summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Norbye <tnorbye@google.com>2014-07-25 20:12:40 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2014-07-24 20:55:36 +0000
commit6044be7330c93bc8dacb0f63e62da8029f39a16f (patch)
tree0ba72f5de1949e0527874a799baa224cbe1537e0
parentb03a5855292feb8c331815f883fe64372aacd872 (diff)
parente5266e2343c8d275d79fa0be725180d0fe3a993c (diff)
downloadidea-6044be7330c93bc8dacb0f63e62da8029f39a16f.tar.gz
Merge "Merge remote-tracking branch 'aosp/upstream-master' into merge"
-rw-r--r--.idea/libraries/Eclipse.xml4
-rw-r--r--.idea/libraries/JavaHelp.xml2
-rw-r--r--.idea/modules.xml8
-rw-r--r--bin/WinLauncher/WinLauncher.exebin822272 -> 822784 bytes
-rw-r--r--bin/WinLauncher/WinLauncher64.exebin838656 -> 839168 bytes
-rwxr-xr-xbin/mac/printenv.py5
-rw-r--r--bin/win/fsnotifier.exebin71208 -> 98920 bytes
-rw-r--r--build/conf/nsis/desktop.ini74
-rw-r--r--build/conf/nsis/idea.nsi147
-rw-r--r--build/gant.xml6
-rw-r--r--build/lib/jps/jps-builders.jarbin1500322 -> 1500478 bytes
-rw-r--r--build/scripts/layouts.gant14
-rw-r--r--build/scripts/utils.gant9
-rw-r--r--build/update.cmd30
-rw-r--r--community-resources/src/idea_community_about.pngbin80521 -> 62151 bytes
-rw-r--r--community-resources/src/idea_community_about@2x.pngbin233223 -> 214572 bytes
-rw-r--r--community-tests/src/tests/testGroups.properties1
-rw-r--r--images/src/META-INF/ImagesPlugin.xml2
-rw-r--r--images/src/org/intellij/images/thumbnail/impl/ThumbnailViewUI.java2
-rw-r--r--java/compiler/impl/src/com/intellij/compiler/CompilerManagerImpl.java4
-rw-r--r--java/compiler/impl/src/com/intellij/compiler/ant/GenerateAntApplication.java2
-rw-r--r--java/compiler/impl/src/com/intellij/compiler/impl/CompileDriver.java11
-rw-r--r--java/compiler/impl/src/com/intellij/compiler/impl/CompilerUtil.java180
-rw-r--r--java/compiler/impl/src/com/intellij/compiler/impl/InternedPath.java79
-rw-r--r--java/compiler/impl/src/com/intellij/compiler/impl/OutputPathFinder.java219
-rw-r--r--java/compiler/impl/src/com/intellij/compiler/impl/PackagingCompilerAdapter.java34
-rw-r--r--java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/ModuleChunk.java343
-rw-r--r--java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/eclipse/EclipseSettingsBuilder.java47
-rw-r--r--java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/javac/JavacSettingsBuilder.java92
-rw-r--r--java/compiler/impl/src/com/intellij/compiler/impl/packagingCompiler/BuildInstructionBase.java72
-rw-r--r--java/compiler/impl/src/com/intellij/compiler/impl/packagingCompiler/DependentJarsEvaluator.java44
-rw-r--r--java/compiler/impl/src/com/intellij/compiler/impl/packagingCompiler/DestinationInfo.java60
-rw-r--r--java/compiler/impl/src/com/intellij/compiler/impl/packagingCompiler/ExplodedDestinationInfo.java33
-rw-r--r--java/compiler/impl/src/com/intellij/compiler/impl/packagingCompiler/FileCopyInstructionImpl.java76
-rw-r--r--java/compiler/impl/src/com/intellij/compiler/impl/packagingCompiler/JarDestinationInfo.java55
-rw-r--r--java/compiler/impl/src/com/intellij/compiler/impl/packagingCompiler/JarInfo.java77
-rw-r--r--java/compiler/impl/src/com/intellij/compiler/impl/packagingCompiler/JarsBuilder.java283
-rw-r--r--java/compiler/impl/src/com/intellij/compiler/progress/CompilerTask.java3
-rw-r--r--java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java15
-rw-r--r--java/compiler/impl/src/com/intellij/compiler/server/DefaultMessageHandler.java16
-rw-r--r--java/compiler/impl/src/com/intellij/openapi/projectRoots/impl/MockJdkWrapper.java2
-rw-r--r--java/compiler/impl/src/com/intellij/packaging/impl/compiler/ArtifactCompilerCompileItem.java86
-rw-r--r--java/compiler/impl/src/com/intellij/packaging/impl/compiler/ArtifactCompilerUtil.java103
-rw-r--r--java/compiler/impl/src/com/intellij/packaging/impl/compiler/ArtifactPackagingItemExternalizer.java52
-rw-r--r--java/compiler/impl/src/com/intellij/packaging/impl/compiler/ArtifactPackagingItemOutputState.java30
-rw-r--r--java/compiler/instrumentation-util/src/com/intellij/compiler/notNullVerification/NotNullVerifyingInstrumenter.java85
-rw-r--r--java/compiler/openapi/src/com/intellij/openapi/compiler/make/BuildInstruction.java27
-rw-r--r--java/compiler/openapi/src/com/intellij/openapi/compiler/make/BuildInstructionVisitor.java30
-rw-r--r--java/compiler/openapi/src/com/intellij/openapi/compiler/make/BuildParticipant.java33
-rw-r--r--java/compiler/openapi/src/com/intellij/openapi/compiler/make/BuildParticipantProvider.java37
-rw-r--r--java/compiler/openapi/src/com/intellij/openapi/compiler/make/FileCopyInstruction.java30
-rw-r--r--java/debugger/impl/src/com/intellij/debugger/actions/QuickEvaluateActionHandler.java4
-rw-r--r--java/debugger/impl/src/com/intellij/debugger/engine/JavaStackFrame.java40
-rw-r--r--java/debugger/impl/src/com/intellij/debugger/engine/JavaValue.java5
-rw-r--r--java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/MethodEvaluator.java4
-rw-r--r--java/debugger/impl/src/com/intellij/debugger/impl/DebuggerUtilsEx.java20
-rw-r--r--java/debugger/impl/src/com/intellij/debugger/impl/JavaEditorTextProviderImpl.java5
-rw-r--r--java/debugger/impl/src/com/intellij/debugger/jdi/Bytecodes.java152
-rw-r--r--java/debugger/impl/src/com/intellij/debugger/jdi/InstructionParser.java3
-rw-r--r--java/debugger/impl/src/com/intellij/debugger/settings/DebuggerDataViewsConfigurable.java68
-rw-r--r--java/debugger/impl/src/com/intellij/debugger/settings/DebuggerLaunchingConfigurable.java38
-rw-r--r--java/debugger/impl/src/com/intellij/debugger/settings/DebuggerSettings.java105
-rw-r--r--java/debugger/impl/src/com/intellij/debugger/settings/DebuggerSteppingConfigurable.java15
-rw-r--r--java/debugger/impl/src/com/intellij/debugger/settings/JavaDebuggerSettings.java66
-rw-r--r--java/debugger/impl/src/com/intellij/debugger/settings/ViewsGeneralSettings.java9
-rw-r--r--java/debugger/impl/src/com/intellij/debugger/ui/DebuggerSessionTab.java3
-rw-r--r--java/debugger/impl/src/com/intellij/debugger/ui/JavaDebuggerSupport.java14
-rw-r--r--java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointWithHighlighter.java7
-rw-r--r--java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/JavaExceptionBreakpointType.java12
-rw-r--r--java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/JavaFieldBreakpointType.java12
-rw-r--r--java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/JavaLineBreakpointType.java12
-rw-r--r--java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/JavaMethodBreakpointType.java12
-rw-r--r--java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/JavaWildcardMethodBreakpointType.java12
-rw-r--r--java/debugger/impl/src/com/intellij/debugger/ui/impl/FrameVariablesTree.java7
-rw-r--r--java/debugger/impl/src/com/intellij/debugger/ui/impl/TipManager.java15
-rw-r--r--java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/DebuggerTree.java3
-rw-r--r--java/debugger/impl/src/com/intellij/debugger/ui/tree/render/BatchEvaluator.java3
-rw-r--r--java/debugger/impl/src/com/intellij/debugger/ui/tree/render/ClassRenderer.java17
-rw-r--r--java/debugger/impl/src/com/intellij/debugger/ui/tree/render/ToStringRenderer.java16
-rw-r--r--java/debugger/impl/src/org/jetbrains/java/debugger/breakpoints/properties/JavaBreakpointProperties.java13
-rw-r--r--java/execution/impl/src/com/intellij/execution/application/ApplicationConfigurable.java9
-rw-r--r--java/execution/impl/src/com/intellij/execution/remote/RemoteConfiguration.java11
-rw-r--r--java/idea-ui/src/com/intellij/ide/actions/ShowStructureSettingsAction.java3
-rw-r--r--java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/ErrorPaneConfigurable.java217
-rw-r--r--java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/ProjectStructureConfigurable.java27
-rw-r--r--java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/SidePanel.java152
-rw-r--r--java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/daemon/LibraryProjectStructureElement.java17
-rw-r--r--java/idea-ui/src/com/intellij/platform/templates/SaveProjectAsTemplateAction.java10
-rw-r--r--java/java-analysis-impl/java-analysis-impl.iml1
-rw-r--r--java/java-analysis-impl/src/com/intellij/codeInsight/InferredAnnotationsManagerImpl.java83
-rw-r--r--java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/AddTypeCastFix.java2
-rw-r--r--java/java-analysis-impl/src/com/intellij/codeInsight/intention/AddAnnotationPsiFix.java13
-rw-r--r--java/java-analysis-impl/src/com/intellij/codeInspection/AnonymousCanBeLambdaInspection.java35
-rw-r--r--java/java-analysis-impl/src/com/intellij/codeInspection/AnonymousCanBeMethodReferenceInspection.java2
-rw-r--r--java/java-analysis-impl/src/com/intellij/codeInspection/LambdaCanBeMethodReferenceInspection.java11
-rw-r--r--java/java-analysis-impl/src/com/intellij/codeInspection/bytecodeAnalysis/Analysis.java398
-rw-r--r--java/java-analysis-impl/src/com/intellij/codeInspection/bytecodeAnalysis/BytecodeAnalysisConverter.java485
-rw-r--r--java/java-analysis-impl/src/com/intellij/codeInspection/bytecodeAnalysis/BytecodeAnalysisIndex.java167
-rw-r--r--java/java-analysis-impl/src/com/intellij/codeInspection/bytecodeAnalysis/ClassDataIndexer.java264
-rw-r--r--java/java-analysis-impl/src/com/intellij/codeInspection/bytecodeAnalysis/Contracts.java439
-rw-r--r--java/java-analysis-impl/src/com/intellij/codeInspection/bytecodeAnalysis/ControlFlow.java1030
-rw-r--r--java/java-analysis-impl/src/com/intellij/codeInspection/bytecodeAnalysis/Data.java226
-rw-r--r--java/java-analysis-impl/src/com/intellij/codeInspection/bytecodeAnalysis/Parameters.java390
-rw-r--r--java/java-analysis-impl/src/com/intellij/codeInspection/bytecodeAnalysis/ProjectBytecodeAnalysis.java291
-rw-r--r--java/java-analysis-impl/src/com/intellij/codeInspection/bytecodeAnalysis/Solver.java440
-rw-r--r--java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/ContractInference.java77
-rw-r--r--java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/ControlFlowAnalyzer.java185
-rw-r--r--java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DataFlowInspectionBase.java36
-rw-r--r--java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DfaPsiUtil.java35
-rw-r--r--java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/HardcodedContracts.java133
-rw-r--r--java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/MethodContract.java3
-rw-r--r--java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/StandardInstructionVisitor.java77
-rw-r--r--java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/value/DfaExpressionFactory.java170
-rw-r--r--java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/value/DfaValueFactory.java46
-rw-r--r--java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/value/DfaVariableValue.java2
-rw-r--r--java/java-analysis-impl/src/com/intellij/codeInspection/inheritance/search/InheritorsStatisticalDataSearch.java34
-rw-r--r--java/java-analysis-impl/src/com/intellij/codeInspection/nullable/NullableStuffInspectionBase.java87
-rw-r--r--java/java-analysis-impl/src/com/intellij/codeInspection/unusedLibraries/UnusedLibrariesInspection.java14
-rw-r--r--java/java-analysis-impl/src/com/intellij/codeInspection/varScopeCanBeNarrowed/FieldCanBeLocalInspectionBase.java21
-rw-r--r--java/java-analysis-impl/src/com/intellij/refactoring/extractMethod/ExtractMethodUtil.java147
-rw-r--r--java/java-impl/src/com/intellij/codeInsight/ExternalAnnotationsLineMarkerProvider.java58
-rw-r--r--java/java-impl/src/com/intellij/codeInsight/completion/JavaChainLookupElement.java6
-rw-r--r--java/java-impl/src/com/intellij/codeInsight/completion/JavaClassNameInsertHandler.java3
-rw-r--r--java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionContributor.java39
-rw-r--r--java/java-impl/src/com/intellij/codeInsight/completion/JavaMethodMergingContributor.java43
-rw-r--r--java/java-impl/src/com/intellij/codeInsight/completion/JavaNoVariantsDelegator.java2
-rw-r--r--java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateAbstractMethodFromUsageFix.java2
-rw-r--r--java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateFieldFromUsageFix.java16
-rw-r--r--java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateFromUsageBaseFix.java3
-rw-r--r--java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateMethodFromUsageFix.java19
-rw-r--r--java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ImportClassFix.java14
-rw-r--r--java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ImportClassFixBase.java13
-rw-r--r--java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/JavaSmartEnterProcessor.java54
-rw-r--r--java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/PlainEnterProcessor.java42
-rw-r--r--java/java-impl/src/com/intellij/codeInsight/folding/impl/JavaFoldingBuilder.java3
-rw-r--r--java/java-impl/src/com/intellij/codeInsight/generation/GenerateDelegateHandler.java11
-rw-r--r--java/java-impl/src/com/intellij/codeInsight/generation/OverrideImplementUtil.java10
-rw-r--r--java/java-impl/src/com/intellij/codeInsight/hint/api/impls/MethodParameterInfoHandler.java11
-rw-r--r--java/java-impl/src/com/intellij/codeInsight/template/impl/ShortenToStaticImportProcessor.java13
-rw-r--r--java/java-impl/src/com/intellij/codeInsight/unwrap/JavaMethodParameterUnwrapper.java12
-rw-r--r--java/java-impl/src/com/intellij/ide/projectView/impl/nodes/PackageUtil.java12
-rw-r--r--java/java-impl/src/com/intellij/ide/util/PackageUtil.java28
-rw-r--r--java/java-impl/src/com/intellij/openapi/roots/impl/JavaLanguageLevelPusher.java4
-rw-r--r--java/java-impl/src/com/intellij/psi/formatter/java/JavaSpacePropertyProcessor.java16
-rw-r--r--java/java-impl/src/com/intellij/psi/impl/JavaCodeBlockModificationListener.java4
-rw-r--r--java/java-impl/src/com/intellij/psi/impl/JavaDirectoryIconProvider.java5
-rw-r--r--java/java-impl/src/com/intellij/psi/impl/JavaPsiImplementationHelperImpl.java2
-rw-r--r--java/java-impl/src/com/intellij/psi/impl/source/codeStyle/javadoc/JDParser.java10
-rw-r--r--java/java-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/JavaCharsetReferenceContributor.java52
-rw-r--r--java/java-impl/src/com/intellij/psi/util/proximity/KnownElementWeigher.java31
-rw-r--r--java/java-impl/src/com/intellij/refactoring/changeSignature/JavaChangeSignatureUsageProcessor.java5
-rw-r--r--java/java-impl/src/com/intellij/refactoring/extractMethod/ExtractMethodUtil.java146
-rw-r--r--java/java-impl/src/com/intellij/refactoring/inline/InlineMethodProcessor.java2
-rw-r--r--java/java-impl/src/com/intellij/refactoring/introduceField/BaseExpressionToFieldHandler.java3
-rw-r--r--java/java-impl/src/com/intellij/refactoring/introduceField/InplaceIntroduceConstantPopup.java5
-rw-r--r--java/java-impl/src/com/intellij/refactoring/introduceField/InplaceIntroduceFieldPopup.java9
-rw-r--r--java/java-impl/src/com/intellij/refactoring/introduceParameter/IntroduceParameterProcessor.java9
-rw-r--r--java/java-impl/src/com/intellij/refactoring/introduceVariable/IntroduceVariableBase.java21
-rw-r--r--java/java-impl/src/com/intellij/refactoring/memberPullUp/JavaPullUpHelper.java16
-rw-r--r--java/java-impl/src/com/intellij/refactoring/memberPullUp/PullUpDialog.java2
-rw-r--r--java/java-impl/src/com/intellij/refactoring/move/moveClassesOrPackages/AutocreatingSingleSourceRootMoveDestination.java2
-rw-r--r--java/java-impl/src/com/intellij/refactoring/util/duplicates/DuplicatesImpl.java2
-rw-r--r--java/java-impl/src/com/intellij/spellchecker/LiteralExpressionTokenizer.java11
-rw-r--r--java/java-impl/src/com/intellij/testIntegration/BaseGenerateTestSupportMethodAction.java10
-rw-r--r--java/java-indexing-impl/src/com/intellij/psi/impl/java/stubs/index/JavaAnnotationIndex.java2
-rw-r--r--java/java-indexing-impl/src/com/intellij/psi/impl/java/stubs/index/JavaAnonymousClassBaseRefOccurenceIndex.java2
-rw-r--r--java/java-indexing-impl/src/com/intellij/psi/impl/java/stubs/index/JavaFieldNameIndex.java2
-rw-r--r--java/java-indexing-impl/src/com/intellij/psi/impl/java/stubs/index/JavaFullClassNameIndex.java2
-rw-r--r--java/java-indexing-impl/src/com/intellij/psi/impl/java/stubs/index/JavaMethodNameIndex.java2
-rw-r--r--java/java-indexing-impl/src/com/intellij/psi/impl/java/stubs/index/JavaMethodParameterTypesIndex.java2
-rw-r--r--java/java-indexing-impl/src/com/intellij/psi/impl/java/stubs/index/JavaShortClassNameIndex.java2
-rw-r--r--java/java-indexing-impl/src/com/intellij/psi/impl/java/stubs/index/JavaSuperClassNameOccurenceIndex.java2
-rw-r--r--java/java-psi-api/src/com/intellij/codeInsight/AnnotationUtil.java40
-rw-r--r--java/java-psi-api/src/com/intellij/codeInsight/InferredAnnotationsManager.java40
-rw-r--r--java/java-psi-api/src/com/intellij/codeInsight/NullableNotNullManager.java14
-rw-r--r--java/java-psi-api/src/com/intellij/psi/PsiMethodReferenceUtil.java10
-rw-r--r--java/java-psi-api/src/com/intellij/psi/util/MethodSignatureUtil.java2
-rw-r--r--java/java-psi-api/src/com/intellij/psi/util/PsiFormatUtil.java34
-rw-r--r--java/java-psi-api/src/com/intellij/psi/util/PsiTypesUtil.java1
-rw-r--r--java/java-psi-api/src/com/intellij/psi/util/PsiUtil.java2
-rw-r--r--java/java-psi-impl/src/com/intellij/codeInsight/folding/impl/JavaFoldingBuilderBase.java54
-rw-r--r--java/java-psi-impl/src/com/intellij/codeInsight/folding/impl/ParameterNameFoldingManager.java153
-rw-r--r--java/java-psi-impl/src/com/intellij/codeInsight/javadoc/JavaDocInfoGenerator.java43
-rw-r--r--java/java-psi-impl/src/com/intellij/lang/java/parser/DeclarationParser.java83
-rw-r--r--java/java-psi-impl/src/com/intellij/lang/java/parser/ReferenceParser.java4
-rw-r--r--java/java-psi-impl/src/com/intellij/psi/impl/InheritanceImplUtil.java12
-rw-r--r--java/java-psi-impl/src/com/intellij/psi/impl/JavaConstantExpressionEvaluator.java6
-rw-r--r--java/java-psi-impl/src/com/intellij/psi/impl/compiled/SignatureParsing.java4
-rw-r--r--java/java-psi-impl/src/com/intellij/psi/impl/java/stubs/JavaImportStatementElementType.java6
-rw-r--r--java/java-psi-impl/src/com/intellij/psi/impl/source/JavaLightStubBuilder.java4
-rw-r--r--java/java-psi-impl/src/com/intellij/psi/impl/source/PsiJavaCodeReferenceElementImpl.java12
-rw-r--r--java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/ClassResolverProcessor.java5
-rw-r--r--java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/InferenceSession.java21
-rw-r--r--java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/constraints/PsiMethodReferenceCompatibilityConstraint.java15
-rw-r--r--java/java-psi-impl/src/com/intellij/psi/impl/source/tree/JavaElementType.java2
-rw-r--r--java/java-psi-impl/src/com/intellij/psi/impl/source/tree/JavaSourceUtil.java81
-rw-r--r--java/java-psi-impl/src/com/intellij/psi/impl/source/tree/SourceUtil.java79
-rw-r--r--java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/ExpressionPsiElement.java21
-rw-r--r--java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/MethodElement.java18
-rw-r--r--java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiMethodReferenceExpressionImpl.java8
-rw-r--r--java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiPackageStatementImpl.java4
-rw-r--r--java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiReferenceExpressionImpl.java2
-rw-r--r--java/java-psi-impl/src/com/intellij/psi/scope/conflictResolvers/JavaMethodsConflictResolver.java13
-rw-r--r--java/java-tests/testData/codeInsight/completion/normal/MethodMergingMinimalTail.java7
-rw-r--r--java/java-tests/testData/codeInsight/completion/normal/MethodMergingMinimalTail_after.java7
-rw-r--r--java/java-tests/testData/codeInsight/completion/normal/SmartEnterNoNewLine.java9
-rw-r--r--java/java-tests/testData/codeInsight/completion/normal/SmartEnterNoNewLine_after.java9
-rw-r--r--java/java-tests/testData/codeInsight/completion/normal/SmartEnterWithNewLine.java9
-rw-r--r--java/java-tests/testData/codeInsight/completion/normal/SmartEnterWithNewLine_after.java11
-rw-r--r--java/java-tests/testData/codeInsight/completion/normal/UnimportedStaticInnerClass.java6
-rw-r--r--java/java-tests/testData/codeInsight/completion/normal/UnimportedStaticInnerClass_after.java8
-rw-r--r--java/java-tests/testData/codeInsight/completion/smartType/AutoImportExpectedType.java5
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/annotations/typeAnnotations.java1
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/mostSpecific/IDEA127584.java22
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IDEA127596.java9
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/IDEA126969.java15
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/IDEA127506.java24
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addTypeCast/afterShortenFQNs.java10
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addTypeCast/beforeShortenFQNs.java8
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/anonymous2lambda/beforeObjectInferredButIntExpected.java16
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/convert2Local/afterMultipleMethodsMultipleFields.java17
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/convert2Local/beforeMultipleMethodsMultipleFields.java18
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/convert2Local/beforeMultipleMethodsOnReadOnly.java18
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createFieldFromUsage/beforeInsideInterface.java7
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createMethodFromUsage/afterStaticInInterface.java10
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createMethodFromUsage/beforeStaticInInterface.java6
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/lambda2methodReference/afterAmbiguityWithoutSuperMethods.java11
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/lambda2methodReference/beforeAmbiguityWithoutSuperMethods.java11
-rw-r--r--java/java-tests/testData/codeInsight/javadocIG/annotationsInParams.html2
-rw-r--r--java/java-tests/testData/codeInsight/javadocIG/annotationsInParams.java4
-rw-r--r--java/java-tests/testData/codeInsight/javadocIG/pInsidePre.html6
-rw-r--r--java/java-tests/testData/codeInsight/javadocIG/pInsidePre.java10
-rw-r--r--java/java-tests/testData/codeInsight/nullityinferrer/afterMethodReturnValue.java1
-rw-r--r--java/java-tests/testData/codeInsight/template/postfix/templates/cast/ternary.java5
-rw-r--r--java/java-tests/testData/codeInsight/template/postfix/templates/cast/ternary_after.java5
-rw-r--r--java/java-tests/testData/codeInsight/typing/columnMode_after.java5
-rw-r--r--java/java-tests/testData/codeInsight/typing/columnMode_before.java5
-rw-r--r--java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/awt/annotations.xml345
-rw-r--r--java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/awt/event/annotations.xml5
-rw-r--r--java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/beans/beancontext/annotations.xml79
-rw-r--r--java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/io/annotations.xml395
-rw-r--r--java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/lang/annotation/annotations.xml5
-rw-r--r--java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/lang/annotations.xml1347
-rw-r--r--java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/lang/invoke/annotations.xml1872
-rw-r--r--java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/net/annotations.xml422
-rw-r--r--java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/security/annotations.xml132
-rw-r--r--java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/sql/annotations.xml78
-rw-r--r--java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/util/annotations.xml1533
-rw-r--r--java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/util/concurrent/annotations.xml5
-rw-r--r--java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/util/concurrent/atomic/annotations.xml98
-rw-r--r--java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/util/concurrent/locks/annotations.xml134
-rw-r--r--java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/javax/swing/annotations.xml527
-rw-r--r--java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/collections/annotations.xml40
-rw-r--r--java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/collections/map/annotations.xml161
-rw-r--r--java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/lang/annotations.xml1581
-rw-r--r--java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/lang/builder/annotations.xml574
-rw-r--r--java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/lang/enum/annotations.xml50
-rw-r--r--java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/lang/enums/annotations.xml50
-rw-r--r--java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/lang/exception/annotations.xml72
-rw-r--r--java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/lang/math/annotations.xml309
-rw-r--r--java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/lang/mutable/annotations.xml192
-rw-r--r--java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/lang/text/annotations.xml422
-rw-r--r--java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/lang/time/annotations.xml481
-rw-r--r--java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/anakia/annotations.xml108
-rw-r--r--java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/app/annotations.xml29
-rw-r--r--java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/app/event/annotations.xml89
-rw-r--r--java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/app/event/implement/annotations.xml90
-rw-r--r--java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/app/tools/annotations.xml39
-rw-r--r--java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/context/annotations.xml37
-rw-r--r--java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/convert/annotations.xml33
-rw-r--r--java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/exception/annotations.xml17
-rw-r--r--java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/io/annotations.xml8
-rw-r--r--java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/runtime/annotations.xml98
-rw-r--r--java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/runtime/directive/annotations.xml209
-rw-r--r--java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/runtime/log/annotations.xml76
-rw-r--r--java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/runtime/parser/annotations.xml73
-rw-r--r--java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/runtime/parser/node/annotations.xml475
-rw-r--r--java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/runtime/resource/annotations.xml5
-rw-r--r--java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/runtime/resource/loader/annotations.xml102
-rw-r--r--java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/runtime/visitor/annotations.xml245
-rw-r--r--java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/servlet/annotations.xml23
-rw-r--r--java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/texen/annotations.xml14
-rw-r--r--java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/texen/ant/annotations.xml11
-rw-r--r--java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/texen/util/annotations.xml23
-rw-r--r--java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/util/annotations.xml109
-rw-r--r--java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/util/introspection/annotations.xml127
-rw-r--r--java/java-tests/testData/codeInspection/bytecodeAnalysis/src/Example.java43
-rw-r--r--java/java-tests/testData/compiler/notNullVerification/CustomExceptionType.java5
-rw-r--r--java/java-tests/testData/compiler/notNullVerification/annotations.jarbin10899 -> 22366 bytes
-rw-r--r--java/java-tests/testData/inspection/dataFlow/AlexBug/src/Test.java6
-rw-r--r--java/java-tests/testData/inspection/dataFlow/caseAndNpe/expected.xml5
-rw-r--r--java/java-tests/testData/inspection/dataFlow/fixture/AccessingSameArrayElements.java56
-rw-r--r--java/java-tests/testData/inspection/dataFlow/fixture/AssertThat.java18
-rw-r--r--java/java-tests/testData/inspection/dataFlow/fixture/CatchRuntimeException.java2
-rw-r--r--java/java-tests/testData/inspection/dataFlow/fixture/ContractInferenceBewareOverriding.java21
-rw-r--r--java/java-tests/testData/inspection/dataFlow/fixture/FinalFieldDuringSuperInitialization.java20
-rw-r--r--java/java-tests/testData/inspection/dataFlow/fixture/GuavaCheckNotNull.java11
-rw-r--r--java/java-tests/testData/inspection/dataFlow/fixture/NumberComparisonsWhenValueIsKnown.java16
-rw-r--r--java/java-tests/testData/inspection/dataFlow/fixture/ReportConstantReferences.java10
-rw-r--r--java/java-tests/testData/inspection/dataFlow/fixture/ReportConstantReferences_NotInComplexAssignment.java6
-rw-r--r--java/java-tests/testData/inspection/dataFlow/fixture/ReportConstantReferences_OverloadedCall.java14
-rw-r--r--java/java-tests/testData/inspection/dataFlow/fixture/ReportConstantReferences_OverloadedCall_after.java14
-rw-r--r--java/java-tests/testData/inspection/dataFlow/fixture/ReportConstantReferences_ReplaceWithEnum.java7
-rw-r--r--java/java-tests/testData/inspection/dataFlow/fixture/ReportConstantReferences_ReplaceWithEnum_after.java9
-rw-r--r--java/java-tests/testData/inspection/dataFlow/fixture/ReportConstantReferences_ReplaceWithIntConstant.java10
-rw-r--r--java/java-tests/testData/inspection/dataFlow/fixture/ReportConstantReferences_ReplaceWithIntConstant_after.java10
-rw-r--r--java/java-tests/testData/inspection/dataFlow/fixture/ReportConstantReferences_ReplaceWithString.java8
-rw-r--r--java/java-tests/testData/inspection/dataFlow/fixture/ReportConstantReferences_ReplaceWithString_after.java8
-rw-r--r--java/java-tests/testData/inspection/dataFlow/fixture/ReportConstantReferences_Switch.java22
-rw-r--r--java/java-tests/testData/inspection/dataFlow/fixture/ReportConstantReferences_after.java10
-rw-r--r--java/java-tests/testData/inspection/dataFlow/fixture/UseInferredContracts.java15
-rw-r--r--java/java-tests/testData/inspection/nullableProblems/GetterSetterProblems.java4
-rw-r--r--java/java-tests/testData/inspection/nullableProblems/NotNullCustomException.java8
-rw-r--r--java/java-tests/testData/inspection/nullableProblems/NotNullFieldNotInitialized.java9
-rw-r--r--java/java-tests/testData/psi/parser-full/annotationParsing/annotation/Errors.java6
-rw-r--r--java/java-tests/testData/psi/parser-full/annotationParsing/annotation/Errors.txt91
-rw-r--r--java/java-tests/testData/psi/parser-full/annotationParsing/annotation/TypeAnnotations.java6
-rw-r--r--java/java-tests/testData/psi/parser-full/annotationParsing/annotation/TypeAnnotations.txt140
-rw-r--r--java/java-tests/testData/refactoring/inlineMethod/ThisNameConflict.java11
-rw-r--r--java/java-tests/testData/refactoring/inlineMethod/ThisNameConflict.java.after8
-rw-r--r--java/java-tests/testData/refactoring/pullUp/AsDefaultMethodOverAbstract.java12
-rw-r--r--java/java-tests/testData/refactoring/pullUp/AsDefaultMethodOverAbstract_after.java12
-rw-r--r--java/java-tests/testSrc/com/intellij/TestClassesFilterTest.java27
-rw-r--r--java/java-tests/testSrc/com/intellij/codeInsight/JavaTypingTest.java8
-rw-r--r--java/java-tests/testSrc/com/intellij/codeInsight/completion/JavaAutoPopupTest.groovy11
-rw-r--r--java/java-tests/testSrc/com/intellij/codeInsight/completion/NormalCompletionTest.groovy10
-rw-r--r--java/java-tests/testSrc/com/intellij/codeInsight/completion/SmartTypeCompletionOrderingTest.groovy12
-rw-r--r--java/java-tests/testSrc/com/intellij/codeInsight/completion/SmartTypeCompletionTest.java13
-rw-r--r--java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingJdk7Test.java10
-rw-r--r--java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/MostSpecificResolutionTest.java4
-rw-r--r--java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/NewLambdaHighlightingTest.java262
-rw-r--r--java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/NewMethodRefHighlightingTest.java8
-rw-r--r--java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/CreateFieldFromUsageTest.java1
-rw-r--r--java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/RenameWrongReferenceTest.java16
-rw-r--r--java/java-tests/testSrc/com/intellij/codeInsight/folding/JavaFoldingTest.groovy85
-rw-r--r--java/java-tests/testSrc/com/intellij/codeInsight/intention/AddImportActionTest.groovy60
-rw-r--r--java/java-tests/testSrc/com/intellij/codeInsight/javadoc/JavaDocInfoGeneratorTest.java8
-rw-r--r--java/java-tests/testSrc/com/intellij/codeInsight/template/LiveTemplateTest.groovy26
-rw-r--r--java/java-tests/testSrc/com/intellij/codeInsight/template/postfix/templates/CastPostfixTemplateTest.java3
-rw-r--r--java/java-tests/testSrc/com/intellij/codeInspection/ContractInferenceFromSourceTest.groovy64
-rw-r--r--java/java-tests/testSrc/com/intellij/codeInspection/DataFlowInspectionTest.java61
-rw-r--r--java/java-tests/testSrc/com/intellij/codeInspection/NullableStuffInspectionTest.java2
-rw-r--r--java/java-tests/testSrc/com/intellij/codeInspection/bytecodeAnalysis/BytecodeAnalysisIntegrationTest.java177
-rw-r--r--java/java-tests/testSrc/com/intellij/codeInspection/bytecodeAnalysis/BytecodeAnalysisResultsHighlightingTest.java67
-rw-r--r--java/java-tests/testSrc/com/intellij/codeInspection/bytecodeAnalysis/BytecodeAnalysisTest.java209
-rw-r--r--java/java-tests/testSrc/com/intellij/codeInspection/bytecodeAnalysis/ExpectContract.java30
-rw-r--r--java/java-tests/testSrc/com/intellij/codeInspection/bytecodeAnalysis/ExpectLeaking.java26
-rw-r--r--java/java-tests/testSrc/com/intellij/codeInspection/bytecodeAnalysis/ExpectNoPsiKey.java26
-rw-r--r--java/java-tests/testSrc/com/intellij/codeInspection/bytecodeAnalysis/ExpectNotNull.java26
-rw-r--r--java/java-tests/testSrc/com/intellij/codeInspection/bytecodeAnalysis/data/LeakingParametersData.java43
-rw-r--r--java/java-tests/testSrc/com/intellij/codeInspection/bytecodeAnalysis/data/Test01.java78
-rw-r--r--java/java-tests/testSrc/com/intellij/codeInspection/bytecodeAnalysis/data/Test02.java33
-rw-r--r--java/java-tests/testSrc/com/intellij/codeInspection/bytecodeAnalysis/data/Test03.java34
-rw-r--r--java/java-tests/testSrc/com/intellij/codeInspection/bytecodeAnalysis/data/TestAnnotation.java26
-rw-r--r--java/java-tests/testSrc/com/intellij/codeInspection/bytecodeAnalysis/data/TestConverterData.java81
-rw-r--r--java/java-tests/testSrc/com/intellij/compiler/notNullVerification/NotNullVerifyingInstrumenterTest.java27
-rw-r--r--java/java-tests/testSrc/com/intellij/find/FindInEditorMultiCaretTest.java222
-rw-r--r--java/java-tests/testSrc/com/intellij/find/FindInEditorTest.java13
-rw-r--r--java/java-tests/testSrc/com/intellij/openapi/roots/impl/DirectoryIndexTest.java223
-rw-r--r--java/java-tests/testSrc/com/intellij/psi/CodeFragmentsTest.java15
-rw-r--r--java/java-tests/testSrc/com/intellij/psi/formatter/java/JavaFormatterBlankLinesTest.java32
-rw-r--r--java/java-tests/testSrc/com/intellij/refactoring/PullUpTest.java3
-rw-r--r--java/java-tests/testSrc/com/intellij/refactoring/inline/InlineMethodTest.java4
-rw-r--r--java/jdkAnnotations/java/text/annotations.xml12
-rw-r--r--java/mockJDK-1.7/jre/lib/annotations.jarbin22215 -> 22366 bytes
-rw-r--r--java/openapi/src/com/intellij/ui/classFilter/ClassFilter.java16
-rw-r--r--java/openapi/src/com/intellij/ui/classFilter/ClassFilterEditor.java2
-rw-r--r--java/remote-servers/impl/remote-servers-java-impl.iml2
-rw-r--r--java/remote-servers/impl/src/META-INF/RemoteServersJava.xml7
-rw-r--r--java/remote-servers/impl/src/com/intellij/remoteServer/impl/module/CloudApplicationConfigurable.java166
-rw-r--r--java/remote-servers/impl/src/com/intellij/remoteServer/impl/module/CloudApplicationConfiguration.java36
-rw-r--r--java/remote-servers/impl/src/com/intellij/remoteServer/impl/module/CloudModuleBuilder.java114
-rw-r--r--java/remote-servers/impl/src/com/intellij/remoteServer/impl/module/CloudModuleBuilderContribution.java48
-rw-r--r--java/remote-servers/impl/src/com/intellij/remoteServer/impl/module/CloudModuleBuilderContributionBase.java142
-rw-r--r--java/remote-servers/impl/src/com/intellij/remoteServer/impl/module/CloudModuleWizardStep.form50
-rw-r--r--java/remote-servers/impl/src/com/intellij/remoteServer/impl/module/CloudModuleWizardStep.java130
-rw-r--r--java/structuralsearch-java/src/META-INF/structuralsearch-java.xml6
-rw-r--r--java/structuralsearch-java/src/com/intellij/structuralsearch/JavaPredefinedConfigurations.java (renamed from plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/JavaPredefinedConfigurations.java)0
-rw-r--r--java/structuralsearch-java/src/com/intellij/structuralsearch/JavaReplaceHandler.java557
-rw-r--r--java/structuralsearch-java/src/com/intellij/structuralsearch/JavaStructuralSearchProfile.java661
-rw-r--r--java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/JavaCompiledPattern.java (renamed from plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/JavaCompiledPattern.java)0
-rw-r--r--java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/JavaMatchPredicateProvider.java (renamed from plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/JavaMatchPredicateProvider.java)0
-rw-r--r--java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/JavaMatchingVisitor.java1637
-rw-r--r--java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/compiler/JavaCompilingVisitor.java (renamed from plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/compiler/JavaCompilingVisitor.java)0
-rw-r--r--java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/BlockFilter.java (renamed from plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/BlockFilter.java)0
-rw-r--r--java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/ClassFilter.java (renamed from plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/ClassFilter.java)0
-rw-r--r--java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/CommentFilter.java (renamed from plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/CommentFilter.java)0
-rw-r--r--java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/ConstantFilter.java (renamed from plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/ConstantFilter.java)0
-rw-r--r--java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/DeclarationFilter.java (renamed from plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/DeclarationFilter.java)0
-rw-r--r--java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/ExpressionFilter.java (renamed from plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/ExpressionFilter.java)0
-rw-r--r--java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/JavaDocFilter.java (renamed from plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/JavaDocFilter.java)0
-rw-r--r--java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/JavaLexicalNodesFilter.java (renamed from plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/JavaLexicalNodesFilter.java)0
-rw-r--r--java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/MethodFilter.java (renamed from plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/MethodFilter.java)0
-rw-r--r--java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/StatementFilter.java (renamed from plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/StatementFilter.java)0
-rw-r--r--java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/SymbolNodeFilter.java (renamed from plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/SymbolNodeFilter.java)0
-rw-r--r--java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/TypeFilter.java (renamed from plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/TypeFilter.java)0
-rw-r--r--java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/TypeParameterFilter.java (renamed from plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/TypeParameterFilter.java)0
-rw-r--r--java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/TypedSymbolNodeFilter.java (renamed from plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/TypedSymbolNodeFilter.java)0
-rw-r--r--java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/VariableFilter.java (renamed from plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/VariableFilter.java)0
-rw-r--r--java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/handlers/DeclarationStatementHandler.java (renamed from plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/handlers/DeclarationStatementHandler.java)0
-rw-r--r--java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/handlers/DocDataHandler.java (renamed from plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/handlers/DocDataHandler.java)0
-rw-r--r--java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/handlers/ExpressionHandler.java (renamed from plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/handlers/ExpressionHandler.java)0
-rw-r--r--java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/handlers/StatementHandler.java (renamed from plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/handlers/StatementHandler.java)0
-rw-r--r--java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/iterators/DocValuesIterator.java (renamed from plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/iterators/DocValuesIterator.java)0
-rw-r--r--java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/iterators/HierarchyNodeIterator.java (renamed from plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/iterators/HierarchyNodeIterator.java)0
-rw-r--r--java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/predicates/ExprTypePredicate.java (renamed from plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/predicates/ExprTypePredicate.java)0
-rw-r--r--java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/predicates/FormalArgTypePredicate.java (renamed from plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/predicates/FormalArgTypePredicate.java)0
-rw-r--r--java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/predicates/ReadPredicate.java (renamed from plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/predicates/ReadPredicate.java)0
-rw-r--r--java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/predicates/WritePredicate.java (renamed from plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/predicates/WritePredicate.java)0
-rw-r--r--java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/strategies/CommentMatchingStrategy.java (renamed from plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/strategies/CommentMatchingStrategy.java)0
-rw-r--r--java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/strategies/ExprMatchingStrategy.java (renamed from plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/strategies/ExprMatchingStrategy.java)0
-rw-r--r--java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/strategies/JavaDocMatchingStrategy.java (renamed from plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/strategies/JavaDocMatchingStrategy.java)0
-rw-r--r--java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/strategies/MatchingStrategyBase.java (renamed from plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/strategies/MatchingStrategyBase.java)0
-rw-r--r--java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/strategies/SymbolMatchingStrategy.java (renamed from plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/strategies/SymbolMatchingStrategy.java)0
-rw-r--r--java/structuralsearch-java/structuralsearch-java.iml (renamed from plugins/structuralsearch/structuralsearch-java/structuralsearch-java.iml)0
-rw-r--r--java/testFramework/src/com/intellij/codeInsight/CodeInsightTestCaseUtil.java6
-rw-r--r--java/typeMigration/src/META-INF/TypeMigration.xml23
-rw-r--r--java/typeMigration/src/com/intellij/refactoring/typeMigration/TypeConversionDescriptor.java (renamed from plugins/typeMigration/src/com/intellij/refactoring/typeMigration/TypeConversionDescriptor.java)0
-rw-r--r--java/typeMigration/src/com/intellij/refactoring/typeMigration/TypeMigrationVariableTypeFixProvider.java (renamed from plugins/typeMigration/src/com/intellij/refactoring/typeMigration/TypeMigrationVariableTypeFixProvider.java)0
-rw-r--r--java/typeMigration/src/com/intellij/refactoring/typeMigration/intentions/ChangeClassParametersIntention.java (renamed from plugins/typeMigration/src/com/intellij/refactoring/typeMigration/intentions/ChangeClassParametersIntention.java)0
-rw-r--r--java/typeMigration/src/com/intellij/refactoring/typeMigration/intentions/ConvertFieldToAtomicIntention.java (renamed from plugins/typeMigration/src/com/intellij/refactoring/typeMigration/intentions/ConvertFieldToAtomicIntention.java)0
-rw-r--r--java/typeMigration/src/com/intellij/refactoring/typeMigration/intentions/ConvertFieldToThreadLocalIntention.java (renamed from plugins/typeMigration/src/com/intellij/refactoring/typeMigration/intentions/ConvertFieldToThreadLocalIntention.java)0
-rw-r--r--java/typeMigration/src/com/intellij/refactoring/typeMigration/rules/AtomicConversionRule.java (renamed from plugins/typeMigration/src/com/intellij/refactoring/typeMigration/rules/AtomicConversionRule.java)0
-rw-r--r--java/typeMigration/src/com/intellij/refactoring/typeMigration/rules/BoxingTypeConversionRule.java (renamed from plugins/typeMigration/src/com/intellij/refactoring/typeMigration/rules/BoxingTypeConversionRule.java)0
-rw-r--r--java/typeMigration/src/com/intellij/refactoring/typeMigration/rules/ElementToArrayConversionRule.java (renamed from plugins/typeMigration/src/com/intellij/refactoring/typeMigration/rules/ElementToArrayConversionRule.java)0
-rw-r--r--java/typeMigration/src/com/intellij/refactoring/typeMigration/rules/ListArrayConversionRule.java (renamed from plugins/typeMigration/src/com/intellij/refactoring/typeMigration/rules/ListArrayConversionRule.java)0
-rw-r--r--java/typeMigration/src/com/intellij/refactoring/typeMigration/rules/ThreadLocalConversionRule.java (renamed from plugins/typeMigration/src/com/intellij/refactoring/typeMigration/rules/ThreadLocalConversionRule.java)0
-rw-r--r--java/typeMigration/src/intentionDescriptions/ChangeClassParametersIntention/after.java.template (renamed from plugins/typeMigration/src/intentionDescriptions/ChangeClassParametersIntention/after.java.template)0
-rw-r--r--java/typeMigration/src/intentionDescriptions/ChangeClassParametersIntention/before.java.template (renamed from plugins/typeMigration/src/intentionDescriptions/ChangeClassParametersIntention/before.java.template)0
-rw-r--r--java/typeMigration/src/intentionDescriptions/ChangeClassParametersIntention/description.html (renamed from plugins/typeMigration/src/intentionDescriptions/ChangeClassParametersIntention/description.html)0
-rw-r--r--java/typeMigration/src/intentionDescriptions/ConvertFieldToAtomicIntention/after.java.template (renamed from plugins/typeMigration/src/intentionDescriptions/ConvertFieldToAtomicIntention/after.java.template)0
-rw-r--r--java/typeMigration/src/intentionDescriptions/ConvertFieldToAtomicIntention/before.java.template (renamed from plugins/typeMigration/src/intentionDescriptions/ConvertFieldToAtomicIntention/before.java.template)0
-rw-r--r--java/typeMigration/src/intentionDescriptions/ConvertFieldToAtomicIntention/description.html (renamed from plugins/typeMigration/src/intentionDescriptions/ConvertFieldToAtomicIntention/description.html)0
-rw-r--r--java/typeMigration/src/intentionDescriptions/ConvertFieldToThreadLocalIntention/after.java.template (renamed from plugins/typeMigration/src/intentionDescriptions/ConvertFieldToThreadLocalIntention/after.java.template)0
-rw-r--r--java/typeMigration/src/intentionDescriptions/ConvertFieldToThreadLocalIntention/before.java.template (renamed from plugins/typeMigration/src/intentionDescriptions/ConvertFieldToThreadLocalIntention/before.java.template)0
-rw-r--r--java/typeMigration/src/intentionDescriptions/ConvertFieldToThreadLocalIntention/description.html (renamed from plugins/typeMigration/src/intentionDescriptions/ConvertFieldToThreadLocalIntention/description.html)0
-rw-r--r--java/typeMigration/test/com/intellij/codeInsight/ConvertToAtomicIntentionTest.java30
-rw-r--r--java/typeMigration/test/com/intellij/codeInsight/ConvertToThreadLocalIntentionTest.java30
-rw-r--r--java/typeMigration/test/com/intellij/refactoring/AllTypeMigrationTests.java (renamed from plugins/typeMigration/test/com/intellij/refactoring/AllTypeMigrationTests.java)0
-rw-r--r--java/typeMigration/test/com/intellij/refactoring/ChangeTypeSignatureTest.java148
-rw-r--r--java/typeMigration/test/com/intellij/refactoring/MigrateTypeSignatureTest.java (renamed from plugins/typeMigration/test/com/intellij/refactoring/MigrateTypeSignatureTest.java)0
-rw-r--r--java/typeMigration/test/com/intellij/refactoring/TypeMigrationByAtomicRuleTest.java (renamed from plugins/typeMigration/test/com/intellij/refactoring/TypeMigrationByAtomicRuleTest.java)0
-rw-r--r--java/typeMigration/test/com/intellij/refactoring/TypeMigrationByThreadLocalRuleTest.java (renamed from plugins/typeMigration/test/com/intellij/refactoring/TypeMigrationByThreadLocalRuleTest.java)0
-rw-r--r--java/typeMigration/test/com/intellij/refactoring/TypeMigrationTest.java (renamed from plugins/typeMigration/test/com/intellij/refactoring/TypeMigrationTest.java)0
-rw-r--r--java/typeMigration/test/com/intellij/refactoring/TypeMigrationTestBase.java193
-rw-r--r--java/typeMigration/test/com/intellij/refactoring/WildcardTypeMigrationTest.java (renamed from plugins/typeMigration/test/com/intellij/refactoring/WildcardTypeMigrationTest.java)0
-rw-r--r--java/typeMigration/testData/intentions/atomic/after1.java (renamed from plugins/typeMigration/testData/intentions/atomic/after1.java)0
-rw-r--r--java/typeMigration/testData/intentions/atomic/after10.java (renamed from plugins/typeMigration/testData/intentions/atomic/after10.java)0
-rw-r--r--java/typeMigration/testData/intentions/atomic/after12.java (renamed from plugins/typeMigration/testData/intentions/atomic/after12.java)0
-rw-r--r--java/typeMigration/testData/intentions/atomic/after13.java (renamed from plugins/typeMigration/testData/intentions/atomic/after13.java)0
-rw-r--r--java/typeMigration/testData/intentions/atomic/after14.java (renamed from plugins/typeMigration/testData/intentions/atomic/after14.java)0
-rw-r--r--java/typeMigration/testData/intentions/atomic/after2.java (renamed from plugins/typeMigration/testData/intentions/atomic/after2.java)0
-rw-r--r--java/typeMigration/testData/intentions/atomic/after3.java (renamed from plugins/typeMigration/testData/intentions/atomic/after3.java)0
-rw-r--r--java/typeMigration/testData/intentions/atomic/after4.java (renamed from plugins/typeMigration/testData/intentions/atomic/after4.java)0
-rw-r--r--java/typeMigration/testData/intentions/atomic/after5.java (renamed from plugins/typeMigration/testData/intentions/atomic/after5.java)0
-rw-r--r--java/typeMigration/testData/intentions/atomic/after6.java (renamed from plugins/typeMigration/testData/intentions/atomic/after6.java)0
-rw-r--r--java/typeMigration/testData/intentions/atomic/after7.java (renamed from plugins/typeMigration/testData/intentions/atomic/after7.java)0
-rw-r--r--java/typeMigration/testData/intentions/atomic/after8.java (renamed from plugins/typeMigration/testData/intentions/atomic/after8.java)0
-rw-r--r--java/typeMigration/testData/intentions/atomic/after9.java (renamed from plugins/typeMigration/testData/intentions/atomic/after9.java)0
-rw-r--r--java/typeMigration/testData/intentions/atomic/afterExcl.java (renamed from plugins/typeMigration/testData/intentions/atomic/afterExcl.java)0
-rw-r--r--java/typeMigration/testData/intentions/atomic/afterTA1.java (renamed from plugins/typeMigration/testData/intentions/atomic/afterTA1.java)0
-rw-r--r--java/typeMigration/testData/intentions/atomic/before1.java (renamed from plugins/typeMigration/testData/intentions/atomic/before1.java)0
-rw-r--r--java/typeMigration/testData/intentions/atomic/before10.java (renamed from plugins/typeMigration/testData/intentions/atomic/before10.java)0
-rw-r--r--java/typeMigration/testData/intentions/atomic/before11.java (renamed from plugins/typeMigration/testData/intentions/atomic/before11.java)0
-rw-r--r--java/typeMigration/testData/intentions/atomic/before12.java (renamed from plugins/typeMigration/testData/intentions/atomic/before12.java)0
-rw-r--r--java/typeMigration/testData/intentions/atomic/before13.java (renamed from plugins/typeMigration/testData/intentions/atomic/before13.java)0
-rw-r--r--java/typeMigration/testData/intentions/atomic/before14.java (renamed from plugins/typeMigration/testData/intentions/atomic/before14.java)0
-rw-r--r--java/typeMigration/testData/intentions/atomic/before2.java (renamed from plugins/typeMigration/testData/intentions/atomic/before2.java)0
-rw-r--r--java/typeMigration/testData/intentions/atomic/before3.java (renamed from plugins/typeMigration/testData/intentions/atomic/before3.java)0
-rw-r--r--java/typeMigration/testData/intentions/atomic/before4.java (renamed from plugins/typeMigration/testData/intentions/atomic/before4.java)0
-rw-r--r--java/typeMigration/testData/intentions/atomic/before5.java (renamed from plugins/typeMigration/testData/intentions/atomic/before5.java)0
-rw-r--r--java/typeMigration/testData/intentions/atomic/before6.java (renamed from plugins/typeMigration/testData/intentions/atomic/before6.java)0
-rw-r--r--java/typeMigration/testData/intentions/atomic/before7.java (renamed from plugins/typeMigration/testData/intentions/atomic/before7.java)0
-rw-r--r--java/typeMigration/testData/intentions/atomic/before8.java (renamed from plugins/typeMigration/testData/intentions/atomic/before8.java)0
-rw-r--r--java/typeMigration/testData/intentions/atomic/before9.java (renamed from plugins/typeMigration/testData/intentions/atomic/before9.java)0
-rw-r--r--java/typeMigration/testData/intentions/atomic/beforeExcl.java (renamed from plugins/typeMigration/testData/intentions/atomic/beforeExcl.java)0
-rw-r--r--java/typeMigration/testData/intentions/atomic/beforeTA1.java (renamed from plugins/typeMigration/testData/intentions/atomic/beforeTA1.java)0
-rw-r--r--java/typeMigration/testData/intentions/threadLocal/after1.java (renamed from plugins/typeMigration/testData/intentions/threadLocal/after1.java)0
-rw-r--r--java/typeMigration/testData/intentions/threadLocal/after2.java (renamed from plugins/typeMigration/testData/intentions/threadLocal/after2.java)0
-rw-r--r--java/typeMigration/testData/intentions/threadLocal/after3.java (renamed from plugins/typeMigration/testData/intentions/threadLocal/after3.java)0
-rw-r--r--java/typeMigration/testData/intentions/threadLocal/after4.java (renamed from plugins/typeMigration/testData/intentions/threadLocal/after4.java)0
-rw-r--r--java/typeMigration/testData/intentions/threadLocal/after5.java (renamed from plugins/typeMigration/testData/intentions/threadLocal/after5.java)0
-rw-r--r--java/typeMigration/testData/intentions/threadLocal/after6.java (renamed from plugins/typeMigration/testData/intentions/threadLocal/after6.java)0
-rw-r--r--java/typeMigration/testData/intentions/threadLocal/after7.java (renamed from plugins/typeMigration/testData/intentions/threadLocal/after7.java)0
-rw-r--r--java/typeMigration/testData/intentions/threadLocal/after8.java (renamed from plugins/typeMigration/testData/intentions/threadLocal/after8.java)0
-rw-r--r--java/typeMigration/testData/intentions/threadLocal/afterTA1.java (renamed from plugins/typeMigration/testData/intentions/threadLocal/afterTA1.java)0
-rw-r--r--java/typeMigration/testData/intentions/threadLocal/before1.java (renamed from plugins/typeMigration/testData/intentions/threadLocal/before1.java)0
-rw-r--r--java/typeMigration/testData/intentions/threadLocal/before2.java (renamed from plugins/typeMigration/testData/intentions/threadLocal/before2.java)0
-rw-r--r--java/typeMigration/testData/intentions/threadLocal/before3.java (renamed from plugins/typeMigration/testData/intentions/threadLocal/before3.java)0
-rw-r--r--java/typeMigration/testData/intentions/threadLocal/before4.java (renamed from plugins/typeMigration/testData/intentions/threadLocal/before4.java)0
-rw-r--r--java/typeMigration/testData/intentions/threadLocal/before5.java (renamed from plugins/typeMigration/testData/intentions/threadLocal/before5.java)0
-rw-r--r--java/typeMigration/testData/intentions/threadLocal/before6.java (renamed from plugins/typeMigration/testData/intentions/threadLocal/before6.java)0
-rw-r--r--java/typeMigration/testData/intentions/threadLocal/before7.java (renamed from plugins/typeMigration/testData/intentions/threadLocal/before7.java)0
-rw-r--r--java/typeMigration/testData/intentions/threadLocal/before8.java (renamed from plugins/typeMigration/testData/intentions/threadLocal/before8.java)0
-rw-r--r--java/typeMigration/testData/intentions/threadLocal/beforeTA1.java (renamed from plugins/typeMigration/testData/intentions/threadLocal/beforeTA1.java)0
-rw-r--r--java/typeMigration/testData/refactoring/changeTypeSignature/CompositeReturnType.java (renamed from plugins/typeMigration/testData/refactoring/changeTypeSignature/CompositeReturnType.java)0
-rw-r--r--java/typeMigration/testData/refactoring/changeTypeSignature/CompositeReturnType.java.after (renamed from plugins/typeMigration/testData/refactoring/changeTypeSignature/CompositeReturnType.java.after)0
-rw-r--r--java/typeMigration/testData/refactoring/changeTypeSignature/FieldTypeMigration.java (renamed from plugins/typeMigration/testData/refactoring/changeTypeSignature/FieldTypeMigration.java)0
-rw-r--r--java/typeMigration/testData/refactoring/changeTypeSignature/FieldTypeMigration.java.after (renamed from plugins/typeMigration/testData/refactoring/changeTypeSignature/FieldTypeMigration.java.after)0
-rw-r--r--java/typeMigration/testData/refactoring/changeTypeSignature/FieldUsage.java (renamed from plugins/typeMigration/testData/refactoring/changeTypeSignature/FieldUsage.java)0
-rw-r--r--java/typeMigration/testData/refactoring/changeTypeSignature/FieldUsage.java.after (renamed from plugins/typeMigration/testData/refactoring/changeTypeSignature/FieldUsage.java.after)0
-rw-r--r--java/typeMigration/testData/refactoring/changeTypeSignature/FieldUsage1.java (renamed from plugins/typeMigration/testData/refactoring/changeTypeSignature/FieldUsage1.java)0
-rw-r--r--java/typeMigration/testData/refactoring/changeTypeSignature/FieldUsage1.java.after (renamed from plugins/typeMigration/testData/refactoring/changeTypeSignature/FieldUsage1.java.after)0
-rw-r--r--java/typeMigration/testData/refactoring/changeTypeSignature/ListTypeArguments.java (renamed from plugins/typeMigration/testData/refactoring/changeTypeSignature/ListTypeArguments.java)0
-rw-r--r--java/typeMigration/testData/refactoring/changeTypeSignature/ListTypeArguments.java.after (renamed from plugins/typeMigration/testData/refactoring/changeTypeSignature/ListTypeArguments.java.after)0
-rw-r--r--java/typeMigration/testData/refactoring/changeTypeSignature/MethodReturnTypeMigration.java (renamed from plugins/typeMigration/testData/refactoring/changeTypeSignature/MethodReturnTypeMigration.java)0
-rw-r--r--java/typeMigration/testData/refactoring/changeTypeSignature/MethodReturnTypeMigration.java.after (renamed from plugins/typeMigration/testData/refactoring/changeTypeSignature/MethodReturnTypeMigration.java.after)0
-rw-r--r--java/typeMigration/testData/refactoring/changeTypeSignature/ParameterMigration.java (renamed from plugins/typeMigration/testData/refactoring/changeTypeSignature/ParameterMigration.java)0
-rw-r--r--java/typeMigration/testData/refactoring/changeTypeSignature/ParameterMigration.java.after (renamed from plugins/typeMigration/testData/refactoring/changeTypeSignature/ParameterMigration.java.after)0
-rw-r--r--java/typeMigration/testData/refactoring/changeTypeSignature/ParameterMigration1.java (renamed from plugins/typeMigration/testData/refactoring/changeTypeSignature/ParameterMigration1.java)0
-rw-r--r--java/typeMigration/testData/refactoring/changeTypeSignature/ParameterMigration1.java.after (renamed from plugins/typeMigration/testData/refactoring/changeTypeSignature/ParameterMigration1.java.after)0
-rw-r--r--java/typeMigration/testData/refactoring/changeTypeSignature/ParameterMigration2.java (renamed from plugins/typeMigration/testData/refactoring/changeTypeSignature/ParameterMigration2.java)0
-rw-r--r--java/typeMigration/testData/refactoring/changeTypeSignature/ParameterMigration2.java.after (renamed from plugins/typeMigration/testData/refactoring/changeTypeSignature/ParameterMigration2.java.after)0
-rw-r--r--java/typeMigration/testData/refactoring/changeTypeSignature/PassedParameter.java (renamed from plugins/typeMigration/testData/refactoring/changeTypeSignature/PassedParameter.java)0
-rw-r--r--java/typeMigration/testData/refactoring/changeTypeSignature/PassedParameter.java.after (renamed from plugins/typeMigration/testData/refactoring/changeTypeSignature/PassedParameter.java.after)0
-rw-r--r--java/typeMigration/testData/refactoring/changeTypeSignature/PassedParameter1.java (renamed from plugins/typeMigration/testData/refactoring/changeTypeSignature/PassedParameter1.java)0
-rw-r--r--java/typeMigration/testData/refactoring/changeTypeSignature/PassedParameter1.java.after (renamed from plugins/typeMigration/testData/refactoring/changeTypeSignature/PassedParameter1.java.after)0
-rw-r--r--java/typeMigration/testData/refactoring/changeTypeSignature/PassedParameter2.java (renamed from plugins/typeMigration/testData/refactoring/changeTypeSignature/PassedParameter2.java)0
-rw-r--r--java/typeMigration/testData/refactoring/changeTypeSignature/PassedParameter2.java.after (renamed from plugins/typeMigration/testData/refactoring/changeTypeSignature/PassedParameter2.java.after)0
-rw-r--r--java/typeMigration/testData/refactoring/changeTypeSignature/ReturnType.java (renamed from plugins/typeMigration/testData/refactoring/changeTypeSignature/ReturnType.java)0
-rw-r--r--java/typeMigration/testData/refactoring/changeTypeSignature/ReturnType.java.after (renamed from plugins/typeMigration/testData/refactoring/changeTypeSignature/ReturnType.java.after)0
-rw-r--r--java/typeMigration/testData/refactoring/changeTypeSignature/ReturnType1.java (renamed from plugins/typeMigration/testData/refactoring/changeTypeSignature/ReturnType1.java)0
-rw-r--r--java/typeMigration/testData/refactoring/changeTypeSignature/ReturnType1.java.after (renamed from plugins/typeMigration/testData/refactoring/changeTypeSignature/ReturnType1.java.after)0
-rw-r--r--java/typeMigration/testData/refactoring/changeTypeSignature/ReturnType2.java (renamed from plugins/typeMigration/testData/refactoring/changeTypeSignature/ReturnType2.java)0
-rw-r--r--java/typeMigration/testData/refactoring/changeTypeSignature/ReturnType2.java.after (renamed from plugins/typeMigration/testData/refactoring/changeTypeSignature/ReturnType2.java.after)0
-rw-r--r--java/typeMigration/testData/refactoring/changeTypeSignature/TypeHierarchy.java (renamed from plugins/typeMigration/testData/refactoring/changeTypeSignature/TypeHierarchy.java)0
-rw-r--r--java/typeMigration/testData/refactoring/changeTypeSignature/TypeHierarchy.java.after (renamed from plugins/typeMigration/testData/refactoring/changeTypeSignature/TypeHierarchy.java.after)0
-rw-r--r--java/typeMigration/testData/refactoring/changeTypeSignature/TypeHierarchy1.java (renamed from plugins/typeMigration/testData/refactoring/changeTypeSignature/TypeHierarchy1.java)0
-rw-r--r--java/typeMigration/testData/refactoring/changeTypeSignature/TypeHierarchy1.java.after (renamed from plugins/typeMigration/testData/refactoring/changeTypeSignature/TypeHierarchy1.java.after)0
-rw-r--r--java/typeMigration/testData/refactoring/changeTypeSignature/TypeHierarchy2.java (renamed from plugins/typeMigration/testData/refactoring/changeTypeSignature/TypeHierarchy2.java)0
-rw-r--r--java/typeMigration/testData/refactoring/changeTypeSignature/TypeHierarchy2.java.after (renamed from plugins/typeMigration/testData/refactoring/changeTypeSignature/TypeHierarchy2.java.after)0
-rw-r--r--java/typeMigration/testData/refactoring/changeTypeSignature/TypeHierarchyFieldUsage.java (renamed from plugins/typeMigration/testData/refactoring/changeTypeSignature/TypeHierarchyFieldUsage.java)0
-rw-r--r--java/typeMigration/testData/refactoring/changeTypeSignature/TypeHierarchyFieldUsage.java.after (renamed from plugins/typeMigration/testData/refactoring/changeTypeSignature/TypeHierarchyFieldUsage.java.after)0
-rw-r--r--java/typeMigration/testData/refactoring/changeTypeSignature/TypeHierarchyFieldUsageConflict.java (renamed from plugins/typeMigration/testData/refactoring/changeTypeSignature/TypeHierarchyFieldUsageConflict.java)0
-rw-r--r--java/typeMigration/testData/refactoring/changeTypeSignature/TypeHierarchyFieldUsageConflict.java.after (renamed from plugins/typeMigration/testData/refactoring/changeTypeSignature/TypeHierarchyFieldUsageConflict.java.after)0
-rw-r--r--java/typeMigration/testData/refactoring/changeTypeSignature/UsedInSuper.java (renamed from plugins/typeMigration/testData/refactoring/changeTypeSignature/UsedInSuper.java)0
-rw-r--r--java/typeMigration/testData/refactoring/changeTypeSignature/UsedInSuper.java.after (renamed from plugins/typeMigration/testData/refactoring/changeTypeSignature/UsedInSuper.java.after)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprAccess2Lvalue/after/Expr.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprAccess2Lvalue/after/Expr.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprAccess2Lvalue/after/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprAccess2Lvalue/after/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprAccess2Lvalue/before/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprAccess2Lvalue/before/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprAccess2Rvalue/after/Expr.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprAccess2Rvalue/after/Expr.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprAccess2Rvalue/after/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprAccess2Rvalue/after/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprAccess2Rvalue/before/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprAccess2Rvalue/before/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprAccessParent2Lvalue/after/Ession.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprAccessParent2Lvalue/after/Ession.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprAccessParent2Lvalue/after/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprAccessParent2Lvalue/after/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprAccessParent2Lvalue/before/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprAccessParent2Lvalue/before/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprAccessParent2Rvalue/after/Expr.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprAccessParent2Rvalue/after/Expr.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprAccessParent2Rvalue/after/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprAccessParent2Rvalue/after/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprAccessParent2Rvalue/before/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprAccessParent2Rvalue/before/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprArrayAccessNegative/after/Expr.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprArrayAccessNegative/after/Expr.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprArrayAccessNegative/after/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprArrayAccessNegative/after/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprArrayAccessNegative/before/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprArrayAccessNegative/before/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprArrayAccessPositive/after/Expr.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprArrayAccessPositive/after/Expr.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprArrayAccessPositive/after/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprArrayAccessPositive/after/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprArrayAccessPositive/before/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprArrayAccessPositive/before/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcBooleanBoolean/after/Expr.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcBooleanBoolean/after/Expr.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcBooleanBoolean/after/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcBooleanBoolean/after/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcBooleanBoolean/before/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcBooleanBoolean/before/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcBooleanNumeric/after/Expr.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcBooleanNumeric/after/Expr.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcBooleanNumeric/after/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcBooleanNumeric/after/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcBooleanNumeric/before/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcBooleanNumeric/before/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcBooleanReference/after/Expr.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcBooleanReference/after/Expr.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcBooleanReference/after/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcBooleanReference/after/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcBooleanReference/before/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcBooleanReference/before/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcNumeric2Boolean/after/Expr.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcNumeric2Boolean/after/Expr.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcNumeric2Boolean/after/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcNumeric2Boolean/after/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcNumeric2Boolean/before/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcNumeric2Boolean/before/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcNumeric2Floating/after/Expr.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcNumeric2Floating/after/Expr.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcNumeric2Floating/after/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcNumeric2Floating/after/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcNumeric2Floating/before/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcNumeric2Floating/before/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcNumeric2Int/after/Expr.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcNumeric2Int/after/Expr.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcNumeric2Int/after/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcNumeric2Int/after/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcNumeric2Int/before/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcNumeric2Int/before/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcNumeric2String/after/Expr.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcNumeric2String/after/Expr.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcNumeric2String/after/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcNumeric2String/after/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcNumeric2String/before/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcNumeric2String/before/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprCast2LvalueNeg/after/Expr.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCast2LvalueNeg/after/Expr.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprCast2LvalueNeg/after/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCast2LvalueNeg/after/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprCast2LvalueNeg/before/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCast2LvalueNeg/before/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprCast2LvaluePos/after/Expr.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCast2LvaluePos/after/Expr.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprCast2LvaluePos/after/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCast2LvaluePos/after/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprCast2LvaluePos/before/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCast2LvaluePos/before/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprConcatNumeric2Reference/after/Expr.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprConcatNumeric2Reference/after/Expr.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprConcatNumeric2Reference/after/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprConcatNumeric2Reference/after/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprConcatNumeric2Reference/before/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprConcatNumeric2Reference/before/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprConcatNumeric2String/after/Expr.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprConcatNumeric2String/after/Expr.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprConcatNumeric2String/after/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprConcatNumeric2String/after/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprConcatNumeric2String/before/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprConcatNumeric2String/before/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprConcatString2Numeric/after/Expr.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprConcatString2Numeric/after/Expr.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprConcatString2Numeric/after/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprConcatString2Numeric/after/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprConcatString2Numeric/before/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprConcatString2Numeric/before/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprConcatString2Reference/after/Expr.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprConcatString2Reference/after/Expr.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprConcatString2Reference/after/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprConcatString2Reference/after/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprConcatString2Reference/before/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprConcatString2Reference/before/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprInstanceofNeg/after/Expr.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprInstanceofNeg/after/Expr.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprInstanceofNeg/after/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprInstanceofNeg/after/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprInstanceofNeg/before/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprInstanceofNeg/before/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprInstanceofPos/after/Expr.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprInstanceofPos/after/Expr.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprInstanceofPos/after/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprInstanceofPos/after/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprInstanceofPos/before/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprInstanceofPos/before/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralBoolean/after/Expr.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralBoolean/after/Expr.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralBoolean/after/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralBoolean/after/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralBoolean/before/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralBoolean/before/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralByte/after/Expr.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralByte/after/Expr.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralByte/after/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralByte/after/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralByte/before/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralByte/before/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralChar/after/Expr.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralChar/after/Expr.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralChar/after/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralChar/after/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralChar/before/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralChar/before/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassExtends/after/Expr.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassExtends/after/Expr.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassExtends/after/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassExtends/after/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassExtends/before/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassExtends/before/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassPrimitive/after/Expr.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassPrimitive/after/Expr.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassPrimitive/after/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassPrimitive/after/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassPrimitive/before/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassPrimitive/before/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassPrimitiveArray/after/Expr.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassPrimitiveArray/after/Expr.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassPrimitiveArray/after/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassPrimitiveArray/after/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassPrimitiveArray/before/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassPrimitiveArray/before/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassRaw/after/Expr.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassRaw/after/Expr.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassRaw/after/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassRaw/after/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassRaw/before/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassRaw/before/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassReference/after/Expr.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassReference/after/Expr.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassReference/after/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassReference/after/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassReference/before/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassReference/before/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassReferenceArray/after/Expr.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassReferenceArray/after/Expr.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassReferenceArray/after/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassReferenceArray/after/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassReferenceArray/before/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassReferenceArray/before/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassSuper/after/Expr.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassSuper/after/Expr.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassSuper/after/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassSuper/after/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassSuper/before/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassSuper/before/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralDouble/after/Expr.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralDouble/after/Expr.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralDouble/after/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralDouble/after/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralDouble/before/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralDouble/before/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralFloat/after/Expr.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralFloat/after/Expr.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralFloat/after/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralFloat/after/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralFloat/before/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralFloat/before/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralInt/after/Expr.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralInt/after/Expr.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralInt/after/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralInt/after/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralInt/before/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralInt/before/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralLong/after/Expr.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralLong/after/Expr.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralLong/after/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralLong/after/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralLong/before/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralLong/before/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralShort/after/Expr.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralShort/after/Expr.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralShort/after/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralShort/after/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralShort/before/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralShort/before/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralString/after/Expr.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralString/after/Expr.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralString/after/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralString/after/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralString/before/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralString/before/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayArray2Lvalue/after/Expr.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayArray2Lvalue/after/Expr.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayArray2Lvalue/after/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayArray2Lvalue/after/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayArray2Lvalue/before/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayArray2Lvalue/before/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayArray2Rvalue/after/Expr.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayArray2Rvalue/after/Expr.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayArray2Rvalue/after/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayArray2Rvalue/after/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayArray2Rvalue/before/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayArray2Rvalue/before/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayGen2Rvalue/after/Expr.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayGen2Rvalue/after/Expr.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayGen2Rvalue/after/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayGen2Rvalue/after/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayGen2Rvalue/before/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayGen2Rvalue/before/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayPrimitive2Lvalue/after/Expr.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayPrimitive2Lvalue/after/Expr.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayPrimitive2Lvalue/after/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayPrimitive2Lvalue/after/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayPrimitive2Lvalue/before/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayPrimitive2Lvalue/before/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayPrimitive2Rvalue/after/Expr.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayPrimitive2Rvalue/after/Expr.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayPrimitive2Rvalue/after/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayPrimitive2Rvalue/after/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayPrimitive2Rvalue/before/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayPrimitive2Rvalue/before/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayReftype2Lvalue/after/Expr.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayReftype2Lvalue/after/Expr.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayReftype2Lvalue/after/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayReftype2Lvalue/after/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayReftype2Lvalue/before/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayReftype2Lvalue/before/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayReftype2Rvalue/after/Expr.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayReftype2Rvalue/after/Expr.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayReftype2Rvalue/after/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayReftype2Rvalue/after/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayReftype2Rvalue/before/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayReftype2Rvalue/before/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewGen/after/Expr.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewGen/after/Expr.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewGen/after/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewGen/after/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewGen/before/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewGen/before/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewGenExtends/after/Expr.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewGenExtends/after/Expr.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewGenExtends/after/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewGenExtends/after/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewGenExtends/before/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewGenExtends/before/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewGenSuper/after/Expr.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewGenSuper/after/Expr.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewGenSuper/after/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewGenSuper/after/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewGenSuper/before/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewGenSuper/before/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewReference/after/Expr.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewReference/after/Expr.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewReference/after/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewReference/after/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewReference/before/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewReference/before/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprReturn2Lvalue/after/Expr.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprReturn2Lvalue/after/Expr.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprReturn2Lvalue/after/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprReturn2Lvalue/after/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprReturn2Lvalue/before/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprReturn2Lvalue/before/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprReturn2Rvalue/after/Expr.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprReturn2Rvalue/after/Expr.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprReturn2Rvalue/after/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprReturn2Rvalue/after/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprReturn2Rvalue/before/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprReturn2Rvalue/before/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprTernary/after/Expr.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprTernary/after/Expr.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprTernary/after/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprTernary/after/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/exprTernary/before/Expr.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprTernary/before/Expr.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/overridingDown/after/Overriding.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/overridingDown/after/Overriding.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/overridingDown/after/Parent.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/overridingDown/after/Parent.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/overridingDown/before/Overriding.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/overridingDown/before/Overriding.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/overridingUp/after/Child.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/overridingUp/after/Child.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/overridingUp/after/Overriding.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/overridingUp/after/Overriding.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/overridingUp/before/Overriding.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/overridingUp/before/Overriding.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/specJavadoc/after/Spec.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/specJavadoc/after/Spec.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/specJavadoc/after/Spec.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/specJavadoc/after/Spec.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/specJavadoc/before/Spec.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/specJavadoc/before/Spec.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/specNotUsed/after/Spec.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/specNotUsed/after/Spec.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/specNotUsed/after/Spec.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/specNotUsed/after/Spec.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/specNotUsed/before/Spec.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/specNotUsed/before/Spec.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayReftype2Lvalue/after/Type.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayReftype2Lvalue/after/Type.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayReftype2Lvalue/after/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayReftype2Lvalue/after/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayReftype2Lvalue/before/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayReftype2Lvalue/before/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayReftype2Rvalue/after/Type.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayReftype2Rvalue/after/Type.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayReftype2Rvalue/after/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayReftype2Rvalue/after/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayReftype2Rvalue/before/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayReftype2Rvalue/before/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayRoots2Lvalue/after/Type.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayRoots2Lvalue/after/Type.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayRoots2Lvalue/after/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayRoots2Lvalue/after/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayRoots2Lvalue/before/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayRoots2Lvalue/before/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayVararg2Lvalue/after/Type.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayVararg2Lvalue/after/Type.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayVararg2Lvalue/after/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayVararg2Lvalue/after/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayVararg2Lvalue/before/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayVararg2Lvalue/before/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayVararg2RvalueNeg/after/Type.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayVararg2RvalueNeg/after/Type.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayVararg2RvalueNeg/after/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayVararg2RvalueNeg/after/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayVararg2RvalueNeg/before/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayVararg2RvalueNeg/before/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayVararg2RvaluePos/after/Type.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayVararg2RvaluePos/after/Type.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayVararg2RvaluePos/after/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayVararg2RvaluePos/after/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayVararg2RvaluePos/before/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayVararg2RvaluePos/before/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxBoolean2Lvalue/after/Type.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxBoolean2Lvalue/after/Type.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxBoolean2Lvalue/after/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxBoolean2Lvalue/after/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxBoolean2Lvalue/before/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxBoolean2Lvalue/before/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxBoolean2Rvalue/after/Type.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxBoolean2Rvalue/after/Type.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxBoolean2Rvalue/after/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxBoolean2Rvalue/after/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxBoolean2Rvalue/before/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxBoolean2Rvalue/before/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxByte2Lvalue/after/Type.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxByte2Lvalue/after/Type.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxByte2Lvalue/after/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxByte2Lvalue/after/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxByte2Lvalue/before/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxByte2Lvalue/before/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxByte2Rvalue/after/Type.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxByte2Rvalue/after/Type.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxByte2Rvalue/after/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxByte2Rvalue/after/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxByte2Rvalue/before/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxByte2Rvalue/before/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxChar2Lvalue/after/Type.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxChar2Lvalue/after/Type.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxChar2Lvalue/after/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxChar2Lvalue/after/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxChar2Lvalue/before/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxChar2Lvalue/before/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxChar2Rvalue/after/Type.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxChar2Rvalue/after/Type.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxChar2Rvalue/after/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxChar2Rvalue/after/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxChar2Rvalue/before/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxChar2Rvalue/before/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxDouble2Lvalue/after/Type.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxDouble2Lvalue/after/Type.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxDouble2Lvalue/after/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxDouble2Lvalue/after/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxDouble2Lvalue/before/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxDouble2Lvalue/before/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxDouble2Rvalue/after/Type.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxDouble2Rvalue/after/Type.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxDouble2Rvalue/after/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxDouble2Rvalue/after/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxDouble2Rvalue/before/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxDouble2Rvalue/before/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxFloat2Lvalue/after/Type.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxFloat2Lvalue/after/Type.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxFloat2Lvalue/after/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxFloat2Lvalue/after/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxFloat2Lvalue/before/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxFloat2Lvalue/before/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxFloat2Rvalue/after/Type.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxFloat2Rvalue/after/Type.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxFloat2Rvalue/after/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxFloat2Rvalue/after/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxFloat2Rvalue/before/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxFloat2Rvalue/before/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxInt2Lvalue/after/Type.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxInt2Lvalue/after/Type.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxInt2Lvalue/after/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxInt2Lvalue/after/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxInt2Lvalue/before/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxInt2Lvalue/before/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxInt2Rvalue/after/Type.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxInt2Rvalue/after/Type.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxInt2Rvalue/after/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxInt2Rvalue/after/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxInt2Rvalue/before/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxInt2Rvalue/before/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxLong2Lvalue/after/Type.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxLong2Lvalue/after/Type.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxLong2Lvalue/after/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxLong2Lvalue/after/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxLong2Lvalue/before/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxLong2Lvalue/before/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxLong2Rvalue/after/Type.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxLong2Rvalue/after/Type.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxLong2Rvalue/after/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxLong2Rvalue/after/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxLong2Rvalue/before/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxLong2Rvalue/before/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxShort2Lvalue/after/Type.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxShort2Lvalue/after/Type.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxShort2Lvalue/after/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxShort2Lvalue/after/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxShort2Lvalue/before/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxShort2Lvalue/before/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxShort2Rvalue/after/Type.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxShort2Rvalue/after/Type.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxShort2Rvalue/after/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxShort2Rvalue/after/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxShort2Rvalue/before/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxShort2Rvalue/before/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeGenAncestor2Lvalue/after/Type.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeGenAncestor2Lvalue/after/Type.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeGenAncestor2Lvalue/after/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeGenAncestor2Lvalue/after/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeGenAncestor2Lvalue/before/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeGenAncestor2Lvalue/before/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeGenAncestorWildcard2Lvalue/after/Type.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeGenAncestorWildcard2Lvalue/after/Type.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeGenAncestorWildcard2Lvalue/after/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeGenAncestorWildcard2Lvalue/after/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeGenAncestorWildcard2Lvalue/before/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeGenAncestorWildcard2Lvalue/before/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeGenDescendant2Rvalue/after/Type.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeGenDescendant2Rvalue/after/Type.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeGenDescendant2Rvalue/after/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeGenDescendant2Rvalue/after/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeGenDescendant2Rvalue/before/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeGenDescendant2Rvalue/before/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeGenDescendantWildcard2Rvalue/after/Type.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeGenDescendantWildcard2Rvalue/after/Type.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeGenDescendantWildcard2Rvalue/after/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeGenDescendantWildcard2Rvalue/after/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeGenDescendantWildcard2Rvalue/before/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeGenDescendantWildcard2Rvalue/before/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeGenRaw2Lvalue/after/Type.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeGenRaw2Lvalue/after/Type.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeGenRaw2Lvalue/after/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeGenRaw2Lvalue/after/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeGenRaw2Lvalue/before/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeGenRaw2Lvalue/before/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeGenRaw2Rvalue/after/Type.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeGenRaw2Rvalue/after/Type.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeGenRaw2Rvalue/after/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeGenRaw2Rvalue/after/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeGenRaw2Rvalue/before/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeGenRaw2Rvalue/before/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubBoolean2Lvalue/after/Type.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubBoolean2Lvalue/after/Type.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubBoolean2Lvalue/after/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubBoolean2Lvalue/after/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubBoolean2Lvalue/before/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubBoolean2Lvalue/before/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubBoolean2Rvalue/after/Type.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubBoolean2Rvalue/after/Type.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubBoolean2Rvalue/after/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubBoolean2Rvalue/after/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubBoolean2Rvalue/before/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubBoolean2Rvalue/before/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubByte2Rvalue/after/Type.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubByte2Rvalue/after/Type.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubByte2Rvalue/after/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubByte2Rvalue/after/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubByte2Rvalue/before/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubByte2Rvalue/before/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubChar2Lvalue/after/Type.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubChar2Lvalue/after/Type.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubChar2Lvalue/after/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubChar2Lvalue/after/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubChar2Lvalue/before/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubChar2Lvalue/before/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubChar2Rvalue/after/Type.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubChar2Rvalue/after/Type.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubChar2Rvalue/after/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubChar2Rvalue/after/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubChar2Rvalue/before/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubChar2Rvalue/before/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubDouble2Lvalue/after/Type.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubDouble2Lvalue/after/Type.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubDouble2Lvalue/after/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubDouble2Lvalue/after/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubDouble2Lvalue/before/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubDouble2Lvalue/before/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubFloat2Lvalue/after/Type.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubFloat2Lvalue/after/Type.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubFloat2Lvalue/after/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubFloat2Lvalue/after/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubFloat2Lvalue/before/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubFloat2Lvalue/before/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubFloat2Rvalue/after/Type.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubFloat2Rvalue/after/Type.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubFloat2Rvalue/after/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubFloat2Rvalue/after/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubFloat2Rvalue/before/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubFloat2Rvalue/before/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubInt2Lvalue/after/Type.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubInt2Lvalue/after/Type.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubInt2Lvalue/after/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubInt2Lvalue/after/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubInt2Lvalue/before/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubInt2Lvalue/before/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubInt2Rvalue/after/Type.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubInt2Rvalue/after/Type.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubInt2Rvalue/after/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubInt2Rvalue/after/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubInt2Rvalue/before/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubInt2Rvalue/before/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubLong2Lvalue/after/Type.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubLong2Lvalue/after/Type.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubLong2Lvalue/after/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubLong2Lvalue/after/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubLong2Lvalue/before/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubLong2Lvalue/before/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubLong2Rvalue/after/Type.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubLong2Rvalue/after/Type.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubLong2Rvalue/after/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubLong2Rvalue/after/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubLong2Rvalue/before/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubLong2Rvalue/before/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubShort2Lvalue/after/Type.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubShort2Lvalue/after/Type.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubShort2Lvalue/after/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubShort2Lvalue/after/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubShort2Lvalue/before/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubShort2Lvalue/before/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubShort2Rvalue/after/Type.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubShort2Rvalue/after/Type.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubShort2Rvalue/after/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubShort2Rvalue/after/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubShort2Rvalue/before/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubShort2Rvalue/before/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeRefClassChild2Rvalue/after/Type.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeRefClassChild2Rvalue/after/Type.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeRefClassChild2Rvalue/after/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeRefClassChild2Rvalue/after/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeRefClassChild2Rvalue/before/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeRefClassChild2Rvalue/before/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeRefClassParent2Lvalue/after/Type.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeRefClassParent2Lvalue/after/Type.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeRefClassParent2Lvalue/after/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeRefClassParent2Lvalue/after/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeRefClassParent2Lvalue/before/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeRefClassParent2Lvalue/before/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeRefClassParent2Rvalue/after/Type.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeRefClassParent2Rvalue/after/Type.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeRefClassParent2Rvalue/after/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeRefClassParent2Rvalue/after/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeRefClassParent2Rvalue/before/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeRefClassParent2Rvalue/before/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeRefFaceChild2Lvalue/after/Type.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeRefFaceChild2Lvalue/after/Type.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeRefFaceChild2Lvalue/after/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeRefFaceChild2Lvalue/after/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeRefFaceChild2Lvalue/before/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeRefFaceChild2Lvalue/before/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeRefFaceChild2Rvalue/after/Type.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeRefFaceChild2Rvalue/after/Type.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeRefFaceChild2Rvalue/after/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeRefFaceChild2Rvalue/after/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeRefFaceChild2Rvalue/before/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeRefFaceChild2Rvalue/before/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeRefFaceParent2Lvalue/after/Type.items (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeRefFaceParent2Lvalue/after/Type.items)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeRefFaceParent2Lvalue/after/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeRefFaceParent2Lvalue/after/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/migrateTypeSignature/typeRefFaceParent2Lvalue/before/Type.java (renamed from plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeRefFaceParent2Lvalue/before/Type.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t01/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t01/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t01/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t01/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t01/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t01/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t02/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t02/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t02/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t02/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t02/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t02/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t03/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t03/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t03/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t03/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t03/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t03/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t04/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t04/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t04/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t04/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t04/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t04/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t05/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t05/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t05/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t05/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t05/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t05/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t06/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t06/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t06/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t06/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t06/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t06/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t07/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t07/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t07/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t07/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t07/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t07/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t08/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t08/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t08/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t08/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t08/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t08/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t09/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t09/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t09/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t09/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t09/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t09/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t10/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t10/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t10/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t10/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t10/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t10/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t100/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t100/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t100/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t100/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t100/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t100/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t101/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t101/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t101/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t101/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t101/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t101/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t102/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t102/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t102/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t102/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t102/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t102/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t103/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t103/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t103/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t103/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t103/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t103/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t104/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t104/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t104/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t104/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t104/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t104/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t105/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t105/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t105/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t105/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t105/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t105/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t106/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t106/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t106/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t106/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t106/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t106/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t107/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t107/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t107/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t107/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t107/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t107/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t108/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t108/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t108/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t108/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t108/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t108/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t109/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t109/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t109/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t109/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t109/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t109/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t11/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t11/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t11/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t11/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t11/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t11/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t110/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t110/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t110/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t110/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t110/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t110/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t111/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t111/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t111/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t111/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t111/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t111/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t112/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t112/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t112/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t112/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t112/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t112/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t113/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t113/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t113/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t113/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t113/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t113/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t114/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t114/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t114/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t114/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t114/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t114/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t115/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t115/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t115/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t115/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t115/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t115/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t116/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t116/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t116/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t116/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t116/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t116/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t117/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t117/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t117/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t117/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t117/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t117/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t118/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t118/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t118/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t118/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t118/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t118/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t119/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t119/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t119/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t119/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t119/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t119/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t12/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t12/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t12/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t12/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t12/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t12/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t120/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t120/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t120/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t120/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t120/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t120/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t121/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t121/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t121/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t121/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t121/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t121/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t122/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t122/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t122/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t122/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t122/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t122/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t123/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t123/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t123/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t123/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t123/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t123/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t124/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t124/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t124/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t124/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t124/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t124/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t125/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t125/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t125/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t125/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t125/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t125/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t126/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t126/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t126/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t126/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t126/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t126/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t127/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t127/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t127/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t127/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t127/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t127/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t128/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t128/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t128/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t128/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t128/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t128/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t129/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t129/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t129/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t129/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t129/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t129/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t13/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t13/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t13/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t13/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t13/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t13/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t130/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t130/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t130/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t130/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t130/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t130/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t131/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t131/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t131/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t131/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t131/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t131/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t132/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t132/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t132/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t132/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t132/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t132/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t133/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t133/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t133/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t133/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t133/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t133/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t134/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t134/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t134/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t134/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t134/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t134/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t135/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t135/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t135/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t135/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t135/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t135/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t136/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t136/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t136/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t136/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t136/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t136/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t137/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t137/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t137/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t137/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t137/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t137/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t138/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t138/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t138/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t138/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t138/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t138/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t139/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t139/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t139/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t139/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t139/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t139/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t14/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t14/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t14/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t14/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t14/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t14/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t15/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t15/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t15/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t15/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t15/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t15/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t16/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t16/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t16/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t16/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t16/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t16/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t17/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t17/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t17/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t17/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t17/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t17/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t18/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t18/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t18/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t18/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t18/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t18/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t19/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t19/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t19/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t19/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t19/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t19/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t20/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t20/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t20/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t20/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t20/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t20/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t21/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t21/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t21/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t21/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t21/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t21/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t22/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t22/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t22/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t22/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t22/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t22/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t23/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t23/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t23/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t23/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t23/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t23/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t24/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t24/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t24/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t24/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t24/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t24/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t25/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t25/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t25/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t25/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t25/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t25/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t26/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t26/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t26/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t26/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t26/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t26/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t27/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t27/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t27/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t27/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t27/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t27/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t28/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t28/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t28/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t28/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t28/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t28/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t29/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t29/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t29/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t29/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t29/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t29/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t30/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t30/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t30/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t30/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t30/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t30/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t31/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t31/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t31/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t31/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t31/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t31/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t32/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t32/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t32/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t32/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t32/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t32/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t33/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t33/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t33/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t33/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t33/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t33/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t34/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t34/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t34/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t34/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t34/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t34/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t35/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t35/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t35/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t35/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t35/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t35/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t36/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t36/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t36/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t36/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t36/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t36/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t37/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t37/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t37/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t37/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t37/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t37/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t38/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t38/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t38/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t38/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t38/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t38/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t39/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t39/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t39/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t39/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t39/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t39/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t40/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t40/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t40/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t40/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t40/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t40/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t41/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t41/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t41/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t41/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t41/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t41/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t42/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t42/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t42/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t42/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t42/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t42/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t43/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t43/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t43/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t43/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t43/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t43/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t44/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t44/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t44/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t44/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t44/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t44/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t45/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t45/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t45/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t45/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t45/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t45/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t46/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t46/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t46/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t46/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t46/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t46/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t47/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t47/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t47/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t47/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t47/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t47/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t48/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t48/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t48/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t48/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t48/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t48/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t49/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t49/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t49/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t49/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t49/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t49/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t50/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t50/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t50/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t50/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t50/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t50/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t51/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t51/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t51/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t51/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t51/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t51/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t52/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t52/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t52/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t52/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t52/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t52/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t53/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t53/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t53/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t53/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t53/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t53/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t54/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t54/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t54/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t54/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t54/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t54/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t55/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t55/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t55/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t55/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t55/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t55/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t56/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t56/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t56/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t56/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t56/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t56/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t57/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t57/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t57/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t57/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t57/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t57/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t58/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t58/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t58/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t58/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t58/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t58/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t59/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t59/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t59/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t59/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t59/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t59/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t60/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t60/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t60/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t60/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t60/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t60/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t61/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t61/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t61/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t61/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t61/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t61/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t62/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t62/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t62/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t62/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t62/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t62/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t63/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t63/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t63/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t63/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t63/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t63/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t64/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t64/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t64/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t64/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t64/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t64/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t65/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t65/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t65/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t65/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t65/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t65/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t66/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t66/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t66/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t66/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t66/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t66/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t67/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t67/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t67/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t67/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t67/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t67/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t68/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t68/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t68/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t68/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t68/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t68/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t69/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t69/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t69/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t69/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t69/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t69/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t70/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t70/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t70/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t70/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t70/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t70/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t71/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t71/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t71/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t71/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t71/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t71/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t72/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t72/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t72/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t72/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t72/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t72/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t73/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t73/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t73/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t73/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t73/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t73/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t74/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t74/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t74/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t74/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t74/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t74/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t75/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t75/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t75/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t75/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t75/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t75/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t76/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t76/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t76/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t76/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t76/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t76/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t77/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t77/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t77/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t77/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t77/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t77/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t78/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t78/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t78/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t78/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t78/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t78/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t79/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t79/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t79/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t79/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t79/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t79/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t80/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t80/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t80/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t80/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t80/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t80/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t81/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t81/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t81/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t81/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t81/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t81/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t82/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t82/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t82/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t82/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t82/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t82/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t83/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t83/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t83/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t83/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t83/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t83/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t84/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t84/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t84/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t84/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t84/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t84/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t85/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t85/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t85/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t85/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t85/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t85/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t86/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t86/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t86/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t86/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t86/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t86/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t87/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t87/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t87/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t87/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t87/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t87/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t88/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t88/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t88/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t88/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t88/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t88/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t89/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t89/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t89/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t89/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t89/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t89/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t90/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t90/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t90/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t90/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t90/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t90/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t91/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t91/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t91/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t91/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t91/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t91/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t92/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t92/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t92/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t92/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t92/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t92/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t93/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t93/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t93/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t93/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t93/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t93/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t94/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t94/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t94/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t94/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t94/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t94/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t95/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t95/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t95/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t95/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t95/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t95/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t96/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t96/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t96/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t96/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t96/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t96/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t97/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t97/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t97/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t97/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t97/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t97/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t98/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t98/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t98/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t98/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t98/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t98/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t99/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t99/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t99/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t99/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/t99/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/t99/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/typeAnno/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigration/typeAnno/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/typeAnno/after/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/typeAnno/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigration/typeAnno/before/test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigration/typeAnno/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigrationByAtomic/directAssignments/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/directAssignments/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigrationByAtomic/directAssignments/after/Test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/directAssignments/after/Test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigrationByAtomic/directAssignments/before/Test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/directAssignments/before/Test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigrationByAtomic/directByte/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/directByte/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigrationByAtomic/directByte/after/Test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/directByte/after/Test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigrationByAtomic/directByte/before/Test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/directByte/before/Test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigrationByAtomic/directConditions/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/directConditions/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigrationByAtomic/directConditions/after/Test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/directConditions/after/Test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigrationByAtomic/directConditions/before/Test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/directConditions/before/Test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigrationByAtomic/directForeach/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/directForeach/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigrationByAtomic/directForeach/after/Test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/directForeach/after/Test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigrationByAtomic/directForeach/before/Test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/directForeach/before/Test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigrationByAtomic/directIncrementDecrement/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/directIncrementDecrement/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigrationByAtomic/directIncrementDecrement/after/Test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/directIncrementDecrement/after/Test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigrationByAtomic/directIncrementDecrement/before/Test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/directIncrementDecrement/before/Test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigrationByAtomic/directIntArray/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/directIntArray/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigrationByAtomic/directIntArray/after/Test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/directIntArray/after/Test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigrationByAtomic/directIntArray/before/Test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/directIntArray/before/Test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigrationByAtomic/directString/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/directString/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigrationByAtomic/directString/after/Test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/directString/after/Test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigrationByAtomic/directString/before/Test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/directString/before/Test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigrationByAtomic/directStringArray/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/directStringArray/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigrationByAtomic/directStringArray/after/Test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/directStringArray/after/Test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigrationByAtomic/directStringArray/before/Test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/directStringArray/before/Test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseAssignments/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseAssignments/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseAssignments/after/Test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseAssignments/after/Test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseAssignments/before/Test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseAssignments/before/Test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseByte/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseByte/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseByte/after/Test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseByte/after/Test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseByte/before/Test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseByte/before/Test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseConditions/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseConditions/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseConditions/after/Test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseConditions/after/Test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseConditions/before/Test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseConditions/before/Test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseIncrementDecrement/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseIncrementDecrement/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseIncrementDecrement/after/Test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseIncrementDecrement/after/Test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseIncrementDecrement/before/Test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseIncrementDecrement/before/Test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseIntArray/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseIntArray/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseIntArray/after/Test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseIntArray/after/Test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseIntArray/before/Test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseIntArray/before/Test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseString/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseString/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseString/after/Test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseString/after/Test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseString/before/Test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseString/before/Test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseStringArray/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseStringArray/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseStringArray/after/Test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseStringArray/after/Test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseStringArray/before/Test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseStringArray/before/Test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigrationByThreadLocal/directByte/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigrationByThreadLocal/directByte/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigrationByThreadLocal/directByte/after/Test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigrationByThreadLocal/directByte/after/Test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigrationByThreadLocal/directByte/before/Test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigrationByThreadLocal/directByte/before/Test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigrationByThreadLocal/directInt/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigrationByThreadLocal/directInt/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigrationByThreadLocal/directInt/after/Test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigrationByThreadLocal/directInt/after/Test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigrationByThreadLocal/directInt/before/Test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigrationByThreadLocal/directInt/before/Test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigrationByThreadLocal/directString/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigrationByThreadLocal/directString/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigrationByThreadLocal/directString/after/Test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigrationByThreadLocal/directString/after/Test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigrationByThreadLocal/directString/before/Test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigrationByThreadLocal/directString/before/Test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigrationByThreadLocal/languageLevel/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/typeMigrationByThreadLocal/languageLevel/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigrationByThreadLocal/languageLevel/after/Test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigrationByThreadLocal/languageLevel/after/Test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/typeMigrationByThreadLocal/languageLevel/before/Test.java (renamed from plugins/typeMigration/testData/refactoring/typeMigrationByThreadLocal/languageLevel/before/Test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/wildcard/assignmentExtends/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/wildcard/assignmentExtends/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/wildcard/assignmentExtends/after/test.java (renamed from plugins/typeMigration/testData/refactoring/wildcard/assignmentExtends/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/wildcard/assignmentExtends/before/test.java (renamed from plugins/typeMigration/testData/refactoring/wildcard/assignmentExtends/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/wildcard/assignmentSuper/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/wildcard/assignmentSuper/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/wildcard/assignmentSuper/after/test.java (renamed from plugins/typeMigration/testData/refactoring/wildcard/assignmentSuper/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/wildcard/assignmentSuper/before/test.java (renamed from plugins/typeMigration/testData/refactoring/wildcard/assignmentSuper/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/wildcard/assignmentUnbounded/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/wildcard/assignmentUnbounded/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/wildcard/assignmentUnbounded/after/test.java (renamed from plugins/typeMigration/testData/refactoring/wildcard/assignmentUnbounded/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/wildcard/assignmentUnbounded/before/test.java (renamed from plugins/typeMigration/testData/refactoring/wildcard/assignmentUnbounded/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/wildcard/consumerExtends/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/wildcard/consumerExtends/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/wildcard/consumerExtends/after/test.java (renamed from plugins/typeMigration/testData/refactoring/wildcard/consumerExtends/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/wildcard/consumerExtends/before/test.java (renamed from plugins/typeMigration/testData/refactoring/wildcard/consumerExtends/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/wildcard/consumerSuper/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/wildcard/consumerSuper/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/wildcard/consumerSuper/after/test.java (renamed from plugins/typeMigration/testData/refactoring/wildcard/consumerSuper/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/wildcard/consumerSuper/before/test.java (renamed from plugins/typeMigration/testData/refactoring/wildcard/consumerSuper/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/wildcard/consumerUnbounded/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/wildcard/consumerUnbounded/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/wildcard/consumerUnbounded/after/test.java (renamed from plugins/typeMigration/testData/refactoring/wildcard/consumerUnbounded/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/wildcard/consumerUnbounded/before/test.java (renamed from plugins/typeMigration/testData/refactoring/wildcard/consumerUnbounded/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/wildcard/getAssignmentExtendsToChildType/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/wildcard/getAssignmentExtendsToChildType/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/wildcard/getAssignmentExtendsToChildType/after/test.java (renamed from plugins/typeMigration/testData/refactoring/wildcard/getAssignmentExtendsToChildType/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/wildcard/getAssignmentExtendsToChildType/before/test.java (renamed from plugins/typeMigration/testData/refactoring/wildcard/getAssignmentExtendsToChildType/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/wildcard/getAssignmentExtendsToSuperType/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/wildcard/getAssignmentExtendsToSuperType/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/wildcard/getAssignmentExtendsToSuperType/after/test.java (renamed from plugins/typeMigration/testData/refactoring/wildcard/getAssignmentExtendsToSuperType/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/wildcard/getAssignmentExtendsToSuperType/before/test.java (renamed from plugins/typeMigration/testData/refactoring/wildcard/getAssignmentExtendsToSuperType/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/wildcard/getAssignmentExtendsToType/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/wildcard/getAssignmentExtendsToType/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/wildcard/getAssignmentExtendsToType/after/test.java (renamed from plugins/typeMigration/testData/refactoring/wildcard/getAssignmentExtendsToType/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/wildcard/getAssignmentExtendsToType/before/test.java (renamed from plugins/typeMigration/testData/refactoring/wildcard/getAssignmentExtendsToType/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/wildcard/getExtends/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/wildcard/getExtends/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/wildcard/getExtends/after/test.java (renamed from plugins/typeMigration/testData/refactoring/wildcard/getExtends/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/wildcard/getExtends/before/test.java (renamed from plugins/typeMigration/testData/refactoring/wildcard/getExtends/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/wildcard/getSuper/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/wildcard/getSuper/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/wildcard/getSuper/after/test.java (renamed from plugins/typeMigration/testData/refactoring/wildcard/getSuper/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/wildcard/getSuper/before/test.java (renamed from plugins/typeMigration/testData/refactoring/wildcard/getSuper/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/wildcard/getUnbounded/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/wildcard/getUnbounded/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/wildcard/getUnbounded/after/test.java (renamed from plugins/typeMigration/testData/refactoring/wildcard/getUnbounded/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/wildcard/getUnbounded/before/test.java (renamed from plugins/typeMigration/testData/refactoring/wildcard/getUnbounded/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/wildcard/lengthSize/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/wildcard/lengthSize/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/wildcard/lengthSize/after/test.java (renamed from plugins/typeMigration/testData/refactoring/wildcard/lengthSize/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/wildcard/lengthSize/before/test.java (renamed from plugins/typeMigration/testData/refactoring/wildcard/lengthSize/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/wildcard/producerCollectionChanged/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/wildcard/producerCollectionChanged/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/wildcard/producerCollectionChanged/after/test.java (renamed from plugins/typeMigration/testData/refactoring/wildcard/producerCollectionChanged/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/wildcard/producerCollectionChanged/before/test.java (renamed from plugins/typeMigration/testData/refactoring/wildcard/producerCollectionChanged/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/wildcard/producerExtends/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/wildcard/producerExtends/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/wildcard/producerExtends/after/test.java (renamed from plugins/typeMigration/testData/refactoring/wildcard/producerExtends/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/wildcard/producerExtends/before/test.java (renamed from plugins/typeMigration/testData/refactoring/wildcard/producerExtends/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/wildcard/producerExtendsCollectionChanged/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/wildcard/producerExtendsCollectionChanged/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/wildcard/producerExtendsCollectionChanged/after/test.java (renamed from plugins/typeMigration/testData/refactoring/wildcard/producerExtendsCollectionChanged/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/wildcard/producerExtendsCollectionChanged/before/test.java (renamed from plugins/typeMigration/testData/refactoring/wildcard/producerExtendsCollectionChanged/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/wildcard/producerExtendsFailToStopAtWildcard/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/wildcard/producerExtendsFailToStopAtWildcard/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/wildcard/producerExtendsFailToStopAtWildcard/after/test.java (renamed from plugins/typeMigration/testData/refactoring/wildcard/producerExtendsFailToStopAtWildcard/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/wildcard/producerExtendsFailToStopAtWildcard/before/test.java (renamed from plugins/typeMigration/testData/refactoring/wildcard/producerExtendsFailToStopAtWildcard/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/wildcard/producerFailToStopAtWildcard/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/wildcard/producerFailToStopAtWildcard/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/wildcard/producerFailToStopAtWildcard/after/test.java (renamed from plugins/typeMigration/testData/refactoring/wildcard/producerFailToStopAtWildcard/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/wildcard/producerFailToStopAtWildcard/before/test.java (renamed from plugins/typeMigration/testData/refactoring/wildcard/producerFailToStopAtWildcard/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/wildcard/producerStopAtWildcard/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/wildcard/producerStopAtWildcard/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/wildcard/producerStopAtWildcard/after/test.java (renamed from plugins/typeMigration/testData/refactoring/wildcard/producerStopAtWildcard/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/wildcard/producerStopAtWildcard/before/test.java (renamed from plugins/typeMigration/testData/refactoring/wildcard/producerStopAtWildcard/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/wildcard/producerSuper/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/wildcard/producerSuper/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/wildcard/producerSuper/after/test.java (renamed from plugins/typeMigration/testData/refactoring/wildcard/producerSuper/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/wildcard/producerSuper/before/test.java (renamed from plugins/typeMigration/testData/refactoring/wildcard/producerSuper/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/wildcard/producerUnbounded/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/wildcard/producerUnbounded/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/wildcard/producerUnbounded/after/test.java (renamed from plugins/typeMigration/testData/refactoring/wildcard/producerUnbounded/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/wildcard/producerUnbounded/before/test.java (renamed from plugins/typeMigration/testData/refactoring/wildcard/producerUnbounded/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/wildcard/threadLocalConsumerExtends/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/wildcard/threadLocalConsumerExtends/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/wildcard/threadLocalConsumerExtends/after/test.java (renamed from plugins/typeMigration/testData/refactoring/wildcard/threadLocalConsumerExtends/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/wildcard/threadLocalConsumerExtends/before/test.java (renamed from plugins/typeMigration/testData/refactoring/wildcard/threadLocalConsumerExtends/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/wildcard/threadLocalConsumerSuper/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/wildcard/threadLocalConsumerSuper/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/wildcard/threadLocalConsumerSuper/after/test.java (renamed from plugins/typeMigration/testData/refactoring/wildcard/threadLocalConsumerSuper/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/wildcard/threadLocalConsumerSuper/before/test.java (renamed from plugins/typeMigration/testData/refactoring/wildcard/threadLocalConsumerSuper/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/wildcard/threadLocalProducerExtends/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/wildcard/threadLocalProducerExtends/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/wildcard/threadLocalProducerExtends/after/test.java (renamed from plugins/typeMigration/testData/refactoring/wildcard/threadLocalProducerExtends/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/wildcard/threadLocalProducerExtends/before/test.java (renamed from plugins/typeMigration/testData/refactoring/wildcard/threadLocalProducerExtends/before/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/wildcard/threadLocalProducerSuper/after/Test.items (renamed from plugins/typeMigration/testData/refactoring/wildcard/threadLocalProducerSuper/after/Test.items)0
-rw-r--r--java/typeMigration/testData/refactoring/wildcard/threadLocalProducerSuper/after/test.java (renamed from plugins/typeMigration/testData/refactoring/wildcard/threadLocalProducerSuper/after/test.java)0
-rw-r--r--java/typeMigration/testData/refactoring/wildcard/threadLocalProducerSuper/before/test.java (renamed from plugins/typeMigration/testData/refactoring/wildcard/threadLocalProducerSuper/before/test.java)0
-rw-r--r--java/typeMigration/typeMigration.iml (renamed from plugins/typeMigration/typeMigration.iml)0
-rw-r--r--jps/jps-builders/src/org/jetbrains/jps/api/CmdlineProtoUtil.java4
-rw-r--r--jps/jps-builders/src/org/jetbrains/jps/incremental/IncProjectBuilder.java2
-rw-r--r--jps/jps-builders/src/org/jetbrains/jps/incremental/java/JavaBuilder.java2
-rw-r--r--jps/jps-builders/src/org/jetbrains/jps/incremental/messages/BuilderStatisticsMessage.java2
-rw-r--r--jps/jps-builders/src/org/jetbrains/jps/javac/JavacMain.java55
-rw-r--r--jps/jps-builders/src/org/jetbrains/jps/javac/OptimizedFileManager17.java13
-rw-r--r--jps/jps-builders/testSrc/org/jetbrains/jps/builders/ModuleClasspathTest.kt3
-rw-r--r--jps/lib/optimizedFileManager.jarbin22194 -> 22365 bytes
-rw-r--r--jps/standalone-builder/src/org/jetbrains/jps/idea/IdeaProjectLoader.groovy12
-rw-r--r--lib/ecj-4.3.2.jarbin1830790 -> 0 bytes
-rw-r--r--lib/ecj-4.4.jarbin0 -> 2298872 bytes
-rw-r--r--lib/jh.jarbin531676 -> 562749 bytes
-rw-r--r--lib/required_for_dist.txt2
-rw-r--r--lib/src/jhsrc.jarbin358922 -> 378089 bytes
-rw-r--r--native/WinLauncher/WinLauncher/WinLauncher.cpp4
-rw-r--r--native/fileWatcher/fileWatcher3.cpp757
-rw-r--r--native/fileWatcher/fileWatcher3.rc103
-rw-r--r--native/fileWatcher/fileWatcher3.sln8
-rw-r--r--native/fileWatcher/fileWatcher3.vcproj221
-rw-r--r--native/fileWatcher/fileWatcher3.vcxproj102
-rw-r--r--native/fileWatcher/fileWatcher3.vcxproj.filters27
-rw-r--r--native/fileWatcher/resource.h14
-rw-r--r--native/fileWatcher/stdafx.cpp8
-rw-r--r--native/fileWatcher/stdafx.h15
-rw-r--r--native/fileWatcher/targetver.h13
-rw-r--r--platform/analysis-api/src/com/intellij/analysis/AnalysisScope.java2
-rw-r--r--platform/analysis-api/src/com/intellij/codeHighlighting/HighlightDisplayLevel.java45
-rw-r--r--platform/analysis-api/src/com/intellij/codeInspection/ex/ScopeToolState.java4
-rw-r--r--platform/analysis-api/src/com/intellij/psi/search/scope/ProjectFilesScope.java2
-rw-r--r--platform/analysis-impl/src/com/intellij/codeInspection/ex/InspectionProfileImpl.java52
-rw-r--r--platform/analysis-impl/src/com/intellij/codeInspection/ex/ToolsImpl.java51
-rw-r--r--platform/annotations/src/org/jetbrains/annotations/NotNull.java12
-rw-r--r--platform/core-api/src/com/intellij/openapi/project/DumbService.java6
-rw-r--r--platform/core-api/src/com/intellij/openapi/util/AsyncValueLoader.java3
-rw-r--r--platform/core-api/src/com/intellij/patterns/ElementPatternCondition.java24
-rw-r--r--platform/core-api/src/com/intellij/patterns/ObjectPattern.java11
-rw-r--r--platform/core-api/src/com/intellij/patterns/StringPattern.java16
-rw-r--r--platform/core-api/src/com/intellij/psi/stubs/DefaultStubBuilder.java5
-rw-r--r--platform/core-api/src/com/intellij/ui/SimpleTextAttributes.java1
-rw-r--r--platform/core-impl/src/com/intellij/ide/plugins/PluginDescriptorComparator.java13
-rw-r--r--platform/core-impl/src/com/intellij/ide/plugins/PluginManagerCore.java55
-rw-r--r--platform/core-impl/src/com/intellij/ide/util/PropertiesComponentImpl.java (renamed from platform/platform-impl/src/com/intellij/ide/util/PropertiesComponentImpl.java)0
-rw-r--r--platform/core-impl/src/com/intellij/mock/MockApplicationEx.java4
-rw-r--r--platform/core-impl/src/com/intellij/openapi/application/ex/ApplicationEx.java14
-rw-r--r--platform/core-impl/src/com/intellij/openapi/application/impl/ApplicationInfoImpl.java2
-rw-r--r--platform/core-impl/src/com/intellij/psi/impl/file/impl/FileManagerImpl.java28
-rw-r--r--platform/core-impl/src/com/intellij/psi/stubs/ObjectStubTree.java5
-rw-r--r--platform/core-impl/src/com/intellij/util/indexing/FileContentImpl.java25
-rw-r--r--platform/editor-ui-api/src/com/intellij/openapi/editor/Caret.java6
-rw-r--r--platform/editor-ui-ex/src/com/intellij/openapi/editor/ex/util/LexerEditorHighlighter.java4
-rw-r--r--platform/editor-ui-ex/src/com/intellij/psi/impl/cache/impl/id/PlatformIdTableBuilding.java2
-rw-r--r--platform/editor-ui-ex/src/com/intellij/psi/impl/cache/impl/todo/TodoIndex.java2
-rw-r--r--platform/icons/src/general/projectConfigurable.pngbin0 -> 1076 bytes
-rw-r--r--platform/icons/src/general/projectConfigurable@2x.pngbin0 -> 1098 bytes
-rw-r--r--platform/icons/src/general/projectConfigurable@2x_dark.pngbin0 -> 1109 bytes
-rw-r--r--platform/icons/src/general/projectConfigurable_dark.pngbin0 -> 1059 bytes
-rw-r--r--platform/indexing-api/src/com/intellij/psi/search/IndexPattern.java23
-rw-r--r--platform/indexing-api/src/com/intellij/psi/search/PsiSearchHelper.java5
-rw-r--r--platform/indexing-api/src/com/intellij/psi/search/SingleTargetRequestResultProcessor.java4
-rw-r--r--platform/indexing-api/src/com/intellij/psi/stubs/AbstractStubIndex.java3
-rw-r--r--platform/indexing-api/src/com/intellij/psi/stubs/StubIndex.java26
-rw-r--r--platform/indexing-impl/src/com/intellij/openapi/module/impl/scopes/ModuleWithDependentsScope.java19
-rw-r--r--platform/indexing-impl/src/com/intellij/psi/impl/cache/CacheManager.java12
-rw-r--r--platform/indexing-impl/src/com/intellij/psi/impl/cache/impl/BaseFilterLexer.java2
-rw-r--r--platform/indexing-impl/src/com/intellij/psi/impl/cache/impl/BaseFilterLexerUtil.java3
-rw-r--r--platform/indexing-impl/src/com/intellij/psi/stubs/StubProcessingHelperBase.java12
-rw-r--r--platform/lang-api/src/com/intellij/codeInsight/completion/CompletionParameters.java13
-rw-r--r--platform/lang-api/src/com/intellij/codeInsight/editorActions/smartEnter/SmartEnterProcessor.java4
-rw-r--r--platform/lang-api/src/com/intellij/codeInspection/ui/ListTable.java5
-rw-r--r--platform/lang-api/src/com/intellij/openapi/module/ModuleUtil.java29
-rw-r--r--platform/lang-api/src/com/intellij/psi/codeStyle/CodeStyleSettings.java36
-rw-r--r--platform/lang-api/src/com/intellij/psi/codeStyle/CodeStyleSettingsCustomizable.java1
-rw-r--r--platform/lang-api/src/com/intellij/psi/codeStyle/CommonCodeStyleSettings.java10
-rw-r--r--platform/lang-api/src/com/intellij/psi/util/PsiUtilBase.java36
-rw-r--r--platform/lang-impl/src/com/intellij/application/options/CodeCompletionPanel.java22
-rw-r--r--platform/lang-impl/src/com/intellij/application/options/CodeStyleAbstractPanel.java6
-rw-r--r--platform/lang-impl/src/com/intellij/application/options/CodeStyleSettingsUtilImpl.java4
-rw-r--r--platform/lang-impl/src/com/intellij/application/options/ModuleAwareProjectConfigurable.java4
-rw-r--r--platform/lang-impl/src/com/intellij/application/options/codeStyle/OptionTableWithPreviewPanel.java142
-rw-r--r--platform/lang-impl/src/com/intellij/application/options/codeStyle/WrappingAndBracesPanel.java2
-rw-r--r--platform/lang-impl/src/com/intellij/application/options/editor/EditorSmartKeysConfigurable.java6
-rw-r--r--platform/lang-impl/src/com/intellij/codeInsight/CodeInsightSettings.java5
-rw-r--r--platform/lang-impl/src/com/intellij/codeInsight/actions/MultiCaretCodeInsightAction.java153
-rw-r--r--platform/lang-impl/src/com/intellij/codeInsight/actions/MultiCaretCodeInsightActionHandler.java39
-rw-r--r--platform/lang-impl/src/com/intellij/codeInsight/actions/ReformatCodeAction.java5
-rw-r--r--platform/lang-impl/src/com/intellij/codeInsight/completion/CodeCompletionHandlerBase.java7
-rw-r--r--platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionProgressIndicator.java5
-rw-r--r--platform/lang-impl/src/com/intellij/codeInsight/completion/FilePathCompletionContributor.java68
-rw-r--r--platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/ShowIntentionsPass.java3
-rw-r--r--platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/analysis/encoding/EncodingReferenceInjector.java46
-rw-r--r--platform/lang-impl/src/com/intellij/codeInsight/documentation/DocumentationManager.java25
-rw-r--r--platform/lang-impl/src/com/intellij/codeInsight/editorActions/CopyHandler.java7
-rw-r--r--platform/lang-impl/src/com/intellij/codeInsight/editorActions/IndentingBackspaceHandler.java2
-rw-r--r--platform/lang-impl/src/com/intellij/codeInsight/editorActions/TextBlockTransferable.java127
-rw-r--r--platform/lang-impl/src/com/intellij/codeInsight/editorActions/TextBlockTransferableData.java30
-rw-r--r--platform/lang-impl/src/com/intellij/codeInsight/editorActions/fillParagraph/ParagraphFillHandler.java2
-rw-r--r--platform/lang-impl/src/com/intellij/codeInsight/generation/CommentByBlockCommentHandler.java95
-rw-r--r--platform/lang-impl/src/com/intellij/codeInsight/generation/CommentByLineCommentHandler.java623
-rw-r--r--platform/lang-impl/src/com/intellij/codeInsight/generation/actions/CommentByBlockCommentAction.java13
-rw-r--r--platform/lang-impl/src/com/intellij/codeInsight/generation/actions/CommentByLineCommentAction.java13
-rw-r--r--platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupImpl.java6
-rw-r--r--platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupOffsets.java88
-rw-r--r--platform/lang-impl/src/com/intellij/codeInsight/template/LiveTemplateBuilder.java9
-rw-r--r--platform/lang-impl/src/com/intellij/codeInsight/template/postfix/settings/PostfixDescriptionPanel.java1
-rw-r--r--platform/lang-impl/src/com/intellij/codeInsight/template/postfix/settings/PostfixTemplatesConfigurable.form2
-rw-r--r--platform/lang-impl/src/com/intellij/codeInspection/InspectionApplication.java2
-rw-r--r--platform/lang-impl/src/com/intellij/codeInspection/ex/Descriptor.java15
-rw-r--r--platform/lang-impl/src/com/intellij/codeInspection/ex/SeverityEditorDialog.java3
-rw-r--r--platform/lang-impl/src/com/intellij/codeInspection/ex/VisibleTreeState.java4
-rw-r--r--platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionResultsViewComparator.java2
-rw-r--r--platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionTree.java2
-rw-r--r--platform/lang-impl/src/com/intellij/execution/console/LanguageConsoleViewImpl.java2
-rw-r--r--platform/lang-impl/src/com/intellij/find/EditorSearchComponent.java34
-rw-r--r--platform/lang-impl/src/com/intellij/find/FindUtil.java102
-rw-r--r--platform/lang-impl/src/com/intellij/find/editorHeaderActions/AddOccurrenceAction.java46
-rw-r--r--platform/lang-impl/src/com/intellij/find/editorHeaderActions/EditorHeaderAction.java21
-rw-r--r--platform/lang-impl/src/com/intellij/find/editorHeaderActions/NextOccurrenceAction.java17
-rw-r--r--platform/lang-impl/src/com/intellij/find/editorHeaderActions/PrevOccurrenceAction.java17
-rw-r--r--platform/lang-impl/src/com/intellij/find/editorHeaderActions/RemoveOccurrenceAction.java49
-rw-r--r--platform/lang-impl/src/com/intellij/find/editorHeaderActions/RestorePreviousSettingsAction.java5
-rw-r--r--platform/lang-impl/src/com/intellij/find/editorHeaderActions/SelectAllAction.java53
-rw-r--r--platform/lang-impl/src/com/intellij/find/impl/FindInProjectUtil.java11
-rw-r--r--platform/lang-impl/src/com/intellij/find/impl/livePreview/LivePreview.java47
-rw-r--r--platform/lang-impl/src/com/intellij/find/impl/livePreview/LivePreviewController.java19
-rw-r--r--platform/lang-impl/src/com/intellij/find/impl/livePreview/SearchResults.java147
-rw-r--r--platform/lang-impl/src/com/intellij/find/impl/livePreview/SelectionManager.java90
-rw-r--r--platform/lang-impl/src/com/intellij/formatting/FormatProcessor.java23
-rw-r--r--platform/lang-impl/src/com/intellij/ide/actions/GotoActionAction.java28
-rw-r--r--platform/lang-impl/src/com/intellij/ide/actions/GotoRelatedFileAction.java46
-rw-r--r--platform/lang-impl/src/com/intellij/ide/actions/GotoRelatedSymbolAction.java37
-rw-r--r--platform/lang-impl/src/com/intellij/ide/actions/SearchEverywhereAction.java237
-rw-r--r--platform/lang-impl/src/com/intellij/ide/projectView/ProjectViewPsiTreeChangeListener.java6
-rw-r--r--platform/lang-impl/src/com/intellij/ide/projectView/actions/MarkExcludeRootAction.java13
-rw-r--r--platform/lang-impl/src/com/intellij/ide/projectView/actions/MarkRootActionBase.java74
-rw-r--r--platform/lang-impl/src/com/intellij/ide/projectView/actions/UnmarkRootAction.java24
-rw-r--r--platform/lang-impl/src/com/intellij/ide/projectView/impl/nodes/ProjectViewDirectoryHelper.java29
-rw-r--r--platform/lang-impl/src/com/intellij/ide/projectView/impl/nodes/PsiDirectoryNode.java13
-rw-r--r--platform/lang-impl/src/com/intellij/ide/ui/search/TraverseUIStarter.java2
-rw-r--r--platform/lang-impl/src/com/intellij/ide/util/gotoByName/GotoActionItemProvider.java169
-rw-r--r--platform/lang-impl/src/com/intellij/ide/util/gotoByName/GotoActionModel.java285
-rw-r--r--platform/lang-impl/src/com/intellij/injected/editor/InjectedCaret.java17
-rw-r--r--platform/lang-impl/src/com/intellij/internal/DumpDirectoryInfoAction.java7
-rw-r--r--platform/lang-impl/src/com/intellij/internal/DumpVfsInfoForExcludedFilesAction.java114
-rw-r--r--platform/lang-impl/src/com/intellij/lang/parser/GeneratedParserUtilBase.java25
-rw-r--r--platform/lang-impl/src/com/intellij/openapi/diff/impl/settings/DiffPreviewProvider.java2
-rw-r--r--platform/lang-impl/src/com/intellij/openapi/editor/actions/SelectAllOccurrencesAction.java53
-rw-r--r--platform/lang-impl/src/com/intellij/openapi/editor/actions/SelectNextOccurrenceAction.java30
-rw-r--r--platform/lang-impl/src/com/intellij/openapi/editor/actions/SelectOccurrencesActionHandler.java47
-rw-r--r--platform/lang-impl/src/com/intellij/openapi/editor/actions/UnselectPreviousOccurrenceAction.java10
-rw-r--r--platform/lang-impl/src/com/intellij/openapi/roots/impl/DirectoryIndexImpl.java27
-rw-r--r--platform/lang-impl/src/com/intellij/openapi/roots/impl/PushedFilePropertiesUpdater.java350
-rw-r--r--platform/lang-impl/src/com/intellij/openapi/roots/impl/PushedFilePropertiesUpdaterImpl.java351
-rw-r--r--platform/lang-impl/src/com/intellij/openapi/util/registry/RegistryUi.java4
-rw-r--r--platform/lang-impl/src/com/intellij/packageDependencies/ui/ProjectPatternProvider.java8
-rw-r--r--platform/lang-impl/src/com/intellij/profile/codeInspection/ui/AddScopeUtil.java117
-rw-r--r--platform/lang-impl/src/com/intellij/profile/codeInspection/ui/InspectionConfigTreeNode.java119
-rw-r--r--platform/lang-impl/src/com/intellij/profile/codeInspection/ui/InspectionToolsConfigurable.java2
-rw-r--r--platform/lang-impl/src/com/intellij/profile/codeInspection/ui/InspectionsAggregationUtil.java74
-rw-r--r--platform/lang-impl/src/com/intellij/profile/codeInspection/ui/InspectionsConfigTreeComparator.java74
-rw-r--r--platform/lang-impl/src/com/intellij/profile/codeInspection/ui/InspectionsConfigTreeRenderer.java117
-rw-r--r--platform/lang-impl/src/com/intellij/profile/codeInspection/ui/LevelChooser.java6
-rw-r--r--platform/lang-impl/src/com/intellij/profile/codeInspection/ui/LevelChooserAction.java33
-rw-r--r--platform/lang-impl/src/com/intellij/profile/codeInspection/ui/MultiScopeSeverityIcon.java58
-rw-r--r--platform/lang-impl/src/com/intellij/profile/codeInspection/ui/ScopesChooser.java98
-rw-r--r--platform/lang-impl/src/com/intellij/profile/codeInspection/ui/SingleInspectionProfilePanel.java542
-rw-r--r--platform/lang-impl/src/com/intellij/profile/codeInspection/ui/ToolDescriptors.java70
-rw-r--r--platform/lang-impl/src/com/intellij/profile/codeInspection/ui/actions/AddScopeAction.java164
-rw-r--r--platform/lang-impl/src/com/intellij/profile/codeInspection/ui/actions/DeleteScopeAction.java90
-rw-r--r--platform/lang-impl/src/com/intellij/profile/codeInspection/ui/actions/MoveScopeAction.java81
-rw-r--r--platform/lang-impl/src/com/intellij/profile/codeInspection/ui/filter/InspectionFilterAction.java129
-rw-r--r--platform/lang-impl/src/com/intellij/profile/codeInspection/ui/filter/InspectionsFilter.java102
-rw-r--r--platform/lang-impl/src/com/intellij/profile/codeInspection/ui/inspectionsTree/InspectionConfigTreeNode.java97
-rw-r--r--platform/lang-impl/src/com/intellij/profile/codeInspection/ui/inspectionsTree/InspectionsConfigTreeComparator.java74
-rw-r--r--platform/lang-impl/src/com/intellij/profile/codeInspection/ui/inspectionsTree/InspectionsConfigTreeRenderer.java95
-rw-r--r--platform/lang-impl/src/com/intellij/profile/codeInspection/ui/inspectionsTree/InspectionsConfigTreeTable.java257
-rw-r--r--platform/lang-impl/src/com/intellij/profile/codeInspection/ui/inspectionsTree/MultiScopeSeverityIcon.java74
-rw-r--r--platform/lang-impl/src/com/intellij/profile/codeInspection/ui/inspectionsTree/ScopesAndSeveritiesHintTable.java106
-rw-r--r--platform/lang-impl/src/com/intellij/profile/codeInspection/ui/table/ScopesAndSeveritiesTable.java404
-rw-r--r--platform/lang-impl/src/com/intellij/profile/codeInspection/ui/table/SeverityRenderer.java64
-rw-r--r--platform/lang-impl/src/com/intellij/profile/codeInspection/ui/table/ThreeStateCheckBoxRenderer.java127
-rw-r--r--platform/lang-impl/src/com/intellij/psi/impl/file/DirectoryIconProvider.java13
-rw-r--r--platform/lang-impl/src/com/intellij/psi/impl/file/impl/PsiVFSListener.java2
-rw-r--r--platform/lang-impl/src/com/intellij/psi/impl/source/PostprocessReformattingAspect.java2
-rw-r--r--platform/lang-impl/src/com/intellij/psi/impl/source/codeStyle/CodeFormatterFacade.java16
-rw-r--r--platform/lang-impl/src/com/intellij/psi/impl/source/codeStyle/CodeStyleFacadeImpl.java5
-rw-r--r--platform/lang-impl/src/com/intellij/psi/impl/source/codeStyle/CodeStyleManagerImpl.java6
-rw-r--r--platform/lang-impl/src/com/intellij/psi/impl/source/tree/injected/InjectedLanguageUtil.java17
-rw-r--r--platform/lang-impl/src/com/intellij/psi/stubs/StubIndexImpl.java25
-rw-r--r--platform/lang-impl/src/com/intellij/refactoring/actions/RefactoringQuickListPopupAction.java5
-rw-r--r--platform/lang-impl/src/com/intellij/refactoring/introduce/inplace/AbstractInplaceIntroducer.java20
-rw-r--r--platform/lang-impl/src/com/intellij/refactoring/rename/inplace/InplaceRefactoring.java19
-rw-r--r--platform/lang-impl/src/com/intellij/refactoring/rename/inplace/MemberInplaceRenamer.java5
-rw-r--r--platform/lang-impl/src/com/intellij/refactoring/rename/inplace/VariableInplaceRenamer.java23
-rw-r--r--platform/lang-impl/src/com/intellij/unscramble/AnalyzeStacktraceOnErrorAction.java26
-rw-r--r--platform/lang-impl/src/com/intellij/util/indexing/ContentHashesSupport.java11
-rw-r--r--platform/lang-impl/src/com/intellij/util/indexing/DebugAssertions.java14
-rw-r--r--platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndexImpl.java55
-rw-r--r--platform/lang-impl/src/com/intellij/util/indexing/IndexingStamp.java2
-rw-r--r--platform/lang-impl/src/com/intellij/util/indexing/MapReduceIndex.java153
-rw-r--r--platform/lang-impl/src/com/intellij/util/indexing/containers/ChangeBufferingList.java5
-rw-r--r--platform/lvcs-impl/src/com/intellij/history/integration/IdeaGateway.java2
-rw-r--r--platform/platform-api/src/com/intellij/codeInsight/editorActions/TextBlockTransferable.java127
-rw-r--r--platform/platform-api/src/com/intellij/codeInsight/editorActions/TextBlockTransferableData.java30
-rw-r--r--platform/platform-api/src/com/intellij/codeStyle/CodeStyleFacade.java3
-rw-r--r--platform/platform-api/src/com/intellij/openapi/actionSystem/IdeActions.java3
-rw-r--r--platform/platform-api/src/com/intellij/openapi/actionSystem/ex/ComboBoxAction.java7
-rw-r--r--platform/platform-api/src/com/intellij/openapi/editor/CaretStateTransferableData.java56
-rw-r--r--platform/platform-api/src/com/intellij/openapi/editor/ClipboardTextPerCaretSplitter.java18
-rw-r--r--platform/platform-api/src/com/intellij/openapi/editor/CopyPasteSupport.java212
-rw-r--r--platform/platform-api/src/com/intellij/openapi/editor/EditorModificationUtil.java155
-rw-r--r--platform/platform-api/src/com/intellij/openapi/editor/highlighter/FragmentedEditorHighlighter.java5
-rw-r--r--platform/platform-api/src/com/intellij/openapi/options/ConfigurableEP.java4
-rw-r--r--platform/platform-api/src/com/intellij/openapi/options/SearchableConfigurable.java10
-rw-r--r--platform/platform-api/src/com/intellij/openapi/ui/ComboBoxTableRenderer.java12
-rw-r--r--platform/platform-api/src/com/intellij/openapi/ui/DetailsComponent.java6
-rw-r--r--platform/platform-api/src/com/intellij/openapi/ui/FixedSizeButton.java6
-rw-r--r--platform/platform-api/src/com/intellij/openapi/ui/MasterDetailsComponent.java6
-rw-r--r--platform/platform-api/src/com/intellij/openapi/ui/ThreeComponentsSplitter.java17
-rw-r--r--platform/platform-api/src/com/intellij/openapi/wm/FocusCommand.java61
-rw-r--r--platform/platform-api/src/com/intellij/ui/BooleanTableCellRenderer.java6
-rw-r--r--platform/platform-api/src/com/intellij/ui/ColorChooser.java21
-rw-r--r--platform/platform-api/src/com/intellij/ui/ColorChooserService.java13
-rw-r--r--platform/platform-api/src/com/intellij/ui/ColorPickerListener.java1
-rw-r--r--platform/platform-api/src/com/intellij/ui/ExpandedItemRendererComponentWrapper.java13
-rw-r--r--platform/platform-api/src/com/intellij/ui/GroupedElementsRenderer.java42
-rw-r--r--platform/platform-api/src/com/intellij/ui/JBSplitter.java10
-rw-r--r--platform/platform-api/src/com/intellij/ui/TextFieldWithHistoryWithBrowseButton.java6
-rw-r--r--platform/platform-api/src/com/intellij/ui/dualView/DualView.java4
-rw-r--r--platform/platform-api/src/com/intellij/ui/speedSearch/SpeedSearchSupply.java6
-rw-r--r--platform/platform-api/src/com/intellij/ui/table/JBTable.java39
-rw-r--r--platform/platform-api/src/com/intellij/ui/table/TableView.java20
-rw-r--r--platform/platform-api/src/com/intellij/ui/tabs/impl/JBTabsImpl.java4
-rw-r--r--platform/platform-api/src/com/intellij/util/net/HTTPProxySettings.form1
-rw-r--r--platform/platform-api/src/com/intellij/util/ui/NSScrollerHelper.java2
-rw-r--r--platform/platform-impl/src/com/intellij/codeStyle/DefaultCodeStyleFacade.java3
-rw-r--r--platform/platform-impl/src/com/intellij/diagnostic/PerformanceWatcher.java20
-rw-r--r--platform/platform-impl/src/com/intellij/execution/impl/EditorHyperlinkSupport.java3
-rw-r--r--platform/platform-impl/src/com/intellij/help/impl/KeymapGenerator.java13
-rw-r--r--platform/platform-impl/src/com/intellij/ide/IdeEventQueue.java26
-rw-r--r--platform/platform-impl/src/com/intellij/ide/MacOSApplicationProvider.java7
-rw-r--r--platform/platform-impl/src/com/intellij/ide/TipOfTheDayManager.java2
-rw-r--r--platform/platform-impl/src/com/intellij/ide/actions/ShowSettingsAction.java7
-rw-r--r--platform/platform-impl/src/com/intellij/ide/actions/ShowSettingsUtilImpl.java112
-rw-r--r--platform/platform-impl/src/com/intellij/ide/actions/TemplateProjectPropertiesAction.java5
-rw-r--r--platform/platform-impl/src/com/intellij/ide/customize/PluginGroups.java6
-rw-r--r--platform/platform-impl/src/com/intellij/ide/file/BatchFileChangeListener.java45
-rw-r--r--platform/platform-impl/src/com/intellij/ide/passwordSafe/HelpID.java6
-rw-r--r--platform/platform-impl/src/com/intellij/ide/passwordSafe/PasswordStorage.java62
-rw-r--r--platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/PasswordSafeImpl.java72
-rw-r--r--platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/PasswordSafeProvider.java21
-rw-r--r--platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/BasePasswordSafeProvider.java37
-rw-r--r--platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/masterKey/EnterPasswordComponent.java6
-rw-r--r--platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/masterKey/MasterKeyPasswordSafe.java67
-rw-r--r--platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/masterKey/ResetPasswordComponent.java2
-rw-r--r--platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/memory/MemoryPasswordSafe.java27
-rw-r--r--platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/nil/NilProvider.java32
-rw-r--r--platform/platform-impl/src/com/intellij/ide/passwordSafe/ui/PasswordSafePromptDialog.java2
-rw-r--r--platform/platform-impl/src/com/intellij/ide/plugins/PluginInstaller.java42
-rw-r--r--platform/platform-impl/src/com/intellij/ide/plugins/PluginManagerMain.java4
-rw-r--r--platform/platform-impl/src/com/intellij/ide/plugins/PluginsTableRenderer.form6
-rw-r--r--platform/platform-impl/src/com/intellij/ide/plugins/PluginsTableRenderer.java26
-rw-r--r--platform/platform-impl/src/com/intellij/ide/ui/search/SearchUtil.java8
-rw-r--r--platform/platform-impl/src/com/intellij/ide/util/TipDialog.java43
-rw-r--r--platform/platform-impl/src/com/intellij/idea/IdeaLogger.java2
-rwxr-xr-xplatform/platform-impl/src/com/intellij/idea/StartupUtil.java2
-rw-r--r--platform/platform-impl/src/com/intellij/jps/impl/JpsIdePluginManagerImpl.java19
-rw-r--r--platform/platform-impl/src/com/intellij/jps/impl/JpsPluginBean.java26
-rw-r--r--platform/platform-impl/src/com/intellij/openapi/application/impl/ApplicationImpl.java18
-rw-r--r--platform/platform-impl/src/com/intellij/openapi/diff/impl/Rediffers.java7
-rw-r--r--platform/platform-impl/src/com/intellij/openapi/editor/actions/EditorActionUtil.java8
-rw-r--r--platform/platform-impl/src/com/intellij/openapi/editor/ex/SoftWrapModelEx.java5
-rw-r--r--platform/platform-impl/src/com/intellij/openapi/editor/impl/BorderEffect.java2
-rw-r--r--platform/platform-impl/src/com/intellij/openapi/editor/impl/CaretImpl.java7
-rw-r--r--platform/platform-impl/src/com/intellij/openapi/editor/impl/CaretModelImpl.java14
-rw-r--r--platform/platform-impl/src/com/intellij/openapi/editor/impl/DefaultEditorTextRepresentationHelper.java34
-rw-r--r--platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorImpl.java16
-rw-r--r--platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorMarkupModelImpl.java19
-rw-r--r--platform/platform-impl/src/com/intellij/openapi/editor/impl/FoldingModelImpl.java3
-rw-r--r--platform/platform-impl/src/com/intellij/openapi/editor/impl/SelectionModelImpl.java11
-rw-r--r--platform/platform-impl/src/com/intellij/openapi/editor/impl/SettingsImpl.java25
-rw-r--r--platform/platform-impl/src/com/intellij/openapi/editor/impl/SoftWrapModelImpl.java37
-rw-r--r--platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/AbstractMappingStrategy.java11
-rw-r--r--platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/CacheEntry.java16
-rw-r--r--platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/CachingSoftWrapDataMapper.java21
-rw-r--r--platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/EditorPosition.java35
-rw-r--r--platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/LogicalToVisualMappingStrategy.java8
-rw-r--r--platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/OffsetToLogicalCalculationStrategy.java11
-rw-r--r--platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/SoftWrapApplianceManager.java21
-rw-r--r--platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/VisualToLogicalCalculationStrategy.java10
-rw-r--r--platform/platform-impl/src/com/intellij/openapi/editor/textarea/TextComponentCaret.java6
-rw-r--r--platform/platform-impl/src/com/intellij/openapi/editor/textarea/TextComponentEditor.java2
-rw-r--r--platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorWindow.java57
-rw-r--r--platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/FileDocumentManagerImpl.java8
-rw-r--r--platform/platform-impl/src/com/intellij/openapi/keymap/impl/IdeKeyEventDispatcher.java37
-rw-r--r--platform/platform-impl/src/com/intellij/openapi/keymap/impl/KeymapManagerImpl.java13
-rw-r--r--platform/platform-impl/src/com/intellij/openapi/keymap/impl/ModifierKeyDoubleClickHandler.java210
-rw-r--r--platform/platform-impl/src/com/intellij/openapi/options/ConfigurableBase.java52
-rw-r--r--platform/platform-impl/src/com/intellij/openapi/options/ConfigurableUi.java16
-rw-r--r--platform/platform-impl/src/com/intellij/openapi/options/ex/ConfigurableWrapper.java38
-rw-r--r--platform/platform-impl/src/com/intellij/openapi/options/ex/MixedConfigurableGroup.java83
-rw-r--r--platform/platform-impl/src/com/intellij/openapi/options/newEditor/OptionsTree.java46
-rw-r--r--platform/platform-impl/src/com/intellij/openapi/project/impl/ProjectManagerImpl.java7
-rw-r--r--platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/PluginUpdateInfoPanel.form8
-rw-r--r--platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/FileWatcher.java46
-rw-r--r--platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/FSRecords.java6
-rw-r--r--platform/platform-impl/src/com/intellij/openapi/wm/impl/FocusManagerImpl.java4
-rw-r--r--platform/platform-impl/src/com/intellij/openapi/wm/impl/StripeButton.java13
-rw-r--r--platform/platform-impl/src/com/intellij/openapi/wm/impl/TestWindowManager.java35
-rw-r--r--platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowImpl.java2
-rw-r--r--platform/platform-impl/src/com/intellij/openapi/wm/impl/commands/RequestFocusInToolWindowCmd.java2
-rw-r--r--platform/platform-impl/src/com/intellij/openapi/wm/impl/status/InfoAndProgressPanel.java3
-rw-r--r--platform/platform-impl/src/com/intellij/remote/PathMappingProvider.java5
-rw-r--r--platform/platform-impl/src/com/intellij/remote/RemoteFile.java9
-rw-r--r--platform/platform-impl/src/com/intellij/remotesdk/MutableRemoteCredentials.java23
-rw-r--r--platform/platform-impl/src/com/intellij/remotesdk/RemoteCancelledException.java27
-rw-r--r--platform/platform-impl/src/com/intellij/remotesdk/RemoteCredentials.java24
-rw-r--r--platform/platform-impl/src/com/intellij/remotesdk/RemoteCredentialsHolder.java24
-rw-r--r--platform/platform-impl/src/com/intellij/remotesdk/RemoteFile.java38
-rw-r--r--platform/platform-impl/src/com/intellij/remotesdk/RemoteInterpreterException.java29
-rw-r--r--platform/platform-impl/src/com/intellij/remotesdk/RemoteProcessHandlerBase.java24
-rw-r--r--platform/platform-impl/src/com/intellij/remotesdk/RemoteSdkAdditionalData.java12
-rw-r--r--platform/platform-impl/src/com/intellij/remotesdk/RemoteSdkData.java26
-rw-r--r--platform/platform-impl/src/com/intellij/remotesdk/RemoteSdkDataBuilder.java26
-rw-r--r--platform/platform-impl/src/com/intellij/remotesdk/RemoteSdkDataHolder.java30
-rw-r--r--platform/platform-impl/src/com/intellij/remotesdk/RemoteSdkFactory.java45
-rw-r--r--platform/platform-impl/src/com/intellij/remotesdk/RemoteSshProcess.java23
-rw-r--r--platform/platform-impl/src/com/intellij/ui/AbstractExpandableItemsHandler.java21
-rw-r--r--platform/platform-impl/src/com/intellij/ui/CellRendererPanel.java8
-rw-r--r--platform/platform-impl/src/com/intellij/ui/ColorChooserServiceImpl.java16
-rw-r--r--platform/platform-impl/src/com/intellij/ui/ColorPicker.java13
-rw-r--r--platform/platform-impl/src/com/intellij/ui/ColorPickerListenerFactory.java29
-rw-r--r--platform/platform-impl/src/com/intellij/ui/EditorTextFieldCellRenderer.java44
-rw-r--r--platform/platform-impl/src/com/intellij/ui/ShowColorPickerAction.java7
-rw-r--r--platform/platform-impl/src/com/intellij/ui/Splash.java13
-rw-r--r--platform/platform-impl/src/com/intellij/ui/TableExpandableItemsHandler.java16
-rw-r--r--platform/platform-impl/src/com/intellij/ui/TableSpeedSearch.java4
-rw-r--r--platform/platform-impl/src/com/intellij/ui/TreeExpandableItemsHandler.java3
-rw-r--r--platform/platform-impl/src/com/intellij/ui/messages/JBMacMessages.java10
-rw-r--r--platform/platform-impl/src/com/intellij/ui/popup/AbstractPopup.java80
-rw-r--r--platform/platform-impl/src/com/intellij/ui/popup/PopupFactoryImpl.java17
-rw-r--r--platform/platform-impl/src/com/intellij/ui/popup/list/GroupedItemsListRenderer.java13
-rw-r--r--platform/platform-impl/src/com/intellij/util/ui/SwingHelper.java465
-rw-r--r--platform/platform-impl/src/com/intellij/util/ui/table/TableModelEditor.java9
-rw-r--r--platform/platform-resources-en/src/messages/ActionsBundle.properties18
-rw-r--r--platform/platform-resources-en/src/messages/ApplicationBundle.properties5
-rw-r--r--platform/platform-resources-en/src/messages/CodeInsightBundle.properties8
-rw-r--r--platform/platform-resources-en/src/messages/IdeBundle.properties2
-rw-r--r--platform/platform-resources-en/src/messages/InspectionsBundle.properties1
-rw-r--r--platform/platform-resources-en/src/messages/OptionsBundle.properties11
-rw-r--r--platform/platform-resources-en/src/messages/XDebuggerBundle.properties12
-rw-r--r--platform/platform-resources-en/src/misc/registry.properties61
-rw-r--r--platform/platform-resources-en/src/tips/QuickEvaluateExpression.html15
-rw-r--r--platform/platform-resources-en/src/tips/images/quick_evaluate.pngbin0 -> 5679 bytes
-rw-r--r--platform/platform-resources/src/META-INF/LangExtensions.xml22
-rw-r--r--platform/platform-resources/src/META-INF/PlatformExtensionPoints.xml3
-rw-r--r--platform/platform-resources/src/META-INF/PlatformExtensions.xml28
-rw-r--r--platform/platform-resources/src/META-INF/PlatformLangPlugin.xml4
-rw-r--r--platform/platform-resources/src/META-INF/VcsExtensions.xml2
-rw-r--r--platform/platform-resources/src/META-INF/XmlPlugin.xml4
-rw-r--r--platform/platform-resources/src/META-INF/xdebugger.xml4
-rw-r--r--platform/platform-resources/src/brokenPlugins.txt3
-rw-r--r--platform/platform-resources/src/componentSets/Lang.xml5
-rw-r--r--platform/platform-resources/src/idea/PlatformLangActionManager.xml2
-rw-r--r--platform/platform-resources/src/idea/VcsActions.xml3
-rw-r--r--platform/platform-tests/testSrc/com/intellij/openapi/editor/EditorMultiCaretTest.java32
-rw-r--r--platform/platform-tests/testSrc/com/intellij/openapi/editor/actions/EditorActionTest.java11
-rw-r--r--platform/platform-tests/testSrc/com/intellij/openapi/editor/actions/SelectUnselectOccurrenceActionsTest.java65
-rw-r--r--platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/softwrap/mapping/CachingSoftWrapDataMapperTest.java9
-rw-r--r--platform/platform-tests/testSrc/com/intellij/openapi/fileEditor/FileEditorManagerTest.java17
-rw-r--r--platform/platform-tests/testSrc/com/intellij/openapi/keymap/impl/ModifierKeyDoubleClickHandlerTest.java169
-rw-r--r--platform/platform-tests/testSrc/com/intellij/patterns/StandardPatternsTest.java76
-rw-r--r--platform/platform-tests/testSrc/com/intellij/patterns/StringPatternTest.java92
-rw-r--r--platform/platform-tests/testSrc/com/intellij/psi/PsiDocumentManagerImplTest.java4
-rw-r--r--platform/platform-tests/testSrc/com/intellij/usages/impl/UsageViewTest.java10
-rw-r--r--platform/projectModel-api/src/com/intellij/openapi/roots/ProjectFileIndex.java15
-rw-r--r--platform/projectModel-impl/src/com/intellij/ide/projectView/impl/ProjectRootsUtil.java12
-rw-r--r--platform/projectModel-impl/src/com/intellij/lang/LanguagePerFileMappings.java (renamed from platform/lang-impl/src/com/intellij/lang/LanguagePerFileMappings.java)0
-rw-r--r--platform/projectModel-impl/src/com/intellij/openapi/roots/ModuleRootModificationUtil.java24
-rw-r--r--platform/projectModel-impl/src/com/intellij/openapi/roots/impl/DirectoryIndex.java12
-rw-r--r--platform/projectModel-impl/src/com/intellij/openapi/roots/impl/DirectoryInfo.java226
-rw-r--r--platform/projectModel-impl/src/com/intellij/openapi/roots/impl/DirectoryInfoImpl.java255
-rw-r--r--platform/projectModel-impl/src/com/intellij/openapi/roots/impl/FileIndexBase.java17
-rw-r--r--platform/projectModel-impl/src/com/intellij/openapi/roots/impl/FilePropertyPusher.java2
-rw-r--r--platform/projectModel-impl/src/com/intellij/openapi/roots/impl/ModuleFileIndexImpl.java26
-rw-r--r--platform/projectModel-impl/src/com/intellij/openapi/roots/impl/NonProjectDirectoryInfo.java127
-rw-r--r--platform/projectModel-impl/src/com/intellij/openapi/roots/impl/ProjectFileIndexFacade.java4
-rw-r--r--platform/projectModel-impl/src/com/intellij/openapi/roots/impl/ProjectFileIndexImpl.java67
-rw-r--r--platform/projectModel-impl/src/com/intellij/openapi/roots/impl/PushedFilePropertiesUpdater.java34
-rw-r--r--platform/projectModel-impl/src/com/intellij/openapi/roots/impl/RootIndex.java102
-rw-r--r--platform/remote-servers/impl/resources/resources/cloud.properties3
-rw-r--r--platform/remote-servers/impl/src/META-INF/RemoteServers.xml2
-rw-r--r--platform/remote-servers/impl/src/com/intellij/remoteServer/impl/configuration/RemoteServerConfigurable.java22
-rw-r--r--platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ui/ServersToolWindowContent.java3
-rw-r--r--platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ui/tree/ServersTreeStructure.java18
-rw-r--r--platform/remote-servers/impl/src/com/intellij/remoteServer/util/CloudAccountSelectionEditor.form31
-rw-r--r--platform/remote-servers/impl/src/com/intellij/remoteServer/util/CloudAccountSelectionEditor.java304
-rw-r--r--platform/remote-servers/impl/src/com/intellij/remoteServer/util/CloudRuntimeTask.java9
-rw-r--r--platform/remote-servers/impl/src/com/intellij/remoteServer/util/CloudSupportConfigurableBase.java190
-rw-r--r--platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/BasicDebuggerViewSupport.java5
-rw-r--r--platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/DebuggerViewSupport.java2
-rw-r--r--platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/VariableView.java2
-rw-r--r--platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/frame/CallFrameView.java10
-rw-r--r--platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/frame/StackFrameImplBase.java15
-rw-r--r--platform/structuralsearch/build.xml53
-rw-r--r--platform/structuralsearch/source/META-INF/structuralsearch.xml39
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/DocumentBasedReplaceHandler.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/DocumentBasedReplaceHandler.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/MalformedPatternException.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/MalformedPatternException.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/MatchOptions.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/MatchOptions.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/MatchResult.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/MatchResult.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/MatchResultSink.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/MatchResultSink.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/MatchVariableConstraint.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/MatchVariableConstraint.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/Matcher.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/Matcher.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/MatchingProcess.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/MatchingProcess.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/NamedScriptableDefinition.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/NamedScriptableDefinition.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/PredefinedConfigurationUtil.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/PredefinedConfigurationUtil.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/ReplacementVariableDefinition.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/ReplacementVariableDefinition.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/SSRBundle.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/SSRBundle.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/StructuralReplaceHandler.java16
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/StructuralSearchException.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/StructuralSearchException.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/StructuralSearchProfile.java281
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/StructuralSearchProfileBase.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/StructuralSearchProfileBase.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/StructuralSearchUtil.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/StructuralSearchUtil.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/UnsupportedPatternException.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/UnsupportedPatternException.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/XmlStructuralSearchProfile.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/XmlStructuralSearchProfile.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/CompiledPattern.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/CompiledPattern.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/DataProvider.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/DataProvider.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/GlobalMatchingVisitor.java315
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/MatchConstraintsSink.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/MatchConstraintsSink.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/MatchContext.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/MatchContext.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/MatchPredicateProvider.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/MatchPredicateProvider.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/MatchResultImpl.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/MatchResultImpl.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/MatchUtils.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/MatchUtils.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/MatcherImpl.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/MatcherImpl.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/MatcherImplUtil.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/MatcherImplUtil.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/PatternTreeContext.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/PatternTreeContext.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/XmlCompiledPattern.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/XmlCompiledPattern.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/XmlMatchingVisitor.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/XmlMatchingVisitor.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/compiler/CompileContext.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/compiler/CompileContext.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/compiler/DeleteNodesAction.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/compiler/DeleteNodesAction.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/compiler/FindInFilesOptimizingSearchHelper.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/compiler/FindInFilesOptimizingSearchHelper.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/compiler/GlobalCompilingVisitor.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/compiler/GlobalCompilingVisitor.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/compiler/OptimizingSearchHelper.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/compiler/OptimizingSearchHelper.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/compiler/OptimizingSearchHelperBase.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/compiler/OptimizingSearchHelperBase.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/compiler/PatternCompiler.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/compiler/PatternCompiler.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/compiler/StringToConstraintsTransformer.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/compiler/StringToConstraintsTransformer.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/compiler/TestModeOptimizingSearchHelper.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/compiler/TestModeOptimizingSearchHelper.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/compiler/XmlCompilingVisitor.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/compiler/XmlCompilingVisitor.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/filters/CompositeFilter.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/filters/CompositeFilter.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/filters/DefaultFilter.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/filters/DefaultFilter.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/filters/LexicalNodesFilter.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/filters/LexicalNodesFilter.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/filters/TagValueFilter.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/filters/TagValueFilter.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/filters/XmlLexicalNodesFilter.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/filters/XmlLexicalNodesFilter.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/handlers/DelegatingHandler.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/handlers/DelegatingHandler.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/handlers/LightTopLevelMatchingHandler.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/handlers/LightTopLevelMatchingHandler.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/handlers/LiteralWithSubstitutionHandler.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/handlers/LiteralWithSubstitutionHandler.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/handlers/MatchPredicate.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/handlers/MatchPredicate.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/handlers/MatchingHandler.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/handlers/MatchingHandler.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/handlers/SimpleHandler.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/handlers/SimpleHandler.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/handlers/SkippingHandler.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/handlers/SkippingHandler.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/handlers/SubstitutionHandler.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/handlers/SubstitutionHandler.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/handlers/SymbolHandler.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/handlers/SymbolHandler.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/handlers/TopLevelMatchingHandler.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/handlers/TopLevelMatchingHandler.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/handlers/TypedSymbolHandler.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/handlers/TypedSymbolHandler.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/handlers/XmlTextHandler.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/handlers/XmlTextHandler.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/iterators/SsrFilteringNodeIterator.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/iterators/SsrFilteringNodeIterator.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/predicates/AbstractStringBasedPredicate.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/predicates/AbstractStringBasedPredicate.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/predicates/BinaryPredicate.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/predicates/BinaryPredicate.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/predicates/ContainsPredicate.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/predicates/ContainsPredicate.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/predicates/NotPredicate.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/predicates/NotPredicate.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/predicates/ReferencePredicate.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/predicates/ReferencePredicate.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/predicates/RegExpPredicate.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/predicates/RegExpPredicate.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/predicates/ScriptPredicate.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/predicates/ScriptPredicate.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/predicates/ScriptSupport.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/predicates/ScriptSupport.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/predicates/WithinPredicate.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/predicates/WithinPredicate.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/strategies/MatchingStrategy.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/strategies/MatchingStrategy.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/strategies/XmlMatchingStrategy.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/strategies/XmlMatchingStrategy.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/inspection/highlightTemplate/SSBasedInspection.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/inspection/highlightTemplate/SSBasedInspection.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/inspection/highlightTemplate/SSBasedInspectionCompiledPatternsCache.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/inspection/highlightTemplate/SSBasedInspectionCompiledPatternsCache.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/inspection/highlightTemplate/SSBasedInspectionOptions.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/inspection/highlightTemplate/SSBasedInspectionOptions.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/plugin/StructuralReplaceAction.java50
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/plugin/StructuralSearchAction.java49
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/plugin/StructuralSearchPlugin.java111
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/ReplaceOptions.java185
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/ReplacementInfo.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/ReplacementInfo.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/impl/ParameterInfo.java114
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/impl/ReplacementBuilder.java218
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/impl/ReplacementContext.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/impl/ReplacementContext.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/impl/ReplacementInfoImpl.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/impl/ReplacementInfoImpl.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/impl/Replacer.java426
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/impl/ReplacerUtil.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/impl/ReplacerUtil.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/ui/ReplaceCommand.java40
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/ui/ReplaceConfiguration.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/ui/ReplaceConfiguration.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/ui/ReplaceDialog.java195
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/ui/ReplaceUsageViewContext.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/ui/ReplaceUsageViewContext.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/ui/ReplacementPreviewDialog.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/ui/ReplacementPreviewDialog.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/Configuration.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/Configuration.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/ConfigurationCreator.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/ConfigurationCreator.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/ConfigurationManager.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/ConfigurationManager.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/DialogBase.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/DialogBase.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/EditVarConstraintsDialog.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/EditVarConstraintsDialog.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/ExistingTemplatesComponent.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/ExistingTemplatesComponent.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/SearchCommand.java142
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/SearchConfiguration.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/SearchConfiguration.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/SearchContext.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/SearchContext.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/SearchDialog.java995
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/SearchModel.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/SearchModel.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/SelectTemplateDialog.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/SelectTemplateDialog.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/SubstitutionShortInfoHandler.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/SubstitutionShortInfoHandler.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/UIUtil.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/UIUtil.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/UsageViewContext.java190
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/VarConstraints.form (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/VarConstraints.form)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/plugin/util/CollectingMatchResultSink.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/util/CollectingMatchResultSink.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/structuralsearch/plugin/util/SmartPsiPointer.java (renamed from plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/util/SmartPsiPointer.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/tokenindex/AnonymToken.java (renamed from plugins/structuralsearch/source/com/intellij/tokenindex/AnonymToken.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/tokenindex/IndentToken.java (renamed from plugins/structuralsearch/source/com/intellij/tokenindex/IndentToken.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/tokenindex/LanguageTokenizer.java (renamed from plugins/structuralsearch/source/com/intellij/tokenindex/LanguageTokenizer.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/tokenindex/PathMarkerToken.java (renamed from plugins/structuralsearch/source/com/intellij/tokenindex/PathMarkerToken.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/tokenindex/PsiMarkerToken.java (renamed from plugins/structuralsearch/source/com/intellij/tokenindex/PsiMarkerToken.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/tokenindex/RecursiveTokenizingVisitor.java (renamed from plugins/structuralsearch/source/com/intellij/tokenindex/RecursiveTokenizingVisitor.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/tokenindex/TextToken.java (renamed from plugins/structuralsearch/source/com/intellij/tokenindex/TextToken.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/tokenindex/Token.java (renamed from plugins/structuralsearch/source/com/intellij/tokenindex/Token.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/tokenindex/TokenIndex.java (renamed from plugins/structuralsearch/source/com/intellij/tokenindex/TokenIndex.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/tokenindex/TokenIndexKey.java (renamed from plugins/structuralsearch/source/com/intellij/tokenindex/TokenIndexKey.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/tokenindex/TokenIndexKeyDescriptor.java (renamed from plugins/structuralsearch/source/com/intellij/tokenindex/TokenIndexKeyDescriptor.java)0
-rw-r--r--platform/structuralsearch/source/com/intellij/tokenindex/Tokenizer.java (renamed from plugins/structuralsearch/source/com/intellij/tokenindex/Tokenizer.java)0
-rw-r--r--platform/structuralsearch/source/inspectionDescriptions/SSBasedInspection.html (renamed from plugins/structuralsearch/source/inspectionDescriptions/SSBasedInspection.html)0
-rw-r--r--platform/structuralsearch/source/messages/SSRBundle.properties233
-rw-r--r--platform/structuralsearch/structuralsearch-tests.iml (renamed from plugins/structuralsearch/structuralsearch-tests.iml)0
-rw-r--r--platform/structuralsearch/structuralsearch.iml (renamed from plugins/structuralsearch/structuralsearch.iml)0
-rw-r--r--platform/structuralsearch/testData/java/DoNotFindReturn.java (renamed from plugins/structuralsearch/testData/java/DoNotFindReturn.java)0
-rw-r--r--platform/structuralsearch/testData/java/ReformatAndShortenClassRefPerformance_pattern.java (renamed from plugins/structuralsearch/testData/java/ReformatAndShortenClassRefPerformance_pattern.java)0
-rw-r--r--platform/structuralsearch/testData/java/ReformatAndShortenClassRefPerformance_replacement.java (renamed from plugins/structuralsearch/testData/java/ReformatAndShortenClassRefPerformance_replacement.java)0
-rw-r--r--platform/structuralsearch/testData/java/ReformatAndShortenClassRefPerformance_result.java (renamed from plugins/structuralsearch/testData/java/ReformatAndShortenClassRefPerformance_result.java)0
-rw-r--r--platform/structuralsearch/testData/java/ReformatAndShortenClassRefPerformance_source.java (renamed from plugins/structuralsearch/testData/java/ReformatAndShortenClassRefPerformance_source.java)0
-rw-r--r--platform/structuralsearch/testData/java/after1.java (renamed from plugins/structuralsearch/testData/java/after1.java)0
-rw-r--r--platform/structuralsearch/testData/java/after2.java (renamed from plugins/structuralsearch/testData/java/after2.java)0
-rw-r--r--platform/structuralsearch/testData/java/before1.java (renamed from plugins/structuralsearch/testData/java/before1.java)0
-rw-r--r--platform/structuralsearch/testData/java/before2.java (renamed from plugins/structuralsearch/testData/java/before2.java)0
-rw-r--r--platform/structuralsearch/testData/ssBased/ExpressionStatement.java (renamed from plugins/structuralsearch/testData/ssBased/ExpressionStatement.java)0
-rw-r--r--platform/structuralsearch/testData/ssBased/TwoStatementPattern.java (renamed from plugins/structuralsearch/testData/ssBased/TwoStatementPattern.java)0
-rw-r--r--platform/structuralsearch/testData/ssBased/simple/expected.xml (renamed from plugins/structuralsearch/testData/ssBased/simple/expected.xml)0
-rw-r--r--platform/structuralsearch/testData/ssBased/simple/src/x/X.java (renamed from plugins/structuralsearch/testData/ssBased/simple/src/x/X.java)0
-rw-r--r--platform/structuralsearch/testSource/com/intellij/structuralsearch/OptimizedSearchScanTest.java (renamed from plugins/structuralsearch/testSource/com/intellij/structuralsearch/OptimizedSearchScanTest.java)0
-rw-r--r--platform/structuralsearch/testSource/com/intellij/structuralsearch/SSBasedInspectionTest.java47
-rw-r--r--platform/structuralsearch/testSource/com/intellij/structuralsearch/SSRCodeInsightTest.java75
-rw-r--r--platform/structuralsearch/testSource/com/intellij/structuralsearch/StructuralReplaceTest.java2132
-rw-r--r--platform/structuralsearch/testSource/com/intellij/structuralsearch/StructuralReplaceTestCase.java (renamed from plugins/structuralsearch/testSource/com/intellij/structuralsearch/StructuralReplaceTestCase.java)0
-rw-r--r--platform/structuralsearch/testSource/com/intellij/structuralsearch/StructuralSearchTest.java2946
-rw-r--r--platform/structuralsearch/testSource/com/intellij/structuralsearch/StructuralSearchTestCase.java (renamed from plugins/structuralsearch/testSource/com/intellij/structuralsearch/StructuralSearchTestCase.java)0
-rw-r--r--platform/structuralsearch/testSource/com/intellij/structuralsearch/impl/matcher/compiler/StringToConstraintsTransformerTest.java (renamed from plugins/structuralsearch/testSource/com/intellij/structuralsearch/impl/matcher/compiler/StringToConstraintsTransformerTest.java)0
-rw-r--r--platform/testFramework/src/com/intellij/GroupBasedTestClassFilter.java49
-rw-r--r--platform/testFramework/src/com/intellij/TestCaseLoader.java6
-rw-r--r--platform/testFramework/src/com/intellij/openapi/application/ex/PathManagerEx.java2
-rw-r--r--platform/testFramework/src/com/intellij/testFramework/EditorTestUtil.java2
-rw-r--r--platform/testFramework/src/com/intellij/testFramework/FileEditorManagerTestCase.java1
-rw-r--r--platform/testFramework/src/com/intellij/testFramework/LightPlatformCodeInsightTestCase.java4
-rw-r--r--platform/testFramework/src/com/intellij/testFramework/PlatformTestUtil.java2
-rw-r--r--platform/testFramework/src/com/intellij/testFramework/TestDataProvider.java6
-rw-r--r--platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java10
-rw-r--r--platform/testRunner/src/com/intellij/execution/testframework/TestsUIUtil.java3
-rw-r--r--platform/util-rt/src/com/intellij/execution/rmi/RemoteServer.java66
-rw-r--r--platform/util-rt/src/com/intellij/execution/rmi/ssl/SslSocketFactory.java21
-rw-r--r--platform/util/src/com/intellij/icons/AllIcons.java1
-rw-r--r--platform/util/src/com/intellij/openapi/ui/VerticalFlowLayout.java4
-rw-r--r--platform/util/src/com/intellij/openapi/util/BuildNumber.java35
-rw-r--r--platform/util/src/com/intellij/openapi/util/IconLoader.java4
-rw-r--r--platform/util/src/com/intellij/openapi/util/io/FileUtil.java13
-rw-r--r--platform/util/src/com/intellij/openapi/util/registry/ui/RegistryCheckBox.java7
-rw-r--r--platform/util/src/com/intellij/psi/codeStyle/MinusculeMatcher.java20
-rw-r--r--platform/util/src/com/intellij/ui/Graphics2DDelegate.java4
-rw-r--r--platform/util/src/com/intellij/util/containers/ContainerUtil.java18
-rw-r--r--platform/util/src/com/intellij/util/containers/OrderedSet.java6
-rw-r--r--platform/util/src/com/intellij/util/io/AbstractStringEnumerator.java8
-rw-r--r--platform/util/src/com/intellij/util/io/AppendableStorageBackedByResizableMappedFile.java4
-rw-r--r--platform/util/src/com/intellij/util/io/CachingEnumerator.java149
-rw-r--r--platform/util/src/com/intellij/util/io/DataEnumerator.java30
-rw-r--r--platform/util/src/com/intellij/util/io/EnumeratorStringDescriptor.java1
-rw-r--r--platform/util/src/com/intellij/util/io/IntToIntBtree.java10
-rw-r--r--platform/util/src/com/intellij/util/io/PagedFileStorage.java30
-rw-r--r--platform/util/src/com/intellij/util/io/PersistentHashMap.java2
-rw-r--r--platform/util/src/com/intellij/util/io/PersistentStringEnumerator.java131
-rw-r--r--platform/util/src/com/intellij/util/ui/ColumnInfo.java14
-rw-r--r--platform/util/src/com/intellij/util/ui/UIUtil.java22
-rw-r--r--platform/util/testSrc/com/intellij/util/containers/ConcurrentMapsTest.java2
-rw-r--r--platform/vcs-impl/src/com/intellij/openapi/vcs/actions/AnnotateToggleAction.java3
-rw-r--r--platform/vcs-impl/src/com/intellij/openapi/vcs/changes/MapIgnoredFilesHolder.java6
-rw-r--r--platform/vcs-impl/src/com/intellij/openapi/vcs/changes/RemoteRevisionsCache.java25
-rw-r--r--platform/vcs-impl/src/com/intellij/openapi/vcs/changes/UpdatingChangeListBuilder.java14
-rw-r--r--platform/vcs-impl/src/com/intellij/openapi/vcs/changes/VcsGuess.java7
-rw-r--r--platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesTreeList.java3
-rw-r--r--platform/vcs-impl/src/com/intellij/openapi/vcs/ex/CopyLineStatusRangeAction.java2
-rw-r--r--platform/vcs-impl/src/com/intellij/openapi/vcs/ex/DocumentWrapper.java15
-rw-r--r--platform/vcs-impl/src/com/intellij/openapi/vcs/ex/LineStatusTracker.java263
-rw-r--r--platform/vcs-impl/src/com/intellij/openapi/vcs/ex/LineStatusTrackerDrawing.java2
-rw-r--r--platform/vcs-impl/src/com/intellij/openapi/vcs/ex/Range.java10
-rw-r--r--platform/vcs-impl/src/com/intellij/openapi/vcs/ex/RollbackLineStatusAction.java136
-rw-r--r--platform/vcs-impl/src/com/intellij/openapi/vcs/ex/RollbackLineStatusRangeAction.java43
-rw-r--r--platform/vcs-impl/src/com/intellij/openapi/vcs/ex/SegmentTree.java116
-rw-r--r--platform/vcs-impl/src/com/intellij/openapi/vcs/ex/ShowLineStatusRangeDiffAction.java38
-rw-r--r--platform/vcs-impl/src/com/intellij/openapi/vcs/history/FileHistoryPanelImpl.java10
-rw-r--r--platform/vcs-impl/src/com/intellij/openapi/vcs/impl/ModuleDefaultVcsRootPolicy.java7
-rw-r--r--platform/vcs-impl/src/com/intellij/openapi/vcs/impl/ProjectLevelVcsManagerImpl.java35
-rw-r--r--platform/vcs-impl/src/com/intellij/openapi/vcs/impl/VcsRootIterator.java18
-rw-r--r--platform/vcs-impl/src/com/intellij/openapi/vcs/impl/projectlevelman/NewMappings.java79
-rw-r--r--platform/vcs-log/api/src/com/intellij/vcs/log/VcsLogRefManager.java12
-rw-r--r--platform/vcs-log/api/src/com/intellij/vcs/log/graph/GraphColorManager.java17
-rw-r--r--platform/vcs-log/impl/src/com/intellij/vcs/log/graph/GraphColorManagerImpl.java35
-rw-r--r--platform/vcs-log/impl/src/com/intellij/vcs/log/ui/filter/StructureFilterPopupComponent.java9
-rw-r--r--platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/DetailsPanel.java3
-rw-r--r--platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/VcsLogGraphTable.java17
-rw-r--r--platform/vcs-log/impl/src/com/intellij/vcs/log/ui/render/AbstractPaddingCellRender.java2
-rw-r--r--platform/vcs-log/impl/test/com/intellij/vcs/log/impl/TestVcsLogProvider.java10
-rw-r--r--platform/xdebugger-api/src/com/intellij/xdebugger/XDebuggerBundle.java1
-rw-r--r--platform/xdebugger-api/src/com/intellij/xdebugger/breakpoints/XBreakpointType.java10
-rw-r--r--platform/xdebugger-api/src/com/intellij/xdebugger/evaluation/XDebuggerEvaluator.java3
-rw-r--r--platform/xdebugger-api/src/com/intellij/xdebugger/settings/XDebuggerSettings.java26
-rw-r--r--platform/xdebugger-api/src/com/intellij/xdebugger/settings/XDebuggerSettingsManager.java36
-rw-r--r--platform/xdebugger-impl/src/com/intellij/xdebugger/impl/DebuggerSupport.java9
-rw-r--r--platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebugSessionImpl.java2
-rw-r--r--platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerManagerImpl.java7
-rw-r--r--platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerUtilImpl.java2
-rw-r--r--platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/UnmuteOnStopAction.java4
-rw-r--r--platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/BreakpointState.java4
-rw-r--r--platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XBreakpointBase.java15
-rw-r--r--platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XLineBreakpointImpl.java5
-rw-r--r--platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XLineBreakpointManager.java9
-rw-r--r--platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/XBreakpointActionsPanel.java5
-rw-r--r--platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/XLightBreakpointPropertiesPanel.java5
-rw-r--r--platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/ExpressionInputComponent.java8
-rw-r--r--platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/XDebuggerEvaluationDialog.java61
-rw-r--r--platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/quick/XDebuggerTreeCreator.java22
-rw-r--r--platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/quick/XQuickEvaluateHandler.java3
-rw-r--r--platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/DataViewsConfigurable.java53
-rw-r--r--platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/DataViewsConfigurableUi.form50
-rw-r--r--platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/DataViewsConfigurableUi.java61
-rw-r--r--platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/DebuggerConfigurable.java125
-rw-r--r--platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/DebuggerConfigurableProvider.java82
-rw-r--r--platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/DebuggerSettingsPanelProvider.java27
-rw-r--r--platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/GeneralConfigurable.java51
-rw-r--r--platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/GeneralConfigurableUi.form34
-rw-r--r--platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/GeneralConfigurableUi.java52
-rw-r--r--platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/MergedCompositeConfigurable.java118
-rw-r--r--platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/SteppingConfigurable.java41
-rw-r--r--platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/SubCompositeConfigurable.java180
-rw-r--r--platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/XDebuggerDataViewSettings.java30
-rw-r--r--platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/XDebuggerGeneralSettings.java10
-rw-r--r--platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/XDebuggerSettingsManager.java32
-rw-r--r--platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/XDebuggerSettingsPanelProviderImpl.java49
-rw-r--r--platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/ExecutionPointHighlighter.java12
-rw-r--r--platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/XDebuggerTree.java20
-rw-r--r--platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/actions/SortValuesToggleAction.java4
-rw-r--r--platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/nodes/XValueContainerNode.java2
-rw-r--r--platform/xdebugger-impl/testSrc/com/intellij/xdebugger/XDebuggerSettingsTest.java4
-rw-r--r--plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/META-INF/InspectionGadgets.xml4
-rw-r--r--plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/InspectionGadgetsBundle.properties2
-rw-r--r--plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/BaseGlobalInspection.java4
-rw-r--r--plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/assignment/AssignmentToMethodParameterInspection.java3
-rw-r--r--plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/classlayout/ClassWithOnlyPrivateConstructorsInspectionBase.java91
-rw-r--r--plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/controlflow/IfStatementWithIdenticalBranchesInspection.java47
-rw-r--r--plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/dataflow/UnnecessaryLocalVariableInspectionBase.java5
-rw-r--r--plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/numeric/PointlessArithmeticExpressionInspection.java7
-rw-r--r--plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/performance/CallToSimpleGetterInClassInspection.java198
-rw-r--r--plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/performance/CallToSimpleGetterInClassInspectionBase.java103
-rw-r--r--plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/performance/CallToSimpleSetterInClassInspection.java201
-rw-r--r--plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/performance/CallToSimpleSetterInClassInspectionBase.java103
-rw-r--r--plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/psiutils/ImportUtils.java8
-rw-r--r--plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/style/UnnecessaryInterfaceModifierInspection.java5
-rw-r--r--plugins/InspectionGadgets/src/com/siyeh/ig/classlayout/ClassWithOnlyPrivateConstructorsInspection.java33
-rw-r--r--plugins/InspectionGadgets/src/com/siyeh/ig/fixes/InlineCallFix.java60
-rw-r--r--plugins/InspectionGadgets/src/com/siyeh/ig/performance/CallToSimpleGetterInClassInspection.java63
-rw-r--r--plugins/InspectionGadgets/src/com/siyeh/ig/performance/CallToSimpleSetterInClassInspection.java43
-rw-r--r--plugins/InspectionGadgets/src/inspectionDescriptions/ClassWithOnlyPrivateConstructors.html9
-rw-r--r--plugins/InspectionGadgets/src/inspectionDescriptions/ClassWithoutConstructor.html2
-rw-r--r--plugins/InspectionGadgets/src/inspectionDescriptions/ClassWithoutNoArgConstructor.html2
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/controlflow/if_statement_with_identical_branches/IfStatementWithIdenticalBranches.java47
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/controlflow/if_statement_with_identical_branches/expected.xml65
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/numeric/pointless_arithmetic_expression/PointlessArithmeticExpression.java1
-rw-r--r--plugins/InspectionGadgets/testsrc/com/siyeh/ig/classlayout/ClassWithOnlyPrivateConstructorsInspectionTest.java49
-rw-r--r--plugins/InspectionGadgets/testsrc/com/siyeh/ig/controlflow/IfStatementWithIdenticalBranchesInspectionTest.java18
-rw-r--r--plugins/IntelliLang/java-support/resources/javaInjections.xml16
-rw-r--r--plugins/IntelliLang/src/META-INF/plugin.xml2
-rw-r--r--plugins/IntelliLang/src/org/intellij/plugins/intelliLang/inject/InjectorUtils.java200
-rw-r--r--plugins/IntentionPowerPak/src/com/siyeh/ipp/junit/FlipAssertLiteralIntention.java15
-rw-r--r--plugins/IntentionPowerPak/src/com/siyeh/ipp/junit/ReplaceAssertEqualsWithAssertLiteralIntention.java13
-rw-r--r--plugins/IntentionPowerPak/src/com/siyeh/ipp/junit/ReplaceAssertLiteralWithAssertEqualsIntention.java13
-rw-r--r--plugins/IntentionPowerPak/src/com/siyeh/ipp/types/ReplaceMethodRefWithLambdaIntention.java30
-rw-r--r--plugins/IntentionPowerPak/test/com/siyeh/ipp/junit/flip_assert_literal/ExistingStaticImport.java11
-rw-r--r--plugins/IntentionPowerPak/test/com/siyeh/ipp/junit/flip_assert_literal/ExistingStaticImport_after.java11
-rw-r--r--plugins/IntentionPowerPak/test/com/siyeh/ipp/junit/flip_assert_literal/StaticImportWithoutTestMethod.java8
-rw-r--r--plugins/IntentionPowerPak/test/com/siyeh/ipp/junit/flip_assert_literal/StaticImportWithoutTestMethod_after.java9
-rw-r--r--plugins/IntentionPowerPak/test/com/siyeh/ipp/junit/replace_assert_equals_with_assert_literal/OutsideTestMethod.java8
-rw-r--r--plugins/IntentionPowerPak/test/com/siyeh/ipp/junit/replace_assert_equals_with_assert_literal/OutsideTestMethod_after.java9
-rw-r--r--plugins/IntentionPowerPak/test/com/siyeh/ipp/junit/replace_assert_literal_with_assert_equals/OutsideTestMethod.java8
-rw-r--r--plugins/IntentionPowerPak/test/com/siyeh/ipp/junit/replace_assert_literal_with_assert_equals/OutsideTestMethod_after.java9
-rw-r--r--plugins/IntentionPowerPak/test/com/siyeh/ipp/types/methodRefs2lambda/Ambiguity_after.java2
-rw-r--r--plugins/IntentionPowerPak/test/com/siyeh/ipp/types/methodRefs2lambda/ArrayMethodRef_after.java2
-rw-r--r--plugins/IntentionPowerPak/test/com/siyeh/ipp/types/methodRefs2lambda/NewRefsInference1_after.java4
-rw-r--r--plugins/IntentionPowerPak/test/com/siyeh/ipp/types/methodRefs2lambda/NewRefsInference_after.java2
-rw-r--r--plugins/IntentionPowerPak/test/com/siyeh/ipp/types/methodRefs2lambda/NewRefsInnerClass_after.java2
-rw-r--r--plugins/IntentionPowerPak/test/com/siyeh/ipp/types/methodRefs2lambda/NewRefsStaticInnerClass_after.java2
-rw-r--r--plugins/IntentionPowerPak/test/com/siyeh/ipp/types/methodRefs2lambda/Receiver_after.java2
-rw-r--r--plugins/IntentionPowerPak/test/com/siyeh/ipp/types/methodRefs2lambda/Subst_after.java2
-rw-r--r--plugins/IntentionPowerPak/testSrc/com/siyeh/ipp/junit/FlipAssertLiteralIntentionTest.java6
-rw-r--r--plugins/IntentionPowerPak/testSrc/com/siyeh/ipp/junit/ReplaceAssertEqualsWithAssertLiteralIntentionTest.java47
-rw-r--r--plugins/IntentionPowerPak/testSrc/com/siyeh/ipp/junit/ReplaceAssertLiteralWithAssertEqualsIntentionTest.java47
-rw-r--r--plugins/copyright/src/META-INF/plugin.xml2
-rw-r--r--plugins/coverage-common/src/META-INF/coverage-common-plugin.xml2
-rw-r--r--plugins/coverage/src/com/intellij/execution/configurations/coverage/JavaCoverageEnabledConfiguration.java21
-rw-r--r--plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/cvsstatuses/CvsChangeProvider.java2
-rw-r--r--plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/ui/experts/importToCvs/ImportTree.java12
-rw-r--r--plugins/devkit/resources/META-INF/plugin.xml2
-rw-r--r--plugins/devkit/src/build/PluginBuildConfiguration.java6
-rw-r--r--plugins/devkit/src/build/PluginBuildParticipant.java213
-rw-r--r--plugins/devkit/src/build/PluginBuildParticipantProvider.java40
-rw-r--r--plugins/devkit/src/references/RegistryImplicitPropertyUsageProvider.java38
-rw-r--r--plugins/devkit/src/testAssistant/TestDataGuessByExistingFilesUtil.java21
-rw-r--r--plugins/eclipse/src/org/jetbrains/idea/eclipse/conversion/EPathUtil.java2
-rw-r--r--plugins/eclipse/src/org/jetbrains/idea/eclipse/conversion/IdeaSpecificSettings.java2
-rw-r--r--plugins/git4idea/remote-servers-git/src/com/intellij/remoteServer/util/importProject/CloudGitChooseAccountStepBase.java18
-rw-r--r--plugins/git4idea/remote-servers-git/src/com/intellij/remoteServer/util/importProject/CloudGitChooseAccountStepImpl.java3
-rw-r--r--plugins/git4idea/remote-servers-git/src/com/intellij/remoteServer/util/importProject/CloudGitRemoteDetector.java15
-rw-r--r--plugins/git4idea/src/git4idea/GitUtil.java14
-rw-r--r--plugins/git4idea/src/git4idea/actions/GitMergeAction.java43
-rw-r--r--plugins/git4idea/src/git4idea/actions/GitRebaseAbort.java9
-rw-r--r--plugins/git4idea/src/git4idea/actions/GitRebaseActionBase.java16
-rw-r--r--plugins/git4idea/src/git4idea/actions/GitResetHead.java8
-rw-r--r--plugins/git4idea/src/git4idea/actions/GitStash.java9
-rw-r--r--plugins/git4idea/src/git4idea/branch/GitCheckoutOperation.java68
-rw-r--r--plugins/git4idea/src/git4idea/branch/GitMergeOperation.java126
-rw-r--r--plugins/git4idea/src/git4idea/checkin/GitCheckinEnvironment.java4
-rw-r--r--plugins/git4idea/src/git4idea/checkout/GitCloneDialog.java18
-rw-r--r--plugins/git4idea/src/git4idea/cherrypick/GitCherryPicker.java21
-rw-r--r--plugins/git4idea/src/git4idea/commands/GitHttpGuiAuthenticator.java12
-rw-r--r--plugins/git4idea/src/git4idea/commands/GitImpl.java14
-rw-r--r--plugins/git4idea/src/git4idea/commands/GitLineHandlerPasswordRequestAware.java55
-rw-r--r--plugins/git4idea/src/git4idea/log/GitRefManager.java30
-rw-r--r--plugins/git4idea/src/git4idea/rebase/GitRebaser.java108
-rw-r--r--plugins/git4idea/src/git4idea/remote/GitHttpAuthDataProvider.java3
-rw-r--r--plugins/git4idea/src/git4idea/repo/GitRepositoryReader.java2
-rw-r--r--plugins/git4idea/src/git4idea/rollback/GitRollbackEnvironment.java20
-rw-r--r--plugins/git4idea/src/git4idea/ui/GitUnstashDialog.java42
-rw-r--r--plugins/git4idea/src/git4idea/update/GitUpdateProcess.java8
-rw-r--r--plugins/git4idea/test-stepdefs/git4idea/GitCucumberWorld.java7
-rw-r--r--plugins/git4idea/tests/git4idea/log/GitLogRefSorterTest.java311
-rw-r--r--plugins/git4idea/tests/git4idea/log/GitRefManagerTest.java308
-rw-r--r--plugins/git4idea/tests/git4idea/test/GitPlatformTest.java5
-rw-r--r--plugins/git4idea/tests/git4idea/test/GitTestUtil.java5
-rw-r--r--plugins/github/src/org/jetbrains/plugins/github/GithubRebaseAction.java5
-rw-r--r--plugins/github/src/org/jetbrains/plugins/github/GithubShareAction.java2
-rw-r--r--plugins/github/src/org/jetbrains/plugins/github/extensions/GithubCheckoutProvider.java2
-rw-r--r--plugins/github/src/org/jetbrains/plugins/github/extensions/GithubHttpAuthDataProvider.java5
-rw-r--r--plugins/github/src/org/jetbrains/plugins/github/tasks/GithubRepositoryEditor.java3
-rw-r--r--plugins/github/src/org/jetbrains/plugins/github/ui/GithubSettingsPanel.java7
-rw-r--r--plugins/github/src/org/jetbrains/plugins/github/util/GithubAuthData.java5
-rw-r--r--plugins/github/src/org/jetbrains/plugins/github/util/GithubAuthDataHolder.java6
-rw-r--r--plugins/github/src/org/jetbrains/plugins/github/util/GithubSettings.java23
-rw-r--r--plugins/github/src/org/jetbrains/plugins/github/util/GithubUtil.java6
-rw-r--r--plugins/github/test/org/jetbrains/plugins/github/GithubCreateGistTestBase.java6
-rw-r--r--plugins/github/test/org/jetbrains/plugins/github/GithubRequestPagingTest.java2
-rw-r--r--plugins/github/test/org/jetbrains/plugins/github/GithubShareProjectTest.java2
-rw-r--r--plugins/github/test/org/jetbrains/plugins/github/GithubShareProjectTestBase.java2
-rw-r--r--plugins/github/test/org/jetbrains/plugins/github/test/GithubTest.java2
-rw-r--r--plugins/gradle/src/META-INF/plugin.xml2
-rw-r--r--plugins/gradle/src/org/jetbrains/plugins/gradle/config/GradleScriptType.java9
-rw-r--r--plugins/gradle/src/org/jetbrains/plugins/gradle/execution/test/runner/TestMethodGradleConfigurationProducer.java12
-rw-r--r--plugins/gradle/testSources/org/jetbrains/plugins/gradle/importing/GradleImportingTestCase.java8
-rw-r--r--plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/BaseInspection.java5
-rw-r--r--plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/synthetic/GrLightMethodBuilder.java6
-rw-r--r--plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/synthetic/GrLightParameterListBuilder.java4
-rw-r--r--plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/synthetic/GrMethodWrapper.java2
-rw-r--r--plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/stubs/elements/GrStubFileElementType.java1
-rw-r--r--plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/stubs/index/GrFullClassNameIndex.java2
-rw-r--r--plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/typeEnhancers/FromStringHintProcessor.java9
-rw-r--r--plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/providers/GroovyReferenceContributor.java38
-rw-r--r--plugins/groovy/src/META-INF/plugin.xml12
-rw-r--r--plugins/groovy/src/META-INF/structuralsearch.xml6
-rw-r--r--plugins/groovy/src/org/intellij/plugins/intelliLang/inject/groovy/PatternEditorContextMembersProvider.java161
-rw-r--r--plugins/groovy/src/org/jetbrains/plugins/groovy/compiler/GroovyCompilerConfigurable.java2
-rw-r--r--plugins/groovy/src/org/jetbrains/plugins/groovy/compiler/GroovyCompilerExtension.java36
-rw-r--r--plugins/groovy/src/org/jetbrains/plugins/groovy/compiler/generator/TopLevelDependencyValidityState.java98
-rw-r--r--plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovyDebuggerClassFilterProvider.java41
-rw-r--r--plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovyDebuggerSettings.java74
-rw-r--r--plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovyDebuggerSettingsConfigurable.form45
-rw-r--r--plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovyDebuggerSettingsConfigurable.java97
-rw-r--r--plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovyHotSwapper.java1
-rw-r--r--plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovySteppingConfigurable.java37
-rw-r--r--plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovySteppingConfigurableUi.form26
-rw-r--r--plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovySteppingConfigurableUi.java33
-rw-r--r--plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/filters/GroovyDebuggerClassFilterProvider.java41
-rw-r--r--plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/filters/GroovyDebuggerSettings.java66
-rw-r--r--plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/filters/GroovyDebuggerSettingsConfigurable.form53
-rw-r--r--plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/filters/GroovyDebuggerSettingsConfigurable.java106
-rw-r--r--plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/GrMethodMergingContributor.java15
-rw-r--r--plugins/groovy/src/org/jetbrains/plugins/groovy/lang/resolve/providers/GroovyReferenceContributor.java39
-rw-r--r--plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/MvcModuleStructureUtil.java42
-rw-r--r--plugins/groovy/structuralsearch-groovy/src/com/intellij/structuralsearch/GroovyEquivalenceDescriptorProvider.java99
-rw-r--r--plugins/groovy/structuralsearch-groovy/structuralsearch-groovy.iml2
-rw-r--r--plugins/groovy/test/org/jetbrains/plugins/groovy/FastGroovyTestSuite.java5
-rw-r--r--plugins/groovy/test/org/jetbrains/plugins/groovy/GrCommentTest.groovy6
-rw-r--r--plugins/groovy/test/org/jetbrains/plugins/groovy/completion/GroovyCompletionTest.groovy6
-rw-r--r--plugins/groovy/test/org/jetbrains/plugins/groovy/lang/findUsages/FindUsagesTest.groovy10
-rw-r--r--plugins/groovy/test/org/jetbrains/plugins/groovy/lang/resolve/TypeInference2_3Test.groovy12
-rw-r--r--plugins/hg4idea/src/org/zmlx/hg4idea/execution/HgCommandAuthenticator.java25
-rw-r--r--plugins/hg4idea/src/org/zmlx/hg4idea/log/HgRefManager.java16
-rw-r--r--plugins/hg4idea/src/org/zmlx/hg4idea/provider/update/HgUpdateEnvironment.java2
-rw-r--r--plugins/java-decompiler/lib/fernflower.jarbin273276 -> 273340 bytes
-rw-r--r--plugins/java-decompiler/src/org/jetbrains/java/decompiler/IdeaDecompiler.java4
-rw-r--r--plugins/java-decompiler/test/org/jetbrains/java/decompiler/IdeaDecompilerTest.java7
-rw-r--r--plugins/java-decompiler/testData/CodeConstructs.classbin0 -> 324 bytes
-rw-r--r--plugins/java-decompiler/testData/CodeConstructs.java5
-rw-r--r--plugins/java-decompiler/testData/CodeConstructs.txt15
-rw-r--r--plugins/java-i18n/src/com/intellij/codeInspection/duplicateStringLiteral/DuplicateStringLiteralInspection.java9
-rw-r--r--plugins/javaFX/src/META-INF/common-javaFX-plugin.xml2
-rw-r--r--plugins/junit/src/com/intellij/execution/junit2/configuration/JUnitConfigurable.java2
-rw-r--r--plugins/junit/src/com/intellij/execution/junit2/configuration/JUnitConfigurationModel.java2
-rw-r--r--plugins/maven/src/main/resources/META-INF/plugin.xml2
-rw-r--r--plugins/properties/properties-psi-impl/src/com/intellij/codeInspection/unused/UnusedPropertyInspection.java59
-rw-r--r--plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/PropertiesImplUtil.java11
-rw-r--r--plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/editor/ResourceBundleEditorViewElement.java2
-rw-r--r--plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/editor/ResourceBundleFileStructureViewElement.java3
-rw-r--r--plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/editor/ResourceBundlePropertyStructureViewElement.java3
-rw-r--r--plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/structureView/PropertiesFileStructureViewElement.java3
-rw-r--r--plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/structureView/PropertiesPrefixGroup.java6
-rw-r--r--plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/structureView/PropertiesStructureViewElement.java3
-rw-r--r--plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleEditor.java71
-rw-r--r--plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleStructureViewComponent.java11
-rw-r--r--plugins/properties/testSrc/com/intellij/lang/properties/ResourceBundleRenameTest.java51
-rw-r--r--plugins/properties/testSrc/com/intellij/lang/properties/ResourceBundleTest.java61
-rw-r--r--plugins/structuralsearch/build.xml53
-rw-r--r--plugins/structuralsearch/source/com/intellij/structuralsearch/StructuralReplaceHandler.java15
-rw-r--r--plugins/structuralsearch/source/com/intellij/structuralsearch/StructuralSearchProfile.java281
-rw-r--r--plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/GlobalMatchingVisitor.java319
-rw-r--r--plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/StructuralReplaceAction.java55
-rw-r--r--plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/StructuralSearchAction.java54
-rw-r--r--plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/StructuralSearchPlugin.java110
-rw-r--r--plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/ReplaceOptions.java177
-rw-r--r--plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/impl/ParameterInfo.java123
-rw-r--r--plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/impl/ReplacementBuilder.java217
-rw-r--r--plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/impl/Replacer.java424
-rw-r--r--plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/ui/ReplaceCommand.java48
-rw-r--r--plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/ui/ReplaceDialog.java206
-rw-r--r--plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/SearchCommand.java145
-rw-r--r--plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/SearchDialog.java1000
-rw-r--r--plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/UsageViewContext.java183
-rw-r--r--plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/actions/DoSearchAction.java24
-rw-r--r--plugins/structuralsearch/source/messages/SSRBundle.properties240
-rw-r--r--plugins/structuralsearch/structuralsearch-java/src/META-INF/java.xml6
-rw-r--r--plugins/structuralsearch/structuralsearch-java/src/META-INF/plugin.xml48
-rw-r--r--plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/JavaReplaceHandler.java500
-rw-r--r--plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/JavaStructuralSearchProfile.java675
-rw-r--r--plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/JavaMatchingVisitor.java1640
-rw-r--r--plugins/structuralsearch/testSource/com/intellij/structuralsearch/SSBasedInspectionTest.java47
-rw-r--r--plugins/structuralsearch/testSource/com/intellij/structuralsearch/SSRCodeInsightTest.java75
-rw-r--r--plugins/structuralsearch/testSource/com/intellij/structuralsearch/StructuralReplaceTest.java2133
-rw-r--r--plugins/structuralsearch/testSource/com/intellij/structuralsearch/StructuralSearchTest.java2938
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/ConflictedSvnChange.java19
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/DepthCombo.java40
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/ForNestedRootChecker.java14
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/NestedCopiesBuilder.java10
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/Node.java8
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/RepeatSvnActionThroughBusy.java12
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/RootsToWorkingCopies.java9
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/StatusReceiver.java4
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/StatusWalkerPartner.java10
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/SvnBundle.properties6
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/SvnChangeProvider.java32
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/SvnChangeProviderContext.java98
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/SvnChangedFile.java10
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/SvnChangelistListener.java10
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/SvnConfiguration.java20
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/SvnConfigurationState.java2
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/SvnContentRevision.java4
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/SvnDiffProvider.java41
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/SvnFileSystemListener.java222
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/SvnFileUrlMappingImpl.java4
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/SvnProgressCanceller.java8
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/SvnRecursiveStatusWalker.java71
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/SvnRootsDetector.java4
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/SvnStatusConvertor.java60
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/SvnUtil.java105
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/SvnVcs.java84
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/actions/AbstractShowPropertiesDiffAction.java4
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/actions/CleanupWorker.java8
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/actions/CreateBranchOrTagAction.java27
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/actions/CreateExternalAction.java13
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/actions/MarkLocallyDeletedTreeConflictResolvedAction.java4
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/actions/MarkResolvedAction.java24
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/actions/MarkTreeConflictResolvedAction.java4
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/actions/RelocateAction.java4
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/actions/SetPropertyAction.java4
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/actions/ShareProjectAction.java8
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/actions/SvnExcludingIgnoredOperation.java23
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/actions/SvnMergeProvider.java7
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/add/AddClient.java8
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/add/CmdAddClient.java24
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/add/SvnKitAddClient.java12
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/annotate/AnnotateClient.java7
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/annotate/AnnotationConsumer.java29
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/annotate/BaseSvnFileAnnotation.java218
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/annotate/CmdAnnotateClient.java86
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/annotate/SvnAnnotationProvider.java94
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/annotate/SvnKitAnnotateClient.java63
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/annotate/SvnRemoteFileAnnotation.java7
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/api/BaseNodeDescription.java42
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/api/BaseSvnClient.java52
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/api/ClientFactory.java3
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/api/Depth.java93
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/api/EventAction.java91
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/api/FileStatusResultParser.java14
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/api/InfoCommandRepositoryProvider.java5
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/api/NodeKind.java94
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/api/ProgressEvent.java118
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/api/ProgressTracker.java28
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/api/SvnKitClientFactory.java3
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/branchConfig/BranchesLoader.java22
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/branchConfig/DefaultConfigLoader.java23
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/branchConfig/SvnBranchConfigurationNew.java4
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/browse/BrowseClient.java5
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/browse/CmdBrowseClient.java87
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/browse/DirectoryEntry.java100
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/browse/DirectoryEntryConsumer.java25
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/browse/SvnKitBrowseClient.java19
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/change/CmdChangeListClient.java6
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/CheckinClient.java3
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/CmdCheckinClient.java40
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/CmdImportClient.java4
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/CommitEventHandler.java4
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/CommitInfo.java127
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/IdeaCommitHandler.java31
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/ImportClient.java4
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/SvnCheckinEnvironment.java38
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/SvnCheckinHandlerFactory.java54
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/SvnKitCheckinClient.java19
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/SvnKitImportClient.java8
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/checkout/CheckoutClient.java8
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/checkout/CheckoutEventHandler.java28
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/checkout/CmdCheckoutClient.java10
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/checkout/CmdExportClient.java8
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/checkout/ExportClient.java8
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/checkout/SvnCheckoutProvider.java28
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/checkout/SvnKitCheckoutClient.java12
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/checkout/SvnKitExportClient.java14
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/cleanup/CleanupClient.java4
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/cleanup/CmdCleanupClient.java4
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/cleanup/SvnKitCleanupClient.java6
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/BaseUpdateCommandListener.java29
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/Command.java8
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/CommandUtil.java36
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/SvnBindException.java7
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/SvnExceptionWrapper.java4
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/UpdateOutputLineConverter.java59
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/config/SvnConfigureProxiesDialog.java8
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/conflict/CmdConflictClient.java4
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/conflict/ConflictAction.java72
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/conflict/ConflictClient.java4
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/conflict/ConflictOperation.java40
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/conflict/ConflictReason.java89
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/conflict/ConflictVersion.java85
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/conflict/SvnKitConflictClient.java6
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/conflict/TreeConflictDescription.java119
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/copy/CmdCopyMoveClient.java4
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/copy/CopyMoveClient.java4
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/copy/SvnKitCopyMoveClient.java8
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/delete/CmdDeleteClient.java4
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/delete/DeleteClient.java4
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/delete/SvnKitDeleteClient.java6
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/BranchMerger.java12
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/CopiesPanel.java8
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/CreateBranchOrTagDialog.java6
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/LoadRecentBranchRevisions.java14
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/PropertiesComponent.java5
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/RepositoryBrowserComponent.java10
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/RepositoryBrowserDialog.java63
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/RepositoryTreeNode.java22
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SelectLocationDialog.java12
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SetPropertyDialog.java4
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SvnFormatWorker.java20
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SvnRepositoryTreeCellRenderer.java13
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/WCInfo.java12
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/CheckoutOptionsDialog.java4
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/ExportOptionsDialog.java4
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/ImportOptionsDialog.java4
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browserCache/CacheLoader.java5
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browserCache/Loader.java5
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browserCache/RepositoryLoader.java19
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browserCache/SvnRepositoryCache.java15
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browserCache/SyntheticWorker.java39
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/diff/CmdDiffClient.java26
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/diff/DiffOptions.java44
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/diff/DirectoryWithBranchComparer.java2
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/diff/SvnKitDiffClient.java14
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/history/CmdHistoryClient.java97
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/history/FirstInBranch.java15
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/history/HistoryClient.java3
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/history/LatestExistentSearcher.java33
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/history/LogEntry.java187
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/history/LogEntryConsumer.java25
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/history/LogEntryPath.java132
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/history/LogHierarchyNode.java41
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/history/MergeSourceHierarchyBuilder.java21
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/history/SingleCommittedListProvider.java12
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnChangeList.java25
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnCommittedChangesProvider.java81
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnCopyPathTracker.java6
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnFileRevision.java12
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnHistoryProvider.java37
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnHistorySession.java4
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnKitHistoryClient.java23
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnLogUtil.java11
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnMergeSourceDetails.java8
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnMergeSourceTracker.java9
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnPathThroughHistoryCorrection.java17
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnRevisionsNavigationMediator.java13
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/history/TreeStructureNode.java41
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/ignore/SvnPropertyService.java4
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/info/CmdInfoClient.java194
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/info/IdeaSVNInfo.java105
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/info/Info.java267
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/info/InfoClient.java19
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/info/InfoConsumer.java26
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/info/SVNLockWrapper.java99
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/info/SvnInfoHandler.java45
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/info/SvnInfoStructure.java103
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/info/SvnKitInfoClient.java58
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/CmdMergeClient.java28
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/GroupMerger.java4
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/IntegrateEventHandler.java14
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/IntegratedSelectedOptionsDialog.java4
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/MergeCalculatorTask.java33
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/MergeClient.java22
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/Merger.java7
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/PointMerger.java4
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/SvnIntegrateChangesTask.java8
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/SvnKitMergeClient.java32
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/lock/CmdLockClient.java32
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/lock/Lock.java128
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/lock/LockClient.java6
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/lock/SvnKitLockClient.java10
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/mergeinfo/BranchInfo.java10
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/mergeinfo/OneRecursiveShotMergeInfoWorker.java3
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/properties/CmdPropertyClient.java19
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/properties/PropertyClient.java8
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/properties/SvnKitPropertyClient.java15
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/revert/CmdRevertClient.java26
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/revert/RevertClient.java6
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/revert/SvnKitRevertClient.java10
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/rollback/SvnRollbackEnvironment.java39
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/status/CmdStatusClient.java131
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/status/PortableStatus.java172
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/status/Status.java313
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/status/StatusClient.java32
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/status/StatusConsumer.java25
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/status/StatusType.java110
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/status/SvnKitStatusClient.java75
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/status/SvnStatusHandler.java167
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/svnkit/SvnKitProgressCanceller.java34
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/treeConflict/MergeFromTheirsResolver.java19
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/treeConflict/SvnTreeConflictResolver.java99
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/treeConflict/TreeConflictRefreshablePanel.java68
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/update/AbstractSvnUpdatePanel.java4
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/update/AbstractUpdateIntegrateCrawler.java12
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/update/AutoSvnUpdater.java4
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/update/CmdUpdateClient.java73
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/update/MergeRootInfo.java4
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/update/SvnKitUpdateClient.java43
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/update/SvnUpdateEnvironment.java18
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/update/UpdateClient.java21
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/update/UpdateEventHandler.java56
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/update/UpdateRootInfo.java4
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/upgrade/CmdUpgradeClient.java20
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/upgrade/SvnKitUpgradeClient.java16
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/upgrade/UpgradeClient.java4
-rw-r--r--plugins/svn4idea/testSource/org/jetbrains/idea/svn/ConflictCreator.java18
-rw-r--r--plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnCachingRevisionsTest.java7
-rw-r--r--plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnMergeInfoTest.java8
-rw-r--r--plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnNativeClientAuthTest.java3
-rw-r--r--plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnParseCommandLineParseTest.java46
-rw-r--r--plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnProtocolsTest.java3
-rw-r--r--plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnResolveTreeAcceptVariantsTest.java34
-rw-r--r--plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnTreeConflictDataTest.java368
-rw-r--r--plugins/svn4idea/testSource/org/jetbrains/idea/svn/TreeConflictData.java164
-rw-r--r--plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnCachingRevisionsTest.java6
-rw-r--r--plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnMergeInfoTest.java4
-rw-r--r--plugins/tasks/tasks-api/src/com/intellij/tasks/impl/BaseRepositoryImpl.java10
-rw-r--r--plugins/tasks/tasks-core/jira/src/com/intellij/tasks/jira/JiraRemoteApi.java8
-rw-r--r--plugins/tasks/tasks-core/jira/src/com/intellij/tasks/jira/JiraRepository.java57
-rw-r--r--plugins/tasks/tasks-core/jira/src/com/intellij/tasks/jira/JiraRepositoryEditor.java16
-rw-r--r--plugins/tasks/tasks-core/jira/src/com/intellij/tasks/jira/soap/JiraLegacyApi.java114
-rw-r--r--plugins/tasks/tasks-core/jira/src/com/intellij/tasks/jira/soap/JiraSoapApi.java114
-rw-r--r--plugins/tasks/tasks-core/src/META-INF/plugin.xml2
-rw-r--r--plugins/tasks/tasks-core/src/com/intellij/tasks/trello/TrelloRepository.java30
-rw-r--r--plugins/tasks/tasks-core/src/com/intellij/tasks/trello/model/TrelloCard.java3
-rw-r--r--plugins/tasks/tasks-tests/test/com/intellij/tasks/integration/live/LiveIntegrationTestCase.java22
-rw-r--r--plugins/tasks/tasks-tests/test/com/intellij/tasks/integration/live/TrelloIntegrationTest.java142
-rw-r--r--plugins/terminal/resources/META-INF/terminal.xml2
-rw-r--r--plugins/typeMigration/src/META-INF/plugin.xml39
-rw-r--r--plugins/typeMigration/test/com/intellij/codeInsight/ConvertToAtomicIntentionTest.java30
-rw-r--r--plugins/typeMigration/test/com/intellij/codeInsight/ConvertToThreadLocalIntentionTest.java30
-rw-r--r--plugins/typeMigration/test/com/intellij/refactoring/ChangeTypeSignatureTest.java148
-rw-r--r--plugins/typeMigration/test/com/intellij/refactoring/TypeMigrationTestBase.java193
-rw-r--r--plugins/ui-designer/src/META-INF/plugin.xml2
-rw-r--r--plugins/xpath/xpath-view/src/META-INF/plugin.xml6
-rw-r--r--python/helpers/coverage/__init__.py48
-rw-r--r--python/helpers/coverage/__main__.py5
-rw-r--r--python/helpers/coverage/annotate.py15
-rw-r--r--python/helpers/coverage/backward.py96
-rw-r--r--python/helpers/coverage/bytecode.py74
-rw-r--r--python/helpers/coverage/cmdline.py349
-rw-r--r--python/helpers/coverage/codeunit.py44
-rw-r--r--python/helpers/coverage/collector.py74
-rw-r--r--python/helpers/coverage/config.py211
-rw-r--r--python/helpers/coverage/control.py374
-rw-r--r--python/helpers/coverage/data.py52
-rw-r--r--python/helpers/coverage/debug.py54
-rw-r--r--python/helpers/coverage/execfile.py86
-rw-r--r--python/helpers/coverage/files.py220
-rw-r--r--python/helpers/coverage/fullcoverage/encodings.py57
-rw-r--r--python/helpers/coverage/html.py177
-rw-r--r--python/helpers/coverage/htmlfiles/coverage_html.js6
-rw-r--r--python/helpers/coverage/htmlfiles/index.html13
-rw-r--r--python/helpers/coverage/htmlfiles/jquery.min.js (renamed from python/helpers/coverage/htmlfiles/jquery-1.4.3.min.js)0
-rwxr-xr-x[-rw-r--r--]python/helpers/coverage/htmlfiles/keybd_closed.pngbin177 -> 264 bytes
-rwxr-xr-x[-rw-r--r--]python/helpers/coverage/htmlfiles/keybd_open.pngbin175 -> 267 bytes
-rw-r--r--python/helpers/coverage/htmlfiles/pyfile.html15
-rw-r--r--python/helpers/coverage/htmlfiles/style.css29
-rw-r--r--python/helpers/coverage/misc.py32
-rw-r--r--python/helpers/coverage/parser.py442
-rw-r--r--python/helpers/coverage/phystokens.py112
-rw-r--r--python/helpers/coverage/report.py37
-rw-r--r--python/helpers/coverage/results.py73
-rw-r--r--python/helpers/coverage/summary.py31
-rw-r--r--python/helpers/coverage/templite.py228
-rw-r--r--python/helpers/coverage/tracer.c730
-rw-r--r--python/helpers/coverage/tracer.pydbin9728 -> 0 bytes
-rw-r--r--python/helpers/coverage/version.py9
-rw-r--r--python/helpers/coverage/xmlreport.py38
-rw-r--r--python/helpers/generator3.py3
-rw-r--r--python/helpers/pep8.py843
-rw-r--r--python/helpers/pycharm/lettuce_runner.py132
-rw-r--r--python/helpers/pycharm_generator_utils/module_redeclarator.py2
-rw-r--r--python/helpers/pycharm_generator_utils/util_methods.py41
-rw-r--r--python/helpers/pydev/pydevd_comm.py2
-rw-r--r--python/helpers/pydev/pydevd_signature.py2
-rw-r--r--python/psi-api/src/com/jetbrains/python/PyNames.java8
-rw-r--r--python/pydevSrc/com/jetbrains/python/debugger/pydev/RemoteDebugger.java57
-rw-r--r--python/src/META-INF/pycharm-core.xml2
-rw-r--r--python/src/META-INF/python-core.xml10
-rw-r--r--python/src/com/jetbrains/python/codeInsight/completion/PyBracketProtectingCompletionContributor.java35
-rw-r--r--python/src/com/jetbrains/python/codeInsight/editorActions/smartEnter/PySmartEnterProcessor.java36
-rw-r--r--python/src/com/jetbrains/python/codeInsight/editorActions/smartEnter/enterProcessors/PyPlainEnterProcessor.java19
-rw-r--r--python/src/com/jetbrains/python/codeInsight/editorActions/smartEnter/fixers/PyWithFixer.java79
-rw-r--r--python/src/com/jetbrains/python/codeInsight/intentions/ConvertFormatOperatorToMethodIntention.java5
-rw-r--r--python/src/com/jetbrains/python/console/PydevConsoleRunner.java10
-rw-r--r--python/src/com/jetbrains/python/inspections/quickfix/GenerateBinaryStubsFix.java38
-rw-r--r--python/src/com/jetbrains/python/inspections/unresolvedReference/PyUnresolvedReferencesInspection.java8
-rw-r--r--python/src/com/jetbrains/python/packaging/PyPackageManagerImpl.java55
-rw-r--r--python/src/com/jetbrains/python/packaging/PyPackageUtil.java2
-rw-r--r--python/src/com/jetbrains/python/projectView/PyRemoteLibrariesNode.java41
-rw-r--r--python/src/com/jetbrains/python/projectView/PyTreeStructureProvider.java22
-rw-r--r--python/src/com/jetbrains/python/psi/impl/PyStarImportElementImpl.java23
-rw-r--r--python/src/com/jetbrains/python/psi/impl/PythonLanguageLevelPusher.java6
-rw-r--r--python/src/com/jetbrains/python/psi/impl/stubs/PyFileStubBuilder.java3
-rw-r--r--python/src/com/jetbrains/python/psi/types/PyFunctionType.java15
-rw-r--r--python/src/com/jetbrains/python/psi/types/PyModuleType.java2
-rw-r--r--python/src/com/jetbrains/python/sdk/PythonSdkType.java8
-rw-r--r--python/src/com/jetbrains/python/sdk/flavors/PyRemoteSdkFlavor.java2
-rw-r--r--python/src/com/jetbrains/python/validation/Pep8ExternalAnnotator.java2
-rw-r--r--python/testData/MockSdk2.7/python_stubs/__builtin__.py587
-rw-r--r--python/testData/MockSdk3.2/python_stubs/builtins.py715
-rw-r--r--python/testData/codeInsight/smartEnter/withTargetIncomplete.py1
-rw-r--r--python/testData/codeInsight/smartEnter/withTargetIncomplete_after.py1
-rw-r--r--python/testData/codeInsight/smartEnter/withTargetOmitted.py1
-rw-r--r--python/testData/codeInsight/smartEnter/withTargetOmitted_after.py2
-rw-r--r--python/testData/completion/modulePrivateNamesCompletedInsideImport/a.py1
-rw-r--r--python/testData/completion/modulePrivateNamesCompletedInsideImport/module.py3
-rw-r--r--python/testData/inspections/PyUnresolvedReferencesInspection/PrivateModuleNames/a.py5
-rw-r--r--python/testData/inspections/PyUnresolvedReferencesInspection/PrivateModuleNames/lib.py3
-rw-r--r--python/testData/intentions/PyConvertFormatOperatorToMethodIntentionTest/concatenated.py2
-rw-r--r--python/testData/intentions/PyConvertFormatOperatorToMethodIntentionTest/concatenated_after.py2
-rw-r--r--python/testData/resolve/multiFile/modulePrivateName/ImportedFile.py1
-rw-r--r--python/testData/resolve/multiFile/modulePrivateName/ModulePrivateName.py5
-rw-r--r--python/testData/resolve/multiFile/modulePrivateNameInDunderAll/ImportedFile.py4
-rw-r--r--python/testData/resolve/multiFile/modulePrivateNameInDunderAll/ModulePrivateNameInDunderAll.py5
-rw-r--r--python/testSrc/com/jetbrains/python/Py3CompletionTest.java20
-rw-r--r--python/testSrc/com/jetbrains/python/PyCommenterTest.java6
-rw-r--r--python/testSrc/com/jetbrains/python/PyMultiFileResolveTest.java10
-rw-r--r--python/testSrc/com/jetbrains/python/PySmartEnterTest.java10
-rw-r--r--python/testSrc/com/jetbrains/python/PyTypeTest.java10
-rw-r--r--python/testSrc/com/jetbrains/python/PythonCompletionTest.java32
-rw-r--r--python/testSrc/com/jetbrains/python/inspections/PyUnresolvedReferencesInspectionTest.java5
-rw-r--r--python/testSrc/com/jetbrains/python/intentions/PyConvertFormatOperatorToMethodIntentionTest.java5
-rw-r--r--resources-en/src/messages/DebuggerBundle.properties11
-rw-r--r--resources/src/META-INF/IdeTipsAndTricks.xml1
-rw-r--r--resources/src/META-INF/IdeaPlugin.xml17
-rw-r--r--resources/src/idea/RichPlatformActions.xml3
-rw-r--r--resources/src/idea/RichPlatformPlugin.xml18
-rw-r--r--spellchecker/src/META-INF/SpellCheckerPlugin.xml2
-rw-r--r--spellchecker/src/com/intellij/spellchecker/jetbrains.dic4
-rw-r--r--xml/dom-impl/src/com/intellij/util/xml/impl/DomInvocationHandler.java12
-rw-r--r--xml/impl/src/com/intellij/application/options/emmet/EmmetOptions.java2
-rw-r--r--xml/impl/src/com/intellij/codeInsight/template/emmet/EmmetException.java22
-rw-r--r--xml/impl/src/com/intellij/codeInsight/template/emmet/EmmetPreviewHint.java4
-rw-r--r--xml/impl/src/com/intellij/codeInsight/template/emmet/EmmetPreviewUtil.java17
-rw-r--r--xml/impl/src/com/intellij/codeInsight/template/emmet/ZenCodingTemplate.java38
-rw-r--r--xml/impl/src/com/intellij/codeInsight/template/emmet/generators/LoremGenerator.java5
-rw-r--r--xml/impl/src/com/intellij/codeInsight/template/emmet/generators/XmlZenCodingGenerator.java7
-rw-r--r--xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/AddOperationNode.java5
-rw-r--r--xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/ClimbUpOperationNode.java7
-rw-r--r--xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/FilterNode.java8
-rw-r--r--xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/LoremNode.java9
-rw-r--r--xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/MoreOperationNode.java9
-rw-r--r--xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/MulOperationNode.java8
-rw-r--r--xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/TemplateNode.java29
-rw-r--r--xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/TextNode.java21
-rw-r--r--xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/UnaryMulOperationNode.java10
-rw-r--r--xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/ZenCodingNode.java5
-rw-r--r--xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/ZenEmptyNode.java8
-rw-r--r--xml/impl/src/com/intellij/ide/browsers/WebBrowserManager.java14
-rw-r--r--xml/impl/src/com/intellij/ide/browsers/actions/OpenInBrowserBaseGroupAction.java8
-rw-r--r--xml/impl/src/com/intellij/openapi/options/colors/pages/XMLColorsPage.java10
-rw-r--r--xml/impl/src/com/intellij/xml/util/UserColorLookup.java3
2620 files changed, 60936 insertions, 30474 deletions
diff --git a/.idea/libraries/Eclipse.xml b/.idea/libraries/Eclipse.xml
index 0e496f809fd9..dc3840d522fc 100644
--- a/.idea/libraries/Eclipse.xml
+++ b/.idea/libraries/Eclipse.xml
@@ -1,11 +1,11 @@
<component name="libraryTable">
<library name="Eclipse">
<CLASSES>
- <root url="jar://$PROJECT_DIR$/lib/ecj-4.3.2.jar!/" />
+ <root url="jar://$PROJECT_DIR$/lib/ecj-4.4.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
- <root url="jar://$PROJECT_DIR$/lib/src/ecjsrc-4.3.2.jar!/" />
+ <root url="jar://$PROJECT_DIR$/lib/src/ecjsrc-4.4.jar!/" />
</SOURCES>
</library>
</component> \ No newline at end of file
diff --git a/.idea/libraries/JavaHelp.xml b/.idea/libraries/JavaHelp.xml
index 458f03548750..0f5e24398d71 100644
--- a/.idea/libraries/JavaHelp.xml
+++ b/.idea/libraries/JavaHelp.xml
@@ -5,7 +5,7 @@
</CLASSES>
<JAVADOC />
<SOURCES>
- <root url="jar://$PROJECT_DIR$/lib/src/jhsrc.jar!/src" />
+ <root url="jar://$PROJECT_DIR$/lib/src/jhsrc.jar!/" />
</SOURCES>
</library>
</component> \ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
index c23fcc8c1df4..46fdb988e98c 100644
--- a/.idea/modules.xml
+++ b/.idea/modules.xml
@@ -187,10 +187,10 @@
<module fileurl="file://$PROJECT_DIR$/platform/smRunner/smRunner.iml" filepath="$PROJECT_DIR$/platform/smRunner/smRunner.iml" group="platform" />
<module fileurl="file://$PROJECT_DIR$/plugins/cvs/smartcvs-src/smartcvs-src.iml" filepath="$PROJECT_DIR$/plugins/cvs/smartcvs-src/smartcvs-src.iml" group="plugins/VCS/cvs" />
<module fileurl="file://$PROJECT_DIR$/spellchecker/spellchecker.iml" filepath="$PROJECT_DIR$/spellchecker/spellchecker.iml" group="plugins" />
- <module fileurl="file://$PROJECT_DIR$/plugins/structuralsearch/structuralsearch.iml" filepath="$PROJECT_DIR$/plugins/structuralsearch/structuralsearch.iml" />
+ <module fileurl="file://$PROJECT_DIR$/platform/structuralsearch/structuralsearch.iml" filepath="$PROJECT_DIR$/platform/structuralsearch/structuralsearch.iml" />
<module fileurl="file://$PROJECT_DIR$/plugins/groovy/structuralsearch-groovy/structuralsearch-groovy.iml" filepath="$PROJECT_DIR$/plugins/groovy/structuralsearch-groovy/structuralsearch-groovy.iml" />
- <module fileurl="file://$PROJECT_DIR$/plugins/structuralsearch/structuralsearch-java/structuralsearch-java.iml" filepath="$PROJECT_DIR$/plugins/structuralsearch/structuralsearch-java/structuralsearch-java.iml" />
- <module fileurl="file://$PROJECT_DIR$/plugins/structuralsearch/structuralsearch-tests.iml" filepath="$PROJECT_DIR$/plugins/structuralsearch/structuralsearch-tests.iml" />
+ <module fileurl="file://$PROJECT_DIR$/java/structuralsearch-java/structuralsearch-java.iml" filepath="$PROJECT_DIR$/java/structuralsearch-java/structuralsearch-java.iml" />
+ <module fileurl="file://$PROJECT_DIR$/platform/structuralsearch/structuralsearch-tests.iml" filepath="$PROJECT_DIR$/platform/structuralsearch/structuralsearch-tests.iml" />
<module fileurl="file://$PROJECT_DIR$/platform/structure-view-api/structure-view-api.iml" filepath="$PROJECT_DIR$/platform/structure-view-api/structure-view-api.iml" group="platform" />
<module fileurl="file://$PROJECT_DIR$/platform/structure-view-impl/structure-view-impl.iml" filepath="$PROJECT_DIR$/platform/structure-view-impl/structure-view-impl.iml" group="platform" />
<module fileurl="file://$PROJECT_DIR$/plugins/svn4idea/svn4idea.iml" filepath="$PROJECT_DIR$/plugins/svn4idea/svn4idea.iml" group="plugins/VCS" />
@@ -207,7 +207,7 @@
<module fileurl="file://$PROJECT_DIR$/plugins/testng_rt/testng_rt.iml" filepath="$PROJECT_DIR$/plugins/testng_rt/testng_rt.iml" group="plugins" />
<module fileurl="file://$PROJECT_DIR$/platform/testFramework/bootstrap/tests_bootstrap.iml" filepath="$PROJECT_DIR$/platform/testFramework/bootstrap/tests_bootstrap.iml" group="platform" />
<module fileurl="file://$PROJECT_DIR$/../base/testutils/testutils.iml" filepath="$PROJECT_DIR$/../base/testutils/testutils.iml" group="plugins/Android/android-sdk" />
- <module fileurl="file://$PROJECT_DIR$/plugins/typeMigration/typeMigration.iml" filepath="$PROJECT_DIR$/plugins/typeMigration/typeMigration.iml" />
+ <module fileurl="file://$PROJECT_DIR$/java/typeMigration/typeMigration.iml" filepath="$PROJECT_DIR$/java/typeMigration/typeMigration.iml" />
<module fileurl="file://$PROJECT_DIR$/plugins/ui-designer/ui-designer.iml" filepath="$PROJECT_DIR$/plugins/ui-designer/ui-designer.iml" group="plugins" />
<module fileurl="file://$PROJECT_DIR$/plugins/ui-designer-core/ui-designer-core.iml" filepath="$PROJECT_DIR$/plugins/ui-designer-core/ui-designer-core.iml" group="plugins" />
<module fileurl="file://$PROJECT_DIR$/plugins/ui-designer/jps-plugin/ui-designer-jps-plugin.iml" filepath="$PROJECT_DIR$/plugins/ui-designer/jps-plugin/ui-designer-jps-plugin.iml" group="plugins" />
diff --git a/bin/WinLauncher/WinLauncher.exe b/bin/WinLauncher/WinLauncher.exe
index 3a0855660c6c..66b04fa1bfd8 100644
--- a/bin/WinLauncher/WinLauncher.exe
+++ b/bin/WinLauncher/WinLauncher.exe
Binary files differ
diff --git a/bin/WinLauncher/WinLauncher64.exe b/bin/WinLauncher/WinLauncher64.exe
index 1daf83cdccf7..12a18522deed 100644
--- a/bin/WinLauncher/WinLauncher64.exe
+++ b/bin/WinLauncher/WinLauncher64.exe
Binary files differ
diff --git a/bin/mac/printenv.py b/bin/mac/printenv.py
index 4d81c1fef76b..64b1d476248a 100755
--- a/bin/mac/printenv.py
+++ b/bin/mac/printenv.py
@@ -9,6 +9,9 @@ import sys
if len(sys.argv) != 2:
raise Error('Exactly one argument expected')
-with open(sys.argv[1], 'w') as f:
+f = open(sys.argv[1], 'w')
+try:
for key, value in os.environ.items():
f.writelines([key, '=', value, '\0'])
+finally:
+ f.close()
diff --git a/bin/win/fsnotifier.exe b/bin/win/fsnotifier.exe
index a545257af745..7a6118aadcfd 100644
--- a/bin/win/fsnotifier.exe
+++ b/bin/win/fsnotifier.exe
Binary files differ
diff --git a/build/conf/nsis/desktop.ini b/build/conf/nsis/desktop.ini
index 478a08152efe..8f590b778e84 100644
--- a/build/conf/nsis/desktop.ini
+++ b/build/conf/nsis/desktop.ini
@@ -4,23 +4,71 @@ NumFields=3
[Field 1]
Type=checkbox
Left=5
-Right=-1
+Right=100
Top=10
Bottom=20
State=0
[Field 2]
Type=checkbox
-Left=5
+Left=120
+Right=-1
+Top=10
+Bottom=20
+State=0
+
+[Field 3]
+Type=GroupBox
+Left=1
Right=-1
-Top=25
-Bottom=35
-State=1
-
-;[Field 3]
-;Type=checkbox
-;Left=5
-;Right=-1
-;Top=40
-;Bottom=50
-;State=1 \ No newline at end of file
+Top=35
+Bottom=65
+Text=Create Associations
+
+[Field 4]
+Type=checkbox
+Left=5
+Right=45
+Top=50
+Bottom=60
+State=0
+
+[Field 5]
+Type=checkbox
+Left=50
+Right=90
+Top=50
+Bottom=60
+State=0
+
+[Field 6]
+Type=checkbox
+Left=95
+Right=135
+Top=50
+Bottom=60
+State=0
+
+[Field 7]
+Type=checkbox
+Left=140
+Right=180
+Top=50
+Bottom=60
+State=0
+
+[Field 8]
+Type=checkbox
+Left=185
+Right=225
+Top=50
+Bottom=60
+State=0
+
+[Field 9]
+Type=checkbox
+Left=230
+Right=270
+Top=50
+Bottom=60
+State=0 \ No newline at end of file
diff --git a/build/conf/nsis/idea.nsi b/build/conf/nsis/idea.nsi
index 145d61d0624b..5f31dc3c9f3f 100644
--- a/build/conf/nsis/idea.nsi
+++ b/build/conf/nsis/idea.nsi
@@ -12,6 +12,7 @@
; thus ${PRODUCT_WITH_VER} is used for uninstall registry information
!define PRODUCT_REG_VER "${MUI_PRODUCT}\${VER_BUILD}"
+!define INSTALL_OPTION_ELEMENTS 4
Name "${MUI_PRODUCT}"
SetCompressor lzma
; http://nsis.sourceforge.net/Shortcuts_removal_fails_on_Windows_Vista
@@ -25,6 +26,8 @@ RequestExecutionLevel user
!include UAC.nsh
!include "InstallOptions.nsh"
!include StrFunc.nsh
+!include LogicLib.nsh
+
${UnStrStr}
${UnStrLoc}
${UnStrRep}
@@ -97,6 +100,57 @@ Var IS_UPGRADE_60
StrCpy $9 "Modified"
complete:
FunctionEnd
+
+Function ${un}SplitStr
+Exch $0 ; str
+Push $1 ; inQ
+Push $3 ; idx
+Push $4 ; tmp
+StrCpy $1 0
+StrCpy $3 0
+loop:
+ StrCpy $4 $0 1 $3
+ ${If} $4 == '"'
+ ${If} $1 <> 0
+ StrCpy $0 $0 "" 1
+ IntOp $3 $3 - 1
+ ${EndIf}
+ IntOp $1 $1 !
+ ${EndIf}
+ ${If} $4 == '' ; The end?
+ StrCpy $1 0
+ StrCpy $4 ','
+ ${EndIf}
+ ${If} $4 == ','
+ ${AndIf} $1 = 0
+ StrCpy $4 $0 $3
+ StrCpy $1 $4 "" -1
+ ${IfThen} $1 == '"' ${|} StrCpy $4 $4 -1 ${|}
+ killspace:
+ IntOp $3 $3 + 1
+ StrCpy $0 $0 "" $3
+ StrCpy $1 $0 1
+ StrCpy $3 0
+ StrCmp $1 ',' killspace
+ Push $0 ; Remaining
+ Exch 4
+ Pop $0
+ StrCmp $4 "" 0 moreleft
+ Pop $4
+ Pop $3
+ Pop $1
+ Return
+ moreleft:
+ Exch $4
+ Exch 2
+ Pop $1
+ Pop $3
+ Return
+ ${EndIf}
+ IntOp $3 $3 + 1
+ Goto loop
+FunctionEnd
+
!macroend
!insertmacro INST_UNINST_SWITCH ""
!insertmacro INST_UNINST_SWITCH "un."
@@ -686,6 +740,23 @@ skip_default_instdir:
FunctionEnd
+Function DoAssociation
+ ; back up old value of an association
+ ReadRegStr $1 HKCR $R4 ""
+ StrCmp $1 "" skip_backup
+ StrCmp $1 ${PRODUCT_PATHS_SELECTOR} skip_backup
+ WriteRegStr HKCR $R4 "backup_val" $1
+skip_backup:
+ WriteRegStr HKCR $R4 "" "${PRODUCT_PATHS_SELECTOR}"
+ ReadRegStr $0 HKCR ${PRODUCT_PATHS_SELECTOR} ""
+ StrCmp $0 "" 0 command_exists
+ WriteRegStr HKCR ${PRODUCT_PATHS_SELECTOR} "" "${PRODUCT_FULL_NAME}"
+ WriteRegStr HKCR "${PRODUCT_PATHS_SELECTOR}\shell" "" "open"
+ WriteRegStr HKCR "${PRODUCT_PATHS_SELECTOR}\DefaultIcon" "" "$INSTDIR\bin\${PRODUCT_EXE_FILE},0"
+command_exists:
+ WriteRegStr HKCR "${PRODUCT_PATHS_SELECTOR}\shell\open\command" "" \
+ '$INSTDIR\bin\${PRODUCT_EXE_FILE} "%1"'
+FunctionEnd
;------------------------------------------------------------------------------
; Installer sections
@@ -716,6 +787,20 @@ skip_desktop_shortcut:
${EndIf}
skip_quicklaunch_shortcut:
+ !insertmacro INSTALLOPTIONS_READ $R1 "Desktop.ini" "Settings" "NumFields"
+ IntCmp $R1 ${INSTALL_OPTION_ELEMENTS} do_association done do_association
+do_association:
+ StrCpy $R2 ${INSTALL_OPTION_ELEMENTS}
+get_user_choice:
+ !insertmacro INSTALLOPTIONS_READ $R3 "Desktop.ini" "Field $R2" "State"
+ StrCmp $R3 1 "" next_association
+ !insertmacro INSTALLOPTIONS_READ $R4 "Desktop.ini" "Field $R2" "Text"
+ call DoAssociation
+next_association:
+ IntOp $R2 $R2 + 1
+ IntCmp $R1 $R2 get_user_choice done get_user_choice
+
+done:
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
; $STARTMENU_FOLDER stores name of IDEA folder in Start Menu,
; save it name in the "MenuFolder" RegValue
@@ -754,27 +839,6 @@ skip_quicklaunch_shortcut:
skip_ipr:
-StrCmp "${ASSOCIATION}" "NoAssociation" skip_association
- ; back up old value of an association
- ReadRegStr $1 HKCR ${ASSOCIATION} ""
- StrCmp $1 "" skip_backup
- StrCmp $1 ${PRODUCT_PATHS_SELECTOR} skip_backup
- WriteRegStr HKCR ${ASSOCIATION} "backup_val" $1
-skip_backup:
- WriteRegStr HKCR ${ASSOCIATION} "" "${PRODUCT_PATHS_SELECTOR}"
- ReadRegStr $0 HKCR ${PRODUCT_PATHS_SELECTOR} ""
- StrCmp $0 "" 0 command_exists
- WriteRegStr HKCR ${PRODUCT_PATHS_SELECTOR} "" "${PRODUCT_FULL_NAME}"
- WriteRegStr HKCR "${PRODUCT_PATHS_SELECTOR}\shell" "" "open"
- WriteRegStr HKCR "${PRODUCT_PATHS_SELECTOR}\DefaultIcon" "" "$INSTDIR\bin\${PRODUCT_EXE_FILE},0"
-command_exists:
- WriteRegStr HKCR "${PRODUCT_PATHS_SELECTOR}\shell\open\command" "" \
- '$INSTDIR\bin\${PRODUCT_EXE_FILE} "%1"'
-
-skip_association:
- ; Rest of script
-
-
; readonly section
SectionIn RO
!include "idea_win.nsh"
@@ -842,13 +906,28 @@ Function ConfirmDesktopShortcut
!insertmacro MUI_HEADER_TEXT "$(installation_options)" "$(installation_options_prompt)"
!insertmacro INSTALLOPTIONS_WRITE "Desktop.ini" "Field 1" "Text" "$(create_desktop_shortcut)"
call winVersion
- ${If} $0 == "1"
- ;do not ask user about creating quick launch under Windows 7
- !insertmacro INSTALLOPTIONS_WRITE "Desktop.ini" "Settings" "NumFields" "1"
- ${Else}
- !insertmacro INSTALLOPTIONS_WRITE "Desktop.ini" "Field 2" "Text" "$(create_quick_launch_shortcut)"
- ${EndIf}
-; !insertmacro INSTALLOPTIONS_WRITE "Desktop.ini" "Field 3" "Text" "$(install_for_current_user_only)"
+ !insertmacro INSTALLOPTIONS_WRITE "Desktop.ini" "Field 2" "Text" "$(create_quick_launch_shortcut)"
+ ${If} $0 == "1"
+ !insertmacro INSTALLOPTIONS_WRITE "Desktop.ini" "Field 2" "Flags" "DISABLED"
+ ${EndIf}
+ StrCmp "${ASSOCIATION}" "NoAssociation" skip_association
+ StrCpy $R0 3
+ push "${ASSOCIATION}"
+loop:
+ call SplitStr
+ Pop $0
+ StrCmp $0 "" done
+ IntOp $R0 $R0 + 1
+ !insertmacro INSTALLOPTIONS_WRITE "Desktop.ini" "Field $R0" "Text" "$0"
+ goto loop
+skip_association:
+ StrCpy $R0 2
+ call winVersion
+ ${If} $0 == "1"
+ IntOp $R0 $R0 - 1
+ ${EndIf}
+done:
+ !insertmacro INSTALLOPTIONS_WRITE "Desktop.ini" "Settings" "NumFields" "$R0"
!insertmacro INSTALLOPTIONS_DISPLAY "Desktop.ini"
FunctionEnd
@@ -931,11 +1010,13 @@ Function un.ReturnBackupRegValue
;replace Default str with the backup value (if there is the one) and then delete backup
; $1 - key (for example ".java")
; $2 - name (for example "backup_val")
+ Push $0
ReadRegStr $0 HKCR $1 $2
StrCmp $0 "" "noBackup"
WriteRegStr HKCR $1 "" $0
DeleteRegValue HKCR $1 $2
noBackup:
+ Pop $0
FunctionEnd
Function un.OMDeleteRegKeyIfEmpty
@@ -1140,12 +1221,16 @@ clear_Registry:
Call un.OMDeleteRegValue
StrCmp "${ASSOCIATION}" "NoAssociation" finish_uninstall
- StrCpy $1 "${ASSOCIATION}"
+ push "${ASSOCIATION}"
+loop:
+ call un.SplitStr
+ Pop $0
+ StrCmp $0 "" finish_uninstall
+ StrCpy $1 $0
StrCpy $2 "backup_val"
Call un.ReturnBackupRegValue
-
+ goto loop
finish_uninstall:
-
StrCpy $1 "$5\${PRODUCT_REG_VER}"
StrCpy $2 "Build"
Call un.OMDeleteRegValue
diff --git a/build/gant.xml b/build/gant.xml
index 416440b6aebd..7991950aae81 100644
--- a/build/gant.xml
+++ b/build/gant.xml
@@ -15,6 +15,12 @@
<fileset dir="${project.home}/build/kotlinc/jps" erroronmissingdir="false">
<include name="*.jar"/>
</fileset>
+ <fileset dir="${project.home}/build/kotlinc/lib" erroronmissingdir="false">
+ <include name="kotlin-runtime.jar"/>
+ </fileset>
+ <fileset dir="${project.home}/build/kotlinc/plugin" erroronmissingdir="false">
+ <include name="kotlin-plugin.jar"/>
+ </fileset>
<fileset dir="${idea.lib}">
<include name="jdom.jar"/>
<include name="log4j.jar"/>
diff --git a/build/lib/jps/jps-builders.jar b/build/lib/jps/jps-builders.jar
index 05c199bfbb85..f937e00ed467 100644
--- a/build/lib/jps/jps-builders.jar
+++ b/build/lib/jps/jps-builders.jar
Binary files differ
diff --git a/build/scripts/layouts.gant b/build/scripts/layouts.gant
index 7e17eedc4335..d80746e17790 100644
--- a/build/scripts/layouts.gant
+++ b/build/scripts/layouts.gant
@@ -86,8 +86,11 @@ def layoutFull(String home, String targetDirectory, String patchedDescriptorDir
"manifest",
"platform-main",
"remote-servers-java-impl",
+ "structuralsearch",
+ "structuralsearch-java",
"testFramework",
"tests_bootstrap",
+ "typeMigration",
"ui-designer-core"
].flatten()
implementationModules.removeAll(jpsCommonModules) //todo[nik] remove jps modules from platformImplementationModules instead and update layouts of minor IDEs accordingly
@@ -262,7 +265,7 @@ public def layoutCommunityPlugins(String home) {
layoutCloud()
dir("plugins") {
- def simplePlugins = ["commander", "copyright", "java-i18n", "hg4idea", "github", "typeMigration"] //, "tasks-time-tracking"]
+ def simplePlugins = ["commander", "copyright", "java-i18n", "hg4idea", "github"] //, "tasks-time-tracking"]
simplePlugins.each {
layoutPlugin it
@@ -549,15 +552,6 @@ public def layoutCommunityPlugins(String home) {
}
}
- pluginDir("structuralsearch") {
- dir("lib") {
- jar("structuralsearch.jar") {
- module("structuralsearch")
- module("structuralsearch-java")
- }
- }
- }
-
pluginDir("java-decompiler") {
dir("lib") {
jar("java-decompiler.jar") {
diff --git a/build/scripts/utils.gant b/build/scripts/utils.gant
index 580d63d0bb53..e5eb3eb90c25 100644
--- a/build/scripts/utils.gant
+++ b/build/scripts/utils.gant
@@ -89,7 +89,7 @@ private String require(String key) {
this[key]
}
catch (MissingPropertyException ignored) {
- projectBuilder.error("Property $key is required")
+ projectBuilder.error("Property '$key' is required")
}
}
@@ -98,7 +98,7 @@ private String require(String key, String defaultValue) {
this[key]
}
catch (MissingPropertyException ignored) {
- projectBuilder.info("$key is not defined. Defaulting to $defaultValue")
+ projectBuilder.info("'$key' is not defined. Defaulting to '$defaultValue'")
this[key] = defaultValue
}
}
@@ -113,8 +113,9 @@ binding.setVariable("requireProperty", {String key, String defaultValue = null -
})
binding.setVariable("guessHome", {
- // Current file is supposed to be at build/scripts/release.gant path
- new File(requireProperty("gant.file").substring("file:".length())).getParentFile().getParentFile().getParent()
+ // current file is supposed to be at build/scripts/*.gant path
+ String uri = requireProperty("gant.file")
+ new File(new URI(uri).getSchemeSpecificPart()).getParentFile().getParentFile().getParent()
})
binding.setVariable("loadProject", {
diff --git a/build/update.cmd b/build/update.cmd
index 74b499573283..558db879aecc 100644
--- a/build/update.cmd
+++ b/build/update.cmd
@@ -10,40 +10,40 @@
:: 4. You quit IntelliJ IDEA
IF NOT EXIST "%JAVA_HOME%\bin\java.exe" (
- ECHO JAVA_HOME must be defined and point to a valid Java installaton
+ ECHO JAVA_HOME must be defined and point to a valid Java installation
EXIT
)
IF NOT EXIST "%WORK_IDEA_HOME%\bin\idea.bat" (
- @ECHO WORK_IDEA_HOME must be defined and point to build you're updating
+ ECHO WORK_IDEA_HOME must be defined and point to IDEA installation you wish to update
EXIT
)
IF NOT EXIST "%DEV_IDEA_HOME%\build\update.cmd" (
- @ECHO DEV_IDEA_HOME must be defined and point to source base your're updating from
+ ECHO DEV_IDEA_HOME must be defined and point to a source base you're updating from
EXIT
)
-ECHO Updating %WORK_IDEA_HOME% from compiled classes at %DEV_IDEA_HOME%
+ECHO Updating "%WORK_IDEA_HOME%" from compiled classes at "%DEV_IDEA_HOME%"
-CD %DEV_IDEA_HOME%
+CD "%DEV_IDEA_HOME%"
SET ANT_HOME=%DEV_IDEA_HOME%\lib\ant
-SET EXEC_ANT="%JAVA_HOME%\bin\java.exe" -Dant.home=%ANT_HOME% -classpath "%ANT_HOME%\lib\ant-launcher.jar" org.apache.tools.ant.launch.Launcher
-CALL %EXEC_ANT% -f build/update.xml %*
+SET EXEC_ANT="%JAVA_HOME%\bin\java.exe" -Dant.home="%ANT_HOME%" -classpath "%ANT_HOME%\lib\ant-launcher.jar" org.apache.tools.ant.launch.Launcher
+%EXEC_ANT% -f build/update.xml
IF NOT ERRORLEVEL 0 GOTO failed
+IF NOT EXIST "%DEV_IDEA_HOME%\out\deploy" GOTO failed
-DEL /Q /S %WORK_IDEA_HOME%\lib
-DEL /Q /S %WORK_IDEA_HOME%\plugins
+RMDIR /Q /S "%WORK_IDEA_HOME%\lib"
+RMDIR /Q /S "%WORK_IDEA_HOME%\plugins"
-XCOPY %DEV_IDEA_HOME%\bin\win\*.dll %WORK_IDEA_HOME%\bin\ /Q /E /Y
-XCOPY %DEV_IDEA_HOME%\bin\win\fsnotifier.exe %WORK_IDEA_HOME%\bin\ /Q /E /Y
-XCOPY %DEV_IDEA_HOME%\bin\win\runnerw.exe %WORK_IDEA_HOME%\bin\ /Q /E /Y
-XCOPY %DEV_IDEA_HOME%\out\deploy\*.* %WORK_IDEA_HOME%\ /Q /E /Y
+XCOPY "%DEV_IDEA_HOME%\bin\win\*.dll" "%WORK_IDEA_HOME%\bin\" /Q /E /Y
+XCOPY "%DEV_IDEA_HOME%\bin\win\*.exe" "%WORK_IDEA_HOME%\bin\" /Q /E /Y
+XCOPY "%DEV_IDEA_HOME%\out\deploy\*.*" "%WORK_IDEA_HOME%\" /Q /E /Y
GOTO done
:failed
-ECHO "Update failed; work IDEA build not modified."
+ECHO Update failed; work IDEA build not modified.
:done
-CD /D %WORK_IDEA_HOME%\bin
+CD /D "%WORK_IDEA_HOME%\bin"
diff --git a/community-resources/src/idea_community_about.png b/community-resources/src/idea_community_about.png
index d5e5a353e8ef..79fe896536ba 100644
--- a/community-resources/src/idea_community_about.png
+++ b/community-resources/src/idea_community_about.png
Binary files differ
diff --git a/community-resources/src/idea_community_about@2x.png b/community-resources/src/idea_community_about@2x.png
index 72bc8c68a9d5..d7ed6b89aeec 100644
--- a/community-resources/src/idea_community_about@2x.png
+++ b/community-resources/src/idea_community_about@2x.png
Binary files differ
diff --git a/community-tests/src/tests/testGroups.properties b/community-tests/src/tests/testGroups.properties
index 8aa168501144..a528fa8840df 100644
--- a/community-tests/src/tests/testGroups.properties
+++ b/community-tests/src/tests/testGroups.properties
@@ -3,6 +3,7 @@
org.jetbrains.idea.svn.*
org.jetbrains.idea.svn16.*
com.intellij.util.net.ssl.*
+com.intellij.tasks.integration.live.*
[DECOMPILER_TESTS]
org.jetbrains.java.decompiler.*
diff --git a/images/src/META-INF/ImagesPlugin.xml b/images/src/META-INF/ImagesPlugin.xml
index 2c234ffe0e34..ef623446c56a 100644
--- a/images/src/META-INF/ImagesPlugin.xml
+++ b/images/src/META-INF/ImagesPlugin.xml
@@ -4,7 +4,7 @@
<extensions defaultExtensionNs="com.intellij">
<errorHandler implementation="com.intellij.diagnostic.ITNReporter"/>
- <applicationConfigurable instance="org.intellij.images.options.impl.OptionsConfigurabe" id="Images" displayName="Images"/>
+ <applicationConfigurable groupId="editor" instance="org.intellij.images.options.impl.OptionsConfigurabe" id="Images" displayName="Images"/>
<fileEditorProvider implementation="org.intellij.images.editor.impl.ImageFileEditorProvider"/>
<selectInTarget implementation="org.intellij.images.thumbnail.impl.ThumbnailSelectInTarget"/>
<applicationService serviceInterface="org.intellij.images.options.OptionsManager"
diff --git a/images/src/org/intellij/images/thumbnail/impl/ThumbnailViewUI.java b/images/src/org/intellij/images/thumbnail/impl/ThumbnailViewUI.java
index cef0e6cb7184..83f7679fcc62 100644
--- a/images/src/org/intellij/images/thumbnail/impl/ThumbnailViewUI.java
+++ b/images/src/org/intellij/images/thumbnail/impl/ThumbnailViewUI.java
@@ -300,7 +300,7 @@ final class ThumbnailViewUI extends JPanel implements DataProvider, Disposable {
Project project = thumbnailView.getProject();
if (!project.isDisposed()) {
ProjectRootManager rootManager = ProjectRootManager.getInstance(project);
- boolean projectIgnored = rootManager.getFileIndex().isIgnored(file);
+ boolean projectIgnored = rootManager.getFileIndex().isExcluded(file);
if (!projectIgnored && !FileTypeManager.getInstance().isFileIgnored(file)) {
ImageFileTypeManager typeManager = ImageFileTypeManager.getInstance();
diff --git a/java/compiler/impl/src/com/intellij/compiler/CompilerManagerImpl.java b/java/compiler/impl/src/com/intellij/compiler/CompilerManagerImpl.java
index 5cb7a2477315..ceebef6ac8f0 100644
--- a/java/compiler/impl/src/com/intellij/compiler/CompilerManagerImpl.java
+++ b/java/compiler/impl/src/com/intellij/compiler/CompilerManagerImpl.java
@@ -309,7 +309,9 @@ public class CompilerManagerImpl extends CompilerManager {
}
public void finished(boolean aborted, int errors, int warnings, final CompileContext compileContext) {
- myEventPublisher.compilationFinished(aborted, errors, warnings, compileContext);
+ if (!myProject.isDisposed()) {
+ myEventPublisher.compilationFinished(aborted, errors, warnings, compileContext);
+ }
if (myDelegate != null) {
myDelegate.finished(aborted, errors, warnings, compileContext);
}
diff --git a/java/compiler/impl/src/com/intellij/compiler/ant/GenerateAntApplication.java b/java/compiler/impl/src/com/intellij/compiler/ant/GenerateAntApplication.java
index b8a27b7818dc..5a957a28c2d3 100644
--- a/java/compiler/impl/src/com/intellij/compiler/ant/GenerateAntApplication.java
+++ b/java/compiler/impl/src/com/intellij/compiler/ant/GenerateAntApplication.java
@@ -61,7 +61,7 @@ public class GenerateAntApplication {
GenerateAntApplication.LOG.error(e);
}
finally {
- application.exit(true);
+ application.exit(true, true);
}
}
});
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/CompileDriver.java b/java/compiler/impl/src/com/intellij/compiler/impl/CompileDriver.java
index 46584ef9c8bf..406d16574955 100644
--- a/java/compiler/impl/src/com/intellij/compiler/impl/CompileDriver.java
+++ b/java/compiler/impl/src/com/intellij/compiler/impl/CompileDriver.java
@@ -176,17 +176,6 @@ public class CompileDriver {
}
}
- private static boolean containsFileIndexScopes(CompileScope scope) {
- if (scope instanceof CompositeScope) {
- for (CompileScope childScope : ((CompositeScope)scope).getScopes()) {
- if (containsFileIndexScopes(childScope)) {
- return true;
- }
- }
- }
- return scope instanceof FileIndexCompileScope;
- }
-
private void doRebuild(CompileStatusNotification callback, CompilerMessage message, final CompileScope compileScope) {
if (validateCompilerConfiguration(compileScope)) {
startup(compileScope, true, false, callback, message);
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/CompilerUtil.java b/java/compiler/impl/src/com/intellij/compiler/impl/CompilerUtil.java
index 9b227da1dbf8..67bdb5209f39 100644
--- a/java/compiler/impl/src/com/intellij/compiler/impl/CompilerUtil.java
+++ b/java/compiler/impl/src/com/intellij/compiler/impl/CompilerUtil.java
@@ -20,36 +20,24 @@
*/
package com.intellij.compiler.impl;
-import com.intellij.CommonBundle;
-import com.intellij.compiler.CompilerConfiguration;
-import com.intellij.compiler.impl.javaCompiler.ModuleChunk;
-import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.compiler.CompileContext;
import com.intellij.openapi.compiler.CompilerBundle;
import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.module.Module;
-import com.intellij.openapi.module.ModuleManager;
-import com.intellij.openapi.project.Project;
import com.intellij.openapi.projectRoots.Sdk;
-import com.intellij.openapi.roots.ModuleRootManager;
-import com.intellij.openapi.ui.Messages;
-import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.openapi.vfs.CharsetToolkit;
import com.intellij.openapi.vfs.LocalFileSystem;
-import com.intellij.openapi.vfs.VfsUtilCore;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.newvfs.RefreshQueue;
import com.intellij.pom.java.LanguageLevel;
import com.intellij.util.ThrowableRunnable;
-import com.intellij.util.containers.ContainerUtil;
-import gnu.trove.THashMap;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import java.io.File;
-import java.io.FileFilter;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Set;
public class CompilerUtil {
private static final Logger LOG = Logger.getInstance("#com.intellij.compiler.impl.CompilerUtil");
@@ -62,51 +50,6 @@ public class CompilerUtil {
return path;
}
- public static void collectFiles(Collection<File> container, File rootDir, FileFilter fileFilter) {
- final File[] files = rootDir.listFiles(fileFilter);
- if (files == null) {
- return;
- }
- for (File file : files) {
- if (file.isDirectory()) {
- collectFiles(container, file, fileFilter);
- }
- else {
- container.add(file);
- }
- }
- }
-
- public static Map<Module, List<VirtualFile>> buildModuleToFilesMap(CompileContext context, VirtualFile[] files) {
- return buildModuleToFilesMap(context, Arrays.asList(files));
- }
-
-
- public static Map<Module, List<VirtualFile>> buildModuleToFilesMap(final CompileContext context, final List<VirtualFile> files) {
- //assertion: all files are different
- final Map<Module, List<VirtualFile>> map = new THashMap<Module, List<VirtualFile>>();
- ApplicationManager.getApplication().runReadAction(new Runnable() {
- public void run() {
- for (VirtualFile file : files) {
- final Module module = context.getModuleByFile(file);
-
- if (module == null) {
- continue; // looks like file invalidated
- }
-
- List<VirtualFile> moduleFiles = map.get(module);
- if (moduleFiles == null) {
- moduleFiles = new ArrayList<VirtualFile>();
- map.put(module, moduleFiles);
- }
- moduleFiles.add(file);
- }
- }
- });
- return map;
- }
-
-
/**
* must not be called inside ReadAction
* @param files
@@ -167,58 +110,6 @@ public class CompilerUtil {
}
}
- public static void addLocaleOptions(final List<String> commandLine, final boolean launcherUsed) {
- // need to specify default encoding so that javac outputs messages in 'correct' language
- //noinspection HardCodedStringLiteral
- commandLine.add((launcherUsed? "-J" : "") + "-D" + CharsetToolkit.FILE_ENCODING_PROPERTY + "=" + CharsetToolkit.getDefaultSystemCharset().name());
- // javac's VM should use the same default locale that IDEA uses in order for javac to print messages in 'correct' language
- //noinspection HardCodedStringLiteral
- final String lang = System.getProperty("user.language");
- if (lang != null) {
- //noinspection HardCodedStringLiteral
- commandLine.add((launcherUsed? "-J" : "") + "-Duser.language=" + lang);
- }
- //noinspection HardCodedStringLiteral
- final String country = System.getProperty("user.country");
- if (country != null) {
- //noinspection HardCodedStringLiteral
- commandLine.add((launcherUsed? "-J" : "") + "-Duser.country=" + country);
- }
- //noinspection HardCodedStringLiteral
- final String region = System.getProperty("user.region");
- if (region != null) {
- //noinspection HardCodedStringLiteral
- commandLine.add((launcherUsed? "-J" : "") + "-Duser.region=" + region);
- }
- }
-
- public static void addTargetCommandLineSwitch(final ModuleChunk chunk, final List<String> commandLine) {
- String optionValue = null;
- CompilerConfiguration config = null;
- final Module[] modules = chunk.getModules();
- for (Module module : modules) {
- if (config == null) {
- config = CompilerConfiguration.getInstance(module.getProject());
- }
- final String moduleTarget = config.getBytecodeTargetLevel(module);
- if (moduleTarget == null) {
- continue;
- }
- if (optionValue == null) {
- optionValue = moduleTarget;
- }
- else {
- if (moduleTarget.compareTo(optionValue) < 0) {
- optionValue = moduleTarget; // use the lower possible target among modules that form the chunk
- }
- }
- }
- if (optionValue != null) {
- commandLine.add("-target");
- commandLine.add(optionValue);
- }
- }
-
public static void addSourceCommandLineSwitch(final Sdk jdk, LanguageLevel chunkLanguageLevel, @NonNls final List<String> commandLine) {
final String versionString = jdk.getVersionString();
if (StringUtil.isEmpty(versionString)) {
@@ -312,67 +203,4 @@ public class CompilerUtil {
public static void logDuration(final String activityName, long duration) {
LOG.info(activityName + " took " + duration + " ms: " + duration /60000 + " min " +(duration %60000)/1000 + "sec");
}
-
- public static void clearOutputDirectories(final Collection<File> outputDirectories) {
- final long start = System.currentTimeMillis();
- // do not delete directories themselves, or we'll get rootsChanged() otherwise
- final Collection<File> filesToDelete = new ArrayList<File>(outputDirectories.size() * 2);
- for (File outputDirectory : outputDirectories) {
- File[] files = outputDirectory.listFiles();
- if (files != null) {
- ContainerUtil.addAll(filesToDelete, files);
- }
- }
- if (filesToDelete.size() > 0) {
- FileUtil.asyncDelete(filesToDelete);
-
- // ensure output directories exist
- for (final File file : outputDirectories) {
- file.mkdirs();
- }
- final long clearStop = System.currentTimeMillis();
-
- refreshIODirectories(outputDirectories);
-
- final long refreshStop = System.currentTimeMillis();
-
- logDuration("Clearing output dirs", clearStop - start);
- logDuration("Refreshing output directories", refreshStop - clearStop);
- }
- }
-
- public static void computeIntersectingPaths(final Project project,
- final Collection<VirtualFile> outputPaths,
- final Collection<VirtualFile> result) {
- for (Module module : ModuleManager.getInstance(project).getModules()) {
- final ModuleRootManager rootManager = ModuleRootManager.getInstance(module);
- final VirtualFile[] sourceRoots = rootManager.getSourceRoots();
- for (final VirtualFile outputPath : outputPaths) {
- for (VirtualFile sourceRoot : sourceRoots) {
- if (VfsUtilCore.isAncestor(outputPath, sourceRoot, true) || VfsUtilCore.isAncestor(sourceRoot, outputPath, false)) {
- result.add(outputPath);
- }
- }
- }
- }
- }
-
- public static boolean askUserToContinueWithNoClearing(Project project, Collection<VirtualFile> affectedOutputPaths) {
- final StringBuilder paths = new StringBuilder();
- for (final VirtualFile affectedOutputPath : affectedOutputPaths) {
- if (paths.length() > 0) {
- paths.append(",\n");
- }
- paths.append(affectedOutputPath.getPath().replace('/', File.separatorChar));
- }
- final int answer = Messages.showOkCancelDialog(project,
- CompilerBundle.message("warning.sources.under.output.paths", paths.toString()),
- CommonBundle.getErrorTitle(), Messages.getWarningIcon());
- if (answer == Messages.OK) { // ok
- return true;
- }
- else {
- return false;
- }
- }
}
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/InternedPath.java b/java/compiler/impl/src/com/intellij/compiler/impl/InternedPath.java
deleted file mode 100644
index 7914dc29c2c1..000000000000
--- a/java/compiler/impl/src/com/intellij/compiler/impl/InternedPath.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright 2000-2009 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.compiler.impl;
-
-import com.intellij.util.StringBuilderSpinAllocator;
-import com.intellij.util.containers.StringInterner;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author Eugene Zhuravlev
- * Date: Jun 21, 2006
- */
-public class InternedPath {
- private final @NotNull List<String> myValue;
-
- public InternedPath(StringInterner interner, String url, final char separator) {
- myValue = convert(interner, url, separator);
- }
-
- public String toString() {
- return join(myValue, '/');
- }
-
- public static List<String> convert(StringInterner interner, String value, char delim) {
- final List<String> result = new ArrayList<String>();
- int start = 0;
- final int len = value.length();
- for (int idx = 0; idx < len; idx++) {
- if (value.charAt(idx) == delim) {
- result.add(interner.intern(value.substring(start, idx)));
- start = idx + 1;
- }
- }
- if (start < value.length()) {
- result.add(interner.intern(value.substring(start)));
- }
- if (len > 0 && value.charAt(len-1) == delim) { // ends with delimiter
- result.add("");
- }
- return result;
- }
-
- public static String join(List<String> value, char separator) {
- final int size = value.size();
- if (size > 1) {
- final StringBuilder builder = StringBuilderSpinAllocator.alloc();
- try {
- builder.append(value.get(0));
- for (int idx = 1; idx < size; idx++) {
- builder.append(separator).append(value.get(idx));
- }
- return builder.toString();
- }
- finally {
- StringBuilderSpinAllocator.dispose(builder);
- }
- }
- else if (size == 1){
- return value.get(0);
- }
- return "";
- }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/OutputPathFinder.java b/java/compiler/impl/src/com/intellij/compiler/impl/OutputPathFinder.java
deleted file mode 100644
index 6a712d131711..000000000000
--- a/java/compiler/impl/src/com/intellij/compiler/impl/OutputPathFinder.java
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- * Copyright 2000-2009 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.compiler.impl;
-
-import com.intellij.openapi.util.Pair;
-import com.intellij.openapi.util.io.FileUtil;
-import org.jetbrains.annotations.Nullable;
-
-import java.io.File;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * @author Eugene Zhuravlev
- * Date: Apr 6, 2009
- */
-public class OutputPathFinder {
- private final Node myRoot = new Node("");
-
- public OutputPathFinder(Set<File> outputDirs) {
- for (File dir : outputDirs) {
- final String path = FileUtil.toSystemIndependentName(dir.getPath());
- Node node = myRoot;
- int idx = path.startsWith("/")? 1 : 0;
- int slashIndex = path.indexOf('/', idx);
-
- for (; slashIndex >= 0; slashIndex = path.indexOf('/', idx)) {
- final String name = path.substring(idx, slashIndex);
- node = node.addChild(name);
- idx = slashIndex + 1;
- }
-
- if (idx < path.length()) {
- node = node.addChild(path.substring(idx));
- }
-
- node.setData(path);
- }
- }
-
- @Nullable
- public String lookupOutputPath(File outputFile) {
- return lookupOutputPath(outputFile.getPath());
- }
-
- @Nullable
- public String lookupOutputPath(String filePath) {
- final String path = FileUtil.toSystemIndependentName(filePath);
- Node node = myRoot;
- int idx = path.startsWith("/")? 1 : 0;
-
- return findOutputPath(path, idx, node);
- }
-
- private static @Nullable String findOutputPath(final String path, int idx, Node node) {
- while (true) {
- final int slashIndex = path.indexOf('/', idx);
- final String name = slashIndex < idx? path.substring(idx) : path.substring(idx, slashIndex);
- node = node.getChild(name);
- if (node == null) {
- return null;
- }
- if (node.isOutputRoot()) {
- if (node.hasChildren() && slashIndex > idx) {
- final String candidate = findOutputPath(path, slashIndex + 1, node);
- if (candidate != null) {
- return candidate;
- }
- }
- return node.getData();
- }
- if (slashIndex < 0) {
- return null; // end of path reached
- }
- idx = slashIndex + 1;
- }
- }
-
- private static class Node {
- private final String myName;
- @Nullable
- private Object myChildren; // either a Node or a Map<String, Node> or a String or a Pair<String, Node or NodeMap>
-
- private Node(String name) {
- myName = name;
- }
-
- public String getName() {
- return myName;
- }
-
- public boolean isOutputRoot() {
- return myChildren instanceof String || myChildren instanceof Pair;
- }
-
- public boolean hasChildren() {
- return myChildren instanceof Map || myChildren instanceof Pair;
- }
-
- @Nullable
- public String getData() {
- if (myChildren instanceof String) {
- return (String)myChildren;
- }
- if (myChildren instanceof Pair) {
- //noinspection unchecked
- return (String)((Pair)myChildren).first;
- }
- return null;
- }
-
- public void setData(String path) {
- if (myChildren != null) {
- if (myChildren instanceof String) {
- myChildren = path;
- }
- else {
- myChildren = new Pair(path, myChildren instanceof Pair? ((Pair)myChildren).second : myChildren);
- }
- }
- else {
- myChildren = path;
- }
- }
-
- public Node addChild(String childName) {
- if (myChildren == null) {
- final Node node = new Node(childName);
- myChildren = node;
- return node;
- }
- if (myChildren instanceof String) {
- final Node node = new Node(childName);
- myChildren = new Pair(myChildren, node);
- return node;
- }
-
- final Map<String, Node> map;
- if (myChildren instanceof Map) {
- map = (Map<String, Node>)myChildren;
- }
- else if (myChildren instanceof Node) {
- final Node existingChild = (Node)myChildren;
- myChildren = map = new HashMap<String, Node>();
- map.put(existingChild.getName(), existingChild);
- }
- else { // myChildren is a Pair
- Object children = ((Pair)myChildren).second;
- if (children instanceof Map) {
- map = (Map<String, Node>)children;
- }
- else {
- final Node existingChild = (Node)children;
- myChildren = new Pair(((Pair)myChildren).first, map = new HashMap<String, Node>());
- map.put(existingChild.getName(), existingChild);
- }
- }
-
- Node node = map.get(childName);
- if (node == null) {
- map.put(childName, node = new Node(childName));
- }
- return node;
- }
-
- @Nullable
- public Node getChild(String childName) {
- final Object children = myChildren instanceof Pair? ((Pair)myChildren).second : myChildren;
- if (children instanceof Node) {
- final Node childNode = (Node)children;
- return childName.equals(childNode.getName())? childNode : null;
- }
- if (children instanceof Map) {
- return ((Map<String, Node>)myChildren).get(childName);
- }
- return null;
- }
- }
-
-
- public static void main(String[] args) {
- final Set<File> set = new HashSet<File>();
- set.add(new File("/a/b/c"));
- set.add(new File("a/b/d"));
- set.add(new File("a/b/e"));
- set.add(new File("/a/b/f/g"));
- set.add(new File("/a/b/f/g/zzz"));
-
- final OutputPathFinder finder = new OutputPathFinder(set);
-
- System.out.println(finder.lookupOutputPath(new File("a/b")));
- System.out.println(finder.lookupOutputPath(new File("a/b/c/dir1/dir2/File.class")));
- System.out.println(finder.lookupOutputPath(new File("a/b/d/dir1/dir2/File.class")));
- System.out.println(finder.lookupOutputPath(new File("a/b/jjjjj/dir1/dir2/File.class")));
- System.out.println(finder.lookupOutputPath(new File("a/b/e/File.class")));
- System.out.println(finder.lookupOutputPath(new File("a/b/File.class")));
-
- System.out.println(finder.lookupOutputPath(new File("/a/b/f/g/File.class")));
- System.out.println(finder.lookupOutputPath(new File("/a/b/f/g/ttt/yy/File.class")));
- System.out.println(finder.lookupOutputPath(new File("/a/b/f/g/zzz/File.class")));
- System.out.println(finder.lookupOutputPath(new File("/a/b/f/g/zzz/mmm/ttt/File.class")));
-
- }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/PackagingCompilerAdapter.java b/java/compiler/impl/src/com/intellij/compiler/impl/PackagingCompilerAdapter.java
deleted file mode 100644
index d2f7826a1704..000000000000
--- a/java/compiler/impl/src/com/intellij/compiler/impl/PackagingCompilerAdapter.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright 2000-2009 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.compiler.impl;
-
-import com.intellij.openapi.compiler.CompileContext;
-import com.intellij.openapi.compiler.PackagingCompiler;
-import com.intellij.openapi.compiler.ValidityState;
-import org.jetbrains.annotations.Nullable;
-
-public class PackagingCompilerAdapter extends FileProcessingCompilerAdapter{
- private final PackagingCompiler myCompiler;
-
- public PackagingCompilerAdapter(CompileContext compileContext, PackagingCompiler compiler) {
- super(compileContext, compiler);
- myCompiler = compiler;
- }
-
- public void processOutdatedItem(CompileContext context, String url, @Nullable ValidityState state) {
- myCompiler.processOutdatedItem(context, url, state);
- }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/ModuleChunk.java b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/ModuleChunk.java
deleted file mode 100644
index 513c5dad5102..000000000000
--- a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/ModuleChunk.java
+++ /dev/null
@@ -1,343 +0,0 @@
-/*
- * Copyright 2000-2009 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.compiler.impl.javaCompiler;
-
-import com.intellij.compiler.CompilerConfiguration;
-import com.intellij.compiler.CompilerConfigurationImpl;
-import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.compiler.ex.CompileContextEx;
-import com.intellij.openapi.module.EffectiveLanguageLevelUtil;
-import com.intellij.openapi.module.Module;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.projectRoots.Sdk;
-import com.intellij.openapi.roots.JdkOrderEntry;
-import com.intellij.openapi.roots.ModuleRootManager;
-import com.intellij.openapi.roots.OrderEntry;
-import com.intellij.openapi.roots.OrderEnumerator;
-import com.intellij.openapi.util.Computable;
-import com.intellij.openapi.util.Condition;
-import com.intellij.openapi.vfs.VfsUtil;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.pom.java.LanguageLevel;
-import com.intellij.util.Chunk;
-import com.intellij.util.PathsList;
-import com.intellij.util.StringBuilderSpinAllocator;
-import com.intellij.util.containers.ContainerUtil;
-import com.intellij.util.containers.OrderedSet;
-import gnu.trove.THashMap;
-import org.jetbrains.annotations.NotNull;
-
-import java.io.File;
-import java.util.*;
-
-/**
- * @author Eugene Zhuravlev
- * Date: Sep 29, 2004
- */
-public class ModuleChunk extends Chunk<Module> {
- private final CompileContextEx myContext;
- private final Map<Module, List<VirtualFile>> myModuleToFilesMap = new THashMap<Module, List<VirtualFile>>();
- private final Map<VirtualFile, VirtualFile> myTransformedToOriginalMap = new THashMap<VirtualFile, VirtualFile>();
- private int mySourcesFilter = ALL_SOURCES;
-
- public ModuleChunk(CompileContextEx context, Chunk<Module> chunk, Map<Module, List<VirtualFile>> moduleToFilesMap) {
- super(chunk.getNodes());
- myContext = context;
- for (final Module module : chunk.getNodes()) {
- final List<VirtualFile> files = moduleToFilesMap.get(module);
- // Important!!! Collections in the myModuleToFilesMap must be modifiable copies of the corresponding collections
- // from the moduleToFilesMap. This is needed to support SourceTransforming compilers
- myModuleToFilesMap.put(module, files == null ? Collections.<VirtualFile>emptyList() : new ArrayList<VirtualFile>(files));
- }
- }
-
- public static final int SOURCES = 0x1;
- public static final int TEST_SOURCES = 0x2;
- public static final int ALL_SOURCES = SOURCES | TEST_SOURCES;
-
- public void setSourcesFilter(int filter) {
- mySourcesFilter = filter;
- }
-
- public int getSourcesFilter() {
- return mySourcesFilter;
- }
-
- public void substituteWithTransformedVersion(Module module, int fileIndex, VirtualFile transformedFile) {
- final List<VirtualFile> moduleFiles = getFilesToCompile(module);
- final VirtualFile currentFile = moduleFiles.get(fileIndex);
- moduleFiles.set(fileIndex, transformedFile);
- VirtualFile originalFile = myTransformedToOriginalMap.remove(currentFile);
- if (originalFile == null) {
- originalFile = currentFile;
- }
- myTransformedToOriginalMap.put(transformedFile, originalFile);
- }
-
- public VirtualFile getOriginalFile(VirtualFile file) {
- final VirtualFile original = myTransformedToOriginalMap.get(file);
- return original != null? original : file;
- }
-
- @NotNull
- public List<VirtualFile> getFilesToCompile(Module forModule) {
- return myModuleToFilesMap.get(forModule);
- }
-
- @NotNull
- public List<VirtualFile> getFilesToCompile() {
- if (getModuleCount() == 0) {
- return Collections.emptyList();
- }
- final Set<Module> modules = getNodes();
-
- final List<VirtualFile> filesToCompile = new ArrayList<VirtualFile>();
- for (final Module module : modules) {
- final List<VirtualFile> moduleCompilableFiles = getFilesToCompile(module);
- if (mySourcesFilter == ALL_SOURCES) {
- filesToCompile.addAll(moduleCompilableFiles);
- }
- else {
- for (final VirtualFile file : moduleCompilableFiles) {
- VirtualFile originalFile = myTransformedToOriginalMap.get(file);
- if (originalFile == null) {
- originalFile = file;
- }
- if (mySourcesFilter == TEST_SOURCES) {
- if (myContext.isInTestSourceContent(originalFile)) {
- filesToCompile.add(file);
- }
- }
- else {
- if (!myContext.isInTestSourceContent(originalFile)) {
- filesToCompile.add(file);
- }
- }
- }
- }
- }
- return filesToCompile;
- }
-
- /**
- * @return the jdk. Assumes that the jdk is the same for all modules
- */
- public Sdk getJdk() {
- final Module module = getNodes().iterator().next();
- return ModuleRootManager.getInstance(module).getSdk();
- }
-
- public VirtualFile[] getSourceRoots() {
- return getSourceRoots(mySourcesFilter);
- }
-
- private VirtualFile[] getSourceRoots(final int sourcesFilter) {
- return ApplicationManager.getApplication().runReadAction(new Computable<VirtualFile[]>() {
- public VirtualFile[] compute() {
- return filterRoots(getAllSourceRoots(), getNodes().iterator().next().getProject(), sourcesFilter);
- }
- });
- }
-
- public VirtualFile[] getSourceRoots(final Module module) {
- if (!getNodes().contains(module)) {
- return VirtualFile.EMPTY_ARRAY;
- }
- return ApplicationManager.getApplication().runReadAction(new Computable<VirtualFile[]>() {
- public VirtualFile[] compute() {
- return filterRoots(myContext.getSourceRoots(module), module.getProject(), mySourcesFilter);
- }
- });
- }
-
- private VirtualFile[] filterRoots(VirtualFile[] roots, Project project, final int sourcesFilter) {
- final List<VirtualFile> filteredRoots = new ArrayList<VirtualFile>(roots.length);
- final CompilerConfigurationImpl compilerConfiguration = (CompilerConfigurationImpl)CompilerConfiguration.getInstance(project);
- for (final VirtualFile root : roots) {
- if (sourcesFilter != ALL_SOURCES) {
- if (myContext.isInTestSourceContent(root)) {
- if ((sourcesFilter & TEST_SOURCES) == 0) {
- continue;
- }
- }
- else {
- if ((sourcesFilter & SOURCES) == 0) {
- continue;
- }
- }
- }
- if (compilerConfiguration.isExcludedFromCompilation(root)) {
- continue;
- }
- filteredRoots.add(root);
- }
- return VfsUtil.toVirtualFileArray(filteredRoots);
- }
-
- private VirtualFile[] getAllSourceRoots() {
- final Set<Module> modules = getNodes();
- Set<VirtualFile> roots = new HashSet<VirtualFile>();
- for (final Module module : modules) {
- ContainerUtil.addAll(roots, myContext.getSourceRoots(module));
- }
- return VfsUtil.toVirtualFileArray(roots);
- }
-
- public String getCompilationClasspath() {
- final OrderedSet<VirtualFile> cpFiles = getCompilationClasspathFiles();
- return convertToStringPath(cpFiles);
-
- }
-
- public OrderedSet<VirtualFile> getCompilationClasspathFiles() {
- return getCompilationClasspathFiles(true);
- }
-
- public OrderedSet<VirtualFile> getCompilationClasspathFiles(final boolean exportedOnly) {
- final Set<Module> modules = getNodes();
-
- OrderedSet<VirtualFile> cpFiles = new OrderedSet<VirtualFile>();
- for (final Module module : modules) {
- Collections.addAll(cpFiles, orderEnumerator(module, exportedOnly, new AfterJdkOrderEntryCondition()).getClassesRoots());
- }
- return cpFiles;
- }
-
- private OrderEnumerator orderEnumerator(Module module, boolean exportedOnly, Condition<OrderEntry> condition) {
- OrderEnumerator enumerator = OrderEnumerator.orderEntries(module).compileOnly().satisfying(condition);
- if ((mySourcesFilter & TEST_SOURCES) == 0) {
- enumerator = enumerator.productionOnly();
- }
- enumerator = enumerator.recursively();
- return exportedOnly ? enumerator.exportedOnly() : enumerator;
- }
-
- public String getCompilationBootClasspath() {
- return convertToStringPath(getCompilationBootClasspathFiles());
- }
-
- public OrderedSet<VirtualFile> getCompilationBootClasspathFiles() {
- return getCompilationBootClasspathFiles(true);
- }
-
- public OrderedSet<VirtualFile> getCompilationBootClasspathFiles(final boolean exportedOnly) {
- final Set<Module> modules = getNodes();
- final OrderedSet<VirtualFile> cpFiles = new OrderedSet<VirtualFile>();
- final OrderedSet<VirtualFile> jdkFiles = new OrderedSet<VirtualFile>();
- for (final Module module : modules) {
- Collections.addAll(cpFiles, orderEnumerator(module, exportedOnly, new BeforeJdkOrderEntryCondition(module)).getClassesRoots());
- Collections.addAll(jdkFiles, OrderEnumerator.orderEntries(module).sdkOnly().getClassesRoots());
- }
- cpFiles.addAll(jdkFiles);
- return cpFiles;
- }
-
- private static String convertToStringPath(final OrderedSet<VirtualFile> cpFiles) {
- PathsList classpath = new PathsList();
- classpath.addVirtualFiles(cpFiles);
- return classpath.getPathsString();
- }
-
- //private String tryZipFor(String outputDir) {
- // final File zip = CompilerPathsEx.getZippedOutputPath(myContext.getProject(), outputDir);
- // if (zip.exists()) {
- // try {
- // myContext.commitZip(outputDir); // flush unsaved data if any
- // }
- // catch (IOException e) {
- // LOG.info(e);
- // }
- // return zip.getPath();
- // }
- // return outputDir;
- //}
-
- public int getModuleCount() {
- return getNodes().size();
- }
-
- public Module[] getModules() {
- final Set<Module> nodes = getNodes();
- return nodes.toArray(new Module[nodes.size()]);
- }
-
- public String getSourcePath() {
- return getSourcePath(mySourcesFilter);
- }
-
- public String getSourcePath(final int sourcesFilter) {
- if (getModuleCount() == 0) {
- return "";
- }
- final VirtualFile[] filteredRoots = getSourceRoots(sourcesFilter);
- final StringBuilder buffer = StringBuilderSpinAllocator.alloc();
- try {
- ApplicationManager.getApplication().runReadAction(new Runnable() {
- public void run() {
- for (VirtualFile root : filteredRoots) {
- if (buffer.length() > 0) {
- buffer.append(File.pathSeparatorChar);
- }
- buffer.append(root.getPath().replace('/', File.separatorChar));
- }
- }
- });
- return buffer.toString();
- }
- finally {
- StringBuilderSpinAllocator.dispose(buffer);
- }
- }
-
- //the check for equal language levels is done elsewhere
- public LanguageLevel getLanguageLevel() {
- return EffectiveLanguageLevelUtil.getEffectiveLanguageLevel(getNodes().iterator().next());
- }
-
- public Project getProject() {
- return myContext.getProject();
- }
-
- private static class BeforeJdkOrderEntryCondition implements Condition<OrderEntry> {
- private boolean myJdkFound;
- private final Module myOwnerModule;
-
- private BeforeJdkOrderEntryCondition(Module ownerModule) {
- myOwnerModule = ownerModule;
- }
-
- @Override
- public boolean value(OrderEntry orderEntry) {
- if (orderEntry instanceof JdkOrderEntry && myOwnerModule.equals(orderEntry.getOwnerModule())) {
- myJdkFound = true;
- }
- return !myJdkFound;
- }
- }
-
- private static class AfterJdkOrderEntryCondition implements Condition<OrderEntry> {
- private boolean myJdkFound;
-
- @Override
- public boolean value(OrderEntry orderEntry) {
- if (orderEntry instanceof JdkOrderEntry) {
- myJdkFound = true;
- return false;
- }
- return myJdkFound;
- }
- }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/eclipse/EclipseSettingsBuilder.java b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/eclipse/EclipseSettingsBuilder.java
deleted file mode 100644
index 7748223d0eac..000000000000
--- a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/eclipse/EclipseSettingsBuilder.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright 2000-2012 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.compiler.impl.javaCompiler.eclipse;
-
-import com.intellij.compiler.impl.javaCompiler.javac.JavacSettingsBuilder;
-import com.intellij.openapi.module.Module;
-import com.intellij.util.Chunk;
-import org.jetbrains.jps.model.java.compiler.EclipseCompilerOptions;
-
-import java.util.Collection;
-
-/**
- * @author Eugene Zhuravlev
- * Date: 9/27/12
- */
-public class EclipseSettingsBuilder extends JavacSettingsBuilder {
- public EclipseSettingsBuilder(final EclipseCompilerOptions options) {
- super(options);
- }
-
- @Override
- public EclipseCompilerOptions getOptions() {
- return (EclipseCompilerOptions)super.getOptions();
- }
-
- @Override
- public Collection<String> getOptions(Chunk<Module> chunk) {
- final Collection<String> options = super.getOptions(chunk);
- if (getOptions().PROCEED_ON_ERROR) {
- options.add("-proceedOnError");
- }
- return options;
- }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/javac/JavacSettingsBuilder.java b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/javac/JavacSettingsBuilder.java
deleted file mode 100644
index 7be8e1da9fd4..000000000000
--- a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/javac/JavacSettingsBuilder.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright 2000-2009 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.compiler.impl.javaCompiler.javac;
-
-import com.intellij.compiler.CompilerEncodingService;
-import com.intellij.compiler.impl.javaCompiler.ModuleChunk;
-import com.intellij.openapi.module.Module;
-import com.intellij.util.Chunk;
-import org.jetbrains.jps.model.java.compiler.JpsJavaCompilerOptions;
-
-import java.nio.charset.Charset;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.StringTokenizer;
-
-public class JavacSettingsBuilder {
- private final JpsJavaCompilerOptions myOptions;
-
- public JavacSettingsBuilder(JpsJavaCompilerOptions options) {
- myOptions = options;
- }
-
- protected JpsJavaCompilerOptions getOptions() {
- return myOptions;
- }
-
- public Collection<String> getOptions(Chunk<Module> chunk) {
- List<String> options = new ArrayList<String>();
- if (getOptions().DEBUGGING_INFO) {
- options.add("-g");
- }
- if (getOptions().DEPRECATION) {
- options.add("-deprecation");
- }
- if (getOptions().GENERATE_NO_WARNINGS) {
- options.add("-nowarn");
- }
- boolean isEncodingSet = false;
- final StringTokenizer tokenizer = new StringTokenizer(getOptions().ADDITIONAL_OPTIONS_STRING, " \t\r\n");
- while(tokenizer.hasMoreTokens()) {
- final String token = tokenizer.nextToken();
- if(!acceptUserOption(token)) {
- continue;
- }
- options.add(token);
- if ("-encoding".equals(token)) {
- isEncodingSet = true;
- }
- }
- if (!isEncodingSet && acceptEncoding()) {
- final Charset charset = CompilerEncodingService.getPreferredModuleEncoding(chunk);
- if (charset != null) {
- options.add("-encoding");
- options.add(charset.name());
- }
- }
- return options;
- }
-
- protected boolean acceptUserOption(String token) {
- return !("-g".equals(token) || "-deprecation".equals(token) || "-nowarn".equals(token));
- }
-
- protected boolean acceptEncoding() {
- return true;
- }
-
- public String getOptionsString(final ModuleChunk chunk) {
- final StringBuilder options = new StringBuilder();
- for (String option : getOptions(chunk)) {
- if (options.length() > 0) {
- options.append(" ");
- }
- options.append(option);
- }
- return options.toString();
- }
-} \ No newline at end of file
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/packagingCompiler/BuildInstructionBase.java b/java/compiler/impl/src/com/intellij/compiler/impl/packagingCompiler/BuildInstructionBase.java
deleted file mode 100644
index 446dd2e37b28..000000000000
--- a/java/compiler/impl/src/com/intellij/compiler/impl/packagingCompiler/BuildInstructionBase.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright 2000-2009 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.
- */
-
-/**
- * @author cdr
- */
-package com.intellij.compiler.impl.packagingCompiler;
-
-import com.intellij.openapi.compiler.make.BuildInstruction;
-import com.intellij.openapi.util.UserDataHolderBase;
-import com.intellij.openapi.util.io.FileUtil;
-import gnu.trove.THashSet;
-import org.jetbrains.annotations.NonNls;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Collection;
-
-public abstract class BuildInstructionBase extends UserDataHolderBase implements BuildInstruction, Cloneable {
- private final String myOutputRelativePath;
- private Collection<File> myFilesToDelete;
-
- protected BuildInstructionBase(String outputRelativePath) {
- myOutputRelativePath = outputRelativePath;
- }
-
- public String getOutputRelativePath() {
- return myOutputRelativePath;
- }
-
- public BuildInstructionBase clone() {
- return (BuildInstructionBase)super.clone();
- }
-
- public void addFileToDelete(File file) {
- if (myFilesToDelete == null) {
- myFilesToDelete = new THashSet<File>();
- }
- myFilesToDelete.add(file);
- }
-
- public void collectFilesToDelete(Collection<File> filesToDelete) {
- if (myFilesToDelete != null) {
- filesToDelete.addAll(myFilesToDelete);
- }
- myFilesToDelete = null;
- }
-
- @NonNls
- public String toString() {
- return super.toString();
- }
-
- protected File createTempFile(final String prefix, final String suffix) throws IOException {
- final File tempFile = FileUtil.createTempFile(prefix + "___", suffix);
- addFileToDelete(tempFile);
- return tempFile;
- }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/packagingCompiler/DependentJarsEvaluator.java b/java/compiler/impl/src/com/intellij/compiler/impl/packagingCompiler/DependentJarsEvaluator.java
deleted file mode 100644
index 9fa4e2c63de9..000000000000
--- a/java/compiler/impl/src/com/intellij/compiler/impl/packagingCompiler/DependentJarsEvaluator.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright 2000-2009 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.compiler.impl.packagingCompiler;
-
-import com.intellij.openapi.util.Pair;
-
-import java.util.LinkedHashSet;
-import java.util.Set;
-
-/**
- * @author nik
- */
-public class DependentJarsEvaluator {
- private final Set<JarInfo> myJars = new LinkedHashSet<JarInfo>();
-
- public void addJarWithDependencies(final JarInfo jarInfo) {
- if (myJars.add(jarInfo)) {
- for (JarDestinationInfo destination : jarInfo.getJarDestinations()) {
- addJarWithDependencies(destination.getJarInfo());
- }
- for (Pair<String, JarInfo> pair : jarInfo.getPackedJars()) {
- addJarWithDependencies(pair.getSecond());
- }
- }
- }
-
- public Set<JarInfo> getJars() {
- return myJars;
- }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/packagingCompiler/DestinationInfo.java b/java/compiler/impl/src/com/intellij/compiler/impl/packagingCompiler/DestinationInfo.java
deleted file mode 100644
index abda98227402..000000000000
--- a/java/compiler/impl/src/com/intellij/compiler/impl/packagingCompiler/DestinationInfo.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright 2000-2009 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.compiler.impl.packagingCompiler;
-
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.openapi.vfs.LocalFileSystem;
-import org.jetbrains.annotations.Nullable;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * @author nik
- */
-public abstract class DestinationInfo {
- private VirtualFile myOutputFile;
- private final String myOutputPath;
- private final String myOutputFilePath;
-
- protected DestinationInfo(@NotNull final String outputPath, @Nullable final VirtualFile outputFile, @NotNull String outputFilePath) {
- myOutputFilePath = outputFilePath;
- myOutputFile = outputFile;
- myOutputPath = outputPath;
- }
-
- @NotNull
- public String getOutputPath() {
- return myOutputPath;
- }
-
- @Nullable
- public VirtualFile getOutputFile() {
- return myOutputFile;
- }
-
- @NotNull
- public String getOutputFilePath() {
- return myOutputFilePath;
- }
-
- public void update() {
- if (myOutputFile != null && !myOutputFile.isValid()) {
- myOutputFile = null;
- }
- if (myOutputFile == null) {
- myOutputFile = LocalFileSystem.getInstance().findFileByPath(myOutputFilePath);
- }
- }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/packagingCompiler/ExplodedDestinationInfo.java b/java/compiler/impl/src/com/intellij/compiler/impl/packagingCompiler/ExplodedDestinationInfo.java
deleted file mode 100644
index 33a3a8e8da11..000000000000
--- a/java/compiler/impl/src/com/intellij/compiler/impl/packagingCompiler/ExplodedDestinationInfo.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright 2000-2009 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.compiler.impl.packagingCompiler;
-
-import com.intellij.openapi.vfs.VirtualFile;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * @author nik
- */
-public class ExplodedDestinationInfo extends DestinationInfo {
- public ExplodedDestinationInfo(final String outputPath, @Nullable final VirtualFile outputFile) {
- super(outputPath, outputFile, outputPath);
- }
-
- public String toString() {
- return getOutputPath();
- }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/packagingCompiler/FileCopyInstructionImpl.java b/java/compiler/impl/src/com/intellij/compiler/impl/packagingCompiler/FileCopyInstructionImpl.java
deleted file mode 100644
index 64b58555f151..000000000000
--- a/java/compiler/impl/src/com/intellij/compiler/impl/packagingCompiler/FileCopyInstructionImpl.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright 2000-2009 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.compiler.impl.packagingCompiler;
-
-import com.intellij.openapi.compiler.make.BuildInstructionVisitor;
-import com.intellij.openapi.compiler.make.FileCopyInstruction;
-import com.intellij.openapi.util.io.FileUtil;
-
-import java.io.File;
-
-public class FileCopyInstructionImpl extends BuildInstructionBase implements FileCopyInstruction {
- private File myFile;
- private boolean myIsDirectory;
-
- public FileCopyInstructionImpl(File source, boolean isDirectory, String outputRelativePath) {
- super(outputRelativePath);
- setFile(source, isDirectory);
- }
-
- public boolean accept(BuildInstructionVisitor visitor) throws Exception {
- return visitor.visitFileCopyInstruction(this);
- }
-
- public String toString() {
- return "Copy " + getFile() + "->" + getOutputRelativePath();
- }
-
- public boolean equals(Object o) {
- if (this == o) return true;
- if (!(o instanceof FileCopyInstruction)) return false;
-
- final FileCopyInstruction item = (FileCopyInstruction) o;
-
- if (getFile() != null ? !FileUtil.filesEqual(getFile(), item.getFile()) : item.getFile() != null) return false;
-
- if (getOutputRelativePath() != null) {
- if (!getOutputRelativePath().equals( item.getOutputRelativePath() )) return false;
- } else if ( item.getOutputRelativePath() != null ) {
- return false;
- }
-
- return true;
- }
-
- public int hashCode() {
- return (getFile() != null ? getFile().hashCode() : 0) +
- (getOutputRelativePath() != null ? getOutputRelativePath().hashCode():0);
- }
-
- public File getFile() {
- return myFile;
- }
-
- public boolean isDirectory() {
- return myIsDirectory;
- }
-
- private void setFile(File file, boolean isDirectory) {
- myFile = file;
- myIsDirectory = isDirectory;
- }
-
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/packagingCompiler/JarDestinationInfo.java b/java/compiler/impl/src/com/intellij/compiler/impl/packagingCompiler/JarDestinationInfo.java
deleted file mode 100644
index 5cc45c19278e..000000000000
--- a/java/compiler/impl/src/com/intellij/compiler/impl/packagingCompiler/JarDestinationInfo.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright 2000-2009 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.compiler.impl.packagingCompiler;
-
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.openapi.vfs.JarFileSystem;
-
-/**
- * @author nik
- */
-public class JarDestinationInfo extends DestinationInfo {
- private static final Logger LOG = Logger.getInstance("#com.intellij.compiler.impl.packagingCompiler.JarDestinationInfo");
- private final String myPathInJar;
- private final JarInfo myJarInfo;
-
- public JarDestinationInfo(final String pathInJar, final JarInfo jarInfo, DestinationInfo jarDestination) {
- super(appendPathInJar(jarDestination.getOutputPath(), pathInJar), jarDestination.getOutputFile(), jarDestination.getOutputFilePath());
- LOG.assertTrue(!pathInJar.startsWith(".."), pathInJar);
- myPathInJar = StringUtil.startsWithChar(pathInJar, '/') ? pathInJar : "/" + pathInJar;
- myJarInfo = jarInfo;
- }
-
- private static String appendPathInJar(String outputPath, String pathInJar) {
- LOG.assertTrue(outputPath.length() > 0 && outputPath.charAt(outputPath.length() - 1) != '/');
- LOG.assertTrue(pathInJar.length() > 0 && pathInJar.charAt(0) != '/');
- return outputPath + JarFileSystem.JAR_SEPARATOR + pathInJar;
- }
-
- public String getPathInJar() {
- return myPathInJar;
- }
-
- public JarInfo getJarInfo() {
- return myJarInfo;
- }
-
- public String toString() {
- return myPathInJar + "(" + getOutputPath() + ")";
- }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/packagingCompiler/JarInfo.java b/java/compiler/impl/src/com/intellij/compiler/impl/packagingCompiler/JarInfo.java
deleted file mode 100644
index 7626ca13469b..000000000000
--- a/java/compiler/impl/src/com/intellij/compiler/impl/packagingCompiler/JarInfo.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright 2000-2009 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.compiler.impl.packagingCompiler;
-
-import com.intellij.openapi.util.Pair;
-import com.intellij.openapi.vfs.VirtualFile;
-
-import java.util.ArrayList;
-import java.util.LinkedHashSet;
-import java.util.List;
-
-/**
- * @author nik
- */
-public class JarInfo {
- private final List<Pair<String, VirtualFile>> myPackedFiles;
- private final LinkedHashSet<Pair<String, JarInfo>> myPackedJars;
- private final List<DestinationInfo> myDestinations;
-
- public JarInfo() {
- myDestinations = new ArrayList<DestinationInfo>();
- myPackedFiles = new ArrayList<Pair<String, VirtualFile>>();
- myPackedJars = new LinkedHashSet<Pair<String, JarInfo>>();
- }
-
- public void addDestination(DestinationInfo info) {
- myDestinations.add(info);
- if (info instanceof JarDestinationInfo) {
- JarDestinationInfo destinationInfo = (JarDestinationInfo)info;
- destinationInfo.getJarInfo().myPackedJars.add(Pair.create(destinationInfo.getPathInJar(), this));
- }
- }
-
- public void addContent(String pathInJar, VirtualFile sourceFile) {
- myPackedFiles.add(Pair.create(pathInJar, sourceFile));
- }
-
- public List<Pair<String, VirtualFile>> getPackedFiles() {
- return myPackedFiles;
- }
-
- public LinkedHashSet<Pair<String, JarInfo>> getPackedJars() {
- return myPackedJars;
- }
-
- public List<JarDestinationInfo> getJarDestinations() {
- final ArrayList<JarDestinationInfo> list = new ArrayList<JarDestinationInfo>();
- for (DestinationInfo destination : myDestinations) {
- if (destination instanceof JarDestinationInfo) {
- list.add((JarDestinationInfo)destination);
- }
- }
- return list;
- }
-
- public List<DestinationInfo> getAllDestinations() {
- return myDestinations;
- }
-
- public String getPresentableDestination() {
- return !myDestinations.isEmpty() ? myDestinations.get(0).getOutputPath() : "";
- }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/packagingCompiler/JarsBuilder.java b/java/compiler/impl/src/com/intellij/compiler/impl/packagingCompiler/JarsBuilder.java
deleted file mode 100644
index c543abe674cc..000000000000
--- a/java/compiler/impl/src/com/intellij/compiler/impl/packagingCompiler/JarsBuilder.java
+++ /dev/null
@@ -1,283 +0,0 @@
-/*
- * Copyright 2000-2014 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.compiler.impl.packagingCompiler;
-
-import com.intellij.openapi.compiler.CompileContext;
-import com.intellij.openapi.compiler.CompilerBundle;
-import com.intellij.openapi.compiler.CompilerMessageCategory;
-import com.intellij.openapi.deployment.DeploymentUtil;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.util.Couple;
-import com.intellij.openapi.util.Pair;
-import com.intellij.openapi.util.io.FileUtil;
-import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.openapi.vfs.VfsUtil;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.packaging.impl.compiler.ArtifactCompilerUtil;
-import com.intellij.util.ArrayUtil;
-import com.intellij.util.graph.CachingSemiGraph;
-import com.intellij.util.graph.DFSTBuilder;
-import com.intellij.util.graph.GraphGenerator;
-import com.intellij.util.io.ZipUtil;
-import gnu.trove.THashSet;
-import org.jetbrains.annotations.NonNls;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.io.*;
-import java.util.*;
-import java.util.jar.JarFile;
-import java.util.jar.JarOutputStream;
-import java.util.jar.Manifest;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipOutputStream;
-
-/**
- * @author nik
- */
-public class JarsBuilder {
- private static final Logger LOG = Logger.getInstance("#com.intellij.compiler.impl.packagingCompiler.JarsBuilder");
- private final Set<JarInfo> myJarsToBuild;
- private final FileFilter myFileFilter;
- private final CompileContext myContext;
- private Map<JarInfo, File> myBuiltJars;
-
- public JarsBuilder(Set<JarInfo> jarsToBuild, FileFilter fileFilter, CompileContext context) {
- DependentJarsEvaluator evaluator = new DependentJarsEvaluator();
- for (JarInfo jarInfo : jarsToBuild) {
- evaluator.addJarWithDependencies(jarInfo);
- }
- myJarsToBuild = evaluator.getJars();
- myFileFilter = fileFilter;
- myContext = context;
- }
-
- public boolean buildJars(Set<String> writtenPaths) throws IOException {
- myContext.getProgressIndicator().setText(CompilerBundle.message("packaging.compiler.message.building.archives"));
-
- final JarInfo[] sortedJars = sortJars();
- if (sortedJars == null) {
- return false;
- }
-
- myBuiltJars = new HashMap<JarInfo, File>();
- try {
- for (JarInfo jar : sortedJars) {
- myContext.getProgressIndicator().checkCanceled();
- buildJar(jar);
- }
-
- myContext.getProgressIndicator().setText(CompilerBundle.message("packaging.compiler.message.copying.archives"));
- copyJars(writtenPaths);
- }
- finally {
- deleteTemporaryJars();
- }
-
-
- return true;
- }
-
- private void deleteTemporaryJars() {
- for (File file : myBuiltJars.values()) {
- FileUtil.delete(file);
- }
- }
-
- private void copyJars(final Set<String> writtenPaths) throws IOException {
- for (Map.Entry<JarInfo, File> entry : myBuiltJars.entrySet()) {
- File fromFile = entry.getValue();
- boolean first = true;
- for (DestinationInfo destination : entry.getKey().getAllDestinations()) {
- if (destination instanceof ExplodedDestinationInfo) {
- File toFile = new File(FileUtil.toSystemDependentName(destination.getOutputPath()));
-
- if (first) {
- first = false;
- renameFile(fromFile, toFile, writtenPaths);
- fromFile = toFile;
- }
- else {
- DeploymentUtil.getInstance().copyFile(fromFile, toFile, myContext, writtenPaths, myFileFilter);
- }
-
- }
- }
- }
- }
-
- private static void renameFile(final File fromFile, final File toFile, final Set<String> writtenPaths) throws IOException {
- FileUtil.rename(fromFile, toFile);
- writtenPaths.add(toFile.getPath());
- }
-
- @Nullable
- private JarInfo[] sortJars() {
- final DFSTBuilder<JarInfo> builder = new DFSTBuilder<JarInfo>(GraphGenerator.create(CachingSemiGraph.create(new JarsGraph())));
- if (!builder.isAcyclic()) {
- final Couple<JarInfo> dependency = builder.getCircularDependency();
- String message = CompilerBundle.message("packaging.compiler.error.cannot.build.circular.dependency.found.between.0.and.1",
- dependency.getFirst().getPresentableDestination(),
- dependency.getSecond().getPresentableDestination());
- myContext.addMessage(CompilerMessageCategory.ERROR, message, null, -1, -1);
- return null;
- }
-
- JarInfo[] jars = myJarsToBuild.toArray(new JarInfo[myJarsToBuild.size()]);
- Arrays.sort(jars, builder.comparator());
- jars = ArrayUtil.reverseArray(jars);
- return jars;
- }
-
- public Set<JarInfo> getJarsToBuild() {
- return myJarsToBuild;
- }
-
- private void buildJar(final JarInfo jar) throws IOException {
- if (jar.getPackedFiles().isEmpty() && jar.getPackedJars().isEmpty()) {
- myContext.addMessage(CompilerMessageCategory.WARNING, "Archive '" + jar.getPresentableDestination() + "' has no files so it won't be created", null, -1, -1);
- return;
- }
-
- myContext.getProgressIndicator()
- .setText(CompilerBundle.message("packaging.compiler.message.building.0", jar.getPresentableDestination()));
- File jarFile = FileUtil.createTempFile("artifactCompiler", "tmp");
- myBuiltJars.put(jar, jarFile);
-
- FileUtil.createParentDirs(jarFile);
-
- VirtualFile manifestFile = null;
- for (Pair<String, VirtualFile> pair : jar.getPackedFiles()) {
- if (pair.getFirst().equals(JarFile.MANIFEST_NAME)) {
- manifestFile = pair.getSecond();
- }
- }
- final JarOutputStream jarOutputStream = createJarOutputStream(jarFile, manifestFile);
-
- try {
- final THashSet<String> writtenPaths = new THashSet<String>();
- for (Pair<String, VirtualFile> pair : jar.getPackedFiles()) {
- if (pair.getFirst().equals(JarFile.MANIFEST_NAME)) continue;
- final VirtualFile sourceFile = pair.getSecond();
- if (sourceFile.isInLocalFileSystem()) {
- File file = VfsUtil.virtualToIoFile(sourceFile);
- addFileToJar(jarOutputStream, file, pair.getFirst(), writtenPaths);
- }
- else {
- extractFileAndAddToJar(jarOutputStream, sourceFile, pair.getFirst(), writtenPaths);
- }
- }
-
- for (Pair<String, JarInfo> nestedJar : jar.getPackedJars()) {
- File nestedJarFile = myBuiltJars.get(nestedJar.getSecond());
- if (nestedJarFile != null) {
- addFileToJar(jarOutputStream, nestedJarFile, nestedJar.getFirst(), writtenPaths);
- }
- else {
- LOG.debug("nested jar file " + nestedJar.getFirst() + " for " + jar.getPresentableDestination() + " not found");
- }
- }
- }
- finally {
- jarOutputStream.close();
- }
- }
-
- private static JarOutputStream createJarOutputStream(File jarFile, VirtualFile manifestFile) throws IOException {
- final BufferedOutputStream outputStream = new BufferedOutputStream(new FileOutputStream(jarFile));
- final JarOutputStream jarOutputStream;
- if (manifestFile != null) {
- final InputStream manifestStream = manifestFile.getInputStream();
- try {
- jarOutputStream = new JarOutputStream(outputStream, new Manifest(manifestStream));
- }
- finally {
- manifestStream.close();
- }
- }
- else {
- jarOutputStream = new JarOutputStream(outputStream);
- }
- return jarOutputStream;
- }
-
- private void extractFileAndAddToJar(JarOutputStream jarOutputStream, VirtualFile sourceFile, String relativePath, THashSet<String> writtenPaths)
- throws IOException {
- relativePath = addParentDirectories(jarOutputStream, writtenPaths, relativePath);
- myContext.getProgressIndicator().setText2(relativePath);
- if (!writtenPaths.add(relativePath)) return;
-
- final BufferedInputStream input = ArtifactCompilerUtil.getJarEntryInputStream(sourceFile, myContext);
- if (input == null) return;
-
- ZipEntry entry = new ZipEntry(relativePath);
- entry.setTime(ArtifactCompilerUtil.getJarFile(sourceFile).lastModified());
- jarOutputStream.putNextEntry(entry);
- FileUtil.copy(input, jarOutputStream);
- jarOutputStream.closeEntry();
- }
-
- private void addFileToJar(final @NotNull JarOutputStream jarOutputStream, final @NotNull File file, @NotNull String relativePath,
- final @NotNull THashSet<String> writtenPaths) throws IOException {
- if (!file.exists()) {
- return;
- }
-
- relativePath = addParentDirectories(jarOutputStream, writtenPaths, relativePath);
- myContext.getProgressIndicator().setText2(relativePath);
- ZipUtil.addFileToZip(jarOutputStream, file, relativePath, writtenPaths, myFileFilter);
- }
-
- private static String addParentDirectories(JarOutputStream jarOutputStream, THashSet<String> writtenPaths, String relativePath) throws IOException {
- while (StringUtil.startsWithChar(relativePath, '/')) {
- relativePath = relativePath.substring(1);
- }
- int i = relativePath.indexOf('/');
- while (i != -1) {
- String prefix = relativePath.substring(0, i+1);
- if (!writtenPaths.contains(prefix) && prefix.length() > 1) {
- addEntry(jarOutputStream, prefix);
- writtenPaths.add(prefix);
- }
- i = relativePath.indexOf('/', i + 1);
- }
- return relativePath;
- }
-
- private static void addEntry(final ZipOutputStream output, @NonNls final String relativePath) throws IOException {
- ZipEntry e = new ZipEntry(relativePath);
- e.setMethod(ZipEntry.STORED);
- e.setSize(0);
- e.setCrc(0);
- output.putNextEntry(e);
- output.closeEntry();
- }
-
- private class JarsGraph implements GraphGenerator.SemiGraph<JarInfo> {
- public Collection<JarInfo> getNodes() {
- return myJarsToBuild;
- }
-
- public Iterator<JarInfo> getIn(final JarInfo n) {
- Set<JarInfo> ins = new HashSet<JarInfo>();
- for (JarDestinationInfo destination : n.getJarDestinations()) {
- ins.add(destination.getJarInfo());
- }
- return ins.iterator();
- }
- }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/progress/CompilerTask.java b/java/compiler/impl/src/com/intellij/compiler/progress/CompilerTask.java
index 395a7a711398..f568f2d06364 100644
--- a/java/compiler/impl/src/com/intellij/compiler/progress/CompilerTask.java
+++ b/java/compiler/impl/src/com/intellij/compiler/progress/CompilerTask.java
@@ -463,6 +463,9 @@ public class CompilerTask extends Task.Backgroundable {
}
private void removeAllContents(Project project, Content notRemove) {
+ if (project.isDisposed()) {
+ return;
+ }
final MessageView messageView = MessageView.SERVICE.getInstance(project);
Content[] contents = messageView.getContentManager().getContents();
for (Content content : contents) {
diff --git a/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java b/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java
index c32d9ecda313..03ff006eea40 100644
--- a/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java
+++ b/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java
@@ -28,6 +28,7 @@ import com.intellij.execution.process.*;
import com.intellij.execution.ui.RunContentDescriptor;
import com.intellij.ide.DataManager;
import com.intellij.ide.PowerSaveMode;
+import com.intellij.ide.file.BatchFileChangeListener;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.actionSystem.CommonDataKeys;
import com.intellij.openapi.application.Application;
@@ -246,7 +247,13 @@ public class BuildManager implements ApplicationComponent{
for (VFileEvent event : events) {
final VirtualFile eventFile = event.getFile();
- if (eventFile == null || ProjectCoreUtil.isProjectOrWorkspaceFile(eventFile)) {
+ if (eventFile == null) {
+ continue;
+ }
+ if (!eventFile.isValid()) {
+ return true; // should be deleted
+ }
+ if (ProjectCoreUtil.isProjectOrWorkspaceFile(eventFile)) {
continue;
}
@@ -268,6 +275,12 @@ public class BuildManager implements ApplicationComponent{
});
+ conn.subscribe(BatchFileChangeListener.TOPIC, new BatchFileChangeListener.Adapter() {
+ public void batchChangeStarted(Project project) {
+ cancelAutoMakeTasks(project);
+ }
+ });
+
EditorFactory.getInstance().getEventMulticaster().addDocumentListener(new DocumentAdapter() {
@Override
public void documentChanged(DocumentEvent e) {
diff --git a/java/compiler/impl/src/com/intellij/compiler/server/DefaultMessageHandler.java b/java/compiler/impl/src/com/intellij/compiler/server/DefaultMessageHandler.java
index e4df975348d9..6a8c9740df80 100644
--- a/java/compiler/impl/src/com/intellij/compiler/server/DefaultMessageHandler.java
+++ b/java/compiler/impl/src/com/intellij/compiler/server/DefaultMessageHandler.java
@@ -48,8 +48,10 @@ import java.util.concurrent.atomic.AtomicBoolean;
*/
public abstract class DefaultMessageHandler implements BuilderMessageHandler {
private static final Logger LOG = Logger.getInstance("#com.intellij.compiler.server.DefaultMessageHandler");
+ public static final long CONSTANT_SEARCH_TIME_LIMIT = 60 * 1000L; // one minute
private final Project myProject;
private final SequentialTaskExecutor myTaskExecutor = new SequentialTaskExecutor(PooledThreadExecutor.INSTANCE);
+ private volatile long myConstantSearchTime = 0L;
protected DefaultMessageHandler(Project project) {
myProject = project;
@@ -119,14 +121,25 @@ public abstract class DefaultMessageHandler implements BuilderMessageHandler {
boolean canceled = false;
final Ref<Boolean> isSuccess = Ref.create(Boolean.TRUE);
final Set<String> affectedPaths = Collections.synchronizedSet(new HashSet<String>()); // PsiSearchHelper runs multiple threads
+ final long searchStart = System.currentTimeMillis();
try {
- if (isDumbMode()) {
+ if (myConstantSearchTime > CONSTANT_SEARCH_TIME_LIMIT) {
+ // skipping constant search and letting the build rebuild dependent modules
+ isSuccess.set(Boolean.FALSE);
+ LOG.debug("Total constant search time exceeded time limit for this build session");
+ }
+ else if(isDumbMode()) {
// do not wait until dumb mode finishes
isSuccess.set(Boolean.FALSE);
LOG.debug("Constant search task: cannot search in dumb mode");
}
else {
final String qualifiedName = ownerClassName.replace('$', '.');
+
+ handleCompileMessage(sessionId, CmdlineProtoUtil.createCompileProgressMessageResponse(
+ "Searching for usages of changed/removed constants for class " + qualifiedName
+ ).getCompileMessage());
+
final PsiClass[] classes = ApplicationManager.getApplication().runReadAction(new Computable<PsiClass[]>() {
public PsiClass[] compute() {
return JavaPsiFacade.getInstance(myProject).findClasses(qualifiedName, GlobalSearchScope.allScope(myProject));
@@ -202,6 +215,7 @@ public abstract class DefaultMessageHandler implements BuilderMessageHandler {
throw e;
}
finally {
+ myConstantSearchTime += (System.currentTimeMillis() - searchStart);
if (!canceled) {
notifyConstantSearchFinished(channel, sessionId, ownerClassName, fieldName, isSuccess, affectedPaths);
}
diff --git a/java/compiler/impl/src/com/intellij/openapi/projectRoots/impl/MockJdkWrapper.java b/java/compiler/impl/src/com/intellij/openapi/projectRoots/impl/MockJdkWrapper.java
index c5b6c66754f2..779df52e49e3 100644
--- a/java/compiler/impl/src/com/intellij/openapi/projectRoots/impl/MockJdkWrapper.java
+++ b/java/compiler/impl/src/com/intellij/openapi/projectRoots/impl/MockJdkWrapper.java
@@ -93,7 +93,7 @@ public final class MockJdkWrapper implements Sdk {
@NotNull
public SdkModificator getSdkModificator() {
- return null;
+ return myDelegate.getSdkModificator();
}
public Sdk getDelegate() {
diff --git a/java/compiler/impl/src/com/intellij/packaging/impl/compiler/ArtifactCompilerCompileItem.java b/java/compiler/impl/src/com/intellij/packaging/impl/compiler/ArtifactCompilerCompileItem.java
deleted file mode 100644
index b4e1865f46ff..000000000000
--- a/java/compiler/impl/src/com/intellij/packaging/impl/compiler/ArtifactCompilerCompileItem.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright 2000-2010 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.packaging.impl.compiler;
-
-import com.intellij.openapi.compiler.generic.VirtualFileCompileItem;
-import com.intellij.compiler.impl.packagingCompiler.DestinationInfo;
-import com.intellij.openapi.util.Pair;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.util.SmartList;
-import com.intellij.util.io.DataExternalizer;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.List;
-
-/**
- * @author nik
- */
-public class ArtifactCompilerCompileItem extends VirtualFileCompileItem<ArtifactPackagingItemOutputState> {
- public static final DataExternalizer<ArtifactPackagingItemOutputState> OUTPUT_EXTERNALIZER = new ArtifactPackagingItemExternalizer();
- private final List<DestinationInfo> myDestinations = new SmartList<DestinationInfo>();
-
- public ArtifactCompilerCompileItem(VirtualFile file) {
- super(file);
- }
-
- public void addDestination(DestinationInfo info) {
- myDestinations.add(info);
- }
-
- public List<DestinationInfo> getDestinations() {
- return myDestinations;
- }
-
- @NotNull
- @Override
- public ArtifactPackagingItemOutputState computeOutputState() {
- final SmartList<Pair<String, Long>> pairs = new SmartList<Pair<String, Long>>();
- for (DestinationInfo destination : myDestinations) {
- destination.update();
- final VirtualFile outputFile = destination.getOutputFile();
- long timestamp = outputFile != null ? outputFile.getTimeStamp() : -1;
- pairs.add(Pair.create(destination.getOutputPath(), timestamp));
- }
- return new ArtifactPackagingItemOutputState(pairs);
- }
-
- @Override
- public boolean isOutputUpToDate(@NotNull ArtifactPackagingItemOutputState state) {
- final SmartList<Pair<String, Long>> cachedDestinations = state.myDestinations;
- if (cachedDestinations.size() != myDestinations.size()) {
- return false;
- }
-
- for (DestinationInfo info : myDestinations) {
- final VirtualFile outputFile = info.getOutputFile();
- long timestamp = outputFile != null ? outputFile.getTimeStamp() : -1;
- final String path = info.getOutputPath();
- boolean found = false;
- //todo[nik] use map if list contains many items
- for (Pair<String, Long> cachedDestination : cachedDestinations) {
- if (cachedDestination.first.equals(path)) {
- if (cachedDestination.second != timestamp) return false;
- found = true;
- break;
- }
- }
- if (!found) return false;
- }
-
- return true;
- }
-
-}
diff --git a/java/compiler/impl/src/com/intellij/packaging/impl/compiler/ArtifactCompilerUtil.java b/java/compiler/impl/src/com/intellij/packaging/impl/compiler/ArtifactCompilerUtil.java
index 0c2a15172c99..d4070de6b844 100644
--- a/java/compiler/impl/src/com/intellij/packaging/impl/compiler/ArtifactCompilerUtil.java
+++ b/java/compiler/impl/src/com/intellij/packaging/impl/compiler/ArtifactCompilerUtil.java
@@ -15,129 +15,26 @@
*/
package com.intellij.packaging.impl.compiler;
-import com.intellij.facet.Facet;
-import com.intellij.facet.FacetManager;
-import com.intellij.facet.FacetRootsProvider;
import com.intellij.openapi.application.ReadAction;
import com.intellij.openapi.application.Result;
-import com.intellij.openapi.compiler.CompileContext;
-import com.intellij.openapi.compiler.CompilerMessageCategory;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.module.Module;
-import com.intellij.openapi.module.ModuleManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.openapi.vfs.JarFileSystem;
-import com.intellij.openapi.vfs.VfsUtilCore;
-import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.packaging.artifacts.Artifact;
import com.intellij.packaging.artifacts.ArtifactManager;
-import com.intellij.packaging.elements.PackagingElement;
-import com.intellij.packaging.elements.PackagingElementResolvingContext;
-import com.intellij.packaging.impl.artifacts.ArtifactUtil;
-import com.intellij.packaging.impl.elements.FileOrDirectoryCopyPackagingElement;
-import com.intellij.util.Processor;
-import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.containers.MultiMap;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
import org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.ParametersMessage.TargetTypeBuildScope;
import org.jetbrains.jps.incremental.artifacts.ArtifactBuildTargetType;
-import java.io.BufferedInputStream;
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashSet;
import java.util.List;
-import java.util.Set;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipFile;
/**
* @author nik
*/
public class ArtifactCompilerUtil {
- private static final Logger LOG = Logger.getInstance("#com.intellij.packaging.impl.compiler.ArtifactCompilerUtil");
-
private ArtifactCompilerUtil() {
}
- @Nullable
- public static BufferedInputStream getJarEntryInputStream(VirtualFile sourceFile, final CompileContext context) throws IOException {
- final String fullPath = sourceFile.getPath();
- final int jarEnd = fullPath.indexOf(JarFileSystem.JAR_SEPARATOR);
- LOG.assertTrue(jarEnd != -1, fullPath);
- String pathInJar = fullPath.substring(jarEnd + JarFileSystem.JAR_SEPARATOR.length());
- String jarPath = fullPath.substring(0, jarEnd);
- final ZipFile jarFile = new ZipFile(new File(FileUtil.toSystemDependentName(jarPath)));
- final ZipEntry entry = jarFile.getEntry(pathInJar);
- if (entry == null) {
- context.addMessage(CompilerMessageCategory.ERROR, "Cannot extract '" + pathInJar + "' from '" + jarFile.getName() + "': entry not found", null, -1, -1);
- return null;
- }
-
- return new BufferedInputStream(jarFile.getInputStream(entry)) {
- @Override
- public void close() throws IOException {
- super.close();
- jarFile.close();
- }
- };
- }
-
- public static File getJarFile(VirtualFile jarEntry) {
- String fullPath = jarEntry.getPath();
- return new File(FileUtil.toSystemDependentName(fullPath.substring(fullPath.indexOf(JarFileSystem.JAR_SEPARATOR))));
- }
-
-
- @NotNull
- public static Set<VirtualFile> getArtifactOutputsContainingSourceFiles(final @NotNull Project project) {
- final List<VirtualFile> allOutputs = new ArrayList<VirtualFile>();
- for (Artifact artifact : ArtifactManager.getInstance(project).getArtifacts()) {
- ContainerUtil.addIfNotNull(artifact.getOutputFile(), allOutputs);
- }
-
- final Set<VirtualFile> roots = new HashSet<VirtualFile>();
- final PackagingElementResolvingContext context = ArtifactManager.getInstance(project).getResolvingContext();
- for (Artifact artifact : ArtifactManager.getInstance(project).getArtifacts()) {
- Processor<PackagingElement<?>> processor = new Processor<PackagingElement<?>>() {
- @Override
- public boolean process(@NotNull PackagingElement<?> element) {
- if (element instanceof FileOrDirectoryCopyPackagingElement<?>) {
- final VirtualFile file = ((FileOrDirectoryCopyPackagingElement)element).findFile();
- if (file != null) {
- roots.add(file);
- }
- }
- return true;
- }
- };
- ArtifactUtil.processRecursivelySkippingIncludedArtifacts(artifact, processor, context);
- }
-
- final Module[] modules = ModuleManager.getInstance(project).getModules();
- for (Module module : modules) {
- final Facet[] facets = FacetManager.getInstance(module).getAllFacets();
- for (Facet facet : facets) {
- if (facet instanceof FacetRootsProvider) {
- roots.addAll(((FacetRootsProvider)facet).getFacetRoots());
- }
- }
- }
-
- final Set<VirtualFile> affectedOutputPaths = new HashSet<VirtualFile>();
- for (VirtualFile output : allOutputs) {
- for (VirtualFile root : roots) {
- if (VfsUtilCore.isAncestor(output, root, false)) {
- affectedOutputPaths.add(output);
- }
- }
- }
- return affectedOutputPaths;
- }
public static boolean containsArtifacts(List<TargetTypeBuildScope> scopes) {
for (TargetTypeBuildScope scope : scopes) {
diff --git a/java/compiler/impl/src/com/intellij/packaging/impl/compiler/ArtifactPackagingItemExternalizer.java b/java/compiler/impl/src/com/intellij/packaging/impl/compiler/ArtifactPackagingItemExternalizer.java
deleted file mode 100644
index 175cdca3ea9e..000000000000
--- a/java/compiler/impl/src/com/intellij/packaging/impl/compiler/ArtifactPackagingItemExternalizer.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright 2000-2014 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.packaging.impl.compiler;
-
-import com.intellij.openapi.util.Pair;
-import com.intellij.util.SmartList;
-import com.intellij.util.io.DataExternalizer;
-import com.intellij.util.io.IOUtil;
-import org.jetbrains.annotations.NotNull;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-
-/**
-* @author nik
-*/
-public class ArtifactPackagingItemExternalizer implements DataExternalizer<ArtifactPackagingItemOutputState> {
- @Override
- public void save(@NotNull DataOutput out, ArtifactPackagingItemOutputState value) throws IOException {
- out.writeInt(value.myDestinations.size());
- for (Pair<String, Long> pair : value.myDestinations) {
- IOUtil.writeUTF(out, pair.getFirst());
- out.writeLong(pair.getSecond());
- }
- }
-
- @Override
- public ArtifactPackagingItemOutputState read(@NotNull DataInput in) throws IOException {
- int size = in.readInt();
- SmartList<Pair<String, Long>> destinations = new SmartList<Pair<String, Long>>();
- while (size-- > 0) {
- String path = IOUtil.readUTF(in);
- long outputTimestamp = in.readLong();
- destinations.add(Pair.create(path, outputTimestamp));
- }
- return new ArtifactPackagingItemOutputState(destinations);
- }
-}
diff --git a/java/compiler/impl/src/com/intellij/packaging/impl/compiler/ArtifactPackagingItemOutputState.java b/java/compiler/impl/src/com/intellij/packaging/impl/compiler/ArtifactPackagingItemOutputState.java
deleted file mode 100644
index 29ac0ae91918..000000000000
--- a/java/compiler/impl/src/com/intellij/packaging/impl/compiler/ArtifactPackagingItemOutputState.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright 2000-2010 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.packaging.impl.compiler;
-
-import com.intellij.openapi.util.Pair;
-import com.intellij.util.SmartList;
-
-/**
-* @author nik
-*/
-public class ArtifactPackagingItemOutputState {
- public final SmartList<Pair<String, Long>> myDestinations;
-
- public ArtifactPackagingItemOutputState(SmartList<Pair<String, Long>> destinations) {
- myDestinations = destinations;
- }
-}
diff --git a/java/compiler/instrumentation-util/src/com/intellij/compiler/notNullVerification/NotNullVerifyingInstrumenter.java b/java/compiler/instrumentation-util/src/com/intellij/compiler/notNullVerification/NotNullVerifyingInstrumenter.java
index 3bc0dc093fc8..686791e94c04 100644
--- a/java/compiler/instrumentation-util/src/com/intellij/compiler/notNullVerification/NotNullVerifyingInstrumenter.java
+++ b/java/compiler/instrumentation-util/src/com/intellij/compiler/notNullVerification/NotNullVerifyingInstrumenter.java
@@ -15,11 +15,11 @@
*/
package com.intellij.compiler.notNullVerification;
+import com.sun.istack.internal.NotNull;
+import com.sun.istack.internal.Nullable;
import org.jetbrains.org.objectweb.asm.*;
-import java.util.ArrayList;
import java.util.LinkedHashMap;
-import java.util.List;
import java.util.Map;
/**
@@ -100,6 +100,15 @@ public class NotNullVerifyingInstrumenter extends ClassVisitor implements Opcode
myClassName = name;
}
+ private static class NotNullState {
+ @Nullable String message;
+ @NotNull String exceptionType;
+
+ NotNullState(String exceptionType) {
+ this.exceptionType = exceptionType;
+ }
+ }
+
@Override
public MethodVisitor visitMethod(final int access, final String name, String desc, String signature, String[] exceptions) {
final Type[] args = Type.getArgumentTypes(desc);
@@ -107,29 +116,32 @@ public class NotNullVerifyingInstrumenter extends ClassVisitor implements Opcode
final MethodVisitor v = cv.visitMethod(access, name, desc, signature, exceptions);
final Map<Integer, String> paramNames = myMethodParamNames.get(myClassName + '.' + name + desc);
return new MethodVisitor(Opcodes.ASM5, v) {
-
- private final List<Integer> myNotNullParams = new ArrayList<Integer>();
+ private final Map<Integer, NotNullState> myNotNullParams = new LinkedHashMap<Integer, NotNullState>();
private int mySyntheticCount = 0;
- private boolean myIsNotNull = false;
- private String myMessage = null;
+ private NotNullState myMethodNotNull;
private Label myStartGeneratedCodeLabel;
+ private AnnotationVisitor collectNotNullArgs(AnnotationVisitor base, final NotNullState state) {
+ return new AnnotationVisitor(Opcodes.ASM5, base) {
+ @Override
+ public void visit(String methodName, Object o) {
+ if (ANNOTATION_DEFAULT_METHOD.equals(methodName) && !((String) o).isEmpty()) {
+ state.message = (String) o;
+ }
+ else if ("exception".equals(methodName) && o instanceof Type && !((Type)o).getClassName().equals(Exception.class.getName())) {
+ state.exceptionType = ((Type)o).getInternalName();
+ }
+ super.visit(methodName, o);
+ }
+ };
+ }
+
public AnnotationVisitor visitParameterAnnotation(final int parameter, final String anno, final boolean visible) {
AnnotationVisitor av = mv.visitParameterAnnotation(parameter, anno, visible);
if (isReferenceType(args[parameter]) && anno.equals(NOT_NULL_TYPE)) {
- myNotNullParams.add(new Integer(parameter));
- av = new AnnotationVisitor(Opcodes.ASM5, av) {
- @Override
- public void visit(String methodName, Object o) {
- if(ANNOTATION_DEFAULT_METHOD.equals(methodName)) {
- String message = (String) o;
- if(!message.isEmpty()) {
- myMessage = message;
- }
- }
- super.visit(methodName, o);
- }
- };
+ NotNullState state = new NotNullState(IAE_CLASS_NAME);
+ myNotNullParams.put(new Integer(parameter), state);
+ av = collectNotNullArgs(av, state);
}
else if (anno.equals(SYNTHETIC_TYPE)) {
// see http://forge.ow2.org/tracker/?aid=307392&group_id=23&atid=100023&func=detail
@@ -143,19 +155,8 @@ public class NotNullVerifyingInstrumenter extends ClassVisitor implements Opcode
public AnnotationVisitor visitAnnotation(String anno, boolean isRuntime) {
AnnotationVisitor av = mv.visitAnnotation(anno, isRuntime);
if (isReferenceType(returnType) && anno.equals(NOT_NULL_TYPE)) {
- myIsNotNull = true;
- av = new AnnotationVisitor(Opcodes.ASM5, av) {
- @Override
- public void visit(String methodName, Object o) {
- if(ANNOTATION_DEFAULT_METHOD.equals(methodName)) {
- String message = (String) o;
- if(!message.isEmpty()) {
- myMessage = message;
- }
- }
- super.visit(methodName, o);
- }
- };
+ myMethodNotNull = new NotNullState(ISE_CLASS_NAME);
+ av = collectNotNullArgs(av, myMethodNotNull);
}
return av;
@@ -167,7 +168,8 @@ public class NotNullVerifyingInstrumenter extends ClassVisitor implements Opcode
myStartGeneratedCodeLabel = new Label();
mv.visitLabel(myStartGeneratedCodeLabel);
}
- for (Integer param : myNotNullParams) {
+ for (Map.Entry<Integer, NotNullState> entry : myNotNullParams.entrySet()) {
+ Integer param = entry.getKey();
int var = ((access & ACC_STATIC) == 0) ? 1 : 0;
for (int i = 0; i < param; ++i) {
var += args[i].getSize();
@@ -177,14 +179,15 @@ public class NotNullVerifyingInstrumenter extends ClassVisitor implements Opcode
Label end = new Label();
mv.visitJumpInsn(IFNONNULL, end);
+ NotNullState state = entry.getValue();
String paramName = paramNames == null ? null : paramNames.get(param);
- String descrPattern = myMessage != null
- ? myMessage
+ String descrPattern = state.message != null
+ ? state.message
: paramName != null ? NULL_ARG_MESSAGE_NAMED : NULL_ARG_MESSAGE_INDEXED;
- String[] args = myMessage != null
+ String[] args = state.message != null
? EMPTY_STRING_ARRAY
: new String[]{paramName != null ? paramName : String.valueOf(param - mySyntheticCount), myClassName, name};
- generateThrow(IAE_CLASS_NAME, end, descrPattern, args);
+ generateThrow(state.exceptionType, end, descrPattern, args);
}
}
@@ -199,13 +202,13 @@ public class NotNullVerifyingInstrumenter extends ClassVisitor implements Opcode
@Override
public void visitInsn(int opcode) {
if (opcode == ARETURN) {
- if (myIsNotNull) {
+ if (myMethodNotNull != null) {
mv.visitInsn(DUP);
final Label skipLabel = new Label();
mv.visitJumpInsn(IFNONNULL, skipLabel);
- String descrPattern = myMessage != null ? myMessage : NULL_RESULT_MESSAGE;
- String[] args = myMessage != null ? EMPTY_STRING_ARRAY : new String[]{myClassName, name};
- generateThrow(ISE_CLASS_NAME, skipLabel, descrPattern, args);
+ String descrPattern = myMethodNotNull.message != null ? myMethodNotNull.message : NULL_RESULT_MESSAGE;
+ String[] args = myMethodNotNull.message != null ? EMPTY_STRING_ARRAY : new String[]{myClassName, name};
+ generateThrow(myMethodNotNull.exceptionType, skipLabel, descrPattern, args);
}
}
diff --git a/java/compiler/openapi/src/com/intellij/openapi/compiler/make/BuildInstruction.java b/java/compiler/openapi/src/com/intellij/openapi/compiler/make/BuildInstruction.java
deleted file mode 100644
index eed2e77c8030..000000000000
--- a/java/compiler/openapi/src/com/intellij/openapi/compiler/make/BuildInstruction.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright 2000-2009 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.openapi.compiler.make;
-
-/**
- * @deprecated this class is part of the obsolete build system which runs as part of the IDE process. Since IDEA 12 plugins need to
- * integrate into 'external build system' instead (http://confluence.jetbrains.com/display/IDEADEV/External+Builder+API+and+Plugins).
- * Since IDEA 13 users cannot switch to the old build system via UI and it will be completely removed in IDEA 14.
- */
-public interface BuildInstruction {
- String getOutputRelativePath();
-
- boolean accept(BuildInstructionVisitor visitor) throws Exception;
-}
diff --git a/java/compiler/openapi/src/com/intellij/openapi/compiler/make/BuildInstructionVisitor.java b/java/compiler/openapi/src/com/intellij/openapi/compiler/make/BuildInstructionVisitor.java
deleted file mode 100644
index 0bd62be958f7..000000000000
--- a/java/compiler/openapi/src/com/intellij/openapi/compiler/make/BuildInstructionVisitor.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright 2000-2009 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.openapi.compiler.make;
-
-/**
- * @deprecated this class is part of the obsolete build system which runs as part of the IDE process. Since IDEA 12 plugins need to
- * integrate into 'external build system' instead (http://confluence.jetbrains.com/display/IDEADEV/External+Builder+API+and+Plugins).
- * Since IDEA 13 users cannot switch to the old build system via UI and it will be completely removed in IDEA 14.
- */
-public abstract class BuildInstructionVisitor {
- public boolean visitInstruction(BuildInstruction instruction) throws Exception {
- return true;
- }
- public boolean visitFileCopyInstruction(FileCopyInstruction instruction) throws Exception {
- return visitInstruction(instruction);
- }
-} \ No newline at end of file
diff --git a/java/compiler/openapi/src/com/intellij/openapi/compiler/make/BuildParticipant.java b/java/compiler/openapi/src/com/intellij/openapi/compiler/make/BuildParticipant.java
deleted file mode 100644
index 977772418589..000000000000
--- a/java/compiler/openapi/src/com/intellij/openapi/compiler/make/BuildParticipant.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright 2000-2009 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.openapi.compiler.make;
-
-import com.intellij.openapi.compiler.CompileContext;
-import com.intellij.packaging.artifacts.Artifact;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * @deprecated this class is part of the obsolete build system which runs as part of the IDE process. Since IDEA 12 plugins need to
- * integrate into 'external build system' instead (http://confluence.jetbrains.com/display/IDEADEV/External+Builder+API+and+Plugins).
- * Since IDEA 13 users cannot switch to the old build system via UI and it will be completely removed in IDEA 14.
- */
-public abstract class BuildParticipant {
- public static final BuildParticipant[] EMPTY_ARRAY = new BuildParticipant[0];
-
- @Nullable
- public abstract Artifact createArtifact(CompileContext context);
-
-}
diff --git a/java/compiler/openapi/src/com/intellij/openapi/compiler/make/BuildParticipantProvider.java b/java/compiler/openapi/src/com/intellij/openapi/compiler/make/BuildParticipantProvider.java
deleted file mode 100644
index 374e161549ad..000000000000
--- a/java/compiler/openapi/src/com/intellij/openapi/compiler/make/BuildParticipantProvider.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright 2000-2009 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.openapi.compiler.make;
-
-import com.intellij.openapi.extensions.ExtensionPointName;
-import com.intellij.openapi.module.Module;
-
-import java.util.Collection;
-
-/**
- * @author nik
- *
- * @deprecated this class is part of the obsolete build system which runs as part of the IDE process. Since IDEA 12 plugins need to
- * integrate into 'external build system' instead (http://confluence.jetbrains.com/display/IDEADEV/External+Builder+API+and+Plugins).
- * Since IDEA 13 users cannot switch to the old build system via UI and it will be completely removed in IDEA 14.
- */
-public abstract class BuildParticipantProvider {
- public static final ExtensionPointName<BuildParticipantProvider> EXTENSION_POINT_NAME = ExtensionPointName.create("com.intellij.compiler.buildParticipantProvider");
-
-
- public abstract Collection<? extends BuildParticipant> getParticipants(Module module);
-
-}
diff --git a/java/compiler/openapi/src/com/intellij/openapi/compiler/make/FileCopyInstruction.java b/java/compiler/openapi/src/com/intellij/openapi/compiler/make/FileCopyInstruction.java
deleted file mode 100644
index c5636394cfe0..000000000000
--- a/java/compiler/openapi/src/com/intellij/openapi/compiler/make/FileCopyInstruction.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright 2000-2009 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.openapi.compiler.make;
-
-import java.io.File;
-
-/**
- * @deprecated this class is part of the obsolete build system which runs as part of the IDE process. Since IDEA 12 plugins need to
- * integrate into 'external build system' instead (http://confluence.jetbrains.com/display/IDEADEV/External+Builder+API+and+Plugins).
- * Since IDEA 13 users cannot switch to the old build system via UI and it will be completely removed in IDEA 14.
- */
-public interface FileCopyInstruction extends BuildInstruction {
- File getFile();
-
- boolean isDirectory();
-
-} \ No newline at end of file
diff --git a/java/debugger/impl/src/com/intellij/debugger/actions/QuickEvaluateActionHandler.java b/java/debugger/impl/src/com/intellij/debugger/actions/QuickEvaluateActionHandler.java
index 6eedff4136ea..2696f226e412 100644
--- a/java/debugger/impl/src/com/intellij/debugger/actions/QuickEvaluateActionHandler.java
+++ b/java/debugger/impl/src/com/intellij/debugger/actions/QuickEvaluateActionHandler.java
@@ -22,13 +22,13 @@ package com.intellij.debugger.actions;
import com.intellij.debugger.DebuggerManagerEx;
import com.intellij.debugger.impl.DebuggerSession;
-import com.intellij.debugger.settings.DebuggerSettings;
import com.intellij.debugger.ui.ValueHint;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.project.Project;
import com.intellij.xdebugger.impl.evaluate.quick.common.AbstractValueHint;
import com.intellij.xdebugger.impl.evaluate.quick.common.QuickEvaluateHandler;
import com.intellij.xdebugger.impl.evaluate.quick.common.ValueHintType;
+import com.intellij.xdebugger.settings.XDebuggerSettingsManager;
import org.jetbrains.annotations.NotNull;
import java.awt.*;
@@ -53,6 +53,6 @@ public class QuickEvaluateActionHandler extends QuickEvaluateHandler {
@Override
public int getValueLookupDelay(final Project project) {
- return DebuggerSettings.getInstance().VALUE_LOOKUP_DELAY;
+ return XDebuggerSettingsManager.getInstance().getDataViewSettings().getValueLookupDelay();
}
}
diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/JavaStackFrame.java b/java/debugger/impl/src/com/intellij/debugger/engine/JavaStackFrame.java
index ed4d8296c381..bcd8257736c2 100644
--- a/java/debugger/impl/src/com/intellij/debugger/engine/JavaStackFrame.java
+++ b/java/debugger/impl/src/com/intellij/debugger/engine/JavaStackFrame.java
@@ -27,7 +27,6 @@ import com.intellij.debugger.impl.DebuggerUtilsEx;
import com.intellij.debugger.jdi.*;
import com.intellij.debugger.settings.DebuggerSettings;
import com.intellij.debugger.settings.NodeRendererSettings;
-import com.intellij.debugger.settings.ViewsGeneralSettings;
import com.intellij.debugger.ui.breakpoints.Breakpoint;
import com.intellij.debugger.ui.impl.FrameVariablesTree;
import com.intellij.debugger.ui.impl.watch.*;
@@ -47,6 +46,7 @@ import com.intellij.xdebugger.frame.XCompositeNode;
import com.intellij.xdebugger.frame.XStackFrame;
import com.intellij.xdebugger.frame.XValueChildrenList;
import com.intellij.xdebugger.impl.ui.XDebuggerUIConstants;
+import com.intellij.xdebugger.settings.XDebuggerSettingsManager;
import com.sun.jdi.*;
import com.sun.jdi.event.Event;
import com.sun.jdi.event.ExceptionEvent;
@@ -66,7 +66,6 @@ public class JavaStackFrame extends XStackFrame {
private final DebugProcessImpl myDebugProcess;
private final XSourcePosition myXSourcePosition;
- private final SourcePosition mySourcePosition;
private final NodeManagerImpl myNodeManager;
private final StackFrameDescriptorImpl myDescriptor;
private static final JavaFramesListRenderer FRAME_RENDERER = new JavaFramesListRenderer();
@@ -74,43 +73,22 @@ public class JavaStackFrame extends XStackFrame {
public JavaStackFrame(@NotNull StackFrameProxyImpl stackFrameProxy, @NotNull DebugProcessImpl debugProcess, MethodsTracker tracker) {
myDebugProcess = debugProcess;
- Pair<SourcePosition, XSourcePosition> positions = calcSourcePosition(stackFrameProxy);
- mySourcePosition = positions.getFirst();
- myXSourcePosition = positions.getSecond();
myNodeManager = debugProcess.getXdebugProcess().getNodeManager();
myDescriptor = new StackFrameDescriptorImpl(stackFrameProxy, tracker);
myDescriptor.setContext(null);
myDescriptor.updateRepresentation(null, DescriptorLabelListener.DUMMY_LISTENER);
+ myXSourcePosition = ApplicationManager.getApplication().runReadAction(new Computable<XSourcePosition>() {
+ @Override
+ public XSourcePosition compute() {
+ return myDescriptor.getSourcePosition() != null ? DebuggerUtilsEx.toXSourcePosition(myDescriptor.getSourcePosition()) : null;
+ }
+ });
}
public StackFrameDescriptorImpl getDescriptor() {
return myDescriptor;
}
- private Pair<SourcePosition, XSourcePosition> calcSourcePosition(StackFrameProxyImpl stackFrameProxy) {
- final CompoundPositionManager positionManager = myDebugProcess.getPositionManager();
- if (positionManager == null) {
- // process already closed
- return null;
- }
- Location location = null;
- try {
- location = stackFrameProxy.location();
- }
- catch (Throwable e) {
- LOG.info(e);
- }
- final Location loc = location;
- return ApplicationManager.getApplication().runReadAction(new Computable<Pair<SourcePosition, XSourcePosition>>() {
- @Override
- public Pair<SourcePosition, XSourcePosition> compute() {
- SourcePosition position = positionManager.getSourcePosition(loc);
- XSourcePosition xSourcePosition = position != null ? DebuggerUtilsEx.toXSourcePosition(position) : null;
- return new Pair<SourcePosition, XSourcePosition>(position, xSourcePosition);
- }
- });
- }
-
@Nullable
@Override
public XDebuggerEvaluator getEvaluator() {
@@ -174,7 +152,7 @@ public class JavaStackFrame extends XStackFrame {
threadSuspendContext,
getStackFrameProxy().threadProxy(),
getStackFrameProxy());
- context.setPositionCache(mySourcePosition);
+ context.setPositionCache(myDescriptor.getSourcePosition());
context.initCaches();
}
return context;
@@ -293,7 +271,7 @@ public class JavaStackFrame extends XStackFrame {
}
try {
- if (!ViewsGeneralSettings.getInstance().ENABLE_AUTO_EXPRESSIONS && !myAutoWatchMode) {
+ if (!XDebuggerSettingsManager.getInstance().getDataViewSettings().isAutoExpressions() && !myAutoWatchMode) {
// optimization
superBuildVariables(evaluationContext, children);
}
diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/JavaValue.java b/java/debugger/impl/src/com/intellij/debugger/engine/JavaValue.java
index 6af021c0f9cc..0a691d332207 100644
--- a/java/debugger/impl/src/com/intellij/debugger/engine/JavaValue.java
+++ b/java/debugger/impl/src/com/intellij/debugger/engine/JavaValue.java
@@ -58,7 +58,10 @@ public class JavaValue extends XNamedValue implements NodeDescriptorProvider {
private final EvaluationContextImpl myEvaluationContext;
private final NodeManagerImpl myNodeManager;
- private JavaValue(JavaValue parent, @NotNull ValueDescriptorImpl valueDescriptor, EvaluationContextImpl evaluationContext, NodeManagerImpl nodeManager) {
+ private JavaValue(JavaValue parent,
+ @NotNull ValueDescriptorImpl valueDescriptor,
+ @NotNull EvaluationContextImpl evaluationContext,
+ NodeManagerImpl nodeManager) {
super(valueDescriptor.getName());
myParent = parent;
myValueDescriptor = valueDescriptor;
diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/MethodEvaluator.java b/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/MethodEvaluator.java
index d299af172340..69cbb140be86 100644
--- a/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/MethodEvaluator.java
+++ b/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/MethodEvaluator.java
@@ -83,8 +83,8 @@ public class MethodEvaluator implements Evaluator {
ReferenceType referenceType = null;
if(object instanceof ObjectReference) {
- final ReferenceType qualifierType = ((ObjectReference)object).referenceType();
- referenceType = debugProcess.findClass(context, qualifierType.name(), qualifierType.classLoader());
+ // it seems that if we have an object of the class, the class must be ready, so no need to use findClass here
+ referenceType = ((ObjectReference)object).referenceType();
}
else if(object instanceof ClassType) {
final ClassType qualifierType = (ClassType)object;
diff --git a/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerUtilsEx.java b/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerUtilsEx.java
index e937aac836ef..026b7111d18f 100644
--- a/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerUtilsEx.java
+++ b/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerUtilsEx.java
@@ -45,6 +45,7 @@ import com.intellij.psi.*;
import com.intellij.psi.codeStyle.CodeStyleSettingsManager;
import com.intellij.ui.classFilter.ClassFilter;
import com.intellij.util.SmartList;
+import com.intellij.util.containers.ContainerUtil;
import com.intellij.xdebugger.XSourcePosition;
import com.intellij.xdebugger.impl.XSourcePositionImpl;
import com.sun.jdi.*;
@@ -199,7 +200,7 @@ public abstract class DebuggerUtilsEx extends DebuggerUtils {
public static ClassFilter create(Element element) throws InvalidDataException {
ClassFilter filter = new ClassFilter();
- filter.readExternal(element);
+ DefaultJDOMExternalizer.readExternal(filter, element);
return filter;
}
@@ -245,24 +246,23 @@ public abstract class DebuggerUtilsEx extends DebuggerUtils {
return res;
}
- public static ClassFilter[] readFilters(List children) throws InvalidDataException {
- if (children == null || children.size() == 0) {
+ public static ClassFilter[] readFilters(List<Element> children) throws InvalidDataException {
+ if (ContainerUtil.isEmpty(children)) {
return ClassFilter.EMPTY_ARRAY;
}
- List<ClassFilter> classFiltersList = new ArrayList<ClassFilter>(children.size());
- for (Object aChildren : children) {
- final ClassFilter classFilter = new ClassFilter();
- classFilter.readExternal((Element)aChildren);
- classFiltersList.add(classFilter);
+
+ ClassFilter[] filters = new ClassFilter[children.size()];
+ for (int i = 0, size = children.size(); i < size; i++) {
+ filters[i] = create(children.get(i));
}
- return classFiltersList.toArray(new ClassFilter[classFiltersList.size()]);
+ return filters;
}
public static void writeFilters(Element parentNode, @NonNls String tagName, ClassFilter[] filters) throws WriteExternalException {
for (ClassFilter filter : filters) {
Element element = new Element(tagName);
parentNode.addContent(element);
- filter.writeExternal(element);
+ DefaultJDOMExternalizer.writeExternal(filter, element);
}
}
diff --git a/java/debugger/impl/src/com/intellij/debugger/impl/JavaEditorTextProviderImpl.java b/java/debugger/impl/src/com/intellij/debugger/impl/JavaEditorTextProviderImpl.java
index 11b077340eb7..7b76b9738843 100644
--- a/java/debugger/impl/src/com/intellij/debugger/impl/JavaEditorTextProviderImpl.java
+++ b/java/debugger/impl/src/com/intellij/debugger/impl/JavaEditorTextProviderImpl.java
@@ -107,7 +107,10 @@ public class JavaEditorTextProviderImpl implements EditorTextProvider {
else if (parent instanceof PsiThisExpression) {
expression = parent;
}
- else if (parent instanceof PsiInstanceOfExpression || parent instanceof PsiBinaryExpression || parent instanceof PsiPolyadicExpression) {
+ else if (parent instanceof PsiInstanceOfExpression
+ || parent instanceof PsiBinaryExpression
+ || parent instanceof PsiPolyadicExpression
+ || parent instanceof PsiPrefixExpression) {
if (allowMethodCalls || !DebuggerUtils.hasSideEffects(parent)) {
expression = parent;
}
diff --git a/java/debugger/impl/src/com/intellij/debugger/jdi/Bytecodes.java b/java/debugger/impl/src/com/intellij/debugger/jdi/Bytecodes.java
index 86fb655b0853..d6aa2372e720 100644
--- a/java/debugger/impl/src/com/intellij/debugger/jdi/Bytecodes.java
+++ b/java/debugger/impl/src/com/intellij/debugger/jdi/Bytecodes.java
@@ -232,15 +232,16 @@ class Bytecodes {
static {
int i;
byte[] b = new byte[220];
- String s = "AAAAAAAAAAAAAAAABCLMMDDDDDEEEEEEEEEEEEEEEEEEEEAAAAAAAADD"
- + "DDDEEEEEEEEEEEEEEEEEEEEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
- + "AAAAAAAAAAAAAAAAANAAAAAAAAAAAAAAAAAAAAJJJJJJJJJJJJJJJJDOPAA"
- + "AAAAGGGGGGGHIFBFAAFFAARQJJKKJJJJJJJJJJJJJJJJJJ";
- for (i = 0; i < b.length; ++i) {
- b[i] = (byte) (s.charAt(i) - 'A');
- }
- TYPE = b;
+ String s =
+ "AAAAAAAAAAAAAAAABCLMMDDDDDEEEEEEEEEEEEEEEEEEEEAAAAAAAADDDDDEE" +
+ "EEEEEEEEEEEEEEEEEEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" +
+ "AAAAAAAAAANAAAAAAAAAAAAAAAAAAAAJJJJJJJJJJJJJJJJDOPAAAAAAGGGGG" +
+ "GGHIFBFAAFFAARQJJKKJLMMGGGGGGGGGGGGHGAFFQFFGGG";
+ for (i = 0; i < b.length; ++i) {
+ b[i] = (byte) (s.charAt(i) - 'A');
}
+ TYPE = b;
+ }
static final int NOP = 0; // visitInsn
@@ -446,4 +447,139 @@ class Bytecodes {
static final int GOTO_W = 200; // -
static final int JSR_W = 201; // -
+ // JVM runtime-specific and reserved opcodes:
+ // From JVM specification:
+ // In addition to the opcodes of the instructions specified later in this chapter, which are used in class files (§4), three opcodes are reserved for internal use by a Java Virtual Machine implementation. If the instruction set of the Java Virtual Machine is extended in the future, these reserved opcodes are guaranteed not to be used.
+ // Two of the reserved opcodes, numbers 254 (0xfe) and 255 (0xff), have the mnemonics impdep1 and impdep2, respectively. These instructions are intended to provide "back doors" or traps to implementation-specific functionality implemented in software and hardware, respectively. The third reserved opcode, number 202 (0xca), has the mnemonic breakpoint and is intended to be used by debuggers to implement breakpoints.
+ // Although these opcodes have been reserved, they may be used only inside a Java Virtual Machine implementation. They cannot appear in valid class files. Tools such as debuggers or JIT code generators (§2.13) that might directly interact with Java Virtual Machine code that has been already loaded and executed may encounter these opcodes. Such tools should attempt to behave gracefully if they encounter any of these reserved instructions.
+
+ static final int BREAKPOINT = 202;
+ static final int LDC_QUICK = 203;
+ static final int LDC_W_QUICK = 204;
+ static final int LDC2_W_QUICK = 205;
+ static final int GETFIELD_QUICK = 206;
+ static final int PUTFIELD_QUICK = 207;
+ static final int GETFIELD2_QUICK = 208;
+ static final int PUTFIELD2_QUICK = 209;
+ static final int GETSTATIC_QUICK = 210;
+ static final int PUTSTATIC_QUICK = 211;
+ static final int GETSTATIC2_QUICK = 212;
+ static final int PUTSTATIC2_QUICK = 213;
+ static final int INVOKEVIRTUAL_QUICK = 214;
+ static final int INVOKENONVIRTUAL_QUICK = 215;
+ static final int INVOKESUPER_QUICK = 216;
+ static final int INVOKESTATIC_QUICK = 217;
+ static final int INVOKEINTERFACE_QUICK = 218;
+ static final int INVOKEVIRTUALOBJECT_QUICK = 219;
+ static final int NEW_QUICK = 221;
+ static final int ANEWARRAY_QUICK = 222;
+ static final int MULTIANEWARRAY_QUICK = 223;
+ static final int CHECKCAST_QUICK = 224;
+ static final int INSTANCEOF_QUICK = 225;
+ static final int INVOKEVIRTUAL_QUICK_W = 226;
+ static final int GETFIELD_QUICK_W = 227;
+ static final int PUTFIELD_QUICK_W = 228;
+ static final int IMPDEP1 = 254;
+ static final int IMPDEP2 = 255;
+
+ public static void main(String[] args) {
+ int[] b = new int[229];
+ //code to generate the above string
+
+ // SBYTE_INSN instructions
+ b[NEWARRAY] = SBYTE_INSN;
+ b[BIPUSH] = SBYTE_INSN;
+
+ // SHORT_INSN instructions
+ b[SIPUSH] = SHORT_INSN;
+
+ // (IMPL)VAR_INSN instructions
+ b[RET] = VAR_INSN;
+ for (int i = ILOAD; i <= ALOAD; ++i) {
+ b[i] = VAR_INSN;
+ }
+ for (int i = ISTORE; i <= ASTORE; ++i) {
+ b[i] = VAR_INSN;
+ }
+ for (int i = 26; i <= 45; ++i) { // ILOAD_0 to ALOAD_3
+ b[i] = IMPLVAR_INSN;
+ }
+ for (int i = 59; i <= 78; ++i) { // ISTORE_0 to ASTORE_3
+ b[i] = IMPLVAR_INSN;
+ }
+
+ // TYPE_INSN instructions
+ b[NEW] = TYPE_INSN;
+ b[ANEWARRAY] = TYPE_INSN;
+ b[CHECKCAST] = TYPE_INSN;
+ b[INSTANCEOF] = TYPE_INSN;
+
+ // (Set)FIELDORMETH_INSN instructions
+ for (int i = GETSTATIC; i <= INVOKESTATIC; ++i) {
+ b[i] = FIELDORMETH_INSN;
+ }
+ b[INVOKEINTERFACE] = ITFMETH_INSN;
+ b[INVOKEDYNAMIC] = INDYMETH_INSN;
+
+ // LABEL(W)_INSN instructions
+ for (int i = IFEQ; i <= JSR; ++i) {
+ b[i] = LABEL_INSN;
+ }
+ b[IFNULL] = LABEL_INSN;
+ b[IFNONNULL] = LABEL_INSN;
+ b[GOTO_W] = LABELW_INSN; // GOTO_W
+ b[JSR_W] = LABELW_INSN; // JSR_W
+
+ b[BREAKPOINT] = LABEL_INSN; // todo: is this correct?
+
+ // LDC(_W) instructions
+ b[LDC] = LDC_INSN;
+ b[LDC_W] = LDCW_INSN; // LDC_W
+ b[LDC2_W] = LDCW_INSN; // LDC2_W
+
+ // special instructions
+ b[IINC] = IINC_INSN;
+ b[TABLESWITCH] = TABL_INSN;
+ b[LOOKUPSWITCH] = LOOK_INSN;
+ b[MULTIANEWARRAY] = MANA_INSN;
+ b[WIDE] = WIDE_INSN; // WIDE
+
+ // runtime-specific
+
+ b[LDC_QUICK] = LDC_INSN; // = 203;
+ b[LDC_W_QUICK] = LDCW_INSN; // = 204;
+ b[LDC2_W_QUICK] = LDCW_INSN; // = 205;
+ b[GETFIELD_QUICK] = FIELDORMETH_INSN; // = 206;
+ b[PUTFIELD_QUICK] = FIELDORMETH_INSN; // = 207;
+
+ b[GETFIELD2_QUICK] = FIELDORMETH_INSN; // = 208;
+ b[PUTFIELD2_QUICK] = FIELDORMETH_INSN; // = 209;
+ b[GETSTATIC_QUICK] = FIELDORMETH_INSN; // = 210;
+ b[PUTSTATIC_QUICK] = FIELDORMETH_INSN; // = 211;
+ b[GETSTATIC2_QUICK] = FIELDORMETH_INSN; // = 212;
+ b[PUTSTATIC2_QUICK] = FIELDORMETH_INSN; // = 213;
+ b[INVOKEVIRTUAL_QUICK] = FIELDORMETH_INSN; // = 214;
+ b[INVOKENONVIRTUAL_QUICK] = FIELDORMETH_INSN; // = 215;
+ b[INVOKESUPER_QUICK] = FIELDORMETH_INSN; // = 216;
+ b[INVOKESTATIC_QUICK] = FIELDORMETH_INSN; // = 217;
+ b[INVOKEINTERFACE_QUICK] = ITFMETH_INSN; // = 218;
+ b[INVOKEVIRTUALOBJECT_QUICK] = FIELDORMETH_INSN; // = 219;
+ b[220] = Bytecodes.NOARG_INSN; // the ID is not used for any opcode
+ b[NEW_QUICK] = TYPE_INSN; // = 221;
+ b[ANEWARRAY_QUICK] = TYPE_INSN; // = 222;
+ b[MULTIANEWARRAY_QUICK] = MANA_INSN; // = 223;
+ b[CHECKCAST_QUICK] = TYPE_INSN; // = 224;
+ b[INSTANCEOF_QUICK] = TYPE_INSN; // = 225;
+ b[INVOKEVIRTUAL_QUICK_W] = FIELDORMETH_INSN; // = 226;
+ b[GETFIELD_QUICK_W] = FIELDORMETH_INSN; // = 227;
+ b[PUTFIELD_QUICK_W] = FIELDORMETH_INSN; // = 228;
+
+
+ for (int i = 0; i < b.length; ++i) {
+ System.err.print((char)('A' + b[i]));
+ }
+ System.err.println();
+
+ }
+
}
diff --git a/java/debugger/impl/src/com/intellij/debugger/jdi/InstructionParser.java b/java/debugger/impl/src/com/intellij/debugger/jdi/InstructionParser.java
index b8053a891d42..78bf10fe7e40 100644
--- a/java/debugger/impl/src/com/intellij/debugger/jdi/InstructionParser.java
+++ b/java/debugger/impl/src/com/intellij/debugger/jdi/InstructionParser.java
@@ -38,7 +38,8 @@ public class InstructionParser {
break;
}
int opcode = myCode[v] & 0xFF;
- switch (Bytecodes.TYPE[opcode]) {
+ final byte opcodeType = opcode == Bytecodes.IMPDEP1 || opcode == Bytecodes.IMPDEP2? Bytecodes.NOARG_INSN : Bytecodes.TYPE[opcode];
+ switch (opcodeType) {
case Bytecodes.NOARG_INSN:
v += 1;
break;
diff --git a/java/debugger/impl/src/com/intellij/debugger/settings/DebuggerDataViewsConfigurable.java b/java/debugger/impl/src/com/intellij/debugger/settings/DebuggerDataViewsConfigurable.java
index db01e13836ef..452a924aed00 100644
--- a/java/debugger/impl/src/com/intellij/debugger/settings/DebuggerDataViewsConfigurable.java
+++ b/java/debugger/impl/src/com/intellij/debugger/settings/DebuggerDataViewsConfigurable.java
@@ -20,6 +20,7 @@ import com.intellij.debugger.impl.DebuggerUtilsEx;
import com.intellij.debugger.ui.JavaDebuggerSupport;
import com.intellij.debugger.ui.tree.render.ClassRenderer;
import com.intellij.debugger.ui.tree.render.ToStringRenderer;
+import com.intellij.openapi.options.OptionsBundle;
import com.intellij.openapi.options.SearchableConfigurable;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.registry.Registry;
@@ -45,7 +46,6 @@ public class DebuggerDataViewsConfigurable implements SearchableConfigurable {
private JCheckBox myCbAutoscroll;
private JCheckBox myCbShowSyntheticFields;
private StateRestoringCheckBox myCbShowValFieldsAsLocalVariables;
- private JCheckBox myCbSort;
private JCheckBox myCbHideNullArrayElements;
private JCheckBox myCbShowStatic;
private JCheckBox myCbShowDeclaredType;
@@ -54,15 +54,13 @@ public class DebuggerDataViewsConfigurable implements SearchableConfigurable {
private StateRestoringCheckBox myCbShowStaticFinalFields;
private final ArrayRendererConfigurable myArrayRendererConfigurable;
- private JCheckBox myCbEnableAutoExpressions;
private JCheckBox myCbEnableAlternateViews;
private JCheckBox myCbEnableToString;
private JRadioButton myRbAllThatOverride;
private JRadioButton myRbFromList;
private ClassFilterEditor myToStringFilterEditor;
- private JTextField myValueTooltipDelayField;
-
+
private Project myProject;
private RegistryCheckBox myAutoTooltip;
@@ -71,16 +69,19 @@ public class DebuggerDataViewsConfigurable implements SearchableConfigurable {
myArrayRendererConfigurable = new ArrayRendererConfigurable(NodeRendererSettings.getInstance().getArrayRenderer());
}
+ @Override
public void disposeUIResources() {
myArrayRendererConfigurable.disposeUIResources();
myToStringFilterEditor = null;
myProject = null;
}
+ @Override
public String getDisplayName() {
- return DebuggerBundle.message("base.renderer.configurable.display.name");
+ return OptionsBundle.message("options.java.display.name");
}
+ @Override
public JComponent createComponent() {
if (myProject == null) {
myProject = JavaDebuggerSupport.getContextProjectForEditorFieldsInDebuggerConfigurables();
@@ -90,13 +91,12 @@ public class DebuggerDataViewsConfigurable implements SearchableConfigurable {
myCbAutoscroll = new JCheckBox(DebuggerBundle.message("label.base.renderer.configurable.autoscroll"));
myCbShowSyntheticFields = new JCheckBox(DebuggerBundle.message("label.base.renderer.configurable.show.synthetic.fields"));
myCbShowValFieldsAsLocalVariables = new StateRestoringCheckBox(DebuggerBundle.message("label.base.renderer.configurable.show.val.fields.as.locals"));
- myCbSort = new JCheckBox(DebuggerBundle.message("label.base.renderer.configurable.sort.alphabetically"));
myCbHideNullArrayElements = new JCheckBox(DebuggerBundle.message("label.base.renderer.configurable.hide.null.array.elements"));
myCbShowStatic = new JCheckBox(DebuggerBundle.message("label.base.renderer.configurable.show.static.fields"));
myCbShowStaticFinalFields = new StateRestoringCheckBox(DebuggerBundle.message("label.base.renderer.configurable.show.static.final.fields"));
myCbEnableAlternateViews = new JCheckBox(DebuggerBundle.message("label.base.renderer.configurable.alternate.view"));
- myCbEnableAutoExpressions = new JCheckBox(DebuggerBundle.message("label.base.renderer.configurable.auto.expressions"));
myCbShowStatic.addChangeListener(new ChangeListener(){
+ @Override
public void stateChanged(ChangeEvent e) {
if(myCbShowStatic.isSelected()) {
myCbShowStaticFinalFields.makeSelectable();
@@ -121,14 +121,15 @@ public class DebuggerDataViewsConfigurable implements SearchableConfigurable {
myCbShowFQNames = new JCheckBox(DebuggerBundle.message("label.base.renderer.configurable.show.fq.names"));
myCbShowObjectId = new JCheckBox(DebuggerBundle.message("label.base.renderer.configurable.show.object.id"));
- myCbEnableToString = new JCheckBox(DebuggerBundle.message("label.base.renderer.configurable.enable.tostring"));
- myRbAllThatOverride = new JRadioButton(DebuggerBundle.message("label.base.renderer.configurable.all.overridding"));
+ myCbEnableToString = new JCheckBox(DebuggerBundle.message("label.base.renderer.configurable.enable.toString"));
+ myRbAllThatOverride = new JRadioButton(DebuggerBundle.message("label.base.renderer.configurable.all.overriding"));
myRbFromList = new JRadioButton(DebuggerBundle.message("label.base.renderer.configurable.classes.from.list"));
ButtonGroup group = new ButtonGroup();
group.add(myRbAllThatOverride);
group.add(myRbFromList);
myToStringFilterEditor = new ClassFilterEditor(myProject, null, "reference.viewBreakpoints.classFilters.newPattern");
myCbEnableToString.addItemListener(new ItemListener() {
+ @Override
public void itemStateChanged(ItemEvent e) {
final boolean enabled = myCbEnableToString.isSelected();
myRbAllThatOverride.setEnabled(enabled);
@@ -137,12 +138,12 @@ public class DebuggerDataViewsConfigurable implements SearchableConfigurable {
}
});
myRbFromList.addItemListener(new ItemListener() {
+ @Override
public void itemStateChanged(ItemEvent e) {
myToStringFilterEditor.setEnabled(myCbEnableToString.isSelected() && myRbFromList.isSelected());
}
});
- panel.add(myCbSort, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
panel.add(myCbAutoscroll, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(4, 0, 0, 0), 0, 0));
@@ -151,14 +152,6 @@ public class DebuggerDataViewsConfigurable implements SearchableConfigurable {
DebuggerBundle.message("label.base.renderer.configurable.autoTooltip.description",
Registry.stringValue("ide.forcedShowTooltip")));
panel.add(myAutoTooltip, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(4, 0, 0, 0), 0, 0));
-
- final JLabel tooltipLabel = new JLabel(DebuggerBundle.message("label.debugger.general.configurable.tooltips.delay"));
- panel.add(tooltipLabel, new GridBagConstraints(1, GridBagConstraints.RELATIVE, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(4, 0, 0, 0), 0, 0));
- myValueTooltipDelayField = new JTextField(10);
- myValueTooltipDelayField.setMinimumSize(new Dimension(50, myValueTooltipDelayField.getPreferredSize().height));
- panel.add(myValueTooltipDelayField, new GridBagConstraints(2, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(4, 0, 0, 0), 0, 0));
- tooltipLabel.setLabelFor(myValueTooltipDelayField);
-
final JPanel showPanel = new JPanel(new GridBagLayout());
showPanel.setBorder(IdeBorderFactory.createTitledBorder("Show", true));
@@ -174,12 +167,12 @@ public class DebuggerDataViewsConfigurable implements SearchableConfigurable {
final JPanel arraysPanel = new JPanel(new BorderLayout(0, UIUtil.DEFAULT_VGAP));
final JComponent arraysComponent = myArrayRendererConfigurable.createComponent();
+ assert arraysComponent != null;
arraysPanel.add(arraysComponent, BorderLayout.CENTER);
arraysPanel.add(myCbHideNullArrayElements, BorderLayout.SOUTH);
arraysPanel.setBorder(IdeBorderFactory.createTitledBorder("Arrays", true));
panel.add(arraysPanel, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 3, 1, 1.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
- panel.add(myCbEnableAutoExpressions, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 10), 0, 0));
panel.add(myCbEnableAlternateViews, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(4, 0, 0, 10), 0, 0));
// starting 4-th row
panel.add(myCbEnableToString, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 3, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(4, 0, 0, 0), 0, 0));
@@ -191,22 +184,16 @@ public class DebuggerDataViewsConfigurable implements SearchableConfigurable {
return panel;
}
+ @Override
public void apply() {
final ViewsGeneralSettings generalSettings = ViewsGeneralSettings.getInstance();
final NodeRendererSettings rendererSettings = NodeRendererSettings.getInstance();
- try {
- DebuggerSettings.getInstance().VALUE_LOOKUP_DELAY = Integer.parseInt(myValueTooltipDelayField.getText().trim());
- }
- catch (NumberFormatException ignored) {
- }
generalSettings.AUTOSCROLL_TO_NEW_LOCALS = myCbAutoscroll.isSelected();
rendererSettings.setAlternateCollectionViewsEnabled(myCbEnableAlternateViews.isSelected());
generalSettings.HIDE_NULL_ARRAY_ELEMENTS = myCbHideNullArrayElements.isSelected();
- generalSettings.ENABLE_AUTO_EXPRESSIONS = myCbEnableAutoExpressions.isSelected();
final ClassRenderer classRenderer = rendererSettings.getClassRenderer();
- classRenderer.SORT_ASCENDING = myCbSort.isSelected();
classRenderer.SHOW_STATIC = myCbShowStatic.isSelected();
classRenderer.SHOW_STATIC_FINAL = myCbShowStaticFinalFields.isSelectedWhenSelectable();
classRenderer.SHOW_SYNTHETICS = myCbShowSyntheticFields.isSelected();
@@ -227,15 +214,14 @@ public class DebuggerDataViewsConfigurable implements SearchableConfigurable {
rendererSettings.fireRenderersChanged();
}
+ @Override
public void reset() {
final ViewsGeneralSettings generalSettings = ViewsGeneralSettings.getInstance();
final NodeRendererSettings rendererSettings = NodeRendererSettings.getInstance();
- myValueTooltipDelayField.setText(Integer.toString(DebuggerSettings.getInstance().VALUE_LOOKUP_DELAY));
myCbAutoscroll.setSelected(generalSettings.AUTOSCROLL_TO_NEW_LOCALS);
myCbHideNullArrayElements.setSelected(generalSettings.HIDE_NULL_ARRAY_ELEMENTS);
myCbEnableAlternateViews.setSelected(rendererSettings.areAlternateCollectionViewsEnabled());
- myCbEnableAutoExpressions.setSelected(generalSettings.ENABLE_AUTO_EXPRESSIONS);
ClassRenderer classRenderer = rendererSettings.getClassRenderer();
@@ -244,7 +230,6 @@ public class DebuggerDataViewsConfigurable implements SearchableConfigurable {
if (!classRenderer.SHOW_SYNTHETICS) {
myCbShowValFieldsAsLocalVariables.makeUnselectable(false);
}
- myCbSort.setSelected(classRenderer.SORT_ASCENDING);
myCbShowStatic.setSelected(classRenderer.SHOW_STATIC);
myCbShowStaticFinalFields.setSelected(classRenderer.SHOW_STATIC_FINAL);
if(!classRenderer.SHOW_STATIC) {
@@ -268,36 +253,27 @@ public class DebuggerDataViewsConfigurable implements SearchableConfigurable {
myArrayRendererConfigurable.reset();
}
+ @Override
public boolean isModified() {
- return areGeneralSettingsModified() || areDefaultRenderersModified() || areDebuggerSettingsModified();
- }
-
- private boolean areDebuggerSettingsModified() {
- try {
- return DebuggerSettings.getInstance().VALUE_LOOKUP_DELAY != Integer.parseInt(myValueTooltipDelayField.getText().trim());
- }
- catch (NumberFormatException ignored) {
- }
- return false;
+ return areGeneralSettingsModified() || areDefaultRenderersModified();
}
private boolean areGeneralSettingsModified() {
ViewsGeneralSettings generalSettings = ViewsGeneralSettings.getInstance();
- return
- (generalSettings.AUTOSCROLL_TO_NEW_LOCALS != myCbAutoscroll.isSelected()) ||
- (generalSettings.ENABLE_AUTO_EXPRESSIONS != myCbEnableAutoExpressions.isSelected()) ||
- (generalSettings.HIDE_NULL_ARRAY_ELEMENTS != myCbHideNullArrayElements.isSelected()) || myAutoTooltip.isChanged();
+ return generalSettings.AUTOSCROLL_TO_NEW_LOCALS != myCbAutoscroll.isSelected() ||
+ generalSettings.HIDE_NULL_ARRAY_ELEMENTS != myCbHideNullArrayElements.isSelected() ||
+ myAutoTooltip.isChanged();
}
private boolean areDefaultRenderersModified() {
if (myArrayRendererConfigurable.isModified()) {
return true;
}
+
final NodeRendererSettings rendererSettings = NodeRendererSettings.getInstance();
final ClassRenderer classRenderer = rendererSettings.getClassRenderer();
final boolean isClassRendererModified=
- (classRenderer.SORT_ASCENDING != myCbSort.isSelected()) ||
(classRenderer.SHOW_STATIC != myCbShowStatic.isSelected()) ||
(classRenderer.SHOW_STATIC_FINAL != myCbShowStaticFinalFields.isSelectedWhenSelectable()) ||
(classRenderer.SHOW_SYNTHETICS != myCbShowSyntheticFields.isSelected()) ||
@@ -325,16 +301,20 @@ public class DebuggerDataViewsConfigurable implements SearchableConfigurable {
return false;
}
+ @SuppressWarnings("SpellCheckingInspection")
+ @Override
@NotNull
public String getHelpTopic() {
return "reference.idesettings.debugger.dataviews";
}
+ @Override
@NotNull
public String getId() {
return getHelpTopic();
}
+ @Override
public Runnable enableSearch(String option) {
return null;
}
diff --git a/java/debugger/impl/src/com/intellij/debugger/settings/DebuggerLaunchingConfigurable.java b/java/debugger/impl/src/com/intellij/debugger/settings/DebuggerLaunchingConfigurable.java
index f731c8943dec..490f99bb5461 100644
--- a/java/debugger/impl/src/com/intellij/debugger/settings/DebuggerLaunchingConfigurable.java
+++ b/java/debugger/impl/src/com/intellij/debugger/settings/DebuggerLaunchingConfigurable.java
@@ -17,23 +17,21 @@ package com.intellij.debugger.settings;
import com.intellij.debugger.DebuggerBundle;
import com.intellij.openapi.options.Configurable;
+import com.intellij.openapi.options.OptionsBundle;
import com.intellij.openapi.util.SystemInfo;
-import com.intellij.openapi.util.registry.Registry;
import com.intellij.ui.StateRestoringCheckBox;
import com.intellij.ui.components.panels.VerticalBox;
import javax.swing.*;
-import javax.swing.border.Border;
import java.awt.*;
-public class DebuggerLaunchingConfigurable implements Configurable{
+public class DebuggerLaunchingConfigurable implements Configurable {
private JRadioButton myRbSocket;
private JRadioButton myRbShmem;
- private JCheckBox myHideDebuggerCheckBox;
private StateRestoringCheckBox myCbForceClassicVM;
private JCheckBox myCbDisableJIT;
- private JCheckBox myFocusAppCheckBox;
+ @Override
public void reset() {
final DebuggerSettings settings = DebuggerSettings.getInstance();
if (!SystemInfo.isWindows) {
@@ -49,12 +47,11 @@ public class DebuggerLaunchingConfigurable implements Configurable{
}
myRbShmem.setEnabled(true);
}
- myHideDebuggerCheckBox.setSelected(settings.HIDE_DEBUGGER_ON_PROCESS_TERMINATION);
myCbForceClassicVM.setSelected(settings.FORCE_CLASSIC_VM);
myCbDisableJIT.setSelected(settings.DISABLE_JIT);
- myFocusAppCheckBox.setSelected(Registry.is("debugger.mayBringFrameToFrontOnBreakpoint"));
}
+ @Override
public void apply() {
getSettingsTo(DebuggerSettings.getInstance());
}
@@ -66,43 +63,34 @@ public class DebuggerLaunchingConfigurable implements Configurable{
else {
settings.DEBUGGER_TRANSPORT = DebuggerSettings.SOCKET_TRANSPORT;
}
- settings.HIDE_DEBUGGER_ON_PROCESS_TERMINATION = myHideDebuggerCheckBox.isSelected();
settings.FORCE_CLASSIC_VM = myCbForceClassicVM.isSelectedWhenSelectable();
settings.DISABLE_JIT = myCbDisableJIT.isSelected();
- Registry.get("debugger.mayBringFrameToFrontOnBreakpoint").setValue(myFocusAppCheckBox.isSelected());
}
+ @Override
public boolean isModified() {
final DebuggerSettings currentSettings = DebuggerSettings.getInstance();
final DebuggerSettings debuggerSettings = currentSettings.clone();
getSettingsTo(debuggerSettings);
- return !debuggerSettings.equals(currentSettings) || Registry.is("debugger.mayBringFrameToFrontOnBreakpoint") != myFocusAppCheckBox.isSelected();
+ return !debuggerSettings.equals(currentSettings);
}
+ @Override
public String getDisplayName() {
- return DebuggerBundle.message("debugger.launching.configurable.display.name");
+ return OptionsBundle.message("options.java.display.name");
}
+ @Override
public String getHelpTopic() {
return "reference.idesettings.debugger.launching";
}
+ @Override
public JComponent createComponent() {
myCbForceClassicVM = new StateRestoringCheckBox(DebuggerBundle.message("label.debugger.launching.configurable.force.classic.vm"));
myCbDisableJIT = new JCheckBox(DebuggerBundle.message("label.debugger.launching.configurable.disable.jit"));
- myHideDebuggerCheckBox = new JCheckBox(DebuggerBundle.message("label.debugger.launching.configurable.hide.window"));
myRbSocket = new JRadioButton(DebuggerBundle.message("label.debugger.launching.configurable.socket"));
myRbShmem = new JRadioButton(DebuggerBundle.message("label.debugger.launching.configurable.shmem"));
- myFocusAppCheckBox = new JCheckBox(DebuggerBundle.message("label.debugger.focusAppOnBreakpoint"));
-
- int cbLeftOffset = 0;
- final Border border = myCbForceClassicVM.getBorder();
- if (border != null) {
- final Insets insets = border.getBorderInsets(myCbForceClassicVM);
- if (insets != null) {
- cbLeftOffset = insets.left;
- }
- }
final ButtonGroup gr = new ButtonGroup();
gr.add(myRbSocket);
@@ -119,8 +107,6 @@ public class DebuggerLaunchingConfigurable implements Configurable{
panel.add(transportPanel);
panel.add(myCbForceClassicVM);
panel.add(myCbDisableJIT);
- panel.add(myHideDebuggerCheckBox);
- panel.add(myFocusAppCheckBox);
JPanel result = new JPanel(new BorderLayout());
result.add(panel, BorderLayout.NORTH);
@@ -129,7 +115,7 @@ public class DebuggerLaunchingConfigurable implements Configurable{
}
+ @Override
public void disposeUIResources() {
}
-
-}
+} \ No newline at end of file
diff --git a/java/debugger/impl/src/com/intellij/debugger/settings/DebuggerSettings.java b/java/debugger/impl/src/com/intellij/debugger/settings/DebuggerSettings.java
index e25c895858a5..bb3fafed746f 100644
--- a/java/debugger/impl/src/com/intellij/debugger/settings/DebuggerSettings.java
+++ b/java/debugger/impl/src/com/intellij/debugger/settings/DebuggerSettings.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -16,25 +16,31 @@
package com.intellij.debugger.settings;
import com.intellij.debugger.impl.DebuggerUtilsEx;
-import com.intellij.openapi.components.NamedComponent;
-import com.intellij.openapi.components.ServiceManager;
+import com.intellij.openapi.components.*;
import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.util.DefaultJDOMExternalizer;
import com.intellij.openapi.util.InvalidDataException;
-import com.intellij.openapi.util.JDOMExternalizable;
import com.intellij.openapi.util.WriteExternalException;
import com.intellij.ui.classFilter.ClassFilter;
+import com.intellij.util.containers.hash.LinkedHashMap;
+import com.intellij.util.xmlb.SkipDefaultValuesSerializationFilters;
+import com.intellij.util.xmlb.XmlSerializer;
+import com.intellij.util.xmlb.annotations.Transient;
import org.jdom.Element;
import org.jetbrains.annotations.NonNls;
-import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
-import java.util.ArrayList;
import java.util.HashMap;
-import java.util.List;
import java.util.Map;
-public class DebuggerSettings implements JDOMExternalizable, NamedComponent, Cloneable {
- private static final Logger LOG = Logger.getInstance("#com.intellij.debugger.settings.DebuggerSettings");
+@State(
+ name = "DebuggerSettings",
+ storages = {
+ @Storage(
+ file = StoragePathMacros.APP_CONFIG + "/other.xml"
+ )}
+)
+public class DebuggerSettings implements Cloneable, PersistentStateComponent<Element> {
+ private static final Logger LOG = Logger.getInstance(DebuggerSettings.class);
public static final int SOCKET_TRANSPORT = 0;
public static final int SHMEM_TRANSPORT = 1;
@@ -50,11 +56,9 @@ public class DebuggerSettings implements JDOMExternalizable, NamedComponent, Clo
@NonNls public static final String RUN_HOTSWAP_ASK = "RunHotswapAsk";
public boolean TRACING_FILTERS_ENABLED;
- public int VALUE_LOOKUP_DELAY; // ms
public int DEBUGGER_TRANSPORT;
public boolean FORCE_CLASSIC_VM;
public boolean DISABLE_JIT;
- public boolean HIDE_DEBUGGER_ON_PROCESS_TERMINATION;
public boolean HOTSWAP_IN_BACKGROUND = true;
public boolean SKIP_SYNTHETIC_METHODS;
public boolean SKIP_CONSTRUCTORS;
@@ -72,8 +76,10 @@ public class DebuggerSettings implements JDOMExternalizable, NamedComponent, Clo
private ClassFilter[] mySteppingFilters = ClassFilter.EMPTY_ARRAY;
- private Map<String, ContentState> myContentStates = new HashMap<String, ContentState>();
+ private Map<String, ContentState> myContentStates = new LinkedHashMap<String, ContentState>();
+ // transient - custom serialization
+ @Transient
public ClassFilter[] getSteppingFilters() {
final ClassFilter[] rv = new ClassFilter[mySteppingFilters.length];
for (int idx = 0; idx < rv.length; idx++) {
@@ -82,50 +88,51 @@ public class DebuggerSettings implements JDOMExternalizable, NamedComponent, Clo
return rv;
}
+ public static DebuggerSettings getInstance() {
+ return ServiceManager.getService(DebuggerSettings.class);
+ }
+
public void setSteppingFilters(ClassFilter[] steppingFilters) {
mySteppingFilters = steppingFilters != null ? steppingFilters : ClassFilter.EMPTY_ARRAY;
}
- @SuppressWarnings({"HardCodedStringLiteral"})
- public void readExternal(Element parentNode) throws InvalidDataException {
- DefaultJDOMExternalizer.readExternal(this, parentNode);
- List<ClassFilter> filtersList = new ArrayList<ClassFilter>();
-
- for (final Object o : parentNode.getChildren("filter")) {
- Element filter = (Element)o;
- filtersList.add(DebuggerUtilsEx.create(filter));
- }
- setSteppingFilters(filtersList.toArray(new ClassFilter[filtersList.size()]));
-
- filtersList.clear();
-
- final List contents = parentNode.getChildren("content");
- myContentStates.clear();
- for (Object content : contents) {
- final ContentState state = new ContentState((Element)content);
- myContentStates.put(state.getType(), state);
+ @Nullable
+ @Override
+ public Element getState() {
+ Element state = XmlSerializer.serialize(this, new SkipDefaultValuesSerializationFilters());
+ try {
+ DebuggerUtilsEx.writeFilters(state, "filter", mySteppingFilters);
}
- }
-
- @SuppressWarnings({"HardCodedStringLiteral"})
- public void writeExternal(Element parentNode) throws WriteExternalException {
- DefaultJDOMExternalizer.writeExternal(this, parentNode);
- for (ClassFilter mySteppingFilter : mySteppingFilters) {
- Element element = new Element("filter");
- parentNode.addContent(element);
- mySteppingFilter.writeExternal(element);
+ catch (WriteExternalException e) {
+ LOG.error(e);
+ return null;
}
for (ContentState eachState : myContentStates.values()) {
final Element content = new Element("content");
if (eachState.write(content)) {
- parentNode.addContent(content);
+ state.addContent(content);
}
}
+ return state;
}
- public static DebuggerSettings getInstance() {
- return ServiceManager.getService(DebuggerSettings.class);
+ @Override
+ public void loadState(Element state) {
+ XmlSerializer.deserializeInto(this, state);
+
+ try {
+ setSteppingFilters(DebuggerUtilsEx.readFilters(state.getChildren("filter")));
+ }
+ catch (InvalidDataException e) {
+ LOG.error(e);
+ }
+
+ myContentStates.clear();
+ for (Element content : state.getChildren("content")) {
+ ContentState contentState = new ContentState(content);
+ myContentStates.put(contentState.getType(), contentState);
+ }
}
public boolean equals(Object obj) {
@@ -134,11 +141,9 @@ public class DebuggerSettings implements JDOMExternalizable, NamedComponent, Clo
return
TRACING_FILTERS_ENABLED == secondSettings.TRACING_FILTERS_ENABLED &&
- VALUE_LOOKUP_DELAY == secondSettings.VALUE_LOOKUP_DELAY &&
DEBUGGER_TRANSPORT == secondSettings.DEBUGGER_TRANSPORT &&
FORCE_CLASSIC_VM == secondSettings.FORCE_CLASSIC_VM &&
DISABLE_JIT == secondSettings.DISABLE_JIT &&
- HIDE_DEBUGGER_ON_PROCESS_TERMINATION == secondSettings.HIDE_DEBUGGER_ON_PROCESS_TERMINATION &&
HOTSWAP_IN_BACKGROUND == secondSettings.HOTSWAP_IN_BACKGROUND &&
SKIP_SYNTHETIC_METHODS == secondSettings.SKIP_SYNTHETIC_METHODS &&
SKIP_CLASSLOADERS == secondSettings.SKIP_CLASSLOADERS &&
@@ -150,6 +155,7 @@ public class DebuggerSettings implements JDOMExternalizable, NamedComponent, Clo
DebuggerUtilsEx.filterEquals(mySteppingFilters, secondSettings.mySteppingFilters);
}
+ @Override
public DebuggerSettings clone() {
try {
final DebuggerSettings cloned = (DebuggerSettings)super.clone();
@@ -169,13 +175,7 @@ public class DebuggerSettings implements JDOMExternalizable, NamedComponent, Clo
return null;
}
- @NotNull
- public String getComponentName() {
- return "DebuggerSettings";
- }
-
public static class ContentState implements Cloneable {
-
private final String myType;
private boolean myMinimized;
private String mySelectedTab;
@@ -208,7 +208,7 @@ public class DebuggerSettings implements JDOMExternalizable, NamedComponent, Clo
if (mySelectedTab != null) {
element.setAttribute("selected", mySelectedTab);
}
- element.setAttribute("split", new Double(mySplitProportion).toString());
+ element.setAttribute("split", Double.toString(mySplitProportion));
element.setAttribute("detached", Boolean.valueOf(myDetached).toString());
element.setAttribute("horizontal", Boolean.valueOf(myHorizontalToolbar).toString());
return true;
@@ -266,6 +266,7 @@ public class DebuggerSettings implements JDOMExternalizable, NamedComponent, Clo
myHorizontalToolbar = horizontalToolbar;
}
+ @Override
public ContentState clone() throws CloneNotSupportedException {
return (ContentState)super.clone();
}
diff --git a/java/debugger/impl/src/com/intellij/debugger/settings/DebuggerSteppingConfigurable.java b/java/debugger/impl/src/com/intellij/debugger/settings/DebuggerSteppingConfigurable.java
index 75d9a81edc62..cec458ccbb70 100644
--- a/java/debugger/impl/src/com/intellij/debugger/settings/DebuggerSteppingConfigurable.java
+++ b/java/debugger/impl/src/com/intellij/debugger/settings/DebuggerSteppingConfigurable.java
@@ -18,6 +18,7 @@ package com.intellij.debugger.settings;
import com.intellij.debugger.DebuggerBundle;
import com.intellij.debugger.ui.JavaDebuggerSupport;
import com.intellij.openapi.options.Configurable;
+import com.intellij.openapi.options.OptionsBundle;
import com.intellij.openapi.options.SearchableConfigurable;
import com.intellij.openapi.project.Project;
import com.intellij.ui.classFilter.ClassFilterEditor;
@@ -37,6 +38,7 @@ public class DebuggerSteppingConfigurable implements SearchableConfigurable, Con
private JCheckBox myCbSkipSimpleGetters;
private Project myProject;
+ @Override
public void reset() {
final DebuggerSettings settings = DebuggerSettings.getInstance();
myCbSkipSimpleGetters.setSelected(settings.SKIP_GETTERS);
@@ -52,6 +54,7 @@ public class DebuggerSteppingConfigurable implements SearchableConfigurable, Con
}
+ @Override
public void apply() {
getSettingsTo(DebuggerSettings.getInstance());
}
@@ -67,6 +70,7 @@ public class DebuggerSteppingConfigurable implements SearchableConfigurable, Con
settings.setSteppingFilters(mySteppingFilterEditor.getFilters());
}
+ @Override
public boolean isModified() {
final DebuggerSettings currentSettings = DebuggerSettings.getInstance();
final DebuggerSettings debuggerSettings = currentSettings.clone();
@@ -74,30 +78,35 @@ public class DebuggerSteppingConfigurable implements SearchableConfigurable, Con
return !debuggerSettings.equals(currentSettings);
}
+ @Override
public String getDisplayName() {
- return DebuggerBundle.message("debugger.stepping.configurable.display.name");
+ return OptionsBundle.message("options.java.display.name");
}
+ @Override
@NotNull
public String getHelpTopic() {
return "reference.idesettings.debugger.stepping";
}
+ @Override
@NotNull
public String getId() {
return getHelpTopic();
}
+ @Override
public Runnable enableSearch(String option) {
return null;
}
+ @Override
public JComponent createComponent() {
final JPanel panel = new JPanel(new GridBagLayout());
myProject = JavaDebuggerSupport.getContextProjectForEditorFieldsInDebuggerConfigurables();
myCbSkipSyntheticMethods = new JCheckBox(DebuggerBundle.message("label.debugger.general.configurable.skip.synthetic.methods"));
myCbSkipConstructors = new JCheckBox(DebuggerBundle.message("label.debugger.general.configurable.skip.constructors"));
- myCbSkipClassLoaders = new JCheckBox(DebuggerBundle.message("label.debugger.general.configurable.skip.classloaders"));
+ myCbSkipClassLoaders = new JCheckBox(DebuggerBundle.message("label.debugger.general.configurable.skip.classLoaders"));
myCbSkipSimpleGetters = new JCheckBox(DebuggerBundle.message("label.debugger.general.configurable.skip.simple.getters"));
myCbStepInfoFiltersEnabled = new JCheckBox(DebuggerBundle.message("label.debugger.general.configurable.step.filters.list.header"));
panel.add(myCbSkipSyntheticMethods, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0),0, 0));
@@ -110,6 +119,7 @@ public class DebuggerSteppingConfigurable implements SearchableConfigurable, Con
panel.add(mySteppingFilterEditor, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 5, 0, 0),0, 0));
myCbStepInfoFiltersEnabled.addActionListener(new ActionListener() {
+ @Override
public void actionPerformed(ActionEvent e) {
mySteppingFilterEditor.setEnabled(myCbStepInfoFiltersEnabled.isSelected());
}
@@ -117,6 +127,7 @@ public class DebuggerSteppingConfigurable implements SearchableConfigurable, Con
return panel;
}
+ @Override
public void disposeUIResources() {
mySteppingFilterEditor = null;
myProject = null;
diff --git a/java/debugger/impl/src/com/intellij/debugger/settings/JavaDebuggerSettings.java b/java/debugger/impl/src/com/intellij/debugger/settings/JavaDebuggerSettings.java
new file mode 100644
index 000000000000..7151cb9f650e
--- /dev/null
+++ b/java/debugger/impl/src/com/intellij/debugger/settings/JavaDebuggerSettings.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.debugger.settings;
+
+import com.intellij.openapi.options.Configurable;
+import com.intellij.xdebugger.settings.XDebuggerSettings;
+import org.jdom.Element;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * We cannot now transform DebuggerSettings to XDebuggerSettings: getState/loadState is not called for EP,
+ * but we cannot use standard implementation to save our state, due to backward compatibility we must use own state spec.
+ *
+ * But we must implement createConfigurable as part of XDebuggerSettings otherwise java general settings will be before xdebugger general setting,
+ * because JavaDebuggerSettingsPanelProvider has higher priority than XDebuggerSettingsPanelProviderImpl.
+ */
+class JavaDebuggerSettings extends XDebuggerSettings<Element> {
+ protected JavaDebuggerSettings() {
+ super("java");
+ }
+
+ @Nullable
+ @Override
+ public Configurable createConfigurable(@NotNull Category category) {
+ switch (category) {
+ case ROOT:
+ return new DebuggerLaunchingConfigurable();
+ case DATA_VIEWS:
+ return new DebuggerDataViewsConfigurable(null);
+ case STEPPING:
+ return new DebuggerSteppingConfigurable();
+ }
+ return null;
+ }
+
+ @Override
+ public void generalApplied(@NotNull XDebuggerSettings.Category category) {
+ if (category == XDebuggerSettings.Category.DATA_VIEWS) {
+ NodeRendererSettings.getInstance().fireRenderersChanged();
+ }
+ }
+
+ @Nullable
+ @Override
+ public Element getState() {
+ return null;
+ }
+
+ @Override
+ public void loadState(Element state) {
+ }
+} \ No newline at end of file
diff --git a/java/debugger/impl/src/com/intellij/debugger/settings/ViewsGeneralSettings.java b/java/debugger/impl/src/com/intellij/debugger/settings/ViewsGeneralSettings.java
index 8518e8258519..9555ce6c34dc 100644
--- a/java/debugger/impl/src/com/intellij/debugger/settings/ViewsGeneralSettings.java
+++ b/java/debugger/impl/src/com/intellij/debugger/settings/ViewsGeneralSettings.java
@@ -32,7 +32,6 @@ public class ViewsGeneralSettings implements PersistentStateComponent<Element> {
public boolean SHOW_OBJECTID = true;
public boolean HIDE_NULL_ARRAY_ELEMENTS = true;
public boolean AUTOSCROLL_TO_NEW_LOCALS = true;
- public boolean ENABLE_AUTO_EXPRESSIONS = true;
public ViewsGeneralSettings() {
}
@@ -41,22 +40,22 @@ public class ViewsGeneralSettings implements PersistentStateComponent<Element> {
return ServiceManager.getService(ViewsGeneralSettings.class);
}
+ @Override
public void loadState(Element element) {
try {
DefaultJDOMExternalizer.readExternal(this, element);
}
- catch (InvalidDataException e) {
- // ignore
+ catch (InvalidDataException ignored) {
}
}
+ @Override
public Element getState() {
Element element = new Element("ViewsGeneralSettings");
try {
DefaultJDOMExternalizer.writeExternal(this, element);
}
- catch (WriteExternalException e) {
- // ignore
+ catch (WriteExternalException ignored) {
}
return element;
}
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/DebuggerSessionTab.java b/java/debugger/impl/src/com/intellij/debugger/ui/DebuggerSessionTab.java
index 7b4b22ee19be..600efd834e56 100644
--- a/java/debugger/impl/src/com/intellij/debugger/ui/DebuggerSessionTab.java
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/DebuggerSessionTab.java
@@ -61,6 +61,7 @@ import com.intellij.unscramble.ThreadDumpPanel;
import com.intellij.unscramble.ThreadState;
import com.intellij.xdebugger.XDebuggerBundle;
import com.intellij.xdebugger.impl.actions.XDebuggerActions;
+import com.intellij.xdebugger.impl.settings.XDebuggerSettingsManager;
import com.intellij.xdebugger.impl.ui.DebuggerSessionTabBase;
import com.intellij.xdebugger.impl.ui.XDebuggerUIConstants;
import org.jetbrains.annotations.NotNull;
@@ -105,7 +106,7 @@ public class DebuggerSessionTab extends DebuggerSessionTabBase implements Dispos
case DebuggerSession.EVENT_DETACHED:
myUi.updateActionsNow();
- if (debuggerSettings.HIDE_DEBUGGER_ON_PROCESS_TERMINATION) {
+ if (XDebuggerSettingsManager.getInstanceImpl().getGeneralSettings().isHideDebuggerOnProcessTermination()) {
try {
ExecutionManager.getInstance(getProject()).getContentManager().hideRunContent(DefaultDebugExecutor.getDebugExecutorInstance(), myRunContentDescriptor);
}
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/JavaDebuggerSupport.java b/java/debugger/impl/src/com/intellij/debugger/ui/JavaDebuggerSupport.java
index 630fa30339d2..27f63e032314 100644
--- a/java/debugger/impl/src/com/intellij/debugger/ui/JavaDebuggerSupport.java
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/JavaDebuggerSupport.java
@@ -18,7 +18,9 @@ package com.intellij.debugger.ui;
import com.intellij.debugger.DebuggerManagerEx;
import com.intellij.debugger.actions.*;
import com.intellij.debugger.impl.DebuggerContextImpl;
-import com.intellij.debugger.settings.*;
+import com.intellij.debugger.settings.DebuggerHotswapConfigurable;
+import com.intellij.debugger.settings.NodeRendererSettings;
+import com.intellij.debugger.settings.UserRenderersConfigurable;
import com.intellij.debugger.ui.breakpoints.Breakpoint;
import com.intellij.ide.DataManager;
import com.intellij.openapi.Disposable;
@@ -333,22 +335,16 @@ public class JavaDebuggerSupport extends DebuggerSupport {
//}
}
- public static class JavaDebuggerSettingsPanelProvider extends DebuggerSettingsPanelProvider {
+ final static class JavaDebuggerSettingsPanelProvider extends DebuggerSettingsPanelProvider {
@Override
public int getPriority() {
return 1;
}
- @Override
- public Configurable getRootConfigurable() {
- return new DebuggerLaunchingConfigurable();
- }
-
+ @NotNull
@Override
public Collection<? extends Configurable> getConfigurables() {
final ArrayList<Configurable> configurables = new ArrayList<Configurable>();
- configurables.add(new DebuggerDataViewsConfigurable(null));
- configurables.add(new DebuggerSteppingConfigurable());
configurables.add(new UserRenderersConfigurable(null));
configurables.add(new DebuggerHotswapConfigurable());
return configurables;
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointWithHighlighter.java b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointWithHighlighter.java
index 1087338ab8d5..d6cbf1487ab9 100644
--- a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointWithHighlighter.java
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointWithHighlighter.java
@@ -177,7 +177,12 @@ public abstract class BreakpointWithHighlighter<P extends JavaBreakpointProperti
protected BreakpointWithHighlighter(@NotNull Project project, XBreakpoint xBreakpoint) {
//for persistency
super(project, xBreakpoint);
- reload();
+ ApplicationManager.getApplication().runReadAction(new Runnable() {
+ @Override
+ public void run() {
+ reload();
+ }
+ });
}
@Override
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/JavaExceptionBreakpointType.java b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/JavaExceptionBreakpointType.java
index 3bbea653a8a9..638e6a018c96 100644
--- a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/JavaExceptionBreakpointType.java
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/JavaExceptionBreakpointType.java
@@ -59,6 +59,18 @@ public class JavaExceptionBreakpointType extends JavaBreakpointTypeBase<JavaExce
return AllIcons.Debugger.Db_disabled_exception_breakpoint;
}
+ @NotNull
+ @Override
+ public Icon getMutedEnabledIcon() {
+ return AllIcons.Debugger.Db_muted_exception_breakpoint;
+ }
+
+ @NotNull
+ @Override
+ public Icon getMutedDisabledIcon() {
+ return AllIcons.Debugger.Db_muted_disabled_exception_breakpoint;
+ }
+
//@Override
protected String getHelpID() {
return HelpID.EXCEPTION_BREAKPOINTS;
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/JavaFieldBreakpointType.java b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/JavaFieldBreakpointType.java
index 0b1ba90ecbd6..f34898b7f615 100644
--- a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/JavaFieldBreakpointType.java
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/JavaFieldBreakpointType.java
@@ -63,6 +63,18 @@ public class JavaFieldBreakpointType extends JavaLineBreakpointTypeBase<JavaFiel
return AllIcons.Debugger.Db_disabled_field_breakpoint;
}
+ @NotNull
+ @Override
+ public Icon getMutedEnabledIcon() {
+ return AllIcons.Debugger.Db_muted_field_breakpoint;
+ }
+
+ @NotNull
+ @Override
+ public Icon getMutedDisabledIcon() {
+ return AllIcons.Debugger.Db_muted_disabled_field_breakpoint;
+ }
+
//@Override
protected String getHelpID() {
return HelpID.FIELD_WATCHPOINTS;
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/JavaLineBreakpointType.java b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/JavaLineBreakpointType.java
index 70d0f009e76c..a3c442fb410b 100644
--- a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/JavaLineBreakpointType.java
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/JavaLineBreakpointType.java
@@ -41,18 +41,6 @@ public class JavaLineBreakpointType extends JavaLineBreakpointTypeBase<JavaBreak
super("java-line", DebuggerBundle.message("line.breakpoints.tab.title"));
}
- @NotNull
- @Override
- public Icon getEnabledIcon() {
- return AllIcons.Debugger.Db_set_breakpoint;
- }
-
- @NotNull
- @Override
- public Icon getDisabledIcon() {
- return AllIcons.Debugger.Db_disabled_breakpoint;
- }
-
//@Override
protected String getHelpID() {
return HelpID.LINE_BREAKPOINTS;
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/JavaMethodBreakpointType.java b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/JavaMethodBreakpointType.java
index 2ec27499e9a3..4d7d51295fd6 100644
--- a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/JavaMethodBreakpointType.java
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/JavaMethodBreakpointType.java
@@ -51,6 +51,18 @@ public class JavaMethodBreakpointType extends JavaLineBreakpointTypeBase<JavaMet
return AllIcons.Debugger.Db_disabled_method_breakpoint;
}
+ @NotNull
+ @Override
+ public Icon getMutedEnabledIcon() {
+ return AllIcons.Debugger.Db_muted_method_breakpoint;
+ }
+
+ @NotNull
+ @Override
+ public Icon getMutedDisabledIcon() {
+ return AllIcons.Debugger.Db_muted_disabled_method_breakpoint;
+ }
+
//@Override
protected String getHelpID() {
return HelpID.METHOD_BREAKPOINTS;
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/JavaWildcardMethodBreakpointType.java b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/JavaWildcardMethodBreakpointType.java
index 8fea87b40db2..83da4a9f7027 100644
--- a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/JavaWildcardMethodBreakpointType.java
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/JavaWildcardMethodBreakpointType.java
@@ -50,6 +50,18 @@ public class JavaWildcardMethodBreakpointType extends JavaBreakpointTypeBase<Jav
return AllIcons.Debugger.Db_disabled_method_breakpoint;
}
+ @NotNull
+ @Override
+ public Icon getMutedEnabledIcon() {
+ return AllIcons.Debugger.Db_muted_method_breakpoint;
+ }
+
+ @NotNull
+ @Override
+ public Icon getMutedDisabledIcon() {
+ return AllIcons.Debugger.Db_muted_disabled_method_breakpoint;
+ }
+
//@Override
protected String getHelpID() {
return HelpID.METHOD_BREAKPOINTS;
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/impl/FrameVariablesTree.java b/java/debugger/impl/src/com/intellij/debugger/ui/impl/FrameVariablesTree.java
index 8cb6828d26e8..5d32e714ab89 100644
--- a/java/debugger/impl/src/com/intellij/debugger/ui/impl/FrameVariablesTree.java
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/impl/FrameVariablesTree.java
@@ -53,6 +53,7 @@ import com.intellij.util.text.CharArrayUtil;
import com.intellij.util.ui.tree.TreeModelAdapter;
import com.intellij.xdebugger.XDebuggerBundle;
import com.intellij.xdebugger.frame.XStackFrame;
+import com.intellij.xdebugger.settings.XDebuggerSettingsManager;
import com.sun.jdi.*;
import gnu.trove.TIntObjectHashMap;
import gnu.trove.TObjectProcedure;
@@ -157,7 +158,7 @@ public class FrameVariablesTree extends DebuggerTree {
}
try {
- if (!ViewsGeneralSettings.getInstance().ENABLE_AUTO_EXPRESSIONS && !myAutoWatchMode) {
+ if (!XDebuggerSettingsManager.getInstance().getDataViewSettings().isAutoExpressions() && !myAutoWatchMode) {
// optimization
super.buildVariables(stackDescriptor, evaluationContext);
}
@@ -273,7 +274,7 @@ public class FrameVariablesTree extends DebuggerTree {
}
catch (UnsupportedOperationException ignored) {
}
- catch (InternalException e) {
+ catch (Exception e) {
LOG.info(e);
}
return Collections.emptyList();
@@ -569,7 +570,7 @@ public class FrameVariablesTree extends DebuggerTree {
myVars = vars;
myPosition = position;
myEvalContext = evalContext;
- myCollectExpressions = ViewsGeneralSettings.getInstance().ENABLE_AUTO_EXPRESSIONS;
+ myCollectExpressions = XDebuggerSettingsManager.getInstance().getDataViewSettings().isAutoExpressions();
}
@Override
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/impl/TipManager.java b/java/debugger/impl/src/com/intellij/debugger/ui/impl/TipManager.java
index fce05d1f23db..df91efed9579 100644
--- a/java/debugger/impl/src/com/intellij/debugger/ui/impl/TipManager.java
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/impl/TipManager.java
@@ -15,7 +15,6 @@
*/
package com.intellij.debugger.ui.impl;
-import com.intellij.debugger.settings.DebuggerSettings;
import com.intellij.ide.FrameStateListener;
import com.intellij.ide.FrameStateManager;
import com.intellij.openapi.Disposable;
@@ -32,6 +31,7 @@ import com.intellij.util.Alarm;
import com.intellij.util.ui.UIUtil;
import com.intellij.util.ui.update.Activatable;
import com.intellij.util.ui.update.UiNotifyConnector;
+import com.intellij.xdebugger.settings.XDebuggerSettingsManager;
import javax.swing.*;
import javax.swing.event.PopupMenuEvent;
@@ -117,14 +117,17 @@ public class TipManager implements Disposable, PopupMenuListener {
return menu;
}
+ @Override
public void popupMenuWillBecomeVisible(final PopupMenuEvent e) {
myPopupShown = true;
}
+ @Override
public void popupMenuWillBecomeInvisible(final PopupMenuEvent e) {
onPopupClosed(e);
}
+ @Override
public void popupMenuCanceled(final PopupMenuEvent e) {
onPopupClosed(e);
}
@@ -174,12 +177,13 @@ public class TipManager implements Disposable, PopupMenuListener {
myShowAlarm.cancelAllRequests();
myHideAlarm.cancelAllRequests();
myShowAlarm.addRequest(new Runnable() {
+ @Override
public void run() {
if (!myIsDisposed && !myPopupShown) {
showTooltip(e, auto);
}
}
- }, auto ? DebuggerSettings.getInstance().VALUE_LOOKUP_DELAY : 10);
+ }, auto ? XDebuggerSettingsManager.getInstance().getDataViewSettings().getValueLookupDelay() : 10);
}
private void showTooltip(InputEvent e, boolean auto) {
@@ -245,6 +249,7 @@ public class TipManager implements Disposable, PopupMenuListener {
myCurrentTooltip = null;
} else {
myHideAlarm.addRequest(new Runnable() {
+ @Override
public void run() {
if (myInsideComponent) {
hideTooltip(true);
@@ -273,10 +278,12 @@ public class TipManager implements Disposable, PopupMenuListener {
myComponent = component;
new UiNotifyConnector.Once(component, new Activatable() {
+ @Override
public void showNotify() {
installListeners();
}
+ @Override
public void hideNotify() {
}
});
@@ -284,6 +291,7 @@ public class TipManager implements Disposable, PopupMenuListener {
final HideTooltipAction hide = new HideTooltipAction();
hide.registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0)), myComponent);
Disposer.register(this, new Disposable() {
+ @Override
public void dispose() {
hide.unregisterCustomShortcutSet(myComponent);
}
@@ -292,6 +300,7 @@ public class TipManager implements Disposable, PopupMenuListener {
private class HideTooltipAction extends AnAction {
+ @Override
public void actionPerformed(AnActionEvent e) {
hideTooltip(true);
}
@@ -316,6 +325,7 @@ public class TipManager implements Disposable, PopupMenuListener {
FrameStateManager.getInstance().addListener(myFrameStateListener);
}
+ @Override
public void dispose() {
Disposer.dispose(this);
@@ -333,6 +343,7 @@ public class TipManager implements Disposable, PopupMenuListener {
private class MyAwtPreprocessor implements AWTEventListener {
+ @Override
public void eventDispatched(AWTEvent event) {
if (event.getID() == MouseEvent.MOUSE_MOVED) {
preventFromHideIfInsideTooltip(event);
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/DebuggerTree.java b/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/DebuggerTree.java
index 52d557535917..d333eaaacd10 100644
--- a/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/DebuggerTree.java
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/DebuggerTree.java
@@ -55,6 +55,7 @@ import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.ui.SpeedSearchComparator;
import com.intellij.ui.TreeSpeedSearch;
+import com.intellij.xdebugger.settings.XDebuggerSettingsManager;
import com.sun.jdi.*;
import com.sun.jdi.event.Event;
import com.sun.jdi.event.ExceptionEvent;
@@ -485,7 +486,7 @@ public abstract class DebuggerTree extends DebuggerTreeBase implements DataProvi
try {
buildVariables(stackDescriptor, evaluationContext);
- if (classRenderer.SORT_ASCENDING) {
+ if (XDebuggerSettingsManager.getInstance().getDataViewSettings().isSortValues()) {
Collections.sort(myChildren, NodeManagerImpl.getNodeComparator());
}
}
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/tree/render/BatchEvaluator.java b/java/debugger/impl/src/com/intellij/debugger/ui/tree/render/BatchEvaluator.java
index abf937e5a793..59749a2b001a 100644
--- a/java/debugger/impl/src/com/intellij/debugger/ui/tree/render/BatchEvaluator.java
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/tree/render/BatchEvaluator.java
@@ -27,6 +27,7 @@ import com.intellij.debugger.engine.jdi.ThreadReferenceProxy;
import com.intellij.debugger.engine.managerThread.SuspendContextCommand;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.Key;
+import com.intellij.openapi.util.registry.Registry;
import com.intellij.rt.debugger.BatchEvaluatorServer;
import com.intellij.util.containers.HashMap;
import com.sun.jdi.*;
@@ -120,7 +121,7 @@ public class BatchEvaluator {
final EvaluationContext evaluationContext = command.getEvaluationContext();
final SuspendContext suspendContext = evaluationContext.getSuspendContext();
- if(!hasBatchEvaluator(evaluationContext)) {
+ if(!Registry.is("debugger.batch.evaluation") || !hasBatchEvaluator(evaluationContext)) {
myDebugProcess.getManagerThread().invokeCommand(command);
}
else {
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/tree/render/ClassRenderer.java b/java/debugger/impl/src/com/intellij/debugger/ui/tree/render/ClassRenderer.java
index bd14ef55b054..7fe89bb42299 100644
--- a/java/debugger/impl/src/com/intellij/debugger/ui/tree/render/ClassRenderer.java
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/tree/render/ClassRenderer.java
@@ -38,6 +38,7 @@ import com.intellij.psi.PsiElementFactory;
import com.intellij.psi.PsiExpression;
import com.intellij.util.IncorrectOperationException;
import com.intellij.util.StringBuilderSpinAllocator;
+import com.intellij.xdebugger.settings.XDebuggerSettingsManager;
import com.sun.jdi.*;
import org.jdom.Element;
import org.jetbrains.annotations.NonNls;
@@ -58,7 +59,6 @@ public class ClassRenderer extends NodeRendererImpl{
public static final @NonNls String UNIQUE_ID = "ClassRenderer";
- public boolean SORT_ASCENDING = false;
public boolean SHOW_SYNTHETICS = true;
public boolean SHOW_VAL_FIELDS_AS_LOCAL_VARIABLES = true;
public boolean SHOW_STATIC = false;
@@ -83,22 +83,27 @@ public class ClassRenderer extends NodeRendererImpl{
return typeName;
}
+ @Override
public String getUniqueId() {
return UNIQUE_ID;
}
+ @Override
public boolean isEnabled() {
return myProperties.isEnabled();
}
+ @Override
public void setEnabled(boolean enabled) {
myProperties.setEnabled(enabled);
}
+ @Override
public ClassRenderer clone() {
return (ClassRenderer) super.clone();
}
+ @Override
public String calcLabel(ValueDescriptor descriptor, EvaluationContext evaluationContext, DescriptorLabelListener labelListener) throws EvaluateException {
return calcLabel(descriptor);
}
@@ -151,6 +156,7 @@ public class ClassRenderer extends NodeRendererImpl{
}
}
+ @Override
public void buildChildren(final Value value, final ChildrenBuilder builder, final EvaluationContext evaluationContext) {
DebuggerManagerThreadImpl.assertIsManagerThread();
final ValueDescriptorImpl parentDescriptor = (ValueDescriptorImpl)builder.getParentDescriptor();
@@ -171,7 +177,7 @@ public class ClassRenderer extends NodeRendererImpl{
children.add(nodeManager.createNode(nodeDescriptorFactory.getFieldDescriptor(parentDescriptor, objRef, field), evaluationContext));
}
- if(SORT_ASCENDING) {
+ if (XDebuggerSettingsManager.getInstance().getDataViewSettings().isSortValues()) {
Collections.sort(children, NodeManagerImpl.getNodeComparator());
}
}
@@ -211,16 +217,19 @@ public class ClassRenderer extends NodeRendererImpl{
return true;
}
+ @Override
public void readExternal(Element element) throws InvalidDataException {
super.readExternal(element);
DefaultJDOMExternalizer.readExternal(this, element);
}
+ @Override
public void writeExternal(Element element) throws WriteExternalException {
super.writeExternal(element);
DefaultJDOMExternalizer.writeExternal(this, element);
}
+ @Override
public PsiExpression getChildValueExpression(DebuggerTreeNode node, DebuggerContext context) throws EvaluateException {
FieldDescriptor fieldDescriptor = (FieldDescriptor)node.getDescriptor();
@@ -251,19 +260,23 @@ public class ClassRenderer extends NodeRendererImpl{
return false;
}
+ @Override
public boolean isExpandable(Value value, EvaluationContext evaluationContext, NodeDescriptor parentDescriptor) {
DebuggerManagerThreadImpl.assertIsManagerThread();
return valueExpandable(value);
}
+ @Override
public boolean isApplicable(Type type) {
return type instanceof ReferenceType && !(type instanceof ArrayType);
}
+ @Override
public @NonNls String getName() {
return "Object";
}
+ @Override
public void setName(String text) {
LOG.assertTrue(false);
}
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/tree/render/ToStringRenderer.java b/java/debugger/impl/src/com/intellij/debugger/ui/tree/render/ToStringRenderer.java
index fd77aa900a7c..4016289147a7 100644
--- a/java/debugger/impl/src/com/intellij/debugger/ui/tree/render/ToStringRenderer.java
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/tree/render/ToStringRenderer.java
@@ -36,7 +36,7 @@ import com.sun.jdi.*;
import org.jdom.Element;
import org.jetbrains.annotations.NonNls;
-import java.util.Iterator;
+import java.util.List;
import static com.intellij.psi.CommonClassNames.JAVA_LANG_STRING;
@@ -126,14 +126,10 @@ public class ToStringRenderer extends NodeRendererImpl {
@SuppressWarnings({"HardCodedStringLiteral"})
private static boolean overridesToString(Type type) {
if(type instanceof ClassType) {
- final ClassType classType = (ClassType)type;
- final java.util.List methods = classType.methodsByName("toString", "()Ljava/lang/String;");
- if (methods.size() > 0) {
- for (Iterator iterator = methods.iterator(); iterator.hasNext();) {
- final Method method = (Method)iterator.next();
- if(!(method.declaringType().name()).equals(CommonClassNames.JAVA_LANG_OBJECT)){
- return true;
- }
+ final List<Method> methods = ((ClassType)type).methodsByName("toString", "()Ljava/lang/String;");
+ for (Method method : methods) {
+ if (!(method.declaringType().name()).equals(CommonClassNames.JAVA_LANG_OBJECT)) {
+ return true;
}
}
}
@@ -182,7 +178,7 @@ public class ToStringRenderer extends NodeRendererImpl {
private boolean isFiltered(Type t) {
if (t instanceof ReferenceType) {
for (ClassFilter classFilter : myClassFilters) {
- if (classFilter.isEnabled() && DebuggerUtilsEx.getSuperType(t, classFilter.getPattern()) != null) {
+ if (classFilter.isEnabled() && DebuggerUtils.getSuperType(t, classFilter.getPattern()) != null) {
return true;
}
}
diff --git a/java/debugger/impl/src/org/jetbrains/java/debugger/breakpoints/properties/JavaBreakpointProperties.java b/java/debugger/impl/src/org/jetbrains/java/debugger/breakpoints/properties/JavaBreakpointProperties.java
index 599aed3dd0dd..be8833afd55b 100644
--- a/java/debugger/impl/src/org/jetbrains/java/debugger/breakpoints/properties/JavaBreakpointProperties.java
+++ b/java/debugger/impl/src/org/jetbrains/java/debugger/breakpoints/properties/JavaBreakpointProperties.java
@@ -45,7 +45,7 @@ public class JavaBreakpointProperties<T extends JavaBreakpointProperties> extend
}
public boolean setInstanceFilters(InstanceFilter[] instanceFilters) {
- boolean changed = !Comparing.equal(myInstanceFilters, instanceFilters);
+ boolean changed = !filtersEqual(myInstanceFilters, instanceFilters);
myInstanceFilters = instanceFilters;
return changed;
}
@@ -64,11 +64,18 @@ public class JavaBreakpointProperties<T extends JavaBreakpointProperties> extend
}
public final boolean setClassFilters(ClassFilter[] classFilters) {
- boolean changed = !Comparing.equal(myClassFilters, classFilters);
+ boolean changed = !filtersEqual(myClassFilters, classFilters);
myClassFilters = classFilters;
return changed;
}
+ private static boolean filtersEqual(Object[] a, Object[] b) {
+ if ((a == null || a.length == 0) && (b == null || b.length == 0)) {
+ return true;
+ }
+ return Comparing.equal(a, b);
+ }
+
@Tag("class-exclusion-filters")
@AbstractCollection(surroundWithTag = false)
public ClassFilter[] getClassExclusionFilters() {
@@ -76,7 +83,7 @@ public class JavaBreakpointProperties<T extends JavaBreakpointProperties> extend
}
public boolean setClassExclusionFilters(ClassFilter[] classExclusionFilters) {
- boolean changed = !Comparing.equal(myClassExclusionFilters, classExclusionFilters);
+ boolean changed = !filtersEqual(myClassExclusionFilters, classExclusionFilters);
myClassExclusionFilters = classExclusionFilters;
return changed;
}
diff --git a/java/execution/impl/src/com/intellij/execution/application/ApplicationConfigurable.java b/java/execution/impl/src/com/intellij/execution/application/ApplicationConfigurable.java
index b72a8883636f..04af179638cd 100644
--- a/java/execution/impl/src/com/intellij/execution/application/ApplicationConfigurable.java
+++ b/java/execution/impl/src/com/intellij/execution/application/ApplicationConfigurable.java
@@ -16,6 +16,7 @@
package com.intellij.execution.application;
import com.intellij.execution.ExecutionBundle;
+import com.intellij.execution.JavaExecutionUtil;
import com.intellij.execution.configurations.ConfigurationUtil;
import com.intellij.execution.ui.AlternativeJREPanel;
import com.intellij.execution.ui.ClassBrowser;
@@ -71,7 +72,9 @@ public class ApplicationConfigurable extends SettingsEditor<ApplicationConfigura
public void applyEditorTo(final ApplicationConfiguration configuration) throws ConfigurationException {
myCommonProgramParameters.applyTo(configuration);
myModuleSelector.applyTo(configuration);
- configuration.MAIN_CLASS_NAME = getMainClassField().getText();
+ final String className = getMainClassField().getText();
+ final PsiClass aClass = myModuleSelector.findClass(className);
+ configuration.MAIN_CLASS_NAME = aClass != null ? JavaExecutionUtil.getRuntimeQualifiedName(aClass) : className;
configuration.ALTERNATIVE_JRE_PATH = myAlternativeJREPanel.getPath();
configuration.ALTERNATIVE_JRE_PATH_ENABLED = myAlternativeJREPanel.isPathEnabled();
configuration.ENABLE_SWING_INSPECTOR = (myVersionDetector.isJre50Configured(configuration) || myVersionDetector.isModuleJre50Configured(configuration)) && myShowSwingInspectorCheckbox.isSelected();
@@ -82,7 +85,7 @@ public class ApplicationConfigurable extends SettingsEditor<ApplicationConfigura
public void resetEditorFrom(final ApplicationConfiguration configuration) {
myCommonProgramParameters.reset(configuration);
myModuleSelector.reset(configuration);
- getMainClassField().setText(configuration.MAIN_CLASS_NAME);
+ getMainClassField().setText(configuration.MAIN_CLASS_NAME.replaceAll("\\$", "\\."));
myAlternativeJREPanel.init(configuration.ALTERNATIVE_JRE_PATH, configuration.ALTERNATIVE_JRE_PATH_ENABLED);
updateShowSwingInspector(configuration);
@@ -121,7 +124,7 @@ public class ApplicationConfigurable extends SettingsEditor<ApplicationConfigura
public Visibility isDeclarationVisible(PsiElement declaration, PsiElement place) {
if (declaration instanceof PsiClass) {
final PsiClass aClass = (PsiClass)declaration;
- if (ConfigurationUtil.MAIN_CLASS.value(aClass) && PsiMethodUtil.findMainMethod(aClass) != null) {
+ if (ConfigurationUtil.MAIN_CLASS.value(aClass) && PsiMethodUtil.findMainMethod(aClass) != null || place.getParent() != null && myModuleSelector.findClass(((PsiClass)declaration).getQualifiedName()) != null) {
return Visibility.VISIBLE;
}
}
diff --git a/java/execution/impl/src/com/intellij/execution/remote/RemoteConfiguration.java b/java/execution/impl/src/com/intellij/execution/remote/RemoteConfiguration.java
index 4f503f3f7270..57c84c9fa929 100644
--- a/java/execution/impl/src/com/intellij/execution/remote/RemoteConfiguration.java
+++ b/java/execution/impl/src/com/intellij/execution/remote/RemoteConfiguration.java
@@ -77,10 +77,13 @@ public class RemoteConfiguration extends ModuleBasedConfiguration<JavaRunConfigu
@Override
public RunProfileState getState(@NotNull final Executor executor, @NotNull final ExecutionEnvironment env) throws ExecutionException {
- GenericDebuggerRunnerSettings debuggerSettings = (GenericDebuggerRunnerSettings)env.getRunnerSettings();
- debuggerSettings.LOCAL = false;
- debuggerSettings.setDebugPort(USE_SOCKET_TRANSPORT ? PORT : SHMEM_ADDRESS);
- debuggerSettings.setTransport(USE_SOCKET_TRANSPORT ? DebuggerSettings.SOCKET_TRANSPORT : DebuggerSettings.SHMEM_TRANSPORT);
+ final GenericDebuggerRunnerSettings debuggerSettings = (GenericDebuggerRunnerSettings)env.getRunnerSettings();
+ if (debuggerSettings != null) {
+ // sync self state with execution environment's state if available
+ debuggerSettings.LOCAL = false;
+ debuggerSettings.setDebugPort(USE_SOCKET_TRANSPORT ? PORT : SHMEM_ADDRESS);
+ debuggerSettings.setTransport(USE_SOCKET_TRANSPORT ? DebuggerSettings.SOCKET_TRANSPORT : DebuggerSettings.SHMEM_TRANSPORT);
+ }
return new RemoteStateState(getProject(), createRemoteConnection());
}
diff --git a/java/idea-ui/src/com/intellij/ide/actions/ShowStructureSettingsAction.java b/java/idea-ui/src/com/intellij/ide/actions/ShowStructureSettingsAction.java
index e3570c2c0fe5..ded07d482ed3 100644
--- a/java/idea-ui/src/com/intellij/ide/actions/ShowStructureSettingsAction.java
+++ b/java/idea-ui/src/com/intellij/ide/actions/ShowStructureSettingsAction.java
@@ -27,6 +27,7 @@ import com.intellij.openapi.project.ProjectManager;
import com.intellij.openapi.roots.ui.configuration.ProjectStructureConfigurable;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.ui.Gray;
+import com.intellij.ui.JBColor;
import com.intellij.ui.border.CustomLineBorder;
import org.jetbrains.annotations.Nullable;
@@ -55,7 +56,7 @@ public class ShowStructureSettingsAction extends AnAction implements DumbAware {
protected JComponent createSouthPanel() {
JComponent panel = super.createSouthPanel();
assert panel != null;
- CustomLineBorder line = new CustomLineBorder(Gray._153, 1, 0, 0, 0);
+ CustomLineBorder line = new CustomLineBorder(new JBColor(Gray._153, Gray._80), 1, 0, 0, 0);
panel.setBorder(new CompoundBorder(line, new EmptyBorder(10, 5, 5, 5)));
return panel;
}
diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/ErrorPaneConfigurable.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/ErrorPaneConfigurable.java
new file mode 100644
index 000000000000..77ccbe6cbdff
--- /dev/null
+++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/ErrorPaneConfigurable.java
@@ -0,0 +1,217 @@
+/*
+ * Copyright 2000-2014 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.openapi.roots.ui.configuration;
+
+import com.intellij.openapi.Disposable;
+import com.intellij.openapi.options.Configurable;
+import com.intellij.openapi.options.ConfigurationException;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.roots.ui.configuration.projectRoot.StructureConfigurableContext;
+import com.intellij.openapi.util.Disposer;
+import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.ui.*;
+import com.intellij.ui.awt.RelativePoint;
+import com.intellij.util.Alarm;
+import com.intellij.util.ui.UIUtil;
+import org.jetbrains.annotations.Nls;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import javax.swing.*;
+import javax.swing.event.HyperlinkEvent;
+import javax.swing.text.Element;
+import java.awt.*;
+import java.awt.event.MouseEvent;
+import java.net.URL;
+import java.util.ArrayList;
+
+/**
+ * @author Konstantin Bulenkov
+ */
+public class ErrorPaneConfigurable extends JPanel implements Configurable, Disposable, ConfigurationErrors {
+ private final Alarm myAlarm;
+ private final ArrayList<ConfigurationError> myErrors = new ArrayList<ConfigurationError>();
+ private final JTextPane myContent = new JTextPane();
+ private Runnable myOnErrorsChanged;
+
+ public ErrorPaneConfigurable(final Project project, StructureConfigurableContext context, Runnable onErrorsChanged) {
+ super(new BorderLayout());
+ myOnErrorsChanged = onErrorsChanged;
+ myContent.setEditorKit(UIUtil.getHTMLEditorKit());
+ myContent.setEditable(false);
+ myContent.setBackground(UIUtil.getListBackground());
+ final JScrollPane pane = ScrollPaneFactory.createScrollPane(myContent, true);
+ pane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
+ add(pane);
+ myAlarm = new Alarm(this);
+ project.getMessageBus().connect(this).subscribe(ConfigurationErrors.TOPIC, this);
+ myContent.addHyperlinkListener(new HyperlinkAdapter() {
+ @Override
+ public void hyperlinkActivated(HyperlinkEvent e) {
+ final URL url = e.getURL();
+ final AWTEvent awtEvent = EventQueue.getCurrentEvent();
+ if (!(awtEvent instanceof MouseEvent)) {
+ return;
+ }
+ final MouseEvent me = (MouseEvent)awtEvent;
+
+ if (url != null) {
+ ConfigurationError error = null;
+ Element element = e.getSourceElement();
+ while (element != null) {
+ if ("li".equals(element.getName())) {
+ final Element ol = element.getParentElement();
+ for (int i = 0; i < ol.getElementCount(); i++) {
+ if (ol.getElement(i) == element) {
+ error = myErrors.get(i);
+ }
+ }
+ break;
+ }
+ element = element.getParentElement();
+ }
+ if (error == null) return;
+ final String host = url.getHost();
+ String path = url.getPath();
+ if (path != null && path.startsWith("/")) {
+ path = StringUtil.unescapeXml(path.substring(1));
+ }
+ if (path != null) {
+ if ("fix".equals(host)) {
+ final MouseEvent mouseEvent = new MouseEvent(me.getComponent(), me.getID(), me.getWhen(), me.getModifiers(),
+ me.getX() - 15, me.getY() + 10, me.getClickCount(), me.isPopupTrigger());
+ error.fix(myContent, new RelativePoint(mouseEvent));
+ } else {
+ error.navigate();
+ }
+ }
+ }
+ }
+ });
+
+ refresh();
+ }
+
+ public void refresh() {
+ myAlarm.cancelAllRequests();
+ myAlarm.addRequest(new Runnable() {
+ @Override
+ public void run() {
+ String html = "<html>" +
+ "<header><style type='text/css'>" +
+ "body {" +
+ " color: #" + ColorUtil.toHex(new JBColor(Gray.x33, UIUtil.getLabelForeground())) + ";" +
+ " font-family: '" + UIUtil.getLabelFont().getName() + ",serif';" +
+ " font-size: " + UIUtil.getLabelFont().getSize() + ";" +
+ "}" +
+ "li {" +
+ " margin-bottom: 5;" +
+ "}" +
+ "ol {" +
+ "}" +
+ "a {" +
+ " text-decoration: none;" +
+ "}" +
+ "</style>" +
+ "</header>" +
+ "<body>";
+ int i = 0;
+ html += "<ol>";
+ for (ConfigurationError error : myErrors) {
+ i++;
+ String description = error.getDescription();
+ if (description.startsWith("<html>") && description.endsWith("</html>")) {
+ description = description.substring(6, description.length() - 7);
+ }
+ if (description.startsWith("Module '")) {
+ final int start = 8;
+ final int end = description.indexOf("'", 9);
+ final String moduleName = description.substring(start, end);
+ description = "Module <a href='http://module/" + StringUtil.escapeXml(moduleName) + "'>" + StringUtil.escapeXml(moduleName) + "</a> " + description.substring(
+ end + 1);
+ }
+ if (error.canBeFixed()) {
+ description += " <a href='http://fix/" + i + "'>[Fix]</a>";
+ }
+ html+= "<li>" + description + "</li>";
+ }
+ html += "</ol></body></html>";
+ myContent.setText(html);
+ if (myOnErrorsChanged != null) {
+ myOnErrorsChanged.run();
+ }
+ }
+ }, 100);
+ }
+
+ @Nls
+ @Override
+ public String getDisplayName() {
+ return "Problems";
+ }
+
+ @Nullable
+ @Override
+ public String getHelpTopic() {
+ return null;
+ }
+
+ @Nullable
+ @Override
+ public JComponent createComponent() {
+ return this;
+ }
+
+ @Override
+ public boolean isModified() {
+ return false;
+ }
+
+ @Override
+ public void apply() throws ConfigurationException {
+
+ }
+
+ @Override
+ public void reset() {
+
+ }
+
+ @Override
+ public void disposeUIResources() {
+ Disposer.dispose(this);
+ }
+
+ @Override
+ public void dispose() {
+ }
+
+ @Override
+ public void addError(@NotNull ConfigurationError error) {
+ myErrors.add(error);
+ refresh();
+ }
+
+ @Override
+ public void removeError(@NotNull ConfigurationError error) {
+ myErrors.remove(error);
+ refresh();
+ }
+
+ public int getErrorsCount() {
+ return myErrors.size();
+ }
+}
diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/ProjectStructureConfigurable.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/ProjectStructureConfigurable.java
index d007c3650642..bf083f92c66c 100644
--- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/ProjectStructureConfigurable.java
+++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/ProjectStructureConfigurable.java
@@ -43,7 +43,6 @@ import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.openapi.wm.ex.IdeFocusTraversalPolicy;
import com.intellij.packaging.artifacts.Artifact;
-import com.intellij.ui.Gray;
import com.intellij.ui.JBSplitter;
import com.intellij.ui.components.panels.Wrapper;
import com.intellij.ui.navigation.BackAction;
@@ -179,11 +178,7 @@ public class ProjectStructureConfigurable extends BaseConfigurable implements Se
mySplitter.setSplitterProportionKey("ProjectStructure.TopLevelElements");
mySplitter.setHonorComponentsMinimumSize(true);
if (Registry.is("ide.new.project.settings")) {
- mySplitter.setDividerWidth(1);
- mySplitter.setShowDividerIcon(false);
- mySplitter.getDivider().setBackground(Gray._153.withAlpha(128));
- mySplitter.setShowDividerControls(false);
- mySplitter.setOrientation(mySplitter.getOrientation());
+ mySplitter.setOnePixelMode();
}
initSidePanel();
@@ -203,7 +198,7 @@ public class ProjectStructureConfigurable extends BaseConfigurable implements Se
toolbar.setTargetComponent(myComponent);
myToolbarComponent = toolbar.getComponent();
if (Registry.is("ide.new.project.settings")) {
- left.setBackground(new Color(0xD2D6DD));
+ left.setBackground(UIUtil.getSidePanelColor());
} else {
left.add(myToolbarComponent, BorderLayout.NORTH);
}
@@ -214,7 +209,9 @@ public class ProjectStructureConfigurable extends BaseConfigurable implements Se
myComponent.add(mySplitter, BorderLayout.CENTER);
myErrorsComponent = new ConfigurationErrorsComponent(myProject);
- myComponent.add(myErrorsComponent, BorderLayout.SOUTH);
+ if (!Registry.is("ide.new.project.settings")) {
+ myComponent.add(myErrorsComponent, BorderLayout.SOUTH);
+ }
myUiInitialized = true;
@@ -253,6 +250,11 @@ public class ProjectStructureConfigurable extends BaseConfigurable implements Se
addConfigurable(configurable, true);
}
}
+
+ if (Registry.is("ide.new.project.settings")) {
+ mySidePanel.addSeparator("--");
+ addErrorPane();
+ }
}
private void addArtifactsConfig() {
@@ -299,6 +301,15 @@ public class ProjectStructureConfigurable extends BaseConfigurable implements Se
addConfigurable(myProjectLibrariesConfig, ConfigurableId.PROJECT_LIBRARIES);
}
+ private void addErrorPane() {
+ addConfigurable(new ErrorPaneConfigurable(myProject, myContext, new Runnable() {
+ @Override
+ public void run() {
+ mySidePanel.getList().repaint();
+ }
+ }), true);
+ }
+
private void addGlobalLibrariesConfig() {
addConfigurable(myGlobalLibrariesConfig, ConfigurableId.GLOBAL_LIBRARIES);
}
diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/SidePanel.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/SidePanel.java
index a2d1e4e0489d..290f35e561b5 100644
--- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/SidePanel.java
+++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/SidePanel.java
@@ -16,17 +16,23 @@
package com.intellij.openapi.roots.ui.configuration;
import com.intellij.openapi.actionSystem.Presentation;
+import com.intellij.openapi.ui.GraphicsConfig;
import com.intellij.openapi.ui.popup.ListItemDescriptor;
import com.intellij.openapi.util.registry.Registry;
-import com.intellij.ui.ScrollPaneFactory;
+import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.ui.*;
import com.intellij.ui.components.JBList;
+import com.intellij.ui.components.panels.NonOpaquePanel;
import com.intellij.ui.navigation.History;
import com.intellij.ui.navigation.Place;
import com.intellij.ui.popup.list.GroupedItemsListRenderer;
import com.intellij.util.ui.EmptyIcon;
+import com.intellij.util.ui.GraphicsUtil;
+import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
+import javax.swing.border.Border;
import javax.swing.border.EmptyBorder;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
@@ -36,6 +42,9 @@ import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
+import static javax.swing.SwingConstants.CENTER;
+import static javax.swing.SwingConstants.LEFT;
+
public class SidePanel extends JPanel {
private final JList myList;
@@ -56,7 +65,7 @@ public class SidePanel extends JPanel {
myModel = new DefaultListModel();
myList = new JBList(myModel);
if (Registry.is("ide.new.project.settings")) {
- myList.setBackground(new Color(0xD2D6DD));
+ myList.setBackground(UIUtil.getSidePanelColor());
myList.setBorder(new EmptyBorder(5, 0, 0, 0));
}
final ListItemDescriptor descriptor = new ListItemDescriptor() {
@@ -84,18 +93,100 @@ public class SidePanel extends JPanel {
@Override
public String getCaptionAboveOf(final Object value) {
- String text = myIndex2Separator.get(myPlaces.indexOf(value));
- return text != null && Registry.is("ide.new.project.settings") ? text.toUpperCase() : text;
+ return myIndex2Separator.get(myPlaces.indexOf(value));
}
};
myList.setCellRenderer(new GroupedItemsListRenderer(descriptor) {
+ JPanel myExtraPanel;
+ CountLabel myCountLabel;
{
mySeparatorComponent.setCaptionCentered(false);
}
+
+ @Override
+ protected Color getForeground() {
+ return Registry.is("ide.new.project.settings") ? new JBColor(Gray._60, Gray._140) : super.getForeground();
+ }
+
+ @Override
+ protected SeparatorWithText createSeparator() {
+ return new SeparatorWithText() {
+ @Override
+ protected void paintComponent(Graphics g) {
+ if (Registry.is("ide.new.project.settings")) {
+ g.setColor(new JBColor(POPUP_SEPARATOR_FOREGROUND, Gray._80));
+ if ("--".equals(getCaption())) {
+ g.drawLine(0, getHeight()/ 2, getWidth(), getHeight() /2);
+ return;
+ }
+ Rectangle viewR = new Rectangle(0, getVgap(), getWidth() - 1, getHeight() - getVgap() - 1);
+ Rectangle iconR = new Rectangle();
+ Rectangle textR = new Rectangle();
+ String s = SwingUtilities
+ .layoutCompoundLabel(g.getFontMetrics(), getCaption(), null, CENTER,
+ LEFT,
+ CENTER,
+ LEFT,
+ viewR, iconR, textR, 0);
+ GraphicsUtil.setupAAPainting(g);
+ g.setColor(new JBColor(Gray._255.withAlpha(80), Gray._0.withAlpha(80)));
+ g.drawString(s, textR.x + 10, textR.y + 1 + g.getFontMetrics().getAscent());
+ g.setColor(new JBColor(new Color(0x5F6D7B), Gray._120));
+ g.drawString(s, textR.x + 10, textR.y + g.getFontMetrics().getAscent());
+ }
+ else {
+ super.paintComponent(g);
+ }
+ }
+ };
+ }
+
+ @Override
+ protected void layout() {
+ if (Registry.is("ide.new.project.settings")) {
+ myRendererComponent.add(mySeparatorComponent, BorderLayout.NORTH);
+ myExtraPanel.add(myComponent, BorderLayout.CENTER);
+ myExtraPanel.add(myCountLabel, BorderLayout.EAST);
+ myRendererComponent.add(myExtraPanel, BorderLayout.CENTER);
+ } else {
+ super.layout();
+ }
+ }
+
+ @Override
+ public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
+ myCountLabel.setText("");
+ final Component component = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
+ if ("Problems".equals(descriptor.getTextFor(value))) {
+ final ErrorPaneConfigurable errorPane = (ErrorPaneConfigurable)((Place)value).getPath("category");
+ if (errorPane != null && errorPane.getErrorsCount() > 0) {
+ myCountLabel.setSelected(isSelected);
+ myCountLabel.setText(String.valueOf(errorPane.getErrorsCount()));
+ }
+ }
+ return component;
+ }
+
+ @Override
+ protected JComponent createItemComponent() {
+ myExtraPanel = new NonOpaquePanel(new BorderLayout());
+ myCountLabel = new CountLabel();
+
+
+ if (Registry.is("ide.new.project.settings")) {
+ myTextLabel = new EngravedLabel();
+ myTextLabel.setFont(myTextLabel.getFont().deriveFont(Font.BOLD));
+ myTextLabel.setForeground(Gray._240);
+ myTextLabel.setOpaque(true);
+ return layoutComponent(myTextLabel);
+ }
+ return super.createItemComponent();
+ }
+
@Override
protected Color getBackground() {
- return Registry.is("ide.new.project.settings") ? new Color(0xD2D6DD) : super.getBackground();
+ return Registry.is("ide.new.project.settings") ? UIUtil.getSidePanelColor() : super.getBackground();
}
});
@@ -114,6 +205,10 @@ public class SidePanel extends JPanel {
});
}
+ public JList getList() {
+ return myList;
+ }
+
public void addPlace(Place place, @NotNull Presentation presentation) {
myModel.addElement(place);
myPlaces.add(place);
@@ -133,4 +228,51 @@ public class SidePanel extends JPanel {
public void select(final Place place) {
myList.setSelectedValue(place, true);
}
+
+ private static class CountLabel extends JLabel {
+ private boolean mySelected;
+
+ public CountLabel() {
+ super();
+ setBorder(new Border() {
+ @Override
+ public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
+ }
+
+ @Override
+ public Insets getBorderInsets(Component c) {
+ return StringUtil.isEmpty(getText()) ? new Insets(0,0,0,0) : new Insets(2, 6, 2, 6 + 6);
+ }
+
+ @Override
+ public boolean isBorderOpaque() {
+ return false;
+ }
+ });
+ setFont(UIUtil.getListFont().deriveFont(Font.BOLD));
+ }
+
+ public boolean isSelected() {
+ return mySelected;
+ }
+
+ public void setSelected(boolean selected) {
+ mySelected = selected;
+ }
+
+ @Override
+ protected void paintComponent(Graphics g) {
+ g.setColor(isSelected() ? UIUtil.getListSelectionBackground() : UIUtil.getSidePanelColor());
+ g.fillRect(0, 0, getWidth(), getHeight());
+ if (StringUtil.isEmpty(getText())) return;
+ final JBColor deepBlue = new JBColor(new Color(0x97A4B2), new Color(92, 98, 113));
+ g.setColor(isSelected() ? Gray._255.withAlpha(UIUtil.isUnderDarcula() ? 100 : 220) : deepBlue);
+ final GraphicsConfig config = GraphicsUtil.setupAAPainting(g);
+ g.fillRoundRect(0, 3, getWidth() - 6 -1, getHeight()-6 , (getHeight() - 6), (getHeight() - 6));
+ config.restore();
+ setForeground(isSelected() ? deepBlue.darker() : UIUtil.getListForeground(true));
+
+ super.paintComponent(g);
+ }
+ }
}
diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/daemon/LibraryProjectStructureElement.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/daemon/LibraryProjectStructureElement.java
index 1fc3dbd66162..7af12e978190 100644
--- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/daemon/LibraryProjectStructureElement.java
+++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/daemon/LibraryProjectStructureElement.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2012 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -34,6 +34,7 @@ import com.intellij.openapi.roots.ui.configuration.projectRoot.LibraryConfigurab
import com.intellij.openapi.roots.ui.configuration.projectRoot.StructureConfigurableContext;
import com.intellij.openapi.ui.NamedConfigurable;
import com.intellij.openapi.util.ActionCallback;
+import com.intellij.openapi.util.registry.Registry;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.util.PathUtil;
import com.intellij.xml.util.XmlStringUtil;
@@ -95,7 +96,14 @@ public class LibraryProjectStructureElement extends ProjectStructureElement {
private static String createInvalidRootsDescription(List<String> invalidClasses, String rootName, String libraryName) {
StringBuilder buffer = new StringBuilder();
- buffer.append("Library '").append(StringUtil.escapeXml(libraryName)).append("' has broken " + rootName + " " + StringUtil.pluralize("path", invalidClasses.size()) + ":");
+ final String name = StringUtil.escapeXml(libraryName);
+ buffer.append("Library ");
+ if (Registry.is("ide.new.project.settings")) {
+ buffer.append("<a href='http://library/").append(name).append("'>").append(name).append("</a>");
+ } else {
+ buffer.append("'").append(name).append("'");
+ }
+ buffer.append(" has broken " + rootName + " " + StringUtil.pluralize("path", invalidClasses.size()) + ":");
for (String url : invalidClasses) {
buffer.append("<br>&nbsp;&nbsp;");
buffer.append(PathUtil.toPresentableUrl(url));
@@ -150,7 +158,10 @@ public class LibraryProjectStructureElement extends ProjectStructureElement {
@Override
public ProjectStructureProblemDescription createUnusedElementWarning() {
final List<ConfigurationErrorQuickFix> fixes = Arrays.asList(new AddLibraryToDependenciesFix(), new RemoveLibraryFix(), new RemoveAllUnusedLibrariesFix());
- return new ProjectStructureProblemDescription("Library '" + StringUtil.escapeXml(myLibrary.getName()) + "'" + " is not used", null, createPlace(),
+ final String name = StringUtil.escapeXml(myLibrary.getName());
+ String libraryName = Registry.is("ide.new.project.settings") ? "<a href='http://library/" + name + "'>" + name + "</a>"
+ : "'" + name + "'";
+ return new ProjectStructureProblemDescription("Library " + libraryName + " is not used", null, createPlace(),
ProjectStructureProblemType.unused("unused-library"), ProjectStructureProblemDescription.ProblemLevel.PROJECT,
fixes, false);
}
diff --git a/java/idea-ui/src/com/intellij/platform/templates/SaveProjectAsTemplateAction.java b/java/idea-ui/src/com/intellij/platform/templates/SaveProjectAsTemplateAction.java
index c2fafe029658..328eda553ac1 100644
--- a/java/idea-ui/src/com/intellij/platform/templates/SaveProjectAsTemplateAction.java
+++ b/java/idea-ui/src/com/intellij/platform/templates/SaveProjectAsTemplateAction.java
@@ -40,7 +40,6 @@ import com.intellij.openapi.roots.ModuleRootManager;
import com.intellij.openapi.roots.ProjectRootManager;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.util.JDOMUtil;
-import com.intellij.openapi.util.ThrowableComputable;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.StreamUtil;
import com.intellij.openapi.vfs.VfsUtil;
@@ -177,12 +176,7 @@ public class SaveProjectAsTemplateAction extends AnAction {
@Override
public InputStream getContent(final File file) throws IOException {
if (virtualFile.getFileType().isBinary() || PROJECT_TEMPLATE_XML.equals(virtualFile.getName())) return STANDARD.getContent(file);
- String result = ApplicationManager.getApplication().runReadAction(new ThrowableComputable<String, IOException>() {
- @Override
- public String compute() throws IOException {
- return getEncodedContent(virtualFile, project, parameters);
- }
- });
+ String result = getEncodedContent(virtualFile, project, parameters);
return new ByteArrayInputStream(result.getBytes(TemplateModuleBuilder.UTF_8));
}
});
@@ -253,10 +247,10 @@ public class SaveProjectAsTemplateAction extends AnAction {
public static String getEncodedContent(VirtualFile virtualFile,
Project project,
Map<String, String> parameters) throws IOException {
+ String text = VfsUtilCore.loadText(virtualFile);
final FileTemplate template = FileTemplateManager.getInstance().getDefaultTemplate(FileTemplateManager.FILE_HEADER_TEMPLATE_NAME);
final String templateText = template.getText();
final Pattern pattern = FileHeaderChecker.getTemplatePattern(template, project, new TIntObjectHashMap<String>());
- String text = VfsUtilCore.loadText(virtualFile);
String result = convertTemplates(text, pattern, templateText);
result = ProjectTemplateFileProcessor.encodeFile(result, virtualFile, project);
for (Map.Entry<String, String> entry : parameters.entrySet()) {
diff --git a/java/java-analysis-impl/java-analysis-impl.iml b/java/java-analysis-impl/java-analysis-impl.iml
index c3f33d642544..95c129baadfb 100644
--- a/java/java-analysis-impl/java-analysis-impl.iml
+++ b/java/java-analysis-impl/java-analysis-impl.iml
@@ -17,6 +17,7 @@
<orderEntry type="module" module-name="java-analysis-api" exported="" />
<orderEntry type="module" module-name="resources-en" />
<orderEntry type="module" module-name="xml-psi-impl" />
+ <orderEntry type="library" exported="" name="asm5" level="project" />
</component>
</module>
diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/InferredAnnotationsManagerImpl.java b/java/java-analysis-impl/src/com/intellij/codeInsight/InferredAnnotationsManagerImpl.java
new file mode 100644
index 000000000000..813ff25caee2
--- /dev/null
+++ b/java/java-analysis-impl/src/com/intellij/codeInsight/InferredAnnotationsManagerImpl.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2000-2014 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;
+
+import com.intellij.codeInspection.bytecodeAnalysis.ProjectBytecodeAnalysis;
+import com.intellij.codeInspection.dataFlow.ContractInference;
+import com.intellij.codeInspection.dataFlow.MethodContract;
+import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.psi.PsiAnnotation;
+import com.intellij.psi.PsiMethod;
+import com.intellij.psi.PsiModifierListOwner;
+import com.intellij.psi.util.PsiUtil;
+import com.intellij.util.containers.ContainerUtil;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.List;
+
+import static com.intellij.codeInspection.dataFlow.ControlFlowAnalyzer.ORG_JETBRAINS_ANNOTATIONS_CONTRACT;
+
+public class InferredAnnotationsManagerImpl extends InferredAnnotationsManager {
+ @Nullable
+ @Override
+ public PsiAnnotation findInferredAnnotation(@NotNull PsiModifierListOwner listOwner, @NotNull String annotationFQN) {
+ PsiAnnotation fromBytecode = ProjectBytecodeAnalysis.getInstance(listOwner.getProject()).findInferredAnnotation(listOwner, annotationFQN);
+ if (fromBytecode != null) {
+ return fromBytecode;
+ }
+
+ if (ORG_JETBRAINS_ANNOTATIONS_CONTRACT.equals(annotationFQN) && canHaveContract(listOwner)) {
+ List<MethodContract> contracts = ContractInference.inferContracts((PsiMethod)listOwner);
+ if (!contracts.isEmpty()) {
+ return ProjectBytecodeAnalysis.getInstance(listOwner.getProject()).createContractAnnotation("\"" + StringUtil.join(contracts, "; ") + "\"");
+ }
+ }
+
+ return null;
+ }
+
+ private static boolean canHaveContract(PsiModifierListOwner listOwner) {
+ return listOwner instanceof PsiMethod && !PsiUtil.canBeOverriden((PsiMethod)listOwner);
+ }
+
+ @NotNull
+ @Override
+ public PsiAnnotation[] findInferredAnnotations(@NotNull PsiModifierListOwner listOwner) {
+ List<PsiAnnotation> result = ContainerUtil.newArrayList();
+ PsiAnnotation[] fromBytecode = ProjectBytecodeAnalysis.getInstance(listOwner.getProject()).findInferredAnnotations(listOwner);
+ for (PsiAnnotation annotation : fromBytecode) {
+ if (!ORG_JETBRAINS_ANNOTATIONS_CONTRACT.equals(annotation.getQualifiedName()) || canHaveContract(listOwner)) {
+ result.add(annotation);
+ }
+ }
+
+ if (canHaveContract(listOwner)) {
+ List<MethodContract> contracts = ContractInference.inferContracts((PsiMethod)listOwner);
+ if (!contracts.isEmpty()) {
+ result.add(ProjectBytecodeAnalysis.getInstance(listOwner.getProject())
+ .createContractAnnotation("\"" + StringUtil.join(contracts, "; ") + "\""));
+ }
+ }
+
+ return result.isEmpty() ? PsiAnnotation.EMPTY_ARRAY : result.toArray(new PsiAnnotation[result.size()]);
+ }
+
+ @Override
+ public boolean isInferredAnnotation(@NotNull PsiAnnotation annotation) {
+ return annotation.getUserData(ProjectBytecodeAnalysis.INFERRED_ANNOTATION) != null;
+ }
+}
diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/AddTypeCastFix.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/AddTypeCastFix.java
index 0ccad5cadf48..9fc35a649504 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/AddTypeCastFix.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/AddTypeCastFix.java
@@ -31,6 +31,7 @@ import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.project.Project;
import com.intellij.psi.*;
import com.intellij.psi.codeStyle.CodeStyleManager;
+import com.intellij.psi.codeStyle.JavaCodeStyleManager;
import com.intellij.psi.util.PsiUtil;
import com.intellij.psi.util.TypeConversionUtil;
import org.jetbrains.annotations.NotNull;
@@ -91,6 +92,7 @@ public class AddTypeCastFix extends LocalQuickFixAndIntentionActionOnPsiElement
String text = "(" + type.getCanonicalText(false) + ")value";
PsiElementFactory factory = JavaPsiFacade.getInstance(original.getProject()).getElementFactory();
PsiTypeCastExpression typeCast = (PsiTypeCastExpression)factory.createExpressionFromText(text, original);
+ typeCast = (PsiTypeCastExpression)JavaCodeStyleManager.getInstance(project).shortenClassReferences(typeCast);
typeCast = (PsiTypeCastExpression)CodeStyleManager.getInstance(project).reformat(typeCast);
if (expression instanceof PsiConditionalExpression) {
diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/intention/AddAnnotationPsiFix.java b/java/java-analysis-impl/src/com/intellij/codeInsight/intention/AddAnnotationPsiFix.java
index 84f704f64dcd..e5e4bb68d11e 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInsight/intention/AddAnnotationPsiFix.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInsight/intention/AddAnnotationPsiFix.java
@@ -75,13 +75,16 @@ public class AddAnnotationPsiFix extends LocalQuickFixOnPsiElement {
PsiElement element = file.findElementAt(offset);
- PsiModifierListOwner listOwner = PsiTreeUtil.getParentOfType(element, PsiParameter.class, false);
- if (listOwner != null) return listOwner;
+ PsiModifierListOwner listOwner = PsiTreeUtil.getParentOfType(element, PsiModifierListOwner.class, false);
+ if (listOwner instanceof PsiParameter) return listOwner;
- final PsiIdentifier psiIdentifier = PsiTreeUtil.getParentOfType(element, PsiIdentifier.class, false);
- if (psiIdentifier != null && psiIdentifier.getParent() instanceof PsiModifierListOwner) {
- return (PsiModifierListOwner)psiIdentifier.getParent();
+ if (listOwner instanceof PsiNameIdentifierOwner) {
+ PsiElement id = ((PsiNameIdentifierOwner)listOwner).getNameIdentifier();
+ if (id != null && id.getTextRange().containsOffset(offset)) { // Groovy methods will pass this check as well
+ return listOwner;
+ }
}
+
return null;
}
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/AnonymousCanBeLambdaInspection.java b/java/java-analysis-impl/src/com/intellij/codeInspection/AnonymousCanBeLambdaInspection.java
index 96066c34eefe..c1f127d3a1df 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/AnonymousCanBeLambdaInspection.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/AnonymousCanBeLambdaInspection.java
@@ -32,10 +32,7 @@ import com.intellij.psi.controlFlow.ControlFlow;
import com.intellij.psi.controlFlow.ControlFlowUtil;
import com.intellij.psi.impl.source.resolve.DefaultParameterTypeInferencePolicy;
import com.intellij.psi.infos.MethodCandidateInfo;
-import com.intellij.psi.util.InheritanceUtil;
-import com.intellij.psi.util.PsiTreeUtil;
-import com.intellij.psi.util.PsiTypesUtil;
-import com.intellij.psi.util.PsiUtil;
+import com.intellij.psi.util.*;
import com.intellij.util.ArrayUtilRt;
import com.intellij.util.Function;
import com.intellij.util.containers.ContainerUtilRt;
@@ -91,16 +88,12 @@ public class AnonymousCanBeLambdaInspection extends BaseJavaBatchLocalInspection
final PsiMethod[] methods = aClass.getMethods();
if (methods.length == 1 && aClass.getFields().length == 0) {
final PsiCodeBlock body = methods[0].getBody();
- if (body != null) {
- final ForbiddenRefsChecker checker = new ForbiddenRefsChecker(methods[0], aClass);
- body.accept(checker);
- if (!checker.hasForbiddenRefs()) {
- final PsiElement lBrace = aClass.getLBrace();
- LOG.assertTrue(lBrace != null);
- final TextRange rangeInElement = new TextRange(0, aClass.getStartOffsetInParent() + lBrace.getStartOffsetInParent());
- holder.registerProblem(aClass.getParent(), "Anonymous #ref #loc can be replaced with lambda",
- ProblemHighlightType.LIKE_UNUSED_SYMBOL, rangeInElement, new ReplaceWithLambdaFix());
- }
+ if (body != null && !hasForbiddenRefsInsideBody(methods[0], aClass)) {
+ final PsiElement lBrace = aClass.getLBrace();
+ LOG.assertTrue(lBrace != null);
+ final TextRange rangeInElement = new TextRange(0, aClass.getStartOffsetInParent() + lBrace.getStartOffsetInParent());
+ holder.registerProblem(aClass.getParent(), "Anonymous #ref #loc can be replaced with lambda",
+ ProblemHighlightType.LIKE_UNUSED_SYMBOL, rangeInElement, new ReplaceWithLambdaFix());
}
}
}
@@ -110,6 +103,14 @@ public class AnonymousCanBeLambdaInspection extends BaseJavaBatchLocalInspection
};
}
+ public static boolean hasForbiddenRefsInsideBody(PsiMethod method, PsiAnonymousClass aClass) {
+ final ForbiddenRefsChecker checker = new ForbiddenRefsChecker(method, aClass);
+ final PsiCodeBlock body = method.getBody();
+ LOG.assertTrue(body != null);
+ body.accept(checker);
+ return checker.hasForbiddenRefs();
+ }
+
private static PsiType getInferredType(PsiAnonymousClass aClass) {
final PsiExpression expression = (PsiExpression)aClass.getParent();
final PsiType psiType = PsiTypesUtil.getExpectedTypeByParent(expression);
@@ -369,14 +370,14 @@ public class AnonymousCanBeLambdaInspection extends BaseJavaBatchLocalInspection
private final PsiMethod myMethod;
private final PsiAnonymousClass myAnonymClass;
- private final boolean myRawType;
+ private final boolean myEqualInference;
public ForbiddenRefsChecker(PsiMethod method,
PsiAnonymousClass aClass) {
myMethod = method;
myAnonymClass = aClass;
final PsiType inferredType = getInferredType(aClass);
- myRawType = inferredType instanceof PsiClassType && ((PsiClassType)inferredType).isRaw();
+ myEqualInference = !aClass.getBaseClassType().equals(inferredType);
}
@Override
@@ -467,7 +468,7 @@ public class AnonymousCanBeLambdaInspection extends BaseJavaBatchLocalInspection
}
}
- if (myRawType) {
+ if (myEqualInference) {
final PsiElement resolved = expression.resolve();
if (resolved instanceof PsiParameter && ((PsiParameter)resolved).getDeclarationScope() == myMethod) {
final int parameterIndex = myMethod.getParameterList().getParameterIndex((PsiParameter)resolved);
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/AnonymousCanBeMethodReferenceInspection.java b/java/java-analysis-impl/src/com/intellij/codeInspection/AnonymousCanBeMethodReferenceInspection.java
index d6a884c8917c..c3363ec7eb12 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/AnonymousCanBeMethodReferenceInspection.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/AnonymousCanBeMethodReferenceInspection.java
@@ -69,7 +69,7 @@ public class AnonymousCanBeMethodReferenceInspection extends BaseJavaBatchLocalI
final PsiClassType baseClassType = aClass.getBaseClassType();
if (LambdaUtil.isFunctionalType(baseClassType)) {
final PsiMethod[] methods = aClass.getMethods();
- if (methods.length == 1 && aClass.getFields().length == 0) {
+ if (methods.length == 1 && aClass.getFields().length == 0 && !AnonymousCanBeLambdaInspection.hasForbiddenRefsInsideBody(methods[0], aClass)) {
final PsiCodeBlock body = methods[0].getBody();
final PsiCallExpression callExpression =
LambdaCanBeMethodReferenceInspection
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/LambdaCanBeMethodReferenceInspection.java b/java/java-analysis-impl/src/com/intellij/codeInspection/LambdaCanBeMethodReferenceInspection.java
index 1e887030dcb4..416226e9ac8f 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/LambdaCanBeMethodReferenceInspection.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/LambdaCanBeMethodReferenceInspection.java
@@ -245,11 +245,14 @@ public class LambdaCanBeMethodReferenceInspection extends BaseJavaBatchLocalInsp
PsiParameter[] candidateParams = method.getParameterList().getParameters();
if (candidateParams.length == 1) {
if (TypeConversionUtil.areTypesConvertible(candidateParams[0].getType(), parameters[0].getType())) {
- for (PsiMethod superMethod : psiMethod.findDeepestSuperMethods()) {
- PsiMethod validSuperMethod = ensureNonAmbiguousMethod(parameters, superMethod);
- if (validSuperMethod != null) return validSuperMethod;
+ final PsiMethod[] deepestSuperMethods = psiMethod.findDeepestSuperMethods();
+ if (deepestSuperMethods.length > 0) {
+ for (PsiMethod superMethod : deepestSuperMethods) {
+ PsiMethod validSuperMethod = ensureNonAmbiguousMethod(parameters, superMethod);
+ if (validSuperMethod != null) return validSuperMethod;
+ }
+ return null;
}
- return null;
}
}
}
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/bytecodeAnalysis/Analysis.java b/java/java-analysis-impl/src/com/intellij/codeInspection/bytecodeAnalysis/Analysis.java
new file mode 100644
index 000000000000..44e493c63f0a
--- /dev/null
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/bytecodeAnalysis/Analysis.java
@@ -0,0 +1,398 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.codeInspection.bytecodeAnalysis;
+
+import gnu.trove.TIntObjectHashMap;
+import org.jetbrains.org.objectweb.asm.Opcodes;
+import org.jetbrains.org.objectweb.asm.Type;
+import org.jetbrains.org.objectweb.asm.tree.MethodNode;
+import org.jetbrains.org.objectweb.asm.tree.analysis.AnalyzerException;
+import org.jetbrains.org.objectweb.asm.tree.analysis.BasicValue;
+import org.jetbrains.org.objectweb.asm.tree.analysis.Frame;
+
+import java.util.*;
+
+class AbstractValues {
+ static final class ParamValue extends BasicValue {
+ ParamValue(Type tp) {
+ super(tp);
+ }
+ }
+ static final BasicValue InstanceOfCheckValue = new BasicValue(Type.INT_TYPE) {
+ @Override
+ public boolean equals(Object value) {
+ return this == value;
+ }
+ };
+
+ static final BasicValue TrueValue = new BasicValue(Type.INT_TYPE) {
+ @Override
+ public boolean equals(Object value) {
+ return this == value;
+ }
+ };
+
+ static final BasicValue FalseValue = new BasicValue(Type.INT_TYPE) {
+ @Override
+ public boolean equals(Object value) {
+ return this == value;
+ }
+ };
+
+ static final BasicValue NullValue = new BasicValue(Type.getObjectType("null")) {
+ @Override
+ public boolean equals(Object value) {
+ return this == value;
+ }
+ };
+ static final class NotNullValue extends BasicValue {
+ NotNullValue(Type tp) {
+ super(tp);
+ }
+ }
+ static final class CallResultValue extends BasicValue {
+ final Set<Key> inters;
+ CallResultValue(Type tp, Set<Key> inters) {
+ super(tp);
+ this.inters = inters;
+ }
+ }
+
+ static boolean isInstance(Conf curr, Conf prev) {
+ if (curr.insnIndex != prev.insnIndex) {
+ return false;
+ }
+ Frame<BasicValue> currFr = curr.frame;
+ Frame<BasicValue> prevFr = prev.frame;
+ for (int i = 0; i < currFr.getLocals(); i++) {
+ if (!isInstance(currFr.getLocal(i), prevFr.getLocal(i))) {
+ return false;
+ }
+ }
+ for (int i = 0; i < currFr.getStackSize(); i++) {
+ if (!isInstance(currFr.getStack(i), prevFr.getStack(i))) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ static boolean isInstance(BasicValue curr, BasicValue prev) {
+ if (prev instanceof ParamValue) {
+ return curr instanceof ParamValue;
+ }
+ if (InstanceOfCheckValue == prev) {
+ return InstanceOfCheckValue == curr;
+ }
+ if (TrueValue == prev) {
+ return TrueValue == curr;
+ }
+ if (FalseValue == prev) {
+ return FalseValue == curr;
+ }
+ if (NullValue == prev) {
+ return NullValue == curr;
+ }
+ if (prev instanceof NotNullValue) {
+ return curr instanceof NotNullValue;
+ }
+ if (prev instanceof CallResultValue) {
+ if (curr instanceof CallResultValue) {
+ CallResultValue prevCall = (CallResultValue) prev;
+ CallResultValue currCall = (CallResultValue) curr;
+ return prevCall.inters.equals(currCall.inters);
+ }
+ else {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ static boolean equiv(Conf curr, Conf prev) {
+ Frame<BasicValue> currFr = curr.frame;
+ Frame<BasicValue> prevFr = prev.frame;
+ for (int i = currFr.getStackSize() - 1; i >= 0; i--) {
+ if (!equiv(currFr.getStack(i), prevFr.getStack(i))) {
+ return false;
+ }
+ }
+ for (int i = currFr.getLocals() - 1; i >= 0; i--) {
+ if (!equiv(currFr.getLocal(i), prevFr.getLocal(i))) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ static boolean equiv(BasicValue curr, BasicValue prev) {
+ if (curr.getClass() == prev.getClass()) {
+ if (curr instanceof CallResultValue && prev instanceof CallResultValue) {
+ Set<Key> keys1 = ((CallResultValue)prev).inters;
+ Set<Key> keys2 = ((CallResultValue)curr).inters;
+ return keys1.equals(keys2);
+ }
+ else return true;
+ }
+ else return false;
+ }
+}
+
+final class Conf {
+ final int insnIndex;
+ final Frame<BasicValue> frame;
+ final int fastHashCode;
+
+ Conf(int insnIndex, Frame<BasicValue> frame) {
+ this.insnIndex = insnIndex;
+ this.frame = frame;
+
+ int hash = 0;
+ for (int i = 0; i < frame.getLocals(); i++) {
+ hash = hash * 31 + frame.getLocal(i).getClass().hashCode();
+ }
+ for (int i = 0; i < frame.getStackSize(); i++) {
+ hash = hash * 31 + frame.getStack(i).getClass().hashCode();
+ }
+ fastHashCode = hash;
+ }
+}
+
+final class State {
+ final int index;
+ final Conf conf;
+ final List<Conf> history;
+ final boolean taken;
+ final boolean hasCompanions;
+
+ State(int index, Conf conf, List<Conf> history, boolean taken, boolean hasCompanions) {
+ this.index = index;
+ this.conf = conf;
+ this.history = history;
+ this.taken = taken;
+ this.hasCompanions = hasCompanions;
+ }
+}
+
+interface PendingAction<Res> {}
+class ProceedState<Res> implements PendingAction<Res> {
+ final State state;
+
+ ProceedState(State state) {
+ this.state = state;
+ }
+}
+class MakeResult<Res> implements PendingAction<Res> {
+ final State state;
+ final Res subResult;
+ final int[] indices;
+
+ MakeResult(State state, Res subResult, int[] indices) {
+ this.state = state;
+ this.subResult = subResult;
+ this.indices = indices;
+ }
+}
+
+abstract class Analysis<Res> {
+ private static final int STEPS_LIMIT = 30000;
+ final RichControlFlow richControlFlow;
+ final Direction direction;
+ final ControlFlowGraph controlFlow;
+ final MethodNode methodNode;
+ final Method method;
+ final DFSTree dfsTree;
+ final Res myIdentity;
+
+ final Deque<PendingAction<Res>> pending = new LinkedList<PendingAction<Res>>();
+ final TIntObjectHashMap<List<State>> computed = new TIntObjectHashMap<List<State>>();
+ final TIntObjectHashMap<Res> results = new TIntObjectHashMap<Res>();
+ final Key aKey;
+
+ Res earlyResult = null;
+
+ abstract Res identity();
+ abstract Res combineResults(Res delta, List<Res> subResults);
+ abstract boolean isEarlyResult(Res res);
+ abstract Equation<Key, Value> mkEquation(Res result);
+ abstract void processState(State state) throws AnalyzerException;
+
+ protected Analysis(RichControlFlow richControlFlow, Direction direction, boolean stable) {
+ this.richControlFlow = richControlFlow;
+ this.direction = direction;
+ controlFlow = richControlFlow.controlFlow;
+ methodNode = controlFlow.methodNode;
+ method = new Method(controlFlow.className, methodNode.name, methodNode.desc);
+ dfsTree = richControlFlow.dfsTree;
+ aKey = new Key(method, direction, stable);
+ myIdentity = identity();
+ }
+
+ final State createStartState() {
+ return new State(0, new Conf(0, createStartFrame()), new ArrayList<Conf>(), false, false);
+ }
+
+ static boolean stateEquiv(State curr, State prev) {
+ if (curr.taken != prev.taken) {
+ return false;
+ }
+ if (curr.conf.fastHashCode != prev.conf.fastHashCode) {
+ return false;
+ }
+ if (!AbstractValues.equiv(curr.conf, prev.conf)) {
+ return false;
+ }
+ if (curr.history.size() != prev.history.size()) {
+ return false;
+ }
+ for (int i = 0; i < curr.history.size(); i++) {
+ Conf curr1 = curr.history.get(i);
+ Conf prev1 = prev.history.get(i);
+ if (curr1.fastHashCode != prev1.fastHashCode || !AbstractValues.equiv(curr1, prev1)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ final Equation<Key, Value> analyze() throws AnalyzerException {
+ pending.push(new ProceedState<Res>(createStartState()));
+ int steps = 0;
+ while (!pending.isEmpty() && earlyResult == null) {
+ steps ++;
+ if (steps >= STEPS_LIMIT) {
+ throw new AnalyzerException(null, "limit is reached, steps: " + steps + " in method " + method);
+ }
+ PendingAction<Res> action = pending.pop();
+ if (action instanceof MakeResult) {
+ MakeResult<Res> makeResult = (MakeResult<Res>) action;
+ ArrayList<Res> subResults = new ArrayList<Res>();
+ for (int index : makeResult.indices) {
+ subResults.add(results.get(index));
+ }
+ Res result = combineResults(makeResult.subResult, subResults);
+ if (isEarlyResult(result)) {
+ earlyResult = result;
+ } else {
+ State state = makeResult.state;
+ int insnIndex = state.conf.insnIndex;
+ results.put(state.index, result);
+ List<State> thisComputed = computed.get(insnIndex);
+ if (thisComputed == null) {
+ thisComputed = new ArrayList<State>();
+ computed.put(insnIndex, thisComputed);
+ }
+ thisComputed.add(state);
+ }
+ }
+ else if (action instanceof ProceedState) {
+ ProceedState<Res> proceedState = (ProceedState<Res>) action;
+ State state = proceedState.state;
+ int insnIndex = state.conf.insnIndex;
+ Conf conf = state.conf;
+ List<Conf> history = state.history;
+
+ boolean fold = false;
+ if (dfsTree.loopEnters.contains(insnIndex)) {
+ for (Conf prev : history) {
+ if (AbstractValues.isInstance(conf, prev)) {
+ fold = true;
+ }
+ }
+ }
+ if (fold) {
+ results.put(state.index, myIdentity);
+ List<State> thisComputed = computed.get(insnIndex);
+ if (thisComputed == null) {
+ thisComputed = new ArrayList<State>();
+ computed.put(insnIndex, thisComputed);
+ }
+ thisComputed.add(state);
+ }
+ else {
+ State baseState = null;
+ List<State> thisComputed = computed.get(insnIndex);
+ if (thisComputed != null) {
+ for (State prevState : thisComputed) {
+ if (stateEquiv(state, prevState)) {
+ baseState = prevState;
+ break;
+ }
+ }
+ }
+ if (baseState != null) {
+ results.put(state.index, results.get(baseState.index));
+ } else {
+ // the main call
+ processState(state);
+ }
+
+ }
+ }
+ }
+ if (earlyResult != null) {
+ return mkEquation(earlyResult);
+ } else {
+ return mkEquation(results.get(0));
+ }
+ }
+
+ final Frame<BasicValue> createStartFrame() {
+ Frame<BasicValue> frame = new Frame<BasicValue>(methodNode.maxLocals, methodNode.maxStack);
+ Type returnType = Type.getReturnType(methodNode.desc);
+ BasicValue returnValue = Type.VOID_TYPE.equals(returnType) ? null : new BasicValue(returnType);
+ frame.setReturn(returnValue);
+
+ Type[] args = Type.getArgumentTypes(methodNode.desc);
+ int local = 0;
+ if ((methodNode.access & Opcodes.ACC_STATIC) == 0) {
+ frame.setLocal(local++, new AbstractValues.NotNullValue(Type.getObjectType(controlFlow.className)));
+ }
+ for (int i = 0; i < args.length; i++) {
+ BasicValue value;
+ if (direction instanceof InOut && ((InOut)direction).paramIndex == i) {
+ value = new AbstractValues.ParamValue(args[i]);
+ }
+ else if (direction instanceof In && ((In)direction).paramIndex == i) {
+ value = new AbstractValues.ParamValue(args[i]);
+ }
+ else {
+ value = new BasicValue(args[i]);
+ }
+ frame.setLocal(local++, value);
+ if (args[i].getSize() == 2) {
+ frame.setLocal(local++, BasicValue.UNINITIALIZED_VALUE);
+ }
+ }
+ while (local < methodNode.maxLocals) {
+ frame.setLocal(local++, BasicValue.UNINITIALIZED_VALUE);
+ }
+ return frame;
+ }
+
+ static BasicValue popValue(Frame<BasicValue> frame) {
+ return frame.getStack(frame.getStackSize() - 1);
+ }
+
+ static <A> List<A> append(List<A> xs, A x) {
+ ArrayList<A> result = new ArrayList<A>();
+ if (xs != null) {
+ result.addAll(xs);
+ }
+ result.add(x);
+ return result;
+ }
+}
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/bytecodeAnalysis/BytecodeAnalysisConverter.java b/java/java-analysis-impl/src/com/intellij/codeInspection/bytecodeAnalysis/BytecodeAnalysisConverter.java
new file mode 100644
index 000000000000..f29dd7f6cf0c
--- /dev/null
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/bytecodeAnalysis/BytecodeAnalysisConverter.java
@@ -0,0 +1,485 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.codeInspection.bytecodeAnalysis;
+
+import com.intellij.ide.util.PropertiesComponent;
+import com.intellij.openapi.application.ApplicationManager;
+import com.intellij.openapi.application.PathManager;
+import com.intellij.openapi.components.ApplicationComponent;
+import com.intellij.openapi.progress.ProgressManager;
+import com.intellij.openapi.util.ThrowableComputable;
+import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.psi.*;
+import com.intellij.psi.util.PsiTreeUtil;
+import com.intellij.psi.util.TypeConversionUtil;
+import com.intellij.util.io.*;
+import gnu.trove.TIntHashSet;
+import gnu.trove.TIntObjectHashMap;
+import gnu.trove.TIntObjectIterator;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+import org.jetbrains.org.objectweb.asm.Type;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.File;
+import java.io.IOException;
+import java.util.*;
+
+import static com.intellij.codeInspection.bytecodeAnalysis.ProjectBytecodeAnalysis.LOG;
+
+/**
+ * @author lambdamix
+ */
+public class BytecodeAnalysisConverter implements ApplicationComponent {
+
+ private static final String VERSION = "BytecodeAnalysisConverter.Enumerators";
+
+ public static BytecodeAnalysisConverter getInstance() {
+ return ApplicationManager.getApplication().getComponent(BytecodeAnalysisConverter.class);
+ }
+
+ private PersistentStringEnumerator myNamesEnumerator;
+ private PersistentEnumeratorDelegate<int[]> myCompoundKeyEnumerator;
+ private int version;
+
+ @Override
+ public void initComponent() {
+ version = PropertiesComponent.getInstance().getOrInitInt(VERSION, 0);
+ final File keysDir = new File(PathManager.getIndexRoot(), "bytecodekeys");
+ final File namesFile = new File(keysDir, "names");
+ final File compoundKeysFile = new File(keysDir, "compound");
+
+ try {
+ IOUtil.openCleanOrResetBroken(new ThrowableComputable<Void, IOException>() {
+ @Override
+ public Void compute() throws IOException {
+ myNamesEnumerator = new PersistentStringEnumerator(namesFile, true);
+ myCompoundKeyEnumerator = new IntArrayPersistentEnumerator(compoundKeysFile, new IntArrayKeyDescriptor());
+ return null;
+ }
+ }, new Runnable() {
+ @Override
+ public void run() {
+ LOG.info("Error during initialization of enumerators in bytecode analysis. Re-initializing.");
+ IOUtil.deleteAllFilesStartingWith(keysDir);
+ version ++;
+ }
+ });
+ }
+ catch (IOException e) {
+ LOG.error("Re-initialization of enumerators in bytecode analysis failed.", e);
+ }
+ // TODO: is it enough for rebuilding indices?
+ PropertiesComponent.getInstance().setValue(VERSION, String.valueOf(version));
+ }
+
+ @Override
+ public void disposeComponent() {
+ try {
+ myNamesEnumerator.close();
+ myCompoundKeyEnumerator.close();
+ }
+ catch (IOException e) {
+ LOG.debug(e);
+ }
+ }
+
+ @NotNull
+ @Override
+ public String getComponentName() {
+ return "BytecodeAnalysisConverter";
+ }
+
+ IntIdEquation convert(Equation<Key, Value> equation) throws IOException {
+ ProgressManager.checkCanceled();
+
+ Result<Key, Value> rhs = equation.rhs;
+ IntIdResult result;
+ if (rhs instanceof Final) {
+ result = new IntIdFinal(((Final<Key, Value>)rhs).value);
+ } else {
+ Pending<Key, Value> pending = (Pending<Key, Value>)rhs;
+ Set<Product<Key, Value>> sumOrigin = pending.sum;
+ IntIdComponent[] components = new IntIdComponent[sumOrigin.size()];
+ int componentI = 0;
+ for (Product<Key, Value> prod : sumOrigin) {
+ int[] intProd = new int[prod.ids.size()];
+ int idI = 0;
+ for (Key id : prod.ids) {
+ int rawId = mkAsmKey(id);
+ if (rawId <= 0) {
+ LOG.error("raw key should be positive. rawId = " + rawId);
+ }
+ intProd[idI] = id.stable ? rawId : -rawId;
+ idI++;
+ }
+ IntIdComponent intIdComponent = new IntIdComponent(prod.value, intProd);
+ components[componentI] = intIdComponent;
+ componentI++;
+ }
+ result = new IntIdPending(components);
+ }
+
+ int rawKey = mkAsmKey(equation.id);
+ if (rawKey <= 0) {
+ LOG.error("raw key should be positive. rawKey = " + rawKey);
+ }
+
+ int key = equation.id.stable ? rawKey : -rawKey;
+ return new IntIdEquation(key, result);
+ }
+
+ public int mkAsmKey(@NotNull Key key) throws IOException {
+ return myCompoundKeyEnumerator.enumerate(new int[]{mkDirectionKey(key.direction), mkAsmSignatureKey(key.method)});
+ }
+
+ private int mkDirectionKey(Direction dir) throws IOException {
+ return myCompoundKeyEnumerator.enumerate(new int[]{dir.directionId(), dir.paramId(), dir.valueId()});
+ }
+
+ // class + short signature
+ private int mkAsmSignatureKey(@NotNull Method method) throws IOException {
+ int[] sigKey = new int[2];
+ sigKey[0] = mkAsmTypeKey(Type.getObjectType(method.internalClassName));
+ sigKey[1] = mkAsmShortSignatureKey(method);
+ return myCompoundKeyEnumerator.enumerate(sigKey);
+ }
+
+ private int mkAsmShortSignatureKey(@NotNull Method method) throws IOException {
+ Type[] argTypes = Type.getArgumentTypes(method.methodDesc);
+ int arity = argTypes.length;
+ int[] sigKey = new int[3 + arity];
+ sigKey[0] = mkAsmTypeKey(Type.getReturnType(method.methodDesc));
+ sigKey[1] = myNamesEnumerator.enumerate(method.methodName);
+ sigKey[2] = argTypes.length;
+ for (int i = 0; i < argTypes.length; i++) {
+ sigKey[3 + i] = mkAsmTypeKey(argTypes[i]);
+ }
+ return myCompoundKeyEnumerator.enumerate(sigKey);
+ }
+
+ @Nullable
+ private static Direction extractDirection(int[] directionKey) {
+ switch (directionKey[0]) {
+ case Direction.OUT_DIRECTION:
+ return new Out();
+ case Direction.IN_DIRECTION:
+ return new In(directionKey[1]);
+ case Direction.INOUT_DIRECTION:
+ return new InOut(directionKey[1], Value.values()[directionKey[2]]);
+ }
+ return null;
+ }
+
+ private int mkAsmTypeKey(Type type) throws IOException {
+ String className = type.getClassName();
+ int dotIndex = className.lastIndexOf('.');
+ String packageName;
+ String simpleName;
+ if (dotIndex > 0) {
+ packageName = className.substring(0, dotIndex);
+ simpleName = className.substring(dotIndex + 1);
+ } else {
+ packageName = "";
+ simpleName = className;
+ }
+ int[] classKey = new int[]{myNamesEnumerator.enumerate(packageName), myNamesEnumerator.enumerate(simpleName)};
+ return myCompoundKeyEnumerator.enumerate(classKey);
+ }
+
+ public int mkPsiKey(@NotNull PsiMethod psiMethod, Direction direction) throws IOException {
+ final PsiClass psiClass = PsiTreeUtil.getParentOfType(psiMethod, PsiClass.class, false);
+ if (psiClass == null) {
+ LOG.debug("PsiClass was null for " + psiMethod.getName());
+ return -1;
+ }
+ int sigKey = mkPsiSignatureKey(psiMethod);
+ if (sigKey == -1) {
+ return -1;
+ }
+ return myCompoundKeyEnumerator.enumerate(new int[]{mkDirectionKey(direction), sigKey});
+
+ }
+
+ private int mkPsiSignatureKey(@NotNull PsiMethod psiMethod) throws IOException {
+ final PsiClass psiClass = PsiTreeUtil.getParentOfType(psiMethod, PsiClass.class, false);
+ if (psiClass == null) {
+ LOG.debug("PsiClass was null for " + psiMethod.getName());
+ return -1;
+ }
+ PsiClass outerClass = psiClass.getContainingClass();
+ boolean isInnerClassConstructor = psiMethod.isConstructor() && (outerClass != null) && !psiClass.hasModifierProperty(PsiModifier.STATIC);
+ PsiParameter[] parameters = psiMethod.getParameterList().getParameters();
+ PsiType returnType = psiMethod.getReturnType();
+
+ final int shift = isInnerClassConstructor ? 1 : 0;
+ final int arity = parameters.length + shift;
+ int[] shortSigKey = new int[3 + arity];
+ if (returnType == null) {
+ shortSigKey[0] = mkPsiTypeKey(PsiType.VOID);
+ shortSigKey[1] = myNamesEnumerator.enumerate("<init>");
+ } else {
+ shortSigKey[0] = mkPsiTypeKey(returnType);
+ shortSigKey[1] = myNamesEnumerator.enumerate(psiMethod.getName());
+ }
+ shortSigKey[2] = arity;
+ if (isInnerClassConstructor) {
+ shortSigKey[3] = mkPsiClassKey(outerClass, 0);
+ }
+ for (int i = 0; i < parameters.length; i++) {
+ PsiParameter parameter = parameters[i];
+ shortSigKey[3 + i + shift] = mkPsiTypeKey(parameter.getType());
+ }
+ for (int aShortSigKey : shortSigKey) {
+ if (aShortSigKey == -1) {
+ return -1;
+ }
+ }
+
+ int[] sigKey = new int[2];
+ int classKey = mkPsiClassKey(psiClass, 0);
+ if (classKey == -1) {
+ return -1;
+ }
+ sigKey[0] = classKey;
+ sigKey[1] = myCompoundKeyEnumerator.enumerate(shortSigKey);
+
+ return myCompoundKeyEnumerator.enumerate(sigKey);
+ }
+
+
+ private int mkPsiClassKey(PsiClass psiClass, int dimensions) throws IOException {
+ PsiFile containingFile = psiClass.getContainingFile();
+ if (!(containingFile instanceof PsiClassOwner)) {
+ LOG.debug("containingFile was not resolved for " + psiClass.getQualifiedName());
+ return -1;
+ }
+ PsiClassOwner psiFile = (PsiClassOwner)containingFile;
+ String packageName = psiFile.getPackageName();
+ String qname = psiClass.getQualifiedName();
+ if (qname == null) {
+ return -1;
+ }
+ String className = qname;
+ if (packageName.length() > 0) {
+ className = qname.substring(packageName.length() + 1).replace('.', '$');
+ }
+ int[] classKey = new int[2];
+ classKey[0] = myNamesEnumerator.enumerate(packageName);
+ if (dimensions == 0) {
+ classKey[1] = myNamesEnumerator.enumerate(className);
+ } else {
+ StringBuilder sb = new StringBuilder(className);
+ for (int j = 0; j < dimensions; j++) {
+ sb.append("[]");
+ }
+ classKey[1] = myNamesEnumerator.enumerate(sb.toString());
+ }
+ return myCompoundKeyEnumerator.enumerate(classKey);
+ }
+
+ private int mkPsiTypeKey(PsiType psiType) throws IOException {
+ int dimensions = 0;
+ psiType = TypeConversionUtil.erasure(psiType);
+ if (psiType instanceof PsiArrayType) {
+ PsiArrayType arrayType = (PsiArrayType)psiType;
+ psiType = arrayType.getDeepComponentType();
+ dimensions = arrayType.getArrayDimensions();
+ }
+
+ if (psiType instanceof PsiClassType) {
+ // no resolve() -> no package/class split
+ PsiClass psiClass = ((PsiClassType)psiType).resolve();
+ if (psiClass != null) {
+ return mkPsiClassKey(psiClass, dimensions);
+ }
+ else {
+ LOG.debug("resolve was null for " + ((PsiClassType)psiType).getClassName());
+ return -1;
+ }
+ }
+ else if (psiType instanceof PsiPrimitiveType) {
+ String packageName = "";
+ String className = psiType.getPresentableText();
+ int[] classKey = new int[2];
+ classKey[0] = myNamesEnumerator.enumerate(packageName);
+ if (dimensions == 0) {
+ classKey[1] = myNamesEnumerator.enumerate(className);
+ } else {
+ StringBuilder sb = new StringBuilder(className);
+ for (int j = 0; j < dimensions; j++) {
+ sb.append("[]");
+ }
+ classKey[1] = myNamesEnumerator.enumerate(sb.toString());
+ }
+ return myCompoundKeyEnumerator.enumerate(classKey);
+ }
+ return -1;
+ }
+
+ public void addAnnotations(TIntObjectHashMap<Value> internalIdSolutions, Annotations annotations) {
+
+ TIntObjectHashMap<List<String>> contractClauses = new TIntObjectHashMap<List<String>>();
+ TIntObjectIterator<Value> solutionsIterator = internalIdSolutions.iterator();
+
+ TIntHashSet notNulls = annotations.notNulls;
+ TIntObjectHashMap<String> contracts = annotations.contracts;
+
+ for (int i = internalIdSolutions.size(); i-- > 0;) {
+ solutionsIterator.advance();
+ int key = Math.abs(solutionsIterator.key());
+ Value value = solutionsIterator.value();
+ if (value == Value.Top || value == Value.Bot) {
+ continue;
+ }
+ try {
+ int[] compoundKey = myCompoundKeyEnumerator.valueOf(key);
+ Direction direction = extractDirection(myCompoundKeyEnumerator.valueOf(compoundKey[0]));
+ if (value == Value.NotNull && (direction instanceof In || direction instanceof Out)) {
+ notNulls.add(key);
+ }
+ else if (direction instanceof InOut) {
+ compoundKey = new int[]{mkDirectionKey(new Out()), compoundKey[1]};
+ try {
+ int baseKey = myCompoundKeyEnumerator.enumerate(compoundKey);
+ List<String> clauses = contractClauses.get(baseKey);
+ if (clauses == null) {
+ clauses = new ArrayList<String>();
+ contractClauses.put(baseKey, clauses);
+ }
+ int[] sig = myCompoundKeyEnumerator.valueOf(compoundKey[1]);
+ int[] shortSig = myCompoundKeyEnumerator.valueOf(sig[1]);
+ int arity = shortSig[2];
+ clauses.add(contractElement(arity, (InOut)direction, value));
+ }
+ catch (IOException e) {
+ LOG.debug(e);
+ }
+ }
+ }
+ catch (IOException e) {
+ LOG.debug(e);
+ }
+ }
+
+ TIntObjectIterator<List<String>> buildersIterator = contractClauses.iterator();
+ for (int i = contractClauses.size(); i-- > 0;) {
+ buildersIterator.advance();
+ int key = buildersIterator.key();
+ if (!notNulls.contains(key)) {
+ List<String> clauses = buildersIterator.value();
+ Collections.sort(clauses);
+ StringBuilder sb = new StringBuilder("\"");
+ StringUtil.join(clauses, ";", sb);
+ sb.append('"');
+ contracts.put(key, sb.toString().intern());
+ }
+ }
+ }
+
+ static String contractValueString(Value v) {
+ switch (v) {
+ case False: return "false";
+ case True: return "true";
+ case NotNull: return "!null";
+ case Null: return "null";
+ default: return "_";
+ }
+ }
+
+ static String contractElement(int arity, InOut inOut, Value value) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0; i < arity; i++) {
+ Value currentValue = Value.Top;
+ if (i == inOut.paramIndex) {
+ currentValue = inOut.inValue;
+ }
+ if (i > 0) {
+ sb.append(',');
+ }
+ sb.append(contractValueString(currentValue));
+ }
+ sb.append("->");
+ sb.append(contractValueString(value));
+ return sb.toString();
+ }
+
+ public int getVersion() {
+ return version;
+ }
+
+ private static class IntArrayKeyDescriptor implements KeyDescriptor<int[]> {
+
+ @Override
+ public void save(@NotNull DataOutput out, int[] value) throws IOException {
+ DataInputOutputUtil.writeINT(out, value.length);
+ for (int i : value) {
+ DataInputOutputUtil.writeINT(out, i);
+ }
+ }
+
+ @Override
+ public int[] read(@NotNull DataInput in) throws IOException {
+ int[] value = new int[DataInputOutputUtil.readINT(in)];
+ for (int i = 0; i < value.length; i++) {
+ value[i] = DataInputOutputUtil.readINT(in);
+ }
+ return value;
+ }
+
+ @Override
+ public int getHashCode(int[] value) {
+ return Arrays.hashCode(value);
+ }
+
+ @Override
+ public boolean isEqual(int[] val1, int[] val2) {
+ return Arrays.equals(val1, val2);
+ }
+ }
+
+ private static class IntArrayPersistentEnumerator extends PersistentEnumeratorDelegate<int[]> {
+ private final CachingEnumerator<int[]> myCache;
+
+ public IntArrayPersistentEnumerator(File compoundKeysFile, IntArrayKeyDescriptor descriptor) throws IOException {
+ super(compoundKeysFile, descriptor, 1024 * 4);
+ myCache = new CachingEnumerator<int[]>(new DataEnumerator<int[]>() {
+ @Override
+ public int enumerate(@Nullable int[] value) throws IOException {
+ return IntArrayPersistentEnumerator.super.enumerate(value);
+ }
+
+ @Nullable
+ @Override
+ public int[] valueOf(int idx) throws IOException {
+ return IntArrayPersistentEnumerator.super.valueOf(idx);
+ }
+ }, descriptor);
+ }
+
+ @Override
+ public int enumerate(@Nullable int[] value) throws IOException {
+ return myCache.enumerate(value);
+ }
+
+ @Nullable
+ @Override
+ public int[] valueOf(int idx) throws IOException {
+ return myCache.valueOf(idx);
+ }
+ }
+}
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/bytecodeAnalysis/BytecodeAnalysisIndex.java b/java/java-analysis-impl/src/com/intellij/codeInspection/bytecodeAnalysis/BytecodeAnalysisIndex.java
new file mode 100644
index 000000000000..6a4b32783c95
--- /dev/null
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/bytecodeAnalysis/BytecodeAnalysisIndex.java
@@ -0,0 +1,167 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.codeInspection.bytecodeAnalysis;
+
+import com.intellij.ide.highlighter.JavaClassFileType;
+import com.intellij.openapi.application.Application;
+import com.intellij.openapi.application.ApplicationManager;
+import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.openapi.vfs.VirtualFileWithId;
+import com.intellij.util.SystemProperties;
+import com.intellij.util.indexing.*;
+import com.intellij.util.io.DataExternalizer;
+import com.intellij.util.io.DataInputOutputUtil;
+import com.intellij.util.io.EnumeratorIntegerDescriptor;
+import com.intellij.util.io.KeyDescriptor;
+import org.jetbrains.annotations.NotNull;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+
+/**
+ * @author lambdamix
+ */
+public class BytecodeAnalysisIndex extends FileBasedIndexExtension<Integer, Collection<IntIdEquation>> {
+ public static final ID<Integer, Collection<IntIdEquation>> NAME = ID.create("bytecodeAnalysis");
+ private final EquationExternalizer myExternalizer = new EquationExternalizer();
+ private static final DataIndexer<Integer, Collection<IntIdEquation>, FileContent> INDEXER =
+ new ClassDataIndexer(BytecodeAnalysisConverter.getInstance());
+
+ private static final int ourInternalVersion = 2;
+ private static boolean ourEnabled = SystemProperties.getBooleanProperty("idea.enable.bytecode.contract.inference", isEnabledByDefault());
+
+ private static boolean isEnabledByDefault() {
+ Application application = ApplicationManager.getApplication();
+ return application.isInternal() || application.isUnitTestMode();
+ }
+
+ public static int indexKey(VirtualFile file, boolean parameters) {
+ return (file instanceof VirtualFileWithId ? ((VirtualFileWithId)file).getId() * 2 : -2) + (parameters ? 1 : 0);
+ }
+
+ @NotNull
+ @Override
+ public ID<Integer, Collection<IntIdEquation>> getName() {
+ return NAME;
+ }
+
+ @NotNull
+ @Override
+ public DataIndexer<Integer, Collection<IntIdEquation>, FileContent> getIndexer() {
+ return INDEXER;
+ }
+
+ @NotNull
+ @Override
+ public KeyDescriptor<Integer> getKeyDescriptor() {
+ return EnumeratorIntegerDescriptor.INSTANCE;
+ }
+
+ @NotNull
+ @Override
+ public DataExternalizer<Collection<IntIdEquation>> getValueExternalizer() {
+ return myExternalizer;
+ }
+
+ @NotNull
+ @Override
+ public FileBasedIndex.InputFilter getInputFilter() {
+ return new DefaultFileTypeSpecificInputFilter(JavaClassFileType.INSTANCE) {
+ @Override
+ public boolean acceptInput(@NotNull VirtualFile file) {
+ return ourEnabled && super.acceptInput(file);
+ }
+ };
+ }
+
+ @Override
+ public boolean dependsOnFileContent() {
+ return true;
+ }
+
+ @Override
+ public int getVersion() {
+ return ourInternalVersion + BytecodeAnalysisConverter.getInstance().getVersion() + (ourEnabled ? 0xFF : 0);
+ }
+
+ public static class EquationExternalizer implements DataExternalizer<Collection<IntIdEquation>> {
+ @Override
+ public void save(@NotNull DataOutput out, Collection<IntIdEquation> equations) throws IOException {
+ DataInputOutputUtil.writeINT(out, equations.size());
+
+ for (IntIdEquation equation : equations) {
+ out.writeInt(equation.id);
+ IntIdResult rhs = equation.rhs;
+ if (rhs instanceof IntIdFinal) {
+ IntIdFinal finalResult = (IntIdFinal)rhs;
+ out.writeBoolean(true); // final flag
+ DataInputOutputUtil.writeINT(out, finalResult.value.ordinal());
+ } else {
+ IntIdPending pendResult = (IntIdPending)rhs;
+ out.writeBoolean(false); // pending flag
+ DataInputOutputUtil.writeINT(out, pendResult.delta.length);
+
+ for (IntIdComponent component : pendResult.delta) {
+ DataInputOutputUtil.writeINT(out, component.value.ordinal());
+ int[] ids = component.ids;
+ DataInputOutputUtil.writeINT(out, ids.length);
+ for (int id : ids) {
+ out.writeInt(id);
+ }
+ }
+ }
+ }
+ }
+
+ @Override
+ public Collection<IntIdEquation> read(@NotNull DataInput in) throws IOException {
+
+ int size = DataInputOutputUtil.readINT(in);
+ ArrayList<IntIdEquation> result = new ArrayList<IntIdEquation>(size);
+
+ for (int x = 0; x < size; x++) {
+ int equationId = in.readInt();
+ boolean isFinal = in.readBoolean(); // flag
+ if (isFinal) {
+ int ordinal = DataInputOutputUtil.readINT(in);
+ Value value = Value.values()[ordinal];
+ result.add(new IntIdEquation(equationId, new IntIdFinal(value)));
+ } else {
+
+ int sumLength = DataInputOutputUtil.readINT(in);
+ IntIdComponent[] components = new IntIdComponent[sumLength];
+
+ for (int i = 0; i < sumLength; i++) {
+ int ordinal = DataInputOutputUtil.readINT(in);
+ Value value = Value.values()[ordinal];
+ int componentSize = DataInputOutputUtil.readINT(in);
+ int[] ids = new int[componentSize];
+ for (int j = 0; j < componentSize; j++) {
+ ids[j] = in.readInt();
+ }
+ components[i] = new IntIdComponent(value, ids);
+ }
+ result.add(new IntIdEquation(equationId, new IntIdPending(components)));
+ }
+ }
+
+ return result;
+ }
+ }
+}
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/bytecodeAnalysis/ClassDataIndexer.java b/java/java-analysis-impl/src/com/intellij/codeInspection/bytecodeAnalysis/ClassDataIndexer.java
new file mode 100644
index 000000000000..5e74a8b5dbb3
--- /dev/null
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/bytecodeAnalysis/ClassDataIndexer.java
@@ -0,0 +1,264 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.codeInspection.bytecodeAnalysis;
+
+import com.intellij.openapi.progress.ProcessCanceledException;
+import com.intellij.openapi.progress.ProgressManager;
+import com.intellij.openapi.util.NotNullLazyValue;
+import com.intellij.util.indexing.DataIndexer;
+import com.intellij.util.indexing.FileContent;
+import gnu.trove.TIntHashSet;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.org.objectweb.asm.*;
+import org.jetbrains.org.objectweb.asm.tree.MethodNode;
+import org.jetbrains.org.objectweb.asm.tree.analysis.AnalyzerException;
+
+import java.util.*;
+
+import static com.intellij.codeInspection.bytecodeAnalysis.ProjectBytecodeAnalysis.LOG;
+
+/**
+ * @author lambdamix
+ */
+public class ClassDataIndexer implements DataIndexer<Integer, Collection<IntIdEquation>, FileContent> {
+ final BytecodeAnalysisConverter myConverter;
+
+ public ClassDataIndexer(BytecodeAnalysisConverter converter) {
+ myConverter = converter;
+ }
+
+ @NotNull
+ @Override
+ public Map<Integer, Collection<IntIdEquation>> map(@NotNull FileContent inputData) {
+ HashMap<Integer, Collection<IntIdEquation>> map = new HashMap<Integer, Collection<IntIdEquation>>(2);
+ try {
+ ClassEquations rawEquations = processClass(new ClassReader(inputData.getContent()));
+ List<Equation<Key, Value>> rawParameterEquations = rawEquations.parameterEquations;
+ List<Equation<Key, Value>> rawContractEquations = rawEquations.contractEquations;
+
+ Collection<IntIdEquation> idParameterEquations = new ArrayList<IntIdEquation>(rawParameterEquations.size());
+ Collection<IntIdEquation> idContractEquations = new ArrayList<IntIdEquation>(rawContractEquations.size());
+
+ map.put(BytecodeAnalysisIndex.indexKey(inputData.getFile(), true), idParameterEquations);
+ map.put(BytecodeAnalysisIndex.indexKey(inputData.getFile(), false), idContractEquations);
+
+
+ for (Equation<Key, Value> rawParameterEquation: rawParameterEquations) {
+ idParameterEquations.add(myConverter.convert(rawParameterEquation));
+ }
+ for (Equation<Key, Value> rawContractEquation: rawContractEquations) {
+ idContractEquations.add(myConverter.convert(rawContractEquation));
+ }
+ }
+ catch (ProcessCanceledException e) {
+ throw e;
+ }
+ catch (Throwable e) {
+ // incorrect bytecode may result in Runtime exceptions during analysis
+ // so here we suppose that exception is due to incorrect bytecode
+ LOG.debug("Unexpected Error during indexing of bytecode", e);
+ }
+ return map;
+ }
+
+ private static class ClassEquations {
+ final List<Equation<Key, Value>> parameterEquations;
+ final List<Equation<Key, Value>> contractEquations;
+
+ private ClassEquations(List<Equation<Key, Value>> parameterEquations, List<Equation<Key, Value>> contractEquations) {
+ this.parameterEquations = parameterEquations;
+ this.contractEquations = contractEquations;
+ }
+ }
+
+ public static ClassEquations processClass(final ClassReader classReader) {
+ final List<Equation<Key, Value>> parameterEquations = new ArrayList<Equation<Key, Value>>();
+ final List<Equation<Key, Value>> contractEquations = new ArrayList<Equation<Key, Value>>();
+
+ classReader.accept(new ClassVisitor(Opcodes.ASM5) {
+ private boolean stableClass;
+
+ @Override
+ public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) {
+ stableClass = (access & Opcodes.ACC_FINAL) != 0;
+ super.visit(version, access, name, signature, superName, interfaces);
+ }
+
+ @Override
+ public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
+ final MethodNode node = new MethodNode(Opcodes.ASM5, access, name, desc, signature, exceptions);
+ return new MethodVisitor(Opcodes.ASM5, node) {
+ @Override
+ public void visitEnd() {
+ super.visitEnd();
+ processMethod(classReader.getClassName(), node, stableClass);
+ }
+ };
+ }
+
+ void processMethod(final String className, final MethodNode methodNode, boolean stableClass) {
+ ProgressManager.checkCanceled();
+ Type[] argumentTypes = Type.getArgumentTypes(methodNode.desc);
+ Type resultType = Type.getReturnType(methodNode.desc);
+ int resultSort = resultType.getSort();
+ boolean isReferenceResult = resultSort == Type.OBJECT || resultSort == Type.ARRAY;
+ boolean isBooleanResult = Type.BOOLEAN_TYPE == resultType;
+ boolean isInterestingResult = isReferenceResult || isBooleanResult;
+
+ if (argumentTypes.length == 0 && !isInterestingResult) {
+ return;
+ }
+
+ Method method = new Method(className, methodNode.name, methodNode.desc);
+ int access = methodNode.access;
+ boolean stable =
+ stableClass ||
+ (access & Opcodes.ACC_FINAL) != 0 ||
+ (access & Opcodes.ACC_PRIVATE) != 0 ||
+ (access & Opcodes.ACC_STATIC) != 0 ||
+ "<init>".equals(methodNode.name);
+ try {
+ boolean added = false;
+ ControlFlowGraph graph = cfg.buildControlFlowGraph(className, methodNode);
+
+ boolean maybeLeakingParameter = false;
+ for (Type argType : argumentTypes) {
+ int argSort = argType.getSort();
+ if (argSort == Type.OBJECT || argSort == Type.ARRAY || (isInterestingResult && Type.BOOLEAN_TYPE.equals(argType))) {
+ maybeLeakingParameter = true;
+ break;
+ }
+ }
+
+ if (graph.transitions.length > 0) {
+ DFSTree dfs = cfg.buildDFSTree(graph.transitions);
+ boolean reducible = dfs.back.isEmpty() || cfg.reducible(graph, dfs);
+ if (reducible) {
+ NotNullLazyValue<TIntHashSet> resultOrigins = new NotNullLazyValue<TIntHashSet>() {
+ @NotNull
+ @Override
+ protected TIntHashSet compute() {
+ try {
+ return cfg.resultOrigins(className, methodNode);
+ }
+ catch (AnalyzerException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ };
+ boolean[] leakingParameters = maybeLeakingParameter ? cfg.leakingParameters(className, methodNode) : null;
+ boolean shouldComputeResult = isReferenceResult;
+
+ if (!shouldComputeResult && isInterestingResult && maybeLeakingParameter) {
+ loop: for (int i = 0; i < argumentTypes.length; i++) {
+ Type argType = argumentTypes[i];
+ int argSort = argType.getSort();
+ boolean isReferenceArg = argSort == Type.OBJECT || argSort == Type.ARRAY;
+ boolean isBooleanArg = Type.BOOLEAN_TYPE.equals(argType);
+ if ((isReferenceArg || isBooleanArg) && !leakingParameters[i]) {
+ shouldComputeResult = true;
+ break loop;
+ }
+ }
+ }
+
+ Equation<Key, Value> resultEquation =
+ shouldComputeResult ? new InOutAnalysis(new RichControlFlow(graph, dfs), new Out(), resultOrigins.getValue(), stable).analyze() : null;
+
+ for (int i = 0; i < argumentTypes.length; i++) {
+ Type argType = argumentTypes[i];
+ int argSort = argType.getSort();
+ boolean isReferenceArg = argSort == Type.OBJECT || argSort == Type.ARRAY;
+ boolean isBooleanArg = Type.BOOLEAN_TYPE.equals(argType);
+ if (isReferenceArg) {
+ if (leakingParameters[i]) {
+ parameterEquations.add(new NonNullInAnalysis(new RichControlFlow(graph, dfs), new In(i), stable).analyze());
+ } else {
+ parameterEquations.add(new Equation<Key, Value>(new Key(method, new In(i), stable), new Final<Key, Value>(Value.Top)));
+ }
+ }
+ if (isReferenceArg && isInterestingResult) {
+ if (leakingParameters[i]) {
+ contractEquations.add(new InOutAnalysis(new RichControlFlow(graph, dfs), new InOut(i, Value.Null), resultOrigins.getValue(), stable).analyze());
+ contractEquations.add(new InOutAnalysis(new RichControlFlow(graph, dfs), new InOut(i, Value.NotNull), resultOrigins.getValue(), stable).analyze());
+ } else {
+ contractEquations.add(new Equation<Key, Value>(new Key(method, new InOut(i, Value.Null), stable), resultEquation.rhs));
+ contractEquations.add(new Equation<Key, Value>(new Key(method, new InOut(i, Value.NotNull), stable), resultEquation.rhs));
+ }
+ }
+ if (isBooleanArg && isInterestingResult) {
+ if (leakingParameters[i]) {
+ contractEquations.add(new InOutAnalysis(new RichControlFlow(graph, dfs), new InOut(i, Value.False), resultOrigins.getValue(), stable).analyze());
+ contractEquations.add(new InOutAnalysis(new RichControlFlow(graph, dfs), new InOut(i, Value.True), resultOrigins.getValue(), stable).analyze());
+ } else {
+ contractEquations.add(new Equation<Key, Value>(new Key(method, new InOut(i, Value.False), stable), resultEquation.rhs));
+ contractEquations.add(new Equation<Key, Value>(new Key(method, new InOut(i, Value.True), stable), resultEquation.rhs));
+ }
+ }
+ }
+ if (isReferenceResult) {
+ if (resultEquation != null) {
+ contractEquations.add(resultEquation);
+ } else {
+ contractEquations.add(new InOutAnalysis(new RichControlFlow(graph, dfs), new Out(), resultOrigins.getValue(), stable).analyze());
+ }
+ }
+ added = true;
+ }
+ else {
+ LOG.debug("CFG for " + method + " is not reducible");
+ }
+ }
+
+ if (!added) {
+ method = new Method(className, methodNode.name, methodNode.desc);
+ for (int i = 0; i < argumentTypes.length; i++) {
+ Type argType = argumentTypes[i];
+ int argSort = argType.getSort();
+ boolean isReferenceArg = argSort == Type.OBJECT || argSort == Type.ARRAY;
+ boolean isBooleanArg = Type.BOOLEAN_TYPE.equals(argType);
+
+ if (isReferenceArg) {
+ parameterEquations.add(new Equation<Key, Value>(new Key(method, new In(i), stable), new Final<Key, Value>(Value.Top)));
+ }
+ if (isReferenceArg && isInterestingResult) {
+ contractEquations.add(new Equation<Key, Value>(new Key(method, new InOut(i, Value.Null), stable), new Final<Key, Value>(Value.Top)));
+ contractEquations.add(new Equation<Key, Value>(new Key(method, new InOut(i, Value.NotNull), stable), new Final<Key, Value>(Value.Top)));
+ }
+ if (isBooleanArg && isInterestingResult) {
+ contractEquations.add(new Equation<Key, Value>(new Key(method, new InOut(i, Value.False), stable), new Final<Key, Value>(Value.Top)));
+ contractEquations.add(new Equation<Key, Value>(new Key(method, new InOut(i, Value.True), stable), new Final<Key, Value>(Value.Top)));
+ }
+ }
+ if (isReferenceResult) {
+ contractEquations.add(new Equation<Key, Value>(new Key(method, new Out(), stable), new Final<Key, Value>(Value.Top)));
+ }
+ }
+ }
+ catch (ProcessCanceledException e) {
+ throw e;
+ }
+ catch (Throwable e) {
+ // incorrect bytecode may result in Runtime exceptions during analysis
+ // so here we suppose that exception is due to incorrect bytecode
+ LOG.debug("Unexpected Error during processing of " + method, e);
+ }
+ }
+ }, ClassReader.SKIP_DEBUG | ClassReader.SKIP_FRAMES);
+
+ return new ClassEquations(parameterEquations, contractEquations);
+ }
+}
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/bytecodeAnalysis/Contracts.java b/java/java-analysis-impl/src/com/intellij/codeInspection/bytecodeAnalysis/Contracts.java
new file mode 100644
index 000000000000..c837b127b74b
--- /dev/null
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/bytecodeAnalysis/Contracts.java
@@ -0,0 +1,439 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.codeInspection.bytecodeAnalysis;
+
+import gnu.trove.TIntHashSet;
+import org.jetbrains.org.objectweb.asm.Handle;
+import org.jetbrains.org.objectweb.asm.Type;
+import org.jetbrains.org.objectweb.asm.tree.*;
+import org.jetbrains.org.objectweb.asm.tree.analysis.AnalyzerException;
+import org.jetbrains.org.objectweb.asm.tree.analysis.BasicInterpreter;
+import org.jetbrains.org.objectweb.asm.tree.analysis.BasicValue;
+import org.jetbrains.org.objectweb.asm.tree.analysis.Frame;
+
+import java.util.*;
+
+import static com.intellij.codeInspection.bytecodeAnalysis.AbstractValues.*;
+import static org.jetbrains.org.objectweb.asm.Opcodes.*;
+
+class InOutAnalysis extends Analysis<Result<Key, Value>> {
+
+ final ResultUtil<Key, Value> resultUtil =
+ new ResultUtil<Key, Value>(new ELattice<Value>(Value.Bot, Value.Top));
+
+ private final InOutInterpreter interpreter;
+ private final Value inValue;
+
+ protected InOutAnalysis(RichControlFlow richControlFlow, Direction direction, TIntHashSet resultOrigins, boolean stable) {
+ super(richControlFlow, direction, stable);
+ interpreter = new InOutInterpreter(direction, richControlFlow.controlFlow.methodNode.instructions, resultOrigins);
+ inValue = direction instanceof InOut ? ((InOut)direction).inValue : null;
+ }
+
+ @Override
+ Result<Key, Value> identity() {
+ return new Final<Key, Value>(Value.Bot);
+ }
+
+ @Override
+ Result<Key, Value> combineResults(Result<Key, Value> delta, List<Result<Key, Value>> subResults) {
+ Result<Key, Value> result = null;
+ for (Result<Key, Value> subResult : subResults) {
+ if (result == null) {
+ result = subResult;
+ } else {
+ result = resultUtil.join(result, subResult);
+ }
+ }
+ return result;
+ }
+
+ @Override
+ boolean isEarlyResult(Result<Key, Value> res) {
+ if (res instanceof Final) {
+ return ((Final<?, Value>)res).value == Value.Top;
+ }
+ return false;
+ }
+
+ @Override
+ Equation<Key, Value> mkEquation(Result<Key, Value> res) {
+ return new Equation<Key, Value>(aKey, res);
+ }
+
+ private int id = 0;
+
+ @Override
+ void processState(State state) throws AnalyzerException {
+ int stateIndex = state.index;
+ Conf preConf = state.conf;
+ int insnIndex = preConf.insnIndex;
+ boolean loopEnter = dfsTree.loopEnters.contains(insnIndex);
+ Conf conf = loopEnter ? generalize(preConf) : preConf;
+ List<Conf> history = state.history;
+ boolean taken = state.taken;
+ Frame<BasicValue> frame = conf.frame;
+ AbstractInsnNode insnNode = methodNode.instructions.get(insnIndex);
+ List<Conf> nextHistory = dfsTree.loopEnters.contains(insnIndex) ? append(history, conf) : history;
+ Frame<BasicValue> nextFrame = execute(frame, insnNode);
+
+ if (interpreter.deReferenced) {
+ results.put(stateIndex, new Final<Key, Value>(Value.Bot));
+ computed.put(insnIndex, append(computed.get(insnIndex), state));
+ return;
+ }
+
+ int opcode = insnNode.getOpcode();
+ switch (opcode) {
+ case ARETURN:
+ case IRETURN:
+ case LRETURN:
+ case FRETURN:
+ case DRETURN:
+ case RETURN:
+ BasicValue stackTop = popValue(frame);
+ if (FalseValue == stackTop) {
+ results.put(stateIndex, new Final<Key, Value>(Value.False));
+ computed.put(insnIndex, append(computed.get(insnIndex), state));
+ }
+ else if (TrueValue == stackTop) {
+ results.put(stateIndex, new Final<Key, Value>(Value.True));
+ computed.put(insnIndex, append(computed.get(insnIndex), state));
+ }
+ else if (NullValue == stackTop) {
+ results.put(stateIndex, new Final<Key, Value>(Value.Null));
+ computed.put(insnIndex, append(computed.get(insnIndex), state));
+ }
+ else if (stackTop instanceof NotNullValue) {
+ results.put(stateIndex, new Final<Key, Value>(Value.NotNull));
+ computed.put(insnIndex, append(computed.get(insnIndex), state));
+ }
+ else if (stackTop instanceof ParamValue) {
+ results.put(stateIndex, new Final<Key, Value>(inValue));
+ computed.put(insnIndex, append(computed.get(insnIndex), state));
+ }
+ else if (stackTop instanceof CallResultValue) {
+ Set<Key> keys = ((CallResultValue) stackTop).inters;
+ results.put(stateIndex, new Pending<Key, Value>(Collections.singleton(new Product<Key, Value>(Value.Top, keys))));
+ computed.put(insnIndex, append(computed.get(insnIndex), state));
+ }
+ else {
+ earlyResult = new Final<Key, Value>(Value.Top);
+ }
+ return;
+ case ATHROW:
+ results.put(stateIndex, new Final<Key, Value>(Value.Bot));
+ computed.put(insnIndex, append(computed.get(insnIndex), state));
+ return;
+ default:
+ }
+
+ if (opcode == IFNONNULL && popValue(frame) instanceof ParamValue) {
+ int nextInsnIndex = inValue == Value.Null ? insnIndex + 1 : methodNode.instructions.indexOf(((JumpInsnNode)insnNode).label);
+ State nextState = new State(++id, new Conf(nextInsnIndex, nextFrame), nextHistory, true, false);
+ pending.push(new MakeResult<Result<Key, Value>>(state, myIdentity, new int[]{nextState.index}));
+ pending.push(new ProceedState<Result<Key, Value>>(nextState));
+ return;
+ }
+
+ if (opcode == IFNULL && popValue(frame) instanceof ParamValue) {
+ int nextInsnIndex = inValue == Value.NotNull ? insnIndex + 1 : methodNode.instructions.indexOf(((JumpInsnNode)insnNode).label);
+ State nextState = new State(++id, new Conf(nextInsnIndex, nextFrame), nextHistory, true, false);
+ pending.push(new MakeResult<Result<Key, Value>>(state, myIdentity, new int[]{nextState.index}));
+ pending.push(new ProceedState<Result<Key, Value>>(nextState));
+ return;
+ }
+
+ if (opcode == IFEQ && popValue(frame) == InstanceOfCheckValue && inValue == Value.Null) {
+ int nextInsnIndex = methodNode.instructions.indexOf(((JumpInsnNode)insnNode).label);
+ State nextState = new State(++id, new Conf(nextInsnIndex, nextFrame), nextHistory, true, false);
+ pending.push(new MakeResult<Result<Key, Value>>(state, myIdentity, new int[]{nextState.index}));
+ pending.push(new ProceedState<Result<Key, Value>>(nextState));
+ return;
+ }
+
+ if (opcode == IFNE && popValue(frame) == InstanceOfCheckValue && inValue == Value.Null) {
+ int nextInsnIndex = insnIndex + 1;
+ State nextState = new State(++id, new Conf(nextInsnIndex, nextFrame), nextHistory, true, false);
+ pending.push(new MakeResult<Result<Key, Value>>(state, myIdentity, new int[]{nextState.index}));
+ pending.push(new ProceedState<Result<Key, Value>>(nextState));
+ return;
+ }
+
+ if (opcode == IFEQ && popValue(frame) instanceof ParamValue) {
+ int nextInsnIndex = inValue == Value.True ? insnIndex + 1 : methodNode.instructions.indexOf(((JumpInsnNode)insnNode).label);
+ State nextState = new State(++id, new Conf(nextInsnIndex, nextFrame), nextHistory, true, false);
+ pending.push(new MakeResult<Result<Key, Value>>(state, myIdentity, new int[]{nextState.index}));
+ pending.push(new ProceedState<Result<Key, Value>>(nextState));
+ return;
+ }
+
+ if (opcode == IFNE && popValue(frame) instanceof ParamValue) {
+ int nextInsnIndex = inValue == Value.False ? insnIndex + 1 : methodNode.instructions.indexOf(((JumpInsnNode)insnNode).label);
+ State nextState = new State(++id, new Conf(nextInsnIndex, nextFrame), nextHistory, true, false);
+ pending.push(new MakeResult<Result<Key, Value>>(state, myIdentity, new int[]{nextState.index}));
+ pending.push(new ProceedState<Result<Key, Value>>(nextState));
+ return;
+ }
+
+ // general case
+ int[] nextInsnIndices = controlFlow.transitions[insnIndex];
+ List<State> nextStates = new ArrayList<State>(nextInsnIndices.length);
+ int[] subIndices = new int[nextInsnIndices.length];
+
+ for (int i = 0; i < nextInsnIndices.length; i++) {
+ int nextInsnIndex = nextInsnIndices[i];
+ Frame<BasicValue> nextFrame1 = nextFrame;
+ if (controlFlow.errorTransitions.contains(new Edge(insnIndex, nextInsnIndex))) {
+ nextFrame1 = new Frame<BasicValue>(frame);
+ nextFrame1.clearStack();
+ nextFrame1.push(new BasicValue(Type.getType("java/lang/Throwable")));
+ }
+ nextStates.add(new State(++id, new Conf(nextInsnIndex, nextFrame1), nextHistory, taken, false));
+ subIndices[i] = id;
+ }
+
+ pending.push(new MakeResult<Result<Key, Value>>(state, myIdentity, subIndices));
+ for (State nextState : nextStates) {
+ pending.push(new ProceedState<Result<Key, Value>>(nextState));
+ }
+ }
+
+ private Frame<BasicValue> execute(Frame<BasicValue> frame, AbstractInsnNode insnNode) throws AnalyzerException {
+ interpreter.deReferenced = false;
+ switch (insnNode.getType()) {
+ case AbstractInsnNode.LABEL:
+ case AbstractInsnNode.LINE:
+ case AbstractInsnNode.FRAME:
+ return frame;
+ default:
+ Frame<BasicValue> nextFrame = new Frame<BasicValue>(frame);
+ nextFrame.execute(insnNode, interpreter);
+ return nextFrame;
+ }
+ }
+
+ private static Conf generalize(Conf conf) {
+ Frame<BasicValue> frame = new Frame<BasicValue>(conf.frame);
+ for (int i = 0; i < frame.getLocals(); i++) {
+ BasicValue value = frame.getLocal(i);
+ Class<?> valueClass = value.getClass();
+ if (valueClass != BasicValue.class && valueClass != ParamValue.class) {
+ frame.setLocal(i, new BasicValue(value.getType()));
+ }
+ }
+
+ BasicValue[] stack = new BasicValue[frame.getStackSize()];
+ for (int i = 0; i < frame.getStackSize(); i++) {
+ stack[i] = frame.getStack(i);
+ }
+ frame.clearStack();
+
+ for (BasicValue value : stack) {
+ Class<?> valueClass = value.getClass();
+ if (valueClass != BasicValue.class && valueClass != ParamValue.class) {
+ frame.push(new BasicValue(value.getType()));
+ } else {
+ frame.push(value);
+ }
+ }
+
+ return new Conf(conf.insnIndex, frame);
+ }
+}
+
+class InOutInterpreter extends BasicInterpreter {
+ final Direction direction;
+ final InsnList insns;
+ final TIntHashSet resultOrigins;
+ final boolean nullAnalysis;
+
+ boolean deReferenced = false;
+
+ InOutInterpreter(Direction direction, InsnList insns, TIntHashSet resultOrigins) {
+ this.direction = direction;
+ this.insns = insns;
+ this.resultOrigins = resultOrigins;
+ nullAnalysis = (direction instanceof InOut) && (((InOut)direction).inValue) == Value.Null;
+ }
+
+ @Override
+ public BasicValue newOperation(AbstractInsnNode insn) throws AnalyzerException {
+ boolean propagate = resultOrigins.contains(insns.indexOf(insn));
+ if (propagate) {
+ switch (insn.getOpcode()) {
+ case ICONST_0:
+ return FalseValue;
+ case ICONST_1:
+ return TrueValue;
+ case ACONST_NULL:
+ return NullValue;
+ case LDC:
+ Object cst = ((LdcInsnNode)insn).cst;
+ if (cst instanceof Type) {
+ Type type = (Type)cst;
+ if (type.getSort() == Type.OBJECT || type.getSort() == Type.ARRAY) {
+ return new NotNullValue(Type.getObjectType("java/lang/Class"));
+ }
+ if (type.getSort() == Type.METHOD) {
+ return new NotNullValue(Type.getObjectType("java/lang/invoke/MethodType"));
+ }
+ }
+ else if (cst instanceof String) {
+ return new NotNullValue(Type.getObjectType("java/lang/String"));
+ }
+ else if (cst instanceof Handle) {
+ return new NotNullValue(Type.getObjectType("java/lang/invoke/MethodHandle"));
+ }
+ break;
+ case NEW:
+ return new NotNullValue(Type.getObjectType(((TypeInsnNode)insn).desc));
+ default:
+ }
+ }
+ return super.newOperation(insn);
+ }
+
+ @Override
+ public BasicValue unaryOperation(AbstractInsnNode insn, BasicValue value) throws AnalyzerException {
+ boolean propagate = resultOrigins.contains(insns.indexOf(insn));
+ switch (insn.getOpcode()) {
+ case GETFIELD:
+ case ARRAYLENGTH:
+ case MONITORENTER:
+ if (nullAnalysis && value instanceof ParamValue) {
+ deReferenced = true;
+ }
+ return super.unaryOperation(insn, value);
+ case CHECKCAST:
+ if (value instanceof ParamValue) {
+ return new ParamValue(Type.getObjectType(((TypeInsnNode)insn).desc));
+ }
+ break;
+ case INSTANCEOF:
+ if (value instanceof ParamValue) {
+ return InstanceOfCheckValue;
+ }
+ break;
+ case NEWARRAY:
+ case ANEWARRAY:
+ if (propagate) {
+ return new NotNullValue(super.unaryOperation(insn, value).getType());
+ }
+ break;
+ default:
+ }
+ return super.unaryOperation(insn, value);
+ }
+
+ @Override
+ public BasicValue binaryOperation(AbstractInsnNode insn, BasicValue value1, BasicValue value2) throws AnalyzerException {
+ switch (insn.getOpcode()) {
+ case IALOAD:
+ case LALOAD:
+ case FALOAD:
+ case DALOAD:
+ case AALOAD:
+ case BALOAD:
+ case CALOAD:
+ case SALOAD:
+ case PUTFIELD:
+ if (nullAnalysis && value1 instanceof ParamValue) {
+ deReferenced = true;
+ }
+ break;
+ default:
+ }
+ return super.binaryOperation(insn, value1, value2);
+ }
+
+ @Override
+ public BasicValue ternaryOperation(AbstractInsnNode insn, BasicValue value1, BasicValue value2, BasicValue value3) throws AnalyzerException {
+ switch (insn.getOpcode()) {
+ case IASTORE:
+ case LASTORE:
+ case FASTORE:
+ case DASTORE:
+ case AASTORE:
+ case BASTORE:
+ case CASTORE:
+ case SASTORE:
+ if (nullAnalysis && value1 instanceof ParamValue) {
+ deReferenced = true;
+ }
+ default:
+ }
+ return super.ternaryOperation(insn, value1, value2, value3);
+ }
+
+ @Override
+ public BasicValue naryOperation(AbstractInsnNode insn, List<? extends BasicValue> values) throws AnalyzerException {
+ boolean propagate = resultOrigins.contains(insns.indexOf(insn));
+ int opCode = insn.getOpcode();
+ int shift = opCode == INVOKESTATIC ? 0 : 1;
+
+ switch (opCode) {
+ case INVOKESPECIAL:
+ case INVOKEINTERFACE:
+ case INVOKEVIRTUAL:
+ if (nullAnalysis && values.get(0) instanceof ParamValue) {
+ deReferenced = true;
+ return super.naryOperation(insn, values);
+ }
+ }
+
+ if (propagate) {
+ switch (opCode) {
+ case INVOKESTATIC:
+ case INVOKESPECIAL:
+ case INVOKEVIRTUAL:
+ case INVOKEINTERFACE:
+ boolean stable = opCode == INVOKESTATIC || opCode == INVOKESPECIAL;
+ MethodInsnNode mNode = (MethodInsnNode)insn;
+ Method method = new Method(mNode.owner, mNode.name, mNode.desc);
+ Type retType = Type.getReturnType(mNode.desc);
+ boolean isRefRetType = retType.getSort() == Type.OBJECT || retType.getSort() == Type.ARRAY;
+ if (!Type.VOID_TYPE.equals(retType)) {
+ if (direction instanceof InOut) {
+ InOut inOut = (InOut)direction;
+ HashSet<Key> keys = new HashSet<Key>();
+ for (int i = shift; i < values.size(); i++) {
+ if (values.get(i) instanceof ParamValue) {
+ keys.add(new Key(method, new InOut(i - shift, inOut.inValue), stable));
+ }
+ }
+ if (isRefRetType) {
+ keys.add(new Key(method, new Out(), stable));
+ }
+ if (!keys.isEmpty()) {
+ return new CallResultValue(retType, keys);
+ }
+ }
+ else if (isRefRetType) {
+ HashSet<Key> keys = new HashSet<Key>();
+ keys.add(new Key(method, new Out(), stable));
+ return new CallResultValue(retType, keys);
+ }
+ }
+ break;
+ case MULTIANEWARRAY:
+ return new NotNullValue(super.naryOperation(insn, values).getType());
+ default:
+ }
+ }
+ return super.naryOperation(insn, values);
+ }
+}
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/bytecodeAnalysis/ControlFlow.java b/java/java-analysis-impl/src/com/intellij/codeInspection/bytecodeAnalysis/ControlFlow.java
new file mode 100644
index 000000000000..910d75b9a57f
--- /dev/null
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/bytecodeAnalysis/ControlFlow.java
@@ -0,0 +1,1030 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.codeInspection.bytecodeAnalysis;
+
+import gnu.trove.TIntArrayList;
+import gnu.trove.TIntHashSet;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.org.objectweb.asm.Opcodes;
+import org.jetbrains.org.objectweb.asm.Type;
+import org.jetbrains.org.objectweb.asm.tree.*;
+import org.jetbrains.org.objectweb.asm.tree.analysis.*;
+import org.jetbrains.org.objectweb.asm.tree.analysis.Value;
+
+import java.util.*;
+
+import static org.jetbrains.org.objectweb.asm.Opcodes.*;
+
+final class cfg {
+ static ControlFlowGraph buildControlFlowGraph(String className, MethodNode methodNode) throws AnalyzerException {
+ return new ControlFlowBuilder(className, methodNode).buildCFG();
+ }
+
+ static TIntHashSet resultOrigins(String className, MethodNode methodNode) throws AnalyzerException {
+ Frame<SourceValue>[] frames = new Analyzer<SourceValue>(MININAL_ORIGIN_INTERPRETER).analyze(className, methodNode);
+ InsnList insns = methodNode.instructions;
+ TIntHashSet result = new TIntHashSet();
+ for (int i = 0; i < frames.length; i++) {
+ AbstractInsnNode insnNode = insns.get(i);
+ Frame<SourceValue> frame = frames[i];
+ if (frame != null) {
+ switch (insnNode.getOpcode()) {
+ case ARETURN:
+ case IRETURN:
+ case LRETURN:
+ case FRETURN:
+ case DRETURN:
+ for (AbstractInsnNode sourceInsn : frame.pop().insns) {
+ result.add(insns.indexOf(sourceInsn));
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+ }
+ return result;
+ }
+
+ static boolean[] leakingParameters(String className, MethodNode methodNode) throws AnalyzerException {
+ Frame<ParamsValue>[] frames = new Analyzer<ParamsValue>(new ParametersUsage(methodNode)).analyze(className, methodNode);
+ InsnList insns = methodNode.instructions;
+ LeakingParametersCollector collector = new LeakingParametersCollector(methodNode);
+ for (int i = 0; i < frames.length; i++) {
+ AbstractInsnNode insnNode = insns.get(i);
+ Frame<ParamsValue> frame = frames[i];
+ if (frame != null) {
+ switch (insnNode.getType()) {
+ case AbstractInsnNode.LABEL:
+ case AbstractInsnNode.LINE:
+ case AbstractInsnNode.FRAME:
+ break;
+ default:
+ frame.execute(insnNode, collector);
+ }
+ }
+ }
+ return collector.leaking;
+ }
+
+ static final Interpreter<SourceValue> MININAL_ORIGIN_INTERPRETER = new SourceInterpreter() {
+ final SourceValue[] sourceVals = {new SourceValue(1), new SourceValue(2)};
+
+ @Override
+ public SourceValue newOperation(AbstractInsnNode insn) {
+ SourceValue result = super.newOperation(insn);
+ switch (insn.getOpcode()) {
+ case ICONST_0:
+ case ICONST_1:
+ case ACONST_NULL:
+ case LDC:
+ case NEW:
+ return result;
+ default:
+ return sourceVals[result.getSize() - 1];
+ }
+ }
+
+ @Override
+ public SourceValue unaryOperation(AbstractInsnNode insn, SourceValue value) {
+ SourceValue result = super.unaryOperation(insn, value);
+ switch (insn.getOpcode()) {
+ case CHECKCAST:
+ case NEWARRAY:
+ case ANEWARRAY:
+ return result;
+ default:
+ return sourceVals[result.getSize() - 1];
+ }
+ }
+
+ @Override
+ public SourceValue binaryOperation(AbstractInsnNode insn, SourceValue value1, SourceValue value2) {
+ switch (insn.getOpcode()) {
+ case LALOAD:
+ case DALOAD:
+ case LADD:
+ case DADD:
+ case LSUB:
+ case DSUB:
+ case LMUL:
+ case DMUL:
+ case LDIV:
+ case DDIV:
+ case LREM:
+ case LSHL:
+ case LSHR:
+ case LUSHR:
+ case LAND:
+ case LOR:
+ case LXOR:
+ return sourceVals[1];
+ default:
+ return sourceVals[0];
+ }
+ }
+
+ @Override
+ public SourceValue ternaryOperation(AbstractInsnNode insn, SourceValue value1, SourceValue value2, SourceValue value3) {
+ return sourceVals[0];
+ }
+
+ @Override
+ public SourceValue copyOperation(AbstractInsnNode insn, SourceValue value) {
+ return value;
+ }
+
+ };
+
+ private interface Action {}
+ private static class MarkScanned implements Action {
+ final int node;
+ private MarkScanned(int node) {
+ this.node = node;
+ }
+ }
+ private static class ExamineEdge implements Action {
+ final int from;
+ final int to;
+
+ private ExamineEdge(int from, int to) {
+ this.from = from;
+ this.to = to;
+ }
+ }
+
+ // Graphs: Theory and Algorithms. by K. Thulasiraman , M. N. S. Swamy (1992)
+ // 11.7.2 DFS of a directed graph
+ static DFSTree buildDFSTree(int[][] transitions) {
+ Set<Edge> tree = new HashSet<Edge>();
+ Set<Edge> forward = new HashSet<Edge>();
+ Set<Edge> back = new HashSet<Edge>();
+ Set<Edge> cross = new HashSet<Edge>();
+
+ boolean[] marked = new boolean[transitions.length];
+ boolean[] scanned = new boolean[transitions.length];
+ int[] preOrder = new int[transitions.length];
+ int[] postOrder = new int[transitions.length];
+
+ int entered = 0;
+ int completed = 0;
+
+ Deque<Action> stack = new LinkedList<Action>();
+ Set<Integer> loopEnters = new HashSet<Integer>();
+
+ // enter 0
+ entered ++;
+ preOrder[0] = entered;
+ marked[0] = true;
+ stack.push(new MarkScanned(0));
+ for (int to : transitions[0]) {
+ stack.push(new ExamineEdge(0, to));
+ }
+
+ while (!stack.isEmpty()) {
+ Action action = stack.pop();
+ if (action instanceof MarkScanned) {
+ MarkScanned markScannedAction = (MarkScanned) action;
+ completed ++;
+ postOrder[markScannedAction.node] = completed;
+ scanned[markScannedAction.node] = true;
+ }
+ else {
+ ExamineEdge examineEdgeAction = (ExamineEdge) action;
+ int from = examineEdgeAction.from;
+ int to = examineEdgeAction.to;
+ if (!marked[to]) {
+ tree.add(new Edge(from, to));
+ // enter to
+ entered ++;
+ preOrder[to] = entered;
+ marked[to] = true;
+ stack.push(new MarkScanned(to));
+ for (int to1 : transitions[to]) {
+ stack.push(new ExamineEdge(to, to1));
+ }
+ }
+ else if (preOrder[to] > preOrder[from]) {
+ forward.add(new Edge(from, to));
+ }
+ else if (preOrder[to] < preOrder[from] && !scanned[to]) {
+ back.add(new Edge(from, to));
+ loopEnters.add(to);
+ } else {
+ cross.add(new Edge(from, to));
+ }
+ }
+ }
+
+ return new DFSTree(preOrder, postOrder, tree, forward, back, cross, loopEnters);
+ }
+
+ // Tarjan. Testing flow graph reducibility.
+ // Journal of Computer and System Sciences 9.3 (1974): 355-365.
+ static boolean reducible(ControlFlowGraph cfg, DFSTree dfs) {
+ int size = cfg.transitions.length;
+ HashSet<Integer>[] cycles = new HashSet[size];
+ HashSet<Integer>[] nonCycles = new HashSet[size];
+ int[] collapsedTo = new int[size];
+ for (int i = 0; i < size; i++) {
+ cycles[i] = new HashSet<Integer>();
+ nonCycles[i] = new HashSet<Integer>();
+ collapsedTo[i] = i;
+ }
+
+ for (Edge edge : dfs.back) {
+ cycles[edge.to].add(edge.from);
+ }
+ for (Edge edge : dfs.tree) {
+ nonCycles[edge.to].add(edge.from);
+ }
+ for (Edge edge : dfs.forward) {
+ nonCycles[edge.to].add(edge.from);
+ }
+ for (Edge edge : dfs.cross) {
+ nonCycles[edge.to].add(edge.from);
+ }
+
+ for (int w = size - 1; w >= 0 ; w--) {
+ HashSet<Integer> p = new HashSet<Integer>(cycles[w]);
+ Queue<Integer> queue = new LinkedList<Integer>(cycles[w]);
+
+ while (!queue.isEmpty()) {
+ int x = queue.remove();
+ for (int y : nonCycles[x]) {
+ int y1 = collapsedTo[y];
+ if (!dfs.isDescendant(y1, w)) {
+ return false;
+ }
+ if (y1 != w && p.add(y1)) {
+ queue.add(y1);
+ }
+ }
+ }
+
+ for (int x : p) {
+ collapsedTo[x] = w;
+ }
+ }
+
+ return true;
+ }
+
+}
+
+final class Edge {
+ final int from, to;
+
+ Edge(int from, int to) {
+ this.from = from;
+ this.to = to;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof Edge)) {
+ return false;
+ }
+ Edge edge = (Edge) o;
+ return from == edge.from && to == edge.to;
+ }
+
+ @Override
+ public int hashCode() {
+ return 31 * from + to;
+ }
+
+ @Override
+ public String toString() {
+ return "(" + from + "," + to + ")";
+ }
+}
+
+final class ControlFlowGraph {
+ final String className;
+ final MethodNode methodNode;
+ final int[][] transitions;
+ final Set<Edge> errorTransitions;
+
+ ControlFlowGraph(String className, MethodNode methodNode, int[][] transitions, Set<Edge> errorTransitions) {
+ this.className = className;
+ this.methodNode = methodNode;
+ this.transitions = transitions;
+ this.errorTransitions = errorTransitions;
+ }
+
+ @Override
+ public String toString() {
+ return "CFG(" +
+ Arrays.toString(transitions) + "," +
+ errorTransitions +
+ ')';
+ }
+}
+
+final class RichControlFlow {
+ final ControlFlowGraph controlFlow;
+ final DFSTree dfsTree;
+
+ RichControlFlow(ControlFlowGraph controlFlow, DFSTree dfsTree) {
+ this.controlFlow = controlFlow;
+ this.dfsTree = dfsTree;
+ }
+}
+
+final class ControlFlowBuilder extends CfgAnalyzer {
+ final String className;
+ final MethodNode methodNode;
+ final TIntArrayList[] transitions;
+ final Set<Edge> errorTransitions;
+
+ ControlFlowBuilder(String className, MethodNode methodNode) {
+ this.className = className;
+ this.methodNode = methodNode;
+ transitions = new TIntArrayList[methodNode.instructions.size()];
+ for (int i = 0; i < transitions.length; i++) {
+ transitions[i] = new TIntArrayList();
+ }
+ errorTransitions = new HashSet<Edge>();
+ }
+
+ final ControlFlowGraph buildCFG() throws AnalyzerException {
+ if ((methodNode.access & (ACC_ABSTRACT | ACC_NATIVE)) == 0) {
+ analyze(methodNode);
+ }
+ int[][] resultTransitions = new int[transitions.length][];
+ for (int i = 0; i < resultTransitions.length; i++) {
+ resultTransitions[i] = transitions[i].toNativeArray();
+ }
+ return new ControlFlowGraph(className, methodNode, resultTransitions, errorTransitions);
+ }
+
+ @Override
+ protected final void newControlFlowEdge(int insn, int successor) {
+ if (!transitions[insn].contains(successor)) {
+ transitions[insn].add(successor);
+ }
+ }
+
+ @Override
+ protected final boolean newControlFlowExceptionEdge(int insn, int successor) {
+ if (!transitions[insn].contains(successor)) {
+ transitions[insn].add(successor);
+ errorTransitions.add(new Edge(insn, successor));
+ }
+ return true;
+ }
+}
+
+final class DFSTree {
+ final int[] preOrder, postOrder;
+ final Set<Edge> tree, forward, back, cross;
+ final Set<Integer> loopEnters;
+
+ DFSTree(int[] preOrder,
+ int[] postOrder,
+ Set<Edge> tree,
+ Set<Edge> forward,
+ Set<Edge> back,
+ Set<Edge> cross,
+ Set<Integer> loopEnters) {
+ this.preOrder = preOrder;
+ this.postOrder = postOrder;
+ this.tree = tree;
+ this.forward = forward;
+ this.back = back;
+ this.cross = cross;
+ this.loopEnters = loopEnters;
+ }
+
+ final boolean isDescendant(int child, int parent) {
+ return preOrder[parent] <= preOrder[child] && postOrder[child] <= postOrder[parent];
+ }
+}
+
+final class ParamsValue implements Value {
+ @NotNull final boolean[] params;
+ final int size;
+
+ ParamsValue(@NotNull boolean[] params, int size) {
+ this.params = params;
+ this.size = size;
+ }
+
+ @Override
+ public int getSize() {
+ return size;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null) return false;
+ ParamsValue that = (ParamsValue)o;
+ return (this.size == that.size && Arrays.equals(this.params, that.params));
+ }
+
+ @Override
+ public int hashCode() {
+ return 31 * Arrays.hashCode(params) + size;
+ }
+}
+
+class ParametersUsage extends Interpreter<ParamsValue> {
+ final ParamsValue val1;
+ final ParamsValue val2;
+ int called = -1;
+ final int rangeStart;
+ final int rangeEnd;
+ final int arity;
+ final int shift;
+
+ ParametersUsage(MethodNode methodNode) {
+ super(ASM5);
+ arity = Type.getArgumentTypes(methodNode.desc).length;
+ boolean[] emptyParams = new boolean[arity];
+ val1 = new ParamsValue(emptyParams, 1);
+ val2 = new ParamsValue(emptyParams, 2);
+
+ shift = (methodNode.access & ACC_STATIC) == 0 ? 2 : 1;
+ rangeStart = shift;
+ rangeEnd = arity + shift;
+ }
+
+ @Override
+ public ParamsValue newValue(Type type) {
+ if (type == null) return val1;
+ called++;
+ if (type == Type.VOID_TYPE) return null;
+ if (called < rangeEnd && rangeStart <= called) {
+ boolean[] params = new boolean[arity];
+ params[called - shift] = true;
+ return type.getSize() == 1 ? new ParamsValue(params, 1) : new ParamsValue(params, 2);
+ }
+ else {
+ return type.getSize() == 1 ? val1 : val2;
+ }
+ }
+
+ @Override
+ public ParamsValue newOperation(final AbstractInsnNode insn) {
+ int size;
+ switch (insn.getOpcode()) {
+ case LCONST_0:
+ case LCONST_1:
+ case DCONST_0:
+ case DCONST_1:
+ size = 2;
+ break;
+ case LDC:
+ Object cst = ((LdcInsnNode) insn).cst;
+ size = cst instanceof Long || cst instanceof Double ? 2 : 1;
+ break;
+ case GETSTATIC:
+ size = Type.getType(((FieldInsnNode) insn).desc).getSize();
+ break;
+ default:
+ size = 1;
+ }
+ return size == 1 ? val1 : val2;
+ }
+
+ @Override
+ public ParamsValue copyOperation(AbstractInsnNode insn, ParamsValue value) {
+ return value;
+ }
+
+ @Override
+ public ParamsValue unaryOperation(AbstractInsnNode insn, ParamsValue value) {
+ int size;
+ switch (insn.getOpcode()) {
+ case CHECKCAST:
+ return new ParamsValue(value.params, Type.getObjectType(((TypeInsnNode)insn).desc).getSize());
+ case LNEG:
+ case DNEG:
+ case I2L:
+ case I2D:
+ case L2D:
+ case F2L:
+ case F2D:
+ case D2L:
+ size = 2;
+ break;
+ case GETFIELD:
+ size = Type.getType(((FieldInsnNode) insn).desc).getSize();
+ break;
+ default:
+ size = 1;
+ }
+ return size == 1 ? val1 : val2;
+ }
+
+ @Override
+ public ParamsValue binaryOperation(AbstractInsnNode insn, ParamsValue value1, ParamsValue value2) {
+ int size;
+ switch (insn.getOpcode()) {
+ case LALOAD:
+ case DALOAD:
+ case LADD:
+ case DADD:
+ case LSUB:
+ case DSUB:
+ case LMUL:
+ case DMUL:
+ case LDIV:
+ case DDIV:
+ case LREM:
+ case DREM:
+ case LSHL:
+ case LSHR:
+ case LUSHR:
+ case LAND:
+ case LOR:
+ case LXOR:
+ size = 2;
+ break;
+ default:
+ size = 1;
+ }
+ return size == 1 ? val1 : val2;
+ }
+
+ @Override
+ public ParamsValue ternaryOperation(AbstractInsnNode insn, ParamsValue value1, ParamsValue value2, ParamsValue value3) {
+ return val1;
+ }
+
+ @Override
+ public ParamsValue naryOperation(AbstractInsnNode insn, List<? extends ParamsValue> values) {
+ int size;
+ int opcode = insn.getOpcode();
+ if (opcode == MULTIANEWARRAY) {
+ size = 1;
+ } else {
+ String desc = (opcode == INVOKEDYNAMIC) ? ((InvokeDynamicInsnNode) insn).desc : ((MethodInsnNode) insn).desc;
+ size = Type.getReturnType(desc).getSize();
+ }
+ return size == 1 ? val1 : val2;
+ }
+
+ @Override
+ public void returnOperation(AbstractInsnNode insn, ParamsValue value, ParamsValue expected) {}
+
+ @Override
+ public ParamsValue merge(ParamsValue v1, ParamsValue v2) {
+ if (v1.equals(v2)) return v1;
+ boolean[] params = new boolean[arity];
+ boolean[] params1 = v1.params;
+ boolean[] params2 = v2.params;
+ for (int i = 0; i < arity; i++) {
+ params[i] = params1[i] || params2[i];
+ }
+ return new ParamsValue(params, Math.min(v1.size, v2.size));
+ }
+}
+
+class LeakingParametersCollector extends ParametersUsage {
+ final boolean[] leaking;
+ LeakingParametersCollector(MethodNode methodNode) {
+ super(methodNode);
+ leaking = new boolean[arity];
+ }
+
+ @Override
+ public ParamsValue unaryOperation(AbstractInsnNode insn, ParamsValue value) {
+ switch (insn.getOpcode()) {
+ case GETFIELD:
+ case ARRAYLENGTH:
+ case MONITORENTER:
+ case INSTANCEOF:
+ case IRETURN:
+ case ARETURN:
+ case IFNONNULL:
+ case IFNULL:
+ case IFEQ:
+ case IFNE:
+ boolean[] params = value.params;
+ for (int i = 0; i < arity; i++) {
+ leaking[i] |= params[i];
+ }
+ break;
+ default:
+ }
+ return super.unaryOperation(insn, value);
+ }
+
+ @Override
+ public ParamsValue binaryOperation(AbstractInsnNode insn, ParamsValue value1, ParamsValue value2) {
+ switch (insn.getOpcode()) {
+ case IALOAD:
+ case LALOAD:
+ case FALOAD:
+ case DALOAD:
+ case AALOAD:
+ case BALOAD:
+ case CALOAD:
+ case SALOAD:
+ case PUTFIELD:
+ boolean[] params = value1.params;
+ for (int i = 0; i < arity; i++) {
+ leaking[i] |= params[i];
+ }
+ break;
+ default:
+ }
+ return super.binaryOperation(insn, value1, value2);
+ }
+
+ @Override
+ public ParamsValue ternaryOperation(AbstractInsnNode insn, ParamsValue value1, ParamsValue value2, ParamsValue value3) {
+ switch (insn.getOpcode()) {
+ case IASTORE:
+ case LASTORE:
+ case FASTORE:
+ case DASTORE:
+ case AASTORE:
+ case BASTORE:
+ case CASTORE:
+ case SASTORE:
+ boolean[] params = value1.params;
+ for (int i = 0; i < arity; i++) {
+ leaking[i] |= params[i];
+ }
+ break;
+ default:
+ }
+ return super.ternaryOperation(insn, value1, value2, value3);
+ }
+
+ @Override
+ public ParamsValue naryOperation(AbstractInsnNode insn, List<? extends ParamsValue> values) {
+ switch (insn.getOpcode()) {
+ case INVOKESTATIC:
+ case INVOKESPECIAL:
+ case INVOKEVIRTUAL:
+ case INVOKEINTERFACE:
+ for (ParamsValue value : values) {
+ boolean[] params = value.params;
+ for (int i = 0; i < arity; i++) {
+ leaking[i] |= params[i];
+ }
+ }
+ break;
+ default:
+ }
+ return super.naryOperation(insn, values);
+ }
+}
+
+/**
+ * Specialized lite version of {@link org.jetbrains.org.objectweb.asm.tree.analysis.Analyzer}.
+ * Calculation of fix-point of frames is removed, since frames are not needed to build control flow graph.
+ * So, the main point here is handling of subroutines (jsr) and try-catch-finally blocks.
+ */
+class CfgAnalyzer implements Opcodes {
+ static class Subroutine {
+
+ LabelNode start;
+
+ boolean[] access;
+
+ List<JumpInsnNode> callers;
+
+ private Subroutine() {
+ }
+
+ Subroutine(final LabelNode start, final int maxLocals,
+ final JumpInsnNode caller) {
+ this.start = start;
+ this.access = new boolean[maxLocals];
+ this.callers = new ArrayList<JumpInsnNode>();
+ callers.add(caller);
+ }
+
+ public Subroutine copy() {
+ Subroutine result = new Subroutine();
+ result.start = start;
+ result.access = new boolean[access.length];
+ System.arraycopy(access, 0, result.access, 0, access.length);
+ result.callers = new ArrayList<JumpInsnNode>(callers);
+ return result;
+ }
+
+ public boolean merge(final Subroutine subroutine) throws AnalyzerException {
+ boolean changes = false;
+ for (int i = 0; i < access.length; ++i) {
+ if (subroutine.access[i] && !access[i]) {
+ access[i] = true;
+ changes = true;
+ }
+ }
+ if (subroutine.start == start) {
+ for (int i = 0; i < subroutine.callers.size(); ++i) {
+ JumpInsnNode caller = subroutine.callers.get(i);
+ if (!callers.contains(caller)) {
+ callers.add(caller);
+ changes = true;
+ }
+ }
+ }
+ return changes;
+ }
+ }
+ private int n;
+ private InsnList insns;
+ private List<TryCatchBlockNode>[] handlers;
+ private Subroutine[] subroutines;
+ private boolean[] wasQueued;
+ private boolean[] queued;
+ private int[] queue;
+ private int top;
+
+ public void analyze(final MethodNode m) throws AnalyzerException {
+ n = m.instructions.size();
+ insns = m.instructions;
+ handlers = (List<TryCatchBlockNode>[]) new List<?>[n];
+ subroutines = new Subroutine[n];
+ queued = new boolean[n];
+ wasQueued = new boolean[n];
+ queue = new int[n];
+ top = 0;
+
+ // computes exception handlers for each instruction
+ for (int i = 0; i < m.tryCatchBlocks.size(); ++i) {
+ TryCatchBlockNode tcb = m.tryCatchBlocks.get(i);
+ int begin = insns.indexOf(tcb.start);
+ int end = insns.indexOf(tcb.end);
+ for (int j = begin; j < end; ++j) {
+ List<TryCatchBlockNode> insnHandlers = handlers[j];
+ if (insnHandlers == null) {
+ insnHandlers = new ArrayList<TryCatchBlockNode>();
+ handlers[j] = insnHandlers;
+ }
+ insnHandlers.add(tcb);
+ }
+ }
+
+ // computes the subroutine for each instruction:
+ Subroutine main = new Subroutine(null, m.maxLocals, null);
+ List<AbstractInsnNode> subroutineCalls = new ArrayList<AbstractInsnNode>();
+ Map<LabelNode, Subroutine> subroutineHeads = new HashMap<LabelNode, Subroutine>();
+
+ findSubroutine(0, main, subroutineCalls);
+ while (!subroutineCalls.isEmpty()) {
+ JumpInsnNode jsr = (JumpInsnNode) subroutineCalls.remove(0);
+ Subroutine sub = subroutineHeads.get(jsr.label);
+ if (sub == null) {
+ sub = new Subroutine(jsr.label, m.maxLocals, jsr);
+ subroutineHeads.put(jsr.label, sub);
+ findSubroutine(insns.indexOf(jsr.label), sub, subroutineCalls);
+ } else {
+ sub.callers.add(jsr);
+ }
+ }
+ for (int i = 0; i < n; ++i) {
+ if (subroutines[i] != null && subroutines[i].start == null) {
+ subroutines[i] = null;
+ }
+ }
+
+ merge(0, null);
+ // control flow analysis
+ while (top > 0) {
+ int insn = queue[--top];
+ Subroutine subroutine = subroutines[insn];
+ queued[insn] = false;
+
+ AbstractInsnNode insnNode = null;
+ try {
+ insnNode = m.instructions.get(insn);
+ int insnOpcode = insnNode.getOpcode();
+ int insnType = insnNode.getType();
+
+ if (insnType == AbstractInsnNode.LABEL || insnType == AbstractInsnNode.LINE || insnType == AbstractInsnNode.FRAME) {
+ merge(insn + 1, subroutine);
+ newControlFlowEdge(insn, insn + 1);
+ } else {
+ subroutine = subroutine == null ? null : subroutine.copy();
+
+ if (insnNode instanceof JumpInsnNode) {
+ JumpInsnNode j = (JumpInsnNode) insnNode;
+ if (insnOpcode != GOTO && insnOpcode != JSR) {
+ merge(insn + 1, subroutine);
+ newControlFlowEdge(insn, insn + 1);
+ }
+ int jump = insns.indexOf(j.label);
+ if (insnOpcode == JSR) {
+ merge(jump, new Subroutine(j.label, m.maxLocals, j));
+ } else {
+ merge(jump, subroutine);
+ }
+ newControlFlowEdge(insn, jump);
+ } else if (insnNode instanceof LookupSwitchInsnNode) {
+ LookupSwitchInsnNode lsi = (LookupSwitchInsnNode) insnNode;
+ int jump = insns.indexOf(lsi.dflt);
+ merge(jump, subroutine);
+ newControlFlowEdge(insn, jump);
+ for (int j = 0; j < lsi.labels.size(); ++j) {
+ LabelNode label = lsi.labels.get(j);
+ jump = insns.indexOf(label);
+ merge(jump, subroutine);
+ newControlFlowEdge(insn, jump);
+ }
+ } else if (insnNode instanceof TableSwitchInsnNode) {
+ TableSwitchInsnNode tsi = (TableSwitchInsnNode) insnNode;
+ int jump = insns.indexOf(tsi.dflt);
+ merge(jump, subroutine);
+ newControlFlowEdge(insn, jump);
+ for (int j = 0; j < tsi.labels.size(); ++j) {
+ LabelNode label = tsi.labels.get(j);
+ jump = insns.indexOf(label);
+ merge(jump, subroutine);
+ newControlFlowEdge(insn, jump);
+ }
+ } else if (insnOpcode == RET) {
+ if (subroutine == null) {
+ throw new AnalyzerException(insnNode, "RET instruction outside of a sub routine");
+ }
+ for (int i = 0; i < subroutine.callers.size(); ++i) {
+ JumpInsnNode caller = subroutine.callers.get(i);
+ int call = insns.indexOf(caller);
+ if (wasQueued[call]) {
+ merge(call + 1, subroutines[call], subroutine.access);
+ newControlFlowEdge(insn, call + 1);
+ }
+ }
+ } else if (insnOpcode != ATHROW && (insnOpcode < IRETURN || insnOpcode > RETURN)) {
+ if (subroutine != null) {
+ if (insnNode instanceof VarInsnNode) {
+ int var = ((VarInsnNode) insnNode).var;
+ subroutine.access[var] = true;
+ if (insnOpcode == LLOAD || insnOpcode == DLOAD
+ || insnOpcode == LSTORE
+ || insnOpcode == DSTORE) {
+ subroutine.access[var + 1] = true;
+ }
+ } else if (insnNode instanceof IincInsnNode) {
+ int var = ((IincInsnNode) insnNode).var;
+ subroutine.access[var] = true;
+ }
+ }
+ merge(insn + 1, subroutine);
+ newControlFlowEdge(insn, insn + 1);
+ }
+ }
+
+ List<TryCatchBlockNode> insnHandlers = handlers[insn];
+ if (insnHandlers != null) {
+ for (TryCatchBlockNode tcb : insnHandlers) {
+ newControlFlowExceptionEdge(insn, tcb);
+ merge(insns.indexOf(tcb.handler), subroutine);
+ }
+ }
+ } catch (AnalyzerException e) {
+ throw new AnalyzerException(e.node, "Error at instruction "
+ + insn + ": " + e.getMessage(), e);
+ } catch (Exception e) {
+ throw new AnalyzerException(insnNode, "Error at instruction "
+ + insn + ": " + e.getMessage(), e);
+ }
+ }
+ }
+
+ private void findSubroutine(int insn, final Subroutine sub,
+ final List<AbstractInsnNode> calls) throws AnalyzerException {
+ while (true) {
+ if (insn < 0 || insn >= n) {
+ throw new AnalyzerException(null, "Execution can fall off end of the code");
+ }
+ if (subroutines[insn] != null) {
+ return;
+ }
+ subroutines[insn] = sub.copy();
+ AbstractInsnNode node = insns.get(insn);
+
+ // calls findSubroutine recursively on normal successors
+ if (node instanceof JumpInsnNode) {
+ if (node.getOpcode() == JSR) {
+ // do not follow a JSR, it leads to another subroutine!
+ calls.add(node);
+ } else {
+ JumpInsnNode jnode = (JumpInsnNode) node;
+ findSubroutine(insns.indexOf(jnode.label), sub, calls);
+ }
+ } else if (node instanceof TableSwitchInsnNode) {
+ TableSwitchInsnNode tsnode = (TableSwitchInsnNode) node;
+ findSubroutine(insns.indexOf(tsnode.dflt), sub, calls);
+ for (int i = tsnode.labels.size() - 1; i >= 0; --i) {
+ LabelNode l = tsnode.labels.get(i);
+ findSubroutine(insns.indexOf(l), sub, calls);
+ }
+ } else if (node instanceof LookupSwitchInsnNode) {
+ LookupSwitchInsnNode lsnode = (LookupSwitchInsnNode) node;
+ findSubroutine(insns.indexOf(lsnode.dflt), sub, calls);
+ for (int i = lsnode.labels.size() - 1; i >= 0; --i) {
+ LabelNode l = lsnode.labels.get(i);
+ findSubroutine(insns.indexOf(l), sub, calls);
+ }
+ }
+
+ // calls findSubroutine recursively on exception handler successors
+ List<TryCatchBlockNode> insnHandlers = handlers[insn];
+ if (insnHandlers != null) {
+ for (int i = 0; i < insnHandlers.size(); ++i) {
+ TryCatchBlockNode tcb = insnHandlers.get(i);
+ findSubroutine(insns.indexOf(tcb.handler), sub, calls);
+ }
+ }
+
+ // if insn does not falls through to the next instruction, return.
+ switch (node.getOpcode()) {
+ case GOTO:
+ case RET:
+ case TABLESWITCH:
+ case LOOKUPSWITCH:
+ case IRETURN:
+ case LRETURN:
+ case FRETURN:
+ case DRETURN:
+ case ARETURN:
+ case RETURN:
+ case ATHROW:
+ return;
+ }
+ insn++;
+ }
+ }
+
+ protected void newControlFlowEdge(final int insn, final int successor) {}
+
+ protected boolean newControlFlowExceptionEdge(final int insn,
+ final int successor) {
+ return true;
+ }
+
+ protected boolean newControlFlowExceptionEdge(final int insn,
+ final TryCatchBlockNode tcb) {
+ return newControlFlowExceptionEdge(insn, insns.indexOf(tcb.handler));
+ }
+
+ // -------------------------------------------------------------------------
+
+ private void merge(final int insn, final Subroutine subroutine) throws AnalyzerException {
+ Subroutine oldSubroutine = subroutines[insn];
+ boolean changes = false;
+
+ if (!wasQueued[insn]) {
+ wasQueued[insn] = true;
+ changes = true;
+ }
+
+ if (oldSubroutine == null) {
+ if (subroutine != null) {
+ subroutines[insn] = subroutine.copy();
+ changes = true;
+ }
+ } else {
+ if (subroutine != null) {
+ changes |= oldSubroutine.merge(subroutine);
+ }
+ }
+ if (changes && !queued[insn]) {
+ queued[insn] = true;
+ queue[top++] = insn;
+ }
+ }
+
+ private void merge(final int insn, final Subroutine subroutineBeforeJSR, final boolean[] access) throws AnalyzerException {
+ Subroutine oldSubroutine = subroutines[insn];
+ boolean changes = false;
+
+ if (!wasQueued[insn]) {
+ wasQueued[insn] = true;
+ changes = true;
+ }
+
+ if (oldSubroutine != null && subroutineBeforeJSR != null) {
+ changes |= oldSubroutine.merge(subroutineBeforeJSR);
+ }
+ if (changes && !queued[insn]) {
+ queued[insn] = true;
+ queue[top++] = insn;
+ }
+ }
+}
+
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/bytecodeAnalysis/Data.java b/java/java-analysis-impl/src/com/intellij/codeInspection/bytecodeAnalysis/Data.java
new file mode 100644
index 000000000000..132c5643b2d6
--- /dev/null
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/bytecodeAnalysis/Data.java
@@ -0,0 +1,226 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.codeInspection.bytecodeAnalysis;
+
+final class Method {
+ final String internalClassName;
+ final String methodName;
+ final String methodDesc;
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ Method method = (Method) o;
+ return internalClassName.equals(method.internalClassName) && methodDesc.equals(method.methodDesc) && methodName.equals(method.methodName);
+ }
+
+ @Override
+ public int hashCode() {
+ int result = internalClassName.hashCode();
+ result = 31 * result + methodName.hashCode();
+ result = 31 * result + methodDesc.hashCode();
+ return result;
+ }
+
+ Method(String internalClassName, String methodName, String methodDesc) {
+ this.internalClassName = internalClassName;
+ this.methodName = methodName;
+ this.methodDesc = methodDesc;
+ }
+
+ @Override
+ public String toString() {
+ return internalClassName + ' ' + methodName + ' ' + methodDesc;
+ }
+}
+
+enum Value {
+ Bot, NotNull, Null, True, False, Top
+}
+
+interface Direction {
+ static final int OUT_DIRECTION = 0;
+ static final int IN_DIRECTION = 1;
+ static final int INOUT_DIRECTION = 2;
+ int directionId();
+ int paramId();
+ int valueId();
+}
+
+final class In implements Direction {
+ final int paramIndex;
+
+ In(int paramIndex) {
+ this.paramIndex = paramIndex;
+ }
+
+ @Override
+ public String toString() {
+ return "In " + paramIndex;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ In in = (In) o;
+ if (paramIndex != in.paramIndex) return false;
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return paramIndex;
+ }
+
+ @Override
+ public int directionId() {
+ return IN_DIRECTION;
+ }
+
+ @Override
+ public int paramId() {
+ return paramIndex;
+ }
+
+ @Override
+ public int valueId() {
+ return 0;
+ }
+}
+
+final class InOut implements Direction {
+ final int paramIndex;
+ final Value inValue;
+
+ InOut(int paramIndex, Value inValue) {
+ this.paramIndex = paramIndex;
+ this.inValue = inValue;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ InOut inOut = (InOut) o;
+
+ if (paramIndex != inOut.paramIndex) return false;
+ if (inValue != inOut.inValue) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = paramIndex;
+ result = 31 * result + inValue.ordinal();
+ return result;
+ }
+
+ @Override
+ public String toString() {
+ return "InOut " + paramIndex + " " + inValue.toString();
+ }
+
+ @Override
+ public int directionId() {
+ return INOUT_DIRECTION;
+ }
+
+ @Override
+ public int paramId() {
+ return paramIndex;
+ }
+
+ @Override
+ public int valueId() {
+ return inValue.ordinal();
+ }
+}
+
+final class Out implements Direction {
+ @Override
+ public String toString() {
+ return "Out";
+ }
+
+ @Override
+ public int hashCode() {
+ return 1;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ return obj instanceof Out;
+ }
+
+ @Override
+ public int directionId() {
+ return OUT_DIRECTION;
+ }
+
+ @Override
+ public int paramId() {
+ return 0;
+ }
+
+ @Override
+ public int valueId() {
+ return 0;
+ }
+}
+
+final class Key {
+ final Method method;
+ final Direction direction;
+ final boolean stable;
+
+ Key(Method method, Direction direction, boolean stable) {
+ this.method = method;
+ this.direction = direction;
+ this.stable = stable;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ Key key = (Key) o;
+
+ if (!direction.equals(key.direction)) return false;
+ if (!method.equals(key.method)) return false;
+ if (stable != key.stable) return false;
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = method.hashCode();
+ result = 31 * result + direction.hashCode();
+ result = 31 * result + (stable ? 1 : 0);
+ return result;
+ }
+
+ @Override
+ public String toString() {
+ return "" + method + ' ' + direction + ' ' + stable;
+ }
+}
+
+
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/bytecodeAnalysis/Parameters.java b/java/java-analysis-impl/src/com/intellij/codeInspection/bytecodeAnalysis/Parameters.java
new file mode 100644
index 000000000000..08c52c4d49b0
--- /dev/null
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/bytecodeAnalysis/Parameters.java
@@ -0,0 +1,390 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.codeInspection.bytecodeAnalysis;
+
+import org.jetbrains.org.objectweb.asm.Type;
+import org.jetbrains.org.objectweb.asm.tree.AbstractInsnNode;
+import org.jetbrains.org.objectweb.asm.tree.JumpInsnNode;
+import org.jetbrains.org.objectweb.asm.tree.MethodInsnNode;
+import org.jetbrains.org.objectweb.asm.tree.TypeInsnNode;
+import org.jetbrains.org.objectweb.asm.tree.analysis.AnalyzerException;
+import org.jetbrains.org.objectweb.asm.tree.analysis.BasicInterpreter;
+import org.jetbrains.org.objectweb.asm.tree.analysis.BasicValue;
+import org.jetbrains.org.objectweb.asm.tree.analysis.Frame;
+
+import java.util.*;
+
+import static com.intellij.codeInspection.bytecodeAnalysis.AbstractValues.InstanceOfCheckValue;
+import static com.intellij.codeInspection.bytecodeAnalysis.AbstractValues.ParamValue;
+import static com.intellij.codeInspection.bytecodeAnalysis.PResults.*;
+import static org.jetbrains.org.objectweb.asm.Opcodes.*;
+
+abstract class PResults {
+ // SoP = sum of products
+ static Set<Set<Key>> join(Set<Set<Key>> sop1, Set<Set<Key>> sop2) {
+ Set<Set<Key>> sop = new HashSet<Set<Key>>();
+ sop.addAll(sop1);
+ sop.addAll(sop2);
+ return sop;
+ }
+
+ static Set<Set<Key>> meet(Set<Set<Key>> sop1, Set<Set<Key>> sop2) {
+ Set<Set<Key>> sop = new HashSet<Set<Key>>();
+ for (Set<Key> prod1 : sop1) {
+ for (Set<Key> prod2 : sop2) {
+ Set<Key> prod = new HashSet<Key>();
+ prod.addAll(prod1);
+ prod.addAll(prod2);
+ sop.add(prod);
+ }
+ }
+ return sop;
+ }
+
+ // Results
+ interface PResult {}
+ static final PResult Identity = new PResult() {
+ @Override
+ public String toString() {
+ return "Identity";
+ }
+ };
+ // similar to top, maximal element
+ static final PResult Return = new PResult() {
+ @Override
+ public String toString() {
+ return "Return";
+ }
+ };
+ // minimal element
+ static final PResult NPE = new PResult() {
+ @Override
+ public String toString() {
+ return "NPE";
+ }
+ };
+ static final class ConditionalNPE implements PResult {
+ final Set<Set<Key>> sop;
+ public ConditionalNPE(Set<Set<Key>> sop) {
+ this.sop = sop;
+ }
+
+ public ConditionalNPE(Key key) {
+ sop = new HashSet<Set<Key>>();
+ Set<Key> prod = new HashSet<Key>();
+ prod.add(key);
+ sop.add(prod);
+ }
+ }
+
+ static PResult join(PResult r1, PResult r2) {
+ if (Identity == r1) return r2;
+ if (Identity == r2) return r1;
+ if (Return == r1) return Return;
+ if (Return == r2) return Return;
+ if (NPE == r1) return r2;
+ if (NPE == r2) return r1;
+ ConditionalNPE cnpe1 = (ConditionalNPE) r1;
+ ConditionalNPE cnpe2 = (ConditionalNPE) r2;
+ return new ConditionalNPE(join(cnpe1.sop, cnpe2.sop));
+ }
+
+ static PResult meet(PResult r1, PResult r2) {
+ if (Identity == r1) return r2;
+ if (Return == r1) return r2;
+ if (Return == r2) return r1;
+ if (NPE == r1) return NPE;
+ if (NPE == r2) return NPE;
+ if (Identity == r2) return Identity;
+ ConditionalNPE cnpe1 = (ConditionalNPE) r1;
+ ConditionalNPE cnpe2 = (ConditionalNPE) r2;
+ return new ConditionalNPE(meet(cnpe1.sop, cnpe2.sop));
+ }
+
+}
+
+class NonNullInAnalysis extends Analysis<PResult> {
+
+ private final NonNullInInterpreter interpreter = new NonNullInInterpreter();
+
+ protected NonNullInAnalysis(RichControlFlow richControlFlow, Direction direction, boolean stable) {
+ super(richControlFlow, direction, stable);
+ }
+
+ @Override
+ PResult identity() {
+ return Identity;
+ }
+
+ @Override
+ PResult combineResults(PResult delta, List<PResult> subResults) {
+ PResult subResult = Identity;
+ for (PResult sr : subResults) {
+ subResult = join(subResult, sr);
+ }
+ return meet(delta, subResult);
+ }
+
+ @Override
+ boolean isEarlyResult(PResult result) {
+ return false;
+ }
+
+ @Override
+ Equation<Key, Value> mkEquation(PResult result) {
+ if (Identity == result || Return == result) {
+ return new Equation<Key, Value>(aKey, new Final<Key, Value>(Value.Top));
+ }
+ else if (NPE == result) {
+ return new Equation<Key, Value>(aKey, new Final<Key, Value>(Value.NotNull));
+ }
+ else {
+ ConditionalNPE condNpe = (ConditionalNPE) result;
+ Set<Product<Key, Value>> components = new HashSet<Product<Key, Value>>();
+ for (Set<Key> prod : condNpe.sop) {
+ components.add(new Product<Key, Value>(Value.Top, prod));
+ }
+ return new Equation<Key, Value>(aKey, new Pending<Key, Value>(components));
+ }
+ }
+
+ private int id = 0;
+ private Frame<BasicValue> nextFrame = null;
+ private PResult subResult = null;
+
+ @Override
+ void processState(State state) throws AnalyzerException {
+ int stateIndex = state.index;
+ Conf conf = state.conf;
+ int insnIndex = conf.insnIndex;
+ List<Conf> history = state.history;
+ boolean taken = state.taken;
+ Frame<BasicValue> frame = conf.frame;
+ AbstractInsnNode insnNode = methodNode.instructions.get(insnIndex);
+ List<Conf> nextHistory = dfsTree.loopEnters.contains(insnIndex) ? append(history, conf) : history;
+ boolean hasCompanions = state.hasCompanions;
+ execute(frame, insnNode);
+
+ boolean notEmptySubResult = subResult != Identity;
+
+ if (subResult == NPE) {
+ results.put(stateIndex, NPE);
+ computed.put(insnIndex, append(computed.get(insnIndex), state));
+ return;
+ }
+
+ int opcode = insnNode.getOpcode();
+ switch (opcode) {
+ case ARETURN:
+ case IRETURN:
+ case LRETURN:
+ case FRETURN:
+ case DRETURN:
+ case RETURN:
+ if (!hasCompanions) {
+ earlyResult = Return;
+ } else {
+ results.put(stateIndex, Return);
+ computed.put(insnIndex, append(computed.get(insnIndex), state));
+ }
+ return;
+ default:
+ }
+
+ if (opcode == ATHROW) {
+ if (taken) {
+ results.put(stateIndex, NPE);
+ } else {
+ results.put(stateIndex, Identity);
+ }
+ computed.put(insnIndex, append(computed.get(insnIndex), state));
+ return;
+ }
+
+ if (opcode == IFNONNULL && popValue(frame) instanceof ParamValue) {
+ int nextInsnIndex = insnIndex + 1;
+ State nextState = new State(++id, new Conf(nextInsnIndex, nextFrame), nextHistory, true, hasCompanions || notEmptySubResult);
+ pending.push(new MakeResult<PResult>(state, subResult, new int[]{nextState.index}));
+ pending.push(new ProceedState<PResult>(nextState));
+ return;
+ }
+
+ if (opcode == IFNULL && popValue(frame) instanceof ParamValue) {
+ int nextInsnIndex = methodNode.instructions.indexOf(((JumpInsnNode)insnNode).label);
+ State nextState = new State(++id, new Conf(nextInsnIndex, nextFrame), nextHistory, true, hasCompanions || notEmptySubResult);
+ pending.push(new MakeResult<PResult>(state, subResult, new int[]{nextState.index}));
+ pending.push(new ProceedState<PResult>(nextState));
+ return;
+ }
+
+ if (opcode == IFEQ && popValue(frame) == InstanceOfCheckValue) {
+ int nextInsnIndex = methodNode.instructions.indexOf(((JumpInsnNode)insnNode).label);
+ State nextState = new State(++id, new Conf(nextInsnIndex, nextFrame), nextHistory, true, hasCompanions || notEmptySubResult);
+ pending.push(new MakeResult<PResult>(state, subResult, new int[]{nextState.index}));
+ pending.push(new ProceedState<PResult>(nextState));
+ return;
+ }
+
+ if (opcode == IFNE && popValue(frame) == InstanceOfCheckValue) {
+ int nextInsnIndex = insnIndex + 1;
+ State nextState = new State(++id, new Conf(nextInsnIndex, nextFrame), nextHistory, true, hasCompanions || notEmptySubResult);
+ pending.push(new MakeResult<PResult>(state, subResult, new int[]{nextState.index}));
+ pending.push(new ProceedState<PResult>(nextState));
+ return;
+ }
+
+ // general case
+ int[] nextInsnIndices = controlFlow.transitions[insnIndex];
+ List<State> nextStates = new ArrayList<State>(nextInsnIndices.length);
+ int[] subIndices = new int[nextInsnIndices.length];
+
+ for (int i = 0; i < nextInsnIndices.length; i++) {
+ int nextInsnIndex = nextInsnIndices[i];
+ Frame<BasicValue> nextFrame1 = nextFrame;
+ if (controlFlow.errorTransitions.contains(new Edge(insnIndex, nextInsnIndex))) {
+ nextFrame1 = new Frame<BasicValue>(frame);
+ nextFrame1.clearStack();
+ nextFrame1.push(new BasicValue(Type.getType("java/lang/Throwable")));
+ }
+ nextStates.add(new State(++id, new Conf(nextInsnIndex, nextFrame1), nextHistory, taken, hasCompanions || notEmptySubResult));
+ subIndices[i] = (id);
+ }
+
+ pending.push(new MakeResult<PResult>(state, subResult, subIndices));
+ for (State nextState : nextStates) {
+ pending.push(new ProceedState<PResult>(nextState));
+ }
+
+ }
+
+ private void execute(Frame<BasicValue> frame, AbstractInsnNode insnNode) throws AnalyzerException {
+ switch (insnNode.getType()) {
+ case AbstractInsnNode.LABEL:
+ case AbstractInsnNode.LINE:
+ case AbstractInsnNode.FRAME:
+ nextFrame = frame;
+ subResult = Identity;
+ break;
+ default:
+ nextFrame = new Frame<BasicValue>(frame);
+ interpreter.reset();
+ nextFrame.execute(insnNode, interpreter);
+ subResult = interpreter.getSubResult();
+ }
+ }
+}
+
+class NonNullInInterpreter extends BasicInterpreter {
+ private PResult subResult = Identity;
+ public PResult getSubResult() {
+ return subResult;
+ }
+ void reset() {
+ subResult = Identity;
+ }
+
+ @Override
+ public BasicValue unaryOperation(AbstractInsnNode insn, BasicValue value) throws AnalyzerException {
+ switch (insn.getOpcode()) {
+ case GETFIELD:
+ case ARRAYLENGTH:
+ case MONITORENTER:
+ if (value instanceof ParamValue) {
+ subResult = NPE;
+ }
+ break;
+ case CHECKCAST:
+ if (value instanceof ParamValue) {
+ return new ParamValue(Type.getObjectType(((TypeInsnNode)insn).desc));
+ }
+ break;
+ case INSTANCEOF:
+ if (value instanceof ParamValue) {
+ return InstanceOfCheckValue;
+ }
+ break;
+ default:
+
+ }
+ return super.unaryOperation(insn, value);
+ }
+
+ @Override
+ public BasicValue binaryOperation(AbstractInsnNode insn, BasicValue value1, BasicValue value2) throws AnalyzerException {
+ switch (insn.getOpcode()) {
+ case IALOAD:
+ case LALOAD:
+ case FALOAD:
+ case DALOAD:
+ case AALOAD:
+ case BALOAD:
+ case CALOAD:
+ case SALOAD:
+ case PUTFIELD:
+ if (value1 instanceof ParamValue) {
+ subResult = NPE;
+ }
+ break;
+ default:
+ }
+ return super.binaryOperation(insn, value1, value2);
+ }
+
+ @Override
+ public BasicValue ternaryOperation(AbstractInsnNode insn, BasicValue value1, BasicValue value2, BasicValue value3) throws AnalyzerException {
+ switch (insn.getOpcode()) {
+ case IASTORE:
+ case LASTORE:
+ case FASTORE:
+ case DASTORE:
+ case AASTORE:
+ case BASTORE:
+ case CASTORE:
+ case SASTORE:
+ if (value1 instanceof ParamValue) {
+ subResult = NPE;
+ }
+ default:
+ }
+ return super.ternaryOperation(insn, value1, value2, value3);
+ }
+
+ @Override
+ public BasicValue naryOperation(AbstractInsnNode insn, List<? extends BasicValue> values) throws AnalyzerException {
+ int opcode = insn.getOpcode();
+ boolean isStaticInvoke = opcode == INVOKESTATIC;
+ int shift = isStaticInvoke ? 0 : 1;
+ if ((opcode == INVOKESPECIAL || opcode ==INVOKEINTERFACE || opcode == INVOKEVIRTUAL) && values.get(0) instanceof ParamValue) {
+ subResult = NPE;
+ }
+ switch (opcode) {
+ case INVOKESTATIC:
+ case INVOKESPECIAL:
+ case INVOKEVIRTUAL:
+ case INVOKEINTERFACE:
+ boolean stable = opcode == INVOKESTATIC || opcode == INVOKESPECIAL;
+ MethodInsnNode methodNode = (MethodInsnNode) insn;
+ for (int i = shift; i < values.size(); i++) {
+ if (values.get(i) instanceof ParamValue) {
+ Method method = new Method(methodNode.owner, methodNode.name, methodNode.desc);
+ subResult = meet(subResult, new ConditionalNPE(new Key(method, new In(i - shift), stable)));
+ }
+ }
+ default:
+ }
+ return super.naryOperation(insn, values);
+ }
+}
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/bytecodeAnalysis/ProjectBytecodeAnalysis.java b/java/java-analysis-impl/src/com/intellij/codeInspection/bytecodeAnalysis/ProjectBytecodeAnalysis.java
new file mode 100644
index 000000000000..86b9dd101fd9
--- /dev/null
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/bytecodeAnalysis/ProjectBytecodeAnalysis.java
@@ -0,0 +1,291 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.codeInspection.bytecodeAnalysis;
+
+import com.intellij.ProjectTopics;
+import com.intellij.codeInsight.AnnotationUtil;
+import com.intellij.codeInspection.dataFlow.ControlFlowAnalyzer;
+import com.intellij.openapi.components.ServiceManager;
+import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.openapi.progress.ProgressManager;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.roots.ContentIterator;
+import com.intellij.openapi.roots.ModuleRootAdapter;
+import com.intellij.openapi.roots.ModuleRootEvent;
+import com.intellij.openapi.util.Key;
+import com.intellij.openapi.util.ModificationTracker;
+import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.psi.*;
+import com.intellij.psi.search.GlobalSearchScope;
+import com.intellij.psi.search.ProjectScope;
+import com.intellij.psi.util.CachedValueProvider;
+import com.intellij.psi.util.CachedValuesManager;
+import com.intellij.util.IncorrectOperationException;
+import com.intellij.util.indexing.FileBasedIndex;
+import com.intellij.util.messages.MessageBusConnection;
+import gnu.trove.TIntHashSet;
+import gnu.trove.TIntObjectHashMap;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.io.IOException;
+import java.util.Collection;
+
+/**
+ * @author lambdamix
+ */
+public class ProjectBytecodeAnalysis {
+ public static final Logger LOG = Logger.getInstance("#com.intellij.codeInspection.bytecodeAnalysis");
+ public static final Key<Boolean> INFERRED_ANNOTATION = Key.create("INFERRED_ANNOTATION");
+ private final Project myProject;
+
+ private volatile Annotations myAnnotations = null;
+
+ public static ProjectBytecodeAnalysis getInstance(@NotNull Project project) {
+ return ServiceManager.getService(project, ProjectBytecodeAnalysis.class);
+ }
+
+ public ProjectBytecodeAnalysis(Project project) {
+ myProject = project;
+ final MessageBusConnection connection = myProject.getMessageBus().connect();
+ connection.subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootAdapter() {
+ @Override
+ public void rootsChanged(ModuleRootEvent event) {
+ unloadAnnotations();
+ }
+ });
+ }
+
+ private void loadAnnotations() {
+ Annotations annotations = new Annotations();
+ loadParameterAnnotations(annotations);
+ loadContractAnnotations(annotations);
+ myAnnotations = annotations;
+ LOG.debug("NotNull annotations: " + myAnnotations.notNulls.size());
+ LOG.debug("Contract annotations: " + myAnnotations.contracts.size());
+ }
+
+ private void unloadAnnotations() {
+ myAnnotations = null;
+ LOG.debug("unloaded");
+ }
+
+ private void loadParameterAnnotations(Annotations annotations) {
+ LOG.debug("initializing parameter annotations");
+ final IntIdSolver solver = new IntIdSolver(new ELattice<Value>(Value.NotNull, Value.Top));
+
+ processValues(true, new FileBasedIndex.ValueProcessor<Collection<IntIdEquation>>() {
+ @Override
+ public boolean process(VirtualFile file, Collection<IntIdEquation> value) {
+ for (IntIdEquation intIdEquation : value) {
+ solver.addEquation(intIdEquation);
+ }
+ return true;
+ }
+ });
+
+ LOG.debug("parameter equations are constructed");
+ LOG.debug("equations: " + solver.getSize());
+ TIntObjectHashMap<Value> solutions = solver.solve();
+ LOG.debug("parameter equations are solved");
+ BytecodeAnalysisConverter.getInstance().addAnnotations(solutions, annotations);
+ }
+
+ private void processValues(final boolean parameters, final FileBasedIndex.ValueProcessor<Collection<IntIdEquation>> processor) {
+ final GlobalSearchScope libScope = ProjectScope.getLibrariesScope(myProject);
+ final FileBasedIndex index = FileBasedIndex.getInstance();
+ index.iterateIndexableFiles(new ContentIterator() {
+ @Override
+ public boolean processFile(VirtualFile fileOrDir) {
+ ProgressManager.checkCanceled();
+ if (!fileOrDir.isDirectory() && libScope.contains(fileOrDir)) {
+ index.processValues(BytecodeAnalysisIndex.NAME, BytecodeAnalysisIndex.indexKey(fileOrDir, parameters),
+ fileOrDir, processor, GlobalSearchScope.fileScope(myProject, fileOrDir));
+ }
+ return false;
+ }
+ }, myProject, null);
+ }
+
+ private void loadContractAnnotations(Annotations annotations) {
+ LOG.debug("initializing contract annotations");
+ final IntIdSolver solver = new IntIdSolver(new ELattice<Value>(Value.Bot, Value.Top));
+ processValues(false, new FileBasedIndex.ValueProcessor<Collection<IntIdEquation>>() {
+ @Override
+ public boolean process(VirtualFile file, Collection<IntIdEquation> value) {
+ for (IntIdEquation intIdEquation : value) {
+ solver.addEquation(intIdEquation);
+ }
+ return true;
+ }
+ });
+ LOG.debug("contract equations are constructed");
+ LOG.debug("equations: " + solver.getSize());
+ TIntObjectHashMap<Value> solutions = solver.solve();
+ LOG.debug("contract equations are solved");
+ BytecodeAnalysisConverter.getInstance().addAnnotations(solutions, annotations);
+ }
+
+ @Nullable
+ public PsiAnnotation findInferredAnnotation(@NotNull PsiModifierListOwner listOwner, @NotNull String annotationFQN) {
+ if (!(listOwner instanceof PsiCompiledElement)) {
+ return null;
+ }
+ if (annotationFQN.equals("org.jetbrains.annotations.NotNull")) {
+ return findNotNullAnnotation(listOwner);
+ }
+ else if (annotationFQN.equals("org.jetbrains.annotations.Contract")) {
+ return findContractAnnotation(listOwner);
+ }
+ else {
+ return null;
+ }
+ }
+
+ @NotNull
+ public PsiAnnotation[] findInferredAnnotations(@NotNull PsiModifierListOwner listOwner) {
+ if (!(listOwner instanceof PsiCompiledElement)) {
+ return PsiAnnotation.EMPTY_ARRAY;
+ }
+ return collectInferredAnnotations(listOwner);
+ }
+
+ // TODO the best way to synchronize?
+ @NotNull
+ private synchronized PsiAnnotation[] collectInferredAnnotations(PsiModifierListOwner listOwner) {
+ if (myAnnotations == null) {
+ loadAnnotations();
+ }
+ try {
+ int key = getKey(listOwner);
+ if (key == -1) {
+ return PsiAnnotation.EMPTY_ARRAY;
+ }
+ boolean notNull = myAnnotations.notNulls.contains(key);
+ String contractValue = myAnnotations.contracts.get(key);
+
+ if (notNull && contractValue != null) {
+ return new PsiAnnotation[]{
+ getNotNullAnnotation(),
+ createAnnotationFromText("@" + ControlFlowAnalyzer.ORG_JETBRAINS_ANNOTATIONS_CONTRACT + "(" + contractValue + ")")
+ };
+ }
+ else if (notNull) {
+ return new PsiAnnotation[]{
+ getNotNullAnnotation()
+ };
+ }
+ else if (contractValue != null) {
+ return new PsiAnnotation[]{
+ createAnnotationFromText("@" + ControlFlowAnalyzer.ORG_JETBRAINS_ANNOTATIONS_CONTRACT + "(" + contractValue + ")")
+ };
+ }
+ else {
+ return PsiAnnotation.EMPTY_ARRAY;
+ }
+ }
+ catch (IOException e) {
+ LOG.debug(e);
+ return PsiAnnotation.EMPTY_ARRAY;
+ }
+ }
+
+ private PsiAnnotation getNotNullAnnotation() {
+ return CachedValuesManager.getManager(myProject).getCachedValue(myProject, new CachedValueProvider<PsiAnnotation>() {
+ @Nullable
+ @Override
+ public Result<PsiAnnotation> compute() {
+ return Result.create(createAnnotationFromText("@" + AnnotationUtil.NOT_NULL), ModificationTracker.NEVER_CHANGED);
+ }
+ });
+ }
+
+ @Nullable
+ private synchronized PsiAnnotation findNotNullAnnotation(PsiModifierListOwner listOwner) {
+ if (myAnnotations == null) {
+ loadAnnotations();
+ }
+ try {
+ int key = getKey(listOwner);
+ if (key == -1) {
+ return null;
+ }
+ return myAnnotations.notNulls.contains(key) ? getNotNullAnnotation() : null;
+ }
+ catch (IOException e) {
+ LOG.debug(e);
+ return null;
+ }
+ }
+
+ @Nullable
+ private synchronized PsiAnnotation findContractAnnotation(PsiModifierListOwner listOwner) {
+ if (myAnnotations == null) {
+ loadAnnotations();
+ }
+ try {
+ int key = getKey(listOwner);
+ if (key == -1) {
+ return null;
+ }
+ String contractValue = myAnnotations.contracts.get(key);
+ return contractValue != null ? createContractAnnotation(contractValue) : null;
+ }
+ catch (IOException e) {
+ LOG.debug(e);
+ return null;
+ }
+ }
+
+ public PsiAnnotation createContractAnnotation(String contractValue) {
+ return createAnnotationFromText("@org.jetbrains.annotations.Contract(" + contractValue + ")");
+ }
+
+ public static int getKey(@NotNull PsiModifierListOwner owner) throws IOException {
+ LOG.assertTrue(owner instanceof PsiCompiledElement, owner);
+
+ if (owner instanceof PsiMethod) {
+ return BytecodeAnalysisConverter.getInstance().mkPsiKey((PsiMethod)owner, new Out());
+ }
+
+ if (owner instanceof PsiParameter) {
+ PsiElement parent = owner.getParent();
+ if (parent instanceof PsiParameterList) {
+ PsiElement gParent = parent.getParent();
+ if (gParent instanceof PsiMethod) {
+ final int index = ((PsiParameterList)parent).getParameterIndex((PsiParameter)owner);
+ return BytecodeAnalysisConverter.getInstance().mkPsiKey((PsiMethod)gParent, new In(index));
+ }
+ }
+ }
+
+ return -1;
+ }
+
+ @NotNull
+ private PsiAnnotation createAnnotationFromText(@NotNull final String text) throws IncorrectOperationException {
+ PsiAnnotation annotation = JavaPsiFacade.getElementFactory(myProject).createAnnotationFromText(text, null);
+ annotation.putUserData(INFERRED_ANNOTATION, Boolean.TRUE);
+ return annotation;
+ }
+}
+
+class Annotations {
+ // @NotNull keys
+ final TIntHashSet notNulls = new TIntHashSet();
+ // @Contracts
+ final TIntObjectHashMap<String> contracts = new TIntObjectHashMap<String>();
+}
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/bytecodeAnalysis/Solver.java b/java/java-analysis-impl/src/com/intellij/codeInspection/bytecodeAnalysis/Solver.java
new file mode 100644
index 000000000000..47c97790d102
--- /dev/null
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/bytecodeAnalysis/Solver.java
@@ -0,0 +1,440 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.codeInspection.bytecodeAnalysis;
+
+import com.intellij.util.containers.IntStack;
+import com.intellij.util.containers.IntToIntSetMap;
+import gnu.trove.TIntObjectHashMap;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.*;
+
+final class ELattice<T extends Enum<T>> {
+ final T bot;
+ final T top;
+
+ ELattice(T bot, T top) {
+ this.bot = bot;
+ this.top = top;
+ }
+
+ final T join(T x, T y) {
+ if (x == bot) return y;
+ if (y == bot) return x;
+ if (x == y) return x;
+ return top;
+ }
+
+ final T meet(T x, T y) {
+ if (x == top) return y;
+ if (y == top) return x;
+ if (x == y) return x;
+ return bot;
+ }
+}
+
+// component specialized for ints
+final class IntIdComponent {
+ Value value;
+ final int[] ids;
+
+ IntIdComponent(Value value, int[] ids) {
+ this.value = value;
+ this.ids = ids;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ IntIdComponent that = (IntIdComponent)o;
+
+ if (!Arrays.equals(ids, that.ids)) return false;
+ if (value != that.value) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return value.ordinal() + Arrays.hashCode(ids);
+ }
+
+ public boolean remove(int id) {
+ return IdUtils.remove(ids, id);
+ }
+
+ public boolean isEmpty() {
+ return IdUtils.isEmpty(ids);
+ }
+
+ IntIdComponent copy() {
+ return new IntIdComponent(value, ids.clone());
+ }
+}
+
+class IdUtils {
+ // removed value
+ static final int nullId = 0;
+
+ static boolean contains(int[] ids, int id) {
+ for (int id1 : ids) {
+ if (id1 == id) return true;
+ }
+
+ return false;
+ }
+
+ static boolean isEmpty(int[] ids) {
+ for (int id : ids) {
+ if (id != nullId) return false;
+ }
+ return true;
+ }
+
+ static IntIdComponent[] toArray(Collection<IntIdComponent> set) {
+ IntIdComponent[] result = new IntIdComponent[set.size()];
+ int i = 0;
+ for (IntIdComponent intIdComponent : set) {
+ result[i] = intIdComponent;
+ i++;
+ }
+
+ return result;
+ }
+
+ static boolean remove(int[] ids, int id) {
+ boolean removed = false;
+ for (int i = 0; i < ids.length; i++) {
+ if (ids[i] == id) {
+ ids[i] = nullId;
+ removed = true;
+ }
+ }
+ return removed;
+ }
+}
+
+class ResultUtil<Id, T extends Enum<T>> {
+ private final ELattice<T> lattice;
+ final T top;
+ ResultUtil(ELattice<T> lattice) {
+ this.lattice = lattice;
+ top = lattice.top;
+ }
+
+ Result<Id, T> join(Result<Id, T> r1, Result<Id, T> r2) {
+ if (r1 instanceof Final && ((Final) r1).value == top) {
+ return r1;
+ }
+ if (r2 instanceof Final && ((Final) r2).value == top) {
+ return r2;
+ }
+ if (r1 instanceof Final && r2 instanceof Final) {
+ return new Final<Id, T>(lattice.join(((Final<?, T>) r1).value, ((Final<?, T>) r2).value));
+ }
+ if (r1 instanceof Final && r2 instanceof Pending) {
+ Final<?, T> f1 = (Final<?, T>)r1;
+ Pending<Id, T> pending = (Pending<Id, T>) r2;
+ Set<Product<Id, T>> sum1 = new HashSet<Product<Id, T>>(pending.sum);
+ sum1.add(new Product<Id, T>(f1.value, Collections.<Id>emptySet()));
+ return new Pending<Id, T>(sum1);
+ }
+ if (r1 instanceof Pending && r2 instanceof Final) {
+ Final<?, T> f2 = (Final<?, T>)r2;
+ Pending<Id, T> pending = (Pending<Id, T>) r1;
+ Set<Product<Id, T>> sum1 = new HashSet<Product<Id, T>>(pending.sum);
+ sum1.add(new Product<Id, T>(f2.value, Collections.<Id>emptySet()));
+ return new Pending<Id, T>(sum1);
+ }
+ Pending<Id, T> pending1 = (Pending<Id, T>) r1;
+ Pending<Id, T> pending2 = (Pending<Id, T>) r2;
+ Set<Product<Id, T>> sum = new HashSet<Product<Id, T>>();
+ sum.addAll(pending1.sum);
+ sum.addAll(pending2.sum);
+ return new Pending<Id, T>(sum);
+ }
+}
+
+final class Product<K, V> {
+ @NotNull final V value;
+ @NotNull final Set<K> ids;
+
+ Product(@NotNull V value, @NotNull Set<K> ids) {
+ this.value = value;
+ this.ids = ids;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ Product product = (Product)o;
+
+ if (!ids.equals(product.ids)) return false;
+ if (!value.equals(product.value)) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = value.hashCode();
+ result = 31 * result + ids.hashCode();
+ return result;
+ }
+}
+
+interface Result<Id, T> {}
+final class Final<Id, T> implements Result<Id, T> {
+ final T value;
+ Final(T value) {
+ this.value = value;
+ }
+
+ @Override
+ public String toString() {
+ return "Final{" + "value=" + value + '}';
+ }
+}
+
+final class Pending<Id, T> implements Result<Id, T> {
+ final Set<Product<Id, T>> sum;
+
+ Pending(Set<Product<Id, T>> sum) {
+ this.sum = sum;
+ }
+
+}
+
+interface IntIdResult {}
+// this just wrapper, no need for this really
+final class IntIdFinal implements IntIdResult {
+ final Value value;
+ public IntIdFinal(Value value) {
+ this.value = value;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ IntIdFinal that = (IntIdFinal)o;
+
+ if (value != that.value) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return value.ordinal();
+ }
+
+ @Override
+ public String toString() {
+ return super.toString();
+ }
+}
+
+final class IntIdPending implements IntIdResult {
+ final IntIdComponent[] delta;
+
+ IntIdPending(IntIdComponent[] delta) {
+ this.delta = delta;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof IntIdPending)) return false;
+ IntIdPending pending = (IntIdPending)o;
+ return !Arrays.equals(delta, pending.delta);
+ }
+
+ @Override
+ public int hashCode() {
+ return Arrays.hashCode(delta);
+ }
+
+ IntIdPending copy() {
+ IntIdComponent[] delta1 = new IntIdComponent[delta.length];
+ for (int i = 0; i < delta.length; i++) {
+ delta1[i] = delta[i].copy();
+ }
+ return new IntIdPending(delta1);
+ }
+}
+
+final class IntIdEquation {
+ final int id;
+ final IntIdResult rhs;
+
+ IntIdEquation(int id, IntIdResult rhs) {
+ this.id = id;
+ this.rhs = rhs;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof IntIdEquation)) return false;
+
+ IntIdEquation equation = (IntIdEquation)o;
+
+ if (id != equation.id) return false;
+ if (!rhs.equals(equation.rhs)) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = id;
+ result = 31 * result + rhs.hashCode();
+ return result;
+ }
+}
+
+final class Solution<Id, Val> {
+ final Id id;
+ final Val value;
+
+ Solution(Id id, Val value) {
+ this.id = id;
+ this.value = value;
+ }
+}
+
+final class Equation<Id, T> {
+ final Id id;
+ final Result<Id, T> rhs;
+
+ Equation(Id id, Result<Id, T> rhs) {
+ this.id = id;
+ this.rhs = rhs;
+ }
+
+ @Override
+ public String toString() {
+ return "Equation{" + "id=" + id + ", rhs=" + rhs + '}';
+ }
+}
+
+final class IntIdSolver {
+
+ private int size = 0;
+ private final ELattice<Value> lattice;
+ private final IntToIntSetMap dependencies = new IntToIntSetMap(10000, 0.5f);
+ private final TIntObjectHashMap<IntIdPending> pending = new TIntObjectHashMap<IntIdPending>();
+ private final TIntObjectHashMap<Value> solved = new TIntObjectHashMap<Value>();
+ private final IntStack moving = new IntStack();
+
+ int getSize() {
+ return size;
+ }
+
+ IntIdSolver(ELattice<Value> lattice) {
+ this.lattice = lattice;
+ }
+
+ void addEquation(IntIdEquation equation) {
+ size ++;
+ IntIdResult rhs = equation.rhs;
+ if (rhs instanceof IntIdFinal) {
+ solved.put(equation.id, ((IntIdFinal) rhs).value);
+ moving.push(equation.id);
+ } else if (rhs instanceof IntIdPending) {
+ IntIdPending pendResult = ((IntIdPending)rhs).copy();
+ IntIdResult norm = normalize(pendResult.delta);
+ if (norm instanceof IntIdFinal) {
+ solved.put(equation.id, ((IntIdFinal) norm).value);
+ moving.push(equation.id);
+ }
+ else {
+ IntIdPending pendResult1 = ((IntIdPending)rhs).copy();
+ for (IntIdComponent component : pendResult1.delta) {
+ for (int trigger : component.ids) {
+ dependencies.addOccurence(trigger, equation.id);
+ }
+ pending.put(equation.id, pendResult1);
+ }
+ }
+ }
+ }
+
+ TIntObjectHashMap<Value> solve() {
+ while (!moving.empty()) {
+ int id = moving.pop();
+ Value value = solved.get(id);
+
+ boolean stable = id > 0;
+ int[] pIds = stable ? new int[]{id, -id} : new int[]{-id, id};
+ Value[] pVals = stable ? new Value[]{value, value} : new Value[]{value, lattice.top};
+
+ for (int i = 0; i < pIds.length; i++) {
+ int pId = pIds[i];
+ Value pVal = pVals[i];
+ // todo - remove
+ int[] dIds = dependencies.get(pId);
+ for (int dId : dIds) {
+ IntIdPending pend = pending.remove(dId);
+ if (pend != null) {
+ IntIdResult pend1 = substitute(pend, pId, pVal);
+ if (pend1 instanceof IntIdFinal) {
+ IntIdFinal fi = (IntIdFinal)pend1;
+ solved.put(dId, fi.value);
+ moving.push(dId);
+ }
+ else {
+ pending.put(dId, (IntIdPending)pend1);
+ }
+ }
+ }
+ }
+ }
+ pending.clear();
+ return solved;
+ }
+
+ // substitute id -> value into pending
+ IntIdResult substitute(IntIdPending pending, int id, Value value) {
+ IntIdComponent[] sum = pending.delta;
+ for (IntIdComponent intIdComponent : sum) {
+ if (intIdComponent.remove(id)) {
+ intIdComponent.value = lattice.meet(intIdComponent.value, value);
+ }
+ }
+ return normalize(sum);
+ }
+
+ IntIdResult normalize(IntIdComponent[] sum) {
+ Value acc = lattice.bot;
+ boolean computableNow = true;
+ for (IntIdComponent prod : sum) {
+ if (prod.isEmpty() || prod.value == lattice.bot) {
+ acc = lattice.join(acc, prod.value);
+ } else {
+ computableNow = false;
+ }
+ }
+ return (acc == lattice.top || computableNow) ? new IntIdFinal(acc) : new IntIdPending(sum);
+ }
+
+}
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/ContractInference.java b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/ContractInference.java
index 534d65b07531..a1c908837ad0 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/ContractInference.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/ContractInference.java
@@ -15,6 +15,7 @@
*/
package com.intellij.codeInspection.dataFlow;
+import com.intellij.codeInsight.NullableNotNullManager;
import com.intellij.codeInspection.dataFlow.MethodContract.ValueConstraint;
import com.intellij.openapi.util.Computable;
import com.intellij.openapi.util.Condition;
@@ -41,6 +42,10 @@ public class ContractInference {
@NotNull
public static List<MethodContract> inferContracts(@NotNull final PsiMethod method) {
+ if (method instanceof PsiCompiledElement) {
+ return Collections.emptyList();
+ }
+
return CachedValuesManager.getCachedValue(method, new CachedValueProvider<List<MethodContract>>() {
@Nullable
@Override
@@ -70,7 +75,12 @@ class ContractInferenceInterpreter {
}
else if (statements[0] instanceof PsiExpressionStatement && ((PsiExpressionStatement)statements[0]).getExpression() instanceof PsiMethodCallExpression) {
List<MethodContract> result = handleDelegation(((PsiExpressionStatement)statements[0]).getExpression(), false);
- if (result != null) return result;
+ if (result != null) return ContainerUtil.findAll(result, new Condition<MethodContract>() {
+ @Override
+ public boolean value(MethodContract contract) {
+ return contract.returnValue == THROW_EXCEPTION || !textMatches(myMethod.getReturnTypeElement(), PsiKeyword.VOID);
+ }
+ });
}
}
@@ -103,7 +113,7 @@ class ContractInferenceInterpreter {
return RecursionManager.doPreventingRecursion(myMethod, true, new Computable<List<MethodContract>>() {
@Override
public List<MethodContract> compute() {
- List<MethodContract> delegateContracts = ContractInference.inferContracts(targetMethod); //todo use explicit contracts, too
+ List<MethodContract> delegateContracts = ControlFlowAnalyzer.getMethodContracts(targetMethod);
return ContainerUtil.mapNotNull(delegateContracts, new NullableFunction<MethodContract, MethodContract>() {
@Nullable
@Override
@@ -125,7 +135,7 @@ class ContractInferenceInterpreter {
}
}
}
- return new MethodContract(answer, negated ? negateConstraint(delegateContract.returnValue) : delegateContract.returnValue);
+ return answer == null ? null : new MethodContract(answer, negated ? negateConstraint(delegateContract.returnValue) : delegateContract.returnValue);
}
});
}
@@ -173,10 +183,12 @@ class ContractInferenceInterpreter {
if (expr instanceof PsiInstanceOfExpression) {
final int parameter = resolveParameter(((PsiInstanceOfExpression)expr).getOperand());
if (parameter >= 0) {
- return ContainerUtil.map(states, new Function<ValueConstraint[], MethodContract>() {
+ return ContainerUtil.mapNotNull(states, new Function<ValueConstraint[], MethodContract>() {
@Override
public MethodContract fun(ValueConstraint[] state) {
- return new MethodContract(withConstraint(state, parameter, NULL_VALUE), FALSE_VALUE);
+ ValueConstraint paramConstraint = NULL_VALUE;
+ ValueConstraint returnValue = FALSE_VALUE;
+ return contractWithConstraint(state, parameter, paramConstraint, returnValue);
}
});
}
@@ -187,17 +199,17 @@ class ContractInferenceInterpreter {
return toContracts(states, constraint);
}
- int parameter = resolveParameter(expr);
- if (parameter >= 0) {
+ int paramIndex = resolveParameter(expr);
+ if (paramIndex >= 0) {
List<MethodContract> result = ContainerUtil.newArrayList();
for (ValueConstraint[] state : states) {
- if (state[parameter] != ANY_VALUE) {
+ if (state[paramIndex] != ANY_VALUE) {
// the second 'o' reference in cases like: if (o != null) return o;
- result.add(new MethodContract(state, state[parameter]));
- } else {
+ result.add(new MethodContract(state, state[paramIndex]));
+ } else if (textMatches(myMethod.getParameterList().getParameters()[paramIndex].getTypeElement(), PsiKeyword.BOOLEAN)) {
// if (boolValue) ...
- result.add(new MethodContract(withConstraint(state, parameter, TRUE_VALUE), TRUE_VALUE));
- result.add(new MethodContract(withConstraint(state, parameter, FALSE_VALUE), FALSE_VALUE));
+ ContainerUtil.addIfNotNull(result, contractWithConstraint(state, paramIndex, TRUE_VALUE, TRUE_VALUE));
+ ContainerUtil.addIfNotNull(result, contractWithConstraint(state, paramIndex, FALSE_VALUE, FALSE_VALUE));
}
}
return result;
@@ -206,6 +218,18 @@ class ContractInferenceInterpreter {
return Collections.emptyList();
}
+ @Nullable
+ private MethodContract contractWithConstraint(ValueConstraint[] state,
+ int parameter, ValueConstraint paramConstraint,
+ ValueConstraint returnValue) {
+ ValueConstraint[] newState = withConstraint(state, parameter, paramConstraint);
+ return newState == null ? null : new MethodContract(newState, returnValue);
+ }
+
+ private static boolean textMatches(@Nullable PsiTypeElement typeElement, @NotNull String text) {
+ return typeElement != null && typeElement.textMatches(text);
+ }
+
private List<MethodContract> visitEqualityComparison(List<ValueConstraint[]> states,
PsiExpression op1,
PsiExpression op2,
@@ -219,8 +243,9 @@ class ContractInferenceInterpreter {
if (parameter >= 0 && constraint != null) {
List<MethodContract> result = ContainerUtil.newArrayList();
for (ValueConstraint[] state : states) {
- result.add(new MethodContract(withConstraint(state, parameter, constraint), equality ? TRUE_VALUE : FALSE_VALUE));
- result.add(new MethodContract(withConstraint(state, parameter, negateConstraint(constraint)), equality ? FALSE_VALUE : TRUE_VALUE));
+ ContainerUtil.addIfNotNull(result, contractWithConstraint(state, parameter, constraint, equality ? TRUE_VALUE : FALSE_VALUE));
+ ContainerUtil.addIfNotNull(result, contractWithConstraint(state, parameter, negateConstraint(constraint),
+ equality ? FALSE_VALUE : TRUE_VALUE));
}
return result;
}
@@ -295,7 +320,15 @@ class ContractInferenceInterpreter {
result.addAll(toContracts(states, THROW_EXCEPTION));
}
else if (statement instanceof PsiReturnStatement) {
- result.addAll(visitExpression(states, ((PsiReturnStatement)statement).getReturnValue()));
+ List<MethodContract> contracts = visitExpression(states, ((PsiReturnStatement)statement).getReturnValue());
+ for (MethodContract contract : contracts) {
+ if ((contract.returnValue == TRUE_VALUE || contract.returnValue == FALSE_VALUE) &&
+ !textMatches(myMethod.getReturnTypeElement(), PsiKeyword.BOOLEAN)) {
+ continue;
+ }
+
+ result.add(contract);
+ }
}
else if (statement instanceof PsiAssertStatement) {
List<MethodContract> conditionResults = visitExpression(states, ((PsiAssertStatement)statement).getAssertCondition());
@@ -357,7 +390,19 @@ class ContractInferenceInterpreter {
return -1;
}
- private static ValueConstraint[] withConstraint(ValueConstraint[] constraints, int index, ValueConstraint constraint) {
+ @Nullable
+ private ValueConstraint[] withConstraint(ValueConstraint[] constraints, int index, ValueConstraint constraint) {
+ if (constraints[index] == constraint) return constraints;
+
+ ValueConstraint negated = negateConstraint(constraint);
+ if (negated != constraint && constraints[index] == negated) {
+ return null;
+ }
+
+ if (constraint == NULL_VALUE && NullableNotNullManager.isNotNull(myMethod.getParameterList().getParameters()[index])) {
+ return null;
+ }
+
ValueConstraint[] copy = constraints.clone();
copy[index] = constraint;
return copy;
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/ControlFlowAnalyzer.java b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/ControlFlowAnalyzer.java
index 65e7fd7c859a..7ef19f2b73d0 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/ControlFlowAnalyzer.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/ControlFlowAnalyzer.java
@@ -20,7 +20,6 @@ import com.intellij.codeInspection.dataFlow.instructions.*;
import com.intellij.codeInspection.dataFlow.value.*;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.Condition;
-import com.intellij.openapi.util.registry.Registry;
import com.intellij.psi.*;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.psi.tree.IElementType;
@@ -30,37 +29,15 @@ import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.containers.Stack;
import com.siyeh.ig.numeric.UnnecessaryExplicitNumericCastInspection;
import org.jetbrains.annotations.Contract;
-import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.*;
-import java.util.regex.Pattern;
-import static com.intellij.codeInspection.dataFlow.MethodContract.ValueConstraint;
import static com.intellij.psi.CommonClassNames.*;
public class ControlFlowAnalyzer extends JavaElementVisitor {
private static final Logger LOG = Logger.getInstance("#com.intellij.codeInspection.dataFlow.ControlFlowAnalyzer");
- private static final Condition<String> FALSE_GETTERS = parseFalseGetters();
-
- private static Condition<String> parseFalseGetters() {
- try {
- final Pattern pattern = Pattern.compile(Registry.stringValue("ide.dfa.getters.with.side.effects"));
- return new Condition<String>() {
- @Override
- public boolean value(String s) {
- return pattern.matcher(s).matches();
- }
- };
- }
- catch (Exception e) {
- LOG.error(e);
- //noinspection unchecked
- return Condition.FALSE;
- }
- }
-
public static final String ORG_JETBRAINS_ANNOTATIONS_CONTRACT = Contract.class.getName();
private boolean myIgnoreAssertions;
@@ -209,9 +186,23 @@ public class ControlFlowAnalyzer extends JavaElementVisitor {
}
addInstruction(new AssignInstruction(rExpr));
+
+ flushArrayElementsOnUnknownIndexAssignment(lExpr);
+
finishElement(expression);
}
+ private void flushArrayElementsOnUnknownIndexAssignment(PsiExpression lExpr) {
+ if (lExpr instanceof PsiArrayAccessExpression &&
+ myFactory.createValue(lExpr) == null // check for unknown index, otherwise AssignInstruction will flush only that element
+ ) {
+ DfaValue arrayVar = myFactory.createValue(((PsiArrayAccessExpression)lExpr).getArrayExpression());
+ if (arrayVar instanceof DfaVariableValue) {
+ addInstruction(new FlushVariableInstruction((DfaVariableValue)arrayVar));
+ }
+ }
+ }
+
private void generateDefaultAssignmentBinOp(PsiExpression lExpr, PsiExpression rExpr, final PsiType exprType) {
lExpr.accept(this);
addInstruction(new DupInstruction());
@@ -635,7 +626,7 @@ public class ControlFlowAnalyzer extends JavaElementVisitor {
((PsiReferenceExpression)caseExpression).getQualifierExpression() == null &&
JavaPsiFacade.getInstance(body.getProject()).getConstantEvaluationHelper().computeConstantExpression(caseValue) != null) {
- addInstruction(new PushInstruction(getExpressionDfaValue((PsiReferenceExpression)caseExpression), caseExpression));
+ addInstruction(new PushInstruction(myFactory.createValue(caseExpression), caseExpression));
caseValue.accept(this);
addInstruction(new BinopInstruction(JavaTokenType.EQEQ, null, caseExpression.getProject()));
}
@@ -1030,7 +1021,8 @@ public class ControlFlowAnalyzer extends JavaElementVisitor {
addInstruction(new PopInstruction());
}
- pushTypeOrUnknown(arrayExpression);
+ DfaValue toPush = myFactory.createValue(expression);
+ addInstruction(new PushInstruction(toPush != null ? toPush : myFactory.createTypeValue(expression.getType(), Nullness.UNKNOWN), null));
finishElement(expression);
}
@@ -1396,8 +1388,8 @@ public class ControlFlowAnalyzer extends JavaElementVisitor {
}
addConditionalRuntimeThrow();
- List<MethodContract> contracts = method instanceof PsiMethod ? getMethodContracts((PsiMethod)method) : Collections.<MethodContract>emptyList();
- addInstruction(new MethodCallInstruction(expression, createChainedVariableValue(expression), contracts));
+ List<MethodContract> contracts = method instanceof PsiMethod ? getMethodCallContracts((PsiMethod)method, expression) : Collections.<MethodContract>emptyList();
+ addInstruction(new MethodCallInstruction(expression, myFactory.createValue(expression), contracts));
if (!contracts.isEmpty()) {
// if a contract resulted in 'fail', handle it
addInstruction(new DupInstruction());
@@ -1431,6 +1423,11 @@ public class ControlFlowAnalyzer extends JavaElementVisitor {
finishElement(expression);
}
+ private static List<MethodContract> getMethodCallContracts(@NotNull final PsiMethod method, @NotNull PsiMethodCallExpression call) {
+ List<MethodContract> contracts = HardcodedContracts.getHardcodedContracts(method, call);
+ return !contracts.isEmpty() ? contracts : getMethodContracts(method);
+ }
+
static List<MethodContract> getMethodContracts(@NotNull final PsiMethod method) {
final PsiAnnotation contractAnno = findContractAnnotation(method);
final int paramCount = method.getParameterList().getParametersCount();
@@ -1458,45 +1455,6 @@ public class ControlFlowAnalyzer extends JavaElementVisitor {
});
}
- @NonNls String methodName = method.getName();
-
- PsiClass owner = method.getContainingClass();
- if (owner != null) {
- final String className = owner.getQualifiedName();
- if ("java.lang.System".equals(className)) {
- if ("exit".equals(methodName)) {
- return Collections.singletonList(new MethodContract(MethodContract.createConstraintArray(paramCount), ValueConstraint.THROW_EXCEPTION));
- }
- }
- else if ("junit.framework.Assert".equals(className) || "org.junit.Assert".equals(className) ||
- "junit.framework.TestCase".equals(className) || "org.testng.Assert".equals(className) || "org.testng.AssertJUnit".equals(className)) {
- boolean testng = className.startsWith("org.testng.");
- if ("fail".equals(methodName)) {
- return Collections.singletonList(new MethodContract(MethodContract.createConstraintArray(paramCount), ValueConstraint.THROW_EXCEPTION));
- }
-
- int checkedParam = testng ? 0 : paramCount - 1;
- ValueConstraint[] constraints = MethodContract.createConstraintArray(paramCount);
- if ("assertTrue".equals(methodName)) {
- constraints[checkedParam] = ValueConstraint.FALSE_VALUE;
- return Collections.singletonList(new MethodContract(constraints, ValueConstraint.THROW_EXCEPTION));
- }
- if ("assertFalse".equals(methodName)) {
- constraints[checkedParam] = ValueConstraint.TRUE_VALUE;
- return Collections.singletonList(new MethodContract(constraints, ValueConstraint.THROW_EXCEPTION));
- }
- if ("assertNull".equals(methodName)) {
- constraints[checkedParam] = ValueConstraint.NOT_NULL_VALUE;
- return Collections.singletonList(new MethodContract(constraints, ValueConstraint.THROW_EXCEPTION));
- }
- if ("assertNotNull".equals(methodName)) {
- constraints[checkedParam] = ValueConstraint.NULL_VALUE;
- return Collections.singletonList(new MethodContract(constraints, ValueConstraint.THROW_EXCEPTION));
- }
- return Collections.emptyList();
- }
- }
-
return Collections.emptyList();
}
@@ -1505,20 +1463,6 @@ public class ControlFlowAnalyzer extends JavaElementVisitor {
return AnnotationUtil.findAnnotation(method, ORG_JETBRAINS_ANNOTATIONS_CONTRACT);
}
- private void pushTypeOrUnknown(PsiExpression expr) {
- PsiType type = expr.getType();
-
- final DfaValue dfaValue;
- if (type instanceof PsiClassType) {
- dfaValue = myFactory.createTypeValue(type, Nullness.UNKNOWN);
- }
- else {
- dfaValue = null;
- }
-
- addInstruction(new PushInstruction(dfaValue, null));
- }
-
@Override public void visitNewExpression(PsiNewExpression expression) {
startElement(expression);
@@ -1657,88 +1601,11 @@ public class ControlFlowAnalyzer extends JavaElementVisitor {
}
boolean referenceRead = PsiUtil.isAccessedForReading(expression) && !PsiUtil.isAccessedForWriting(expression);
- addInstruction(new PushInstruction(getExpressionDfaValue(expression), expression, referenceRead));
+ addInstruction(new PushInstruction(myFactory.createValue(expression), expression, referenceRead));
finishElement(expression);
}
- @Nullable
- private DfaValue getExpressionDfaValue(PsiReferenceExpression expression) {
- DfaValue dfaValue = myFactory.createReferenceValue(expression);
- if (dfaValue == null) {
- PsiElement resolved = expression.resolve();
- if (resolved instanceof PsiField) {
- dfaValue = createDfaValueForAnotherInstanceMemberAccess(expression, (PsiField)resolved);
- }
- }
- return dfaValue;
- }
-
- @NotNull
- private DfaValue createDfaValueForAnotherInstanceMemberAccess(PsiReferenceExpression expression, PsiField field) {
- DfaValue dfaValue = null;
- if (expression.getQualifierExpression() != null) {
- dfaValue = createChainedVariableValue(expression);
- }
- if (dfaValue == null) {
- PsiType type = expression.getType();
- return myFactory.createTypeValue(type, DfaPsiUtil.getElementNullability(type, field));
- }
- return dfaValue;
- }
-
- @Nullable
- private DfaVariableValue createChainedVariableValue(@Nullable PsiExpression expression) {
- if (expression instanceof PsiParenthesizedExpression) {
- return createChainedVariableValue(((PsiParenthesizedExpression)expression).getExpression());
- }
-
- PsiReferenceExpression refExpr;
- if (expression instanceof PsiMethodCallExpression) {
- refExpr = ((PsiMethodCallExpression)expression).getMethodExpression();
- }
- else if (expression instanceof PsiReferenceExpression) {
- refExpr = (PsiReferenceExpression)expression;
- }
- else {
- return null;
- }
-
- PsiElement target = refExpr.resolve();
- PsiModifierListOwner var = getAccessedVariable(target);
- if (var == null) {
- return null;
- }
-
- if (DfaValueFactory.isEffectivelyUnqualified(refExpr)) {
- return myFactory.getVarFactory().createVariableValue(var, refExpr.getType(), false, null);
- }
-
- if (!(var instanceof PsiField) || !var.hasModifierProperty(PsiModifier.TRANSIENT) && !var.hasModifierProperty(PsiModifier.VOLATILE)) {
- DfaVariableValue qualifierValue = createChainedVariableValue(refExpr.getQualifierExpression());
- if (qualifierValue != null) {
- return myFactory.getVarFactory().createVariableValue(var, refExpr.getType(), false, qualifierValue);
- }
- }
- return null;
- }
-
- @Nullable
- private static PsiModifierListOwner getAccessedVariable(final PsiElement target) {
- if (target instanceof PsiVariable) {
- return (PsiVariable)target;
- }
- if (target instanceof PsiMethod) {
- if (PropertyUtil.isSimplePropertyGetter((PsiMethod)target)) {
- String qName = PsiUtil.getMemberQualifiedName((PsiMethod)target);
- if (qName == null || !FALSE_GETTERS.value(qName)) {
- return (PsiMethod)target;
- }
- }
- }
- return null;
- }
-
@Override public void visitSuperExpression(PsiSuperExpression expression) {
startElement(expression);
addInstruction(new PushInstruction(myFactory.createTypeValue(expression.getType(), Nullness.NOT_NULL), null));
@@ -1769,7 +1636,7 @@ public class ControlFlowAnalyzer extends JavaElementVisitor {
generateBoxingUnboxingInstructionFor(operand, castExpression.getType());
}
else {
- pushTypeOrUnknown(castExpression);
+ addInstruction(new PushInstruction(myFactory.createTypeValue(castExpression.getType(), Nullness.UNKNOWN), null));
}
final PsiTypeElement typeElement = castExpression.getCastType();
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DataFlowInspectionBase.java b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DataFlowInspectionBase.java
index 3e017e091084..d66d63bf85c3 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DataFlowInspectionBase.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DataFlowInspectionBase.java
@@ -32,7 +32,8 @@ import com.intellij.codeInsight.daemon.impl.quickfix.SimplifyBooleanExpressionFi
import com.intellij.codeInsight.intention.impl.AddNullableAnnotationFix;
import com.intellij.codeInspection.*;
import com.intellij.codeInspection.dataFlow.instructions.*;
-import com.intellij.codeInspection.dataFlow.value.*;
+import com.intellij.codeInspection.dataFlow.value.DfaConstValue;
+import com.intellij.codeInspection.dataFlow.value.DfaValue;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Condition;
@@ -41,9 +42,9 @@ import com.intellij.openapi.util.WriteExternalException;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.pom.java.LanguageLevel;
import com.intellij.psi.*;
-import com.intellij.psi.codeStyle.JavaCodeStyleManager;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.psi.util.PsiUtil;
+import com.intellij.refactoring.extractMethod.ExtractMethodUtil;
import com.intellij.util.ArrayUtil;
import com.intellij.util.ArrayUtilRt;
import com.intellij.util.IncorrectOperationException;
@@ -106,7 +107,6 @@ public class DataFlowInspectionBase extends BaseJavaBatchLocalInspectionTool {
public void visitIfStatement(PsiIfStatement statement) {
PsiExpression condition = statement.getCondition();
if (BranchingInstruction.isBoolConst(condition)) {
- assert condition != null;
LocalQuickFix fix = createSimplifyBooleanExpressionFix(condition, condition.textMatches(PsiKeyword.TRUE));
holder.registerProblem(condition, "Condition is always " + condition.getText(), fix);
}
@@ -253,7 +253,7 @@ public class DataFlowInspectionBase extends BaseJavaBatchLocalInspectionTool {
final Object value = pair.second.getValue();
PsiVariable constant = pair.second.getConstant();
final String presentableName = constant != null ? constant.getName() : String.valueOf(value);
- final String exprText = getConstantValueText(value, constant);
+ final String exprText = String.valueOf(value);
if (presentableName == null || exprText == null) {
continue;
}
@@ -280,31 +280,23 @@ public class DataFlowInspectionBase extends BaseJavaBatchLocalInspectionTool {
PsiElement problemElement = descriptor.getPsiElement();
if (problemElement == null) return;
+ PsiMethodCallExpression call = problemElement.getParent() instanceof PsiExpressionList &&
+ problemElement.getParent().getParent() instanceof PsiMethodCallExpression ?
+ (PsiMethodCallExpression)problemElement.getParent().getParent() :
+ null;
+ PsiMethod targetMethod = call == null ? null : call.resolveMethod();
+
JavaPsiFacade facade = JavaPsiFacade.getInstance(project);
- PsiElement newElement = problemElement.replace(facade.getElementFactory().createExpressionFromText(exprText, null));
- newElement = JavaCodeStyleManager.getInstance(project).shortenClassReferences(newElement);
- if (newElement instanceof PsiJavaCodeReferenceElement) {
- PsiJavaCodeReferenceElement ref = (PsiJavaCodeReferenceElement)newElement;
- PsiElement target = ref.resolve();
- String shortName = ref.getReferenceName();
- if (target != null && shortName != null && ref.isQualified() &&
- facade.getResolveHelper().resolveReferencedVariable(shortName, newElement) == target) {
- newElement.replace(facade.getElementFactory().createExpressionFromText(shortName, null));
- }
+ problemElement.replace(facade.getElementFactory().createExpressionFromText(exprText, null));
+
+ if (targetMethod != null) {
+ ExtractMethodUtil.addCastsToEnsureResolveTarget(targetMethod, call);
}
}
});
}
}
- private static String getConstantValueText(Object value, @Nullable PsiVariable constant) {
- if (constant != null) {
- return constant instanceof PsiMember ? PsiUtil.getMemberQualifiedName((PsiMember)constant) : constant.getName();
- }
-
- return value instanceof String ? "\"" + StringUtil.escapeStringCharacters((String)value) + "\"" : String.valueOf(value);
- }
-
private void reportNullableArgumentsPassedToNonAnnotated(DataFlowInstructionVisitor visitor, ProblemsHolder holder, Set<PsiElement> reportedAnchors) {
for (PsiElement expr : visitor.getProblems(NullabilityProblem.passingNullableArgumentToNonAnnotatedParameter)) {
if (reportedAnchors.contains(expr)) continue;
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DfaPsiUtil.java b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DfaPsiUtil.java
index e6c278e1414b..4dd2ac23c9ae 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DfaPsiUtil.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DfaPsiUtil.java
@@ -17,16 +17,15 @@ package com.intellij.codeInspection.dataFlow;
import com.intellij.codeInsight.NullableNotNullManager;
import com.intellij.codeInspection.dataFlow.instructions.Instruction;
+import com.intellij.codeInspection.dataFlow.instructions.MethodCallInstruction;
import com.intellij.codeInspection.dataFlow.instructions.ReturnInstruction;
+import com.intellij.codeInspection.dataFlow.value.DfaValueFactory;
import com.intellij.openapi.util.Ref;
import com.intellij.psi.*;
import com.intellij.psi.search.LocalSearchScope;
import com.intellij.psi.search.searches.ReferencesSearch;
import com.intellij.psi.tree.IElementType;
-import com.intellij.psi.util.CachedValueProvider;
-import com.intellij.psi.util.CachedValuesManager;
-import com.intellij.psi.util.PsiModificationTracker;
-import com.intellij.psi.util.PsiTreeUtil;
+import com.intellij.psi.util.*;
import com.intellij.util.NullableFunction;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.containers.MultiMap;
@@ -126,11 +125,36 @@ public class DfaPsiUtil {
shouldCheck = psiBlock == body;
}
+ private boolean isCallExposingNonInitializedFields(Instruction instruction) {
+ if (!(instruction instanceof MethodCallInstruction) ||
+ ((MethodCallInstruction)instruction).getMethodType() != MethodCallInstruction.MethodType.REGULAR_METHOD_CALL) {
+ return false;
+ }
+
+ PsiCallExpression call = ((MethodCallInstruction)instruction).getCallExpression();
+ if (call == null) return false;
+
+ if (call instanceof PsiMethodCallExpression &&
+ DfaValueFactory.isEffectivelyUnqualified(((PsiMethodCallExpression)call).getMethodExpression())) {
+ return true;
+ }
+
+ PsiExpressionList argumentList = call.getArgumentList();
+ if (argumentList != null) {
+ for (PsiExpression expression : argumentList.getExpressions()) {
+ if (expression instanceof PsiThisExpression) return true;
+ }
+ }
+
+ return false;
+ }
+
@Override
protected DfaInstructionState[] acceptInstruction(InstructionVisitor visitor, DfaInstructionState instructionState) {
if (shouldCheck) {
Instruction instruction = instructionState.getInstruction();
- if (instruction instanceof ReturnInstruction && !((ReturnInstruction)instruction).isViaException()) {
+ if (isCallExposingNonInitializedFields(instruction) ||
+ instruction instanceof ReturnInstruction && !((ReturnInstruction)instruction).isViaException()) {
for (PsiField field : containingClass.getFields()) {
if (!instructionState.getMemoryState().isNotNull(getFactory().getVarFactory().createVariableValue(field, false))) {
map.put(field, false);
@@ -138,6 +162,7 @@ public class DfaPsiUtil {
map.put(field, true);
}
}
+ return DfaInstructionState.EMPTY_ARRAY;
}
}
return super.acceptInstruction(visitor, instructionState);
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/HardcodedContracts.java b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/HardcodedContracts.java
new file mode 100644
index 000000000000..7e77dc281c1d
--- /dev/null
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/HardcodedContracts.java
@@ -0,0 +1,133 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.codeInspection.dataFlow;
+
+import com.intellij.psi.*;
+import com.siyeh.ig.psiutils.ExpressionUtils;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.Collections;
+import java.util.List;
+
+import static com.intellij.codeInspection.dataFlow.MethodContract.ValueConstraint.*;
+import static com.intellij.codeInspection.dataFlow.MethodContract.createConstraintArray;
+
+/**
+ * @author peter
+ */
+class HardcodedContracts {
+ static List<MethodContract> getHardcodedContracts(@NotNull PsiMethod method, @NotNull PsiMethodCallExpression call) {
+ PsiClass owner = method.getContainingClass();
+ if (owner == null) return Collections.emptyList();
+
+ final int paramCount = method.getParameterList().getParametersCount();
+ String className = owner.getQualifiedName();
+ String methodName = method.getName();
+
+ if ("java.lang.System".equals(className)) {
+ if ("exit".equals(methodName)) {
+ return Collections.singletonList(new MethodContract(createConstraintArray(paramCount), THROW_EXCEPTION));
+ }
+ }
+ else if ("com.google.common.base.Preconditions".equals(className)) {
+ if ("checkNotNull".equals(methodName) && paramCount > 0) {
+ MethodContract.ValueConstraint[] constraints = createConstraintArray(paramCount);
+ constraints[0] = NULL_VALUE;
+ return Collections.singletonList(new MethodContract(constraints, THROW_EXCEPTION));
+ }
+ }
+ else if ("junit.framework.Assert".equals(className) ||
+ "org.junit.Assert".equals(className) ||
+ "junit.framework.TestCase".equals(className) ||
+ "org.testng.Assert".equals(className) ||
+ "org.testng.AssertJUnit".equals(className)) {
+ return handleTestFrameworks(paramCount, className, methodName, call);
+ }
+
+ return Collections.emptyList();
+ }
+
+ private static boolean isNotNullMatcher(PsiExpression expr) {
+ if (expr instanceof PsiMethodCallExpression) {
+ String calledName = ((PsiMethodCallExpression)expr).getMethodExpression().getReferenceName();
+ if ("notNullValue".equals(calledName)) {
+ return true;
+ }
+ if ("not".equals(calledName)) {
+ PsiExpression[] notArgs = ((PsiMethodCallExpression)expr).getArgumentList().getExpressions();
+ if (notArgs.length == 1 &&
+ notArgs[0] instanceof PsiMethodCallExpression &&
+ "equalTo".equals(((PsiMethodCallExpression)notArgs[0]).getMethodExpression().getReferenceName())) {
+ PsiExpression[] equalArgs = ((PsiMethodCallExpression)notArgs[0]).getArgumentList().getExpressions();
+ if (equalArgs.length == 1 && ExpressionUtils.isNullLiteral(equalArgs[0])) {
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ private static List<MethodContract> handleTestFrameworks(int paramCount, String className, String methodName,
+ @NotNull PsiMethodCallExpression call) {
+ if ("assertThat".equals(methodName)) {
+ PsiExpression[] args = call.getArgumentList().getExpressions();
+ if (args.length == paramCount) {
+ for (int i = 1; i < args.length; i++) {
+ if (isNotNullMatcher(args[i])) {
+ MethodContract.ValueConstraint[] constraints = createConstraintArray(args.length);
+ constraints[i - 1] = NULL_VALUE;
+ return Collections.singletonList(new MethodContract(constraints, THROW_EXCEPTION));
+ }
+ }
+ }
+ return Collections.emptyList();
+ }
+
+ if (!"junit.framework.Assert".equals(className) &&
+ !"junit.framework.TestCase".equals(className) &&
+ !"org.junit.Assert".equals(className) &&
+ !"org.testng.Assert".equals(className) &&
+ !"org.testng.AssertJUnit".equals(className)) {
+ return Collections.emptyList();
+ }
+
+ boolean testng = className.startsWith("org.testng.");
+ if ("fail".equals(methodName)) {
+ return Collections.singletonList(new MethodContract(createConstraintArray(paramCount), THROW_EXCEPTION));
+ }
+
+ int checkedParam = testng ? 0 : paramCount - 1;
+ MethodContract.ValueConstraint[] constraints = createConstraintArray(paramCount);
+ if ("assertTrue".equals(methodName)) {
+ constraints[checkedParam] = FALSE_VALUE;
+ return Collections.singletonList(new MethodContract(constraints, THROW_EXCEPTION));
+ }
+ if ("assertFalse".equals(methodName)) {
+ constraints[checkedParam] = TRUE_VALUE;
+ return Collections.singletonList(new MethodContract(constraints, THROW_EXCEPTION));
+ }
+ if ("assertNull".equals(methodName)) {
+ constraints[checkedParam] = NOT_NULL_VALUE;
+ return Collections.singletonList(new MethodContract(constraints, THROW_EXCEPTION));
+ }
+ if ("assertNotNull".equals(methodName)) {
+ constraints[checkedParam] = NULL_VALUE;
+ return Collections.singletonList(new MethodContract(constraints, THROW_EXCEPTION));
+ }
+ return Collections.emptyList();
+ }
+}
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/MethodContract.java b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/MethodContract.java
index 160f69ba349e..691c2f00d985 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/MethodContract.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/MethodContract.java
@@ -20,6 +20,7 @@ import com.intellij.codeInspection.dataFlow.value.DfaValueFactory;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.util.Function;
import com.intellij.util.containers.ContainerUtil;
+import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.List;
@@ -31,7 +32,7 @@ public class MethodContract {
public final ValueConstraint[] arguments;
public final ValueConstraint returnValue;
- public MethodContract(ValueConstraint[] arguments, ValueConstraint returnValue) {
+ public MethodContract(@NotNull ValueConstraint[] arguments, @NotNull ValueConstraint returnValue) {
this.arguments = arguments;
this.returnValue = returnValue;
}
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/StandardInstructionVisitor.java b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/StandardInstructionVisitor.java
index 522bd34a9cf7..013e24cbe07a 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/StandardInstructionVisitor.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/StandardInstructionVisitor.java
@@ -455,10 +455,10 @@ public class StandardInstructionVisitor extends InstructionVisitor {
DfaValue dfaRight,
DfaValue dfaLeft, IElementType opSign) {
if (dfaRight instanceof DfaConstValue && dfaLeft instanceof DfaVariableValue) {
- PsiType varType = ((DfaVariableValue)dfaLeft).getVariableType();
Object value = ((DfaConstValue)dfaRight).getValue();
- if (varType instanceof PsiPrimitiveType && value instanceof Number) {
- DfaInstructionState[] result = checkTypeRanges(instruction, runner, memState, opSign, varType, ((Number)value).longValue());
+ if (value instanceof Number) {
+ DfaInstructionState[] result = checkComparingWithConstant(instruction, runner, memState, (DfaVariableValue)dfaLeft, opSign,
+ ((Number)value).doubleValue());
if (result != null) {
return result;
}
@@ -485,33 +485,60 @@ public class StandardInstructionVisitor extends InstructionVisitor {
return null;
}
- private static DfaInstructionState[] checkTypeRanges(BinopInstruction instruction,
- DataFlowRunner runner,
- DfaMemoryState memState,
- IElementType opSign, PsiType varType, long constantValue) {
- long minValue = varType == PsiType.BYTE ? Byte.MIN_VALUE :
- varType == PsiType.SHORT ? Short.MIN_VALUE :
- varType == PsiType.INT ? Integer.MIN_VALUE :
- varType == PsiType.CHAR ? Character.MIN_VALUE :
- Long.MIN_VALUE;
- long maxValue = varType == PsiType.BYTE ? Byte.MAX_VALUE :
- varType == PsiType.SHORT ? Short.MAX_VALUE :
- varType == PsiType.INT ? Integer.MAX_VALUE :
- varType == PsiType.CHAR ? Character.MAX_VALUE :
- Long.MAX_VALUE;
-
- if (constantValue < minValue || constantValue > maxValue) {
+ @Nullable
+ private static DfaInstructionState[] checkComparingWithConstant(BinopInstruction instruction,
+ DataFlowRunner runner,
+ DfaMemoryState memState,
+ DfaVariableValue var,
+ IElementType opSign, double comparedWith) {
+ DfaConstValue knownConstantValue = memState.getConstantValue(var);
+ Object knownValue = knownConstantValue == null ? null : knownConstantValue.getValue();
+ if (knownValue instanceof Number) {
+ double knownDouble = ((Number)knownValue).doubleValue();
+ return checkComparisonWithKnownRange(instruction, runner, memState, opSign, comparedWith, knownDouble, knownDouble);
+ }
+
+ PsiType varType = var.getVariableType();
+ if (!(varType instanceof PsiPrimitiveType)) return null;
+
+ double minValue = varType == PsiType.BYTE ? Byte.MIN_VALUE :
+ varType == PsiType.SHORT ? Short.MIN_VALUE :
+ varType == PsiType.INT ? Integer.MIN_VALUE :
+ varType == PsiType.CHAR ? Character.MIN_VALUE :
+ varType == PsiType.LONG ? Long.MIN_VALUE :
+ varType == PsiType.FLOAT ? Float.MIN_VALUE :
+ Double.MIN_VALUE;
+ double maxValue = varType == PsiType.BYTE ? Byte.MAX_VALUE :
+ varType == PsiType.SHORT ? Short.MAX_VALUE :
+ varType == PsiType.INT ? Integer.MAX_VALUE :
+ varType == PsiType.CHAR ? Character.MAX_VALUE :
+ varType == PsiType.LONG ? Long.MAX_VALUE :
+ varType == PsiType.FLOAT ? Float.MAX_VALUE :
+ Double.MAX_VALUE;
+
+ return checkComparisonWithKnownRange(instruction, runner, memState, opSign, comparedWith, minValue, maxValue);
+ }
+
+ @Nullable
+ private static DfaInstructionState[] checkComparisonWithKnownRange(BinopInstruction instruction,
+ DataFlowRunner runner,
+ DfaMemoryState memState,
+ IElementType opSign,
+ double comparedWith,
+ double rangeMin,
+ double rangeMax) {
+ if (comparedWith < rangeMin || comparedWith > rangeMax) {
if (opSign == EQEQ) return alwaysFalse(instruction, runner, memState);
if (opSign == NE) return alwaysTrue(instruction, runner, memState);
}
- if (opSign == LT && constantValue <= minValue) return alwaysFalse(instruction, runner, memState);
- if (opSign == LT && constantValue > maxValue) return alwaysTrue(instruction, runner, memState);
- if (opSign == LE && constantValue >= maxValue) return alwaysTrue(instruction, runner, memState);
+ 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 == GT && constantValue >= maxValue) return alwaysFalse(instruction, runner, memState);
- if (opSign == GT && constantValue < minValue) return alwaysTrue(instruction, runner, memState);
- if (opSign == GE && constantValue <= minValue) return alwaysTrue(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);
return null;
}
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/value/DfaExpressionFactory.java b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/value/DfaExpressionFactory.java
new file mode 100644
index 000000000000..ec9e02fce92d
--- /dev/null
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/value/DfaExpressionFactory.java
@@ -0,0 +1,170 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.codeInspection.dataFlow.value;
+
+import com.intellij.codeInspection.dataFlow.DfaPsiUtil;
+import com.intellij.codeInspection.dataFlow.Nullness;
+import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.openapi.util.Condition;
+import com.intellij.openapi.util.registry.Registry;
+import com.intellij.psi.*;
+import com.intellij.psi.impl.JavaConstantExpressionEvaluator;
+import com.intellij.psi.util.PropertyUtil;
+import com.intellij.psi.util.PsiUtil;
+import com.intellij.util.containers.ContainerUtil;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.Map;
+import java.util.regex.Pattern;
+
+/**
+ * @author peter
+ */
+public class DfaExpressionFactory {
+ private static final Logger LOG = Logger.getInstance("#com.intellij.codeInspection.dataFlow.value.DfaExpressionFactory");
+ private static final Condition<String> FALSE_GETTERS = parseFalseGetters();
+
+ private static Condition<String> parseFalseGetters() {
+ try {
+ final Pattern pattern = Pattern.compile(Registry.stringValue("ide.dfa.getters.with.side.effects"));
+ return new Condition<String>() {
+ @Override
+ public boolean value(String s) {
+ return pattern.matcher(s).matches();
+ }
+ };
+ }
+ catch (Exception e) {
+ LOG.error(e);
+ //noinspection unchecked
+ return Condition.FALSE;
+ }
+ }
+
+ private final DfaValueFactory myFactory;
+ private Map<Integer, PsiVariable> myMockIndices = ContainerUtil.newHashMap();
+
+ public DfaExpressionFactory(DfaValueFactory factory) {
+ myFactory = factory;
+ }
+
+ @Nullable
+ public DfaValue getExpressionDfaValue(@Nullable PsiExpression expression) {
+ if (expression == null) return null;
+
+ if (expression instanceof PsiParenthesizedExpression) {
+ return getExpressionDfaValue(((PsiParenthesizedExpression)expression).getExpression());
+ }
+
+ if (expression instanceof PsiArrayAccessExpression) {
+ PsiExpression arrayExpression = ((PsiArrayAccessExpression)expression).getArrayExpression();
+ DfaValue qualifier = getExpressionDfaValue(arrayExpression);
+ if (qualifier instanceof DfaVariableValue) {
+ PsiVariable indexVar = getArrayIndexVariable(((PsiArrayAccessExpression)expression).getIndexExpression());
+ if (indexVar != null) {
+ return myFactory.getVarFactory().createVariableValue(indexVar, expression.getType(), false, (DfaVariableValue)qualifier);
+ }
+ }
+ return null;
+ }
+
+ if (expression instanceof PsiMethodCallExpression) {
+ return createReferenceValue(((PsiMethodCallExpression)expression).getMethodExpression());
+ }
+
+ if (expression instanceof PsiReferenceExpression) {
+ return createReferenceValue((PsiReferenceExpression)expression);
+ }
+
+ if (expression instanceof PsiLiteralExpression) {
+ return myFactory.createLiteralValue((PsiLiteralExpression)expression);
+ }
+
+ if (expression instanceof PsiNewExpression) {
+ return myFactory.createTypeValue(expression.getType(), Nullness.NOT_NULL);
+ }
+
+ final Object value = JavaConstantExpressionEvaluator.computeConstantExpression(expression, false);
+ PsiType type = expression.getType();
+ if (value != null && type != null) {
+ if (value instanceof String) {
+ return myFactory.createTypeValue(type, Nullness.NOT_NULL); // Non-null string literal.
+ }
+ return myFactory.getConstFactory().createFromValue(value, type, null);
+ }
+
+ return null;
+ }
+
+ private DfaValue createReferenceValue(@NotNull PsiReferenceExpression refExpr) {
+ PsiModifierListOwner var = getAccessedVariableOrGetter(refExpr.resolve());
+ if (var == null) {
+ return null;
+ }
+
+ if (!var.hasModifierProperty(PsiModifier.VOLATILE) && !var.hasModifierProperty(PsiModifier.TRANSIENT)) {
+ if (var instanceof PsiVariable && var.hasModifierProperty(PsiModifier.FINAL)) {
+ DfaValue constValue = myFactory.getConstFactory().create((PsiVariable)var);
+ if (constValue != null) return constValue;
+ }
+
+ if (DfaValueFactory.isEffectivelyUnqualified(refExpr)) {
+ return myFactory.getVarFactory().createVariableValue(var, refExpr.getType(), false, null);
+ }
+
+ DfaValue qualifierValue = getExpressionDfaValue(refExpr.getQualifierExpression());
+ if (qualifierValue instanceof DfaVariableValue) {
+ return myFactory.getVarFactory().createVariableValue(var, refExpr.getType(), false, (DfaVariableValue)qualifierValue);
+ }
+ }
+
+ PsiType type = refExpr.getType();
+ return myFactory.createTypeValue(type, DfaPsiUtil.getElementNullability(type, var));
+ }
+
+ @Nullable
+ private static PsiModifierListOwner getAccessedVariableOrGetter(final PsiElement target) {
+ if (target instanceof PsiVariable) {
+ return (PsiVariable)target;
+ }
+ if (target instanceof PsiMethod) {
+ if (PropertyUtil.isSimplePropertyGetter((PsiMethod)target)) {
+ String qName = PsiUtil.getMemberQualifiedName((PsiMethod)target);
+ if (qName == null || !FALSE_GETTERS.value(qName)) {
+ return (PsiMethod)target;
+ }
+ }
+ }
+ return null;
+ }
+
+ @Nullable
+ private PsiVariable getArrayIndexVariable(@Nullable PsiExpression indexExpression) {
+ Object constant = JavaConstantExpressionEvaluator.computeConstantExpression(indexExpression, false);
+ if (constant instanceof Integer) {
+ PsiVariable mockVar = myMockIndices.get(constant);
+ if (mockVar == null) {
+ mockVar = JavaPsiFacade.getElementFactory(indexExpression.getProject()).createField("$array$index$" + constant, PsiType.INT);
+ myMockIndices.put((Integer)constant, mockVar);
+ }
+ return mockVar;
+ }
+ return null;
+ }
+
+
+}
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/value/DfaValueFactory.java b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/value/DfaValueFactory.java
index ba7772ba2ca2..da1d2d952634 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/value/DfaValueFactory.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/value/DfaValueFactory.java
@@ -27,7 +27,6 @@ package com.intellij.codeInspection.dataFlow.value;
import com.intellij.codeInspection.dataFlow.Nullness;
import com.intellij.openapi.util.Pair;
import com.intellij.psi.*;
-import com.intellij.psi.impl.JavaConstantExpressionEvaluator;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.psi.util.TypeConversionUtil;
import com.intellij.util.containers.ContainerUtil;
@@ -52,6 +51,7 @@ public class DfaValueFactory {
myBoxedFactory = new DfaBoxedValue.Factory(this);
myTypeFactory = new DfaTypeValue.Factory(this);
myRelationFactory = new DfaRelationValue.Factory(this);
+ myExpressionFactory = new DfaExpressionFactory(this);
}
public boolean isHonorFieldInitializers() {
@@ -83,28 +83,7 @@ public class DfaValueFactory {
@Nullable
public DfaValue createValue(PsiExpression psiExpression) {
- if (psiExpression instanceof PsiReferenceExpression) {
- return createReferenceValue((PsiReferenceExpression)psiExpression);
- }
-
- if (psiExpression instanceof PsiLiteralExpression) {
- return createLiteralValue((PsiLiteralExpression)psiExpression);
- }
-
- if (psiExpression instanceof PsiNewExpression) {
- return createTypeValue(psiExpression.getType(), Nullness.NOT_NULL);
- }
-
- final Object value = JavaConstantExpressionEvaluator.computeConstantExpression(psiExpression, false);
- PsiType type = psiExpression.getType();
- if (value != null && type != null) {
- if (value instanceof String) {
- return createTypeValue(type, Nullness.NOT_NULL); // Non-null string literal.
- }
- return getConstFactory().createFromValue(value, type, null);
- }
-
- return null;
+ return myExpressionFactory.getExpressionDfaValue(psiExpression);
}
@Nullable
@@ -116,26 +95,6 @@ public class DfaValueFactory {
}
@Nullable
- public DfaValue createReferenceValue(PsiReferenceExpression referenceExpression) {
- PsiElement psiSource = referenceExpression.resolve();
- if (!(psiSource instanceof PsiVariable)) {
- return null;
- }
-
- final PsiVariable variable = (PsiVariable)psiSource;
- if (variable.hasModifierProperty(PsiModifier.FINAL) && !variable.hasModifierProperty(PsiModifier.TRANSIENT)) {
- DfaValue constValue = getConstFactory().create(variable);
- if (constValue != null) return constValue;
- }
-
- if (!variable.hasModifierProperty(PsiModifier.VOLATILE) && isEffectivelyUnqualified(referenceExpression)) {
- return getVarFactory().createVariableValue(variable, referenceExpression.getType(), false, null);
- }
-
- return null;
- }
-
- @Nullable
public static PsiVariable resolveUnqualifiedVariable(PsiReferenceExpression refExpression) {
if (isEffectivelyUnqualified(refExpression)) {
PsiElement resolved = refExpression.resolve();
@@ -168,6 +127,7 @@ public class DfaValueFactory {
private final DfaBoxedValue.Factory myBoxedFactory;
private final DfaTypeValue.Factory myTypeFactory;
private final DfaRelationValue.Factory myRelationFactory;
+ private final DfaExpressionFactory myExpressionFactory;
@NotNull
public DfaVariableValue.Factory getVarFactory() {
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/value/DfaVariableValue.java b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/value/DfaVariableValue.java
index 31492bb38b9b..3030bef32934 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/value/DfaVariableValue.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/value/DfaVariableValue.java
@@ -105,7 +105,7 @@ public class DfaVariableValue extends DfaValue {
return myTypeValue;
}
- @Nullable
+ @NotNull
public PsiModifierListOwner getPsiVariable() {
return myVariable;
}
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/inheritance/search/InheritorsStatisticalDataSearch.java b/java/java-analysis-impl/src/com/intellij/codeInspection/inheritance/search/InheritorsStatisticalDataSearch.java
index 8691d6b65f3e..4266b66cb6ed 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/inheritance/search/InheritorsStatisticalDataSearch.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/inheritance/search/InheritorsStatisticalDataSearch.java
@@ -1,6 +1,21 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package com.intellij.codeInspection.inheritance.search;
-import com.intellij.openapi.util.Pair;
+import com.intellij.openapi.util.Couple;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiClass;
import com.intellij.psi.search.GlobalSearchScope;
@@ -32,7 +47,7 @@ public class InheritorsStatisticalDataSearch {
disabledNames.add(aClassName);
disabledNames.add(superClassName);
final Set<InheritorsCountData> collector = new TreeSet<InheritorsCountData>();
- final Pair<Integer, Integer> collectingResult = collectInheritorsInfo(superClass, collector, disabledNames);
+ final Couple<Integer> collectingResult = collectInheritorsInfo(superClass, collector, disabledNames);
final int allAnonymousInheritors = collectingResult.getSecond();
final int allInheritors = collectingResult.getFirst() + allAnonymousInheritors - 1;
@@ -64,19 +79,19 @@ public class InheritorsStatisticalDataSearch {
return result;
}
- private static Pair<Integer, Integer> collectInheritorsInfo(final PsiClass superClass,
+ private static Couple<Integer> collectInheritorsInfo(final PsiClass superClass,
final Set<InheritorsCountData> collector,
final Set<String> disabledNames) {
return collectInheritorsInfo(superClass, collector, disabledNames, new HashSet<String>(), new HashSet<String>());
}
- private static Pair<Integer, Integer> collectInheritorsInfo(final PsiClass aClass,
+ private static Couple<Integer> collectInheritorsInfo(final PsiClass aClass,
final Set<InheritorsCountData> collector,
final Set<String> disabledNames,
final Set<String> processedElements,
final Set<String> allNotAnonymousInheritors) {
final String className = aClass.getName();
- if (!processedElements.add(className)) return Pair.create(0, 0);
+ if (!processedElements.add(className)) return Couple.of(0, 0);
final MyInheritorsInfoProcessor processor = new MyInheritorsInfoProcessor(collector, disabledNames, processedElements);
DirectClassInheritorsSearch.search(aClass).forEach(processor);
@@ -87,7 +102,7 @@ public class InheritorsStatisticalDataSearch {
if (!aClass.isInterface() && allInheritorsCount != 0 && !disabledNames.contains(className)) {
collector.add(new InheritorsCountData(aClass, allInheritorsCount));
}
- return Pair.create(allNotAnonymousInheritors.size(), processor.getAnonymousInheritorsCount());
+ return Couple.of(allNotAnonymousInheritors.size(), processor.getAnonymousInheritorsCount());
}
private static class MyInheritorsInfoProcessor implements Processor<PsiClass> {
@@ -120,8 +135,11 @@ public class InheritorsStatisticalDataSearch {
myAnonymousInheritorsCount++;
}
else {
- final Pair<Integer, Integer> res =
- collectInheritorsInfo(psiClass, myCollector, myDisabledNames, myProcessedElements, myAllNotAnonymousInheritors);
+ final Couple<Integer> res = collectInheritorsInfo(psiClass,
+ myCollector,
+ myDisabledNames,
+ myProcessedElements,
+ myAllNotAnonymousInheritors);
myAnonymousInheritorsCount += res.getSecond();
if (!psiClass.isInterface()) {
myAllNotAnonymousInheritors.add(inheritorName);
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/nullable/NullableStuffInspectionBase.java b/java/java-analysis-impl/src/com/intellij/codeInspection/nullable/NullableStuffInspectionBase.java
index 38f8d46fe10c..47d32a03bf8f 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/nullable/NullableStuffInspectionBase.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/nullable/NullableStuffInspectionBase.java
@@ -114,8 +114,8 @@ public class NullableStuffInspectionBase extends BaseJavaBatchLocalInspectionToo
ProblemHighlightType.GENERIC_ERROR_OR_WARNING, getterAnnoFix);
}
}
- if (annotated.isDeclaredNotNull && manager.isNullable(getter, false) ||
- annotated.isDeclaredNullable && manager.isNotNull(getter, false)) {
+ if (annotated.isDeclaredNotNull && isNullableNotInferred(getter, false) ||
+ annotated.isDeclaredNullable && isNotNullNotInferred(getter, false)) {
holder.registerProblem(nameIdentifier, InspectionsBundle.message(
"inspection.nullable.problems.annotated.field.getter.conflict", getPresentableAnnoName(field), getPresentableAnnoName(getter)),
ProblemHighlightType.GENERIC_ERROR_OR_WARNING, getterAnnoFix);
@@ -141,8 +141,8 @@ public class NullableStuffInspectionBase extends BaseJavaBatchLocalInspectionToo
addAnnoFix);
}
if (PropertyUtil.isSimpleSetter(setter)) {
- if (annotated.isDeclaredNotNull && manager.isNullable(parameter, false) ||
- annotated.isDeclaredNullable && manager.isNotNull(parameter, false)) {
+ if (annotated.isDeclaredNotNull && isNullableNotInferred(parameter, false) ||
+ annotated.isDeclaredNullable && isNotNullNotInferred(parameter, false)) {
final PsiIdentifier nameIdentifier1 = parameter.getNameIdentifier();
assertValidElement(setter, parameter, nameIdentifier1);
holder.registerProblem(nameIdentifier1, InspectionsBundle.message(
@@ -154,7 +154,17 @@ public class NullableStuffInspectionBase extends BaseJavaBatchLocalInspectionToo
}
}
- for (PsiExpression rhs : DfaPsiUtil.findAllConstructorInitializers(field)) {
+ List<PsiExpression> initializers = DfaPsiUtil.findAllConstructorInitializers(field);
+ if (annotated.isDeclaredNotNull && initializers.isEmpty()) {
+ final PsiAnnotation annotation = AnnotationUtil.findAnnotation(field, manager.getNotNulls());
+ if (annotation != null) {
+ holder.registerProblem(annotation.isPhysical() ? annotation : field.getNameIdentifier(),
+ "Not-null fields must be initialized",
+ ProblemHighlightType.GENERIC_ERROR_OR_WARNING);
+ }
+ }
+
+ for (PsiExpression rhs : initializers) {
if (rhs instanceof PsiReferenceExpression) {
PsiElement target = ((PsiReferenceExpression)rhs).resolve();
if (target instanceof PsiParameter) {
@@ -169,7 +179,7 @@ public class NullableStuffInspectionBase extends BaseJavaBatchLocalInspectionToo
ProblemHighlightType.GENERIC_ERROR_OR_WARNING, fix);
continue;
}
- if (annotated.isDeclaredNullable && manager.isNotNull(parameter, false)) {
+ if (annotated.isDeclaredNullable && isNotNullNotInferred(parameter, false)) {
boolean usedAsQualifier = !ReferencesSearch.search(parameter).forEach(new Processor<PsiReference>() {
@Override
public boolean process(PsiReference reference) {
@@ -203,6 +213,33 @@ public class NullableStuffInspectionBase extends BaseJavaBatchLocalInspectionToo
if (!PsiUtil.isLanguageLevel5OrHigher(parameter)) return;
check(parameter, holder, parameter.getType());
}
+
+ @Override
+ public void visitAnnotation(PsiAnnotation annotation) {
+ if (!AnnotationUtil.NOT_NULL.equals(annotation.getQualifiedName())) return;
+
+ PsiAnnotationMemberValue value = annotation.findDeclaredAttributeValue("exception");
+ if (value instanceof PsiClassObjectAccessExpression) {
+ PsiClass psiClass = PsiUtil.resolveClassInClassTypeOnly(((PsiClassObjectAccessExpression)value).getOperand().getType());
+ if (psiClass != null && !hasStringConstructor(psiClass)) {
+ holder.registerProblem(value,
+ "Custom exception class should have a constructor with a single message parameter of String type",
+ ProblemHighlightType.GENERIC_ERROR_OR_WARNING);
+
+ }
+ }
+ }
+
+ private boolean hasStringConstructor(PsiClass aClass) {
+ for (PsiMethod method : aClass.getConstructors()) {
+ PsiParameterList list = method.getParameterList();
+ if (list.getParametersCount() == 1 &&
+ list.getParameters()[0].getType().equalsToText(CommonClassNames.JAVA_LANG_STRING)) {
+ return true;
+ }
+ }
+ return false;
+ }
};
}
@@ -231,7 +268,7 @@ public class NullableStuffInspectionBase extends BaseJavaBatchLocalInspectionToo
PsiAnnotation isDeclaredNotNull = AnnotationUtil.findAnnotation(parameter, manager.getNotNulls());
PsiAnnotation isDeclaredNullable = AnnotationUtil.findAnnotation(parameter, manager.getNullables());
if (isDeclaredNullable != null && isDeclaredNotNull != null) {
- reportNullableNotNullConflict(holder, parameter, isDeclaredNullable, isDeclaredNotNull);
+ reportNullableNotNullConflict(holder, parameter, isDeclaredNullable, isDeclaredNotNull);
}
if ((isDeclaredNotNull != null || isDeclaredNullable != null) && type != null && TypeConversionUtil.isPrimitive(type.getCanonicalText())) {
PsiAnnotation annotation = isDeclaredNotNull == null ? isDeclaredNullable : isDeclaredNotNull;
@@ -282,7 +319,7 @@ public class NullableStuffInspectionBase extends BaseJavaBatchLocalInspectionToo
if (!reported_nullable_method_overrides_notnull
&& REPORT_NOTNULL_PARAMETER_OVERRIDES_NULLABLE
&& annotated.isDeclaredNullable
- && NullableNotNullManager.isNotNull(superMethod)) {
+ && isNotNullNotInferred(superMethod, true)) {
reported_nullable_method_overrides_notnull = true;
final PsiAnnotation annotation = AnnotationUtil.findAnnotation(method, nullableManager.getNullables(), true);
holder.registerProblem(annotation != null ? annotation : method.getNameIdentifier(),
@@ -293,7 +330,7 @@ public class NullableStuffInspectionBase extends BaseJavaBatchLocalInspectionToo
&& REPORT_NOT_ANNOTATED_METHOD_OVERRIDES_NOTNULL
&& !annotated.isDeclaredNullable
&& !annotated.isDeclaredNotNull
- && NullableNotNullManager.isNotNull(superMethod)) {
+ && isNotNullNotInferred(superMethod, true)) {
reported_not_annotated_method_overrides_notnull = true;
final String defaultNotNull = nullableManager.getDefaultNotNull();
final String[] annotationsToRemove = ArrayUtil.toStringArray(nullableManager.getNullables());
@@ -314,8 +351,8 @@ public class NullableStuffInspectionBase extends BaseJavaBatchLocalInspectionToo
PsiParameter parameter = parameters[i];
PsiParameter superParameter = superParameters[i];
if (!reported_notnull_parameter_overrides_nullable[i] && REPORT_NOTNULL_PARAMETER_OVERRIDES_NULLABLE &&
- nullableManager.isNotNull(parameter, false) &&
- nullableManager.isNullable(superParameter, false)) {
+ isNotNullNotInferred(parameter, false) &&
+ isNullableNotInferred(superParameter, false)) {
reported_notnull_parameter_overrides_nullable[i] = true;
final PsiAnnotation annotation = AnnotationUtil.findAnnotation(parameter, nullableManager.getNotNulls(), true);
holder.registerProblem(annotation != null ? annotation : parameter.getNameIdentifier(),
@@ -325,7 +362,7 @@ public class NullableStuffInspectionBase extends BaseJavaBatchLocalInspectionToo
ProblemHighlightType.GENERIC_ERROR_OR_WARNING);
}
if (!reported_not_annotated_parameter_overrides_notnull[i] && REPORT_NOT_ANNOTATED_METHOD_OVERRIDES_NOTNULL) {
- if (!nullableManager.hasNullability(parameter) && nullableManager.isNotNull(superParameter, false)) {
+ if (!nullableManager.hasNullability(parameter) && isNotNullNotInferred(superParameter, false)) {
reported_not_annotated_parameter_overrides_notnull[i] = true;
final LocalQuickFix fix = AnnotationUtil.isAnnotatingApplicable(parameter, nullableManager.getDefaultNotNull())
? new AddNotNullAnnotationFix(parameter)
@@ -346,7 +383,7 @@ public class NullableStuffInspectionBase extends BaseJavaBatchLocalInspectionToo
boolean hasAnnotatedParameter = false;
for (int i = 0; i < parameters.length; i++) {
PsiParameter parameter = parameters[i];
- parameterAnnotated[i] = nullableManager.isNotNull(parameter, false);
+ parameterAnnotated[i] = isNotNullNotInferred(parameter, false);
hasAnnotatedParameter |= parameterAnnotated[i];
}
if (hasAnnotatedParameter || annotated.isDeclaredNotNull) {
@@ -362,8 +399,8 @@ public class NullableStuffInspectionBase extends BaseJavaBatchLocalInspectionToo
final boolean applicable = AnnotationUtil.isAnnotatingApplicable(overriding, defaultNotNull);
if (!methodQuickFixSuggested
&& annotated.isDeclaredNotNull
- && !nullableManager.isNotNull(overriding, false)
- && (nullableManager.isNullable(overriding, false) || !nullableManager.isNullable(overriding, true))) {
+ && !isNotNullNotInferred(overriding, false)
+ && (isNullableNotInferred(overriding, false) || !isNullableNotInferred(overriding, true))) {
method.getNameIdentifier(); //load tree
PsiAnnotation annotation = AnnotationUtil.findAnnotation(method, nullableManager.getNotNulls());
final String[] annotationsToRemove = ArrayUtil.toStringArray(nullableManager.getNullables());
@@ -391,7 +428,7 @@ public class NullableStuffInspectionBase extends BaseJavaBatchLocalInspectionToo
for (int i = 0; i < psiParameters.length; i++) {
if (parameterQuickFixSuggested[i]) continue;
PsiParameter parameter = psiParameters[i];
- if (parameterAnnotated[i] && !nullableManager.isNotNull(parameter, false) && !nullableManager.isNullable(parameter, false)) {
+ if (parameterAnnotated[i] && !isNotNullNotInferred(parameter, false) && !isNullableNotInferred(parameter, false)) {
parameters[i].getNameIdentifier(); //be sure that corresponding tree element available
PsiAnnotation annotation = AnnotationUtil.findAnnotation(parameters[i], nullableManager.getNotNulls());
PsiElement psiElement = annotation;
@@ -415,6 +452,24 @@ public class NullableStuffInspectionBase extends BaseJavaBatchLocalInspectionToo
}
}
+ private static boolean isNotNullNotInferred(@NotNull PsiModifierListOwner owner, boolean checkBases) {
+ Project project = owner.getProject();
+ NullableNotNullManager manager = NullableNotNullManager.getInstance(project);
+ if (!manager.isNotNull(owner, checkBases)) return false;
+
+ PsiAnnotation anno = manager.getNotNullAnnotation(owner, checkBases);
+ return !(anno != null && AnnotationUtil.isInferredAnnotation(anno));
+ }
+
+ private static boolean isNullableNotInferred(@NotNull PsiModifierListOwner owner, boolean checkBases) {
+ Project project = owner.getProject();
+ NullableNotNullManager manager = NullableNotNullManager.getInstance(project);
+ if (!manager.isNullable(owner, checkBases)) return false;
+
+ PsiAnnotation anno = manager.getNullableAnnotation(owner, checkBases);
+ return !(anno != null && AnnotationUtil.isInferredAnnotation(anno));
+ }
+
@NotNull
private static LocalQuickFix[] wrapFix(LocalQuickFix fix) {
if (fix == null) return LocalQuickFix.EMPTY_ARRAY;
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/unusedLibraries/UnusedLibrariesInspection.java b/java/java-analysis-impl/src/com/intellij/codeInspection/unusedLibraries/UnusedLibrariesInspection.java
index 5a419dfa9647..4db11dc0b0d0 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/unusedLibraries/UnusedLibrariesInspection.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/unusedLibraries/UnusedLibrariesInspection.java
@@ -23,14 +23,15 @@ package com.intellij.codeInspection.unusedLibraries;
import com.intellij.analysis.AnalysisScope;
import com.intellij.codeInsight.daemon.GroupNames;
import com.intellij.codeInspection.*;
-import com.intellij.codeInspection.reference.*;
+import com.intellij.codeInspection.reference.RefEntity;
+import com.intellij.codeInspection.reference.RefGraphAnnotator;
+import com.intellij.codeInspection.reference.RefManager;
+import com.intellij.codeInspection.reference.RefModule;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleUtilCore;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.*;
-import com.intellij.openapi.roots.impl.DirectoryIndex;
-import com.intellij.openapi.roots.impl.DirectoryInfo;
import com.intellij.openapi.roots.libraries.Library;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.Key;
@@ -185,12 +186,12 @@ public class UnusedLibrariesInspection extends GlobalInspectionTool {
private static class UnusedLibraryGraphAnnotator extends RefGraphAnnotator {
public static final Key<Set<VirtualFile>> USED_LIBRARY_ROOTS = Key.create("inspection.dependencies");
- private final DirectoryIndex myDirectoryIndex;
+ private final ProjectFileIndex myFileIndex;
private RefManager myManager;
public UnusedLibraryGraphAnnotator(RefManager manager) {
myManager = manager;
- myDirectoryIndex = DirectoryIndex.getInstance(manager.getProject());
+ myFileIndex = ProjectRootManager.getInstance(manager.getProject()).getFileIndex();
}
@Override
@@ -199,8 +200,7 @@ public class UnusedLibrariesInspection extends GlobalInspectionTool {
final VirtualFile virtualFile = PsiUtilCore.getVirtualFile(what);
final VirtualFile containingDir = virtualFile != null ? virtualFile.getParent() : null;
if (containingDir != null) {
- final DirectoryInfo infoForDirectory = myDirectoryIndex.getInfoForDirectory(containingDir);
- final VirtualFile libraryClassRoot = infoForDirectory != null ? infoForDirectory.getLibraryClassRoot() : null;
+ final VirtualFile libraryClassRoot = myFileIndex.getClassRootForFile(containingDir);
if (libraryClassRoot != null) {
final Module fromModule = ModuleUtilCore.findModuleForPsiElement(from);
if (fromModule != null){
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/varScopeCanBeNarrowed/FieldCanBeLocalInspectionBase.java b/java/java-analysis-impl/src/com/intellij/codeInspection/varScopeCanBeNarrowed/FieldCanBeLocalInspectionBase.java
index f84abbb0e3d6..e13f3e66a198 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/varScopeCanBeNarrowed/FieldCanBeLocalInspectionBase.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/varScopeCanBeNarrowed/FieldCanBeLocalInspectionBase.java
@@ -132,6 +132,7 @@ public class FieldCanBeLocalInspectionBase extends BaseJavaBatchLocalInspectionT
final Set<PsiField> candidates,
final Set<PsiField> usedFields,
final boolean ignoreFieldsUsedInMultipleMethods) {
+ final Set<PsiField> ignored = new HashSet<PsiField>();
aClass.accept(new JavaRecursiveElementWalkingVisitor() {
@Override
public void visitElement(PsiElement element) {
@@ -144,7 +145,7 @@ public class FieldCanBeLocalInspectionBase extends BaseJavaBatchLocalInspectionT
final PsiCodeBlock body = method.getBody();
if (body != null) {
- checkCodeBlock(body, candidates, usedFields, ignoreFieldsUsedInMultipleMethods);
+ checkCodeBlock(body, candidates, usedFields, ignoreFieldsUsedInMultipleMethods, ignored);
}
}
@@ -153,14 +154,14 @@ public class FieldCanBeLocalInspectionBase extends BaseJavaBatchLocalInspectionT
super.visitLambdaExpression(expression);
final PsiElement body = expression.getBody();
if (body != null) {
- checkCodeBlock(body, candidates, usedFields, ignoreFieldsUsedInMultipleMethods);
+ checkCodeBlock(body, candidates, usedFields, ignoreFieldsUsedInMultipleMethods, ignored);
}
}
@Override
public void visitClassInitializer(PsiClassInitializer initializer) {
super.visitClassInitializer(initializer);
- checkCodeBlock(initializer.getBody(), candidates, usedFields, ignoreFieldsUsedInMultipleMethods);
+ checkCodeBlock(initializer.getBody(), candidates, usedFields, ignoreFieldsUsedInMultipleMethods, ignored);
}
});
}
@@ -168,20 +169,28 @@ public class FieldCanBeLocalInspectionBase extends BaseJavaBatchLocalInspectionT
private static void checkCodeBlock(final PsiElement body,
final Set<PsiField> candidates,
Set<PsiField> usedFields,
- boolean ignoreFieldsUsedInMultipleMethods) {
+ boolean ignoreFieldsUsedInMultipleMethods,
+ Set<PsiField> ignored) {
try {
+ final Ref<Collection<PsiVariable>> writtenVariables = new Ref<Collection<PsiVariable>>();
final ControlFlow
controlFlow = ControlFlowFactory.getInstance(body.getProject()).getControlFlow(body, AllVariablesControlFlowPolicy.getInstance());
final List<PsiVariable> usedVars = ControlFlowUtil.getUsedVariables(controlFlow, 0, controlFlow.getSize());
for (PsiVariable usedVariable : usedVars) {
if (usedVariable instanceof PsiField) {
final PsiField usedField = (PsiField)usedVariable;
- if (!usedFields.add(usedField) && ignoreFieldsUsedInMultipleMethods) {
+ if (!getWrittenVariables(controlFlow, writtenVariables).contains(usedField)) {
+ ignored.add(usedField);
+ }
+
+ if (!usedFields.add(usedField) && (ignoreFieldsUsedInMultipleMethods || ignored.contains(usedField))) {
candidates.remove(usedField); //used in more than one code block
}
}
}
- final Ref<Collection<PsiVariable>> writtenVariables = new Ref<Collection<PsiVariable>>();
+
+ if (candidates.isEmpty()) return;
+
final List<PsiReferenceExpression> readBeforeWrites = ControlFlowUtil.getReadBeforeWrite(controlFlow);
for (final PsiReferenceExpression readBeforeWrite : readBeforeWrites) {
final PsiElement resolved = readBeforeWrite.resolve();
diff --git a/java/java-analysis-impl/src/com/intellij/refactoring/extractMethod/ExtractMethodUtil.java b/java/java-analysis-impl/src/com/intellij/refactoring/extractMethod/ExtractMethodUtil.java
new file mode 100644
index 000000000000..82ed68a44228
--- /dev/null
+++ b/java/java-analysis-impl/src/com/intellij/refactoring/extractMethod/ExtractMethodUtil.java
@@ -0,0 +1,147 @@
+/*
+ * Copyright 2000-2009 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.refactoring.extractMethod;
+
+import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.openapi.util.Key;
+import com.intellij.psi.*;
+import com.intellij.psi.search.SearchScope;
+import com.intellij.psi.search.searches.ClassInheritorsSearch;
+import com.intellij.psi.search.searches.ReferencesSearch;
+import com.intellij.psi.util.PsiTreeUtil;
+import com.intellij.psi.util.RedundantCastUtil;
+import com.intellij.util.IncorrectOperationException;
+import com.intellij.util.Processor;
+import com.intellij.util.containers.HashMap;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.Map;
+
+/**
+ * @author ven
+ */
+public class ExtractMethodUtil {
+ private static final Key<PsiMethod> RESOLVE_TARGET_KEY = Key.create("RESOLVE_TARGET_KEY");
+ private static final Logger LOG = Logger.getInstance("com.intellij.refactoring.extractMethod.ExtractMethodUtil");
+
+ private ExtractMethodUtil() { }
+
+ static Map<PsiMethodCallExpression, PsiMethod> encodeOverloadTargets(final PsiClass targetClass,
+ final SearchScope processConflictsScope,
+ final String overloadName,
+ final PsiElement extractedFragment) {
+ final Map<PsiMethodCallExpression, PsiMethod> ret = new HashMap<PsiMethodCallExpression, PsiMethod>();
+ encodeInClass(targetClass, overloadName, extractedFragment, ret);
+
+ ClassInheritorsSearch.search(targetClass, processConflictsScope, true).forEach(new Processor<PsiClass>() {
+ public boolean process(PsiClass inheritor) {
+ encodeInClass(inheritor, overloadName, extractedFragment, ret);
+ return true;
+ }
+ });
+
+ return ret;
+ }
+
+ private static void encodeInClass(final PsiClass aClass,
+ final String overloadName,
+ final PsiElement extractedFragment,
+ final Map<PsiMethodCallExpression, PsiMethod> ret) {
+ final PsiMethod[] overloads = aClass.findMethodsByName(overloadName, false);
+ for (final PsiMethod overload : overloads) {
+ for (final PsiReference ref : ReferencesSearch.search(overload)) {
+ final PsiElement element = ref.getElement();
+ final PsiElement parent = element.getParent();
+ if (parent instanceof PsiMethodCallExpression) {
+ final PsiMethodCallExpression call = (PsiMethodCallExpression)parent;
+ if (PsiTreeUtil.isAncestor(extractedFragment, element, false)) {
+ call.putCopyableUserData(RESOLVE_TARGET_KEY, overload);
+ } else {
+ //we assume element won't be invalidated as a result of extraction
+ ret.put(call, overload);
+ }
+ }
+ }
+ }
+ }
+
+ public static void decodeOverloadTargets(Map<PsiMethodCallExpression, PsiMethod> oldResolves, final PsiMethod extracted,
+ final PsiElement oldFragment) {
+ final PsiCodeBlock body = extracted.getBody();
+ assert body != null;
+ final JavaRecursiveElementVisitor visitor = new JavaRecursiveElementVisitor() {
+
+ @Override public void visitMethodCallExpression(PsiMethodCallExpression expression) {
+ super.visitMethodCallExpression(expression);
+ final PsiMethod target = expression.getCopyableUserData(RESOLVE_TARGET_KEY);
+ if (target != null) {
+ expression.putCopyableUserData(RESOLVE_TARGET_KEY, null);
+ try {
+ addCastsToEnsureResolveTarget(target, expression);
+ }
+ catch (IncorrectOperationException e) {
+ LOG.error(e);
+ }
+ }
+ }
+ };
+ body.accept(visitor);
+ oldFragment.accept(visitor);
+
+ for (final Map.Entry<PsiMethodCallExpression, PsiMethod> entry : oldResolves.entrySet()) {
+ try {
+ addCastsToEnsureResolveTarget(entry.getValue(), entry.getKey());
+ }
+ catch (IncorrectOperationException e) {
+ LOG.error(e);
+ }
+ }
+ }
+
+ public static void addCastsToEnsureResolveTarget(@NotNull final PsiMethod oldTarget, @NotNull final PsiMethodCallExpression call)
+ throws IncorrectOperationException {
+ final PsiMethod newTarget = call.resolveMethod();
+ final PsiManager manager = oldTarget.getManager();
+ final PsiElementFactory factory = JavaPsiFacade.getInstance(manager.getProject()).getElementFactory();
+ if (!manager.areElementsEquivalent(oldTarget, newTarget)) {
+ final PsiParameter[] oldParameters = oldTarget.getParameterList().getParameters();
+ if (oldParameters.length > 0) {
+ final PsiMethodCallExpression copy = (PsiMethodCallExpression)call.copy();
+ final PsiExpression[] args = copy.getArgumentList().getExpressions();
+ for (int i = 0; i < args.length; i++) {
+ PsiExpression arg = args[i];
+ PsiType paramType = i < oldParameters.length ? oldParameters[i].getType() : oldParameters[oldParameters.length - 1].getType();
+ final PsiTypeCastExpression cast = (PsiTypeCastExpression)factory.createExpressionFromText("(a)b", null);
+ final PsiTypeElement typeElement = cast.getCastType();
+ assert typeElement != null;
+ typeElement.replace(factory.createTypeElement(paramType));
+ final PsiExpression operand = cast.getOperand();
+ assert operand != null;
+ operand.replace(arg);
+ arg.replace(cast);
+ }
+
+ for (int i = 0; i < copy.getArgumentList().getExpressions().length; i++) {
+ PsiExpression oldarg = call.getArgumentList().getExpressions()[i];
+ PsiTypeCastExpression cast = (PsiTypeCastExpression)copy.getArgumentList().getExpressions()[i];
+ if (!RedundantCastUtil.isCastRedundant(cast)) {
+ oldarg.replace(cast);
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/java/java-impl/src/com/intellij/codeInsight/ExternalAnnotationsLineMarkerProvider.java b/java/java-impl/src/com/intellij/codeInsight/ExternalAnnotationsLineMarkerProvider.java
index d5d927cf44fc..182f79c94bce 100644
--- a/java/java-impl/src/com/intellij/codeInsight/ExternalAnnotationsLineMarkerProvider.java
+++ b/java/java-impl/src/com/intellij/codeInsight/ExternalAnnotationsLineMarkerProvider.java
@@ -48,43 +48,55 @@ public class ExternalAnnotationsLineMarkerProvider implements LineMarkerProvider
@Nullable
@Override
public LineMarkerInfo getLineMarkerInfo(@NotNull PsiElement element) {
- if (element instanceof PsiParameter) return null;
+ if (!(element instanceof PsiModifierListOwner)) return null;
+ if (element instanceof PsiParameter || element instanceof PsiLocalVariable) return null;
- PsiModifierListOwner owner = null;
- if (element instanceof PsiModifierListOwner) {
- final PsiModifierListOwner modifierListOwner = (PsiModifierListOwner)element;
- final ExternalAnnotationsManager annotationsManager = ExternalAnnotationsManager.getInstance(modifierListOwner.getProject());
- PsiAnnotation[] externalAnnotations = annotationsManager.findExternalAnnotations(modifierListOwner);
- if (externalAnnotations != null && externalAnnotations.length > 0) {
- owner = (PsiModifierListOwner)element;
- } else if (element instanceof PsiMethod) {
- final PsiParameter[] parameters = ((PsiMethod)element).getParameterList().getParameters();
- for (PsiParameter parameter : parameters) {
- externalAnnotations = annotationsManager.findExternalAnnotations(parameter);
- if (externalAnnotations != null && externalAnnotations.length > 0) {
- owner = (PsiMethod)element;
- break;
- }
- }
- }
- }
-
- if (owner == null) {
+ if (!shouldShowSignature(preferCompiledElement((PsiModifierListOwner)element))) {
return null;
}
final Function<PsiModifierListOwner, String> annotationsCollector = new Function<PsiModifierListOwner, String>() {
@Override
public String fun(PsiModifierListOwner owner) {
- return XmlStringUtil.wrapInHtml(JavaDocInfoGenerator.generateSignature(owner));
+ return XmlStringUtil.wrapInHtml(JavaDocInfoGenerator.generateSignature(preferCompiledElement(owner)));
}
};
- return new LineMarkerInfo<PsiModifierListOwner>(owner, owner.getTextOffset(), AllIcons.Gutter.ExtAnnotation,
+ return new LineMarkerInfo<PsiModifierListOwner>((PsiModifierListOwner)element, element.getTextOffset(), AllIcons.Gutter.ExtAnnotation,
Pass.UPDATE_ALL,
annotationsCollector, new MyIconGutterHandler(),
GutterIconRenderer.Alignment.LEFT);
}
+ private static PsiModifierListOwner preferCompiledElement(PsiModifierListOwner element) {
+ PsiElement original = element.getOriginalElement();
+ return original instanceof PsiModifierListOwner ? (PsiModifierListOwner)original : element;
+ }
+
+ private static boolean shouldShowSignature(PsiModifierListOwner owner) {
+ if (hasNonCodeAnnotations(owner)) {
+ return true;
+ }
+
+ if (owner instanceof PsiMethod) {
+ for (PsiParameter parameter : ((PsiMethod)owner).getParameterList().getParameters()) {
+ if (hasNonCodeAnnotations(parameter)) {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ private static boolean hasNonCodeAnnotations(@NotNull PsiModifierListOwner element) {
+ Project project = element.getProject();
+ PsiAnnotation[] externalAnnotations = ExternalAnnotationsManager.getInstance(project).findExternalAnnotations(element);
+ if (externalAnnotations != null && externalAnnotations.length > 0) {
+ return true;
+ }
+ return InferredAnnotationsManager.getInstance(project).findInferredAnnotations(element).length > 0;
+ }
+
@Override
public void collectSlowLineMarkers(@NotNull List<PsiElement> elements, @NotNull Collection<LineMarkerInfo> result) {}
diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/JavaChainLookupElement.java b/java/java-impl/src/com/intellij/codeInsight/completion/JavaChainLookupElement.java
index 4ff8ca2ec5f8..cbc9653b6adf 100644
--- a/java/java-impl/src/com/intellij/codeInsight/completion/JavaChainLookupElement.java
+++ b/java/java-impl/src/com/intellij/codeInsight/completion/JavaChainLookupElement.java
@@ -21,6 +21,7 @@ import com.intellij.diagnostic.AttachmentFactory;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.util.ClassConditionKey;
+import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.*;
import com.intellij.psi.codeStyle.CodeStyleManager;
@@ -38,6 +39,7 @@ import java.util.Set;
* @author peter
*/
public class JavaChainLookupElement extends LookupElementDecorator<LookupElement> implements TypedLookupItem {
+ public static final Key<Boolean> CHAIN_QUALIFIER = Key.create("CHAIN_QUALIFIER");
private static final Logger LOG = Logger.getInstance("#com.intellij.codeInsight.completion.JavaChainLookupElement");
public static final ClassConditionKey<JavaChainLookupElement> CLASS_CONDITION_KEY = ClassConditionKey.create(JavaChainLookupElement.class);
private final LookupElement myQualifier;
@@ -109,9 +111,12 @@ public class JavaChainLookupElement extends LookupElementDecorator<LookupElement
public void handleInsert(InsertionContext context) {
final Document document = context.getEditor().getDocument();
document.replaceString(context.getStartOffset(), context.getTailOffset(), ";");
+ myQualifier.putUserData(CHAIN_QUALIFIER, true);
final InsertionContext qualifierContext = CompletionUtil.emulateInsertion(context, context.getStartOffset(), myQualifier);
OffsetKey oldStart = context.trackOffset(context.getStartOffset(), false);
+ PsiDocumentManager.getInstance(context.getProject()).doPostponedOperationsAndUnblockDocument(document);
+
int start = CharArrayUtil.shiftForward(context.getDocument().getCharsSequence(), context.getStartOffset(), " \t\n");
if (shouldParenthesizeQualifier(context.getFile(), start, qualifierContext.getTailOffset())) {
final String space = CodeStyleSettingsManager.getSettings(qualifierContext.getProject()).SPACE_WITHIN_PARENTHESES ? " " : "";
@@ -165,6 +170,7 @@ public class JavaChainLookupElement extends LookupElementDecorator<LookupElement
if (expr instanceof PsiJavaCodeReferenceElement ||
expr instanceof PsiMethodCallExpression ||
+ expr instanceof PsiNewExpression ||
expr instanceof PsiArrayAccessExpression) {
return false;
}
diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/JavaClassNameInsertHandler.java b/java/java-impl/src/com/intellij/codeInsight/completion/JavaClassNameInsertHandler.java
index be6d8146ce3d..f5a8253ab5ab 100644
--- a/java/java-impl/src/com/intellij/codeInsight/completion/JavaClassNameInsertHandler.java
+++ b/java/java-impl/src/com/intellij/codeInsight/completion/JavaClassNameInsertHandler.java
@@ -98,7 +98,8 @@ class JavaClassNameInsertHandler implements InsertHandler<JavaPsiClassReferenceE
context.setTailOffset(context.getOffset(refEnd));
context.commitDocument();
- if (shouldInsertParentheses(file.findElementAt(context.getTailOffset() - 1))) {
+ if (item.getUserData(JavaChainLookupElement.CHAIN_QUALIFIER) == null &&
+ shouldInsertParentheses(file.findElementAt(context.getTailOffset() - 1))) {
if (ConstructorInsertHandler.insertParentheses(context, item, psiClass, false)) {
fillTypeArgs |= psiClass.hasTypeParameters() && PsiUtil.getLanguageLevel(file).isAtLeast(LanguageLevel.JDK_1_5);
}
diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionContributor.java b/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionContributor.java
index 7310227a80f0..fba10a633432 100644
--- a/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionContributor.java
+++ b/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionContributor.java
@@ -426,7 +426,7 @@ public class JavaCompletionContributor extends CompletionContributor {
if (JavaCompletionData.isAfterPrimitiveOrArrayType(position)) {
return false;
}
-
+
return true;
}
@@ -466,11 +466,11 @@ public class JavaCompletionContributor extends CompletionContributor {
methods: for (PsiMethod method : annoClass.getMethods()) {
if (!(method instanceof PsiAnnotationMethod)) continue;
-
+
final String attrName = method.getName();
for (PsiNameValuePair existingAttr : existingPairs) {
if (PsiTreeUtil.isAncestor(existingAttr, insertedElement, false)) break;
- if (Comparing.equal(existingAttr.getName(), attrName) ||
+ if (Comparing.equal(existingAttr.getName(), attrName) ||
PsiAnnotation.DEFAULT_REFERENCED_METHOD_NAME.equals(attrName) && existingAttr.getName() == null) continue methods;
}
LookupElementBuilder element = LookupElementBuilder.createWithIcon(method).withInsertHandler(new InsertHandler<LookupElement>() {
@@ -479,7 +479,7 @@ public class JavaCompletionContributor extends CompletionContributor {
final Editor editor = context.getEditor();
TailType.EQ.processTail(editor, editor.getCaretModel().getOffset());
context.setAddCompletionChar(false);
-
+
context.commitDocument();
PsiAnnotationParameterList paramList =
PsiTreeUtil.findElementOfClassAtOffset(context.getFile(), context.getStartOffset(), PsiAnnotationParameterList.class, false);
@@ -644,7 +644,20 @@ public class JavaCompletionContributor extends CompletionContributor {
if (file instanceof PsiJavaFile) {
if (context.getInvocationCount() > 0) {
autoImport(file, context.getStartOffset() - 1, context.getEditor());
- PsiDocumentManager.getInstance(context.getProject()).commitDocument(context.getEditor().getDocument());
+
+ PsiElement leaf = file.findElementAt(context.getStartOffset() - 1);
+ if (leaf != null) leaf = PsiTreeUtil.prevVisibleLeaf(leaf);
+
+ PsiVariable variable = PsiTreeUtil.getParentOfType(leaf, PsiVariable.class);
+ if (variable != null) {
+ PsiTypeElement typeElement = variable.getTypeElement();
+ if (typeElement != null) {
+ PsiType type = typeElement.getType();
+ if (type instanceof PsiClassType && ((PsiClassType)type).resolve() == null) {
+ autoImportReference(file, context.getEditor(), typeElement.getInnermostComponentReferenceElement());
+ }
+ }
+ }
}
JavaCompletionUtil.initOffsets(file, context.getOffsetMap());
@@ -702,7 +715,13 @@ public class JavaCompletionContributor extends CompletionContributor {
iterator.advance();
}
- if (!iterator.atEnd() && (iterator.getTokenType() == JavaTokenType.LPARENTH || iterator.getTokenType() == JavaTokenType.COLON)) {
+ if (!iterator.atEnd() && (iterator.getTokenType() == JavaTokenType.LPARENTH)) {
+ return true;
+ }
+
+ if (!iterator.atEnd()
+ && (iterator.getTokenType() == JavaTokenType.COLON)
+ && null == PsiTreeUtil.findElementOfClassAtOffset(file, startOffset, PsiConditionalExpression.class, false)) {
return true;
}
@@ -721,7 +740,7 @@ public class JavaCompletionContributor extends CompletionContributor {
return iterator.getTokenType() == JavaTokenType.EQ || iterator.getTokenType() == JavaTokenType.LPARENTH;
}
- private static void autoImport(final PsiFile file, int offset, final Editor editor) {
+ private static void autoImport(@NotNull final PsiFile file, int offset, @NotNull final Editor editor) {
final CharSequence text = editor.getDocument().getCharsSequence();
while (offset > 0 && Character.isJavaIdentifierPart(text.charAt(offset))) offset--;
if (offset <= 0) return;
@@ -734,7 +753,10 @@ public class JavaCompletionContributor extends CompletionContributor {
while (offset > 0 && Character.isWhitespace(text.charAt(offset))) offset--;
if (offset <= 0) return;
- PsiJavaCodeReferenceElement element = extractReference(PsiTreeUtil.findElementOfClassAtOffset(file, offset, PsiExpression.class, false));
+ autoImportReference(file, editor, extractReference(PsiTreeUtil.findElementOfClassAtOffset(file, offset, PsiExpression.class, false)));
+ }
+
+ private static void autoImportReference(@NotNull PsiFile file, @NotNull Editor editor, @Nullable PsiJavaCodeReferenceElement element) {
if (element == null) return;
while (true) {
@@ -745,6 +767,7 @@ public class JavaCompletionContributor extends CompletionContributor {
}
if (!(element.getParent() instanceof PsiMethodCallExpression) && element.multiResolve(true).length == 0) {
new ImportClassFix(element).doFix(editor, false, false);
+ PsiDocumentManager.getInstance(file.getProject()).commitDocument(editor.getDocument());
}
}
diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/JavaMethodMergingContributor.java b/java/java-impl/src/com/intellij/codeInsight/completion/JavaMethodMergingContributor.java
index b409014c1fe8..661d0abfcaac 100644
--- a/java/java-impl/src/com/intellij/codeInsight/completion/JavaMethodMergingContributor.java
+++ b/java/java-impl/src/com/intellij/codeInsight/completion/JavaMethodMergingContributor.java
@@ -18,11 +18,14 @@ package com.intellij.codeInsight.completion;
import com.intellij.codeInsight.lookup.LookupElement;
import com.intellij.codeInsight.lookup.LookupItem;
import com.intellij.psi.PsiMethod;
-import com.intellij.psi.ResolveResult;
+import com.intellij.psi.PsiType;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
+import static com.intellij.util.ObjectUtils.assertNotNull;
+
/**
* @author peter
*/
@@ -38,13 +41,9 @@ public class JavaMethodMergingContributor extends CompletionContributor {
final LookupElement[] items = context.getItems();
if (items.length > 1) {
String commonName = null;
- LookupElement best = null;
final ArrayList<PsiMethod> allMethods = new ArrayList<PsiMethod>();
for (LookupElement item : items) {
- Object o = item.getObject();
- if (o instanceof ResolveResult) {
- o = ((ResolveResult)o).getElement();
- }
+ Object o = item.getPsiElement();
if (item.getUserData(LookupItem.FORCE_SHOW_SIGNATURE_ATTR) != null || !(o instanceof PsiMethod)) {
return AutoCompletionDecision.SHOW_LOOKUP;
}
@@ -56,19 +55,37 @@ public class JavaMethodMergingContributor extends CompletionContributor {
return AutoCompletionDecision.SHOW_LOOKUP;
}
- if (best == null && method.getParameterList().getParametersCount() > 0) {
- best = item;
- }
commonName = name;
allMethods.add(method);
item.putUserData(JavaCompletionUtil.ALL_METHODS_ATTRIBUTE, allMethods);
}
- if (best == null) {
- best = items[0];
- }
- return AutoCompletionDecision.insertItem(best);
+
+ return AutoCompletionDecision.insertItem(findBestOverload(items));
}
return super.handleAutoCompletionPossibility(context);
}
+
+ public static LookupElement findBestOverload(LookupElement[] items) {
+ LookupElement best = items[0];
+ for (int i = 1; i < items.length; i++) {
+ LookupElement item = items[i];
+ if (getPriority(best) < getPriority(item)) {
+ best = item;
+ }
+ }
+ return best;
+ }
+
+ private static int getPriority(LookupElement element) {
+ PsiMethod method = assertNotNull(getItemMethod(element));
+ return (method.getReturnType() == PsiType.VOID ? 0 : 1) +
+ (method.getParameterList().getParametersCount() > 0 ? 2 : 0);
+ }
+
+ @Nullable
+ private static PsiMethod getItemMethod(LookupElement item) {
+ Object o = item.getPsiElement();
+ return o instanceof PsiMethod ? (PsiMethod)o : null;
+ }
}
diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/JavaNoVariantsDelegator.java b/java/java-impl/src/com/intellij/codeInsight/completion/JavaNoVariantsDelegator.java
index f36f567199a0..ceebdecdf8c3 100644
--- a/java/java-impl/src/com/intellij/codeInsight/completion/JavaNoVariantsDelegator.java
+++ b/java/java-impl/src/com/intellij/codeInsight/completion/JavaNoVariantsDelegator.java
@@ -20,6 +20,7 @@ import com.intellij.codeInsight.completion.impl.BetterPrefixMatcher;
import com.intellij.codeInsight.completion.impl.CamelHumpMatcher;
import com.intellij.codeInsight.lookup.AutoCompletionPolicy;
import com.intellij.codeInsight.lookup.LookupElement;
+import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.*;
@@ -41,7 +42,6 @@ import static com.intellij.patterns.PsiJavaPatterns.psiElement;
* @author peter
*/
public class JavaNoVariantsDelegator extends CompletionContributor {
-
@Override
public void fillCompletionVariants(@NotNull final CompletionParameters parameters, @NotNull CompletionResultSet result) {
LinkedHashSet<CompletionResult> plainResults = result.runRemainingContributors(parameters, true);
diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateAbstractMethodFromUsageFix.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateAbstractMethodFromUsageFix.java
index abcff2238c68..5edd1973cfd8 100644
--- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateAbstractMethodFromUsageFix.java
+++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateAbstractMethodFromUsageFix.java
@@ -51,7 +51,7 @@ public class CreateAbstractMethodFromUsageFix extends CreateMethodFromUsageFix {
}
@Override
- protected boolean shouldBeAbstract(PsiClass targetClass) {
+ protected boolean shouldBeAbstract(PsiReferenceExpression expression, PsiClass targetClass) {
return true;
}
}
diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateFieldFromUsageFix.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateFieldFromUsageFix.java
index 939b8b6f8a13..1e9d1a88cb99 100644
--- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateFieldFromUsageFix.java
+++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateFieldFromUsageFix.java
@@ -28,6 +28,9 @@ import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.psi.util.PsiUtil;
import org.jetbrains.annotations.NotNull;
+import java.util.ArrayList;
+import java.util.List;
+
/**
* @author Mike
*/
@@ -45,6 +48,19 @@ public class CreateFieldFromUsageFix extends CreateVarFromUsageFix {
return false;
}
+ @NotNull
+ @Override
+ protected List<PsiClass> getTargetClasses(PsiElement element) {
+ final List<PsiClass> targetClasses = new ArrayList<PsiClass>();
+ for (PsiClass psiClass : super.getTargetClasses(element)) {
+ if (psiClass.getManager().isInProject(psiClass) &&
+ (!psiClass.isInterface() && !psiClass.isAnnotationType() || shouldCreateStaticMember(myReferenceExpression, psiClass))) {
+ targetClasses.add(psiClass);
+ }
+ }
+ return targetClasses;
+ }
+
@Override
protected boolean canBeTargetClass(PsiClass psiClass) {
return psiClass.getManager().isInProject(psiClass) && !psiClass.isInterface() && !psiClass.isAnnotationType();
diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateFromUsageBaseFix.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateFromUsageBaseFix.java
index c12fbe8d7711..09b83e2a489f 100644
--- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateFromUsageBaseFix.java
+++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateFromUsageBaseFix.java
@@ -168,6 +168,9 @@ public abstract class CreateFromUsageBaseFix extends BaseIntentionAction {
list.deleteChildRange(list.getFirstChild(), list.getLastChild());
return;
}
+ if (targetClass.isInterface()) {
+ return;
+ }
final String visibility = getVisibility(parentClass, targetClass);
if (VisibilityUtil.ESCALATE_VISIBILITY.equals(visibility)) {
list.setModifierProperty(PsiModifier.PRIVATE, true);
diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateMethodFromUsageFix.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateMethodFromUsageFix.java
index b7cd8af73084..8e93a6a0c817 100644
--- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateMethodFromUsageFix.java
+++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateMethodFromUsageFix.java
@@ -120,7 +120,7 @@ public class CreateMethodFromUsageFix extends CreateFromUsageBaseFix {
PsiMethodCallExpression call = getMethodCall();
if (call == null) return Collections.emptyList();
for (PsiClass target : targets) {
- if (target.isInterface() && shouldCreateStaticMember(call.getMethodExpression(), target)) continue;
+ if (target.isInterface() && shouldCreateStaticMember(call.getMethodExpression(), target) && !PsiUtil.isLanguageLevel8OrHigher(target)) continue;
if (!isMethodSignatureExists(call, target)) {
result.add(target);
}
@@ -155,7 +155,8 @@ public class CreateMethodFromUsageFix extends CreateFromUsageBaseFix {
PsiCodeBlock body = method.getBody();
assert body != null;
- if (shouldBeAbstract(targetClass)) {
+ final boolean shouldBeAbstract = shouldBeAbstract(expression.getMethodExpression(), targetClass);
+ if (shouldBeAbstract) {
body.delete();
if (!targetClass.isInterface()) {
method.getModifierList().setModifierProperty(PsiModifier.ABSTRACT, true);
@@ -167,14 +168,14 @@ public class CreateMethodFromUsageFix extends CreateFromUsageBaseFix {
expression = getMethodCall();
LOG.assertTrue(expression.isValid());
- if (!targetClass.isInterface() && shouldCreateStaticMember(expression.getMethodExpression(), targetClass) && !shouldBeAbstract(targetClass)) {
+ if ((!targetClass.isInterface() || PsiUtil.isLanguageLevel8OrHigher(targetClass)) && shouldCreateStaticMember(expression.getMethodExpression(), targetClass) && !shouldBeAbstract) {
PsiUtil.setModifierProperty(method, PsiModifier.STATIC, true);
}
final PsiElement context = PsiTreeUtil.getParentOfType(expression, PsiClass.class, PsiMethod.class);
PsiExpression[] arguments = expression.getArgumentList().getExpressions();
- doCreate(targetClass, method, shouldBeAbstract(targetClass),
+ doCreate(targetClass, method, shouldBeAbstract,
ContainerUtil.map2List(arguments, Pair.<PsiExpression, PsiType>createFunction(null)),
getTargetSubstitutor(expression),
CreateFromUsageUtils.guessExpectedTypes(expression, true),
@@ -213,7 +214,7 @@ public class CreateMethodFromUsageFix extends CreateFromUsageBaseFix {
public static void doCreate(PsiClass targetClass, PsiMethod method, List<Pair<PsiExpression, PsiType>> arguments, PsiSubstitutor substitutor,
ExpectedTypeInfo[] expectedTypes, @Nullable PsiElement context) {
- doCreate(targetClass, method, shouldBeAbstractImpl(targetClass), arguments, substitutor, expectedTypes, context);
+ doCreate(targetClass, method, shouldBeAbstractImpl(null, targetClass), arguments, substitutor, expectedTypes, context);
}
public static void doCreate(PsiClass targetClass,
@@ -340,12 +341,12 @@ public class CreateMethodFromUsageFix extends CreateFromUsageBaseFix {
return false;
}
- protected boolean shouldBeAbstract(PsiClass targetClass) {
- return shouldBeAbstractImpl(targetClass);
+ protected boolean shouldBeAbstract(PsiReferenceExpression expression, PsiClass targetClass) {
+ return shouldBeAbstractImpl(expression, targetClass);
}
- private static boolean shouldBeAbstractImpl(PsiClass targetClass) {
- return targetClass.isInterface();
+ private static boolean shouldBeAbstractImpl(PsiReferenceExpression expression, PsiClass targetClass) {
+ return targetClass.isInterface() && (expression == null || !shouldCreateStaticMember(expression, targetClass));
}
@Override
diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ImportClassFix.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ImportClassFix.java
index b5de7b73e318..fec3efd161ba 100644
--- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ImportClassFix.java
+++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ImportClassFix.java
@@ -30,6 +30,7 @@ import com.intellij.psi.*;
import com.intellij.psi.util.ClassUtil;
import org.jetbrains.annotations.NotNull;
+import java.util.Collections;
import java.util.List;
public class ImportClassFix extends ImportClassFixBase<PsiJavaCodeReferenceElement, PsiJavaCodeReferenceElement> {
@@ -107,9 +108,22 @@ public class ImportClassFix extends ImportClassFixBase<PsiJavaCodeReferenceEleme
return super.getRequiredMemberName(reference);
}
+ @Override
+ protected boolean canReferenceClass(PsiJavaCodeReferenceElement ref) {
+ if (ref instanceof PsiReferenceExpression) {
+ PsiElement parent = ref.getParent();
+ return parent instanceof PsiReferenceExpression || parent instanceof PsiExpressionStatement;
+ }
+ return true;
+ }
+
@NotNull
@Override
protected List<PsiClass> filterByContext(@NotNull List<PsiClass> candidates, @NotNull PsiJavaCodeReferenceElement ref) {
+ if (ref instanceof PsiReferenceExpression) {
+ return Collections.emptyList();
+ }
+
PsiElement typeElement = ref.getParent();
if (typeElement instanceof PsiTypeElement) {
PsiElement var = typeElement.getParent();
diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ImportClassFixBase.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ImportClassFixBase.java
index 8047486d93ba..2fbe85bc7b25 100644
--- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ImportClassFixBase.java
+++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ImportClassFixBase.java
@@ -102,14 +102,19 @@ public abstract class ImportClassFixBase<T extends PsiElement, R extends PsiRefe
// can happen when e.g. class name happened to be in a method position
if (element instanceof PsiClass && result.isValidResult()) return Collections.emptyList();
}
- PsiShortNamesCache cache = PsiShortNamesCache.getInstance(myElement.getProject());
+
String name = getReferenceName(myRef);
GlobalSearchScope scope = myElement.getResolveScope();
if (name == null) {
return Collections.emptyList();
}
+
+ if (!canReferenceClass(myRef)) {
+ return Collections.emptyList();
+ }
+
boolean referenceHasTypeParameters = hasTypeParameters(myRef);
- PsiClass[] classes = cache.getClassesByName(name, scope);
+ PsiClass[] classes = PsiShortNamesCache.getInstance(myElement.getProject()).getClassesByName(name, scope);
if (classes.length == 0) return Collections.emptyList();
List<PsiClass> classList = new ArrayList<PsiClass>(classes.length);
boolean isAnnotationReference = myElement.getParent() instanceof PsiAnnotation;
@@ -140,6 +145,10 @@ public abstract class ImportClassFixBase<T extends PsiElement, R extends PsiRefe
return classList;
}
+ protected boolean canReferenceClass(R ref) {
+ return true;
+ }
+
private List<PsiClass> filterByRequiredMemberName(List<PsiClass> classList) {
final String memberName = getRequiredMemberName(myElement);
if (memberName != null) {
diff --git a/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/JavaSmartEnterProcessor.java b/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/JavaSmartEnterProcessor.java
index cea07113fe24..90c26bc6073b 100644
--- a/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/JavaSmartEnterProcessor.java
+++ b/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/JavaSmartEnterProcessor.java
@@ -47,7 +47,21 @@ public class JavaSmartEnterProcessor extends SmartEnterProcessor {
private static final Logger LOG = Logger.getInstance("#com.intellij.codeInsight.editorActions.smartEnter.JavaSmartEnterProcessor");
private static final Fixer[] ourFixers;
- private static final EnterProcessor[] ourEnterProcessors;
+ private static final EnterProcessor[] ourEnterProcessors = {
+ new CommentBreakerEnterProcessor(),
+ new AfterSemicolonEnterProcessor(),
+ new LeaveCodeBlockEnterProcessor(),
+ new PlainEnterProcessor()
+ };
+ private static final EnterProcessor[] ourAfterCompletionEnterProcessors = {
+ new AfterSemicolonEnterProcessor(),
+ new EnterProcessor() {
+ @Override
+ public boolean doEnter(Editor editor, PsiElement psiElement, boolean isModified) {
+ return PlainEnterProcessor.expandCodeBlock(editor, psiElement);
+ }
+ }
+ };
static {
final List<Fixer> fixers = new ArrayList<Fixer>();
@@ -78,15 +92,7 @@ public class JavaSmartEnterProcessor extends SmartEnterProcessor {
fixers.add(new MissingArrayInitializerBraceFixer());
fixers.add(new MissingArrayConstructorBracketFixer());
fixers.add(new EnumFieldFixer());
- //ourFixers.add(new CompletionFixer());
ourFixers = fixers.toArray(new Fixer[fixers.size()]);
-
- List<EnterProcessor> processors = new ArrayList<EnterProcessor>();
- processors.add(new CommentBreakerEnterProcessor());
- processors.add(new AfterSemicolonEnterProcessor());
- processors.add(new LeaveCodeBlockEnterProcessor());
- processors.add(new PlainEnterProcessor());
- ourEnterProcessors = processors.toArray(new EnterProcessor[processors.size()]);
}
private int myFirstErrorOffset = Integer.MAX_VALUE;
@@ -102,13 +108,22 @@ public class JavaSmartEnterProcessor extends SmartEnterProcessor {
public boolean process(@NotNull final Project project, @NotNull final Editor editor, @NotNull final PsiFile psiFile) {
FeatureUsageTracker.getInstance().triggerFeatureUsed("codeassists.complete.statement");
+ return invokeProcessor(editor, psiFile, false);
+ }
+
+ @Override
+ public boolean processAfterCompletion(@NotNull Editor editor, @NotNull PsiFile psiFile) {
+ return invokeProcessor(editor, psiFile, true);
+ }
+
+ private boolean invokeProcessor(Editor editor, PsiFile psiFile, boolean afterCompletion) {
final Document document = editor.getDocument();
- final String textForRollback = document.getText();
+ final CharSequence textForRollback = document.getImmutableCharSequence();
try {
editor.putUserData(SMART_ENTER_TIMESTAMP, editor.getDocument().getModificationStamp());
myFirstErrorOffset = Integer.MAX_VALUE;
mySkipEnter = false;
- process(project, editor, psiFile, 0);
+ process(editor, psiFile, 0, afterCompletion);
}
catch (TooManyAttemptsException e) {
document.replaceString(0, document.getTextLength(), textForRollback);
@@ -118,8 +133,7 @@ public class JavaSmartEnterProcessor extends SmartEnterProcessor {
return true;
}
-
- private void process(@NotNull final Project project, @NotNull final Editor editor, @NotNull final PsiFile file, final int attempt) throws TooManyAttemptsException {
+ private void process(@NotNull final Editor editor, @NotNull final PsiFile file, final int attempt, boolean afterCompletion) throws TooManyAttemptsException {
if (attempt > MAX_ATTEMPTS) throw new TooManyAttemptsException();
try {
@@ -148,18 +162,18 @@ public class JavaSmartEnterProcessor extends SmartEnterProcessor {
for (PsiElement psiElement : queue) {
for (Fixer fixer : ourFixers) {
fixer.apply(editor, this, psiElement);
- if (LookupManager.getInstance(project).getActiveLookup() != null) {
+ if (LookupManager.getInstance(file.getProject()).getActiveLookup() != null) {
return;
}
- if (isUncommited(project) || !psiElement.isValid()) {
+ if (isUncommited(file.getProject()) || !psiElement.isValid()) {
moveCaretInsideBracesIfAny(editor, file);
- process(project, editor, file, attempt + 1);
+ process(editor, file, attempt + 1, afterCompletion);
return;
}
}
}
- doEnter(atCaret, editor);
+ doEnter(atCaret, editor, afterCompletion);
}
catch (IncorrectOperationException e) {
LOG.error(e);
@@ -187,7 +201,7 @@ public class JavaSmartEnterProcessor extends SmartEnterProcessor {
}
- private void doEnter(PsiElement atCaret, Editor editor) throws IncorrectOperationException {
+ private void doEnter(PsiElement atCaret, Editor editor, boolean afterCompletion) throws IncorrectOperationException {
final PsiFile psiFile = atCaret.getContainingFile();
final RangeMarker rangeMarker = createRangeMarker(atCaret);
@@ -205,7 +219,7 @@ public class JavaSmartEnterProcessor extends SmartEnterProcessor {
}
atCaret = CodeInsightUtil.findElementInRange(psiFile, rangeMarker.getStartOffset(), rangeMarker.getEndOffset(), atCaret.getClass());
- for (EnterProcessor processor : ourEnterProcessors) {
+ for (EnterProcessor processor : afterCompletion ? ourAfterCompletionEnterProcessors : ourEnterProcessors) {
if(atCaret == null){
// Can't restore element at caret after enter processor execution!
break;
@@ -214,7 +228,7 @@ public class JavaSmartEnterProcessor extends SmartEnterProcessor {
if (processor.doEnter(editor, atCaret, isModified(editor))) return;
}
- if (!isModified(editor)) {
+ if (!isModified(editor) && !afterCompletion) {
plainEnter(editor);
} else {
if (myFirstErrorOffset == Integer.MAX_VALUE) {
diff --git a/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/PlainEnterProcessor.java b/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/PlainEnterProcessor.java
index 0fe58925d884..6bafcc00d983 100644
--- a/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/PlainEnterProcessor.java
+++ b/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/PlainEnterProcessor.java
@@ -42,29 +42,37 @@ import org.jetbrains.annotations.Nullable;
public class PlainEnterProcessor implements EnterProcessor {
@Override
public boolean doEnter(Editor editor, PsiElement psiElement, boolean isModified) {
+ if (expandCodeBlock(editor, psiElement)) return true;
+
+ getEnterHandler(IdeActions.ACTION_EDITOR_START_NEW_LINE).execute(editor, ((EditorEx)editor).getDataContext());
+ return true;
+ }
+
+ static boolean expandCodeBlock(Editor editor, PsiElement psiElement) {
PsiCodeBlock block = getControlStatementBlock(editor.getCaretModel().getOffset(), psiElement);
if (processExistingBlankLine(editor, block, psiElement)) {
return true;
}
- EditorActionHandler enterHandler = getEnterHandler(IdeActions.ACTION_EDITOR_START_NEW_LINE);
- if (block != null) {
- PsiElement firstElement = block.getFirstBodyElement();
- if (firstElement == null) {
- firstElement = block.getRBrace();
- // Plain enter processor inserts enter after the end of line, hence, we don't want to use it here because the line ends with
- // the empty braces block. So, we get the following in case of default handler usage:
- // Before:
- // if (condition[caret]) {}
- // After:
- // if (condition) {}
- // [caret]
- enterHandler = getEnterHandler(IdeActions.ACTION_EDITOR_ENTER);
- }
- editor.getCaretModel().moveToOffset(firstElement != null ?
- firstElement.getTextRange().getStartOffset() :
- block.getTextRange().getEndOffset());
+ if (block == null) {
+ return false;
}
+ EditorActionHandler enterHandler = getEnterHandler(IdeActions.ACTION_EDITOR_START_NEW_LINE);
+ PsiElement firstElement = block.getFirstBodyElement();
+ if (firstElement == null) {
+ firstElement = block.getRBrace();
+ // Plain enter processor inserts enter after the end of line, hence, we don't want to use it here because the line ends with
+ // the empty braces block. So, we get the following in case of default handler usage:
+ // Before:
+ // if (condition[caret]) {}
+ // After:
+ // if (condition) {}
+ // [caret]
+ enterHandler = getEnterHandler(IdeActions.ACTION_EDITOR_ENTER);
+ }
+ editor.getCaretModel().moveToOffset(firstElement != null ?
+ firstElement.getTextRange().getStartOffset() :
+ block.getTextRange().getEndOffset());
enterHandler.execute(editor, ((EditorEx)editor).getDataContext());
return true;
}
diff --git a/java/java-impl/src/com/intellij/codeInsight/folding/impl/JavaFoldingBuilder.java b/java/java-impl/src/com/intellij/codeInsight/folding/impl/JavaFoldingBuilder.java
index 8646805b3a2f..5d948f326930 100644
--- a/java/java-impl/src/com/intellij/codeInsight/folding/impl/JavaFoldingBuilder.java
+++ b/java/java-impl/src/com/intellij/codeInsight/folding/impl/JavaFoldingBuilder.java
@@ -17,6 +17,7 @@ package com.intellij.codeInsight.folding.impl;
import com.intellij.codeInsight.ExpectedTypeInfo;
import com.intellij.codeInsight.ExpectedTypesProvider;
+import com.intellij.lang.java.JavaLanguage;
import com.intellij.openapi.project.Project;
import com.intellij.psi.*;
import com.intellij.psi.codeStyle.CodeStyleSettings;
@@ -27,7 +28,7 @@ public class JavaFoldingBuilder extends JavaFoldingBuilderBase {
@Override
protected boolean isBelowRightMargin(Project project, int lineLength) {
final CodeStyleSettings settings = CodeStyleSettingsManager.getSettings(project);
- return lineLength <= settings.RIGHT_MARGIN;
+ return lineLength <= settings.getRightMargin(JavaLanguage.INSTANCE);
}
@Override
diff --git a/java/java-impl/src/com/intellij/codeInsight/generation/GenerateDelegateHandler.java b/java/java-impl/src/com/intellij/codeInsight/generation/GenerateDelegateHandler.java
index 4236da3187fc..fe4208deada7 100644
--- a/java/java-impl/src/com/intellij/codeInsight/generation/GenerateDelegateHandler.java
+++ b/java/java-impl/src/com/intellij/codeInsight/generation/GenerateDelegateHandler.java
@@ -251,11 +251,22 @@ public class GenerateDelegateHandler implements LanguageCodeInsightActionHandler
final Set<MethodSignature> existingSignatures = new HashSet<MethodSignature>(aClass.getVisibleSignatures());
final Set<PsiMethodMember> selection = new HashSet<PsiMethodMember>();
Map<PsiClass, PsiSubstitutor> superSubstitutors = new HashMap<PsiClass, PsiSubstitutor>();
+
+ final PsiClass containingClass = targetMember.getContainingClass();
JavaPsiFacade facade = JavaPsiFacade.getInstance(target.getProject());
for (PsiMethod method : allMethods) {
final PsiClass superClass = method.getContainingClass();
if (CommonClassNames.JAVA_LANG_OBJECT.equals(superClass.getQualifiedName())) continue;
if (method.isConstructor()) continue;
+
+ //do not suggest to override final method
+ if (method.hasModifierProperty(PsiModifier.FINAL)) {
+ PsiMethod overridden = containingClass.findMethodBySignature(method, true);
+ if (overridden != null && overridden.getContainingClass() != containingClass) {
+ continue;
+ }
+ }
+
PsiSubstitutor superSubstitutor = superSubstitutors.get(superClass);
if (superSubstitutor == null) {
superSubstitutor = TypeConversionUtil.getSuperClassSubstitutor(superClass, targetClass, substitutor);
diff --git a/java/java-impl/src/com/intellij/codeInsight/generation/OverrideImplementUtil.java b/java/java-impl/src/com/intellij/codeInsight/generation/OverrideImplementUtil.java
index d8df67367790..49e2e43f2ce4 100644
--- a/java/java-impl/src/com/intellij/codeInsight/generation/OverrideImplementUtil.java
+++ b/java/java-impl/src/com/intellij/codeInsight/generation/OverrideImplementUtil.java
@@ -15,10 +15,7 @@
*/
package com.intellij.codeInsight.generation;
-import com.intellij.codeInsight.AnnotationUtil;
-import com.intellij.codeInsight.CodeInsightActionHandler;
-import com.intellij.codeInsight.CodeInsightBundle;
-import com.intellij.codeInsight.MethodImplementor;
+import com.intellij.codeInsight.*;
import com.intellij.codeInsight.intention.AddAnnotationFix;
import com.intellij.codeInsight.intention.AddAnnotationPsiFix;
import com.intellij.featureStatistics.FeatureUsageTracker;
@@ -259,6 +256,11 @@ public class OverrideImplementUtil extends OverrideImplementExploreUtil {
for (String annotation : each.getAnnotations(project)) {
if (moduleScope != null && facade.findClass(annotation, moduleScope) == null) continue;
if (AnnotationUtil.isAnnotated(overridden, annotation, false, false) && !AnnotationUtil.isAnnotated(method, annotation, false, false)) {
+ PsiAnnotation psiAnnotation = AnnotationUtil.findAnnotation(overridden, annotation);
+ if (psiAnnotation != null && AnnotationUtil.isInferredAnnotation(psiAnnotation)) {
+ continue;
+ }
+
AddAnnotationPsiFix.removePhysicalAnnotations(method, each.annotationsToRemove(project, annotation));
AddAnnotationPsiFix.addPhysicalAnnotation(annotation, PsiNameValuePair.EMPTY_ARRAY, method.getModifierList());
}
diff --git a/java/java-impl/src/com/intellij/codeInsight/hint/api/impls/MethodParameterInfoHandler.java b/java/java-impl/src/com/intellij/codeInsight/hint/api/impls/MethodParameterInfoHandler.java
index b33287321535..fd85d1124171 100644
--- a/java/java-impl/src/com/intellij/codeInsight/hint/api/impls/MethodParameterInfoHandler.java
+++ b/java/java-impl/src/com/intellij/codeInsight/hint/api/impls/MethodParameterInfoHandler.java
@@ -23,6 +23,7 @@ import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer;
import com.intellij.codeInsight.lookup.LookupElement;
import com.intellij.lang.parameterInfo.*;
import com.intellij.openapi.project.DumbAware;
+import com.intellij.openapi.project.DumbService;
import com.intellij.psi.*;
import com.intellij.psi.impl.source.resolve.CompletionParameterTypeInferencePolicy;
import com.intellij.psi.infos.CandidateInfo;
@@ -31,6 +32,7 @@ import com.intellij.psi.tree.IElementType;
import com.intellij.psi.util.MethodSignatureUtil;
import com.intellij.psi.util.PsiUtilBase;
import com.intellij.util.ArrayUtil;
+import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.containers.HashSet;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -443,13 +445,18 @@ public class MethodParameterInfoHandler implements ParameterInfoHandlerWithTabAc
private static void appendModifierList(@NotNull StringBuilder buffer, @NotNull PsiModifierListOwner owner) {
int lastSize = buffer.length();
- for (PsiAnnotation annotation : AnnotationUtil.getAllAnnotations(owner, false, null)) {
+ Set<String> shownAnnotations = ContainerUtil.newHashSet();
+ for (PsiAnnotation annotation : AnnotationUtil.getAllAnnotations(owner, false, null, !DumbService.isDumb(owner.getProject()))) {
final PsiJavaCodeReferenceElement element = annotation.getNameReferenceElement();
if (element != null) {
final PsiElement resolved = element.resolve();
if (resolved instanceof PsiClass && !AnnotationUtil.isAnnotated((PsiClass)resolved, "java.lang.annotation.Documented", false)) continue;
+
+ String referenceName = element.getReferenceName();
+ if (!shownAnnotations.add(referenceName)) continue;
+
if (lastSize != buffer.length()) buffer.append(" ");
- buffer.append("@").append(element.getReferenceName());
+ buffer.append("@").append(referenceName);
}
}
if (lastSize != buffer.length()) buffer.append(" ");
diff --git a/java/java-impl/src/com/intellij/codeInsight/template/impl/ShortenToStaticImportProcessor.java b/java/java-impl/src/com/intellij/codeInsight/template/impl/ShortenToStaticImportProcessor.java
index 41424cf2b526..fbb6786c4972 100644
--- a/java/java-impl/src/com/intellij/codeInsight/template/impl/ShortenToStaticImportProcessor.java
+++ b/java/java-impl/src/com/intellij/codeInsight/template/impl/ShortenToStaticImportProcessor.java
@@ -27,11 +27,11 @@ import com.intellij.openapi.util.Pair;
import com.intellij.psi.PsiDocumentManager;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
+import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.psi.util.PsiUtilBase;
import com.intellij.psi.util.PsiUtilCore;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
import java.util.Collections;
@@ -63,7 +63,7 @@ public class ShortenToStaticImportProcessor implements TemplateOptionalProcessor
for (
PsiElement element = PsiUtilCore.getElementAtOffset(file, templateRange.getStartOffset());
element != null && element.getTextRange().getStartOffset() < templateRange.getEndOffset();
- element = getNext(element))
+ element = PsiTreeUtil.nextLeaf(element))
{
for (StaticImporter importer : IMPORTERS) {
if (importer.canPerform(element)) {
@@ -81,15 +81,6 @@ public class ShortenToStaticImportProcessor implements TemplateOptionalProcessor
}
}
- @Nullable
- private static PsiElement getNext(@NotNull PsiElement element) {
- PsiElement result = element.getNextSibling();
- for (PsiElement current = element; current != null && result == null; current = current.getParent()) {
- result = current.getNextSibling();
- }
- return result;
- }
-
@Nls
@Override
public String getOptionName() {
diff --git a/java/java-impl/src/com/intellij/codeInsight/unwrap/JavaMethodParameterUnwrapper.java b/java/java-impl/src/com/intellij/codeInsight/unwrap/JavaMethodParameterUnwrapper.java
index ec771e43c073..1c1957bcf472 100644
--- a/java/java-impl/src/com/intellij/codeInsight/unwrap/JavaMethodParameterUnwrapper.java
+++ b/java/java-impl/src/com/intellij/codeInsight/unwrap/JavaMethodParameterUnwrapper.java
@@ -29,15 +29,23 @@ public class JavaMethodParameterUnwrapper extends JavaUnwrapper {
super("");
}
+ private static PsiElement adjustElementToTheLeft(PsiElement element) {
+ if (element instanceof PsiJavaToken && ((PsiJavaToken)element).getTokenType() == JavaTokenType.RPARENTH) {
+ return element.getPrevSibling();
+ }
+ return element;
+ }
+
@Override
public String getDescription(PsiElement e) {
- String text = e.getText();
+ String text = adjustElementToTheLeft(e).getText();
if (text.length() > 20) text = text.substring(0, 17) + "...";
return CodeInsightBundle.message("unwrap.with.placeholder", text);
}
@Override
public boolean isApplicableTo(PsiElement e) {
+ e = adjustElementToTheLeft(e);
final PsiElement parent = e.getParent();
if (e instanceof PsiExpression){
if (parent instanceof PsiExpressionList) {
@@ -62,6 +70,7 @@ public class JavaMethodParameterUnwrapper extends JavaUnwrapper {
@Override
public PsiElement collectAffectedElements(PsiElement e, List<PsiElement> toExtract) {
+ e = adjustElementToTheLeft(e);
super.collectAffectedElements(e, toExtract);
return isTopLevelCall(e) ? e.getParent() : e.getParent().getParent();
}
@@ -73,6 +82,7 @@ public class JavaMethodParameterUnwrapper extends JavaUnwrapper {
@Override
protected void doUnwrap(PsiElement element, Context context) throws IncorrectOperationException {
+ element = adjustElementToTheLeft(element);
PsiElement methodCall = isTopLevelCall(element) ? element.getParent() : element.getParent().getParent();
final PsiElement extractedElement = isTopLevelCall(element) ? getArg(element) : element;
context.extractElement(extractedElement, methodCall);
diff --git a/java/java-impl/src/com/intellij/ide/projectView/impl/nodes/PackageUtil.java b/java/java-impl/src/com/intellij/ide/projectView/impl/nodes/PackageUtil.java
index e9e999b7b149..bcb4b3d20319 100644
--- a/java/java-impl/src/com/intellij/ide/projectView/impl/nodes/PackageUtil.java
+++ b/java/java-impl/src/com/intellij/ide/projectView/impl/nodes/PackageUtil.java
@@ -21,8 +21,6 @@ import com.intellij.ide.util.treeView.TreeViewUtil;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.*;
-import com.intellij.openapi.roots.impl.DirectoryIndex;
-import com.intellij.openapi.roots.impl.DirectoryInfo;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.JavaDirectoryService;
@@ -230,20 +228,16 @@ public class PackageUtil {
}
private static class ProjectLibrariesSearchScope extends GlobalSearchScope {
- private final DirectoryIndex myDirectoryIndex;
+ private final ProjectFileIndex myFileIndex;
public ProjectLibrariesSearchScope(@NotNull Project project) {
super(project);
- myDirectoryIndex = DirectoryIndex.getInstance(project);
+ myFileIndex = ProjectRootManager.getInstance(project).getFileIndex();
}
@Override
public boolean contains(@NotNull VirtualFile file) {
- VirtualFile dir = file.isDirectory() ? file : file.getParent();
- if (dir == null) return false;
-
- DirectoryInfo info = myDirectoryIndex.getInfoForDirectory(dir);
- return info != null && info.hasLibraryClassRoot();
+ return myFileIndex.isInLibraryClasses(file);
}
@Override
diff --git a/java/java-impl/src/com/intellij/ide/util/PackageUtil.java b/java/java-impl/src/com/intellij/ide/util/PackageUtil.java
index be9405ee4754..0530f34e653a 100644
--- a/java/java-impl/src/com/intellij/ide/util/PackageUtil.java
+++ b/java/java-impl/src/com/intellij/ide/util/PackageUtil.java
@@ -24,14 +24,12 @@ import com.intellij.openapi.module.ModuleUtil;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.project.ProjectBundle;
import com.intellij.openapi.projectRoots.impl.ProjectRootUtil;
-import com.intellij.openapi.roots.ModulePackageIndex;
-import com.intellij.openapi.roots.ModuleRootManager;
-import com.intellij.openapi.roots.ProjectFileIndex;
-import com.intellij.openapi.roots.ProjectRootManager;
+import com.intellij.openapi.roots.*;
import com.intellij.openapi.roots.ui.configuration.CommonContentEntriesEditor;
import com.intellij.openapi.roots.ui.configuration.ProjectSettingsService;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.util.Computable;
+import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.*;
import com.intellij.psi.search.GlobalSearchScope;
@@ -52,13 +50,29 @@ public class PackageUtil {
@Nullable
public static PsiDirectory findPossiblePackageDirectoryInModule(Module module, String packageName) {
+ return findPossiblePackageDirectoryInModule(module, packageName, true);
+ }
+ @Nullable
+ public static PsiDirectory findPossiblePackageDirectoryInModule(Module module, String packageName, boolean preferNonGeneratedRoots) {
+ final Project project = module.getProject();
PsiDirectory psiDirectory = null;
- if (!"".equals(packageName)) {
- PsiPackage rootPackage = findLongestExistingPackage(module.getProject(), packageName);
+ if (!StringUtil.isEmptyOrSpaces(packageName)) {
+ PsiPackage rootPackage = findLongestExistingPackage(project, packageName);
if (rootPackage != null) {
final PsiDirectory[] psiDirectories = getPackageDirectoriesInModule(rootPackage, module);
if (psiDirectories.length > 0) {
psiDirectory = psiDirectories[0];
+
+ // If we prefer to find a non-generated PsiDirectory for the given package name, search through all
+ // the directories for the first dir not marked as generated and use that one instead
+ if (preferNonGeneratedRoots && psiDirectories.length > 1) {
+ for (PsiDirectory dir : psiDirectories) {
+ if (!GeneratedSourcesFilter.isGeneratedSourceByAnyFilter(dir.getVirtualFile(), project)) {
+ psiDirectory = dir;
+ break;
+ }
+ }
+ }
}
}
}
@@ -66,7 +80,7 @@ public class PackageUtil {
if (checkSourceRootsConfigured(module)) {
final List<VirtualFile> sourceRoots = ModuleRootManager.getInstance(module).getSourceRoots(JavaModuleSourceRootTypes.SOURCES);
for (VirtualFile sourceRoot : sourceRoots) {
- final PsiDirectory directory = PsiManager.getInstance(module.getProject()).findDirectory(sourceRoot);
+ final PsiDirectory directory = PsiManager.getInstance(project).findDirectory(sourceRoot);
if (directory != null) {
psiDirectory = directory;
break;
diff --git a/java/java-impl/src/com/intellij/openapi/roots/impl/JavaLanguageLevelPusher.java b/java/java-impl/src/com/intellij/openapi/roots/impl/JavaLanguageLevelPusher.java
index d933576fc697..a4e7b64241f3 100644
--- a/java/java-impl/src/com/intellij/openapi/roots/impl/JavaLanguageLevelPusher.java
+++ b/java/java-impl/src/com/intellij/openapi/roots/impl/JavaLanguageLevelPusher.java
@@ -86,7 +86,7 @@ public class JavaLanguageLevelPusher implements FilePropertyPusher<LanguageLevel
private static final FileAttribute PERSISTENCE = new FileAttribute("language_level_persistence", 3, true);
@Override
- public void persistAttribute(@NotNull VirtualFile fileOrDir, @NotNull LanguageLevel level) throws IOException {
+ public void persistAttribute(@NotNull Project project, @NotNull VirtualFile fileOrDir, @NotNull LanguageLevel level) throws IOException {
final DataInputStream iStream = PERSISTENCE.readAttribute(fileOrDir);
if (iStream != null) {
try {
@@ -104,7 +104,7 @@ public class JavaLanguageLevelPusher implements FilePropertyPusher<LanguageLevel
for (VirtualFile child : fileOrDir.getChildren()) {
if (!child.isDirectory() && StdFileTypes.JAVA.equals(child.getFileType())) {
- PushedFilePropertiesUpdater.filePropertiesChanged(child);
+ PushedFilePropertiesUpdater.getInstance(project).filePropertiesChanged(child);
}
}
}
diff --git a/java/java-impl/src/com/intellij/psi/formatter/java/JavaSpacePropertyProcessor.java b/java/java-impl/src/com/intellij/psi/formatter/java/JavaSpacePropertyProcessor.java
index b76aeaa4b3fd..28748028c246 100644
--- a/java/java-impl/src/com/intellij/psi/formatter/java/JavaSpacePropertyProcessor.java
+++ b/java/java-impl/src/com/intellij/psi/formatter/java/JavaSpacePropertyProcessor.java
@@ -44,6 +44,7 @@ import com.intellij.psi.tree.IElementType;
import com.intellij.psi.tree.java.IJavaElementType;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.util.containers.ConcurrentHashMap;
+import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.Map;
@@ -229,7 +230,7 @@ public class JavaSpacePropertyProcessor extends JavaElementVisitor {
new TextRange(dependanceStart, myChild1.getTextRange().getEndOffset()),
keepOneLine, true);
}
- else if (myRole1 == ChildRole.LBRACE) {
+ else if (myRole1 == ChildRole.LBRACE || isEndOfLineCommentAfterLBrace(myChild1)) {
if (aClass.isEnum()) {
createParenthSpace(true, false);
}
@@ -275,6 +276,19 @@ public class JavaSpacePropertyProcessor extends JavaElementVisitor {
}
}
+ private boolean isEndOfLineCommentAfterLBrace(@NotNull ASTNode node) {
+ if (node.getPsi() instanceof PsiComment) {
+ PsiElement ws = node.getPsi().getPrevSibling();
+ if (ws instanceof PsiWhiteSpace && !ws.textContains('\n')) {
+ PsiElement beforeWs = ws.getPrevSibling();
+ if (beforeWs instanceof PsiJavaToken && ((PsiJavaToken)beforeWs).getTokenType() == JavaTokenType.LBRACE) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
private static boolean isTheOnlyClassMember(final ASTNode node) {
ASTNode next = node.getTreeNext();
if (next == null || !(next.getElementType() == JavaTokenType.RBRACE)) return false;
diff --git a/java/java-impl/src/com/intellij/psi/impl/JavaCodeBlockModificationListener.java b/java/java-impl/src/com/intellij/psi/impl/JavaCodeBlockModificationListener.java
index 18be9cd12246..314f55c2f7fe 100644
--- a/java/java-impl/src/com/intellij/psi/impl/JavaCodeBlockModificationListener.java
+++ b/java/java-impl/src/com/intellij/psi/impl/JavaCodeBlockModificationListener.java
@@ -16,6 +16,7 @@
package com.intellij.psi.impl;
import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.openapi.roots.ProjectFileIndex;
import com.intellij.psi.*;
import com.intellij.psi.impl.source.jsp.jspXml.JspDirective;
import com.intellij.psi.util.PsiModificationTracker;
@@ -90,7 +91,8 @@ public class JavaCodeBlockModificationListener implements PsiTreeChangePreproces
}
private static boolean isSourceDir(PsiElement element) {
- return element instanceof PsiDirectory && JavaDirectoryService.getInstance().getPackage((PsiDirectory)element) != null;
+ return element instanceof PsiDirectory &&
+ ProjectFileIndex.SERVICE.getInstance(element.getProject()).isInSource(((PsiDirectory)element).getVirtualFile());
}
private static boolean isClassOwner(final PsiElement element) {
diff --git a/java/java-impl/src/com/intellij/psi/impl/JavaDirectoryIconProvider.java b/java/java-impl/src/com/intellij/psi/impl/JavaDirectoryIconProvider.java
index 795e66e01ed4..e87e95f79086 100644
--- a/java/java-impl/src/com/intellij/psi/impl/JavaDirectoryIconProvider.java
+++ b/java/java-impl/src/com/intellij/psi/impl/JavaDirectoryIconProvider.java
@@ -15,6 +15,7 @@
*/
package com.intellij.psi.impl;
+import com.intellij.icons.AllIcons;
import com.intellij.ide.IconProvider;
import com.intellij.ide.projectView.impl.ProjectRootsUtil;
import com.intellij.openapi.module.Module;
@@ -24,6 +25,7 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.ProjectRootManager;
import com.intellij.openapi.roots.SourceFolder;
import com.intellij.openapi.roots.ui.configuration.SourceRootPresentation;
+import com.intellij.openapi.util.registry.Registry;
import com.intellij.openapi.vfs.JarFileSystem;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.JavaDirectoryService;
@@ -68,6 +70,9 @@ public class JavaDirectoryIconProvider extends IconProvider implements DumbAware
else if (JavaDirectoryService.getInstance().getPackage(psiDirectory) != null) {
symbolIcon = PlatformIcons.PACKAGE_ICON;
}
+ else if (!Registry.is("ide.hide.excluded.files") && ProjectRootManager.getInstance(project).getFileIndex().isExcluded(vFile)) {
+ symbolIcon = AllIcons.Modules.ExcludeRoot;
+ }
else {
symbolIcon = PlatformIcons.DIRECTORY_CLOSED_ICON;
}
diff --git a/java/java-impl/src/com/intellij/psi/impl/JavaPsiImplementationHelperImpl.java b/java/java-impl/src/com/intellij/psi/impl/JavaPsiImplementationHelperImpl.java
index 8ea592fd99aa..dce55fd952b5 100644
--- a/java/java-impl/src/com/intellij/psi/impl/JavaPsiImplementationHelperImpl.java
+++ b/java/java-impl/src/com/intellij/psi/impl/JavaPsiImplementationHelperImpl.java
@@ -178,7 +178,7 @@ public class JavaPsiImplementationHelperImpl extends JavaPsiImplementationHelper
}
List<OrderEntry> orderEntries = index.getOrderEntriesForFile(virtualFile);
if (orderEntries.isEmpty()) {
- LOG.error("Inconsistent: " + DirectoryIndex.getInstance(myProject).getInfoForDirectory(folder).toString());
+ LOG.error("Inconsistent: " + DirectoryIndex.getInstance(myProject).getInfoForFile(folder).toString());
}
final VirtualFile[] files = orderEntries.get(0).getFiles(OrderRootType.CLASSES);
for (VirtualFile rootFile : files) {
diff --git a/java/java-impl/src/com/intellij/psi/impl/source/codeStyle/javadoc/JDParser.java b/java/java-impl/src/com/intellij/psi/impl/source/codeStyle/javadoc/JDParser.java
index b424af918851..f6dc9b9697f2 100644
--- a/java/java-impl/src/com/intellij/psi/impl/source/codeStyle/javadoc/JDParser.java
+++ b/java/java-impl/src/com/intellij/psi/impl/source/codeStyle/javadoc/JDParser.java
@@ -15,6 +15,7 @@
*/
package com.intellij.psi.impl.source.codeStyle.javadoc;
+import com.intellij.lang.java.JavaLanguage;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.pom.java.LanguageLevel;
@@ -469,20 +470,21 @@ public class JDParser {
boolean firstLineShorter,
int firstLinePrefixLength)
{
+ int rightMargin = mySettings.getRightMargin(JavaLanguage.INSTANCE);
StringBuilder sb = new StringBuilder();
List<String> list;
//If wrap comments selected, comments should be wrapped by the right margin
if (mySettings.WRAP_COMMENTS) {
- list = toArrayWrapping(str, mySettings.RIGHT_MARGIN - prefix.length());
+ list = toArrayWrapping(str, rightMargin - prefix.length());
if (firstLineShorter
&& list != null && !list.isEmpty()
- && list.get(0).length() > mySettings.RIGHT_MARGIN - firstLinePrefixLength)
+ && list.get(0).length() > rightMargin - firstLinePrefixLength)
{
list = new ArrayList<String>();
//want the first line to be shorter, according to it's prefix
- String firstLine = toArrayWrapping(str, mySettings.RIGHT_MARGIN - firstLinePrefixLength).get(0);
+ String firstLine = toArrayWrapping(str, rightMargin - firstLinePrefixLength).get(0);
//so now first line is exactly same width we need
list.add(firstLine);
str = str.substring(firstLine.length());
@@ -493,7 +495,7 @@ public class JDParser {
}
//getting all another lines according to their prefix
- List<String> subList = toArrayWrapping(str, mySettings.RIGHT_MARGIN - prefix.length());
+ List<String> subList = toArrayWrapping(str, rightMargin - prefix.length());
//removing pre tag
if (unclosedPreTag && subList != null && !subList.isEmpty()) {
diff --git a/java/java-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/JavaCharsetReferenceContributor.java b/java/java-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/JavaCharsetReferenceContributor.java
deleted file mode 100644
index db1a385d5137..000000000000
--- a/java/java-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/JavaCharsetReferenceContributor.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright 2000-2014 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.intellij.psi.impl.source.resolve.reference.impl;
-
-import com.intellij.codeInsight.daemon.impl.analysis.encoding.EncodingReference;
-import com.intellij.psi.*;
-import com.intellij.psi.impl.source.resolve.reference.impl.manipulators.StringLiteralManipulator;
-import com.intellij.util.ProcessingContext;
-import org.jetbrains.annotations.NotNull;
-
-import java.nio.charset.Charset;
-
-import static com.intellij.patterns.PsiJavaPatterns.literalExpression;
-import static com.intellij.patterns.PsiJavaPatterns.psiMethod;
-import static com.intellij.patterns.StandardPatterns.string;
-
-/**
- * @author peter
- */
-public class JavaCharsetReferenceContributor extends PsiReferenceContributor {
- @Override
- public void registerReferenceProviders(@NotNull PsiReferenceRegistrar registrar) {
- registrar.registerReferenceProvider(
- literalExpression().methodCallParameter(
- 0, psiMethod().withName(string().oneOf("forName", "isSupported")).inClass(Charset.class.getName())),
- new PsiReferenceProvider() {
- @NotNull
- @Override
- public PsiReference[] getReferencesByElement(@NotNull PsiElement element, @NotNull ProcessingContext context) {
- PsiLiteralExpression literal = (PsiLiteralExpression)element;
- Object value = literal.getValue();
- if (value instanceof String) {
- return new PsiReference[]{new EncodingReference(element, (String)value, StringLiteralManipulator.getValueRange(literal))};
- }
- return PsiReference.EMPTY_ARRAY;
- }
- });
- }
-}
diff --git a/java/java-impl/src/com/intellij/psi/util/proximity/KnownElementWeigher.java b/java/java-impl/src/com/intellij/psi/util/proximity/KnownElementWeigher.java
index ffb122b1ca61..511d41f58986 100644
--- a/java/java-impl/src/com/intellij/psi/util/proximity/KnownElementWeigher.java
+++ b/java/java-impl/src/com/intellij/psi/util/proximity/KnownElementWeigher.java
@@ -20,14 +20,26 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.*;
import com.intellij.psi.util.ProximityLocation;
+import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import java.util.Set;
+
+import static com.intellij.psi.CommonClassNames.*;
+
/**
* @author peter
*/
public class KnownElementWeigher extends ProximityWeigher {
+ private static final Set<String> POPULAR_JDK_CLASSES = ContainerUtil.newHashSet(
+ JAVA_LANG_STRING,
+ JAVA_LANG_CLASS,
+ System.class.getName(), JAVA_LANG_RUNNABLE,
+ JAVA_LANG_EXCEPTION, JAVA_LANG_THROWABLE, JAVA_LANG_RUNTIME_EXCEPTION,
+ JAVA_UTIL_ARRAY_LIST, JAVA_UTIL_HASH_MAP, JAVA_UTIL_HASH_SET
+ );
@Override
public Comparable weigh(@NotNull final PsiElement element, @NotNull final ProximityLocation location) {
@@ -50,7 +62,7 @@ public class KnownElementWeigher extends ProximityWeigher {
if (containingClass != null) {
String methodName = method.getName();
if ("finalize".equals(methodName) || "registerNatives".equals(methodName) || methodName.startsWith("wait") || methodName.startsWith("notify")) {
- if (CommonClassNames.JAVA_LANG_OBJECT.equals(containingClass.getQualifiedName())) {
+ if (JAVA_LANG_OBJECT.equals(containingClass.getQualifiedName())) {
return -1;
}
}
@@ -58,11 +70,11 @@ public class KnownElementWeigher extends ProximityWeigher {
return -1;
}
if ("subSequence".equals(methodName)) {
- if (CommonClassNames.JAVA_LANG_STRING.equals(containingClass.getQualifiedName())) {
+ if (JAVA_LANG_STRING.equals(containingClass.getQualifiedName())) {
return -1;
}
}
- if (CommonClassNames.JAVA_LANG_OBJECT.equals(containingClass.getQualifiedName())) {
+ if (JAVA_LANG_OBJECT.equals(containingClass.getQualifiedName())) {
return 0;
}
return getJdkClassProximity(method.getContainingClass());
@@ -86,8 +98,8 @@ public class KnownElementWeigher extends ProximityWeigher {
@NonNls final String qname = element.getQualifiedName();
if (qname != null) {
String pkg = StringUtil.getPackageName(qname);
- if (qname.equals(CommonClassNames.JAVA_LANG_OBJECT)) return 5;
- if (isPopularJdkClass(qname)) return 8;
+ if (qname.equals(JAVA_LANG_OBJECT)) return 5;
+ if (POPULAR_JDK_CLASSES.contains(qname)) return 8;
if (pkg.equals("java.lang")) return 6;
if (pkg.equals("java.util")) return 7;
@@ -103,13 +115,4 @@ public class KnownElementWeigher extends ProximityWeigher {
return 0;
}
- private static boolean isPopularJdkClass(String qname) {
- return qname.equals(CommonClassNames.JAVA_LANG_STRING) ||
- qname.equals(System.class.getName()) ||
- qname.equals(CommonClassNames.JAVA_LANG_EXCEPTION) ||
- qname.equals(CommonClassNames.JAVA_LANG_THROWABLE) ||
- qname.equals(CommonClassNames.JAVA_LANG_RUNTIME_EXCEPTION) ||
- qname.equals(CommonClassNames.JAVA_LANG_RUNNABLE) ||
- qname.equals(CommonClassNames.JAVA_LANG_CLASS);
- }
} \ No newline at end of file
diff --git a/java/java-impl/src/com/intellij/refactoring/changeSignature/JavaChangeSignatureUsageProcessor.java b/java/java-impl/src/com/intellij/refactoring/changeSignature/JavaChangeSignatureUsageProcessor.java
index 8a9eca38a529..6a44f2529284 100644
--- a/java/java-impl/src/com/intellij/refactoring/changeSignature/JavaChangeSignatureUsageProcessor.java
+++ b/java/java-impl/src/com/intellij/refactoring/changeSignature/JavaChangeSignatureUsageProcessor.java
@@ -15,7 +15,9 @@
*/
package com.intellij.refactoring.changeSignature;
+import com.intellij.codeInsight.AnnotationUtil;
import com.intellij.codeInsight.ExceptionUtil;
+import com.intellij.codeInsight.InferredAnnotationsManager;
import com.intellij.codeInsight.daemon.impl.analysis.JavaHighlightUtil;
import com.intellij.codeInspection.dataFlow.ControlFlowAnalyzer;
import com.intellij.lang.StdLanguages;
@@ -943,7 +945,8 @@ public class JavaChangeSignatureUsageProcessor implements ChangeSignatureUsagePr
}
private static void checkContract(MultiMap<PsiElement, String> conflictDescriptions, PsiMethod method) {
- if (ControlFlowAnalyzer.findContractAnnotation(method) != null) {
+ PsiAnnotation contract = ControlFlowAnalyzer.findContractAnnotation(method);
+ if (contract != null && !AnnotationUtil.isInferredAnnotation(contract)) {
conflictDescriptions.putValue(method, "@Contract annotation will have to be changed manually");
}
}
diff --git a/java/java-impl/src/com/intellij/refactoring/extractMethod/ExtractMethodUtil.java b/java/java-impl/src/com/intellij/refactoring/extractMethod/ExtractMethodUtil.java
deleted file mode 100644
index f20ff1ca9ded..000000000000
--- a/java/java-impl/src/com/intellij/refactoring/extractMethod/ExtractMethodUtil.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * Copyright 2000-2009 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.refactoring.extractMethod;
-
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.util.Key;
-import com.intellij.psi.*;
-import com.intellij.psi.search.SearchScope;
-import com.intellij.psi.search.searches.ClassInheritorsSearch;
-import com.intellij.psi.search.searches.ReferencesSearch;
-import com.intellij.psi.util.PsiTreeUtil;
-import com.intellij.psi.util.RedundantCastUtil;
-import com.intellij.util.IncorrectOperationException;
-import com.intellij.util.Processor;
-import com.intellij.util.containers.HashMap;
-
-import java.util.Map;
-
-/**
- * @author ven
- */
-public class ExtractMethodUtil {
- private static final Key<PsiMethod> RESOLVE_TARGET_KEY = Key.create("RESOLVE_TARGET_KEY");
- private static final Logger LOG = Logger.getInstance("com.intellij.refactoring.extractMethod.ExtractMethodUtil");
-
- private ExtractMethodUtil() { }
-
- static Map<PsiMethodCallExpression, PsiMethod> encodeOverloadTargets(final PsiClass targetClass,
- final SearchScope processConflictsScope,
- final String overloadName,
- final PsiElement extractedFragment) {
- final Map<PsiMethodCallExpression, PsiMethod> ret = new HashMap<PsiMethodCallExpression, PsiMethod>();
- encodeInClass(targetClass, overloadName, extractedFragment, ret);
-
- ClassInheritorsSearch.search(targetClass, processConflictsScope, true).forEach(new Processor<PsiClass>() {
- public boolean process(PsiClass inheritor) {
- encodeInClass(inheritor, overloadName, extractedFragment, ret);
- return true;
- }
- });
-
- return ret;
- }
-
- private static void encodeInClass(final PsiClass aClass,
- final String overloadName,
- final PsiElement extractedFragment,
- final Map<PsiMethodCallExpression, PsiMethod> ret) {
- final PsiMethod[] overloads = aClass.findMethodsByName(overloadName, false);
- for (final PsiMethod overload : overloads) {
- for (final PsiReference ref : ReferencesSearch.search(overload)) {
- final PsiElement element = ref.getElement();
- final PsiElement parent = element.getParent();
- if (parent instanceof PsiMethodCallExpression) {
- final PsiMethodCallExpression call = (PsiMethodCallExpression)parent;
- if (PsiTreeUtil.isAncestor(extractedFragment, element, false)) {
- call.putCopyableUserData(RESOLVE_TARGET_KEY, overload);
- } else {
- //we assume element won't be invalidated as a result of extraction
- ret.put(call, overload);
- }
- }
- }
- }
- }
-
- public static void decodeOverloadTargets(Map<PsiMethodCallExpression, PsiMethod> oldResolves, final PsiMethod extracted,
- final PsiElement oldFragment) {
- final PsiCodeBlock body = extracted.getBody();
- assert body != null;
- final JavaRecursiveElementVisitor visitor = new JavaRecursiveElementVisitor() {
-
- @Override public void visitMethodCallExpression(PsiMethodCallExpression expression) {
- super.visitMethodCallExpression(expression);
- final PsiMethod target = expression.getCopyableUserData(RESOLVE_TARGET_KEY);
- if (target != null) {
- expression.putCopyableUserData(RESOLVE_TARGET_KEY, null);
- try {
- assertSameResolveTarget(target, expression, extracted);
- }
- catch (IncorrectOperationException e) {
- LOG.error(e);
- }
- }
- }
- };
- body.accept(visitor);
- oldFragment.accept(visitor);
-
- for (final Map.Entry<PsiMethodCallExpression, PsiMethod> entry : oldResolves.entrySet()) {
- try {
- assertSameResolveTarget(entry.getValue(), entry.getKey(), extracted);
- }
- catch (IncorrectOperationException e) {
- LOG.error(e);
- }
- }
- }
-
- private static void assertSameResolveTarget(final PsiMethod oldTarget, final PsiMethodCallExpression call, final PsiMethod extracted)
- throws IncorrectOperationException {
- final PsiMethod newTarget = call.resolveMethod();
- final PsiManager manager = extracted.getManager();
- final PsiElementFactory factory = JavaPsiFacade.getInstance(manager.getProject()).getElementFactory();
- if (!manager.areElementsEquivalent(oldTarget, newTarget)) {
- final PsiParameter[] oldParameters = oldTarget.getParameterList().getParameters();
- if (oldParameters.length > 0) {
- final PsiMethodCallExpression copy = (PsiMethodCallExpression)call.copy();
- final PsiExpression[] args = copy.getArgumentList().getExpressions();
- for (int i = 0; i < args.length; i++) {
- PsiExpression arg = args[i];
- PsiType paramType = i < oldParameters.length ? oldParameters[i].getType() : oldParameters[oldParameters.length - 1].getType();
- final PsiTypeCastExpression cast = (PsiTypeCastExpression)factory.createExpressionFromText("(a)b", null);
- final PsiTypeElement typeElement = cast.getCastType();
- assert typeElement != null;
- typeElement.replace(factory.createTypeElement(paramType));
- final PsiExpression operand = cast.getOperand();
- assert operand != null;
- operand.replace(arg);
- arg.replace(cast);
- }
-
- for (int i = 0; i < copy.getArgumentList().getExpressions().length; i++) {
- PsiExpression oldarg = call.getArgumentList().getExpressions()[i];
- PsiTypeCastExpression cast = (PsiTypeCastExpression)copy.getArgumentList().getExpressions()[i];
- if (!RedundantCastUtil.isCastRedundant(cast)) {
- oldarg.replace(cast);
- }
- }
- }
- }
- }
-}
diff --git a/java/java-impl/src/com/intellij/refactoring/inline/InlineMethodProcessor.java b/java/java-impl/src/com/intellij/refactoring/inline/InlineMethodProcessor.java
index 7b68e338aa63..b29d02fad178 100644
--- a/java/java-impl/src/com/intellij/refactoring/inline/InlineMethodProcessor.java
+++ b/java/java-impl/src/com/intellij/refactoring/inline/InlineMethodProcessor.java
@@ -791,7 +791,7 @@ public class InlineMethodProcessor extends BaseRefactoringProcessor {
String[] names = myJavaCodeStyle.suggestVariableName(VariableKind.LOCAL_VARIABLE, null, null, thisType)
.names;
String thisVarName = names[0];
- thisVarName = myJavaCodeStyle.suggestUniqueVariableName(thisVarName, block.getFirstChild(), true);
+ thisVarName = myJavaCodeStyle.suggestUniqueVariableName(thisVarName, myMethod.getFirstChild(), true);
PsiExpression initializer = myFactory.createExpressionFromText("null", null);
PsiDeclarationStatement declaration = myFactory.createVariableDeclarationStatement(thisVarName, thisType, initializer);
declaration = (PsiDeclarationStatement)block.addAfter(declaration, null);
diff --git a/java/java-impl/src/com/intellij/refactoring/introduceField/BaseExpressionToFieldHandler.java b/java/java-impl/src/com/intellij/refactoring/introduceField/BaseExpressionToFieldHandler.java
index 731daff180c9..a751acea42df 100644
--- a/java/java-impl/src/com/intellij/refactoring/introduceField/BaseExpressionToFieldHandler.java
+++ b/java/java-impl/src/com/intellij/refactoring/introduceField/BaseExpressionToFieldHandler.java
@@ -405,7 +405,8 @@ public abstract class BaseExpressionToFieldHandler extends IntroduceHandlerBase
PsiElementFactory factory = JavaPsiFacade.getInstance(psiManager.getProject()).getElementFactory();
try {
PsiField field = factory.createFieldFromText(pattern.toString(), null);
- field.getTypeElement().replace(factory.createTypeElement(type));
+ final PsiTypeElement typeElement = factory.createTypeElement(type);
+ field.getTypeElement().replace(typeElement);
field = (PsiField)CodeStyleManager.getInstance(psiManager.getProject()).reformat(field);
if (includeInitializer) {
field.getInitializer().replace(initializerExpr);
diff --git a/java/java-impl/src/com/intellij/refactoring/introduceField/InplaceIntroduceConstantPopup.java b/java/java-impl/src/com/intellij/refactoring/introduceField/InplaceIntroduceConstantPopup.java
index 4238c2181f0b..ceae8aed2e44 100644
--- a/java/java-impl/src/com/intellij/refactoring/introduceField/InplaceIntroduceConstantPopup.java
+++ b/java/java-impl/src/com/intellij/refactoring/introduceField/InplaceIntroduceConstantPopup.java
@@ -224,6 +224,11 @@ public class InplaceIntroduceConstantPopup extends AbstractInplaceIntroduceField
}
@Override
+ protected String getRefactoringId() {
+ return "refactoring.extractConstant";
+ }
+
+ @Override
protected boolean startsOnTheSameElement(RefactoringActionHandler handler, PsiElement element) {
return super.startsOnTheSameElement(handler, element) && handler instanceof IntroduceConstantHandler;
}
diff --git a/java/java-impl/src/com/intellij/refactoring/introduceField/InplaceIntroduceFieldPopup.java b/java/java-impl/src/com/intellij/refactoring/introduceField/InplaceIntroduceFieldPopup.java
index 4c1de5e39551..3998a93d1b54 100644
--- a/java/java-impl/src/com/intellij/refactoring/introduceField/InplaceIntroduceFieldPopup.java
+++ b/java/java-impl/src/com/intellij/refactoring/introduceField/InplaceIntroduceFieldPopup.java
@@ -148,6 +148,11 @@ public class InplaceIntroduceFieldPopup extends AbstractInplaceIntroduceFieldPop
}
}
+ @Override
+ protected String getRefactoringId() {
+ return "refactoring.extractField";
+ }
+
public void setVisibility(String visibility) {
myIntroduceFieldPanel.setVisibility(visibility);
}
@@ -203,6 +208,8 @@ public class InplaceIntroduceFieldPopup extends AbstractInplaceIntroduceFieldPop
protected void performIntroduce() {
ourLastInitializerPlace = myIntroduceFieldPanel.getInitializerPlace();
+ final PsiType forcedType = getType();
+ LOG.assertTrue(forcedType == null || forcedType.isValid(), forcedType);
final BaseExpressionToFieldHandler.Settings settings =
new BaseExpressionToFieldHandler.Settings(getInputName(),
getExpr(),
@@ -211,7 +218,7 @@ public class InplaceIntroduceFieldPopup extends AbstractInplaceIntroduceFieldPop
myIntroduceFieldPanel.isDeclareFinal(),
myIntroduceFieldPanel.getInitializerPlace(),
myIntroduceFieldPanel.getFieldVisibility(), (PsiLocalVariable)getLocalVariable(),
- getType(),
+ forcedType,
myIntroduceFieldPanel.isDeleteVariable(),
myParentClass, false, false);
new WriteCommandAction(myProject, getCommandName(), getCommandName()){
diff --git a/java/java-impl/src/com/intellij/refactoring/introduceParameter/IntroduceParameterProcessor.java b/java/java-impl/src/com/intellij/refactoring/introduceParameter/IntroduceParameterProcessor.java
index dc1f1668d744..152172597d6e 100644
--- a/java/java-impl/src/com/intellij/refactoring/introduceParameter/IntroduceParameterProcessor.java
+++ b/java/java-impl/src/com/intellij/refactoring/introduceParameter/IntroduceParameterProcessor.java
@@ -348,6 +348,15 @@ public class IntroduceParameterProcessor extends BaseRefactoringProcessor implem
return data;
}
+ @Nullable
+ @Override
+ protected RefactoringEventData getAfterData(UsageInfo[] usages) {
+ final PsiParameter parameter = JavaIntroduceParameterMethodUsagesProcessor.getAnchorParameter(myMethodToReplaceIn);
+ final RefactoringEventData afterData = new RefactoringEventData();
+ afterData.addElement(parameter);
+ return afterData;
+ }
+
protected void performRefactoring(UsageInfo[] usages) {
try {
PsiElementFactory factory = JavaPsiFacade.getInstance(myManager.getProject()).getElementFactory();
diff --git a/java/java-impl/src/com/intellij/refactoring/introduceVariable/IntroduceVariableBase.java b/java/java-impl/src/com/intellij/refactoring/introduceVariable/IntroduceVariableBase.java
index 0e513d4d39d0..16fc097bc612 100644
--- a/java/java-impl/src/com/intellij/refactoring/introduceVariable/IntroduceVariableBase.java
+++ b/java/java-impl/src/com/intellij/refactoring/introduceVariable/IntroduceVariableBase.java
@@ -61,6 +61,8 @@ import com.intellij.refactoring.*;
import com.intellij.refactoring.introduce.inplace.AbstractInplaceIntroducer;
import com.intellij.refactoring.introduce.inplace.OccurrencesChooser;
import com.intellij.refactoring.introduceField.ElementToWorkOn;
+import com.intellij.refactoring.listeners.RefactoringEventData;
+import com.intellij.refactoring.listeners.RefactoringEventListener;
import com.intellij.refactoring.ui.TypeSelectorManagerImpl;
import com.intellij.refactoring.util.CommonRefactoringUtil;
import com.intellij.refactoring.util.FieldConflictsResolver;
@@ -85,7 +87,8 @@ import java.util.*;
public abstract class IntroduceVariableBase extends IntroduceHandlerBase {
private static final Logger LOG = Logger.getInstance("#com.intellij.refactoring.introduceVariable.IntroduceVariableBase");
@NonNls private static final String PREFER_STATEMENTS_OPTION = "introduce.variable.prefer.statements";
-
+ @NonNls private static final String REFACTORING_ID = "refactoring.extractVariable";
+
protected static final String REFACTORING_NAME = RefactoringBundle.message("introduce.variable.title");
public static final Key<Boolean> NEED_PARENTHESIS = Key.create("NEED_PARENTHESIS");
@@ -677,13 +680,27 @@ public abstract class IntroduceVariableBase extends IntroduceHandlerBase {
occurrenceMarkers.add(topLevelEditor.getDocument().createRangeMarker(occurrence.getTextRange()));
}
}
+ final RefactoringEventData beforeData = new RefactoringEventData();
+ beforeData.addElement(expr);
+ project.getMessageBus()
+ .syncPublisher(RefactoringEventListener.REFACTORING_EVENT_TOPIC).refactoringStarted(REFACTORING_ID, beforeData);
final String expressionText = expr.getText();
final Runnable runnable = introduce(project, expr, topLevelEditor, chosenAnchor, occurrences, settings, variable);
CommandProcessor.getInstance().executeCommand(
project,
new Runnable() {
public void run() {
- ApplicationManager.getApplication().runWriteAction(runnable);
+ try {
+ ApplicationManager.getApplication().runWriteAction(runnable);
+ }
+ finally {
+ final RefactoringEventData afterData = new RefactoringEventData();
+ final SmartPsiElementPointer<PsiVariable> pointer = variable.get();
+ afterData.addElement(pointer != null ? pointer.getElement() : null);
+ project.getMessageBus()
+ .syncPublisher(RefactoringEventListener.REFACTORING_EVENT_TOPIC).refactoringDone(REFACTORING_ID, afterData);
+ }
+
if (isInplaceAvailableOnDataContext) {
final PsiVariable elementToRename = variable.get().getElement();
if (elementToRename != null) {
diff --git a/java/java-impl/src/com/intellij/refactoring/memberPullUp/JavaPullUpHelper.java b/java/java-impl/src/com/intellij/refactoring/memberPullUp/JavaPullUpHelper.java
index 39913cdf2a60..ab86ee853b3b 100644
--- a/java/java-impl/src/com/intellij/refactoring/memberPullUp/JavaPullUpHelper.java
+++ b/java/java-impl/src/com/intellij/refactoring/memberPullUp/JavaPullUpHelper.java
@@ -219,7 +219,10 @@ public class JavaPullUpHelper implements PullUpHelper<MemberInfo> {
}
}
PsiMethod methodCopy = (PsiMethod)method.copy();
- if (method.findSuperMethods(myTargetSuperClass).length == 0) {
+ Language language = myTargetSuperClass.getLanguage();
+ final PsiMethod superClassMethod = myTargetSuperClass.findMethodBySignature(methodCopy, false);
+ if (superClassMethod != null && superClassMethod.findDeepestSuperMethods().length == 0 ||
+ method.findSuperMethods(myTargetSuperClass).length == 0) {
deleteOverrideAnnotationIfFound(methodCopy);
}
boolean isOriginalMethodAbstract = method.hasModifierProperty(PsiModifier.ABSTRACT) || method.hasModifierProperty(PsiModifier.DEFAULT);
@@ -238,7 +241,14 @@ public class JavaPullUpHelper implements PullUpHelper<MemberInfo> {
myJavaDocPolicy.processCopiedJavaDoc(methodCopy.getDocComment(), method.getDocComment(), isOriginalMethodAbstract);
- final PsiMember movedElement = anchor != null ? (PsiMember)myTargetSuperClass.addBefore(methodCopy, anchor) : (PsiMember)myTargetSuperClass.add(methodCopy);
+ final PsiMember movedElement;
+ if (superClassMethod != null && superClassMethod.hasModifierProperty(PsiModifier.ABSTRACT)) {
+ movedElement = (PsiMember)superClassMethod.replace(convertMethodToLanguage(methodCopy, language));
+ }
+ else {
+ movedElement =
+ anchor != null ? (PsiMember)myTargetSuperClass.addBefore(methodCopy, anchor) : (PsiMember)myTargetSuperClass.add(methodCopy);
+ }
CodeStyleSettings styleSettings = CodeStyleSettingsManager.getSettings(method.getProject());
if (styleSettings.INSERT_OVERRIDE_ANNOTATION) {
if (PsiUtil.isLanguageLevel5OrHigher(mySourceClass) && !myIsTargetInterface || PsiUtil.isLanguageLevel6OrHigher(mySourceClass)) {
@@ -265,8 +275,6 @@ public class JavaPullUpHelper implements PullUpHelper<MemberInfo> {
RefactoringUtil.replaceMovedMemberTypeParameters(methodCopy, PsiUtil.typeParametersIterable(mySourceClass), substitutor, elementFactory);
fixReferencesToStatic(methodCopy);
- Language language = myTargetSuperClass.getLanguage();
- final PsiMethod superClassMethod = myTargetSuperClass.findMethodBySignature(methodCopy, false);
if (superClassMethod != null && superClassMethod.hasModifierProperty(PsiModifier.ABSTRACT)) {
superClassMethod.replace(convertMethodToLanguage(methodCopy, language));
}
diff --git a/java/java-impl/src/com/intellij/refactoring/memberPullUp/PullUpDialog.java b/java/java-impl/src/com/intellij/refactoring/memberPullUp/PullUpDialog.java
index b92c5f52bfa9..3fd4e334a01f 100644
--- a/java/java-impl/src/com/intellij/refactoring/memberPullUp/PullUpDialog.java
+++ b/java/java-impl/src/com/intellij/refactoring/memberPullUp/PullUpDialog.java
@@ -196,7 +196,7 @@ public class PullUpDialog extends PullUpDialogBase<MemberInfoStorage, MemberInfo
final PsiSubstitutor superSubstitutor = TypeConversionUtil.getSuperClassSubstitutor(currentSuperClass, myClass, PsiSubstitutor.EMPTY);
final MethodSignature signature = ((PsiMethod) element).getSignature(superSubstitutor);
final PsiMethod superClassMethod = MethodSignatureUtil.findMethodBySignature(currentSuperClass, signature, false);
- if (superClassMethod != null) return false;
+ if (superClassMethod != null && !PsiUtil.isLanguageLevel8OrHigher(currentSuperClass)) return false;
return !((PsiModifierListOwner) element).hasModifierProperty(PsiModifier.STATIC) || PsiUtil.isLanguageLevel8OrHigher(currentSuperClass);
}
return true;
diff --git a/java/java-impl/src/com/intellij/refactoring/move/moveClassesOrPackages/AutocreatingSingleSourceRootMoveDestination.java b/java/java-impl/src/com/intellij/refactoring/move/moveClassesOrPackages/AutocreatingSingleSourceRootMoveDestination.java
index c1bc3bf60038..ce19d6bacaa5 100644
--- a/java/java-impl/src/com/intellij/refactoring/move/moveClassesOrPackages/AutocreatingSingleSourceRootMoveDestination.java
+++ b/java/java-impl/src/com/intellij/refactoring/move/moveClassesOrPackages/AutocreatingSingleSourceRootMoveDestination.java
@@ -102,6 +102,6 @@ public class AutocreatingSingleSourceRootMoveDestination extends AutocreatingMov
if (myTargetDirectory == null) {
myTargetDirectory = RefactoringUtil.createPackageDirectoryInSourceRoot(myPackage, mySourceRoot);
}
- return RefactoringUtil.createPackageDirectoryInSourceRoot(myPackage, mySourceRoot);
+ return myTargetDirectory;
}
}
diff --git a/java/java-impl/src/com/intellij/refactoring/util/duplicates/DuplicatesImpl.java b/java/java-impl/src/com/intellij/refactoring/util/duplicates/DuplicatesImpl.java
index 895334d12abe..5e5b620bcd31 100644
--- a/java/java-impl/src/com/intellij/refactoring/util/duplicates/DuplicatesImpl.java
+++ b/java/java-impl/src/com/intellij/refactoring/util/duplicates/DuplicatesImpl.java
@@ -131,7 +131,7 @@ public class DuplicatesImpl {
}
HighlightManager.getInstance(project).removeSegmentHighlighter(editor, highlighters.get(0));
- new WriteCommandAction(project, MethodDuplicatesHandler.REFACTORING_NAME) {
+ new WriteCommandAction(project, MethodDuplicatesHandler.REFACTORING_NAME, MethodDuplicatesHandler.REFACTORING_NAME) {
@Override
protected void run(Result result) throws Throwable {
try {
diff --git a/java/java-impl/src/com/intellij/spellchecker/LiteralExpressionTokenizer.java b/java/java-impl/src/com/intellij/spellchecker/LiteralExpressionTokenizer.java
index 2eade6903cd2..5d10f0714eda 100644
--- a/java/java-impl/src/com/intellij/spellchecker/LiteralExpressionTokenizer.java
+++ b/java/java-impl/src/com/intellij/spellchecker/LiteralExpressionTokenizer.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2012 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -17,7 +17,6 @@ package com.intellij.spellchecker;
import com.intellij.codeInsight.AnnotationUtil;
import com.intellij.psi.JavaTokenType;
-import com.intellij.psi.PsiLanguageInjectionHost;
import com.intellij.psi.PsiLiteralExpression;
import com.intellij.psi.PsiModifierListOwner;
import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil;
@@ -37,12 +36,10 @@ import java.util.Collections;
public class LiteralExpressionTokenizer extends Tokenizer<PsiLiteralExpression> {
@Override
public void tokenize(@NotNull PsiLiteralExpression element, TokenConsumer consumer) {
- PsiLiteralExpressionImpl literalExpression = (PsiLiteralExpressionImpl) element;
- if (literalExpression.getLiteralElementType() != JavaTokenType.STRING_LITERAL) {
- return; // not a string literal
- }
+ PsiLiteralExpressionImpl literalExpression = (PsiLiteralExpressionImpl)element;
+ if (literalExpression.getLiteralElementType() != JavaTokenType.STRING_LITERAL) return; // not a string literal
- if (InjectedLanguageUtil.hasInjections((PsiLanguageInjectionHost)element)) return;
+ if (InjectedLanguageUtil.hasInjections(literalExpression)) return;
final PsiModifierListOwner listOwner = PsiTreeUtil.getParentOfType(element, PsiModifierListOwner.class);
if (listOwner != null && AnnotationUtil.isAnnotated(listOwner, Collections.singleton(AnnotationUtil.NON_NLS), false, false)) {
diff --git a/java/java-impl/src/com/intellij/testIntegration/BaseGenerateTestSupportMethodAction.java b/java/java-impl/src/com/intellij/testIntegration/BaseGenerateTestSupportMethodAction.java
index 40a97cf93981..6d82acdbdf8e 100644
--- a/java/java-impl/src/com/intellij/testIntegration/BaseGenerateTestSupportMethodAction.java
+++ b/java/java-impl/src/com/intellij/testIntegration/BaseGenerateTestSupportMethodAction.java
@@ -24,9 +24,10 @@ import com.intellij.codeInsight.generation.actions.BaseGenerateAction;
import com.intellij.codeInsight.hint.HintManager;
import com.intellij.ide.fileTemplates.FileTemplateDescriptor;
import com.intellij.ide.fileTemplates.impl.AllFileTemplatesConfigurable;
-import com.intellij.ide.util.EditSourceUtil;
-import com.intellij.openapi.actionSystem.*;
-import com.intellij.openapi.application.ApplicationManager;
+import com.intellij.openapi.actionSystem.AnAction;
+import com.intellij.openapi.actionSystem.AnActionEvent;
+import com.intellij.openapi.actionSystem.CommonDataKeys;
+import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.command.WriteCommandAction;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Editor;
@@ -40,7 +41,6 @@ import com.intellij.ui.components.JBList;
import com.intellij.util.Consumer;
import com.intellij.util.Function;
import com.intellij.util.IncorrectOperationException;
-import com.intellij.util.Processor;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -100,7 +100,7 @@ public class BaseGenerateTestSupportMethodAction extends BaseGenerateAction {
private static PsiClass findTargetClass(@NotNull Editor editor, @NotNull PsiFile file) {
int offset = editor.getCaretModel().getOffset();
PsiElement element = file.findElementAt(offset);
- return element == null ? null : TestIntegrationUtils.findOuterClass(element);
+ return PsiTreeUtil.getParentOfType(element, PsiClass.class, false) == null ? null : TestIntegrationUtils.findOuterClass(element);
}
@Override
diff --git a/java/java-indexing-impl/src/com/intellij/psi/impl/java/stubs/index/JavaAnnotationIndex.java b/java/java-indexing-impl/src/com/intellij/psi/impl/java/stubs/index/JavaAnnotationIndex.java
index 90edae7b3648..67f8bde38c2e 100644
--- a/java/java-indexing-impl/src/com/intellij/psi/impl/java/stubs/index/JavaAnnotationIndex.java
+++ b/java/java-indexing-impl/src/com/intellij/psi/impl/java/stubs/index/JavaAnnotationIndex.java
@@ -44,7 +44,7 @@ public class JavaAnnotationIndex extends StringStubIndexExtension<PsiAnnotation>
}
@Override
- public Collection<PsiAnnotation> get(final String s, final Project project, @NotNull final GlobalSearchScope scope) {
+ public Collection<PsiAnnotation> get(@NotNull final String s, @NotNull final Project project, @NotNull final GlobalSearchScope scope) {
return StubIndex.getElements(getKey(), s, project, new JavaSourceFilterScope(scope), PsiAnnotation.class);
}
} \ No newline at end of file
diff --git a/java/java-indexing-impl/src/com/intellij/psi/impl/java/stubs/index/JavaAnonymousClassBaseRefOccurenceIndex.java b/java/java-indexing-impl/src/com/intellij/psi/impl/java/stubs/index/JavaAnonymousClassBaseRefOccurenceIndex.java
index 3c92cd48188d..0439ea5a726f 100644
--- a/java/java-indexing-impl/src/com/intellij/psi/impl/java/stubs/index/JavaAnonymousClassBaseRefOccurenceIndex.java
+++ b/java/java-indexing-impl/src/com/intellij/psi/impl/java/stubs/index/JavaAnonymousClassBaseRefOccurenceIndex.java
@@ -45,7 +45,7 @@ public class JavaAnonymousClassBaseRefOccurenceIndex extends StringStubIndexExte
}
@Override
- public Collection<PsiAnonymousClass> get(final String s, final Project project, @NotNull final GlobalSearchScope scope) {
+ public Collection<PsiAnonymousClass> get(@NotNull final String s, @NotNull final Project project, @NotNull final GlobalSearchScope scope) {
return StubIndex.getElements(getKey(), s, project, new JavaSourceFilterScope(scope), PsiAnonymousClass.class);
}
} \ No newline at end of file
diff --git a/java/java-indexing-impl/src/com/intellij/psi/impl/java/stubs/index/JavaFieldNameIndex.java b/java/java-indexing-impl/src/com/intellij/psi/impl/java/stubs/index/JavaFieldNameIndex.java
index 873ea3ec4ab4..d2d4cc812123 100644
--- a/java/java-indexing-impl/src/com/intellij/psi/impl/java/stubs/index/JavaFieldNameIndex.java
+++ b/java/java-indexing-impl/src/com/intellij/psi/impl/java/stubs/index/JavaFieldNameIndex.java
@@ -44,7 +44,7 @@ public class JavaFieldNameIndex extends StringStubIndexExtension<PsiField> {
}
@Override
- public Collection<PsiField> get(final String s, final Project project, @NotNull final GlobalSearchScope scope) {
+ public Collection<PsiField> get(@NotNull final String s, @NotNull final Project project, @NotNull final GlobalSearchScope scope) {
return StubIndex.getElements(getKey(), s, project, new JavaSourceFilterScope(scope), PsiField.class);
}
} \ No newline at end of file
diff --git a/java/java-indexing-impl/src/com/intellij/psi/impl/java/stubs/index/JavaFullClassNameIndex.java b/java/java-indexing-impl/src/com/intellij/psi/impl/java/stubs/index/JavaFullClassNameIndex.java
index 045fdc08b07e..ecabef22aa08 100644
--- a/java/java-indexing-impl/src/com/intellij/psi/impl/java/stubs/index/JavaFullClassNameIndex.java
+++ b/java/java-indexing-impl/src/com/intellij/psi/impl/java/stubs/index/JavaFullClassNameIndex.java
@@ -44,7 +44,7 @@ public class JavaFullClassNameIndex extends IntStubIndexExtension<PsiClass> {
}
@Override
- public Collection<PsiClass> get(final Integer integer, final Project project, @NotNull final GlobalSearchScope scope) {
+ public Collection<PsiClass> get(@NotNull final Integer integer, @NotNull final Project project, @NotNull final GlobalSearchScope scope) {
return StubIndex.getElements(getKey(), integer, project, new JavaSourceFilterScope(scope), PsiClass.class);
}
} \ No newline at end of file
diff --git a/java/java-indexing-impl/src/com/intellij/psi/impl/java/stubs/index/JavaMethodNameIndex.java b/java/java-indexing-impl/src/com/intellij/psi/impl/java/stubs/index/JavaMethodNameIndex.java
index daf3f52a552c..42e95d38479f 100644
--- a/java/java-indexing-impl/src/com/intellij/psi/impl/java/stubs/index/JavaMethodNameIndex.java
+++ b/java/java-indexing-impl/src/com/intellij/psi/impl/java/stubs/index/JavaMethodNameIndex.java
@@ -44,7 +44,7 @@ public class JavaMethodNameIndex extends StringStubIndexExtension<PsiMethod> {
}
@Override
- public Collection<PsiMethod> get(final String s, final Project project, @NotNull final GlobalSearchScope scope) {
+ public Collection<PsiMethod> get(@NotNull final String s, @NotNull final Project project, @NotNull final GlobalSearchScope scope) {
return StubIndex.getElements(getKey(), s, project, new JavaSourceFilterScope(scope), PsiMethod.class);
}
} \ No newline at end of file
diff --git a/java/java-indexing-impl/src/com/intellij/psi/impl/java/stubs/index/JavaMethodParameterTypesIndex.java b/java/java-indexing-impl/src/com/intellij/psi/impl/java/stubs/index/JavaMethodParameterTypesIndex.java
index 689961ec024b..23f4ffac729e 100644
--- a/java/java-indexing-impl/src/com/intellij/psi/impl/java/stubs/index/JavaMethodParameterTypesIndex.java
+++ b/java/java-indexing-impl/src/com/intellij/psi/impl/java/stubs/index/JavaMethodParameterTypesIndex.java
@@ -44,7 +44,7 @@ public class JavaMethodParameterTypesIndex extends StringStubIndexExtension<PsiM
}
@Override
- public Collection<PsiMethod> get(final String s, final Project project, @NotNull final GlobalSearchScope scope) {
+ public Collection<PsiMethod> get(@NotNull final String s, @NotNull final Project project, @NotNull final GlobalSearchScope scope) {
return StubIndex.getElements(getKey(), s, project, new JavaSourceFilterScope(scope), PsiMethod.class);
}
} \ No newline at end of file
diff --git a/java/java-indexing-impl/src/com/intellij/psi/impl/java/stubs/index/JavaShortClassNameIndex.java b/java/java-indexing-impl/src/com/intellij/psi/impl/java/stubs/index/JavaShortClassNameIndex.java
index 35e1d1ec8d34..5f0d9298b1cc 100644
--- a/java/java-indexing-impl/src/com/intellij/psi/impl/java/stubs/index/JavaShortClassNameIndex.java
+++ b/java/java-indexing-impl/src/com/intellij/psi/impl/java/stubs/index/JavaShortClassNameIndex.java
@@ -51,7 +51,7 @@ public class JavaShortClassNameIndex extends StringStubIndexExtension<PsiClass>
}
@Override
- public Collection<PsiClass> get(final String s, final Project project, @NotNull final GlobalSearchScope scope) {
+ public Collection<PsiClass> get(@NotNull final String s, @NotNull final Project project, @NotNull final GlobalSearchScope scope) {
return StubIndex.getElements(getKey(), s, project, new JavaSourceFilterScope(scope), PsiClass.class);
}
diff --git a/java/java-indexing-impl/src/com/intellij/psi/impl/java/stubs/index/JavaSuperClassNameOccurenceIndex.java b/java/java-indexing-impl/src/com/intellij/psi/impl/java/stubs/index/JavaSuperClassNameOccurenceIndex.java
index dcd7ae9b40ab..542ed3896f08 100644
--- a/java/java-indexing-impl/src/com/intellij/psi/impl/java/stubs/index/JavaSuperClassNameOccurenceIndex.java
+++ b/java/java-indexing-impl/src/com/intellij/psi/impl/java/stubs/index/JavaSuperClassNameOccurenceIndex.java
@@ -45,7 +45,7 @@ public class JavaSuperClassNameOccurenceIndex extends StringStubIndexExtension<P
}
@Override
- public Collection<PsiReferenceList> get(final String s, final Project project, @NotNull final GlobalSearchScope scope) {
+ public Collection<PsiReferenceList> get(@NotNull final String s, @NotNull final Project project, @NotNull final GlobalSearchScope scope) {
return StubIndex.getElements(getKey(), s, project, new JavaSourceFilterScope(scope), PsiReferenceList.class);
}
diff --git a/java/java-psi-api/src/com/intellij/codeInsight/AnnotationUtil.java b/java/java-psi-api/src/com/intellij/codeInsight/AnnotationUtil.java
index c0cd96c20d47..c2c79a9d9d8a 100644
--- a/java/java-psi-api/src/com/intellij/codeInsight/AnnotationUtil.java
+++ b/java/java-psi-api/src/com/intellij/codeInsight/AnnotationUtil.java
@@ -113,13 +113,21 @@ public class AnnotationUtil {
}
}
if (!skipExternal) {
- final ExternalAnnotationsManager annotationsManager = ExternalAnnotationsManager.getInstance(listOwner.getProject());
+ final Project project = listOwner.getProject();
+ final ExternalAnnotationsManager annotationsManager = ExternalAnnotationsManager.getInstance(project);
for (String annotationName : annotationNames) {
final PsiAnnotation annotation = annotationsManager.findExternalAnnotation(listOwner, annotationName);
if (annotation != null) {
return annotation;
}
}
+ final InferredAnnotationsManager inferredAnnotationsManager = InferredAnnotationsManager.getInstance(project);
+ for (String annotationName : annotationNames) {
+ final PsiAnnotation annotation = inferredAnnotationsManager.findInferredAnnotation(listOwner, annotationName);
+ if (annotation != null) {
+ return annotation;
+ }
+ }
}
return null;
}
@@ -269,8 +277,12 @@ public class AnnotationUtil {
if (modifierList == null) return false;
PsiAnnotation annotation = modifierList.findAnnotation(annotationFQN);
if (annotation != null) return true;
- if (!skipExternal && ExternalAnnotationsManager.getInstance(listOwner.getProject()).findExternalAnnotation(listOwner, annotationFQN) != null) {
- return true;
+ if (!skipExternal) {
+ final Project project = listOwner.getProject();
+ if (ExternalAnnotationsManager.getInstance(project).findExternalAnnotation(listOwner, annotationFQN) != null ||
+ InferredAnnotationsManager.getInstance(project).findInferredAnnotation(listOwner, annotationFQN) != null) {
+ return true;
+ }
}
if (checkHierarchy) {
if (listOwner instanceof PsiMethod) {
@@ -365,17 +377,31 @@ public class AnnotationUtil {
}
@NotNull
- public static PsiAnnotation[] getAllAnnotations(@NotNull PsiModifierListOwner owner, boolean inHierarchy, Set<PsiModifierListOwner> visited) {
+ public static PsiAnnotation[] getAllAnnotations(@NotNull PsiModifierListOwner owner,
+ boolean inHierarchy,
+ Set<PsiModifierListOwner> visited) {
+ return getAllAnnotations(owner, inHierarchy, visited, true);
+ }
+
+ @NotNull
+ public static PsiAnnotation[] getAllAnnotations(@NotNull PsiModifierListOwner owner,
+ boolean inHierarchy,
+ Set<PsiModifierListOwner> visited, boolean withInferred) {
final PsiModifierList list = owner.getModifierList();
PsiAnnotation[] annotations = PsiAnnotation.EMPTY_ARRAY;
if (list != null) {
annotations = list.getAnnotations();
}
- final PsiAnnotation[] externalAnnotations = ExternalAnnotationsManager.getInstance(owner.getProject()).findExternalAnnotations(owner);
+ final Project project = owner.getProject();
+ final PsiAnnotation[] externalAnnotations = ExternalAnnotationsManager.getInstance(project).findExternalAnnotations(owner);
if (externalAnnotations != null) {
annotations = ArrayUtil.mergeArrays(annotations, externalAnnotations, PsiAnnotation.ARRAY_FACTORY);
}
+ if (withInferred) {
+ final PsiAnnotation[] inferredAnnotations = InferredAnnotationsManager.getInstance(project).findInferredAnnotations(owner);
+ annotations = ArrayUtil.mergeArrays(annotations, inferredAnnotations, PsiAnnotation.ARRAY_FACTORY);
+ }
if (inHierarchy) {
if (owner instanceof PsiClass) {
@@ -435,6 +461,10 @@ public class AnnotationUtil {
return PsiTreeUtil.getParentOfType(element, PsiNameValuePair.class, PsiArrayInitializerMemberValue.class) != null;
}
+ public static boolean isInferredAnnotation(@NotNull PsiAnnotation annotation) {
+ return InferredAnnotationsManager.getInstance(annotation.getProject()).isInferredAnnotation(annotation);
+ }
+
@Nullable
public static String getStringAttributeValue(@NotNull PsiAnnotation anno, @Nullable final String attributeName) {
PsiAnnotationMemberValue attrValue = anno.findAttributeValue(attributeName);
diff --git a/java/java-psi-api/src/com/intellij/codeInsight/InferredAnnotationsManager.java b/java/java-psi-api/src/com/intellij/codeInsight/InferredAnnotationsManager.java
new file mode 100644
index 000000000000..b3fbfe7547cf
--- /dev/null
+++ b/java/java-psi-api/src/com/intellij/codeInsight/InferredAnnotationsManager.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2000-2014 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;
+
+import com.intellij.openapi.components.ServiceManager;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.NotNullLazyKey;
+import com.intellij.psi.PsiAnnotation;
+import com.intellij.psi.PsiModifierListOwner;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+public abstract class InferredAnnotationsManager {
+ private static final NotNullLazyKey<InferredAnnotationsManager, Project> INSTANCE_KEY = ServiceManager.createLazyKey(InferredAnnotationsManager.class);
+
+ public static InferredAnnotationsManager getInstance(@NotNull Project project) {
+ return INSTANCE_KEY.getValue(project);
+ }
+
+ @Nullable
+ public abstract PsiAnnotation findInferredAnnotation(@NotNull PsiModifierListOwner listOwner, @NotNull String annotationFQN);
+
+ @NotNull
+ public abstract PsiAnnotation[] findInferredAnnotations(@NotNull PsiModifierListOwner listOwner);
+
+ public abstract boolean isInferredAnnotation(@NotNull PsiAnnotation annotation);
+}
diff --git a/java/java-psi-api/src/com/intellij/codeInsight/NullableNotNullManager.java b/java/java-psi-api/src/com/intellij/codeInsight/NullableNotNullManager.java
index 192d19c31958..21e014e4aca3 100644
--- a/java/java-psi-api/src/com/intellij/codeInsight/NullableNotNullManager.java
+++ b/java/java-psi-api/src/com/intellij/codeInsight/NullableNotNullManager.java
@@ -94,10 +94,15 @@ public class NullableNotNullManager implements PersistentStateComponent<Element>
@Nullable
public String getNullable(PsiModifierListOwner owner) {
- PsiAnnotation annotation = findNullabilityAnnotation(owner, false, true);
+ PsiAnnotation annotation = getNullableAnnotation(owner, false);
return annotation == null ? null : annotation.getQualifiedName();
}
+ @Nullable
+ public PsiAnnotation getNullableAnnotation(PsiModifierListOwner owner, boolean checkBases) {
+ return findNullabilityAnnotation(owner, checkBases, true);
+ }
+
public void setDefaultNullable(@NotNull String defaultNullable) {
LOG.assertTrue(getNullables().contains(defaultNullable));
myDefaultNullable = defaultNullable;
@@ -108,8 +113,13 @@ public class NullableNotNullManager implements PersistentStateComponent<Element>
}
@Nullable
+ public PsiAnnotation getNotNullAnnotation(PsiModifierListOwner owner, boolean checkBases) {
+ return findNullabilityAnnotation(owner, checkBases, false);
+ }
+
+ @Nullable
public String getNotNull(PsiModifierListOwner owner) {
- PsiAnnotation annotation = findNullabilityAnnotation(owner, false, false);
+ PsiAnnotation annotation = getNotNullAnnotation(owner, false);
return annotation == null ? null : annotation.getQualifiedName();
}
diff --git a/java/java-psi-api/src/com/intellij/psi/PsiMethodReferenceUtil.java b/java/java-psi-api/src/com/intellij/psi/PsiMethodReferenceUtil.java
index fe45c66cf024..87afd3d4f8e4 100644
--- a/java/java-psi-api/src/com/intellij/psi/PsiMethodReferenceUtil.java
+++ b/java/java-psi-api/src/com/intellij/psi/PsiMethodReferenceUtil.java
@@ -44,7 +44,15 @@ public class PsiMethodReferenceUtil {
public static String checkReturnType(PsiMethodReferenceExpression expression, JavaResolveResult result, PsiType functionalInterfaceType) {
final PsiElement resolve = result.getElement();
if (resolve instanceof PsiMethod) {
+ final PsiClass containingClass = ((PsiMethod)resolve).getContainingClass();
+ LOG.assertTrue(containingClass != null);
PsiSubstitutor subst = result.getSubstitutor();
+ PsiClass qContainingClass = getQualifierResolveResult(expression).getContainingClass();
+ if (qContainingClass != null && InheritanceUtil.isInheritorOrSelf(qContainingClass, containingClass, true)) {
+ subst = TypeConversionUtil.getClassSubstitutor(containingClass, qContainingClass, subst);
+ LOG.assertTrue(subst != null);
+ }
+
final PsiType interfaceReturnType = LambdaUtil.getFunctionalInterfaceReturnType(functionalInterfaceType);
@@ -57,7 +65,7 @@ public class PsiMethodReferenceUtil {
PsiType methodReturnType = subst.substitute(returnType);
if (interfaceReturnType != null && interfaceReturnType != PsiType.VOID) {
if (methodReturnType == null) {
- methodReturnType = JavaPsiFacade.getElementFactory(expression.getProject()).createType(((PsiMethod)resolve).getContainingClass(), subst);
+ methodReturnType = JavaPsiFacade.getElementFactory(expression.getProject()).createType(containingClass, subst);
}
if (!TypeConversionUtil.isAssignable(interfaceReturnType, methodReturnType, false)) {
return "Bad return type in method reference: cannot convert " + methodReturnType.getCanonicalText() + " to " + interfaceReturnType.getCanonicalText();
diff --git a/java/java-psi-api/src/com/intellij/psi/util/MethodSignatureUtil.java b/java/java-psi-api/src/com/intellij/psi/util/MethodSignatureUtil.java
index 388da3b05ab9..622714c6dd61 100644
--- a/java/java-psi-api/src/com/intellij/psi/util/MethodSignatureUtil.java
+++ b/java/java-psi-api/src/com/intellij/psi/util/MethodSignatureUtil.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
diff --git a/java/java-psi-api/src/com/intellij/psi/util/PsiFormatUtil.java b/java/java-psi-api/src/com/intellij/psi/util/PsiFormatUtil.java
index 472e7cd65403..885f1bd9a444 100644
--- a/java/java-psi-api/src/com/intellij/psi/util/PsiFormatUtil.java
+++ b/java/java-psi-api/src/com/intellij/psi/util/PsiFormatUtil.java
@@ -450,6 +450,40 @@ public class PsiFormatUtil extends PsiFormatUtilBase {
return builder.toString();
}
+ @Nullable
+ public static String getRawExternalName(PsiModifierListOwner owner) {
+ final StringBuilder builder = new StringBuilder();
+ final PsiClass psiClass = PsiTreeUtil.getParentOfType(owner, PsiClass.class, false);
+ if (psiClass == null) return null;
+ ClassUtil.formatClassName(psiClass, builder);
+ if (owner instanceof PsiMethod) {
+ builder.append(" ");
+ formatMethod((PsiMethod)owner, PsiSubstitutor.EMPTY,
+ SHOW_NAME | SHOW_FQ_NAME | SHOW_TYPE | SHOW_RAW_TYPE | SHOW_PARAMETERS | SHOW_FQ_CLASS_NAMES,
+ SHOW_TYPE | SHOW_RAW_TYPE | SHOW_FQ_CLASS_NAMES,
+ Integer.MAX_VALUE, builder);
+ }
+ else if (owner instanceof PsiParameter) {
+ final PsiElement declarationScope = ((PsiParameter)owner).getDeclarationScope();
+ if (!(declarationScope instanceof PsiMethod)) {
+ return null;
+ }
+ final PsiMethod psiMethod = (PsiMethod)declarationScope;
+
+ builder.append(" ");
+ formatMethod(psiMethod, PsiSubstitutor.EMPTY,
+ SHOW_NAME | SHOW_FQ_NAME | SHOW_TYPE | SHOW_RAW_TYPE | SHOW_PARAMETERS | SHOW_FQ_CLASS_NAMES,
+ SHOW_TYPE | SHOW_RAW_TYPE | SHOW_FQ_CLASS_NAMES,
+ Integer.MAX_VALUE, builder);
+ builder.append(" ");
+ builder.append(psiMethod.getParameterList().getParameterIndex((PsiParameter)owner));
+ }
+ else {
+ return null;
+ }
+ return builder.toString();
+ }
+
public static String getPackageDisplayName(@NotNull final PsiClass psiClass) {
if (psiClass instanceof PsiTypeParameter) {
PsiTypeParameterListOwner owner = ((PsiTypeParameter)psiClass).getOwner();
diff --git a/java/java-psi-api/src/com/intellij/psi/util/PsiTypesUtil.java b/java/java-psi-api/src/com/intellij/psi/util/PsiTypesUtil.java
index 1a7e71c5fc69..b721d801b6c4 100644
--- a/java/java-psi-api/src/com/intellij/psi/util/PsiTypesUtil.java
+++ b/java/java-psi-api/src/com/intellij/psi/util/PsiTypesUtil.java
@@ -181,6 +181,7 @@ public class PsiTypesUtil {
@Nullable
public static PsiType createJavaLangClassType(@NotNull PsiElement context, @Nullable PsiType qualifierType, boolean captureTopLevelWildcards) {
if (qualifierType != null) {
+ PsiUtil.ensureValidType(qualifierType);
JavaPsiFacade facade = JavaPsiFacade.getInstance(context.getProject());
PsiClass javaLangClass = facade.findClass(CommonClassNames.JAVA_LANG_CLASS, context.getResolveScope());
if (javaLangClass != null && javaLangClass.getTypeParameters().length == 1) {
diff --git a/java/java-psi-api/src/com/intellij/psi/util/PsiUtil.java b/java/java-psi-api/src/com/intellij/psi/util/PsiUtil.java
index b71214f907f0..e5493711b7c2 100644
--- a/java/java-psi-api/src/com/intellij/psi/util/PsiUtil.java
+++ b/java/java-psi-api/src/com/intellij/psi/util/PsiUtil.java
@@ -775,7 +775,7 @@ public final class PsiUtil extends PsiUtilCore {
@NotNull
public static Iterable<PsiTypeParameter> typeParametersIterable(@NotNull final PsiTypeParameterListOwner owner) {
- ArrayList<PsiTypeParameter> result = null;
+ List<PsiTypeParameter> result = null;
PsiTypeParameterListOwner currentOwner = owner;
while (currentOwner != null) {
diff --git a/java/java-psi-impl/src/com/intellij/codeInsight/folding/impl/JavaFoldingBuilderBase.java b/java/java-psi-impl/src/com/intellij/codeInsight/folding/impl/JavaFoldingBuilderBase.java
index 9f5ecb109fd5..5e008afb4797 100644
--- a/java/java-psi-impl/src/com/intellij/codeInsight/folding/impl/JavaFoldingBuilderBase.java
+++ b/java/java-psi-impl/src/com/intellij/codeInsight/folding/impl/JavaFoldingBuilderBase.java
@@ -45,7 +45,6 @@ import com.intellij.psi.util.*;
import com.intellij.util.Function;
import com.intellij.util.ObjectUtils;
import com.intellij.util.text.CharArrayUtil;
-import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -701,7 +700,7 @@ public abstract class JavaFoldingBuilderBase extends CustomFoldingBuilder implem
else if (element instanceof PsiComment) {
return settings.isCollapseEndOfLineComments();
}
- else if (isLiteralExpression(element)
+ else if (ParameterNameFoldingManager.isLiteralExpression(element)
&& element.getParent() instanceof PsiExpressionList
&& (element.getParent().getParent() instanceof PsiCallExpression
|| element.getParent().getParent() instanceof PsiAnonymousClass)) {
@@ -760,55 +759,8 @@ public abstract class JavaFoldingBuilderBase extends CustomFoldingBuilder implem
if (quick || !JavaCodeFoldingSettings.getInstance().isInlineParameterNamesForLiteralCallArguments()) {
return;
}
- PsiExpressionList callArgumentsList = expression.getArgumentList();
- if (callArgumentsList == null) {
- return;
- }
-
- PsiExpression[] callArguments = callArgumentsList.getExpressions();
- if (callArguments.length > 1) {
- PsiParameter[] parameters = null;
- boolean isResolved = false;
-
- for (int i = 0; i < callArguments.length; i++) {
- PsiExpression callArgument = callArguments[i];
-
- if (callArgument.getType() != null && isLiteralExpression(callArgument)) {
- if (!isResolved) {
- PsiMethod method = expression.resolveMethod();
- isResolved = true;
- if (method == null) {
- return;
- }
- parameters = method.getParameterList().getParameters();
- if (parameters.length != callArguments.length) {
- return;
- }
- }
-
- PsiParameter methodParam = parameters[i];
- if (TypeConversionUtil.isAssignable(methodParam.getType(), callArgument.getType())) {
- TextRange range = callArgument.getTextRange();
- String placeholderText = methodParam.getName() + ": " + callArgument.getText();
- foldElements.add(new NamedFoldingDescriptor(callArgument, range.getStartOffset(), range.getEndOffset(), null, placeholderText));
- }
- }
- }
- }
- }
-
- @Contract("null -> false")
- private static boolean isLiteralExpression(@Nullable PsiElement callArgument) {
- if (callArgument instanceof PsiLiteralExpression)
- return true;
-
- if (callArgument instanceof PsiPrefixExpression) {
- PsiPrefixExpression expr = (PsiPrefixExpression)callArgument;
- IElementType tokenType = expr.getOperationTokenType();
- return JavaTokenType.MINUS.equals(tokenType) && expr.getOperand() instanceof PsiLiteralExpression;
- }
-
- return false;
+ ParameterNameFoldingManager manager = new ParameterNameFoldingManager(expression);
+ foldElements.addAll(manager.buildDescriptors());
}
private boolean addClosureFolding(final PsiClass aClass, final Document document, final List<FoldingDescriptor> foldElements,
diff --git a/java/java-psi-impl/src/com/intellij/codeInsight/folding/impl/ParameterNameFoldingManager.java b/java/java-psi-impl/src/com/intellij/codeInsight/folding/impl/ParameterNameFoldingManager.java
new file mode 100644
index 000000000000..aca4357f7e49
--- /dev/null
+++ b/java/java-psi-impl/src/com/intellij/codeInsight/folding/impl/ParameterNameFoldingManager.java
@@ -0,0 +1,153 @@
+/*
+ * Copyright 2000-2014 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.folding.impl;
+
+import com.intellij.lang.folding.FoldingDescriptor;
+import com.intellij.lang.folding.NamedFoldingDescriptor;
+import com.intellij.openapi.util.Couple;
+import com.intellij.openapi.util.TextRange;
+import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.psi.*;
+import com.intellij.psi.tree.IElementType;
+import com.intellij.psi.util.TypeConversionUtil;
+import com.intellij.util.containers.ContainerUtil;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.List;
+
+public class ParameterNameFoldingManager {
+ private static final int MIN_NAME_LENGTH_THRESHOLD = 3;
+ private static final int MIN_ARGS_TO_FOLD = 2;
+
+ private static final List<Couple<String>> COMMONLY_USED_PARAMETER_PAIR = ContainerUtil.newArrayList(
+ Couple.of("begin", "end"),
+ Couple.of("start", "end"),
+ Couple.of("first", "last"),
+ Couple.of("first", "second"),
+ Couple.of("from", "to"),
+ Couple.of("key", "value")
+ );
+
+ private final PsiCallExpression myCallExpression;
+
+ private PsiExpression[] myCallArguments;
+ private PsiParameter[] myParameters;
+
+ public ParameterNameFoldingManager(@NotNull PsiCallExpression callExpression) {
+ myCallExpression = callExpression;
+ }
+
+ public static boolean isLiteralExpression(@Nullable PsiElement callArgument) {
+ if (callArgument instanceof PsiLiteralExpression)
+ return true;
+
+ if (callArgument instanceof PsiPrefixExpression) {
+ PsiPrefixExpression expr = (PsiPrefixExpression)callArgument;
+ IElementType tokenType = expr.getOperationTokenType();
+ return JavaTokenType.MINUS.equals(tokenType) && expr.getOperand() instanceof PsiLiteralExpression;
+ }
+
+ return false;
+ }
+
+ @Nullable
+ public PsiExpression[] getArguments(@NotNull PsiCallExpression call) {
+ PsiExpressionList callArgumentsList = call.getArgumentList();
+ return callArgumentsList != null ? callArgumentsList.getExpressions() : null;
+ }
+
+ @NotNull
+ public List<FoldingDescriptor> buildDescriptors() {
+ myCallArguments = getArguments(myCallExpression);
+
+ if (myCallArguments != null && myCallArguments.length >= MIN_ARGS_TO_FOLD && hasLiteralExpression(myCallArguments)) {
+ PsiMethod method = myCallExpression.resolveMethod();
+
+ if (method != null) {
+ myParameters = method.getParameterList().getParameters();
+ if (myParameters.length == myCallArguments.length) {
+ return buildDescriptorsForLiteralArguments();
+ }
+ }
+ }
+
+ return ContainerUtil.emptyList();
+ }
+
+ @NotNull
+ private List<FoldingDescriptor> buildDescriptorsForLiteralArguments() {
+ List<FoldingDescriptor> descriptors = ContainerUtil.newArrayList();
+
+ int i = 0;
+ while (i < myCallArguments.length) {
+ if (i + 1 < myCallArguments.length && isCommonlyNamedParameterPair(i, i + 1)) {
+ i += 2;
+ continue;
+ }
+
+ if (shouldInlineParameterName(i)) {
+ descriptors.add(createFoldingDescriptor(myCallArguments[i], myParameters[i]));
+ }
+ i++;
+ }
+
+ return descriptors;
+ }
+
+ @NotNull
+ private static NamedFoldingDescriptor createFoldingDescriptor(@NotNull PsiExpression callArgument, @NotNull PsiParameter methodParam) {
+ TextRange range = callArgument.getTextRange();
+ String placeholderText = methodParam.getName() + ": " + callArgument.getText();
+ return new NamedFoldingDescriptor(callArgument, range.getStartOffset(), range.getEndOffset(), null, placeholderText);
+ }
+
+ private boolean isCommonlyNamedParameterPair(int first, int second) {
+ assert first < myParameters.length && second < myParameters.length;
+
+ String firstParamName = myParameters[first].getName();
+ String secondParamName = myParameters[second].getName();
+ if (firstParamName == null || secondParamName == null) return false;
+
+ for (Couple<String> knownPair : COMMONLY_USED_PARAMETER_PAIR) {
+ if (StringUtil.containsIgnoreCase(firstParamName, knownPair.first)
+ && StringUtil.containsIgnoreCase(secondParamName, knownPair.second)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ private boolean shouldInlineParameterName(int paramIndex) {
+ PsiExpression argument = myCallArguments[paramIndex];
+ if (isLiteralExpression(argument) && argument.getType() != null) {
+ PsiParameter parameter = myParameters[paramIndex];
+ String paramName = parameter.getName();
+ if (paramName != null && paramName.length() >= MIN_NAME_LENGTH_THRESHOLD) {
+ return TypeConversionUtil.isAssignable(parameter.getType(), argument.getType());
+ }
+ }
+ return false;
+ }
+
+ private static boolean hasLiteralExpression(@NotNull PsiExpression[] arguments) {
+ for (PsiExpression argument : arguments) {
+ if (isLiteralExpression(argument)) return true;
+ }
+ return false;
+ }
+}
diff --git a/java/java-psi-impl/src/com/intellij/codeInsight/javadoc/JavaDocInfoGenerator.java b/java/java-psi-impl/src/com/intellij/codeInsight/javadoc/JavaDocInfoGenerator.java
index 0052dd5bb8b9..f2b9583c49b0 100644
--- a/java/java-psi-impl/src/com/intellij/codeInsight/javadoc/JavaDocInfoGenerator.java
+++ b/java/java-psi-impl/src/com/intellij/codeInsight/javadoc/JavaDocInfoGenerator.java
@@ -18,6 +18,7 @@ package com.intellij.codeInsight.javadoc;
import com.intellij.codeInsight.AnnotationUtil;
import com.intellij.codeInsight.CodeInsightBundle;
import com.intellij.codeInsight.ExternalAnnotationsManager;
+import com.intellij.codeInsight.InferredAnnotationsManager;
import com.intellij.codeInsight.documentation.DocumentationManagerUtil;
import com.intellij.lang.ASTNode;
import com.intellij.lang.LangBundle;
@@ -217,6 +218,7 @@ public class JavaDocInfoGenerator {
LOG.debug(text);
}
+ text = StringUtil.replaceIgnoreCase(text, "<p/>", "<p></p>");
return StringUtil.replace(text, "/>", ">");
}
@@ -321,7 +323,7 @@ public class JavaDocInfoGenerator {
}
private static boolean generateClassSignature(StringBuilder buffer, PsiClass aClass, boolean generateLink) {
- generateAnnotations(buffer, aClass, generateLink);
+ generateAnnotations(buffer, aClass, generateLink, true);
String modifiers = PsiFormatUtil.formatModifiers(aClass, PsiFormatUtilBase.JAVADOC_MODIFIERS_ONLY);
if (!modifiers.isEmpty()) {
buffer.append(modifiers);
@@ -487,7 +489,7 @@ public class JavaDocInfoGenerator {
}
private static void generateFieldSignature(StringBuilder buffer, PsiField field, boolean generateLink) {
- generateAnnotations(buffer, field, generateLink);
+ generateAnnotations(buffer, field, generateLink, true);
String modifiers = PsiFormatUtil.formatModifiers(field, PsiFormatUtilBase.JAVADOC_MODIFIERS_ONLY);
if (!modifiers.isEmpty()) {
buffer.append(modifiers);
@@ -695,30 +697,38 @@ public class JavaDocInfoGenerator {
}
}
- private static void generateAnnotations(@NonNls @NotNull StringBuilder buffer, @NotNull PsiModifierListOwner owner, boolean generateLink) {
+ private static void generateAnnotations(@NonNls @NotNull StringBuilder buffer,
+ @NotNull PsiModifierListOwner owner,
+ boolean generateLink,
+ boolean splitAnnotations) {
final PsiModifierList ownerModifierList = owner.getModifierList();
if (ownerModifierList == null) return;
- generateAnnotations(buffer, owner, ownerModifierList.getAnnotations(), false, generateLink);
- final PsiAnnotation[] externalAnnotations = ExternalAnnotationsManager.getInstance(owner.getProject()).findExternalAnnotations(owner);
- if (externalAnnotations != null) {
- generateAnnotations(buffer, owner, externalAnnotations, true, generateLink);
+ generateAnnotations(buffer, owner, ownerModifierList.getAnnotations(), false, generateLink, splitAnnotations);
+ PsiAnnotation[] externalAnnotations = ExternalAnnotationsManager.getInstance(owner.getProject()).findExternalAnnotations(owner);
+ if (externalAnnotations == null) {
+ externalAnnotations = new PsiAnnotation[]{};
}
+ PsiAnnotation[] inferredAnnotations = InferredAnnotationsManager.getInstance(owner.getProject()).findInferredAnnotations(owner);
+ externalAnnotations = ArrayUtil.mergeArrays(externalAnnotations, inferredAnnotations, PsiAnnotation.ARRAY_FACTORY);
+ generateAnnotations(buffer, owner, externalAnnotations, true, generateLink, splitAnnotations);
}
private static void generateAnnotations(StringBuilder buffer,
PsiModifierListOwner owner,
PsiAnnotation[] annotations,
boolean external,
- boolean generateLink) {
+ boolean generateLink, boolean splitAnnotations) {
PsiManager manager = owner.getManager();
for (PsiAnnotation annotation : annotations) {
final PsiJavaCodeReferenceElement nameReferenceElement = annotation.getNameReferenceElement();
if (nameReferenceElement == null) continue;
final PsiElement resolved = nameReferenceElement.resolve();
+ boolean inferred = AnnotationUtil.isInferredAnnotation(annotation);
if (resolved instanceof PsiClass) {
final PsiClass annotationType = (PsiClass)resolved;
if (AnnotationUtil.isAnnotated(annotationType, "java.lang.annotation.Documented", false)) {
+ if (inferred) buffer.append("<i>");
final PsiClassType type = JavaPsiFacade.getInstance(manager.getProject()).getElementFactory().createType(annotationType, PsiSubstitutor.EMPTY);
buffer.append("@");
generateType(buffer, type, owner, generateLink);
@@ -736,24 +746,27 @@ public class JavaDocInfoGenerator {
}
final PsiAnnotationMemberValue value = pair.getValue();
if (value != null) {
- buffer.append(value.getText());
+ buffer.append(XmlStringUtil.escapeString(value.getText()));
}
}
buffer.append(")");
}
+ if (inferred) buffer.append("</i>");
buffer.append("&nbsp;");
}
} else if (external) {
- buffer.append(annotation.getText());
+ if (inferred) buffer.append("<i>");
+ buffer.append(XmlStringUtil.escapeString(annotation.getText()));
buffer.append("&nbsp;");
+ if (inferred) buffer.append("</i>");
}
else {
buffer.append("<font color=red>");
- buffer.append(annotation.getText());
+ buffer.append(XmlStringUtil.escapeString(annotation.getText()));
buffer.append("</font>");
buffer.append("&nbsp;");
}
- buffer.append("\n");
+ if (splitAnnotations) buffer.append("\n");
}
}
@@ -767,7 +780,7 @@ public class JavaDocInfoGenerator {
buffer.append(modifiers);
buffer.append(" ");
}
- generateAnnotations(buffer, parameter, true);
+ generateAnnotations(buffer, parameter, true, true);
generateType(buffer, parameter.getType(), parameter);
buffer.append(" ");
buffer.append("<b>");
@@ -843,7 +856,7 @@ public class JavaDocInfoGenerator {
}
private static void generateMethodSignature(StringBuilder buffer, PsiMethod method, boolean generateLink) {
- generateAnnotations(buffer, method, generateLink);
+ generateAnnotations(buffer, method, generateLink, true);
String modifiers = PsiFormatUtil.formatModifiers(method, PsiFormatUtilBase.JAVADOC_MODIFIERS_ONLY);
int indent = 0;
if (!modifiers.isEmpty()) {
@@ -876,7 +889,7 @@ public class JavaDocInfoGenerator {
PsiParameter[] parms = method.getParameterList().getParameters();
for (int i = 0; i < parms.length; i++) {
PsiParameter parm = parms[i];
- generateAnnotations(buffer, parm, generateLink);
+ generateAnnotations(buffer, parm, generateLink, false);
generateType(buffer, parm.getType(), method, generateLink);
buffer.append("&nbsp;");
if (parm.getName() != null) {
diff --git a/java/java-psi-impl/src/com/intellij/lang/java/parser/DeclarationParser.java b/java/java-psi-impl/src/com/intellij/lang/java/parser/DeclarationParser.java
index 0377048d0acb..36d024726bbf 100644
--- a/java/java-psi-impl/src/com/intellij/lang/java/parser/DeclarationParser.java
+++ b/java/java-psi-impl/src/com/intellij/lang/java/parser/DeclarationParser.java
@@ -46,6 +46,8 @@ public class DeclarationParser {
JavaTokenType.IDENTIFIER, JavaTokenType.COMMA, JavaTokenType.THROWS_KEYWORD);
private static final TokenSet PARAM_LIST_STOPPERS = TokenSet.create(
JavaTokenType.RPARENTH, JavaTokenType.LBRACE, JavaTokenType.ARROW);
+ private static final TokenSet TYPE_START = TokenSet.orSet(
+ ElementType.PRIMITIVE_TYPE_BIT_SET, TokenSet.create(JavaTokenType.IDENTIFIER, JavaTokenType.AT));
private static final String WHITESPACES = "\n\r \t";
private static final String LINE_ENDS = "\n\r";
@@ -278,56 +280,64 @@ public class DeclarationParser {
return modList;
}
- PsiBuilder.Marker type;
- if (ElementType.PRIMITIVE_TYPE_BIT_SET.contains(builder.getTokenType())) {
- type = parseTypeNotNull(builder);
- }
- else if (builder.getTokenType() == JavaTokenType.IDENTIFIER) {
- final PsiBuilder.Marker idPos = builder.mark();
- type = parseTypeNotNull(builder);
- if (builder.getTokenType() == JavaTokenType.LPARENTH) { // constructor
- if (context == Context.CODE_BLOCK) {
- declaration.rollbackTo();
- return null;
- }
- idPos.rollbackTo();
- if (typeParams == null) {
- emptyElement(builder, JavaElementType.TYPE_PARAMETER_LIST);
- }
- builder.advanceLexer();
- if (builder.getTokenType() != JavaTokenType.LPARENTH) {
- declaration.rollbackTo();
- return null;
- }
- return parseMethodFromLeftParenth(builder, declaration, false, true);
- }
- idPos.drop();
- }
- else if (builder.getTokenType() == JavaTokenType.LBRACE) {
+ if (builder.getTokenType() == JavaTokenType.LBRACE) {
if (context == Context.CODE_BLOCK) {
error(builder, JavaErrorMessages.message("expected.identifier.or.type"), typeParams);
declaration.drop();
return modList;
}
- final PsiBuilder.Marker codeBlock = myParser.getStatementParser().parseCodeBlock(builder);
+ PsiBuilder.Marker codeBlock = myParser.getStatementParser().parseCodeBlock(builder);
assert codeBlock != null : builder.getOriginalText();
if (typeParams != null) {
- final PsiBuilder.Marker error = typeParams.precede();
+ PsiBuilder.Marker error = typeParams.precede();
error.errorBefore(JavaErrorMessages.message("unexpected.token"), codeBlock);
}
+
done(declaration, JavaElementType.CLASS_INITIALIZER);
return declaration;
}
- else {
- final PsiBuilder.Marker error;
- if (typeParams != null) {
- error = typeParams.precede();
+
+ PsiBuilder.Marker type = null;
+
+ if (TYPE_START.contains(builder.getTokenType())) {
+ PsiBuilder.Marker pos = builder.mark();
+
+ type = myParser.getReferenceParser().parseType(builder, ReferenceParser.EAT_LAST_DOT | ReferenceParser.WILDCARD);
+
+ if (type == null) {
+ pos.rollbackTo();
+ }
+ else if (builder.getTokenType() == JavaTokenType.LPARENTH) { // constructor
+ if (context == Context.CODE_BLOCK) {
+ declaration.rollbackTo();
+ return null;
+ }
+
+ pos.rollbackTo();
+
+ if (typeParams == null) {
+ emptyElement(builder, JavaElementType.TYPE_PARAMETER_LIST);
+ }
+ parseAnnotations(builder);
+ builder.advanceLexer();
+
+ if (builder.getTokenType() == JavaTokenType.LPARENTH) {
+ return parseMethodFromLeftParenth(builder, declaration, false, true);
+ }
+ else {
+ declaration.rollbackTo();
+ return null;
+ }
}
else {
- error = builder.mark();
+ pos.drop();
}
+ }
+
+ if (type == null) {
+ PsiBuilder.Marker error = typeParams != null ? typeParams.precede() : builder.mark();
error.error(JavaErrorMessages.message("expected.identifier.or.type"));
declaration.drop();
return modList;
@@ -364,13 +374,6 @@ public class DeclarationParser {
}
@NotNull
- private PsiBuilder.Marker parseTypeNotNull(final PsiBuilder builder) {
- final PsiBuilder.Marker type = myParser.getReferenceParser().parseType(builder, ReferenceParser.EAT_LAST_DOT | ReferenceParser.WILDCARD);
- assert type != null : builder.getOriginalText();
- return type;
- }
-
- @NotNull
public Pair<PsiBuilder.Marker, Boolean> parseModifierList(final PsiBuilder builder) {
return parseModifierList(builder, ElementType.MODIFIER_BIT_SET);
}
diff --git a/java/java-psi-impl/src/com/intellij/lang/java/parser/ReferenceParser.java b/java/java-psi-impl/src/com/intellij/lang/java/parser/ReferenceParser.java
index 42a41d51c6fb..e18b1b5b5dab 100644
--- a/java/java-psi-impl/src/com/intellij/lang/java/parser/ReferenceParser.java
+++ b/java/java-psi-impl/src/com/intellij/lang/java/parser/ReferenceParser.java
@@ -277,8 +277,8 @@ public class ReferenceParser {
error(builder, JavaErrorMessages.message("expected.identifier"));
}
else {
- final IElementType tokenType = builder.getTokenType();
- if (WILDCARD_KEYWORD_SET.contains(tokenType) && tokenType != null) {
+ IElementType tokenType = builder.getTokenType();
+ if (WILDCARD_KEYWORD_SET.contains(tokenType)) {
parseReferenceList(builder, tokenType, null, JavaTokenType.AND);
}
}
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/InheritanceImplUtil.java b/java/java-psi-impl/src/com/intellij/psi/impl/InheritanceImplUtil.java
index 543c8a653651..f958555a3c45 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/InheritanceImplUtil.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/InheritanceImplUtil.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -24,7 +24,7 @@ import com.intellij.psi.util.CachedValueProvider;
import com.intellij.psi.util.CachedValuesManager;
import com.intellij.psi.util.InheritanceUtil;
import com.intellij.psi.util.PsiModificationTracker;
-import com.intellij.util.containers.ConcurrentHashMap;
+import com.intellij.util.containers.ConcurrentWeakHashMap;
import com.intellij.util.containers.HashSet;
import gnu.trove.THashSet;
import org.jetbrains.annotations.NonNls;
@@ -41,14 +41,14 @@ public class InheritanceImplUtil {
if (baseClass instanceof PsiAnonymousClass) return false;
if (!checkDeep) return isInheritor(candidateClass, baseClass, false, null);
- if (CommonClassNames.JAVA_LANG_OBJECT.equals(candidateClass.getQualifiedName())) return false;
- if (CommonClassNames.JAVA_LANG_OBJECT.equals(baseClass.getQualifiedName())) return true;
+ if (CommonClassNames.JAVA_LANG_OBJECT_SHORT.equals(candidateClass.getName()) && CommonClassNames.JAVA_LANG_OBJECT.equals(candidateClass.getQualifiedName())) return false;
+ if (CommonClassNames.JAVA_LANG_OBJECT_SHORT.equals(baseClass.getName()) && CommonClassNames.JAVA_LANG_OBJECT.equals(baseClass.getQualifiedName())) return true;
Map<PsiClass, Boolean> map = CachedValuesManager.
getCachedValue(candidateClass, new CachedValueProvider<Map<PsiClass, Boolean>>() {
@Nullable
@Override
public Result<Map<PsiClass, Boolean>> compute() {
- final Map<PsiClass, Boolean> map = new ConcurrentHashMap<PsiClass, Boolean>();
+ final Map<PsiClass, Boolean> map = new ConcurrentWeakHashMap<PsiClass, Boolean>();
return Result.create(map, candidateClass, PsiModificationTracker.JAVA_STRUCTURE_MODIFICATION_COUNT);
}
});
@@ -82,7 +82,7 @@ public class InheritanceImplUtil {
}
@NonNls final String baseName = baseClass.getName();
- if ("Object".equals(baseName)) {
+ if (CommonClassNames.JAVA_LANG_OBJECT_SHORT.equals(baseName)) {
PsiClass objectClass = JavaPsiFacade.getInstance(manager.getProject()).findClass(CommonClassNames.JAVA_LANG_OBJECT, candidateClass.getResolveScope());
if (manager.areElementsEquivalent(baseClass, objectClass)) {
if (manager.areElementsEquivalent(candidateClass, objectClass)) return false;
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/JavaConstantExpressionEvaluator.java b/java/java-psi-impl/src/com/intellij/psi/impl/JavaConstantExpressionEvaluator.java
index 674ccbe1f03f..19da149c99b8 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/JavaConstantExpressionEvaluator.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/JavaConstantExpressionEvaluator.java
@@ -105,11 +105,11 @@ public class JavaConstantExpressionEvaluator extends JavaRecursiveElementWalking
return myMapFactory.create();
}
- public static Object computeConstantExpression(PsiExpression expression, @Nullable Set<PsiVariable> visitedVars, boolean throwExceptionOnOverflow) {
+ public static Object computeConstantExpression(@Nullable PsiExpression expression, @Nullable Set<PsiVariable> visitedVars, boolean throwExceptionOnOverflow) {
return computeConstantExpression(expression, visitedVars, throwExceptionOnOverflow, null);
}
- public static Object computeConstantExpression(PsiExpression expression, @Nullable Set<PsiVariable> visitedVars, boolean throwExceptionOnOverflow,
+ public static Object computeConstantExpression(@Nullable PsiExpression expression, @Nullable Set<PsiVariable> visitedVars, boolean throwExceptionOnOverflow,
final PsiConstantEvaluationHelper.AuxEvaluator auxEvaluator) {
if (expression == null) return null;
@@ -131,7 +131,7 @@ public class JavaConstantExpressionEvaluator extends JavaRecursiveElementWalking
return cached == NO_VALUE ? null : cached;
}
- public static Object computeConstantExpression(PsiExpression expression, boolean throwExceptionOnOverflow) {
+ public static Object computeConstantExpression(@Nullable PsiExpression expression, boolean throwExceptionOnOverflow) {
return computeConstantExpression(expression, null, throwExceptionOnOverflow);
}
}
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/compiled/SignatureParsing.java b/java/java-psi-impl/src/com/intellij/psi/impl/compiled/SignatureParsing.java
index 46cceffcb6ad..bd5f75ece27f 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/compiled/SignatureParsing.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/compiled/SignatureParsing.java
@@ -32,6 +32,7 @@ import com.intellij.util.cls.ClsFormatException;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.io.StringRef;
import org.jetbrains.annotations.NonNls;
+import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.text.CharacterIterator;
@@ -259,7 +260,8 @@ public class SignatureParsing {
return variance;
}
- public static String parseTypeString(CharacterIterator signature) throws ClsFormatException {
+ @NotNull
+ public static String parseTypeString(@NotNull CharacterIterator signature) throws ClsFormatException {
int arrayDimensions = 0;
while (signature.current() == '[') {
arrayDimensions++;
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/java/stubs/JavaImportStatementElementType.java b/java/java-psi-impl/src/com/intellij/psi/impl/java/stubs/JavaImportStatementElementType.java
index 7c9af30f1d9b..93e359e6778a 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/java/stubs/JavaImportStatementElementType.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/java/stubs/JavaImportStatementElementType.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -24,7 +24,7 @@ import com.intellij.psi.impl.java.stubs.impl.PsiImportStatementStubImpl;
import com.intellij.psi.impl.source.PsiImportStatementImpl;
import com.intellij.psi.impl.source.PsiImportStaticStatementImpl;
import com.intellij.psi.impl.source.tree.JavaElementType;
-import com.intellij.psi.impl.source.tree.SourceUtil;
+import com.intellij.psi.impl.source.tree.JavaSourceUtil;
import com.intellij.psi.impl.source.tree.java.ImportStaticStatementElement;
import com.intellij.psi.stubs.IndexSink;
import com.intellij.psi.stubs.StubElement;
@@ -68,7 +68,7 @@ public abstract class JavaImportStatementElementType extends JavaStubElementType
for (LighterASTNode child : tree.getChildren(node)) {
IElementType type = child.getTokenType();
if (type == JavaElementType.JAVA_CODE_REFERENCE || type == JavaElementType.IMPORT_STATIC_REFERENCE) {
- refText = SourceUtil.getReferenceText(tree, child);
+ refText = JavaSourceUtil.getReferenceText(tree, child);
}
else if (type == JavaTokenType.ASTERISK) {
isOnDemand = true;
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/JavaLightStubBuilder.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/JavaLightStubBuilder.java
index ff8c80db3729..3413fda3a3fe 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/source/JavaLightStubBuilder.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/JavaLightStubBuilder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -44,7 +44,7 @@ public class JavaLightStubBuilder extends LightStubBuilder {
if (pkg != null) {
LighterASTNode ref = LightTreeUtil.firstChildOfType(tree, pkg, JavaElementType.JAVA_CODE_REFERENCE);
if (ref != null) {
- refText = SourceUtil.getReferenceText(tree, ref);
+ refText = JavaSourceUtil.getReferenceText(tree, ref);
}
}
return new PsiJavaFileStubImpl((PsiJavaFile)file, StringRef.fromString(refText), false);
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiJavaCodeReferenceElementImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiJavaCodeReferenceElementImpl.java
index 55b760031646..807b42d60383 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiJavaCodeReferenceElementImpl.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiJavaCodeReferenceElementImpl.java
@@ -587,7 +587,15 @@ public class PsiJavaCodeReferenceElementImpl extends CompositePsiElement impleme
if (parameterList != null) {
text += parameterList.getText();
}
- PsiJavaCodeReferenceElement ref = facade.getParserFacade().createReferenceFromText(text, getParent());
+
+ PsiJavaCodeReferenceElement ref;
+ try {
+ ref = facade.getParserFacade().createReferenceFromText(text, getParent());
+ }
+ catch (IncorrectOperationException e) {
+ throw new IncorrectOperationException(e.getMessage() + " [qname=" + qName + " class=" + aClass + ";" + aClass.getClass().getName() + "]");
+ }
+
((PsiJavaCodeReferenceElementImpl)ref).setAnnotations(annotations);
getTreeParent().replaceChildInternal(this, (TreeElement)ref.getNode());
@@ -743,7 +751,7 @@ public class PsiJavaCodeReferenceElementImpl extends CompositePsiElement impleme
private String getNormalizedText() {
String whiteSpaceAndComments = myCachedNormalizedText;
if (whiteSpaceAndComments == null) {
- myCachedNormalizedText = whiteSpaceAndComments = SourceUtil.getReferenceText(this);
+ myCachedNormalizedText = whiteSpaceAndComments = JavaSourceUtil.getReferenceText(this);
}
return whiteSpaceAndComments;
}
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/ClassResolverProcessor.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/ClassResolverProcessor.java
index a2e5593478eb..3e081a738caf 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/ClassResolverProcessor.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/ClassResolverProcessor.java
@@ -38,6 +38,7 @@ public class ClassResolverProcessor extends BaseScopeProcessor implements NameHi
@NotNull
private final PsiFile myContainingFile;
private final PsiElement myPlace;
+ private final PsiResolveHelper myResolveHelper;
private PsiClass myAccessClass = null;
private List<ClassCandidateInfo> myCandidates = null;
private boolean myHasAccessibleCandidate;
@@ -67,6 +68,7 @@ public class ClassResolverProcessor extends BaseScopeProcessor implements NameHi
}
}
}
+ myResolveHelper = JavaPsiFacade.getInstance(containingFile.getProject()).getResolveHelper();
}
@NotNull
@@ -252,8 +254,7 @@ public class ClassResolverProcessor extends BaseScopeProcessor implements NameHi
}
private boolean checkAccessibility(final PsiClass aClass) {
- JavaPsiFacade facade = JavaPsiFacade.getInstance(aClass.getProject());
- return facade.getResolveHelper().isAccessible(aClass, myPlace, myAccessClass);
+ return myResolveHelper.isAccessible(aClass, myPlace, myAccessClass);
}
@Override
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/InferenceSession.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/InferenceSession.java
index f16231ac8d26..6098199c591c 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/InferenceSession.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/InferenceSession.java
@@ -379,7 +379,7 @@ public class InferenceSession {
PsiType returnType = method.getReturnType();
if (!PsiType.VOID.equals(returnType) && returnType != null) {
PsiType targetType = getTargetType(context);
- if (targetType != null) {
+ if (targetType != null && !PsiType.VOID.equals(targetType)) {
registerReturnTypeConstraints(PsiUtil.isRawSubstitutor(method, mySiteSubstitutor) ? returnType : mySiteSubstitutor.substitute(returnType), targetType);
}
}
@@ -970,7 +970,8 @@ public class InferenceSession {
addConstraint(new TypeCompatibilityConstraint(getParameterType(parameters, i, PsiSubstitutor.EMPTY, varargs), pType));
}
}
- else if (parameters.length + 1 == functionalMethodParameters.length && !varargs || !isStatic && varargs && functionalMethodParameters.length > 0) { //instance methods
+ else if (parameters.length + 1 == functionalMethodParameters.length && !varargs ||
+ !isStatic && varargs && functionalMethodParameters.length > 0 && PsiMethodReferenceUtil.hasReceiver(reference, method)) { //instance methods
initBounds(containingClass.getTypeParameters());
final PsiType pType = signature.getParameterTypes()[0];
@@ -1020,13 +1021,13 @@ public class InferenceSession {
*/
public static boolean isMoreSpecific(PsiMethod m1,
PsiMethod m2,
- PsiSubstitutor siteSubstitutor2,
PsiExpression[] args,
PsiElement context,
boolean varargs) {
- final PsiTypeParameter[] typeParameters = m2.getTypeParameters();
-
- final InferenceSession session = new InferenceSession(typeParameters, siteSubstitutor2, m2.getManager(), context);
+ final InferenceSession session = new InferenceSession(PsiTypeParameter.EMPTY_ARRAY, PsiSubstitutor.EMPTY, m2.getManager(), context);
+ for (PsiTypeParameter param : PsiUtil.typeParametersIterable(m2)) {
+ session.initBounds(param);
+ }
final PsiParameter[] parameters1 = m1.getParameterList().getParameters();
final PsiParameter[] parameters2 = m2.getParameterList().getParameters();
@@ -1036,8 +1037,8 @@ public class InferenceSession {
final int paramsLength = !varargs ? parameters1.length : parameters1.length - 1;
for (int i = 0; i < paramsLength; i++) {
- PsiType sType = getParameterType(parameters1, i, siteSubstitutor2, false);
- PsiType tType = getParameterType(parameters2, i, siteSubstitutor2, varargs);
+ PsiType sType = getParameterType(parameters1, i, PsiSubstitutor.EMPTY, false);
+ PsiType tType = getParameterType(parameters2, i, PsiSubstitutor.EMPTY, varargs);
if (session.isProperType(sType) && session.isProperType(tType)) {
if (!TypeConversionUtil.isAssignable(tType, sType)) {
return false;
@@ -1054,8 +1055,8 @@ public class InferenceSession {
}
if (varargs) {
- PsiType sType = getParameterType(parameters1, paramsLength, siteSubstitutor2, true);
- PsiType tType = getParameterType(parameters2, paramsLength, siteSubstitutor2, true);
+ PsiType sType = getParameterType(parameters1, paramsLength, PsiSubstitutor.EMPTY, true);
+ PsiType tType = getParameterType(parameters2, paramsLength, PsiSubstitutor.EMPTY, true);
session.addConstraint(new StrictSubtypingConstraint(tType, sType));
}
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/constraints/PsiMethodReferenceCompatibilityConstraint.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/constraints/PsiMethodReferenceCompatibilityConstraint.java
index 175f083ce319..18d0c49e79d4 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/constraints/PsiMethodReferenceCompatibilityConstraint.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/constraints/PsiMethodReferenceCompatibilityConstraint.java
@@ -21,6 +21,7 @@ import com.intellij.psi.impl.source.resolve.graphInference.FunctionalInterfacePa
import com.intellij.psi.impl.source.resolve.graphInference.InferenceSession;
import com.intellij.psi.impl.source.resolve.graphInference.PsiPolyExpressionUtil;
import com.intellij.psi.infos.MethodCandidateInfo;
+import com.intellij.psi.util.InheritanceUtil;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.psi.util.PsiUtil;
import com.intellij.psi.util.TypeConversionUtil;
@@ -60,6 +61,10 @@ public class PsiMethodReferenceCompatibilityConstraint implements ConstraintForm
final PsiType interfaceMethodReturnType = interfaceMethod.getReturnType();
final PsiType returnType = substitutor.substitute(interfaceMethodReturnType);
final PsiType[] typeParameters = myExpression.getTypeParameters();
+
+ final PsiMethodReferenceUtil.QualifierResolveResult qualifierResolveResult = PsiMethodReferenceUtil.getQualifierResolveResult(myExpression);
+ PsiSubstitutor psiSubstitutor = qualifierResolveResult.getSubstitutor();
+
if (!myExpression.isExact()) {
for (PsiParameter parameter : targetParameters) {
if (!session.isProperType(substitutor.substitute(parameter.getType()))) {
@@ -70,11 +75,9 @@ public class PsiMethodReferenceCompatibilityConstraint implements ConstraintForm
final PsiMember applicableMember = myExpression.getPotentiallyApplicableMember();
LOG.assertTrue(applicableMember != null);
- final PsiMethodReferenceUtil.QualifierResolveResult qualifierResolveResult = PsiMethodReferenceUtil.getQualifierResolveResult(myExpression);
final PsiClass applicableMemberContainingClass = applicableMember.getContainingClass();
final PsiClass containingClass = qualifierResolveResult.getContainingClass();
- PsiSubstitutor psiSubstitutor = qualifierResolveResult.getSubstitutor();
psiSubstitutor = applicableMemberContainingClass == null || containingClass == null || myExpression.isConstructor()
? psiSubstitutor
: TypeConversionUtil.getSuperClassSubstitutor(applicableMemberContainingClass, containingClass, psiSubstitutor);
@@ -143,6 +146,13 @@ public class PsiMethodReferenceCompatibilityConstraint implements ConstraintForm
final PsiType referencedMethodReturnType;
final PsiClass containingClass = method.getContainingClass();
LOG.assertTrue(containingClass != null, method);
+
+ PsiClass qContainingClass = qualifierResolveResult.getContainingClass();
+ if (qContainingClass != null && InheritanceUtil.isInheritorOrSelf(qContainingClass, containingClass, true)) {
+ psiSubstitutor = TypeConversionUtil.getClassSubstitutor(containingClass, qContainingClass, PsiSubstitutor.EMPTY);
+ LOG.assertTrue(psiSubstitutor != null);
+ }
+
if (method.isConstructor()) {
referencedMethodReturnType = JavaPsiFacade.getElementFactory(method.getProject()).createType(containingClass, PsiSubstitutor.EMPTY);
}
@@ -179,7 +189,6 @@ public class PsiMethodReferenceCompatibilityConstraint implements ConstraintForm
}
int idx = 0;
- PsiSubstitutor psiSubstitutor = PsiSubstitutor.EMPTY;
for (PsiTypeParameter param : method.getTypeParameters()) {
if (idx < typeParameters.length) {
psiSubstitutor = psiSubstitutor.put(param, typeParameters[idx++]);
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/JavaElementType.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/JavaElementType.java
index 4fbbad26964d..8d42dbeb4f90 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/JavaElementType.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/JavaElementType.java
@@ -84,8 +84,8 @@ public interface JavaElementType {
IElementType PARAMETER_LIST = JavaStubElementTypes.PARAMETER_LIST;
IElementType EXTENDS_BOUND_LIST = JavaStubElementTypes.EXTENDS_BOUND_LIST;
IElementType THROWS_LIST = JavaStubElementTypes.THROWS_LIST;
- IElementType LITERAL_EXPRESSION = new JavaCompositeElementType("LITERAL_EXPRESSION", PsiLiteralExpressionImpl.class);
+ IElementType LITERAL_EXPRESSION = new JavaCompositeElementType("LITERAL_EXPRESSION", PsiLiteralExpressionImpl.class);
IElementType IMPORT_STATIC_REFERENCE = new JavaCompositeElementType("IMPORT_STATIC_REFERENCE", PsiImportStaticReferenceElementImpl.class);
IElementType TYPE = new JavaCompositeElementType("TYPE", PsiTypeElementImpl.class);
IElementType DIAMOND_TYPE = new JavaCompositeElementType("DIAMOND_TYPE", PsiDiamondTypeElementImpl.class);
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/JavaSourceUtil.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/JavaSourceUtil.java
index 8cf5b5bfbdd2..e2af7b08df0d 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/JavaSourceUtil.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/JavaSourceUtil.java
@@ -15,13 +15,28 @@
*/
package com.intellij.psi.impl.source.tree;
+import com.intellij.lang.ASTFactory;
import com.intellij.lang.ASTNode;
+import com.intellij.lang.LighterAST;
+import com.intellij.lang.LighterASTNode;
+import com.intellij.openapi.diagnostic.Logger;
import com.intellij.psi.*;
+import com.intellij.psi.codeStyle.CodeStyleManager;
+import com.intellij.psi.impl.source.DummyHolder;
import com.intellij.psi.impl.source.SourceJavaCodeReference;
+import com.intellij.psi.impl.source.SourceTreeToPsiMap;
+import com.intellij.psi.tree.IElementType;
+import com.intellij.psi.tree.TokenSet;
import com.intellij.util.CharTable;
+import com.intellij.util.IncorrectOperationException;
import org.jetbrains.annotations.NotNull;
public class JavaSourceUtil {
+ private static final Logger LOG = Logger.getInstance("#com.intellij.psi.impl.source.tree.JavaSourceUtil");
+
+ private static final TokenSet REF_FILTER = TokenSet.orSet(
+ ElementType.JAVA_COMMENT_OR_WHITESPACE_BIT_SET, TokenSet.create(JavaElementType.ANNOTATION));
+
private JavaSourceUtil() { }
public static void fullyQualifyReference(@NotNull CompositeElement reference, @NotNull PsiClass targetClass) {
@@ -61,4 +76,70 @@ public class JavaSourceUtil {
}
}
}
+
+ @NotNull
+ public static String getReferenceText(@NotNull PsiJavaCodeReferenceElement ref) {
+ final StringBuilder buffer = new StringBuilder();
+
+ ((TreeElement)ref.getNode()).acceptTree(new RecursiveTreeElementWalkingVisitor() {
+ @Override
+ public void visitLeaf(LeafElement leaf) {
+ if (!REF_FILTER.contains(leaf.getElementType())) {
+ String leafText = leaf.getText();
+ if (buffer.length() > 0 && !leafText.isEmpty() && Character.isJavaIdentifierPart(leafText.charAt(0))) {
+ char lastInBuffer = buffer.charAt(buffer.length() - 1);
+ if (lastInBuffer == '?' || Character.isJavaIdentifierPart(lastInBuffer)) {
+ buffer.append(" ");
+ }
+ }
+
+ buffer.append(leafText);
+ }
+ }
+
+ @Override
+ public void visitComposite(CompositeElement composite) {
+ if (!REF_FILTER.contains(composite.getElementType())) {
+ super.visitComposite(composite);
+ }
+ }
+ });
+
+ return buffer.toString();
+ }
+
+ @NotNull
+ public static String getReferenceText(@NotNull LighterAST tree, @NotNull LighterASTNode node) {
+ return LightTreeUtil.toFilteredString(tree, node, REF_FILTER);
+ }
+
+ public static TreeElement addParenthToReplacedChild(@NotNull IElementType parenthType,
+ @NotNull TreeElement newChild,
+ @NotNull PsiManager manager) {
+ CompositeElement parenthExpr = ASTFactory.composite(parenthType);
+
+ TreeElement dummyExpr = (TreeElement)newChild.clone();
+ final CharTable charTableByTree = SharedImplUtil.findCharTableByTree(newChild);
+ new DummyHolder(manager, parenthExpr, null, charTableByTree);
+ parenthExpr.putUserData(CharTable.CHAR_TABLE_KEY, charTableByTree);
+ parenthExpr.rawAddChildren(ASTFactory.leaf(JavaTokenType.LPARENTH, "("));
+ parenthExpr.rawAddChildren(dummyExpr);
+ parenthExpr.rawAddChildren(ASTFactory.leaf(JavaTokenType.RPARENTH, ")"));
+
+ try {
+ CodeStyleManager codeStyleManager = CodeStyleManager.getInstance(manager.getProject());
+ PsiElement formatted = codeStyleManager.reformat(SourceTreeToPsiMap.treeToPsiNotNull(parenthExpr));
+ parenthExpr = (CompositeElement)SourceTreeToPsiMap.psiToTreeNotNull(formatted);
+ }
+ catch (IncorrectOperationException e) {
+ LOG.error(e); // should not happen
+ }
+
+ newChild.putUserData(CharTable.CHAR_TABLE_KEY, SharedImplUtil.findCharTableByTree(newChild));
+ dummyExpr.getTreeParent().replaceChild(dummyExpr, newChild);
+
+ // TODO remove explicit caches drop since this should be ok if we will use ChangeUtil for the modification
+ TreeUtil.clearCaches(TreeUtil.getFileElement(parenthExpr));
+ return parenthExpr;
+ }
}
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/SourceUtil.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/SourceUtil.java
index 93e9f60c890e..554580828c0b 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/SourceUtil.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/SourceUtil.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -15,94 +15,29 @@
*/
package com.intellij.psi.impl.source.tree;
-import com.intellij.lang.ASTFactory;
import com.intellij.lang.LighterAST;
import com.intellij.lang.LighterASTNode;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.psi.JavaTokenType;
-import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiJavaCodeReferenceElement;
import com.intellij.psi.PsiManager;
-import com.intellij.psi.codeStyle.CodeStyleManager;
-import com.intellij.psi.impl.source.DummyHolder;
-import com.intellij.psi.impl.source.SourceTreeToPsiMap;
import com.intellij.psi.tree.IElementType;
-import com.intellij.psi.tree.TokenSet;
-import com.intellij.util.CharTable;
-import com.intellij.util.IncorrectOperationException;
import org.jetbrains.annotations.NotNull;
+/** @deprecated use {@link JavaSourceUtil} (to be removed in IDEA 15) */
+@SuppressWarnings("UnusedDeclaration")
public class SourceUtil {
- private static final Logger LOG = Logger.getInstance("#com.intellij.psi.impl.source.tree.SourceUtil");
-
- private static final TokenSet REF_FILTER = TokenSet.orSet(
- ElementType.JAVA_COMMENT_OR_WHITESPACE_BIT_SET, TokenSet.create(JavaElementType.ANNOTATION));
-
private SourceUtil() { }
@NotNull
public static String getReferenceText(@NotNull PsiJavaCodeReferenceElement ref) {
- final StringBuilder buffer = new StringBuilder();
-
- ((TreeElement)ref.getNode()).acceptTree(new RecursiveTreeElementWalkingVisitor() {
- @Override
- public void visitLeaf(LeafElement leaf) {
- if (!REF_FILTER.contains(leaf.getElementType())) {
- String leafText = leaf.getText();
- if (buffer.length() > 0 && !leafText.isEmpty() && Character.isJavaIdentifierPart(leafText.charAt(0))) {
- char lastInBuffer = buffer.charAt(buffer.length() - 1);
- if (lastInBuffer == '?' || Character.isJavaIdentifierPart(lastInBuffer)) {
- buffer.append(" ");
- }
- }
-
- buffer.append(leafText);
- }
- }
-
- @Override
- public void visitComposite(CompositeElement composite) {
- if (!REF_FILTER.contains(composite.getElementType())) {
- super.visitComposite(composite);
- }
- }
- });
-
- return buffer.toString();
+ return JavaSourceUtil.getReferenceText(ref);
}
@NotNull
public static String getReferenceText(@NotNull LighterAST tree, @NotNull LighterASTNode node) {
- return LightTreeUtil.toFilteredString(tree, node, REF_FILTER);
+ return JavaSourceUtil.getReferenceText(tree, node);
}
- public static TreeElement addParenthToReplacedChild(@NotNull IElementType parenthType,
- @NotNull TreeElement newChild,
- @NotNull PsiManager manager) {
- CompositeElement parenthExpr = ASTFactory.composite(parenthType);
-
- TreeElement dummyExpr = (TreeElement)newChild.clone();
- final CharTable charTableByTree = SharedImplUtil.findCharTableByTree(newChild);
- new DummyHolder(manager, parenthExpr, null, charTableByTree);
- parenthExpr.putUserData(CharTable.CHAR_TABLE_KEY, charTableByTree);
- parenthExpr.rawAddChildren(ASTFactory.leaf(JavaTokenType.LPARENTH, "("));
- parenthExpr.rawAddChildren(dummyExpr);
- parenthExpr.rawAddChildren(ASTFactory.leaf(JavaTokenType.RPARENTH, ")"));
-
- try {
- CodeStyleManager codeStyleManager = CodeStyleManager.getInstance(manager.getProject());
- PsiElement formatted = codeStyleManager.reformat(SourceTreeToPsiMap.treeToPsiNotNull(parenthExpr));
- parenthExpr = (CompositeElement)SourceTreeToPsiMap.psiToTreeNotNull(formatted);
- }
- catch (IncorrectOperationException e) {
- LOG.error(e); // should not happen
- }
-
- newChild.putUserData(CharTable.CHAR_TABLE_KEY, SharedImplUtil.findCharTableByTree(newChild));
- dummyExpr.getTreeParent().replaceChild(dummyExpr, newChild);
-
- // TODO remove explicit caches drop since this should be ok if we will use ChangeUtil for the modification
- TreeUtil.clearCaches(TreeUtil.getFileElement(parenthExpr));
- return parenthExpr;
+ public static TreeElement addParenthToReplacedChild(@NotNull IElementType parenthType, @NotNull TreeElement newChild, @NotNull PsiManager manager) {
+ return JavaSourceUtil.addParenthToReplacedChild(parenthType, newChild, manager);
}
}
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/ExpressionPsiElement.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/ExpressionPsiElement.java
index 1d8693efc55c..e0b122e95592 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/ExpressionPsiElement.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/ExpressionPsiElement.java
@@ -13,10 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-/*
- * @author max
- */
package com.intellij.psi.impl.source.tree.java;
import com.intellij.lang.ASTNode;
@@ -24,13 +20,11 @@ import com.intellij.psi.impl.source.tree.*;
import com.intellij.psi.tree.IElementType;
import org.jetbrains.annotations.NotNull;
+/**
+ * @author max
+ */
public class ExpressionPsiElement extends CompositePsiElement {
- private final int myHC = CompositePsiElement.ourHC++;
-
- @Override
- public final int hashCode() {
- return myHC;
- }
+ @SuppressWarnings("AssignmentToStaticFieldFromInstanceMethod") private final int myHC = CompositePsiElement.ourHC++;
public ExpressionPsiElement(final IElementType type) {
super(type);
@@ -42,9 +36,14 @@ public class ExpressionPsiElement extends CompositePsiElement {
ElementType.EXPRESSION_BIT_SET.contains(newElement.getElementType())) {
boolean needParenth = ReplaceExpressionUtil.isNeedParenthesis(child, newElement);
if (needParenth) {
- newElement = SourceUtil.addParenthToReplacedChild(JavaElementType.PARENTH_EXPRESSION, newElement, getManager());
+ newElement = JavaSourceUtil.addParenthToReplacedChild(JavaElementType.PARENTH_EXPRESSION, newElement, getManager());
}
}
super.replaceChildInternal(child, newElement);
}
+
+ @Override
+ public final int hashCode() {
+ return myHC;
+ }
}
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/MethodElement.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/MethodElement.java
index 31fb4bca8833..1edd7cbaec76 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/MethodElement.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/MethodElement.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -41,14 +41,15 @@ public class MethodElement extends CompositeElement implements Constants {
@Override
public int getTextOffset() {
- return findChildByRole(ChildRole.NAME).getStartOffset();
+ ASTNode name = findChildByType(IDENTIFIER);
+ return name != null ? name.getStartOffset() : this.getStartOffset();
}
@Override
public TreeElement addInternal(TreeElement first, ASTNode last, ASTNode anchor, Boolean before) {
- if (first == last && first.getElementType() == JavaElementType.CODE_BLOCK){
- ASTNode semicolon = findChildByRole(ChildRole.CLOSING_SEMICOLON);
- if (semicolon != null){
+ if (first == last && first.getElementType() == JavaElementType.CODE_BLOCK) {
+ ASTNode semicolon = TreeUtil.findChildBackward(this, SEMICOLON);
+ if (semicolon != null) {
deleteChildInternal(semicolon);
}
}
@@ -64,7 +65,7 @@ public class MethodElement extends CompositeElement implements Constants {
@Override
public void deleteChildInternal(@NotNull ASTNode child) {
- if (child.getElementType() == CODE_BLOCK){
+ if (child.getElementType() == CODE_BLOCK) {
final ASTNode prevWS = TreeUtil.prevLeaf(child);
if (prevWS != null && prevWS.getElementType() == TokenType.WHITE_SPACE) {
removeChild(prevWS);
@@ -80,9 +81,9 @@ public class MethodElement extends CompositeElement implements Constants {
}
@Override
- public ASTNode findChildByRole(int role){
+ public ASTNode findChildByRole(int role) {
LOG.assertTrue(ChildRole.isUnique(role));
- switch(role){
+ switch (role) {
default:
return null;
@@ -161,5 +162,4 @@ public class MethodElement extends CompositeElement implements Constants {
protected boolean isVisibilitySupported() {
return true;
}
-
}
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiMethodReferenceExpressionImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiMethodReferenceExpressionImpl.java
index 2209efe4141b..95171ba30bc9 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiMethodReferenceExpressionImpl.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiMethodReferenceExpressionImpl.java
@@ -434,7 +434,7 @@ public class PsiMethodReferenceExpressionImpl extends PsiReferenceExpressionBase
return true;
}
- final PsiSubstitutor subst = result.getSubstitutor();
+ PsiSubstitutor subst = result.getSubstitutor();
PsiType methodReturnType = null;
PsiClass containingClass = null;
@@ -451,6 +451,12 @@ public class PsiMethodReferenceExpressionImpl extends PsiReferenceExpressionBase
return false;
}
+ PsiClass qContainingClass = PsiMethodReferenceUtil.getQualifierResolveResult(this).getContainingClass();
+ if (qContainingClass != null && containingClass != null && InheritanceUtil.isInheritorOrSelf(qContainingClass, containingClass, true)) {
+ subst = TypeConversionUtil.getClassSubstitutor(containingClass, qContainingClass, subst);
+ LOG.assertTrue(subst != null);
+ }
+
methodReturnType = subst.substitute(returnType);
}
else if (resolve instanceof PsiClass) {
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiPackageStatementImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiPackageStatementImpl.java
index 5a42715590ef..29d072970560 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiPackageStatementImpl.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiPackageStatementImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -38,7 +38,7 @@ public class PsiPackageStatementImpl extends CompositePsiElement implements PsiP
@Override
public String getPackageName() {
PsiJavaCodeReferenceElement ref = getPackageReference();
- return ref == null ? null : SourceUtil.getReferenceText(ref);
+ return ref == null ? null : JavaSourceUtil.getReferenceText(ref);
}
@Override
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiReferenceExpressionImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiReferenceExpressionImpl.java
index 02ffaa6f3c20..8dd43933c660 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiReferenceExpressionImpl.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiReferenceExpressionImpl.java
@@ -761,7 +761,7 @@ public class PsiReferenceExpressionImpl extends PsiReferenceExpressionBase imple
private String getCachedNormalizedText() {
String whiteSpaceAndComments = myCachedNormalizedText;
if (whiteSpaceAndComments == null) {
- myCachedNormalizedText = whiteSpaceAndComments = SourceUtil.getReferenceText(this);
+ myCachedNormalizedText = whiteSpaceAndComments = JavaSourceUtil.getReferenceText(this);
}
return whiteSpaceAndComments;
}
diff --git a/java/java-psi-impl/src/com/intellij/psi/scope/conflictResolvers/JavaMethodsConflictResolver.java b/java/java-psi-impl/src/com/intellij/psi/scope/conflictResolvers/JavaMethodsConflictResolver.java
index f136c843aa87..59083c625f82 100644
--- a/java/java-psi-impl/src/com/intellij/psi/scope/conflictResolvers/JavaMethodsConflictResolver.java
+++ b/java/java-psi-impl/src/com/intellij/psi/scope/conflictResolvers/JavaMethodsConflictResolver.java
@@ -550,10 +550,10 @@ public class JavaMethodsConflictResolver implements PsiConflictResolver{
final PsiSubstitutor methodSubstitutor1 = calculateMethodSubstitutor(typeParameters1, method1, siteSubstitutor1, types1, types2AtSite,
languageLevel);
- boolean applicable12 = isApplicableTo(types2AtSite, method1, languageLevel, varargsPosition, methodSubstitutor1, method2, siteSubstitutor1);
+ boolean applicable12 = isApplicableTo(types2AtSite, method1, languageLevel, varargsPosition, methodSubstitutor1, method2);
final PsiSubstitutor methodSubstitutor2 = calculateMethodSubstitutor(typeParameters2, method2, siteSubstitutor2, types2, types1AtSite, languageLevel);
- boolean applicable21 = isApplicableTo(types1AtSite, method2, languageLevel, varargsPosition, methodSubstitutor2, method1, siteSubstitutor2);
+ boolean applicable21 = isApplicableTo(types1AtSite, method2, languageLevel, varargsPosition, methodSubstitutor2, method1);
if (!myLanguageLevel.isAtLeast(LanguageLevel.JDK_1_8)) {
final boolean typeArgsApplicable12 = GenericsUtil.isTypeArgumentsApplicable(typeParameters1, methodSubstitutor1, myArgumentsList, !applicable21);
@@ -604,9 +604,9 @@ public class JavaMethodsConflictResolver implements PsiConflictResolver{
if (toCompareFunctional) {
final boolean applicable12ignoreFunctionalType = isApplicableTo(types2AtSite, method1, languageLevel, varargsPosition,
- calculateMethodSubstitutor(typeParameters1, method1, siteSubstitutor1, types1, types2AtSite, languageLevel), null, null);
+ calculateMethodSubstitutor(typeParameters1, method1, siteSubstitutor1, types1, types2AtSite, languageLevel), null);
final boolean applicable21ignoreFunctionalType = isApplicableTo(types1AtSite, method2, languageLevel, varargsPosition,
- calculateMethodSubstitutor(typeParameters2, method2, siteSubstitutor2, types2, types1AtSite, languageLevel), null, null);
+ calculateMethodSubstitutor(typeParameters2, method2, siteSubstitutor2, types2, types1AtSite, languageLevel), null);
if (applicable12ignoreFunctionalType || applicable21ignoreFunctionalType) {
Specifics specifics = null;
@@ -694,12 +694,11 @@ public class JavaMethodsConflictResolver implements PsiConflictResolver{
@NotNull LanguageLevel languageLevel,
boolean varargsPosition,
@NotNull PsiSubstitutor methodSubstitutor1,
- PsiMethod method2,
- PsiSubstitutor siteSubstitutor1) {
+ PsiMethod method2) {
if (languageLevel.isAtLeast(LanguageLevel.JDK_1_8) && method2 != null && method1.getTypeParameters().length > 0 && myArgumentsList instanceof PsiExpressionList) {
final PsiElement parent = myArgumentsList.getParent();
if (parent instanceof PsiCallExpression && ((PsiCallExpression)parent).getTypeArguments().length == 0) {
- return InferenceSession.isMoreSpecific(method2, method1, siteSubstitutor1, ((PsiExpressionList)myArgumentsList).getExpressions(), myArgumentsList, varargsPosition);
+ return InferenceSession.isMoreSpecific(method2, method1, ((PsiExpressionList)myArgumentsList).getExpressions(), myArgumentsList, varargsPosition);
}
}
final int applicabilityLevel = PsiUtil.getApplicabilityLevel(method1, methodSubstitutor1, types2AtSite, languageLevel, false, varargsPosition);
diff --git a/java/java-tests/testData/codeInsight/completion/normal/MethodMergingMinimalTail.java b/java/java-tests/testData/codeInsight/completion/normal/MethodMergingMinimalTail.java
new file mode 100644
index 000000000000..aa5945895222
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/normal/MethodMergingMinimalTail.java
@@ -0,0 +1,7 @@
+class Foo {
+ {
+ foo("someTestAttachment", "".getByt<caret>)
+ }
+
+ void foo(String s, byte[] z) {}
+} \ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completion/normal/MethodMergingMinimalTail_after.java b/java/java-tests/testData/codeInsight/completion/normal/MethodMergingMinimalTail_after.java
new file mode 100644
index 000000000000..a89e601edec6
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/normal/MethodMergingMinimalTail_after.java
@@ -0,0 +1,7 @@
+class Foo {
+ {
+ foo("someTestAttachment", "".getBytes(<caret>))
+ }
+
+ void foo(String s, byte[] z) {}
+} \ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completion/normal/SmartEnterNoNewLine.java b/java/java-tests/testData/codeInsight/completion/normal/SmartEnterNoNewLine.java
new file mode 100644
index 000000000000..49f9b65ec7b3
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/normal/SmartEnterNoNewLine.java
@@ -0,0 +1,9 @@
+
+class Tester {
+ private void build(EntityBuilder builder) {
+ }
+
+ public void test1(int abc, int abd) {
+ System.out.println(a<caret>);
+ }
+}
diff --git a/java/java-tests/testData/codeInsight/completion/normal/SmartEnterNoNewLine_after.java b/java/java-tests/testData/codeInsight/completion/normal/SmartEnterNoNewLine_after.java
new file mode 100644
index 000000000000..ce2b8956d9ac
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/normal/SmartEnterNoNewLine_after.java
@@ -0,0 +1,9 @@
+
+class Tester {
+ private void build(EntityBuilder builder) {
+ }
+
+ public void test1(int abc, int abd) {
+ System.out.println(abc);<caret>
+ }
+}
diff --git a/java/java-tests/testData/codeInsight/completion/normal/SmartEnterWithNewLine.java b/java/java-tests/testData/codeInsight/completion/normal/SmartEnterWithNewLine.java
new file mode 100644
index 000000000000..d21cac7e5efa
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/normal/SmartEnterWithNewLine.java
@@ -0,0 +1,9 @@
+
+class Tester {
+ private void build(EntityBuilder builder) {
+ }
+
+ public void test1(int abc, int abd) {
+ if(a<caret>)
+ }
+}
diff --git a/java/java-tests/testData/codeInsight/completion/normal/SmartEnterWithNewLine_after.java b/java/java-tests/testData/codeInsight/completion/normal/SmartEnterWithNewLine_after.java
new file mode 100644
index 000000000000..1b70dd9760a1
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/normal/SmartEnterWithNewLine_after.java
@@ -0,0 +1,11 @@
+
+class Tester {
+ private void build(EntityBuilder builder) {
+ }
+
+ public void test1(int abc, int abd) {
+ if (abc) {
+ <caret>
+ }
+ }
+}
diff --git a/java/java-tests/testData/codeInsight/completion/normal/UnimportedStaticInnerClass.java b/java/java-tests/testData/codeInsight/completion/normal/UnimportedStaticInnerClass.java
new file mode 100644
index 000000000000..4dcd4a5d770f
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/normal/UnimportedStaticInnerClass.java
@@ -0,0 +1,6 @@
+class Zoo {
+ void foo() {
+ new Super.I<caret>
+ }
+
+}
diff --git a/java/java-tests/testData/codeInsight/completion/normal/UnimportedStaticInnerClass_after.java b/java/java-tests/testData/codeInsight/completion/normal/UnimportedStaticInnerClass_after.java
new file mode 100644
index 000000000000..6db6912f48d2
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/normal/UnimportedStaticInnerClass_after.java
@@ -0,0 +1,8 @@
+import foo.Super;
+
+class Zoo {
+ void foo() {
+ new Super.Inner()<caret>
+ }
+
+}
diff --git a/java/java-tests/testData/codeInsight/completion/smartType/AutoImportExpectedType.java b/java/java-tests/testData/codeInsight/completion/smartType/AutoImportExpectedType.java
new file mode 100644
index 000000000000..e120ecb7bd2b
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/smartType/AutoImportExpectedType.java
@@ -0,0 +1,5 @@
+class Main<T extends Foo> {
+ {
+ List<Foo> list = new <caret>
+ }
+} \ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/annotations/typeAnnotations.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/annotations/typeAnnotations.java
index 28035c8c1698..01f7486ea89a 100644
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/annotations/typeAnnotations.java
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/annotations/typeAnnotations.java
@@ -114,6 +114,7 @@ class Outer {
void <error descr="Annotations are not allowed here">@TA</error> misplaced() { }
@TA Outer() { }
+ <T> <error descr="Annotations are not allowed here">@TA</error> Outer(T t) { }
class MyClass<@TA @TPA T> { }
interface MyInterface<@TA @TPA E> { }
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/mostSpecific/IDEA127584.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/mostSpecific/IDEA127584.java
new file mode 100644
index 000000000000..f1222505a708
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/mostSpecific/IDEA127584.java
@@ -0,0 +1,22 @@
+class Test {
+ public static <Tfoo, Vfoo> Future<Vfoo> foo(Future<Tfoo> future, Function<Tfoo, Vfoo> function) {
+ return future.map(function);
+ }
+
+ // These interfaces inspired by FoundationDB Java client class files
+ interface PartialFunction <TP, VP> {
+ VP apply(TP t) throws java.lang.Exception;
+ }
+
+ interface Function <TF, VF> extends PartialFunction<TF, VF> {
+ VF apply(TF t);
+ }
+
+ interface PartialFuture <TPP> {
+ <VPP> PartialFuture<VPP> map(PartialFunction<TPP, VPP> partialFunction);
+ }
+
+ interface Future <TFF> extends PartialFuture<TFF> {
+ <VFF> Future<VFF> map(Function<TFF, VFF> function);
+ }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IDEA127596.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IDEA127596.java
new file mode 100644
index 000000000000..20636674141b
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IDEA127596.java
@@ -0,0 +1,9 @@
+class Executor<E> {
+ <K> void bar(Executor<K> e) {
+ Runnable r = () -> foo(e);
+ }
+
+ private <T> T foo(final Executor<T> e) {
+ return null;
+ }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/IDEA126969.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/IDEA126969.java
new file mode 100644
index 000000000000..e981d28298b5
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/IDEA126969.java
@@ -0,0 +1,15 @@
+import java.util.Collection;
+import java.util.List;
+import java.util.stream.Stream;
+
+class IDEA126969 {
+ void foo(final Stream<List<Integer>> stream) {
+
+ stream.flatMap(List::stream)
+ .forEach(i -> System.out.println(i.floatValue()));
+
+ stream.flatMap(Collection::stream)
+ .forEach(i -> System.out.println(i.floatValue()));
+
+ }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/IDEA127506.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/IDEA127506.java
new file mode 100644
index 000000000000..7abf6ba9427a
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/IDEA127506.java
@@ -0,0 +1,24 @@
+import java.util.List;
+import java.util.Set;
+import java.util.stream.Stream;
+
+class Validator {
+ static boolean thereAreConstraintViolationsIn1(final Stream<Object> objectStream, Validator validator) {
+ Stream<Set<List<Object>>> rStream = objectStream
+ .map(validator::validate);
+ return rStream
+ .flatMap(set -> set.stream())
+ .findAny()
+ .isPresent();
+ }
+
+ static void thereAreConstraintViolationsIn(final Stream<Object> objectStream, Validator validator) {
+ Stream<Set<List<Object>>> rStream = objectStream.map(validator ::validate);
+
+ Stream<Set<List<Object>>> lStream = objectStream.map((a) -> validator.validate(a));
+ }
+
+ <T> Set<List<T>> validate(T var1, Class<?> ... var2) {
+ return null;
+ }
+} \ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addTypeCast/afterShortenFQNs.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addTypeCast/afterShortenFQNs.java
new file mode 100644
index 000000000000..9fea89ffa684
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addTypeCast/afterShortenFQNs.java
@@ -0,0 +1,10 @@
+import java.util.List;
+
+// "Cast parameter to 'java.util.List'" "true"
+class Test {
+ void m(Object o) {
+ foo((List) o);
+ }
+
+ private void foo(final java.util.List o) {}
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addTypeCast/beforeShortenFQNs.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addTypeCast/beforeShortenFQNs.java
new file mode 100644
index 000000000000..e53d8b1e6c31
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addTypeCast/beforeShortenFQNs.java
@@ -0,0 +1,8 @@
+// "Cast parameter to 'java.util.List'" "true"
+class Test {
+ void m(Object o) {
+ foo(<caret>o);
+ }
+
+ private void foo(final java.util.List o) {}
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/anonymous2lambda/beforeObjectInferredButIntExpected.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/anonymous2lambda/beforeObjectInferredButIntExpected.java
new file mode 100644
index 000000000000..3a82478ec678
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/anonymous2lambda/beforeObjectInferredButIntExpected.java
@@ -0,0 +1,16 @@
+// "Replace with lambda" "false"
+import java.util.function.Function;
+
+class Test {
+ void ab() {
+ comparing(new Func<caret>tion<Integer, String>() {
+ public String apply(Integer pObj) {
+ return Integer.toString(pObj);
+ }
+ });
+
+ }
+
+ static <T> void comparing(Function<T, String> keyExtractor){}
+
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/convert2Local/afterMultipleMethodsMultipleFields.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/convert2Local/afterMultipleMethodsMultipleFields.java
new file mode 100644
index 000000000000..9d1502b44bc0
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/convert2Local/afterMultipleMethodsMultipleFields.java
@@ -0,0 +1,17 @@
+// "Convert to local" "true"
+class MyClassTest {
+
+ private boolean editable = false;
+
+ boolean isEditable() {
+ return editable;
+ }
+
+ void setEditable(boolean editable) {
+ this.editable = editable;
+ }
+
+ public void setEditable1(final boolean editable1) {
+ boolean editable11 = editable1;
+ }
+} \ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/convert2Local/beforeMultipleMethodsMultipleFields.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/convert2Local/beforeMultipleMethodsMultipleFields.java
new file mode 100644
index 000000000000..4c6ead704f57
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/convert2Local/beforeMultipleMethodsMultipleFields.java
@@ -0,0 +1,18 @@
+// "Convert to local" "true"
+class MyClassTest {
+
+ private boolean editable = false;
+ private boolean edit<caret>able1 = false;
+
+ boolean isEditable() {
+ return editable;
+ }
+
+ void setEditable(boolean editable) {
+ this.editable = editable;
+ }
+
+ public void setEditable1(final boolean editable1) {
+ this.editable1 = editable1;
+ }
+} \ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/convert2Local/beforeMultipleMethodsOnReadOnly.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/convert2Local/beforeMultipleMethodsOnReadOnly.java
new file mode 100644
index 000000000000..db61483db9ad
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/convert2Local/beforeMultipleMethodsOnReadOnly.java
@@ -0,0 +1,18 @@
+// "Convert to local" "false"
+class MyClassTest {
+
+ private boolean edit<caret>able = false;
+ private boolean editable1 = false;
+
+ boolean isEditable() {
+ return editable;
+ }
+
+ void setEditable(boolean editable) {
+ this.editable = editable;
+ }
+
+ public void setEditable1(final boolean editable1) {
+ this.editable1 = editable1;
+ }
+} \ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createFieldFromUsage/beforeInsideInterface.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createFieldFromUsage/beforeInsideInterface.java
new file mode 100644
index 000000000000..74627f9409ee
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createFieldFromUsage/beforeInsideInterface.java
@@ -0,0 +1,7 @@
+// "Create Field 'myFoo'" "false"
+
+interface Test {
+ default String get() {
+ return my<caret>Foo;
+ }
+} \ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createMethodFromUsage/afterStaticInInterface.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createMethodFromUsage/afterStaticInInterface.java
new file mode 100644
index 000000000000..66a2b59a9a10
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createMethodFromUsage/afterStaticInInterface.java
@@ -0,0 +1,10 @@
+// "Create Method 'f'" "true"
+interface X {
+ public static void m() {
+ f();
+ }
+
+ static void f() {
+
+ }
+} \ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createMethodFromUsage/beforeStaticInInterface.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createMethodFromUsage/beforeStaticInInterface.java
new file mode 100644
index 000000000000..81afbe358fbe
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createMethodFromUsage/beforeStaticInInterface.java
@@ -0,0 +1,6 @@
+// "Create Method 'f'" "true"
+interface X {
+ public static void m() {
+ f<caret>();
+ }
+} \ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/lambda2methodReference/afterAmbiguityWithoutSuperMethods.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/lambda2methodReference/afterAmbiguityWithoutSuperMethods.java
new file mode 100644
index 000000000000..54310c8da75f
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/lambda2methodReference/afterAmbiguityWithoutSuperMethods.java
@@ -0,0 +1,11 @@
+// "Replace lambda with method reference" "true"
+import java.io.PrintStream;
+import java.util.function.BiConsumer;
+
+class Test {
+ {
+ BiConsumer<PrintStream, String> printer = PrintStream::println;
+ }
+
+
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/lambda2methodReference/beforeAmbiguityWithoutSuperMethods.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/lambda2methodReference/beforeAmbiguityWithoutSuperMethods.java
new file mode 100644
index 000000000000..7c68e5ec9fbc
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/lambda2methodReference/beforeAmbiguityWithoutSuperMethods.java
@@ -0,0 +1,11 @@
+// "Replace lambda with method reference" "true"
+import java.io.PrintStream;
+import java.util.function.BiConsumer;
+
+class Test {
+ {
+ BiConsumer<PrintStream, String> printer = (printStream, x) -> printSt<caret>ream.println(x);
+ }
+
+
+}
diff --git a/java/java-tests/testData/codeInsight/javadocIG/annotationsInParams.html b/java/java-tests/testData/codeInsight/javadocIG/annotationsInParams.html
new file mode 100644
index 000000000000..c9b08d63be93
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/javadocIG/annotationsInParams.html
@@ -0,0 +1,2 @@
+<html><head> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } p { margin: 5px 0; } </style></head><body><small><b><a href="psi_element://Test"><code>Test</code></a></b></small><PRE>public&nbsp;void&nbsp;<b>foo</b>(@<a href="psi_element://java.lang.Deprecated"><code>Deprecated</code></a>&nbsp;<a href="psi_element://java.lang.String"><code>String</code></a>&nbsp;s,
+ @<a href="psi_element://java.lang.Deprecated"><code>Deprecated</code></a>&nbsp;<a href="psi_element://java.lang.String"><code>String</code></a>&nbsp;p)</PRE></body></html> \ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/javadocIG/annotationsInParams.java b/java/java-tests/testData/codeInsight/javadocIG/annotationsInParams.java
new file mode 100644
index 000000000000..676ff2d3e7cc
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/javadocIG/annotationsInParams.java
@@ -0,0 +1,4 @@
+class Test {
+ public void foo(@Deprecated String s,
+ @Deprecated String p){}
+} \ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/javadocIG/pInsidePre.html b/java/java-tests/testData/codeInsight/javadocIG/pInsidePre.html
new file mode 100644
index 000000000000..fbfd2983208a
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/javadocIG/pInsidePre.html
@@ -0,0 +1,6 @@
+<html><head> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } p { margin: 5px 0; } </style></head><body><small><b><a href="psi_element://Test"><code>Test</code></a></b></small><PRE>public <a href="psi_element://java.lang.String"><code>String</code></a> <b>field = null</b></PRE>
+ <pre>
+ foo
+ <p></p>
+ bar
+ </pre></body></html> \ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/javadocIG/pInsidePre.java b/java/java-tests/testData/codeInsight/javadocIG/pInsidePre.java
new file mode 100644
index 000000000000..0627e4b99510
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/javadocIG/pInsidePre.java
@@ -0,0 +1,10 @@
+class Test {
+ /**
+ * <pre>
+ * foo
+ * <p/>
+ * bar
+ * </pre>
+ */
+ public String field = null;
+} \ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/nullityinferrer/afterMethodReturnValue.java b/java/java-tests/testData/codeInsight/nullityinferrer/afterMethodReturnValue.java
index 6ae0b5b7994f..6503f431ec28 100644
--- a/java/java-tests/testData/codeInsight/nullityinferrer/afterMethodReturnValue.java
+++ b/java/java-tests/testData/codeInsight/nullityinferrer/afterMethodReturnValue.java
@@ -15,6 +15,7 @@ class Test {
return s;
}
+ @NotNull
String foo4(@NotNull String s) {
return s.substring(0);
}
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/cast/ternary.java b/java/java-tests/testData/codeInsight/template/postfix/templates/cast/ternary.java
new file mode 100644
index 000000000000..0e0ff3741921
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/cast/ternary.java
@@ -0,0 +1,5 @@
+public class Foo {
+ void m(String s) {
+ Object o = s.isEmpty() ? s.concat("a").cast<caret> : s.concat("b");
+ }
+} \ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/cast/ternary_after.java b/java/java-tests/testData/codeInsight/template/postfix/templates/cast/ternary_after.java
new file mode 100644
index 000000000000..486e88ba2dc3
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/cast/ternary_after.java
@@ -0,0 +1,5 @@
+public class Foo {
+ void m(String s) {
+ Object o = s.isEmpty() ? (() s.concat("a")) : s.concat("b");
+ }
+} \ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/typing/columnMode_after.java b/java/java-tests/testData/codeInsight/typing/columnMode_after.java
new file mode 100644
index 000000000000..78c14369ab56
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/typing/columnMode_after.java
@@ -0,0 +1,5 @@
+class Foo {
+ void m() {
+ System.exit(<caret>)
+ }
+} \ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/typing/columnMode_before.java b/java/java-tests/testData/codeInsight/typing/columnMode_before.java
new file mode 100644
index 000000000000..ba4c1bfa09ff
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/typing/columnMode_before.java
@@ -0,0 +1,5 @@
+class Foo {
+ void m() {
+ System.exit<caret>
+ }
+} \ No newline at end of file
diff --git a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/awt/annotations.xml b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/awt/annotations.xml
new file mode 100644
index 000000000000..0314b02a4d7b
--- /dev/null
+++ b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/awt/annotations.xml
@@ -0,0 +1,345 @@
+<root>
+ <item name="java.awt.Component boolean action(java.awt.Event, java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_-&gt;false;_,!null-&gt;false;_,null-&gt;false;null,_-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.awt.Component boolean contains(java.awt.Point) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.awt.Component boolean dispatchMouseWheelToAncestor(java.awt.event.MouseWheelEvent) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.awt.Component boolean dispatchMouseWheelToAncestor(java.awt.event.MouseWheelEvent)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;true&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.awt.Component boolean eventEnabled(java.awt.AWTEvent) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.awt.Component boolean gotFocus(java.awt.Event, java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_-&gt;false;_,!null-&gt;false;_,null-&gt;false;null,_-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.awt.Component boolean handleEvent(java.awt.Event) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.awt.Component boolean keyDown(java.awt.Event, int)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_-&gt;false;null,_-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.awt.Component boolean keyUp(java.awt.Event, int)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_-&gt;false;null,_-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.awt.Component boolean lostFocus(java.awt.Event, java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_-&gt;false;_,!null-&gt;false;_,null-&gt;false;null,_-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.awt.Component boolean mouseDown(java.awt.Event, int, int)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_,_-&gt;false;null,_,_-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.awt.Component boolean mouseDrag(java.awt.Event, int, int)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_,_-&gt;false;null,_,_-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.awt.Component boolean mouseEnter(java.awt.Event, int, int)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_,_-&gt;false;null,_,_-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.awt.Component boolean mouseExit(java.awt.Event, int, int)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_,_-&gt;false;null,_,_-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.awt.Component boolean mouseMove(java.awt.Event, int, int)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_,_-&gt;false;null,_,_-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.awt.Component boolean mouseUp(java.awt.Event, int, int)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_,_-&gt;false;null,_,_-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.awt.Component boolean postEvent(java.awt.Event) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.awt.Component java.awt.AWTEvent coalesceEvents(java.awt.AWTEvent, java.awt.AWTEvent) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.awt.Component java.awt.AWTEvent coalesceEvents(java.awt.AWTEvent, java.awt.AWTEvent)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.awt.Component java.awt.Component findUnderMouseInWindow(java.awt.PointerInfo)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.awt.Component java.awt.Component getComponentAt(java.awt.Point) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.awt.Component java.awt.Dimension getMaximumSize()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.awt.Component java.awt.Dimension getSize(java.awt.Dimension)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;!null;null-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.awt.Component java.awt.Dimension minimumSize()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.awt.Component java.awt.Dimension preferredSize()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.awt.Component java.awt.Dimension size()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.awt.Component java.awt.Point getLocation(java.awt.Point)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;!null;null-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.awt.Component java.awt.Point location()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.awt.Component java.awt.Point pointRelativeToComponent(java.awt.Point) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.awt.Component java.awt.Point pointRelativeToComponent(java.awt.Point)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.awt.Component java.awt.Rectangle bounds()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.awt.Component java.awt.Rectangle getBounds(java.awt.Rectangle)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;!null;null-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.awt.Component java.awt.Window getContainingWindow(java.awt.Component)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.awt.Component java.lang.String paramString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.awt.Component java.lang.String toString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.awt.Component javax.accessibility.AccessibleStateSet getAccessibleStateSet()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.awt.Component void add(java.awt.PopupMenu) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.awt.Component void applyComponentOrientation(java.awt.ComponentOrientation) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.awt.Component void createBufferStrategy(int, java.awt.BufferCapabilities) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.awt.Component void dispatchEventImpl(java.awt.AWTEvent) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.awt.Component void list(java.io.PrintStream, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.awt.Component void list(java.io.PrintWriter, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.awt.Component void readObject(java.io.ObjectInputStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.awt.Component void resize(java.awt.Dimension) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.awt.Component void setBounds(java.awt.Rectangle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.awt.Component void setLocation(java.awt.Point) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.awt.Component void writeObject(java.io.ObjectOutputStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.awt.Component.FlipBufferStrategy FlipBufferStrategy(java.awt.Component, int, java.awt.BufferCapabilities) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.awt.Component.FlipBufferStrategy void createBuffers(int, java.awt.BufferCapabilities) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.awt.Container boolean eventEnabled(java.awt.AWTEvent) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.awt.Container boolean isAncestorOf(java.awt.Component)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.awt.Container boolean isRemoveNotifyNeeded(java.awt.Component, java.awt.Container, java.awt.Container)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,_,null-&gt;false;_,null,_-&gt;false;null,_,_-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.awt.Container java.awt.Component add(java.awt.Component)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;!null;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.awt.Container java.awt.Component add(java.awt.Component, int)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_-&gt;!null;null,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.awt.Container java.awt.Component add(java.lang.String, java.awt.Component)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,!null-&gt;!null;_,null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.awt.Container java.awt.Component findComponentAt(java.awt.Point) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.awt.Container java.awt.Component getComponentAt(java.awt.Point) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.awt.Container java.awt.Component[] getComponents()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.awt.Container java.awt.Component[] getComponents_NoClientCode()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.awt.Container java.lang.String paramString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.awt.Container void addDelicately(java.awt.Component, java.awt.Container, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.awt.Container void addImpl(java.awt.Component, java.lang.Object, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.awt.Container void applyComponentOrientation(java.awt.ComponentOrientation) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.awt.Container void checkAdding(java.awt.Component, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.awt.Container void deliverEvent(java.awt.Event) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.awt.Container void dispatchEventImpl(java.awt.AWTEvent) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.awt.Container void dispatchEventToSelf(java.awt.AWTEvent) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.awt.Container void list(java.io.PrintStream, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.awt.Container void list(java.io.PrintWriter, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.awt.Container void readObject(java.io.ObjectInputStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.awt.Container void remove(java.awt.Component) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.awt.Container void removeDelicately(java.awt.Component, java.awt.Container, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.awt.Container void reparentTraverse(java.awt.peer.ContainerPeer, java.awt.Container) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.awt.Container void setComponentZOrder(java.awt.Component, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.awt.Container void writeObject(java.io.ObjectOutputStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.awt.Dimension Dimension(java.awt.Dimension) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.awt.Dimension boolean equals(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.awt.Dimension java.awt.Dimension getSize()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.awt.Dimension java.lang.String toString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.awt.Dimension void setSize(java.awt.Dimension) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.awt.Frame java.lang.String constructComponentName()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.awt.Frame void readObject(java.io.ObjectInputStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.awt.Frame void writeObject(java.io.ObjectOutputStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.awt.Window Window(java.awt.Frame) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.awt.Window Window(java.awt.Window) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.awt.Window Window(java.awt.Window, java.awt.GraphicsConfiguration) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.awt.Window boolean dispatchMouseWheelToAncestor(java.awt.event.MouseWheelEvent)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;false;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.awt.Window boolean eventEnabled(java.awt.AWTEvent) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.awt.Window boolean postEvent(java.awt.Event)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.awt.Window java.lang.Object access$000(java.awt.Window) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.awt.Window java.lang.String constructComponentName()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.awt.Window void connectOwnedWindow(java.awt.Window) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.awt.Window void dispatchEventImpl(java.awt.AWTEvent) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.awt.Window void ownedInit(java.awt.Window) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.awt.Window void preProcessKeyEvent(java.awt.event.KeyEvent) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.awt.Window void readObject(java.io.ObjectInputStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.awt.Window void writeObject(java.io.ObjectOutputStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+</root>
diff --git a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/awt/event/annotations.xml b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/awt/event/annotations.xml
new file mode 100644
index 000000000000..7b9c87e9eb3f
--- /dev/null
+++ b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/awt/event/annotations.xml
@@ -0,0 +1,5 @@
+<root>
+ <item name="java.awt.event.ActionEvent java.lang.String paramString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+</root>
diff --git a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/beans/beancontext/annotations.xml b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/beans/beancontext/annotations.xml
new file mode 100644
index 000000000000..60214de88d04
--- /dev/null
+++ b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/beans/beancontext/annotations.xml
@@ -0,0 +1,79 @@
+<root>
+ <item name="java.beans.beancontext.BeanContextServicesSupport boolean addService(java.lang.Class, java.beans.beancontext.BeanContextServiceProvider, boolean) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.beans.beancontext.BeanContextServicesSupport boolean addService(java.lang.Class, java.beans.beancontext.BeanContextServiceProvider, boolean) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.beans.beancontext.BeanContextServicesSupport boolean hasService(java.lang.Class) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.beans.beancontext.BeanContextServicesSupport java.beans.beancontext.BeanContextServicesListener getChildBeanContextServicesListener(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.beans.beancontext.BeanContextServicesSupport java.beans.beancontext.BeanContextServicesSupport.BCSSServiceProvider createBCSSServiceProvider(java.lang.Class, java.beans.beancontext.BeanContextServiceProvider)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.beans.beancontext.BeanContextServicesSupport java.beans.beancontext.BeanContextSupport.BCSChild createBCSChild(java.lang.Object, java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.beans.beancontext.BeanContextServicesSupport java.lang.Object getService(java.beans.beancontext.BeanContextChild, java.lang.Object, java.lang.Class, java.lang.Object, java.beans.beancontext.BeanContextServiceRevokedListener) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.beans.beancontext.BeanContextServicesSupport java.lang.Object getService(java.beans.beancontext.BeanContextChild, java.lang.Object, java.lang.Class, java.lang.Object, java.beans.beancontext.BeanContextServiceRevokedListener) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.beans.beancontext.BeanContextServicesSupport java.lang.Object getService(java.beans.beancontext.BeanContextChild, java.lang.Object, java.lang.Class, java.lang.Object, java.beans.beancontext.BeanContextServiceRevokedListener) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.beans.beancontext.BeanContextServicesSupport java.lang.Object getService(java.beans.beancontext.BeanContextChild, java.lang.Object, java.lang.Class, java.lang.Object, java.beans.beancontext.BeanContextServiceRevokedListener) 4">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.beans.beancontext.BeanContextServicesSupport java.util.Iterator getCurrentServiceClasses()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.beans.beancontext.BeanContextServicesSupport void addBeanContextServicesListener(java.beans.beancontext.BeanContextServicesListener) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.beans.beancontext.BeanContextServicesSupport void bcsPreDeserializationHook(java.io.ObjectInputStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.beans.beancontext.BeanContextServicesSupport void bcsPreSerializationHook(java.io.ObjectOutputStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.beans.beancontext.BeanContextServicesSupport void childJustRemovedHook(java.lang.Object, java.beans.beancontext.BeanContextSupport.BCSChild) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.beans.beancontext.BeanContextServicesSupport void readObject(java.io.ObjectInputStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.beans.beancontext.BeanContextServicesSupport void releaseService(java.beans.beancontext.BeanContextChild, java.lang.Object, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.beans.beancontext.BeanContextServicesSupport void releaseService(java.beans.beancontext.BeanContextChild, java.lang.Object, java.lang.Object) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.beans.beancontext.BeanContextServicesSupport void releaseService(java.beans.beancontext.BeanContextChild, java.lang.Object, java.lang.Object) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.beans.beancontext.BeanContextServicesSupport void removeBeanContextServicesListener(java.beans.beancontext.BeanContextServicesListener) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.beans.beancontext.BeanContextServicesSupport void revokeService(java.lang.Class, java.beans.beancontext.BeanContextServiceProvider, boolean) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.beans.beancontext.BeanContextServicesSupport void revokeService(java.lang.Class, java.beans.beancontext.BeanContextServiceProvider, boolean) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.beans.beancontext.BeanContextServicesSupport void serviceAvailable(java.beans.beancontext.BeanContextServiceAvailableEvent) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.beans.beancontext.BeanContextServicesSupport void serviceRevoked(java.beans.beancontext.BeanContextServiceRevokedEvent) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.beans.beancontext.BeanContextServicesSupport void writeObject(java.io.ObjectOutputStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+</root>
diff --git a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/io/annotations.xml b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/io/annotations.xml
new file mode 100644
index 000000000000..868b0f3f11c0
--- /dev/null
+++ b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/io/annotations.xml
@@ -0,0 +1,395 @@
+<root>
+ <item name="java.io.BufferedInputStream int read(byte[], int, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.BufferedReader BufferedReader(java.io.Reader) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.BufferedReader BufferedReader(java.io.Reader, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.BufferedReader int read(char[], int, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.BufferedWriter BufferedWriter(java.io.Writer) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.BufferedWriter BufferedWriter(java.io.Writer, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.BufferedWriter void write(char[], int, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.ByteArrayInputStream ByteArrayInputStream(byte[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.ByteArrayInputStream ByteArrayInputStream(byte[], int, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.ByteArrayInputStream int read(byte[], int, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.ByteArrayOutputStream java.lang.String toString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.ByteArrayOutputStream java.lang.String toString(int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.ByteArrayOutputStream java.lang.String toString(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.ByteArrayOutputStream java.lang.String toString(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.ByteArrayOutputStream void write(byte[], int, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.ByteArrayOutputStream void writeTo(java.io.OutputStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.DataInputStream int read(byte[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.DataInputStream java.lang.String readUTF()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.DataInputStream java.lang.String readUTF(java.io.DataInput) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.DataInputStream java.lang.String readUTF(java.io.DataInput)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.DataInputStream void readFully(byte[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.File File(java.io.File, java.lang.String) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.File File(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.File File(java.lang.String, java.io.File) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.File File(java.lang.String, java.lang.String) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.File File(java.net.URI) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.File boolean equals(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.io.File java.io.File createTempFile(java.lang.String, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.File java.io.File createTempFile(java.lang.String, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.File java.io.File createTempFile(java.lang.String, java.lang.String, java.io.File) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.File java.io.File createTempFile(java.lang.String, java.lang.String, java.io.File)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.File java.io.File generateFile(java.lang.String, java.lang.String, java.io.File)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.File java.io.File getAbsoluteFile()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.File java.io.File getCanonicalFile()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.File java.lang.String getName()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.File java.lang.String slashify(java.lang.String, boolean) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.File java.net.URI toURI()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.File java.net.URL toURL()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.File void readObject(java.io.ObjectInputStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.File void writeObject(java.io.ObjectOutputStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.FileInputStream FileInputStream(java.io.FileDescriptor) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.FileInputStream int read(byte[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.FileOutputStream FileOutputStream(java.io.FileDescriptor) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.FileOutputStream void write(byte[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.FileReader FileReader(java.io.FileDescriptor) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.FileWriter FileWriter(java.io.FileDescriptor) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.FilterOutputStream void write(byte[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.FilterOutputStream void write(byte[], int, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.InputStream int read(byte[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.InputStream int read(byte[], int, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.InputStreamReader InputStreamReader(java.io.InputStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.InputStreamReader InputStreamReader(java.io.InputStream, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.InputStreamReader InputStreamReader(java.io.InputStream, java.lang.String) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.InputStreamReader InputStreamReader(java.io.InputStream, java.nio.charset.Charset) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.InputStreamReader InputStreamReader(java.io.InputStream, java.nio.charset.Charset) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.InputStreamReader InputStreamReader(java.io.InputStream, java.nio.charset.CharsetDecoder) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.InputStreamReader InputStreamReader(java.io.InputStream, java.nio.charset.CharsetDecoder) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.ObjectInputStream boolean access$400(java.io.ObjectInputStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.ObjectInputStream int access$000(java.io.ObjectInputStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.ObjectInputStream int access$002(java.io.ObjectInputStream, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.ObjectInputStream int read(byte[], int, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.ObjectInputStream java.io.ObjectInputStream.BlockDataInputStream access$200(java.io.ObjectInputStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.ObjectInputStream java.io.ObjectInputStream.HandleTable access$100(java.io.ObjectInputStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.ObjectInputStream java.io.ObjectStreamClass readClassDescriptor()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.ObjectInputStream java.io.ObjectStreamClass readNonProxyDesc(boolean)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.ObjectInputStream java.lang.Class resolveClass(java.io.ObjectStreamClass) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.ObjectInputStream java.lang.Class resolveProxyClass(java.lang.String[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.ObjectInputStream java.lang.Object access$300(java.io.ObjectInputStream, boolean) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.ObjectInputStream java.lang.Object resolveObject(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;!null;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.io.ObjectInputStream void access$500(java.io.ObjectInputStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.ObjectInputStream void defaultReadFields(java.lang.Object, java.io.ObjectStreamClass) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.ObjectInputStream void readExternalData(java.io.Externalizable, java.io.ObjectStreamClass) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.ObjectInputStream void readFully(byte[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.ObjectInputStream void readFully(byte[], int, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.ObjectInputStream void readSerialData(java.lang.Object, java.io.ObjectStreamClass) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.ObjectOutputStream java.io.ObjectOutputStream.BlockDataOutputStream access$000(java.io.ObjectOutputStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.ObjectOutputStream java.lang.Object replaceObject(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;!null;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.io.ObjectOutputStream void access$100(java.io.ObjectOutputStream, java.lang.Object, boolean) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.ObjectOutputStream void defaultWriteFields(java.lang.Object, java.io.ObjectStreamClass) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.ObjectOutputStream void write(byte[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.ObjectOutputStream void write(byte[], int, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.ObjectOutputStream void writeArray(java.lang.Object, java.io.ObjectStreamClass, boolean) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.ObjectOutputStream void writeArray(java.lang.Object, java.io.ObjectStreamClass, boolean) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.ObjectOutputStream void writeClassDescriptor(java.io.ObjectStreamClass) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.ObjectOutputStream void writeEnum(java.lang.Enum, java.io.ObjectStreamClass, boolean) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.ObjectOutputStream void writeEnum(java.lang.Enum, java.io.ObjectStreamClass, boolean) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.ObjectOutputStream void writeExternalData(java.io.Externalizable) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.ObjectOutputStream void writeNonProxyDesc(java.io.ObjectStreamClass, boolean) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.ObjectOutputStream void writeOrdinaryObject(java.lang.Object, java.io.ObjectStreamClass, boolean) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.ObjectOutputStream void writeProxyDesc(java.io.ObjectStreamClass, boolean) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.ObjectOutputStream void writeSerialData(java.lang.Object, java.io.ObjectStreamClass) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.OutputStream void write(byte[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.OutputStream void write(byte[], int, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.OutputStreamWriter OutputStreamWriter(java.io.OutputStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.OutputStreamWriter OutputStreamWriter(java.io.OutputStream, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.OutputStreamWriter OutputStreamWriter(java.io.OutputStream, java.lang.String) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.OutputStreamWriter OutputStreamWriter(java.io.OutputStream, java.nio.charset.Charset) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.OutputStreamWriter OutputStreamWriter(java.io.OutputStream, java.nio.charset.Charset) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.OutputStreamWriter OutputStreamWriter(java.io.OutputStream, java.nio.charset.CharsetEncoder) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.OutputStreamWriter OutputStreamWriter(java.io.OutputStream, java.nio.charset.CharsetEncoder) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.PrintStream PrintStream(boolean, java.io.OutputStream) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.PrintStream PrintStream(java.io.File, java.lang.String) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.PrintStream PrintStream(java.io.OutputStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.PrintStream PrintStream(java.io.OutputStream, boolean) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.PrintStream PrintStream(java.io.OutputStream, boolean, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.PrintStream PrintStream(java.io.OutputStream, boolean, java.lang.String) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.PrintStream PrintStream(java.lang.String, java.lang.String) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.PrintStream java.io.PrintStream append(char)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.PrintStream java.io.PrintStream append(java.lang.CharSequence)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.PrintStream java.io.PrintStream append(java.lang.CharSequence, int, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.PrintStream void init(java.io.OutputStreamWriter) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.RandomAccessFile RandomAccessFile(java.io.File, java.lang.String) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.RandomAccessFile RandomAccessFile(java.lang.String, java.lang.String) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.RandomAccessFile int read(byte[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.RandomAccessFile java.lang.String readUTF()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.RandomAccessFile void readFully(byte[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.RandomAccessFile void write(byte[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.RandomAccessFile void writeBytes(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.RandomAccessFile void writeChars(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.Reader Reader(java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.Reader int read(char[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.Reader int read(java.nio.CharBuffer) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.Writer Writer(java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.Writer java.io.Writer append(char)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.Writer java.io.Writer append(java.lang.CharSequence)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.Writer java.io.Writer append(java.lang.CharSequence, int, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.Writer void write(char[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.Writer void write(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.io.Writer void write(java.lang.String, int, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+</root>
diff --git a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/lang/annotation/annotations.xml b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/lang/annotation/annotations.xml
new file mode 100644
index 000000000000..21d29c1ed4df
--- /dev/null
+++ b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/lang/annotation/annotations.xml
@@ -0,0 +1,5 @@
+<root>
+ <item name="java.lang.annotation.IncompleteAnnotationException IncompleteAnnotationException(java.lang.Class&lt;? extends java.lang.annotation.Annotation&gt;, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+</root>
diff --git a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/lang/annotations.xml b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/lang/annotations.xml
new file mode 100644
index 000000000000..8d157485ada1
--- /dev/null
+++ b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/lang/annotations.xml
@@ -0,0 +1,1347 @@
+<root>
+ <item name="java.lang.AbstractStringBuilder int indexOf(java.lang.String, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.AbstractStringBuilder int lastIndexOf(java.lang.String, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.AbstractStringBuilder java.lang.AbstractStringBuilder append(boolean)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.AbstractStringBuilder java.lang.AbstractStringBuilder append(char)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.AbstractStringBuilder java.lang.AbstractStringBuilder append(char[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.AbstractStringBuilder java.lang.AbstractStringBuilder append(char[])">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.AbstractStringBuilder java.lang.AbstractStringBuilder append(char[], int, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.AbstractStringBuilder java.lang.AbstractStringBuilder append(double)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.AbstractStringBuilder java.lang.AbstractStringBuilder append(float)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.AbstractStringBuilder java.lang.AbstractStringBuilder append(int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.AbstractStringBuilder java.lang.AbstractStringBuilder append(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.AbstractStringBuilder java.lang.AbstractStringBuilder append(java.lang.StringBuffer)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.lang.AbstractStringBuilder java.lang.AbstractStringBuilder append(long)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.AbstractStringBuilder java.lang.AbstractStringBuilder appendCodePoint(int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.AbstractStringBuilder java.lang.AbstractStringBuilder delete(int, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.AbstractStringBuilder java.lang.AbstractStringBuilder deleteCharAt(int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.AbstractStringBuilder java.lang.AbstractStringBuilder insert(int, char)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.AbstractStringBuilder java.lang.AbstractStringBuilder insert(int, char[]) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.AbstractStringBuilder java.lang.AbstractStringBuilder insert(int, char[])">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.AbstractStringBuilder java.lang.AbstractStringBuilder insert(int, char[], int, int) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.AbstractStringBuilder java.lang.AbstractStringBuilder insert(int, char[], int, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.AbstractStringBuilder java.lang.AbstractStringBuilder insert(int, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.AbstractStringBuilder java.lang.AbstractStringBuilder replace(int, int, java.lang.String) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.AbstractStringBuilder java.lang.AbstractStringBuilder replace(int, int, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.AbstractStringBuilder java.lang.String substring(int, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Boolean boolean equals(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.lang.Boolean boolean parseBoolean(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.lang.Boolean boolean toBoolean(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.lang.Boolean int compareTo(java.lang.Boolean) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Boolean int compareTo(java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Boolean java.lang.String toString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Boolean java.lang.String toString(boolean)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Byte Byte(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Byte boolean equals(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.lang.Byte byte parseByte(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Byte byte parseByte(java.lang.String, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Byte int compareTo(java.lang.Byte) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Byte int compareTo(java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Byte java.lang.Byte decode(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Byte java.lang.Byte decode(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Byte java.lang.Byte valueOf(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Byte java.lang.Byte valueOf(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Byte java.lang.Byte valueOf(java.lang.String, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Byte java.lang.Byte valueOf(java.lang.String, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Byte java.lang.String toString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Byte java.lang.String toString(byte)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Character boolean equals(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.lang.Character char[] toChars(int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Character int codePointAt(char[], int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Character int codePointAt(java.lang.CharSequence, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Character int codePointBefore(char[], int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Character int codePointBefore(java.lang.CharSequence, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Character int compareTo(java.lang.Character) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Character int compareTo(java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Character int toChars(int, char[], int) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Character java.lang.Character valueOf(char)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Character java.lang.String toString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Character java.lang.String toString(char)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Character void toSurrogates(int, char[], int) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Class A getAnnotation(java.lang.Class&lt;A&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Class T cast(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;!null;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.lang.Class boolean access$202(boolean)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;false-&gt;false;true-&gt;true&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.lang.Class boolean access$302(boolean)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;false-&gt;false;true-&gt;true&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.lang.Class boolean isAnnotationPresent(java.lang.Class&lt;? extends java.lang.annotation.Annotation&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Class java.lang.Class toClass(java.lang.reflect.Type)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.lang.Class java.lang.Class&lt;? extends U&gt; asSubclass(java.lang.Class&lt;U&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Class java.lang.Class&lt;? extends U&gt; asSubclass(java.lang.Class&lt;U&gt;)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Class java.lang.String argumentTypesToString(java.lang.Class[])">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Class java.lang.String getSimpleName()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Class java.lang.String resolveName(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;!null;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.lang.Class java.lang.String toString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Class java.lang.reflect.Constructor[] copyConstructors(java.lang.reflect.Constructor[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Class java.lang.reflect.Field getDeclaredField(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Class java.lang.reflect.Field getField(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Class java.lang.reflect.Field getField0(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Class java.lang.reflect.Field searchFields(java.lang.reflect.Field[], java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Class java.lang.reflect.Field searchFields(java.lang.reflect.Field[], java.lang.String) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Class java.lang.reflect.Field[] copyFields(java.lang.reflect.Field[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Class java.lang.reflect.Method getDeclaredMethod(java.lang.String, java.lang.Class...) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Class java.lang.reflect.Method getMethod(java.lang.String, java.lang.Class...) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Class java.lang.reflect.Method getMethod0(java.lang.String, java.lang.Class[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Class java.lang.reflect.Method searchMethods(java.lang.reflect.Method[], java.lang.String, java.lang.Class[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Class java.lang.reflect.Method searchMethods(java.lang.reflect.Method[], java.lang.String, java.lang.Class[]) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Class java.lang.reflect.Method[] copyMethods(java.lang.reflect.Method[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Class void addAll(java.util.Collection, java.lang.reflect.Field[]) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.ClassLoader boolean compareCerts(java.security.cert.Certificate[], java.security.cert.Certificate[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.ClassLoader boolean loadLibrary0(java.lang.Class, java.io.File)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.lang.ClassLoader java.lang.Package definePackage(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.net.URL)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.ClassLoader java.lang.String findLibrary(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;null;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.lang.ClassLoader java.lang.String[] initializePath(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.ClassLoader java.net.URL findResource(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;null;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.lang.ClassLoader java.util.Enumeration findResources(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.ClassLoader java.util.Enumeration getBootstrapResources(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.ClassLoader java.util.Enumeration getResources(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.ClassLoader java.util.Enumeration getSystemResources(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.ClassLoader void checkCerts(java.lang.String, java.security.CodeSource) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.ClassLoader void setSigners(java.lang.Class, java.lang.Object[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Double boolean equals(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.lang.Double int compareTo(java.lang.Double) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Double int compareTo(java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Double java.lang.Double valueOf(double)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Double java.lang.Double valueOf(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Enum T valueOf(java.lang.Class&lt;T&gt;, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Enum int compareTo(E) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Enum int compareTo(java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Float boolean equals(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.lang.Float int compareTo(java.lang.Float) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Float int compareTo(java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Float java.lang.Float valueOf(float)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Float java.lang.Float valueOf(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Integer Integer(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Integer boolean equals(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.lang.Integer int compareTo(java.lang.Integer) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Integer int compareTo(java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Integer int parseInt(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Integer int parseInt(java.lang.String, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Integer java.lang.Integer decode(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Integer java.lang.Integer decode(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Integer java.lang.Integer getInteger(java.lang.String, java.lang.Integer)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,!null-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.lang.Integer java.lang.Integer valueOf(int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Integer java.lang.Integer valueOf(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Integer java.lang.Integer valueOf(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Integer java.lang.Integer valueOf(java.lang.String, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Integer java.lang.Integer valueOf(java.lang.String, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Integer java.lang.String toBinaryString(int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Integer java.lang.String toHexString(int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Integer java.lang.String toOctalString(int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Integer java.lang.String toString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Integer java.lang.String toString(int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Integer java.lang.String toString(int, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Integer java.lang.String toUnsignedString(int, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Integer void getChars(int, int, char[]) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Long Long(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Long boolean equals(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.lang.Long int compareTo(java.lang.Long) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Long int compareTo(java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Long java.lang.Long decode(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Long java.lang.Long decode(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Long java.lang.Long getLong(java.lang.String, java.lang.Long)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,!null-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.lang.Long java.lang.Long valueOf(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Long java.lang.Long valueOf(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Long java.lang.Long valueOf(java.lang.String, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Long java.lang.Long valueOf(java.lang.String, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Long java.lang.String toBinaryString(long)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Long java.lang.String toHexString(long)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Long java.lang.String toOctalString(long)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Long java.lang.String toString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Long java.lang.String toString(long)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Long java.lang.String toString(long, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Long java.lang.String toUnsignedString(long, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Long long parseLong(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Long long parseLong(java.lang.String, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Long void getChars(long, int, char[]) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.NumberFormatException java.lang.NumberFormatException forInputString(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Object java.lang.String toString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Short Short(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Short boolean equals(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.lang.Short int compareTo(java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Short int compareTo(java.lang.Short) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Short java.lang.Short decode(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Short java.lang.Short decode(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Short java.lang.Short valueOf(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Short java.lang.Short valueOf(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Short java.lang.Short valueOf(java.lang.String, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Short java.lang.Short valueOf(java.lang.String, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Short java.lang.Short valueOf(short)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Short java.lang.String toString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Short java.lang.String toString(short)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Short short parseShort(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Short short parseShort(java.lang.String, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.String String(byte[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.String String(byte[], int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.String String(byte[], int, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.String String(byte[], int, int, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.String String(byte[], int, int, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.String String(byte[], int, int, java.lang.String) 3">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.String String(byte[], java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.String String(byte[], java.lang.String) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.String String(char[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.String String(char[], int, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.String String(int[], int, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.String String(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.String String(java.lang.StringBuffer) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.String String(java.lang.StringBuilder) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.String boolean contains(java.lang.CharSequence) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.String boolean contentEquals(java.lang.CharSequence) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.String boolean contentEquals(java.lang.StringBuffer) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.String boolean endsWith(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.String boolean regionMatches(boolean, int, java.lang.String, int, int) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.String boolean regionMatches(int, java.lang.String, int, int) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.String boolean startsWith(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.String boolean startsWith(java.lang.String, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.String byte[] getBytes(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.String char[] toCharArray()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.String int compareTo(java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.String int compareTo(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.String int indexOf(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.String int indexOf(java.lang.String, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.String int lastIndexOf(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.String int lastIndexOf(java.lang.String, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.String java.lang.CharSequence subSequence(int, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.String java.lang.String concat(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.String java.lang.String concat(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.String java.lang.String copyValueOf(char[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.String java.lang.String copyValueOf(char[])">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.String java.lang.String copyValueOf(char[], int, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.String java.lang.String copyValueOf(char[], int, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.String java.lang.String replace(java.lang.CharSequence, java.lang.CharSequence) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.String java.lang.String replace(java.lang.CharSequence, java.lang.CharSequence) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.String java.lang.String substring(int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.String java.lang.String substring(int, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.String java.lang.String toLowerCase(java.util.Locale) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.String java.lang.String toString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.String java.lang.String toUpperCase(java.util.Locale) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.String java.lang.String valueOf(boolean)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.String java.lang.String valueOf(char)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.String java.lang.String valueOf(char[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.String java.lang.String valueOf(char[])">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.String java.lang.String valueOf(char[], int, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.String java.lang.String valueOf(char[], int, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.String java.lang.String valueOf(int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.String java.lang.String valueOf(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.lang.String java.lang.String valueOf(long)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.String void checkBounds(byte[], int, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.String.CaseInsensitiveComparator int compare(java.lang.String, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.String.CaseInsensitiveComparator int compare(java.lang.String, java.lang.String) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer StringBuffer(java.lang.CharSequence) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer StringBuffer(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer int indexOf(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer int indexOf(java.lang.String, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer int lastIndexOf(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer int lastIndexOf(java.lang.String, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer java.lang.AbstractStringBuilder append(boolean)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer java.lang.AbstractStringBuilder append(char)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer java.lang.AbstractStringBuilder append(char[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer java.lang.AbstractStringBuilder append(char[])">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer java.lang.AbstractStringBuilder append(char[], int, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer java.lang.AbstractStringBuilder append(double)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer java.lang.AbstractStringBuilder append(float)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer java.lang.AbstractStringBuilder append(int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer java.lang.AbstractStringBuilder append(java.lang.CharSequence)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer java.lang.AbstractStringBuilder append(java.lang.CharSequence, int, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer java.lang.AbstractStringBuilder append(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer java.lang.AbstractStringBuilder append(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer java.lang.AbstractStringBuilder append(java.lang.StringBuffer)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer java.lang.AbstractStringBuilder append(long)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer java.lang.AbstractStringBuilder appendCodePoint(int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer java.lang.AbstractStringBuilder delete(int, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer java.lang.AbstractStringBuilder deleteCharAt(int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer java.lang.AbstractStringBuilder insert(int, boolean)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer java.lang.AbstractStringBuilder insert(int, char)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer java.lang.AbstractStringBuilder insert(int, char[]) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer java.lang.AbstractStringBuilder insert(int, char[])">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer java.lang.AbstractStringBuilder insert(int, char[], int, int) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer java.lang.AbstractStringBuilder insert(int, char[], int, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer java.lang.AbstractStringBuilder insert(int, double)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer java.lang.AbstractStringBuilder insert(int, float)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer java.lang.AbstractStringBuilder insert(int, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer java.lang.AbstractStringBuilder insert(int, java.lang.CharSequence)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer java.lang.AbstractStringBuilder insert(int, java.lang.CharSequence, int, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer java.lang.AbstractStringBuilder insert(int, java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer java.lang.AbstractStringBuilder insert(int, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer java.lang.AbstractStringBuilder insert(int, long)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer java.lang.AbstractStringBuilder replace(int, int, java.lang.String) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer java.lang.AbstractStringBuilder replace(int, int, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer java.lang.AbstractStringBuilder reverse()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer java.lang.Appendable append(char)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer java.lang.Appendable append(java.lang.CharSequence)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer java.lang.Appendable append(java.lang.CharSequence, int, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer java.lang.CharSequence subSequence(int, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer java.lang.String substring(int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer java.lang.String substring(int, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer java.lang.String toString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer java.lang.StringBuffer append(boolean)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer java.lang.StringBuffer append(char)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer java.lang.StringBuffer append(char[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer java.lang.StringBuffer append(char[])">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer java.lang.StringBuffer append(char[], int, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer java.lang.StringBuffer append(double)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer java.lang.StringBuffer append(float)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer java.lang.StringBuffer append(int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer java.lang.StringBuffer append(java.lang.CharSequence)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer java.lang.StringBuffer append(java.lang.CharSequence, int, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer java.lang.StringBuffer append(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer java.lang.StringBuffer append(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer java.lang.StringBuffer append(java.lang.StringBuffer)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer java.lang.StringBuffer append(long)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer java.lang.StringBuffer appendCodePoint(int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer java.lang.StringBuffer delete(int, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer java.lang.StringBuffer deleteCharAt(int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer java.lang.StringBuffer insert(int, boolean)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer java.lang.StringBuffer insert(int, char)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer java.lang.StringBuffer insert(int, char[]) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer java.lang.StringBuffer insert(int, char[])">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer java.lang.StringBuffer insert(int, char[], int, int) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer java.lang.StringBuffer insert(int, char[], int, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer java.lang.StringBuffer insert(int, double)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer java.lang.StringBuffer insert(int, float)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer java.lang.StringBuffer insert(int, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer java.lang.StringBuffer insert(int, java.lang.CharSequence)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer java.lang.StringBuffer insert(int, java.lang.CharSequence, int, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer java.lang.StringBuffer insert(int, java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer java.lang.StringBuffer insert(int, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer java.lang.StringBuffer insert(int, long)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer java.lang.StringBuffer replace(int, int, java.lang.String) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer java.lang.StringBuffer replace(int, int, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer java.lang.StringBuffer reverse()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer void readObject(java.io.ObjectInputStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuffer void writeObject(java.io.ObjectOutputStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder StringBuilder(java.lang.CharSequence) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder StringBuilder(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder int indexOf(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder int indexOf(java.lang.String, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder int lastIndexOf(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder int lastIndexOf(java.lang.String, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder java.lang.AbstractStringBuilder append(boolean)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder java.lang.AbstractStringBuilder append(char)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder java.lang.AbstractStringBuilder append(char[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder java.lang.AbstractStringBuilder append(char[])">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder java.lang.AbstractStringBuilder append(char[], int, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder java.lang.AbstractStringBuilder append(double)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder java.lang.AbstractStringBuilder append(float)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder java.lang.AbstractStringBuilder append(int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder java.lang.AbstractStringBuilder append(java.lang.CharSequence)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder java.lang.AbstractStringBuilder append(java.lang.CharSequence, int, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder java.lang.AbstractStringBuilder append(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder java.lang.AbstractStringBuilder append(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder java.lang.AbstractStringBuilder append(java.lang.StringBuffer)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder java.lang.AbstractStringBuilder append(long)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder java.lang.AbstractStringBuilder appendCodePoint(int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder java.lang.AbstractStringBuilder delete(int, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder java.lang.AbstractStringBuilder deleteCharAt(int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder java.lang.AbstractStringBuilder insert(int, boolean)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder java.lang.AbstractStringBuilder insert(int, char)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder java.lang.AbstractStringBuilder insert(int, char[]) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder java.lang.AbstractStringBuilder insert(int, char[])">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder java.lang.AbstractStringBuilder insert(int, char[], int, int) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder java.lang.AbstractStringBuilder insert(int, char[], int, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder java.lang.AbstractStringBuilder insert(int, double)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder java.lang.AbstractStringBuilder insert(int, float)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder java.lang.AbstractStringBuilder insert(int, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder java.lang.AbstractStringBuilder insert(int, java.lang.CharSequence)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder java.lang.AbstractStringBuilder insert(int, java.lang.CharSequence, int, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder java.lang.AbstractStringBuilder insert(int, java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder java.lang.AbstractStringBuilder insert(int, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder java.lang.AbstractStringBuilder insert(int, long)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder java.lang.AbstractStringBuilder replace(int, int, java.lang.String) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder java.lang.AbstractStringBuilder replace(int, int, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder java.lang.AbstractStringBuilder reverse()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder java.lang.Appendable append(char)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder java.lang.Appendable append(java.lang.CharSequence)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder java.lang.Appendable append(java.lang.CharSequence, int, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder java.lang.String toString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder java.lang.StringBuilder append(boolean)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder java.lang.StringBuilder append(char)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder java.lang.StringBuilder append(char[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder java.lang.StringBuilder append(char[])">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder java.lang.StringBuilder append(char[], int, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder java.lang.StringBuilder append(double)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder java.lang.StringBuilder append(float)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder java.lang.StringBuilder append(int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder java.lang.StringBuilder append(java.lang.CharSequence)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder java.lang.StringBuilder append(java.lang.CharSequence, int, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder java.lang.StringBuilder append(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder java.lang.StringBuilder append(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder java.lang.StringBuilder append(java.lang.StringBuffer)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder java.lang.StringBuilder append(java.lang.StringBuilder)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder java.lang.StringBuilder append(long)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder java.lang.StringBuilder appendCodePoint(int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder java.lang.StringBuilder delete(int, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder java.lang.StringBuilder deleteCharAt(int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder java.lang.StringBuilder insert(int, boolean)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder java.lang.StringBuilder insert(int, char)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder java.lang.StringBuilder insert(int, char[]) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder java.lang.StringBuilder insert(int, char[])">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder java.lang.StringBuilder insert(int, char[], int, int) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder java.lang.StringBuilder insert(int, char[], int, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder java.lang.StringBuilder insert(int, double)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder java.lang.StringBuilder insert(int, float)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder java.lang.StringBuilder insert(int, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder java.lang.StringBuilder insert(int, java.lang.CharSequence)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder java.lang.StringBuilder insert(int, java.lang.CharSequence, int, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder java.lang.StringBuilder insert(int, java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder java.lang.StringBuilder insert(int, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder java.lang.StringBuilder insert(int, long)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder java.lang.StringBuilder replace(int, int, java.lang.String) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder java.lang.StringBuilder replace(int, int, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder java.lang.StringBuilder reverse()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder void readObject(java.io.ObjectInputStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.StringBuilder void writeObject(java.io.ObjectOutputStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.System java.lang.String clearProperty(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.System java.lang.String getProperty(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.System java.lang.String getProperty(java.lang.String, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.System java.lang.String setProperty(java.lang.String, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.System void checkKey(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.System.2 sun.reflect.ConstantPool getConstantPool(java.lang.Class) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.System.2 sun.reflect.annotation.AnnotationType getAnnotationType(java.lang.Class) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.System.2 void blockedOn(java.lang.Thread, sun.nio.ch.Interruptible) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.System.2 void setAnnotationType(java.lang.Class, sun.reflect.annotation.AnnotationType) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Thread Thread(java.lang.Runnable, java.lang.String) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Thread Thread(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Thread Thread(java.lang.ThreadGroup, java.lang.Runnable, java.lang.String) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Thread Thread(java.lang.ThreadGroup, java.lang.Runnable, java.lang.String, long) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Thread Thread(java.lang.ThreadGroup, java.lang.String) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Thread java.lang.String getName()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Thread java.lang.String toString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Thread void init(java.lang.ThreadGroup, java.lang.Runnable, java.lang.String, long) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Thread void setName(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.ThreadLocal int access$400(java.lang.ThreadLocal) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.ThreadLocal java.lang.ThreadLocal.ThreadLocalMap createInheritedMap(java.lang.ThreadLocal.ThreadLocalMap) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.ThreadLocal java.lang.ThreadLocal.ThreadLocalMap createInheritedMap(java.lang.ThreadLocal.ThreadLocalMap)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.ThreadLocal java.lang.ThreadLocal.ThreadLocalMap getMap(java.lang.Thread) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.ThreadLocal void createMap(java.lang.Thread, T) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.ThreadLocal.ThreadLocalMap ThreadLocalMap(java.lang.ThreadLocal, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.ThreadLocal.ThreadLocalMap ThreadLocalMap(java.lang.ThreadLocal.ThreadLocalMap) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.ThreadLocal.ThreadLocalMap ThreadLocalMap(java.lang.ThreadLocal.ThreadLocalMap, java.lang.ThreadLocal.1) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.ThreadLocal.ThreadLocalMap java.lang.ThreadLocal.ThreadLocalMap.Entry access$000(java.lang.ThreadLocal.ThreadLocalMap, java.lang.ThreadLocal) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.ThreadLocal.ThreadLocalMap java.lang.ThreadLocal.ThreadLocalMap.Entry access$000(java.lang.ThreadLocal.ThreadLocalMap, java.lang.ThreadLocal) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.ThreadLocal.ThreadLocalMap java.lang.ThreadLocal.ThreadLocalMap.Entry getEntry(java.lang.ThreadLocal) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.ThreadLocal.ThreadLocalMap java.lang.ThreadLocal.ThreadLocalMap.Entry getEntryAfterMiss(java.lang.ThreadLocal, int, java.lang.ThreadLocal.ThreadLocalMap.Entry)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,_,null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.lang.ThreadLocal.ThreadLocalMap void access$100(java.lang.ThreadLocal.ThreadLocalMap, java.lang.ThreadLocal, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.ThreadLocal.ThreadLocalMap void access$100(java.lang.ThreadLocal.ThreadLocalMap, java.lang.ThreadLocal, java.lang.Object) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.ThreadLocal.ThreadLocalMap void access$200(java.lang.ThreadLocal.ThreadLocalMap, java.lang.ThreadLocal) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.ThreadLocal.ThreadLocalMap void access$200(java.lang.ThreadLocal.ThreadLocalMap, java.lang.ThreadLocal) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.ThreadLocal.ThreadLocalMap void remove(java.lang.ThreadLocal) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.ThreadLocal.ThreadLocalMap void set(java.lang.ThreadLocal, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Throwable java.lang.Throwable initCause(java.lang.Throwable)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Throwable void printEnclosedStackTrace(java.lang.Throwable.PrintStreamOrWriter, java.lang.StackTraceElement[], java.lang.String, java.lang.String, java.util.Set&lt;java.lang.Throwable&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Throwable void printEnclosedStackTrace(java.lang.Throwable.PrintStreamOrWriter, java.lang.StackTraceElement[], java.lang.String, java.lang.String, java.util.Set&lt;java.lang.Throwable&gt;) 4">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Throwable void printStackTrace(java.lang.Throwable.PrintStreamOrWriter) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Throwable void readObject(java.io.ObjectInputStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Throwable void setStackTrace(java.lang.StackTraceElement[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.Throwable void writeObject(java.io.ObjectOutputStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+</root>
diff --git a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/lang/invoke/annotations.xml b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/lang/invoke/annotations.xml
new file mode 100644
index 000000000000..f800dab8c906
--- /dev/null
+++ b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/lang/invoke/annotations.xml
@@ -0,0 +1,1872 @@
+<root>
+ <item name="java.lang.invoke.AdapterMethodHandle AdapterMethodHandle(java.lang.invoke.MethodHandle, java.lang.invoke.MethodType, long) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.AdapterMethodHandle AdapterMethodHandle(java.lang.invoke.MethodHandle, java.lang.invoke.MethodType, long, java.lang.Object) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.AdapterMethodHandle AdapterMethodHandle(java.lang.invoke.MethodHandle, java.lang.invoke.MethodType, long, java.lang.invoke.AdapterMethodHandle.1) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.AdapterMethodHandle boolean canBoxArgument(java.lang.Class&lt;?&gt;, java.lang.Class&lt;?&gt;)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_-&gt;false;_,!null-&gt;false;_,null-&gt;false;null,_-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.lang.invoke.AdapterMethodHandle boolean canCheckCast(java.lang.Class&lt;?&gt;, java.lang.Class&lt;?&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.AdapterMethodHandle boolean canCheckCast(java.lang.Class&lt;?&gt;, java.lang.Class&lt;?&gt;)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.lang.invoke.AdapterMethodHandle boolean canCheckCast(java.lang.invoke.MethodType, java.lang.invoke.MethodType, int, java.lang.Class&lt;?&gt;)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,null,_,_-&gt;false;null,_,_,_-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.lang.invoke.AdapterMethodHandle boolean canConvertArgument(java.lang.Class&lt;?&gt;, java.lang.Class&lt;?&gt;)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,null-&gt;true;null,_-&gt;true&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.lang.invoke.AdapterMethodHandle boolean canDupArguments(java.lang.invoke.MethodType, java.lang.invoke.MethodType, int, int)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,null,_,_-&gt;false;null,_,_,_-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.lang.invoke.AdapterMethodHandle boolean canPairwiseConvert(java.lang.invoke.MethodType, java.lang.invoke.MethodType) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.AdapterMethodHandle boolean canPairwiseConvert(java.lang.invoke.MethodType, java.lang.invoke.MethodType) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.AdapterMethodHandle boolean canPrimCast(java.lang.Class&lt;?&gt;, java.lang.Class&lt;?&gt;)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,null-&gt;false;null,_-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.lang.invoke.AdapterMethodHandle boolean canPrimCast(java.lang.invoke.MethodType, java.lang.invoke.MethodType, int, java.lang.Class&lt;?&gt;)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,null,_,_-&gt;false;null,_,_,_-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.lang.invoke.AdapterMethodHandle boolean canRotateArguments(java.lang.invoke.MethodType, java.lang.invoke.MethodType, int, int, int)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,null,_,_,_-&gt;false;null,_,_,_,_-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.lang.invoke.AdapterMethodHandle boolean canSpreadArguments(java.lang.invoke.MethodType, java.lang.invoke.MethodType, java.lang.Class&lt;?&gt;, int, int)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,null,_,_,_-&gt;false;null,_,_,_,_-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.lang.invoke.AdapterMethodHandle boolean canSwapArguments(java.lang.invoke.MethodType, java.lang.invoke.MethodType, int, int)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,null,_,_-&gt;false;null,_,_,_-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.lang.invoke.AdapterMethodHandle boolean canUnboxArgument(java.lang.Class&lt;?&gt;, java.lang.Class&lt;?&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.AdapterMethodHandle boolean canUnboxArgument(java.lang.invoke.MethodType, java.lang.invoke.MethodType, int, java.lang.Class&lt;?&gt;)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,null,_,_-&gt;false;null,_,_,_-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.lang.invoke.AdapterMethodHandle int diffReturnTypes(java.lang.invoke.MethodType, java.lang.invoke.MethodType, boolean) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.AdapterMethodHandle int diffReturnTypes(java.lang.invoke.MethodType, java.lang.invoke.MethodType, boolean) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.AdapterMethodHandle int diffTypes(java.lang.invoke.MethodType, java.lang.invoke.MethodType, boolean) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.AdapterMethodHandle int diffTypes(java.lang.invoke.MethodType, java.lang.invoke.MethodType, boolean) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.AdapterMethodHandle java.lang.String toString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.AdapterMethodHandle java.lang.invoke.MethodHandle makeBoxArgument(java.lang.invoke.MethodType, java.lang.invoke.MethodHandle, int, java.lang.Class&lt;?&gt;)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_,_,_-&gt;null;_,!null,_,_-&gt;null;_,_,_,!null-&gt;null;_,_,_,null-&gt;null;_,null,_,_-&gt;null;null,_,_,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.lang.invoke.AdapterMethodHandle java.lang.invoke.MethodHandle makeCheckCast(java.lang.invoke.MethodType, java.lang.invoke.MethodHandle, int, java.lang.Class&lt;?&gt;) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.AdapterMethodHandle java.lang.invoke.MethodHandle makeDropArguments(java.lang.invoke.MethodType, java.lang.invoke.MethodHandle, int, int) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.AdapterMethodHandle java.lang.invoke.MethodHandle makeDupArguments(java.lang.invoke.MethodType, java.lang.invoke.MethodHandle, int, int) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.AdapterMethodHandle java.lang.invoke.MethodHandle makePairwiseConvert(java.lang.invoke.MethodType, java.lang.invoke.MethodHandle) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.AdapterMethodHandle java.lang.invoke.MethodHandle makePermutation(java.lang.invoke.MethodType, java.lang.invoke.MethodHandle, int[]) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.AdapterMethodHandle java.lang.invoke.MethodHandle makePermutation(java.lang.invoke.MethodType, java.lang.invoke.MethodHandle, int[]) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.AdapterMethodHandle java.lang.invoke.MethodHandle makePrimCast(java.lang.invoke.MethodType, java.lang.invoke.MethodHandle, int, java.lang.Class&lt;?&gt;) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.AdapterMethodHandle java.lang.invoke.MethodHandle makePrimCast(java.lang.invoke.MethodType, java.lang.invoke.MethodHandle, int, java.lang.Class&lt;?&gt;)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_,_,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.lang.invoke.AdapterMethodHandle java.lang.invoke.MethodHandle makeRetype(java.lang.invoke.MethodType, java.lang.invoke.MethodHandle, boolean) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.AdapterMethodHandle java.lang.invoke.MethodHandle makeRetypeOnly(java.lang.invoke.MethodType, java.lang.invoke.MethodHandle) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.AdapterMethodHandle java.lang.invoke.MethodHandle makeRetypeRaw(java.lang.invoke.MethodType, java.lang.invoke.MethodHandle) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.AdapterMethodHandle java.lang.invoke.MethodHandle makeRotateArguments(java.lang.invoke.MethodType, java.lang.invoke.MethodHandle, int, int, int) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.AdapterMethodHandle java.lang.invoke.MethodHandle makeRotateArguments(java.lang.invoke.MethodType, java.lang.invoke.MethodHandle, int, int, int)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_,_,_,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.lang.invoke.AdapterMethodHandle java.lang.invoke.MethodHandle makeSpreadArguments(java.lang.invoke.MethodType, java.lang.invoke.MethodHandle, java.lang.Class&lt;?&gt;, int, int) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.AdapterMethodHandle java.lang.invoke.MethodHandle makeSwapArguments(java.lang.invoke.MethodType, java.lang.invoke.MethodHandle, int, int)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,null,_,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.lang.invoke.AdapterMethodHandle java.lang.invoke.MethodHandle makeUnboxArgument(java.lang.invoke.MethodType, java.lang.invoke.MethodHandle, int, java.lang.Class&lt;?&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.AdapterMethodHandle java.lang.invoke.MethodHandle makeUnboxArgument(java.lang.invoke.MethodType, java.lang.invoke.MethodHandle, int, java.lang.Class&lt;?&gt;) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.AdapterMethodHandle java.lang.invoke.MethodHandle makeVarargsCollector(java.lang.invoke.MethodHandle, java.lang.Class&lt;?&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.AdapterMethodHandle java.lang.invoke.MethodHandle makeVarargsCollector(java.lang.invoke.MethodHandle, java.lang.Class&lt;?&gt;)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.AdapterMethodHandle java.lang.invoke.MethodHandle nonAdapter(java.lang.invoke.MethodHandle)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.lang.invoke.AdapterMethodHandle.AsVarargsCollector AsVarargsCollector(java.lang.invoke.MethodHandle, java.lang.Class&lt;?&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.AdapterMethodHandle.AsVarargsCollector java.lang.invoke.MethodHandle asType(java.lang.invoke.MethodType) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.BoundMethodHandle BoundMethodHandle(java.lang.invoke.DirectMethodHandle, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.BoundMethodHandle BoundMethodHandle(java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.BoundMethodHandle BoundMethodHandle(java.lang.invoke.MethodHandle, java.lang.Object, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.BoundMethodHandle BoundMethodHandle(java.lang.invoke.MethodType, java.lang.Object, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.BoundMethodHandle BoundMethodHandle(java.lang.invoke.MethodType, java.lang.invoke.MethodHandle, java.lang.Object, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.BoundMethodHandle BoundMethodHandle(java.lang.invoke.MethodType, java.lang.invoke.MethodHandle, java.lang.Object, int) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.BoundMethodHandle java.lang.Object bindPrimitiveArgument(java.lang.Object, java.lang.invoke.MethodHandle, int) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.BoundMethodHandle java.lang.Object checkReferenceArgument(java.lang.Object, java.lang.invoke.MethodHandle, int) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.BoundMethodHandle java.lang.Object checkReferenceArgument(java.lang.Object, java.lang.invoke.MethodHandle, int)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_,_-&gt;!null;null,_,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.lang.invoke.BoundMethodHandle java.lang.RuntimeException badBoundArgumentException(java.lang.Object, java.lang.invoke.MethodHandle, int) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.BoundMethodHandle java.lang.RuntimeException badBoundArgumentException(java.lang.Object, java.lang.invoke.MethodHandle, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.BoundMethodHandle java.lang.String noParens(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.BoundMethodHandle java.lang.String noParens(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.lang.invoke.CallSite CallSite(java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.CallSite CallSite(java.lang.invoke.MethodType) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.CallSite java.lang.Object maybeReBox(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;!null;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.lang.invoke.CallSite java.lang.invoke.CallSite makeSite(java.lang.invoke.MethodHandle, java.lang.String, java.lang.invoke.MethodType, java.lang.Object, java.lang.invoke.MemberName, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.CallSite java.lang.invoke.CallSite makeSite(java.lang.invoke.MethodHandle, java.lang.String, java.lang.invoke.MethodType, java.lang.Object, java.lang.invoke.MemberName, int) 4">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.CallSite java.lang.invoke.WrongMethodTypeException wrongTargetType(java.lang.invoke.MethodHandle, java.lang.invoke.MethodType)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.CallSite void checkTargetChange(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.CallSite void checkTargetChange(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.CallSite void maybeReBoxElements(java.lang.Object[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.ConstantCallSite ConstantCallSite(java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.DirectMethodHandle DirectMethodHandle(java.lang.invoke.MethodType, java.lang.invoke.MemberName, boolean, java.lang.Class&lt;?&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.DirectMethodHandle DirectMethodHandle(java.lang.invoke.MethodType, java.lang.invoke.MemberName, boolean, java.lang.Class&lt;?&gt;) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric FilterGeneric(java.lang.invoke.MethodType) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric java.lang.String toString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric java.lang.invoke.FilterGeneric of(java.lang.invoke.FilterGeneric.Kind, int, java.lang.invoke.MethodType, java.lang.invoke.MethodType) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric java.lang.invoke.FilterGeneric.Adapter findAdapter(java.lang.invoke.MethodType, java.lang.invoke.FilterGeneric.Kind, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric java.lang.invoke.FilterGeneric.Adapter findAdapter(java.lang.invoke.MethodType, java.lang.invoke.FilterGeneric.Kind, int) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric java.lang.invoke.FilterGeneric.Adapter getAdapter(java.lang.invoke.FilterGeneric.Kind, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric java.lang.invoke.MethodHandle make(java.lang.invoke.FilterGeneric.Kind, int, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric java.lang.invoke.MethodHandle make(java.lang.invoke.FilterGeneric.Kind, int, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric java.lang.invoke.MethodHandle make(java.lang.invoke.FilterGeneric.Kind, int, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 3">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric java.lang.invoke.MethodHandle makeArgumentCollector(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric java.lang.invoke.MethodHandle makeArgumentCollector(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric java.lang.invoke.MethodHandle makeArgumentFilter(int, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric java.lang.invoke.MethodHandle makeArgumentFilter(int, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric java.lang.invoke.MethodHandle makeArgumentFolder(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric java.lang.invoke.MethodHandle makeArgumentFolder(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric java.lang.invoke.MethodHandle makeFlyby(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric java.lang.invoke.MethodHandle makeFlyby(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric java.lang.invoke.MethodType entryType(java.lang.invoke.FilterGeneric.Kind, int, java.lang.invoke.MethodType, java.lang.invoke.MethodType) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric java.lang.invoke.MethodType entryType(java.lang.invoke.FilterGeneric.Kind, int, java.lang.invoke.MethodType, java.lang.invoke.MethodType)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,_,_,null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric java.lang.invoke.MethodType targetType(java.lang.invoke.MethodType, java.lang.invoke.FilterGeneric.Kind, int, java.lang.invoke.MethodType) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric java.lang.invoke.MethodType targetType(java.lang.invoke.MethodType, java.lang.invoke.FilterGeneric.Kind, int, java.lang.invoke.MethodType)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_,_,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.Adapter Adapter(java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.Adapter Adapter(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F0 F0(java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F0 F0(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F0 java.lang.invoke.FilterGeneric.F0 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F0 java.lang.invoke.FilterGeneric.F0 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F1 F1(java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F1 F1(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F1 java.lang.invoke.FilterGeneric.F1 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F1 java.lang.invoke.FilterGeneric.F1 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F10 F10(java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F10 F10(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F10 java.lang.invoke.FilterGeneric.F10 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F10 java.lang.invoke.FilterGeneric.F10 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F11 F11(java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F11 F11(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F11 java.lang.invoke.FilterGeneric.F11 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F11 java.lang.invoke.FilterGeneric.F11 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F12 F12(java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F12 F12(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F12 java.lang.invoke.FilterGeneric.F12 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F12 java.lang.invoke.FilterGeneric.F12 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F13 F13(java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F13 F13(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F13 java.lang.invoke.FilterGeneric.F13 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F13 java.lang.invoke.FilterGeneric.F13 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F14 F14(java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F14 F14(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F14 java.lang.invoke.FilterGeneric.F14 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F14 java.lang.invoke.FilterGeneric.F14 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F15 F15(java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F15 F15(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F15 java.lang.invoke.FilterGeneric.F15 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F15 java.lang.invoke.FilterGeneric.F15 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F16 F16(java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F16 F16(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F16 java.lang.invoke.FilterGeneric.F16 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F16 java.lang.invoke.FilterGeneric.F16 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F17 F17(java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F17 F17(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F17 java.lang.invoke.FilterGeneric.F17 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F17 java.lang.invoke.FilterGeneric.F17 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F18 F18(java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F18 F18(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F18 java.lang.invoke.FilterGeneric.F18 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F18 java.lang.invoke.FilterGeneric.F18 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F19 F19(java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F19 F19(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F19 java.lang.invoke.FilterGeneric.F19 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F19 java.lang.invoke.FilterGeneric.F19 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F2 F2(java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F2 F2(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F2 java.lang.invoke.FilterGeneric.F2 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F2 java.lang.invoke.FilterGeneric.F2 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F20 F20(java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F20 F20(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F20 java.lang.invoke.FilterGeneric.F20 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F20 java.lang.invoke.FilterGeneric.F20 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F3 F3(java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F3 F3(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F3 java.lang.invoke.FilterGeneric.F3 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F3 java.lang.invoke.FilterGeneric.F3 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F4 F4(java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F4 F4(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F4 java.lang.invoke.FilterGeneric.F4 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F4 java.lang.invoke.FilterGeneric.F4 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F5 F5(java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F5 F5(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F5 java.lang.invoke.FilterGeneric.F5 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F5 java.lang.invoke.FilterGeneric.F5 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F6 F6(java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F6 F6(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F6 java.lang.invoke.FilterGeneric.F6 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F6 java.lang.invoke.FilterGeneric.F6 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F7 F7(java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F7 F7(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F7 java.lang.invoke.FilterGeneric.F7 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F7 java.lang.invoke.FilterGeneric.F7 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F8 F8(java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F8 F8(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F8 java.lang.invoke.FilterGeneric.F8 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F8 java.lang.invoke.FilterGeneric.F8 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F9 F9(java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F9 F9(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F9 java.lang.invoke.FilterGeneric.F9 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.F9 java.lang.invoke.FilterGeneric.F9 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterGeneric.Kind java.lang.String invokerName(int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FilterOneArgument java.lang.invoke.MethodHandle make(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_-&gt;!null;_,!null-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.lang.invoke.FromGeneric FromGeneric(java.lang.invoke.MethodType) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FromGeneric java.lang.String toString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FromGeneric java.lang.invoke.FromGeneric of(java.lang.invoke.MethodType) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FromGeneric java.lang.invoke.FromGeneric.Adapter findAdapter(java.lang.invoke.MethodType) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FromGeneric java.lang.invoke.FromGeneric.Adapter makeInstance(java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FromGeneric java.lang.invoke.MethodHandle computeReturnConversion(java.lang.invoke.MethodType, java.lang.invoke.MethodType) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FromGeneric java.lang.invoke.MethodHandle computeReturnConversion(java.lang.invoke.MethodType, java.lang.invoke.MethodType) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FromGeneric java.lang.invoke.MethodHandle computeUnboxingInvoker(java.lang.invoke.MethodType, java.lang.invoke.MethodType) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FromGeneric java.lang.invoke.MethodHandle computeUnboxingInvoker(java.lang.invoke.MethodType, java.lang.invoke.MethodType) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FromGeneric java.lang.invoke.MethodHandle make(java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FromGeneric.A0 A0(java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FromGeneric.A0 A0(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FromGeneric.A0 java.lang.invoke.FromGeneric.A0 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FromGeneric.A0 java.lang.invoke.FromGeneric.A0 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FromGeneric.A1 A1(java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FromGeneric.A1 A1(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FromGeneric.A1 java.lang.invoke.FromGeneric.A1 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FromGeneric.A1 java.lang.invoke.FromGeneric.A1 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FromGeneric.A10 A10(java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FromGeneric.A10 A10(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FromGeneric.A10 java.lang.invoke.FromGeneric.A10 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FromGeneric.A10 java.lang.invoke.FromGeneric.A10 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FromGeneric.A2 A2(java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FromGeneric.A2 A2(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FromGeneric.A2 java.lang.invoke.FromGeneric.A2 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FromGeneric.A2 java.lang.invoke.FromGeneric.A2 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FromGeneric.A3 A3(java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FromGeneric.A3 A3(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FromGeneric.A3 java.lang.invoke.FromGeneric.A3 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FromGeneric.A3 java.lang.invoke.FromGeneric.A3 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FromGeneric.A4 A4(java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FromGeneric.A4 A4(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FromGeneric.A4 java.lang.invoke.FromGeneric.A4 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FromGeneric.A4 java.lang.invoke.FromGeneric.A4 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FromGeneric.A5 A5(java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FromGeneric.A5 A5(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FromGeneric.A5 java.lang.invoke.FromGeneric.A5 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FromGeneric.A5 java.lang.invoke.FromGeneric.A5 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FromGeneric.A6 A6(java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FromGeneric.A6 A6(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FromGeneric.A6 java.lang.invoke.FromGeneric.A6 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FromGeneric.A6 java.lang.invoke.FromGeneric.A6 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FromGeneric.A7 A7(java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FromGeneric.A7 A7(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FromGeneric.A7 java.lang.invoke.FromGeneric.A7 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FromGeneric.A7 java.lang.invoke.FromGeneric.A7 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FromGeneric.A8 A8(java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FromGeneric.A8 A8(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FromGeneric.A8 java.lang.invoke.FromGeneric.A8 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FromGeneric.A8 java.lang.invoke.FromGeneric.A8 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FromGeneric.A9 A9(java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FromGeneric.A9 A9(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FromGeneric.A9 java.lang.invoke.FromGeneric.A9 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FromGeneric.A9 java.lang.invoke.FromGeneric.A9 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FromGeneric.Adapter Adapter(java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.FromGeneric.Adapter Adapter(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.InvokeGeneric boolean returnConversionNeeded(java.lang.invoke.MethodType, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.InvokeGeneric boolean returnConversionNeeded(java.lang.invoke.MethodType, java.lang.invoke.MethodHandle)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.lang.invoke.InvokeGeneric java.lang.String toString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.InvokeGeneric java.lang.invoke.MethodHandle dispatch(java.lang.invoke.MethodType, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.InvokeGeneric java.lang.invoke.MethodHandle dispatch(java.lang.invoke.MethodType, java.lang.invoke.MethodHandle) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.InvokeGeneric java.lang.invoke.MethodHandle dispatchWithConversion(java.lang.invoke.MethodType, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.InvokeGeneric java.lang.invoke.MethodHandle dispatchWithConversion(java.lang.invoke.MethodType, java.lang.invoke.MethodHandle) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.InvokeGeneric java.lang.invoke.MethodHandle dispatcher(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.InvokeGeneric java.lang.invoke.MethodHandle dropDispatchArguments(java.lang.invoke.MethodHandle)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.lang.invoke.Invokers Invokers(java.lang.invoke.MethodType) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.Invokers java.lang.String toString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.Invokers java.lang.invoke.MethodType invokerType(java.lang.invoke.MethodType) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MemberName MemberName(java.lang.Class&lt;?&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MemberName MemberName(java.lang.Class&lt;?&gt;, java.lang.String, java.lang.invoke.MethodType) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MemberName MemberName(java.lang.Class&lt;?&gt;, java.lang.String, java.lang.invoke.MethodType, int) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MemberName MemberName(java.lang.reflect.Constructor) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MemberName MemberName(java.lang.reflect.Field) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MemberName MemberName(java.lang.reflect.Method) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MemberName int access$200(java.lang.invoke.MemberName) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MemberName java.lang.IllegalAccessException makeAccessException(java.lang.String, java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MemberName java.lang.Object access$100(java.lang.invoke.MemberName) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MemberName java.lang.Object access$102(java.lang.invoke.MemberName, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MemberName java.lang.Object access$102(java.lang.invoke.MemberName, java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,!null-&gt;!null;_,null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.lang.invoke.MemberName java.lang.ReflectiveOperationException makeAccessException(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MemberName java.lang.String access$000(java.lang.invoke.MemberName) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MemberName java.lang.String access$002(java.lang.invoke.MemberName, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MemberName java.lang.String access$002(java.lang.invoke.MemberName, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,!null-&gt;!null;_,null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.lang.invoke.MemberName java.lang.String getName(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.lang.invoke.MemberName.Factory boolean resolveInPlace(java.lang.invoke.MemberName, boolean, java.lang.Class&lt;?&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MemberName.Factory java.lang.invoke.MemberName resolveOrNull(java.lang.invoke.MemberName, boolean, java.lang.Class&lt;?&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandle MethodHandle(java.lang.invoke.MethodType) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandle java.lang.Object invokeWithArguments(java.util.List&lt;?&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandle java.lang.String toString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandle java.lang.invoke.MethodHandle asCollector(java.lang.Class&lt;?&gt;, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandle java.lang.invoke.MethodHandle asSpreader(java.lang.Class&lt;?&gt;, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandle java.lang.invoke.MethodHandle asVarargsCollector(java.lang.Class&lt;?&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandle java.lang.invoke.MethodHandle asVarargsCollector(java.lang.Class&lt;?&gt;)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandleImpl java.lang.invoke.MethodHandle accessArrayElement(java.lang.Class&lt;?&gt;, boolean) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandleImpl java.lang.invoke.MethodHandle accessField(java.lang.invoke.MemberName, boolean, java.lang.Class&lt;?&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandleImpl java.lang.invoke.MethodHandle accessField(java.lang.invoke.MemberName, boolean, java.lang.Class&lt;?&gt;)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandleImpl java.lang.invoke.MethodHandle asVarargsCollector(java.lang.invoke.MethodHandle, java.lang.Class&lt;?&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandleImpl java.lang.invoke.MethodHandle asVarargsCollector(java.lang.invoke.MethodHandle, java.lang.Class&lt;?&gt;)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandleImpl java.lang.invoke.MethodHandle bindArgument(java.lang.invoke.MethodHandle, int, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandleImpl java.lang.invoke.MethodHandle bindArgument(java.lang.invoke.MethodHandle, int, java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandleImpl java.lang.invoke.MethodHandle bindReceiver(java.lang.invoke.MethodHandle, java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.lang.invoke.MethodHandleImpl java.lang.invoke.MethodHandle collectArguments(java.lang.invoke.MethodHandle, java.lang.invoke.MethodType, int, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandleImpl java.lang.invoke.MethodHandle dropArguments(java.lang.invoke.MethodHandle, java.lang.invoke.MethodType, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandleImpl java.lang.invoke.MethodHandle dropArguments(java.lang.invoke.MethodHandle, java.lang.invoke.MethodType, int) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandleImpl java.lang.invoke.MethodHandle filterArgument(java.lang.invoke.MethodHandle, int, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandleImpl java.lang.invoke.MethodHandle filterArgument(java.lang.invoke.MethodHandle, int, java.lang.invoke.MethodHandle) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandleImpl java.lang.invoke.MethodHandle findMethod(java.lang.invoke.MemberName, boolean, java.lang.Class&lt;?&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandleImpl java.lang.invoke.MethodHandle foldArguments(java.lang.invoke.MethodHandle, java.lang.invoke.MethodType, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandleImpl java.lang.invoke.MethodHandle foldArguments(java.lang.invoke.MethodHandle, java.lang.invoke.MethodType, java.lang.invoke.MethodHandle) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandleImpl java.lang.invoke.MethodHandle makeAllocator(java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandleImpl java.lang.invoke.MethodHandle makeGuardWithCatch(java.lang.invoke.MethodHandle, java.lang.Class&lt;? extends java.lang.Throwable&gt;, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandleImpl java.lang.invoke.MethodHandle makeGuardWithCatch(java.lang.invoke.MethodHandle, java.lang.Class&lt;? extends java.lang.Throwable&gt;, java.lang.invoke.MethodHandle) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandleImpl java.lang.invoke.MethodHandle makeGuardWithTest(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandleImpl java.lang.invoke.MethodHandle makeGuardWithTest(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandleImpl java.lang.invoke.MethodHandle spreadArguments(java.lang.invoke.MethodHandle, java.lang.invoke.MethodType, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandleImpl.AllocateObject AllocateObject(java.lang.invoke.MethodHandle, java.lang.Class&lt;C&gt;, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandleImpl.AllocateObject java.lang.invoke.MethodHandle make(java.lang.Class&lt;?&gt;, java.lang.invoke.MethodHandle) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandleImpl.AllocateObject java.lang.invoke.MethodType makeConType(java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandleImpl.FieldAccessor FieldAccessor(java.lang.invoke.MemberName, boolean) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandleImpl.FieldAccessor V getElementL(java.lang.Class&lt;V[]&gt;, V[], int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandleImpl.FieldAccessor boolean doCache(java.lang.Class&lt;?&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandleImpl.FieldAccessor boolean getElementZ(boolean[], int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandleImpl.FieldAccessor byte getElementB(byte[], int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandleImpl.FieldAccessor char getElementC(char[], int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandleImpl.FieldAccessor double getElementD(double[], int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandleImpl.FieldAccessor float getElementF(float[], int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandleImpl.FieldAccessor int getElementI(int[], int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandleImpl.FieldAccessor java.lang.Object getElementL(java.lang.Object[], int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandleImpl.FieldAccessor java.lang.Object staticBase(java.lang.invoke.MemberName) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandleImpl.FieldAccessor java.lang.String aname(java.lang.Class&lt;?&gt;, boolean) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandleImpl.FieldAccessor java.lang.String aname(java.lang.Class&lt;?&gt;, boolean)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandleImpl.FieldAccessor java.lang.String fname(java.lang.Class&lt;?&gt;, boolean, boolean)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandleImpl.FieldAccessor java.lang.invoke.MethodHandle ahandle(java.lang.Class&lt;?&gt;, boolean) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandleImpl.FieldAccessor java.lang.invoke.MethodHandle fhandle(java.lang.Class&lt;?&gt;, java.lang.Class&lt;?&gt;, boolean, boolean) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandleImpl.FieldAccessor java.lang.invoke.MethodHandle fhandle(java.lang.Class&lt;?&gt;, java.lang.Class&lt;?&gt;, boolean, boolean) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandleImpl.FieldAccessor java.lang.invoke.MethodType atype(java.lang.Class&lt;?&gt;, boolean) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandleImpl.FieldAccessor long getElementJ(long[], int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandleImpl.FieldAccessor short getElementS(short[], int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandleImpl.FieldAccessor void setElementB(byte[], int, byte) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandleImpl.FieldAccessor void setElementC(char[], int, char) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandleImpl.FieldAccessor void setElementD(double[], int, double) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandleImpl.FieldAccessor void setElementF(float[], int, float) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandleImpl.FieldAccessor void setElementI(int[], int, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandleImpl.FieldAccessor void setElementJ(long[], int, long) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandleImpl.FieldAccessor void setElementL(java.lang.Class&lt;V[]&gt;, V[], int, V) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandleImpl.FieldAccessor void setElementL(java.lang.Object[], int, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandleImpl.FieldAccessor void setElementS(short[], int, short) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandleImpl.FieldAccessor void setElementZ(boolean[], int, boolean) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandleImpl.GuardWithCatch GuardWithCatch(java.lang.invoke.MethodHandle, java.lang.Class&lt;? extends java.lang.Throwable&gt;, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandleImpl.GuardWithCatch GuardWithCatch(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.Class&lt;? extends java.lang.Throwable&gt;, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandleImpl.GuardWithTest GuardWithTest(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandleImpl.GuardWithTest java.lang.invoke.MethodHandle make(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandleImpl.GuardWithTest java.lang.invoke.MethodHandle make(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandleNatives java.lang.Object[] makeTarget(java.lang.Class&lt;?&gt;, java.lang.String, java.lang.String, int, java.lang.Class&lt;?&gt;)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandleNatives java.lang.invoke.CallSite makeDynamicCallSite(java.lang.invoke.MethodHandle, java.lang.String, java.lang.invoke.MethodType, java.lang.Object, java.lang.invoke.MemberName, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandleNatives java.lang.invoke.CallSite makeDynamicCallSite(java.lang.invoke.MethodHandle, java.lang.String, java.lang.invoke.MethodType, java.lang.Object, java.lang.invoke.MemberName, int) 4">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandleNatives java.lang.invoke.MethodHandle linkMethodHandleConstant(java.lang.Class&lt;?&gt;, int, java.lang.Class&lt;?&gt;, java.lang.String, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandleNatives java.lang.invoke.MethodHandle linkMethodHandleConstant(java.lang.Class&lt;?&gt;, int, java.lang.Class&lt;?&gt;, java.lang.String, java.lang.Object) 4">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandleNatives java.lang.invoke.MethodType findMethodHandleType(java.lang.Class&lt;?&gt;, java.lang.Class&lt;?&gt;[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandleNatives void notifyGenericMethodType(java.lang.invoke.MethodType) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandleNatives void raiseException(int, java.lang.Object, java.lang.Object) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandleStatics java.lang.Error uncaughtException(java.lang.Exception)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandleStatics java.lang.RuntimeException newIllegalArgumentException(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandleStatics java.lang.RuntimeException newIllegalArgumentException(java.lang.String, java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandleStatics java.lang.RuntimeException newIllegalStateException(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandleStatics java.lang.RuntimeException newIllegalStateException(java.lang.String, java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandleStatics java.lang.String addTypeString(java.lang.Object, java.lang.invoke.MethodHandle)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,!null-&gt;!null;null,_-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.lang.invoke.MethodHandleStatics java.lang.String getNameString(java.lang.invoke.MethodHandle)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandleStatics java.lang.String getNameString(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandleStatics java.lang.String getNameString(java.lang.invoke.MethodHandle, java.lang.invoke.MethodType)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandleStatics java.lang.String message(java.lang.String, java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_-&gt;!null;_,!null-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.lang.invoke.MethodHandles T asInstance(java.lang.invoke.MethodHandle, java.lang.Class&lt;T&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles T asInstance(java.lang.invoke.MethodHandle, java.lang.Class&lt;T&gt;) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles T1 checkValue(java.lang.Class&lt;T0&gt;, java.lang.Class&lt;T1&gt;, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles boolean access$100(java.lang.reflect.Method) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles boolean isObjectMethod(java.lang.reflect.Method) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles java.lang.Class&lt;?&gt; wrapperInstanceType(java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles java.lang.Object access$200(java.lang.Object, java.lang.reflect.Method, java.lang.Object[]) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles java.lang.Object callObjectMethod(java.lang.Object, java.lang.reflect.Method, java.lang.Object[]) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles java.lang.RuntimeException misMatchedTypes(java.lang.String, java.lang.invoke.MethodType, java.lang.invoke.MethodType)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles java.lang.invoke.MethodHandle arrayElementGetter(java.lang.Class&lt;?&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles java.lang.invoke.MethodHandle arrayElementSetter(java.lang.Class&lt;?&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles java.lang.invoke.MethodHandle asVarargsCollector(java.lang.invoke.MethodHandle, java.lang.Class&lt;?&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles java.lang.invoke.MethodHandle asVarargsCollector(java.lang.invoke.MethodHandle, java.lang.Class&lt;?&gt;)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles java.lang.invoke.MethodHandle catchException(java.lang.invoke.MethodHandle, java.lang.Class&lt;? extends java.lang.Throwable&gt;, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles java.lang.invoke.MethodHandle catchException(java.lang.invoke.MethodHandle, java.lang.Class&lt;? extends java.lang.Throwable&gt;, java.lang.invoke.MethodHandle) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles java.lang.invoke.MethodHandle collectArguments(java.lang.invoke.MethodHandle, java.lang.invoke.MethodType) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles java.lang.invoke.MethodHandle collectArguments(java.lang.invoke.MethodHandle, java.lang.invoke.MethodType) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles java.lang.invoke.MethodHandle constant(java.lang.Class&lt;?&gt;, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles java.lang.invoke.MethodHandle convertArguments(java.lang.invoke.MethodHandle, java.lang.invoke.MethodType) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles java.lang.invoke.MethodHandle dropArguments(java.lang.invoke.MethodHandle, int, java.lang.Class&lt;?&gt;...) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles java.lang.invoke.MethodHandle dropArguments(java.lang.invoke.MethodHandle, int, java.lang.Class&lt;?&gt;...)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.lang.invoke.MethodHandles java.lang.invoke.MethodHandle dropArguments(java.lang.invoke.MethodHandle, int, java.util.List&lt;java.lang.Class&lt;?&gt;&gt;) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles java.lang.invoke.MethodHandle dropArguments(java.lang.invoke.MethodHandle, int, java.util.List&lt;java.lang.Class&lt;?&gt;&gt;)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.lang.invoke.MethodHandles java.lang.invoke.MethodHandle exactInvoker(java.lang.invoke.MethodType) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles java.lang.invoke.MethodHandle explicitCastArguments(java.lang.invoke.MethodHandle, java.lang.invoke.MethodType) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles java.lang.invoke.MethodHandle filterArguments(java.lang.invoke.MethodHandle, int, java.lang.invoke.MethodHandle...) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles java.lang.invoke.MethodHandle filterArguments(java.lang.invoke.MethodHandle, int, java.lang.invoke.MethodHandle...) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles java.lang.invoke.MethodHandle filterReturnValue(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles java.lang.invoke.MethodHandle filterReturnValue(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles java.lang.invoke.MethodHandle foldArguments(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles java.lang.invoke.MethodHandle foldArguments(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles java.lang.invoke.MethodHandle genericInvoker(java.lang.invoke.MethodType) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles java.lang.invoke.MethodHandle guardWithTest(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles java.lang.invoke.MethodHandle guardWithTest(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles java.lang.invoke.MethodHandle guardWithTest(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles java.lang.invoke.MethodHandle insertArguments(java.lang.invoke.MethodHandle, int, java.lang.Object...) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles java.lang.invoke.MethodHandle insertArguments(java.lang.invoke.MethodHandle, int, java.lang.Object...) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles java.lang.invoke.MethodHandle permuteArguments(java.lang.invoke.MethodHandle, java.lang.invoke.MethodType, int...) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles java.lang.invoke.MethodHandle permuteArguments(java.lang.invoke.MethodHandle, java.lang.invoke.MethodType, int...) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles java.lang.invoke.MethodHandle permuteArguments(java.lang.invoke.MethodHandle, java.lang.invoke.MethodType, int...) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles java.lang.invoke.MethodHandle spreadArguments(java.lang.invoke.MethodHandle, java.lang.invoke.MethodType) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles java.lang.invoke.MethodHandle spreadArguments(java.lang.invoke.MethodHandle, java.lang.invoke.MethodType) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles java.lang.invoke.MethodHandle spreadInvoker(java.lang.invoke.MethodType, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles java.lang.invoke.MethodHandle throwException(java.lang.Class&lt;?&gt;, java.lang.Class&lt;? extends java.lang.Throwable&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles java.lang.invoke.MethodHandle wrapperInstanceTarget(java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles java.lang.invoke.MethodHandles.Lookup lookup()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles java.lang.reflect.Constructor getSingleConstructor(java.lang.Class&lt;?&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles java.lang.reflect.Method getSingleMethod(java.lang.Class&lt;?&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles sun.invoke.WrapperInstance asWrapperInstance(java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles sun.invoke.WrapperInstance asWrapperInstance(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.lang.invoke.MethodHandles void checkReorder(int[], java.lang.invoke.MethodType, java.lang.invoke.MethodType) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles void checkReorder(int[], java.lang.invoke.MethodType, java.lang.invoke.MethodType) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles void checkReorder(int[], java.lang.invoke.MethodType, java.lang.invoke.MethodType) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles.1 java.lang.Object invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[]) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles.Lookup java.lang.String accessFailedMessage(java.lang.Class&lt;?&gt;, java.lang.invoke.MemberName) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles.Lookup java.lang.String accessFailedMessage(java.lang.Class&lt;?&gt;, java.lang.invoke.MemberName)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles.Lookup java.lang.invoke.MemberName resolveOrFail(java.lang.Class&lt;?&gt;, java.lang.String, java.lang.Class&lt;?&gt;, boolean) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles.Lookup java.lang.invoke.MemberName resolveOrFail(java.lang.Class&lt;?&gt;, java.lang.String, java.lang.Class&lt;?&gt;, boolean) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles.Lookup java.lang.invoke.MemberName resolveOrFail(java.lang.Class&lt;?&gt;, java.lang.String, java.lang.invoke.MethodType, boolean) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles.Lookup java.lang.invoke.MemberName resolveOrFail(java.lang.Class&lt;?&gt;, java.lang.String, java.lang.invoke.MethodType, boolean) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles.Lookup java.lang.invoke.MemberName resolveOrFail(java.lang.Class&lt;?&gt;, java.lang.String, java.lang.invoke.MethodType, boolean, boolean, java.lang.Class&lt;?&gt;) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles.Lookup java.lang.invoke.MemberName resolveOrFail(java.lang.Class&lt;?&gt;, java.lang.String, java.lang.invoke.MethodType, boolean, boolean, java.lang.Class&lt;?&gt;) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles.Lookup java.lang.invoke.MethodHandle bind(java.lang.Object, java.lang.String, java.lang.invoke.MethodType) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles.Lookup java.lang.invoke.MethodHandle bind(java.lang.Object, java.lang.String, java.lang.invoke.MethodType) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles.Lookup java.lang.invoke.MethodHandle bind(java.lang.Object, java.lang.String, java.lang.invoke.MethodType) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles.Lookup java.lang.invoke.MethodHandle findConstructor(java.lang.Class&lt;?&gt;, java.lang.invoke.MethodType) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles.Lookup java.lang.invoke.MethodHandle findGetter(java.lang.Class&lt;?&gt;, java.lang.String, java.lang.Class&lt;?&gt;) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles.Lookup java.lang.invoke.MethodHandle findGetter(java.lang.Class&lt;?&gt;, java.lang.String, java.lang.Class&lt;?&gt;) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles.Lookup java.lang.invoke.MethodHandle findSetter(java.lang.Class&lt;?&gt;, java.lang.String, java.lang.Class&lt;?&gt;) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles.Lookup java.lang.invoke.MethodHandle findSetter(java.lang.Class&lt;?&gt;, java.lang.String, java.lang.Class&lt;?&gt;) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles.Lookup java.lang.invoke.MethodHandle findSpecial(java.lang.Class&lt;?&gt;, java.lang.String, java.lang.invoke.MethodType, java.lang.Class&lt;?&gt;) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles.Lookup java.lang.invoke.MethodHandle findSpecial(java.lang.Class&lt;?&gt;, java.lang.String, java.lang.invoke.MethodType, java.lang.Class&lt;?&gt;) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles.Lookup java.lang.invoke.MethodHandle findStatic(java.lang.Class&lt;?&gt;, java.lang.String, java.lang.invoke.MethodType) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles.Lookup java.lang.invoke.MethodHandle findStatic(java.lang.Class&lt;?&gt;, java.lang.String, java.lang.invoke.MethodType) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles.Lookup java.lang.invoke.MethodHandle findStaticGetter(java.lang.Class&lt;?&gt;, java.lang.String, java.lang.Class&lt;?&gt;) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles.Lookup java.lang.invoke.MethodHandle findStaticGetter(java.lang.Class&lt;?&gt;, java.lang.String, java.lang.Class&lt;?&gt;) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles.Lookup java.lang.invoke.MethodHandle findStaticSetter(java.lang.Class&lt;?&gt;, java.lang.String, java.lang.Class&lt;?&gt;) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles.Lookup java.lang.invoke.MethodHandle findStaticSetter(java.lang.Class&lt;?&gt;, java.lang.String, java.lang.Class&lt;?&gt;) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles.Lookup java.lang.invoke.MethodHandle findVirtual(java.lang.Class&lt;?&gt;, java.lang.String, java.lang.invoke.MethodType) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles.Lookup java.lang.invoke.MethodHandle findVirtual(java.lang.Class&lt;?&gt;, java.lang.String, java.lang.invoke.MethodType) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles.Lookup java.lang.invoke.MethodHandle fixVarargs(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles.Lookup java.lang.invoke.MethodHandle fixVarargs(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles.Lookup java.lang.invoke.MethodHandle makeAccessor(java.lang.Class&lt;?&gt;, java.lang.String, java.lang.Class&lt;?&gt;, boolean, boolean) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles.Lookup java.lang.invoke.MethodHandle makeAccessor(java.lang.Class&lt;?&gt;, java.lang.String, java.lang.Class&lt;?&gt;, boolean, boolean) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles.Lookup java.lang.invoke.MethodHandle makeAccessor(java.lang.Class&lt;?&gt;, java.lang.invoke.MemberName, boolean, boolean) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles.Lookup java.lang.invoke.MethodHandle makeAccessor(java.lang.Class&lt;?&gt;, java.lang.invoke.MemberName, boolean, boolean)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,_,true,_-&gt;!null;_,null,_,_-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.lang.invoke.MethodHandles.Lookup java.lang.invoke.MethodHandle restrictProtectedReceiver(java.lang.invoke.MemberName, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles.Lookup java.lang.invoke.MethodHandle restrictProtectedReceiver(java.lang.invoke.MemberName, java.lang.invoke.MethodHandle)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.lang.invoke.MethodHandles.Lookup java.lang.invoke.MethodHandle restrictReceiver(java.lang.invoke.MemberName, java.lang.invoke.MethodHandle, java.lang.Class&lt;?&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles.Lookup java.lang.invoke.MethodHandle restrictReceiver(java.lang.invoke.MemberName, java.lang.invoke.MethodHandle, java.lang.Class&lt;?&gt;) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles.Lookup java.lang.invoke.MethodHandle unreflect(java.lang.reflect.Method) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles.Lookup java.lang.invoke.MethodHandle unreflectConstructor(java.lang.reflect.Constructor) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles.Lookup java.lang.invoke.MethodHandle unreflectGetter(java.lang.reflect.Field) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles.Lookup java.lang.invoke.MethodHandle unreflectSetter(java.lang.reflect.Field) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles.Lookup java.lang.invoke.MethodHandle unreflectSpecial(java.lang.reflect.Method, java.lang.Class&lt;?&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles.Lookup java.lang.invoke.MethodHandles.Lookup in(java.lang.Class&lt;?&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles.Lookup java.lang.invoke.MethodHandles.Lookup in(java.lang.Class&lt;?&gt;)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles.Lookup void checkMethod(java.lang.Class&lt;?&gt;, java.lang.invoke.MemberName, boolean) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodHandles.Lookup void checkUnprivilegedlookupClass(java.lang.Class&lt;?&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodType MethodType(java.lang.Class&lt;?&gt;, java.lang.Class&lt;?&gt;[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodType MethodType(java.lang.Class&lt;?&gt;, java.lang.Class&lt;?&gt;[]) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodType boolean equals(java.lang.invoke.MethodType) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodType int checkPtype(java.lang.Class&lt;?&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodType int checkPtypes(java.lang.Class&lt;?&gt;[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodType java.lang.IndexOutOfBoundsException newIndexOutOfBoundsException(java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodType java.lang.IndexOutOfBoundsException newIndexOutOfBoundsException(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodType java.lang.String toString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodType java.lang.invoke.MethodType appendParameterTypes(java.lang.Class&lt;?&gt;...) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodType java.lang.invoke.MethodType appendParameterTypes(java.util.List&lt;java.lang.Class&lt;?&gt;&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodType java.lang.invoke.MethodType insertParameterTypes(int, java.lang.Class&lt;?&gt;...) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodType java.lang.invoke.MethodType insertParameterTypes(int, java.util.List&lt;java.lang.Class&lt;?&gt;&gt;) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodType java.lang.invoke.MethodType makeImpl(java.lang.Class&lt;?&gt;, java.lang.Class&lt;?&gt;[], boolean) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodType java.lang.invoke.MethodType methodType(java.lang.Class&lt;?&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodType java.lang.invoke.MethodType methodType(java.lang.Class&lt;?&gt;, java.lang.Class&lt;?&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodType java.lang.invoke.MethodType methodType(java.lang.Class&lt;?&gt;, java.lang.Class&lt;?&gt;, java.lang.Class&lt;?&gt;...) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodType java.lang.invoke.MethodType methodType(java.lang.Class&lt;?&gt;, java.lang.Class&lt;?&gt;, java.lang.Class&lt;?&gt;...) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodType java.lang.invoke.MethodType methodType(java.lang.Class&lt;?&gt;, java.lang.Class&lt;?&gt;[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodType java.lang.invoke.MethodType methodType(java.lang.Class&lt;?&gt;, java.lang.invoke.MethodType) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodType java.lang.invoke.MethodType methodType(java.lang.Class&lt;?&gt;, java.lang.invoke.MethodType) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodType java.lang.invoke.MethodType methodType(java.lang.Class&lt;?&gt;, java.util.List&lt;java.lang.Class&lt;?&gt;&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodType java.lang.invoke.MethodType methodType(java.lang.Class&lt;?&gt;, java.util.List&lt;java.lang.Class&lt;?&gt;&gt;) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodType java.lang.invoke.MethodType unwrapWithNoPrims(java.lang.invoke.MethodType) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodType java.lang.invoke.MethodType wrapWithPrims(java.lang.invoke.MethodType) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodType java.util.List&lt;java.lang.Class&lt;?&gt;&gt; parameterList()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodType void MethodType_init(java.lang.Class&lt;?&gt;, java.lang.Class&lt;?&gt;[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodType void MethodType_init(java.lang.Class&lt;?&gt;, java.lang.Class&lt;?&gt;[]) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodType void checkRtype(java.lang.Class&lt;?&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodType void readObject(java.io.ObjectInputStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodType void writeObject(java.io.ObjectOutputStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodTypeForm MethodTypeForm(java.lang.invoke.MethodType) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodTypeForm int[] primsAtEndOrder(java.lang.invoke.MethodType) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodTypeForm java.lang.Class&lt;?&gt; canonicalize(java.lang.Class&lt;?&gt;, int)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.lang.invoke.MethodTypeForm java.lang.Class&lt;?&gt;[] canonicalizes(java.lang.Class&lt;?&gt;[], int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodTypeForm java.lang.String toString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodTypeForm java.lang.invoke.MethodType canonicalize(java.lang.invoke.MethodType, int, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MethodTypeForm java.lang.invoke.MethodType reorderParameters(java.lang.invoke.MethodType, int[], java.lang.Class&lt;?&gt;[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.lang.invoke.MethodTypeForm java.lang.invoke.MethodTypeForm findForm(java.lang.invoke.MethodType) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MutableCallSite MutableCallSite(java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MutableCallSite MutableCallSite(java.lang.invoke.MethodType) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.MutableCallSite void syncAll(java.lang.invoke.MutableCallSite[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.SpreadGeneric java.lang.Object check(java.lang.Object, int)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_-&gt;!null;null,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.lang.invoke.SpreadGeneric java.lang.Object select(java.lang.Object, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.SpreadGeneric java.lang.String toString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.SpreadGeneric java.lang.invoke.MethodHandle access$000(java.lang.invoke.SpreadGeneric) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.SpreadGeneric java.lang.invoke.MethodHandle make(java.lang.invoke.MethodHandle, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.SpreadGeneric java.lang.invoke.MethodHandle makeInstance(java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.SpreadGeneric java.lang.invoke.MethodType preSpreadType(java.lang.invoke.MethodType, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.SpreadGeneric java.lang.invoke.SpreadGeneric of(java.lang.invoke.MethodType, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.SpreadGeneric java.lang.invoke.SpreadGeneric.Adapter findAdapter(java.lang.invoke.SpreadGeneric, java.lang.invoke.MethodHandle[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.SpreadGeneric java.lang.invoke.SpreadGeneric.Adapter findAdapter(java.lang.invoke.SpreadGeneric, java.lang.invoke.MethodHandle[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.lang.invoke.SpreadGeneric.Adapter Adapter(java.lang.invoke.SpreadGeneric, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.SpreadGeneric.S0 S0(java.lang.invoke.SpreadGeneric, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.SpreadGeneric.S0 java.lang.invoke.SpreadGeneric.S0 makeInstance(java.lang.invoke.SpreadGeneric, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.SpreadGeneric.S0 java.lang.invoke.SpreadGeneric.S0 makeInstance(java.lang.invoke.SpreadGeneric, java.lang.invoke.MethodHandle)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.SpreadGeneric.S1 S1(java.lang.invoke.SpreadGeneric, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.SpreadGeneric.S1 java.lang.invoke.SpreadGeneric.S1 makeInstance(java.lang.invoke.SpreadGeneric, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.SpreadGeneric.S1 java.lang.invoke.SpreadGeneric.S1 makeInstance(java.lang.invoke.SpreadGeneric, java.lang.invoke.MethodHandle)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.SpreadGeneric.S10 S10(java.lang.invoke.SpreadGeneric, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.SpreadGeneric.S10 java.lang.invoke.SpreadGeneric.S10 makeInstance(java.lang.invoke.SpreadGeneric, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.SpreadGeneric.S10 java.lang.invoke.SpreadGeneric.S10 makeInstance(java.lang.invoke.SpreadGeneric, java.lang.invoke.MethodHandle)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.SpreadGeneric.S2 S2(java.lang.invoke.SpreadGeneric, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.SpreadGeneric.S2 java.lang.invoke.SpreadGeneric.S2 makeInstance(java.lang.invoke.SpreadGeneric, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.SpreadGeneric.S2 java.lang.invoke.SpreadGeneric.S2 makeInstance(java.lang.invoke.SpreadGeneric, java.lang.invoke.MethodHandle)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.SpreadGeneric.S3 S3(java.lang.invoke.SpreadGeneric, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.SpreadGeneric.S3 java.lang.invoke.SpreadGeneric.S3 makeInstance(java.lang.invoke.SpreadGeneric, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.SpreadGeneric.S3 java.lang.invoke.SpreadGeneric.S3 makeInstance(java.lang.invoke.SpreadGeneric, java.lang.invoke.MethodHandle)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.SpreadGeneric.S4 S4(java.lang.invoke.SpreadGeneric, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.SpreadGeneric.S4 java.lang.invoke.SpreadGeneric.S4 makeInstance(java.lang.invoke.SpreadGeneric, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.SpreadGeneric.S4 java.lang.invoke.SpreadGeneric.S4 makeInstance(java.lang.invoke.SpreadGeneric, java.lang.invoke.MethodHandle)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.SpreadGeneric.S5 S5(java.lang.invoke.SpreadGeneric, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.SpreadGeneric.S5 java.lang.invoke.SpreadGeneric.S5 makeInstance(java.lang.invoke.SpreadGeneric, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.SpreadGeneric.S5 java.lang.invoke.SpreadGeneric.S5 makeInstance(java.lang.invoke.SpreadGeneric, java.lang.invoke.MethodHandle)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.SpreadGeneric.S6 S6(java.lang.invoke.SpreadGeneric, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.SpreadGeneric.S6 java.lang.invoke.SpreadGeneric.S6 makeInstance(java.lang.invoke.SpreadGeneric, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.SpreadGeneric.S6 java.lang.invoke.SpreadGeneric.S6 makeInstance(java.lang.invoke.SpreadGeneric, java.lang.invoke.MethodHandle)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.SpreadGeneric.S7 S7(java.lang.invoke.SpreadGeneric, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.SpreadGeneric.S7 java.lang.invoke.SpreadGeneric.S7 makeInstance(java.lang.invoke.SpreadGeneric, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.SpreadGeneric.S7 java.lang.invoke.SpreadGeneric.S7 makeInstance(java.lang.invoke.SpreadGeneric, java.lang.invoke.MethodHandle)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.SpreadGeneric.S8 S8(java.lang.invoke.SpreadGeneric, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.SpreadGeneric.S8 java.lang.invoke.SpreadGeneric.S8 makeInstance(java.lang.invoke.SpreadGeneric, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.SpreadGeneric.S8 java.lang.invoke.SpreadGeneric.S8 makeInstance(java.lang.invoke.SpreadGeneric, java.lang.invoke.MethodHandle)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.SpreadGeneric.S9 S9(java.lang.invoke.SpreadGeneric, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.SpreadGeneric.S9 java.lang.invoke.SpreadGeneric.S9 makeInstance(java.lang.invoke.SpreadGeneric, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.SpreadGeneric.S9 java.lang.invoke.SpreadGeneric.S9 makeInstance(java.lang.invoke.SpreadGeneric, java.lang.invoke.MethodHandle)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.SwitchPoint java.lang.invoke.MethodHandle guardWithTest(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.lang.invoke.SwitchPoint void invalidateAll(java.lang.invoke.SwitchPoint[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.ToGeneric ToGeneric(java.lang.invoke.MethodType) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.ToGeneric java.lang.String toString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.ToGeneric java.lang.invoke.MethodHandle computeReturnConversion(java.lang.invoke.MethodType, java.lang.invoke.MethodType, boolean) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.ToGeneric java.lang.invoke.MethodHandle computeReturnConversion(java.lang.invoke.MethodType, java.lang.invoke.MethodType, boolean) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.ToGeneric java.lang.invoke.MethodHandle make(java.lang.invoke.MethodType, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.ToGeneric java.lang.invoke.MethodHandle make(java.lang.invoke.MethodType, java.lang.invoke.MethodHandle) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.ToGeneric java.lang.invoke.MethodHandle makeRawArgumentFilter(java.lang.invoke.MethodHandle, java.lang.invoke.MethodType, java.lang.invoke.MethodType) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.ToGeneric java.lang.invoke.MethodHandle makeRawArgumentFilter(java.lang.invoke.MethodHandle, java.lang.invoke.MethodType, java.lang.invoke.MethodType)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.lang.invoke.ToGeneric java.lang.invoke.ToGeneric of(java.lang.invoke.MethodType) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.ToGeneric java.lang.invoke.ToGeneric.Adapter findAdapter(java.lang.invoke.MethodType) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.ToGeneric java.lang.invoke.ToGeneric.Adapter makeInstance(java.lang.invoke.MethodType, java.lang.invoke.MethodHandle) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.ToGeneric.A0 A0(java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.ToGeneric.A0 A0(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.ToGeneric.A0 java.lang.invoke.ToGeneric.A0 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.ToGeneric.A0 java.lang.invoke.ToGeneric.A0 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.ToGeneric.A1 A1(java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.ToGeneric.A1 A1(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.ToGeneric.A1 java.lang.invoke.ToGeneric.A1 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.ToGeneric.A1 java.lang.invoke.ToGeneric.A1 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.ToGeneric.A10 A10(java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.ToGeneric.A10 A10(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.ToGeneric.A10 java.lang.invoke.ToGeneric.A10 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.ToGeneric.A10 java.lang.invoke.ToGeneric.A10 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.ToGeneric.A2 A2(java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.ToGeneric.A2 A2(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.ToGeneric.A2 java.lang.invoke.ToGeneric.A2 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.ToGeneric.A2 java.lang.invoke.ToGeneric.A2 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.ToGeneric.A3 A3(java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.ToGeneric.A3 A3(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.ToGeneric.A3 java.lang.invoke.ToGeneric.A3 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.ToGeneric.A3 java.lang.invoke.ToGeneric.A3 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.ToGeneric.A4 A4(java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.ToGeneric.A4 A4(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.ToGeneric.A4 java.lang.invoke.ToGeneric.A4 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.ToGeneric.A4 java.lang.invoke.ToGeneric.A4 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.ToGeneric.A5 A5(java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.ToGeneric.A5 A5(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.ToGeneric.A5 java.lang.invoke.ToGeneric.A5 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.ToGeneric.A5 java.lang.invoke.ToGeneric.A5 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.ToGeneric.A6 A6(java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.ToGeneric.A6 A6(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.ToGeneric.A6 java.lang.invoke.ToGeneric.A6 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.ToGeneric.A6 java.lang.invoke.ToGeneric.A6 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.ToGeneric.A7 A7(java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.ToGeneric.A7 A7(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.ToGeneric.A7 java.lang.invoke.ToGeneric.A7 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.ToGeneric.A7 java.lang.invoke.ToGeneric.A7 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.ToGeneric.A8 A8(java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.ToGeneric.A8 A8(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.ToGeneric.A8 java.lang.invoke.ToGeneric.A8 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.ToGeneric.A8 java.lang.invoke.ToGeneric.A8 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.ToGeneric.A9 A9(java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.ToGeneric.A9 A9(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.ToGeneric.A9 java.lang.invoke.ToGeneric.A9 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.ToGeneric.A9 java.lang.invoke.ToGeneric.A9 makeInstance(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.ToGeneric.Adapter Adapter(java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.ToGeneric.Adapter Adapter(java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.VolatileCallSite VolatileCallSite(java.lang.invoke.MethodHandle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.lang.invoke.VolatileCallSite VolatileCallSite(java.lang.invoke.MethodType) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+</root>
diff --git a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/net/annotations.xml b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/net/annotations.xml
new file mode 100644
index 000000000000..6c410bc4ed65
--- /dev/null
+++ b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/net/annotations.xml
@@ -0,0 +1,422 @@
+<root>
+ <item name="java.net.DatagramPacket DatagramPacket(byte[], int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.DatagramPacket DatagramPacket(byte[], int, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.DatagramPacket DatagramPacket(byte[], int, int, java.net.InetAddress, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.DatagramPacket DatagramPacket(byte[], int, int, java.net.SocketAddress) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.DatagramPacket DatagramPacket(byte[], int, int, java.net.SocketAddress) 3">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.DatagramPacket DatagramPacket(byte[], int, java.net.InetAddress, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.DatagramPacket DatagramPacket(byte[], int, java.net.SocketAddress) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.DatagramPacket DatagramPacket(byte[], int, java.net.SocketAddress) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.DatagramPacket java.net.SocketAddress getSocketAddress()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.DatagramPacket void setData(byte[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.DatagramPacket void setData(byte[], int, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.DatagramPacket void setSocketAddress(java.net.SocketAddress) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.DatagramSocket DatagramSocket(java.net.DatagramSocketImpl) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.DatagramSocket void connect(java.net.InetAddress, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.DatagramSocket void connect(java.net.SocketAddress) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.DatagramSocket void connectInternal(java.net.InetAddress, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.DatagramSocket void receive(java.net.DatagramPacket) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.DatagramSocket void send(java.net.DatagramPacket) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.InetAddress boolean equals(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;false;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.net.InetAddress int checkNumericZone(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.InetAddress java.lang.Object checkLookupTable(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.net.InetAddress java.lang.Object getCachedAddress(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.InetAddress java.lang.Object readResolve()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.InetAddress java.lang.String getHostFromNameService(java.net.InetAddress, boolean) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.InetAddress java.lang.String toString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.InetAddress java.net.InetAddress getByAddress(byte[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.InetAddress java.net.InetAddress getByAddress(byte[])">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.InetAddress java.net.InetAddress getByAddress(java.lang.String, byte[]) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.InetAddress java.net.InetAddress getByAddress(java.lang.String, byte[])">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.InetAddress java.net.InetAddress[] getAllByName(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.net.InetAddress java.net.InetAddress[] getAllByName0(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.InetAddress java.net.InetAddress[] getAllByName0(java.lang.String, boolean) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.InetAddress sun.net.spi.nameservice.NameService access$002(sun.net.spi.nameservice.NameService)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;!null;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.net.ServerSocket ServerSocket(java.net.Proxy) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.ServerSocket java.lang.String toString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.ServerSocket java.net.Socket accept()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.ServerSocket java.net.SocketImpl access$000(java.net.ServerSocket) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.ServerSocket void implAccept(java.net.Socket) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.Socket Socket(java.net.SocketAddress, java.net.SocketAddress, boolean) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.Socket java.lang.String toString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.Socket void connect(java.net.SocketAddress, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.URI int access$2502(java.net.URI, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.URI int compareTo(java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.URI int compareTo(java.net.URI) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.URI int join(char[], int[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.URI int join(char[], int[]) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.URI int needsNormalization(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.URI java.lang.String access$002(java.net.URI, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.URI java.lang.String access$002(java.net.URI, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,!null-&gt;!null;_,null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.net.URI java.lang.String access$1002(java.net.URI, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.URI java.lang.String access$1002(java.net.URI, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,!null-&gt;!null;_,null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.net.URI java.lang.String access$1102(java.net.URI, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.URI java.lang.String access$1102(java.net.URI, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,!null-&gt;!null;_,null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.net.URI java.lang.String access$1402(java.net.URI, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.URI java.lang.String access$1402(java.net.URI, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,!null-&gt;!null;_,null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.net.URI java.lang.String access$1502(java.net.URI, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.URI java.lang.String access$1502(java.net.URI, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,!null-&gt;!null;_,null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.net.URI java.lang.String access$2202(java.net.URI, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.URI java.lang.String access$2202(java.net.URI, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,!null-&gt;!null;_,null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.net.URI java.lang.String access$2302(java.net.URI, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.URI java.lang.String access$2302(java.net.URI, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,!null-&gt;!null;_,null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.net.URI java.lang.String access$2402(java.net.URI, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.URI java.lang.String access$2402(java.net.URI, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,!null-&gt;!null;_,null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.net.URI java.lang.String access$702(java.net.URI, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.URI java.lang.String access$702(java.net.URI, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,!null-&gt;!null;_,null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.net.URI java.lang.String decode(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;!null;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.net.URI java.lang.String encode(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.URI java.lang.String encode(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.net.URI java.lang.String normalize(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.URI java.lang.String normalize(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;!null;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.net.URI java.lang.String quote(java.lang.String, long, long) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.URI java.lang.String quote(java.lang.String, long, long)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_,_-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.net.URI java.lang.String resolvePath(java.lang.String, java.lang.String, boolean) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.URI java.lang.String resolvePath(java.lang.String, java.lang.String, boolean) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.URI java.lang.String toString(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, int, java.lang.String, java.lang.String, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.URI java.net.URI create(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.URI java.net.URI normalize(java.net.URI) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.URI java.net.URI normalize(java.net.URI)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.net.URI java.net.URI parseServerAuthority()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.URI java.net.URI relativize(java.net.URI) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.URI java.net.URI relativize(java.net.URI)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.net.URI java.net.URI relativize(java.net.URI, java.net.URI) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.URI java.net.URI relativize(java.net.URI, java.net.URI)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,!null-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.net.URI java.net.URI resolve(java.net.URI) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.URI java.net.URI resolve(java.net.URI, java.net.URI) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.URI java.net.URL toURL()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.URI long highMask(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.URI long lowMask(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.URI void appendEscape(java.lang.StringBuffer, byte) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.URI void maybeAddLeadingDot(char[], int[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.URI void readObject(java.io.ObjectInputStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.URI void removeDots(char[], int[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.URI void removeDots(char[], int[]) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.URI void split(char[], int[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.URI void split(char[], int[]) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.URI void writeObject(java.io.ObjectOutputStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.URL URL(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.URL URL(java.lang.String, java.lang.String, int, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.URL URL(java.lang.String, java.lang.String, int, java.lang.String, java.net.URLStreamHandler) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.URL URL(java.lang.String, java.lang.String, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.URL URL(java.net.URL, java.lang.String) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.URL URL(java.net.URL, java.lang.String, java.net.URLStreamHandler) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.URL boolean equals(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.net.URL boolean isValidProtocol(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.URL java.net.URI toURI()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.URL java.net.URLConnection openConnection(java.net.Proxy) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.URL void checkSpecifyHandler(java.lang.SecurityManager) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.URL void readObject(java.io.ObjectInputStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.URL void set(java.lang.String, java.lang.String, int, java.lang.String, java.lang.String) 3">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.URL void writeObject(java.io.ObjectOutputStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.URLConnection boolean checkfpx(java.io.InputStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.URLConnection int readBytes(int[], int, java.io.InputStream) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.URLConnection java.lang.String getContentHandlerPkgPrefixes()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.URLConnection java.lang.String getDefaultRequestProperty(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;null;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.net.URLConnection java.lang.String getHeaderField(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;null;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.net.URLConnection java.lang.String guessContentTypeFromStream(java.io.InputStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.URLConnection java.lang.String stripOffParameters(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;!null;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.net.URLConnection java.lang.String toString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.URLConnection java.lang.String typeToPackageName(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.URLConnection java.lang.String typeToPackageName(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.URLConnection java.net.ContentHandler lookupContentHandlerClassFor(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.URLConnection java.net.FileNameMap getFileNameMap()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.URLConnection void addRequestProperty(java.lang.String, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.net.URLConnection void setRequestProperty(java.lang.String, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+</root>
diff --git a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/security/annotations.xml b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/security/annotations.xml
new file mode 100644
index 000000000000..756cbfcdd13e
--- /dev/null
+++ b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/security/annotations.xml
@@ -0,0 +1,132 @@
+<root>
+ <item name="java.security.Identity boolean identityEquals(java.security.Identity) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.security.Identity boolean keyEquals(java.security.Key, java.security.Key) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.security.Identity boolean keyEquals(java.security.Key, java.security.Key) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.security.Identity java.lang.String printKeys()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.security.Identity java.lang.String toString(boolean)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;true-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.security.Identity java.security.Certificate[] certificates()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.security.Identity void addCertificate(java.security.Certificate) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.security.Policy java.security.PermissionCollection getPermissions(java.security.ProtectionDomain)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.security.Policy void initPolicy(java.security.Policy) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.security.Provider java.lang.String toString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.security.Provider java.lang.String[] getTypeAndAlgorithm(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.security.Provider java.util.Collection values()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.security.Provider java.util.Set keySet()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.security.Provider void implPutAll(java.util.Map) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.security.Provider void parseLegacyPut(java.lang.String, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.security.Provider void putAll(java.util.Map) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.security.Provider void putPropertyStrings(java.security.Provider.Service) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.security.Provider void putService(java.security.Provider.Service) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.security.Provider void removeInvalidServices(java.util.Map&lt;java.security.Provider.ServiceKey,java.security.Provider.Service&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.security.Provider void removePropertyStrings(java.security.Provider.Service) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.security.Provider void removeService(java.security.Provider.Service) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.security.Security boolean isConstraintSatisfied(java.lang.String, java.lang.String, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.security.Security boolean isCriterionSatisfied(java.security.Provider, java.lang.String, java.lang.String, java.lang.String, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.security.Security boolean isStandardAttr(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.security.Security int addProvider(java.security.Provider) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.security.Security int insertProviderAt(java.security.Provider, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.security.Security java.io.File securityPropFile(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.security.Security java.lang.String getProviderProperty(java.lang.String, java.security.Provider) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.security.Security java.lang.String[] getFilterComponents(java.lang.String, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.security.Security java.lang.String[] getFilterComponents(java.lang.String, java.lang.String) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.security.Security java.lang.String[] getFilterComponents(java.lang.String, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.security.Security java.security.Provider[] getProviders(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.security.Security java.security.Provider[] getProviders(java.util.Map) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.security.Security java.util.LinkedHashSet getAllQualifyingCandidates(java.lang.String, java.lang.String, java.security.Provider[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.security.Security java.util.LinkedHashSet getAllQualifyingCandidates(java.lang.String, java.lang.String, java.security.Provider[]) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.security.Security java.util.LinkedHashSet getAllQualifyingCandidates(java.lang.String, java.lang.String, java.security.Provider[]) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.security.Security java.util.LinkedHashSet getProvidersNotUsingCache(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.security.Provider[]) 4">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.security.Security void invalidateSMCache(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.security.Security void setProperty(java.lang.String, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.security.Signer java.lang.String printKeys()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.security.Signer java.lang.String toString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.security.Signer void setKeyPair(java.security.KeyPair) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+</root>
diff --git a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/sql/annotations.xml b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/sql/annotations.xml
new file mode 100644
index 000000000000..2aaa71e67f39
--- /dev/null
+++ b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/sql/annotations.xml
@@ -0,0 +1,78 @@
+<root>
+ <item name="java.sql.Date java.lang.String toString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.sql.Date java.sql.Date valueOf(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.sql.DriverInfo boolean equals(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.sql.DriverInfo java.lang.String toString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.sql.DriverManager boolean isDriverAllowed(java.sql.Driver, java.lang.Class&lt;?&gt;)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.sql.DriverManager boolean isDriverAllowed(java.sql.Driver, java.lang.ClassLoader)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.sql.DriverManager java.sql.Connection getConnection(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.sql.DriverManager java.sql.Connection getConnection(java.lang.String, java.lang.String, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.sql.DriverManager java.sql.Connection getConnection(java.lang.String, java.util.Properties) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.sql.DriverManager java.sql.Connection getConnection(java.lang.String, java.util.Properties, java.lang.Class&lt;?&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.sql.DriverManager void registerDriver(java.sql.Driver) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.sql.SQLException java.util.Iterator&lt;java.lang.Throwable&gt; iterator()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.sql.Time java.lang.String toString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.sql.Time java.sql.Time valueOf(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.sql.Time java.sql.Time valueOf(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.sql.Timestamp boolean equals(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.sql.Timestamp boolean equals(java.sql.Timestamp)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.sql.Timestamp int compareTo(java.sql.Timestamp) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.sql.Timestamp int compareTo(java.util.Date) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.sql.Timestamp java.lang.String toString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.sql.Timestamp java.sql.Timestamp valueOf(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.sql.Timestamp java.sql.Timestamp valueOf(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+</root>
diff --git a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/util/annotations.xml b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/util/annotations.xml
new file mode 100644
index 000000000000..363b81c827b4
--- /dev/null
+++ b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/util/annotations.xml
@@ -0,0 +1,1533 @@
+<root>
+ <item name="java.util.AbstractCollection T[] toArray(T[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.AbstractCollection boolean addAll(java.util.Collection&lt;? extends E&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.AbstractCollection boolean containsAll(java.util.Collection&lt;?&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.AbstractCollection java.lang.String toString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.AbstractList boolean add(E)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;true;null-&gt;true&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.util.AbstractList boolean addAll(int, java.util.Collection&lt;? extends E&gt;) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.AbstractList java.lang.String outOfBoundsMsg(int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.AbstractList java.util.Iterator&lt;E&gt; iterator()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.AbstractList java.util.List&lt;E&gt; subList(int, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.AbstractList java.util.ListIterator&lt;E&gt; listIterator(int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.AbstractMap java.lang.String toString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.AbstractMap void putAll(java.util.Map&lt;? extends K,? extends V&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.AbstractMap.1 java.util.Iterator&lt;K&gt; iterator()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.AbstractMap.2 java.util.Iterator&lt;V&gt; iterator()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.AbstractMap.SimpleEntry SimpleEntry(java.util.Map.Entry&lt;K,V&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.AbstractMap.SimpleEntry boolean equals(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.util.AbstractMap.SimpleEntry java.lang.String toString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.AbstractQueue boolean add(E)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;true;null-&gt;true&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.util.AbstractQueue boolean addAll(java.util.Collection&lt;? extends E&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.AbstractSequentialList boolean addAll(int, java.util.Collection&lt;? extends E&gt;) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.AbstractSet boolean removeAll(java.util.Collection&lt;?&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.ArrayList ArrayList(java.util.Collection&lt;? extends E&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.ArrayList T[] toArray(T[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.ArrayList boolean add(E)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;true;null-&gt;true&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.util.ArrayList boolean addAll(int, java.util.Collection&lt;? extends E&gt;) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.ArrayList boolean addAll(java.util.Collection&lt;? extends E&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.ArrayList java.lang.Object[] toArray()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.ArrayList void readObject(java.io.ObjectInputStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.ArrayList void writeObject(java.io.ObjectOutputStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Arrays T[] cloneSubarray(T[], int, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Arrays int binarySearch(T[], T, java.util.Comparator&lt;? super T&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Arrays int binarySearch(byte[], byte) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Arrays int binarySearch(char[], char) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Arrays int binarySearch(double[], double) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Arrays int binarySearch(float[], float) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Arrays int binarySearch(int[], int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Arrays int binarySearch(java.lang.Object[], java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Arrays int binarySearch(long[], long) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Arrays int binarySearch(short[], short) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Arrays int med3(byte[], int, int, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Arrays int med3(char[], int, int, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Arrays int med3(double[], int, int, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Arrays int med3(float[], int, int, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Arrays int med3(int[], int, int, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Arrays int med3(long[], int, int, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Arrays int med3(short[], int, int, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Arrays java.lang.String deepToString(java.lang.Object[])">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Arrays java.lang.String toString(boolean[])">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Arrays java.lang.String toString(byte[])">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Arrays java.lang.String toString(char[])">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Arrays java.lang.String toString(double[])">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Arrays java.lang.String toString(float[])">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Arrays java.lang.String toString(int[])">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Arrays java.lang.String toString(java.lang.Object[])">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Arrays java.lang.String toString(long[])">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Arrays java.lang.String toString(short[])">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Arrays java.util.List&lt;T&gt; asList(T...) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Arrays java.util.List&lt;T&gt; asList(T...)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Arrays void deepToString(java.lang.Object[], java.lang.StringBuilder, java.util.Set&lt;java.lang.Object[]&gt;) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Arrays void fill(boolean[], boolean) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Arrays void fill(boolean[], int, int, boolean) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Arrays void fill(byte[], byte) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Arrays void fill(byte[], int, int, byte) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Arrays void fill(char[], char) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Arrays void fill(char[], int, int, char) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Arrays void fill(double[], double) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Arrays void fill(double[], int, int, double) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Arrays void fill(float[], float) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Arrays void fill(float[], int, int, float) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Arrays void fill(int[], int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Arrays void fill(int[], int, int, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Arrays void fill(java.lang.Object[], int, int, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Arrays void fill(java.lang.Object[], java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Arrays void fill(long[], int, int, long) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Arrays void fill(long[], long) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Arrays void fill(short[], int, int, short) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Arrays void fill(short[], short) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Arrays void sort(T[], int, int, java.util.Comparator&lt;? super T&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Arrays void sort(T[], java.util.Comparator&lt;? super T&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Arrays void sort(byte[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Arrays void sort(byte[], int, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Arrays void sort(char[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Arrays void sort(char[], int, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Arrays void sort(double[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Arrays void sort(double[], int, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Arrays void sort(float[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Arrays void sort(float[], int, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Arrays void sort(int[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Arrays void sort(int[], int, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Arrays void sort(java.lang.Object[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Arrays void sort(java.lang.Object[], int, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Arrays void sort(long[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Arrays void sort(long[], int, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Arrays void sort(short[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Arrays void sort(short[], int, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Arrays void swap(byte[], int, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Arrays void swap(char[], int, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Arrays void swap(double[], int, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Arrays void swap(float[], int, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Arrays void swap(int[], int, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Arrays void swap(java.lang.Object[], int, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Arrays void swap(long[], int, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Arrays void swap(short[], int, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Arrays.ArrayList ArrayList(E[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Calendar boolean after(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.util.Calendar boolean before(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.util.Calendar java.lang.String toString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Calendar java.util.Calendar createCalendar(java.util.TimeZone, java.util.Locale) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Calendar java.util.Calendar createCalendar(java.util.TimeZone, java.util.Locale)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Calendar java.util.Calendar getInstance()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Calendar java.util.Calendar getInstance(java.util.Locale) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Calendar java.util.Calendar getInstance(java.util.Locale)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Calendar java.util.Calendar getInstance(java.util.TimeZone)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Calendar java.util.Calendar getInstance(java.util.TimeZone, java.util.Locale) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Calendar java.util.Calendar getInstance(java.util.TimeZone, java.util.Locale)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Calendar java.util.Date getTime()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Calendar void readObject(java.io.ObjectInputStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Calendar void setTime(java.util.Date) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Calendar void writeObject(java.io.ObjectOutputStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections T get(java.util.ListIterator&lt;? extends T&gt;, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections T max(java.util.Collection&lt;? extends T&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections T max(java.util.Collection&lt;? extends T&gt;, java.util.Comparator&lt;? super T&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections T min(java.util.Collection&lt;? extends T&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections T min(java.util.Collection&lt;? extends T&gt;, java.util.Comparator&lt;? super T&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections boolean addAll(java.util.Collection&lt;? super T&gt;, T...) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections boolean disjoint(java.util.Collection&lt;?&gt;, java.util.Collection&lt;?&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections boolean disjoint(java.util.Collection&lt;?&gt;, java.util.Collection&lt;?&gt;) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections boolean replaceAll(java.util.List&lt;T&gt;, T, T) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections int binarySearch(java.util.List&lt;? extends T&gt;, T, java.util.Comparator&lt;? super T&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections int binarySearch(java.util.List&lt;? extends java.lang.Comparable&lt;? super T&gt;&gt;, T) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections int frequency(java.util.Collection&lt;?&gt;, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections int indexOfSubList(java.util.List&lt;?&gt;, java.util.List&lt;?&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections int indexOfSubList(java.util.List&lt;?&gt;, java.util.List&lt;?&gt;) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections int indexedBinarySearch(java.util.List&lt;? extends T&gt;, T, java.util.Comparator&lt;? super T&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections int indexedBinarySearch(java.util.List&lt;? extends java.lang.Comparable&lt;? super T&gt;&gt;, T) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections int iteratorBinarySearch(java.util.List&lt;? extends T&gt;, T, java.util.Comparator&lt;? super T&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections int iteratorBinarySearch(java.util.List&lt;? extends java.lang.Comparable&lt;? super T&gt;&gt;, T) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections int lastIndexOfSubList(java.util.List&lt;?&gt;, java.util.List&lt;?&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections int lastIndexOfSubList(java.util.List&lt;?&gt;, java.util.List&lt;?&gt;) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections java.util.ArrayList&lt;T&gt; list(java.util.Enumeration&lt;T&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections java.util.Collection&lt;E&gt; checkedCollection(java.util.Collection&lt;E&gt;, java.lang.Class&lt;E&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections java.util.Collection&lt;E&gt; checkedCollection(java.util.Collection&lt;E&gt;, java.lang.Class&lt;E&gt;) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections java.util.Collection&lt;E&gt; checkedCollection(java.util.Collection&lt;E&gt;, java.lang.Class&lt;E&gt;)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections java.util.Collection&lt;T&gt; synchronizedCollection(java.util.Collection&lt;T&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections java.util.Collection&lt;T&gt; synchronizedCollection(java.util.Collection&lt;T&gt;)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections java.util.Collection&lt;T&gt; synchronizedCollection(java.util.Collection&lt;T&gt;, java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections java.util.Collection&lt;T&gt; unmodifiableCollection(java.util.Collection&lt;? extends T&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections java.util.Collection&lt;T&gt; unmodifiableCollection(java.util.Collection&lt;? extends T&gt;)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections java.util.Enumeration&lt;T&gt; enumeration(java.util.Collection&lt;T&gt;)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections java.util.Iterator&lt;E&gt; singletonIterator(E)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections java.util.List&lt;E&gt; checkedList(java.util.List&lt;E&gt;, java.lang.Class&lt;E&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections java.util.List&lt;E&gt; checkedList(java.util.List&lt;E&gt;, java.lang.Class&lt;E&gt;) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections java.util.List&lt;E&gt; checkedList(java.util.List&lt;E&gt;, java.lang.Class&lt;E&gt;)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections java.util.List&lt;T&gt; nCopies(int, T)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections java.util.List&lt;T&gt; singletonList(T)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections java.util.List&lt;T&gt; synchronizedList(java.util.List&lt;T&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections java.util.List&lt;T&gt; synchronizedList(java.util.List&lt;T&gt;)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections java.util.List&lt;T&gt; synchronizedList(java.util.List&lt;T&gt;, java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections java.util.List&lt;T&gt; unmodifiableList(java.util.List&lt;? extends T&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections java.util.List&lt;T&gt; unmodifiableList(java.util.List&lt;? extends T&gt;)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections java.util.Map&lt;K,V&gt; checkedMap(java.util.Map&lt;K,V&gt;, java.lang.Class&lt;K&gt;, java.lang.Class&lt;V&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections java.util.Map&lt;K,V&gt; checkedMap(java.util.Map&lt;K,V&gt;, java.lang.Class&lt;K&gt;, java.lang.Class&lt;V&gt;) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections java.util.Map&lt;K,V&gt; checkedMap(java.util.Map&lt;K,V&gt;, java.lang.Class&lt;K&gt;, java.lang.Class&lt;V&gt;) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections java.util.Map&lt;K,V&gt; checkedMap(java.util.Map&lt;K,V&gt;, java.lang.Class&lt;K&gt;, java.lang.Class&lt;V&gt;)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections java.util.Map&lt;K,V&gt; singletonMap(K, V)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections java.util.Map&lt;K,V&gt; synchronizedMap(java.util.Map&lt;K,V&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections java.util.Map&lt;K,V&gt; synchronizedMap(java.util.Map&lt;K,V&gt;)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections java.util.Map&lt;K,V&gt; unmodifiableMap(java.util.Map&lt;? extends K,? extends V&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections java.util.Map&lt;K,V&gt; unmodifiableMap(java.util.Map&lt;? extends K,? extends V&gt;)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections java.util.Queue&lt;T&gt; asLifoQueue(java.util.Deque&lt;T&gt;)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections java.util.Set&lt;E&gt; checkedSet(java.util.Set&lt;E&gt;, java.lang.Class&lt;E&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections java.util.Set&lt;E&gt; checkedSet(java.util.Set&lt;E&gt;, java.lang.Class&lt;E&gt;) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections java.util.Set&lt;E&gt; checkedSet(java.util.Set&lt;E&gt;, java.lang.Class&lt;E&gt;)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections java.util.Set&lt;E&gt; newSetFromMap(java.util.Map&lt;E,java.lang.Boolean&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections java.util.Set&lt;E&gt; newSetFromMap(java.util.Map&lt;E,java.lang.Boolean&gt;)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections java.util.Set&lt;T&gt; singleton(T)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections java.util.Set&lt;T&gt; synchronizedSet(java.util.Set&lt;T&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections java.util.Set&lt;T&gt; synchronizedSet(java.util.Set&lt;T&gt;)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections java.util.Set&lt;T&gt; synchronizedSet(java.util.Set&lt;T&gt;, java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections java.util.Set&lt;T&gt; unmodifiableSet(java.util.Set&lt;? extends T&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections java.util.Set&lt;T&gt; unmodifiableSet(java.util.Set&lt;? extends T&gt;)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections java.util.SortedMap&lt;K,V&gt; checkedSortedMap(java.util.SortedMap&lt;K,V&gt;, java.lang.Class&lt;K&gt;, java.lang.Class&lt;V&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections java.util.SortedMap&lt;K,V&gt; checkedSortedMap(java.util.SortedMap&lt;K,V&gt;, java.lang.Class&lt;K&gt;, java.lang.Class&lt;V&gt;) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections java.util.SortedMap&lt;K,V&gt; checkedSortedMap(java.util.SortedMap&lt;K,V&gt;, java.lang.Class&lt;K&gt;, java.lang.Class&lt;V&gt;) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections java.util.SortedMap&lt;K,V&gt; checkedSortedMap(java.util.SortedMap&lt;K,V&gt;, java.lang.Class&lt;K&gt;, java.lang.Class&lt;V&gt;)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections java.util.SortedMap&lt;K,V&gt; synchronizedSortedMap(java.util.SortedMap&lt;K,V&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections java.util.SortedMap&lt;K,V&gt; synchronizedSortedMap(java.util.SortedMap&lt;K,V&gt;)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections java.util.SortedMap&lt;K,V&gt; unmodifiableSortedMap(java.util.SortedMap&lt;K,? extends V&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections java.util.SortedMap&lt;K,V&gt; unmodifiableSortedMap(java.util.SortedMap&lt;K,? extends V&gt;)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections java.util.SortedSet&lt;E&gt; checkedSortedSet(java.util.SortedSet&lt;E&gt;, java.lang.Class&lt;E&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections java.util.SortedSet&lt;E&gt; checkedSortedSet(java.util.SortedSet&lt;E&gt;, java.lang.Class&lt;E&gt;) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections java.util.SortedSet&lt;E&gt; checkedSortedSet(java.util.SortedSet&lt;E&gt;, java.lang.Class&lt;E&gt;)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections java.util.SortedSet&lt;T&gt; synchronizedSortedSet(java.util.SortedSet&lt;T&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections java.util.SortedSet&lt;T&gt; synchronizedSortedSet(java.util.SortedSet&lt;T&gt;)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections java.util.SortedSet&lt;T&gt; unmodifiableSortedSet(java.util.SortedSet&lt;T&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections java.util.SortedSet&lt;T&gt; unmodifiableSortedSet(java.util.SortedSet&lt;T&gt;)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections void copy(java.util.List&lt;? super T&gt;, java.util.List&lt;? extends T&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections void copy(java.util.List&lt;? super T&gt;, java.util.List&lt;? extends T&gt;) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections void fill(java.util.List&lt;? super T&gt;, T) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections void reverse(java.util.List&lt;?&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections void rotate(java.util.List&lt;?&gt;, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections void rotate1(java.util.List&lt;T&gt;, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections void rotate2(java.util.List&lt;?&gt;, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections void shuffle(java.util.List&lt;?&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections void shuffle(java.util.List&lt;?&gt;, java.util.Random) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections void sort(java.util.List&lt;T&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections void sort(java.util.List&lt;T&gt;, java.util.Comparator&lt;? super T&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections void swap(java.lang.Object[], int, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections void swap(java.util.List&lt;?&gt;, int, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.AsLIFOQueue boolean add(E)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;true;null-&gt;true&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.util.Collections.CheckedCollection CheckedCollection(java.util.Collection&lt;E&gt;, java.lang.Class&lt;E&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.CheckedCollection CheckedCollection(java.util.Collection&lt;E&gt;, java.lang.Class&lt;E&gt;) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.CheckedCollection java.lang.String badElementMsg(java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.CheckedCollection java.lang.String badElementMsg(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.CheckedCollection java.util.Collection&lt;E&gt; checkedCopyOf(java.util.Collection&lt;? extends E&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.CheckedCollection java.util.Collection&lt;E&gt; checkedCopyOf(java.util.Collection&lt;? extends E&gt;)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.CheckedCollection java.util.Iterator&lt;E&gt; iterator()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.CheckedList CheckedList(java.util.List&lt;E&gt;, java.lang.Class&lt;E&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.CheckedList CheckedList(java.util.List&lt;E&gt;, java.lang.Class&lt;E&gt;) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.CheckedList java.util.List&lt;E&gt; subList(int, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.CheckedList java.util.ListIterator&lt;E&gt; listIterator(int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.CheckedMap CheckedMap(java.util.Map&lt;K,V&gt;, java.lang.Class&lt;K&gt;, java.lang.Class&lt;V&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.CheckedMap CheckedMap(java.util.Map&lt;K,V&gt;, java.lang.Class&lt;K&gt;, java.lang.Class&lt;V&gt;) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.CheckedMap CheckedMap(java.util.Map&lt;K,V&gt;, java.lang.Class&lt;K&gt;, java.lang.Class&lt;V&gt;) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.CheckedMap java.lang.String badKeyMsg(java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.CheckedMap java.lang.String badKeyMsg(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.CheckedMap java.lang.String badValueMsg(java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.CheckedMap java.lang.String badValueMsg(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.CheckedMap void putAll(java.util.Map&lt;? extends K,? extends V&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.CheckedMap.CheckedEntrySet T[] toArray(T[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.CheckedMap.CheckedEntrySet boolean contains(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.util.Collections.CheckedMap.CheckedEntrySet boolean containsAll(java.util.Collection&lt;?&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.CheckedMap.CheckedEntrySet boolean remove(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.util.Collections.CheckedMap.CheckedEntrySet java.util.Collections.CheckedMap.CheckedEntrySet.CheckedEntry&lt;K,V,T&gt; checkedEntry(java.util.Map.Entry&lt;K,V&gt;, java.lang.Class&lt;T&gt;)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.CheckedMap.CheckedEntrySet java.util.Iterator&lt;java.util.Map.Entry&lt;K,V&gt;&gt; iterator()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.CheckedMap.CheckedEntrySet.1 java.util.Map.Entry&lt;K,V&gt; next()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.CheckedMap.CheckedEntrySet.CheckedEntry java.lang.String badValueMsg(java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.CheckedMap.CheckedEntrySet.CheckedEntry java.lang.String badValueMsg(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.CheckedRandomAccessList CheckedRandomAccessList(java.util.List&lt;E&gt;, java.lang.Class&lt;E&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.CheckedRandomAccessList CheckedRandomAccessList(java.util.List&lt;E&gt;, java.lang.Class&lt;E&gt;) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.CheckedRandomAccessList java.util.List&lt;E&gt; subList(int, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.CheckedSet CheckedSet(java.util.Set&lt;E&gt;, java.lang.Class&lt;E&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.CheckedSet CheckedSet(java.util.Set&lt;E&gt;, java.lang.Class&lt;E&gt;) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.CheckedSortedMap CheckedSortedMap(java.util.SortedMap&lt;K,V&gt;, java.lang.Class&lt;K&gt;, java.lang.Class&lt;V&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.CheckedSortedMap CheckedSortedMap(java.util.SortedMap&lt;K,V&gt;, java.lang.Class&lt;K&gt;, java.lang.Class&lt;V&gt;) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.CheckedSortedMap CheckedSortedMap(java.util.SortedMap&lt;K,V&gt;, java.lang.Class&lt;K&gt;, java.lang.Class&lt;V&gt;) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.CheckedSortedMap java.util.SortedMap&lt;K,V&gt; headMap(K)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.CheckedSortedMap java.util.SortedMap&lt;K,V&gt; subMap(K, K)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.CheckedSortedMap java.util.SortedMap&lt;K,V&gt; tailMap(K)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.CheckedSortedSet CheckedSortedSet(java.util.SortedSet&lt;E&gt;, java.lang.Class&lt;E&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.CheckedSortedSet CheckedSortedSet(java.util.SortedSet&lt;E&gt;, java.lang.Class&lt;E&gt;) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.CheckedSortedSet java.util.SortedSet&lt;E&gt; headSet(E)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.CheckedSortedSet java.util.SortedSet&lt;E&gt; subSet(E, E)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.CheckedSortedSet java.util.SortedSet&lt;E&gt; tailSet(E)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.CopiesList T[] toArray(T[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.CopiesList java.lang.Object[] toArray()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.CopiesList java.util.List&lt;E&gt; subList(int, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.EmptyList T[] toArray(T[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.EmptyList T[] toArray(T[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.util.Collections.EmptyList boolean contains(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;false;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.util.Collections.EmptyList boolean containsAll(java.util.Collection&lt;?&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.EmptyList boolean equals(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.util.Collections.EmptyList java.lang.Object[] toArray()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.EmptyMap V get(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;null;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.util.Collections.EmptyMap boolean containsKey(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;false;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.util.Collections.EmptyMap boolean containsValue(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;false;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.util.Collections.EmptyMap boolean equals(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.util.Collections.EmptySet T[] toArray(T[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.EmptySet T[] toArray(T[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.util.Collections.EmptySet boolean contains(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;false;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.util.Collections.EmptySet boolean containsAll(java.util.Collection&lt;?&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.EmptySet java.lang.Object[] toArray()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.ReverseComparator int compare(java.lang.Comparable&lt;java.lang.Object&gt;, java.lang.Comparable&lt;java.lang.Object&gt;) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.SetFromMap SetFromMap(java.util.Map&lt;E,java.lang.Boolean&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.SetFromMap void readObject(java.io.ObjectInputStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.SingletonList java.util.Iterator&lt;E&gt; iterator()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.SingletonSet java.util.Iterator&lt;E&gt; iterator()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.SynchronizedCollection SynchronizedCollection(java.util.Collection&lt;E&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.SynchronizedCollection void writeObject(java.io.ObjectOutputStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.SynchronizedList SynchronizedList(java.util.List&lt;E&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.SynchronizedList java.lang.Object readResolve()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.SynchronizedList java.util.List&lt;E&gt; subList(int, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.SynchronizedMap SynchronizedMap(java.util.Map&lt;K,V&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.SynchronizedMap void writeObject(java.io.ObjectOutputStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.SynchronizedRandomAccessList SynchronizedRandomAccessList(java.util.List&lt;E&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.SynchronizedRandomAccessList java.lang.Object writeReplace()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.SynchronizedRandomAccessList java.util.List&lt;E&gt; subList(int, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.SynchronizedSet SynchronizedSet(java.util.Set&lt;E&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.SynchronizedSortedMap SynchronizedSortedMap(java.util.SortedMap&lt;K,V&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.SynchronizedSortedMap java.util.SortedMap&lt;K,V&gt; headMap(K)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.SynchronizedSortedMap java.util.SortedMap&lt;K,V&gt; subMap(K, K)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.SynchronizedSortedMap java.util.SortedMap&lt;K,V&gt; tailMap(K)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.SynchronizedSortedSet SynchronizedSortedSet(java.util.SortedSet&lt;E&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.SynchronizedSortedSet java.util.SortedSet&lt;E&gt; headSet(E)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.SynchronizedSortedSet java.util.SortedSet&lt;E&gt; subSet(E, E)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.SynchronizedSortedSet java.util.SortedSet&lt;E&gt; tailSet(E)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.UnmodifiableCollection UnmodifiableCollection(java.util.Collection&lt;? extends E&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.UnmodifiableCollection java.util.Iterator&lt;E&gt; iterator()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.UnmodifiableList UnmodifiableList(java.util.List&lt;? extends E&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.UnmodifiableList java.lang.Object readResolve()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.UnmodifiableList java.util.List&lt;E&gt; subList(int, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.UnmodifiableList java.util.ListIterator&lt;E&gt; listIterator(int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.UnmodifiableMap UnmodifiableMap(java.util.Map&lt;? extends K,? extends V&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.UnmodifiableMap.UnmodifiableEntrySet T[] toArray(T[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.UnmodifiableMap.UnmodifiableEntrySet UnmodifiableEntrySet(java.util.Set&lt;? extends java.util.Map.Entry&lt;? extends K,? extends V&gt;&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.UnmodifiableMap.UnmodifiableEntrySet boolean contains(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.util.Collections.UnmodifiableMap.UnmodifiableEntrySet boolean containsAll(java.util.Collection&lt;?&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.UnmodifiableMap.UnmodifiableEntrySet java.util.Iterator&lt;java.util.Map.Entry&lt;K,V&gt;&gt; iterator()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.UnmodifiableMap.UnmodifiableEntrySet.1 java.util.Map.Entry&lt;K,V&gt; next()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.UnmodifiableRandomAccessList UnmodifiableRandomAccessList(java.util.List&lt;? extends E&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.UnmodifiableRandomAccessList java.lang.Object writeReplace()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.UnmodifiableRandomAccessList java.util.List&lt;E&gt; subList(int, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.UnmodifiableSet UnmodifiableSet(java.util.Set&lt;? extends E&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.UnmodifiableSortedMap UnmodifiableSortedMap(java.util.SortedMap&lt;K,? extends V&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.UnmodifiableSortedMap java.util.SortedMap&lt;K,V&gt; headMap(K)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.UnmodifiableSortedMap java.util.SortedMap&lt;K,V&gt; subMap(K, K)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.UnmodifiableSortedMap java.util.SortedMap&lt;K,V&gt; tailMap(K)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.UnmodifiableSortedSet UnmodifiableSortedSet(java.util.SortedSet&lt;E&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.UnmodifiableSortedSet java.util.SortedSet&lt;E&gt; headSet(E)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.UnmodifiableSortedSet java.util.SortedSet&lt;E&gt; subSet(E, E)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Collections.UnmodifiableSortedSet java.util.SortedSet&lt;E&gt; tailSet(E)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Date Date(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Date boolean after(java.util.Date) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Date boolean before(java.util.Date) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Date boolean equals(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.util.Date int compareTo(java.util.Date) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Date long parse(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Date void readObject(java.io.ObjectInputStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Date void writeObject(java.io.ObjectOutputStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.GregorianCalendar boolean equals(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.util.GregorianCalendar int floorDivide(int, int, int[]) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.GregorianCalendar int floorDivide(long, int, int[]) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.GregorianCalendar java.util.Date getGregorianChange()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.GregorianCalendar long computeJulianDay(boolean, int, int[]) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.GregorianCalendar void readObject(java.io.ObjectInputStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.GregorianCalendar void setGregorianChange(java.util.Date) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.HashMap HashMap(java.util.Map&lt;? extends K,? extends V&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.HashMap T maskNull(T)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.util.HashMap T unmaskNull(T)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.util.HashMap boolean eq(java.lang.Object, java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_-&gt;true&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.util.HashMap int hash(java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.HashMap java.util.HashMap.Entry&lt;K,V&gt; removeMapping(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.util.HashMap java.util.Iterator&lt;K&gt; newKeyIterator()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.HashMap java.util.Iterator&lt;V&gt; newValueIterator()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.HashMap java.util.Iterator&lt;java.util.Map.Entry&lt;K,V&gt;&gt; newEntryIterator()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.HashMap void putAll(java.util.Map&lt;? extends K,? extends V&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.HashMap void putAllForCreate(java.util.Map&lt;? extends K,? extends V&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.HashMap void readObject(java.io.ObjectInputStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.HashMap void transfer(java.util.HashMap.Entry[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.HashMap void writeObject(java.io.ObjectOutputStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Hashtable Hashtable(java.util.Map&lt;? extends K,? extends V&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Hashtable V get(java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Hashtable V put(K, V) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Hashtable V put(K, V) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Hashtable V remove(java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Hashtable boolean contains(java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Hashtable boolean containsKey(java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Hashtable int access$200(java.util.Hashtable) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Hashtable int access$210(java.util.Hashtable) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Hashtable int access$500(java.util.Hashtable) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Hashtable int access$508(java.util.Hashtable) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Hashtable java.lang.String toString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Hashtable java.util.Hashtable.Entry[] access$400(java.util.Hashtable) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Hashtable java.util.Iterator access$100(java.util.Hashtable, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Hashtable void putAll(java.util.Map&lt;? extends K,? extends V&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Hashtable void readObject(java.io.ObjectInputStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Hashtable void reconstitutionPut(java.util.Hashtable.Entry[], K, V) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Hashtable void reconstitutionPut(java.util.Hashtable.Entry[], K, V) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Hashtable void reconstitutionPut(java.util.Hashtable.Entry[], K, V) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Hashtable void writeObject(java.io.ObjectOutputStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Hashtable.Entry V setValue(V) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Hashtable.Entry boolean equals(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.util.Hashtable.Entry java.lang.Object clone()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Hashtable.Entry java.lang.String toString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Hashtable.EntrySet boolean contains(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.util.Hashtable.EntrySet boolean remove(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.util.IdentityHashMap IdentityHashMap(java.util.Map&lt;? extends K,? extends V&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.IdentityHashMap boolean access$1500(java.util.IdentityHashMap, java.lang.Object, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.IdentityHashMap boolean access$1600(java.util.IdentityHashMap, java.lang.Object, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.IdentityHashMap int access$000(java.util.IdentityHashMap) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.IdentityHashMap int access$010(java.util.IdentityHashMap) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.IdentityHashMap int access$200(java.util.IdentityHashMap) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.IdentityHashMap int access$204(java.util.IdentityHashMap) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.IdentityHashMap java.lang.Object access$600(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.util.IdentityHashMap java.lang.Object maskNull(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.util.IdentityHashMap java.lang.Object unmaskNull(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.util.IdentityHashMap java.lang.Object[] access$100(java.util.IdentityHashMap) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.IdentityHashMap void putAll(java.util.Map&lt;? extends K,? extends V&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.IdentityHashMap void readObject(java.io.ObjectInputStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.IdentityHashMap void writeObject(java.io.ObjectOutputStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.IdentityHashMap.EntryIterator.Entry int access$800(java.util.IdentityHashMap.EntryIterator.Entry) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.IdentityHashMap.EntryIterator.Entry int access$802(java.util.IdentityHashMap.EntryIterator.Entry, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.IdentityHashMap.EntryIterator.Entry java.lang.String toString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.IdentityHashMap.EntrySet T[] toArray(T[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.IdentityHashMap.EntrySet boolean contains(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.util.IdentityHashMap.EntrySet boolean remove(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.util.IdentityHashMap.EntrySet java.util.Iterator&lt;java.util.Map.Entry&lt;K,V&gt;&gt; iterator()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.IdentityHashMap.KeySet java.util.Iterator&lt;K&gt; iterator()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.IdentityHashMap.Values java.util.Iterator&lt;V&gt; iterator()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Locale Locale(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Locale Locale(java.lang.String, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Locale Locale(java.lang.String, java.lang.String) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Locale Locale(java.lang.String, java.lang.String, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Locale Locale(java.lang.String, java.lang.String, java.lang.String) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Locale Locale(java.lang.String, java.lang.String, java.lang.String) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Locale java.lang.String convertOldISOCodes(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Locale java.lang.String formatList(java.lang.String[], java.lang.String, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Locale java.lang.String formatList(java.lang.String[], java.lang.String, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,_,null-&gt;!null;_,null,_-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.util.Locale java.lang.String getDisplayCountry(java.util.Locale)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.util.Locale java.lang.String getDisplayLanguage(java.util.Locale)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.util.Locale java.lang.String getDisplayString(java.lang.String, java.util.Locale, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Locale java.lang.String getDisplayString(java.lang.String, java.util.Locale, int)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,null,_-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.util.Locale java.lang.String getISO3Code(java.lang.String, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Locale java.lang.String getISO3Code(java.lang.String, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,null-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.util.Locale java.lang.String toLowerCase(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Locale java.lang.String toLowerCase(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Locale java.lang.String toString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Locale java.lang.String toUpperCase(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Locale java.lang.String toUpperCase(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Locale java.lang.String[] composeList(java.text.MessageFormat, java.lang.String[]) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Locale java.lang.String[] getISO2Table(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Locale java.lang.String[] getISOCountries()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Locale java.lang.String[] getISOLanguages()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Locale java.util.Locale createSingleton(java.lang.String, java.lang.String, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Locale java.util.Locale getInstance(java.lang.String, java.lang.String, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Locale java.util.Locale getInstance(java.lang.String, java.lang.String, java.lang.String) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Locale java.util.Locale getInstance(java.lang.String, java.lang.String, java.lang.String) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Locale void setDefault(java.util.Locale) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Properties java.lang.String getProperty(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Properties java.lang.String loadConvert(char[], int, int, char[]) 3">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Properties java.lang.String loadConvert(char[], int, int, char[])">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Properties java.lang.String saveConvert(java.lang.String, boolean, boolean) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Properties java.lang.String saveConvert(java.lang.String, boolean, boolean)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Properties void list(java.io.PrintStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Properties void list(java.io.PrintWriter) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Properties void load0(java.util.Properties.LineReader) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Properties void loadFromXML(java.io.InputStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Properties void store(java.io.OutputStream, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Properties void store(java.io.Writer, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Properties void store0(java.io.BufferedWriter, java.lang.String, boolean) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Properties void storeToXML(java.io.OutputStream, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Properties void storeToXML(java.io.OutputStream, java.lang.String, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Properties void writeComments(java.io.BufferedWriter, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Properties void writeComments(java.io.BufferedWriter, java.lang.String) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Random void nextBytes(byte[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Random void readObject(java.io.ObjectInputStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.Random void writeObject(java.io.ObjectOutputStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.TreeMap K key(java.util.TreeMap.Entry&lt;K,?&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.TreeMap TreeMap(java.util.SortedMap&lt;K,? extends V&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.TreeMap boolean colorOf(java.util.TreeMap.Entry&lt;K,V&gt;)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;true&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.util.TreeMap boolean valueSearchNonNull(java.util.TreeMap.Entry, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.TreeMap boolean valueSearchNonNull(java.util.TreeMap.Entry, java.lang.Object) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.TreeMap boolean valueSearchNull(java.util.TreeMap.Entry) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.TreeMap int access$100(java.util.TreeMap) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.TreeMap int access$1600(java.util.TreeMap) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.TreeMap int access$900(java.util.TreeMap, java.lang.Object, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.TreeMap java.lang.Object access$1200(java.util.TreeMap.Entry) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.TreeMap java.util.Comparator access$1000(java.util.TreeMap) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.TreeMap java.util.SortedMap&lt;K,V&gt; headMap(K)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.TreeMap java.util.SortedMap&lt;K,V&gt; subMap(K, K)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.TreeMap java.util.SortedMap&lt;K,V&gt; tailMap(K)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.TreeMap java.util.TreeMap.Entry access$1100(java.util.TreeMap, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.TreeMap java.util.TreeMap.Entry access$1300(java.util.TreeMap) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.TreeMap java.util.TreeMap.Entry access$1400(java.util.TreeMap, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.TreeMap java.util.TreeMap.Entry access$300(java.util.TreeMap) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.TreeMap java.util.TreeMap.Entry access$400(java.util.TreeMap, java.util.TreeMap.Entry) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.TreeMap java.util.TreeMap.Entry access$400(java.util.TreeMap, java.util.TreeMap.Entry)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.util.TreeMap java.util.TreeMap.Entry access$800(java.util.TreeMap, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.TreeMap java.util.TreeMap.Entry&lt;K,V&gt; leftOf(java.util.TreeMap.Entry&lt;K,V&gt;)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.util.TreeMap java.util.TreeMap.Entry&lt;K,V&gt; parentOf(java.util.TreeMap.Entry&lt;K,V&gt;)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.util.TreeMap java.util.TreeMap.Entry&lt;K,V&gt; rightOf(java.util.TreeMap.Entry&lt;K,V&gt;)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.util.TreeMap java.util.TreeMap.Entry&lt;K,V&gt; successor(java.util.TreeMap.Entry&lt;K,V&gt;)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="java.util.TreeMap void access$600(java.util.TreeMap, java.util.TreeMap.Entry) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.TreeMap void access$600(java.util.TreeMap, java.util.TreeMap.Entry) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.TreeMap void deleteEntry(java.util.TreeMap.Entry&lt;K,V&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.TreeMap void fixAfterInsertion(java.util.TreeMap.Entry&lt;K,V&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.TreeMap void putAll(java.util.Map&lt;? extends K,? extends V&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.TreeMap void readObject(java.io.ObjectInputStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.TreeMap void rotateLeft(java.util.TreeMap.Entry&lt;K,V&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.TreeMap void rotateRight(java.util.TreeMap.Entry&lt;K,V&gt;) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.TreeMap void writeObject(java.io.ObjectOutputStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+</root>
diff --git a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/util/concurrent/annotations.xml b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/util/concurrent/annotations.xml
new file mode 100644
index 000000000000..3c186b1661ef
--- /dev/null
+++ b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/util/concurrent/annotations.xml
@@ -0,0 +1,5 @@
+<root>
+ <item name="java.util.concurrent.TimeUnit long convert(long, java.util.concurrent.TimeUnit) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+</root>
diff --git a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/util/concurrent/atomic/annotations.xml b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/util/concurrent/atomic/annotations.xml
new file mode 100644
index 000000000000..def395c4cf42
--- /dev/null
+++ b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/util/concurrent/atomic/annotations.xml
@@ -0,0 +1,98 @@
+<root>
+ <item name="java.util.concurrent.atomic.AtomicBoolean java.lang.String toString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.concurrent.atomic.AtomicInteger java.lang.String toString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.concurrent.atomic.AtomicIntegerArray AtomicIntegerArray(int[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.concurrent.atomic.AtomicIntegerArray java.lang.String toString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.concurrent.atomic.AtomicIntegerFieldUpdater java.util.concurrent.atomic.AtomicIntegerFieldUpdater&lt;U&gt; newUpdater(java.lang.Class&lt;U&gt;, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.concurrent.atomic.AtomicIntegerFieldUpdater java.util.concurrent.atomic.AtomicIntegerFieldUpdater&lt;U&gt; newUpdater(java.lang.Class&lt;U&gt;, java.lang.String) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.concurrent.atomic.AtomicIntegerFieldUpdater java.util.concurrent.atomic.AtomicIntegerFieldUpdater&lt;U&gt; newUpdater(java.lang.Class&lt;U&gt;, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.concurrent.atomic.AtomicIntegerFieldUpdater.AtomicIntegerFieldUpdaterImpl AtomicIntegerFieldUpdaterImpl(java.lang.Class&lt;T&gt;, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.concurrent.atomic.AtomicIntegerFieldUpdater.AtomicIntegerFieldUpdaterImpl AtomicIntegerFieldUpdaterImpl(java.lang.Class&lt;T&gt;, java.lang.String) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.concurrent.atomic.AtomicLong java.lang.String toString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.concurrent.atomic.AtomicLongArray AtomicLongArray(long[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.concurrent.atomic.AtomicLongArray java.lang.String toString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.concurrent.atomic.AtomicLongFieldUpdater java.util.concurrent.atomic.AtomicLongFieldUpdater&lt;U&gt; newUpdater(java.lang.Class&lt;U&gt;, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.concurrent.atomic.AtomicLongFieldUpdater java.util.concurrent.atomic.AtomicLongFieldUpdater&lt;U&gt; newUpdater(java.lang.Class&lt;U&gt;, java.lang.String) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.concurrent.atomic.AtomicLongFieldUpdater java.util.concurrent.atomic.AtomicLongFieldUpdater&lt;U&gt; newUpdater(java.lang.Class&lt;U&gt;, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.concurrent.atomic.AtomicLongFieldUpdater.CASUpdater CASUpdater(java.lang.Class&lt;T&gt;, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.concurrent.atomic.AtomicLongFieldUpdater.CASUpdater CASUpdater(java.lang.Class&lt;T&gt;, java.lang.String) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.concurrent.atomic.AtomicLongFieldUpdater.LockedUpdater LockedUpdater(java.lang.Class&lt;T&gt;, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.concurrent.atomic.AtomicLongFieldUpdater.LockedUpdater LockedUpdater(java.lang.Class&lt;T&gt;, java.lang.String) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.concurrent.atomic.AtomicMarkableReference V get(boolean[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.concurrent.atomic.AtomicMarkableReference.ReferenceBooleanPair boolean access$100(java.util.concurrent.atomic.AtomicMarkableReference.ReferenceBooleanPair) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.concurrent.atomic.AtomicMarkableReference.ReferenceBooleanPair java.lang.Object access$000(java.util.concurrent.atomic.AtomicMarkableReference.ReferenceBooleanPair) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.concurrent.atomic.AtomicReferenceArray AtomicReferenceArray(E[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.concurrent.atomic.AtomicReferenceArray java.lang.String toString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.concurrent.atomic.AtomicReferenceFieldUpdater java.util.concurrent.atomic.AtomicReferenceFieldUpdater&lt;U,W&gt; newUpdater(java.lang.Class&lt;U&gt;, java.lang.Class&lt;W&gt;, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.concurrent.atomic.AtomicReferenceFieldUpdater java.util.concurrent.atomic.AtomicReferenceFieldUpdater&lt;U,W&gt; newUpdater(java.lang.Class&lt;U&gt;, java.lang.Class&lt;W&gt;, java.lang.String) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.concurrent.atomic.AtomicReferenceFieldUpdater java.util.concurrent.atomic.AtomicReferenceFieldUpdater&lt;U,W&gt; newUpdater(java.lang.Class&lt;U&gt;, java.lang.Class&lt;W&gt;, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.concurrent.atomic.AtomicReferenceFieldUpdater.AtomicReferenceFieldUpdaterImpl AtomicReferenceFieldUpdaterImpl(java.lang.Class&lt;T&gt;, java.lang.Class&lt;V&gt;, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.concurrent.atomic.AtomicReferenceFieldUpdater.AtomicReferenceFieldUpdaterImpl AtomicReferenceFieldUpdaterImpl(java.lang.Class&lt;T&gt;, java.lang.Class&lt;V&gt;, java.lang.String) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.concurrent.atomic.AtomicStampedReference V get(int[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.concurrent.atomic.AtomicStampedReference.ReferenceIntegerPair int access$100(java.util.concurrent.atomic.AtomicStampedReference.ReferenceIntegerPair) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.concurrent.atomic.AtomicStampedReference.ReferenceIntegerPair java.lang.Object access$000(java.util.concurrent.atomic.AtomicStampedReference.ReferenceIntegerPair) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+</root>
diff --git a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/util/concurrent/locks/annotations.xml b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/util/concurrent/locks/annotations.xml
new file mode 100644
index 000000000000..a5aef3c11bb8
--- /dev/null
+++ b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/util/concurrent/locks/annotations.xml
@@ -0,0 +1,134 @@
+<root>
+ <item name="java.util.concurrent.locks.AbstractQueuedSynchronizer boolean acquireQueued(java.util.concurrent.locks.AbstractQueuedSynchronizer.Node, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.concurrent.locks.AbstractQueuedSynchronizer boolean hasWaiters(java.util.concurrent.locks.AbstractQueuedSynchronizer.ConditionObject) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.concurrent.locks.AbstractQueuedSynchronizer boolean isOnSyncQueue(java.util.concurrent.locks.AbstractQueuedSynchronizer.Node) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.concurrent.locks.AbstractQueuedSynchronizer boolean isQueued(java.lang.Thread) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.concurrent.locks.AbstractQueuedSynchronizer boolean owns(java.util.concurrent.locks.AbstractQueuedSynchronizer.ConditionObject) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.concurrent.locks.AbstractQueuedSynchronizer boolean shouldParkAfterFailedAcquire(java.util.concurrent.locks.AbstractQueuedSynchronizer.Node, java.util.concurrent.locks.AbstractQueuedSynchronizer.Node) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.concurrent.locks.AbstractQueuedSynchronizer boolean transferAfterCancelledWait(java.util.concurrent.locks.AbstractQueuedSynchronizer.Node) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.concurrent.locks.AbstractQueuedSynchronizer int getWaitQueueLength(java.util.concurrent.locks.AbstractQueuedSynchronizer.ConditionObject) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.concurrent.locks.AbstractQueuedSynchronizer java.lang.String toString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.concurrent.locks.AbstractQueuedSynchronizer java.util.Collection&lt;java.lang.Thread&gt; getWaitingThreads(java.util.concurrent.locks.AbstractQueuedSynchronizer.ConditionObject) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.concurrent.locks.AbstractQueuedSynchronizer java.util.concurrent.locks.AbstractQueuedSynchronizer.Node addWaiter(java.util.concurrent.locks.AbstractQueuedSynchronizer.Node)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.concurrent.locks.AbstractQueuedSynchronizer java.util.concurrent.locks.AbstractQueuedSynchronizer.Node enq(java.util.concurrent.locks.AbstractQueuedSynchronizer.Node) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.concurrent.locks.AbstractQueuedSynchronizer void setHead(java.util.concurrent.locks.AbstractQueuedSynchronizer.Node) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.concurrent.locks.AbstractQueuedSynchronizer void setHeadAndPropagate(java.util.concurrent.locks.AbstractQueuedSynchronizer.Node, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.concurrent.locks.AbstractQueuedSynchronizer void unparkSuccessor(java.util.concurrent.locks.AbstractQueuedSynchronizer.Node) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.concurrent.locks.AbstractQueuedSynchronizer.ConditionObject boolean await(long, java.util.concurrent.TimeUnit) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.concurrent.locks.AbstractQueuedSynchronizer.ConditionObject boolean awaitUntil(java.util.Date) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.concurrent.locks.AbstractQueuedSynchronizer.ConditionObject java.util.concurrent.locks.AbstractQueuedSynchronizer.Node addConditionWaiter()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.concurrent.locks.AbstractQueuedSynchronizer.ConditionObject void doSignal(java.util.concurrent.locks.AbstractQueuedSynchronizer.Node) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.concurrent.locks.AbstractQueuedSynchronizer.ConditionObject void doSignalAll(java.util.concurrent.locks.AbstractQueuedSynchronizer.Node) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.concurrent.locks.ReentrantLock boolean hasWaiters(java.util.concurrent.locks.Condition) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.concurrent.locks.ReentrantLock boolean tryLock(long, java.util.concurrent.TimeUnit) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.concurrent.locks.ReentrantLock int getWaitQueueLength(java.util.concurrent.locks.Condition) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.concurrent.locks.ReentrantLock java.lang.String toString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.concurrent.locks.ReentrantLock java.util.Collection&lt;java.lang.Thread&gt; getWaitingThreads(java.util.concurrent.locks.Condition) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.concurrent.locks.ReentrantLock java.util.concurrent.locks.Condition newCondition()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.concurrent.locks.ReentrantLock.Sync java.util.concurrent.locks.AbstractQueuedSynchronizer.ConditionObject newCondition()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.concurrent.locks.ReentrantLock.Sync void readObject(java.io.ObjectInputStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.concurrent.locks.ReentrantReadWriteLock boolean hasWaiters(java.util.concurrent.locks.Condition) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.concurrent.locks.ReentrantReadWriteLock int getWaitQueueLength(java.util.concurrent.locks.Condition) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.concurrent.locks.ReentrantReadWriteLock java.lang.String toString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.concurrent.locks.ReentrantReadWriteLock java.util.Collection&lt;java.lang.Thread&gt; getWaitingThreads(java.util.concurrent.locks.Condition) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock ReadLock(java.util.concurrent.locks.ReentrantReadWriteLock) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock boolean tryLock(long, java.util.concurrent.TimeUnit) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock java.lang.String toString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.concurrent.locks.ReentrantReadWriteLock.Sync java.lang.IllegalMonitorStateException unmatchedUnlockException()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.concurrent.locks.ReentrantReadWriteLock.Sync java.util.concurrent.locks.AbstractQueuedSynchronizer.ConditionObject newCondition()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.concurrent.locks.ReentrantReadWriteLock.Sync void readObject(java.io.ObjectInputStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.concurrent.locks.ReentrantReadWriteLock.Sync.ThreadLocalHoldCounter java.lang.Object initialValue()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.concurrent.locks.ReentrantReadWriteLock.Sync.ThreadLocalHoldCounter java.util.concurrent.locks.ReentrantReadWriteLock.Sync.HoldCounter initialValue()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock WriteLock(java.util.concurrent.locks.ReentrantReadWriteLock) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock boolean tryLock(long, java.util.concurrent.TimeUnit) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock java.lang.String toString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock java.util.concurrent.locks.Condition newCondition()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+</root>
diff --git a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/javax/swing/annotations.xml b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/javax/swing/annotations.xml
new file mode 100644
index 000000000000..c0738eb8897d
--- /dev/null
+++ b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/javax/swing/annotations.xml
@@ -0,0 +1,527 @@
+<root>
+ <item name="javax.swing.AbstractButton java.beans.PropertyChangeListener createActionPropertyChangeListener(javax.swing.Action)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.AbstractButton java.lang.String paramString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.AbstractButton javax.swing.AbstractButton.Handler access$000(javax.swing.AbstractButton) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.AbstractButton void access$100(javax.swing.AbstractButton) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.JButton java.lang.String getUIClassID()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.JButton java.lang.String paramString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.JButton void writeObject(java.io.ObjectOutputStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.JComponent boolean isLightweightComponent(java.awt.Component) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.JComponent boolean processKeyBinding(javax.swing.KeyStroke, java.awt.event.KeyEvent, int, boolean)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,null,_,_-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="javax.swing.JComponent boolean processKeyBindings(java.awt.event.KeyEvent, boolean) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.JComponent boolean processKeyBindings(java.awt.event.KeyEvent, boolean)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="javax.swing.JComponent byte getWriteObjCounter(javax.swing.JComponent) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.JComponent java.awt.Dimension getSize(java.awt.Dimension)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;!null;null-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="javax.swing.JComponent java.awt.Graphics getComponentGraphics(java.awt.Graphics)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;!null;null-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="javax.swing.JComponent java.awt.Point getLocation(java.awt.Point)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;!null;null-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="javax.swing.JComponent java.awt.Point getPopupLocation(java.awt.event.MouseEvent)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;null;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="javax.swing.JComponent java.awt.Point getToolTipLocation(java.awt.event.MouseEvent)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;null;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="javax.swing.JComponent java.awt.Rectangle getBounds(java.awt.Rectangle)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;!null;null-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="javax.swing.JComponent java.awt.Rectangle getVisibleRect()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.JComponent java.lang.String getUIClassID()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.JComponent java.lang.String paramString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.JComponent javax.swing.JToolTip createToolTip()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.JComponent void computeVisibleRect(java.awt.Component, java.awt.Rectangle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.JComponent void computeVisibleRect(java.awt.Component, java.awt.Rectangle) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.JComponent void computeVisibleRect(java.awt.Rectangle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.JComponent void paintImmediately(java.awt.Rectangle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.JComponent void paintWithOffscreenBuffer(javax.swing.JComponent, java.awt.Graphics, int, int, int, int, java.awt.Image) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.JComponent void paintWithOffscreenBuffer(javax.swing.JComponent, java.awt.Graphics, int, int, int, int, java.awt.Image) 6">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.JComponent void processKeyEvent(java.awt.event.KeyEvent) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.JComponent void readObject(java.io.ObjectInputStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.JComponent void repaint(java.awt.Rectangle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.JComponent void setWriteObjCounter(javax.swing.JComponent, byte) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.JComponent void writeObject(java.io.ObjectOutputStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.JComponent.AccessibleJComponent java.lang.String getBorderTitle(javax.swing.border.Border)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="javax.swing.JComponent.AccessibleJComponent javax.accessibility.AccessibleExtendedComponent getAccessibleExtendedComponent()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.JComponent.AccessibleJComponent javax.swing.JComponent access$100(javax.swing.JComponent.AccessibleJComponent) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.JDialog java.lang.String paramString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.JDialog javax.swing.JRootPane createRootPane()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.JDialog void processWindowEvent(java.awt.event.WindowEvent) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.JFrame java.lang.String paramString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.JFrame javax.swing.JRootPane createRootPane()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.JFrame void processWindowEvent(java.awt.event.WindowEvent) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.JLabel java.lang.String getUIClassID()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.JLabel java.lang.String paramString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.JLabel void writeObject(java.io.ObjectOutputStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.JPanel java.lang.String getUIClassID()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.JPanel java.lang.String paramString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.JPanel void writeObject(java.io.ObjectOutputStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.JScrollPane java.awt.Component getCorner(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.JScrollPane java.awt.Rectangle getViewportBorderBounds()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.JScrollPane java.lang.String getUIClassID()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.JScrollPane java.lang.String paramString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.JScrollPane javax.swing.JScrollBar createHorizontalScrollBar()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.JScrollPane javax.swing.JScrollBar createVerticalScrollBar()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.JScrollPane javax.swing.JViewport createViewport()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.JScrollPane void setCorner(java.lang.String, java.awt.Component) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.JScrollPane void writeObject(java.io.ObjectOutputStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.JTable boolean print(int, java.text.MessageFormat, java.text.MessageFormat, boolean, javax.print.attribute.PrintRequestAttributeSet)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,_,_,false,_-&gt;true&quot;"/>
+ </annotation>
+ </item>
+ <item name="javax.swing.JTable int columnAtPoint(java.awt.Point) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.JTable int getScrollableBlockIncrement(java.awt.Rectangle, int, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.JTable int rowAtPoint(java.awt.Point) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.JTable int[] getSelectedRows()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.JTable java.awt.Component prepareEditor(javax.swing.table.TableCellEditor, int, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.JTable java.awt.Component prepareRenderer(javax.swing.table.TableCellRenderer, int, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.JTable java.awt.Dimension getIntercellSpacing()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.JTable java.awt.print.Printable getPrintable(int, java.text.MessageFormat, java.text.MessageFormat)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.JTable java.lang.String getToolTipText(java.awt.event.MouseEvent) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.JTable java.lang.String getUIClassID()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.JTable java.lang.String paramString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.JTable javax.swing.JScrollPane createScrollPaneForTable(javax.swing.JTable)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.JTable javax.swing.ListSelectionModel createDefaultSelectionModel()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.JTable javax.swing.table.JTableHeader createDefaultTableHeader()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.JTable javax.swing.table.TableCellEditor getDefaultEditor(java.lang.Class)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="javax.swing.JTable javax.swing.table.TableCellRenderer getDefaultRenderer(java.lang.Class)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="javax.swing.JTable javax.swing.table.TableColumnModel createDefaultColumnModel()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.JTable javax.swing.table.TableModel createDefaultDataModel()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.JTable void addColumn(javax.swing.table.TableColumn) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.JTable void adjustSizes(long, javax.swing.JTable.Resizable2, boolean) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.JTable void adjustSizes(long, javax.swing.JTable.Resizable3, boolean) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.JTable void changeSelectionModel(javax.swing.ListSelectionModel, int, boolean, boolean, boolean) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.JTable void columnSelectionChanged(javax.swing.event.ListSelectionEvent) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.JTable void readObject(java.io.ObjectInputStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.JTable void setColumnModel(javax.swing.table.TableColumnModel) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.JTable void setGridColor(java.awt.Color) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.JTable void setIntercellSpacing(java.awt.Dimension) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.JTable void setLazyValue(java.util.Hashtable, java.lang.Class, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.JTable void setModel(javax.swing.table.TableModel) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.JTable void setSelectionBackground(java.awt.Color) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.JTable void setSelectionForeground(java.awt.Color) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.JTable void setSelectionModel(javax.swing.ListSelectionModel) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.JTable void tableRowsDeleted(javax.swing.event.TableModelEvent) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.JTable void tableRowsInserted(javax.swing.event.TableModelEvent) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.JTable void valueChanged(javax.swing.event.ListSelectionEvent) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.JTable void writeObject(java.io.ObjectOutputStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.SwingUtilities boolean isDescendingFrom(java.awt.Component, java.awt.Component)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_-&gt;true&quot;"/>
+ </annotation>
+ </item>
+ <item name="javax.swing.SwingUtilities boolean isLeftMouseButton(java.awt.event.MouseEvent) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.SwingUtilities boolean isLeftToRight(java.awt.Component) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.SwingUtilities boolean isMiddleMouseButton(java.awt.event.MouseEvent) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.SwingUtilities boolean isRectangleContainingRectangle(java.awt.Rectangle, java.awt.Rectangle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.SwingUtilities boolean isRectangleContainingRectangle(java.awt.Rectangle, java.awt.Rectangle) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.SwingUtilities boolean isRightMouseButton(java.awt.event.MouseEvent) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.SwingUtilities boolean isValidKeyEventForKeyBindings(java.awt.event.KeyEvent) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.SwingUtilities boolean notifyAction(javax.swing.Action, javax.swing.KeyStroke, java.awt.event.KeyEvent, java.lang.Object, int)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,_,null,_,_-&gt;false;null,_,_,_,_-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="javax.swing.SwingUtilities boolean processKeyBindings(java.awt.event.KeyEvent)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="javax.swing.SwingUtilities int computeStringWidth(java.awt.FontMetrics, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.SwingUtilities int getAccessibleChildrenCount(java.awt.Component) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.SwingUtilities int getAccessibleIndexInParent(java.awt.Component) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.SwingUtilities java.awt.Component getDeepestComponentAt(java.awt.Component, int, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.SwingUtilities java.awt.Container getAncestorNamed(java.lang.String, java.awt.Component)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,null-&gt;null;null,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="javax.swing.SwingUtilities java.awt.Container getAncestorOfClass(java.lang.Class, java.awt.Component)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,null-&gt;null;null,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="javax.swing.SwingUtilities java.awt.Point convertPoint(java.awt.Component, int, int, java.awt.Component)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_,_,_-&gt;!null;_,_,_,!null-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="javax.swing.SwingUtilities java.awt.Point convertPoint(java.awt.Component, java.awt.Point, java.awt.Component)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_,_-&gt;!null;_,!null,_-&gt;!null;_,_,!null-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="javax.swing.SwingUtilities java.awt.Point convertScreenLocationToParent(java.awt.Container, int, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.SwingUtilities java.awt.Point convertScreenLocationToParent(java.awt.Container, int, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.SwingUtilities java.awt.Rectangle calculateInnerArea(javax.swing.JComponent, java.awt.Rectangle)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="javax.swing.SwingUtilities java.awt.Rectangle computeIntersection(int, int, int, int, java.awt.Rectangle) 4">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.SwingUtilities java.awt.Rectangle computeIntersection(int, int, int, int, java.awt.Rectangle)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,_,_,_,!null-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="javax.swing.SwingUtilities java.awt.Rectangle computeUnion(int, int, int, int, java.awt.Rectangle) 4">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.SwingUtilities java.awt.Rectangle computeUnion(int, int, int, int, java.awt.Rectangle)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,_,_,_,!null-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="javax.swing.SwingUtilities java.awt.Rectangle convertRectangle(java.awt.Component, java.awt.Rectangle, java.awt.Component) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.SwingUtilities java.awt.Rectangle convertRectangle(java.awt.Component, java.awt.Rectangle, java.awt.Component)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.SwingUtilities java.awt.Rectangle getLocalBounds(java.awt.Component) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.SwingUtilities java.awt.Rectangle getLocalBounds(java.awt.Component)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.SwingUtilities java.awt.Rectangle[] computeDifference(java.awt.Rectangle, java.awt.Rectangle)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.SwingUtilities java.awt.Window getWindowAncestor(java.awt.Component) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.SwingUtilities java.awt.Window windowForComponent(java.awt.Component) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.SwingUtilities java.awt.event.MouseEvent convertMouseEvent(java.awt.Component, java.awt.event.MouseEvent, java.awt.Component) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.SwingUtilities java.awt.event.MouseEvent convertMouseEvent(java.awt.Component, java.awt.event.MouseEvent, java.awt.Component)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.SwingUtilities java.lang.String layoutCompoundLabel(java.awt.FontMetrics, java.lang.String, javax.swing.Icon, int, int, int, int, java.awt.Rectangle, java.awt.Rectangle, java.awt.Rectangle, int) 7">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.SwingUtilities java.lang.String layoutCompoundLabel(java.awt.FontMetrics, java.lang.String, javax.swing.Icon, int, int, int, int, java.awt.Rectangle, java.awt.Rectangle, java.awt.Rectangle, int) 8">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.SwingUtilities java.lang.String layoutCompoundLabel(java.awt.FontMetrics, java.lang.String, javax.swing.Icon, int, int, int, int, java.awt.Rectangle, java.awt.Rectangle, java.awt.Rectangle, int) 9">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.SwingUtilities java.lang.String layoutCompoundLabel(java.awt.FontMetrics, java.lang.String, javax.swing.Icon, int, int, int, int, java.awt.Rectangle, java.awt.Rectangle, java.awt.Rectangle, int)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,!null,_,_,_,_,_,_,_,_,_-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="javax.swing.SwingUtilities java.lang.String layoutCompoundLabel(javax.swing.JComponent, java.awt.FontMetrics, java.lang.String, javax.swing.Icon, int, int, int, int, java.awt.Rectangle, java.awt.Rectangle, java.awt.Rectangle, int) 10">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.SwingUtilities java.lang.String layoutCompoundLabel(javax.swing.JComponent, java.awt.FontMetrics, java.lang.String, javax.swing.Icon, int, int, int, int, java.awt.Rectangle, java.awt.Rectangle, java.awt.Rectangle, int) 8">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.SwingUtilities java.lang.String layoutCompoundLabel(javax.swing.JComponent, java.awt.FontMetrics, java.lang.String, javax.swing.Icon, int, int, int, int, java.awt.Rectangle, java.awt.Rectangle, java.awt.Rectangle, int) 9">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.SwingUtilities java.lang.String layoutCompoundLabel(javax.swing.JComponent, java.awt.FontMetrics, java.lang.String, javax.swing.Icon, int, int, int, int, java.awt.Rectangle, java.awt.Rectangle, java.awt.Rectangle, int)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,_,!null,_,_,_,_,_,_,_,_,_-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="javax.swing.SwingUtilities java.lang.String layoutCompoundLabelImpl(javax.swing.JComponent, java.awt.FontMetrics, java.lang.String, javax.swing.Icon, int, int, int, int, java.awt.Rectangle, java.awt.Rectangle, java.awt.Rectangle, int) 10">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.SwingUtilities java.lang.String layoutCompoundLabelImpl(javax.swing.JComponent, java.awt.FontMetrics, java.lang.String, javax.swing.Icon, int, int, int, int, java.awt.Rectangle, java.awt.Rectangle, java.awt.Rectangle, int) 8">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.SwingUtilities java.lang.String layoutCompoundLabelImpl(javax.swing.JComponent, java.awt.FontMetrics, java.lang.String, javax.swing.Icon, int, int, int, int, java.awt.Rectangle, java.awt.Rectangle, java.awt.Rectangle, int) 9">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.SwingUtilities java.lang.String layoutCompoundLabelImpl(javax.swing.JComponent, java.awt.FontMetrics, java.lang.String, javax.swing.Icon, int, int, int, int, java.awt.Rectangle, java.awt.Rectangle, java.awt.Rectangle, int)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,_,!null,_,_,_,_,_,_,_,_,_-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="javax.swing.SwingUtilities javax.accessibility.Accessible getAccessibleAt(java.awt.Component, java.awt.Point)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="javax.swing.SwingUtilities javax.accessibility.Accessible getAccessibleChild(java.awt.Component, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.SwingUtilities javax.accessibility.AccessibleStateSet getAccessibleStateSet(java.awt.Component) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.SwingUtilities javax.swing.ActionMap getUIActionMap(javax.swing.JComponent) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.SwingUtilities javax.swing.CellRendererPane getCellRendererPane(java.awt.Component, java.awt.Container) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.SwingUtilities javax.swing.InputMap getUIInputMap(javax.swing.JComponent, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.SwingUtilities javax.swing.JRootPane getRootPane(java.awt.Component)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="javax.swing.SwingUtilities void convertPointFromScreen(java.awt.Point, java.awt.Component) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.SwingUtilities void convertPointFromScreen(java.awt.Point, java.awt.Component) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.SwingUtilities void convertPointToScreen(java.awt.Point, java.awt.Component) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.SwingUtilities void convertPointToScreen(java.awt.Point, java.awt.Component) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.SwingUtilities void paintComponent(java.awt.Graphics, java.awt.Component, java.awt.Container, int, int, int, int) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.SwingUtilities void paintComponent(java.awt.Graphics, java.awt.Component, java.awt.Container, java.awt.Rectangle) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.SwingUtilities void paintComponent(java.awt.Graphics, java.awt.Component, java.awt.Container, java.awt.Rectangle) 3">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.SwingUtilities void replaceUIActionMap(javax.swing.JComponent, javax.swing.ActionMap) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.SwingUtilities void replaceUIInputMap(javax.swing.JComponent, int, javax.swing.InputMap) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="javax.swing.SwingUtilities void updateComponentTreeUI(java.awt.Component) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+</root>
diff --git a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/collections/annotations.xml b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/collections/annotations.xml
new file mode 100644
index 000000000000..08e265e17fcf
--- /dev/null
+++ b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/collections/annotations.xml
@@ -0,0 +1,40 @@
+<root>
+ <item name="org.apache.commons.collections.ExtendedProperties ExtendedProperties(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.collections.ExtendedProperties ExtendedProperties(java.lang.String, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.collections.ExtendedProperties boolean access$000(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.collections.ExtendedProperties boolean endsWithSlash(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.collections.ExtendedProperties java.lang.String escape(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.collections.ExtendedProperties java.lang.String escape(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.collections.ExtendedProperties java.lang.String interpolateHelper(java.lang.String, java.util.List)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_-&gt;!null;null,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.collections.ExtendedProperties java.lang.String testBoolean(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.collections.ExtendedProperties java.lang.String unescape(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.collections.ExtendedProperties java.lang.String unescape(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.collections.ExtendedProperties org.apache.commons.collections.ExtendedProperties convertProperties(java.util.Properties) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.collections.ExtendedProperties void combine(org.apache.commons.collections.ExtendedProperties) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+</root>
diff --git a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/collections/map/annotations.xml b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/collections/map/annotations.xml
new file mode 100644
index 000000000000..26b98c6bdf92
--- /dev/null
+++ b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/collections/map/annotations.xml
@@ -0,0 +1,161 @@
+<root>
+ <item name="org.apache.commons.collections.map.AbstractHashedMap AbstractHashedMap(java.util.Map) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.collections.map.AbstractHashedMap boolean isEqualKey(java.lang.Object, java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_-&gt;true&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.collections.map.AbstractHashedMap boolean isEqualValue(java.lang.Object, java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_-&gt;true&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.collections.map.AbstractHashedMap int entryHashCode(org.apache.commons.collections.map.AbstractHashedMap.HashEntry) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.collections.map.AbstractHashedMap int hash(java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.collections.map.AbstractHashedMap java.lang.Object convertKey(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.collections.map.AbstractHashedMap java.lang.Object entryKey(org.apache.commons.collections.map.AbstractHashedMap.HashEntry) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.collections.map.AbstractHashedMap java.lang.Object entryValue(org.apache.commons.collections.map.AbstractHashedMap.HashEntry) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.collections.map.AbstractHashedMap java.lang.String toString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.collections.map.AbstractHashedMap org.apache.commons.collections.map.AbstractHashedMap.HashEntry createEntry(org.apache.commons.collections.map.AbstractHashedMap.HashEntry, int, java.lang.Object, java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.collections.map.AbstractHashedMap org.apache.commons.collections.map.AbstractHashedMap.HashEntry entryNext(org.apache.commons.collections.map.AbstractHashedMap.HashEntry) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.collections.map.AbstractHashedMap void destroyEntry(org.apache.commons.collections.map.AbstractHashedMap.HashEntry) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.collections.map.AbstractHashedMap void doReadObject(java.io.ObjectInputStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.collections.map.AbstractHashedMap void doWriteObject(java.io.ObjectOutputStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.collections.map.AbstractHashedMap void putAll(java.util.Map) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.collections.map.AbstractHashedMap void removeEntry(org.apache.commons.collections.map.AbstractHashedMap.HashEntry, int, org.apache.commons.collections.map.AbstractHashedMap.HashEntry) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.collections.map.AbstractHashedMap void reuseEntry(org.apache.commons.collections.map.AbstractHashedMap.HashEntry, int, int, java.lang.Object, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.collections.map.AbstractHashedMap void updateEntry(org.apache.commons.collections.map.AbstractHashedMap.HashEntry, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.collections.map.AbstractHashedMap.EntrySet boolean contains(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.collections.map.AbstractHashedMap.EntrySet boolean remove(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.collections.map.AbstractHashedMap.EntrySetIterator EntrySetIterator(org.apache.commons.collections.map.AbstractHashedMap) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.collections.map.AbstractHashedMap.HashEntry java.lang.String toString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.collections.map.AbstractHashedMap.HashIterator HashIterator(org.apache.commons.collections.map.AbstractHashedMap) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.collections.map.AbstractHashedMap.HashIterator java.lang.String toString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.collections.map.AbstractHashedMap.HashMapIterator HashMapIterator(org.apache.commons.collections.map.AbstractHashedMap) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.collections.map.AbstractHashedMap.KeySetIterator KeySetIterator(org.apache.commons.collections.map.AbstractHashedMap) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.collections.map.AbstractHashedMap.ValuesIterator ValuesIterator(org.apache.commons.collections.map.AbstractHashedMap) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.collections.map.AbstractLinkedMap AbstractLinkedMap(java.util.Map) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.collections.map.AbstractLinkedMap org.apache.commons.collections.map.AbstractHashedMap.HashEntry createEntry(org.apache.commons.collections.map.AbstractHashedMap.HashEntry, int, java.lang.Object, java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.collections.map.AbstractLinkedMap org.apache.commons.collections.map.AbstractLinkedMap.LinkEntry entryAfter(org.apache.commons.collections.map.AbstractLinkedMap.LinkEntry) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.collections.map.AbstractLinkedMap org.apache.commons.collections.map.AbstractLinkedMap.LinkEntry entryBefore(org.apache.commons.collections.map.AbstractLinkedMap.LinkEntry) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.collections.map.AbstractLinkedMap void addEntry(org.apache.commons.collections.map.AbstractHashedMap.HashEntry, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.collections.map.AbstractLinkedMap void removeEntry(org.apache.commons.collections.map.AbstractHashedMap.HashEntry, int, org.apache.commons.collections.map.AbstractHashedMap.HashEntry) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.collections.map.AbstractLinkedMap.EntrySetIterator EntrySetIterator(org.apache.commons.collections.map.AbstractLinkedMap) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.collections.map.AbstractLinkedMap.KeySetIterator KeySetIterator(org.apache.commons.collections.map.AbstractLinkedMap) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.collections.map.AbstractLinkedMap.LinkIterator LinkIterator(org.apache.commons.collections.map.AbstractLinkedMap) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.collections.map.AbstractLinkedMap.LinkIterator java.lang.String toString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.collections.map.AbstractLinkedMap.LinkMapIterator LinkMapIterator(org.apache.commons.collections.map.AbstractLinkedMap) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.collections.map.AbstractLinkedMap.ValuesIterator ValuesIterator(org.apache.commons.collections.map.AbstractLinkedMap) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.collections.map.LRUMap LRUMap(java.util.Map) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.collections.map.LRUMap LRUMap(java.util.Map, boolean) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.collections.map.LRUMap boolean removeLRU(org.apache.commons.collections.map.AbstractLinkedMap.LinkEntry)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;true;null-&gt;true&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.collections.map.LRUMap void doReadObject(java.io.ObjectInputStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.collections.map.LRUMap void doWriteObject(java.io.ObjectOutputStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.collections.map.LRUMap void moveToMRU(org.apache.commons.collections.map.AbstractLinkedMap.LinkEntry) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.collections.map.LRUMap void readObject(java.io.ObjectInputStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.collections.map.LRUMap void reuseMapping(org.apache.commons.collections.map.AbstractLinkedMap.LinkEntry, int, int, java.lang.Object, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.collections.map.LRUMap void updateEntry(org.apache.commons.collections.map.AbstractHashedMap.HashEntry, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.collections.map.LRUMap void writeObject(java.io.ObjectOutputStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+</root>
diff --git a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/lang/annotations.xml b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/lang/annotations.xml
new file mode 100644
index 000000000000..e36a5e269c9a
--- /dev/null
+++ b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/lang/annotations.xml
@@ -0,0 +1,1581 @@
+<root>
+ <item name="org.apache.commons.lang.ArrayUtils boolean isEmpty(boolean[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;true&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.ArrayUtils boolean isEmpty(byte[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;true&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.ArrayUtils boolean isEmpty(char[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;true&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.ArrayUtils boolean isEmpty(double[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;true&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.ArrayUtils boolean isEmpty(float[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;true&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.ArrayUtils boolean isEmpty(int[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;true&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.ArrayUtils boolean isEmpty(java.lang.Object[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;true&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.ArrayUtils boolean isEmpty(long[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;true&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.ArrayUtils boolean isEmpty(short[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;true&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.ArrayUtils boolean isSameType(java.lang.Object, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.ArrayUtils boolean isSameType(java.lang.Object, java.lang.Object) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.ArrayUtils boolean[] clone(boolean[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.ArrayUtils boolean[] remove(boolean[], int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.ArrayUtils boolean[] subarray(boolean[], int, int)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.ArrayUtils boolean[] toPrimitive(java.lang.Boolean[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.ArrayUtils boolean[] toPrimitive(java.lang.Boolean[], boolean)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.ArrayUtils byte[] clone(byte[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.ArrayUtils byte[] remove(byte[], int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.ArrayUtils byte[] subarray(byte[], int, int)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.ArrayUtils byte[] toPrimitive(java.lang.Byte[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.ArrayUtils byte[] toPrimitive(java.lang.Byte[], byte)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.ArrayUtils char[] clone(char[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.ArrayUtils char[] remove(char[], int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.ArrayUtils char[] subarray(char[], int, int)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.ArrayUtils char[] toPrimitive(java.lang.Character[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.ArrayUtils char[] toPrimitive(java.lang.Character[], char)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.ArrayUtils double[] clone(double[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.ArrayUtils double[] remove(double[], int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.ArrayUtils double[] subarray(double[], int, int)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.ArrayUtils double[] toPrimitive(java.lang.Double[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.ArrayUtils double[] toPrimitive(java.lang.Double[], double)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.ArrayUtils float[] clone(float[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.ArrayUtils float[] remove(float[], int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.ArrayUtils float[] subarray(float[], int, int)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.ArrayUtils float[] toPrimitive(java.lang.Float[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.ArrayUtils float[] toPrimitive(java.lang.Float[], float)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.ArrayUtils int[] clone(int[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.ArrayUtils int[] remove(int[], int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.ArrayUtils int[] subarray(int[], int, int)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.ArrayUtils int[] toPrimitive(java.lang.Integer[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.ArrayUtils int[] toPrimitive(java.lang.Integer[], int)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.ArrayUtils java.lang.Boolean[] toObject(boolean[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.ArrayUtils java.lang.Byte[] toObject(byte[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.ArrayUtils java.lang.Character[] toObject(char[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.ArrayUtils java.lang.Double[] toObject(double[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.ArrayUtils java.lang.Float[] toObject(float[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.ArrayUtils java.lang.Integer[] toObject(int[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.ArrayUtils java.lang.Long[] toObject(long[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.ArrayUtils java.lang.Object remove(java.lang.Object, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.ArrayUtils java.lang.Object[] clone(java.lang.Object[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.ArrayUtils java.lang.Object[] remove(java.lang.Object[], int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.ArrayUtils java.lang.Object[] subarray(java.lang.Object[], int, int)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.ArrayUtils java.lang.Short[] toObject(short[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.ArrayUtils java.util.Map toMap(java.lang.Object[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.ArrayUtils long[] clone(long[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.ArrayUtils long[] remove(long[], int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.ArrayUtils long[] subarray(long[], int, int)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.ArrayUtils long[] toPrimitive(java.lang.Long[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.ArrayUtils long[] toPrimitive(java.lang.Long[], long)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.ArrayUtils short[] clone(short[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.ArrayUtils short[] remove(short[], int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.ArrayUtils short[] subarray(short[], int, int)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.ArrayUtils short[] toPrimitive(java.lang.Short[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.ArrayUtils short[] toPrimitive(java.lang.Short[], short)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.BooleanUtils boolean isFalse(java.lang.Boolean)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.BooleanUtils boolean isTrue(java.lang.Boolean)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.BooleanUtils boolean toBoolean(java.lang.Boolean)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.BooleanUtils boolean xor(boolean[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.BooleanUtils java.lang.Boolean negate(java.lang.Boolean)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.BooleanUtils java.lang.Boolean toBooleanObject(java.lang.Integer)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.BooleanUtils java.lang.Boolean xor(java.lang.Boolean[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.BooleanUtils java.lang.Integer toIntegerObject(java.lang.Boolean)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.CharEncoding boolean isSupported(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.CharRange boolean contains(org.apache.commons.lang.CharRange) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.CharSet CharSet(java.lang.String[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.CharSet org.apache.commons.lang.CharSet getInstance(java.lang.String[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;!null;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.CharSetUtils java.lang.String delete(java.lang.String, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_-&gt;!null;null,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.CharSetUtils java.lang.String delete(java.lang.String, java.lang.String[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_-&gt;!null;null,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.CharSetUtils java.lang.String keep(java.lang.String, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_-&gt;!null;null,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.CharSetUtils java.lang.String keep(java.lang.String, java.lang.String[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_-&gt;!null;null,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.CharSetUtils java.lang.String modify(java.lang.String, java.lang.String[], boolean) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.CharSetUtils java.lang.String modify(java.lang.String, java.lang.String[], boolean)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.CharSetUtils java.lang.String squeeze(java.lang.String, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_-&gt;!null;null,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.CharSetUtils java.lang.String squeeze(java.lang.String, java.lang.String[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_-&gt;!null;null,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.CharSetUtils java.lang.String translate(java.lang.String, java.lang.String, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_,_-&gt;!null;null,_,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.CharSetUtils org.apache.commons.lang.CharSet evaluateSet(java.lang.String[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;!null;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.CharUtils char toChar(java.lang.Character) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.CharUtils char toChar(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.CharUtils int toIntValue(java.lang.Character) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.CharUtils java.lang.Character toCharacterObject(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.CharUtils java.lang.String toString(java.lang.Character)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.CharUtils java.lang.String unicodeEscaped(char)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.CharUtils java.lang.String unicodeEscaped(java.lang.Character)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;!null;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.ClassUtils boolean isAssignable(java.lang.Class, java.lang.Class)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.ClassUtils boolean isInnerClass(java.lang.Class)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.ClassUtils java.lang.Class primitiveToWrapper(java.lang.Class)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.ClassUtils java.lang.Class[] primitivesToWrappers(java.lang.Class[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.ClassUtils java.lang.Class[] toClass(java.lang.Object[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.ClassUtils java.lang.Class[] wrappersToPrimitives(java.lang.Class[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.ClassUtils java.lang.String getPackageCanonicalName(java.lang.Class)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.ClassUtils java.lang.String getPackageCanonicalName(java.lang.Object, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_-&gt;!null;_,!null-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.ClassUtils java.lang.String getPackageCanonicalName(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.ClassUtils java.lang.String getPackageName(java.lang.Class)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.ClassUtils java.lang.String getPackageName(java.lang.Object, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_-&gt;!null;_,!null-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.ClassUtils java.lang.String getPackageName(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.ClassUtils java.lang.String getShortCanonicalName(java.lang.Class)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.ClassUtils java.lang.String getShortClassName(java.lang.Class)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.ClassUtils java.lang.String getShortClassName(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.ClassUtils java.lang.String toCanonicalName(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.ClassUtils java.lang.reflect.Method getPublicMethod(java.lang.Class, java.lang.String, java.lang.Class[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.ClassUtils java.lang.reflect.Method getPublicMethod(java.lang.Class, java.lang.String, java.lang.Class[]) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.ClassUtils java.util.List convertClassNamesToClasses(java.util.List)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.ClassUtils java.util.List convertClassesToClassNames(java.util.List)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.ClassUtils java.util.List getAllInterfaces(java.lang.Class)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.ClassUtils java.util.List getAllSuperclasses(java.lang.Class)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.Entities java.io.StringWriter createStringWriter(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.Entities java.io.StringWriter createStringWriter(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.Entities java.lang.String escape(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.Entities java.lang.String unescape(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.Entities void addEntities(java.lang.String[][]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.Entities void doUnescape(java.io.Writer, java.lang.String, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.Entities void doUnescape(java.io.Writer, java.lang.String, int) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.Entities void escape(java.io.Writer, java.lang.String) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.Entities void fillWithHtml40Entities(org.apache.commons.lang.Entities) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.Entities void unescape(java.io.Writer, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.Entities void unescape(java.io.Writer, java.lang.String) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.IllegalClassException java.lang.String safeGetClassName(java.lang.Class)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.IncompleteArgumentException java.lang.String safeArrayToString(java.lang.Object[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.IntHashMap boolean contains(java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.LocaleUtils java.util.List localeLookupList(java.util.Locale)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.LocaleUtils java.util.List localeLookupList(java.util.Locale, java.util.Locale)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.LocaleUtils java.util.Locale toLocale(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;!null;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.NumberRange NumberRange(java.lang.Number) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.NumberRange NumberRange(java.lang.Number, java.lang.Number) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.NumberRange NumberRange(java.lang.Number, java.lang.Number) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.NumberRange boolean includesNumber(java.lang.Number)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.NumberRange boolean includesRange(org.apache.commons.lang.NumberRange)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.NumberRange boolean overlaps(org.apache.commons.lang.NumberRange)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.NumberRange java.lang.String toString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.NumberUtils boolean isAllZeros(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;true&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.NumberUtils boolean isDigits(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.NumberUtils boolean isNumber(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.NumberUtils java.lang.Double createDouble(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.NumberUtils java.lang.Float createFloat(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.NumberUtils java.lang.Integer createInteger(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.NumberUtils java.lang.Integer createInteger(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.NumberUtils java.lang.Long createLong(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.NumberUtils java.lang.Long createLong(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.NumberUtils java.lang.Number createNumber(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.NumberUtils java.math.BigDecimal createBigDecimal(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.NumberUtils java.math.BigInteger createBigInteger(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.ObjectUtils java.lang.Object defaultIfNull(java.lang.Object, java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.ObjectUtils java.lang.String identityToString(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;!null;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.ObjectUtils java.lang.String toString(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.ObjectUtils java.lang.StringBuffer appendIdentityToString(java.lang.StringBuffer, java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,!null-&gt;!null;_,null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.ObjectUtils void identityToString(java.lang.StringBuffer, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.ObjectUtils void identityToString(java.lang.StringBuffer, java.lang.Object) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.RandomStringUtils java.lang.String random(int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.RandomStringUtils java.lang.String random(int, boolean, boolean)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.RandomStringUtils java.lang.String random(int, char[])">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.RandomStringUtils java.lang.String random(int, int, int, boolean, boolean)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.RandomStringUtils java.lang.String random(int, int, int, boolean, boolean, char[])">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.RandomStringUtils java.lang.String random(int, int, int, boolean, boolean, char[], java.util.Random)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.RandomStringUtils java.lang.String random(int, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.RandomStringUtils java.lang.String randomAlphabetic(int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.RandomStringUtils java.lang.String randomAlphanumeric(int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.RandomStringUtils java.lang.String randomAscii(int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.RandomStringUtils java.lang.String randomNumeric(int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.SerializationUtils java.lang.Object deserialize(byte[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.SerializationUtils java.lang.Object deserialize(java.io.InputStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.SerializationUtils void serialize(java.io.Serializable, java.io.OutputStream) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.StringEscapeUtils java.lang.String escapeHtml(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringEscapeUtils java.lang.String escapeJavaStyleString(java.lang.String, boolean)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringEscapeUtils java.lang.String escapeSql(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;!null;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringEscapeUtils java.lang.String escapeXml(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringEscapeUtils java.lang.String unescapeCsv(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringEscapeUtils java.lang.String unescapeHtml(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringEscapeUtils java.lang.String unescapeJava(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringEscapeUtils java.lang.String unescapeXml(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringEscapeUtils void escapeHtml(java.io.Writer, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.StringEscapeUtils void escapeJava(java.io.Writer, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.StringEscapeUtils void escapeJavaScript(java.io.Writer, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.StringEscapeUtils void escapeJavaStyleString(java.io.Writer, java.lang.String, boolean) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.StringEscapeUtils void escapeXml(java.io.Writer, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.StringEscapeUtils void unescapeHtml(java.io.Writer, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.StringEscapeUtils void unescapeJava(java.io.Writer, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.StringEscapeUtils void unescapeJavaScript(java.io.Writer, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.StringEscapeUtils void unescapeXml(java.io.Writer, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils boolean contains(java.lang.String, char)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils boolean contains(java.lang.String, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,null-&gt;false;null,_-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils boolean containsAny(java.lang.String, char[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,null-&gt;false;null,_-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils boolean containsAny(java.lang.String, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,null-&gt;false;null,_-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils boolean containsIgnoreCase(java.lang.String, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,null-&gt;false;null,_-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils boolean containsNone(java.lang.String, char[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,null-&gt;true;null,_-&gt;true&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils boolean containsNone(java.lang.String, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,null-&gt;true;null,_-&gt;true&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils boolean containsOnly(java.lang.String, char[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,null-&gt;false;null,_-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils boolean containsOnly(java.lang.String, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,null-&gt;false;null,_-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils boolean isAlpha(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils boolean isAlphaSpace(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils boolean isAlphanumeric(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils boolean isAlphanumericSpace(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils boolean isAsciiPrintable(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils boolean isBlank(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;true&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils boolean isEmpty(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;true&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils boolean isNumeric(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils boolean isNumericSpace(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils boolean isWhitespace(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils int getLevenshteinDistance(java.lang.String, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils int getLevenshteinDistance(java.lang.String, java.lang.String) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String abbreviate(java.lang.String, int)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_-&gt;!null;null,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String abbreviate(java.lang.String, int, int)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_,_-&gt;!null;null,_,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String capitalise(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;!null;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String capitaliseAllWords(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;!null;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String capitalize(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;!null;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String center(java.lang.String, int)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String center(java.lang.String, int, char)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String center(java.lang.String, int, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String chomp(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;!null;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String chomp(java.lang.String, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_-&gt;!null;null,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String chompLast(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String chompLast(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String chompLast(java.lang.String, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String chompLast(java.lang.String, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String chop(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;!null;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String chopNewline(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String chopNewline(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String clean(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String concatenate(java.lang.Object[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;!null;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String defaultString(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;!null;null-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String defaultString(java.lang.String, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String deleteSpaces(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;!null;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String deleteWhitespace(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;!null;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String difference(java.lang.String, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_-&gt;!null;_,!null-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String getChomp(java.lang.String, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String getChomp(java.lang.String, java.lang.String) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String getChomp(java.lang.String, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,!null-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String getCommonPrefix(java.lang.String[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String getNestedString(java.lang.String, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,null-&gt;null;null,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String getNestedString(java.lang.String, java.lang.String, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,_,null-&gt;null;_,null,_-&gt;null;null,_,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String getPrechomp(java.lang.String, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String getPrechomp(java.lang.String, java.lang.String) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String getPrechomp(java.lang.String, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String join(java.lang.Object[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;!null;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String join(java.lang.Object[], char)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_-&gt;!null;null,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String join(java.lang.Object[], char, int, int)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_,_,_-&gt;!null;null,_,_,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String join(java.lang.Object[], java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_-&gt;!null;null,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String join(java.lang.Object[], java.lang.String, int, int)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_,_,_-&gt;!null;null,_,_,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String join(java.util.Collection, char)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String join(java.util.Collection, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String join(java.util.Iterator, char)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String join(java.util.Iterator, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String left(java.lang.String, int)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_-&gt;!null;null,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String leftPad(java.lang.String, int)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String leftPad(java.lang.String, int, char)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String leftPad(java.lang.String, int, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String lowerCase(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String mid(java.lang.String, int, int)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_,_-&gt;!null;null,_,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String overlay(java.lang.String, java.lang.String, int, int)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_,_,_-&gt;!null;null,_,_,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String overlayString(java.lang.String, java.lang.String, int, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String overlayString(java.lang.String, java.lang.String, int, int) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String overlayString(java.lang.String, java.lang.String, int, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String padding(int, char)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String prechomp(java.lang.String, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String prechomp(java.lang.String, java.lang.String) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String prechomp(java.lang.String, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String remove(java.lang.String, char)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_-&gt;!null;null,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String remove(java.lang.String, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_-&gt;!null;null,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String removeEnd(java.lang.String, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_-&gt;!null;null,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String removeEndIgnoreCase(java.lang.String, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_-&gt;!null;null,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String removeStart(java.lang.String, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_-&gt;!null;null,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String removeStartIgnoreCase(java.lang.String, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_-&gt;!null;null,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String repeat(java.lang.String, int)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_-&gt;!null;null,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String replace(java.lang.String, java.lang.String, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_,_-&gt;!null;null,_,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String replace(java.lang.String, java.lang.String, java.lang.String, int)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_,_,_-&gt;!null;null,_,_,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String replaceChars(java.lang.String, char, char)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String replaceChars(java.lang.String, java.lang.String, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_,_-&gt;!null;null,_,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String replaceEach(java.lang.String, java.lang.String[], java.lang.String[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String replaceEach(java.lang.String, java.lang.String[], java.lang.String[], boolean, int)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_,_,_,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String replaceEachRepeatedly(java.lang.String, java.lang.String[], java.lang.String[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String replaceOnce(java.lang.String, java.lang.String, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_,_-&gt;!null;null,_,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String reverse(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;!null;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String reverseDelimited(java.lang.String, char)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String reverseDelimitedString(java.lang.String, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String right(java.lang.String, int)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_-&gt;!null;null,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String rightPad(java.lang.String, int)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String rightPad(java.lang.String, int, char)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String rightPad(java.lang.String, int, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String stripEnd(java.lang.String, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_-&gt;!null;null,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String stripStart(java.lang.String, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_-&gt;!null;null,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String stripToEmpty(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String stripToNull(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String substring(java.lang.String, int)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_-&gt;!null;null,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String substring(java.lang.String, int, int)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_,_-&gt;!null;null,_,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String substringAfter(java.lang.String, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String substringAfterLast(java.lang.String, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String substringBefore(java.lang.String, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String substringBeforeLast(java.lang.String, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_-&gt;!null;null,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String substringBetween(java.lang.String, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,null-&gt;null;null,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String substringBetween(java.lang.String, java.lang.String, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,_,null-&gt;null;_,null,_-&gt;null;null,_,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String swapCase(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;!null;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String trim(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String trimToEmpty(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String trimToNull(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String uncapitalise(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;!null;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String uncapitalize(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;!null;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String upperCase(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String[] split(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String[] split(java.lang.String, char)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String[] split(java.lang.String, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String[] split(java.lang.String, java.lang.String, int)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String[] splitByCharacterType(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String[] splitByCharacterType(java.lang.String, boolean)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String[] splitByCharacterTypeCamelCase(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String[] splitByWholeSeparator(java.lang.String, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String[] splitByWholeSeparator(java.lang.String, java.lang.String, int)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String[] splitByWholeSeparatorPreserveAllTokens(java.lang.String, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String[] splitByWholeSeparatorPreserveAllTokens(java.lang.String, java.lang.String, int)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String[] splitByWholeSeparatorWorker(java.lang.String, java.lang.String, int, boolean)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_,_,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String[] splitPreserveAllTokens(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String[] splitPreserveAllTokens(java.lang.String, char)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String[] splitPreserveAllTokens(java.lang.String, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String[] splitPreserveAllTokens(java.lang.String, java.lang.String, int)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String[] splitWorker(java.lang.String, char, boolean)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String[] splitWorker(java.lang.String, java.lang.String, int, boolean)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_,_,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String[] stripAll(java.lang.String[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String[] stripAll(java.lang.String[], java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.StringUtils java.lang.String[] substringsBetween(java.lang.String, java.lang.String, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.SystemUtils boolean getJavaVersionMatches(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.SystemUtils boolean getOSMatches(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.SystemUtils java.io.File getJavaHome()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.SystemUtils java.io.File getJavaIoTmpDir()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.SystemUtils java.io.File getUserDir()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.SystemUtils java.io.File getUserHome()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.Validate void allElementsOfType(java.util.Collection, java.lang.Class) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.Validate void allElementsOfType(java.util.Collection, java.lang.Class) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.Validate void allElementsOfType(java.util.Collection, java.lang.Class, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.Validate void allElementsOfType(java.util.Collection, java.lang.Class, java.lang.String) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.Validate void noNullElements(java.lang.Object[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.Validate void noNullElements(java.lang.Object[], java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.Validate void noNullElements(java.util.Collection) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.Validate void noNullElements(java.util.Collection, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.Validate void notEmpty(java.lang.Object[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.Validate void notEmpty(java.lang.Object[], java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.Validate void notEmpty(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.Validate void notEmpty(java.lang.String, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.Validate void notEmpty(java.util.Collection) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.Validate void notEmpty(java.util.Collection, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.Validate void notEmpty(java.util.Map) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.Validate void notEmpty(java.util.Map, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.Validate void notNull(java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.Validate void notNull(java.lang.Object, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.WordUtils java.lang.String abbreviate(java.lang.String, int, int, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_,_,_-&gt;!null;null,_,_,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.WordUtils java.lang.String capitalize(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;!null;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.WordUtils java.lang.String capitalize(java.lang.String, char[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_-&gt;!null;null,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.WordUtils java.lang.String capitalizeFully(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.WordUtils java.lang.String capitalizeFully(java.lang.String, char[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.WordUtils java.lang.String initials(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;!null;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.WordUtils java.lang.String initials(java.lang.String, char[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_-&gt;!null;null,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.WordUtils java.lang.String swapCase(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;!null;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.WordUtils java.lang.String uncapitalize(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;!null;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.WordUtils java.lang.String uncapitalize(java.lang.String, char[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_-&gt;!null;null,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.WordUtils java.lang.String wrap(java.lang.String, int)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_-&gt;!null;null,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.WordUtils java.lang.String wrap(java.lang.String, int, java.lang.String, boolean)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_,_,_-&gt;!null;null,_,_,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+</root>
diff --git a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/lang/builder/annotations.xml b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/lang/builder/annotations.xml
new file mode 100644
index 000000000000..c46c851e0fa1
--- /dev/null
+++ b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/lang/builder/annotations.xml
@@ -0,0 +1,574 @@
+<root>
+ <item name="org.apache.commons.lang.builder.CompareToBuilder org.apache.commons.lang.builder.CompareToBuilder append(boolean, boolean)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.CompareToBuilder org.apache.commons.lang.builder.CompareToBuilder append(boolean[], boolean[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,null-&gt;!null;null,_-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.builder.CompareToBuilder org.apache.commons.lang.builder.CompareToBuilder append(byte, byte)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.CompareToBuilder org.apache.commons.lang.builder.CompareToBuilder append(byte[], byte[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,null-&gt;!null;null,_-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.builder.CompareToBuilder org.apache.commons.lang.builder.CompareToBuilder append(char, char)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.CompareToBuilder org.apache.commons.lang.builder.CompareToBuilder append(char[], char[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,null-&gt;!null;null,_-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.builder.CompareToBuilder org.apache.commons.lang.builder.CompareToBuilder append(double, double)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.CompareToBuilder org.apache.commons.lang.builder.CompareToBuilder append(double[], double[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,null-&gt;!null;null,_-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.builder.CompareToBuilder org.apache.commons.lang.builder.CompareToBuilder append(float, float)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.CompareToBuilder org.apache.commons.lang.builder.CompareToBuilder append(float[], float[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,null-&gt;!null;null,_-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.builder.CompareToBuilder org.apache.commons.lang.builder.CompareToBuilder append(int, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.CompareToBuilder org.apache.commons.lang.builder.CompareToBuilder append(int[], int[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,null-&gt;!null;null,_-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.builder.CompareToBuilder org.apache.commons.lang.builder.CompareToBuilder append(java.lang.Object, java.lang.Object, java.util.Comparator)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.CompareToBuilder org.apache.commons.lang.builder.CompareToBuilder append(java.lang.Object[], java.lang.Object[], java.util.Comparator)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,null,_-&gt;!null;null,_,_-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.builder.CompareToBuilder org.apache.commons.lang.builder.CompareToBuilder append(long, long)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.CompareToBuilder org.apache.commons.lang.builder.CompareToBuilder append(long[], long[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,null-&gt;!null;null,_-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.builder.CompareToBuilder org.apache.commons.lang.builder.CompareToBuilder append(short, short)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.CompareToBuilder org.apache.commons.lang.builder.CompareToBuilder append(short[], short[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,null-&gt;!null;null,_-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.builder.CompareToBuilder org.apache.commons.lang.builder.CompareToBuilder appendSuper(int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.CompareToBuilder void reflectionAppend(java.lang.Object, java.lang.Object, java.lang.Class, org.apache.commons.lang.builder.CompareToBuilder, boolean, java.lang.String[]) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.EqualsBuilder org.apache.commons.lang.builder.EqualsBuilder append(boolean, boolean)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.EqualsBuilder org.apache.commons.lang.builder.EqualsBuilder append(boolean[], boolean[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,null-&gt;!null;null,_-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.builder.EqualsBuilder org.apache.commons.lang.builder.EqualsBuilder append(byte, byte)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.EqualsBuilder org.apache.commons.lang.builder.EqualsBuilder append(byte[], byte[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,null-&gt;!null;null,_-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.builder.EqualsBuilder org.apache.commons.lang.builder.EqualsBuilder append(char, char)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.EqualsBuilder org.apache.commons.lang.builder.EqualsBuilder append(char[], char[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,null-&gt;!null;null,_-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.builder.EqualsBuilder org.apache.commons.lang.builder.EqualsBuilder append(double[], double[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,null-&gt;!null;null,_-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.builder.EqualsBuilder org.apache.commons.lang.builder.EqualsBuilder append(float[], float[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,null-&gt;!null;null,_-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.builder.EqualsBuilder org.apache.commons.lang.builder.EqualsBuilder append(int, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.EqualsBuilder org.apache.commons.lang.builder.EqualsBuilder append(int[], int[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,null-&gt;!null;null,_-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.builder.EqualsBuilder org.apache.commons.lang.builder.EqualsBuilder append(java.lang.Object, java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.EqualsBuilder org.apache.commons.lang.builder.EqualsBuilder append(java.lang.Object[], java.lang.Object[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,null-&gt;!null;null,_-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.builder.EqualsBuilder org.apache.commons.lang.builder.EqualsBuilder append(long, long)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.EqualsBuilder org.apache.commons.lang.builder.EqualsBuilder append(long[], long[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,null-&gt;!null;null,_-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.builder.EqualsBuilder org.apache.commons.lang.builder.EqualsBuilder append(short, short)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.EqualsBuilder org.apache.commons.lang.builder.EqualsBuilder append(short[], short[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,null-&gt;!null;null,_-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.builder.EqualsBuilder org.apache.commons.lang.builder.EqualsBuilder appendSuper(boolean)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.EqualsBuilder void reflectionAppend(java.lang.Object, java.lang.Object, java.lang.Class, org.apache.commons.lang.builder.EqualsBuilder, boolean, java.lang.String[]) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.HashCodeBuilder int reflectionHashCode(int, int, java.lang.Object) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.HashCodeBuilder int reflectionHashCode(int, int, java.lang.Object, boolean) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.HashCodeBuilder int reflectionHashCode(int, int, java.lang.Object, boolean, java.lang.Class) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.HashCodeBuilder int reflectionHashCode(int, int, java.lang.Object, boolean, java.lang.Class, java.lang.String[]) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.HashCodeBuilder int reflectionHashCode(java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.HashCodeBuilder int reflectionHashCode(java.lang.Object, boolean) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.HashCodeBuilder int reflectionHashCode(java.lang.Object, java.lang.String[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.HashCodeBuilder int reflectionHashCode(java.lang.Object, java.util.Collection) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.HashCodeBuilder java.lang.Integer toIdentityHashCodeInteger(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.HashCodeBuilder org.apache.commons.lang.builder.HashCodeBuilder append(boolean)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.HashCodeBuilder org.apache.commons.lang.builder.HashCodeBuilder append(boolean[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.builder.HashCodeBuilder org.apache.commons.lang.builder.HashCodeBuilder append(byte)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.HashCodeBuilder org.apache.commons.lang.builder.HashCodeBuilder append(byte[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.builder.HashCodeBuilder org.apache.commons.lang.builder.HashCodeBuilder append(char)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.HashCodeBuilder org.apache.commons.lang.builder.HashCodeBuilder append(char[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.builder.HashCodeBuilder org.apache.commons.lang.builder.HashCodeBuilder append(double[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.builder.HashCodeBuilder org.apache.commons.lang.builder.HashCodeBuilder append(float)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.HashCodeBuilder org.apache.commons.lang.builder.HashCodeBuilder append(float[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.builder.HashCodeBuilder org.apache.commons.lang.builder.HashCodeBuilder append(int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.HashCodeBuilder org.apache.commons.lang.builder.HashCodeBuilder append(int[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.builder.HashCodeBuilder org.apache.commons.lang.builder.HashCodeBuilder append(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.HashCodeBuilder org.apache.commons.lang.builder.HashCodeBuilder append(java.lang.Object[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.builder.HashCodeBuilder org.apache.commons.lang.builder.HashCodeBuilder append(long)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.HashCodeBuilder org.apache.commons.lang.builder.HashCodeBuilder append(long[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.builder.HashCodeBuilder org.apache.commons.lang.builder.HashCodeBuilder append(short)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.HashCodeBuilder org.apache.commons.lang.builder.HashCodeBuilder append(short[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.builder.HashCodeBuilder org.apache.commons.lang.builder.HashCodeBuilder appendSuper(int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.HashCodeBuilder.1 java.lang.Object initialValue()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ReflectionToStringBuilder boolean accept(java.lang.reflect.Field) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ReflectionToStringBuilder java.lang.Object getValue(java.lang.reflect.Field) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ReflectionToStringBuilder java.lang.String[] toNoNullStringArray(java.lang.Object[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ReflectionToStringBuilder org.apache.commons.lang.builder.ReflectionToStringBuilder setExcludeFieldNames(java.lang.String[])">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ReflectionToStringBuilder org.apache.commons.lang.builder.ToStringBuilder reflectionAppendArray(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ReflectionToStringBuilder void appendFieldsIn(java.lang.Class) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringBuilder java.lang.String toString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringBuilder org.apache.commons.lang.builder.ToStringBuilder append(boolean)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringBuilder org.apache.commons.lang.builder.ToStringBuilder append(boolean[])">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringBuilder org.apache.commons.lang.builder.ToStringBuilder append(byte)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringBuilder org.apache.commons.lang.builder.ToStringBuilder append(byte[])">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringBuilder org.apache.commons.lang.builder.ToStringBuilder append(char)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringBuilder org.apache.commons.lang.builder.ToStringBuilder append(char[])">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringBuilder org.apache.commons.lang.builder.ToStringBuilder append(double)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringBuilder org.apache.commons.lang.builder.ToStringBuilder append(double[])">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringBuilder org.apache.commons.lang.builder.ToStringBuilder append(float)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringBuilder org.apache.commons.lang.builder.ToStringBuilder append(float[])">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringBuilder org.apache.commons.lang.builder.ToStringBuilder append(int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringBuilder org.apache.commons.lang.builder.ToStringBuilder append(int[])">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringBuilder org.apache.commons.lang.builder.ToStringBuilder append(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringBuilder org.apache.commons.lang.builder.ToStringBuilder append(java.lang.Object[])">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringBuilder org.apache.commons.lang.builder.ToStringBuilder append(java.lang.String, boolean)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringBuilder org.apache.commons.lang.builder.ToStringBuilder append(java.lang.String, boolean[])">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringBuilder org.apache.commons.lang.builder.ToStringBuilder append(java.lang.String, boolean[], boolean)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringBuilder org.apache.commons.lang.builder.ToStringBuilder append(java.lang.String, byte)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringBuilder org.apache.commons.lang.builder.ToStringBuilder append(java.lang.String, byte[])">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringBuilder org.apache.commons.lang.builder.ToStringBuilder append(java.lang.String, byte[], boolean)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringBuilder org.apache.commons.lang.builder.ToStringBuilder append(java.lang.String, char)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringBuilder org.apache.commons.lang.builder.ToStringBuilder append(java.lang.String, char[])">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringBuilder org.apache.commons.lang.builder.ToStringBuilder append(java.lang.String, char[], boolean)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringBuilder org.apache.commons.lang.builder.ToStringBuilder append(java.lang.String, double)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringBuilder org.apache.commons.lang.builder.ToStringBuilder append(java.lang.String, double[])">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringBuilder org.apache.commons.lang.builder.ToStringBuilder append(java.lang.String, double[], boolean)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringBuilder org.apache.commons.lang.builder.ToStringBuilder append(java.lang.String, float)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringBuilder org.apache.commons.lang.builder.ToStringBuilder append(java.lang.String, float[])">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringBuilder org.apache.commons.lang.builder.ToStringBuilder append(java.lang.String, float[], boolean)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringBuilder org.apache.commons.lang.builder.ToStringBuilder append(java.lang.String, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringBuilder org.apache.commons.lang.builder.ToStringBuilder append(java.lang.String, int[])">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringBuilder org.apache.commons.lang.builder.ToStringBuilder append(java.lang.String, int[], boolean)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringBuilder org.apache.commons.lang.builder.ToStringBuilder append(java.lang.String, java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringBuilder org.apache.commons.lang.builder.ToStringBuilder append(java.lang.String, java.lang.Object, boolean)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringBuilder org.apache.commons.lang.builder.ToStringBuilder append(java.lang.String, java.lang.Object[])">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringBuilder org.apache.commons.lang.builder.ToStringBuilder append(java.lang.String, java.lang.Object[], boolean)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringBuilder org.apache.commons.lang.builder.ToStringBuilder append(java.lang.String, long)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringBuilder org.apache.commons.lang.builder.ToStringBuilder append(java.lang.String, long[])">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringBuilder org.apache.commons.lang.builder.ToStringBuilder append(java.lang.String, long[], boolean)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringBuilder org.apache.commons.lang.builder.ToStringBuilder append(java.lang.String, short)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringBuilder org.apache.commons.lang.builder.ToStringBuilder append(java.lang.String, short[])">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringBuilder org.apache.commons.lang.builder.ToStringBuilder append(java.lang.String, short[], boolean)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringBuilder org.apache.commons.lang.builder.ToStringBuilder append(long)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringBuilder org.apache.commons.lang.builder.ToStringBuilder append(long[])">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringBuilder org.apache.commons.lang.builder.ToStringBuilder append(short)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringBuilder org.apache.commons.lang.builder.ToStringBuilder append(short[])">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringBuilder org.apache.commons.lang.builder.ToStringBuilder appendAsObjectToString(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringBuilder org.apache.commons.lang.builder.ToStringBuilder appendSuper(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringBuilder org.apache.commons.lang.builder.ToStringBuilder appendToString(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringBuilder void setDefaultStyle(org.apache.commons.lang.builder.ToStringStyle) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringStyle java.lang.String getShortClassName(java.lang.Class)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringStyle void appendContentEnd(java.lang.StringBuffer) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringStyle void appendContentStart(java.lang.StringBuffer) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringStyle void appendDetail(java.lang.StringBuffer, java.lang.String, boolean) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringStyle void appendDetail(java.lang.StringBuffer, java.lang.String, boolean[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringStyle void appendDetail(java.lang.StringBuffer, java.lang.String, boolean[]) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringStyle void appendDetail(java.lang.StringBuffer, java.lang.String, byte) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringStyle void appendDetail(java.lang.StringBuffer, java.lang.String, byte[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringStyle void appendDetail(java.lang.StringBuffer, java.lang.String, byte[]) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringStyle void appendDetail(java.lang.StringBuffer, java.lang.String, char) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringStyle void appendDetail(java.lang.StringBuffer, java.lang.String, char[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringStyle void appendDetail(java.lang.StringBuffer, java.lang.String, char[]) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringStyle void appendDetail(java.lang.StringBuffer, java.lang.String, double) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringStyle void appendDetail(java.lang.StringBuffer, java.lang.String, double[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringStyle void appendDetail(java.lang.StringBuffer, java.lang.String, double[]) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringStyle void appendDetail(java.lang.StringBuffer, java.lang.String, float) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringStyle void appendDetail(java.lang.StringBuffer, java.lang.String, float[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringStyle void appendDetail(java.lang.StringBuffer, java.lang.String, float[]) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringStyle void appendDetail(java.lang.StringBuffer, java.lang.String, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringStyle void appendDetail(java.lang.StringBuffer, java.lang.String, int[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringStyle void appendDetail(java.lang.StringBuffer, java.lang.String, int[]) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringStyle void appendDetail(java.lang.StringBuffer, java.lang.String, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringStyle void appendDetail(java.lang.StringBuffer, java.lang.String, java.lang.Object[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringStyle void appendDetail(java.lang.StringBuffer, java.lang.String, java.lang.Object[]) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringStyle void appendDetail(java.lang.StringBuffer, java.lang.String, java.util.Collection) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringStyle void appendDetail(java.lang.StringBuffer, java.lang.String, java.util.Map) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringStyle void appendDetail(java.lang.StringBuffer, java.lang.String, long) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringStyle void appendDetail(java.lang.StringBuffer, java.lang.String, long[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringStyle void appendDetail(java.lang.StringBuffer, java.lang.String, long[]) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringStyle void appendDetail(java.lang.StringBuffer, java.lang.String, short) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringStyle void appendDetail(java.lang.StringBuffer, java.lang.String, short[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringStyle void appendDetail(java.lang.StringBuffer, java.lang.String, short[]) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringStyle void appendFieldSeparator(java.lang.StringBuffer) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringStyle void appendNullText(java.lang.StringBuffer, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringStyle void appendSummary(java.lang.StringBuffer, java.lang.String, boolean[]) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringStyle void appendSummary(java.lang.StringBuffer, java.lang.String, byte[]) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringStyle void appendSummary(java.lang.StringBuffer, java.lang.String, char[]) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringStyle void appendSummary(java.lang.StringBuffer, java.lang.String, double[]) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringStyle void appendSummary(java.lang.StringBuffer, java.lang.String, float[]) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringStyle void appendSummary(java.lang.StringBuffer, java.lang.String, int[]) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringStyle void appendSummary(java.lang.StringBuffer, java.lang.String, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringStyle void appendSummary(java.lang.StringBuffer, java.lang.String, java.lang.Object) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringStyle void appendSummary(java.lang.StringBuffer, java.lang.String, java.lang.Object[]) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringStyle void appendSummary(java.lang.StringBuffer, java.lang.String, long[]) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringStyle void appendSummary(java.lang.StringBuffer, java.lang.String, short[]) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringStyle void appendSummarySize(java.lang.StringBuffer, java.lang.String, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringStyle void reflectionAppendArrayDetail(java.lang.StringBuffer, java.lang.String, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringStyle void removeLastFieldSeparator(java.lang.StringBuffer) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.builder.ToStringStyle.1 java.lang.Object initialValue()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+</root>
diff --git a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/lang/enum/annotations.xml b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/lang/enum/annotations.xml
new file mode 100644
index 000000000000..be5d5ca8d20e
--- /dev/null
+++ b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/lang/enum/annotations.xml
@@ -0,0 +1,50 @@
+<root>
+ <item name="org.apache.commons.lang.enum.Enum Enum(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.enum.Enum java.lang.String getNameInOtherClassLoader(java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.enum.Enum java.util.Iterator iterator(java.lang.Class) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.enum.Enum java.util.List getEnumList(java.lang.Class) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.enum.Enum java.util.Map getEnumMap(java.lang.Class) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.enum.Enum org.apache.commons.lang.enum.Enum getEnum(java.lang.Class, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.enum.Enum org.apache.commons.lang.enum.Enum.Entry createEntry(java.lang.Class) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.enum.Enum org.apache.commons.lang.enum.Enum.Entry getEntry(java.lang.Class) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.enum.EnumUtils java.util.Iterator iterator(java.lang.Class) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.enum.EnumUtils java.util.List getEnumList(java.lang.Class) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.enum.EnumUtils java.util.Map getEnumMap(java.lang.Class) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.enum.EnumUtils org.apache.commons.lang.enum.Enum getEnum(java.lang.Class, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.enum.EnumUtils org.apache.commons.lang.enum.ValuedEnum getEnum(java.lang.Class, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.enum.ValuedEnum ValuedEnum(java.lang.String, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.enum.ValuedEnum int compareTo(java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.enum.ValuedEnum org.apache.commons.lang.enum.Enum getEnum(java.lang.Class, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+</root>
diff --git a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/lang/enums/annotations.xml b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/lang/enums/annotations.xml
new file mode 100644
index 000000000000..0e7d219fd30a
--- /dev/null
+++ b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/lang/enums/annotations.xml
@@ -0,0 +1,50 @@
+<root>
+ <item name="org.apache.commons.lang.enums.Enum Enum(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.enums.Enum java.lang.String getNameInOtherClassLoader(java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.enums.Enum java.util.Iterator iterator(java.lang.Class) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.enums.Enum java.util.List getEnumList(java.lang.Class) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.enums.Enum java.util.Map getEnumMap(java.lang.Class) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.enums.Enum org.apache.commons.lang.enums.Enum getEnum(java.lang.Class, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.enums.Enum org.apache.commons.lang.enums.Enum.Entry createEntry(java.lang.Class) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.enums.Enum org.apache.commons.lang.enums.Enum.Entry getEntry(java.lang.Class) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.enums.EnumUtils java.util.Iterator iterator(java.lang.Class) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.enums.EnumUtils java.util.List getEnumList(java.lang.Class) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.enums.EnumUtils java.util.Map getEnumMap(java.lang.Class) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.enums.EnumUtils org.apache.commons.lang.enums.Enum getEnum(java.lang.Class, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.enums.EnumUtils org.apache.commons.lang.enums.ValuedEnum getEnum(java.lang.Class, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.enums.ValuedEnum ValuedEnum(java.lang.String, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.enums.ValuedEnum int getValueInOtherClassLoader(java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.enums.ValuedEnum org.apache.commons.lang.enums.Enum getEnum(java.lang.Class, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+</root>
diff --git a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/lang/exception/annotations.xml b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/lang/exception/annotations.xml
new file mode 100644
index 000000000000..2924cb9a5731
--- /dev/null
+++ b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/lang/exception/annotations.xml
@@ -0,0 +1,72 @@
+<root>
+ <item name="org.apache.commons.lang.exception.ExceptionUtils boolean isNestedThrowable(java.lang.Throwable)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.exception.ExceptionUtils boolean setCause(java.lang.Throwable, java.lang.Throwable) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.exception.ExceptionUtils java.lang.String getFullStackTrace(java.lang.Throwable)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.exception.ExceptionUtils java.lang.String getMessage(java.lang.Throwable)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.exception.ExceptionUtils java.lang.String getRootCauseMessage(java.lang.Throwable)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.exception.ExceptionUtils java.lang.String getStackTrace(java.lang.Throwable) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.exception.ExceptionUtils java.lang.String getStackTrace(java.lang.Throwable)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.exception.ExceptionUtils java.lang.String[] toArray(java.util.List) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.exception.ExceptionUtils java.lang.Throwable getCause(java.lang.Throwable)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.exception.ExceptionUtils java.lang.Throwable getCause(java.lang.Throwable, java.lang.String[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.exception.ExceptionUtils java.lang.Throwable getCauseUsingWellKnownTypes(java.lang.Throwable)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.exception.ExceptionUtils java.util.ArrayList getCauseMethodNameList()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.exception.ExceptionUtils java.util.List getStackFrameList(java.lang.Throwable) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.exception.ExceptionUtils void removeCommonFrames(java.util.List, java.util.List) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.exception.ExceptionUtils void removeCommonFrames(java.util.List, java.util.List) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.exception.NestableDelegate NestableDelegate(org.apache.commons.lang.exception.Nestable) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.exception.NestableDelegate java.lang.String getMessage(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.exception.NestableDelegate java.lang.String[] getStackFrames(java.lang.Throwable) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.exception.NestableDelegate void printStackTrace(java.io.PrintStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.exception.NestableDelegate void trimStackFrames(java.util.List) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+</root>
diff --git a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/lang/math/annotations.xml b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/lang/math/annotations.xml
new file mode 100644
index 000000000000..c799fc9bc0fd
--- /dev/null
+++ b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/lang/math/annotations.xml
@@ -0,0 +1,309 @@
+<root>
+ <item name="org.apache.commons.lang.math.DoubleRange DoubleRange(java.lang.Number) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.math.DoubleRange DoubleRange(java.lang.Number, java.lang.Number) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.math.DoubleRange DoubleRange(java.lang.Number, java.lang.Number) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.math.DoubleRange boolean containsNumber(java.lang.Number)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.math.DoubleRange boolean containsRange(org.apache.commons.lang.math.Range)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.math.DoubleRange boolean overlapsRange(org.apache.commons.lang.math.Range)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.math.FloatRange FloatRange(java.lang.Number) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.math.FloatRange FloatRange(java.lang.Number, java.lang.Number) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.math.FloatRange FloatRange(java.lang.Number, java.lang.Number) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.math.FloatRange boolean containsNumber(java.lang.Number)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.math.FloatRange boolean containsRange(org.apache.commons.lang.math.Range)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.math.FloatRange boolean overlapsRange(org.apache.commons.lang.math.Range)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.math.Fraction org.apache.commons.lang.math.Fraction abs()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.math.Fraction org.apache.commons.lang.math.Fraction add(org.apache.commons.lang.math.Fraction) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.math.Fraction org.apache.commons.lang.math.Fraction add(org.apache.commons.lang.math.Fraction)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.math.Fraction org.apache.commons.lang.math.Fraction addSub(org.apache.commons.lang.math.Fraction, boolean) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.math.Fraction org.apache.commons.lang.math.Fraction addSub(org.apache.commons.lang.math.Fraction, boolean)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_-&gt;!null;_,false-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.math.Fraction org.apache.commons.lang.math.Fraction divideBy(org.apache.commons.lang.math.Fraction) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.math.Fraction org.apache.commons.lang.math.Fraction getFraction(int, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.math.Fraction org.apache.commons.lang.math.Fraction getFraction(int, int, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.math.Fraction org.apache.commons.lang.math.Fraction getFraction(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.math.Fraction org.apache.commons.lang.math.Fraction invert()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.math.Fraction org.apache.commons.lang.math.Fraction multiplyBy(org.apache.commons.lang.math.Fraction) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.math.Fraction org.apache.commons.lang.math.Fraction negate()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.math.Fraction org.apache.commons.lang.math.Fraction subtract(org.apache.commons.lang.math.Fraction) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.math.Fraction org.apache.commons.lang.math.Fraction subtract(org.apache.commons.lang.math.Fraction)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.math.IEEE754rUtils double max(double[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.math.IEEE754rUtils double min(double[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.math.IEEE754rUtils float max(float[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.math.IEEE754rUtils float min(float[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.math.IntRange IntRange(java.lang.Number) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.math.IntRange IntRange(java.lang.Number, java.lang.Number) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.math.IntRange IntRange(java.lang.Number, java.lang.Number) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.math.IntRange boolean containsNumber(java.lang.Number)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.math.IntRange boolean containsRange(org.apache.commons.lang.math.Range)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.math.IntRange boolean overlapsRange(org.apache.commons.lang.math.Range)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.math.LongRange LongRange(java.lang.Number) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.math.LongRange LongRange(java.lang.Number, java.lang.Number) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.math.LongRange LongRange(java.lang.Number, java.lang.Number) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.math.LongRange boolean containsNumber(java.lang.Number)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.math.LongRange boolean containsRange(org.apache.commons.lang.math.Range)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.math.LongRange boolean overlapsRange(org.apache.commons.lang.math.Range)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.math.NumberRange NumberRange(java.lang.Number) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.math.NumberRange NumberRange(java.lang.Number, java.lang.Number) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.math.NumberRange NumberRange(java.lang.Number, java.lang.Number) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.math.NumberRange boolean containsNumber(java.lang.Number)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.math.NumberUtils boolean isAllZeros(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;true&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.math.NumberUtils boolean isDigits(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.math.NumberUtils boolean isNumber(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.math.NumberUtils byte max(byte[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.math.NumberUtils byte min(byte[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.math.NumberUtils double max(double[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.math.NumberUtils double min(double[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.math.NumberUtils float max(float[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.math.NumberUtils float min(float[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.math.NumberUtils int max(int[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.math.NumberUtils int min(int[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.math.NumberUtils java.lang.Double createDouble(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;!null;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.math.NumberUtils java.lang.Float createFloat(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;!null;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.math.NumberUtils java.lang.Integer createInteger(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;!null;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.math.NumberUtils java.lang.Long createLong(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;!null;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.math.NumberUtils java.lang.Number createNumber(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.math.NumberUtils java.math.BigDecimal createBigDecimal(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;!null;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.math.NumberUtils java.math.BigInteger createBigInteger(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;!null;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.math.NumberUtils long max(long[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.math.NumberUtils long min(long[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.math.NumberUtils short max(short[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.math.NumberUtils short min(short[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.math.RandomUtils boolean nextBoolean(java.util.Random) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.math.RandomUtils double nextDouble(java.util.Random) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.math.RandomUtils float nextFloat(java.util.Random) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.math.RandomUtils int nextInt(java.util.Random) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.math.RandomUtils int nextInt(java.util.Random, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.math.RandomUtils long nextLong(java.util.Random) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.math.Range boolean containsDouble(java.lang.Number)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.math.Range boolean containsFloat(java.lang.Number)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.math.Range boolean containsInteger(java.lang.Number)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.math.Range boolean containsLong(java.lang.Number)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.math.Range boolean containsRange(org.apache.commons.lang.math.Range)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.math.Range boolean overlapsRange(org.apache.commons.lang.math.Range)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.math.Range java.lang.String toString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+</root>
diff --git a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/lang/mutable/annotations.xml b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/lang/mutable/annotations.xml
new file mode 100644
index 000000000000..dd2d7d0d82ab
--- /dev/null
+++ b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/lang/mutable/annotations.xml
@@ -0,0 +1,192 @@
+<root>
+ <item name="org.apache.commons.lang.mutable.MutableBoolean MutableBoolean(java.lang.Boolean) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.mutable.MutableBoolean boolean equals(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.mutable.MutableBoolean int compareTo(java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.mutable.MutableBoolean java.lang.String toString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.mutable.MutableBoolean void setValue(java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.mutable.MutableByte MutableByte(java.lang.Number) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.mutable.MutableByte boolean equals(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.mutable.MutableByte int compareTo(java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.mutable.MutableByte java.lang.Byte toByte()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.mutable.MutableByte java.lang.Object getValue()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.mutable.MutableByte java.lang.String toString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.mutable.MutableByte void add(java.lang.Number) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.mutable.MutableByte void setValue(java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.mutable.MutableByte void subtract(java.lang.Number) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.mutable.MutableDouble MutableDouble(java.lang.Number) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.mutable.MutableDouble boolean equals(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.mutable.MutableDouble int compareTo(java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.mutable.MutableDouble java.lang.Double toDouble()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.mutable.MutableDouble java.lang.Object getValue()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.mutable.MutableDouble void add(java.lang.Number) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.mutable.MutableDouble void setValue(java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.mutable.MutableDouble void subtract(java.lang.Number) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.mutable.MutableFloat MutableFloat(java.lang.Number) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.mutable.MutableFloat boolean equals(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.mutable.MutableFloat int compareTo(java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.mutable.MutableFloat java.lang.Float toFloat()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.mutable.MutableFloat java.lang.Object getValue()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.mutable.MutableFloat void add(java.lang.Number) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.mutable.MutableFloat void setValue(java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.mutable.MutableFloat void subtract(java.lang.Number) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.mutable.MutableInt MutableInt(java.lang.Number) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.mutable.MutableInt boolean equals(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.mutable.MutableInt int compareTo(java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.mutable.MutableInt java.lang.Integer toInteger()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.mutable.MutableInt java.lang.Object getValue()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.mutable.MutableInt java.lang.String toString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.mutable.MutableInt void add(java.lang.Number) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.mutable.MutableInt void setValue(java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.mutable.MutableInt void subtract(java.lang.Number) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.mutable.MutableLong MutableLong(java.lang.Number) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.mutable.MutableLong boolean equals(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.mutable.MutableLong int compareTo(java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.mutable.MutableLong java.lang.Long toLong()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.mutable.MutableLong java.lang.Object getValue()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.mutable.MutableLong java.lang.String toString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.mutable.MutableLong void add(java.lang.Number) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.mutable.MutableLong void setValue(java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.mutable.MutableLong void subtract(java.lang.Number) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.mutable.MutableObject boolean equals(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.mutable.MutableShort MutableShort(java.lang.Number) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.mutable.MutableShort boolean equals(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.mutable.MutableShort int compareTo(java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.mutable.MutableShort java.lang.Object getValue()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.mutable.MutableShort java.lang.Short toShort()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.mutable.MutableShort java.lang.String toString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.mutable.MutableShort void add(java.lang.Number) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.mutable.MutableShort void setValue(java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.mutable.MutableShort void subtract(java.lang.Number) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+</root>
diff --git a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/lang/text/annotations.xml b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/lang/text/annotations.xml
new file mode 100644
index 000000000000..d6d4e6ec1483
--- /dev/null
+++ b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/lang/text/annotations.xml
@@ -0,0 +1,422 @@
+<root>
+ <item name="org.apache.commons.lang.text.ExtendedMessageFormat boolean containsElements(java.util.Collection)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.text.ExtendedMessageFormat int readArgumentIndex(java.lang.String, java.text.ParsePosition) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.text.ExtendedMessageFormat int readArgumentIndex(java.lang.String, java.text.ParsePosition) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.text.ExtendedMessageFormat java.lang.String insertFormats(java.lang.String, java.util.ArrayList)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_-&gt;!null;null,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.text.ExtendedMessageFormat java.lang.String parseFormatDescription(java.lang.String, java.text.ParsePosition) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.text.ExtendedMessageFormat java.lang.String parseFormatDescription(java.lang.String, java.text.ParsePosition) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.text.ExtendedMessageFormat java.lang.String parseFormatDescription(java.lang.String, java.text.ParsePosition)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.text.ExtendedMessageFormat java.lang.StringBuffer appendQuotedString(java.lang.String, java.text.ParsePosition, java.lang.StringBuffer, boolean) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.text.ExtendedMessageFormat java.lang.StringBuffer appendQuotedString(java.lang.String, java.text.ParsePosition, java.lang.StringBuffer, boolean) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.text.ExtendedMessageFormat java.lang.StringBuffer appendQuotedString(java.lang.String, java.text.ParsePosition, java.lang.StringBuffer, boolean)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,_,!null,_-&gt;!null;_,_,null,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.text.ExtendedMessageFormat java.text.Format getFormat(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.text.ExtendedMessageFormat java.text.ParsePosition next(java.text.ParsePosition) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.text.ExtendedMessageFormat java.text.ParsePosition next(java.text.ParsePosition)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.text.ExtendedMessageFormat void getQuotedString(java.lang.String, java.text.ParsePosition, boolean) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.text.ExtendedMessageFormat void getQuotedString(java.lang.String, java.text.ParsePosition, boolean) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.text.ExtendedMessageFormat void seekNonWs(java.lang.String, java.text.ParsePosition) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.text.ExtendedMessageFormat void seekNonWs(java.lang.String, java.text.ParsePosition) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.text.StrBuilder boolean endsWith(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.text.StrBuilder boolean equals(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.text.StrBuilder boolean equals(org.apache.commons.lang.text.StrBuilder)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;true&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.text.StrBuilder boolean equalsIgnoreCase(org.apache.commons.lang.text.StrBuilder)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;true&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.text.StrBuilder boolean startsWith(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.text.StrBuilder char[] getChars(char[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;!null;null-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.text.StrBuilder java.io.Reader asReader()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.text.StrBuilder java.io.Writer asWriter()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.text.StrBuilder java.lang.String leftString(int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.text.StrBuilder java.lang.String midString(int, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.text.StrBuilder java.lang.String rightString(int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.text.StrBuilder java.lang.String substring(int, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.text.StrBuilder java.lang.String toString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.text.StrBuilder java.lang.StringBuffer toStringBuffer()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.text.StrBuilder org.apache.commons.lang.text.StrBuilder append(boolean)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.text.StrBuilder org.apache.commons.lang.text.StrBuilder append(char)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.text.StrBuilder org.apache.commons.lang.text.StrBuilder append(char[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.text.StrBuilder org.apache.commons.lang.text.StrBuilder append(char[], int, int)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_,_-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.text.StrBuilder org.apache.commons.lang.text.StrBuilder append(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.text.StrBuilder org.apache.commons.lang.text.StrBuilder append(java.lang.String, int, int)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_,_-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.text.StrBuilder org.apache.commons.lang.text.StrBuilder append(java.lang.StringBuffer)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.text.StrBuilder org.apache.commons.lang.text.StrBuilder append(java.lang.StringBuffer, int, int)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_,_-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.text.StrBuilder org.apache.commons.lang.text.StrBuilder append(org.apache.commons.lang.text.StrBuilder)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.text.StrBuilder org.apache.commons.lang.text.StrBuilder append(org.apache.commons.lang.text.StrBuilder, int, int)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_,_-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.text.StrBuilder org.apache.commons.lang.text.StrBuilder appendAll(java.lang.Object[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.text.StrBuilder org.apache.commons.lang.text.StrBuilder appendAll(java.util.Collection)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.text.StrBuilder org.apache.commons.lang.text.StrBuilder appendAll(java.util.Iterator)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.text.StrBuilder org.apache.commons.lang.text.StrBuilder appendSeparator(char)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.text.StrBuilder org.apache.commons.lang.text.StrBuilder appendSeparator(char, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.text.StrBuilder org.apache.commons.lang.text.StrBuilder appendSeparator(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.text.StrBuilder org.apache.commons.lang.text.StrBuilder appendSeparator(java.lang.String, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.text.StrBuilder org.apache.commons.lang.text.StrBuilder appendWithSeparators(java.lang.Object[], java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.text.StrBuilder org.apache.commons.lang.text.StrBuilder appendWithSeparators(java.util.Collection, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.text.StrBuilder org.apache.commons.lang.text.StrBuilder appendWithSeparators(java.util.Iterator, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.text.StrBuilder org.apache.commons.lang.text.StrBuilder clear()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.text.StrBuilder org.apache.commons.lang.text.StrBuilder delete(int, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.text.StrBuilder org.apache.commons.lang.text.StrBuilder deleteCharAt(int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.text.StrBuilder org.apache.commons.lang.text.StrBuilder deleteFirst(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.text.StrBuilder org.apache.commons.lang.text.StrBuilder ensureCapacity(int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.text.StrBuilder org.apache.commons.lang.text.StrBuilder insert(int, boolean)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.text.StrBuilder org.apache.commons.lang.text.StrBuilder insert(int, char)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.text.StrBuilder org.apache.commons.lang.text.StrBuilder insert(int, char[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,!null-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.text.StrBuilder org.apache.commons.lang.text.StrBuilder insert(int, char[], int, int)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,!null,_,_-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.text.StrBuilder org.apache.commons.lang.text.StrBuilder insert(int, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.text.StrBuilder org.apache.commons.lang.text.StrBuilder minimizeCapacity()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.text.StrBuilder org.apache.commons.lang.text.StrBuilder replace(int, int, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.text.StrBuilder org.apache.commons.lang.text.StrBuilder replace(org.apache.commons.lang.text.StrMatcher, java.lang.String, int, int, int)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_,_,_,_-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.text.StrBuilder org.apache.commons.lang.text.StrBuilder replaceFirst(java.lang.String, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.text.StrBuilder org.apache.commons.lang.text.StrBuilder replaceImpl(org.apache.commons.lang.text.StrMatcher, java.lang.String, int, int, int)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_,_,_,_-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.text.StrBuilder org.apache.commons.lang.text.StrBuilder setCharAt(int, char)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.text.StrBuilder org.apache.commons.lang.text.StrBuilder setNewLineText(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.text.StrBuilder org.apache.commons.lang.text.StrBuilder setNullText(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.text.StrBuilder org.apache.commons.lang.text.StrTokenizer asTokenizer()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.text.StrBuilder.StrBuilderReader int read(char[], int, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.text.StrLookup org.apache.commons.lang.text.StrLookup mapLookup(java.util.Map)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.text.StrMatcher int isMatch(char[], int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.text.StrMatcher org.apache.commons.lang.text.StrMatcher charMatcher(char)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.text.StrMatcher.CharMatcher int isMatch(char[], int, int, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.text.StrMatcher.CharSetMatcher CharSetMatcher(char[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.text.StrMatcher.CharSetMatcher int isMatch(char[], int, int, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.text.StrMatcher.StringMatcher StringMatcher(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.text.StrMatcher.TrimMatcher int isMatch(char[], int, int, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.text.StrSubstitutor boolean replaceIn(java.lang.StringBuffer)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.text.StrSubstitutor boolean replaceIn(java.lang.StringBuffer, int, int)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_,_-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.text.StrSubstitutor boolean replaceIn(org.apache.commons.lang.text.StrBuilder)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.text.StrSubstitutor boolean replaceIn(org.apache.commons.lang.text.StrBuilder, int, int)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_,_-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.text.StrSubstitutor boolean substitute(org.apache.commons.lang.text.StrBuilder, int, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.text.StrSubstitutor int substitute(org.apache.commons.lang.text.StrBuilder, int, int, java.util.List) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.text.StrSubstitutor java.lang.String replace(char[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.text.StrSubstitutor java.lang.String replace(char[], int, int)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.text.StrSubstitutor java.lang.String replace(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.text.StrSubstitutor java.lang.String replace(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.text.StrSubstitutor java.lang.String replace(java.lang.String, int, int)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.text.StrSubstitutor java.lang.String replace(java.lang.StringBuffer)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.text.StrSubstitutor java.lang.String replace(java.lang.StringBuffer, int, int)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.text.StrSubstitutor java.lang.String replace(org.apache.commons.lang.text.StrBuilder)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.text.StrSubstitutor java.lang.String replace(org.apache.commons.lang.text.StrBuilder, int, int)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.text.StrSubstitutor org.apache.commons.lang.text.StrSubstitutor setVariablePrefix(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.text.StrSubstitutor org.apache.commons.lang.text.StrSubstitutor setVariablePrefixMatcher(org.apache.commons.lang.text.StrMatcher) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.text.StrSubstitutor org.apache.commons.lang.text.StrSubstitutor setVariablePrefixMatcher(org.apache.commons.lang.text.StrMatcher)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.text.StrSubstitutor org.apache.commons.lang.text.StrSubstitutor setVariableSuffix(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.text.StrSubstitutor org.apache.commons.lang.text.StrSubstitutor setVariableSuffixMatcher(org.apache.commons.lang.text.StrMatcher) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.text.StrSubstitutor org.apache.commons.lang.text.StrSubstitutor setVariableSuffixMatcher(org.apache.commons.lang.text.StrMatcher)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.text.StrSubstitutor void checkCyclicSubstitution(java.lang.String, java.util.List) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.text.StrTokenizer int readWithQuotes(char[], int, int, org.apache.commons.lang.text.StrBuilder, java.util.List, int, int) 3">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.text.StrTokenizer java.lang.String toString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.text.StrTokenizer org.apache.commons.lang.text.StrTokenizer reset()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.text.StrTokenizer org.apache.commons.lang.text.StrTokenizer reset(char[])">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.text.StrTokenizer org.apache.commons.lang.text.StrTokenizer reset(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.text.StrTokenizer org.apache.commons.lang.text.StrTokenizer setDelimiterMatcher(org.apache.commons.lang.text.StrMatcher)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.text.StrTokenizer org.apache.commons.lang.text.StrTokenizer setEmptyTokenAsNull(boolean)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.text.StrTokenizer org.apache.commons.lang.text.StrTokenizer setIgnoreEmptyTokens(boolean)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.text.StrTokenizer org.apache.commons.lang.text.StrTokenizer setIgnoredMatcher(org.apache.commons.lang.text.StrMatcher)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.text.StrTokenizer org.apache.commons.lang.text.StrTokenizer setQuoteMatcher(org.apache.commons.lang.text.StrMatcher)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.text.StrTokenizer org.apache.commons.lang.text.StrTokenizer setTrimmerMatcher(org.apache.commons.lang.text.StrMatcher)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+</root>
diff --git a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/lang/time/annotations.xml b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/lang/time/annotations.xml
new file mode 100644
index 000000000000..b392cffbce52
--- /dev/null
+++ b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/lang/time/annotations.xml
@@ -0,0 +1,481 @@
+<root>
+ <item name="org.apache.commons.lang.time.DateFormatUtils java.lang.String format(java.util.Calendar, java.lang.String) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateFormatUtils java.lang.String format(java.util.Calendar, java.lang.String, java.util.Locale) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateFormatUtils java.lang.String format(java.util.Calendar, java.lang.String, java.util.TimeZone) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateFormatUtils java.lang.String format(java.util.Calendar, java.lang.String, java.util.TimeZone, java.util.Locale) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateFormatUtils java.lang.String format(java.util.Date, java.lang.String) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateFormatUtils java.lang.String format(java.util.Date, java.lang.String, java.util.Locale) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateFormatUtils java.lang.String format(java.util.Date, java.lang.String, java.util.TimeZone) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateFormatUtils java.lang.String format(java.util.Date, java.lang.String, java.util.TimeZone, java.util.Locale) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateFormatUtils java.lang.String format(long, java.lang.String) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateFormatUtils java.lang.String format(long, java.lang.String, java.util.Locale) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateFormatUtils java.lang.String format(long, java.lang.String, java.util.TimeZone) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateFormatUtils java.lang.String format(long, java.lang.String, java.util.TimeZone, java.util.Locale) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateFormatUtils java.lang.String formatUTC(java.util.Date, java.lang.String) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateFormatUtils java.lang.String formatUTC(java.util.Date, java.lang.String, java.util.Locale) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateFormatUtils java.lang.String formatUTC(long, java.lang.String) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateFormatUtils java.lang.String formatUTC(long, java.lang.String, java.util.Locale) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateUtils boolean isSameDay(java.util.Calendar, java.util.Calendar) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateUtils boolean isSameDay(java.util.Calendar, java.util.Calendar) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateUtils boolean isSameDay(java.util.Date, java.util.Date) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateUtils boolean isSameDay(java.util.Date, java.util.Date) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateUtils boolean isSameInstant(java.util.Calendar, java.util.Calendar) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateUtils boolean isSameInstant(java.util.Calendar, java.util.Calendar) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateUtils boolean isSameInstant(java.util.Date, java.util.Date) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateUtils boolean isSameInstant(java.util.Date, java.util.Date) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateUtils boolean isSameLocalTime(java.util.Calendar, java.util.Calendar) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateUtils boolean isSameLocalTime(java.util.Calendar, java.util.Calendar) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateUtils java.util.Calendar round(java.util.Calendar, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateUtils java.util.Calendar truncate(java.util.Calendar, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateUtils java.util.Date add(java.util.Date, int, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateUtils java.util.Date add(java.util.Date, int, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateUtils java.util.Date addDays(java.util.Date, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateUtils java.util.Date addDays(java.util.Date, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateUtils java.util.Date addHours(java.util.Date, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateUtils java.util.Date addHours(java.util.Date, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateUtils java.util.Date addMilliseconds(java.util.Date, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateUtils java.util.Date addMilliseconds(java.util.Date, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateUtils java.util.Date addMinutes(java.util.Date, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateUtils java.util.Date addMinutes(java.util.Date, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateUtils java.util.Date addMonths(java.util.Date, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateUtils java.util.Date addMonths(java.util.Date, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateUtils java.util.Date addSeconds(java.util.Date, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateUtils java.util.Date addSeconds(java.util.Date, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateUtils java.util.Date addWeeks(java.util.Date, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateUtils java.util.Date addWeeks(java.util.Date, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateUtils java.util.Date addYears(java.util.Date, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateUtils java.util.Date addYears(java.util.Date, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateUtils java.util.Date parseDate(java.lang.String, java.lang.String[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateUtils java.util.Date parseDate(java.lang.String, java.lang.String[]) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateUtils java.util.Date round(java.lang.Object, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateUtils java.util.Date round(java.lang.Object, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateUtils java.util.Date round(java.util.Date, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateUtils java.util.Date round(java.util.Date, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateUtils java.util.Date set(java.util.Date, int, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateUtils java.util.Date set(java.util.Date, int, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateUtils java.util.Date setDays(java.util.Date, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateUtils java.util.Date setDays(java.util.Date, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateUtils java.util.Date setHours(java.util.Date, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateUtils java.util.Date setHours(java.util.Date, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateUtils java.util.Date setMilliseconds(java.util.Date, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateUtils java.util.Date setMilliseconds(java.util.Date, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateUtils java.util.Date setMinutes(java.util.Date, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateUtils java.util.Date setMinutes(java.util.Date, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateUtils java.util.Date setMonths(java.util.Date, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateUtils java.util.Date setMonths(java.util.Date, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateUtils java.util.Date setSeconds(java.util.Date, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateUtils java.util.Date setSeconds(java.util.Date, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateUtils java.util.Date setYears(java.util.Date, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateUtils java.util.Date setYears(java.util.Date, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateUtils java.util.Date truncate(java.lang.Object, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateUtils java.util.Date truncate(java.lang.Object, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateUtils java.util.Date truncate(java.util.Date, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateUtils java.util.Date truncate(java.util.Date, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateUtils java.util.Iterator iterator(java.lang.Object, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateUtils java.util.Iterator iterator(java.lang.Object, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateUtils java.util.Iterator iterator(java.util.Calendar, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateUtils java.util.Iterator iterator(java.util.Calendar, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateUtils java.util.Iterator iterator(java.util.Date, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateUtils java.util.Iterator iterator(java.util.Date, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateUtils long getFragment(java.util.Calendar, int, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateUtils long getFragment(java.util.Date, int, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateUtils long getFragmentInDays(java.util.Calendar, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateUtils long getFragmentInDays(java.util.Date, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateUtils long getFragmentInHours(java.util.Calendar, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateUtils long getFragmentInHours(java.util.Date, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateUtils long getFragmentInMilliseconds(java.util.Calendar, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateUtils long getFragmentInMilliseconds(java.util.Date, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateUtils long getFragmentInMinutes(java.util.Calendar, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateUtils long getFragmentInMinutes(java.util.Date, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateUtils long getFragmentInSeconds(java.util.Calendar, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateUtils long getFragmentInSeconds(java.util.Date, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DateUtils void modify(java.util.Calendar, int, boolean) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DurationFormatUtils java.lang.String format(org.apache.commons.lang.time.DurationFormatUtils.Token[], int, int, int, int, int, int, int, boolean) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DurationFormatUtils java.lang.String format(org.apache.commons.lang.time.DurationFormatUtils.Token[], int, int, int, int, int, int, int, boolean)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DurationFormatUtils java.lang.String formatDuration(long, java.lang.String) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DurationFormatUtils java.lang.String formatDuration(long, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DurationFormatUtils java.lang.String formatDuration(long, java.lang.String, boolean) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DurationFormatUtils java.lang.String formatDuration(long, java.lang.String, boolean)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DurationFormatUtils java.lang.String formatDurationHMS(long)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DurationFormatUtils java.lang.String formatDurationISO(long)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DurationFormatUtils java.lang.String formatPeriod(long, long, java.lang.String) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DurationFormatUtils java.lang.String formatPeriod(long, long, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DurationFormatUtils java.lang.String formatPeriod(long, long, java.lang.String, boolean, java.util.TimeZone) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DurationFormatUtils java.lang.String formatPeriod(long, long, java.lang.String, boolean, java.util.TimeZone)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DurationFormatUtils java.lang.String formatPeriodISO(long, long)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DurationFormatUtils org.apache.commons.lang.time.DurationFormatUtils.Token[] lexx(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DurationFormatUtils.Token boolean containsTokenWithValue(org.apache.commons.lang.time.DurationFormatUtils.Token[], java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.DurationFormatUtils.Token boolean equals(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.time.FastDateFormat FastDateFormat(java.lang.String, java.util.TimeZone, java.util.Locale) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.FastDateFormat boolean equals(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.time.FastDateFormat java.lang.Object parseObject(java.lang.String, java.text.ParsePosition) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.FastDateFormat java.lang.Object parseObject(java.lang.String, java.text.ParsePosition)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_-&gt;null;_,!null-&gt;null;null,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.time.FastDateFormat java.lang.String format(java.util.Calendar)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.FastDateFormat java.lang.String format(java.util.Date) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.FastDateFormat java.lang.String format(java.util.Date)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.FastDateFormat java.lang.String parseToken(java.lang.String, int[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.FastDateFormat java.lang.String parseToken(java.lang.String, int[]) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.FastDateFormat java.lang.String parseToken(java.lang.String, int[])">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.FastDateFormat java.lang.String toString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.FastDateFormat java.lang.StringBuffer applyRules(java.util.Calendar, java.lang.StringBuffer)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,!null-&gt;!null;_,null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.commons.lang.time.FastDateFormat java.lang.StringBuffer format(java.lang.Object, java.lang.StringBuffer, java.text.FieldPosition) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.FastDateFormat java.lang.StringBuffer format(java.util.Date, java.lang.StringBuffer) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.FastDateFormat org.apache.commons.lang.time.FastDateFormat getInstance(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.FastDateFormat org.apache.commons.lang.time.FastDateFormat getInstance(java.lang.String, java.util.Locale) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.FastDateFormat org.apache.commons.lang.time.FastDateFormat getInstance(java.lang.String, java.util.TimeZone) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.FastDateFormat org.apache.commons.lang.time.FastDateFormat getInstance(java.lang.String, java.util.TimeZone, java.util.Locale) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.FastDateFormat org.apache.commons.lang.time.FastDateFormat.NumberRule selectNumberRule(int, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.FastDateFormat void readObject(java.io.ObjectInputStream) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.FastDateFormat.CharacterLiteral void appendTo(java.lang.StringBuffer, java.util.Calendar) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.FastDateFormat.PaddedNumberField void appendTo(java.lang.StringBuffer, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.FastDateFormat.PaddedNumberField void appendTo(java.lang.StringBuffer, java.util.Calendar) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.FastDateFormat.PaddedNumberField void appendTo(java.lang.StringBuffer, java.util.Calendar) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.FastDateFormat.Pair java.lang.String toString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.FastDateFormat.StringLiteral void appendTo(java.lang.StringBuffer, java.util.Calendar) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.FastDateFormat.TextField void appendTo(java.lang.StringBuffer, java.util.Calendar) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.FastDateFormat.TextField void appendTo(java.lang.StringBuffer, java.util.Calendar) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.FastDateFormat.TimeZoneNameRule void appendTo(java.lang.StringBuffer, java.util.Calendar) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.FastDateFormat.TimeZoneNumberRule void appendTo(java.lang.StringBuffer, java.util.Calendar) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.FastDateFormat.TimeZoneNumberRule void appendTo(java.lang.StringBuffer, java.util.Calendar) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.FastDateFormat.TwelveHourField void appendTo(java.lang.StringBuffer, java.util.Calendar) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.FastDateFormat.TwentyFourHourField void appendTo(java.lang.StringBuffer, java.util.Calendar) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.FastDateFormat.TwoDigitMonthField void appendTo(java.lang.StringBuffer, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.FastDateFormat.TwoDigitMonthField void appendTo(java.lang.StringBuffer, java.util.Calendar) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.FastDateFormat.TwoDigitMonthField void appendTo(java.lang.StringBuffer, java.util.Calendar) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.FastDateFormat.TwoDigitNumberField void appendTo(java.lang.StringBuffer, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.FastDateFormat.TwoDigitNumberField void appendTo(java.lang.StringBuffer, java.util.Calendar) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.FastDateFormat.TwoDigitNumberField void appendTo(java.lang.StringBuffer, java.util.Calendar) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.FastDateFormat.TwoDigitYearField void appendTo(java.lang.StringBuffer, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.FastDateFormat.TwoDigitYearField void appendTo(java.lang.StringBuffer, java.util.Calendar) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.FastDateFormat.TwoDigitYearField void appendTo(java.lang.StringBuffer, java.util.Calendar) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.FastDateFormat.UnpaddedMonthField void appendTo(java.lang.StringBuffer, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.FastDateFormat.UnpaddedMonthField void appendTo(java.lang.StringBuffer, java.util.Calendar) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.FastDateFormat.UnpaddedMonthField void appendTo(java.lang.StringBuffer, java.util.Calendar) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.FastDateFormat.UnpaddedNumberField void appendTo(java.lang.StringBuffer, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.FastDateFormat.UnpaddedNumberField void appendTo(java.lang.StringBuffer, java.util.Calendar) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.FastDateFormat.UnpaddedNumberField void appendTo(java.lang.StringBuffer, java.util.Calendar) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.StopWatch java.lang.String toSplitString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.commons.lang.time.StopWatch java.lang.String toString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+</root>
diff --git a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/anakia/annotations.xml b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/anakia/annotations.xml
new file mode 100644
index 000000000000..a2e1c91b68a7
--- /dev/null
+++ b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/anakia/annotations.xml
@@ -0,0 +1,108 @@
+<root>
+ <item name="org.apache.velocity.anakia.AnakiaElement java.util.List getAttributes()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.anakia.AnakiaElement java.util.List getChildren()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.anakia.AnakiaElement java.util.List getChildren(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.anakia.AnakiaElement java.util.List getChildren(java.lang.String, org.jdom.Namespace)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.anakia.AnakiaElement java.util.List getContent()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.anakia.AnakiaElement org.apache.velocity.anakia.NodeList selectNodes(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.anakia.AnakiaJDOMFactory org.jdom.Element element(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.anakia.AnakiaJDOMFactory org.jdom.Element element(java.lang.String, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.anakia.AnakiaJDOMFactory org.jdom.Element element(java.lang.String, java.lang.String, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.anakia.AnakiaJDOMFactory org.jdom.Element element(java.lang.String, org.jdom.Namespace)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.anakia.AnakiaTask java.lang.String getRelativePath(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.anakia.AnakiaTask org.apache.velocity.anakia.AnakiaTask.Context createContext()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.anakia.AnakiaTask void ensureDirectoryFor(java.io.File) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.anakia.AnakiaTask void setLastModifiedCheck(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.anakia.AnakiaTask void setTemplatePath(java.io.File) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.anakia.AnakiaTask.Context void setName(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.anakia.Escape java.lang.String getText(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.anakia.Escape java.lang.String getText(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.anakia.NodeList NodeList(java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.anakia.NodeList NodeList(java.util.List) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.anakia.NodeList NodeList(java.util.List, boolean) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.anakia.NodeList NodeList(org.jdom.Document) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.anakia.NodeList NodeList(org.jdom.Element) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.anakia.NodeList boolean equals(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.anakia.NodeList java.util.List subList(int, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.anakia.NodeList org.apache.velocity.anakia.NodeList selectNodes(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.anakia.NodeList.AttributeXMLOutputter void output(org.jdom.Attribute, java.io.Writer) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.anakia.NodeList.AttributeXMLOutputter void output(org.jdom.Attribute, java.io.Writer) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.anakia.TreeWalker org.apache.velocity.anakia.NodeList allElements(org.jdom.Element) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.anakia.TreeWalker org.apache.velocity.anakia.NodeList allElements(org.jdom.Element)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.anakia.TreeWalker void treeWalk(org.jdom.Element, java.util.Collection) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.anakia.XPathTool org.apache.velocity.anakia.NodeList applyTo(java.lang.String, java.util.List)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.anakia.XPathTool org.apache.velocity.anakia.NodeList applyTo(java.lang.String, org.jdom.Document)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.anakia.XPathTool org.apache.velocity.anakia.NodeList applyTo(java.lang.String, org.jdom.Element)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+</root>
diff --git a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/app/annotations.xml b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/app/annotations.xml
new file mode 100644
index 000000000000..fac918657687
--- /dev/null
+++ b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/app/annotations.xml
@@ -0,0 +1,29 @@
+<root>
+ <item name="org.apache.velocity.app.FieldMethodizer void addObject(java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.app.FieldMethodizer void inspect(java.lang.Class) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.app.Velocity boolean evaluate(org.apache.velocity.context.Context, java.io.Writer, java.lang.String, java.io.InputStream) 3">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.app.Velocity boolean mergeTemplate(java.lang.String, java.lang.String, org.apache.velocity.context.Context, java.io.Writer)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_,_,_-&gt;true;_,!null,_,_-&gt;true;_,_,!null,_-&gt;true;_,_,_,!null-&gt;true;_,_,_,null-&gt;true;_,_,null,_-&gt;true;_,null,_,_-&gt;true;null,_,_,_-&gt;true&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.app.Velocity boolean mergeTemplate(java.lang.String, org.apache.velocity.context.Context, java.io.Writer)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_,_-&gt;true;_,!null,_-&gt;true;_,_,!null-&gt;true;_,_,null-&gt;true;_,null,_-&gt;true;null,_,_-&gt;true&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.app.VelocityEngine boolean evaluate(org.apache.velocity.context.Context, java.io.Writer, java.lang.String, java.io.InputStream) 3">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.app.VelocityEngine boolean mergeTemplate(java.lang.String, java.lang.String, org.apache.velocity.context.Context, java.io.Writer)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_,_,_-&gt;true;_,!null,_,_-&gt;true;_,_,!null,_-&gt;true;_,_,_,!null-&gt;true;_,_,_,null-&gt;true;_,_,null,_-&gt;true;_,null,_,_-&gt;true;null,_,_,_-&gt;true&quot;"/>
+ </annotation>
+ </item>
+</root>
diff --git a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/app/event/annotations.xml b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/app/event/annotations.xml
new file mode 100644
index 000000000000..ad9def7fd362
--- /dev/null
+++ b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/app/event/annotations.xml
@@ -0,0 +1,89 @@
+<root>
+ <item name="org.apache.velocity.app.event.EventCartridge boolean addEventHandler(org.apache.velocity.app.event.EventHandler)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.app.event.EventCartridge boolean attachToContext(org.apache.velocity.context.Context)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.app.event.EventCartridge boolean removeEventHandler(org.apache.velocity.app.event.EventHandler)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.app.event.EventHandlerUtil boolean shouldLogOnNullSet(org.apache.velocity.runtime.RuntimeServices, org.apache.velocity.context.InternalContextAdapter, java.lang.String, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.app.event.EventHandlerUtil boolean shouldLogOnNullSet(org.apache.velocity.runtime.RuntimeServices, org.apache.velocity.context.InternalContextAdapter, java.lang.String, java.lang.String) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.app.event.EventHandlerUtil java.lang.Object invalidGetMethod(org.apache.velocity.runtime.RuntimeServices, org.apache.velocity.context.InternalContextAdapter, java.lang.String, java.lang.Object, java.lang.String, org.apache.velocity.util.introspection.Info) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.app.event.EventHandlerUtil java.lang.Object invalidGetMethod(org.apache.velocity.runtime.RuntimeServices, org.apache.velocity.context.InternalContextAdapter, java.lang.String, java.lang.Object, java.lang.String, org.apache.velocity.util.introspection.Info) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.app.event.EventHandlerUtil java.lang.Object invalidMethod(org.apache.velocity.runtime.RuntimeServices, org.apache.velocity.context.InternalContextAdapter, java.lang.String, java.lang.Object, java.lang.String, org.apache.velocity.util.introspection.Info) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.app.event.EventHandlerUtil java.lang.Object invalidMethod(org.apache.velocity.runtime.RuntimeServices, org.apache.velocity.context.InternalContextAdapter, java.lang.String, java.lang.Object, java.lang.String, org.apache.velocity.util.introspection.Info) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.app.event.EventHandlerUtil java.lang.Object invalidReferenceHandlerCall(org.apache.velocity.app.event.EventHandlerMethodExecutor, org.apache.velocity.runtime.RuntimeServices, org.apache.velocity.context.InternalContextAdapter) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.app.event.EventHandlerUtil java.lang.Object invalidReferenceHandlerCall(org.apache.velocity.app.event.EventHandlerMethodExecutor, org.apache.velocity.runtime.RuntimeServices, org.apache.velocity.context.InternalContextAdapter) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.app.event.EventHandlerUtil java.lang.Object invalidReferenceHandlerCall(org.apache.velocity.app.event.EventHandlerMethodExecutor, org.apache.velocity.runtime.RuntimeServices, org.apache.velocity.context.InternalContextAdapter) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.app.event.EventHandlerUtil java.lang.Object methodException(org.apache.velocity.runtime.RuntimeServices, org.apache.velocity.context.InternalContextAdapter, java.lang.Class, java.lang.String, java.lang.Exception) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.app.event.EventHandlerUtil java.lang.Object methodException(org.apache.velocity.runtime.RuntimeServices, org.apache.velocity.context.InternalContextAdapter, java.lang.Class, java.lang.String, java.lang.Exception) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.app.event.EventHandlerUtil java.lang.Object referenceInsert(org.apache.velocity.runtime.RuntimeServices, org.apache.velocity.context.InternalContextAdapter, java.lang.String, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.app.event.EventHandlerUtil java.lang.Object referenceInsert(org.apache.velocity.runtime.RuntimeServices, org.apache.velocity.context.InternalContextAdapter, java.lang.String, java.lang.Object) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.app.event.EventHandlerUtil java.lang.String includeEvent(org.apache.velocity.runtime.RuntimeServices, org.apache.velocity.context.InternalContextAdapter, java.lang.String, java.lang.String, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.app.event.EventHandlerUtil java.lang.String includeEvent(org.apache.velocity.runtime.RuntimeServices, org.apache.velocity.context.InternalContextAdapter, java.lang.String, java.lang.String, java.lang.String) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.app.event.EventHandlerUtil void invalidSetMethod(org.apache.velocity.runtime.RuntimeServices, org.apache.velocity.context.InternalContextAdapter, java.lang.String, java.lang.String, org.apache.velocity.util.introspection.Info) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.app.event.EventHandlerUtil void invalidSetMethod(org.apache.velocity.runtime.RuntimeServices, org.apache.velocity.context.InternalContextAdapter, java.lang.String, java.lang.String, org.apache.velocity.util.introspection.Info) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.app.event.IncludeEventHandler.IncludeEventExecutor void execute(org.apache.velocity.app.event.EventHandler) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.app.event.InvalidReferenceEventHandler.InvalidGetMethodExecutor void execute(org.apache.velocity.app.event.EventHandler) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.app.event.InvalidReferenceEventHandler.InvalidMethodExecutor void execute(org.apache.velocity.app.event.EventHandler) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.app.event.InvalidReferenceEventHandler.InvalidSetMethodExecutor void execute(org.apache.velocity.app.event.EventHandler) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.app.event.MethodExceptionEventHandler.MethodExceptionExecutor void execute(org.apache.velocity.app.event.EventHandler) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.app.event.NullSetEventHandler.ShouldLogOnNullSetExecutor void execute(org.apache.velocity.app.event.EventHandler) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.app.event.ReferenceInsertionEventHandler.referenceInsertExecutor void execute(org.apache.velocity.app.event.EventHandler) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+</root>
diff --git a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/app/event/implement/annotations.xml b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/app/event/implement/annotations.xml
new file mode 100644
index 000000000000..5591ed681847
--- /dev/null
+++ b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/app/event/implement/annotations.xml
@@ -0,0 +1,90 @@
+<root>
+ <item name="org.apache.velocity.app.event.implement.EscapeHtmlReference java.lang.String escape(java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.app.event.implement.EscapeHtmlReference java.lang.String getMatchAttribute()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.app.event.implement.EscapeJavaScriptReference java.lang.String escape(java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.app.event.implement.EscapeJavaScriptReference java.lang.String getMatchAttribute()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.app.event.implement.EscapeReference java.lang.Object referenceInsert(java.lang.String, java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.app.event.implement.EscapeReference void setRuntimeServices(org.apache.velocity.runtime.RuntimeServices) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.app.event.implement.EscapeSqlReference java.lang.String escape(java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.app.event.implement.EscapeSqlReference java.lang.String getMatchAttribute()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.app.event.implement.EscapeXmlReference java.lang.String escape(java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.app.event.implement.EscapeXmlReference java.lang.String getMatchAttribute()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.app.event.implement.IncludeNotFound void setRuntimeServices(org.apache.velocity.runtime.RuntimeServices) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.app.event.implement.IncludeRelativePath java.lang.String includeEvent(java.lang.String, java.lang.String, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.app.event.implement.IncludeRelativePath java.lang.String includeEvent(java.lang.String, java.lang.String, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_,_-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.app.event.implement.InvalidReferenceInfo InvalidReferenceInfo(java.lang.String, org.apache.velocity.util.introspection.Info) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.app.event.implement.InvalidReferenceInfo java.lang.String toString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.app.event.implement.PrintExceptions java.lang.Object methodException(java.lang.Class, java.lang.String, java.lang.Exception) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.app.event.implement.PrintExceptions java.lang.Object methodException(java.lang.Class, java.lang.String, java.lang.Exception)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.app.event.implement.PrintExceptions java.lang.String getStackTrace(java.lang.Throwable) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.app.event.implement.ReportInvalidReferences boolean invalidSetMethod(org.apache.velocity.context.Context, java.lang.String, java.lang.String, org.apache.velocity.util.introspection.Info) 3">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.app.event.implement.ReportInvalidReferences boolean invalidSetMethod(org.apache.velocity.context.Context, java.lang.String, java.lang.String, org.apache.velocity.util.introspection.Info)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_,_,_-&gt;false;_,!null,_,_-&gt;false;_,_,!null,_-&gt;false;_,_,_,!null-&gt;false;_,_,_,null-&gt;false;_,_,null,_-&gt;false;_,null,_,_-&gt;false;null,_,_,_-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.app.event.implement.ReportInvalidReferences java.lang.Object invalidGetMethod(org.apache.velocity.context.Context, java.lang.String, java.lang.Object, java.lang.String, org.apache.velocity.util.introspection.Info) 4">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.app.event.implement.ReportInvalidReferences java.lang.Object invalidGetMethod(org.apache.velocity.context.Context, java.lang.String, java.lang.Object, java.lang.String, org.apache.velocity.util.introspection.Info)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_,_,_,_-&gt;null;_,!null,_,_,_-&gt;null;_,_,!null,_,_-&gt;null;_,_,_,!null,_-&gt;null;_,_,_,_,!null-&gt;null;_,_,_,_,null-&gt;null;_,_,_,null,_-&gt;null;_,_,null,_,_-&gt;null;_,null,_,_,_-&gt;null;null,_,_,_,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.app.event.implement.ReportInvalidReferences java.lang.Object invalidMethod(org.apache.velocity.context.Context, java.lang.String, java.lang.Object, java.lang.String, org.apache.velocity.util.introspection.Info) 4">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.app.event.implement.ReportInvalidReferences java.lang.Object invalidMethod(org.apache.velocity.context.Context, java.lang.String, java.lang.Object, java.lang.String, org.apache.velocity.util.introspection.Info)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_,_,_,_-&gt;null;_,!null,_,_,_-&gt;null;_,_,!null,_,_-&gt;null;_,_,_,!null,_-&gt;null;_,_,_,_,!null-&gt;null;_,_,_,_,null-&gt;null;_,_,_,null,_-&gt;null;_,_,null,_,_-&gt;null;_,null,_,_,_-&gt;null;null,_,_,_,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.app.event.implement.ReportInvalidReferences void reportInvalidReference(java.lang.String, org.apache.velocity.util.introspection.Info) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.app.event.implement.ReportInvalidReferences void setRuntimeServices(org.apache.velocity.runtime.RuntimeServices) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+</root>
diff --git a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/app/tools/annotations.xml b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/app/tools/annotations.xml
new file mode 100644
index 000000000000..855a668ec63b
--- /dev/null
+++ b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/app/tools/annotations.xml
@@ -0,0 +1,39 @@
+<root>
+ <item name="org.apache.velocity.app.tools.VelocityFormatter java.lang.Object isNull(java.lang.Object, java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.app.tools.VelocityFormatter java.lang.String formatArray(java.lang.Object, java.lang.String, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.app.tools.VelocityFormatter java.lang.String formatVector(java.util.List, java.lang.String, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.app.tools.VelocityFormatter java.lang.String formatVector(java.util.List, java.lang.String, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.app.tools.VelocityFormatter java.lang.String limitLen(int, java.lang.String, java.lang.String) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.app.tools.VelocityFormatter java.lang.String limitLen(int, java.lang.String, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,!null,_-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.app.tools.VelocityFormatter java.lang.String makeAlternator(java.lang.String, java.lang.String, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.app.tools.VelocityFormatter java.lang.String makeAlternator(java.lang.String, java.lang.String, java.lang.String, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.app.tools.VelocityFormatter java.lang.String makeAlternator(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.app.tools.VelocityFormatter java.lang.String makeAutoAlternator(java.lang.String, java.lang.String, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.app.tools.VelocityFormatter.VelocityAlternator java.lang.String alternate()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+</root>
diff --git a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/context/annotations.xml b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/context/annotations.xml
new file mode 100644
index 000000000000..2e739fb35c61
--- /dev/null
+++ b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/context/annotations.xml
@@ -0,0 +1,37 @@
+<root>
+ <item name="org.apache.velocity.context.AbstractContext boolean containsKey(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.context.AbstractContext java.lang.Object get(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.context.AbstractContext java.lang.Object put(java.lang.String, java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.context.AbstractContext java.lang.Object remove(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.context.EvaluateContext EvaluateContext(org.apache.velocity.context.InternalContextAdapter, org.apache.velocity.runtime.RuntimeServices) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.context.EvaluateContext void initContext(org.apache.velocity.runtime.RuntimeServices) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.context.InternalContextAdapterImpl org.apache.velocity.context.InternalContextAdapter getBaseContext()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.context.ProxyVMContext boolean isConstant(org.apache.velocity.runtime.parser.node.Node) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.context.ProxyVMContext void addVMProxyArg(org.apache.velocity.context.InternalContextAdapter, java.lang.String, java.lang.String, org.apache.velocity.runtime.parser.node.Node) 3">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+</root>
diff --git a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/convert/annotations.xml b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/convert/annotations.xml
new file mode 100644
index 000000000000..8303b86a3cba
--- /dev/null
+++ b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/convert/annotations.xml
@@ -0,0 +1,33 @@
+<root>
+ <item name="org.apache.velocity.convert.WebMacro boolean writeTemplate(java.lang.String, java.lang.String, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.convert.WebMacro boolean writeTemplate(java.lang.String, java.lang.String, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,null,_-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.convert.WebMacro java.lang.String convertName(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.convert.WebMacro java.lang.String convertName(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.convert.WebMacro java.lang.String extractPath(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.convert.WebMacro java.lang.String extractPath(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.convert.WebMacro java.lang.String makeSubstRE(int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.convert.WebMacro void convert(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.convert.WebMacro void main(java.lang.String[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+</root>
diff --git a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/exception/annotations.xml b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/exception/annotations.xml
new file mode 100644
index 000000000000..d7d2ee1dcb64
--- /dev/null
+++ b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/exception/annotations.xml
@@ -0,0 +1,17 @@
+<root>
+ <item name="org.apache.velocity.exception.MethodInvocationException java.lang.String getMessage()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.exception.ParseErrorException ParseErrorException(java.lang.String, org.apache.velocity.util.introspection.Info) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.exception.ParseErrorException ParseErrorException(java.lang.String, org.apache.velocity.util.introspection.Info, java.lang.String) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.exception.ParseErrorException ParseErrorException(org.apache.velocity.exception.VelocityException, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.exception.ParseErrorException ParseErrorException(org.apache.velocity.runtime.parser.ParseException, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+</root>
diff --git a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/io/annotations.xml b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/io/annotations.xml
new file mode 100644
index 000000000000..75ca57304d5b
--- /dev/null
+++ b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/io/annotations.xml
@@ -0,0 +1,8 @@
+<root>
+ <item name="org.apache.velocity.io.UnicodeInputStream org.apache.velocity.io.UnicodeInputStream.UnicodeBOM match(org.apache.velocity.io.UnicodeInputStream.UnicodeBOM, org.apache.velocity.io.UnicodeInputStream.UnicodeBOM) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.io.VelocityWriter void write(char[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+</root>
diff --git a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/runtime/annotations.xml b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/runtime/annotations.xml
new file mode 100644
index 000000000000..457ea7d9dd4b
--- /dev/null
+++ b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/runtime/annotations.xml
@@ -0,0 +1,98 @@
+<root>
+ <item name="org.apache.velocity.runtime.ParserPoolImpl void initialize(org.apache.velocity.runtime.RuntimeServices) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.ParserPoolImpl void put(org.apache.velocity.runtime.parser.Parser) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.RuntimeInstance boolean addVelocimacro(java.lang.String, java.lang.String, java.lang.String[], java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.RuntimeInstance boolean addVelocimacro(java.lang.String, org.apache.velocity.runtime.parser.node.Node, java.lang.String[], java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.RuntimeInstance boolean evaluate(org.apache.velocity.context.Context, java.io.Writer, java.lang.String, java.io.Reader) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.RuntimeInstance boolean invokeVelocimacro(java.lang.String, java.lang.String, java.lang.String[], org.apache.velocity.context.Context, java.io.Writer) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.RuntimeInstance boolean invokeVelocimacro(java.lang.String, java.lang.String, java.lang.String[], org.apache.velocity.context.Context, java.io.Writer) 3">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.RuntimeInstance boolean invokeVelocimacro(java.lang.String, java.lang.String, java.lang.String[], org.apache.velocity.context.Context, java.io.Writer) 4">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.RuntimeInstance boolean isVelocimacro(java.lang.String, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.RuntimeInstance boolean render(org.apache.velocity.context.Context, java.io.Writer, java.lang.String, org.apache.velocity.runtime.parser.node.SimpleNode)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_,_,_-&gt;true;_,!null,_,_-&gt;true;_,_,!null,_-&gt;true;_,_,_,!null-&gt;true;_,_,_,null-&gt;true;_,_,null,_-&gt;true;_,null,_,_-&gt;true;null,_,_,_-&gt;true&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.runtime.RuntimeInstance org.apache.velocity.app.event.EventHandler initializeSpecificEventHandler(java.lang.String, java.lang.String, java.lang.Class)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,_,null-&gt;null;null,_,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.runtime.RuntimeInstance org.apache.velocity.runtime.parser.Parser createNewParser()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.RuntimeInstance void addDirective(org.apache.velocity.runtime.directive.Directive) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.RuntimeInstance void init(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.RuntimeInstance void init(java.util.Properties) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.RuntimeInstance void setProperties(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.RuntimeInstance void setProperties(java.util.Properties) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.VelocimacroFactory VelocimacroFactory(org.apache.velocity.runtime.RuntimeServices) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.VelocimacroFactory boolean addVelocimacro(java.lang.String, java.lang.String, java.lang.String[], java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.VelocimacroFactory boolean addVelocimacro(java.lang.String, java.lang.String, java.lang.String[], java.lang.String) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.VelocimacroFactory boolean addVelocimacro(java.lang.String, java.lang.String, java.lang.String[], java.lang.String) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.VelocimacroFactory boolean addVelocimacro(java.lang.String, java.lang.String, java.lang.String[], java.lang.String) 3">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.VelocimacroFactory boolean addVelocimacro(java.lang.String, org.apache.velocity.runtime.parser.node.Node, java.lang.String[], java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.VelocimacroFactory boolean addVelocimacro(java.lang.String, org.apache.velocity.runtime.parser.node.Node, java.lang.String[], java.lang.String) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.VelocimacroFactory boolean addVelocimacro(java.lang.String, org.apache.velocity.runtime.parser.node.Node, java.lang.String[], java.lang.String) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.VelocimacroFactory boolean addVelocimacro(java.lang.String, org.apache.velocity.runtime.parser.node.Node, java.lang.String[], java.lang.String) 3">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.VelocimacroManager boolean addVM(java.lang.String, org.apache.velocity.runtime.parser.node.Node, java.lang.String[], java.lang.String, boolean) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.VelocimacroManager boolean addVM(java.lang.String, org.apache.velocity.runtime.parser.node.Node, java.lang.String[], java.lang.String, boolean)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_,_,_,_-&gt;true;_,!null,_,_,_-&gt;true;_,_,!null,_,_-&gt;true;_,_,_,!null,_-&gt;true;_,_,_,_,false-&gt;true;_,_,_,_,true-&gt;true;_,_,_,null,_-&gt;true;_,_,null,_,_-&gt;true;null,_,_,_,_-&gt;true&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.runtime.VelocimacroManager.MacroEntry MacroEntry(java.lang.String, org.apache.velocity.runtime.parser.node.Node, java.lang.String[], java.lang.String, org.apache.velocity.runtime.RuntimeServices) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.VelocimacroManager.MacroEntry MacroEntry(java.lang.String, org.apache.velocity.runtime.parser.node.Node, java.lang.String[], java.lang.String, org.apache.velocity.runtime.RuntimeServices, org.apache.velocity.runtime.VelocimacroManager.1) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+</root>
diff --git a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/runtime/directive/annotations.xml b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/runtime/directive/annotations.xml
new file mode 100644
index 000000000000..f6cd67632cb8
--- /dev/null
+++ b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/runtime/directive/annotations.xml
@@ -0,0 +1,209 @@
+<root>
+ <item name="org.apache.velocity.runtime.directive.Block java.lang.String id(org.apache.velocity.context.InternalContextAdapter) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.directive.Block void init(org.apache.velocity.runtime.RuntimeServices, org.apache.velocity.context.InternalContextAdapter, org.apache.velocity.runtime.parser.node.Node) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.directive.Block void init(org.apache.velocity.runtime.RuntimeServices, org.apache.velocity.context.InternalContextAdapter, org.apache.velocity.runtime.parser.node.Node) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.directive.BlockMacro void init(org.apache.velocity.runtime.RuntimeServices, org.apache.velocity.context.InternalContextAdapter, org.apache.velocity.runtime.parser.node.Node) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.directive.BlockMacro void init(org.apache.velocity.runtime.RuntimeServices, org.apache.velocity.context.InternalContextAdapter, org.apache.velocity.runtime.parser.node.Node) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.directive.Break boolean render(org.apache.velocity.context.InternalContextAdapter, java.io.Writer, org.apache.velocity.runtime.parser.node.Node) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.directive.Break boolean render(org.apache.velocity.context.InternalContextAdapter, java.io.Writer, org.apache.velocity.runtime.parser.node.Node)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_,_-&gt;false;_,!null,_-&gt;false;_,_,!null-&gt;false;_,null,_-&gt;false;null,_,_-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.runtime.directive.Break java.lang.String getName()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.directive.Break void init(org.apache.velocity.runtime.RuntimeServices, org.apache.velocity.context.InternalContextAdapter, org.apache.velocity.runtime.parser.node.Node) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.directive.Define boolean render(org.apache.velocity.context.InternalContextAdapter, java.io.Writer, org.apache.velocity.runtime.parser.node.Node) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.directive.Define boolean render(org.apache.velocity.context.InternalContextAdapter, java.io.Writer, org.apache.velocity.runtime.parser.node.Node)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_,_-&gt;true;_,!null,_-&gt;true;_,_,!null-&gt;true;_,_,null-&gt;true;_,null,_-&gt;true&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.runtime.directive.Define java.lang.String getName()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.directive.Define void init(org.apache.velocity.runtime.RuntimeServices, org.apache.velocity.context.InternalContextAdapter, org.apache.velocity.runtime.parser.node.Node) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.directive.Define void init(org.apache.velocity.runtime.RuntimeServices, org.apache.velocity.context.InternalContextAdapter, org.apache.velocity.runtime.parser.node.Node) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.directive.Directive org.apache.velocity.runtime.directive.Scope makeScope(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.directive.Evaluate boolean render(org.apache.velocity.context.InternalContextAdapter, java.io.Writer, org.apache.velocity.runtime.parser.node.Node) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.directive.Evaluate boolean render(org.apache.velocity.context.InternalContextAdapter, java.io.Writer, org.apache.velocity.runtime.parser.node.Node) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.directive.Evaluate java.lang.String getName()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.directive.Evaluate void init(org.apache.velocity.runtime.RuntimeServices, org.apache.velocity.context.InternalContextAdapter, org.apache.velocity.runtime.parser.node.Node) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.directive.Foreach boolean render(org.apache.velocity.context.InternalContextAdapter, java.io.Writer, org.apache.velocity.runtime.parser.node.Node) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.directive.Foreach boolean render(org.apache.velocity.context.InternalContextAdapter, java.io.Writer, org.apache.velocity.runtime.parser.node.Node)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_,_-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.runtime.directive.Foreach java.lang.String getName()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.directive.Foreach void clean(org.apache.velocity.context.InternalContextAdapter, java.lang.Object, java.lang.Object, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.directive.Foreach void init(org.apache.velocity.runtime.RuntimeServices, org.apache.velocity.context.InternalContextAdapter, org.apache.velocity.runtime.parser.node.Node) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.directive.Foreach void put(org.apache.velocity.context.InternalContextAdapter, java.lang.String, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.directive.Include boolean render(org.apache.velocity.context.InternalContextAdapter, java.io.Writer, org.apache.velocity.runtime.parser.node.Node) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.directive.Include boolean render(org.apache.velocity.context.InternalContextAdapter, java.io.Writer, org.apache.velocity.runtime.parser.node.Node)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_,_-&gt;true;_,!null,_-&gt;true;_,_,!null-&gt;true;_,null,_-&gt;true;null,_,_-&gt;true&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.runtime.directive.Include boolean renderOutput(org.apache.velocity.runtime.parser.node.Node, org.apache.velocity.context.InternalContextAdapter, java.io.Writer)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,null,_-&gt;false;null,_,_-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.runtime.directive.Include java.lang.String getName()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.directive.InputBase java.lang.String getInputEncoding(org.apache.velocity.context.InternalContextAdapter) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.directive.Literal boolean render(org.apache.velocity.context.InternalContextAdapter, java.io.Writer, org.apache.velocity.runtime.parser.node.Node) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.directive.Literal boolean render(org.apache.velocity.context.InternalContextAdapter, java.io.Writer, org.apache.velocity.runtime.parser.node.Node)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_,_-&gt;true;_,!null,_-&gt;true;_,_,!null-&gt;true;_,_,null-&gt;true;null,_,_-&gt;true&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.runtime.directive.Literal java.lang.String getName()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.directive.Literal void init(org.apache.velocity.runtime.RuntimeServices, org.apache.velocity.context.InternalContextAdapter, org.apache.velocity.runtime.parser.node.Node) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.directive.Macro boolean render(org.apache.velocity.context.InternalContextAdapter, java.io.Writer, org.apache.velocity.runtime.parser.node.Node)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_,_-&gt;true;_,!null,_-&gt;true;_,_,!null-&gt;true;_,_,null-&gt;true;_,null,_-&gt;true;null,_,_-&gt;true&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.runtime.directive.Macro java.lang.String getName()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.directive.Macro java.lang.StringBuffer macroToString(java.lang.StringBuffer, java.lang.String[]) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.directive.Macro java.lang.StringBuffer macroToString(java.lang.StringBuffer, java.lang.String[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.runtime.directive.Macro java.lang.String[] getArgArray(org.apache.velocity.runtime.parser.node.Node, org.apache.velocity.runtime.RuntimeServices) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.directive.Macro void checkArgs(org.apache.velocity.runtime.RuntimeServices, org.apache.velocity.runtime.parser.Token, org.apache.velocity.runtime.parser.node.Node, java.lang.String) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.directive.Macro void init(org.apache.velocity.runtime.RuntimeServices, org.apache.velocity.context.InternalContextAdapter, org.apache.velocity.runtime.parser.node.Node) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.directive.Macro void init(org.apache.velocity.runtime.RuntimeServices, org.apache.velocity.context.InternalContextAdapter, org.apache.velocity.runtime.parser.node.Node) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.directive.MacroParseException java.lang.String getMessage()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.directive.MacroParseException void appendTemplateInfo(java.lang.StringBuffer) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.directive.Parse boolean render(org.apache.velocity.context.InternalContextAdapter, java.io.Writer, org.apache.velocity.runtime.parser.node.Node) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.directive.Parse boolean render(org.apache.velocity.context.InternalContextAdapter, java.io.Writer, org.apache.velocity.runtime.parser.node.Node) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.directive.Parse java.lang.String getName()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.directive.Parse java.lang.String getScopeName()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.directive.RuntimeMacro RuntimeMacro(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.directive.RuntimeMacro boolean render(org.apache.velocity.context.InternalContextAdapter, java.io.Writer, org.apache.velocity.runtime.parser.node.Node, org.apache.velocity.runtime.Renderable) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.directive.RuntimeMacro java.lang.String getScopeName()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.directive.RuntimeMacro void init(org.apache.velocity.runtime.RuntimeServices, org.apache.velocity.context.InternalContextAdapter, org.apache.velocity.runtime.parser.node.Node) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.directive.Scope.Info java.lang.String toString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.directive.Stop boolean render(org.apache.velocity.context.InternalContextAdapter, java.io.Writer, org.apache.velocity.runtime.parser.node.Node) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.directive.Stop java.lang.String getName()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.directive.Stop void init(org.apache.velocity.runtime.RuntimeServices, org.apache.velocity.context.InternalContextAdapter, org.apache.velocity.runtime.parser.node.Node) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.directive.StopCommand java.lang.String getMessage()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.directive.VelocimacroProxy boolean render(org.apache.velocity.context.InternalContextAdapter, java.io.Writer, org.apache.velocity.runtime.parser.node.Node, org.apache.velocity.runtime.Renderable) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.directive.VelocimacroProxy boolean render(org.apache.velocity.context.InternalContextAdapter, java.io.Writer, org.apache.velocity.runtime.parser.node.Node, org.apache.velocity.runtime.Renderable)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_,_,_-&gt;true;_,!null,_,_-&gt;true;_,_,!null,_-&gt;true;_,_,_,!null-&gt;true;_,_,_,null-&gt;true;_,null,_,_-&gt;true;null,_,_,_-&gt;true&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.runtime.directive.VelocimacroProxy java.lang.String buildErrorMsg(org.apache.velocity.runtime.parser.node.Node, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.directive.VelocimacroProxy void checkArgs(org.apache.velocity.context.InternalContextAdapter, org.apache.velocity.runtime.parser.node.Node, boolean) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.directive.VelocimacroProxy void init(org.apache.velocity.runtime.RuntimeServices) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.directive.VelocimacroProxy void setArgArray(java.lang.String[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+</root>
diff --git a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/runtime/log/annotations.xml b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/runtime/log/annotations.xml
new file mode 100644
index 000000000000..b49c0f73e389
--- /dev/null
+++ b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/runtime/log/annotations.xml
@@ -0,0 +1,76 @@
+<root>
+ <item name="org.apache.velocity.runtime.log.AvalonLogChute void init(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.log.AvalonLogChute void initTarget(java.lang.String, org.apache.velocity.runtime.RuntimeServices) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.log.CommonsLogLogChute void init(org.apache.velocity.runtime.RuntimeServices) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.log.JdkLogChute void init(org.apache.velocity.runtime.RuntimeServices) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.log.Log java.lang.String formatFileString(java.lang.String, int, int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.log.Log java.lang.String formatFileString(org.apache.velocity.runtime.directive.Directive) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.log.Log java.lang.String formatFileString(org.apache.velocity.runtime.directive.Directive)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.log.Log java.lang.String formatFileString(org.apache.velocity.runtime.parser.node.Node) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.log.Log java.lang.String formatFileString(org.apache.velocity.runtime.parser.node.Node)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.log.Log java.lang.String formatFileString(org.apache.velocity.util.introspection.Info) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.log.Log java.lang.String formatFileString(org.apache.velocity.util.introspection.Info)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.log.Log void setLogChute(org.apache.velocity.runtime.log.LogChute) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.log.LogDisplayWrapper LogDisplayWrapper(org.apache.velocity.runtime.log.Log, java.lang.String, boolean) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.log.LogManager boolean isProbablyProvidedLogChute(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.runtime.log.LogManager org.apache.velocity.runtime.log.LogChute createLogChute(org.apache.velocity.runtime.RuntimeServices) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.log.LogManager void updateLog(org.apache.velocity.runtime.log.Log, org.apache.velocity.runtime.RuntimeServices) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.log.LogManager void updateLog(org.apache.velocity.runtime.log.Log, org.apache.velocity.runtime.RuntimeServices) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.log.RuntimeLoggerLog RuntimeLoggerLog(org.apache.velocity.runtime.RuntimeLogger) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.log.ServletLogChute int toLevel(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.log.ServletLogChute void init(org.apache.velocity.runtime.RuntimeServices) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.log.SystemLogChute int toLevel(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.log.SystemLogChute java.lang.String getPrefix(int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.log.SystemLogChute void init(org.apache.velocity.runtime.RuntimeServices) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.log.SystemLogChute void write(java.io.PrintStream, java.lang.String, java.lang.String, java.lang.Throwable) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+</root>
diff --git a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/runtime/parser/annotations.xml b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/runtime/parser/annotations.xml
new file mode 100644
index 000000000000..7d0bc8cdefa1
--- /dev/null
+++ b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/runtime/parser/annotations.xml
@@ -0,0 +1,73 @@
+<root>
+ <item name="org.apache.velocity.runtime.parser.JJTParserState void closeNodeScope(org.apache.velocity.runtime.parser.node.Node, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.JJTParserState void openNodeScope(org.apache.velocity.runtime.parser.node.Node) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.ParseException java.lang.String add_escapes(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.ParseException java.lang.String add_escapes(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.Parser Parser(org.apache.velocity.runtime.RuntimeServices) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.Parser java.lang.String escapedDirective(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.Parser java.lang.String escapedDirective(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.Parser org.apache.velocity.runtime.parser.ParseException generateParseException()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.ParserTokenManager org.apache.velocity.runtime.parser.Token jjFillToken()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.TemplateParseException java.lang.String getMessage()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.TemplateParseException void appendTemplateInfo(java.lang.StringBuffer) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.Token org.apache.velocity.runtime.parser.Token newToken(int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.TokenMgrError TokenMgrError(boolean, int, int, int, java.lang.String, char, int) 4">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.TokenMgrError java.lang.String LexicalError(boolean, int, int, int, java.lang.String, char) 4">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.TokenMgrError java.lang.String LexicalError(boolean, int, int, int, java.lang.String, char)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.TokenMgrError java.lang.String addEscapes(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.TokenMgrError java.lang.String addEscapes(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.VelocityCharStream VelocityCharStream(java.io.InputStream, int, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.VelocityCharStream VelocityCharStream(java.io.InputStream, int, int, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.VelocityCharStream char[] GetSuffix(int)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.VelocityCharStream java.lang.String GetImage()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.VelocityCharStream void ReInit(java.io.InputStream, int, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.VelocityCharStream void ReInit(java.io.InputStream, int, int, int) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+</root>
diff --git a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/runtime/parser/node/annotations.xml b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/runtime/parser/node/annotations.xml
new file mode 100644
index 000000000000..5f78c94ea501
--- /dev/null
+++ b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/runtime/parser/node/annotations.xml
@@ -0,0 +1,475 @@
+<root>
+ <item name="org.apache.velocity.runtime.parser.node.ASTAddNode java.lang.Number perform(java.lang.Number, java.lang.Number, org.apache.velocity.context.InternalContextAdapter) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTAddNode java.lang.Number perform(java.lang.Number, java.lang.Number, org.apache.velocity.context.InternalContextAdapter) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTAndNode java.lang.Object jjtAccept(org.apache.velocity.runtime.parser.node.ParserVisitor, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTAssignment java.lang.Object jjtAccept(org.apache.velocity.runtime.parser.node.ParserVisitor, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTBlock boolean render(org.apache.velocity.context.InternalContextAdapter, java.io.Writer)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_-&gt;true;_,!null-&gt;true;_,null-&gt;true;null,_-&gt;true&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTBlock java.lang.Object jjtAccept(org.apache.velocity.runtime.parser.node.ParserVisitor, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTComment boolean render(org.apache.velocity.context.InternalContextAdapter, java.io.Writer) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTComment boolean render(org.apache.velocity.context.InternalContextAdapter, java.io.Writer)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_-&gt;true;_,!null-&gt;true;null,_-&gt;true&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTComment java.lang.Object init(org.apache.velocity.context.InternalContextAdapter, java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,!null-&gt;!null;_,null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTComment java.lang.Object jjtAccept(org.apache.velocity.runtime.parser.node.ParserVisitor, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTDirective boolean render(org.apache.velocity.context.InternalContextAdapter, java.io.Writer)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_-&gt;true;_,!null-&gt;true;_,null-&gt;true;null,_-&gt;true&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTDirective java.lang.Object init(org.apache.velocity.context.InternalContextAdapter, java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,!null-&gt;!null;_,null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTDirective java.lang.Object jjtAccept(org.apache.velocity.runtime.parser.node.ParserVisitor, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTDivNode java.lang.Number perform(java.lang.Number, java.lang.Number, org.apache.velocity.context.InternalContextAdapter) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTEQNode java.lang.Object jjtAccept(org.apache.velocity.runtime.parser.node.ParserVisitor, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTElseIfStatement java.lang.Object jjtAccept(org.apache.velocity.runtime.parser.node.ParserVisitor, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTElseStatement boolean evaluate(org.apache.velocity.context.InternalContextAdapter)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;true;null-&gt;true&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTElseStatement java.lang.Object jjtAccept(org.apache.velocity.runtime.parser.node.ParserVisitor, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTEscape boolean render(org.apache.velocity.context.InternalContextAdapter, java.io.Writer) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTEscape boolean render(org.apache.velocity.context.InternalContextAdapter, java.io.Writer)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_-&gt;true;_,!null-&gt;true;null,_-&gt;true&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTEscape java.lang.Object init(org.apache.velocity.context.InternalContextAdapter, java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,!null-&gt;!null;_,null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTEscape java.lang.Object jjtAccept(org.apache.velocity.runtime.parser.node.ParserVisitor, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTEscapedDirective boolean render(org.apache.velocity.context.InternalContextAdapter, java.io.Writer) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTEscapedDirective boolean render(org.apache.velocity.context.InternalContextAdapter, java.io.Writer)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_-&gt;true;_,!null-&gt;true;null,_-&gt;true&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTEscapedDirective java.lang.Object jjtAccept(org.apache.velocity.runtime.parser.node.ParserVisitor, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTExpression java.lang.Object jjtAccept(org.apache.velocity.runtime.parser.node.ParserVisitor, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTFalse boolean evaluate(org.apache.velocity.context.InternalContextAdapter)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;false;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTFalse java.lang.Object jjtAccept(org.apache.velocity.runtime.parser.node.ParserVisitor, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTFloatingPointLiteral java.lang.Object init(org.apache.velocity.context.InternalContextAdapter, java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,!null-&gt;!null;_,null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTFloatingPointLiteral java.lang.Object jjtAccept(org.apache.velocity.runtime.parser.node.ParserVisitor, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTGENode java.lang.Object jjtAccept(org.apache.velocity.runtime.parser.node.ParserVisitor, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTGTNode java.lang.Object jjtAccept(org.apache.velocity.runtime.parser.node.ParserVisitor, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTIdentifier java.lang.Object execute(java.lang.Object, org.apache.velocity.context.InternalContextAdapter) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTIdentifier java.lang.Object init(org.apache.velocity.context.InternalContextAdapter, java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,!null-&gt;!null;_,null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTIdentifier java.lang.Object jjtAccept(org.apache.velocity.runtime.parser.node.ParserVisitor, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTIfStatement boolean render(org.apache.velocity.context.InternalContextAdapter, java.io.Writer)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_-&gt;true;_,!null-&gt;true;_,null-&gt;true;null,_-&gt;true&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTIfStatement java.lang.Object jjtAccept(org.apache.velocity.runtime.parser.node.ParserVisitor, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTIncludeStatement java.lang.Object jjtAccept(org.apache.velocity.runtime.parser.node.ParserVisitor, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTIndex java.lang.Object adjMinusIndexArg(java.lang.Object, java.lang.Object, org.apache.velocity.context.InternalContextAdapter, org.apache.velocity.runtime.parser.node.SimpleNode)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_,_,_-&gt;!null;null,_,_,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTIndex java.lang.Object execute(java.lang.Object, org.apache.velocity.context.InternalContextAdapter) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTIndex java.lang.Object init(org.apache.velocity.context.InternalContextAdapter, java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,!null-&gt;!null;_,null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTIntegerLiteral java.lang.Object init(org.apache.velocity.context.InternalContextAdapter, java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,!null-&gt;!null;_,null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTIntegerLiteral java.lang.Object jjtAccept(org.apache.velocity.runtime.parser.node.ParserVisitor, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTIntegerRange java.lang.Object jjtAccept(org.apache.velocity.runtime.parser.node.ParserVisitor, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTLENode java.lang.Object jjtAccept(org.apache.velocity.runtime.parser.node.ParserVisitor, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTLTNode java.lang.Object jjtAccept(org.apache.velocity.runtime.parser.node.ParserVisitor, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTMap java.lang.Object jjtAccept(org.apache.velocity.runtime.parser.node.ParserVisitor, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTMathNode java.lang.Object handleSpecial(java.lang.Object, java.lang.Object, org.apache.velocity.context.InternalContextAdapter)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_,_-&gt;null;_,!null,_-&gt;null;_,_,!null-&gt;null;_,_,null-&gt;null;_,null,_-&gt;null;null,_,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTMathNode java.lang.Object init(org.apache.velocity.context.InternalContextAdapter, java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,!null-&gt;!null;_,null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTMathNode java.lang.Object jjtAccept(org.apache.velocity.runtime.parser.node.ParserVisitor, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTMethod java.lang.Object execute(java.lang.Object, org.apache.velocity.context.InternalContextAdapter) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTMethod java.lang.Object handleInvocationException(java.lang.Object, org.apache.velocity.context.InternalContextAdapter, java.lang.Throwable) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTMethod java.lang.Object handleInvocationException(java.lang.Object, org.apache.velocity.context.InternalContextAdapter, java.lang.Throwable) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTMethod java.lang.Object handleInvocationException(java.lang.Object, org.apache.velocity.context.InternalContextAdapter, java.lang.Throwable) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTMethod java.lang.Object init(org.apache.velocity.context.InternalContextAdapter, java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,!null-&gt;!null;_,null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTMethod java.lang.Object jjtAccept(org.apache.velocity.runtime.parser.node.ParserVisitor, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTMethod.MethodCacheKey boolean equals(java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTModNode java.lang.Number perform(java.lang.Number, java.lang.Number, org.apache.velocity.context.InternalContextAdapter) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTMulNode java.lang.Number perform(java.lang.Number, java.lang.Number, org.apache.velocity.context.InternalContextAdapter) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTMulNode java.lang.Number perform(java.lang.Number, java.lang.Number, org.apache.velocity.context.InternalContextAdapter) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTNENode java.lang.Object jjtAccept(org.apache.velocity.runtime.parser.node.ParserVisitor, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTNotNode java.lang.Object jjtAccept(org.apache.velocity.runtime.parser.node.ParserVisitor, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTObjectArray java.lang.Object jjtAccept(org.apache.velocity.runtime.parser.node.ParserVisitor, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTOrNode java.lang.Object jjtAccept(org.apache.velocity.runtime.parser.node.ParserVisitor, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTParameters java.lang.Object jjtAccept(org.apache.velocity.runtime.parser.node.ParserVisitor, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTReference boolean render(org.apache.velocity.context.InternalContextAdapter, java.io.Writer)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_-&gt;true;_,!null-&gt;true;_,null-&gt;true;null,_-&gt;true&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTReference java.lang.Object getVariableValue(org.apache.velocity.context.Context, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTReference java.lang.Object init(org.apache.velocity.context.InternalContextAdapter, java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,!null-&gt;!null;_,null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTReference java.lang.Object jjtAccept(org.apache.velocity.runtime.parser.node.ParserVisitor, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTReference java.lang.String getDollarBang()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTReference java.lang.String getNullString(org.apache.velocity.context.InternalContextAdapter) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTReference java.lang.String printClass(java.lang.Class)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTSetDirective java.lang.Object init(org.apache.velocity.context.InternalContextAdapter, java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,!null-&gt;!null;_,null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTSetDirective java.lang.Object jjtAccept(org.apache.velocity.runtime.parser.node.ParserVisitor, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTStringLiteral java.lang.Object init(org.apache.velocity.context.InternalContextAdapter, java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,!null-&gt;!null;_,null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTStringLiteral java.lang.Object jjtAccept(org.apache.velocity.runtime.parser.node.ParserVisitor, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTStringLiteral java.lang.String replaceQuotes(java.lang.String, char) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTStringLiteral java.lang.String unescape(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTStringLiteral void adjTokenLineNums(org.apache.velocity.runtime.parser.node.Node) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTSubtractNode java.lang.Number perform(java.lang.Number, java.lang.Number, org.apache.velocity.context.InternalContextAdapter) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTSubtractNode java.lang.Number perform(java.lang.Number, java.lang.Number, org.apache.velocity.context.InternalContextAdapter) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTText boolean render(org.apache.velocity.context.InternalContextAdapter, java.io.Writer) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTText boolean render(org.apache.velocity.context.InternalContextAdapter, java.io.Writer)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_-&gt;true;_,!null-&gt;true;null,_-&gt;true&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTText java.lang.Object init(org.apache.velocity.context.InternalContextAdapter, java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,!null-&gt;!null;_,null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTText java.lang.Object jjtAccept(org.apache.velocity.runtime.parser.node.ParserVisitor, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTTextblock boolean render(org.apache.velocity.context.InternalContextAdapter, java.io.Writer) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTTextblock boolean render(org.apache.velocity.context.InternalContextAdapter, java.io.Writer)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_-&gt;true;_,!null-&gt;true;null,_-&gt;true&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTTextblock java.lang.Object init(org.apache.velocity.context.InternalContextAdapter, java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,!null-&gt;!null;_,null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTTextblock java.lang.Object jjtAccept(org.apache.velocity.runtime.parser.node.ParserVisitor, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTTrue boolean evaluate(org.apache.velocity.context.InternalContextAdapter)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;true;null-&gt;true&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTTrue java.lang.Object jjtAccept(org.apache.velocity.runtime.parser.node.ParserVisitor, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTVariable java.lang.Object jjtAccept(org.apache.velocity.runtime.parser.node.ParserVisitor, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTWord java.lang.Object jjtAccept(org.apache.velocity.runtime.parser.node.ParserVisitor, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.ASTprocess java.lang.Object jjtAccept(org.apache.velocity.runtime.parser.node.ParserVisitor, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.BooleanPropertyExecutor BooleanPropertyExecutor(org.apache.velocity.runtime.RuntimeLogger, org.apache.velocity.util.introspection.Introspector, java.lang.Class, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.GetExecutor GetExecutor(org.apache.velocity.runtime.RuntimeLogger, org.apache.velocity.util.introspection.Introspector, java.lang.Class, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.MapGetExecutor java.lang.Object execute(java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.MapSetExecutor java.lang.Object execute(java.lang.Object, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.MathUtils boolean isInteger(java.lang.Number) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.MathUtils boolean isZero(java.lang.Number) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.MathUtils int compare(java.lang.Number, java.lang.Number) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.MathUtils int compare(java.lang.Number, java.lang.Number) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.MathUtils int findCalculationBase(java.lang.Number, java.lang.Number) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.MathUtils int findCalculationBase(java.lang.Number, java.lang.Number) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.MathUtils java.lang.Number add(java.lang.Number, java.lang.Number) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.MathUtils java.lang.Number add(java.lang.Number, java.lang.Number) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.MathUtils java.lang.Number divide(java.lang.Number, java.lang.Number) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.MathUtils java.lang.Number divide(java.lang.Number, java.lang.Number) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.MathUtils java.lang.Number modulo(java.lang.Number, java.lang.Number) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.MathUtils java.lang.Number modulo(java.lang.Number, java.lang.Number) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.MathUtils java.lang.Number multiply(java.lang.Number, java.lang.Number) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.MathUtils java.lang.Number multiply(java.lang.Number, java.lang.Number) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.MathUtils java.lang.Number subtract(java.lang.Number, java.lang.Number) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.MathUtils java.lang.Number subtract(java.lang.Number, java.lang.Number) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.MathUtils java.lang.Number wrapPrimitive(long, java.lang.Number, java.lang.Number) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.MathUtils java.lang.Number wrapPrimitive(long, java.lang.Number, java.lang.Number) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.MathUtils java.math.BigDecimal toBigDecimal(java.lang.Number) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.MathUtils java.math.BigDecimal toBigDecimal(java.lang.Number)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.MathUtils java.math.BigInteger toBigInteger(java.lang.Number) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.NodeUtils java.lang.String interpolate(java.lang.String, org.apache.velocity.context.Context) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.NodeUtils java.lang.String specialText(org.apache.velocity.runtime.parser.Token) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.NodeUtils java.lang.String tokenLiteral(org.apache.velocity.runtime.parser.Token) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.NodeUtils org.apache.commons.lang.text.StrBuilder getSpecialText(org.apache.velocity.runtime.parser.Token) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.PropertyExecutor PropertyExecutor(org.apache.velocity.runtime.RuntimeLogger, org.apache.velocity.util.introspection.Introspector, java.lang.Class, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.SimpleNode boolean evaluate(org.apache.velocity.context.InternalContextAdapter)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;false;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.SimpleNode boolean render(org.apache.velocity.context.InternalContextAdapter, java.io.Writer)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_-&gt;true;_,!null-&gt;true;_,null-&gt;true;null,_-&gt;true&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.SimpleNode java.lang.Object childrenAccept(org.apache.velocity.runtime.parser.node.ParserVisitor, java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,!null-&gt;!null;_,null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.SimpleNode java.lang.Object execute(java.lang.Object, org.apache.velocity.context.InternalContextAdapter)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_-&gt;null;_,!null-&gt;null;_,null-&gt;null;null,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.SimpleNode java.lang.Object init(org.apache.velocity.context.InternalContextAdapter, java.lang.Object)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,!null-&gt;!null;_,null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.SimpleNode java.lang.Object jjtAccept(org.apache.velocity.runtime.parser.node.ParserVisitor, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.SimpleNode java.lang.Object value(org.apache.velocity.context.InternalContextAdapter)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;null;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.SimpleNode java.lang.String getLocation(org.apache.velocity.context.InternalContextAdapter)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.parser.node.SimpleNode java.lang.String toString(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+</root>
diff --git a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/runtime/resource/annotations.xml b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/runtime/resource/annotations.xml
new file mode 100644
index 000000000000..c85589b43d33
--- /dev/null
+++ b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/runtime/resource/annotations.xml
@@ -0,0 +1,5 @@
+<root>
+ <item name="org.apache.velocity.runtime.resource.ResourceManagerImpl org.apache.velocity.runtime.resource.Resource refreshResource(org.apache.velocity.runtime.resource.Resource, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+</root>
diff --git a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/runtime/resource/loader/annotations.xml b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/runtime/resource/loader/annotations.xml
new file mode 100644
index 000000000000..5fc5b3a6b8f0
--- /dev/null
+++ b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/runtime/resource/loader/annotations.xml
@@ -0,0 +1,102 @@
+<root>
+ <item name="org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader boolean isSourceModified(org.apache.velocity.runtime.resource.Resource)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;false;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader java.io.InputStream getResourceStream(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.resource.loader.DataSourceResourceLoader boolean isSourceModified(org.apache.velocity.runtime.resource.Resource) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.resource.loader.DataSourceResourceLoader java.io.InputStream getResourceStream(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.resource.loader.DataSourceResourceLoader java.sql.PreparedStatement getStatement(java.sql.Connection, java.lang.String, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.resource.loader.DataSourceResourceLoader long getLastModified(org.apache.velocity.runtime.resource.Resource) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.resource.loader.DataSourceResourceLoader long readLastModified(org.apache.velocity.runtime.resource.Resource, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.resource.loader.DataSourceResourceLoader void init(org.apache.commons.collections.ExtendedProperties) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.resource.loader.FileResourceLoader boolean isSourceModified(org.apache.velocity.runtime.resource.Resource) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.resource.loader.FileResourceLoader boolean resourceExists(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.runtime.resource.loader.FileResourceLoader java.io.File getFile(java.lang.String, java.lang.String) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.resource.loader.FileResourceLoader java.io.File getFile(java.lang.String, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.resource.loader.FileResourceLoader java.io.InputStream getResourceStream(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.resource.loader.FileResourceLoader long getLastModified(org.apache.velocity.runtime.resource.Resource) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.resource.loader.FileResourceLoader void init(org.apache.commons.collections.ExtendedProperties) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.resource.loader.JarHolder JarHolder(org.apache.velocity.runtime.RuntimeServices, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.resource.loader.JarResourceLoader boolean isSourceModified(org.apache.velocity.runtime.resource.Resource)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;true;null-&gt;true&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.runtime.resource.loader.JarResourceLoader java.io.InputStream getResourceStream(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.resource.loader.JarResourceLoader void init(org.apache.commons.collections.ExtendedProperties) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.resource.loader.JarResourceLoader void loadJar(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.resource.loader.ResourceLoader void commonInit(org.apache.velocity.runtime.RuntimeServices, org.apache.commons.collections.ExtendedProperties) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.resource.loader.ResourceLoaderFactory org.apache.velocity.runtime.resource.loader.ResourceLoader getLoader(org.apache.velocity.runtime.RuntimeServices, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.resource.loader.StringResourceLoader boolean isSourceModified(org.apache.velocity.runtime.resource.Resource) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.resource.loader.StringResourceLoader boolean resourceExists(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;false&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.runtime.resource.loader.StringResourceLoader java.io.InputStream getResourceStream(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.resource.loader.StringResourceLoader long getLastModified(org.apache.velocity.runtime.resource.Resource) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.resource.loader.StringResourceLoader void init(org.apache.commons.collections.ExtendedProperties) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.resource.loader.URLResourceLoader boolean isSourceModified(org.apache.velocity.runtime.resource.Resource)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;true&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.runtime.resource.loader.URLResourceLoader long getLastModified(org.apache.velocity.runtime.resource.Resource) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.resource.loader.URLResourceLoader void init(org.apache.commons.collections.ExtendedProperties) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+</root>
diff --git a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/runtime/visitor/annotations.xml b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/runtime/visitor/annotations.xml
new file mode 100644
index 000000000000..0ec8ac7715d5
--- /dev/null
+++ b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/runtime/visitor/annotations.xml
@@ -0,0 +1,245 @@
+<root>
+ <item name="org.apache.velocity.runtime.visitor.BaseVisitor java.lang.Object visit(org.apache.velocity.runtime.parser.node.ASTAddNode, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.BaseVisitor java.lang.Object visit(org.apache.velocity.runtime.parser.node.ASTAndNode, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.BaseVisitor java.lang.Object visit(org.apache.velocity.runtime.parser.node.ASTAssignment, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.BaseVisitor java.lang.Object visit(org.apache.velocity.runtime.parser.node.ASTBlock, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.BaseVisitor java.lang.Object visit(org.apache.velocity.runtime.parser.node.ASTComment, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.BaseVisitor java.lang.Object visit(org.apache.velocity.runtime.parser.node.ASTDirective, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.BaseVisitor java.lang.Object visit(org.apache.velocity.runtime.parser.node.ASTDivNode, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.BaseVisitor java.lang.Object visit(org.apache.velocity.runtime.parser.node.ASTEQNode, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.BaseVisitor java.lang.Object visit(org.apache.velocity.runtime.parser.node.ASTElseIfStatement, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.BaseVisitor java.lang.Object visit(org.apache.velocity.runtime.parser.node.ASTElseStatement, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.BaseVisitor java.lang.Object visit(org.apache.velocity.runtime.parser.node.ASTEscape, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.BaseVisitor java.lang.Object visit(org.apache.velocity.runtime.parser.node.ASTEscapedDirective, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.BaseVisitor java.lang.Object visit(org.apache.velocity.runtime.parser.node.ASTExpression, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.BaseVisitor java.lang.Object visit(org.apache.velocity.runtime.parser.node.ASTFalse, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.BaseVisitor java.lang.Object visit(org.apache.velocity.runtime.parser.node.ASTFloatingPointLiteral, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.BaseVisitor java.lang.Object visit(org.apache.velocity.runtime.parser.node.ASTGENode, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.BaseVisitor java.lang.Object visit(org.apache.velocity.runtime.parser.node.ASTGTNode, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.BaseVisitor java.lang.Object visit(org.apache.velocity.runtime.parser.node.ASTIdentifier, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.BaseVisitor java.lang.Object visit(org.apache.velocity.runtime.parser.node.ASTIfStatement, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.BaseVisitor java.lang.Object visit(org.apache.velocity.runtime.parser.node.ASTIntegerLiteral, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.BaseVisitor java.lang.Object visit(org.apache.velocity.runtime.parser.node.ASTIntegerRange, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.BaseVisitor java.lang.Object visit(org.apache.velocity.runtime.parser.node.ASTLENode, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.BaseVisitor java.lang.Object visit(org.apache.velocity.runtime.parser.node.ASTLTNode, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.BaseVisitor java.lang.Object visit(org.apache.velocity.runtime.parser.node.ASTMap, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.BaseVisitor java.lang.Object visit(org.apache.velocity.runtime.parser.node.ASTMethod, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.BaseVisitor java.lang.Object visit(org.apache.velocity.runtime.parser.node.ASTModNode, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.BaseVisitor java.lang.Object visit(org.apache.velocity.runtime.parser.node.ASTMulNode, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.BaseVisitor java.lang.Object visit(org.apache.velocity.runtime.parser.node.ASTNENode, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.BaseVisitor java.lang.Object visit(org.apache.velocity.runtime.parser.node.ASTNotNode, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.BaseVisitor java.lang.Object visit(org.apache.velocity.runtime.parser.node.ASTObjectArray, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.BaseVisitor java.lang.Object visit(org.apache.velocity.runtime.parser.node.ASTOrNode, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.BaseVisitor java.lang.Object visit(org.apache.velocity.runtime.parser.node.ASTReference, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.BaseVisitor java.lang.Object visit(org.apache.velocity.runtime.parser.node.ASTSetDirective, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.BaseVisitor java.lang.Object visit(org.apache.velocity.runtime.parser.node.ASTStringLiteral, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.BaseVisitor java.lang.Object visit(org.apache.velocity.runtime.parser.node.ASTSubtractNode, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.BaseVisitor java.lang.Object visit(org.apache.velocity.runtime.parser.node.ASTText, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.BaseVisitor java.lang.Object visit(org.apache.velocity.runtime.parser.node.ASTTrue, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.BaseVisitor java.lang.Object visit(org.apache.velocity.runtime.parser.node.ASTWord, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.BaseVisitor java.lang.Object visit(org.apache.velocity.runtime.parser.node.ASTprocess, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.BaseVisitor java.lang.Object visit(org.apache.velocity.runtime.parser.node.SimpleNode, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.NodeViewMode java.lang.Object showNode(org.apache.velocity.runtime.parser.node.Node, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.NodeViewMode java.lang.Object visit(org.apache.velocity.runtime.parser.node.ASTAddNode, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.NodeViewMode java.lang.Object visit(org.apache.velocity.runtime.parser.node.ASTAndNode, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.NodeViewMode java.lang.Object visit(org.apache.velocity.runtime.parser.node.ASTAssignment, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.NodeViewMode java.lang.Object visit(org.apache.velocity.runtime.parser.node.ASTBlock, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.NodeViewMode java.lang.Object visit(org.apache.velocity.runtime.parser.node.ASTDirective, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.NodeViewMode java.lang.Object visit(org.apache.velocity.runtime.parser.node.ASTDivNode, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.NodeViewMode java.lang.Object visit(org.apache.velocity.runtime.parser.node.ASTEQNode, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.NodeViewMode java.lang.Object visit(org.apache.velocity.runtime.parser.node.ASTElseIfStatement, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.NodeViewMode java.lang.Object visit(org.apache.velocity.runtime.parser.node.ASTElseStatement, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.NodeViewMode java.lang.Object visit(org.apache.velocity.runtime.parser.node.ASTEscape, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.NodeViewMode java.lang.Object visit(org.apache.velocity.runtime.parser.node.ASTEscapedDirective, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.NodeViewMode java.lang.Object visit(org.apache.velocity.runtime.parser.node.ASTExpression, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.NodeViewMode java.lang.Object visit(org.apache.velocity.runtime.parser.node.ASTFalse, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.NodeViewMode java.lang.Object visit(org.apache.velocity.runtime.parser.node.ASTFloatingPointLiteral, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.NodeViewMode java.lang.Object visit(org.apache.velocity.runtime.parser.node.ASTGENode, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.NodeViewMode java.lang.Object visit(org.apache.velocity.runtime.parser.node.ASTGTNode, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.NodeViewMode java.lang.Object visit(org.apache.velocity.runtime.parser.node.ASTIdentifier, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.NodeViewMode java.lang.Object visit(org.apache.velocity.runtime.parser.node.ASTIfStatement, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.NodeViewMode java.lang.Object visit(org.apache.velocity.runtime.parser.node.ASTIntegerLiteral, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.NodeViewMode java.lang.Object visit(org.apache.velocity.runtime.parser.node.ASTIntegerRange, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.NodeViewMode java.lang.Object visit(org.apache.velocity.runtime.parser.node.ASTLENode, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.NodeViewMode java.lang.Object visit(org.apache.velocity.runtime.parser.node.ASTLTNode, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.NodeViewMode java.lang.Object visit(org.apache.velocity.runtime.parser.node.ASTMap, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.NodeViewMode java.lang.Object visit(org.apache.velocity.runtime.parser.node.ASTMethod, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.NodeViewMode java.lang.Object visit(org.apache.velocity.runtime.parser.node.ASTModNode, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.NodeViewMode java.lang.Object visit(org.apache.velocity.runtime.parser.node.ASTMulNode, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.NodeViewMode java.lang.Object visit(org.apache.velocity.runtime.parser.node.ASTNENode, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.NodeViewMode java.lang.Object visit(org.apache.velocity.runtime.parser.node.ASTNotNode, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.NodeViewMode java.lang.Object visit(org.apache.velocity.runtime.parser.node.ASTObjectArray, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.NodeViewMode java.lang.Object visit(org.apache.velocity.runtime.parser.node.ASTOrNode, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.NodeViewMode java.lang.Object visit(org.apache.velocity.runtime.parser.node.ASTReference, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.NodeViewMode java.lang.Object visit(org.apache.velocity.runtime.parser.node.ASTSetDirective, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.NodeViewMode java.lang.Object visit(org.apache.velocity.runtime.parser.node.ASTStringLiteral, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.NodeViewMode java.lang.Object visit(org.apache.velocity.runtime.parser.node.ASTSubtractNode, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.NodeViewMode java.lang.Object visit(org.apache.velocity.runtime.parser.node.ASTText, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.NodeViewMode java.lang.Object visit(org.apache.velocity.runtime.parser.node.ASTTrue, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.NodeViewMode java.lang.Object visit(org.apache.velocity.runtime.parser.node.ASTWord, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.NodeViewMode java.lang.Object visit(org.apache.velocity.runtime.parser.node.ASTprocess, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.NodeViewMode java.lang.Object visit(org.apache.velocity.runtime.parser.node.SimpleNode, java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.runtime.visitor.NodeViewMode java.lang.String indentString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+</root>
diff --git a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/servlet/annotations.xml b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/servlet/annotations.xml
new file mode 100644
index 000000000000..a1d5f80fe4ca
--- /dev/null
+++ b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/servlet/annotations.xml
@@ -0,0 +1,23 @@
+<root>
+ <item name="org.apache.velocity.servlet.VelocityServlet java.util.Properties loadConfiguration(javax.servlet.ServletConfig) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.servlet.VelocityServlet java.util.Properties loadConfiguration(javax.servlet.ServletConfig)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.servlet.VelocityServlet org.apache.velocity.context.Context createContext(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.servlet.VelocityServlet void error(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.lang.Exception) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.servlet.VelocityServlet void error(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.lang.Exception) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.servlet.VelocityServlet void mergeTemplate(org.apache.velocity.Template, org.apache.velocity.context.Context, javax.servlet.http.HttpServletResponse) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.servlet.VelocityServlet void setContentType(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+</root>
diff --git a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/texen/annotations.xml b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/texen/annotations.xml
new file mode 100644
index 000000000000..bea0f093ad72
--- /dev/null
+++ b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/texen/annotations.xml
@@ -0,0 +1,14 @@
+<root>
+ <item name="org.apache.velocity.texen.Generator Generator(java.util.Properties) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.texen.Generator java.io.Writer getWriter(java.lang.String, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.texen.Generator void fillContextDefaults(org.apache.velocity.context.Context) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.texen.Generator void fillContextHash(org.apache.velocity.context.Context, java.util.Hashtable) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+</root>
diff --git a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/texen/ant/annotations.xml b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/texen/ant/annotations.xml
new file mode 100644
index 000000000000..5b553dea86e3
--- /dev/null
+++ b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/texen/ant/annotations.xml
@@ -0,0 +1,11 @@
+<root>
+ <item name="org.apache.velocity.texen.ant.TexenTask org.apache.velocity.context.Context initControlContext()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.texen.ant.TexenTask void populateInitialContext(org.apache.velocity.context.Context) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.texen.ant.TexenTask void setOutputDirectory(java.io.File) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+</root>
diff --git a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/texen/util/annotations.xml b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/texen/util/annotations.xml
new file mode 100644
index 000000000000..353ade77c7bc
--- /dev/null
+++ b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/texen/util/annotations.xml
@@ -0,0 +1,23 @@
+<root>
+ <item name="org.apache.velocity.texen.util.FileUtil java.io.File file(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.texen.util.FileUtil java.io.File file(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.texen.util.FileUtil java.io.File file(java.lang.String, java.lang.String) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.texen.util.FileUtil java.io.File file(java.lang.String, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.texen.util.PropertiesUtil java.util.Properties loadFromClassPath(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.texen.util.PropertiesUtil java.util.Properties loadFromClassPath(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.texen.util.PropertiesUtil java.util.Properties loadFromTemplatePath(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+</root>
diff --git a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/util/annotations.xml b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/util/annotations.xml
new file mode 100644
index 000000000000..e60004f3fd63
--- /dev/null
+++ b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/util/annotations.xml
@@ -0,0 +1,109 @@
+<root>
+ <item name="org.apache.velocity.util.ArrayIterator ArrayIterator(java.lang.Object) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.util.ClassUtils java.io.InputStream getResourceAsStream(java.lang.Class, java.lang.String) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.util.ClassUtils org.apache.velocity.util.introspection.VelMethod getMethod(java.lang.String, java.lang.Object[], java.lang.Class[], java.lang.Object, org.apache.velocity.context.InternalContextAdapter, org.apache.velocity.runtime.parser.node.SimpleNode, boolean) 4">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.util.ExceptionUtils java.lang.Throwable createWithCause(java.lang.Class, java.lang.String, java.lang.Throwable)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.util.StringUtils boolean allEmpty(java.util.List) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.util.StringUtils java.lang.String capitalizeFirstLetter(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.util.StringUtils java.lang.String capitalizeFirstLetter(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.util.StringUtils java.lang.String chop(java.lang.String, int)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_-&gt;!null;null,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.util.StringUtils java.lang.String chop(java.lang.String, int, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_,_-&gt;!null;null,_,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.util.StringUtils java.lang.String collapseNewlines(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.util.StringUtils java.lang.String collapseNewlines(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.util.StringUtils java.lang.String collapseSpaces(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.util.StringUtils java.lang.String collapseSpaces(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.util.StringUtils java.lang.String concat(java.util.List) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.util.StringUtils java.lang.String concat(java.util.List)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.util.StringUtils java.lang.String firstLetterCaps(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.util.StringUtils java.lang.String firstLetterCaps(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.util.StringUtils java.lang.String getPackageAsPath(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.util.StringUtils java.lang.String getPackageAsPath(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.util.StringUtils java.lang.String normalizePath(java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.util.StringUtils java.lang.String nullTrim(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.util.StringUtils java.lang.String removeAndHump(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.util.StringUtils java.lang.String removeAndHump(java.lang.String, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.util.StringUtils java.lang.String removeUnderScores(java.lang.String)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.util.StringUtils java.lang.String stackTrace(java.lang.Throwable)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.util.StringUtils java.lang.String sub(java.lang.String, java.lang.String, java.lang.String) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.util.StringUtils java.lang.String sub(java.lang.String, java.lang.String, java.lang.String) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.util.StringUtils java.lang.String sub(java.lang.String, java.lang.String, java.lang.String)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null,_,_-&gt;!null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.util.StringUtils java.lang.StringBuffer stringSubstitution(java.lang.String, java.util.Hashtable) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.util.StringUtils java.lang.StringBuffer stringSubstitution(java.lang.String, java.util.Map) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.util.StringUtils java.util.List trimStrings(java.util.List)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;!null-&gt;!null;null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+</root>
diff --git a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/util/introspection/annotations.xml b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/util/introspection/annotations.xml
new file mode 100644
index 000000000000..4518a467c463
--- /dev/null
+++ b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/util/introspection/annotations.xml
@@ -0,0 +1,127 @@
+<root>
+ <item name="org.apache.velocity.util.introspection.ClassMap java.lang.reflect.Method findMethod(java.lang.String, java.lang.Object[]) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.util.introspection.ClassMap void populateMethodCacheWithInterface(org.apache.velocity.util.introspection.ClassMap.MethodCache, java.lang.Class) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.util.introspection.ClassMap.MethodCache java.lang.String makeMethodKey(java.lang.String, java.lang.Object[]) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.util.introspection.ClassMap.MethodCache java.lang.String makeMethodKey(java.lang.reflect.Method) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.util.introspection.ClassMap.MethodCache java.lang.reflect.Method get(java.lang.String, java.lang.Object[]) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.util.introspection.ClassMap.MethodCache void access$100(org.apache.velocity.util.introspection.ClassMap.MethodCache, java.lang.reflect.Method) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.util.introspection.ClassMap.MethodCache void access$100(org.apache.velocity.util.introspection.ClassMap.MethodCache, java.lang.reflect.Method) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.util.introspection.ClassMap.MethodCache void put(java.lang.reflect.Method) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.util.introspection.Info Info(org.apache.velocity.runtime.parser.node.Node) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.util.introspection.Info java.lang.String toString()">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.util.introspection.IntrospectionUtils boolean isMethodInvocationConvertible(java.lang.Class, java.lang.Class, boolean) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.util.introspection.IntrospectionUtils boolean isStrictMethodInvocationConvertible(java.lang.Class, java.lang.Class, boolean) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.util.introspection.Introspector Introspector(org.apache.velocity.runtime.RuntimeLogger) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.util.introspection.Introspector java.lang.reflect.Method getMethod(java.lang.Class, java.lang.String, java.lang.Object[]) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.util.introspection.Introspector java.lang.reflect.Method getMethod(java.lang.Class, java.lang.String, java.lang.Object[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.util.introspection.IntrospectorBase java.lang.reflect.Method getMethod(java.lang.Class, java.lang.String, java.lang.Object[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.util.introspection.IntrospectorBase java.lang.reflect.Method getMethod(java.lang.Class, java.lang.String, java.lang.Object[]) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.util.introspection.IntrospectorCacheImpl org.apache.velocity.util.introspection.ClassMap get(java.lang.Class) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.util.introspection.IntrospectorCacheImpl org.apache.velocity.util.introspection.ClassMap put(java.lang.Class) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.util.introspection.IntrospectorCacheImpl org.apache.velocity.util.introspection.ClassMap put(java.lang.Class)">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.util.introspection.MethodMap boolean isApplicable(java.lang.reflect.Method, java.lang.Class[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.util.introspection.MethodMap boolean isApplicable(java.lang.reflect.Method, java.lang.Class[]) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.util.introspection.MethodMap boolean isConvertible(java.lang.Class, java.lang.Class, boolean) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.util.introspection.MethodMap boolean isStrictConvertible(java.lang.Class, java.lang.Class, boolean) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.util.introspection.MethodMap int compare(java.lang.Class[], java.lang.Class[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.util.introspection.MethodMap int compare(java.lang.Class[], java.lang.Class[]) 1">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.util.introspection.MethodMap java.lang.reflect.Method find(java.lang.String, java.lang.Object[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,null-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.util.introspection.MethodMap java.lang.reflect.Method getBestMatch(java.util.List, java.lang.Class[]) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.util.introspection.MethodMap void add(java.lang.reflect.Method) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.util.introspection.SecureIntrospectorImpl java.lang.reflect.Method getMethod(java.lang.Class, java.lang.String, java.lang.Object[])">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;_,_,null-&gt;null;null,_,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.util.introspection.SecureUberspector java.util.Iterator getIterator(java.lang.Object, org.apache.velocity.util.introspection.Info)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.util.introspection.UberspectImpl java.util.Iterator getIterator(java.lang.Object, org.apache.velocity.util.introspection.Info) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.util.introspection.UberspectImpl org.apache.velocity.util.introspection.VelMethod getMethod(java.lang.Object, java.lang.String, java.lang.Object[], org.apache.velocity.util.introspection.Info)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_,_,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.util.introspection.UberspectImpl org.apache.velocity.util.introspection.VelPropertyGet getPropertyGet(java.lang.Object, java.lang.String, org.apache.velocity.util.introspection.Info)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.util.introspection.UberspectImpl org.apache.velocity.util.introspection.VelPropertySet getPropertySet(java.lang.Object, java.lang.String, java.lang.Object, org.apache.velocity.util.introspection.Info)">
+ <annotation name="org.jetbrains.annotations.Contract">
+ <val val="&quot;null,_,_,_-&gt;null&quot;"/>
+ </annotation>
+ </item>
+ <item name="org.apache.velocity.util.introspection.UberspectImpl void setRuntimeLogger(org.apache.velocity.runtime.RuntimeLogger) 0">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+ <item name="org.apache.velocity.util.introspection.UberspectImpl.VelMethodImpl java.lang.Object[] handleVarArg(java.lang.Class, int, java.lang.Object[]) 2">
+ <annotation name="org.jetbrains.annotations.NotNull"/>
+ </item>
+</root>
diff --git a/java/java-tests/testData/codeInspection/bytecodeAnalysis/src/Example.java b/java/java-tests/testData/codeInspection/bytecodeAnalysis/src/Example.java
new file mode 100644
index 000000000000..5738a372e6ca
--- /dev/null
+++ b/java/java-tests/testData/codeInspection/bytecodeAnalysis/src/Example.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.commons.lang.ArrayUtils;
+import org.apache.commons.lang.ClassUtils;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import javax.swing.*;
+import java.io.FilterOutputStream;
+import java.io.IOException;
+
+public class Example {
+ void test() {
+
+ if (<warning descr="Condition 'ArrayUtils.toMap(null) == null' is always 'true'">ArrayUtils.toMap(null) == null</warning>) {
+ System.out.println("null");
+ }
+
+ if (<warning descr="Condition 'ClassUtils.getPackageName((String)null) == null' is always 'false'">ClassUtils.getPackageName((String)null) == null</warning>) {
+ System.out.println("null");
+ }
+
+ @NotNull Class x = <warning descr="Expression 'ClassUtils.primitiveToWrapper(null)' might evaluate to null but is assigned to a variable that is annotated with @NotNull">ClassUtils.primitiveToWrapper(null)</warning>;
+ }
+
+ void writeBytes(@Nullable byte[] bytes) throws IOException {
+ new FilterOutputStream(null).write(<warning descr="Argument 'bytes' might be null">bytes</warning>);
+ }
+}
diff --git a/java/java-tests/testData/compiler/notNullVerification/CustomExceptionType.java b/java/java-tests/testData/compiler/notNullVerification/CustomExceptionType.java
new file mode 100644
index 000000000000..055b339c5f9c
--- /dev/null
+++ b/java/java-tests/testData/compiler/notNullVerification/CustomExceptionType.java
@@ -0,0 +1,5 @@
+import org.jetbrains.annotations.NotNull;
+
+public class CustomExceptionType {
+ public void foo(Object obj, @NotNull(exception = NullPointerException.class) Object obj2) { }
+} \ No newline at end of file
diff --git a/java/java-tests/testData/compiler/notNullVerification/annotations.jar b/java/java-tests/testData/compiler/notNullVerification/annotations.jar
index 45860d829e91..d96bb1d6bed4 100644
--- a/java/java-tests/testData/compiler/notNullVerification/annotations.jar
+++ b/java/java-tests/testData/compiler/notNullVerification/annotations.jar
Binary files differ
diff --git a/java/java-tests/testData/inspection/dataFlow/AlexBug/src/Test.java b/java/java-tests/testData/inspection/dataFlow/AlexBug/src/Test.java
index 1953a6a43c55..e397de3faf8a 100644
--- a/java/java-tests/testData/inspection/dataFlow/AlexBug/src/Test.java
+++ b/java/java-tests/testData/inspection/dataFlow/AlexBug/src/Test.java
@@ -1,6 +1,8 @@
public class Test {
- public String foo(String path) {
- String smth = new String(path);
+ public Test(String s) { }
+
+ public Test foo(String path) {
+ Test smth = new Test(path);
if (path == null) return null;
return smth;
}
diff --git a/java/java-tests/testData/inspection/dataFlow/caseAndNpe/expected.xml b/java/java-tests/testData/inspection/dataFlow/caseAndNpe/expected.xml
index 184e6c5f85f1..e65851b5b821 100644
--- a/java/java-tests/testData/inspection/dataFlow/caseAndNpe/expected.xml
+++ b/java/java-tests/testData/inspection/dataFlow/caseAndNpe/expected.xml
@@ -22,6 +22,11 @@
</problem>
<problem>
<file>CaseAndNpe.java</file>
+ <line>56</line>
+ <description>Condition &lt;code&gt;i &lt; 5&lt;/code&gt; is always &lt;code&gt;false&lt;/code&gt;</description>
+ </problem>
+ <problem>
+ <file>CaseAndNpe.java</file>
<line>80</line>
<description>Condition is always true</description>
</problem>
diff --git a/java/java-tests/testData/inspection/dataFlow/fixture/AccessingSameArrayElements.java b/java/java-tests/testData/inspection/dataFlow/fixture/AccessingSameArrayElements.java
new file mode 100644
index 000000000000..a5a0001517d6
--- /dev/null
+++ b/java/java-tests/testData/inspection/dataFlow/fixture/AccessingSameArrayElements.java
@@ -0,0 +1,56 @@
+abstract class Test {
+ void testSameEquals(int[] arr1, int[] arr2) {
+ if (arr1[0] == arr2[0] && <warning descr="Condition 'arr1[0] == arr2[0]' is always 'true' when reached">arr1[0] == arr2[0]</warning>) {
+ }
+ }
+
+ void testMatrices(int[][][] arr1, int[][][] arr2) {
+ if (arr1[0][1][2] == arr1[0][1][3] &&
+ <warning descr="Condition 'arr1[0][1][2] == arr1[0][1][3]' is always 'true' when reached">arr1[0][1][2] == arr1[0][1][3]</warning>) {
+ }
+ }
+
+ void testNotEquals(int[] arr1, int[] arr2) {
+ if (arr1[0] != arr2[0]) return;
+
+ if (<warning descr="Condition 'arr1[0] == arr2[0]' is always 'true'">arr1[0] == arr2[0]</warning>) {}
+ }
+
+ void testInvalidatingCall(int[] arr1, int[] arr2) {
+ if (arr1[0] != arr2[0]) return;
+
+ changeArray(arr1);
+
+ if (arr1[0] == arr2[0]) {}
+ }
+ abstract void changeArray(int[] array);
+
+
+ void testIndirectlyInvalidatingCall(int[] arr1, int[] arr2, int[][] arr3) {
+ arr3[0] = arr1;
+
+ if (arr1[0] != arr2[0]) return;
+
+ changeSubArray(arr3);
+
+ if (arr1[0] == arr2[0]) {}
+ }
+ abstract void changeSubArray(int[][] array);
+
+
+ void testAssigning(int[] arr1, int j) {
+ arr1[0] = j;
+ if (<warning descr="Condition 'arr1[0] == j' is always 'true'">arr1[0] == j</warning>) { }
+ }
+
+ void testReassigning(int[] arr1) {
+ arr1[0] = 1;
+ arr1[1] = 3;
+ if (<warning descr="Condition 'arr1[0] == 1' is always 'true'">arr1[0] == 1</warning>) { }
+
+ for (int i = 0; i < arr1.length; i++) {
+ arr1[i] = 2;
+ }
+ if (arr1[0] == 1) { }
+ }
+} \ No newline at end of file
diff --git a/java/java-tests/testData/inspection/dataFlow/fixture/AssertThat.java b/java/java-tests/testData/inspection/dataFlow/fixture/AssertThat.java
new file mode 100644
index 000000000000..b3d614cd8cb3
--- /dev/null
+++ b/java/java-tests/testData/inspection/dataFlow/fixture/AssertThat.java
@@ -0,0 +1,18 @@
+import org.hamcrest.CoreMatchers;
+import org.jetbrains.annotations.Nullable;
+import static org.hamcrest.CoreMatchers.*;
+import static org.junit.Assert.assertThat;
+
+class Contracts {
+
+ private void checkNotNullValue(@Nullable Object o) {
+ assertThat(o, CoreMatchers.<Object>notNullValue());
+ System.out.println(o.hashCode());
+ }
+
+ private void checkNotEqualToNull(@Nullable String test) {
+ assertThat("String is null", test, not(equalTo(null)));
+ int length = test.length();
+ }
+
+} \ No newline at end of file
diff --git a/java/java-tests/testData/inspection/dataFlow/fixture/CatchRuntimeException.java b/java/java-tests/testData/inspection/dataFlow/fixture/CatchRuntimeException.java
index 8f6508642352..e635b8dbd9a9 100644
--- a/java/java-tests/testData/inspection/dataFlow/fixture/CatchRuntimeException.java
+++ b/java/java-tests/testData/inspection/dataFlow/fixture/CatchRuntimeException.java
@@ -36,7 +36,7 @@ class BrokenAlignment {
}
public void bar(@NotNull Object foo) {
- assert <warning descr="Condition 'foo != null' is always 'true'">foo != null</warning>;
+ if (<warning descr="Condition 'foo != null' is always 'true'">foo != null</warning>);
}
public void bar2(@NotNull Object foo) {
diff --git a/java/java-tests/testData/inspection/dataFlow/fixture/ContractInferenceBewareOverriding.java b/java/java-tests/testData/inspection/dataFlow/fixture/ContractInferenceBewareOverriding.java
new file mode 100644
index 000000000000..a1d263f778f6
--- /dev/null
+++ b/java/java-tests/testData/inspection/dataFlow/fixture/ContractInferenceBewareOverriding.java
@@ -0,0 +1,21 @@
+import org.jetbrains.annotations.Nullable;
+
+class Doo {
+
+ boolean isMaybeNotNull(@Nullable Object o) {
+ return o != null;
+ }
+
+ void foo(@Nullable String s) {
+ if (isMaybeNotNull(s)) {
+ System.out.println(<warning descr="Method invocation 's.length()' may produce 'java.lang.NullPointerException'">s.length()</warning>);
+ }
+ }
+
+}
+
+class DooImpl extends Doo {
+ boolean isMaybeNotNull(@Nullable Object o) {
+ return hashCode() == 42;
+ }
+} \ No newline at end of file
diff --git a/java/java-tests/testData/inspection/dataFlow/fixture/FinalFieldDuringSuperInitialization.java b/java/java-tests/testData/inspection/dataFlow/fixture/FinalFieldDuringSuperInitialization.java
new file mode 100644
index 000000000000..59fc5fba349a
--- /dev/null
+++ b/java/java-tests/testData/inspection/dataFlow/fixture/FinalFieldDuringSuperInitialization.java
@@ -0,0 +1,20 @@
+class Parent {
+ Parent() {
+ callProtectedMethod();
+ }
+ protected void callProtectedMethod() { }
+}
+
+class Child extends Parent {
+ private final Object myField;
+ Child() {
+ super();
+ myField = new Object();
+ }
+ @Override
+ protected void callProtectedMethod() {
+ if (myField != null) { // HERE myField CAN be null
+ System.out.println();
+ }
+ }
+} \ No newline at end of file
diff --git a/java/java-tests/testData/inspection/dataFlow/fixture/GuavaCheckNotNull.java b/java/java-tests/testData/inspection/dataFlow/fixture/GuavaCheckNotNull.java
new file mode 100644
index 000000000000..4a11daa71c77
--- /dev/null
+++ b/java/java-tests/testData/inspection/dataFlow/fixture/GuavaCheckNotNull.java
@@ -0,0 +1,11 @@
+import org.jetbrains.annotations.Nullable;
+
+class Contracts {
+
+ private void check(@Nullable Object o) {
+ com.google.common.base.Preconditions.checkNotNull(o);
+ System.out.println(o.hashCode());
+ }
+
+
+} \ No newline at end of file
diff --git a/java/java-tests/testData/inspection/dataFlow/fixture/NumberComparisonsWhenValueIsKnown.java b/java/java-tests/testData/inspection/dataFlow/fixture/NumberComparisonsWhenValueIsKnown.java
new file mode 100644
index 000000000000..71cca5352cf2
--- /dev/null
+++ b/java/java-tests/testData/inspection/dataFlow/fixture/NumberComparisonsWhenValueIsKnown.java
@@ -0,0 +1,16 @@
+import java.util.Arrays;
+
+class Test {
+ int[] mIndex = null;
+ int mSize = 0;
+
+ void indexValues() {
+ float loadFactor = mIndex == null ? 1.f : ((float) mSize) / ((float) mIndex.length);
+
+ if (loadFactor < 0.25f || 0.75f <= loadFactor) {
+ mIndex = new int[mSize * 2];
+ }
+
+ mIndex[0] = -1;
+ }
+} \ No newline at end of file
diff --git a/java/java-tests/testData/inspection/dataFlow/fixture/ReportConstantReferences.java b/java/java-tests/testData/inspection/dataFlow/fixture/ReportConstantReferences.java
index d81b46724a81..dbb4f50f44a5 100644
--- a/java/java-tests/testData/inspection/dataFlow/fixture/ReportConstantReferences.java
+++ b/java/java-tests/testData/inspection/dataFlow/fixture/ReportConstantReferences.java
@@ -1,13 +1,15 @@
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
class Test {
- private void test2(@NotNull Object bar) {
+ private void test2(@NotNull Object bar) {}
+
+ void println(@Nullable Object o) {}
- }
private Object test(Object foo, Object bar) {
if (foo == null) {
- System.out.println(<warning descr="Value 'foo' is always 'null'"><caret>foo</warning>);
- System.out.println(<warning descr="Value 'foo' is always 'null'">foo</warning>);
+ println(<warning descr="Value 'foo' is always 'null'"><caret>foo</warning>);
+ println(<warning descr="Value 'foo' is always 'null'">foo</warning>);
return <warning descr="Expression 'foo' might evaluate to null but is returned by the method which is not declared as @Nullable">foo</warning>;
}
if (bar == null) {
diff --git a/java/java-tests/testData/inspection/dataFlow/fixture/ReportConstantReferences_NotInComplexAssignment.java b/java/java-tests/testData/inspection/dataFlow/fixture/ReportConstantReferences_NotInComplexAssignment.java
deleted file mode 100644
index a13f0f1b5d60..000000000000
--- a/java/java-tests/testData/inspection/dataFlow/fixture/ReportConstantReferences_NotInComplexAssignment.java
+++ /dev/null
@@ -1,6 +0,0 @@
-class Test {
- void foo() {
- int x = 42;
- <caret>x += 100;
- }
-} \ No newline at end of file
diff --git a/java/java-tests/testData/inspection/dataFlow/fixture/ReportConstantReferences_OverloadedCall.java b/java/java-tests/testData/inspection/dataFlow/fixture/ReportConstantReferences_OverloadedCall.java
new file mode 100644
index 000000000000..82c1e9122cc1
--- /dev/null
+++ b/java/java-tests/testData/inspection/dataFlow/fixture/ReportConstantReferences_OverloadedCall.java
@@ -0,0 +1,14 @@
+import org.jetbrains.annotations.Nullable;
+
+class Test {
+ void method(@Nullable String o) {}
+
+ void method(@Nullable Integer o) {}
+
+ private void test(String foo) {
+ if (foo == null) {
+ method(<warning descr="Value 'foo' is always 'null'"><caret>foo</warning>);
+ }
+ }
+
+} \ No newline at end of file
diff --git a/java/java-tests/testData/inspection/dataFlow/fixture/ReportConstantReferences_OverloadedCall_after.java b/java/java-tests/testData/inspection/dataFlow/fixture/ReportConstantReferences_OverloadedCall_after.java
new file mode 100644
index 000000000000..22524625216d
--- /dev/null
+++ b/java/java-tests/testData/inspection/dataFlow/fixture/ReportConstantReferences_OverloadedCall_after.java
@@ -0,0 +1,14 @@
+import org.jetbrains.annotations.Nullable;
+
+class Test {
+ void method(@Nullable String o) {}
+
+ void method(@Nullable Integer o) {}
+
+ private void test(String foo) {
+ if (foo == null) {
+ method(<caret>(String) null);
+ }
+ }
+
+} \ No newline at end of file
diff --git a/java/java-tests/testData/inspection/dataFlow/fixture/ReportConstantReferences_ReplaceWithEnum.java b/java/java-tests/testData/inspection/dataFlow/fixture/ReportConstantReferences_ReplaceWithEnum.java
deleted file mode 100644
index 2ed16ce0c6f5..000000000000
--- a/java/java-tests/testData/inspection/dataFlow/fixture/ReportConstantReferences_ReplaceWithEnum.java
+++ /dev/null
@@ -1,7 +0,0 @@
-class Test {
- private void test() {
- foo.MyEnum s = foo.MyEnum.FOO;
- System.out.println(<caret><warning descr="Value 's' is always 'FOO'">s</warning>);
- }
-
-} \ No newline at end of file
diff --git a/java/java-tests/testData/inspection/dataFlow/fixture/ReportConstantReferences_ReplaceWithEnum_after.java b/java/java-tests/testData/inspection/dataFlow/fixture/ReportConstantReferences_ReplaceWithEnum_after.java
deleted file mode 100644
index 29552fa61615..000000000000
--- a/java/java-tests/testData/inspection/dataFlow/fixture/ReportConstantReferences_ReplaceWithEnum_after.java
+++ /dev/null
@@ -1,9 +0,0 @@
-import foo.MyEnum;
-
-class Test {
- private void test() {
- foo.MyEnum s = foo.MyEnum.FOO;
- System.out.println(MyEnum.FOO);
- }
-
-} \ No newline at end of file
diff --git a/java/java-tests/testData/inspection/dataFlow/fixture/ReportConstantReferences_ReplaceWithIntConstant.java b/java/java-tests/testData/inspection/dataFlow/fixture/ReportConstantReferences_ReplaceWithIntConstant.java
deleted file mode 100644
index 5388bcda069f..000000000000
--- a/java/java-tests/testData/inspection/dataFlow/fixture/ReportConstantReferences_ReplaceWithIntConstant.java
+++ /dev/null
@@ -1,10 +0,0 @@
-class Test {
- public static final int CONST = 23942;
- private void test(int a) {
- if (a == CONST) {
- System.out.println(<caret><warning descr="Value 'a' is always 'CONST'">a</warning>);
- }
-
- }
-
-} \ No newline at end of file
diff --git a/java/java-tests/testData/inspection/dataFlow/fixture/ReportConstantReferences_ReplaceWithIntConstant_after.java b/java/java-tests/testData/inspection/dataFlow/fixture/ReportConstantReferences_ReplaceWithIntConstant_after.java
deleted file mode 100644
index 11feed5f7903..000000000000
--- a/java/java-tests/testData/inspection/dataFlow/fixture/ReportConstantReferences_ReplaceWithIntConstant_after.java
+++ /dev/null
@@ -1,10 +0,0 @@
-class Test {
- public static final int CONST = 23942;
- private void test(int a) {
- if (a == CONST) {
- System.out.println(<caret>CONST);
- }
-
- }
-
-} \ No newline at end of file
diff --git a/java/java-tests/testData/inspection/dataFlow/fixture/ReportConstantReferences_ReplaceWithString.java b/java/java-tests/testData/inspection/dataFlow/fixture/ReportConstantReferences_ReplaceWithString.java
deleted file mode 100644
index fcff4846b378..000000000000
--- a/java/java-tests/testData/inspection/dataFlow/fixture/ReportConstantReferences_ReplaceWithString.java
+++ /dev/null
@@ -1,8 +0,0 @@
-class Test {
- public static final String CONST = "foo bar";
- private void test() {
- String s = CONST;
- System.out.println(<caret><warning descr="Value 's' is always 'CONST'">s</warning>);
- }
-
-} \ No newline at end of file
diff --git a/java/java-tests/testData/inspection/dataFlow/fixture/ReportConstantReferences_ReplaceWithString_after.java b/java/java-tests/testData/inspection/dataFlow/fixture/ReportConstantReferences_ReplaceWithString_after.java
deleted file mode 100644
index a462170b2b31..000000000000
--- a/java/java-tests/testData/inspection/dataFlow/fixture/ReportConstantReferences_ReplaceWithString_after.java
+++ /dev/null
@@ -1,8 +0,0 @@
-class Test {
- public static final String CONST = "foo bar";
- private void test() {
- String s = CONST;
- System.out.println(CONST);
- }
-
-} \ No newline at end of file
diff --git a/java/java-tests/testData/inspection/dataFlow/fixture/ReportConstantReferences_Switch.java b/java/java-tests/testData/inspection/dataFlow/fixture/ReportConstantReferences_Switch.java
deleted file mode 100644
index e48dc19555bb..000000000000
--- a/java/java-tests/testData/inspection/dataFlow/fixture/ReportConstantReferences_Switch.java
+++ /dev/null
@@ -1,22 +0,0 @@
-class Test {
- private void test() {
- int state = 1;
- switch (<warning descr="Value 'state' is always '1'">state</warning>) {
- case 1: break;
- }
- }
-
- private void test2(int state) {
- switch (state) {
- case ONE:
- case TWO:
- if (state == TWO) {
- System.out.println("hello");
- }
- }
- }
-
- public static final int ONE = 1;
- public static final int TWO = 2;
-
-} \ No newline at end of file
diff --git a/java/java-tests/testData/inspection/dataFlow/fixture/ReportConstantReferences_after.java b/java/java-tests/testData/inspection/dataFlow/fixture/ReportConstantReferences_after.java
index 0d187397afc9..395fd486c388 100644
--- a/java/java-tests/testData/inspection/dataFlow/fixture/ReportConstantReferences_after.java
+++ b/java/java-tests/testData/inspection/dataFlow/fixture/ReportConstantReferences_after.java
@@ -1,13 +1,15 @@
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
class Test {
- private void test2(@NotNull Object bar) {
+ private void test2(@NotNull Object bar) {}
+
+ void println(@Nullable Object o) {}
- }
private Object test(Object foo, Object bar) {
if (foo == null) {
- System.out.println(<caret>null);
- System.out.println(foo);
+ println(<caret>null);
+ println(foo);
return foo;
}
if (bar == null) {
diff --git a/java/java-tests/testData/inspection/dataFlow/fixture/UseInferredContracts.java b/java/java-tests/testData/inspection/dataFlow/fixture/UseInferredContracts.java
new file mode 100644
index 000000000000..34b9d708a4b2
--- /dev/null
+++ b/java/java-tests/testData/inspection/dataFlow/fixture/UseInferredContracts.java
@@ -0,0 +1,15 @@
+import org.jetbrains.annotations.Nullable;
+
+class Doo {
+
+ static boolean isNotNull(@Nullable Object o) {
+ return o != null;
+ }
+
+ void foo(@Nullable String s) {
+ if (isNotNull(s)) {
+ System.out.println(s.length());
+ }
+ }
+
+}
diff --git a/java/java-tests/testData/inspection/nullableProblems/GetterSetterProblems.java b/java/java-tests/testData/inspection/nullableProblems/GetterSetterProblems.java
index d49cd9ca6fd0..c8a5816ec741 100644
--- a/java/java-tests/testData/inspection/nullableProblems/GetterSetterProblems.java
+++ b/java/java-tests/testData/inspection/nullableProblems/GetterSetterProblems.java
@@ -2,7 +2,7 @@ import org.jetbrains.annotations.NotNull;
class B {
@NotNull
- B b;
+ B b = new B();
public B <warning descr="Getter for @NotNull field might be annotated @NotNull itself">getB</warning>() {
return b;
@@ -39,7 +39,7 @@ class C {
this.c = c;
}
- @NotNull C c1;
+ @NotNull C c1 = new C(null);
@org.jetbrains.annotations.Nullable
public C getC1() {
if (c1 != null) {
diff --git a/java/java-tests/testData/inspection/nullableProblems/NotNullCustomException.java b/java/java-tests/testData/inspection/nullableProblems/NotNullCustomException.java
new file mode 100644
index 000000000000..42e2798ed1ab
--- /dev/null
+++ b/java/java-tests/testData/inspection/nullableProblems/NotNullCustomException.java
@@ -0,0 +1,8 @@
+import org.jetbrains.annotations.*;
+
+class Test {
+ public void foo(@NotNull(exception = NullPointerException.class) String a) { }
+ public void foo2(@NotNull(exception = <warning descr="Custom exception class should have a constructor with a single message parameter of String type">CustomException.class</warning>) String a) { }
+}
+
+class CustomException extends Exception {} \ No newline at end of file
diff --git a/java/java-tests/testData/inspection/nullableProblems/NotNullFieldNotInitialized.java b/java/java-tests/testData/inspection/nullableProblems/NotNullFieldNotInitialized.java
new file mode 100644
index 000000000000..918d5db30fd2
--- /dev/null
+++ b/java/java-tests/testData/inspection/nullableProblems/NotNullFieldNotInitialized.java
@@ -0,0 +1,9 @@
+import org.jetbrains.annotations.*;
+
+class Test {
+ <warning descr="Not-null fields must be initialized">@NotNull</warning> Object member;
+
+ private void accessMember() {
+ member = new Object();
+ }
+} \ No newline at end of file
diff --git a/java/java-tests/testData/psi/parser-full/annotationParsing/annotation/Errors.java b/java/java-tests/testData/psi/parser-full/annotationParsing/annotation/Errors.java
index 200c37e7fa32..4e90d08eb3ea 100644
--- a/java/java-tests/testData/psi/parser-full/annotationParsing/annotation/Errors.java
+++ b/java/java-tests/testData/psi/parser-full/annotationParsing/annotation/Errors.java
@@ -1,2 +1,8 @@
@Ann(<error descr="Cannot find method 'value'">0</error>) class D {
+
+ <error>@EJB</error>
+ Runnable myMissingEjbRef;
+
+ public <T> @SafeVarargs
+ static void m();
} \ No newline at end of file
diff --git a/java/java-tests/testData/psi/parser-full/annotationParsing/annotation/Errors.txt b/java/java-tests/testData/psi/parser-full/annotationParsing/annotation/Errors.txt
index 9f1efdb6d2e4..678025fdf06a 100644
--- a/java/java-tests/testData/psi/parser-full/annotationParsing/annotation/Errors.txt
+++ b/java/java-tests/testData/psi/parser-full/annotationParsing/annotation/Errors.txt
@@ -69,5 +69,96 @@ PsiJavaFile:Errors.java
<empty list>
PsiWhiteSpace(' ')
PsiJavaToken:LBRACE('{')
+ PsiWhiteSpace('\n\n ')
+ PsiModifierList:
+ <empty list>
+ PsiErrorElement:Identifier or type expected
+ PsiTypeParameterList
+ PsiJavaToken:LT('<')
+ PsiTypeParameter:error
+ PsiIdentifier:error('error')
+ PsiElement(EXTENDS_BOUND_LIST)
+ <empty list>
+ PsiJavaToken:GT('>')
+ PsiModifierList:@EJB
+ PsiAnnotation
+ PsiJavaToken:AT('@')
+ PsiJavaCodeReferenceElement:EJB
+ PsiIdentifier:EJB('EJB')
+ PsiReferenceParameterList
+ <empty list>
+ PsiAnnotationParameterList
+ <empty list>
+ PsiErrorElement:Identifier or type expected
+ PsiTypeParameterList
+ PsiJavaToken:LT('<')
+ PsiErrorElement:Type parameter expected
+ <empty list>
+ PsiErrorElement:'>' expected.
+ <empty list>
+ PsiErrorElement:Unexpected token
+ PsiJavaToken:DIV('/')
+ PsiModifierList:
+ <empty list>
+ PsiTypeElement:error
+ PsiJavaCodeReferenceElement:error
+ PsiIdentifier:error('error')
+ PsiReferenceParameterList
+ <empty list>
+ PsiErrorElement:Identifier expected
+ <empty list>
+ PsiErrorElement:Unexpected token
+ PsiJavaToken:GT('>')
+ PsiWhiteSpace('\n ')
+ PsiField:myMissingEjbRef
+ PsiModifierList:
+ <empty list>
+ PsiTypeElement:Runnable
+ PsiJavaCodeReferenceElement:Runnable
+ PsiIdentifier:Runnable('Runnable')
+ PsiReferenceParameterList
+ <empty list>
+ PsiWhiteSpace(' ')
+ PsiIdentifier:myMissingEjbRef('myMissingEjbRef')
+ PsiJavaToken:SEMICOLON(';')
+ PsiWhiteSpace('\n\n ')
+ PsiModifierList:public
+ PsiKeyword:public('public')
+ PsiWhiteSpace(' ')
+ PsiErrorElement:Identifier or type expected
+ PsiTypeParameterList
+ PsiJavaToken:LT('<')
+ PsiTypeParameter:T
+ PsiIdentifier:T('T')
+ PsiElement(EXTENDS_BOUND_LIST)
+ <empty list>
+ PsiJavaToken:GT('>')
+ PsiWhiteSpace(' ')
+ PsiMethod:m
+ PsiModifierList:@SafeVarargs
+ static
+ PsiAnnotation
+ PsiJavaToken:AT('@')
+ PsiJavaCodeReferenceElement:SafeVarargs
+ PsiIdentifier:SafeVarargs('SafeVarargs')
+ PsiReferenceParameterList
+ <empty list>
+ PsiAnnotationParameterList
+ <empty list>
+ PsiWhiteSpace('\n ')
+ PsiKeyword:static('static')
+ PsiTypeParameterList
+ <empty list>
+ PsiWhiteSpace(' ')
+ PsiTypeElement:void
+ PsiKeyword:void('void')
+ PsiWhiteSpace(' ')
+ PsiIdentifier:m('m')
+ PsiParameterList:()
+ PsiJavaToken:LPARENTH('(')
+ PsiJavaToken:RPARENTH(')')
+ PsiReferenceList
+ <empty list>
+ PsiJavaToken:SEMICOLON(';')
PsiWhiteSpace('\n')
PsiJavaToken:RBRACE('}') \ No newline at end of file
diff --git a/java/java-tests/testData/psi/parser-full/annotationParsing/annotation/TypeAnnotations.java b/java/java-tests/testData/psi/parser-full/annotationParsing/annotation/TypeAnnotations.java
index a74d4d6bbfad..de61404de20d 100644
--- a/java/java-tests/testData/psi/parser-full/annotationParsing/annotation/TypeAnnotations.java
+++ b/java/java-tests/testData/psi/parser-full/annotationParsing/annotation/TypeAnnotations.java
@@ -47,6 +47,11 @@ class SpecSamples {
try (@A Reader r = new @B FileReader("/dev/zero"); @A Writer w = new @B FileWriter("/dev/null")) { }
}
+ interface TestClass {
+ <T> @Nullable List<T> test();
+ <T> @Positive int test(T t);
+ }
+
//
// 2. An annotation on a wildcard type argument appears before the wildcard ...
//
@@ -72,6 +77,7 @@ class SpecSamples {
//
@Immutable SpecSamples() { }
+ <T> @Immutable SpecSamples(T t) { }
//
// todo [r.sh] 5. It is permitted to explicitly declare the method receiver as the first formal parameter ...
diff --git a/java/java-tests/testData/psi/parser-full/annotationParsing/annotation/TypeAnnotations.txt b/java/java-tests/testData/psi/parser-full/annotationParsing/annotation/TypeAnnotations.txt
index 54cf4b873ea8..0cc33a82fa2c 100644
--- a/java/java-tests/testData/psi/parser-full/annotationParsing/annotation/TypeAnnotations.txt
+++ b/java/java-tests/testData/psi/parser-full/annotationParsing/annotation/TypeAnnotations.txt
@@ -1045,6 +1045,104 @@ PsiJavaFile:TypeAnnotations.java
PsiWhiteSpace('\n ')
PsiJavaToken:RBRACE('}')
PsiWhiteSpace('\n\n ')
+ PsiClass:TestClass
+ PsiModifierList:
+ <empty list>
+ PsiKeyword:interface('interface')
+ PsiWhiteSpace(' ')
+ PsiIdentifier:TestClass('TestClass')
+ PsiTypeParameterList
+ <empty list>
+ PsiReferenceList
+ <empty list>
+ PsiReferenceList
+ <empty list>
+ PsiWhiteSpace(' ')
+ PsiJavaToken:LBRACE('{')
+ PsiWhiteSpace('\n ')
+ PsiMethod:test
+ PsiModifierList:
+ <empty list>
+ PsiTypeParameterList
+ PsiJavaToken:LT('<')
+ PsiTypeParameter:T
+ PsiIdentifier:T('T')
+ PsiElement(EXTENDS_BOUND_LIST)
+ <empty list>
+ PsiJavaToken:GT('>')
+ PsiWhiteSpace(' ')
+ PsiTypeElement:@Nullable List<T>
+ PsiAnnotation
+ PsiJavaToken:AT('@')
+ PsiJavaCodeReferenceElement:Nullable
+ PsiIdentifier:Nullable('Nullable')
+ PsiReferenceParameterList
+ <empty list>
+ PsiAnnotationParameterList
+ <empty list>
+ PsiWhiteSpace(' ')
+ PsiJavaCodeReferenceElement:List<T>
+ PsiIdentifier:List('List')
+ PsiReferenceParameterList
+ PsiJavaToken:LT('<')
+ PsiTypeElement:T
+ PsiJavaCodeReferenceElement:T
+ PsiIdentifier:T('T')
+ PsiReferenceParameterList
+ <empty list>
+ PsiJavaToken:GT('>')
+ PsiWhiteSpace(' ')
+ PsiIdentifier:test('test')
+ PsiParameterList:()
+ PsiJavaToken:LPARENTH('(')
+ PsiJavaToken:RPARENTH(')')
+ PsiReferenceList
+ <empty list>
+ PsiJavaToken:SEMICOLON(';')
+ PsiWhiteSpace('\n ')
+ PsiMethod:test
+ PsiModifierList:
+ <empty list>
+ PsiTypeParameterList
+ PsiJavaToken:LT('<')
+ PsiTypeParameter:T
+ PsiIdentifier:T('T')
+ PsiElement(EXTENDS_BOUND_LIST)
+ <empty list>
+ PsiJavaToken:GT('>')
+ PsiWhiteSpace(' ')
+ PsiTypeElement:@Positive int
+ PsiAnnotation
+ PsiJavaToken:AT('@')
+ PsiJavaCodeReferenceElement:Positive
+ PsiIdentifier:Positive('Positive')
+ PsiReferenceParameterList
+ <empty list>
+ PsiAnnotationParameterList
+ <empty list>
+ PsiWhiteSpace(' ')
+ PsiKeyword:int('int')
+ PsiWhiteSpace(' ')
+ PsiIdentifier:test('test')
+ PsiParameterList:(T t)
+ PsiJavaToken:LPARENTH('(')
+ PsiParameter:t
+ PsiModifierList:
+ <empty list>
+ PsiTypeElement:T
+ PsiJavaCodeReferenceElement:T
+ PsiIdentifier:T('T')
+ PsiReferenceParameterList
+ <empty list>
+ PsiWhiteSpace(' ')
+ PsiIdentifier:t('t')
+ PsiJavaToken:RPARENTH(')')
+ PsiReferenceList
+ <empty list>
+ PsiJavaToken:SEMICOLON(';')
+ PsiWhiteSpace('\n ')
+ PsiJavaToken:RBRACE('}')
+ PsiWhiteSpace('\n\n ')
PsiComment(END_OF_LINE_COMMENT)('//')
PsiWhiteSpace('\n ')
PsiComment(END_OF_LINE_COMMENT)('// 2. An annotation on a wildcard type argument appears before the wildcard ...')
@@ -1485,6 +1583,48 @@ PsiJavaFile:TypeAnnotations.java
PsiJavaToken:LBRACE('{')
PsiWhiteSpace(' ')
PsiJavaToken:RBRACE('}')
+ PsiWhiteSpace('\n ')
+ PsiMethod:SpecSamples
+ PsiModifierList:
+ <empty list>
+ PsiTypeParameterList
+ PsiJavaToken:LT('<')
+ PsiTypeParameter:T
+ PsiIdentifier:T('T')
+ PsiElement(EXTENDS_BOUND_LIST)
+ <empty list>
+ PsiJavaToken:GT('>')
+ PsiWhiteSpace(' ')
+ PsiAnnotation
+ PsiJavaToken:AT('@')
+ PsiJavaCodeReferenceElement:Immutable
+ PsiIdentifier:Immutable('Immutable')
+ PsiReferenceParameterList
+ <empty list>
+ PsiAnnotationParameterList
+ <empty list>
+ PsiWhiteSpace(' ')
+ PsiIdentifier:SpecSamples('SpecSamples')
+ PsiParameterList:(T t)
+ PsiJavaToken:LPARENTH('(')
+ PsiParameter:t
+ PsiModifierList:
+ <empty list>
+ PsiTypeElement:T
+ PsiJavaCodeReferenceElement:T
+ PsiIdentifier:T('T')
+ PsiReferenceParameterList
+ <empty list>
+ PsiWhiteSpace(' ')
+ PsiIdentifier:t('t')
+ PsiJavaToken:RPARENTH(')')
+ PsiReferenceList
+ <empty list>
+ PsiWhiteSpace(' ')
+ PsiCodeBlock
+ PsiJavaToken:LBRACE('{')
+ PsiWhiteSpace(' ')
+ PsiJavaToken:RBRACE('}')
PsiWhiteSpace('\n\n ')
PsiComment(END_OF_LINE_COMMENT)('//')
PsiWhiteSpace('\n ')
diff --git a/java/java-tests/testData/refactoring/inlineMethod/ThisNameConflict.java b/java/java-tests/testData/refactoring/inlineMethod/ThisNameConflict.java
new file mode 100644
index 000000000000..262eae47d2a3
--- /dev/null
+++ b/java/java-tests/testData/refactoring/inlineMethod/ThisNameConflict.java
@@ -0,0 +1,11 @@
+class Test {
+ private final String test = "";
+
+ {
+ foo();
+ }
+
+ void fo<caret>o() {
+ if (test.isEmpty());
+ }
+} \ No newline at end of file
diff --git a/java/java-tests/testData/refactoring/inlineMethod/ThisNameConflict.java.after b/java/java-tests/testData/refactoring/inlineMethod/ThisNameConflict.java.after
new file mode 100644
index 000000000000..76ed281eedb8
--- /dev/null
+++ b/java/java-tests/testData/refactoring/inlineMethod/ThisNameConflict.java.after
@@ -0,0 +1,8 @@
+class Test {
+ private final String test = "";
+
+ {
+ if (test.isEmpty());
+ }
+
+} \ No newline at end of file
diff --git a/java/java-tests/testData/refactoring/pullUp/AsDefaultMethodOverAbstract.java b/java/java-tests/testData/refactoring/pullUp/AsDefaultMethodOverAbstract.java
new file mode 100644
index 000000000000..2a1b9f1ace61
--- /dev/null
+++ b/java/java-tests/testData/refactoring/pullUp/AsDefaultMethodOverAbstract.java
@@ -0,0 +1,12 @@
+class Test {
+ interface Printer {
+ void foo();
+
+ }
+
+ abstract class AbstractPrinter implements Printer {
+ @Override
+ public void f<caret>oo() {
+ }
+ }
+} \ No newline at end of file
diff --git a/java/java-tests/testData/refactoring/pullUp/AsDefaultMethodOverAbstract_after.java b/java/java-tests/testData/refactoring/pullUp/AsDefaultMethodOverAbstract_after.java
new file mode 100644
index 000000000000..2a1b9f1ace61
--- /dev/null
+++ b/java/java-tests/testData/refactoring/pullUp/AsDefaultMethodOverAbstract_after.java
@@ -0,0 +1,12 @@
+class Test {
+ interface Printer {
+ void foo();
+
+ }
+
+ abstract class AbstractPrinter implements Printer {
+ @Override
+ public void f<caret>oo() {
+ }
+ }
+} \ No newline at end of file
diff --git a/java/java-tests/testSrc/com/intellij/TestClassesFilterTest.java b/java/java-tests/testSrc/com/intellij/TestClassesFilterTest.java
index 2bbdb91be897..802189ddff83 100644
--- a/java/java-tests/testSrc/com/intellij/TestClassesFilterTest.java
+++ b/java/java-tests/testSrc/com/intellij/TestClassesFilterTest.java
@@ -21,6 +21,8 @@ import org.junit.Test;
import java.io.ByteArrayInputStream;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
+import java.util.Arrays;
+import java.util.Collections;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
@@ -41,7 +43,7 @@ public class TestClassesFilterTest {
"com.intellij.package6.ExcludedTest\n" +
"com.intellij.package7.*package8";
- TestClassesFilter classesFilter = GroupBasedTestClassFilter.createOn(getReader(filterText), "Group1");
+ TestClassesFilter classesFilter = GroupBasedTestClassFilter.createOn(getReader(filterText), Collections.singletonList("Group1"));
assertTrue(classesFilter.matches("com.intellij.package1.Test"));
assertTrue(classesFilter.matches("com.intellij.package1.Test2"));
assertFalse(classesFilter.matches("com.intellij.package2.Test"));
@@ -59,7 +61,7 @@ public class TestClassesFilterTest {
assertFalse(classesFilter.matches("com.intellij.package7.package5.package8"));
assertFalse(classesFilter.matches("com.intellij.package7"));
- classesFilter = GroupBasedTestClassFilter.createOn(getReader(filterText), "Group2");
+ classesFilter = GroupBasedTestClassFilter.createOn(getReader(filterText), Collections.singletonList("Group2"));
assertFalse(classesFilter.matches("com.intellij.package1.Test"));
assertFalse(classesFilter.matches("com.intellij.package1.Test2"));
assertFalse(classesFilter.matches("com.intellij.package2.Test"));
@@ -77,18 +79,29 @@ public class TestClassesFilterTest {
assertTrue(classesFilter.matches("com.intellij.package7.package5.package8"));
assertFalse(classesFilter.matches("com.intellij.package7"));
- classesFilter = GroupBasedTestClassFilter.createOn(getReader(filterText), null);
- checkForNullGroup(classesFilter);
+ classesFilter = GroupBasedTestClassFilter.createOn(getReader(filterText),
+ Collections.singletonList(GroupBasedTestClassFilter.ALL_EXCLUDE_DEFINED));
+ checkForAllExcludedDefinedGroup(classesFilter);
- classesFilter = GroupBasedTestClassFilter.createOn(getReader(filterText), GroupBasedTestClassFilter.ALL_EXCLUDE_DEFINED);
- checkForNullGroup(classesFilter);
+ classesFilter = GroupBasedTestClassFilter.createOn(getReader(filterText), Collections.<String>emptyList());
+ checkForAllExcludedDefinedGroup(classesFilter);
+
+ classesFilter = GroupBasedTestClassFilter.createOn(getReader(filterText), Arrays.asList("Group1", "Group2"));
+ assertTrue(classesFilter.matches("com.intellij.package1.Test"));
+ assertTrue(classesFilter.matches("com.intellij.package5.Test"));
+ assertFalse(classesFilter.matches("com.intellij.package4.Test"));
+
+ classesFilter = GroupBasedTestClassFilter.createOn(getReader(filterText), Arrays.asList("Group1", GroupBasedTestClassFilter.ALL_EXCLUDE_DEFINED));
+ assertTrue(classesFilter.matches("com.intellij.package1.Test"));
+ assertFalse(classesFilter.matches("com.intellij.package5.Test"));
+ assertTrue(classesFilter.matches("com.intellij.package4.Test"));
}
private static InputStreamReader getReader(String filterText) throws UnsupportedEncodingException {
return new InputStreamReader(new ByteArrayInputStream(filterText.getBytes("UTF-8")));
}
- private static void checkForNullGroup(TestClassesFilter classesFilter) {
+ private static void checkForAllExcludedDefinedGroup(TestClassesFilter classesFilter) {
assertFalse(classesFilter.matches("com.intellij.package1.Test"));
assertFalse(classesFilter.matches("com.intellij.package1.Test2"));
assertTrue(classesFilter.matches("com.intellij.package2.Test"));
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/JavaTypingTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/JavaTypingTest.java
index 8c3837fe1722..f59162a6d5b2 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/JavaTypingTest.java
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/JavaTypingTest.java
@@ -15,6 +15,7 @@
*/
package com.intellij.codeInsight;
+import com.intellij.openapi.editor.ex.EditorEx;
import com.intellij.testFramework.PlatformTestUtil;
import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase;
@@ -57,6 +58,13 @@ public class JavaTypingTest extends LightPlatformCodeInsightFixtureTestCase {
doTest('"');
}
+ public void testColumnMode() {
+ myFixture.configureByFile(getTestName(true) + "_before.java");
+ ((EditorEx)myFixture.getEditor()).setColumnMode(true);
+ myFixture.type('(');
+ myFixture.checkResultByFile(getTestName(true) + "_after.java");
+ }
+
private void doTest(char c) {
myFixture.configureByFile(getTestName(true) + "_before.java");
myFixture.type(c);
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/completion/JavaAutoPopupTest.groovy b/java/java-tests/testSrc/com/intellij/codeInsight/completion/JavaAutoPopupTest.groovy
index 8a54c9594144..7391f93a1ab2 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/completion/JavaAutoPopupTest.groovy
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/completion/JavaAutoPopupTest.groovy
@@ -42,6 +42,7 @@ import com.intellij.openapi.editor.Editor
import com.intellij.openapi.editor.EditorFactory
import com.intellij.openapi.editor.LogicalPosition
import com.intellij.openapi.editor.actionSystem.EditorActionManager
+import com.intellij.openapi.editor.ex.EditorEx
import com.intellij.openapi.extensions.Extensions
import com.intellij.openapi.extensions.LoadingOrder
import com.intellij.openapi.fileEditor.FileEditor
@@ -1642,4 +1643,14 @@ class Foo {
assert lookup
assert myFixture.lookupElementStrings == ['goo']
}
+
+ public void "test in column selection mode"() {
+ myFixture.configureByText "a.java", """
+class Foo {{
+ <caret>
+}}"""
+ edt { ((EditorEx)myFixture.editor).setColumnMode(true) }
+ type 'toStr'
+ assert lookup
+ }
}
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/completion/NormalCompletionTest.groovy b/java/java-tests/testSrc/com/intellij/codeInsight/completion/NormalCompletionTest.groovy
index 79a94aaa8148..77b4c0cc64a7 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/completion/NormalCompletionTest.groovy
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/completion/NormalCompletionTest.groovy
@@ -768,6 +768,8 @@ public class ListUtils {
assertStringItems("fofoo", "fofoo");
}
+ public void testMethodMergingMinimalTail() { doTest() }
+
public void testAnnotationQualifiedName() throws Throwable {
doTest();
}
@@ -920,6 +922,9 @@ public class ListUtils {
}
public void testSmartEnterWrapsConstructorCall() throws Throwable { doTest(Lookup.COMPLETE_STATEMENT_SELECT_CHAR as String) }
+ public void testSmartEnterNoNewLine() { doTest(Lookup.COMPLETE_STATEMENT_SELECT_CHAR as String) }
+ public void testSmartEnterWithNewLine() { doTest(Lookup.COMPLETE_STATEMENT_SELECT_CHAR as String) }
+
public void testTabReplacesMethodNameWithLocalVariableName() throws Throwable { doTest('\t'); }
public void testMethodParameterAnnotationClass() throws Throwable { doTest(); }
public void testPrimitiveCastOverwrite() throws Throwable { doTest '\t' }
@@ -1469,6 +1474,11 @@ class Bar {
doTest()
}
+ public void testUnimportedStaticInnerClass() {
+ myFixture.addClass("package foo; public class Super { public static class Inner {} }");
+ doTest()
+ }
+
public void testNoJavaLangPackagesInImport() { doAntiTest() }
public void testNoStaticDuplicatesFromExpectedMemberFactories() {
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/completion/SmartTypeCompletionOrderingTest.groovy b/java/java-tests/testSrc/com/intellij/codeInsight/completion/SmartTypeCompletionOrderingTest.groovy
index b19da5ac6f67..1d258fe01367 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/completion/SmartTypeCompletionOrderingTest.groovy
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/completion/SmartTypeCompletionOrderingTest.groovy
@@ -52,12 +52,12 @@ public class SmartTypeCompletionOrderingTest extends CompletionSortingTestCase {
public void testNewListAlwaysFirst() {
def lookup = invokeCompletion(getTestName(false) + ".java")
- assertPreferredItems 1, 'List', 'AbstractList', 'AbstractSequentialList', 'ArrayList'
+ assertPreferredItems 1, 'List', 'ArrayList', 'AbstractList', 'AbstractSequentialList'
for (int i = 0; i < StatisticsManager.OBLIVION_THRESHOLD + 10; i++) {
- imitateItemSelection(lookup, 3) //ArrayList
+ imitateItemSelection(lookup, 3) //AbstractSequentialList
}
refreshSorting(lookup)
- assertPreferredItems 1, 'List', 'ArrayList', 'AbstractList', 'AbstractSequentialList'
+ assertPreferredItems 1, 'List', 'AbstractSequentialList', 'ArrayList', 'AbstractList'
}
public void testNoStatsOnUnsuccessfulAttempt() {
@@ -170,11 +170,11 @@ public class SmartTypeCompletionOrderingTest extends CompletionSortingTestCase {
public void testStatisticsAffectsNonPreferableExpectedItems() throws Throwable {
final LookupImpl lookup = invokeCompletion(getTestName(false) + ".java");
- assertPreferredItems(1, "List", "AbstractList", "AbstractSequentialList", "ArrayList");
+ assertPreferredItems(1, "List", "ArrayList", "AbstractList", "AbstractSequentialList");
incUseCount(lookup, 0);
- assertPreferredItems(1, "List", "AbstractList", "AbstractSequentialList", "ArrayList");
+ assertPreferredItems(1, "List", "ArrayList", "AbstractList", "AbstractSequentialList");
incUseCount(lookup, 0);
- assertPreferredItems(0, "List", "AbstractList", "AbstractSequentialList", "ArrayList");
+ assertPreferredItems(0, "List", "ArrayList", "AbstractList", "AbstractSequentialList");
}
public void testPreferNonRecursiveMethodParams() throws Throwable {
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/completion/SmartTypeCompletionTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/completion/SmartTypeCompletionTest.java
index ed2b792fc5a9..d2e8825cc16d 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/completion/SmartTypeCompletionTest.java
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/completion/SmartTypeCompletionTest.java
@@ -1029,6 +1029,19 @@ public class SmartTypeCompletionTest extends LightFixtureCompletionTestCase {
assertStringItems("Bar", "Goo");
}
+ public void testAutoImportExpectedType() throws Throwable {
+ boolean old = CodeInsightSettings.getInstance().ADD_UNAMBIGIOUS_IMPORTS_ON_THE_FLY;
+ CodeInsightSettings.getInstance().ADD_UNAMBIGIOUS_IMPORTS_ON_THE_FLY = true;
+ try {
+ configureByTestName();
+ performAction();
+ myFixture.assertPreferredCompletionItems(1, "List", "ArrayList", "AbstractList");
+ }
+ finally {
+ CodeInsightSettings.getInstance().ADD_UNAMBIGIOUS_IMPORTS_ON_THE_FLY = old;
+ }
+ }
+
public void testNoWrongSubstitutorFromStats() throws Throwable {
doTest();
FileDocumentManager.getInstance().saveDocument(myFixture.getEditor().getDocument());
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingJdk7Test.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingJdk7Test.java
index a3b60429e297..d6831d4a2d4a 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingJdk7Test.java
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingJdk7Test.java
@@ -34,7 +34,6 @@ import com.intellij.pom.java.LanguageLevel;
import com.intellij.psi.PsiElement;
import com.intellij.testFramework.IdeaTestUtil;
import org.jdom.Element;
-import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import java.util.List;
@@ -44,7 +43,7 @@ import java.util.List;
* For "heavyweight" tests use AdvHighlightingTest
*/
public class LightAdvHighlightingJdk7Test extends LightDaemonAnalyzerTestCase {
- @NonNls static final String BASE_PATH = "/codeInsight/daemonCodeAnalyzer/advHighlighting7";
+ private static final String BASE_PATH = "/codeInsight/daemonCodeAnalyzer/advHighlighting7";
private void doTest(boolean checkWarnings, boolean checkInfos, Class<?>... classes) {
setLanguageLevel(LanguageLevel.JDK_1_7);
@@ -102,12 +101,9 @@ public class LightAdvHighlightingJdk7Test extends LightDaemonAnalyzerTestCase {
public void testHighlightInaccessibleFromClassModifierList() { doTest(false, false); }
public void testInnerInTypeArguments() { doTest(false, false); }
public void testRawSubstitutor() { doTest(false, false); }
+ public void testIncompleteDiamonds() { doTest(false, false); }
- public void testIncompleteDiamonds() throws Exception {
- doTest(false, false);
- }
-
- public void testDynamicallyAddIgnoredAnnotations() throws Exception {
+ public void testDynamicallyAddIgnoredAnnotations() {
ExtensionPoint<EntryPoint> point = Extensions.getRootArea().getExtensionPoint(ToolExtensionPoints.DEAD_CODE_TOOL);
EntryPoint extension = new EntryPoint() {
@NotNull @Override public String getDisplayName() { return "duh"; }
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/MostSpecificResolutionTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/MostSpecificResolutionTest.java
index 7a73bfed6cbd..9bb7d4801944 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/MostSpecificResolutionTest.java
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/MostSpecificResolutionTest.java
@@ -111,6 +111,10 @@ public class MostSpecificResolutionTest extends LightDaemonAnalyzerTestCase {
doTest();
}
+ public void testIDEA127584() throws Exception {
+ doTest();
+ }
+
private void doTest() {
doTest(true);
}
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/NewLambdaHighlightingTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/NewLambdaHighlightingTest.java
index 6bd7654b72af..ea9ada93ca77 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/NewLambdaHighlightingTest.java
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/NewLambdaHighlightingTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -31,214 +31,64 @@ public class NewLambdaHighlightingTest extends LightDaemonAnalyzerTestCase {
@Override
protected LocalInspectionTool[] configureLocalInspectionTools() {
return new LocalInspectionTool[]{
- new UnusedSymbolLocalInspection(),
+ new UnusedSymbolLocalInspection()
};
}
- public void testIDEA93586() throws Exception {
- doTest();
- }
-
- public void testIDEA113573() throws Exception {
- doTest();
- }
-
- public void testIDEA112922() throws Exception {
- doTest();
- }
-
- public void testIDEA113504() throws Exception {
- doTest();
- }
-
- public void testAfterAbstractPipeline2() throws Exception {
- doTest();
- }
-
- public void testIDEA116252() throws Exception {
- doTest();
- }
-
- public void testIDEA106670() throws Exception {
- doTest();
- }
-
- public void testIDEA116548() throws Exception {
- doTest();
- }
-
- public void testOverloadResolutionSAM() throws Exception {
- doTest();
- }
-
- public void testIntersectionTypesDuringInference() throws Exception {
- doTest();
- }
-
- public void testIncludeConstraintsWhenParentMethodIsDuringCalculation() throws Exception {
- doTest();
- }
-
- public void testUseCalculatedSubstitutor() throws Exception {
- doTest();
- }
-
- public void testArgumentOfAnonymousClass() throws Exception {
- doTest();
- }
-
- public void testEllipsis() throws Exception {
- doTest();
- }
-
- public void testOuterMethodPropagation() throws Exception {
- doTest();
- }
-
- public void testRecursiveCalls() throws Exception {
- doTest();
- }
-
- public void testGroundTargetTypeForImplicitLambdas() throws Exception {
- doTest();
- }
-
- public void testAdditionalConstraintsReduceOrder() throws Exception {
- doTest();
- }
-
- public void testAdditionalConstraintSubstitution() throws Exception {
- doTest();
- }
- public void testFunctionalInterfacesCalculation() throws Exception {
- doTest();
- }
-
- public void testMissedSiteSubstitutorDuringDeepAdditionalConstraintsGathering() throws Exception {
- doTest();
- }
-
- public void testIDEA120992() throws Exception {
- doTest();
- }
-
- public void testTargetTypeConflictResolverShouldNotTryToEvaluateCurrentArgumentType() throws Exception {
- doTest();
- }
-
- public void testIDEA119535() throws Exception {
- doTest();
- }
-
- public void testIDEA119003() throws Exception {
- doTest();
- }
-
- public void testIDEA117124() throws Exception {
- doTest();
- }
-
- public void testWildcardParameterization() throws Exception {
- doTest();
- }
-
- public void testDiamondInLambdaReturn() throws Exception {
- doTest();
- }
-
- public void testIDEA118965() throws Exception {
- doTest();
- }
-
- public void testIDEA121315() throws Exception {
- doTest();
- }
-
- public void testIDEA118965comment() throws Exception {
- doTest();
- }
-
- public void testIDEA122074() throws Exception {
- doTest();
- }
-
- public void testIDEA122084() throws Exception {
- doTest();
- }
-
- public void testAdditionalConstraintDependsOnNonMentionedVars() throws Exception {
- doTest();
- }
-
- public void testIDEA122616() throws Exception {
- doTest();
- }
-
- public void testIDEA122700() throws Exception {
- doTest();
- }
-
- public void testIDEA122406() throws Exception {
- doTest();
- }
-
- public void testNestedCallsInsideLambdaReturnExpression() throws Exception {
- doTest();
- }
-
- public void testIDEA123731() throws Exception {
- doTest();
- }
-
- public void testIDEA123869() throws Exception {
- doTest();
- }
-
- public void testIDEA123848() throws Exception {
- doTest();
- }
-
- public void testOnlyLambdaAtTypeParameterPlace() throws Exception {
- doTest();
- }
-
- public void testLiftedIntersectionType() throws Exception {
- doTest();
- }
-
- public void testInferenceFromReturnStatements() throws Exception {
- doTest();
- }
-
- public void testDownUpThroughLambdaReturnStatements() throws Exception {
- doTest();
- }
-
- public void testIDEA124547() throws Exception {
- doTest();
- }
-
- public void testIDEA118362() throws Exception {
- doTest();
- }
-
- public void testIDEA126056() throws Exception {
- doTest();
- }
-
- public void testIDEA125254() throws Exception {
- doTest();
- }
-
- public void testIDEA124961() throws Exception {
- doTest();
- }
-
- public void testIDEA126109() throws Exception {
- doTest();
- }
-
- public void testIDEA126809() throws Exception {
+ public void testIDEA93586() { doTest(); }
+ public void testIDEA113573() { doTest(); }
+ public void testIDEA112922() { doTest(); }
+ public void testIDEA113504() { doTest(); }
+ public void testAfterAbstractPipeline2() { doTest(); }
+ public void testIDEA116252() { doTest(); }
+ public void testIDEA106670() { doTest(); }
+ public void testIDEA116548() { doTest(); }
+ public void testOverloadResolutionSAM() { doTest(); }
+ public void testIntersectionTypesDuringInference() { doTest(); }
+ public void testIncludeConstraintsWhenParentMethodIsDuringCalculation() { doTest(); }
+ public void testUseCalculatedSubstitutor() { doTest(); }
+ public void testArgumentOfAnonymousClass() { doTest(); }
+ public void testEllipsis() { doTest(); }
+ public void testOuterMethodPropagation() { doTest(); }
+ public void testRecursiveCalls() { doTest(); }
+ public void testGroundTargetTypeForImplicitLambdas() { doTest(); }
+ public void testAdditionalConstraintsReduceOrder() { doTest(); }
+ public void testAdditionalConstraintSubstitution() { doTest(); }
+ public void testFunctionalInterfacesCalculation() { doTest(); }
+ public void testMissedSiteSubstitutorDuringDeepAdditionalConstraintsGathering() { doTest(); }
+ public void testIDEA120992() { doTest(); }
+ public void testTargetTypeConflictResolverShouldNotTryToEvaluateCurrentArgumentType() { doTest(); }
+ public void testIDEA119535() { doTest(); }
+ public void testIDEA119003() { doTest(); }
+ public void testIDEA117124() { doTest(); }
+ public void testWildcardParameterization() { doTest(); }
+ public void testDiamondInLambdaReturn() { doTest(); }
+ public void testIDEA118965() { doTest(); }
+ public void testIDEA121315() { doTest(); }
+ public void testIDEA118965comment() { doTest(); }
+ public void testIDEA122074() { doTest(); }
+ public void testIDEA122084() { doTest(); }
+ public void testAdditionalConstraintDependsOnNonMentionedVars() { doTest(); }
+ public void testIDEA122616() { doTest(); }
+ public void testIDEA122700() { doTest(); }
+ public void testIDEA122406() { doTest(); }
+ public void testNestedCallsInsideLambdaReturnExpression() { doTest(); }
+ public void testIDEA123731() { doTest(); }
+ public void testIDEA123869() { doTest(); }
+ public void testIDEA123848() { doTest(); }
+ public void testOnlyLambdaAtTypeParameterPlace() { doTest(); }
+ public void testLiftedIntersectionType() { doTest(); }
+ public void testInferenceFromReturnStatements() { doTest(); }
+ public void testDownUpThroughLambdaReturnStatements() { doTest(); }
+ public void testIDEA124547() { doTest(); }
+ public void testIDEA118362() { doTest(); }
+ public void testIDEA126056() { doTest(); }
+ public void testIDEA125254() { doTest(); }
+ public void testIDEA124961() { doTest(); }
+ public void testIDEA126109() { doTest(); }
+ public void testIDEA126809() { doTest(); }
+
+ public void testIDEA127596() throws Exception {
doTest();
}
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/NewMethodRefHighlightingTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/NewMethodRefHighlightingTest.java
index 6860bc0c88fa..dd7ceb566139 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/NewMethodRefHighlightingTest.java
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/NewMethodRefHighlightingTest.java
@@ -273,6 +273,14 @@ public class NewMethodRefHighlightingTest extends LightDaemonAnalyzerTestCase {
doTest();
}
+ public void testIDEA126969() throws Exception {
+ doTest();
+ }
+
+ public void testIDEA127506() throws Exception {
+ doTest();
+ }
+
private void doTest() {
doTest(false);
}
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/CreateFieldFromUsageTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/CreateFieldFromUsageTest.java
index fba0c7714bef..2c5c52141ea9 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/CreateFieldFromUsageTest.java
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/CreateFieldFromUsageTest.java
@@ -24,6 +24,7 @@ public class CreateFieldFromUsageTest extends LightQuickFixTestCase {
public void testInsideStaticInnerClass() throws Exception { doSingleTest(); }
public void testCreateFromEquals() throws Exception { doSingleTest(); }
public void testCreateFromEqualsToPrimitiveType() throws Exception { doSingleTest(); }
+ public void testInsideInterface() throws Exception { doSingleTest(); }
public void testWithAlignment() throws Exception {
final CommonCodeStyleSettings settings = CodeStyleSettingsManager.getSettings(getProject()).getCommonSettings(JavaLanguage.INSTANCE);
boolean old = settings.ALIGN_GROUP_FIELD_DECLARATIONS;
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/RenameWrongReferenceTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/RenameWrongReferenceTest.java
index ae2c847128b3..7b19bbd5cd27 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/RenameWrongReferenceTest.java
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/RenameWrongReferenceTest.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2000-2014 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.quickFix;
public class RenameWrongReferenceTest extends LightQuickFixAvailabilityTestCase {
@@ -9,4 +24,3 @@ public class RenameWrongReferenceTest extends LightQuickFixAvailabilityTestCase
return "/codeInsight/daemonCodeAnalyzer/quickFix/renameWrongReference";
}
}
-
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/folding/JavaFoldingTest.groovy b/java/java-tests/testSrc/com/intellij/codeInsight/folding/JavaFoldingTest.groovy
index 2047f13b795d..5d823e001f82 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/folding/JavaFoldingTest.groovy
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/folding/JavaFoldingTest.groovy
@@ -608,7 +608,7 @@ class Test {
configure(testNow, shouldIgnoreRoots(), fourteen, pi, title, c, file);
}
- pubic void configure(boolean testNow, boolean shouldIgnoreRoots, int times, float pi, String title, char terminate, File file) {
+ pubic void configure(boolean testNow, boolean shouldIgnoreRoots, int times, float pii, String title, char terminate, File file) {
System.out.println();
System.out.println();
}
@@ -672,7 +672,7 @@ public class VarArgTest {
assert regions[1].placeholderText == "test: 13"
}
- public void "test inline if argument length is one (EA-57555)"() {
+ public void "test do not inline if parameter length is one or two"() {
def text = """
public class CharSymbol {
@@ -681,7 +681,7 @@ public class CharSymbol {
count(1, false);
}
- public void count(int test, boolean fast) {
+ public void count(int t, boolean fa) {
int temp = test;
boolean isFast = fast;
}
@@ -689,13 +689,78 @@ public class CharSymbol {
"""
configure text
def regions = myFixture.editor.foldingModel.allFoldRegions.sort { it.startOffset }
+ assert regions.size() == 2
+ }
+
+ public void "test do not inline known subsequent parameter names"() {
+ def text = """
+public class Test {
+ public void main() {
+ test1(1, 2);
+ test2(1, 2);
+ test3(1, 2);
+ doTest("first", "second");
+ }
+
+ public void test1(int first, int second) {
+ int start = first;
+ int end = second;
+ }
+
+ public void test2(int key, int value) {
+ int start = key;
+ int end = value;
+ }
+
+ public void test3(int key, int value) {
+ int start = key;
+ int end = value;
+ }
+}
+"""
+ configure text
+ def regions = myFixture.editor.foldingModel.allFoldRegions
assert regions.size() == 4
+ }
- checkRangeOffsetByPositionInText(regions[1], text, "1")
- assert regions[1].placeholderText == "test: 1"
+ public void "test do not inline paired ranged names"() {
+ def text = """
+public class CharSymbol {
- checkRangeOffsetByPositionInText(regions[2], text, "false")
- assert regions[2].placeholderText == "fast: false"
+ public void main() {
+ String s = "AAA";
+ int last = 3;
+
+ substring1(1, last);
+ substring2(1, last);
+ substring3(1, last);
+ substring4(1, last);
+ }
+
+ public void substring1(int beginIndex, int endIndex) {
+ int start = beginIndex;
+ int end = endIndex;
+ }
+
+ public void substring2(int startIndex, int endIndex) {
+ int start = startIndex;
+ int end = endIndex;
+ }
+
+ public void substring3(int from, int to) {
+ int start = from;
+ int end = to;
+ }
+
+ public void substring4(int first, int last) {
+ int start = first;
+ int end = last;
+ }
+}
+"""
+ configure text
+ def regions = myFixture.editor.foldingModel.allFoldRegions.sort { it.startOffset }
+ assert regions.size() == 5
}
public void "test inline names if literal expression can be assigned to method parameter"() {
@@ -764,7 +829,7 @@ public class Test {
}
abstract class Checker {
- Checker(boolean applyToFirst, boolean applyToSecond) {}
+ Checker(boolean isActive, boolean requestFocus) {}
abstract void test();
}
}
@@ -773,8 +838,8 @@ public class Test {
def regions = myFixture.editor.foldingModel.allFoldRegions.sort { it.startOffset }
assert regions.length == 6
- assert regions[1].placeholderText == "applyToFirst: true"
- assert regions[2].placeholderText == "applyToSecond: false"
+ assert regions[1].placeholderText == "isActive: true"
+ assert regions[2].placeholderText == "requestFocus: false"
checkRangeOffsetByPositionInText(regions[1], text, "true")
checkRangeOffsetByPositionInText(regions[2], text, "false")
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/intention/AddImportActionTest.groovy b/java/java-tests/testSrc/com/intellij/codeInsight/intention/AddImportActionTest.groovy
index ead75a2936e2..4b169fcc9249 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/intention/AddImportActionTest.groovy
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/intention/AddImportActionTest.groovy
@@ -177,6 +177,66 @@ class Test {
'''
}
+ public void "test import class in class reference expression"() {
+ myFixture.configureByText 'a.java', '''
+class Test {
+ {
+ equals(Co<caret>llection.class);
+ }
+}
+'''
+ importClass();
+ myFixture.checkResult '''import java.util.Collection;
+
+class Test {
+ {
+ equals(Co<caret>llection.class);
+ }
+}
+'''
+ }
+
+ public void "test import class in qualifier expression"() {
+ myFixture.configureByText 'a.java', '''
+class Test {
+ {
+ equals(Co<caret>llections.emptySet());
+ }
+}
+'''
+ importClass();
+ myFixture.checkResult '''import java.util.Collections;
+
+class Test {
+ {
+ equals(Co<caret>llections.emptySet());
+ }
+}
+'''
+ }
+
+ public void "test don't import class in method call argument"() {
+ myFixture.configureByText 'a.java', '''
+class Test {
+ {
+ equals(Co<caret>llection);
+ }
+}
+'''
+ assert !myFixture.filterAvailableIntentions("Import Class")
+ }
+
+ public void "test don't import class in assignment"() {
+ myFixture.configureByText 'a.java', '''
+class Test {
+ {
+ Co<caret>llection = 2;
+ }
+}
+'''
+ assert !myFixture.filterAvailableIntentions("Import Class")
+ }
+
private def importClass() {
myFixture.launchAction(myFixture.findSingleIntention("Import Class"))
}
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/javadoc/JavaDocInfoGeneratorTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/javadoc/JavaDocInfoGeneratorTest.java
index 454bb7f97a58..8bac921916d3 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/javadoc/JavaDocInfoGeneratorTest.java
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/javadoc/JavaDocInfoGeneratorTest.java
@@ -80,6 +80,10 @@ public class JavaDocInfoGeneratorTest extends CodeInsightTestCase {
doTestField();
}
+ public void testAnnotationsInParams() throws Exception {
+ doTestMethod();
+ }
+
public void testLiteral() throws Exception {
doTestField();
}
@@ -88,6 +92,10 @@ public class JavaDocInfoGeneratorTest extends CodeInsightTestCase {
doTestField();
}
+ public void testPInsidePre() throws Exception {
+ doTestField();
+ }
+
public void testEnumConstantOrdinal() throws Exception {
PsiClass psiClass = getTestClass();
PsiField field = psiClass.getFields() [0];
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/template/LiveTemplateTest.groovy b/java/java-tests/testSrc/com/intellij/codeInsight/template/LiveTemplateTest.groovy
index 3acb9845df66..d866ddd783cf 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/template/LiveTemplateTest.groovy
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/template/LiveTemplateTest.groovy
@@ -797,4 +797,30 @@ class Foo {
}
"""
}
+
+ public void "test two static imports"() {
+ myFixture.configureByText "a.java", """
+
+class Foo {
+ {
+ <caret>
+ }
+}
+"""
+ final TemplateManager manager = TemplateManager.getInstance(getProject());
+ final Template template = manager.createTemplate("xxx", "user", 'java.lang.Math.abs(java.lang.Math.PI);');
+ template.setValue(USE_STATIC_IMPORT_IF_POSSIBLE, true);
+
+ startTemplate(template);
+ myFixture.checkResult """\
+import static java.lang.Math.PI;
+import static java.lang.Math.abs;
+
+class Foo {
+ {
+ abs(PI);<caret>
+ }
+}
+"""
+ }
}
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/template/postfix/templates/CastPostfixTemplateTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/template/postfix/templates/CastPostfixTemplateTest.java
index d5cae6ab30cf..9a50a6b353c5 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/template/postfix/templates/CastPostfixTemplateTest.java
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/template/postfix/templates/CastPostfixTemplateTest.java
@@ -43,4 +43,7 @@ public class CastPostfixTemplateTest extends PostfixTemplateTestCase {
public void testChainCall() {
doTest();
}
+ public void testTernary() {
+ doTest();
+ }
}
diff --git a/java/java-tests/testSrc/com/intellij/codeInspection/ContractInferenceFromSourceTest.groovy b/java/java-tests/testSrc/com/intellij/codeInspection/ContractInferenceFromSourceTest.groovy
index 32982f3687df..23eac589e2db 100644
--- a/java/java-tests/testSrc/com/intellij/codeInspection/ContractInferenceFromSourceTest.groovy
+++ b/java/java-tests/testSrc/com/intellij/codeInspection/ContractInferenceFromSourceTest.groovy
@@ -220,12 +220,74 @@ class ContractInferenceFromSourceTest extends LightCodeInsightFixtureTestCase {
assert c == ['_ -> true']
}
+ public void "test boolean autoboxing"() {
+ def c = inferContracts("""
+ static Object test1(Object o1) {
+ return o1 == null;
+ }""")
+ assert c == []
+ }
+
+ public void "test non-returning delegation"() {
+ def c = inferContracts("""
+ static void test2(Object o) {
+ assertNotNull(o);
+ }
+
+ static boolean assertNotNull(Object o) {
+ if (o == null) {
+ throw new NullPointerException();
+ }
+ return true;
+ }
+ """)
+ assert c == ['null -> fail']
+ }
+
+ public void "test instanceof notnull"() {
+ def c = inferContracts("""
+ public boolean test2(Object o) {
+ if (o != null) {
+ return o instanceof String;
+ } else {
+ return test1(o);
+ }
+ }
+ static boolean test1(Object o1) {
+ return o1 == null;
+ }
+ """)
+ assert c == []
+ }
+
+ public void "test no duplicates in delegation"() {
+ def c = inferContracts("""
+ static boolean test2(Object o1, Object o2) {
+ return test1(o1, o1);
+ }
+ static boolean test1(Object o1, Object o2) {
+ return o1 != null && o2 != null;
+ }
+ """)
+ assert c == ['null, _ -> false', '!null, _ -> true']
+ }
+
+ public void "test take explicit parameter notnull into account"() {
+ def c = inferContracts("""
+ final Object foo(@org.jetbrains.annotations.NotNull Object bar) {
+ if (!(bar instanceof CharSequence)) return null;
+ return new String("abc");
+ }
+ """)
+ assert c == []
+ }
+
private String inferContract(String method) {
return assertOneElement(inferContracts(method))
}
private List<String> inferContracts(String method) {
- def clazz = myFixture.addClass("class Foo { $method }")
+ def clazz = myFixture.addClass("final class Foo { $method }")
return ContractInference.inferContracts(clazz.methods[0]).collect { it as String }
}
}
diff --git a/java/java-tests/testSrc/com/intellij/codeInspection/DataFlowInspectionTest.java b/java/java-tests/testSrc/com/intellij/codeInspection/DataFlowInspectionTest.java
index 833b5196d74a..4cba2ab918a7 100644
--- a/java/java-tests/testSrc/com/intellij/codeInspection/DataFlowInspectionTest.java
+++ b/java/java-tests/testSrc/com/intellij/codeInspection/DataFlowInspectionTest.java
@@ -139,6 +139,12 @@ public class DataFlowInspectionTest extends LightCodeInsightFixtureTestCase {
myFixture.checkResultByFile(getTestName(false) + "_after.java");
}
+ public void testReportConstantReferences_OverloadedCall() {
+ doTestReportConstantReferences();
+ myFixture.launchAction(myFixture.findSingleIntention("Replace with 'null'"));
+ myFixture.checkResultByFile(getTestName(false) + "_after.java");
+ }
+
public void testReportConstantReferencesAfterFinalFieldAccess() { doTestReportConstantReferences(); }
private void doTestReportConstantReferences() {
@@ -148,28 +154,6 @@ public class DataFlowInspectionTest extends LightCodeInsightFixtureTestCase {
myFixture.testHighlighting(true, false, true, getTestName(false) + ".java");
}
- public void _testReportConstantReferences_ReplaceWithString() {
- doTestReportConstantReferences();
- myFixture.launchAction(myFixture.findSingleIntention("Replace with 'CONST'"));
- myFixture.checkResultByFile(getTestName(false) + "_after.java");
- }
- public void _testReportConstantReferences_ReplaceWithIntConstant() {
- doTestReportConstantReferences();
- myFixture.launchAction(myFixture.findSingleIntention("Replace with 'CONST'"));
- myFixture.checkResultByFile(getTestName(false) + "_after.java");
- }
- public void _testReportConstantReferences_ReplaceWithEnum() {
- myFixture.addClass("package foo; public enum MyEnum { FOO }");
- doTestReportConstantReferences();
- myFixture.launchAction(myFixture.findSingleIntention("Replace with 'FOO'"));
- myFixture.checkResultByFile(getTestName(false) + "_after.java");
- }
- public void _testReportConstantReferences_NotInComplexAssignment() {
- doTestReportConstantReferences();
- assertEmpty(myFixture.filterAvailableIntentions("Replace with"));
- }
- public void _testReportConstantReferences_Switch() { doTestReportConstantReferences(); }
-
public void testCheckFieldInitializers() {
doTest();
}
@@ -190,6 +174,7 @@ public class DataFlowInspectionTest extends LightCodeInsightFixtureTestCase {
public void testTransientFinalField() { doTest(); }
public void testFinalFieldDuringInitialization() { doTest(); }
+ public void testFinalFieldDuringSuperInitialization() { doTest(); }
public void _testSymmetricUncheckedCast() { doTest(); } // http://youtrack.jetbrains.com/issue/IDEABKL-6871
public void testNullCheckDoesntAffectUncheckedCast() { doTest(); }
public void testThrowNull() { doTest(); }
@@ -265,6 +250,13 @@ public class DataFlowInspectionTest extends LightCodeInsightFixtureTestCase {
public void testSameComparisonTwice() { doTest(); }
public void testRootThrowableCause() { doTest(); }
+ public void testUseInferredContracts() { doTest(); }
+ public void testContractInferenceBewareOverriding() { doTest(); }
+
+ public void testNumberComparisonsWhenValueIsKnown() { doTest(); }
+
+ public void testAccessingSameArrayElements() { doTest(); }
+
public void testParametersAreNonnullByDefault() {
myFixture.addClass("package javax.annotation; public @interface ParametersAreNonnullByDefault {}");
myFixture.addClass("package javax.annotation; public @interface ParametersAreNullableByDefault {}");
@@ -280,6 +272,29 @@ public class DataFlowInspectionTest extends LightCodeInsightFixtureTestCase {
myFixture.launchAction(myFixture.findSingleIntention("Remove redundant assignment"));
myFixture.checkResultByFile(getTestName(false) + "_after.java");
}
-
+
+ public void testAssertThat() {
+ myFixture.addClass("package org.hamcrest; public class CoreMatchers { " +
+ "public static <T> Matcher<T> notNullValue() {}\n" +
+ "public static <T> Matcher<T> not(Matcher<T> matcher) {}\n" +
+ "public static <T> Matcher<T> equalTo(T operand) {}\n" +
+ "}");
+ myFixture.addClass("package org.hamcrest; public interface Matcher<T> {}");
+ myFixture.addClass("package org.junit; public class Assert { " +
+ "public static <T> void assertThat(T actual, org.hamcrest.Matcher<? super T> matcher) {}\n" +
+ "public static <T> void assertThat(String msg, T actual, org.hamcrest.Matcher<? super T> matcher) {}\n" +
+ "}");
+ myFixture.enableInspections(new DataFlowInspection());
+ myFixture.testHighlighting(true, false, true, getTestName(false) + ".java");
+ }
+
+ public void testGuavaCheckNotNull() {
+ myFixture.addClass("package com.google.common.base; public class Preconditions { " +
+ "public static <T> T checkNotNull(T reference) {}\n" +
+ "}");
+ myFixture.enableInspections(new DataFlowInspection());
+ myFixture.testHighlighting(true, false, true, getTestName(false) + ".java");
+ }
+
public void _testNullCheckBeforeInstanceof() { doTest(); } // http://youtrack.jetbrains.com/issue/IDEA-113220
}
diff --git a/java/java-tests/testSrc/com/intellij/codeInspection/NullableStuffInspectionTest.java b/java/java-tests/testSrc/com/intellij/codeInspection/NullableStuffInspectionTest.java
index 843dcbbb8bfe..e925dd49a8ea 100644
--- a/java/java-tests/testSrc/com/intellij/codeInspection/NullableStuffInspectionTest.java
+++ b/java/java-tests/testSrc/com/intellij/codeInspection/NullableStuffInspectionTest.java
@@ -30,6 +30,8 @@ public class NullableStuffInspectionTest extends LightCodeInsightFixtureTestCase
public void testProblems2() throws Exception{ doTest(); }
public void testNullableFieldNotnullParam() throws Exception{ doTest(); }
public void testNotNullFieldNullableParam() throws Exception{ doTest(); }
+ public void testNotNullCustomException() throws Exception{ doTest(); }
+ public void testNotNullFieldNotInitialized() throws Exception{ doTest(); }
public void testGetterSetterProblems() throws Exception{ doTest(); }
public void testOverriddenMethods() throws Exception{
diff --git a/java/java-tests/testSrc/com/intellij/codeInspection/bytecodeAnalysis/BytecodeAnalysisIntegrationTest.java b/java/java-tests/testSrc/com/intellij/codeInspection/bytecodeAnalysis/BytecodeAnalysisIntegrationTest.java
new file mode 100644
index 000000000000..516b140cc0b1
--- /dev/null
+++ b/java/java-tests/testSrc/com/intellij/codeInspection/bytecodeAnalysis/BytecodeAnalysisIntegrationTest.java
@@ -0,0 +1,177 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.codeInspection.bytecodeAnalysis;
+
+import com.intellij.codeInsight.AnnotationUtil;
+import com.intellij.codeInsight.ExternalAnnotationsManager;
+import com.intellij.codeInsight.InferredAnnotationsManager;
+import com.intellij.openapi.application.ex.PathManagerEx;
+import com.intellij.openapi.projectRoots.Sdk;
+import com.intellij.openapi.projectRoots.SdkModificator;
+import com.intellij.openapi.roots.AnnotationOrderRootType;
+import com.intellij.openapi.roots.ModifiableRootModel;
+import com.intellij.openapi.roots.ModuleRootModificationUtil;
+import com.intellij.openapi.roots.libraries.Library;
+import com.intellij.openapi.roots.libraries.LibraryTable;
+import com.intellij.openapi.vfs.LocalFileSystem;
+import com.intellij.openapi.vfs.VfsUtilCore;
+import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.openapi.vfs.VirtualFileVisitor;
+import com.intellij.psi.*;
+import com.intellij.psi.search.GlobalSearchScope;
+import com.intellij.psi.util.PsiFormatUtil;
+import com.intellij.testFramework.PsiTestUtil;
+import com.intellij.testFramework.fixtures.JavaCodeInsightFixtureTestCase;
+import com.intellij.util.AsynchConsumer;
+import org.jetbrains.annotations.Contract;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author lambdamix
+ */
+public class BytecodeAnalysisIntegrationTest extends JavaCodeInsightFixtureTestCase {
+ public static final String ORG_JETBRAINS_ANNOTATIONS_CONTRACT = Contract.class.getName();
+
+ private InferredAnnotationsManager myInferredAnnotationsManager;
+ private ExternalAnnotationsManager myExternalAnnotationsManager;
+
+ private List<String> diffs = new ArrayList<String>();
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ setUpLibraries();
+ setUpExternalUpAnnotations();
+
+ myInferredAnnotationsManager = InferredAnnotationsManager.getInstance(myModule.getProject());
+ myExternalAnnotationsManager = ExternalAnnotationsManager.getInstance(myModule.getProject());
+ }
+
+ private void setUpLibraries() {
+ VirtualFile lib = LocalFileSystem.getInstance().refreshAndFindFileByPath(PathManagerEx.getTestDataPath() + "/../../../lib");
+ assertNotNull(lib);
+ PsiTestUtil.addLibrary(myModule, "velocity", lib.getPath(), new String[]{"/velocity.jar!/"}, new String[]{});
+ }
+
+ private void setUpExternalUpAnnotations() {
+ String annotationsPath = PathManagerEx.getTestDataPath() + "/codeInspection/bytecodeAnalysis/annotations";
+ final VirtualFile annotationsDir = LocalFileSystem.getInstance().refreshAndFindFileByPath(annotationsPath);
+ assertNotNull(annotationsDir);
+
+ ModuleRootModificationUtil.updateModel(myModule, new AsynchConsumer<ModifiableRootModel>() {
+ @Override
+ public void finished() {
+ }
+
+ @Override
+ public void consume(ModifiableRootModel modifiableRootModel) {
+ final LibraryTable libraryTable = modifiableRootModel.getModuleLibraryTable();
+ Library[] libs = libraryTable.getLibraries();
+ for (Library library : libs) {
+ final Library.ModifiableModel libraryModel = library.getModifiableModel();
+ libraryModel.addRoot(annotationsDir, AnnotationOrderRootType.getInstance());
+ libraryModel.commit();
+ }
+ Sdk sdk = modifiableRootModel.getSdk();
+ if (sdk != null) {
+ SdkModificator sdkModificator = sdk.getSdkModificator();
+ sdkModificator.addRoot(annotationsDir, AnnotationOrderRootType.getInstance());
+ sdkModificator.commitChanges();
+ }
+ }
+ });
+
+ VfsUtilCore.visitChildrenRecursively(annotationsDir, new VirtualFileVisitor() { });
+ annotationsDir.refresh(false, true);
+ }
+
+ public void testSdkAndLibAnnotations() {
+
+ final PsiPackage rootPackage = JavaPsiFacade.getInstance(getProject()).findPackage("");
+ assert rootPackage != null;
+
+ final GlobalSearchScope scope = GlobalSearchScope.allScope(getProject());
+ JavaRecursiveElementVisitor visitor = new JavaRecursiveElementVisitor() {
+ @Override
+ public void visitPackage(PsiPackage aPackage) {
+ for (PsiPackage subPackage : aPackage.getSubPackages(scope)) {
+ visitPackage(subPackage);
+ }
+ for (PsiClass aClass : aPackage.getClasses(scope)) {
+ for (PsiMethod method : aClass.getMethods()) {
+ checkMethodAnnotations(method);
+ }
+ }
+ }
+ };
+
+ rootPackage.accept(visitor);
+ assertEmpty(diffs);
+ }
+
+ private void checkMethodAnnotations(PsiMethod method) {
+ try {
+ if (ProjectBytecodeAnalysis.getKey(method) == -1) {
+ return;
+ }
+ }
+ catch (IOException e) {
+ fail();
+ }
+
+ // not null-result
+ String externalOutAnnotation =
+ myExternalAnnotationsManager.findExternalAnnotation(method, AnnotationUtil.NOT_NULL) == null ? "null" : "@NotNull";
+ String inferredOutAnnotation =
+ myInferredAnnotationsManager.findInferredAnnotation(method, AnnotationUtil.NOT_NULL) == null ? "null" : "@NotNull";
+ String methodKey = PsiFormatUtil.getExternalName(method, false, Integer.MAX_VALUE);
+
+ if (!externalOutAnnotation.equals(inferredOutAnnotation)) {
+ diffs.add(methodKey + ": " + externalOutAnnotation + " != " + inferredOutAnnotation);
+ }
+
+ for (PsiParameter parameter : method.getParameterList().getParameters()) {
+ String parameterKey = PsiFormatUtil.getExternalName(parameter, false, Integer.MAX_VALUE);
+ String externalParameterAnnotation =
+ myExternalAnnotationsManager.findExternalAnnotation(parameter, AnnotationUtil.NOT_NULL) == null ? "null" : "@NotNull";
+ String inferredParameterAnnotation =
+ myInferredAnnotationsManager.findInferredAnnotation(parameter, AnnotationUtil.NOT_NULL) == null ? "null" : "@NotNull";
+ if (!externalParameterAnnotation.equals(inferredParameterAnnotation)) {
+ diffs.add(parameterKey + ": " + externalParameterAnnotation + " != " + inferredParameterAnnotation);
+ }
+ }
+
+ PsiAnnotation externalContractAnnotation =
+ myExternalAnnotationsManager.findExternalAnnotation(method, ORG_JETBRAINS_ANNOTATIONS_CONTRACT);
+ PsiAnnotation inferredContractAnnotation =
+ myInferredAnnotationsManager.findInferredAnnotation(method, ORG_JETBRAINS_ANNOTATIONS_CONTRACT);
+
+ String externalContractAnnotationString =
+ externalContractAnnotation == null ? "null" : "@Contract(" + AnnotationUtil.getStringAttributeValue(externalContractAnnotation, null) + ")";
+ String inferredContractAnnotationString =
+ inferredContractAnnotation == null ? "null" : "@Contract(" + AnnotationUtil.getStringAttributeValue(inferredContractAnnotation, null) + ")";
+
+ if (!externalContractAnnotationString.equals(inferredContractAnnotationString)) {
+ diffs.add(methodKey + ": " + externalContractAnnotationString + " != " + inferredContractAnnotationString);
+ }
+
+ }
+
+}
diff --git a/java/java-tests/testSrc/com/intellij/codeInspection/bytecodeAnalysis/BytecodeAnalysisResultsHighlightingTest.java b/java/java-tests/testSrc/com/intellij/codeInspection/bytecodeAnalysis/BytecodeAnalysisResultsHighlightingTest.java
new file mode 100644
index 000000000000..dc67871e6283
--- /dev/null
+++ b/java/java-tests/testSrc/com/intellij/codeInspection/bytecodeAnalysis/BytecodeAnalysisResultsHighlightingTest.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.codeInspection.bytecodeAnalysis;
+
+import com.intellij.JavaTestUtil;
+import com.intellij.codeInspection.dataFlow.DataFlowInspection;
+import com.intellij.openapi.application.ex.PathManagerEx;
+import com.intellij.openapi.vfs.LocalFileSystem;
+import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.testFramework.LightProjectDescriptor;
+import com.intellij.testFramework.PsiTestUtil;
+import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * @author lambdamix
+ */
+public class BytecodeAnalysisResultsHighlightingTest extends LightCodeInsightFixtureTestCase {
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ setUpLibraries();
+ }
+
+ @NotNull
+ @Override
+ protected LightProjectDescriptor getProjectDescriptor() {
+ return JAVA_1_7;
+ }
+
+ @Override
+ protected String getTestDataPath() {
+ return JavaTestUtil.getJavaTestDataPath() + "/codeInspection/bytecodeAnalysis/src/";
+ }
+
+ private void doTest() {
+ final DataFlowInspection inspection = new DataFlowInspection();
+ inspection.SUGGEST_NULLABLE_ANNOTATIONS = true;
+ inspection.REPORT_CONSTANT_REFERENCE_VALUES = false;
+ myFixture.enableInspections(inspection);
+ myFixture.testHighlighting(true, false, true, getTestName(false) + ".java");
+ }
+
+ public void testExample() {
+ doTest();
+ }
+
+ private void setUpLibraries() {
+ VirtualFile lib = LocalFileSystem.getInstance().refreshAndFindFileByPath(PathManagerEx.getTestDataPath() + "/../../../lib");
+ assertNotNull(lib);
+ PsiTestUtil.addLibrary(myModule, "velocity", lib.getPath(), new String[]{"/velocity.jar!/"}, new String[]{});
+ }
+}
diff --git a/java/java-tests/testSrc/com/intellij/codeInspection/bytecodeAnalysis/BytecodeAnalysisTest.java b/java/java-tests/testSrc/com/intellij/codeInspection/bytecodeAnalysis/BytecodeAnalysisTest.java
new file mode 100644
index 000000000000..09fa87fa95e9
--- /dev/null
+++ b/java/java-tests/testSrc/com/intellij/codeInspection/bytecodeAnalysis/BytecodeAnalysisTest.java
@@ -0,0 +1,209 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.codeInspection.bytecodeAnalysis;
+
+import com.intellij.codeInsight.AnnotationUtil;
+import com.intellij.codeInsight.InferredAnnotationsManager;
+import com.intellij.codeInspection.bytecodeAnalysis.data.*;
+import com.intellij.openapi.util.io.FileUtil;
+import com.intellij.openapi.vfs.LocalFileSystem;
+import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.psi.*;
+import com.intellij.psi.search.GlobalSearchScope;
+import com.intellij.testFramework.PsiTestUtil;
+import com.intellij.testFramework.fixtures.JavaCodeInsightFixtureTestCase;
+import com.intellij.util.ArrayUtil;
+import org.jetbrains.annotations.Contract;
+import org.jetbrains.org.objectweb.asm.*;
+import org.jetbrains.org.objectweb.asm.tree.MethodNode;
+import org.jetbrains.org.objectweb.asm.tree.analysis.AnalyzerException;
+import org.junit.Assert;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Constructor;
+import java.util.HashMap;
+
+/**
+ * @author lambdamix
+ */
+public class BytecodeAnalysisTest extends JavaCodeInsightFixtureTestCase {
+ public static final String ORG_JETBRAINS_ANNOTATIONS_CONTRACT = Contract.class.getName();
+ private final String myClassesProjectRelativePath = "/classes/" + Test01.class.getPackage().getName().replace('.', '/');
+ private JavaPsiFacade myJavaPsiFacade;
+ private InferredAnnotationsManager myInferredAnnotationsManager;
+ private BytecodeAnalysisConverter myBytecodeAnalysisConverter;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ myJavaPsiFacade = JavaPsiFacade.getInstance(myModule.getProject());
+ myInferredAnnotationsManager = InferredAnnotationsManager.getInstance(myModule.getProject());
+ myBytecodeAnalysisConverter = BytecodeAnalysisConverter.getInstance();
+
+ setUpDataClasses();
+ }
+
+ public void testInference() throws IOException {
+ checkAnnotations(Test01.class);
+ checkAnnotations(Test02.class);
+ checkAnnotations(Test03.class);
+ }
+
+ public void testConverter() throws IOException {
+ checkCompoundIds(Test01.class);
+ checkCompoundIds(TestConverterData.class);
+ checkCompoundIds(TestConverterData.StaticNestedClass.class);
+ checkCompoundIds(TestConverterData.InnerClass.class);
+ checkCompoundIds(TestConverterData.GenericStaticNestedClass.class);
+ checkCompoundIds(TestAnnotation.class);
+ }
+
+ public void testLeakingParametersAnalysis() throws IOException {
+ checkLeakingParameters(LeakingParametersData.class);
+ }
+
+ private static void checkLeakingParameters(Class<?> jClass) throws IOException {
+ final HashMap<Method, boolean[]> map = new HashMap<Method, boolean[]>();
+
+ // collecting leakedParameters
+ final ClassReader classReader = new ClassReader(new FileInputStream(jClass.getResource("/" + jClass.getName().replace('.', '/') + ".class").getFile()));
+ classReader.accept(new ClassVisitor(Opcodes.ASM5) {
+ @Override
+ public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
+ final MethodNode node = new MethodNode(Opcodes.ASM5, access, name, desc, signature, exceptions);
+ final Method method = new Method(classReader.getClassName(), name, desc);
+ return new MethodVisitor(Opcodes.ASM5, node) {
+ @Override
+ public void visitEnd() {
+ super.visitEnd();
+ try {
+ map.put(method, cfg.leakingParameters(classReader.getClassName(), node));
+ }
+ catch (AnalyzerException ignore) {}
+ }
+ };
+ }
+ }, ClassReader.SKIP_DEBUG | ClassReader.SKIP_FRAMES);
+
+ for (java.lang.reflect.Method jMethod : jClass.getDeclaredMethods()) {
+ Method method = new Method(Type.getType(jClass).getInternalName(), jMethod.getName(), Type.getMethodDescriptor(jMethod));
+ Annotation[][] annotations = jMethod.getParameterAnnotations();
+ for (int i = 0; i < annotations.length; i++) {
+ boolean isLeaking = false;
+ Annotation[] parameterAnnotations = annotations[i];
+ for (Annotation parameterAnnotation : parameterAnnotations) {
+ if (parameterAnnotation.annotationType() == ExpectLeaking.class) {
+ isLeaking = true;
+ }
+ }
+ assertEquals(method.toString() + " #" + i, isLeaking, map.get(method)[i]);
+ }
+ }
+ }
+
+ private void checkAnnotations(Class<?> javaClass) {
+ PsiClass psiClass = myJavaPsiFacade.findClass(javaClass.getName(), GlobalSearchScope.moduleWithLibrariesScope(myModule));
+ assertNotNull(psiClass);
+
+ for (java.lang.reflect.Method javaMethod : javaClass.getDeclaredMethods()) {
+ PsiMethod psiMethod = psiClass.findMethodsByName(javaMethod.getName(), false)[0];
+ Annotation[][] annotations = javaMethod.getParameterAnnotations();
+
+ // not-null parameters
+ params: for (int i = 0; i < annotations.length; i++) {
+ Annotation[] parameterAnnotations = annotations[i];
+ PsiParameter psiParameter = psiMethod.getParameterList().getParameters()[i];
+ PsiAnnotation inferredAnnotation = myInferredAnnotationsManager.findInferredAnnotation(psiParameter, AnnotationUtil.NOT_NULL);
+ for (Annotation parameterAnnotation : parameterAnnotations) {
+ if (parameterAnnotation.annotationType() == ExpectNotNull.class) {
+ assertNotNull(javaMethod.toString() + " " + i, inferredAnnotation);
+ continue params;
+ }
+ }
+ assertNull(javaMethod.toString() + " " + i, inferredAnnotation);
+ }
+
+ // not-null result
+ ExpectNotNull expectedAnnotation = javaMethod.getAnnotation(ExpectNotNull.class);
+ PsiAnnotation actualAnnotation = myInferredAnnotationsManager.findInferredAnnotation(psiMethod, AnnotationUtil.NOT_NULL);
+ assertEquals(javaMethod.toString(), expectedAnnotation == null, actualAnnotation == null);
+
+
+ // contracts
+ ExpectContract expectedContract = javaMethod.getAnnotation(ExpectContract.class);
+ PsiAnnotation actualContractAnnotation = myInferredAnnotationsManager.findInferredAnnotation(psiMethod, ORG_JETBRAINS_ANNOTATIONS_CONTRACT);
+
+ assertEquals(expectedContract == null, actualContractAnnotation == null);
+
+ if (expectedContract != null) {
+ String expectedContractValue = expectedContract.value();
+ String actualContractValue = AnnotationUtil.getStringAttributeValue(actualContractAnnotation, null);
+ assertEquals(javaMethod.toString(), expectedContractValue, actualContractValue);
+ }
+
+ }
+ }
+
+ private void checkCompoundIds(Class<?> javaClass) throws IOException {
+ String javaClassName = javaClass.getCanonicalName();
+ PsiClass psiClass = myJavaPsiFacade.findClass(javaClassName, GlobalSearchScope.moduleWithLibrariesScope(myModule));
+ assertNotNull(psiClass);
+
+ for (java.lang.reflect.Method javaMethod : javaClass.getDeclaredMethods()) {
+ Method method = new Method(Type.getType(javaClass).getInternalName(), javaMethod.getName(), Type.getMethodDescriptor(javaMethod));
+ boolean noKey = javaMethod.getAnnotation(ExpectNoPsiKey.class) != null;
+ PsiMethod psiMethod = psiClass.findMethodsByName(javaMethod.getName(), false)[0];
+ checkCompoundId(method, psiMethod, noKey);
+ }
+
+ for (Constructor<?> constructor : javaClass.getDeclaredConstructors()) {
+ Method method = new Method(Type.getType(javaClass).getInternalName(), "<init>", Type.getConstructorDescriptor(constructor));
+ boolean noKey = constructor.getAnnotation(ExpectNoPsiKey.class) != null;
+ PsiMethod[] constructors = psiClass.getConstructors();
+ PsiMethod psiMethod = constructors[0];
+ checkCompoundId(method, psiMethod, noKey);
+ }
+ }
+
+ private void checkCompoundId(Method method, PsiMethod psiMethod, boolean noKey) throws IOException {
+ Direction direction = new Out();
+ int psiKey = myBytecodeAnalysisConverter.mkPsiKey(psiMethod, direction);
+ if (noKey) {
+ assertTrue(-1 == psiKey);
+ return;
+ }
+ else {
+ assertFalse(-1 == psiKey);
+ }
+
+ int asmKey = myBytecodeAnalysisConverter.mkAsmKey(new Key(method, direction, true));
+
+ Assert.assertEquals(asmKey, psiKey);
+ }
+
+ private void setUpDataClasses() throws IOException {
+ File classesDir = new File(Test01.class.getResource("/" + Test01.class.getPackage().getName().replace('.', '/')).getFile());
+ File destDir = new File(myModule.getProject().getBaseDir().getPath() + myClassesProjectRelativePath);
+ FileUtil.copyDir(classesDir, destDir);
+ VirtualFile vFile = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(destDir);
+ assertNotNull(vFile);
+ PsiTestUtil.addLibrary(myModule, "dataClasses", vFile.getPath(), new String[]{""}, ArrayUtil.EMPTY_STRING_ARRAY);
+ }
+
+}
diff --git a/java/java-tests/testSrc/com/intellij/codeInspection/bytecodeAnalysis/ExpectContract.java b/java/java-tests/testSrc/com/intellij/codeInspection/bytecodeAnalysis/ExpectContract.java
new file mode 100644
index 000000000000..9b78f742eb9c
--- /dev/null
+++ b/java/java-tests/testSrc/com/intellij/codeInspection/bytecodeAnalysis/ExpectContract.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.codeInspection.bytecodeAnalysis;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * @author lambdamix
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.METHOD)
+public @interface ExpectContract {
+ String value() default "";
+}
diff --git a/java/java-tests/testSrc/com/intellij/codeInspection/bytecodeAnalysis/ExpectLeaking.java b/java/java-tests/testSrc/com/intellij/codeInspection/bytecodeAnalysis/ExpectLeaking.java
new file mode 100644
index 000000000000..3c5ded3427ba
--- /dev/null
+++ b/java/java-tests/testSrc/com/intellij/codeInspection/bytecodeAnalysis/ExpectLeaking.java
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.codeInspection.bytecodeAnalysis;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * @author lambdamix
+ */
+@Retention(RetentionPolicy.RUNTIME)
+public @interface ExpectLeaking {
+}
diff --git a/java/java-tests/testSrc/com/intellij/codeInspection/bytecodeAnalysis/ExpectNoPsiKey.java b/java/java-tests/testSrc/com/intellij/codeInspection/bytecodeAnalysis/ExpectNoPsiKey.java
new file mode 100644
index 000000000000..dde06c0f153b
--- /dev/null
+++ b/java/java-tests/testSrc/com/intellij/codeInspection/bytecodeAnalysis/ExpectNoPsiKey.java
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.codeInspection.bytecodeAnalysis;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * @author lambdamix
+ */
+@Retention(RetentionPolicy.RUNTIME)
+public @interface ExpectNoPsiKey {
+}
diff --git a/java/java-tests/testSrc/com/intellij/codeInspection/bytecodeAnalysis/ExpectNotNull.java b/java/java-tests/testSrc/com/intellij/codeInspection/bytecodeAnalysis/ExpectNotNull.java
new file mode 100644
index 000000000000..39f1c6e7f363
--- /dev/null
+++ b/java/java-tests/testSrc/com/intellij/codeInspection/bytecodeAnalysis/ExpectNotNull.java
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.codeInspection.bytecodeAnalysis;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * @author lambdamix
+ */
+@Retention(RetentionPolicy.RUNTIME)
+public @interface ExpectNotNull {
+}
diff --git a/java/java-tests/testSrc/com/intellij/codeInspection/bytecodeAnalysis/data/LeakingParametersData.java b/java/java-tests/testSrc/com/intellij/codeInspection/bytecodeAnalysis/data/LeakingParametersData.java
new file mode 100644
index 000000000000..ff5887ff2dbb
--- /dev/null
+++ b/java/java-tests/testSrc/com/intellij/codeInspection/bytecodeAnalysis/data/LeakingParametersData.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.codeInspection.bytecodeAnalysis.data;
+
+import com.intellij.codeInspection.bytecodeAnalysis.ExpectLeaking;
+
+/**
+ * @author lambdamix
+ */
+public class LeakingParametersData {
+ int z;
+
+ void test01(@ExpectLeaking Object o1, @ExpectLeaking Object o2, @ExpectLeaking Object o3) {
+ o1.toString();
+ o2.toString();
+ o3.toString();
+ }
+
+ void test02(@ExpectLeaking LeakingParametersData d) {
+ System.out.println(d.z);
+ }
+
+ void test03(int i, @ExpectLeaking LeakingParametersData d) {
+ System.out.println(d.z);
+ }
+
+ void test04(long i, @ExpectLeaking LeakingParametersData d) {
+ System.out.println(d.z);
+ }
+}
diff --git a/java/java-tests/testSrc/com/intellij/codeInspection/bytecodeAnalysis/data/Test01.java b/java/java-tests/testSrc/com/intellij/codeInspection/bytecodeAnalysis/data/Test01.java
new file mode 100644
index 000000000000..1b90bb640b39
--- /dev/null
+++ b/java/java-tests/testSrc/com/intellij/codeInspection/bytecodeAnalysis/data/Test01.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.codeInspection.bytecodeAnalysis.data;
+
+import com.intellij.codeInspection.bytecodeAnalysis.ExpectContract;
+import com.intellij.codeInspection.bytecodeAnalysis.ExpectNotNull;
+
+/**
+ * @author lambdamix
+ */
+public class Test01 {
+ static void f(@ExpectNotNull Object o1, @ExpectNotNull Object o2) {
+ if (o1 == null) throw new NullPointerException();
+ else s(o2, o2);
+ }
+
+ static void g(@ExpectNotNull Object o, boolean b) {
+ if (b) f(o, o);
+ else s(o, o);
+ }
+
+ static void s(@ExpectNotNull Object o1, Object o2) {
+ t(o1);
+ v(o2);
+ }
+
+ static void t(@ExpectNotNull Object o) {
+ o.toString();
+ }
+
+ static void v(Object o) {
+
+ }
+
+ @ExpectContract("null->null")
+ static String toString1(Object o) {
+ return o == null ? null : o.toString();
+ }
+
+ @ExpectContract("null->!null")
+ static String toString2(Object o) {
+ return o == null ? "null" : o.toString();
+ }
+
+ @ExpectNotNull
+ static String constantString() {
+ return "s";
+ }
+
+ @ExpectContract("!null->!null;null->null")
+ static String idString(String s) {
+ return s;
+ }
+
+ @ExpectNotNull
+ public Test01 getThis() {
+ return this;
+ }
+
+ @ExpectNotNull
+ protected Test01 createRoot() {
+ return new Test01();
+ }
+
+}
diff --git a/java/java-tests/testSrc/com/intellij/codeInspection/bytecodeAnalysis/data/Test02.java b/java/java-tests/testSrc/com/intellij/codeInspection/bytecodeAnalysis/data/Test02.java
new file mode 100644
index 000000000000..f794ff23009b
--- /dev/null
+++ b/java/java-tests/testSrc/com/intellij/codeInspection/bytecodeAnalysis/data/Test02.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.codeInspection.bytecodeAnalysis.data;
+
+import com.intellij.codeInspection.bytecodeAnalysis.ExpectNotNull;
+
+/**
+ * @author lambdamix
+ */
+public final class Test02 {
+ @ExpectNotNull
+ public String notNullString() {
+ return "";
+ }
+
+ @ExpectNotNull
+ public String notNullStringDelegate() {
+ return notNullString();
+ }
+}
diff --git a/java/java-tests/testSrc/com/intellij/codeInspection/bytecodeAnalysis/data/Test03.java b/java/java-tests/testSrc/com/intellij/codeInspection/bytecodeAnalysis/data/Test03.java
new file mode 100644
index 000000000000..97903933190e
--- /dev/null
+++ b/java/java-tests/testSrc/com/intellij/codeInspection/bytecodeAnalysis/data/Test03.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.codeInspection.bytecodeAnalysis.data;
+
+import com.intellij.codeInspection.bytecodeAnalysis.ExpectNotNull;
+
+/**
+ * @author lambdamix
+ */
+public class Test03 {
+
+ public String toString1() {
+ return toString();
+ }
+
+ @Override
+ @ExpectNotNull
+ public String toString() {
+ return "";
+ }
+}
diff --git a/java/java-tests/testSrc/com/intellij/codeInspection/bytecodeAnalysis/data/TestAnnotation.java b/java/java-tests/testSrc/com/intellij/codeInspection/bytecodeAnalysis/data/TestAnnotation.java
new file mode 100644
index 000000000000..cfe55ff5cd28
--- /dev/null
+++ b/java/java-tests/testSrc/com/intellij/codeInspection/bytecodeAnalysis/data/TestAnnotation.java
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.codeInspection.bytecodeAnalysis.data;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * @author lambdamix
+ */
+@Retention(RetentionPolicy.RUNTIME)
+public @interface TestAnnotation {
+}
diff --git a/java/java-tests/testSrc/com/intellij/codeInspection/bytecodeAnalysis/data/TestConverterData.java b/java/java-tests/testSrc/com/intellij/codeInspection/bytecodeAnalysis/data/TestConverterData.java
new file mode 100644
index 000000000000..254db418e55c
--- /dev/null
+++ b/java/java-tests/testSrc/com/intellij/codeInspection/bytecodeAnalysis/data/TestConverterData.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.codeInspection.bytecodeAnalysis.data;
+
+import com.intellij.codeInspection.bytecodeAnalysis.BytecodeAnalysisConverter;
+import com.intellij.codeInspection.bytecodeAnalysis.ExpectNoPsiKey;
+
+/**
+ * @author lambdamix
+ */
+public class TestConverterData {
+
+ public static class StaticNestedClass {
+ public StaticNestedClass(Object o) {
+
+ }
+ public StaticNestedClass[] test01(StaticNestedClass[] ns, StaticNestedClass... ellipsis) {
+ return ns;
+ }
+ }
+
+ public class InnerClass {
+ // a reference to outer class should be inserted when translating PSI -> ASM
+ public InnerClass(Object o) {}
+
+ public InnerClass[] Inner2test01(InnerClass[] tests, InnerClass... ellipsis) {
+ return tests;
+ }
+ }
+
+ public static class GenericStaticNestedClass<A> {
+ public GenericStaticNestedClass(A a) {
+
+ }
+ public GenericStaticNestedClass[] test01(GenericStaticNestedClass[] ns, GenericStaticNestedClass... ellipsis) {
+ return ns;
+ }
+
+ public GenericStaticNestedClass<A>[] test02(GenericStaticNestedClass<A>[] ns, GenericStaticNestedClass<A>... ellipsis) {
+ return ns;
+ }
+
+ public class GenericInnerClass<B> {
+ public GenericInnerClass(B b) {}
+
+ public <C> GenericStaticNestedClass<A> test01(GenericInnerClass<C> c) {
+ return GenericStaticNestedClass.this;
+ }
+ }
+ }
+
+ public TestConverterData(int x) {}
+
+ // BytecodeAnalysisConverter class is not in the project path, so translation from PSI is impossible
+ @ExpectNoPsiKey
+ public BytecodeAnalysisConverter test01(BytecodeAnalysisConverter converter) {
+ return converter;
+ }
+
+ @TestAnnotation
+ public TestConverterData[] test02(@TestAnnotation TestConverterData[] tests) throws Exception {
+ return tests;
+ }
+
+ public boolean[] test03(boolean[] b) {
+ return b;
+ }
+}
diff --git a/java/java-tests/testSrc/com/intellij/compiler/notNullVerification/NotNullVerifyingInstrumenterTest.java b/java/java-tests/testSrc/com/intellij/compiler/notNullVerification/NotNullVerifyingInstrumenterTest.java
index 498a1172fa9a..e9d1da3aaf18 100644
--- a/java/java-tests/testSrc/com/intellij/compiler/notNullVerification/NotNullVerifyingInstrumenterTest.java
+++ b/java/java-tests/testSrc/com/intellij/compiler/notNullVerification/NotNullVerifyingInstrumenterTest.java
@@ -67,48 +67,48 @@ public class NotNullVerifyingInstrumenterTest extends UsefulTestCase {
}
public void testSimpleReturn() throws Exception {
- Class testClass = prepareTest();
+ Class<?> testClass = prepareTest();
Object instance = testClass.newInstance();
Method method = testClass.getMethod("test");
verifyCallThrowsException("@NotNull method SimpleReturn.test must not return null", instance, method);
}
public void testSimpleReturnWithMessage() throws Exception {
- Class testClass = prepareTest();
+ Class<?> testClass = prepareTest();
Object instance = testClass.newInstance();
Method method = testClass.getMethod("test");
verifyCallThrowsException("This method cannot return null", instance, method);
}
public void testMultipleReturns() throws Exception {
- Class testClass = prepareTest();
+ Class<?> testClass = prepareTest();
Object instance = testClass.newInstance();
Method method = testClass.getMethod("test", int.class);
verifyCallThrowsException("@NotNull method MultipleReturns.test must not return null", instance, method, 1);
}
public void testSimpleParam() throws Exception {
- Class testClass = prepareTest();
+ Class<?> testClass = prepareTest();
Object instance = testClass.newInstance();
Method method = testClass.getMethod("test", Object.class);
verifyCallThrowsException("Argument 0 for @NotNull parameter of SimpleParam.test must not be null", instance, method, (Object)null);
}
public void testSimpleParamWithMessage() throws Exception {
- Class testClass = prepareTest();
+ Class<?> testClass = prepareTest();
Object instance = testClass.newInstance();
Method method = testClass.getMethod("test", Object.class);
verifyCallThrowsException("SimpleParamWithMessage.test(o) cant be null", instance, method, (Object)null);
}
public void testConstructorParam() throws Exception {
- Class testClass = prepareTest();
+ Class<?> testClass = prepareTest();
Constructor method = testClass.getConstructor(Object.class);
verifyCallThrowsException("Argument 0 for @NotNull parameter of ConstructorParam.<init> must not be null", null, method, (Object)null);
}
public void testConstructorParamWithMessage() throws Exception {
- Class testClass = prepareTest();
+ Class<?> testClass = prepareTest();
Constructor method = testClass.getConstructor(Object.class);
verifyCallThrowsException("ConstructorParam.ConstructorParam.o cant be null", null, method, (Object)null);
}
@@ -132,6 +132,19 @@ public class NotNullVerifyingInstrumenterTest extends UsefulTestCase {
assertNotNull(field);
}
+ public void testCustomExceptionType() throws Exception {
+ Class<?> testClass = prepareTest();
+ try {
+ testClass.getMethod("foo", Object.class, Object.class).invoke(testClass.newInstance(), null, null);
+ fail();
+ }
+ catch (InvocationTargetException e) {
+ //noinspection ThrowableResultOfMethodCallIgnored
+ assertInstanceOf(e.getCause(), NullPointerException.class);
+ assertEquals("Argument 1 for @NotNull parameter of CustomExceptionType.foo must not be null", e.getCause().getMessage());
+ }
+ }
+
public void testEnumConstructorSecondParam() throws Exception {
Class testClass = prepareTest();
Object field = testClass.getField("Value");
diff --git a/java/java-tests/testSrc/com/intellij/find/FindInEditorMultiCaretTest.java b/java/java-tests/testSrc/com/intellij/find/FindInEditorMultiCaretTest.java
new file mode 100644
index 000000000000..02f8c589c43b
--- /dev/null
+++ b/java/java-tests/testSrc/com/intellij/find/FindInEditorMultiCaretTest.java
@@ -0,0 +1,222 @@
+/*
+ * Copyright 2000-2014 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.find;
+
+import com.intellij.find.editorHeaderActions.*;
+import com.intellij.openapi.actionSystem.ActionPlaces;
+import com.intellij.openapi.actionSystem.AnActionEvent;
+import com.intellij.openapi.actionSystem.IdeActions;
+import com.intellij.openapi.util.Getter;
+import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase;
+
+import javax.swing.text.JTextComponent;
+import java.io.IOException;
+
+public class FindInEditorMultiCaretTest extends LightPlatformCodeInsightFixtureTestCase {
+ public void testBasic() throws IOException {
+ init("abc\n" +
+ "abc\n" +
+ "abc");
+ initFind();
+ setTextToFind("b");
+ checkResultByText("a<selection>b<caret></selection>c\n" +
+ "abc\n" +
+ "abc");
+ addOccurrence();
+ checkResultByText("a<selection>b<caret></selection>c\n" +
+ "a<selection>b<caret></selection>c\n" +
+ "abc");
+ nextOccurrence();
+ checkResultByText("a<selection>b<caret></selection>c\n" +
+ "abc\n" +
+ "a<selection>b<caret></selection>c");
+ prevOccurrence();
+ checkResultByText("a<selection>b<caret></selection>c\n" +
+ "a<selection>b<caret></selection>c\n" +
+ "abc");
+ removeOccurrence();
+ checkResultByText("a<selection>b<caret></selection>c\n" +
+ "abc\n" +
+ "abc");
+ allOccurrences();
+ checkResultByText("a<selection>b<caret></selection>c\n" +
+ "a<selection>b<caret></selection>c\n" +
+ "a<selection>b<caret></selection>c");
+ assertNull(getEditorSearchComponent());
+ }
+
+ public void testActionsWorkFromEditor() throws IOException {
+ init("abc\n" +
+ "abc\n" +
+ "abc");
+ initFind();
+ setTextToFind("b");
+ checkResultByText("a<selection>b<caret></selection>c\n" +
+ "abc\n" +
+ "abc");
+ addOccurrenceFromEditor();
+ checkResultByText("a<selection>b<caret></selection>c\n" +
+ "a<selection>b<caret></selection>c\n" +
+ "abc");
+ nextOccurrenceFromEditor();
+ checkResultByText("a<selection>b<caret></selection>c\n" +
+ "abc\n" +
+ "a<selection>b<caret></selection>c");
+ prevOccurrenceFromEditor();
+ checkResultByText("a<selection>b<caret></selection>c\n" +
+ "a<selection>b<caret></selection>c\n" +
+ "abc");
+ removeOccurrenceFromEditor();
+ checkResultByText("a<selection>b<caret></selection>c\n" +
+ "abc\n" +
+ "abc");
+ allOccurrencesFromEditor();
+ checkResultByText("a<selection>b<caret></selection>c\n" +
+ "a<selection>b<caret></selection>c\n" +
+ "a<selection>b<caret></selection>c");
+ assertNull(getEditorSearchComponent());
+ }
+
+ public void testCloseRetainsMulticaretSelection() throws IOException {
+ init("abc\n" +
+ "abc\n" +
+ "abc");
+ initFind();
+ setTextToFind("b");
+ addOccurrence();
+ closeFind();
+ checkResultByText("a<selection>b<caret></selection>c\n" +
+ "a<selection>b<caret></selection>c\n" +
+ "abc");
+ }
+
+ public void testTextModificationRemovesOldSelections() throws IOException {
+ init("abc\n" +
+ "abc\n" +
+ "abc");
+ initFind();
+ setTextToFind("b");
+ addOccurrence();
+ setTextToFind("bc");
+
+ assertEquals(1, myFixture.getEditor().getCaretModel().getCaretCount());
+ assertEquals("bc", myFixture.getEditor().getSelectionModel().getSelectedText());
+ }
+
+ public void testSecondFindNavigatesToTheSameOccurrence() throws IOException {
+ init("ab<caret>c\n" +
+ "abc\n" +
+ "abc");
+ initFind();
+ setTextToFind("abc");
+ checkResultByText("abc\n" +
+ "<selection>abc<caret></selection>\n" +
+ "abc");
+ closeFind();
+ initFind();
+ setTextToFind("abc");
+ checkResultByText("abc\n" +
+ "<selection>abc<caret></selection>\n" +
+ "abc");
+ }
+
+ private void setTextToFind(String text) {
+ EditorSearchComponent editorSearchComponent = getEditorSearchComponent();
+ assertNotNull(editorSearchComponent);
+ JTextComponent searchField = editorSearchComponent.getSearchField();
+ assertNotNull(searchField);
+ for (int i = 0; i <= text.length(); i++) {
+ searchField.setText(text.substring(0, i)); // emulate typing chars one by one
+ }
+ }
+
+ private void nextOccurrence() {
+ final EditorSearchComponent editorSearchComponent = getEditorSearchComponent();
+ executeAction(new NextOccurrenceAction(editorSearchComponent, new Getter<JTextComponent>() {
+ @Override
+ public JTextComponent get() {
+ return editorSearchComponent.getSearchField();
+ }
+ }));
+ }
+
+ private void prevOccurrence() {
+ final EditorSearchComponent editorSearchComponent = getEditorSearchComponent();
+ executeAction(new PrevOccurrenceAction(editorSearchComponent, new Getter<JTextComponent>() {
+ @Override
+ public JTextComponent get() {
+ return editorSearchComponent.getSearchField();
+ }
+ }));
+ }
+
+ private void addOccurrence() {
+ executeAction(new AddOccurrenceAction(getEditorSearchComponent()));
+ }
+
+ private void removeOccurrence() {
+ executeAction(new RemoveOccurrenceAction(getEditorSearchComponent()));
+ }
+
+ private void allOccurrences() {
+ executeAction(new SelectAllAction(getEditorSearchComponent()));
+ }
+
+ private void nextOccurrenceFromEditor() {
+ myFixture.performEditorAction(IdeActions.ACTION_FIND_NEXT);
+ }
+
+ private void prevOccurrenceFromEditor() {
+ myFixture.performEditorAction(IdeActions.ACTION_FIND_PREVIOUS);
+ }
+
+ private void addOccurrenceFromEditor() {
+ myFixture.performEditorAction(IdeActions.ACTION_SELECT_NEXT_OCCURENCE);
+ }
+
+ private void removeOccurrenceFromEditor() {
+ myFixture.performEditorAction(IdeActions.ACTION_UNSELECT_PREVIOUS_OCCURENCE);
+ }
+
+ private void allOccurrencesFromEditor() {
+ myFixture.performEditorAction(IdeActions.ACTION_SELECT_ALL_OCCURRENCES);
+ }
+
+ private void closeFind() {
+ EditorSearchComponent editorSearchComponent = getEditorSearchComponent();
+ executeAction(new CloseOnESCAction(editorSearchComponent, editorSearchComponent.getSearchField()));
+ }
+
+ private static void executeAction(EditorHeaderAction action) {
+ action.actionPerformed(AnActionEvent.createFromInputEvent(action, null, ActionPlaces.EDITOR_TOOLBAR));
+ }
+
+ private void initFind() {
+ myFixture.performEditorAction("Find");
+ }
+
+ private EditorSearchComponent getEditorSearchComponent() {
+ return (EditorSearchComponent)myFixture.getEditor().getHeaderComponent();
+ }
+
+ private void init(String text) {
+ myFixture.configureByText(getTestName(false) + ".txt", text);
+ }
+
+ private void checkResultByText(String text) {
+ myFixture.checkResult(text);
+ }
+}
diff --git a/java/java-tests/testSrc/com/intellij/find/FindInEditorTest.java b/java/java-tests/testSrc/com/intellij/find/FindInEditorTest.java
index cfe9cdde2273..043c755f8ca9 100644
--- a/java/java-tests/testSrc/com/intellij/find/FindInEditorTest.java
+++ b/java/java-tests/testSrc/com/intellij/find/FindInEditorTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -15,10 +15,14 @@
*/
package com.intellij.find;
+import com.intellij.codeInsight.hint.EditorHintListener;
import com.intellij.find.impl.livePreview.LivePreview;
import com.intellij.find.impl.livePreview.LivePreviewController;
import com.intellij.find.impl.livePreview.SearchResults;
+import com.intellij.openapi.application.ApplicationManager;
+import com.intellij.openapi.project.Project;
import com.intellij.testFramework.LightCodeInsightTestCase;
+import com.intellij.ui.LightweightHint;
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
@@ -39,6 +43,13 @@ public class FindInEditorTest extends LightCodeInsightTestCase {
myOutputStream = new ByteArrayOutputStream();
LivePreview.ourTestOutput = new PrintStream(myOutputStream);
+ EditorHintListener listener = new EditorHintListener() {
+ @Override
+ public void hintShown(Project project, LightweightHint hint, int flags) {
+ LivePreview.processNotFound();
+ }
+ };
+ ApplicationManager.getApplication().getMessageBus().connect(myTestRootDisposable).subscribe(EditorHintListener.TOPIC, listener);
}
private void initFind() {
diff --git a/java/java-tests/testSrc/com/intellij/openapi/roots/impl/DirectoryIndexTest.java b/java/java-tests/testSrc/com/intellij/openapi/roots/impl/DirectoryIndexTest.java
index 23895d64a39e..1e3e08a33ae7 100644
--- a/java/java-tests/testSrc/com/intellij/openapi/roots/impl/DirectoryIndexTest.java
+++ b/java/java-tests/testSrc/com/intellij/openapi/roots/impl/DirectoryIndexTest.java
@@ -188,7 +188,7 @@ public class DirectoryIndexTest extends IdeaTestCase {
}
public void testDirInfos() throws IOException {
- checkInfoNull(myRootVFile);
+ assertNotInProject(myRootVFile);
// beware: files in directory index
checkInfo(myFileLibSrc, null, false, true, "", null, myModule);
@@ -206,21 +206,21 @@ public class DirectoryIndexTest extends IdeaTestCase {
checkInfo(myLibSrcDir, myModule, false, true, "", null, myModule2, myModule3);
checkInfo(myLibClsDir, myModule, true, false, "", null, myModule2, myModule3);
- assertEquals(myLibSrcDir, checkInfoNotNull(myLibSrcDir).getSourceRoot());
+ assertEquals(myLibSrcDir, assertInProject(myLibSrcDir).getSourceRoot());
checkInfo(myModule2Dir, myModule2, false, false, null, null);
checkInfo(mySrcDir2, myModule2, false, false, "", JavaSourceRootType.SOURCE, myModule2, myModule3);
- checkInfoNull(myCvsDir);
- checkInfoNull(myExcludeDir);
- checkInfoNull(myExcludedLibClsDir);
- checkInfoNull(myExcludedLibSrcDir);
+ assertNotInProject(myCvsDir);
+ assertExcluded(myExcludeDir, myModule2);
+ assertExcluded(myExcludedLibClsDir, myModule);
+ assertExcluded(myExcludedLibSrcDir, myModule);
- assertEquals(myModule1Dir, checkInfoNotNull(myLibClsDir).getContentRoot());
+ assertEquals(myModule1Dir, assertInProject(myLibClsDir).getContentRoot());
checkInfo(myModule3Dir, myModule3, false, false, null, null);
VirtualFile cvs = myPack1Dir.createChildDirectory(this, "CVS");
- checkInfoNull(cvs);
+ assertNotInProject(cvs);
assertNull(ProjectRootManager.getInstance(myProject).getFileIndex().getPackageNameByDirectory(cvs));
}
@@ -332,7 +332,7 @@ public class DirectoryIndexTest extends IdeaTestCase {
VirtualFile newDir = myModule1Dir.createChildDirectory(this, "newDir");
myIndex.checkConsistency();
- checkInfoNotNull(newDir);
+ assertInProject(newDir);
final FileTypeManagerEx fileTypeManager = (FileTypeManagerEx)FileTypeManager.getInstance();
final String list = fileTypeManager.getIgnoredFilesList();
@@ -345,7 +345,7 @@ public class DirectoryIndexTest extends IdeaTestCase {
}
});
myIndex.checkConsistency();
- checkInfoNull(newDir);
+ assertNotInProject(newDir);
}
finally {
ApplicationManager.getApplication().runWriteAction(new Runnable() {
@@ -354,10 +354,17 @@ public class DirectoryIndexTest extends IdeaTestCase {
fileTypeManager.setIgnoredFilesList(list);
}
});
- checkInfoNotNull(newDir);
+ assertInProject(newDir);
}
}
+ public void testIgnoredFile() throws IOException {
+ VirtualFile ignoredFile = myModule1Dir.createChildData(this, "CVS");
+ DirectoryInfo info = myIndex.getInfoForFile(ignoredFile);
+ assertTrue(info.isIgnored());
+ assertTrue(ProjectRootManager.getInstance(myProject).getFileIndex().isExcluded(ignoredFile));
+ }
+
public void testAddModule() throws Exception {
myIndex.checkConsistency();
@@ -379,16 +386,18 @@ public class DirectoryIndexTest extends IdeaTestCase {
public void testModuleUnderIgnoredDir() throws IOException {
final VirtualFile ignored = myRootVFile.createChildDirectory(this, "RCS");
assertTrue(FileTypeManager.getInstance().isFileIgnored(ignored));
+ assertTrue(ProjectRootManager.getInstance(myProject).getFileIndex().isExcluded(ignored));
final VirtualFile module4 = ignored.createChildDirectory(this, "module4");
assertFalse(FileTypeManager.getInstance().isFileIgnored(module4));
-
+ assertTrue(ProjectRootManager.getInstance(myProject).getFileIndex().isExcluded(module4));
+
new WriteCommandAction.Simple(getProject()) {
@Override
protected void run() throws Throwable {
ModuleManager moduleManager = ModuleManager.getInstance(myProject);
Module module = moduleManager.newModule(myRootVFile.getPath() + "/newModule.iml", StdModuleTypes.JAVA.getId());
PsiTestUtil.addContentRoot(module, module4);
- checkInfoNull(ignored);
+ assertNotInProject(ignored);
checkInfo(module4, module, false, false, null, null);
}
}.execute().throwException();
@@ -418,9 +427,9 @@ public class DirectoryIndexTest extends IdeaTestCase {
public void testExcludedDirsInLibraries() {
ProjectFileIndex index = ProjectRootManager.getInstance(myProject).getFileIndex();
assertFalse(index.isInLibraryClasses(myExcludedLibClsDir));
- assertTrue(index.isIgnored(myExcludedLibClsDir));
+ assertTrue(index.isExcluded(myExcludedLibClsDir));
assertFalse(index.isInLibrarySource(myExcludedLibSrcDir));
- assertTrue(index.isIgnored(myExcludedLibSrcDir));
+ assertTrue(index.isExcluded(myExcludedLibSrcDir));
}
public void testExplicitExcludeOfInner() throws Exception {
@@ -436,20 +445,20 @@ public class DirectoryIndexTest extends IdeaTestCase {
VirtualFile output1 = myModule1Dir.createChildDirectory(this, "output1");
VirtualFile output2 = myModule1Dir.createChildDirectory(this, "output2");
- checkInfoNotNull(output1);
- checkInfoNotNull(output2);
+ assertInProject(output1);
+ assertInProject(output2);
getCompilerProjectExtension().setCompilerOutputUrl(output1.getUrl());
fireRootsChanged();
- checkInfoNull(output1);
- checkInfoNotNull(output2);
+ assertExcluded(output1, myModule);
+ assertInProject(output2);
getCompilerProjectExtension().setCompilerOutputUrl(output2.getUrl());
fireRootsChanged();
- checkInfoNotNull(output1);
- checkInfoNull(output2);
+ assertInProject(output1);
+ assertExcluded(output2, myModule);
}
private void fireRootsChanged() {
@@ -460,12 +469,12 @@ public class DirectoryIndexTest extends IdeaTestCase {
ModuleRootModificationUtil.addModuleLibrary(myModule, "someLib", Collections.<String>emptyList(), Arrays.asList(mySrcDir1.getUrl()));
checkInfo(mySrcDir1, myModule, false, true, "", JavaSourceRootType.SOURCE, myModule, myModule);
- OrderEntry[] entries = myIndex.getInfoForDirectory(mySrcDir1).getOrderEntries();
+ OrderEntry[] entries = myIndex.getInfoForFile(mySrcDir1).getOrderEntries();
assertInstanceOf(entries[0], LibraryOrderEntry.class);
assertInstanceOf(entries[1], ModuleSourceOrderEntry.class);
checkInfo(myTestSrc1, myModule, false, true, "testSrc", JavaSourceRootType.TEST_SOURCE, myModule, myModule);
- entries = myIndex.getInfoForDirectory(myTestSrc1).getOrderEntries();
+ entries = myIndex.getInfoForFile(myTestSrc1).getOrderEntries();
assertInstanceOf(entries[0], LibraryOrderEntry.class);
assertInstanceOf(entries[1], ModuleSourceOrderEntry.class);
}
@@ -473,7 +482,7 @@ public class DirectoryIndexTest extends IdeaTestCase {
public void testModuleSourceAsLibraryClasses() throws Exception {
ModuleRootModificationUtil.addModuleLibrary(myModule, "someLib", Arrays.asList(mySrcDir1.getUrl()), Collections.<String>emptyList());
checkInfo(mySrcDir1, myModule, true, false, "", JavaSourceRootType.SOURCE, myModule);
- assertInstanceOf(assertOneElement(checkInfoNotNull(mySrcDir1).getOrderEntries()), ModuleSourceOrderEntry.class);
+ assertInstanceOf(assertOneElement(assertInProject(mySrcDir1).getOrderEntries()), ModuleSourceOrderEntry.class);
}
public void testModulesWithSameSourceContentRoot() {
@@ -487,7 +496,7 @@ public class DirectoryIndexTest extends IdeaTestCase {
checkInfo(myResDir, myModule, false, false, "", JavaResourceRootType.RESOURCE, myModule);
checkInfo(mySrcDir2, myModule2, false, false, "", JavaSourceRootType.SOURCE, myModule2, myModule3);
- assertEquals(myModule2Dir, myIndex.getInfoForDirectory(mySrcDir2).getContentRoot());
+ assertEquals(myModule2Dir, myIndex.getInfoForFile(mySrcDir2).getContentRoot());
}
public void testModuleWithSameSourceRoot() {
@@ -503,7 +512,7 @@ public class DirectoryIndexTest extends IdeaTestCase {
public void testSameSourceAndOutput() {
PsiTestUtil.setCompilerOutputPath(myModule, mySrcDir1.getUrl(), false);
- checkInfoNull(mySrcDir1);
+ assertExcluded(mySrcDir1, myModule);
}
public void testExcludedDirShouldBeExcludedRightAfterItsCreation() throws Exception {
@@ -512,10 +521,10 @@ public class DirectoryIndexTest extends IdeaTestCase {
VirtualFile module2Output = myModule1Dir.createChildDirectory(this, "module2Output");
VirtualFile module2TestOutput = myModule2Dir.createChildDirectory(this, "module2TestOutput");
- checkInfoNotNull(excluded);
- checkInfoNotNull(projectOutput);
- checkInfoNotNull(module2Output);
- checkInfoNotNull(module2TestOutput);
+ assertInProject(excluded);
+ assertInProject(projectOutput);
+ assertInProject(module2Output);
+ assertInProject(module2TestOutput);
getCompilerProjectExtension().setCompilerOutputUrl(projectOutput.getUrl());
@@ -524,15 +533,10 @@ public class DirectoryIndexTest extends IdeaTestCase {
PsiTestUtil.setCompilerOutputPath(myModule2, module2TestOutput.getUrl(), true);
PsiTestUtil.setExcludeCompileOutput(myModule2, true);
- checkInfoNull(excluded);
- checkInfoNull(projectOutput);
- checkInfoNull(module2Output);
- checkInfoNull(module2TestOutput);
-
- assertFalse(myIndex.isProjectExcludeRoot(excluded));
- assertFalse(myIndex.isProjectExcludeRoot(projectOutput));
- assertFalse(myIndex.isProjectExcludeRoot(module2Output));
- assertFalse(myIndex.isProjectExcludeRoot(module2TestOutput));
+ assertExcluded(excluded, myModule);
+ assertExcluded(projectOutput, myModule);
+ assertExcluded(module2Output, myModule);
+ assertExcluded(module2TestOutput, myModule2);
excluded.delete(this);
projectOutput.delete(this);
@@ -544,46 +548,26 @@ public class DirectoryIndexTest extends IdeaTestCase {
@Override
public void fileCreated(@NotNull VirtualFileEvent e) {
VirtualFile file = e.getFile();
- checkInfoNull(file);
- created.add(file);
-
String fileName = e.getFileName();
- if (fileName.equals("projectOutput")) {
- assertFalse(myIndex.isProjectExcludeRoot(file));
- }
- if (fileName.equals("module2Output")) {
- assertFalse(myIndex.isProjectExcludeRoot(file));
- }
- if (fileName.equals("module2TestOutput")) {
- assertFalse(myIndex.isProjectExcludeRoot(file));
- }
+ assertExcluded(file, fileName.contains("module2TestOutput") ? myModule2 : myModule);
+ created.add(file);
}
};
VirtualFileManager.getInstance().addVirtualFileListener(l, getTestRootDisposable());
excluded = myModule1Dir.createChildDirectory(this, excluded.getName());
- assertFalse(myIndex.isProjectExcludeRoot(excluded));
-
+ assertExcluded(excluded, myModule);
+
projectOutput = myModule1Dir.createChildDirectory(this, projectOutput.getName());
- assertFalse(myIndex.isProjectExcludeRoot(projectOutput));
-
+ assertExcluded(projectOutput, myModule);
+
module2Output = myModule1Dir.createChildDirectory(this, module2Output.getName());
- assertFalse(myIndex.isProjectExcludeRoot(module2Output));
-
- module2TestOutput = myModule2Dir.createChildDirectory(this, module2TestOutput.getName());
- assertFalse(myIndex.isProjectExcludeRoot(module2TestOutput));
+ assertExcluded(module2Output, myModule);
- checkInfoNull(excluded);
- checkInfoNull(projectOutput);
- checkInfoNull(module2Output);
- checkInfoNull(module2TestOutput);
+ module2TestOutput = myModule2Dir.createChildDirectory(this, module2TestOutput.getName());
+ assertExcluded(module2TestOutput, myModule2);
assertEquals(created.toString(), 4, created.size());
-
- assertFalse(myIndex.isProjectExcludeRoot(excluded));
- assertFalse(myIndex.isProjectExcludeRoot(projectOutput));
- assertFalse(myIndex.isProjectExcludeRoot(module2Output));
- assertFalse(myIndex.isProjectExcludeRoot(module2TestOutput));
}
public void testExcludesShouldBeRecognizedRightOnRefresh() throws Exception {
@@ -607,9 +591,9 @@ public class DirectoryIndexTest extends IdeaTestCase {
assertEquals("dir", e.getFileName());
VirtualFile file = e.getFile();
- checkInfoNotNull(file);
- checkInfoNull(file.findFileByRelativePath("excluded"));
- checkInfoNull(file.findFileByRelativePath("excluded/foo"));
+ assertInProject(file);
+ assertExcluded(file.findFileByRelativePath("excluded"), myModule);
+ assertExcluded(file.findFileByRelativePath("excluded/foo"), myModule);
}
};
@@ -638,8 +622,8 @@ public class DirectoryIndexTest extends IdeaTestCase {
});
- checkInfoNull(LocalFileSystem.getInstance().findFileByIoFile(f.getParentFile().getParentFile()));
- checkInfoNotNull(LocalFileSystem.getInstance().findFileByIoFile(f));
+ assertExcluded(LocalFileSystem.getInstance().findFileByIoFile(f.getParentFile().getParentFile()), myModule);
+ assertInProject(LocalFileSystem.getInstance().findFileByIoFile(f));
}
public void testLibraryDirInContent() throws Exception {
@@ -661,7 +645,7 @@ public class DirectoryIndexTest extends IdeaTestCase {
checkInfo(myLibSrcDir, myModule, true, true, "", null, myModule, myModule3);
checkInfo(myResDir, myModule, true, false, "", JavaResourceRootType.RESOURCE, myModule);
- assertInstanceOf(assertOneElement(checkInfoNotNull(myResDir).getOrderEntries()), ModuleSourceOrderEntry.class);
+ assertInstanceOf(assertOneElement(assertInProject(myResDir).getOrderEntries()), ModuleSourceOrderEntry.class);
checkInfo(myExcludedLibSrcDir, null, true, false, "lib.src.exc", null, myModule3, myModule);
checkInfo(myExcludedLibClsDir, null, true, false, "lib.cls.exc", null, myModule3);
@@ -678,11 +662,11 @@ public class DirectoryIndexTest extends IdeaTestCase {
public void testExcludeCompilerOutputOutsideOfContentRoot() throws Exception {
final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(myProject).getFileIndex();
- assertTrue(fileIndex.isIgnored(myOutputDir));
- assertTrue(fileIndex.isIgnored(myModule1OutputDir));
- assertFalse(fileIndex.isIgnored(myOutputDir.getParent()));
- assertTrue(myIndex.isProjectExcludeRoot(myOutputDir));
- assertFalse(myIndex.isProjectExcludeRoot(myModule1OutputDir));
+ assertTrue(fileIndex.isExcluded(myOutputDir));
+ assertTrue(fileIndex.isExcluded(myModule1OutputDir));
+ assertFalse(fileIndex.isExcluded(myOutputDir.getParent()));
+ assertExcludedFromProject(myOutputDir);
+ assertExcludedFromProject(myModule1OutputDir);
String moduleOutputUrl = myModule1OutputDir.getUrl();
myOutputDir.delete(this);
@@ -691,9 +675,9 @@ public class DirectoryIndexTest extends IdeaTestCase {
myOutputDir = myRootVFile.createChildDirectory(this, "out");
myModule1OutputDir = myOutputDir.createChildDirectory(this, "module1");
- assertTrue(myIndex.isProjectExcludeRoot(myOutputDir));
- assertTrue(myIndex.isProjectExcludeRoot(myModule1OutputDir));
- assertTrue(fileIndex.isIgnored(myModule1OutputDir));
+ assertExcludedFromProject(myOutputDir);
+ assertExcludedFromProject(myModule1OutputDir);
+ assertTrue(fileIndex.isExcluded(myModule1OutputDir));
PsiTestUtil.setCompilerOutputPath(myModule, moduleOutputUrl, true);
PsiTestUtil.setCompilerOutputPath(myModule2, moduleOutputUrl, false);
@@ -702,20 +686,20 @@ public class DirectoryIndexTest extends IdeaTestCase {
PsiTestUtil.setCompilerOutputPath(myModule3, moduleOutputUrl, true);
// now no module inherits project output dir, but it still should be project-excluded
- assertTrue(myIndex.isProjectExcludeRoot(myOutputDir));
+ assertExcludedFromProject(myOutputDir);
// project output inside module content shouldn't be projectExcludeRoot
VirtualFile projectOutputUnderContent = myModule1Dir.createChildDirectory(this, "projectOutputUnderContent");
getCompilerProjectExtension().setCompilerOutputUrl(projectOutputUnderContent.getUrl());
fireRootsChanged();
- assertFalse(myIndex.isProjectExcludeRoot(myOutputDir));
- assertFalse(myIndex.isProjectExcludeRoot(projectOutputUnderContent));
-
+ assertNotExcluded(myOutputDir);
+ assertExcluded(projectOutputUnderContent, myModule);
+
projectOutputUnderContent.delete(this);
projectOutputUnderContent = myModule1Dir.createChildDirectory(this, "projectOutputUnderContent");
- assertFalse(myIndex.isProjectExcludeRoot(myOutputDir));
- assertFalse(myIndex.isProjectExcludeRoot(projectOutputUnderContent));
+ assertNotExcluded(myOutputDir);
+ assertExcluded(projectOutputUnderContent, myModule);
}
public void testFileContentAndSourceRoots() throws IOException {
@@ -725,7 +709,7 @@ public class DirectoryIndexTest extends IdeaTestCase {
VirtualFile fileSourceRoot = myRootVFile.createChildData(this, "fileSourceRoot.txt");
VirtualFile fileTestSourceRoot = myRootVFile.createChildData(this, "fileTestSourceRoot.txt");
- checkInfoNull(fileRoot);
+ assertNotInProject(fileRoot);
assertFalse(fileIndex.isInContent(fileRoot));
assertIteratedContent(fileIndex, null, Arrays.asList(fileRoot, fileSourceRoot, fileTestSourceRoot));
@@ -758,7 +742,7 @@ public class DirectoryIndexTest extends IdeaTestCase {
// removing file content root
PsiTestUtil.removeContentEntry(myModule, contentEntry);
- checkInfoNull(fileRoot);
+ assertNotInProject(fileRoot);
assertFalse(fileIndex.isInContent(fileRoot));
assertFalse(fileIndex.isInSource(fileRoot));
assertIteratedContent(fileIndex, Arrays.asList(fileSourceRoot, fileTestSourceRoot), Arrays.asList(fileRoot));
@@ -785,7 +769,6 @@ public class DirectoryIndexTest extends IdeaTestCase {
VirtualFile fileSourceRoot = myModule1Dir.createChildData(this, "fileSourceRoot.txt");
assertTrue(fileIndex.isInContent(fileSourceRoot));
assertFalse(fileIndex.isInSource(fileSourceRoot));
- checkInfoNull(fileSourceRoot);
PsiTestUtil.addSourceRoot(myModule, fileSourceRoot);
assertTrue(fileIndex.isInContent(fileSourceRoot));
@@ -796,7 +779,6 @@ public class DirectoryIndexTest extends IdeaTestCase {
PsiTestUtil.removeSourceRoot(myModule, fileSourceRoot);
assertTrue(fileIndex.isInContent(fileSourceRoot));
assertFalse(fileIndex.isInSource(fileSourceRoot));
- checkInfoNull(fileSourceRoot);
}
public void testFileModuleExcludeRootUnderDirectoryRoot() throws IOException {
@@ -805,20 +787,18 @@ public class DirectoryIndexTest extends IdeaTestCase {
VirtualFile fileExcludeRoot = mySrcDir1.createChildData(this, "fileExcludeRoot.txt");
assertTrue(fileIndex.isInContent(fileExcludeRoot));
assertTrue(fileIndex.isInSource(fileExcludeRoot));
- checkInfoNull(fileExcludeRoot);
assertIteratedContent(fileIndex, Arrays.asList(fileExcludeRoot), null);
PsiTestUtil.addExcludedRoot(myModule, fileExcludeRoot);
assertFalse(fileIndex.isInContent(fileExcludeRoot));
assertFalse(fileIndex.isInSource(fileExcludeRoot));
- checkInfoNull(fileExcludeRoot);
+ assertExcluded(fileExcludeRoot, myModule);
assertIteratedContent(fileIndex, null, Arrays.asList(fileExcludeRoot));
// removing file exclude root
PsiTestUtil.removeExcludedRoot(myModule, fileExcludeRoot);
assertTrue(fileIndex.isInContent(fileExcludeRoot));
assertTrue(fileIndex.isInSource(fileExcludeRoot));
- checkInfoNull(fileExcludeRoot);
assertIteratedContent(fileIndex, Arrays.asList(fileExcludeRoot), null);
}
@@ -833,7 +813,7 @@ public class DirectoryIndexTest extends IdeaTestCase {
PsiTestUtil.addExcludedRoot(myModule, fileRoot);
assertFalse(fileIndex.isInContent(fileRoot));
- checkInfoNull(fileRoot);
+ assertExcluded(fileRoot, myModule);
assertIteratedContent(fileIndex, null, Arrays.asList(fileRoot));
// removing file exclude root
@@ -860,7 +840,7 @@ public class DirectoryIndexTest extends IdeaTestCase {
VirtualFile temp = myRootVFile.createChildDirectory(this, "temp");
VirtualFile fileSourceRoot = myRootVFile.createChildData(this, "fileSourceRoot.txt");
- checkInfoNull(fileSourceRoot);
+ assertNotInProject(fileSourceRoot);
PsiTestUtil.addContentRoot(myModule, fileSourceRoot);
PsiTestUtil.addSourceRoot(myModule, fileSourceRoot);
@@ -870,7 +850,7 @@ public class DirectoryIndexTest extends IdeaTestCase {
// delete and recreate
fileSourceRoot.delete(this);
- checkInfoNull(fileSourceRoot);
+ assertNotInProject(fileSourceRoot);
assertFalse(fileIndex.isInContent(fileSourceRoot));
assertFalse(fileIndex.isInSource(fileSourceRoot));
fileSourceRoot = myRootVFile.createChildData(this, "fileSourceRoot.txt");
@@ -880,11 +860,11 @@ public class DirectoryIndexTest extends IdeaTestCase {
// delete and move from another dir
fileSourceRoot.delete(this);
- checkInfoNull(fileSourceRoot);
+ assertNotInProject(fileSourceRoot);
assertFalse(fileIndex.isInContent(fileSourceRoot));
assertFalse(fileIndex.isInSource(fileSourceRoot));
fileSourceRoot = temp.createChildData(this, "fileSourceRoot.txt");
- checkInfoNull(fileSourceRoot);
+ assertNotInProject(fileSourceRoot);
fileSourceRoot.move(this, myRootVFile);
checkInfo(fileSourceRoot, myModule, false, false, "", JavaSourceRootType.SOURCE, myModule);
assertTrue(fileIndex.isInContent(fileSourceRoot));
@@ -892,11 +872,11 @@ public class DirectoryIndexTest extends IdeaTestCase {
// delete and copy from another dir
fileSourceRoot.delete(this);
- checkInfoNull(fileSourceRoot);
+ assertNotInProject(fileSourceRoot);
assertFalse(fileIndex.isInContent(fileSourceRoot));
assertFalse(fileIndex.isInSource(fileSourceRoot));
fileSourceRoot = temp.createChildData(this, "fileSourceRoot.txt");
- checkInfoNull(fileSourceRoot);
+ assertNotInProject(fileSourceRoot);
fileSourceRoot = fileSourceRoot.copy(this, myRootVFile, "fileSourceRoot.txt");
checkInfo(fileSourceRoot, myModule, false, false, "", JavaSourceRootType.SOURCE, myModule);
assertTrue(fileIndex.isInContent(fileSourceRoot));
@@ -904,25 +884,25 @@ public class DirectoryIndexTest extends IdeaTestCase {
// delete and rename from another file
fileSourceRoot.delete(this);
- checkInfoNull(fileSourceRoot);
+ assertNotInProject(fileSourceRoot);
assertFalse(fileIndex.isInContent(fileSourceRoot));
assertFalse(fileIndex.isInSource(fileSourceRoot));
fileSourceRoot = myRootVFile.createChildData(this, "temp_file.txt");
- checkInfoNull(fileSourceRoot);
+ assertNotInProject(fileSourceRoot);
fileSourceRoot.rename(this, "fileSourceRoot.txt");
checkInfo(fileSourceRoot, myModule, false, false, "", JavaSourceRootType.SOURCE, myModule);
assertTrue(fileIndex.isInContent(fileSourceRoot));
assertTrue(fileIndex.isInSource(fileSourceRoot));
}
- private void checkInfo(VirtualFile dir,
+ private void checkInfo(VirtualFile file,
@Nullable Module module,
boolean isInLibrary,
boolean isInLibrarySource,
@Nullable String packageName,
@Nullable final JpsModuleSourceRootType<?> moduleSourceRootType,
Module... modulesOfOrderEntries) {
- DirectoryInfo info = checkInfoNotNull(dir);
+ DirectoryInfo info = assertInProject(file);
assertEquals(module, info.getModule());
if (moduleSourceRootType != null) {
assertTrue("isInModuleSource", info.isInModuleSource());
@@ -935,8 +915,8 @@ public class DirectoryIndexTest extends IdeaTestCase {
assertEquals(isInLibrarySource, info.isInLibrarySource());
final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(myProject).getFileIndex();
- if (dir.isDirectory()) {
- assertEquals(packageName, fileIndex.getPackageNameByDirectory(dir));
+ if (file.isDirectory()) {
+ assertEquals(packageName, fileIndex.getPackageNameByDirectory(file));
}
assertEquals(Arrays.toString(info.getOrderEntries()), modulesOfOrderEntries.length, info.getOrderEntries().length);
@@ -946,16 +926,33 @@ public class DirectoryIndexTest extends IdeaTestCase {
}
}
- private void checkInfoNull(VirtualFile dir) {
- assertNull(myIndex.getInfoForDirectory(dir));
+ private void assertNotInProject(VirtualFile file) {
+ DirectoryInfo info = myIndex.getInfoForFile(file);
+ assertFalse(info.toString(), info.isInProject());
+ assertFalse(info.toString(), info.isExcluded());
+ }
+
+ private void assertExcluded(VirtualFile file, Module module) {
+ DirectoryInfo info = myIndex.getInfoForFile(file);
+ assertTrue(info.toString(), info.isExcluded());
+ assertEquals(module, info.getModule());
}
- private DirectoryInfo checkInfoNotNull(VirtualFile output2) {
- DirectoryInfo info = myIndex.getInfoForDirectory(output2);
- assertNotNull(output2.toString(), info);
+
+ private DirectoryInfo assertInProject(VirtualFile file) {
+ DirectoryInfo info = myIndex.getInfoForFile(file);
+ assertTrue(file.toString(), info.isInProject());
info.assertConsistency();
return info;
}
+ private void assertNotExcluded(VirtualFile file) {
+ assertFalse(myIndex.getInfoForFile(file).isExcluded());
+ }
+
+ private void assertExcludedFromProject(VirtualFile file) {
+ assertExcluded(file, null);
+ }
+
private void checkPackage(String packageName, boolean includeLibrarySources, VirtualFile... expectedDirs) {
VirtualFile[] actualDirs = myIndex.getDirectoriesByPackageName(packageName, includeLibrarySources).toArray(VirtualFile.EMPTY_ARRAY);
assertNotNull(actualDirs);
diff --git a/java/java-tests/testSrc/com/intellij/psi/CodeFragmentsTest.java b/java/java-tests/testSrc/com/intellij/psi/CodeFragmentsTest.java
index 8f6956808dea..dd0611f53175 100644
--- a/java/java-tests/testSrc/com/intellij/psi/CodeFragmentsTest.java
+++ b/java/java-tests/testSrc/com/intellij/psi/CodeFragmentsTest.java
@@ -1,6 +1,10 @@
package com.intellij.psi;
import com.intellij.openapi.editor.Document;
+import com.intellij.openapi.roots.ex.ProjectRootManagerEx;
+import com.intellij.openapi.util.EmptyRunnable;
+import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.testFramework.LightVirtualFile;
import com.intellij.testFramework.PlatformTestCase;
import com.intellij.testFramework.PlatformTestUtil;
import com.intellij.testFramework.PsiTestCase;
@@ -30,4 +34,15 @@ public class CodeFragmentsTest extends PsiTestCase{
PlatformTestUtil.tryGcSoftlyReachableObjects();
assertEquals("ab", PsiDocumentManager.getInstance(myProject).getDocument(fragment).getText());
}
+
+ public void testDontRecreateFragmentPsi() {
+ PsiExpressionCodeFragment fragment = JavaCodeFragmentFactory.getInstance(myProject).createExpressionCodeFragment("a", null, null, true);
+ VirtualFile file = fragment.getViewProvider().getVirtualFile();
+ assertInstanceOf(file, LightVirtualFile.class);
+
+ ProjectRootManagerEx.getInstanceEx(getProject()).makeRootsChange(EmptyRunnable.getInstance(), false, true);
+
+ assertSame(fragment, PsiManager.getInstance(myProject).findFile(file));
+ assertTrue(fragment.isValid());
+ }
}
diff --git a/java/java-tests/testSrc/com/intellij/psi/formatter/java/JavaFormatterBlankLinesTest.java b/java/java-tests/testSrc/com/intellij/psi/formatter/java/JavaFormatterBlankLinesTest.java
index bf11a587f2c3..fe005a84db3f 100644
--- a/java/java-tests/testSrc/com/intellij/psi/formatter/java/JavaFormatterBlankLinesTest.java
+++ b/java/java-tests/testSrc/com/intellij/psi/formatter/java/JavaFormatterBlankLinesTest.java
@@ -400,4 +400,36 @@ public class JavaFormatterBlankLinesTest extends AbstractJavaFormatterTest {
"}"
);
}
+
+ public void testIDEA126836() {
+ doTextTest(
+ "public class JavaClass { // comment\n" +
+ " public void doSomething() {\n" +
+ " int a = 3;\n" +
+ " }\n" +
+ "}",
+ "public class JavaClass { // comment\n" +
+ " public void doSomething() {\n" +
+ " int a = 3;\n" +
+ " }\n" +
+ "}"
+ );
+ }
+
+ public void testBlankLinesAfterClassHeaderWithComment() {
+ getSettings().BLANK_LINES_AFTER_CLASS_HEADER = 5;
+ doTextTest(
+ "public class JavaClass { // comment\n" +
+ " public void doSomething() {\n" +
+ " int a = 3;\n" +
+ " }\n" +
+ "}",
+ "public class JavaClass { // comment\n" +
+ "\n\n\n\n\n" +
+ " public void doSomething() {\n" +
+ " int a = 3;\n" +
+ " }\n" +
+ "}"
+ );
+ }
}
diff --git a/java/java-tests/testSrc/com/intellij/refactoring/PullUpTest.java b/java/java-tests/testSrc/com/intellij/refactoring/PullUpTest.java
index f0d4e771ed1a..665afec47ec9 100644
--- a/java/java-tests/testSrc/com/intellij/refactoring/PullUpTest.java
+++ b/java/java-tests/testSrc/com/intellij/refactoring/PullUpTest.java
@@ -163,6 +163,9 @@ public class PullUpTest extends LightRefactoringTestCase {
public void testPreserveOverride() {
doTest(false, new RefactoringTestUtil.MemberDescriptor("foo", PsiMethod.class));
}
+ public void testAsDefaultMethodOverAbstract() {
+ doTest(false, "Class <b><code>Test.Printer</code></b> already contains a method <b><code>foo()</code></b>", new RefactoringTestUtil.MemberDescriptor("foo", PsiMethod.class));
+ }
public void testPublicMethodFromPrivateClassConflict() {
doTest(false, new RefactoringTestUtil.MemberDescriptor("HM", PsiClass.class), new RefactoringTestUtil.MemberDescriptor("foo", PsiMethod.class));
diff --git a/java/java-tests/testSrc/com/intellij/refactoring/inline/InlineMethodTest.java b/java/java-tests/testSrc/com/intellij/refactoring/inline/InlineMethodTest.java
index 99de5eb68dc4..922d5e04c3bc 100644
--- a/java/java-tests/testSrc/com/intellij/refactoring/inline/InlineMethodTest.java
+++ b/java/java-tests/testSrc/com/intellij/refactoring/inline/InlineMethodTest.java
@@ -268,6 +268,10 @@ public class InlineMethodTest extends LightRefactoringTestCase {
doTest();
}
+ public void testThisNameConflict() throws Exception {
+ doTest();
+ }
+
private void doTestInlineThisOnly() {
@NonNls String fileName = "/refactoring/inlineMethod/" + getTestName(false) + ".java";
configureByFile(fileName);
diff --git a/java/jdkAnnotations/java/text/annotations.xml b/java/jdkAnnotations/java/text/annotations.xml
index 96eb67c3add7..32b437d85aa3 100644
--- a/java/jdkAnnotations/java/text/annotations.xml
+++ b/java/jdkAnnotations/java/text/annotations.xml
@@ -93,5 +93,17 @@
<item name='java.text.SimpleDateFormat void setDateFormatSymbols(java.text.DateFormatSymbols) 0'>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>
+ <item name='java.text.StringCharacterIterator StringCharacterIterator(java.lang.String) 0'>
+ <annotation name='org.jetbrains.annotations.NotNull'/>
+ </item>
+ <item name='java.text.StringCharacterIterator StringCharacterIterator(java.lang.String, int) 0'>
+ <annotation name='org.jetbrains.annotations.NotNull'/>
+ </item>
+ <item name='java.text.StringCharacterIterator StringCharacterIterator(java.lang.String, int, int, int) 0'>
+ <annotation name='org.jetbrains.annotations.NotNull'/>
+ </item>
+ <item name='java.text.StringCharacterIterator void setText(java.lang.String) 0'>
+ <annotation name='org.jetbrains.annotations.NotNull'/>
+ </item>
</root>
diff --git a/java/mockJDK-1.7/jre/lib/annotations.jar b/java/mockJDK-1.7/jre/lib/annotations.jar
index 22b47ab9bcbc..d96bb1d6bed4 100644
--- a/java/mockJDK-1.7/jre/lib/annotations.jar
+++ b/java/mockJDK-1.7/jre/lib/annotations.jar
Binary files differ
diff --git a/java/openapi/src/com/intellij/ui/classFilter/ClassFilter.java b/java/openapi/src/com/intellij/ui/classFilter/ClassFilter.java
index 7521d3bd7c13..05500e31ebd3 100644
--- a/java/openapi/src/com/intellij/ui/classFilter/ClassFilter.java
+++ b/java/openapi/src/com/intellij/ui/classFilter/ClassFilter.java
@@ -17,20 +17,15 @@
package com.intellij.ui.classFilter;
import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.util.DefaultJDOMExternalizer;
-import com.intellij.openapi.util.InvalidDataException;
-import com.intellij.openapi.util.JDOMExternalizable;
-import com.intellij.openapi.util.WriteExternalException;
import com.intellij.util.xmlb.annotations.Attribute;
import com.intellij.util.xmlb.annotations.Tag;
import com.intellij.util.xmlb.annotations.Transient;
-import org.jdom.Element;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@Tag("class-filter")
-public class ClassFilter implements JDOMExternalizable, Cloneable{
+public class ClassFilter implements Cloneable {
private static final Logger LOG = Logger.getInstance("#com.intellij.ui.classFilter.ClassFilter");
public static final ClassFilter[] EMPTY_ARRAY = new ClassFilter[0];
@@ -72,14 +67,6 @@ public class ClassFilter implements JDOMExternalizable, Cloneable{
return getPattern();
}
- public void readExternal(Element element) throws InvalidDataException {
- DefaultJDOMExternalizer.readExternal(this, element);
- }
-
- public void writeExternal(Element element) throws WriteExternalException {
- DefaultJDOMExternalizer.writeExternal(this, element);
- }
-
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof ClassFilter)) return false;
@@ -99,6 +86,7 @@ public class ClassFilter implements JDOMExternalizable, Cloneable{
return result;
}
+ @Override
public ClassFilter clone() {
try {
return (ClassFilter) super.clone();
diff --git a/java/openapi/src/com/intellij/ui/classFilter/ClassFilterEditor.java b/java/openapi/src/com/intellij/ui/classFilter/ClassFilterEditor.java
index b4b654d423b5..6d924a380974 100644
--- a/java/openapi/src/com/intellij/ui/classFilter/ClassFilterEditor.java
+++ b/java/openapi/src/com/intellij/ui/classFilter/ClassFilterEditor.java
@@ -113,7 +113,7 @@ public class ClassFilterEditor extends JPanel implements ComponentWithEmptyText
myTable.setTableHeader(null);
myTable.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);
myTable.setColumnSelectionAllowed(false);
- myTable.setPreferredScrollableViewportSize(new Dimension(200, 100));
+ myTable.setPreferredScrollableViewportSize(new Dimension(200, myTable.getRowHeight() * JBTable.PREFERRED_SCROLLABLE_VIEWPORT_HEIGHT_IN_ROWS));
TableColumnModel columnModel = myTable.getColumnModel();
TableColumn column = columnModel.getColumn(FilterTableModel.CHECK_MARK);
diff --git a/java/remote-servers/impl/remote-servers-java-impl.iml b/java/remote-servers/impl/remote-servers-java-impl.iml
index b0228d7f4075..6999e2deac71 100644
--- a/java/remote-servers/impl/remote-servers-java-impl.iml
+++ b/java/remote-servers/impl/remote-servers-java-impl.iml
@@ -13,6 +13,8 @@
<orderEntry type="module" module-name="execution-openapi" />
<orderEntry type="module" module-name="lang-impl" />
<orderEntry type="module" module-name="remote-servers-impl" />
+ <orderEntry type="module" module-name="java-impl" />
+ <orderEntry type="module" module-name="openapi" />
</component>
</module>
diff --git a/java/remote-servers/impl/src/META-INF/RemoteServersJava.xml b/java/remote-servers/impl/src/META-INF/RemoteServersJava.xml
index cec87d9643f2..24a0776ccd29 100644
--- a/java/remote-servers/impl/src/META-INF/RemoteServersJava.xml
+++ b/java/remote-servers/impl/src/META-INF/RemoteServersJava.xml
@@ -1,7 +1,14 @@
<idea-plugin>
+
+ <extensionPoints>
+ <extensionPoint qualifiedName="com.intellij.remoteServer.moduleBuilderContribution"
+ interface="com.intellij.remoteServer.impl.module.CloudModuleBuilderContribution"/>
+ </extensionPoints>
+
<extensions defaultExtensionNs="com.intellij">
<applicationService serviceInterface="com.intellij.remoteServer.configuration.deployment.JavaDeploymentSourceUtil"
serviceImplementation="com.intellij.remoteServer.impl.configuration.deployment.JavaDeploymentSourceUtilImpl"/>
<remoteServer.deploymentSource.type implementation="com.intellij.remoteServer.impl.configuration.deployment.ArtifactDeploymentSourceType"/>
+ <moduleBuilder builderClass="com.intellij.remoteServer.impl.module.CloudModuleBuilder"/>
</extensions>
</idea-plugin> \ No newline at end of file
diff --git a/java/remote-servers/impl/src/com/intellij/remoteServer/impl/module/CloudApplicationConfigurable.java b/java/remote-servers/impl/src/com/intellij/remoteServer/impl/module/CloudApplicationConfigurable.java
new file mode 100644
index 000000000000..14bd043a7f23
--- /dev/null
+++ b/java/remote-servers/impl/src/com/intellij/remoteServer/impl/module/CloudApplicationConfigurable.java
@@ -0,0 +1,166 @@
+/*
+ * Copyright 2000-2014 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.remoteServer.impl.module;
+
+import com.intellij.openapi.Disposable;
+import com.intellij.openapi.options.ConfigurationException;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.Disposer;
+import com.intellij.remoteServer.configuration.RemoteServer;
+import com.intellij.remoteServer.runtime.Deployment;
+import com.intellij.remoteServer.runtime.ServerConnection;
+import com.intellij.remoteServer.runtime.ServerConnector;
+import com.intellij.remoteServer.runtime.deployment.ServerRuntimeInstance;
+import com.intellij.remoteServer.util.*;
+import com.intellij.util.concurrency.Semaphore;
+import com.intellij.util.ui.UIUtil;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import javax.swing.*;
+import java.util.Collection;
+import java.util.concurrent.atomic.AtomicReference;
+
+
+public abstract class CloudApplicationConfigurable<
+ SC extends CloudConfigurationBase,
+ DC extends CloudDeploymentNameConfiguration,
+ SR extends CloudMultiSourceServerRuntimeInstance<DC, ?, ?, ?>,
+ AC extends CloudApplicationConfiguration> {
+
+ private final Project myProject;
+ private final Disposable myParentDisposable;
+
+ private DelayedRunner myRunner;
+
+ private RemoteServer<?> myAccount;
+
+ public CloudApplicationConfigurable(@Nullable Project project, Disposable parentDisposable) {
+ myProject = project;
+ myParentDisposable = parentDisposable;
+ }
+
+ public void setAccount(RemoteServer<?> account) {
+ myAccount = account;
+ clearCloudData();
+ }
+
+ protected RemoteServer<SC> getAccount() {
+ return (RemoteServer<SC>)myAccount;
+ }
+
+ public JComponent getComponent() {
+ JComponent result = getMainPanel();
+ if (myRunner == null) {
+ myRunner = new DelayedRunner(result) {
+
+ private RemoteServer<?> myPreviousAccount;
+
+ @Override
+ protected boolean wasChanged() {
+ boolean result = myPreviousAccount != myAccount;
+ if (result) {
+ myPreviousAccount = myAccount;
+ }
+ return result;
+ }
+
+ @Override
+ protected void run() {
+ loadCloudData();
+ }
+ };
+ Disposer.register(myParentDisposable, myRunner);
+ }
+ return result;
+ }
+
+ protected void clearCloudData() {
+ getExistingComboBox().removeAllItems();
+ }
+
+ protected void loadCloudData() {
+ new ConnectionTask<Collection<Deployment>>("Loading existing applications list") {
+
+ @Override
+ protected void run(final ServerConnection<DC> connection,
+ final Semaphore semaphore,
+ final AtomicReference<Collection<Deployment>> result) {
+ connection.connectIfNeeded(new ServerConnector.ConnectionCallback<DC>() {
+
+ @Override
+ public void connected(@NotNull ServerRuntimeInstance<DC> serverRuntimeInstance) {
+ connection.computeDeployments(new Runnable() {
+
+ @Override
+ public void run() {
+ result.set(connection.getDeployments());
+ semaphore.up();
+ UIUtil.invokeLaterIfNeeded(new Runnable() {
+ @Override
+ public void run() {
+ if (!Disposer.isDisposed(myParentDisposable)) {
+ setupExistingApplications(result.get());
+ }
+ }
+ });
+ }
+ });
+ }
+
+ @Override
+ public void errorOccurred(@NotNull String errorMessage) {
+ runtimeErrorOccurred(errorMessage);
+ semaphore.up();
+ }
+ });
+ }
+
+ @Override
+ protected Collection<Deployment> run(SR serverRuntimeInstance) throws ServerRuntimeException {
+ return null;
+ }
+ }.performAsync();
+ }
+
+ private void setupExistingApplications(Collection<Deployment> deployments) {
+ JComboBox existingComboBox = getExistingComboBox();
+ existingComboBox.removeAllItems();
+ for (Deployment deployment : deployments) {
+ existingComboBox.addItem(deployment.getName());
+ }
+ }
+
+ protected Project getProject() {
+ return myProject;
+ }
+
+ protected abstract JComboBox getExistingComboBox();
+
+ protected abstract JComponent getMainPanel();
+
+ public abstract AC createConfiguration();
+
+ public abstract void validate() throws ConfigurationException;
+
+ protected abstract class ConnectionTask<T> extends CloudConnectionTask<T, SC, DC, SR> {
+
+ public ConnectionTask(String title) {
+ super(myProject, title, CloudApplicationConfigurable.this.getAccount());
+ }
+ }
+}
+
diff --git a/java/remote-servers/impl/src/com/intellij/remoteServer/impl/module/CloudApplicationConfiguration.java b/java/remote-servers/impl/src/com/intellij/remoteServer/impl/module/CloudApplicationConfiguration.java
new file mode 100644
index 000000000000..9af0f1ad472b
--- /dev/null
+++ b/java/remote-servers/impl/src/com/intellij/remoteServer/impl/module/CloudApplicationConfiguration.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2000-2014 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.remoteServer.impl.module;
+
+
+public abstract class CloudApplicationConfiguration {
+
+ private boolean myExisting;
+ private final String myExistingAppName;
+
+ protected CloudApplicationConfiguration(boolean existing, String existingAppName) {
+ myExisting = existing;
+ myExistingAppName = existingAppName;
+ }
+
+ public boolean isExisting() {
+ return myExisting;
+ }
+
+ public String getExistingAppName() {
+ return myExistingAppName;
+ }
+}
diff --git a/java/remote-servers/impl/src/com/intellij/remoteServer/impl/module/CloudModuleBuilder.java b/java/remote-servers/impl/src/com/intellij/remoteServer/impl/module/CloudModuleBuilder.java
new file mode 100644
index 000000000000..4aa8d60bcea4
--- /dev/null
+++ b/java/remote-servers/impl/src/com/intellij/remoteServer/impl/module/CloudModuleBuilder.java
@@ -0,0 +1,114 @@
+/*
+ * Copyright 2000-2014 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.remoteServer.impl.module;
+
+import com.intellij.icons.AllIcons;
+import com.intellij.ide.util.projectWizard.JavaModuleBuilder;
+import com.intellij.ide.util.projectWizard.ModuleBuilderListener;
+import com.intellij.ide.util.projectWizard.ModuleWizardStep;
+import com.intellij.ide.util.projectWizard.WizardContext;
+import com.intellij.openapi.Disposable;
+import com.intellij.openapi.module.JavaModuleType;
+import com.intellij.openapi.module.Module;
+import com.intellij.openapi.roots.ui.configuration.ModulesProvider;
+import com.intellij.remoteServer.configuration.RemoteServer;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import javax.swing.*;
+
+
+public class CloudModuleBuilder extends JavaModuleBuilder {
+
+ private RemoteServer<?> myAccount;
+ private CloudApplicationConfiguration myApplicationConfiguration;
+
+ public CloudModuleBuilder() {
+ addListener(new ModuleBuilderListener() {
+
+ @Override
+ public void moduleCreated(@NotNull Module module) {
+ configureModule(module);
+ }
+ });
+ }
+
+ public String getBuilderId() {
+ return getClass().getName();
+ }
+
+ @Override
+ public Icon getBigIcon() {
+ return AllIcons.General.Balloon;
+ }
+
+ @Override
+ public Icon getNodeIcon() {
+ return AllIcons.General.Balloon;
+ }
+
+ @Override
+ public String getDescription() {
+ return "Java module of PAAS cloud application";
+ }
+
+ @Override
+ public String getPresentableName() {
+ return "Clouds";
+ }
+
+ @Override
+ public String getGroupName() {
+ return "Clouds";
+ }
+
+ @Override
+ public String getParentGroup() {
+ return JavaModuleType.JAVA_GROUP;
+ }
+
+ @Override
+ public int getWeight() {
+ return 30;
+ }
+
+ @Override
+ public ModuleWizardStep[] createWizardSteps(@NotNull WizardContext wizardContext, @NotNull ModulesProvider modulesProvider) {
+ return ModuleWizardStep.EMPTY_ARRAY;
+ }
+
+ @Nullable
+ @Override
+ public ModuleWizardStep getCustomOptionsStep(WizardContext context, Disposable parentDisposable) {
+ return new CloudModuleWizardStep(this, context.getProject(), parentDisposable);
+ }
+
+ public void setAccount(RemoteServer<?> account) {
+ myAccount = account;
+ }
+
+ public RemoteServer<?> getAccount() {
+ return myAccount;
+ }
+
+ public void setApplicationConfiguration(CloudApplicationConfiguration applicationConfiguration) {
+ myApplicationConfiguration = applicationConfiguration;
+ }
+
+ private void configureModule(final Module module) {
+ CloudModuleBuilderContribution.getInstanceByType(myAccount.getType()).configureModule(module, myAccount, myApplicationConfiguration);
+ }
+}
diff --git a/java/remote-servers/impl/src/com/intellij/remoteServer/impl/module/CloudModuleBuilderContribution.java b/java/remote-servers/impl/src/com/intellij/remoteServer/impl/module/CloudModuleBuilderContribution.java
new file mode 100644
index 000000000000..6643c89cc1c4
--- /dev/null
+++ b/java/remote-servers/impl/src/com/intellij/remoteServer/impl/module/CloudModuleBuilderContribution.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2000-2014 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.remoteServer.impl.module;
+
+import com.intellij.openapi.Disposable;
+import com.intellij.openapi.extensions.ExtensionPointName;
+import com.intellij.openapi.module.Module;
+import com.intellij.openapi.project.Project;
+import com.intellij.remoteServer.ServerType;
+import com.intellij.remoteServer.configuration.RemoteServer;
+import org.jetbrains.annotations.Nullable;
+
+
+public abstract class CloudModuleBuilderContribution {
+
+ public static final ExtensionPointName<CloudModuleBuilderContribution> EP_NAME
+ = ExtensionPointName.create("com.intellij.remoteServer.moduleBuilderContribution");
+
+ public abstract ServerType<?> getCloudType();
+
+ public abstract CloudApplicationConfigurable createApplicationConfigurable(@Nullable Project project, Disposable parentDisposable);
+
+ public abstract void configureModule(Module module,
+ RemoteServer<?> account,
+ CloudApplicationConfiguration configuration);
+
+ public static CloudModuleBuilderContribution getInstanceByType(ServerType<?> cloudType) {
+ for (CloudModuleBuilderContribution contribution : EP_NAME.getExtensions()) {
+ if (contribution.getCloudType() == cloudType) {
+ return contribution;
+ }
+ }
+ return null;
+ }
+}
diff --git a/java/remote-servers/impl/src/com/intellij/remoteServer/impl/module/CloudModuleBuilderContributionBase.java b/java/remote-servers/impl/src/com/intellij/remoteServer/impl/module/CloudModuleBuilderContributionBase.java
new file mode 100644
index 000000000000..6a927d97bb93
--- /dev/null
+++ b/java/remote-servers/impl/src/com/intellij/remoteServer/impl/module/CloudModuleBuilderContributionBase.java
@@ -0,0 +1,142 @@
+/*
+ * Copyright 2000-2014 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.remoteServer.impl.module;
+
+import com.intellij.execution.RunManagerEx;
+import com.intellij.execution.RunnerAndConfigurationSettings;
+import com.intellij.execution.configurations.ConfigurationType;
+import com.intellij.openapi.Disposable;
+import com.intellij.openapi.module.Module;
+import com.intellij.openapi.module.ModulePointer;
+import com.intellij.openapi.module.ModulePointerManager;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.ui.MessageType;
+import com.intellij.remoteServer.ServerType;
+import com.intellij.remoteServer.configuration.RemoteServer;
+import com.intellij.remoteServer.impl.configuration.deployment.DeployToServerConfigurationType;
+import com.intellij.remoteServer.impl.configuration.deployment.DeployToServerRunConfiguration;
+import com.intellij.remoteServer.impl.configuration.deployment.ModuleDeploymentSourceImpl;
+import com.intellij.remoteServer.util.*;
+import com.intellij.remoteServer.util.ssh.SshKeyChecker;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+
+public abstract class CloudModuleBuilderContributionBase<
+ SC extends CloudConfigurationBase,
+ DC extends CloudDeploymentNameConfiguration,
+ AC extends CloudApplicationConfiguration,
+ SR extends CloudMultiSourceServerRuntimeInstance<DC, ?, ?, ?>>
+ extends CloudModuleBuilderContribution {
+
+ @Override
+ public void configureModule(Module module,
+ RemoteServer<?> account,
+ CloudApplicationConfiguration applicationConfiguration) {
+ RemoteServer<SC> castedAccount = (RemoteServer<SC>)account;
+ final AC castedApplicationConfiguration = (AC)applicationConfiguration;
+
+ DC deploymentConfiguration = createDeploymentConfiguration();
+
+ if (applicationConfiguration.isExisting()) {
+ deploymentConfiguration.setDefaultDeploymentName(false);
+ deploymentConfiguration.setDeploymentName(applicationConfiguration.getExistingAppName());
+ }
+
+ final DeployToServerRunConfiguration<SC, DC> runConfiguration = createRunConfiguration(module, castedAccount, deploymentConfiguration);
+
+ final String cloudName = account.getType().getPresentableName();
+ final Project project = module.getProject();
+ new CloudConnectionTask<Object, SC, DC, SR>(project, CloudBundle.getText("cloud.support", cloudName), castedAccount) {
+
+ CloudNotifier myNotifier = new CloudNotifier(cloudName);
+
+ boolean myFirstAttempt = true;
+
+ @Override
+ protected Object run(SR serverRuntime) throws ServerRuntimeException {
+ doConfigureModule(castedApplicationConfiguration, runConfiguration, myFirstAttempt, serverRuntime);
+ myNotifier.showMessage(CloudBundle.getText("cloud.support.added", cloudName), MessageType.INFO);
+ return null;
+ }
+
+ @Override
+ protected void runtimeErrorOccurred(@NotNull String errorMessage) {
+ myFirstAttempt = false;
+ new SshKeyChecker().checkServerError(errorMessage, myNotifier, project, this);
+ }
+ }.performAsync();
+ }
+
+ private DeployToServerRunConfiguration<SC, DC> createRunConfiguration(Module module,
+ RemoteServer<SC> server,
+ DC deploymentConfiguration) {
+ Project project = module.getProject();
+
+ String serverName = server.getName();
+
+ String name = generateRunConfigurationName(serverName, module.getName());
+
+ final RunManagerEx runManager = RunManagerEx.getInstanceEx(project);
+ final RunnerAndConfigurationSettings runSettings
+ = runManager.createRunConfiguration(name, getRunConfigurationType().getConfigurationFactories()[0]);
+
+ final DeployToServerRunConfiguration<SC, DC> result = (DeployToServerRunConfiguration<SC, DC>)runSettings.getConfiguration();
+
+ result.setServerName(serverName);
+
+ final ModulePointer modulePointer = ModulePointerManager.getInstance(project).create(module);
+ result.setDeploymentSource(new ModuleDeploymentSourceImpl(modulePointer));
+
+ result.setDeploymentConfiguration(deploymentConfiguration);
+
+ runManager.addConfiguration(runSettings, false);
+ runManager.setSelectedConfiguration(runSettings);
+
+ return result;
+ }
+
+ private static String generateRunConfigurationName(String serverName, String moduleName) {
+ return CloudBundle.getText("run.configuration.name", serverName, moduleName);
+ }
+
+ private DeployToServerConfigurationType getRunConfigurationType() {
+ String id = DeployToServerConfigurationType.getId(getCloudType());
+ for (ConfigurationType configurationType : ConfigurationType.CONFIGURATION_TYPE_EP.getExtensions()) {
+ if (configurationType instanceof DeployToServerConfigurationType) {
+ DeployToServerConfigurationType deployConfigurationType = (DeployToServerConfigurationType)configurationType;
+ if (deployConfigurationType.getId().equals(id)) {
+ return deployConfigurationType;
+ }
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public abstract ServerType<SC> getCloudType();
+
+ @Override
+ public abstract CloudApplicationConfigurable<SC, DC, SR, AC> createApplicationConfigurable(@Nullable Project project,
+ Disposable parentDisposable);
+
+ protected abstract DC createDeploymentConfiguration();
+
+ protected abstract void doConfigureModule(AC applicationConfiguration,
+ DeployToServerRunConfiguration<SC, DC> runConfiguration,
+ boolean firstAttempt,
+ SR serverRuntime) throws ServerRuntimeException;
+}
diff --git a/java/remote-servers/impl/src/com/intellij/remoteServer/impl/module/CloudModuleWizardStep.form b/java/remote-servers/impl/src/com/intellij/remoteServer/impl/module/CloudModuleWizardStep.form
new file mode 100644
index 000000000000..19cbaa7f2a5f
--- /dev/null
+++ b/java/remote-servers/impl/src/com/intellij/remoteServer/impl/module/CloudModuleWizardStep.form
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.remoteServer.impl.module.CloudModuleWizardStep">
+ <grid id="27dc6" binding="myMainPanel" layout-manager="GridLayoutManager" row-count="5" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
+ <margin top="0" left="0" bottom="0" right="0"/>
+ <constraints>
+ <xy x="20" y="20" width="415" height="400"/>
+ </constraints>
+ <properties/>
+ <border type="none"/>
+ <children>
+ <grid id="b29a2" binding="myAccountPanelPlaceHolder" layout-manager="BorderLayout" hgap="0" vgap="0">
+ <constraints>
+ <grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
+ </constraints>
+ <properties/>
+ <border type="none"/>
+ <children/>
+ </grid>
+ <vspacer id="276c3">
+ <constraints>
+ <grid row="4" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
+ </constraints>
+ </vspacer>
+ <component id="dd5e7" class="com.intellij.ui.TitledSeparator">
+ <constraints>
+ <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
+ </constraints>
+ <properties>
+ <text value="Account"/>
+ </properties>
+ </component>
+ <component id="61d9c" class="com.intellij.ui.TitledSeparator">
+ <constraints>
+ <grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
+ </constraints>
+ <properties>
+ <text value="Application"/>
+ </properties>
+ </component>
+ <grid id="582a2" binding="myApplicationPanelPlaceHolder" layout-manager="CardLayout" hgap="0" vgap="0">
+ <constraints>
+ <grid row="3" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
+ </constraints>
+ <properties/>
+ <border type="none"/>
+ <children/>
+ </grid>
+ </children>
+ </grid>
+</form>
diff --git a/java/remote-servers/impl/src/com/intellij/remoteServer/impl/module/CloudModuleWizardStep.java b/java/remote-servers/impl/src/com/intellij/remoteServer/impl/module/CloudModuleWizardStep.java
new file mode 100644
index 000000000000..cf0e283616b2
--- /dev/null
+++ b/java/remote-servers/impl/src/com/intellij/remoteServer/impl/module/CloudModuleWizardStep.java
@@ -0,0 +1,130 @@
+/*
+ * Copyright 2000-2014 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.remoteServer.impl.module;
+
+import com.intellij.ide.util.projectWizard.ModuleWizardStep;
+import com.intellij.openapi.Disposable;
+import com.intellij.openapi.options.ConfigurationException;
+import com.intellij.openapi.project.Project;
+import com.intellij.remoteServer.ServerType;
+import com.intellij.remoteServer.configuration.RemoteServer;
+import com.intellij.remoteServer.util.CloudAccountSelectionEditor;
+import com.intellij.util.containers.hash.HashMap;
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+
+public class CloudModuleWizardStep extends ModuleWizardStep {
+
+ private JPanel myMainPanel;
+ private JPanel myAccountPanelPlaceHolder;
+ private JPanel myApplicationPanelPlaceHolder;
+
+ private final CloudModuleBuilder myModuleBuilder;
+ private final Project myProject;
+ private final Disposable myParentDisposable;
+
+ private CloudAccountSelectionEditor myAccountSelectionPanel;
+
+ private Map<ServerType<?>, CloudApplicationConfigurable> myCloudType2ApplicationConfigurable;
+
+ public CloudModuleWizardStep(CloudModuleBuilder moduleBuilder, Project project, Disposable parentDisposable) {
+ myModuleBuilder = moduleBuilder;
+ myProject = project;
+ myParentDisposable = parentDisposable;
+
+ myCloudType2ApplicationConfigurable = new HashMap<ServerType<?>, CloudApplicationConfigurable>();
+
+ List<ServerType<?>> cloudTypes = new ArrayList<ServerType<?>>();
+ for (CloudModuleBuilderContribution contribution : CloudModuleBuilderContribution.EP_NAME.getExtensions()) {
+ cloudTypes.add(contribution.getCloudType());
+ }
+
+ myAccountSelectionPanel = new CloudAccountSelectionEditor(cloudTypes);
+ myAccountPanelPlaceHolder.add(myAccountSelectionPanel.getMainPanel());
+
+ myAccountSelectionPanel.setAccountSelectionListener(new Runnable() {
+
+ @Override
+ public void run() {
+ onAccountSelectionChanged();
+ }
+ });
+ onAccountSelectionChanged();
+ }
+
+ private RemoteServer<?> getSelectedAccount() {
+ return myAccountSelectionPanel.getSelectedAccount();
+ }
+
+ private void onAccountSelectionChanged() {
+ CardLayout applicationPlaceHolderLayout = (CardLayout)myApplicationPanelPlaceHolder.getLayout();
+
+ RemoteServer<?> account = getSelectedAccount();
+ boolean haveAccount = account != null;
+ myApplicationPanelPlaceHolder.setVisible(haveAccount);
+ if (!haveAccount) {
+ return;
+ }
+
+ ServerType<?> cloudType = account.getType();
+ String cardName = cloudType.getId();
+ CloudApplicationConfigurable<?, ?, ?, ?> applicationConfigurable = getApplicationConfigurable();
+ if (applicationConfigurable == null) {
+ applicationConfigurable
+ = CloudModuleBuilderContribution.getInstanceByType(cloudType).createApplicationConfigurable(myProject, myParentDisposable);
+ myCloudType2ApplicationConfigurable.put(cloudType, applicationConfigurable);
+ myApplicationPanelPlaceHolder.add(applicationConfigurable.getComponent(), cardName);
+ }
+ applicationPlaceHolderLayout.show(myApplicationPanelPlaceHolder, cardName);
+
+ applicationConfigurable.setAccount(account);
+ }
+
+ @Override
+ public JComponent getComponent() {
+ return myMainPanel;
+ }
+
+ private CloudApplicationConfigurable<?, ?, ?, ?> getApplicationConfigurable() {
+ RemoteServer<?> account = getSelectedAccount();
+ if (account == null) {
+ return null;
+ }
+ return myCloudType2ApplicationConfigurable.get(account.getType());
+ }
+
+ @Override
+ public void updateDataModel() {
+ myModuleBuilder.setAccount(myAccountSelectionPanel.getSelectedAccount());
+ CloudApplicationConfigurable<?, ?, ?, ?> configurable = getApplicationConfigurable();
+ myModuleBuilder.setApplicationConfiguration(configurable == null ? null : configurable.createConfiguration());
+ }
+
+ @Override
+ public boolean validate() throws ConfigurationException {
+ myAccountSelectionPanel.validate();
+ CloudApplicationConfigurable<?, ?, ?, ?> configurable = getApplicationConfigurable();
+ if (configurable != null) {
+ configurable.validate();
+ }
+ return super.validate();
+ }
+}
diff --git a/java/structuralsearch-java/src/META-INF/structuralsearch-java.xml b/java/structuralsearch-java/src/META-INF/structuralsearch-java.xml
new file mode 100644
index 000000000000..765a70d281bd
--- /dev/null
+++ b/java/structuralsearch-java/src/META-INF/structuralsearch-java.xml
@@ -0,0 +1,6 @@
+<idea-plugin>
+ <extensions defaultExtensionNs="com.intellij">
+ <structuralsearch.profile implementation="com.intellij.structuralsearch.JavaStructuralSearchProfile"/>
+ <structuralsearch.matchPredicateProvider implementation="com.intellij.structuralsearch.impl.matcher.JavaMatchPredicateProvider"/>
+ </extensions>
+</idea-plugin>
diff --git a/plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/JavaPredefinedConfigurations.java b/java/structuralsearch-java/src/com/intellij/structuralsearch/JavaPredefinedConfigurations.java
index a82c941c0fa2..a82c941c0fa2 100644
--- a/plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/JavaPredefinedConfigurations.java
+++ b/java/structuralsearch-java/src/com/intellij/structuralsearch/JavaPredefinedConfigurations.java
diff --git a/java/structuralsearch-java/src/com/intellij/structuralsearch/JavaReplaceHandler.java b/java/structuralsearch-java/src/com/intellij/structuralsearch/JavaReplaceHandler.java
new file mode 100644
index 000000000000..562c8aee753c
--- /dev/null
+++ b/java/structuralsearch-java/src/com/intellij/structuralsearch/JavaReplaceHandler.java
@@ -0,0 +1,557 @@
+package com.intellij.structuralsearch;
+
+import com.intellij.openapi.fileTypes.StdFileTypes;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.psi.*;
+import com.intellij.psi.codeStyle.JavaCodeStyleManager;
+import com.intellij.psi.javadoc.PsiDocComment;
+import com.intellij.psi.xml.XmlText;
+import com.intellij.structuralsearch.impl.matcher.JavaMatchingVisitor;
+import com.intellij.structuralsearch.impl.matcher.MatcherImplUtil;
+import com.intellij.structuralsearch.impl.matcher.PatternTreeContext;
+import com.intellij.structuralsearch.plugin.replace.ReplaceOptions;
+import com.intellij.structuralsearch.plugin.replace.ReplacementInfo;
+import com.intellij.structuralsearch.plugin.replace.impl.ReplacementContext;
+import com.intellij.structuralsearch.plugin.replace.impl.Replacer;
+import com.intellij.structuralsearch.plugin.replace.impl.ReplacerUtil;
+import com.intellij.util.IncorrectOperationException;
+import com.siyeh.ig.psiutils.ImportUtils;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author Eugene.Kudelevsky
+ */
+public class JavaReplaceHandler extends StructuralReplaceHandler {
+ private final ReplacementContext myContext;
+ private PsiCodeBlock codeBlock;
+
+ public JavaReplaceHandler(ReplacementContext context) {
+ this.myContext = context;
+ }
+
+ private PsiCodeBlock getCodeBlock() throws IncorrectOperationException {
+ if (codeBlock == null) {
+ codeBlock = (PsiCodeBlock)MatcherImplUtil.createTreeFromText(
+ myContext.getOptions().getMatchOptions().getSearchPattern(),
+ PatternTreeContext.Block,
+ myContext.getOptions().getMatchOptions().getFileType(),
+ myContext.getProject()
+ )[0].getParent();
+ }
+ return codeBlock;
+ }
+
+ private static PsiElement findRealSubstitutionElement(PsiElement el) {
+ if (el instanceof PsiIdentifier) {
+ // matches are tokens, identifiers, etc
+ el = el.getParent();
+ }
+
+ if (el instanceof PsiReferenceExpression &&
+ el.getParent() instanceof PsiMethodCallExpression
+ ) {
+ // method
+ el = el.getParent();
+ }
+
+ if (el instanceof PsiDeclarationStatement && ((PsiDeclarationStatement)el).getDeclaredElements()[0] instanceof PsiClass) {
+ el = ((PsiDeclarationStatement)el).getDeclaredElements()[0];
+ }
+ return el;
+ }
+
+ private static boolean isListContext(PsiElement el) {
+ boolean listContext = false;
+ final PsiElement parent = el.getParent();
+
+ if (parent instanceof PsiParameterList ||
+ parent instanceof PsiExpressionList ||
+ parent instanceof PsiCodeBlock ||
+ parent instanceof PsiClass ||
+ parent instanceof XmlText ||
+ (parent instanceof PsiIfStatement &&
+ (((PsiIfStatement)parent).getThenBranch() == el ||
+ ((PsiIfStatement)parent).getElseBranch() == el
+ )
+ ) ||
+ (parent instanceof PsiLoopStatement &&
+ ((PsiLoopStatement)parent).getBody() == el
+ )
+ ) {
+ listContext = true;
+ }
+
+ return listContext;
+ }
+
+ @Nullable
+ private PsiNamedElement getSymbolReplacementTarget(final PsiElement el)
+ throws IncorrectOperationException {
+ if (myContext.getOptions().getMatchOptions().getFileType() != StdFileTypes.JAVA) return null; //?
+ final PsiStatement[] searchStatements = getCodeBlock().getStatements();
+ if (searchStatements.length > 0 &&
+ searchStatements[0] instanceof PsiExpressionStatement) {
+ final PsiExpression expression = ((PsiExpressionStatement)searchStatements[0]).getExpression();
+
+ if (expression instanceof PsiReferenceExpression &&
+ ((PsiReferenceExpression)expression).getQualifierExpression() == null
+ ) {
+ // looks like symbol replacements, namely replace AAA by BBB, so lets do the best
+ if (el instanceof PsiNamedElement) {
+ return (PsiNamedElement)el;
+ }
+ }
+ }
+
+ return null;
+ }
+
+ private static PsiElement getMatchExpr(PsiElement replacement, PsiElement elementToReplace) {
+ if (replacement instanceof PsiExpressionStatement &&
+ !(replacement.getLastChild() instanceof PsiJavaToken) &&
+ !(replacement.getLastChild() instanceof PsiComment)
+ ) {
+ // replacement is expression (and pattern should be so)
+ // assert ...
+ replacement = ((PsiExpressionStatement)replacement).getExpression();
+ }
+ else if (replacement instanceof PsiDeclarationStatement &&
+ ((PsiDeclarationStatement)replacement).getDeclaredElements().length == 1
+ ) {
+ return ((PsiDeclarationStatement)replacement).getDeclaredElements()[0];
+ }
+ else if (replacement instanceof PsiBlockStatement &&
+ elementToReplace instanceof PsiCodeBlock
+ ) {
+ return ((PsiBlockStatement)replacement).getCodeBlock();
+ }
+
+ return replacement;
+ }
+
+ private boolean isSymbolReplacement(final PsiElement el) throws IncorrectOperationException {
+ return getSymbolReplacementTarget(el) != null;
+ }
+
+ @SuppressWarnings({"unchecked", "ConstantConditions"})
+ private void handleModifierList(final PsiElement el, final PsiElement replacement) throws IncorrectOperationException {
+ // We want to copy all comments, including doc comments and modifier lists
+ // that are present in matched nodes but not present in search/replace
+
+ Map<String, String> newNameToSearchPatternNameMap = myContext.getNewName2PatternNameMap();
+
+ ModifierListOwnerCollector collector = new ModifierListOwnerCollector();
+ el.accept(collector);
+ Map<String, PsiNamedElement> originalNamedElements = (Map<String, PsiNamedElement>)collector.namedElements.clone();
+ collector.namedElements.clear();
+
+ replacement.accept(collector);
+ Map<String, PsiNamedElement> replacedNamedElements = (Map<String, PsiNamedElement>)collector.namedElements.clone();
+ collector.namedElements.clear();
+
+ if (originalNamedElements.size() == 0 && replacedNamedElements.size() == 0) {
+ Replacer.handleComments(el, replacement, myContext);
+ return;
+ }
+
+ final PsiStatement[] statements = getCodeBlock().getStatements();
+ if (statements.length > 0) {
+ statements[0].getParent().accept(collector);
+ }
+
+ Map<String, PsiNamedElement> searchedNamedElements = (Map<String, PsiNamedElement>)collector.namedElements.clone();
+ collector.namedElements.clear();
+
+ for (String name : originalNamedElements.keySet()) {
+ PsiNamedElement originalNamedElement = originalNamedElements.get(name);
+ PsiNamedElement replacementNamedElement = replacedNamedElements.get(name);
+ String key = newNameToSearchPatternNameMap.get(name);
+ if (key == null) key = name;
+ PsiNamedElement searchNamedElement = searchedNamedElements.get(key);
+
+ if (replacementNamedElement == null && originalNamedElements.size() == 1 && replacedNamedElements.size() == 1) {
+ replacementNamedElement = replacedNamedElements.entrySet().iterator().next().getValue();
+ }
+
+ PsiElement comment = null;
+
+ if (originalNamedElement instanceof PsiDocCommentOwner) {
+ comment = ((PsiDocCommentOwner)originalNamedElement).getDocComment();
+ if (comment == null) {
+ PsiElement prevElement = originalNamedElement.getPrevSibling();
+ if (prevElement instanceof PsiWhiteSpace) {
+ prevElement = prevElement.getPrevSibling();
+ }
+ if (prevElement instanceof PsiComment) {
+ comment = prevElement;
+ }
+ }
+ }
+
+ if (replacementNamedElement != null && searchNamedElement != null) {
+ Replacer.handleComments(originalNamedElement, replacementNamedElement, myContext);
+ }
+
+ if (comment != null && replacementNamedElement instanceof PsiDocCommentOwner &&
+ !(replacementNamedElement.getFirstChild() instanceof PsiDocComment)
+ ) {
+ final PsiElement nextSibling = comment.getNextSibling();
+ PsiElement prevSibling = comment.getPrevSibling();
+ replacementNamedElement.addRangeBefore(
+ prevSibling instanceof PsiWhiteSpace ? prevSibling : comment,
+ nextSibling instanceof PsiWhiteSpace ? nextSibling : comment,
+ replacementNamedElement.getFirstChild()
+ );
+ }
+
+ if (originalNamedElement instanceof PsiModifierListOwner &&
+ replacementNamedElement instanceof PsiModifierListOwner
+ ) {
+ PsiModifierList modifierList = ((PsiModifierListOwner)originalNamedElements.get(name)).getModifierList();
+
+ if (searchNamedElement instanceof PsiModifierListOwner) {
+ PsiModifierList modifierListOfSearchedElement = ((PsiModifierListOwner)searchNamedElement).getModifierList();
+ final PsiModifierListOwner modifierListOwner = ((PsiModifierListOwner)replacementNamedElement);
+ PsiModifierList modifierListOfReplacement = modifierListOwner.getModifierList();
+
+ if (modifierListOfSearchedElement.getTextLength() == 0 &&
+ modifierListOfReplacement.getTextLength() == 0 &&
+ modifierList.getTextLength() > 0
+ ) {
+ PsiElement space = modifierList.getNextSibling();
+ if (!(space instanceof PsiWhiteSpace)) {
+ space = createWhiteSpace(space);
+ }
+
+ modifierListOfReplacement.replace(modifierList);
+ // copy space after modifier list
+ if (space instanceof PsiWhiteSpace) {
+ modifierListOwner.addRangeAfter(space, space, modifierListOwner.getModifierList());
+ }
+ } else if (modifierListOfSearchedElement.getTextLength() == 0 && modifierList.getTextLength() > 0) {
+ modifierListOfReplacement.addRange(modifierList.getFirstChild(), modifierList.getLastChild());
+ }
+ }
+ }
+ }
+ }
+
+ private PsiElement handleSymbolReplacement(PsiElement replacement, final PsiElement el) throws IncorrectOperationException {
+ PsiNamedElement nameElement = getSymbolReplacementTarget(el);
+ if (nameElement != null) {
+ PsiElement oldReplacement = replacement;
+ replacement = el.copy();
+ ((PsiNamedElement)replacement).setName(oldReplacement.getText());
+ }
+
+ return replacement;
+ }
+
+ public void replace(final ReplacementInfo info, ReplaceOptions options) {
+ PsiElement elementToReplace = info.getMatch(0);
+ PsiElement elementParent = elementToReplace.getParent();
+ String replacementToMake = info.getReplacement();
+ Project project = myContext.getProject();
+ PsiElement el = findRealSubstitutionElement(elementToReplace);
+ boolean listContext = isListContext(el);
+
+ if (el instanceof PsiAnnotation && !StringUtil.startsWithChar(replacementToMake, '@')) {
+ replacementToMake = "@" + replacementToMake;
+ }
+
+ PsiElement[] statements = ReplacerUtil
+ .createTreeForReplacement(replacementToMake, el instanceof PsiMember && !isSymbolReplacement(el) ?
+ PatternTreeContext.Class :
+ PatternTreeContext.Block, myContext);
+
+ if (listContext) {
+ if (statements.length > 1) {
+ elementParent.addRangeBefore(statements[0], statements[statements.length - 1], elementToReplace);
+ }
+ else if (statements.length == 1) {
+ PsiElement replacement = getMatchExpr(statements[0], elementToReplace);
+
+ handleModifierList(el, replacement);
+ replacement = handleSymbolReplacement(replacement, el);
+
+ if (replacement instanceof PsiTryStatement) {
+ final List<PsiCatchSection> unmatchedCatchSections = el.getUserData(JavaMatchingVisitor.UNMATCHED_CATCH_SECTION_CONTENT_VAR_KEY);
+ final PsiCatchSection[] catches = ((PsiTryStatement)replacement).getCatchSections();
+
+ if (unmatchedCatchSections != null) {
+ for (int i = unmatchedCatchSections.size() - 1; i >= 0; --i) {
+ final PsiParameter parameter = unmatchedCatchSections.get(i).getParameter();
+ final PsiElementFactory elementFactory = JavaPsiFacade.getInstance(project).getElementFactory();
+ final PsiCatchSection catchSection = elementFactory.createCatchSection(parameter.getType(), parameter.getName(), null);
+
+ catchSection.getCatchBlock().replace(
+ unmatchedCatchSections.get(i).getCatchBlock()
+ );
+ replacement.addAfter(
+ catchSection, catches[catches.length - 1]
+ );
+ replacement.addBefore(createWhiteSpace(replacement), replacement.getLastChild());
+ }
+ }
+ }
+
+ try {
+ final PsiElement inserted = elementParent.addBefore(replacement, elementToReplace);
+
+ if (replacement instanceof PsiComment &&
+ (elementParent instanceof PsiIfStatement ||
+ elementParent instanceof PsiLoopStatement
+ )
+ ) {
+ elementParent.addAfter(createSemicolon(replacement), inserted);
+ }
+ }
+ catch (IncorrectOperationException e) {
+ elementToReplace.replace(replacement);
+ }
+ }
+ }
+ else if (statements.length > 0) {
+ PsiElement replacement = ReplacerUtil.copySpacesAndCommentsBefore(elementToReplace, statements, replacementToMake, elementParent);
+
+ replacement = getMatchExpr(replacement, elementToReplace);
+
+ if (replacement instanceof PsiStatement &&
+ !(replacement.getLastChild() instanceof PsiJavaToken) &&
+ !(replacement.getLastChild() instanceof PsiComment)
+ ) {
+ // assert w/o ;
+ final PsiElement prevLastChildInParent = replacement.getLastChild().getPrevSibling();
+
+ if (prevLastChildInParent != null) {
+ elementParent.addRangeBefore(replacement.getFirstChild(), prevLastChildInParent, el);
+ }
+ else {
+ elementParent.addBefore(replacement.getFirstChild(), el);
+ }
+
+ el.getNode().getTreeParent().removeChild(el.getNode());
+ }
+ else {
+ // preserve comments
+ handleModifierList(el, replacement);
+
+ if (replacement instanceof PsiClass) {
+ // modifier list
+ final PsiStatement[] searchStatements = getCodeBlock().getStatements();
+ if (searchStatements.length > 0 &&
+ searchStatements[0] instanceof PsiDeclarationStatement &&
+ ((PsiDeclarationStatement)searchStatements[0]).getDeclaredElements()[0] instanceof PsiClass
+ ) {
+ final PsiClass replaceClazz = (PsiClass)replacement;
+ final PsiClass queryClazz = (PsiClass)((PsiDeclarationStatement)searchStatements[0]).getDeclaredElements()[0];
+ final PsiClass clazz = (PsiClass)el;
+
+ if (replaceClazz.getExtendsList().getTextLength() == 0 &&
+ queryClazz.getExtendsList().getTextLength() == 0 &&
+ clazz.getExtendsList().getTextLength() != 0
+ ) {
+ replaceClazz.addBefore(clazz.getExtendsList().getPrevSibling(), replaceClazz.getExtendsList()); // whitespace
+ replaceClazz.getExtendsList().addRange(
+ clazz.getExtendsList().getFirstChild(), clazz.getExtendsList().getLastChild()
+ );
+ }
+
+ if (replaceClazz.getImplementsList().getTextLength() == 0 &&
+ queryClazz.getImplementsList().getTextLength() == 0 &&
+ clazz.getImplementsList().getTextLength() != 0
+ ) {
+ replaceClazz.addBefore(clazz.getImplementsList().getPrevSibling(), replaceClazz.getImplementsList()); // whitespace
+ replaceClazz.getImplementsList().addRange(
+ clazz.getImplementsList().getFirstChild(),
+ clazz.getImplementsList().getLastChild()
+ );
+ }
+
+ if (replaceClazz.getTypeParameterList().getTextLength() == 0 &&
+ queryClazz.getTypeParameterList().getTextLength() == 0 &&
+ clazz.getTypeParameterList().getTextLength() != 0
+ ) {
+ // skip < and >
+ replaceClazz.getTypeParameterList().replace(
+ clazz.getTypeParameterList()
+ );
+ }
+ }
+ }
+
+ replacement = handleSymbolReplacement(replacement, el);
+
+ el.replace(replacement);
+ }
+ }
+ else {
+ final PsiElement nextSibling = el.getNextSibling();
+ el.delete();
+ if (nextSibling instanceof PsiWhiteSpace && nextSibling.isValid()) {
+ nextSibling.delete();
+ }
+ }
+
+ if (listContext) {
+ final int matchSize = info.getMatchesCount();
+
+ for (int i = 0; i < matchSize; ++i) {
+ PsiElement matchElement = info.getMatch(i);
+ PsiElement element = findRealSubstitutionElement(matchElement);
+
+ if (element == null) continue;
+ PsiElement firstToDelete = element;
+ PsiElement lastToDelete = element;
+ PsiElement prevSibling = element.getPrevSibling();
+ PsiElement nextSibling = element.getNextSibling();
+
+ if (prevSibling instanceof PsiWhiteSpace) {
+ firstToDelete = prevSibling;
+ prevSibling = prevSibling != null ? prevSibling.getPrevSibling() : null;
+ }
+ else if (prevSibling == null && nextSibling instanceof PsiWhiteSpace) {
+ lastToDelete = nextSibling;
+ }
+
+ if (nextSibling instanceof XmlText && i + 1 < matchSize) {
+ final PsiElement next = info.getMatch(i + 1);
+ if (next != null && next == nextSibling.getNextSibling()) {
+ lastToDelete = nextSibling;
+ }
+ }
+
+ if (element instanceof PsiExpression) {
+ final PsiElement parent = element.getParent().getParent();
+ if ((parent instanceof PsiCall ||
+ parent instanceof PsiAnonymousClass
+ ) &&
+ prevSibling instanceof PsiJavaToken &&
+ ((PsiJavaToken)prevSibling).getTokenType() == JavaTokenType.COMMA
+ ) {
+ firstToDelete = prevSibling;
+ }
+ }
+ else if (element instanceof PsiParameter &&
+ prevSibling instanceof PsiJavaToken &&
+ ((PsiJavaToken)prevSibling).getTokenType() == JavaTokenType.COMMA
+ ) {
+ firstToDelete = prevSibling;
+ }
+
+ element.getParent().deleteChildRange(firstToDelete, lastToDelete);
+ }
+ }
+ }
+
+ @Override
+ public void postProcess(PsiElement affectedElement, ReplaceOptions options) {
+ if (!affectedElement.isValid()) {
+ return;
+ }
+ if (options.isToUseStaticImport()) {
+ shortenWithStaticImports(affectedElement, 0, affectedElement.getTextLength());
+ }
+ if (options.isToShortenFQN()) {
+ final JavaCodeStyleManager codeStyleManager = JavaCodeStyleManager.getInstance(affectedElement.getProject());
+ codeStyleManager.shortenClassReferences(affectedElement, 0, affectedElement.getTextLength());
+ }
+ }
+
+ private static void shortenWithStaticImports(PsiElement affectedElement, int startOffset, int endOffset) {
+ final int elementOffset = affectedElement.getTextOffset();
+ final int finalStartOffset = startOffset + elementOffset;
+ final int finalEndOffset = endOffset + elementOffset;
+ final List<PsiReferenceExpression> references = new ArrayList<PsiReferenceExpression>();
+ final JavaRecursiveElementVisitor collector = new JavaRecursiveElementVisitor() {
+ @Override
+ public void visitReferenceExpression(PsiReferenceExpression expression) {
+ final int offset = expression.getTextOffset();
+ if (offset > finalEndOffset) {
+ return;
+ }
+ super.visitReferenceExpression(expression);
+ if (offset + expression.getTextLength() < finalStartOffset)
+ if (expression.getQualifierExpression() == null) {
+ return;
+ }
+ references.add(expression);
+ }
+ };
+ affectedElement.accept(collector);
+ for (PsiReferenceExpression expression : references) {
+ final PsiElement target = expression.resolve();
+ if (!(target instanceof PsiMember)) {
+ continue;
+ }
+ final PsiMember member = (PsiMember)target;
+ final PsiClass containingClass = member.getContainingClass();
+ if (containingClass == null) {
+ continue;
+ }
+ final String className = containingClass.getQualifiedName();
+ if (className == null) {
+ continue;
+ }
+ final String name = member.getName();
+ if (name == null) {
+ continue;
+ }
+ if (ImportUtils.addStaticImport(className, name, expression)) {
+ final PsiExpression qualifierExpression = expression.getQualifierExpression();
+ if (qualifierExpression != null) {
+ qualifierExpression.delete();
+ }
+ }
+ }
+ }
+
+ @Nullable
+ private static PsiElement createSemicolon(final PsiElement space) throws IncorrectOperationException {
+ final PsiStatement text = JavaPsiFacade.getInstance(space.getProject()).getElementFactory().createStatementFromText(";", null);
+ return text.getFirstChild();
+ }
+
+ private static PsiElement createWhiteSpace(final PsiElement space) throws IncorrectOperationException {
+ return PsiParserFacade.SERVICE.getInstance(space.getProject()).createWhiteSpaceFromText(" ");
+ }
+
+ private static class ModifierListOwnerCollector extends JavaRecursiveElementWalkingVisitor {
+ HashMap<String, PsiNamedElement> namedElements = new HashMap<String, PsiNamedElement>(1);
+
+ @Override
+ public void visitClass(PsiClass aClass) {
+ if (aClass instanceof PsiAnonymousClass) return;
+ handleNamedElement(aClass);
+ }
+
+ private void handleNamedElement(final PsiNamedElement named) {
+ String name = named.getName();
+
+ assert name != null;
+
+ if (StructuralSearchUtil.isTypedVariable(name)) {
+ name = name.substring(1, name.length() - 1);
+ }
+
+ if (!namedElements.containsKey(name)) namedElements.put(name, named);
+ named.acceptChildren(this);
+ }
+
+ @Override
+ public void visitVariable(PsiVariable var) {
+ handleNamedElement(var);
+ }
+
+ @Override
+ public void visitMethod(PsiMethod method) {
+ handleNamedElement(method);
+ }
+ }
+}
diff --git a/java/structuralsearch-java/src/com/intellij/structuralsearch/JavaStructuralSearchProfile.java b/java/structuralsearch-java/src/com/intellij/structuralsearch/JavaStructuralSearchProfile.java
new file mode 100644
index 000000000000..869f01cc7394
--- /dev/null
+++ b/java/structuralsearch-java/src/com/intellij/structuralsearch/JavaStructuralSearchProfile.java
@@ -0,0 +1,661 @@
+package com.intellij.structuralsearch;
+
+import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer;
+import com.intellij.codeInsight.template.JavaCodeContextType;
+import com.intellij.codeInsight.template.TemplateContextType;
+import com.intellij.codeInsight.template.TemplateManager;
+import com.intellij.dupLocator.iterators.NodeIterator;
+import com.intellij.lang.Language;
+import com.intellij.lang.StdLanguages;
+import com.intellij.openapi.editor.Document;
+import com.intellij.openapi.editor.Editor;
+import com.intellij.openapi.fileEditor.FileEditorManager;
+import com.intellij.openapi.fileTypes.FileType;
+import com.intellij.openapi.fileTypes.LanguageFileType;
+import com.intellij.openapi.fileTypes.StdFileTypes;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.psi.*;
+import com.intellij.psi.util.PsiTreeUtil;
+import com.intellij.psi.util.PsiUtilCore;
+import com.intellij.structuralsearch.impl.matcher.*;
+import com.intellij.structuralsearch.impl.matcher.compiler.GlobalCompilingVisitor;
+import com.intellij.structuralsearch.impl.matcher.compiler.JavaCompilingVisitor;
+import com.intellij.structuralsearch.impl.matcher.compiler.PatternCompiler;
+import com.intellij.structuralsearch.impl.matcher.filters.JavaLexicalNodesFilter;
+import com.intellij.structuralsearch.impl.matcher.filters.LexicalNodesFilter;
+import com.intellij.structuralsearch.plugin.replace.ReplaceOptions;
+import com.intellij.structuralsearch.plugin.replace.impl.ParameterInfo;
+import com.intellij.structuralsearch.plugin.replace.impl.ReplacementBuilder;
+import com.intellij.structuralsearch.plugin.replace.impl.ReplacementContext;
+import com.intellij.structuralsearch.plugin.replace.impl.Replacer;
+import com.intellij.structuralsearch.plugin.ui.Configuration;
+import com.intellij.structuralsearch.plugin.ui.SearchContext;
+import com.intellij.structuralsearch.plugin.ui.UIUtil;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.*;
+
+/**
+ * @author Eugene.Kudelevsky
+ */
+public class JavaStructuralSearchProfile extends StructuralSearchProfile {
+ private JavaLexicalNodesFilter myJavaLexicalNodesFilter;
+
+ public String getText(PsiElement match, int start,int end) {
+ if (match instanceof PsiIdentifier) {
+ PsiElement parent = match.getParent();
+ if (parent instanceof PsiJavaCodeReferenceElement && !(parent instanceof PsiExpression)) {
+ match = parent; // care about generic
+ }
+ }
+ final String matchText = match.getText();
+ if (start==0 && end==-1) return matchText;
+ return matchText.substring(start,end == -1? matchText.length():end);
+ }
+
+ public Class getElementContextByPsi(PsiElement element) {
+ if (element instanceof PsiIdentifier) {
+ element = element.getParent();
+ }
+
+ if (element instanceof PsiMember) {
+ return PsiMember.class;
+ } else {
+ return PsiExpression.class;
+ }
+ }
+
+ public String getTypedVarString(final PsiElement element) {
+ String text;
+
+ if (element instanceof PsiNamedElement) {
+ text = ((PsiNamedElement)element).getName();
+ }
+ else if (element instanceof PsiAnnotation) {
+ PsiJavaCodeReferenceElement referenceElement = ((PsiAnnotation)element).getNameReferenceElement();
+ text = referenceElement == null ? null : referenceElement.getQualifiedName();
+ }
+ else if (element instanceof PsiNameValuePair) {
+ text = ((PsiNameValuePair)element).getName();
+ }
+ else {
+ text = element.getText();
+ if (StringUtil.startsWithChar(text, '@')) {
+ text = text.substring(1);
+ }
+ if (StringUtil.endsWithChar(text, ';')) text = text.substring(0, text.length() - 1);
+ else if (element instanceof PsiExpressionStatement) {
+ int i = text.indexOf(';');
+ if (i != -1) text = text.substring(0, i);
+ }
+ }
+
+ if (text==null) text = element.getText();
+
+ return text;
+ }
+
+ @Override
+ public String getMeaningfulText(PsiElement element) {
+ if (element instanceof PsiReferenceExpression &&
+ ((PsiReferenceExpression)element).getQualifierExpression() != null) {
+ final PsiElement resolve = ((PsiReferenceExpression)element).resolve();
+ if (resolve instanceof PsiClass) return element.getText();
+
+ final PsiElement referencedElement = ((PsiReferenceExpression)element).getReferenceNameElement();
+ String text = referencedElement != null ? referencedElement.getText() : "";
+
+ if (resolve == null && text.length() > 0 && Character.isUpperCase(text.charAt(0))) {
+ return element.getText();
+ }
+ return text;
+ }
+ return super.getMeaningfulText(element);
+ }
+
+ @Override
+ public PsiElement updateCurrentNode(PsiElement targetNode) {
+ if (targetNode instanceof PsiCodeBlock && ((PsiCodeBlock)targetNode).getStatements().length == 1) {
+ PsiElement targetNodeParent = targetNode.getParent();
+ if (targetNodeParent instanceof PsiBlockStatement) {
+ targetNodeParent = targetNodeParent.getParent();
+ }
+
+ if (targetNodeParent instanceof PsiIfStatement || targetNodeParent instanceof PsiLoopStatement) {
+ targetNode = targetNodeParent;
+ }
+ }
+ return targetNode;
+ }
+
+ @Override
+ public PsiElement extendMatchedByDownUp(PsiElement targetNode) {
+ if (targetNode instanceof PsiIdentifier) {
+ targetNode = targetNode.getParent();
+ final PsiElement parent = targetNode.getParent();
+ if (parent instanceof PsiTypeElement || parent instanceof PsiStatement) targetNode = parent;
+ }
+ return targetNode;
+ }
+
+ @Override
+ public PsiElement extendMatchOnePsiFile(PsiElement file) {
+ if (file instanceof PsiIdentifier) {
+ // Searching in previous results
+ file = file.getParent();
+ }
+ return file;
+ }
+
+ public void compile(PsiElement[] elements, @NotNull GlobalCompilingVisitor globalVisitor) {
+ elements[0].getParent().accept(new JavaCompilingVisitor(globalVisitor));
+ }
+
+ @NotNull
+ public PsiElementVisitor createMatchingVisitor(@NotNull GlobalMatchingVisitor globalVisitor) {
+ return new JavaMatchingVisitor(globalVisitor);
+ }
+
+ @NotNull
+ @Override
+ public PsiElementVisitor getLexicalNodesFilter(@NotNull LexicalNodesFilter filter) {
+ if (myJavaLexicalNodesFilter == null) {
+ myJavaLexicalNodesFilter = new JavaLexicalNodesFilter(filter);
+ }
+ return myJavaLexicalNodesFilter;
+ }
+
+ @NotNull
+ public CompiledPattern createCompiledPattern() {
+ return new JavaCompiledPattern();
+ }
+
+ @Override
+ public boolean canProcess(@NotNull FileType fileType) {
+ return fileType == StdFileTypes.JAVA;
+ }
+
+ public boolean isMyLanguage(@NotNull Language language) {
+ return language == StdLanguages.JAVA;
+ }
+
+ @Override
+ public StructuralReplaceHandler getReplaceHandler(@NotNull ReplacementContext context) {
+ return new JavaReplaceHandler(context);
+ }
+
+ @NotNull
+ @Override
+ public PsiElement[] createPatternTree(@NotNull String text,
+ @NotNull PatternTreeContext context,
+ @NotNull FileType fileType,
+ @Nullable Language language,
+ String contextName, @Nullable String extension,
+ @NotNull Project project,
+ boolean physical) {
+ if (physical) {
+ throw new UnsupportedOperationException(getClass() + " cannot create physical PSI");
+ }
+ PsiElementFactory elementFactory = JavaPsiFacade.getInstance(project).getElementFactory();
+ if (context == PatternTreeContext.Block) {
+ PsiElement element = elementFactory.createStatementFromText("{\n" + text + "\n}", null);
+ final PsiElement[] children = ((PsiBlockStatement)element).getCodeBlock().getChildren();
+ final int extraChildCount = 4;
+
+ if (children.length > extraChildCount) {
+ PsiElement[] result = new PsiElement[children.length - extraChildCount];
+ final int extraChildStart = 2;
+ System.arraycopy(children, extraChildStart, result, 0, children.length - extraChildCount);
+ return result;
+ }
+ else {
+ return PsiElement.EMPTY_ARRAY;
+ }
+ }
+ else if (context == PatternTreeContext.Class) {
+ PsiElement element = elementFactory.createStatementFromText("class A {\n" + text + "\n}", null);
+ PsiClass clazz = (PsiClass)((PsiDeclarationStatement)element).getDeclaredElements()[0];
+ PsiElement startChild = clazz.getLBrace();
+ if (startChild != null) startChild = startChild.getNextSibling();
+
+ PsiElement endChild = clazz.getRBrace();
+ if (endChild != null) endChild = endChild.getPrevSibling();
+ if (startChild == endChild) return PsiElement.EMPTY_ARRAY; // nothing produced
+
+ final List<PsiElement> result = new ArrayList<PsiElement>(3);
+ assert startChild != null;
+ for (PsiElement el = startChild.getNextSibling(); el != endChild && el != null; el = el.getNextSibling()) {
+ if (el instanceof PsiErrorElement) continue;
+ result.add(el);
+ }
+
+ return PsiUtilCore.toPsiElementArray(result);
+ }
+ else {
+ return PsiFileFactory.getInstance(project).createFileFromText("__dummy.java", text).getChildren();
+ }
+ }
+
+ @NotNull
+ @Override
+ public Editor createEditor(@NotNull SearchContext searchContext,
+ @NotNull FileType fileType,
+ Language dialect,
+ String text,
+ boolean useLastConfiguration) {
+ // provides autocompletion
+
+ PsiElement element = searchContext.getFile();
+
+ if (element != null && !useLastConfiguration) {
+ final Editor selectedEditor = FileEditorManager.getInstance(searchContext.getProject()).getSelectedTextEditor();
+
+ if (selectedEditor != null) {
+ int caretPosition = selectedEditor.getCaretModel().getOffset();
+ PsiElement positionedElement = searchContext.getFile().findElementAt(caretPosition);
+
+ if (positionedElement == null) {
+ positionedElement = searchContext.getFile().findElementAt(caretPosition + 1);
+ }
+
+ if (positionedElement != null) {
+ element = PsiTreeUtil.getParentOfType(
+ positionedElement,
+ PsiClass.class, PsiCodeBlock.class
+ );
+ }
+ }
+ }
+
+ final PsiManager psimanager = PsiManager.getInstance(searchContext.getProject());
+ final Project project = psimanager.getProject();
+ final PsiCodeFragment file = createCodeFragment(project, text, element);
+ final Document doc = PsiDocumentManager.getInstance(searchContext.getProject()).getDocument(file);
+ DaemonCodeAnalyzer.getInstance(searchContext.getProject()).setHighlightingEnabled(file, false);
+ return UIUtil.createEditor(doc, searchContext.getProject(), true, true, getTemplateContextType());
+ }
+
+ @Override
+ public Class<? extends TemplateContextType> getTemplateContextTypeClass() {
+ return JavaCodeContextType.class;
+ }
+
+ public PsiCodeFragment createCodeFragment(Project project, String text, PsiElement context) {
+ final JavaCodeFragmentFactory factory = JavaCodeFragmentFactory.getInstance(project);
+ return factory.createCodeBlockCodeFragment(text, context, true);
+ }
+
+ @Override
+ public void checkSearchPattern(Project project, MatchOptions options) {
+ class ValidatingVisitor extends JavaRecursiveElementWalkingVisitor {
+ private PsiElement myCurrent;
+
+ @Override public void visitAnnotation(PsiAnnotation annotation) {
+ final PsiJavaCodeReferenceElement nameReferenceElement = annotation.getNameReferenceElement();
+
+ if (nameReferenceElement == null ||
+ !nameReferenceElement.getText().equals(MatchOptions.MODIFIER_ANNOTATION_NAME)) {
+ return;
+ }
+
+ for(PsiNameValuePair pair:annotation.getParameterList().getAttributes()) {
+ final PsiAnnotationMemberValue value = pair.getValue();
+
+ if (value instanceof PsiArrayInitializerMemberValue) {
+ for(PsiAnnotationMemberValue v:((PsiArrayInitializerMemberValue)value).getInitializers()) {
+ final String name = StringUtil.stripQuotesAroundValue(v.getText());
+ checkModifier(name);
+ }
+
+ } else if (value != null) {
+ final String name = StringUtil.stripQuotesAroundValue(value.getText());
+ checkModifier(name);
+ }
+ }
+ }
+
+ private void checkModifier(final String name) {
+ if (!MatchOptions.INSTANCE_MODIFIER_NAME.equals(name) &&
+ !PsiModifier.PACKAGE_LOCAL.equals(name) &&
+ Arrays.binarySearch(JavaMatchingVisitor.MODIFIERS, name) < 0
+ ) {
+ throw new MalformedPatternException(SSRBundle.message("invalid.modifier.type",name));
+ }
+ }
+
+ @Override
+ public void visitErrorElement(PsiErrorElement element) {
+ super.visitErrorElement(element);
+ //final PsiElement parent = element.getParent();
+ //if (parent != myCurrent || !"';' expected".equals(element.getErrorDescription())) {
+ // throw new MalformedPatternException(element.getErrorDescription());
+ //}
+ }
+
+ public void setCurrent(PsiElement current) {
+ myCurrent = current;
+ }
+ }
+ ValidatingVisitor visitor = new ValidatingVisitor();
+ final CompiledPattern compiledPattern = PatternCompiler.compilePattern(project, options);
+ final int nodeCount = compiledPattern.getNodeCount();
+ final NodeIterator nodes = compiledPattern.getNodes();
+ while (nodes.hasNext()) {
+ final PsiElement current = nodes.current();
+ visitor.setCurrent(nodeCount == 1 && current instanceof PsiExpressionStatement ? current : null);
+ current.accept(visitor);
+ nodes.advance();
+ }
+ nodes.reset();
+ }
+
+ @Override
+ public void checkReplacementPattern(Project project, ReplaceOptions options) {
+ MatchOptions matchOptions = options.getMatchOptions();
+ FileType fileType = matchOptions.getFileType();
+ PsiElement[] statements = MatcherImplUtil.createTreeFromText(
+ matchOptions.getSearchPattern(),
+ PatternTreeContext.Block,
+ fileType,
+ project
+ );
+ final boolean searchIsExpression = statements.length == 1 && statements[0].getLastChild() instanceof PsiErrorElement;
+
+ PsiElement[] statements2 = MatcherImplUtil.createTreeFromText(
+ options.getReplacement(),
+ PatternTreeContext.Block,
+ fileType,
+ project
+ );
+ final boolean replaceIsExpression = statements2.length == 1 && statements2[0].getLastChild() instanceof PsiErrorElement;
+
+ if (searchIsExpression != replaceIsExpression) {
+ throw new UnsupportedPatternException(
+ searchIsExpression ? SSRBundle.message("replacement.template.is.not.expression.error.message") :
+ SSRBundle.message("search.template.is.not.expression.error.message")
+ );
+ }
+ }
+
+ @Override
+ public LanguageFileType getDefaultFileType(LanguageFileType currentDefaultFileType) {
+ return StdFileTypes.JAVA;
+ }
+
+ @Override
+ Configuration[] getPredefinedTemplates() {
+ return JavaPredefinedConfigurations.createPredefinedTemplates();
+ }
+
+ @Override
+ public void provideAdditionalReplaceOptions(@NotNull PsiElement node, final ReplaceOptions options, final ReplacementBuilder builder) {
+ final String templateText = TemplateManager.getInstance(node.getProject()).createTemplate("", "", options.getReplacement()).getTemplateText();
+ node.accept(new JavaRecursiveElementWalkingVisitor() {
+ @Override
+ public void visitReferenceExpression(PsiReferenceExpression expression) {
+ visitElement(expression);
+ }
+
+ @Override
+ public void visitVariable(PsiVariable field) {
+ super.visitVariable(field);
+
+ final PsiExpression initializer = field.getInitializer();
+
+ if (initializer != null) {
+ final String initText = initializer.getText();
+
+ if (StructuralSearchUtil.isTypedVariable(initText)) {
+ final ParameterInfo initInfo = builder.findParameterization(Replacer.stripTypedVariableDecoration(initText));
+
+ if (initInfo != null) {
+ initInfo.setVariableInitializerContext(true);
+ }
+ }
+ }
+ }
+
+ @Override
+ public void visitClass(PsiClass aClass) {
+ super.visitClass(aClass);
+
+ MatchVariableConstraint constraint =
+ options.getMatchOptions().getVariableConstraint(CompiledPattern.ALL_CLASS_UNMATCHED_CONTENT_VAR_ARTIFICIAL_NAME);
+ if (constraint != null) {
+ ParameterInfo e = new ParameterInfo();
+ e.setName(CompiledPattern.ALL_CLASS_UNMATCHED_CONTENT_VAR_ARTIFICIAL_NAME);
+ e.setStartIndex(templateText.lastIndexOf('}'));
+ builder.addParametrization(e);
+ }
+ }
+
+ @Override
+ public void visitParameter(PsiParameter parameter) {
+ super.visitParameter(parameter);
+
+ String name = parameter.getName();
+ String type = parameter.getType().getCanonicalText();
+
+ if (StructuralSearchUtil.isTypedVariable(name)) {
+ name = Replacer.stripTypedVariableDecoration(name);
+
+ if (StructuralSearchUtil.isTypedVariable(type)) {
+ type = Replacer.stripTypedVariableDecoration(type);
+ }
+ ParameterInfo nameInfo = builder.findParameterization(name);
+ ParameterInfo typeInfo = builder.findParameterization(type);
+
+ if (nameInfo != null && typeInfo != null && !(parameter.getParent() instanceof PsiCatchSection)) {
+ nameInfo.setArgumentContext(false);
+ typeInfo.setArgumentContext(false);
+ typeInfo.setMethodParameterContext(true);
+ nameInfo.setMethodParameterContext(true);
+ typeInfo.setElement(parameter.getTypeElement());
+ }
+ }
+ }
+ });
+ }
+
+ @Override
+ public int handleSubstitution(final ParameterInfo info,
+ MatchResult match,
+ StringBuilder result,
+ int offset,
+ HashMap<String, MatchResult> matchMap) {
+ if (info.getName().equals(match.getName())) {
+ String replacementString = match.getMatchImage();
+ boolean forceAddingNewLine = false;
+
+ if (info.isMethodParameterContext()) {
+ StringBuilder buf = new StringBuilder();
+ handleMethodParameter(buf, info, matchMap);
+ replacementString = buf.toString();
+ }
+ else if (match.getAllSons().size() > 0 && !match.isScopeMatch()) {
+ // compound matches
+ StringBuilder buf = new StringBuilder();
+ MatchResult r = null;
+
+ for (final MatchResult matchResult : match.getAllSons()) {
+ MatchResult previous = r;
+ r = matchResult;
+
+ final PsiElement currentElement = r.getMatch();
+
+ if (buf.length() > 0) {
+ final PsiElement parent = currentElement.getParent();
+ if (info.isStatementContext()) {
+ final PsiElement previousElement = previous.getMatchRef().getElement();
+
+ if (!(previousElement instanceof PsiComment) &&
+ ( buf.charAt(buf.length() - 1) != '}' ||
+ previousElement instanceof PsiDeclarationStatement
+ )
+ ) {
+ buf.append(';');
+ }
+
+ final PsiElement prevSibling = currentElement.getPrevSibling();
+
+ if (prevSibling instanceof PsiWhiteSpace &&
+ prevSibling.getPrevSibling() == previous.getMatch()
+ ) {
+ // consequent statements matched so preserve whitespacing
+ buf.append(prevSibling.getText());
+ }
+ else {
+ buf.append('\n');
+ }
+ }
+ else if (info.isArgumentContext()) {
+ buf.append(',');
+ }
+ else if (parent instanceof PsiClass) {
+ final PsiElement prevSibling = PsiTreeUtil.skipSiblingsBackward(currentElement, PsiWhiteSpace.class);
+ if (prevSibling instanceof PsiJavaToken && JavaTokenType.COMMA.equals(((PsiJavaToken)prevSibling).getTokenType())) {
+ buf.append(',');
+ }
+ else {
+ buf.append('\n');
+ }
+ }
+ else if (parent instanceof PsiReferenceList) {
+ buf.append(',');
+ }
+ else {
+ buf.append(' ');
+ }
+ }
+
+ buf.append(r.getMatchImage());
+ removeExtraSemicolonForSingleVarInstanceInMultipleMatch(info, r, buf);
+ forceAddingNewLine = currentElement instanceof PsiComment;
+ }
+
+ replacementString = buf.toString();
+ } else {
+ StringBuilder buf = new StringBuilder();
+ if (info.isStatementContext()) {
+ forceAddingNewLine = match.getMatch() instanceof PsiComment;
+ }
+ buf.append(replacementString);
+ removeExtraSemicolonForSingleVarInstanceInMultipleMatch(info, match, buf);
+ replacementString = buf.toString();
+ }
+
+ offset = Replacer.insertSubstitution(result, offset, info, replacementString);
+ offset = removeExtraSemicolon(info, offset, result, match);
+ if (forceAddingNewLine && info.isStatementContext()) {
+ result.insert(info.getStartIndex() + offset + 1, '\n');
+ offset ++;
+ }
+ }
+ return offset;
+ }
+
+ @Override
+ public int processAdditionalOptions(ParameterInfo info, int offset, StringBuilder result, MatchResult r) {
+ if (info.isStatementContext()) {
+ return removeExtraSemicolon(info, offset, result, r);
+ }
+ return offset;
+ }
+
+ @Override
+ public boolean isIdentifier(PsiElement element) {
+ return element instanceof PsiIdentifier;
+ }
+
+ @Override
+ public Collection<String> getReservedWords() {
+ return Collections.singleton(PsiModifier.PACKAGE_LOCAL);
+ }
+
+ @Override
+ public boolean isDocCommentOwner(PsiElement match) {
+ return match instanceof PsiMember;
+ }
+
+ private static void handleMethodParameter(StringBuilder buf, ParameterInfo info, HashMap<String, MatchResult> matchMap) {
+ if(info.getElement() ==null) {
+ // no specific handling for name of method parameter since it is handled with type
+ return;
+ }
+
+ String name = ((PsiParameter)info.getElement().getParent()).getName();
+ name = StructuralSearchUtil.isTypedVariable(name) ? Replacer.stripTypedVariableDecoration(name):name;
+
+ final MatchResult matchResult = matchMap.get(name);
+ if (matchResult == null) return;
+
+ if (matchResult.isMultipleMatch()) {
+ for (MatchResult result : matchResult.getAllSons()) {
+ if (buf.length() > 0) {
+ buf.append(',');
+ }
+
+ appendParameter(buf, result);
+ }
+ } else {
+ appendParameter(buf, matchResult);
+ }
+ }
+
+ private static void appendParameter(final StringBuilder buf, final MatchResult _matchResult) {
+ for(Iterator<MatchResult> j = _matchResult.getAllSons().iterator();j.hasNext();) {
+ buf.append(j.next().getMatchImage()).append(' ').append(j.next().getMatchImage());
+ }
+ }
+
+ private static void removeExtraSemicolonForSingleVarInstanceInMultipleMatch(final ParameterInfo info, MatchResult r, StringBuilder buf) {
+ if (info.isStatementContext()) {
+ final PsiElement element = r.getMatchRef().getElement();
+
+ // remove extra ;
+ if (buf.charAt(buf.length()-1)==';' &&
+ r.getMatchImage().charAt(r.getMatchImage().length()-1)==';' &&
+ ( element instanceof PsiReturnStatement ||
+ element instanceof PsiDeclarationStatement ||
+ element instanceof PsiExpressionStatement ||
+ element instanceof PsiAssertStatement ||
+ element instanceof PsiBreakStatement ||
+ element instanceof PsiContinueStatement ||
+ element instanceof PsiMember ||
+ element instanceof PsiIfStatement && !(((PsiIfStatement)element).getThenBranch() instanceof PsiBlockStatement) ||
+ element instanceof PsiLoopStatement && !(((PsiLoopStatement)element).getBody() instanceof PsiBlockStatement)
+ )
+ ) {
+ // contains extra ;
+ buf.deleteCharAt(buf.length()-1);
+ }
+ }
+ }
+
+ private static int removeExtraSemicolon(ParameterInfo info, int offset, StringBuilder result, MatchResult match) {
+ if (info.isStatementContext()) {
+ int index = offset+ info.getStartIndex();
+ if (result.charAt(index)==';' &&
+ ( match == null ||
+ ( result.charAt(index-1)=='}' &&
+ !(match.getMatch() instanceof PsiDeclarationStatement) && // array init in dcl
+ !(match.getMatch() instanceof PsiNewExpression) // array initializer
+ ) ||
+ ( !match.isMultipleMatch() && // ; in comment
+ match.getMatch() instanceof PsiComment
+ ) ||
+ ( match.isMultipleMatch() && // ; in comment
+ match.getAllSons().get( match.getAllSons().size() - 1 ).getMatch() instanceof PsiComment
+ )
+ )
+ ) {
+ result.deleteCharAt(index);
+ --offset;
+ }
+ }
+
+ return offset;
+ }
+}
diff --git a/plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/JavaCompiledPattern.java b/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/JavaCompiledPattern.java
index 9a6330bb799b..9a6330bb799b 100644
--- a/plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/JavaCompiledPattern.java
+++ b/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/JavaCompiledPattern.java
diff --git a/plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/JavaMatchPredicateProvider.java b/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/JavaMatchPredicateProvider.java
index 042912e0354c..042912e0354c 100644
--- a/plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/JavaMatchPredicateProvider.java
+++ b/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/JavaMatchPredicateProvider.java
diff --git a/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/JavaMatchingVisitor.java b/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/JavaMatchingVisitor.java
new file mode 100644
index 000000000000..0ea857b16362
--- /dev/null
+++ b/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/JavaMatchingVisitor.java
@@ -0,0 +1,1637 @@
+package com.intellij.structuralsearch.impl.matcher;
+
+import com.intellij.openapi.util.Key;
+import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.psi.*;
+import com.intellij.psi.javadoc.PsiDocComment;
+import com.intellij.psi.javadoc.PsiDocTag;
+import com.intellij.psi.javadoc.PsiDocTagValue;
+import com.intellij.psi.tree.IElementType;
+import com.intellij.psi.util.PsiTreeUtil;
+import com.intellij.psi.util.PsiUtil;
+import com.intellij.structuralsearch.MatchOptions;
+import com.intellij.structuralsearch.MatchResult;
+import com.intellij.structuralsearch.impl.matcher.filters.LexicalNodesFilter;
+import com.intellij.structuralsearch.impl.matcher.handlers.MatchPredicate;
+import com.intellij.structuralsearch.impl.matcher.handlers.MatchingHandler;
+import com.intellij.structuralsearch.impl.matcher.handlers.SubstitutionHandler;
+import com.intellij.dupLocator.iterators.ArrayBackedNodeIterator;
+import com.intellij.structuralsearch.impl.matcher.iterators.DocValuesIterator;
+import com.intellij.structuralsearch.impl.matcher.iterators.HierarchyNodeIterator;
+import com.intellij.dupLocator.iterators.NodeIterator;
+import com.intellij.structuralsearch.impl.matcher.predicates.NotPredicate;
+import com.intellij.structuralsearch.impl.matcher.predicates.RegExpPredicate;
+import com.intellij.util.containers.ContainerUtil;
+
+import java.util.*;
+
+/**
+ * @author Eugene.Kudelevsky
+ */
+public class JavaMatchingVisitor extends JavaElementVisitor {
+ public static final String[] MODIFIERS = {
+ PsiModifier.PUBLIC, PsiModifier.PROTECTED, PsiModifier.PRIVATE, PsiModifier.STATIC, PsiModifier.ABSTRACT, PsiModifier.FINAL,
+ PsiModifier.NATIVE, PsiModifier.SYNCHRONIZED, PsiModifier.STRICTFP, PsiModifier.TRANSIENT, PsiModifier.VOLATILE, PsiModifier.DEFAULT
+ };
+ public static final Key<List<PsiCatchSection>> UNMATCHED_CATCH_SECTION_CONTENT_VAR_KEY = Key.create("UnmatchedCatchSection");
+ private final GlobalMatchingVisitor myMatchingVisitor;
+ private PsiClass myClazz;
+
+ static {
+ Arrays.sort(MODIFIERS);
+ }
+
+ public JavaMatchingVisitor(GlobalMatchingVisitor matchingVisitor) {
+ this.myMatchingVisitor = matchingVisitor;
+ }
+
+ @Override
+ public void visitComment(PsiComment comment) {
+ PsiElement comment2 = null;
+
+ if (!(myMatchingVisitor.getElement() instanceof PsiComment)) {
+ if (myMatchingVisitor.getElement() instanceof PsiMember) {
+ final PsiElement[] children = myMatchingVisitor.getElement().getChildren();
+ if (children[0] instanceof PsiComment) {
+ comment2 = children[0];
+ }
+ }
+ }
+ else {
+ comment2 = myMatchingVisitor.getElement();
+ }
+
+ if (comment2 == null) {
+ myMatchingVisitor.setResult(false);
+ return;
+ }
+
+ final Object userData = comment.getUserData(CompiledPattern.HANDLER_KEY);
+
+ if (userData instanceof String) {
+ String str = (String)userData;
+ int end = comment2.getTextLength();
+
+ if (((PsiComment)comment2).getTokenType() == JavaTokenType.C_STYLE_COMMENT) {
+ end -= 2;
+ }
+ myMatchingVisitor.setResult(((SubstitutionHandler)myMatchingVisitor.getMatchContext().getPattern().getHandler(str)).handle(
+ comment2,
+ 2,
+ end,
+ myMatchingVisitor.getMatchContext()
+ ));
+ }
+ else if (userData instanceof MatchingHandler) {
+ myMatchingVisitor.setResult(((MatchingHandler)userData).match(comment, comment2, myMatchingVisitor.getMatchContext()));
+ }
+ else {
+ myMatchingVisitor.setResult(comment.getText().equals(comment2.getText()));
+ }
+ }
+
+ @Override
+ public void visitDocTagValue(final PsiDocTagValue value) {
+ final PsiDocTagValue value2 = (PsiDocTagValue)myMatchingVisitor.getElement();
+ final boolean isTypedVar = myMatchingVisitor.getMatchContext().getPattern().isTypedVar(value);
+
+ if (isTypedVar) {
+ myMatchingVisitor.setResult(myMatchingVisitor.handleTypedElement(value, value2));
+ }
+ else {
+ myMatchingVisitor.setResult(value.textMatches(value2));
+ }
+ }
+
+ private static boolean isNotInstanceModifier(final PsiModifierList list2) {
+ return list2.hasModifierProperty(PsiModifier.STATIC) ||
+ list2.hasModifierProperty(PsiModifier.ABSTRACT);
+ }
+
+ @Override
+ public final void visitModifierList(final PsiModifierList list) {
+ final PsiModifierList list2 = (PsiModifierList)myMatchingVisitor.getElement();
+
+ for (@PsiModifier.ModifierConstant String modifier : MODIFIERS) {
+ if (list.hasModifierProperty(modifier) && !list2.hasModifierProperty(modifier)) {
+ myMatchingVisitor.setResult(false);
+ return;
+ }
+ }
+
+ final PsiAnnotation[] annotations = list.getAnnotations();
+ if (annotations.length > 0) {
+ HashSet<PsiAnnotation> set = new HashSet<PsiAnnotation>(Arrays.asList(annotations));
+
+ for (PsiAnnotation annotation : annotations) {
+ final PsiJavaCodeReferenceElement nameReferenceElement = annotation.getNameReferenceElement();
+
+ if (nameReferenceElement != null && MatchOptions.MODIFIER_ANNOTATION_NAME.equals(nameReferenceElement.getText())) {
+ final PsiAnnotationParameterList parameterList = annotation.getParameterList();
+ final PsiNameValuePair[] attributes = parameterList.getAttributes();
+
+ for (PsiNameValuePair pair : attributes) {
+ final PsiAnnotationMemberValue value = pair.getValue();
+ if (value == null) continue;
+
+ if (value instanceof PsiArrayInitializerMemberValue) {
+ boolean matchedOne = false;
+
+ for (PsiAnnotationMemberValue v : ((PsiArrayInitializerMemberValue)value).getInitializers()) {
+ @PsiModifier.ModifierConstant String name = StringUtil.stripQuotesAroundValue(v.getText());
+ if (MatchOptions.INSTANCE_MODIFIER_NAME.equals(name)) {
+ if (isNotInstanceModifier(list2)) {
+ myMatchingVisitor.setResult(false);
+ return;
+ }
+ else {
+ matchedOne = true;
+ }
+ }
+ else if (list2.hasModifierProperty(name)) {
+ matchedOne = true;
+ break;
+ }
+ }
+
+ if (!matchedOne) {
+ myMatchingVisitor.setResult(false);
+ return;
+ }
+ }
+ else {
+ @PsiModifier.ModifierConstant String name = StringUtil.stripQuotesAroundValue(value.getText());
+ if (MatchOptions.INSTANCE_MODIFIER_NAME.equals(name)) {
+ if (isNotInstanceModifier(list2)) {
+ myMatchingVisitor.setResult(false);
+ return;
+ }
+ }
+ else if (!list2.hasModifierProperty(name)) {
+ myMatchingVisitor.setResult(false);
+ return;
+ }
+ }
+ }
+
+ set.remove(annotation);
+ }
+ }
+
+ myMatchingVisitor.setResult(set.isEmpty() || myMatchingVisitor
+ .matchInAnyOrder(set.toArray(new PsiAnnotation[set.size()]), list2.getAnnotations()));
+ }
+ else {
+ myMatchingVisitor.setResult(true);
+ }
+ }
+
+ @Override
+ public void visitDocTag(final PsiDocTag tag) {
+ final PsiDocTag tag2 = (PsiDocTag)myMatchingVisitor.getElement();
+ final boolean isTypedVar = myMatchingVisitor.getMatchContext().getPattern().isTypedVar(tag.getNameElement());
+
+ myMatchingVisitor.setResult(isTypedVar || tag.getName().equals(tag2.getName()));
+
+ PsiElement psiDocTagValue = tag.getValueElement();
+ boolean isTypedValue = false;
+
+ if (myMatchingVisitor.getResult() && psiDocTagValue != null) {
+ final PsiElement[] children = psiDocTagValue.getChildren();
+ if (children.length == 1) {
+ psiDocTagValue = children[0];
+ }
+ isTypedValue = myMatchingVisitor.getMatchContext().getPattern().isTypedVar(psiDocTagValue);
+
+ if (isTypedValue) {
+ if (tag2.getValueElement() != null) {
+ myMatchingVisitor.setResult(myMatchingVisitor.handleTypedElement(psiDocTagValue, tag2.getValueElement()));
+ }
+ else {
+ myMatchingVisitor.setResult(allowsAbsenceOfMatch(psiDocTagValue));
+ }
+ }
+ }
+
+ if (myMatchingVisitor.getResult() && !isTypedValue) {
+ myMatchingVisitor.setResult(myMatchingVisitor.matchInAnyOrder(
+ new DocValuesIterator(tag.getFirstChild()),
+ new DocValuesIterator(tag2.getFirstChild())
+ ));
+ }
+
+ if (myMatchingVisitor.getResult() && isTypedVar) {
+ myMatchingVisitor.setResult(myMatchingVisitor.handleTypedElement(tag.getNameElement(), tag2.getNameElement()));
+ }
+ }
+
+ private boolean allowsAbsenceOfMatch(final PsiElement element) {
+ MatchingHandler handler = myMatchingVisitor.getMatchContext().getPattern().getHandler(element);
+
+ if (handler instanceof SubstitutionHandler &&
+ ((SubstitutionHandler)handler).getMinOccurs() == 0) {
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public void visitDocComment(final PsiDocComment comment) {
+ PsiDocComment comment2;
+
+ if (myMatchingVisitor.getElement() instanceof PsiDocCommentOwner) {
+ comment2 = ((PsiDocCommentOwner)myMatchingVisitor.getElement()).getDocComment();
+
+ if (comment2 == null) {
+ // doc comment are not collapsed for inner classes!
+ myMatchingVisitor.setResult(false);
+ return;
+ }
+ }
+ else {
+ comment2 = (PsiDocComment)myMatchingVisitor.getElement();
+
+ if (myMatchingVisitor.getElement().getParent() instanceof PsiDocCommentOwner) {
+ myMatchingVisitor.setResult(false);
+ return; // we should matched the doc before
+ }
+ }
+
+ if (comment.getTags().length > 0) {
+ myMatchingVisitor.setResult(myMatchingVisitor.matchInAnyOrder(comment.getTags(), comment2.getTags()));
+ }
+ else {
+ visitComment(comment);
+ }
+ }
+
+ @Override
+ public void visitElement(PsiElement el) {
+ myMatchingVisitor.setResult(el.textMatches(myMatchingVisitor.getElement()));
+ }
+
+ @Override
+ public void visitArrayInitializerExpression(PsiArrayInitializerExpression expression) {
+ final PsiArrayInitializerExpression expr2 = (PsiArrayInitializerExpression)myMatchingVisitor.getElement();
+
+ myMatchingVisitor.setResult(myMatchingVisitor.matchSequentially(
+ new ArrayBackedNodeIterator(expression.getInitializers()),
+ new ArrayBackedNodeIterator(expr2.getInitializers())
+ ));
+ }
+
+ @Override
+ public void visitClassInitializer(PsiClassInitializer initializer) {
+ PsiClassInitializer initializer2 = (PsiClassInitializer)myMatchingVisitor.getElement();
+ myMatchingVisitor.setResult(myMatchingVisitor.match(initializer.getModifierList(), initializer2.getModifierList()) &&
+ myMatchingVisitor.match(initializer.getBody(), initializer2.getBody()));
+ }
+
+ @Override
+ public void visitCodeBlock(PsiCodeBlock block) {
+ myMatchingVisitor.setResult(myMatchingVisitor.matchSons(block, myMatchingVisitor.getElement()));
+ }
+
+ @Override
+ public void visitJavaToken(final PsiJavaToken token) {
+ PsiElement element = myMatchingVisitor.getElement();
+ boolean result;
+
+ if (!(element instanceof PsiJavaToken)) {
+ result = token.textMatches(element);
+ } else {
+ final PsiJavaToken anotherToken = (PsiJavaToken)element;
+
+ result = token.getTokenType() == anotherToken.getTokenType() && token.textMatches(anotherToken);
+ }
+
+ myMatchingVisitor.setResult(result);
+ }
+
+ @Override
+ public void visitAnnotation(PsiAnnotation annotation) {
+ final PsiAnnotation psiAnnotation = (PsiAnnotation)myMatchingVisitor.getElement();
+
+ myMatchingVisitor.setResult(myMatchingVisitor.match(annotation.getNameReferenceElement(), psiAnnotation.getNameReferenceElement()) &&
+ myMatchingVisitor
+ .matchInAnyOrder(annotation.getParameterList().getAttributes(),
+ psiAnnotation.getParameterList().getAttributes()));
+ }
+
+ @Override
+ public void visitNameValuePair(PsiNameValuePair pair) {
+ final PsiIdentifier nameIdentifier = pair.getNameIdentifier();
+
+ final PsiNameValuePair elementNameValuePair = (PsiNameValuePair)myMatchingVisitor.getElement();
+ final PsiIdentifier otherIdentifier = elementNameValuePair.getNameIdentifier();
+
+ final PsiAnnotationMemberValue annotationInitializer = pair.getValue();
+ if (annotationInitializer != null) {
+ final boolean isTypedInitializer = myMatchingVisitor.getMatchContext().getPattern().isTypedVar(annotationInitializer) &&
+ annotationInitializer instanceof PsiReferenceExpression;
+
+ myMatchingVisitor.setResult(myMatchingVisitor.match(annotationInitializer, elementNameValuePair.getValue()) ||
+ (isTypedInitializer &&
+ elementNameValuePair.getValue() == null &&
+ allowsAbsenceOfMatch(annotationInitializer)
+ ));
+ }
+ if (myMatchingVisitor.getResult()) {
+ final MatchingHandler handler = myMatchingVisitor.getMatchContext().getPattern().getHandler(nameIdentifier);
+
+ if (handler instanceof SubstitutionHandler) {
+ myMatchingVisitor.setResult(((SubstitutionHandler)handler).handle(otherIdentifier, myMatchingVisitor.getMatchContext()));
+ }
+ else if (nameIdentifier != null) {
+ myMatchingVisitor.setResult(myMatchingVisitor.match(nameIdentifier, otherIdentifier));
+ }
+ else {
+ myMatchingVisitor.setResult(otherIdentifier == null || otherIdentifier.getText().equals("value"));
+ }
+ }
+ }
+
+ private boolean checkHierarchy(PsiMember element, PsiMember patternElement) {
+ final MatchingHandler handler = myMatchingVisitor.getMatchContext().getPattern().getHandler(patternElement);
+ if (handler instanceof SubstitutionHandler) {
+ final SubstitutionHandler handler2 = (SubstitutionHandler)handler;
+
+ if (!handler2.isSubtype()) {
+ if (handler2.isStrictSubtype()) {
+ // check if element is declared not in current class (in ancestors)
+ return element.getContainingClass() != myClazz;
+ }
+ }
+ else {
+ return true;
+ }
+ }
+
+ // check if element is declared in current class (not in ancestors)
+ return element.getContainingClass() == myClazz;
+ }
+
+ @Override
+ public void visitField(PsiField psiField) {
+ if (!checkHierarchy((PsiField)myMatchingVisitor.getElement(), psiField)) {
+ myMatchingVisitor.setResult(false);
+ return;
+ }
+ super.visitField(psiField);
+ }
+
+ @Override
+ public void visitAnonymousClass(final PsiAnonymousClass clazz) {
+ final PsiAnonymousClass clazz2 = (PsiAnonymousClass)myMatchingVisitor.getElement();
+ final boolean isTypedVar = myMatchingVisitor.getMatchContext().getPattern().isTypedVar(clazz.getFirstChild());
+
+ myMatchingVisitor.setResult((myMatchingVisitor.match(clazz.getBaseClassReference(), clazz2.getBaseClassReference()) || isTypedVar) &&
+ myMatchingVisitor.matchSons(clazz.getArgumentList(), clazz2.getArgumentList()) &&
+ compareClasses(clazz, clazz2));
+
+ if (myMatchingVisitor.getResult() && isTypedVar) {
+ myMatchingVisitor.setResult(myMatchingVisitor.handleTypedElement(clazz.getFirstChild(), clazz2.getFirstChild()));
+ }
+ }
+
+ @Override
+ public void visitLambdaExpression(PsiLambdaExpression expression) {
+ final PsiLambdaExpression expression2 = (PsiLambdaExpression)myMatchingVisitor.getElement();
+ boolean result = true;
+ final PsiParameterList parameterList1 = expression.getParameterList();
+ if (parameterList1.getParametersCount() != 0) {
+ result = myMatchingVisitor.matchSons(parameterList1, expression2.getParameterList());
+ }
+ final PsiElement body1 = getElementToMatch(expression.getBody());
+ if (body1 != null) {
+ result = myMatchingVisitor.matchSequentially(body1, getElementToMatch(expression2.getBody()));
+ }
+ myMatchingVisitor.setResult(result);
+ }
+
+ private static PsiElement getElementToMatch(PsiElement element) {
+ if (element instanceof PsiCodeBlock) {
+ element = PsiTreeUtil.getChildOfAnyType(element, PsiStatement.class, PsiComment.class);
+ }
+ if (element instanceof PsiExpressionStatement) {
+ element = ((PsiExpressionStatement)element).getExpression();
+ }
+ if (element instanceof PsiReturnStatement) {
+ element = ((PsiReturnStatement)element).getReturnValue();
+ }
+ return element;
+ }
+
+ protected boolean matchInAnyOrder(final PsiReferenceList elements, final PsiReferenceList elements2, GlobalMatchingVisitor visitor) {
+ if ((elements == null && visitor.isLeftLooseMatching()) ||
+ elements == elements2 // null
+ ) {
+ return true;
+ }
+
+ return visitor.matchInAnyOrder(
+ elements.getReferenceElements(),
+ (elements2 != null) ? elements2.getReferenceElements() : PsiElement.EMPTY_ARRAY
+ );
+ }
+
+ private boolean compareClasses(final PsiClass clazz, final PsiClass clazz2) {
+ final PsiClass saveClazz = this.myClazz;
+ final MatchContext.MatchedElementsListener oldListener = myMatchingVisitor.getMatchContext().getMatchedElementsListener();
+
+ this.myClazz = clazz2;
+
+ final CompiledPattern pattern = myMatchingVisitor.getMatchContext().getPattern();
+ assert pattern instanceof JavaCompiledPattern;
+ final JavaCompiledPattern javaPattern = (JavaCompiledPattern)pattern;
+
+ final String unmatchedHandlerName = clazz.getUserData(JavaCompiledPattern.ALL_CLASS_CONTENT_VAR_NAME_KEY);
+ final MatchingHandler allRemainingClassContentElementHandler = unmatchedHandlerName != null ? pattern.getHandler(unmatchedHandlerName) : null;
+ MatchContext.MatchedElementsListener newListener = null;
+
+ assert javaPattern instanceof JavaCompiledPattern;
+ if (allRemainingClassContentElementHandler != null) {
+ myMatchingVisitor.getMatchContext().setMatchedElementsListener(
+ newListener = new MatchContext.MatchedElementsListener() {
+ private Set<PsiElement> myMatchedElements;
+
+ public void matchedElements(Collection<PsiElement> matchedElements) {
+ if (matchedElements == null) return;
+ if (myMatchedElements == null) {
+ myMatchedElements = new HashSet<PsiElement>(matchedElements);
+ }
+ else {
+ myMatchedElements.addAll(matchedElements);
+ }
+ }
+
+ public void commitUnmatched() {
+ final SubstitutionHandler handler = (SubstitutionHandler)allRemainingClassContentElementHandler;
+
+ for (PsiElement el = clazz2.getFirstChild(); el != null; el = el.getNextSibling()) {
+ if (el instanceof PsiMember && (myMatchedElements == null || !myMatchedElements.contains(el))) {
+ handler.handle(el, myMatchingVisitor.getMatchContext());
+ }
+ }
+ }
+ }
+ );
+ }
+
+ boolean result = false;
+ try {
+ final boolean templateIsInterface = clazz.isInterface();
+ if (templateIsInterface != clazz2.isInterface()) return false;
+ if (templateIsInterface && clazz.isAnnotationType() && !clazz2.isAnnotationType()) return false;
+ final boolean templateIsEnum = clazz.isEnum();
+ if (templateIsEnum && !clazz2.isEnum()) return false;
+
+ if (!matchInAnyOrder(clazz.getExtendsList(), clazz2.getExtendsList(), myMatchingVisitor)) {
+ return false;
+ }
+
+ // check if implements is in extended classes implements
+ final PsiReferenceList implementsList = clazz.getImplementsList();
+ if (implementsList != null) {
+ if (!matchInAnyOrder(implementsList, clazz2.getImplementsList(), myMatchingVisitor)) {
+ final PsiReferenceList anotherExtendsList = clazz2.getExtendsList();
+ final PsiJavaCodeReferenceElement[] referenceElements = implementsList.getReferenceElements();
+
+ boolean accepted = false;
+
+ if (referenceElements.length > 0 && anotherExtendsList != null) {
+ final HierarchyNodeIterator iterator = new HierarchyNodeIterator(clazz2, true, true, false);
+
+ accepted = myMatchingVisitor.matchInAnyOrder(new ArrayBackedNodeIterator(referenceElements), iterator);
+ }
+
+ if (!accepted) return false;
+ }
+ }
+
+ final PsiField[] fields = clazz.getFields();
+
+ if (fields.length > 0) {
+ final PsiField[] fields2 = javaPattern.isRequestsSuperFields() ?
+ clazz2.getAllFields() :
+ clazz2.getFields();
+
+ if (!myMatchingVisitor.matchInAnyOrder(fields, fields2)) {
+ return false;
+ }
+ }
+
+ final PsiMethod[] methods = clazz.getMethods();
+
+ if (methods.length > 0) {
+ final PsiMethod[] methods2 = javaPattern.isRequestsSuperMethods() ?
+ clazz2.getAllMethods() :
+ clazz2.getMethods();
+
+ if (!myMatchingVisitor.matchInAnyOrder(methods, methods2)) {
+ return false;
+ }
+ }
+
+ final PsiClass[] nestedClasses = clazz.getInnerClasses();
+
+ if (nestedClasses.length > 0) {
+ final PsiClass[] nestedClasses2 = javaPattern.isRequestsSuperInners() ?
+ clazz2.getAllInnerClasses() :
+ clazz2.getInnerClasses();
+
+ if (!myMatchingVisitor.matchInAnyOrder(nestedClasses, nestedClasses2)) {
+ return false;
+ }
+ }
+
+ final PsiClassInitializer[] initializers = clazz.getInitializers();
+ if (initializers.length > 0) {
+ final PsiClassInitializer[] initializers2 = clazz2.getInitializers();
+
+ if (!myMatchingVisitor.matchInAnyOrder(initializers, initializers2)) {
+ return false;
+ }
+ }
+
+ result = true;
+ return result;
+ }
+ finally {
+ if (result && newListener != null) newListener.commitUnmatched();
+ this.myClazz = saveClazz;
+ myMatchingVisitor.getMatchContext().setMatchedElementsListener(oldListener);
+ }
+ }
+
+ private boolean compareBody(final PsiElement el1, final PsiElement el2) {
+ PsiElement compareElement1 = el1;
+ PsiElement compareElement2 = el2;
+
+ if (myMatchingVisitor.getMatchContext().getOptions().isLooseMatching()) {
+ if (el1 instanceof PsiBlockStatement) {
+ compareElement1 = ((PsiBlockStatement)el1).getCodeBlock().getFirstChild();
+ }
+
+ if (el2 instanceof PsiBlockStatement) {
+ compareElement2 = ((PsiBlockStatement)el2).getCodeBlock().getFirstChild();
+ }
+ }
+
+ return myMatchingVisitor.matchSequentially(compareElement1, compareElement2);
+ }
+
+ @Override
+ public void visitArrayAccessExpression(final PsiArrayAccessExpression slice) {
+ final PsiArrayAccessExpression slice2 = (PsiArrayAccessExpression)myMatchingVisitor.getElement();
+
+ myMatchingVisitor.setResult(myMatchingVisitor.match(slice.getArrayExpression(), slice2.getArrayExpression()) &&
+ myMatchingVisitor.match(slice.getIndexExpression(), slice2.getIndexExpression()));
+ }
+
+ @Override
+ public void visitMethodReferenceExpression(PsiMethodReferenceExpression expression) {
+ final PsiElement element = myMatchingVisitor.getElement();
+ if (!(element instanceof PsiMethodReferenceExpression)) {
+ myMatchingVisitor.setResult(false);
+ return;
+ }
+ super.visitMethodReferenceExpression(expression);
+ }
+
+ @Override
+ public void visitReferenceExpression(final PsiReferenceExpression reference) {
+ final PsiExpression qualifier = reference.getQualifierExpression();
+
+ final PsiElement nameElement = reference.getReferenceNameElement();
+ final MatchContext context = myMatchingVisitor.getMatchContext();
+ MatchingHandler _handler = nameElement != null ? context.getPattern().getHandlerSimple(nameElement) : null;
+ if (!(_handler instanceof SubstitutionHandler)) _handler = context.getPattern().getHandlerSimple(reference);
+
+ final PsiElement element = myMatchingVisitor.getElement();
+ PsiElement other = element instanceof PsiExpression && context.getOptions().isLooseMatching() ?
+ PsiUtil.skipParenthesizedExprDown((PsiExpression)element) :
+ element;
+ if (_handler instanceof SubstitutionHandler &&
+ !(context.getPattern().getHandlerSimple(qualifier) instanceof SubstitutionHandler) &&
+ !(qualifier instanceof PsiThisExpression)
+ ) {
+ if (other instanceof PsiReferenceExpression) {
+ final PsiReferenceExpression psiReferenceExpression = (PsiReferenceExpression)other;
+
+ final PsiExpression qualifier2 = psiReferenceExpression.getQualifierExpression();
+ if (qualifier2 == null || (context.getOptions().isLooseMatching() && qualifier2 instanceof PsiThisExpression)) {
+ other = psiReferenceExpression.getReferenceNameElement();
+ }
+ }
+
+ final SubstitutionHandler handler = (SubstitutionHandler)_handler;
+ if (handler.isSubtype() || handler.isStrictSubtype()) {
+ myMatchingVisitor.setResult(checkMatchWithingHierarchy(other, handler, reference));
+ }
+ else {
+ myMatchingVisitor.setResult(handler.handle(other, context));
+ }
+
+ return;
+ }
+
+ if (!(other instanceof PsiReferenceExpression)) {
+ myMatchingVisitor.setResult(false);
+ return;
+ }
+
+ final PsiReferenceExpression reference2 = (PsiReferenceExpression)other;
+
+ // just variable
+ final PsiExpression reference2Qualifier = reference2.getQualifierExpression();
+ if (qualifier == null && reference2Qualifier == null) {
+ myMatchingVisitor.setResult(reference.getReferenceNameElement().textMatches(reference2.getReferenceNameElement()));
+ return;
+ }
+
+ // handle field selection
+ if (!(other.getParent() instanceof PsiMethodCallExpression) && qualifier != null) {
+ final PsiElement referenceElement = reference.getReferenceNameElement();
+ final PsiElement referenceElement2 = reference2.getReferenceNameElement();
+
+ if (context.getPattern().isTypedVar(referenceElement)) {
+ myMatchingVisitor.setResult(myMatchingVisitor.handleTypedElement(referenceElement, referenceElement2));
+ }
+ else {
+ myMatchingVisitor.setResult(
+ (referenceElement2 != null && referenceElement != null && referenceElement.textMatches(referenceElement2)) ||
+ referenceElement == referenceElement2);
+ }
+
+ if (!myMatchingVisitor.getResult()) {
+ return;
+ }
+ if (reference2Qualifier != null) {
+ myMatchingVisitor.setResult(myMatchingVisitor.match(qualifier, reference2Qualifier));
+ }
+ else {
+ final PsiElement referencedElement = MatchUtils.getReferencedElement(other);
+ if (referencedElement instanceof PsiField) {
+ final PsiField field = (PsiField)referencedElement;
+ if (qualifier instanceof PsiThisExpression) {
+ myMatchingVisitor.setResult(!field.hasModifierProperty(PsiModifier.STATIC));
+ return;
+ }
+ }
+ final MatchingHandler handler = context.getPattern().getHandler(qualifier);
+ matchImplicitQualifier(handler, referencedElement, context);
+ }
+
+ return;
+ }
+
+ myMatchingVisitor.setResult(false);
+ }
+
+ private static int countCStyleArrayDeclarationDims(final PsiElement type2) {
+ if (type2 != null) {
+ final PsiElement parentElement = type2.getParent();
+
+ if (parentElement instanceof PsiVariable) {
+ final PsiIdentifier psiIdentifier = ((PsiVariable)parentElement).getNameIdentifier();
+ if (psiIdentifier == null) return 0;
+
+ int count = 0;
+ for (PsiElement sibling = psiIdentifier.getNextSibling(); sibling != null; sibling = sibling.getNextSibling()) {
+ if (sibling instanceof PsiJavaToken) {
+ final IElementType tokenType = ((PsiJavaToken)sibling).getTokenType();
+ if (tokenType == JavaTokenType.LBRACKET) ++count;
+ else if (tokenType != JavaTokenType.RBRACKET) break;
+ }
+ }
+
+ return count;
+ }
+ }
+ return 0;
+ }
+
+ private void copyResults(final MatchResultImpl ourResult) {
+ if (ourResult.hasSons()) {
+ for (MatchResult son : ourResult.getAllSons()) {
+ myMatchingVisitor.getMatchContext().getResult().addSon((MatchResultImpl)son);
+ }
+ }
+ }
+
+ private boolean matchType(final PsiElement _type, final PsiElement _type2) {
+ PsiElement el = _type;
+ PsiElement el2 = _type2;
+ PsiType type1 = null;
+ PsiType type2 = null;
+
+ // check for generics
+ if (_type instanceof PsiTypeElement &&
+ ((PsiTypeElement)_type).getInnermostComponentReferenceElement() != null
+ ) {
+ el = ((PsiTypeElement)_type).getInnermostComponentReferenceElement();
+ type1 = ((PsiTypeElement)_type).getType();
+ }
+
+ if (_type2 instanceof PsiTypeElement &&
+ ((PsiTypeElement)_type2).getInnermostComponentReferenceElement() != null
+ ) {
+ el2 = ((PsiTypeElement)_type2).getInnermostComponentReferenceElement();
+ type2 = ((PsiTypeElement)_type2).getType();
+ }
+
+ PsiElement[] typeparams = null;
+ if (el2 instanceof PsiJavaCodeReferenceElement) {
+ typeparams = ((PsiJavaCodeReferenceElement)el2).getParameterList().getTypeParameterElements();
+ if (typeparams.length > 0) {
+ el2 = ((PsiJavaCodeReferenceElement)el2).getReferenceNameElement();
+ }
+ }
+ else if (el2 instanceof PsiTypeParameter) {
+ el2 = ((PsiTypeParameter)el2).getNameIdentifier();
+ }
+ else if (el2 instanceof PsiClass && ((PsiClass)el2).hasTypeParameters()
+ ) {
+ typeparams = ((PsiClass)el2).getTypeParameters();
+ el2 = ((PsiClass)el2).getNameIdentifier();
+ }
+ else if (el2 instanceof PsiMethod && ((PsiMethod)el2).hasTypeParameters()
+ ) {
+ typeparams = ((PsiMethod)_type2).getTypeParameters();
+ el2 = ((PsiMethod)_type2).getNameIdentifier();
+ }
+
+ PsiReferenceParameterList list = null;
+ if (el instanceof PsiJavaCodeReferenceElement) {
+ list = ((PsiJavaCodeReferenceElement)el).getParameterList();
+ }
+
+ if (list != null && list.getTypeParameterElements().length > 0) {
+ boolean result = typeparams != null &&
+ myMatchingVisitor.matchInAnyOrder(
+ list.getTypeParameterElements(),
+ typeparams
+ );
+
+ if (!result) return false;
+ el = ((PsiJavaCodeReferenceElement)el).getReferenceNameElement();
+ }
+ else {
+ if (_type2 instanceof PsiTypeElement) {
+ type2 = ((PsiTypeElement)_type2).getType();
+
+ if (typeparams == null || typeparams.length == 0) {
+ final PsiJavaCodeReferenceElement innermostComponentReferenceElement =
+ ((PsiTypeElement)_type2).getInnermostComponentReferenceElement();
+ if (innermostComponentReferenceElement != null) el2 = innermostComponentReferenceElement;
+ }
+ else {
+ el2 = _type2;
+ }
+ }
+ }
+
+ final int array2Dims = (type2 != null ? type2.getArrayDimensions() : 0) + countCStyleArrayDeclarationDims(_type2);
+ final int arrayDims = (type1 != null ? type1.getArrayDimensions() : 0) + countCStyleArrayDeclarationDims(_type);
+
+ if (myMatchingVisitor.getMatchContext().getPattern().isTypedVar(el)) {
+ final SubstitutionHandler handler = (SubstitutionHandler)myMatchingVisitor.getMatchContext().getPattern().getHandler(el);
+
+ RegExpPredicate regExpPredicate = null;
+
+ if (arrayDims != 0) {
+ if (arrayDims != array2Dims) {
+ return false;
+ }
+ }
+ else if (array2Dims != 0) {
+ regExpPredicate = MatchingHandler.getSimpleRegExpPredicate(handler);
+
+ if (regExpPredicate != null) {
+ regExpPredicate.setNodeTextGenerator(new RegExpPredicate.NodeTextGenerator() {
+ public String getText(PsiElement element) {
+ StringBuilder builder = new StringBuilder(RegExpPredicate.getMeaningfulText(element));
+ for (int i = 0; i < array2Dims; ++i) builder.append("[]");
+ return builder.toString();
+ }
+ });
+ }
+ }
+
+ try {
+ if (handler.isSubtype() || handler.isStrictSubtype()) {
+ return checkMatchWithingHierarchy(el2, handler, el);
+ }
+ else {
+ return handler.handle(el2, myMatchingVisitor.getMatchContext());
+ }
+ }
+ finally {
+ if (regExpPredicate != null) regExpPredicate.setNodeTextGenerator(null);
+ }
+ }
+
+ if (array2Dims != arrayDims) {
+ return false;
+ }
+
+ if (el instanceof PsiIdentifier) {
+ final PsiElement parent = el.getParent();
+ if (parent instanceof PsiJavaCodeReferenceElement) {
+ el = parent;
+ }
+ }
+ if (el2 instanceof PsiIdentifier) {
+ final PsiElement parent = el2.getParent();
+ if (parent instanceof PsiJavaCodeReferenceElement) {
+ el2 = parent;
+ }
+ }
+ final String text = stripTypeParameters(el.getText());
+ if (text.indexOf('.') == -1 || !(el2 instanceof PsiJavaReference)) {
+ return MatchUtils.compareWithNoDifferenceToPackage(text, stripTypeParameters(el2.getText()));
+ }
+ else {
+ PsiElement element2 = ((PsiJavaReference)el2).resolve();
+
+ if (element2 != null) {
+ return text.equals(((PsiClass)element2).getQualifiedName());
+ }
+ else {
+ return MatchUtils.compareWithNoDifferenceToPackage(text, el2.getText());
+ }
+ }
+ }
+
+ private static String stripTypeParameters(String string) {
+ final int index = string.indexOf('<');
+ if (index == -1) {
+ return string;
+ }
+ return string.substring(0, index);
+ }
+
+ private boolean checkMatchWithingHierarchy(PsiElement el2, SubstitutionHandler handler, PsiElement context) {
+ boolean includeInterfaces = true;
+ boolean includeClasses = true;
+ final PsiElement contextParent = context.getParent();
+
+ if (contextParent instanceof PsiReferenceList) {
+ final PsiElement grandParentContext = contextParent.getParent();
+
+ if (grandParentContext instanceof PsiClass) {
+ final PsiClass psiClass = (PsiClass)grandParentContext;
+
+ if (contextParent == psiClass.getExtendsList()) {
+ includeInterfaces = psiClass.isInterface();
+ }
+ else if (contextParent == psiClass.getImplementsList()) {
+ includeClasses = false;
+ }
+ }
+ }
+
+ // is type2 is (strict) subtype of type
+ final NodeIterator node = new HierarchyNodeIterator(el2, includeClasses, includeInterfaces);
+
+ if (handler.isStrictSubtype()) {
+ node.advance();
+ }
+
+ final boolean notPredicate = handler.getPredicate() instanceof NotPredicate;
+ while (node.hasNext() && !handler.validate(node.current(), 0, -1, myMatchingVisitor.getMatchContext())) {
+ if (notPredicate) return false;
+ node.advance();
+ }
+
+ if (node.hasNext()) {
+ handler.addResult(el2, 0, -1, myMatchingVisitor.getMatchContext());
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+
+ @Override
+ public void visitConditionalExpression(final PsiConditionalExpression cond) {
+ final PsiConditionalExpression cond2 = (PsiConditionalExpression)myMatchingVisitor.getElement();
+
+ myMatchingVisitor.setResult(myMatchingVisitor.match(cond.getCondition(), cond2.getCondition()) &&
+ myMatchingVisitor.matchSons(cond, cond2));
+ }
+
+ @Override
+ public void visitPolyadicExpression(PsiPolyadicExpression expression) {
+ PsiPolyadicExpression expr2 = (PsiPolyadicExpression)myMatchingVisitor.getElement();
+
+ boolean result = expression.getOperationTokenType().equals(expr2.getOperationTokenType());
+ if (result) {
+ PsiExpression[] operands1 = expression.getOperands();
+ PsiExpression[] operands2 = expr2.getOperands();
+ if (operands1.length != operands2.length) {
+ result = false;
+ }
+ else {
+ for (int i = 0; i < operands1.length; i++) {
+ PsiExpression e1 = operands1[i];
+ PsiExpression e2 = operands2[i];
+ if (!myMatchingVisitor.match(e1, e2)) {
+ result = false;
+ break;
+ }
+ }
+ }
+ }
+
+ myMatchingVisitor.setResult(result);
+ }
+
+ @Override
+ public void visitVariable(final PsiVariable var) {
+ myMatchingVisitor.getMatchContext().pushResult();
+ final PsiIdentifier nameIdentifier = var.getNameIdentifier();
+
+ boolean isTypedVar = myMatchingVisitor.getMatchContext().getPattern().isTypedVar(nameIdentifier);
+ boolean isTypedInitializer = var.getInitializer() != null &&
+ myMatchingVisitor.getMatchContext().getPattern().isTypedVar(var.getInitializer()) &&
+ var.getInitializer() instanceof PsiReferenceExpression;
+ final PsiVariable var2 = (PsiVariable)myMatchingVisitor.getElement();
+
+ try {
+ myMatchingVisitor.setResult((var.getName().equals(var2.getName()) || isTypedVar) &&
+ ((var.getParent() instanceof PsiClass && ((PsiClass)var.getParent()).isInterface()) ||
+ myMatchingVisitor.match(var.getModifierList(), var2.getModifierList())));
+ if (myMatchingVisitor.getResult()) {
+ final PsiTypeElement typeElement1 = var.getTypeElement();
+ if (typeElement1 != null) {
+ PsiTypeElement typeElement2 = var2.getTypeElement();
+ if (typeElement2 == null) {
+ typeElement2 = JavaPsiFacade.getElementFactory(var2.getProject()).createTypeElement(var2.getType());
+ }
+ myMatchingVisitor.setResult(myMatchingVisitor.match(typeElement1, typeElement2));
+ }
+ }
+
+ if (myMatchingVisitor.getResult()) {
+ // Check initializer
+ final PsiExpression var2Initializer = var2.getInitializer();
+
+ myMatchingVisitor.setResult(myMatchingVisitor.match(var.getInitializer(), var2Initializer) ||
+ (isTypedInitializer &&
+ var2Initializer == null &&
+ allowsAbsenceOfMatch(var.getInitializer())
+ ));
+ }
+
+ if (myMatchingVisitor.getResult() && var instanceof PsiParameter && var.getParent() instanceof PsiCatchSection) {
+ myMatchingVisitor.setResult(myMatchingVisitor.match(
+ ((PsiCatchSection)var.getParent()).getCatchBlock(),
+ ((PsiCatchSection)var2.getParent()).getCatchBlock()
+ ));
+ }
+
+ if (myMatchingVisitor.getResult() && isTypedVar) {
+ myMatchingVisitor.setResult(myMatchingVisitor.handleTypedElement(nameIdentifier, var2.getNameIdentifier()));
+ }
+ }
+ finally {
+ saveOrDropResult(nameIdentifier, isTypedVar, var2.getNameIdentifier());
+ }
+ }
+
+ private void matchArrayDims(final PsiNewExpression new1, final PsiNewExpression new2) {
+ final PsiExpression[] arrayDims = new1.getArrayDimensions();
+ final PsiExpression[] arrayDims2 = new2.getArrayDimensions();
+
+ if (arrayDims.length == arrayDims2.length && arrayDims.length != 0) {
+ for (int i = 0; i < arrayDims.length; ++i) {
+ myMatchingVisitor.setResult(myMatchingVisitor.match(arrayDims[i], arrayDims2[i]));
+ if (!myMatchingVisitor.getResult()) return;
+ }
+ }
+ else {
+ myMatchingVisitor.setResult((arrayDims == arrayDims2) && myMatchingVisitor.matchSons(new1.getArgumentList(), new2.getArgumentList()));
+ }
+ }
+
+ private void saveOrDropResult(final PsiIdentifier methodNameNode, final boolean typedVar, final PsiIdentifier methodNameNode2) {
+ MatchResultImpl ourResult = myMatchingVisitor.getMatchContext().hasResult() ? myMatchingVisitor.getMatchContext().getResult() : null;
+ myMatchingVisitor.getMatchContext().popResult();
+
+ if (myMatchingVisitor.getResult()) {
+ if (typedVar) {
+ final SubstitutionHandler handler =
+ (SubstitutionHandler)myMatchingVisitor.getMatchContext().getPattern().getHandler(methodNameNode);
+ if (ourResult != null) ourResult.setScopeMatch(true);
+ handler.setNestedResult(ourResult);
+ myMatchingVisitor.setResult(handler.handle(methodNameNode2, myMatchingVisitor.getMatchContext()));
+
+ if (handler.getNestedResult() != null) { // some constraint prevent from adding
+ handler.setNestedResult(null);
+ copyResults(ourResult);
+ }
+ }
+ else if (ourResult != null) {
+ copyResults(ourResult);
+ }
+ }
+ }
+
+ private void matchImplicitQualifier(MatchingHandler matchingHandler, PsiElement target, MatchContext context) {
+ if (!(matchingHandler instanceof SubstitutionHandler)) {
+ myMatchingVisitor.setResult(false);
+ return;
+ }
+ final SubstitutionHandler substitutionHandler = (SubstitutionHandler)matchingHandler;
+ final MatchPredicate predicate = substitutionHandler.getPredicate();
+ if (substitutionHandler.getMinOccurs() != 0) {
+ myMatchingVisitor.setResult(false);
+ return;
+ }
+ if (predicate == null) {
+ myMatchingVisitor.setResult(true);
+ return;
+ }
+ if (target == null) {
+ myMatchingVisitor.setResult(false);
+ return;
+ }
+ if (target instanceof PsiModifierListOwner && ((PsiModifierListOwner)target).hasModifierProperty(PsiModifier.STATIC)) {
+ myMatchingVisitor.setResult(predicate.match(null, PsiTreeUtil.getParentOfType(target, PsiClass.class), context));
+ } else {
+ final PsiElementFactory factory = JavaPsiFacade.getElementFactory(target.getProject());
+ final PsiExpression implicitReference = factory.createExpressionFromText("this", target);
+ myMatchingVisitor.setResult(predicate.match(null, implicitReference, context));
+ }
+ }
+
+ @Override
+ public void visitMethodCallExpression(final PsiMethodCallExpression mcall) {
+ final PsiElement element = myMatchingVisitor.getElement();
+ if (!(element instanceof PsiMethodCallExpression)) {
+ myMatchingVisitor.setResult(false);
+ return;
+ }
+ final PsiMethodCallExpression mcall2 = (PsiMethodCallExpression)element;
+ final PsiReferenceExpression mcallRef1 = mcall.getMethodExpression();
+ final PsiReferenceExpression mcallRef2 = mcall2.getMethodExpression();
+
+ final String mcallname1 = mcallRef1.getReferenceName();
+ final String mcallname2 = mcallRef2.getReferenceName();
+ final boolean isTypedVar = myMatchingVisitor.getMatchContext().getPattern().isTypedVar(mcallRef1.getReferenceNameElement());
+
+ if (mcallname1 != null && !mcallname1.equals(mcallname2) && !isTypedVar) {
+ myMatchingVisitor.setResult(false);
+ return;
+ }
+
+ final PsiExpression qualifier = mcallRef1.getQualifierExpression();
+ final PsiExpression elementQualifier = mcallRef2.getQualifierExpression();
+ if (qualifier != null) {
+
+ if (elementQualifier != null) {
+ myMatchingVisitor.setResult(myMatchingVisitor.match(qualifier, elementQualifier));
+ if (!myMatchingVisitor.getResult()) return;
+ }
+ else {
+ final PsiMethod method = mcall2.resolveMethod();
+ if (method != null) {
+ if (qualifier instanceof PsiThisExpression) {
+ myMatchingVisitor.setResult(!method.hasModifierProperty(PsiModifier.STATIC));
+ return;
+ }
+ }
+ final MatchingHandler handler = myMatchingVisitor.getMatchContext().getPattern().getHandler(qualifier);
+ matchImplicitQualifier(handler, method, myMatchingVisitor.getMatchContext());
+ if (!myMatchingVisitor.getResult()) {
+ return;
+ }
+ }
+ }
+ else if (elementQualifier != null) {
+ myMatchingVisitor.setResult(false);
+ return;
+ }
+
+ myMatchingVisitor.setResult(myMatchingVisitor.matchSons(mcall.getArgumentList(), mcall2.getArgumentList()));
+
+ if (myMatchingVisitor.getResult() && isTypedVar) {
+ boolean res = myMatchingVisitor.getResult();
+ res &= myMatchingVisitor.handleTypedElement(mcallRef1.getReferenceNameElement(), mcallRef2.getReferenceNameElement());
+ myMatchingVisitor.setResult(res);
+ }
+ }
+
+ @Override
+ public void visitExpressionStatement(final PsiExpressionStatement expr) {
+ final PsiExpressionStatement expr2 = (PsiExpressionStatement)myMatchingVisitor.getElement();
+
+ myMatchingVisitor.setResult(myMatchingVisitor.match(expr.getExpression(), expr2.getExpression()));
+ }
+
+ @Override
+ public void visitLiteralExpression(final PsiLiteralExpression const1) {
+ final PsiLiteralExpression const2 = (PsiLiteralExpression)myMatchingVisitor.getElement();
+
+ MatchingHandler handler = (MatchingHandler)const1.getUserData(CompiledPattern.HANDLER_KEY);
+
+ if (handler instanceof SubstitutionHandler) {
+ int offset = 0;
+ int length = const2.getTextLength();
+ final String text = const2.getText();
+
+ if (length > 2 && text.charAt(0) == '"' && text.charAt(length - 1) == '"') {
+ length--;
+ offset++;
+ }
+ myMatchingVisitor.setResult(((SubstitutionHandler)handler).handle(const2, offset, length, myMatchingVisitor.getMatchContext()));
+ }
+ else if (handler != null) {
+ myMatchingVisitor.setResult(handler.match(const1, const2, myMatchingVisitor.getMatchContext()));
+ }
+ else {
+ myMatchingVisitor.setResult(const1.textMatches(const2));
+ }
+ }
+
+ @Override
+ public void visitAssignmentExpression(final PsiAssignmentExpression assign) {
+ final PsiAssignmentExpression assign2 = (PsiAssignmentExpression)myMatchingVisitor.getElement();
+
+ myMatchingVisitor.setResult(assign.getOperationTokenType().equals(assign2.getOperationTokenType()) &&
+ myMatchingVisitor.match(assign.getLExpression(), assign2.getLExpression()) &&
+ myMatchingVisitor.match(assign.getRExpression(), assign2.getRExpression()));
+ }
+
+ @Override
+ public void visitIfStatement(final PsiIfStatement if1) {
+ final PsiIfStatement if2 = (PsiIfStatement)myMatchingVisitor.getElement();
+
+ myMatchingVisitor.setResult(myMatchingVisitor.match(if1.getCondition(), if2.getCondition()) &&
+ compareBody(if1.getThenBranch(), if2.getThenBranch()) &&
+ compareBody(if1.getElseBranch(), if2.getElseBranch()));
+ }
+
+ @Override
+ public void visitSwitchStatement(final PsiSwitchStatement switch1) {
+ final PsiSwitchStatement switch2 = (PsiSwitchStatement)myMatchingVisitor.getElement();
+
+ myMatchingVisitor.setResult(myMatchingVisitor.match(switch1.getExpression(), switch2.getExpression()) &&
+ myMatchingVisitor.matchSons(switch1.getBody(), switch2.getBody()));
+ }
+
+ @Override
+ public void visitForStatement(final PsiForStatement for1) {
+ final PsiForStatement for2 = (PsiForStatement)myMatchingVisitor.getElement();
+
+ final PsiStatement initialization = for1.getInitialization();
+ MatchingHandler handler = myMatchingVisitor.getMatchContext().getPattern().getHandler(initialization);
+
+ myMatchingVisitor.setResult(handler.match(initialization, for2.getInitialization(), myMatchingVisitor.getMatchContext()) &&
+ myMatchingVisitor.match(for1.getCondition(), for2.getCondition()) &&
+ myMatchingVisitor.match(for1.getUpdate(), for2.getUpdate()) &&
+ compareBody(for1.getBody(), for2.getBody()));
+ }
+
+ @Override
+ public void visitForeachStatement(PsiForeachStatement for1) {
+ final PsiForeachStatement for2 = (PsiForeachStatement)myMatchingVisitor.getElement();
+
+ myMatchingVisitor.setResult(myMatchingVisitor.match(for1.getIterationParameter(), for2.getIterationParameter()) &&
+ myMatchingVisitor.match(for1.getIteratedValue(), for2.getIteratedValue()) &&
+ compareBody(for1.getBody(), for2.getBody()));
+ }
+
+ @Override
+ public void visitWhileStatement(final PsiWhileStatement while1) {
+ final PsiWhileStatement while2 = (PsiWhileStatement)myMatchingVisitor.getElement();
+
+ myMatchingVisitor.setResult(myMatchingVisitor.match(while1.getCondition(), while2.getCondition()) &&
+ compareBody(while1.getBody(), while2.getBody()));
+ }
+
+ @Override
+ public void visitBlockStatement(final PsiBlockStatement block) {
+ if (myMatchingVisitor.getElement() instanceof PsiCodeBlock &&
+ !(myMatchingVisitor.getElement().getParent() instanceof PsiBlockStatement)
+ ) {
+ myMatchingVisitor.setResult(myMatchingVisitor.matchSons(block.getCodeBlock(), myMatchingVisitor.getElement()));
+ }
+ else {
+ final PsiBlockStatement block2 = (PsiBlockStatement)myMatchingVisitor.getElement();
+ myMatchingVisitor.setResult(myMatchingVisitor.matchSons(block, block2));
+ }
+ }
+
+ @Override
+ public void visitDeclarationStatement(final PsiDeclarationStatement dcl) {
+ final PsiDeclarationStatement declaration = (PsiDeclarationStatement)myMatchingVisitor.getElement();
+ myMatchingVisitor.setResult(myMatchingVisitor.matchInAnyOrder(dcl.getDeclaredElements(), declaration.getDeclaredElements()));
+ }
+
+ @Override
+ public void visitDoWhileStatement(final PsiDoWhileStatement while1) {
+ final PsiDoWhileStatement while2 = (PsiDoWhileStatement)myMatchingVisitor.getElement();
+
+ myMatchingVisitor.setResult(myMatchingVisitor.match(while1.getCondition(), while2.getCondition()) &&
+ compareBody(while1.getBody(), while2.getBody()));
+ }
+
+ @Override
+ public void visitReturnStatement(final PsiReturnStatement return1) {
+ final PsiReturnStatement return2 = (PsiReturnStatement)myMatchingVisitor.getElement();
+
+ myMatchingVisitor.setResult(myMatchingVisitor.match(return1.getReturnValue(), return2.getReturnValue()));
+ }
+
+ @Override
+ public void visitPostfixExpression(final PsiPostfixExpression postfix) {
+ final PsiPostfixExpression postfix2 = (PsiPostfixExpression)myMatchingVisitor.getElement();
+
+ myMatchingVisitor.setResult(postfix.getOperationTokenType().equals(postfix2.getOperationTokenType())
+ && myMatchingVisitor.match(postfix.getOperand(), postfix2.getOperand()));
+ }
+
+ @Override
+ public void visitPrefixExpression(final PsiPrefixExpression prefix) {
+ final PsiPrefixExpression prefix2 = (PsiPrefixExpression)myMatchingVisitor.getElement();
+
+ myMatchingVisitor.setResult(prefix.getOperationTokenType().equals(prefix2.getOperationTokenType())
+ && myMatchingVisitor.match(prefix.getOperand(), prefix2.getOperand()));
+ }
+
+ @Override
+ public void visitAssertStatement(final PsiAssertStatement assert1) {
+ final PsiAssertStatement assert2 = (PsiAssertStatement)myMatchingVisitor.getElement();
+
+ myMatchingVisitor.setResult(myMatchingVisitor.match(assert1.getAssertCondition(), assert2.getAssertCondition()) &&
+ myMatchingVisitor.match(assert1.getAssertDescription(), assert2.getAssertDescription()));
+ }
+
+ @Override
+ public void visitBreakStatement(final PsiBreakStatement break1) {
+ final PsiBreakStatement break2 = (PsiBreakStatement)myMatchingVisitor.getElement();
+
+ myMatchingVisitor.setResult(myMatchingVisitor.match(break1.getLabelIdentifier(), break2.getLabelIdentifier()));
+ }
+
+ @Override
+ public void visitContinueStatement(final PsiContinueStatement continue1) {
+ final PsiContinueStatement continue2 = (PsiContinueStatement)myMatchingVisitor.getElement();
+
+ myMatchingVisitor.setResult(myMatchingVisitor.match(continue1.getLabelIdentifier(), continue2.getLabelIdentifier()));
+ }
+
+ @Override
+ public void visitSuperExpression(final PsiSuperExpression super1) {
+ myMatchingVisitor.setResult(true);
+ }
+
+ @Override
+ public void visitThisExpression(final PsiThisExpression this1) {
+ myMatchingVisitor.setResult(myMatchingVisitor.getElement() instanceof PsiThisExpression);
+ }
+
+ @Override
+ public void visitSynchronizedStatement(final PsiSynchronizedStatement synchronized1) {
+ final PsiSynchronizedStatement synchronized2 = (PsiSynchronizedStatement)myMatchingVisitor.getElement();
+
+ myMatchingVisitor.setResult(myMatchingVisitor.match(synchronized1.getLockExpression(), synchronized2.getLockExpression()) &&
+ myMatchingVisitor.matchSons(synchronized1.getBody(), synchronized2.getBody()));
+ }
+
+ @Override
+ public void visitThrowStatement(final PsiThrowStatement throw1) {
+ final PsiThrowStatement throw2 = (PsiThrowStatement)myMatchingVisitor.getElement();
+
+ myMatchingVisitor.setResult(myMatchingVisitor.match(throw1.getException(), throw2.getException()));
+ }
+
+ @Override
+ public void visitParenthesizedExpression(PsiParenthesizedExpression expr) {
+ if (myMatchingVisitor.getElement() instanceof PsiParenthesizedExpression) {
+ myMatchingVisitor.setResult(myMatchingVisitor.matchSons(expr, myMatchingVisitor.getElement()));
+ }
+ else {
+ myMatchingVisitor.setResult(false);
+ }
+ }
+
+ @Override
+ public void visitCatchSection(final PsiCatchSection section) {
+ final PsiCatchSection section2 = (PsiCatchSection)myMatchingVisitor.getElement();
+ final PsiParameter parameter = section.getParameter();
+ if (parameter != null) {
+ myMatchingVisitor.setResult(myMatchingVisitor.match(parameter, section2.getParameter()));
+ }
+ else {
+ myMatchingVisitor.setResult(myMatchingVisitor.match(section.getCatchBlock(), section2.getCatchBlock()));
+ }
+ }
+
+ @Override
+ public void visitTryStatement(final PsiTryStatement try1) {
+ final PsiTryStatement try2 = (PsiTryStatement)myMatchingVisitor.getElement();
+
+ myMatchingVisitor.setResult(myMatchingVisitor.matchSons(try1.getTryBlock(), try2.getTryBlock()));
+
+ if (!myMatchingVisitor.getResult()) return;
+
+ final PsiResourceList resourceList1 = try1.getResourceList();
+ final PsiCatchSection[] catches1 = try1.getCatchSections();
+ final PsiCodeBlock finally1 = try1.getFinallyBlock();
+
+ final PsiResourceList resourceList2 = try2.getResourceList();
+ final PsiCatchSection[] catches2 = try2.getCatchSections();
+ final PsiCodeBlock finally2 = try2.getFinallyBlock();
+
+ final boolean looseMatching = myMatchingVisitor.getMatchContext().getOptions().isLooseMatching();
+ if (!looseMatching &&
+ ((catches1.length == 0 && catches2.length != 0) ||
+ (finally1 == null && finally2 != null) ||
+ (resourceList1 == null && resourceList2 != null))
+ ) {
+ myMatchingVisitor.setResult(false);
+ }
+ else {
+ if (resourceList1 != null) {
+ if (resourceList2 == null) {
+ myMatchingVisitor.setResult(false);
+ return;
+ }
+ final List<PsiResourceVariable> resourceVariables1 = resourceList1.getResourceVariables();
+ final List<PsiResourceVariable> resourceVariables2 = resourceList2.getResourceVariables();
+ myMatchingVisitor.setResult(myMatchingVisitor.matchInAnyOrder(
+ resourceVariables1.toArray(new PsiResourceVariable[resourceVariables1.size()]),
+ resourceVariables2.toArray(new PsiResourceVariable[resourceVariables2.size()])));
+ if (!myMatchingVisitor.getResult()) return;
+ }
+
+ final List<PsiCatchSection> unmatchedCatchSections = new ArrayList<PsiCatchSection>();
+
+ ContainerUtil.addAll(unmatchedCatchSections, catches2);
+
+ for (int i = 0, j; i < catches1.length; ++i) {
+ MatchingHandler handler = myMatchingVisitor.getMatchContext().getPattern().getHandler(catches1[i]);
+ final PsiElement pinnedNode = handler.getPinnedNode(null);
+
+ if (pinnedNode != null) {
+ myMatchingVisitor.setResult(handler.match(catches1[i], pinnedNode, myMatchingVisitor.getMatchContext()));
+ if (!myMatchingVisitor.getResult()) return;
+ }
+ else {
+ for (j = 0; j < unmatchedCatchSections.size(); ++j) {
+ if (handler.match(catches1[i], unmatchedCatchSections.get(j), myMatchingVisitor.getMatchContext())) {
+ unmatchedCatchSections.remove(j);
+ break;
+ }
+ }
+
+ if (j == catches2.length) {
+ myMatchingVisitor.setResult(false);
+ return;
+ }
+ }
+ }
+
+ if (finally1 != null) {
+ myMatchingVisitor.setResult(myMatchingVisitor.matchSons(finally1, finally2));
+ }
+
+ if (myMatchingVisitor.getResult() && unmatchedCatchSections.size() > 0 && !looseMatching) {
+ try2.putUserData(UNMATCHED_CATCH_SECTION_CONTENT_VAR_KEY, unmatchedCatchSections);
+ }
+ }
+ }
+
+ @Override
+ public void visitSwitchLabelStatement(final PsiSwitchLabelStatement case1) {
+ final PsiSwitchLabelStatement case2 = (PsiSwitchLabelStatement)myMatchingVisitor.getElement();
+
+ myMatchingVisitor.setResult(case1.isDefaultCase() == case2.isDefaultCase() &&
+ myMatchingVisitor.match(case1.getCaseValue(), case2.getCaseValue()));
+ }
+
+ @Override
+ public void visitInstanceOfExpression(final PsiInstanceOfExpression instanceOf) {
+ final PsiInstanceOfExpression instanceOf2 = (PsiInstanceOfExpression)myMatchingVisitor.getElement();
+ myMatchingVisitor.setResult(myMatchingVisitor.match(instanceOf.getOperand(), instanceOf2.getOperand()) &&
+ matchType(instanceOf.getCheckType(), instanceOf2.getCheckType()));
+ }
+
+ @Override
+ public void visitNewExpression(final PsiNewExpression new1) {
+ if (myMatchingVisitor.getElement() instanceof PsiArrayInitializerExpression &&
+ myMatchingVisitor.getElement().getParent() instanceof PsiVariable &&
+ new1.getArrayDimensions().length == 0 &&
+ new1.getArrayInitializer() != null
+ ) {
+ myMatchingVisitor.setResult(
+ myMatchingVisitor.match(new1.getClassReference(), ((PsiVariable)myMatchingVisitor.getElement().getParent()).getTypeElement()));
+ myMatchingVisitor.matchSons(new1.getArrayInitializer(), myMatchingVisitor.getElement());
+ return;
+ }
+
+ if (!(myMatchingVisitor.getElement() instanceof PsiNewExpression)) {
+ myMatchingVisitor.setResult(false);
+ return;
+ }
+ final PsiNewExpression new2 = (PsiNewExpression)myMatchingVisitor.getElement();
+
+ if (new1.getClassReference() != null) {
+ if (new2.getClassReference() != null) {
+ myMatchingVisitor.setResult(myMatchingVisitor.match(new1.getClassReference(), new2.getClassReference()) &&
+ myMatchingVisitor.matchSons(new1.getArrayInitializer(), new2.getArrayInitializer()));
+
+ if (myMatchingVisitor.getResult()) {
+ // matching dims
+ matchArrayDims(new1, new2);
+ }
+ return;
+ }
+ else {
+ // match array of primitive by new 'T();
+ final PsiKeyword newKeyword = PsiTreeUtil.getChildOfType(new2, PsiKeyword.class);
+ final PsiElement element = PsiTreeUtil.getNextSiblingOfType(newKeyword, PsiWhiteSpace.class);
+
+ if (element != null && element.getNextSibling() instanceof PsiKeyword) {
+ ((LexicalNodesFilter)LexicalNodesFilter.getInstance()).setCareKeyWords(true);
+
+ myMatchingVisitor.setResult(myMatchingVisitor.match(new1.getClassReference(), element.getNextSibling()) &&
+ myMatchingVisitor.matchSons(new1.getArrayInitializer(), new2.getArrayInitializer()));
+
+ ((LexicalNodesFilter)LexicalNodesFilter.getInstance()).setCareKeyWords(false);
+ if (myMatchingVisitor.getResult()) {
+ // matching dims
+ matchArrayDims(new1, new2);
+ }
+
+ return;
+ }
+ }
+ }
+
+ if (new1.getClassReference() == new2.getClassReference()) {
+ // probably anonymous class or array of primitive type
+ ((LexicalNodesFilter)LexicalNodesFilter.getInstance()).setCareKeyWords(true);
+ myMatchingVisitor.setResult(myMatchingVisitor.matchSons(new1, new2));
+ ((LexicalNodesFilter)LexicalNodesFilter.getInstance()).setCareKeyWords(false);
+ }
+ else if (new1.getAnonymousClass() == null &&
+ new1.getClassReference() != null &&
+ new2.getAnonymousClass() != null) {
+ // allow matching anonymous class without pattern
+ myMatchingVisitor.setResult(myMatchingVisitor.match(new1.getClassReference(), new2.getAnonymousClass().getBaseClassReference()) &&
+ myMatchingVisitor.matchSons(new1.getArgumentList(), new2.getArgumentList()));
+ }
+ else {
+ myMatchingVisitor.setResult(false);
+ }
+ }
+
+ @Override
+ public void visitKeyword(PsiKeyword keyword) {
+ myMatchingVisitor.setResult(keyword.textMatches(myMatchingVisitor.getElement()));
+ }
+
+ @Override
+ public void visitTypeCastExpression(final PsiTypeCastExpression cast) {
+ final PsiTypeCastExpression cast2 = (PsiTypeCastExpression)myMatchingVisitor.getElement();
+
+ myMatchingVisitor.setResult(myMatchingVisitor.match(cast.getCastType(), cast2.getCastType()) &&
+ myMatchingVisitor.match(cast.getOperand(), cast2.getOperand()));
+ }
+
+ @Override
+ public void visitClassObjectAccessExpression(final PsiClassObjectAccessExpression expr) {
+ final PsiClassObjectAccessExpression expr2 = (PsiClassObjectAccessExpression)myMatchingVisitor.getElement();
+
+ myMatchingVisitor.setResult(myMatchingVisitor.match(expr.getOperand(), expr2.getOperand()));
+ }
+
+ @Override
+ public void visitReferenceElement(final PsiJavaCodeReferenceElement ref) {
+ myMatchingVisitor.setResult(matchType(ref, myMatchingVisitor.getElement()));
+ }
+
+ @Override
+ public void visitTypeElement(final PsiTypeElement typeElement) {
+ myMatchingVisitor.setResult(matchType(typeElement, myMatchingVisitor.getElement()));
+ }
+
+ @Override
+ public void visitTypeParameter(PsiTypeParameter psiTypeParameter) {
+ final PsiTypeParameter parameter = (PsiTypeParameter)myMatchingVisitor.getElement();
+ final PsiElement[] children = psiTypeParameter.getChildren();
+ final PsiElement[] children2 = parameter.getChildren();
+
+ final MatchingHandler handler = myMatchingVisitor.getMatchContext().getPattern().getHandler(children[0]);
+
+ if (handler instanceof SubstitutionHandler) {
+ myMatchingVisitor.setResult(((SubstitutionHandler)handler).handle(children2[0], myMatchingVisitor.getMatchContext()));
+ }
+ else {
+ myMatchingVisitor.setResult(children[0].textMatches(children2[0]));
+ }
+
+ if (myMatchingVisitor.getResult() && children.length > 2) {
+ // constraint present
+ if (children2.length == 2) {
+ myMatchingVisitor.setResult(false);
+ return;
+ }
+
+ if (!children[2].getFirstChild().textMatches(children2[2].getFirstChild())) {
+ // constraint type (extends)
+ myMatchingVisitor.setResult(false);
+ return;
+ }
+ myMatchingVisitor.setResult(myMatchingVisitor.matchInAnyOrder(children[2].getChildren(), children2[2].getChildren()));
+ }
+ }
+
+ @Override
+ public void visitClass(PsiClass clazz) {
+ if (clazz.hasTypeParameters()) {
+ myMatchingVisitor
+ .setResult(
+ myMatchingVisitor.match(clazz.getTypeParameterList(), ((PsiClass)myMatchingVisitor.getElement()).getTypeParameterList()));
+
+ if (!myMatchingVisitor.getResult()) return;
+ }
+
+ PsiClass clazz2;
+
+ if (myMatchingVisitor.getElement() instanceof PsiDeclarationStatement &&
+ myMatchingVisitor.getElement().getFirstChild() instanceof PsiClass
+ ) {
+ clazz2 = (PsiClass)myMatchingVisitor.getElement().getFirstChild();
+ }
+ else {
+ clazz2 = (PsiClass)myMatchingVisitor.getElement();
+ }
+
+ final boolean isTypedVar = myMatchingVisitor.getMatchContext().getPattern().isTypedVar(clazz.getNameIdentifier());
+
+ if (clazz.getModifierList().getTextLength() > 0) {
+ if (!myMatchingVisitor.match(clazz.getModifierList(), clazz2.getModifierList())) {
+ myMatchingVisitor.setResult(false);
+ return;
+ }
+ }
+
+ myMatchingVisitor.setResult((clazz.getName().equals(clazz2.getName()) || isTypedVar) &&
+ compareClasses(clazz, clazz2));
+
+ if (myMatchingVisitor.getResult() && isTypedVar) {
+ PsiElement id = clazz2.getNameIdentifier();
+ if (id == null) id = clazz2;
+ myMatchingVisitor.setResult(myMatchingVisitor.handleTypedElement(clazz.getNameIdentifier(), id));
+ }
+ }
+
+ @Override
+ public void visitTypeParameterList(PsiTypeParameterList psiTypeParameterList) {
+ myMatchingVisitor.setResult(myMatchingVisitor.matchSequentially(
+ psiTypeParameterList.getFirstChild(),
+ myMatchingVisitor.getElement().getFirstChild()
+ ));
+ }
+
+ @Override
+ public void visitMethod(PsiMethod method) {
+ final PsiIdentifier methodNameNode = method.getNameIdentifier();
+ final boolean isTypedVar = myMatchingVisitor.getMatchContext().getPattern().isTypedVar(methodNameNode);
+ final PsiMethod method2 = (PsiMethod)myMatchingVisitor.getElement();
+
+ myMatchingVisitor.getMatchContext().pushResult();
+
+ try {
+ if (method.hasTypeParameters()) {
+ myMatchingVisitor.setResult(
+ myMatchingVisitor.match(method.getTypeParameterList(), ((PsiMethod)myMatchingVisitor.getElement()).getTypeParameterList()));
+
+ if (!myMatchingVisitor.getResult()) return;
+ }
+
+ if (!checkHierarchy(method2, method)) {
+ myMatchingVisitor.setResult(false);
+ return;
+ }
+
+ myMatchingVisitor.setResult((method.getName().equals(method2.getName()) || isTypedVar) &&
+ myMatchingVisitor.match(method.getModifierList(), method2.getModifierList()) &&
+ myMatchingVisitor.matchSons(method.getParameterList(), method2.getParameterList()) &&
+ myMatchingVisitor.match(method.getReturnTypeElement(), method2.getReturnTypeElement()) &&
+ matchInAnyOrder(method.getThrowsList(), method2.getThrowsList(), myMatchingVisitor) &&
+ myMatchingVisitor.matchSonsOptionally(method.getBody(), method2.getBody()));
+ }
+ finally {
+ final PsiIdentifier methodNameNode2 = method2.getNameIdentifier();
+
+ saveOrDropResult(methodNameNode, isTypedVar, methodNameNode2);
+ }
+ }
+}
diff --git a/plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/compiler/JavaCompilingVisitor.java b/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/compiler/JavaCompilingVisitor.java
index 271f1c468b0b..271f1c468b0b 100644
--- a/plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/compiler/JavaCompilingVisitor.java
+++ b/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/compiler/JavaCompilingVisitor.java
diff --git a/plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/BlockFilter.java b/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/BlockFilter.java
index 5cef7ffaf3c8..5cef7ffaf3c8 100644
--- a/plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/BlockFilter.java
+++ b/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/BlockFilter.java
diff --git a/plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/ClassFilter.java b/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/ClassFilter.java
index 6e68b08d70da..6e68b08d70da 100644
--- a/plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/ClassFilter.java
+++ b/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/ClassFilter.java
diff --git a/plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/CommentFilter.java b/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/CommentFilter.java
index c2d974c9754e..c2d974c9754e 100644
--- a/plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/CommentFilter.java
+++ b/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/CommentFilter.java
diff --git a/plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/ConstantFilter.java b/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/ConstantFilter.java
index 401e3c15e365..401e3c15e365 100644
--- a/plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/ConstantFilter.java
+++ b/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/ConstantFilter.java
diff --git a/plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/DeclarationFilter.java b/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/DeclarationFilter.java
index d5f5ef5bf36e..d5f5ef5bf36e 100644
--- a/plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/DeclarationFilter.java
+++ b/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/DeclarationFilter.java
diff --git a/plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/ExpressionFilter.java b/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/ExpressionFilter.java
index 632cc403eabb..632cc403eabb 100644
--- a/plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/ExpressionFilter.java
+++ b/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/ExpressionFilter.java
diff --git a/plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/JavaDocFilter.java b/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/JavaDocFilter.java
index d12e9cbd0440..d12e9cbd0440 100644
--- a/plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/JavaDocFilter.java
+++ b/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/JavaDocFilter.java
diff --git a/plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/JavaLexicalNodesFilter.java b/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/JavaLexicalNodesFilter.java
index 1c86acda3e83..1c86acda3e83 100644
--- a/plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/JavaLexicalNodesFilter.java
+++ b/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/JavaLexicalNodesFilter.java
diff --git a/plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/MethodFilter.java b/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/MethodFilter.java
index 00888bb86c5a..00888bb86c5a 100644
--- a/plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/MethodFilter.java
+++ b/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/MethodFilter.java
diff --git a/plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/StatementFilter.java b/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/StatementFilter.java
index 91abc96139e1..91abc96139e1 100644
--- a/plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/StatementFilter.java
+++ b/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/StatementFilter.java
diff --git a/plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/SymbolNodeFilter.java b/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/SymbolNodeFilter.java
index 3e461b6738b6..3e461b6738b6 100644
--- a/plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/SymbolNodeFilter.java
+++ b/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/SymbolNodeFilter.java
diff --git a/plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/TypeFilter.java b/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/TypeFilter.java
index 14dd452b0b7a..14dd452b0b7a 100644
--- a/plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/TypeFilter.java
+++ b/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/TypeFilter.java
diff --git a/plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/TypeParameterFilter.java b/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/TypeParameterFilter.java
index 2f81c8b3980f..2f81c8b3980f 100644
--- a/plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/TypeParameterFilter.java
+++ b/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/TypeParameterFilter.java
diff --git a/plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/TypedSymbolNodeFilter.java b/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/TypedSymbolNodeFilter.java
index 4416b8b7db24..4416b8b7db24 100644
--- a/plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/TypedSymbolNodeFilter.java
+++ b/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/TypedSymbolNodeFilter.java
diff --git a/plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/VariableFilter.java b/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/VariableFilter.java
index e1907ecaf556..e1907ecaf556 100644
--- a/plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/VariableFilter.java
+++ b/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/filters/VariableFilter.java
diff --git a/plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/handlers/DeclarationStatementHandler.java b/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/handlers/DeclarationStatementHandler.java
index 7342e96758f0..7342e96758f0 100644
--- a/plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/handlers/DeclarationStatementHandler.java
+++ b/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/handlers/DeclarationStatementHandler.java
diff --git a/plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/handlers/DocDataHandler.java b/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/handlers/DocDataHandler.java
index dbc97ce67f75..dbc97ce67f75 100644
--- a/plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/handlers/DocDataHandler.java
+++ b/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/handlers/DocDataHandler.java
diff --git a/plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/handlers/ExpressionHandler.java b/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/handlers/ExpressionHandler.java
index 6437c148dd0d..6437c148dd0d 100644
--- a/plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/handlers/ExpressionHandler.java
+++ b/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/handlers/ExpressionHandler.java
diff --git a/plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/handlers/StatementHandler.java b/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/handlers/StatementHandler.java
index c6361e2ad4e7..c6361e2ad4e7 100644
--- a/plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/handlers/StatementHandler.java
+++ b/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/handlers/StatementHandler.java
diff --git a/plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/iterators/DocValuesIterator.java b/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/iterators/DocValuesIterator.java
index c1323abd0951..c1323abd0951 100644
--- a/plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/iterators/DocValuesIterator.java
+++ b/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/iterators/DocValuesIterator.java
diff --git a/plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/iterators/HierarchyNodeIterator.java b/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/iterators/HierarchyNodeIterator.java
index 324528435cb6..324528435cb6 100644
--- a/plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/iterators/HierarchyNodeIterator.java
+++ b/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/iterators/HierarchyNodeIterator.java
diff --git a/plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/predicates/ExprTypePredicate.java b/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/predicates/ExprTypePredicate.java
index d66db76c272d..d66db76c272d 100644
--- a/plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/predicates/ExprTypePredicate.java
+++ b/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/predicates/ExprTypePredicate.java
diff --git a/plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/predicates/FormalArgTypePredicate.java b/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/predicates/FormalArgTypePredicate.java
index 02f1ee7d08e0..02f1ee7d08e0 100644
--- a/plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/predicates/FormalArgTypePredicate.java
+++ b/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/predicates/FormalArgTypePredicate.java
diff --git a/plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/predicates/ReadPredicate.java b/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/predicates/ReadPredicate.java
index ce25b998ba9b..ce25b998ba9b 100644
--- a/plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/predicates/ReadPredicate.java
+++ b/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/predicates/ReadPredicate.java
diff --git a/plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/predicates/WritePredicate.java b/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/predicates/WritePredicate.java
index e0d86824a920..e0d86824a920 100644
--- a/plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/predicates/WritePredicate.java
+++ b/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/predicates/WritePredicate.java
diff --git a/plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/strategies/CommentMatchingStrategy.java b/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/strategies/CommentMatchingStrategy.java
index 7bba3250b768..7bba3250b768 100644
--- a/plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/strategies/CommentMatchingStrategy.java
+++ b/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/strategies/CommentMatchingStrategy.java
diff --git a/plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/strategies/ExprMatchingStrategy.java b/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/strategies/ExprMatchingStrategy.java
index c892badb85be..c892badb85be 100644
--- a/plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/strategies/ExprMatchingStrategy.java
+++ b/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/strategies/ExprMatchingStrategy.java
diff --git a/plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/strategies/JavaDocMatchingStrategy.java b/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/strategies/JavaDocMatchingStrategy.java
index b65180eff650..b65180eff650 100644
--- a/plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/strategies/JavaDocMatchingStrategy.java
+++ b/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/strategies/JavaDocMatchingStrategy.java
diff --git a/plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/strategies/MatchingStrategyBase.java b/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/strategies/MatchingStrategyBase.java
index df6e0fd46832..df6e0fd46832 100644
--- a/plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/strategies/MatchingStrategyBase.java
+++ b/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/strategies/MatchingStrategyBase.java
diff --git a/plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/strategies/SymbolMatchingStrategy.java b/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/strategies/SymbolMatchingStrategy.java
index f31ee37e8aed..f31ee37e8aed 100644
--- a/plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/strategies/SymbolMatchingStrategy.java
+++ b/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/strategies/SymbolMatchingStrategy.java
diff --git a/plugins/structuralsearch/structuralsearch-java/structuralsearch-java.iml b/java/structuralsearch-java/structuralsearch-java.iml
index 4b2ec18c28e6..4b2ec18c28e6 100644
--- a/plugins/structuralsearch/structuralsearch-java/structuralsearch-java.iml
+++ b/java/structuralsearch-java/structuralsearch-java.iml
diff --git a/java/testFramework/src/com/intellij/codeInsight/CodeInsightTestCaseUtil.java b/java/testFramework/src/com/intellij/codeInsight/CodeInsightTestCaseUtil.java
index aa77a1e03473..df90bbb727f7 100644
--- a/java/testFramework/src/com/intellij/codeInsight/CodeInsightTestCaseUtil.java
+++ b/java/testFramework/src/com/intellij/codeInsight/CodeInsightTestCaseUtil.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -15,13 +15,13 @@
*/
package com.intellij.codeInsight;
-import com.intellij.codeInsight.actions.CodeInsightAction;
import com.intellij.ide.DataManager;
import com.intellij.openapi.actionSystem.ActionManager;
+import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
public class CodeInsightTestCaseUtil {
- public static void doAction(CodeInsightTestCase testCase, CodeInsightAction action, String testName, String ext) throws Exception {
+ public static void doAction(CodeInsightTestCase testCase, AnAction action, String testName, String ext) throws Exception {
testCase.configureByFile(testName + "." + ext);
action.actionPerformed(new AnActionEvent(
diff --git a/java/typeMigration/src/META-INF/TypeMigration.xml b/java/typeMigration/src/META-INF/TypeMigration.xml
new file mode 100644
index 000000000000..b460dad4165a
--- /dev/null
+++ b/java/typeMigration/src/META-INF/TypeMigration.xml
@@ -0,0 +1,23 @@
+<idea-plugin>
+ <extensions defaultExtensionNs="com.intellij">
+ <codeInsight.changeVariableTypeQuickFixProvider
+ implementation="com.intellij.refactoring.typeMigration.TypeMigrationVariableTypeFixProvider"/>
+ <conversion.rule implementation="com.intellij.refactoring.typeMigration.rules.ListArrayConversionRule"/>
+ <conversion.rule implementation="com.intellij.refactoring.typeMigration.rules.AtomicConversionRule"/>
+ <conversion.rule implementation="com.intellij.refactoring.typeMigration.rules.BoxingTypeConversionRule"/>
+ <conversion.rule implementation="com.intellij.refactoring.typeMigration.rules.ElementToArrayConversionRule"/>
+ <conversion.rule implementation="com.intellij.refactoring.typeMigration.rules.ThreadLocalConversionRule"/>
+ <intentionAction>
+ <className>com.intellij.refactoring.typeMigration.intentions.ConvertFieldToAtomicIntention</className>
+ <category>Concurrency</category>
+ </intentionAction>
+ <intentionAction>
+ <className>com.intellij.refactoring.typeMigration.intentions.ConvertFieldToThreadLocalIntention</className>
+ <category>Concurrency</category>
+ </intentionAction>
+ <intentionAction>
+ <className>com.intellij.refactoring.typeMigration.intentions.ChangeClassParametersIntention</className>
+ <category>Declaration</category>
+ </intentionAction>
+ </extensions>
+</idea-plugin>
diff --git a/plugins/typeMigration/src/com/intellij/refactoring/typeMigration/TypeConversionDescriptor.java b/java/typeMigration/src/com/intellij/refactoring/typeMigration/TypeConversionDescriptor.java
index d116c3ce30fe..d116c3ce30fe 100644
--- a/plugins/typeMigration/src/com/intellij/refactoring/typeMigration/TypeConversionDescriptor.java
+++ b/java/typeMigration/src/com/intellij/refactoring/typeMigration/TypeConversionDescriptor.java
diff --git a/plugins/typeMigration/src/com/intellij/refactoring/typeMigration/TypeMigrationVariableTypeFixProvider.java b/java/typeMigration/src/com/intellij/refactoring/typeMigration/TypeMigrationVariableTypeFixProvider.java
index d84320e4cd08..d84320e4cd08 100644
--- a/plugins/typeMigration/src/com/intellij/refactoring/typeMigration/TypeMigrationVariableTypeFixProvider.java
+++ b/java/typeMigration/src/com/intellij/refactoring/typeMigration/TypeMigrationVariableTypeFixProvider.java
diff --git a/plugins/typeMigration/src/com/intellij/refactoring/typeMigration/intentions/ChangeClassParametersIntention.java b/java/typeMigration/src/com/intellij/refactoring/typeMigration/intentions/ChangeClassParametersIntention.java
index 9571807cd229..9571807cd229 100644
--- a/plugins/typeMigration/src/com/intellij/refactoring/typeMigration/intentions/ChangeClassParametersIntention.java
+++ b/java/typeMigration/src/com/intellij/refactoring/typeMigration/intentions/ChangeClassParametersIntention.java
diff --git a/plugins/typeMigration/src/com/intellij/refactoring/typeMigration/intentions/ConvertFieldToAtomicIntention.java b/java/typeMigration/src/com/intellij/refactoring/typeMigration/intentions/ConvertFieldToAtomicIntention.java
index d794d59f9943..d794d59f9943 100644
--- a/plugins/typeMigration/src/com/intellij/refactoring/typeMigration/intentions/ConvertFieldToAtomicIntention.java
+++ b/java/typeMigration/src/com/intellij/refactoring/typeMigration/intentions/ConvertFieldToAtomicIntention.java
diff --git a/plugins/typeMigration/src/com/intellij/refactoring/typeMigration/intentions/ConvertFieldToThreadLocalIntention.java b/java/typeMigration/src/com/intellij/refactoring/typeMigration/intentions/ConvertFieldToThreadLocalIntention.java
index e01aaadae7d8..e01aaadae7d8 100644
--- a/plugins/typeMigration/src/com/intellij/refactoring/typeMigration/intentions/ConvertFieldToThreadLocalIntention.java
+++ b/java/typeMigration/src/com/intellij/refactoring/typeMigration/intentions/ConvertFieldToThreadLocalIntention.java
diff --git a/plugins/typeMigration/src/com/intellij/refactoring/typeMigration/rules/AtomicConversionRule.java b/java/typeMigration/src/com/intellij/refactoring/typeMigration/rules/AtomicConversionRule.java
index a4ec46e44838..a4ec46e44838 100644
--- a/plugins/typeMigration/src/com/intellij/refactoring/typeMigration/rules/AtomicConversionRule.java
+++ b/java/typeMigration/src/com/intellij/refactoring/typeMigration/rules/AtomicConversionRule.java
diff --git a/plugins/typeMigration/src/com/intellij/refactoring/typeMigration/rules/BoxingTypeConversionRule.java b/java/typeMigration/src/com/intellij/refactoring/typeMigration/rules/BoxingTypeConversionRule.java
index 4353bf602e04..4353bf602e04 100644
--- a/plugins/typeMigration/src/com/intellij/refactoring/typeMigration/rules/BoxingTypeConversionRule.java
+++ b/java/typeMigration/src/com/intellij/refactoring/typeMigration/rules/BoxingTypeConversionRule.java
diff --git a/plugins/typeMigration/src/com/intellij/refactoring/typeMigration/rules/ElementToArrayConversionRule.java b/java/typeMigration/src/com/intellij/refactoring/typeMigration/rules/ElementToArrayConversionRule.java
index 0d25df778bcc..0d25df778bcc 100644
--- a/plugins/typeMigration/src/com/intellij/refactoring/typeMigration/rules/ElementToArrayConversionRule.java
+++ b/java/typeMigration/src/com/intellij/refactoring/typeMigration/rules/ElementToArrayConversionRule.java
diff --git a/plugins/typeMigration/src/com/intellij/refactoring/typeMigration/rules/ListArrayConversionRule.java b/java/typeMigration/src/com/intellij/refactoring/typeMigration/rules/ListArrayConversionRule.java
index 0aa639ba28cb..0aa639ba28cb 100644
--- a/plugins/typeMigration/src/com/intellij/refactoring/typeMigration/rules/ListArrayConversionRule.java
+++ b/java/typeMigration/src/com/intellij/refactoring/typeMigration/rules/ListArrayConversionRule.java
diff --git a/plugins/typeMigration/src/com/intellij/refactoring/typeMigration/rules/ThreadLocalConversionRule.java b/java/typeMigration/src/com/intellij/refactoring/typeMigration/rules/ThreadLocalConversionRule.java
index 2fb305147d02..2fb305147d02 100644
--- a/plugins/typeMigration/src/com/intellij/refactoring/typeMigration/rules/ThreadLocalConversionRule.java
+++ b/java/typeMigration/src/com/intellij/refactoring/typeMigration/rules/ThreadLocalConversionRule.java
diff --git a/plugins/typeMigration/src/intentionDescriptions/ChangeClassParametersIntention/after.java.template b/java/typeMigration/src/intentionDescriptions/ChangeClassParametersIntention/after.java.template
index 413db792c422..413db792c422 100644
--- a/plugins/typeMigration/src/intentionDescriptions/ChangeClassParametersIntention/after.java.template
+++ b/java/typeMigration/src/intentionDescriptions/ChangeClassParametersIntention/after.java.template
diff --git a/plugins/typeMigration/src/intentionDescriptions/ChangeClassParametersIntention/before.java.template b/java/typeMigration/src/intentionDescriptions/ChangeClassParametersIntention/before.java.template
index 96eb1b46dbd2..96eb1b46dbd2 100644
--- a/plugins/typeMigration/src/intentionDescriptions/ChangeClassParametersIntention/before.java.template
+++ b/java/typeMigration/src/intentionDescriptions/ChangeClassParametersIntention/before.java.template
diff --git a/plugins/typeMigration/src/intentionDescriptions/ChangeClassParametersIntention/description.html b/java/typeMigration/src/intentionDescriptions/ChangeClassParametersIntention/description.html
index d4dc0a283bf8..d4dc0a283bf8 100644
--- a/plugins/typeMigration/src/intentionDescriptions/ChangeClassParametersIntention/description.html
+++ b/java/typeMigration/src/intentionDescriptions/ChangeClassParametersIntention/description.html
diff --git a/plugins/typeMigration/src/intentionDescriptions/ConvertFieldToAtomicIntention/after.java.template b/java/typeMigration/src/intentionDescriptions/ConvertFieldToAtomicIntention/after.java.template
index 53cfaf5be80c..53cfaf5be80c 100644
--- a/plugins/typeMigration/src/intentionDescriptions/ConvertFieldToAtomicIntention/after.java.template
+++ b/java/typeMigration/src/intentionDescriptions/ConvertFieldToAtomicIntention/after.java.template
diff --git a/plugins/typeMigration/src/intentionDescriptions/ConvertFieldToAtomicIntention/before.java.template b/java/typeMigration/src/intentionDescriptions/ConvertFieldToAtomicIntention/before.java.template
index 9e6048be8324..9e6048be8324 100644
--- a/plugins/typeMigration/src/intentionDescriptions/ConvertFieldToAtomicIntention/before.java.template
+++ b/java/typeMigration/src/intentionDescriptions/ConvertFieldToAtomicIntention/before.java.template
diff --git a/plugins/typeMigration/src/intentionDescriptions/ConvertFieldToAtomicIntention/description.html b/java/typeMigration/src/intentionDescriptions/ConvertFieldToAtomicIntention/description.html
index 0f799f7b36a8..0f799f7b36a8 100644
--- a/plugins/typeMigration/src/intentionDescriptions/ConvertFieldToAtomicIntention/description.html
+++ b/java/typeMigration/src/intentionDescriptions/ConvertFieldToAtomicIntention/description.html
diff --git a/plugins/typeMigration/src/intentionDescriptions/ConvertFieldToThreadLocalIntention/after.java.template b/java/typeMigration/src/intentionDescriptions/ConvertFieldToThreadLocalIntention/after.java.template
index 377017bd41c6..377017bd41c6 100644
--- a/plugins/typeMigration/src/intentionDescriptions/ConvertFieldToThreadLocalIntention/after.java.template
+++ b/java/typeMigration/src/intentionDescriptions/ConvertFieldToThreadLocalIntention/after.java.template
diff --git a/plugins/typeMigration/src/intentionDescriptions/ConvertFieldToThreadLocalIntention/before.java.template b/java/typeMigration/src/intentionDescriptions/ConvertFieldToThreadLocalIntention/before.java.template
index 14fae704762b..14fae704762b 100644
--- a/plugins/typeMigration/src/intentionDescriptions/ConvertFieldToThreadLocalIntention/before.java.template
+++ b/java/typeMigration/src/intentionDescriptions/ConvertFieldToThreadLocalIntention/before.java.template
diff --git a/plugins/typeMigration/src/intentionDescriptions/ConvertFieldToThreadLocalIntention/description.html b/java/typeMigration/src/intentionDescriptions/ConvertFieldToThreadLocalIntention/description.html
index 930467e5df1b..930467e5df1b 100644
--- a/plugins/typeMigration/src/intentionDescriptions/ConvertFieldToThreadLocalIntention/description.html
+++ b/java/typeMigration/src/intentionDescriptions/ConvertFieldToThreadLocalIntention/description.html
diff --git a/java/typeMigration/test/com/intellij/codeInsight/ConvertToAtomicIntentionTest.java b/java/typeMigration/test/com/intellij/codeInsight/ConvertToAtomicIntentionTest.java
new file mode 100644
index 000000000000..d4de1aa249ac
--- /dev/null
+++ b/java/typeMigration/test/com/intellij/codeInsight/ConvertToAtomicIntentionTest.java
@@ -0,0 +1,30 @@
+package com.intellij.codeInsight;
+
+import com.intellij.codeInsight.daemon.quickFix.LightQuickFixParameterizedTestCase;
+import com.intellij.testFramework.PlatformTestUtil;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * @author anna
+ */
+public class ConvertToAtomicIntentionTest extends LightQuickFixParameterizedTestCase {
+ @Override
+ protected boolean shouldBeAvailableAfterExecution() {
+ return true;
+ }
+
+ @Override
+ protected String getBasePath() {
+ return "/intentions/atomic";
+ }
+
+ @NotNull
+ @Override
+ protected String getTestDataPath() {
+ return PlatformTestUtil.getCommunityPath() + "/java/typeMigration/testData";
+ }
+
+ public void test() throws Exception {
+ doAllTests();
+ }
+} \ No newline at end of file
diff --git a/java/typeMigration/test/com/intellij/codeInsight/ConvertToThreadLocalIntentionTest.java b/java/typeMigration/test/com/intellij/codeInsight/ConvertToThreadLocalIntentionTest.java
new file mode 100644
index 000000000000..e45b26ba77c8
--- /dev/null
+++ b/java/typeMigration/test/com/intellij/codeInsight/ConvertToThreadLocalIntentionTest.java
@@ -0,0 +1,30 @@
+package com.intellij.codeInsight;
+
+import com.intellij.codeInsight.daemon.quickFix.LightQuickFixParameterizedTestCase;
+import com.intellij.testFramework.PlatformTestUtil;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * @author anna
+ */
+public class ConvertToThreadLocalIntentionTest extends LightQuickFixParameterizedTestCase {
+ @Override
+ protected boolean shouldBeAvailableAfterExecution() {
+ return true;
+ }
+
+ @Override
+ protected String getBasePath() {
+ return "/intentions/threadLocal";
+ }
+
+ @NotNull
+ @Override
+ protected String getTestDataPath() {
+ return PlatformTestUtil.getCommunityPath() + "/java/typeMigration/testData";
+ }
+
+ public void test() throws Exception {
+ doAllTests();
+ }
+} \ No newline at end of file
diff --git a/plugins/typeMigration/test/com/intellij/refactoring/AllTypeMigrationTests.java b/java/typeMigration/test/com/intellij/refactoring/AllTypeMigrationTests.java
index 2fb8d9054628..2fb8d9054628 100644
--- a/plugins/typeMigration/test/com/intellij/refactoring/AllTypeMigrationTests.java
+++ b/java/typeMigration/test/com/intellij/refactoring/AllTypeMigrationTests.java
diff --git a/java/typeMigration/test/com/intellij/refactoring/ChangeTypeSignatureTest.java b/java/typeMigration/test/com/intellij/refactoring/ChangeTypeSignatureTest.java
new file mode 100644
index 000000000000..8feae694f7b6
--- /dev/null
+++ b/java/typeMigration/test/com/intellij/refactoring/ChangeTypeSignatureTest.java
@@ -0,0 +1,148 @@
+/*
+ * User: anna
+ * Date: 18-Mar-2008
+ */
+package com.intellij.refactoring;
+
+import com.intellij.psi.*;
+import com.intellij.psi.impl.source.PsiImmediateClassType;
+import com.intellij.psi.search.GlobalSearchScope;
+import com.intellij.psi.util.PsiTreeUtil;
+import com.intellij.refactoring.typeMigration.TypeMigrationLabeler;
+import com.intellij.refactoring.typeMigration.TypeMigrationProcessor;
+import com.intellij.refactoring.typeMigration.TypeMigrationRules;
+import com.intellij.testFramework.LightCodeInsightTestCase;
+import com.intellij.testFramework.PlatformTestUtil;
+import org.jetbrains.annotations.NotNull;
+
+public class ChangeTypeSignatureTest extends LightCodeInsightTestCase {
+ @NotNull
+ @Override
+ protected String getTestDataPath() {
+ return PlatformTestUtil.getCommunityPath() + "/java/typeMigration/testData";
+ }
+
+ private void doTest(boolean success, String migrationTypeText) throws Exception {
+ String dataPath = "/refactoring/changeTypeSignature/";
+ configureByFile(dataPath + getTestName(false) + ".java");
+ final PsiFile file = getFile();
+ final PsiElement element = file.findElementAt(getEditor().getCaretModel().getOffset());
+ final PsiReferenceParameterList parameterList = PsiTreeUtil.getParentOfType(element, PsiReferenceParameterList.class);
+ assert parameterList != null;
+ final PsiClass superClass = (PsiClass)((PsiJavaCodeReferenceElement)parameterList.getParent()).resolve();
+ assert superClass != null;
+
+ PsiType migrationType = getJavaFacade().getElementFactory().createTypeFromText(migrationTypeText, null);
+
+ try {
+ final TypeMigrationRules rules = new TypeMigrationRules(TypeMigrationLabeler.getElementType(parameterList));
+ rules.setMigrationRootType(PsiSubstitutor.EMPTY.put(superClass.getTypeParameters()[0], migrationType).substitute(new PsiImmediateClassType(superClass, PsiSubstitutor.EMPTY)));
+ rules.setBoundScope(GlobalSearchScope.projectScope(getProject()));
+ new TypeMigrationProcessor(getProject(), parameterList, rules).run();
+ if (success) {
+ checkResultByFile(dataPath + getTestName(false) + ".java.after");
+ } else {
+ fail("Conflicts should be detected");
+ }
+ }
+ catch (RuntimeException e) {
+ if (success) {
+ e.printStackTrace();
+ fail("Conflicts should not appear");
+ }
+ }
+ }
+
+ private void doTest(boolean success) throws Exception {
+ doTest(success, CommonClassNames.JAVA_LANG_OBJECT);
+ }
+
+ public void testListTypeArguments() throws Exception {
+ doTest(true);
+ }
+
+ public void testFieldUsage() throws Exception {
+ doTest(true);
+ }
+
+ public void testFieldUsage1() throws Exception {
+ doTest(true);
+ }
+
+ public void testReturnType() throws Exception {
+ doTest(true);
+ }
+
+ public void testReturnType1() throws Exception {
+ doTest(true);
+ }
+
+ public void testReturnType2() throws Exception {
+ doTest(true);
+ }
+
+ public void testPassedParameter() throws Exception {
+ doTest(true);
+ }
+
+ public void testPassedParameter1() throws Exception {
+ doTest(true, "java.lang.Integer");
+ }
+
+ public void testPassedParameter2() throws Exception {
+ doTest(true);
+ }
+
+ public void testUsedInSuper() throws Exception {
+ doTest(true);
+ }
+
+ public void testCompositeReturnType() throws Exception {
+ doTest(true);
+ }
+
+ public void testTypeHierarchy() throws Exception {
+ doTest(true);
+ }
+
+ public void testTypeHierarchy1() throws Exception {
+ doTest(true);
+ }
+
+ public void testTypeHierarchy2() throws Exception {
+ doTest(true);
+ }
+
+ public void testTypeHierarchyFieldUsage() throws Exception {
+ doTest(true);
+ }
+
+ public void testTypeHierarchyFieldUsageConflict() throws Exception {
+ doTest(true);
+ }
+
+ public void testParameterMigration() throws Exception {
+ doTest(true);
+ }
+
+ public void testParameterMigration1() throws Exception {
+ doTest(true, "java.lang.Integer");
+ }
+
+ public void testParameterMigration2() throws Exception {
+ doTest(true, "java.lang.Integer");
+ }
+
+ public void testFieldTypeMigration() throws Exception {
+ doTest(true, "java.lang.String");
+ }
+
+ public void testMethodReturnTypeMigration() throws Exception {
+ doTest(true, "java.lang.Integer");
+ }
+
+ @Override
+ protected boolean isRunInWriteAction() {
+ return false;
+ }
+} \ No newline at end of file
diff --git a/plugins/typeMigration/test/com/intellij/refactoring/MigrateTypeSignatureTest.java b/java/typeMigration/test/com/intellij/refactoring/MigrateTypeSignatureTest.java
index 7889306ed6f0..7889306ed6f0 100644
--- a/plugins/typeMigration/test/com/intellij/refactoring/MigrateTypeSignatureTest.java
+++ b/java/typeMigration/test/com/intellij/refactoring/MigrateTypeSignatureTest.java
diff --git a/plugins/typeMigration/test/com/intellij/refactoring/TypeMigrationByAtomicRuleTest.java b/java/typeMigration/test/com/intellij/refactoring/TypeMigrationByAtomicRuleTest.java
index 80658077e986..80658077e986 100644
--- a/plugins/typeMigration/test/com/intellij/refactoring/TypeMigrationByAtomicRuleTest.java
+++ b/java/typeMigration/test/com/intellij/refactoring/TypeMigrationByAtomicRuleTest.java
diff --git a/plugins/typeMigration/test/com/intellij/refactoring/TypeMigrationByThreadLocalRuleTest.java b/java/typeMigration/test/com/intellij/refactoring/TypeMigrationByThreadLocalRuleTest.java
index 5d002d3fcced..5d002d3fcced 100644
--- a/plugins/typeMigration/test/com/intellij/refactoring/TypeMigrationByThreadLocalRuleTest.java
+++ b/java/typeMigration/test/com/intellij/refactoring/TypeMigrationByThreadLocalRuleTest.java
diff --git a/plugins/typeMigration/test/com/intellij/refactoring/TypeMigrationTest.java b/java/typeMigration/test/com/intellij/refactoring/TypeMigrationTest.java
index b3c36dca19f2..b3c36dca19f2 100644
--- a/plugins/typeMigration/test/com/intellij/refactoring/TypeMigrationTest.java
+++ b/java/typeMigration/test/com/intellij/refactoring/TypeMigrationTest.java
diff --git a/java/typeMigration/test/com/intellij/refactoring/TypeMigrationTestBase.java b/java/typeMigration/test/com/intellij/refactoring/TypeMigrationTestBase.java
new file mode 100644
index 000000000000..2d4c2118c040
--- /dev/null
+++ b/java/typeMigration/test/com/intellij/refactoring/TypeMigrationTestBase.java
@@ -0,0 +1,193 @@
+package com.intellij.refactoring;
+
+import com.intellij.openapi.command.WriteCommandAction;
+import com.intellij.openapi.fileEditor.FileDocumentManager;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.io.FileUtil;
+import com.intellij.openapi.vfs.LocalFileSystem;
+import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.psi.PsiClass;
+import com.intellij.psi.PsiElement;
+import com.intellij.psi.PsiField;
+import com.intellij.psi.PsiType;
+import com.intellij.psi.search.GlobalSearchScope;
+import com.intellij.psi.search.LocalSearchScope;
+import com.intellij.refactoring.typeMigration.TypeMigrationProcessor;
+import com.intellij.refactoring.typeMigration.TypeMigrationRules;
+import com.intellij.testFramework.PlatformTestUtil;
+import com.intellij.usageView.UsageInfo;
+import org.jetbrains.annotations.NonNls;
+import org.jetbrains.annotations.NotNull;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.PrintWriter;
+
+/**
+ * @author anna
+ * Date: 30-Apr-2008
+ */
+public abstract class TypeMigrationTestBase extends MultiFileTestCase {
+ @Override
+ protected String getTestDataPath() {
+ return PlatformTestUtil.getCommunityPath() + "/java/typeMigration/testData";
+ }
+
+ protected void doTestFieldType(@NonNls String fieldName, PsiType fromType, PsiType toType) {
+ doTestFieldType(fieldName, "Test", fromType, toType);
+ }
+
+ protected void doTestFieldType(@NonNls final String fieldName, String className, final PsiType rootType, final PsiType migrationType) {
+ final RulesProvider provider = new RulesProvider() {
+ @Override
+ public TypeMigrationRules provide() throws Exception {
+ final TypeMigrationRules rules = new TypeMigrationRules(rootType);
+ rules.setMigrationRootType(migrationType);
+ return rules;
+ }
+
+ @Override
+ public PsiElement victims(PsiClass aClass) {
+ final PsiField field = aClass.findFieldByName(fieldName, false);
+ assert field != null : fieldName + " not found in " + aClass;
+ return field;
+ }
+ };
+
+ start(provider, className);
+ }
+
+ protected void doTestMethodType(@NonNls final String methodName, final PsiType rootType, final PsiType migrationType) {
+ doTestMethodType(methodName, "Test", rootType, migrationType);
+ }
+
+ protected void doTestMethodType(@NonNls final String methodName, @NonNls String className, final PsiType rootType, final PsiType migrationType) {
+ final RulesProvider provider = new RulesProvider() {
+ @Override
+ public TypeMigrationRules provide() throws Exception {
+ final TypeMigrationRules rules = new TypeMigrationRules(rootType);
+ rules.setMigrationRootType(migrationType);
+ return rules;
+ }
+
+ @Override
+ public PsiElement victims(PsiClass aClass) {
+ return aClass.findMethodsByName(methodName, false)[0];
+ }
+ };
+
+ start(provider, className);
+ }
+
+ protected void doTestFirstParamType(@NonNls final String methodName, final PsiType rootType, final PsiType migrationType) {
+ doTestFirstParamType(methodName, "Test", rootType, migrationType);
+ }
+
+ protected void doTestFirstParamType(@NonNls final String methodName, String className, final PsiType rootType, final PsiType migrationType) {
+ final RulesProvider provider = new RulesProvider() {
+ @Override
+ public TypeMigrationRules provide() throws Exception {
+ final TypeMigrationRules rules = new TypeMigrationRules(rootType);
+ rules.setMigrationRootType(migrationType);
+ return rules;
+ }
+
+ @Override
+ public PsiElement victims(PsiClass aClass) {
+ return aClass.findMethodsByName(methodName, false)[0].getParameterList().getParameters()[0];
+ }
+ };
+
+ start(provider, className);
+ }
+
+ public void start(final RulesProvider provider) {
+ start(provider, "Test");
+ }
+
+ public void start(final RulesProvider provider, final String className) {
+ doTest(new PerformAction() {
+ @Override
+ public void performAction(VirtualFile rootDir, VirtualFile rootAfter) throws Exception {
+ TypeMigrationTestBase.this.performAction(className, rootDir.getName(), provider);
+ }
+ });
+ }
+
+ private void performAction(String className, String rootDir, RulesProvider provider) throws Exception {
+ PsiClass aClass = myJavaFacade.findClass(className, GlobalSearchScope.allScope(getProject()));
+
+ assertNotNull("Class " + className + " not found", aClass);
+
+ final TypeMigrationRules rules = provider.provide();
+ rules.setBoundScope(new LocalSearchScope(aClass.getContainingFile()));
+ final TestTypeMigrationProcessor pr = new TestTypeMigrationProcessor(getProject(), provider.victims(aClass), rules);
+
+ final UsageInfo[] usages = pr.findUsages();
+ final String report = pr.getLabeler().getMigrationReport();
+
+ WriteCommandAction.runWriteCommandAction(null, new Runnable() {
+ public void run() {
+ pr.performRefactoring(usages);
+ }
+ });
+
+
+ String itemName = className + ".items";
+ String patternName = getTestDataPath() + getTestRoot() + getTestName(true) + "/after/" + itemName;
+
+ File patternFile = new File(patternName);
+
+ if (!patternFile.exists()) {
+ PrintWriter writer = new PrintWriter(new FileOutputStream(patternFile));
+ try {
+ writer.print(report);
+ writer.close();
+ }
+ finally {
+ writer.close();
+ }
+
+ System.out.println("Pattern not found, file " + patternName + " created.");
+
+ LocalFileSystem.getInstance().refreshAndFindFileByIoFile(patternFile);
+ }
+
+ File graFile = new File(FileUtil.getTempDirectory() + File.separator + rootDir + File.separator + itemName);
+
+ PrintWriter writer = new PrintWriter(new FileOutputStream(graFile));
+ try {
+ writer.print(report);
+ writer.close();
+ }
+ finally {
+ writer.close();
+ }
+
+ LocalFileSystem.getInstance().refreshAndFindFileByIoFile(graFile);
+ FileDocumentManager.getInstance().saveAllDocuments();
+ }
+
+ interface RulesProvider {
+ TypeMigrationRules provide() throws Exception;
+
+ PsiElement victims(PsiClass aClass);
+ }
+
+ private static class TestTypeMigrationProcessor extends TypeMigrationProcessor {
+ public TestTypeMigrationProcessor(final Project project, final PsiElement root, final TypeMigrationRules rules) {
+ super(project, root, rules);
+ }
+
+ @NotNull
+ @Override
+ public UsageInfo[] findUsages() {
+ return super.findUsages();
+ }
+
+ @Override
+ public void performRefactoring(final UsageInfo[] usages) {
+ super.performRefactoring(usages);
+ }
+ }
+} \ No newline at end of file
diff --git a/plugins/typeMigration/test/com/intellij/refactoring/WildcardTypeMigrationTest.java b/java/typeMigration/test/com/intellij/refactoring/WildcardTypeMigrationTest.java
index d66320623f83..d66320623f83 100644
--- a/plugins/typeMigration/test/com/intellij/refactoring/WildcardTypeMigrationTest.java
+++ b/java/typeMigration/test/com/intellij/refactoring/WildcardTypeMigrationTest.java
diff --git a/plugins/typeMigration/testData/intentions/atomic/after1.java b/java/typeMigration/testData/intentions/atomic/after1.java
index 853f715fd8c4..853f715fd8c4 100644
--- a/plugins/typeMigration/testData/intentions/atomic/after1.java
+++ b/java/typeMigration/testData/intentions/atomic/after1.java
diff --git a/plugins/typeMigration/testData/intentions/atomic/after10.java b/java/typeMigration/testData/intentions/atomic/after10.java
index 685e3fb710e2..685e3fb710e2 100644
--- a/plugins/typeMigration/testData/intentions/atomic/after10.java
+++ b/java/typeMigration/testData/intentions/atomic/after10.java
diff --git a/plugins/typeMigration/testData/intentions/atomic/after12.java b/java/typeMigration/testData/intentions/atomic/after12.java
index 8accafd9fa10..8accafd9fa10 100644
--- a/plugins/typeMigration/testData/intentions/atomic/after12.java
+++ b/java/typeMigration/testData/intentions/atomic/after12.java
diff --git a/plugins/typeMigration/testData/intentions/atomic/after13.java b/java/typeMigration/testData/intentions/atomic/after13.java
index dea58d02e88c..dea58d02e88c 100644
--- a/plugins/typeMigration/testData/intentions/atomic/after13.java
+++ b/java/typeMigration/testData/intentions/atomic/after13.java
diff --git a/plugins/typeMigration/testData/intentions/atomic/after14.java b/java/typeMigration/testData/intentions/atomic/after14.java
index 6109d4106e9b..6109d4106e9b 100644
--- a/plugins/typeMigration/testData/intentions/atomic/after14.java
+++ b/java/typeMigration/testData/intentions/atomic/after14.java
diff --git a/plugins/typeMigration/testData/intentions/atomic/after2.java b/java/typeMigration/testData/intentions/atomic/after2.java
index 2c2ad94beeb0..2c2ad94beeb0 100644
--- a/plugins/typeMigration/testData/intentions/atomic/after2.java
+++ b/java/typeMigration/testData/intentions/atomic/after2.java
diff --git a/plugins/typeMigration/testData/intentions/atomic/after3.java b/java/typeMigration/testData/intentions/atomic/after3.java
index 505349d5dc36..505349d5dc36 100644
--- a/plugins/typeMigration/testData/intentions/atomic/after3.java
+++ b/java/typeMigration/testData/intentions/atomic/after3.java
diff --git a/plugins/typeMigration/testData/intentions/atomic/after4.java b/java/typeMigration/testData/intentions/atomic/after4.java
index e268b2604404..e268b2604404 100644
--- a/plugins/typeMigration/testData/intentions/atomic/after4.java
+++ b/java/typeMigration/testData/intentions/atomic/after4.java
diff --git a/plugins/typeMigration/testData/intentions/atomic/after5.java b/java/typeMigration/testData/intentions/atomic/after5.java
index 82ff84c68e75..82ff84c68e75 100644
--- a/plugins/typeMigration/testData/intentions/atomic/after5.java
+++ b/java/typeMigration/testData/intentions/atomic/after5.java
diff --git a/plugins/typeMigration/testData/intentions/atomic/after6.java b/java/typeMigration/testData/intentions/atomic/after6.java
index f0120300e0f9..f0120300e0f9 100644
--- a/plugins/typeMigration/testData/intentions/atomic/after6.java
+++ b/java/typeMigration/testData/intentions/atomic/after6.java
diff --git a/plugins/typeMigration/testData/intentions/atomic/after7.java b/java/typeMigration/testData/intentions/atomic/after7.java
index 19336f0bc61b..19336f0bc61b 100644
--- a/plugins/typeMigration/testData/intentions/atomic/after7.java
+++ b/java/typeMigration/testData/intentions/atomic/after7.java
diff --git a/plugins/typeMigration/testData/intentions/atomic/after8.java b/java/typeMigration/testData/intentions/atomic/after8.java
index bdfbd5b03a4d..bdfbd5b03a4d 100644
--- a/plugins/typeMigration/testData/intentions/atomic/after8.java
+++ b/java/typeMigration/testData/intentions/atomic/after8.java
diff --git a/plugins/typeMigration/testData/intentions/atomic/after9.java b/java/typeMigration/testData/intentions/atomic/after9.java
index c462a10961d4..c462a10961d4 100644
--- a/plugins/typeMigration/testData/intentions/atomic/after9.java
+++ b/java/typeMigration/testData/intentions/atomic/after9.java
diff --git a/plugins/typeMigration/testData/intentions/atomic/afterExcl.java b/java/typeMigration/testData/intentions/atomic/afterExcl.java
index 72f91198ce3d..72f91198ce3d 100644
--- a/plugins/typeMigration/testData/intentions/atomic/afterExcl.java
+++ b/java/typeMigration/testData/intentions/atomic/afterExcl.java
diff --git a/plugins/typeMigration/testData/intentions/atomic/afterTA1.java b/java/typeMigration/testData/intentions/atomic/afterTA1.java
index a90ed666ea30..a90ed666ea30 100644
--- a/plugins/typeMigration/testData/intentions/atomic/afterTA1.java
+++ b/java/typeMigration/testData/intentions/atomic/afterTA1.java
diff --git a/plugins/typeMigration/testData/intentions/atomic/before1.java b/java/typeMigration/testData/intentions/atomic/before1.java
index d3b926f29fb3..d3b926f29fb3 100644
--- a/plugins/typeMigration/testData/intentions/atomic/before1.java
+++ b/java/typeMigration/testData/intentions/atomic/before1.java
diff --git a/plugins/typeMigration/testData/intentions/atomic/before10.java b/java/typeMigration/testData/intentions/atomic/before10.java
index a4e7c9db6b75..a4e7c9db6b75 100644
--- a/plugins/typeMigration/testData/intentions/atomic/before10.java
+++ b/java/typeMigration/testData/intentions/atomic/before10.java
diff --git a/plugins/typeMigration/testData/intentions/atomic/before11.java b/java/typeMigration/testData/intentions/atomic/before11.java
index b1abb55f9503..b1abb55f9503 100644
--- a/plugins/typeMigration/testData/intentions/atomic/before11.java
+++ b/java/typeMigration/testData/intentions/atomic/before11.java
diff --git a/plugins/typeMigration/testData/intentions/atomic/before12.java b/java/typeMigration/testData/intentions/atomic/before12.java
index 2c634df22c2f..2c634df22c2f 100644
--- a/plugins/typeMigration/testData/intentions/atomic/before12.java
+++ b/java/typeMigration/testData/intentions/atomic/before12.java
diff --git a/plugins/typeMigration/testData/intentions/atomic/before13.java b/java/typeMigration/testData/intentions/atomic/before13.java
index 179e2b165252..179e2b165252 100644
--- a/plugins/typeMigration/testData/intentions/atomic/before13.java
+++ b/java/typeMigration/testData/intentions/atomic/before13.java
diff --git a/plugins/typeMigration/testData/intentions/atomic/before14.java b/java/typeMigration/testData/intentions/atomic/before14.java
index 042b4c4dd2a1..042b4c4dd2a1 100644
--- a/plugins/typeMigration/testData/intentions/atomic/before14.java
+++ b/java/typeMigration/testData/intentions/atomic/before14.java
diff --git a/plugins/typeMigration/testData/intentions/atomic/before2.java b/java/typeMigration/testData/intentions/atomic/before2.java
index d33fffc40e20..d33fffc40e20 100644
--- a/plugins/typeMigration/testData/intentions/atomic/before2.java
+++ b/java/typeMigration/testData/intentions/atomic/before2.java
diff --git a/plugins/typeMigration/testData/intentions/atomic/before3.java b/java/typeMigration/testData/intentions/atomic/before3.java
index 661dbdd63fb2..661dbdd63fb2 100644
--- a/plugins/typeMigration/testData/intentions/atomic/before3.java
+++ b/java/typeMigration/testData/intentions/atomic/before3.java
diff --git a/plugins/typeMigration/testData/intentions/atomic/before4.java b/java/typeMigration/testData/intentions/atomic/before4.java
index ecf4b985a5d2..ecf4b985a5d2 100644
--- a/plugins/typeMigration/testData/intentions/atomic/before4.java
+++ b/java/typeMigration/testData/intentions/atomic/before4.java
diff --git a/plugins/typeMigration/testData/intentions/atomic/before5.java b/java/typeMigration/testData/intentions/atomic/before5.java
index 7ace336aa8be..7ace336aa8be 100644
--- a/plugins/typeMigration/testData/intentions/atomic/before5.java
+++ b/java/typeMigration/testData/intentions/atomic/before5.java
diff --git a/plugins/typeMigration/testData/intentions/atomic/before6.java b/java/typeMigration/testData/intentions/atomic/before6.java
index abc59802e025..abc59802e025 100644
--- a/plugins/typeMigration/testData/intentions/atomic/before6.java
+++ b/java/typeMigration/testData/intentions/atomic/before6.java
diff --git a/plugins/typeMigration/testData/intentions/atomic/before7.java b/java/typeMigration/testData/intentions/atomic/before7.java
index fd2d066a4337..fd2d066a4337 100644
--- a/plugins/typeMigration/testData/intentions/atomic/before7.java
+++ b/java/typeMigration/testData/intentions/atomic/before7.java
diff --git a/plugins/typeMigration/testData/intentions/atomic/before8.java b/java/typeMigration/testData/intentions/atomic/before8.java
index d2ef50810f7e..d2ef50810f7e 100644
--- a/plugins/typeMigration/testData/intentions/atomic/before8.java
+++ b/java/typeMigration/testData/intentions/atomic/before8.java
diff --git a/plugins/typeMigration/testData/intentions/atomic/before9.java b/java/typeMigration/testData/intentions/atomic/before9.java
index a9f693800f81..a9f693800f81 100644
--- a/plugins/typeMigration/testData/intentions/atomic/before9.java
+++ b/java/typeMigration/testData/intentions/atomic/before9.java
diff --git a/plugins/typeMigration/testData/intentions/atomic/beforeExcl.java b/java/typeMigration/testData/intentions/atomic/beforeExcl.java
index 3df455583c35..3df455583c35 100644
--- a/plugins/typeMigration/testData/intentions/atomic/beforeExcl.java
+++ b/java/typeMigration/testData/intentions/atomic/beforeExcl.java
diff --git a/plugins/typeMigration/testData/intentions/atomic/beforeTA1.java b/java/typeMigration/testData/intentions/atomic/beforeTA1.java
index 10bdd5df4822..10bdd5df4822 100644
--- a/plugins/typeMigration/testData/intentions/atomic/beforeTA1.java
+++ b/java/typeMigration/testData/intentions/atomic/beforeTA1.java
diff --git a/plugins/typeMigration/testData/intentions/threadLocal/after1.java b/java/typeMigration/testData/intentions/threadLocal/after1.java
index b5df8fd35214..b5df8fd35214 100644
--- a/plugins/typeMigration/testData/intentions/threadLocal/after1.java
+++ b/java/typeMigration/testData/intentions/threadLocal/after1.java
diff --git a/plugins/typeMigration/testData/intentions/threadLocal/after2.java b/java/typeMigration/testData/intentions/threadLocal/after2.java
index 3a546c5b0c9a..3a546c5b0c9a 100644
--- a/plugins/typeMigration/testData/intentions/threadLocal/after2.java
+++ b/java/typeMigration/testData/intentions/threadLocal/after2.java
diff --git a/plugins/typeMigration/testData/intentions/threadLocal/after3.java b/java/typeMigration/testData/intentions/threadLocal/after3.java
index 9fc0f825ac4b..9fc0f825ac4b 100644
--- a/plugins/typeMigration/testData/intentions/threadLocal/after3.java
+++ b/java/typeMigration/testData/intentions/threadLocal/after3.java
diff --git a/plugins/typeMigration/testData/intentions/threadLocal/after4.java b/java/typeMigration/testData/intentions/threadLocal/after4.java
index 8410a1c33c0e..8410a1c33c0e 100644
--- a/plugins/typeMigration/testData/intentions/threadLocal/after4.java
+++ b/java/typeMigration/testData/intentions/threadLocal/after4.java
diff --git a/plugins/typeMigration/testData/intentions/threadLocal/after5.java b/java/typeMigration/testData/intentions/threadLocal/after5.java
index 435e1b6a50e6..435e1b6a50e6 100644
--- a/plugins/typeMigration/testData/intentions/threadLocal/after5.java
+++ b/java/typeMigration/testData/intentions/threadLocal/after5.java
diff --git a/plugins/typeMigration/testData/intentions/threadLocal/after6.java b/java/typeMigration/testData/intentions/threadLocal/after6.java
index 1879a46be16d..1879a46be16d 100644
--- a/plugins/typeMigration/testData/intentions/threadLocal/after6.java
+++ b/java/typeMigration/testData/intentions/threadLocal/after6.java
diff --git a/plugins/typeMigration/testData/intentions/threadLocal/after7.java b/java/typeMigration/testData/intentions/threadLocal/after7.java
index 5398ff5e2991..5398ff5e2991 100644
--- a/plugins/typeMigration/testData/intentions/threadLocal/after7.java
+++ b/java/typeMigration/testData/intentions/threadLocal/after7.java
diff --git a/plugins/typeMigration/testData/intentions/threadLocal/after8.java b/java/typeMigration/testData/intentions/threadLocal/after8.java
index d158894b6130..d158894b6130 100644
--- a/plugins/typeMigration/testData/intentions/threadLocal/after8.java
+++ b/java/typeMigration/testData/intentions/threadLocal/after8.java
diff --git a/plugins/typeMigration/testData/intentions/threadLocal/afterTA1.java b/java/typeMigration/testData/intentions/threadLocal/afterTA1.java
index 0e3687e146b6..0e3687e146b6 100644
--- a/plugins/typeMigration/testData/intentions/threadLocal/afterTA1.java
+++ b/java/typeMigration/testData/intentions/threadLocal/afterTA1.java
diff --git a/plugins/typeMigration/testData/intentions/threadLocal/before1.java b/java/typeMigration/testData/intentions/threadLocal/before1.java
index e35925390137..e35925390137 100644
--- a/plugins/typeMigration/testData/intentions/threadLocal/before1.java
+++ b/java/typeMigration/testData/intentions/threadLocal/before1.java
diff --git a/plugins/typeMigration/testData/intentions/threadLocal/before2.java b/java/typeMigration/testData/intentions/threadLocal/before2.java
index 47c6471739d7..47c6471739d7 100644
--- a/plugins/typeMigration/testData/intentions/threadLocal/before2.java
+++ b/java/typeMigration/testData/intentions/threadLocal/before2.java
diff --git a/plugins/typeMigration/testData/intentions/threadLocal/before3.java b/java/typeMigration/testData/intentions/threadLocal/before3.java
index 19d296cffa36..19d296cffa36 100644
--- a/plugins/typeMigration/testData/intentions/threadLocal/before3.java
+++ b/java/typeMigration/testData/intentions/threadLocal/before3.java
diff --git a/plugins/typeMigration/testData/intentions/threadLocal/before4.java b/java/typeMigration/testData/intentions/threadLocal/before4.java
index 66d2efa6230a..66d2efa6230a 100644
--- a/plugins/typeMigration/testData/intentions/threadLocal/before4.java
+++ b/java/typeMigration/testData/intentions/threadLocal/before4.java
diff --git a/plugins/typeMigration/testData/intentions/threadLocal/before5.java b/java/typeMigration/testData/intentions/threadLocal/before5.java
index c459443241e4..c459443241e4 100644
--- a/plugins/typeMigration/testData/intentions/threadLocal/before5.java
+++ b/java/typeMigration/testData/intentions/threadLocal/before5.java
diff --git a/plugins/typeMigration/testData/intentions/threadLocal/before6.java b/java/typeMigration/testData/intentions/threadLocal/before6.java
index 74427e6e4f06..74427e6e4f06 100644
--- a/plugins/typeMigration/testData/intentions/threadLocal/before6.java
+++ b/java/typeMigration/testData/intentions/threadLocal/before6.java
diff --git a/plugins/typeMigration/testData/intentions/threadLocal/before7.java b/java/typeMigration/testData/intentions/threadLocal/before7.java
index dfff0417b272..dfff0417b272 100644
--- a/plugins/typeMigration/testData/intentions/threadLocal/before7.java
+++ b/java/typeMigration/testData/intentions/threadLocal/before7.java
diff --git a/plugins/typeMigration/testData/intentions/threadLocal/before8.java b/java/typeMigration/testData/intentions/threadLocal/before8.java
index af321e0da56c..af321e0da56c 100644
--- a/plugins/typeMigration/testData/intentions/threadLocal/before8.java
+++ b/java/typeMigration/testData/intentions/threadLocal/before8.java
diff --git a/plugins/typeMigration/testData/intentions/threadLocal/beforeTA1.java b/java/typeMigration/testData/intentions/threadLocal/beforeTA1.java
index ac3409c2e759..ac3409c2e759 100644
--- a/plugins/typeMigration/testData/intentions/threadLocal/beforeTA1.java
+++ b/java/typeMigration/testData/intentions/threadLocal/beforeTA1.java
diff --git a/plugins/typeMigration/testData/refactoring/changeTypeSignature/CompositeReturnType.java b/java/typeMigration/testData/refactoring/changeTypeSignature/CompositeReturnType.java
index 051e42810e3d..051e42810e3d 100644
--- a/plugins/typeMigration/testData/refactoring/changeTypeSignature/CompositeReturnType.java
+++ b/java/typeMigration/testData/refactoring/changeTypeSignature/CompositeReturnType.java
diff --git a/plugins/typeMigration/testData/refactoring/changeTypeSignature/CompositeReturnType.java.after b/java/typeMigration/testData/refactoring/changeTypeSignature/CompositeReturnType.java.after
index 8966bc1ee03d..8966bc1ee03d 100644
--- a/plugins/typeMigration/testData/refactoring/changeTypeSignature/CompositeReturnType.java.after
+++ b/java/typeMigration/testData/refactoring/changeTypeSignature/CompositeReturnType.java.after
diff --git a/plugins/typeMigration/testData/refactoring/changeTypeSignature/FieldTypeMigration.java b/java/typeMigration/testData/refactoring/changeTypeSignature/FieldTypeMigration.java
index fabb24302b8d..fabb24302b8d 100644
--- a/plugins/typeMigration/testData/refactoring/changeTypeSignature/FieldTypeMigration.java
+++ b/java/typeMigration/testData/refactoring/changeTypeSignature/FieldTypeMigration.java
diff --git a/plugins/typeMigration/testData/refactoring/changeTypeSignature/FieldTypeMigration.java.after b/java/typeMigration/testData/refactoring/changeTypeSignature/FieldTypeMigration.java.after
index 01a6bf49322e..01a6bf49322e 100644
--- a/plugins/typeMigration/testData/refactoring/changeTypeSignature/FieldTypeMigration.java.after
+++ b/java/typeMigration/testData/refactoring/changeTypeSignature/FieldTypeMigration.java.after
diff --git a/plugins/typeMigration/testData/refactoring/changeTypeSignature/FieldUsage.java b/java/typeMigration/testData/refactoring/changeTypeSignature/FieldUsage.java
index 92864f163560..92864f163560 100644
--- a/plugins/typeMigration/testData/refactoring/changeTypeSignature/FieldUsage.java
+++ b/java/typeMigration/testData/refactoring/changeTypeSignature/FieldUsage.java
diff --git a/plugins/typeMigration/testData/refactoring/changeTypeSignature/FieldUsage.java.after b/java/typeMigration/testData/refactoring/changeTypeSignature/FieldUsage.java.after
index 07ee7a4e9351..07ee7a4e9351 100644
--- a/plugins/typeMigration/testData/refactoring/changeTypeSignature/FieldUsage.java.after
+++ b/java/typeMigration/testData/refactoring/changeTypeSignature/FieldUsage.java.after
diff --git a/plugins/typeMigration/testData/refactoring/changeTypeSignature/FieldUsage1.java b/java/typeMigration/testData/refactoring/changeTypeSignature/FieldUsage1.java
index bff01e33a9e3..bff01e33a9e3 100644
--- a/plugins/typeMigration/testData/refactoring/changeTypeSignature/FieldUsage1.java
+++ b/java/typeMigration/testData/refactoring/changeTypeSignature/FieldUsage1.java
diff --git a/plugins/typeMigration/testData/refactoring/changeTypeSignature/FieldUsage1.java.after b/java/typeMigration/testData/refactoring/changeTypeSignature/FieldUsage1.java.after
index b3764fda80de..b3764fda80de 100644
--- a/plugins/typeMigration/testData/refactoring/changeTypeSignature/FieldUsage1.java.after
+++ b/java/typeMigration/testData/refactoring/changeTypeSignature/FieldUsage1.java.after
diff --git a/plugins/typeMigration/testData/refactoring/changeTypeSignature/ListTypeArguments.java b/java/typeMigration/testData/refactoring/changeTypeSignature/ListTypeArguments.java
index 98b178156750..98b178156750 100644
--- a/plugins/typeMigration/testData/refactoring/changeTypeSignature/ListTypeArguments.java
+++ b/java/typeMigration/testData/refactoring/changeTypeSignature/ListTypeArguments.java
diff --git a/plugins/typeMigration/testData/refactoring/changeTypeSignature/ListTypeArguments.java.after b/java/typeMigration/testData/refactoring/changeTypeSignature/ListTypeArguments.java.after
index 535acf216d57..535acf216d57 100644
--- a/plugins/typeMigration/testData/refactoring/changeTypeSignature/ListTypeArguments.java.after
+++ b/java/typeMigration/testData/refactoring/changeTypeSignature/ListTypeArguments.java.after
diff --git a/plugins/typeMigration/testData/refactoring/changeTypeSignature/MethodReturnTypeMigration.java b/java/typeMigration/testData/refactoring/changeTypeSignature/MethodReturnTypeMigration.java
index 8183831c3ff3..8183831c3ff3 100644
--- a/plugins/typeMigration/testData/refactoring/changeTypeSignature/MethodReturnTypeMigration.java
+++ b/java/typeMigration/testData/refactoring/changeTypeSignature/MethodReturnTypeMigration.java
diff --git a/plugins/typeMigration/testData/refactoring/changeTypeSignature/MethodReturnTypeMigration.java.after b/java/typeMigration/testData/refactoring/changeTypeSignature/MethodReturnTypeMigration.java.after
index 405cd8a74384..405cd8a74384 100644
--- a/plugins/typeMigration/testData/refactoring/changeTypeSignature/MethodReturnTypeMigration.java.after
+++ b/java/typeMigration/testData/refactoring/changeTypeSignature/MethodReturnTypeMigration.java.after
diff --git a/plugins/typeMigration/testData/refactoring/changeTypeSignature/ParameterMigration.java b/java/typeMigration/testData/refactoring/changeTypeSignature/ParameterMigration.java
index fdce63b995a8..fdce63b995a8 100644
--- a/plugins/typeMigration/testData/refactoring/changeTypeSignature/ParameterMigration.java
+++ b/java/typeMigration/testData/refactoring/changeTypeSignature/ParameterMigration.java
diff --git a/plugins/typeMigration/testData/refactoring/changeTypeSignature/ParameterMigration.java.after b/java/typeMigration/testData/refactoring/changeTypeSignature/ParameterMigration.java.after
index ff031aa42904..ff031aa42904 100644
--- a/plugins/typeMigration/testData/refactoring/changeTypeSignature/ParameterMigration.java.after
+++ b/java/typeMigration/testData/refactoring/changeTypeSignature/ParameterMigration.java.after
diff --git a/plugins/typeMigration/testData/refactoring/changeTypeSignature/ParameterMigration1.java b/java/typeMigration/testData/refactoring/changeTypeSignature/ParameterMigration1.java
index fdce63b995a8..fdce63b995a8 100644
--- a/plugins/typeMigration/testData/refactoring/changeTypeSignature/ParameterMigration1.java
+++ b/java/typeMigration/testData/refactoring/changeTypeSignature/ParameterMigration1.java
diff --git a/plugins/typeMigration/testData/refactoring/changeTypeSignature/ParameterMigration1.java.after b/java/typeMigration/testData/refactoring/changeTypeSignature/ParameterMigration1.java.after
index f3cef5b65bba..f3cef5b65bba 100644
--- a/plugins/typeMigration/testData/refactoring/changeTypeSignature/ParameterMigration1.java.after
+++ b/java/typeMigration/testData/refactoring/changeTypeSignature/ParameterMigration1.java.after
diff --git a/plugins/typeMigration/testData/refactoring/changeTypeSignature/ParameterMigration2.java b/java/typeMigration/testData/refactoring/changeTypeSignature/ParameterMigration2.java
index 278b80eb95d5..278b80eb95d5 100644
--- a/plugins/typeMigration/testData/refactoring/changeTypeSignature/ParameterMigration2.java
+++ b/java/typeMigration/testData/refactoring/changeTypeSignature/ParameterMigration2.java
diff --git a/plugins/typeMigration/testData/refactoring/changeTypeSignature/ParameterMigration2.java.after b/java/typeMigration/testData/refactoring/changeTypeSignature/ParameterMigration2.java.after
index 5978a88ee283..5978a88ee283 100644
--- a/plugins/typeMigration/testData/refactoring/changeTypeSignature/ParameterMigration2.java.after
+++ b/java/typeMigration/testData/refactoring/changeTypeSignature/ParameterMigration2.java.after
diff --git a/plugins/typeMigration/testData/refactoring/changeTypeSignature/PassedParameter.java b/java/typeMigration/testData/refactoring/changeTypeSignature/PassedParameter.java
index 416bf0f810b8..416bf0f810b8 100644
--- a/plugins/typeMigration/testData/refactoring/changeTypeSignature/PassedParameter.java
+++ b/java/typeMigration/testData/refactoring/changeTypeSignature/PassedParameter.java
diff --git a/plugins/typeMigration/testData/refactoring/changeTypeSignature/PassedParameter.java.after b/java/typeMigration/testData/refactoring/changeTypeSignature/PassedParameter.java.after
index 64847ab2afd1..64847ab2afd1 100644
--- a/plugins/typeMigration/testData/refactoring/changeTypeSignature/PassedParameter.java.after
+++ b/java/typeMigration/testData/refactoring/changeTypeSignature/PassedParameter.java.after
diff --git a/plugins/typeMigration/testData/refactoring/changeTypeSignature/PassedParameter1.java b/java/typeMigration/testData/refactoring/changeTypeSignature/PassedParameter1.java
index f9bdb275f3aa..f9bdb275f3aa 100644
--- a/plugins/typeMigration/testData/refactoring/changeTypeSignature/PassedParameter1.java
+++ b/java/typeMigration/testData/refactoring/changeTypeSignature/PassedParameter1.java
diff --git a/plugins/typeMigration/testData/refactoring/changeTypeSignature/PassedParameter1.java.after b/java/typeMigration/testData/refactoring/changeTypeSignature/PassedParameter1.java.after
index 1777cb6da9d8..1777cb6da9d8 100644
--- a/plugins/typeMigration/testData/refactoring/changeTypeSignature/PassedParameter1.java.after
+++ b/java/typeMigration/testData/refactoring/changeTypeSignature/PassedParameter1.java.after
diff --git a/plugins/typeMigration/testData/refactoring/changeTypeSignature/PassedParameter2.java b/java/typeMigration/testData/refactoring/changeTypeSignature/PassedParameter2.java
index 62c7cf4da263..62c7cf4da263 100644
--- a/plugins/typeMigration/testData/refactoring/changeTypeSignature/PassedParameter2.java
+++ b/java/typeMigration/testData/refactoring/changeTypeSignature/PassedParameter2.java
diff --git a/plugins/typeMigration/testData/refactoring/changeTypeSignature/PassedParameter2.java.after b/java/typeMigration/testData/refactoring/changeTypeSignature/PassedParameter2.java.after
index e5ed5910c2c1..e5ed5910c2c1 100644
--- a/plugins/typeMigration/testData/refactoring/changeTypeSignature/PassedParameter2.java.after
+++ b/java/typeMigration/testData/refactoring/changeTypeSignature/PassedParameter2.java.after
diff --git a/plugins/typeMigration/testData/refactoring/changeTypeSignature/ReturnType.java b/java/typeMigration/testData/refactoring/changeTypeSignature/ReturnType.java
index 17960b186a46..17960b186a46 100644
--- a/plugins/typeMigration/testData/refactoring/changeTypeSignature/ReturnType.java
+++ b/java/typeMigration/testData/refactoring/changeTypeSignature/ReturnType.java
diff --git a/plugins/typeMigration/testData/refactoring/changeTypeSignature/ReturnType.java.after b/java/typeMigration/testData/refactoring/changeTypeSignature/ReturnType.java.after
index 1758610f1571..1758610f1571 100644
--- a/plugins/typeMigration/testData/refactoring/changeTypeSignature/ReturnType.java.after
+++ b/java/typeMigration/testData/refactoring/changeTypeSignature/ReturnType.java.after
diff --git a/plugins/typeMigration/testData/refactoring/changeTypeSignature/ReturnType1.java b/java/typeMigration/testData/refactoring/changeTypeSignature/ReturnType1.java
index 9e01a295be05..9e01a295be05 100644
--- a/plugins/typeMigration/testData/refactoring/changeTypeSignature/ReturnType1.java
+++ b/java/typeMigration/testData/refactoring/changeTypeSignature/ReturnType1.java
diff --git a/plugins/typeMigration/testData/refactoring/changeTypeSignature/ReturnType1.java.after b/java/typeMigration/testData/refactoring/changeTypeSignature/ReturnType1.java.after
index 8a584bdca610..8a584bdca610 100644
--- a/plugins/typeMigration/testData/refactoring/changeTypeSignature/ReturnType1.java.after
+++ b/java/typeMigration/testData/refactoring/changeTypeSignature/ReturnType1.java.after
diff --git a/plugins/typeMigration/testData/refactoring/changeTypeSignature/ReturnType2.java b/java/typeMigration/testData/refactoring/changeTypeSignature/ReturnType2.java
index 83b7294972fc..83b7294972fc 100644
--- a/plugins/typeMigration/testData/refactoring/changeTypeSignature/ReturnType2.java
+++ b/java/typeMigration/testData/refactoring/changeTypeSignature/ReturnType2.java
diff --git a/plugins/typeMigration/testData/refactoring/changeTypeSignature/ReturnType2.java.after b/java/typeMigration/testData/refactoring/changeTypeSignature/ReturnType2.java.after
index a26f7d3f1655..a26f7d3f1655 100644
--- a/plugins/typeMigration/testData/refactoring/changeTypeSignature/ReturnType2.java.after
+++ b/java/typeMigration/testData/refactoring/changeTypeSignature/ReturnType2.java.after
diff --git a/plugins/typeMigration/testData/refactoring/changeTypeSignature/TypeHierarchy.java b/java/typeMigration/testData/refactoring/changeTypeSignature/TypeHierarchy.java
index 2bfa264828c0..2bfa264828c0 100644
--- a/plugins/typeMigration/testData/refactoring/changeTypeSignature/TypeHierarchy.java
+++ b/java/typeMigration/testData/refactoring/changeTypeSignature/TypeHierarchy.java
diff --git a/plugins/typeMigration/testData/refactoring/changeTypeSignature/TypeHierarchy.java.after b/java/typeMigration/testData/refactoring/changeTypeSignature/TypeHierarchy.java.after
index 4c4736302857..4c4736302857 100644
--- a/plugins/typeMigration/testData/refactoring/changeTypeSignature/TypeHierarchy.java.after
+++ b/java/typeMigration/testData/refactoring/changeTypeSignature/TypeHierarchy.java.after
diff --git a/plugins/typeMigration/testData/refactoring/changeTypeSignature/TypeHierarchy1.java b/java/typeMigration/testData/refactoring/changeTypeSignature/TypeHierarchy1.java
index 5396a7c59422..5396a7c59422 100644
--- a/plugins/typeMigration/testData/refactoring/changeTypeSignature/TypeHierarchy1.java
+++ b/java/typeMigration/testData/refactoring/changeTypeSignature/TypeHierarchy1.java
diff --git a/plugins/typeMigration/testData/refactoring/changeTypeSignature/TypeHierarchy1.java.after b/java/typeMigration/testData/refactoring/changeTypeSignature/TypeHierarchy1.java.after
index 16a02ae4ea3d..16a02ae4ea3d 100644
--- a/plugins/typeMigration/testData/refactoring/changeTypeSignature/TypeHierarchy1.java.after
+++ b/java/typeMigration/testData/refactoring/changeTypeSignature/TypeHierarchy1.java.after
diff --git a/plugins/typeMigration/testData/refactoring/changeTypeSignature/TypeHierarchy2.java b/java/typeMigration/testData/refactoring/changeTypeSignature/TypeHierarchy2.java
index 2eb6d429915e..2eb6d429915e 100644
--- a/plugins/typeMigration/testData/refactoring/changeTypeSignature/TypeHierarchy2.java
+++ b/java/typeMigration/testData/refactoring/changeTypeSignature/TypeHierarchy2.java
diff --git a/plugins/typeMigration/testData/refactoring/changeTypeSignature/TypeHierarchy2.java.after b/java/typeMigration/testData/refactoring/changeTypeSignature/TypeHierarchy2.java.after
index b30ab01e5594..b30ab01e5594 100644
--- a/plugins/typeMigration/testData/refactoring/changeTypeSignature/TypeHierarchy2.java.after
+++ b/java/typeMigration/testData/refactoring/changeTypeSignature/TypeHierarchy2.java.after
diff --git a/plugins/typeMigration/testData/refactoring/changeTypeSignature/TypeHierarchyFieldUsage.java b/java/typeMigration/testData/refactoring/changeTypeSignature/TypeHierarchyFieldUsage.java
index 3bf853421127..3bf853421127 100644
--- a/plugins/typeMigration/testData/refactoring/changeTypeSignature/TypeHierarchyFieldUsage.java
+++ b/java/typeMigration/testData/refactoring/changeTypeSignature/TypeHierarchyFieldUsage.java
diff --git a/plugins/typeMigration/testData/refactoring/changeTypeSignature/TypeHierarchyFieldUsage.java.after b/java/typeMigration/testData/refactoring/changeTypeSignature/TypeHierarchyFieldUsage.java.after
index 5eeea8234a2e..5eeea8234a2e 100644
--- a/plugins/typeMigration/testData/refactoring/changeTypeSignature/TypeHierarchyFieldUsage.java.after
+++ b/java/typeMigration/testData/refactoring/changeTypeSignature/TypeHierarchyFieldUsage.java.after
diff --git a/plugins/typeMigration/testData/refactoring/changeTypeSignature/TypeHierarchyFieldUsageConflict.java b/java/typeMigration/testData/refactoring/changeTypeSignature/TypeHierarchyFieldUsageConflict.java
index bf9237fe6fb3..bf9237fe6fb3 100644
--- a/plugins/typeMigration/testData/refactoring/changeTypeSignature/TypeHierarchyFieldUsageConflict.java
+++ b/java/typeMigration/testData/refactoring/changeTypeSignature/TypeHierarchyFieldUsageConflict.java
diff --git a/plugins/typeMigration/testData/refactoring/changeTypeSignature/TypeHierarchyFieldUsageConflict.java.after b/java/typeMigration/testData/refactoring/changeTypeSignature/TypeHierarchyFieldUsageConflict.java.after
index ffecf75c7f20..ffecf75c7f20 100644
--- a/plugins/typeMigration/testData/refactoring/changeTypeSignature/TypeHierarchyFieldUsageConflict.java.after
+++ b/java/typeMigration/testData/refactoring/changeTypeSignature/TypeHierarchyFieldUsageConflict.java.after
diff --git a/plugins/typeMigration/testData/refactoring/changeTypeSignature/UsedInSuper.java b/java/typeMigration/testData/refactoring/changeTypeSignature/UsedInSuper.java
index 4cbee666c3cb..4cbee666c3cb 100644
--- a/plugins/typeMigration/testData/refactoring/changeTypeSignature/UsedInSuper.java
+++ b/java/typeMigration/testData/refactoring/changeTypeSignature/UsedInSuper.java
diff --git a/plugins/typeMigration/testData/refactoring/changeTypeSignature/UsedInSuper.java.after b/java/typeMigration/testData/refactoring/changeTypeSignature/UsedInSuper.java.after
index d321e6520dc0..d321e6520dc0 100644
--- a/plugins/typeMigration/testData/refactoring/changeTypeSignature/UsedInSuper.java.after
+++ b/java/typeMigration/testData/refactoring/changeTypeSignature/UsedInSuper.java.after
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprAccess2Lvalue/after/Expr.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprAccess2Lvalue/after/Expr.items
index 7ce904f6afe4..7ce904f6afe4 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprAccess2Lvalue/after/Expr.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprAccess2Lvalue/after/Expr.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprAccess2Lvalue/after/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprAccess2Lvalue/after/Expr.java
index 65fd52a3e86e..65fd52a3e86e 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprAccess2Lvalue/after/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprAccess2Lvalue/after/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprAccess2Lvalue/before/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprAccess2Lvalue/before/Expr.java
index 1c13032fa121..1c13032fa121 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprAccess2Lvalue/before/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprAccess2Lvalue/before/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprAccess2Rvalue/after/Expr.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprAccess2Rvalue/after/Expr.items
index d79df57fc220..d79df57fc220 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprAccess2Rvalue/after/Expr.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprAccess2Rvalue/after/Expr.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprAccess2Rvalue/after/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprAccess2Rvalue/after/Expr.java
index 11599a2cd3a6..11599a2cd3a6 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprAccess2Rvalue/after/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprAccess2Rvalue/after/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprAccess2Rvalue/before/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprAccess2Rvalue/before/Expr.java
index 64998cf198c8..64998cf198c8 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprAccess2Rvalue/before/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprAccess2Rvalue/before/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprAccessParent2Lvalue/after/Ession.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprAccessParent2Lvalue/after/Ession.items
index 15e80380b536..15e80380b536 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprAccessParent2Lvalue/after/Ession.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprAccessParent2Lvalue/after/Ession.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprAccessParent2Lvalue/after/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprAccessParent2Lvalue/after/Expr.java
index 3a9531d8f9d8..3a9531d8f9d8 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprAccessParent2Lvalue/after/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprAccessParent2Lvalue/after/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprAccessParent2Lvalue/before/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprAccessParent2Lvalue/before/Expr.java
index 898b41a6ab6f..898b41a6ab6f 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprAccessParent2Lvalue/before/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprAccessParent2Lvalue/before/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprAccessParent2Rvalue/after/Expr.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprAccessParent2Rvalue/after/Expr.items
index 95bf149e7b68..95bf149e7b68 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprAccessParent2Rvalue/after/Expr.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprAccessParent2Rvalue/after/Expr.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprAccessParent2Rvalue/after/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprAccessParent2Rvalue/after/Expr.java
index 9ffe2e3a7332..9ffe2e3a7332 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprAccessParent2Rvalue/after/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprAccessParent2Rvalue/after/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprAccessParent2Rvalue/before/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprAccessParent2Rvalue/before/Expr.java
index 0a244c6448bd..0a244c6448bd 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprAccessParent2Rvalue/before/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprAccessParent2Rvalue/before/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprArrayAccessNegative/after/Expr.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprArrayAccessNegative/after/Expr.items
index 0f10ca83564b..0f10ca83564b 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprArrayAccessNegative/after/Expr.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprArrayAccessNegative/after/Expr.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprArrayAccessNegative/after/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprArrayAccessNegative/after/Expr.java
index 9258f512d2b1..9258f512d2b1 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprArrayAccessNegative/after/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprArrayAccessNegative/after/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprArrayAccessNegative/before/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprArrayAccessNegative/before/Expr.java
index 57fde1c6b34c..57fde1c6b34c 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprArrayAccessNegative/before/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprArrayAccessNegative/before/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprArrayAccessPositive/after/Expr.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprArrayAccessPositive/after/Expr.items
index afc565fc6df7..afc565fc6df7 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprArrayAccessPositive/after/Expr.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprArrayAccessPositive/after/Expr.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprArrayAccessPositive/after/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprArrayAccessPositive/after/Expr.java
index 7971b5e9e770..7971b5e9e770 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprArrayAccessPositive/after/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprArrayAccessPositive/after/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprArrayAccessPositive/before/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprArrayAccessPositive/before/Expr.java
index 57fde1c6b34c..57fde1c6b34c 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprArrayAccessPositive/before/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprArrayAccessPositive/before/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcBooleanBoolean/after/Expr.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcBooleanBoolean/after/Expr.items
index 4e6bf57cbb3e..4e6bf57cbb3e 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcBooleanBoolean/after/Expr.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcBooleanBoolean/after/Expr.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcBooleanBoolean/after/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcBooleanBoolean/after/Expr.java
index d0dd0e83a559..d0dd0e83a559 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcBooleanBoolean/after/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcBooleanBoolean/after/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcBooleanBoolean/before/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcBooleanBoolean/before/Expr.java
index d0364a40ca25..d0364a40ca25 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcBooleanBoolean/before/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcBooleanBoolean/before/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcBooleanNumeric/after/Expr.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcBooleanNumeric/after/Expr.items
index 21ecfb0d65a5..21ecfb0d65a5 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcBooleanNumeric/after/Expr.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcBooleanNumeric/after/Expr.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcBooleanNumeric/after/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcBooleanNumeric/after/Expr.java
index c54d809c3906..c54d809c3906 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcBooleanNumeric/after/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcBooleanNumeric/after/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcBooleanNumeric/before/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcBooleanNumeric/before/Expr.java
index 1b113b43a3e6..1b113b43a3e6 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcBooleanNumeric/before/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcBooleanNumeric/before/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcBooleanReference/after/Expr.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcBooleanReference/after/Expr.items
index 815d62ca7530..815d62ca7530 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcBooleanReference/after/Expr.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcBooleanReference/after/Expr.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcBooleanReference/after/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcBooleanReference/after/Expr.java
index bc4c04967759..bc4c04967759 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcBooleanReference/after/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcBooleanReference/after/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcBooleanReference/before/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcBooleanReference/before/Expr.java
index 6def87eb9709..6def87eb9709 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcBooleanReference/before/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcBooleanReference/before/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcNumeric2Boolean/after/Expr.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcNumeric2Boolean/after/Expr.items
index aeddc71515d9..aeddc71515d9 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcNumeric2Boolean/after/Expr.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcNumeric2Boolean/after/Expr.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcNumeric2Boolean/after/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcNumeric2Boolean/after/Expr.java
index c90c55120370..c90c55120370 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcNumeric2Boolean/after/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcNumeric2Boolean/after/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcNumeric2Boolean/before/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcNumeric2Boolean/before/Expr.java
index 057b284248a0..057b284248a0 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcNumeric2Boolean/before/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcNumeric2Boolean/before/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcNumeric2Floating/after/Expr.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcNumeric2Floating/after/Expr.items
index 0fdb9d1291e9..0fdb9d1291e9 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcNumeric2Floating/after/Expr.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcNumeric2Floating/after/Expr.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcNumeric2Floating/after/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcNumeric2Floating/after/Expr.java
index 8e16d5b5d974..8e16d5b5d974 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcNumeric2Floating/after/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcNumeric2Floating/after/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcNumeric2Floating/before/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcNumeric2Floating/before/Expr.java
index 4088b28a0060..4088b28a0060 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcNumeric2Floating/before/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcNumeric2Floating/before/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcNumeric2Int/after/Expr.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcNumeric2Int/after/Expr.items
index 36e79ff677b4..36e79ff677b4 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcNumeric2Int/after/Expr.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcNumeric2Int/after/Expr.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcNumeric2Int/after/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcNumeric2Int/after/Expr.java
index 323dad23d5d3..323dad23d5d3 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcNumeric2Int/after/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcNumeric2Int/after/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcNumeric2Int/before/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcNumeric2Int/before/Expr.java
index 716f4b7e60e1..716f4b7e60e1 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcNumeric2Int/before/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcNumeric2Int/before/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcNumeric2String/after/Expr.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcNumeric2String/after/Expr.items
index 406008949bd1..406008949bd1 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcNumeric2String/after/Expr.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcNumeric2String/after/Expr.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcNumeric2String/after/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcNumeric2String/after/Expr.java
index 62fd2ff0b0ff..62fd2ff0b0ff 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcNumeric2String/after/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcNumeric2String/after/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcNumeric2String/before/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcNumeric2String/before/Expr.java
index 057b284248a0..057b284248a0 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcNumeric2String/before/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprCalcNumeric2String/before/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCast2LvalueNeg/after/Expr.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprCast2LvalueNeg/after/Expr.items
index 01f325b2852d..01f325b2852d 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCast2LvalueNeg/after/Expr.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprCast2LvalueNeg/after/Expr.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCast2LvalueNeg/after/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprCast2LvalueNeg/after/Expr.java
index 5a7343152288..5a7343152288 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCast2LvalueNeg/after/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprCast2LvalueNeg/after/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCast2LvalueNeg/before/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprCast2LvalueNeg/before/Expr.java
index e3519b4bb4bf..e3519b4bb4bf 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCast2LvalueNeg/before/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprCast2LvalueNeg/before/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCast2LvaluePos/after/Expr.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprCast2LvaluePos/after/Expr.items
index f69d09024863..f69d09024863 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCast2LvaluePos/after/Expr.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprCast2LvaluePos/after/Expr.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCast2LvaluePos/after/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprCast2LvaluePos/after/Expr.java
index 64aecc896b80..64aecc896b80 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCast2LvaluePos/after/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprCast2LvaluePos/after/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCast2LvaluePos/before/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprCast2LvaluePos/before/Expr.java
index e3519b4bb4bf..e3519b4bb4bf 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprCast2LvaluePos/before/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprCast2LvaluePos/before/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprConcatNumeric2Reference/after/Expr.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprConcatNumeric2Reference/after/Expr.items
index 0b73994dece5..0b73994dece5 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprConcatNumeric2Reference/after/Expr.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprConcatNumeric2Reference/after/Expr.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprConcatNumeric2Reference/after/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprConcatNumeric2Reference/after/Expr.java
index cf844f4eddf2..cf844f4eddf2 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprConcatNumeric2Reference/after/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprConcatNumeric2Reference/after/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprConcatNumeric2Reference/before/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprConcatNumeric2Reference/before/Expr.java
index 71b89f955e59..71b89f955e59 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprConcatNumeric2Reference/before/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprConcatNumeric2Reference/before/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprConcatNumeric2String/after/Expr.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprConcatNumeric2String/after/Expr.items
index 46d6b1f5a15f..46d6b1f5a15f 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprConcatNumeric2String/after/Expr.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprConcatNumeric2String/after/Expr.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprConcatNumeric2String/after/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprConcatNumeric2String/after/Expr.java
index 5ce2b795d268..5ce2b795d268 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprConcatNumeric2String/after/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprConcatNumeric2String/after/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprConcatNumeric2String/before/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprConcatNumeric2String/before/Expr.java
index 71b89f955e59..71b89f955e59 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprConcatNumeric2String/before/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprConcatNumeric2String/before/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprConcatString2Numeric/after/Expr.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprConcatString2Numeric/after/Expr.items
index 3bb9c1ebf19a..3bb9c1ebf19a 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprConcatString2Numeric/after/Expr.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprConcatString2Numeric/after/Expr.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprConcatString2Numeric/after/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprConcatString2Numeric/after/Expr.java
index ac05959f3c08..ac05959f3c08 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprConcatString2Numeric/after/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprConcatString2Numeric/after/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprConcatString2Numeric/before/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprConcatString2Numeric/before/Expr.java
index bb57398b961c..bb57398b961c 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprConcatString2Numeric/before/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprConcatString2Numeric/before/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprConcatString2Reference/after/Expr.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprConcatString2Reference/after/Expr.items
index 302e3c9da48c..302e3c9da48c 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprConcatString2Reference/after/Expr.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprConcatString2Reference/after/Expr.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprConcatString2Reference/after/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprConcatString2Reference/after/Expr.java
index c23893bd5b63..c23893bd5b63 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprConcatString2Reference/after/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprConcatString2Reference/after/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprConcatString2Reference/before/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprConcatString2Reference/before/Expr.java
index bb57398b961c..bb57398b961c 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprConcatString2Reference/before/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprConcatString2Reference/before/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprInstanceofNeg/after/Expr.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprInstanceofNeg/after/Expr.items
index 7712b490ec9a..7712b490ec9a 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprInstanceofNeg/after/Expr.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprInstanceofNeg/after/Expr.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprInstanceofNeg/after/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprInstanceofNeg/after/Expr.java
index 93da179e0c37..93da179e0c37 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprInstanceofNeg/after/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprInstanceofNeg/after/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprInstanceofNeg/before/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprInstanceofNeg/before/Expr.java
index 72af0a04ab0b..72af0a04ab0b 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprInstanceofNeg/before/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprInstanceofNeg/before/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprInstanceofPos/after/Expr.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprInstanceofPos/after/Expr.items
index 5b608c5c0b1a..5b608c5c0b1a 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprInstanceofPos/after/Expr.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprInstanceofPos/after/Expr.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprInstanceofPos/after/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprInstanceofPos/after/Expr.java
index e7f8a225bd9e..e7f8a225bd9e 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprInstanceofPos/after/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprInstanceofPos/after/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprInstanceofPos/before/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprInstanceofPos/before/Expr.java
index fa8ab953a084..fa8ab953a084 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprInstanceofPos/before/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprInstanceofPos/before/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralBoolean/after/Expr.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralBoolean/after/Expr.items
index b446d1101a06..b446d1101a06 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralBoolean/after/Expr.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralBoolean/after/Expr.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralBoolean/after/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralBoolean/after/Expr.java
index d0d0a2d12326..d0d0a2d12326 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralBoolean/after/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralBoolean/after/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralBoolean/before/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralBoolean/before/Expr.java
index 05b89dc47d4f..05b89dc47d4f 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralBoolean/before/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralBoolean/before/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralByte/after/Expr.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralByte/after/Expr.items
index efc0c3bb0c41..efc0c3bb0c41 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralByte/after/Expr.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralByte/after/Expr.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralByte/after/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralByte/after/Expr.java
index 6288f06f450a..6288f06f450a 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralByte/after/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralByte/after/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralByte/before/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralByte/before/Expr.java
index 05b89dc47d4f..05b89dc47d4f 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralByte/before/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralByte/before/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralChar/after/Expr.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralChar/after/Expr.items
index 62960ffeacf8..62960ffeacf8 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralChar/after/Expr.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralChar/after/Expr.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralChar/after/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralChar/after/Expr.java
index eab5b7cf5059..eab5b7cf5059 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralChar/after/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralChar/after/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralChar/before/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralChar/before/Expr.java
index 05b89dc47d4f..05b89dc47d4f 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralChar/before/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralChar/before/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassExtends/after/Expr.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassExtends/after/Expr.items
index 2a1f903ca5ab..2a1f903ca5ab 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassExtends/after/Expr.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassExtends/after/Expr.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassExtends/after/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassExtends/after/Expr.java
index a9f761e2bd1f..a9f761e2bd1f 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassExtends/after/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassExtends/after/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassExtends/before/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassExtends/before/Expr.java
index 202ef9ef2da6..202ef9ef2da6 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassExtends/before/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassExtends/before/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassPrimitive/after/Expr.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassPrimitive/after/Expr.items
index 485a0f5d91a4..485a0f5d91a4 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassPrimitive/after/Expr.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassPrimitive/after/Expr.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassPrimitive/after/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassPrimitive/after/Expr.java
index 44edef75bfe4..44edef75bfe4 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassPrimitive/after/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassPrimitive/after/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassPrimitive/before/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassPrimitive/before/Expr.java
index 35a3d63f8dea..35a3d63f8dea 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassPrimitive/before/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassPrimitive/before/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassPrimitiveArray/after/Expr.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassPrimitiveArray/after/Expr.items
index cd609774cf24..cd609774cf24 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassPrimitiveArray/after/Expr.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassPrimitiveArray/after/Expr.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassPrimitiveArray/after/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassPrimitiveArray/after/Expr.java
index 9939d2f3d410..9939d2f3d410 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassPrimitiveArray/after/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassPrimitiveArray/after/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassPrimitiveArray/before/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassPrimitiveArray/before/Expr.java
index 35a3d63f8dea..35a3d63f8dea 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassPrimitiveArray/before/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassPrimitiveArray/before/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassRaw/after/Expr.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassRaw/after/Expr.items
index 0bda2fd18195..0bda2fd18195 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassRaw/after/Expr.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassRaw/after/Expr.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassRaw/after/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassRaw/after/Expr.java
index 9edcf9d47a31..9edcf9d47a31 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassRaw/after/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassRaw/after/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassRaw/before/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassRaw/before/Expr.java
index 35a3d63f8dea..35a3d63f8dea 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassRaw/before/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassRaw/before/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassReference/after/Expr.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassReference/after/Expr.items
index ee8fece53e89..ee8fece53e89 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassReference/after/Expr.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassReference/after/Expr.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassReference/after/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassReference/after/Expr.java
index 45fd995735ae..45fd995735ae 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassReference/after/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassReference/after/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassReference/before/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassReference/before/Expr.java
index 35a3d63f8dea..35a3d63f8dea 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassReference/before/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassReference/before/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassReferenceArray/after/Expr.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassReferenceArray/after/Expr.items
index 26be6c5d8e6f..26be6c5d8e6f 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassReferenceArray/after/Expr.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassReferenceArray/after/Expr.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassReferenceArray/after/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassReferenceArray/after/Expr.java
index 46b110d7f75f..46b110d7f75f 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassReferenceArray/after/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassReferenceArray/after/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassReferenceArray/before/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassReferenceArray/before/Expr.java
index 35a3d63f8dea..35a3d63f8dea 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassReferenceArray/before/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassReferenceArray/before/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassSuper/after/Expr.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassSuper/after/Expr.items
index 61336d444497..61336d444497 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassSuper/after/Expr.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassSuper/after/Expr.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassSuper/after/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassSuper/after/Expr.java
index 3ae94c8c1228..3ae94c8c1228 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassSuper/after/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassSuper/after/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassSuper/before/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassSuper/before/Expr.java
index 1e5b26a44e4f..1e5b26a44e4f 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassSuper/before/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralClassSuper/before/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralDouble/after/Expr.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralDouble/after/Expr.items
index eb7229ef905e..eb7229ef905e 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralDouble/after/Expr.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralDouble/after/Expr.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralDouble/after/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralDouble/after/Expr.java
index a1fafc25fe6e..a1fafc25fe6e 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralDouble/after/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralDouble/after/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralDouble/before/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralDouble/before/Expr.java
index 05b89dc47d4f..05b89dc47d4f 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralDouble/before/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralDouble/before/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralFloat/after/Expr.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralFloat/after/Expr.items
index dcf1562d69b7..dcf1562d69b7 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralFloat/after/Expr.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralFloat/after/Expr.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralFloat/after/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralFloat/after/Expr.java
index 8210b283c426..8210b283c426 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralFloat/after/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralFloat/after/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralFloat/before/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralFloat/before/Expr.java
index 05b89dc47d4f..05b89dc47d4f 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralFloat/before/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralFloat/before/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralInt/after/Expr.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralInt/after/Expr.items
index 6969f1efd214..6969f1efd214 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralInt/after/Expr.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralInt/after/Expr.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralInt/after/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralInt/after/Expr.java
index 51bce6ac6430..51bce6ac6430 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralInt/after/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralInt/after/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralInt/before/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralInt/before/Expr.java
index 05b89dc47d4f..05b89dc47d4f 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralInt/before/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralInt/before/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralLong/after/Expr.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralLong/after/Expr.items
index 71718fa25bb1..71718fa25bb1 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralLong/after/Expr.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralLong/after/Expr.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralLong/after/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralLong/after/Expr.java
index 1556e9f05ffb..1556e9f05ffb 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralLong/after/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralLong/after/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralLong/before/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralLong/before/Expr.java
index 05b89dc47d4f..05b89dc47d4f 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralLong/before/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralLong/before/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralShort/after/Expr.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralShort/after/Expr.items
index f282b956c933..f282b956c933 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralShort/after/Expr.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralShort/after/Expr.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralShort/after/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralShort/after/Expr.java
index 39b549b335bb..39b549b335bb 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralShort/after/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralShort/after/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralShort/before/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralShort/before/Expr.java
index 05b89dc47d4f..05b89dc47d4f 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralShort/before/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralShort/before/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralString/after/Expr.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralString/after/Expr.items
index 6bb1edafdfa8..6bb1edafdfa8 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralString/after/Expr.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralString/after/Expr.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralString/after/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralString/after/Expr.java
index 3adc44418ad4..3adc44418ad4 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralString/after/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralString/after/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralString/before/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralString/before/Expr.java
index 05b89dc47d4f..05b89dc47d4f 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralString/before/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprLiteralString/before/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayArray2Lvalue/after/Expr.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayArray2Lvalue/after/Expr.items
index 444531918ce0..444531918ce0 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayArray2Lvalue/after/Expr.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayArray2Lvalue/after/Expr.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayArray2Lvalue/after/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayArray2Lvalue/after/Expr.java
index 570367998bd1..570367998bd1 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayArray2Lvalue/after/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayArray2Lvalue/after/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayArray2Lvalue/before/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayArray2Lvalue/before/Expr.java
index d88808766d7d..d88808766d7d 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayArray2Lvalue/before/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayArray2Lvalue/before/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayArray2Rvalue/after/Expr.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayArray2Rvalue/after/Expr.items
index 4b4b9036abb0..4b4b9036abb0 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayArray2Rvalue/after/Expr.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayArray2Rvalue/after/Expr.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayArray2Rvalue/after/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayArray2Rvalue/after/Expr.java
index fc54bb6ca9d6..fc54bb6ca9d6 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayArray2Rvalue/after/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayArray2Rvalue/after/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayArray2Rvalue/before/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayArray2Rvalue/before/Expr.java
index 8c4093e44d75..8c4093e44d75 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayArray2Rvalue/before/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayArray2Rvalue/before/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayGen2Rvalue/after/Expr.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayGen2Rvalue/after/Expr.items
index 825ef4f10f19..825ef4f10f19 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayGen2Rvalue/after/Expr.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayGen2Rvalue/after/Expr.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayGen2Rvalue/after/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayGen2Rvalue/after/Expr.java
index 5083896eb293..5083896eb293 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayGen2Rvalue/after/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayGen2Rvalue/after/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayGen2Rvalue/before/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayGen2Rvalue/before/Expr.java
index c2301a434ec9..c2301a434ec9 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayGen2Rvalue/before/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayGen2Rvalue/before/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayPrimitive2Lvalue/after/Expr.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayPrimitive2Lvalue/after/Expr.items
index d5976f11c486..d5976f11c486 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayPrimitive2Lvalue/after/Expr.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayPrimitive2Lvalue/after/Expr.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayPrimitive2Lvalue/after/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayPrimitive2Lvalue/after/Expr.java
index 0c6c31bf4929..0c6c31bf4929 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayPrimitive2Lvalue/after/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayPrimitive2Lvalue/after/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayPrimitive2Lvalue/before/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayPrimitive2Lvalue/before/Expr.java
index e7724ca422f4..e7724ca422f4 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayPrimitive2Lvalue/before/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayPrimitive2Lvalue/before/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayPrimitive2Rvalue/after/Expr.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayPrimitive2Rvalue/after/Expr.items
index 5f371c0c6430..5f371c0c6430 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayPrimitive2Rvalue/after/Expr.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayPrimitive2Rvalue/after/Expr.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayPrimitive2Rvalue/after/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayPrimitive2Rvalue/after/Expr.java
index 58017644820c..58017644820c 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayPrimitive2Rvalue/after/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayPrimitive2Rvalue/after/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayPrimitive2Rvalue/before/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayPrimitive2Rvalue/before/Expr.java
index cb1e0d64aa4b..cb1e0d64aa4b 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayPrimitive2Rvalue/before/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayPrimitive2Rvalue/before/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayReftype2Lvalue/after/Expr.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayReftype2Lvalue/after/Expr.items
index a1472a46da67..a1472a46da67 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayReftype2Lvalue/after/Expr.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayReftype2Lvalue/after/Expr.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayReftype2Lvalue/after/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayReftype2Lvalue/after/Expr.java
index bfae5390508e..bfae5390508e 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayReftype2Lvalue/after/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayReftype2Lvalue/after/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayReftype2Lvalue/before/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayReftype2Lvalue/before/Expr.java
index 5cb70f7265f7..5cb70f7265f7 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayReftype2Lvalue/before/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayReftype2Lvalue/before/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayReftype2Rvalue/after/Expr.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayReftype2Rvalue/after/Expr.items
index 4dabd7d9161e..4dabd7d9161e 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayReftype2Rvalue/after/Expr.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayReftype2Rvalue/after/Expr.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayReftype2Rvalue/after/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayReftype2Rvalue/after/Expr.java
index f2d53b50f272..f2d53b50f272 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayReftype2Rvalue/after/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayReftype2Rvalue/after/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayReftype2Rvalue/before/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayReftype2Rvalue/before/Expr.java
index 9e973b7925a0..9e973b7925a0 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayReftype2Rvalue/before/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewArrayReftype2Rvalue/before/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewGen/after/Expr.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewGen/after/Expr.items
index d19a8ab094b7..d19a8ab094b7 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewGen/after/Expr.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewGen/after/Expr.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewGen/after/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewGen/after/Expr.java
index aab73939b929..aab73939b929 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewGen/after/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewGen/after/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewGen/before/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewGen/before/Expr.java
index e38d8aa7229f..e38d8aa7229f 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewGen/before/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewGen/before/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewGenExtends/after/Expr.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewGenExtends/after/Expr.items
index 9003258e73a5..9003258e73a5 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewGenExtends/after/Expr.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewGenExtends/after/Expr.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewGenExtends/after/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewGenExtends/after/Expr.java
index f939534d6972..f939534d6972 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewGenExtends/after/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewGenExtends/after/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewGenExtends/before/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewGenExtends/before/Expr.java
index e65ce8b9a8fc..e65ce8b9a8fc 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewGenExtends/before/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewGenExtends/before/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewGenSuper/after/Expr.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewGenSuper/after/Expr.items
index ca323d833a2c..ca323d833a2c 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewGenSuper/after/Expr.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewGenSuper/after/Expr.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewGenSuper/after/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewGenSuper/after/Expr.java
index 4f5a29eecc6c..4f5a29eecc6c 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewGenSuper/after/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewGenSuper/after/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewGenSuper/before/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewGenSuper/before/Expr.java
index 73a22ebeccde..73a22ebeccde 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewGenSuper/before/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewGenSuper/before/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewReference/after/Expr.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewReference/after/Expr.items
index cab7f8173076..cab7f8173076 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewReference/after/Expr.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewReference/after/Expr.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewReference/after/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewReference/after/Expr.java
index 5cc9c87ec7e4..5cc9c87ec7e4 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewReference/after/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewReference/after/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewReference/before/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewReference/before/Expr.java
index ed03e4ddc1d3..ed03e4ddc1d3 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprNewReference/before/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprNewReference/before/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprReturn2Lvalue/after/Expr.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprReturn2Lvalue/after/Expr.items
index e91631f5c332..e91631f5c332 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprReturn2Lvalue/after/Expr.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprReturn2Lvalue/after/Expr.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprReturn2Lvalue/after/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprReturn2Lvalue/after/Expr.java
index 37c310d405e3..37c310d405e3 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprReturn2Lvalue/after/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprReturn2Lvalue/after/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprReturn2Lvalue/before/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprReturn2Lvalue/before/Expr.java
index 76e26b5c15bb..76e26b5c15bb 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprReturn2Lvalue/before/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprReturn2Lvalue/before/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprReturn2Rvalue/after/Expr.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprReturn2Rvalue/after/Expr.items
index e91631f5c332..e91631f5c332 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprReturn2Rvalue/after/Expr.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprReturn2Rvalue/after/Expr.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprReturn2Rvalue/after/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprReturn2Rvalue/after/Expr.java
index 37c310d405e3..37c310d405e3 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprReturn2Rvalue/after/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprReturn2Rvalue/after/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprReturn2Rvalue/before/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprReturn2Rvalue/before/Expr.java
index 76e26b5c15bb..76e26b5c15bb 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprReturn2Rvalue/before/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprReturn2Rvalue/before/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprTernary/after/Expr.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprTernary/after/Expr.items
index 6e445ca2c431..6e445ca2c431 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprTernary/after/Expr.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprTernary/after/Expr.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprTernary/after/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprTernary/after/Expr.java
index 1e75f910f300..1e75f910f300 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprTernary/after/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprTernary/after/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprTernary/before/Expr.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprTernary/before/Expr.java
index 3a714e5334a4..3a714e5334a4 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/exprTernary/before/Expr.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/exprTernary/before/Expr.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/overridingDown/after/Overriding.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/overridingDown/after/Overriding.java
index 9fb5b2161ba1..9fb5b2161ba1 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/overridingDown/after/Overriding.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/overridingDown/after/Overriding.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/overridingDown/after/Parent.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/overridingDown/after/Parent.items
index 0857363a2808..0857363a2808 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/overridingDown/after/Parent.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/overridingDown/after/Parent.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/overridingDown/before/Overriding.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/overridingDown/before/Overriding.java
index 212ce8080636..212ce8080636 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/overridingDown/before/Overriding.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/overridingDown/before/Overriding.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/overridingUp/after/Child.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/overridingUp/after/Child.items
index 0857363a2808..0857363a2808 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/overridingUp/after/Child.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/overridingUp/after/Child.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/overridingUp/after/Overriding.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/overridingUp/after/Overriding.java
index 9fb5b2161ba1..9fb5b2161ba1 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/overridingUp/after/Overriding.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/overridingUp/after/Overriding.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/overridingUp/before/Overriding.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/overridingUp/before/Overriding.java
index 212ce8080636..212ce8080636 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/overridingUp/before/Overriding.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/overridingUp/before/Overriding.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/specJavadoc/after/Spec.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/specJavadoc/after/Spec.items
index 4428712f4683..4428712f4683 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/specJavadoc/after/Spec.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/specJavadoc/after/Spec.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/specJavadoc/after/Spec.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/specJavadoc/after/Spec.java
index b6c748c1e749..b6c748c1e749 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/specJavadoc/after/Spec.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/specJavadoc/after/Spec.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/specJavadoc/before/Spec.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/specJavadoc/before/Spec.java
index 45080dc2dec1..45080dc2dec1 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/specJavadoc/before/Spec.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/specJavadoc/before/Spec.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/specNotUsed/after/Spec.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/specNotUsed/after/Spec.items
index 8ffc5c9a6744..8ffc5c9a6744 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/specNotUsed/after/Spec.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/specNotUsed/after/Spec.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/specNotUsed/after/Spec.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/specNotUsed/after/Spec.java
index 03d0dc267246..03d0dc267246 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/specNotUsed/after/Spec.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/specNotUsed/after/Spec.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/specNotUsed/before/Spec.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/specNotUsed/before/Spec.java
index 36a606c54faa..36a606c54faa 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/specNotUsed/before/Spec.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/specNotUsed/before/Spec.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayReftype2Lvalue/after/Type.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayReftype2Lvalue/after/Type.items
index e56da57e1062..e56da57e1062 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayReftype2Lvalue/after/Type.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayReftype2Lvalue/after/Type.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayReftype2Lvalue/after/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayReftype2Lvalue/after/Type.java
index 5b667afd7284..5b667afd7284 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayReftype2Lvalue/after/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayReftype2Lvalue/after/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayReftype2Lvalue/before/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayReftype2Lvalue/before/Type.java
index 6c0ad8e907ae..6c0ad8e907ae 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayReftype2Lvalue/before/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayReftype2Lvalue/before/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayReftype2Rvalue/after/Type.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayReftype2Rvalue/after/Type.items
index aa0545cd97f1..aa0545cd97f1 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayReftype2Rvalue/after/Type.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayReftype2Rvalue/after/Type.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayReftype2Rvalue/after/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayReftype2Rvalue/after/Type.java
index 1dc9d19b69d7..1dc9d19b69d7 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayReftype2Rvalue/after/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayReftype2Rvalue/after/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayReftype2Rvalue/before/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayReftype2Rvalue/before/Type.java
index b84f5fada9b6..b84f5fada9b6 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayReftype2Rvalue/before/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayReftype2Rvalue/before/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayRoots2Lvalue/after/Type.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayRoots2Lvalue/after/Type.items
index bfcf79449245..bfcf79449245 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayRoots2Lvalue/after/Type.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayRoots2Lvalue/after/Type.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayRoots2Lvalue/after/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayRoots2Lvalue/after/Type.java
index ea67626d3e12..ea67626d3e12 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayRoots2Lvalue/after/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayRoots2Lvalue/after/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayRoots2Lvalue/before/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayRoots2Lvalue/before/Type.java
index 41bb17f7fec2..41bb17f7fec2 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayRoots2Lvalue/before/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayRoots2Lvalue/before/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayVararg2Lvalue/after/Type.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayVararg2Lvalue/after/Type.items
index 9bcbf6e3ccf2..9bcbf6e3ccf2 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayVararg2Lvalue/after/Type.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayVararg2Lvalue/after/Type.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayVararg2Lvalue/after/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayVararg2Lvalue/after/Type.java
index 82714edc14eb..82714edc14eb 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayVararg2Lvalue/after/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayVararg2Lvalue/after/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayVararg2Lvalue/before/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayVararg2Lvalue/before/Type.java
index 6c0ad8e907ae..6c0ad8e907ae 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayVararg2Lvalue/before/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayVararg2Lvalue/before/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayVararg2RvalueNeg/after/Type.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayVararg2RvalueNeg/after/Type.items
index 8e16567f6b52..8e16567f6b52 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayVararg2RvalueNeg/after/Type.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayVararg2RvalueNeg/after/Type.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayVararg2RvalueNeg/after/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayVararg2RvalueNeg/after/Type.java
index b14ffa0b66b9..b14ffa0b66b9 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayVararg2RvalueNeg/after/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayVararg2RvalueNeg/after/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayVararg2RvalueNeg/before/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayVararg2RvalueNeg/before/Type.java
index 299d07095294..299d07095294 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayVararg2RvalueNeg/before/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayVararg2RvalueNeg/before/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayVararg2RvaluePos/after/Type.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayVararg2RvaluePos/after/Type.items
index fa58313766a2..fa58313766a2 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayVararg2RvaluePos/after/Type.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayVararg2RvaluePos/after/Type.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayVararg2RvaluePos/after/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayVararg2RvaluePos/after/Type.java
index b17f19ce9366..b17f19ce9366 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayVararg2RvaluePos/after/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayVararg2RvaluePos/after/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayVararg2RvaluePos/before/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayVararg2RvaluePos/before/Type.java
index 299d07095294..299d07095294 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayVararg2RvaluePos/before/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeArrayVararg2RvaluePos/before/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxBoolean2Lvalue/after/Type.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxBoolean2Lvalue/after/Type.items
index d2a5bdf18da5..d2a5bdf18da5 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxBoolean2Lvalue/after/Type.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxBoolean2Lvalue/after/Type.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxBoolean2Lvalue/after/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxBoolean2Lvalue/after/Type.java
index 256ad8ae87ba..256ad8ae87ba 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxBoolean2Lvalue/after/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxBoolean2Lvalue/after/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxBoolean2Lvalue/before/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxBoolean2Lvalue/before/Type.java
index e27196d88750..e27196d88750 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxBoolean2Lvalue/before/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxBoolean2Lvalue/before/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxBoolean2Rvalue/after/Type.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxBoolean2Rvalue/after/Type.items
index ddbe17fb4ffc..ddbe17fb4ffc 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxBoolean2Rvalue/after/Type.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxBoolean2Rvalue/after/Type.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxBoolean2Rvalue/after/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxBoolean2Rvalue/after/Type.java
index d58f3df69336..d58f3df69336 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxBoolean2Rvalue/after/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxBoolean2Rvalue/after/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxBoolean2Rvalue/before/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxBoolean2Rvalue/before/Type.java
index fcfe89fe9eca..fcfe89fe9eca 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxBoolean2Rvalue/before/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxBoolean2Rvalue/before/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxByte2Lvalue/after/Type.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxByte2Lvalue/after/Type.items
index 1c80a5546782..1c80a5546782 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxByte2Lvalue/after/Type.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxByte2Lvalue/after/Type.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxByte2Lvalue/after/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxByte2Lvalue/after/Type.java
index 40e19f5b4a68..40e19f5b4a68 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxByte2Lvalue/after/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxByte2Lvalue/after/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxByte2Lvalue/before/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxByte2Lvalue/before/Type.java
index c525d82e6f19..c525d82e6f19 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxByte2Lvalue/before/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxByte2Lvalue/before/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxByte2Rvalue/after/Type.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxByte2Rvalue/after/Type.items
index 192b82591e68..192b82591e68 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxByte2Rvalue/after/Type.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxByte2Rvalue/after/Type.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxByte2Rvalue/after/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxByte2Rvalue/after/Type.java
index 435b929c8591..435b929c8591 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxByte2Rvalue/after/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxByte2Rvalue/after/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxByte2Rvalue/before/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxByte2Rvalue/before/Type.java
index c0c7993580df..c0c7993580df 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxByte2Rvalue/before/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxByte2Rvalue/before/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxChar2Lvalue/after/Type.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxChar2Lvalue/after/Type.items
index 3499c81915b3..3499c81915b3 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxChar2Lvalue/after/Type.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxChar2Lvalue/after/Type.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxChar2Lvalue/after/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxChar2Lvalue/after/Type.java
index c075b5ea1ae1..c075b5ea1ae1 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxChar2Lvalue/after/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxChar2Lvalue/after/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxChar2Lvalue/before/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxChar2Lvalue/before/Type.java
index c821e8a38b8e..c821e8a38b8e 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxChar2Lvalue/before/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxChar2Lvalue/before/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxChar2Rvalue/after/Type.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxChar2Rvalue/after/Type.items
index 8f1b31f74f05..8f1b31f74f05 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxChar2Rvalue/after/Type.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxChar2Rvalue/after/Type.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxChar2Rvalue/after/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxChar2Rvalue/after/Type.java
index bec7b611e95a..bec7b611e95a 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxChar2Rvalue/after/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxChar2Rvalue/after/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxChar2Rvalue/before/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxChar2Rvalue/before/Type.java
index a98d2a5fa05a..a98d2a5fa05a 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxChar2Rvalue/before/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxChar2Rvalue/before/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxDouble2Lvalue/after/Type.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxDouble2Lvalue/after/Type.items
index c961b407f293..c961b407f293 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxDouble2Lvalue/after/Type.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxDouble2Lvalue/after/Type.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxDouble2Lvalue/after/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxDouble2Lvalue/after/Type.java
index c2cc8485f4f5..c2cc8485f4f5 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxDouble2Lvalue/after/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxDouble2Lvalue/after/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxDouble2Lvalue/before/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxDouble2Lvalue/before/Type.java
index 56ec2d53eb99..56ec2d53eb99 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxDouble2Lvalue/before/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxDouble2Lvalue/before/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxDouble2Rvalue/after/Type.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxDouble2Rvalue/after/Type.items
index 2c80921ecfcb..2c80921ecfcb 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxDouble2Rvalue/after/Type.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxDouble2Rvalue/after/Type.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxDouble2Rvalue/after/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxDouble2Rvalue/after/Type.java
index ac0e3c68ebdb..ac0e3c68ebdb 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxDouble2Rvalue/after/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxDouble2Rvalue/after/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxDouble2Rvalue/before/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxDouble2Rvalue/before/Type.java
index 4950dcb0d5bd..4950dcb0d5bd 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxDouble2Rvalue/before/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxDouble2Rvalue/before/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxFloat2Lvalue/after/Type.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxFloat2Lvalue/after/Type.items
index d51dd6bd244e..d51dd6bd244e 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxFloat2Lvalue/after/Type.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxFloat2Lvalue/after/Type.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxFloat2Lvalue/after/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxFloat2Lvalue/after/Type.java
index 4e06d3369857..4e06d3369857 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxFloat2Lvalue/after/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxFloat2Lvalue/after/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxFloat2Lvalue/before/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxFloat2Lvalue/before/Type.java
index 24ec9a945603..24ec9a945603 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxFloat2Lvalue/before/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxFloat2Lvalue/before/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxFloat2Rvalue/after/Type.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxFloat2Rvalue/after/Type.items
index 1b905928d822..1b905928d822 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxFloat2Rvalue/after/Type.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxFloat2Rvalue/after/Type.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxFloat2Rvalue/after/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxFloat2Rvalue/after/Type.java
index 1db8edb10bed..1db8edb10bed 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxFloat2Rvalue/after/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxFloat2Rvalue/after/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxFloat2Rvalue/before/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxFloat2Rvalue/before/Type.java
index 078b103e8df1..078b103e8df1 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxFloat2Rvalue/before/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxFloat2Rvalue/before/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxInt2Lvalue/after/Type.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxInt2Lvalue/after/Type.items
index 24c52d5796ed..24c52d5796ed 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxInt2Lvalue/after/Type.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxInt2Lvalue/after/Type.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxInt2Lvalue/after/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxInt2Lvalue/after/Type.java
index e0075f597b24..e0075f597b24 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxInt2Lvalue/after/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxInt2Lvalue/after/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxInt2Lvalue/before/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxInt2Lvalue/before/Type.java
index 9c2f74c3f26f..9c2f74c3f26f 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxInt2Lvalue/before/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxInt2Lvalue/before/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxInt2Rvalue/after/Type.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxInt2Rvalue/after/Type.items
index d95e0af0768c..d95e0af0768c 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxInt2Rvalue/after/Type.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxInt2Rvalue/after/Type.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxInt2Rvalue/after/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxInt2Rvalue/after/Type.java
index 4bf28b31788c..4bf28b31788c 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxInt2Rvalue/after/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxInt2Rvalue/after/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxInt2Rvalue/before/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxInt2Rvalue/before/Type.java
index 87273262b496..87273262b496 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxInt2Rvalue/before/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxInt2Rvalue/before/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxLong2Lvalue/after/Type.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxLong2Lvalue/after/Type.items
index 29939f335f62..29939f335f62 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxLong2Lvalue/after/Type.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxLong2Lvalue/after/Type.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxLong2Lvalue/after/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxLong2Lvalue/after/Type.java
index 695801b1bc4f..695801b1bc4f 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxLong2Lvalue/after/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxLong2Lvalue/after/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxLong2Lvalue/before/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxLong2Lvalue/before/Type.java
index c6a909f7c46a..c6a909f7c46a 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxLong2Lvalue/before/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxLong2Lvalue/before/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxLong2Rvalue/after/Type.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxLong2Rvalue/after/Type.items
index 0fa3e3feb520..0fa3e3feb520 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxLong2Rvalue/after/Type.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxLong2Rvalue/after/Type.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxLong2Rvalue/after/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxLong2Rvalue/after/Type.java
index 6f407a2591a1..6f407a2591a1 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxLong2Rvalue/after/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxLong2Rvalue/after/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxLong2Rvalue/before/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxLong2Rvalue/before/Type.java
index ceceb07caa8e..ceceb07caa8e 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxLong2Rvalue/before/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxLong2Rvalue/before/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxShort2Lvalue/after/Type.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxShort2Lvalue/after/Type.items
index c6a4cc9b70c8..c6a4cc9b70c8 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxShort2Lvalue/after/Type.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxShort2Lvalue/after/Type.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxShort2Lvalue/after/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxShort2Lvalue/after/Type.java
index 50d61183a785..50d61183a785 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxShort2Lvalue/after/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxShort2Lvalue/after/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxShort2Lvalue/before/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxShort2Lvalue/before/Type.java
index 52eb7aa5b30c..52eb7aa5b30c 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxShort2Lvalue/before/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxShort2Lvalue/before/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxShort2Rvalue/after/Type.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxShort2Rvalue/after/Type.items
index 28ba15701be6..28ba15701be6 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxShort2Rvalue/after/Type.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxShort2Rvalue/after/Type.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxShort2Rvalue/after/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxShort2Rvalue/after/Type.java
index ba146982c723..ba146982c723 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxShort2Rvalue/after/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxShort2Rvalue/after/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxShort2Rvalue/before/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxShort2Rvalue/before/Type.java
index 9ca0f4947260..9ca0f4947260 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxShort2Rvalue/before/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeAutoboxShort2Rvalue/before/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeGenAncestor2Lvalue/after/Type.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeGenAncestor2Lvalue/after/Type.items
index 6106a705cdd8..6106a705cdd8 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeGenAncestor2Lvalue/after/Type.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeGenAncestor2Lvalue/after/Type.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeGenAncestor2Lvalue/after/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeGenAncestor2Lvalue/after/Type.java
index 7e3eeb9770ca..7e3eeb9770ca 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeGenAncestor2Lvalue/after/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeGenAncestor2Lvalue/after/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeGenAncestor2Lvalue/before/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeGenAncestor2Lvalue/before/Type.java
index 2e63240580ca..2e63240580ca 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeGenAncestor2Lvalue/before/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeGenAncestor2Lvalue/before/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeGenAncestorWildcard2Lvalue/after/Type.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeGenAncestorWildcard2Lvalue/after/Type.items
index 6cb2f2be0d34..6cb2f2be0d34 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeGenAncestorWildcard2Lvalue/after/Type.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeGenAncestorWildcard2Lvalue/after/Type.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeGenAncestorWildcard2Lvalue/after/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeGenAncestorWildcard2Lvalue/after/Type.java
index 2ffef9b4e9ad..2ffef9b4e9ad 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeGenAncestorWildcard2Lvalue/after/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeGenAncestorWildcard2Lvalue/after/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeGenAncestorWildcard2Lvalue/before/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeGenAncestorWildcard2Lvalue/before/Type.java
index 4fc8d5baf167..4fc8d5baf167 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeGenAncestorWildcard2Lvalue/before/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeGenAncestorWildcard2Lvalue/before/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeGenDescendant2Rvalue/after/Type.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeGenDescendant2Rvalue/after/Type.items
index ab6a62095446..ab6a62095446 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeGenDescendant2Rvalue/after/Type.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeGenDescendant2Rvalue/after/Type.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeGenDescendant2Rvalue/after/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeGenDescendant2Rvalue/after/Type.java
index 119e65ca61b5..119e65ca61b5 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeGenDescendant2Rvalue/after/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeGenDescendant2Rvalue/after/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeGenDescendant2Rvalue/before/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeGenDescendant2Rvalue/before/Type.java
index e53aa1d3cd1b..e53aa1d3cd1b 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeGenDescendant2Rvalue/before/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeGenDescendant2Rvalue/before/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeGenDescendantWildcard2Rvalue/after/Type.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeGenDescendantWildcard2Rvalue/after/Type.items
index e34aedf887d3..e34aedf887d3 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeGenDescendantWildcard2Rvalue/after/Type.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeGenDescendantWildcard2Rvalue/after/Type.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeGenDescendantWildcard2Rvalue/after/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeGenDescendantWildcard2Rvalue/after/Type.java
index a0982c89aa5c..a0982c89aa5c 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeGenDescendantWildcard2Rvalue/after/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeGenDescendantWildcard2Rvalue/after/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeGenDescendantWildcard2Rvalue/before/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeGenDescendantWildcard2Rvalue/before/Type.java
index 79f4d219b47c..79f4d219b47c 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeGenDescendantWildcard2Rvalue/before/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeGenDescendantWildcard2Rvalue/before/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeGenRaw2Lvalue/after/Type.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeGenRaw2Lvalue/after/Type.items
index 9da02a3b248c..9da02a3b248c 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeGenRaw2Lvalue/after/Type.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeGenRaw2Lvalue/after/Type.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeGenRaw2Lvalue/after/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeGenRaw2Lvalue/after/Type.java
index f66a7c1fadc0..f66a7c1fadc0 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeGenRaw2Lvalue/after/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeGenRaw2Lvalue/after/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeGenRaw2Lvalue/before/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeGenRaw2Lvalue/before/Type.java
index 968d7e85e0b7..968d7e85e0b7 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeGenRaw2Lvalue/before/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeGenRaw2Lvalue/before/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeGenRaw2Rvalue/after/Type.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeGenRaw2Rvalue/after/Type.items
index a3dd46449c57..a3dd46449c57 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeGenRaw2Rvalue/after/Type.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeGenRaw2Rvalue/after/Type.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeGenRaw2Rvalue/after/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeGenRaw2Rvalue/after/Type.java
index f78a0b3d5a68..f78a0b3d5a68 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeGenRaw2Rvalue/after/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeGenRaw2Rvalue/after/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeGenRaw2Rvalue/before/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeGenRaw2Rvalue/before/Type.java
index 968d7e85e0b7..968d7e85e0b7 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeGenRaw2Rvalue/before/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeGenRaw2Rvalue/before/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubBoolean2Lvalue/after/Type.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubBoolean2Lvalue/after/Type.items
index 361d3837f2da..361d3837f2da 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubBoolean2Lvalue/after/Type.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubBoolean2Lvalue/after/Type.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubBoolean2Lvalue/after/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubBoolean2Lvalue/after/Type.java
index 8a5b062df2e6..8a5b062df2e6 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubBoolean2Lvalue/after/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubBoolean2Lvalue/after/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubBoolean2Lvalue/before/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubBoolean2Lvalue/before/Type.java
index b9185a0c81ed..b9185a0c81ed 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubBoolean2Lvalue/before/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubBoolean2Lvalue/before/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubBoolean2Rvalue/after/Type.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubBoolean2Rvalue/after/Type.items
index 361d3837f2da..361d3837f2da 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubBoolean2Rvalue/after/Type.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubBoolean2Rvalue/after/Type.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubBoolean2Rvalue/after/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubBoolean2Rvalue/after/Type.java
index 8a5b062df2e6..8a5b062df2e6 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubBoolean2Rvalue/after/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubBoolean2Rvalue/after/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubBoolean2Rvalue/before/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubBoolean2Rvalue/before/Type.java
index b9185a0c81ed..b9185a0c81ed 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubBoolean2Rvalue/before/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubBoolean2Rvalue/before/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubByte2Rvalue/after/Type.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubByte2Rvalue/after/Type.items
index 71e76cc5a1e9..71e76cc5a1e9 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubByte2Rvalue/after/Type.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubByte2Rvalue/after/Type.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubByte2Rvalue/after/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubByte2Rvalue/after/Type.java
index ac3a40879f5b..ac3a40879f5b 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubByte2Rvalue/after/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubByte2Rvalue/after/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubByte2Rvalue/before/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubByte2Rvalue/before/Type.java
index f7edce2eea98..f7edce2eea98 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubByte2Rvalue/before/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubByte2Rvalue/before/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubChar2Lvalue/after/Type.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubChar2Lvalue/after/Type.items
index 521321c601c1..521321c601c1 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubChar2Lvalue/after/Type.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubChar2Lvalue/after/Type.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubChar2Lvalue/after/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubChar2Lvalue/after/Type.java
index 8b94e45d5626..8b94e45d5626 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubChar2Lvalue/after/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubChar2Lvalue/after/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubChar2Lvalue/before/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubChar2Lvalue/before/Type.java
index 2d55ceaa511a..2d55ceaa511a 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubChar2Lvalue/before/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubChar2Lvalue/before/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubChar2Rvalue/after/Type.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubChar2Rvalue/after/Type.items
index 404f84f33867..404f84f33867 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubChar2Rvalue/after/Type.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubChar2Rvalue/after/Type.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubChar2Rvalue/after/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubChar2Rvalue/after/Type.java
index dc346a77074c..dc346a77074c 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubChar2Rvalue/after/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubChar2Rvalue/after/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubChar2Rvalue/before/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubChar2Rvalue/before/Type.java
index f7edce2eea98..f7edce2eea98 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubChar2Rvalue/before/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubChar2Rvalue/before/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubDouble2Lvalue/after/Type.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubDouble2Lvalue/after/Type.items
index 6946fcefbac0..6946fcefbac0 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubDouble2Lvalue/after/Type.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubDouble2Lvalue/after/Type.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubDouble2Lvalue/after/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubDouble2Lvalue/after/Type.java
index 8a5035c81e4d..8a5035c81e4d 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubDouble2Lvalue/after/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubDouble2Lvalue/after/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubDouble2Lvalue/before/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubDouble2Lvalue/before/Type.java
index 2d55ceaa511a..2d55ceaa511a 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubDouble2Lvalue/before/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubDouble2Lvalue/before/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubFloat2Lvalue/after/Type.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubFloat2Lvalue/after/Type.items
index c479836287e0..c479836287e0 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubFloat2Lvalue/after/Type.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubFloat2Lvalue/after/Type.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubFloat2Lvalue/after/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubFloat2Lvalue/after/Type.java
index 8b59184de85f..8b59184de85f 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubFloat2Lvalue/after/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubFloat2Lvalue/after/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubFloat2Lvalue/before/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubFloat2Lvalue/before/Type.java
index 2d55ceaa511a..2d55ceaa511a 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubFloat2Lvalue/before/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubFloat2Lvalue/before/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubFloat2Rvalue/after/Type.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubFloat2Rvalue/after/Type.items
index 7a22f6771caf..7a22f6771caf 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubFloat2Rvalue/after/Type.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubFloat2Rvalue/after/Type.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubFloat2Rvalue/after/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubFloat2Rvalue/after/Type.java
index 0b933cce77dd..0b933cce77dd 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubFloat2Rvalue/after/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubFloat2Rvalue/after/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubFloat2Rvalue/before/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubFloat2Rvalue/before/Type.java
index f7edce2eea98..f7edce2eea98 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubFloat2Rvalue/before/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubFloat2Rvalue/before/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubInt2Lvalue/after/Type.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubInt2Lvalue/after/Type.items
index 200b3b8b3fb5..200b3b8b3fb5 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubInt2Lvalue/after/Type.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubInt2Lvalue/after/Type.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubInt2Lvalue/after/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubInt2Lvalue/after/Type.java
index b15830da724d..b15830da724d 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubInt2Lvalue/after/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubInt2Lvalue/after/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubInt2Lvalue/before/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubInt2Lvalue/before/Type.java
index 2d55ceaa511a..2d55ceaa511a 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubInt2Lvalue/before/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubInt2Lvalue/before/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubInt2Rvalue/after/Type.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubInt2Rvalue/after/Type.items
index b7c45d6a6aff..b7c45d6a6aff 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubInt2Rvalue/after/Type.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubInt2Rvalue/after/Type.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubInt2Rvalue/after/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubInt2Rvalue/after/Type.java
index c13b0ab9bee2..c13b0ab9bee2 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubInt2Rvalue/after/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubInt2Rvalue/after/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubInt2Rvalue/before/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubInt2Rvalue/before/Type.java
index f7edce2eea98..f7edce2eea98 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubInt2Rvalue/before/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubInt2Rvalue/before/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubLong2Lvalue/after/Type.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubLong2Lvalue/after/Type.items
index 3f94bd20c6e8..3f94bd20c6e8 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubLong2Lvalue/after/Type.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubLong2Lvalue/after/Type.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubLong2Lvalue/after/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubLong2Lvalue/after/Type.java
index 1b594666283c..1b594666283c 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubLong2Lvalue/after/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubLong2Lvalue/after/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubLong2Lvalue/before/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubLong2Lvalue/before/Type.java
index 2d55ceaa511a..2d55ceaa511a 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubLong2Lvalue/before/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubLong2Lvalue/before/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubLong2Rvalue/after/Type.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubLong2Rvalue/after/Type.items
index 98a3c92987b9..98a3c92987b9 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubLong2Rvalue/after/Type.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubLong2Rvalue/after/Type.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubLong2Rvalue/after/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubLong2Rvalue/after/Type.java
index e3e3b25d89b4..e3e3b25d89b4 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubLong2Rvalue/after/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubLong2Rvalue/after/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubLong2Rvalue/before/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubLong2Rvalue/before/Type.java
index f7edce2eea98..f7edce2eea98 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubLong2Rvalue/before/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubLong2Rvalue/before/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubShort2Lvalue/after/Type.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubShort2Lvalue/after/Type.items
index 8f0cd52a3560..8f0cd52a3560 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubShort2Lvalue/after/Type.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubShort2Lvalue/after/Type.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubShort2Lvalue/after/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubShort2Lvalue/after/Type.java
index ccbe23c4b4e2..ccbe23c4b4e2 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubShort2Lvalue/after/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubShort2Lvalue/after/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubShort2Lvalue/before/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubShort2Lvalue/before/Type.java
index 2d55ceaa511a..2d55ceaa511a 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubShort2Lvalue/before/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubShort2Lvalue/before/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubShort2Rvalue/after/Type.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubShort2Rvalue/after/Type.items
index 754060e723ec..754060e723ec 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubShort2Rvalue/after/Type.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubShort2Rvalue/after/Type.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubShort2Rvalue/after/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubShort2Rvalue/after/Type.java
index eb53bcd49ebc..eb53bcd49ebc 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubShort2Rvalue/after/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubShort2Rvalue/after/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubShort2Rvalue/before/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubShort2Rvalue/before/Type.java
index f7edce2eea98..f7edce2eea98 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubShort2Rvalue/before/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typePrimsubShort2Rvalue/before/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeRefClassChild2Rvalue/after/Type.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeRefClassChild2Rvalue/after/Type.items
index 78431b6e4a4a..78431b6e4a4a 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeRefClassChild2Rvalue/after/Type.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeRefClassChild2Rvalue/after/Type.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeRefClassChild2Rvalue/after/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeRefClassChild2Rvalue/after/Type.java
index f5d9434c07c4..f5d9434c07c4 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeRefClassChild2Rvalue/after/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeRefClassChild2Rvalue/after/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeRefClassChild2Rvalue/before/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeRefClassChild2Rvalue/before/Type.java
index e5cfab9f9af5..e5cfab9f9af5 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeRefClassChild2Rvalue/before/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeRefClassChild2Rvalue/before/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeRefClassParent2Lvalue/after/Type.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeRefClassParent2Lvalue/after/Type.items
index 18fce6b3d6ec..18fce6b3d6ec 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeRefClassParent2Lvalue/after/Type.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeRefClassParent2Lvalue/after/Type.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeRefClassParent2Lvalue/after/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeRefClassParent2Lvalue/after/Type.java
index 8d7fee567890..8d7fee567890 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeRefClassParent2Lvalue/after/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeRefClassParent2Lvalue/after/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeRefClassParent2Lvalue/before/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeRefClassParent2Lvalue/before/Type.java
index 074af076748d..074af076748d 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeRefClassParent2Lvalue/before/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeRefClassParent2Lvalue/before/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeRefClassParent2Rvalue/after/Type.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeRefClassParent2Rvalue/after/Type.items
index 4e7bfb9a5f9a..4e7bfb9a5f9a 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeRefClassParent2Rvalue/after/Type.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeRefClassParent2Rvalue/after/Type.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeRefClassParent2Rvalue/after/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeRefClassParent2Rvalue/after/Type.java
index 9953f41083c5..9953f41083c5 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeRefClassParent2Rvalue/after/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeRefClassParent2Rvalue/after/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeRefClassParent2Rvalue/before/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeRefClassParent2Rvalue/before/Type.java
index e5cfab9f9af5..e5cfab9f9af5 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeRefClassParent2Rvalue/before/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeRefClassParent2Rvalue/before/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeRefFaceChild2Lvalue/after/Type.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeRefFaceChild2Lvalue/after/Type.items
index 9dd227a952df..9dd227a952df 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeRefFaceChild2Lvalue/after/Type.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeRefFaceChild2Lvalue/after/Type.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeRefFaceChild2Lvalue/after/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeRefFaceChild2Lvalue/after/Type.java
index f4b8de1d6028..f4b8de1d6028 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeRefFaceChild2Lvalue/after/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeRefFaceChild2Lvalue/after/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeRefFaceChild2Lvalue/before/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeRefFaceChild2Lvalue/before/Type.java
index 074af076748d..074af076748d 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeRefFaceChild2Lvalue/before/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeRefFaceChild2Lvalue/before/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeRefFaceChild2Rvalue/after/Type.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeRefFaceChild2Rvalue/after/Type.items
index 91683c097f98..91683c097f98 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeRefFaceChild2Rvalue/after/Type.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeRefFaceChild2Rvalue/after/Type.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeRefFaceChild2Rvalue/after/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeRefFaceChild2Rvalue/after/Type.java
index f16470efa1df..f16470efa1df 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeRefFaceChild2Rvalue/after/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeRefFaceChild2Rvalue/after/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeRefFaceChild2Rvalue/before/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeRefFaceChild2Rvalue/before/Type.java
index e5cfab9f9af5..e5cfab9f9af5 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeRefFaceChild2Rvalue/before/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeRefFaceChild2Rvalue/before/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeRefFaceParent2Lvalue/after/Type.items b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeRefFaceParent2Lvalue/after/Type.items
index a10aad579ef2..a10aad579ef2 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeRefFaceParent2Lvalue/after/Type.items
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeRefFaceParent2Lvalue/after/Type.items
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeRefFaceParent2Lvalue/after/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeRefFaceParent2Lvalue/after/Type.java
index d53c072b9b56..d53c072b9b56 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeRefFaceParent2Lvalue/after/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeRefFaceParent2Lvalue/after/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeRefFaceParent2Lvalue/before/Type.java b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeRefFaceParent2Lvalue/before/Type.java
index 074af076748d..074af076748d 100644
--- a/plugins/typeMigration/testData/refactoring/migrateTypeSignature/typeRefFaceParent2Lvalue/before/Type.java
+++ b/java/typeMigration/testData/refactoring/migrateTypeSignature/typeRefFaceParent2Lvalue/before/Type.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t01/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t01/after/Test.items
index 702373b694d5..702373b694d5 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t01/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t01/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t01/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t01/after/test.java
index cf8dd0203f05..cf8dd0203f05 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t01/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t01/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t01/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t01/before/test.java
index 1f7a52e4aa63..1f7a52e4aa63 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t01/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t01/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t02/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t02/after/Test.items
index eb13633449ca..eb13633449ca 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t02/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t02/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t02/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t02/after/test.java
index 5842b8fa99e0..5842b8fa99e0 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t02/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t02/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t02/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t02/before/test.java
index d0ebca58783c..d0ebca58783c 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t02/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t02/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t03/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t03/after/Test.items
index f1747c90b2ed..f1747c90b2ed 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t03/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t03/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t03/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t03/after/test.java
index 5fd61417ba05..5fd61417ba05 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t03/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t03/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t03/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t03/before/test.java
index 9e1559784bde..9e1559784bde 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t03/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t03/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t04/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t04/after/Test.items
index edea723357ea..edea723357ea 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t04/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t04/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t04/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t04/after/test.java
index 080208fcbd6c..080208fcbd6c 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t04/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t04/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t04/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t04/before/test.java
index 591b5a530d2b..591b5a530d2b 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t04/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t04/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t05/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t05/after/Test.items
index 8152c1b711e7..8152c1b711e7 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t05/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t05/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t05/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t05/after/test.java
index b74d13b84fda..b74d13b84fda 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t05/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t05/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t05/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t05/before/test.java
index e8a96127f4fd..e8a96127f4fd 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t05/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t05/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t06/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t06/after/Test.items
index 3ad4c0f7992f..3ad4c0f7992f 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t06/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t06/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t06/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t06/after/test.java
index f4fa6ab1f876..f4fa6ab1f876 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t06/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t06/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t06/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t06/before/test.java
index 862356ebd9cc..862356ebd9cc 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t06/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t06/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t07/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t07/after/Test.items
index 12252787a292..12252787a292 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t07/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t07/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t07/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t07/after/test.java
index 09d7a0982009..09d7a0982009 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t07/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t07/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t07/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t07/before/test.java
index 87955af32435..87955af32435 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t07/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t07/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t08/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t08/after/Test.items
index 7c09ce5a46f7..7c09ce5a46f7 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t08/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t08/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t08/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t08/after/test.java
index 9f13a80a2f2a..9f13a80a2f2a 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t08/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t08/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t08/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t08/before/test.java
index e38a9aa3155d..e38a9aa3155d 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t08/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t08/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t09/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t09/after/Test.items
index 39394462b76e..39394462b76e 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t09/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t09/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t09/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t09/after/test.java
index 5e779c9e12f5..5e779c9e12f5 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t09/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t09/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t09/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t09/before/test.java
index db3f02ed1976..db3f02ed1976 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t09/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t09/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t10/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t10/after/Test.items
index 77d161720fb5..77d161720fb5 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t10/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t10/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t10/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t10/after/test.java
index 7820f54d0340..7820f54d0340 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t10/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t10/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t10/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t10/before/test.java
index 726f23a4bf8d..726f23a4bf8d 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t10/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t10/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t100/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t100/after/Test.items
index 135dca6a135e..135dca6a135e 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t100/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t100/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t100/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t100/after/test.java
index b2917c86149e..b2917c86149e 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t100/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t100/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t100/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t100/before/test.java
index 7bf03e3a27da..7bf03e3a27da 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t100/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t100/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t101/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t101/after/Test.items
index 285bc5b6ca51..285bc5b6ca51 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t101/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t101/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t101/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t101/after/test.java
index 6344b428b46c..6344b428b46c 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t101/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t101/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t101/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t101/before/test.java
index e16f3d100bc9..e16f3d100bc9 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t101/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t101/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t102/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t102/after/Test.items
index b9f794b195bf..b9f794b195bf 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t102/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t102/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t102/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t102/after/test.java
index dcd056fcaf90..dcd056fcaf90 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t102/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t102/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t102/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t102/before/test.java
index f59b5db84644..f59b5db84644 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t102/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t102/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t103/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t103/after/Test.items
index b13c3192a1d8..b13c3192a1d8 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t103/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t103/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t103/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t103/after/test.java
index af807d53c7b0..af807d53c7b0 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t103/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t103/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t103/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t103/before/test.java
index 7e5802d50574..7e5802d50574 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t103/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t103/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t104/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t104/after/Test.items
index f085abb3c681..f085abb3c681 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t104/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t104/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t104/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t104/after/test.java
index d70a09a513bd..d70a09a513bd 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t104/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t104/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t104/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t104/before/test.java
index bc4b40c061a2..bc4b40c061a2 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t104/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t104/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t105/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t105/after/Test.items
index 7821f01df96c..7821f01df96c 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t105/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t105/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t105/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t105/after/test.java
index 71797316503f..71797316503f 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t105/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t105/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t105/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t105/before/test.java
index 763dc905176d..763dc905176d 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t105/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t105/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t106/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t106/after/Test.items
index 2fab8a1f5fae..2fab8a1f5fae 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t106/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t106/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t106/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t106/after/test.java
index dafbfca4a742..dafbfca4a742 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t106/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t106/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t106/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t106/before/test.java
index 65ad21055710..65ad21055710 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t106/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t106/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t107/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t107/after/Test.items
index 93a16148be72..93a16148be72 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t107/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t107/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t107/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t107/after/test.java
index ce44f19e2458..ce44f19e2458 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t107/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t107/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t107/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t107/before/test.java
index 65ad21055710..65ad21055710 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t107/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t107/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t108/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t108/after/Test.items
index a9f530ce25f7..a9f530ce25f7 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t108/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t108/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t108/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t108/after/test.java
index 26b9322b4739..26b9322b4739 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t108/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t108/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t108/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t108/before/test.java
index 08a3229cd932..08a3229cd932 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t108/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t108/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t109/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t109/after/Test.items
index 6a47f6675781..6a47f6675781 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t109/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t109/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t109/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t109/after/test.java
index bae70cd5b0d4..bae70cd5b0d4 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t109/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t109/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t109/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t109/before/test.java
index 26280e892cd0..26280e892cd0 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t109/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t109/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t11/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t11/after/Test.items
index 4058a7862ff2..4058a7862ff2 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t11/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t11/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t11/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t11/after/test.java
index 1491875ea2b7..1491875ea2b7 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t11/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t11/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t11/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t11/before/test.java
index b0aa7086f175..b0aa7086f175 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t11/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t11/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t110/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t110/after/Test.items
index 3853e035e26b..3853e035e26b 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t110/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t110/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t110/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t110/after/test.java
index cb813fd6567f..cb813fd6567f 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t110/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t110/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t110/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t110/before/test.java
index 08a3229cd932..08a3229cd932 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t110/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t110/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t111/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t111/after/Test.items
index 29717a0b2377..29717a0b2377 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t111/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t111/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t111/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t111/after/test.java
index e257e485d6bb..e257e485d6bb 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t111/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t111/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t111/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t111/before/test.java
index 2620dd9f5d6a..2620dd9f5d6a 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t111/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t111/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t112/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t112/after/Test.items
index 78f2ed729f10..78f2ed729f10 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t112/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t112/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t112/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t112/after/test.java
index c31ec11010c3..c31ec11010c3 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t112/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t112/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t112/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t112/before/test.java
index e7bf28f0de1e..e7bf28f0de1e 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t112/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t112/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t113/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t113/after/Test.items
index 1b69785be552..1b69785be552 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t113/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t113/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t113/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t113/after/test.java
index 9f9bdcaffad7..9f9bdcaffad7 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t113/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t113/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t113/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t113/before/test.java
index 6627e8d101de..6627e8d101de 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t113/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t113/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t114/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t114/after/Test.items
index b6c70f112866..b6c70f112866 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t114/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t114/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t114/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t114/after/test.java
index 6e2b9f24c22a..6e2b9f24c22a 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t114/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t114/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t114/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t114/before/test.java
index f73951e56432..f73951e56432 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t114/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t114/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t115/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t115/after/Test.items
index b07cf0af793c..b07cf0af793c 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t115/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t115/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t115/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t115/after/test.java
index 8d69a2330c70..8d69a2330c70 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t115/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t115/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t115/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t115/before/test.java
index f585aba2e91c..f585aba2e91c 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t115/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t115/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t116/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t116/after/Test.items
index 0aee5ef814c6..0aee5ef814c6 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t116/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t116/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t116/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t116/after/test.java
index 95ddfb44251f..95ddfb44251f 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t116/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t116/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t116/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t116/before/test.java
index d68047e81823..d68047e81823 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t116/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t116/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t117/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t117/after/Test.items
index 0aee5ef814c6..0aee5ef814c6 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t117/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t117/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t117/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t117/after/test.java
index 3172eaa133dc..3172eaa133dc 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t117/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t117/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t117/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t117/before/test.java
index 46cde69dca96..46cde69dca96 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t117/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t117/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t118/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t118/after/Test.items
index dcd1be2928cb..dcd1be2928cb 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t118/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t118/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t118/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t118/after/test.java
index 37d684a97957..37d684a97957 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t118/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t118/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t118/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t118/before/test.java
index 012a188e5ad5..012a188e5ad5 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t118/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t118/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t119/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t119/after/Test.items
index dcd1be2928cb..dcd1be2928cb 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t119/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t119/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t119/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t119/after/test.java
index 28446b6bc761..28446b6bc761 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t119/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t119/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t119/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t119/before/test.java
index 28aeed25cefa..28aeed25cefa 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t119/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t119/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t12/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t12/after/Test.items
index a1b75e0f23ac..a1b75e0f23ac 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t12/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t12/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t12/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t12/after/test.java
index 657869206253..657869206253 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t12/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t12/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t12/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t12/before/test.java
index 24199ff02584..24199ff02584 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t12/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t12/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t120/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t120/after/Test.items
index 6f23d60f1d3c..6f23d60f1d3c 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t120/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t120/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t120/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t120/after/test.java
index e40c1215581b..e40c1215581b 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t120/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t120/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t120/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t120/before/test.java
index 0f65e57d94ee..0f65e57d94ee 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t120/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t120/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t121/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t121/after/Test.items
index dadc2c72891a..dadc2c72891a 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t121/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t121/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t121/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t121/after/test.java
index e3a952e4d560..e3a952e4d560 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t121/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t121/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t121/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t121/before/test.java
index aad87ca532b7..aad87ca532b7 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t121/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t121/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t122/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t122/after/Test.items
index 00092fc53a55..00092fc53a55 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t122/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t122/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t122/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t122/after/test.java
index 5784ee52e360..5784ee52e360 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t122/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t122/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t122/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t122/before/test.java
index bb086dad2af8..bb086dad2af8 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t122/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t122/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t123/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t123/after/Test.items
index 691d3e6a1e26..691d3e6a1e26 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t123/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t123/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t123/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t123/after/test.java
index 883991ffec9d..883991ffec9d 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t123/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t123/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t123/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t123/before/test.java
index 516fcf828234..516fcf828234 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t123/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t123/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t124/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t124/after/Test.items
index 4a7df94f76b2..4a7df94f76b2 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t124/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t124/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t124/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t124/after/test.java
index f41fe88534f4..f41fe88534f4 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t124/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t124/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t124/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t124/before/test.java
index b40d864d16c7..b40d864d16c7 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t124/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t124/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t125/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t125/after/Test.items
index 3859bad4e428..3859bad4e428 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t125/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t125/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t125/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t125/after/test.java
index 7854f476cc9e..7854f476cc9e 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t125/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t125/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t125/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t125/before/test.java
index 30cf3914d62a..30cf3914d62a 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t125/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t125/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t126/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t126/after/Test.items
index f870c21c0523..f870c21c0523 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t126/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t126/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t126/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t126/after/test.java
index 7b2814378d28..7b2814378d28 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t126/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t126/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t126/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t126/before/test.java
index 0dc76ccbdc72..0dc76ccbdc72 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t126/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t126/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t127/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t127/after/Test.items
index 78aa0fbd396b..78aa0fbd396b 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t127/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t127/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t127/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t127/after/test.java
index 06a4d09a41a6..06a4d09a41a6 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t127/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t127/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t127/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t127/before/test.java
index dd2c813fd38e..dd2c813fd38e 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t127/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t127/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t128/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t128/after/Test.items
index 24ec208dbb43..24ec208dbb43 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t128/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t128/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t128/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t128/after/test.java
index 8f2ad153d911..8f2ad153d911 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t128/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t128/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t128/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t128/before/test.java
index 33bb6bf973c1..33bb6bf973c1 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t128/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t128/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t129/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t129/after/Test.items
index 8ca26492b5bd..8ca26492b5bd 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t129/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t129/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t129/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t129/after/test.java
index 33bb6bf973c1..33bb6bf973c1 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t129/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t129/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t129/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t129/before/test.java
index 8f2ad153d911..8f2ad153d911 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t129/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t129/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t13/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t13/after/Test.items
index ca5cc75efa2e..ca5cc75efa2e 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t13/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t13/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t13/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t13/after/test.java
index 53b97a29e38c..53b97a29e38c 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t13/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t13/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t13/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t13/before/test.java
index 9024eab86966..9024eab86966 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t13/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t13/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t130/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t130/after/Test.items
index 056ae7968e06..056ae7968e06 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t130/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t130/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t130/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t130/after/test.java
index 67ed3db2315a..67ed3db2315a 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t130/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t130/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t130/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t130/before/test.java
index 7ee7852db3d4..7ee7852db3d4 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t130/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t130/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t131/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t131/after/Test.items
index e8d3b6152d2d..e8d3b6152d2d 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t131/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t131/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t131/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t131/after/test.java
index 5c02bb8a41f2..5c02bb8a41f2 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t131/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t131/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t131/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t131/before/test.java
index 7ee7852db3d4..7ee7852db3d4 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t131/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t131/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t132/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t132/after/Test.items
index e5b813b90288..e5b813b90288 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t132/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t132/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t132/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t132/after/test.java
index 6f53c98f5459..6f53c98f5459 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t132/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t132/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t132/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t132/before/test.java
index 2e6ab23c21d6..2e6ab23c21d6 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t132/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t132/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t133/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t133/after/Test.items
index 777fddf90a83..777fddf90a83 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t133/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t133/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t133/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t133/after/test.java
index 41db920f7120..41db920f7120 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t133/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t133/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t133/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t133/before/test.java
index 5599c1a59b46..5599c1a59b46 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t133/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t133/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t134/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t134/after/Test.items
index 2880fefdc224..2880fefdc224 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t134/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t134/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t134/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t134/after/test.java
index 26cb24f419d2..26cb24f419d2 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t134/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t134/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t134/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t134/before/test.java
index 7a7760404f36..7a7760404f36 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t134/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t134/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t135/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t135/after/Test.items
index 4e20b05def59..4e20b05def59 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t135/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t135/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t135/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t135/after/test.java
index c992fd8569bf..c992fd8569bf 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t135/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t135/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t135/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t135/before/test.java
index 756e9380835d..756e9380835d 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t135/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t135/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t136/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t136/after/Test.items
index 617357a07275..617357a07275 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t136/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t136/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t136/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t136/after/test.java
index 08185f4c079c..08185f4c079c 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t136/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t136/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t136/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t136/before/test.java
index e66f3a5f5bfa..e66f3a5f5bfa 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t136/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t136/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t137/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t137/after/Test.items
index 01da876f7e94..01da876f7e94 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t137/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t137/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t137/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t137/after/test.java
index b2d59c1303dc..b2d59c1303dc 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t137/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t137/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t137/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t137/before/test.java
index 832535bc9440..832535bc9440 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t137/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t137/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t138/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t138/after/Test.items
index 176574ab1bc0..176574ab1bc0 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t138/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t138/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t138/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t138/after/test.java
index 141e122e2ccc..141e122e2ccc 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t138/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t138/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t138/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t138/before/test.java
index 28feb3c90d4a..28feb3c90d4a 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t138/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t138/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t139/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t139/after/Test.items
index 2fbe632fa578..2fbe632fa578 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t139/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t139/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t139/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t139/after/test.java
index d91661b68309..d91661b68309 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t139/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t139/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t139/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t139/before/test.java
index f937525f52e2..f937525f52e2 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t139/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t139/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t14/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t14/after/Test.items
index 21635daebc66..21635daebc66 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t14/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t14/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t14/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t14/after/test.java
index de034ae20adf..de034ae20adf 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t14/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t14/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t14/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t14/before/test.java
index 8f6feeba681d..8f6feeba681d 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t14/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t14/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t15/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t15/after/Test.items
index 31ff4b94b421..31ff4b94b421 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t15/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t15/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t15/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t15/after/test.java
index dcc5808448d5..dcc5808448d5 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t15/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t15/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t15/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t15/before/test.java
index b22cc32ea85b..b22cc32ea85b 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t15/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t15/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t16/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t16/after/Test.items
index c0038308e560..c0038308e560 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t16/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t16/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t16/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t16/after/test.java
index 8c87396bcb3d..8c87396bcb3d 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t16/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t16/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t16/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t16/before/test.java
index c401bf03de20..c401bf03de20 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t16/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t16/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t17/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t17/after/Test.items
index aa0aa0551659..aa0aa0551659 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t17/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t17/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t17/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t17/after/test.java
index 73530057f21b..73530057f21b 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t17/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t17/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t17/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t17/before/test.java
index a425495c6065..a425495c6065 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t17/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t17/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t18/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t18/after/Test.items
index 2f426a4bb9b0..2f426a4bb9b0 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t18/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t18/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t18/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t18/after/test.java
index 35d9b61c1045..35d9b61c1045 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t18/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t18/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t18/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t18/before/test.java
index 3113a46d5dc6..3113a46d5dc6 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t18/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t18/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t19/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t19/after/Test.items
index a2ec06ad3634..a2ec06ad3634 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t19/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t19/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t19/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t19/after/test.java
index 9609791bb138..9609791bb138 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t19/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t19/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t19/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t19/before/test.java
index 815f0ed1ab3a..815f0ed1ab3a 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t19/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t19/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t20/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t20/after/Test.items
index c97038d663ce..c97038d663ce 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t20/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t20/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t20/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t20/after/test.java
index 815f0ed1ab3a..815f0ed1ab3a 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t20/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t20/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t20/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t20/before/test.java
index 9609791bb138..9609791bb138 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t20/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t20/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t21/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t21/after/Test.items
index 53630275ac1c..53630275ac1c 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t21/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t21/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t21/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t21/after/test.java
index 34e758cb64d6..34e758cb64d6 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t21/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t21/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t21/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t21/before/test.java
index 1f647aff2488..1f647aff2488 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t21/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t21/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t22/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t22/after/Test.items
index e8b61ea780ac..e8b61ea780ac 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t22/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t22/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t22/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t22/after/test.java
index affc2b3da86f..affc2b3da86f 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t22/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t22/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t22/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t22/before/test.java
index 24b0b43cb5a2..24b0b43cb5a2 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t22/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t22/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t23/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t23/after/Test.items
index 99507129472e..99507129472e 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t23/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t23/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t23/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t23/after/test.java
index df9ad40dc0e9..df9ad40dc0e9 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t23/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t23/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t23/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t23/before/test.java
index a99eafcc46dc..a99eafcc46dc 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t23/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t23/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t24/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t24/after/Test.items
index 21962d201ce2..21962d201ce2 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t24/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t24/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t24/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t24/after/test.java
index 6e0abdb55348..6e0abdb55348 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t24/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t24/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t24/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t24/before/test.java
index 536dfc3ebd30..536dfc3ebd30 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t24/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t24/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t25/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t25/after/Test.items
index 21962d201ce2..21962d201ce2 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t25/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t25/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t25/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t25/after/test.java
index b06e456332d8..b06e456332d8 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t25/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t25/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t25/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t25/before/test.java
index 2994877fade8..2994877fade8 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t25/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t25/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t26/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t26/after/Test.items
index eae7ba330dd9..eae7ba330dd9 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t26/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t26/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t26/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t26/after/test.java
index ee47caa11464..ee47caa11464 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t26/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t26/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t26/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t26/before/test.java
index 581f5fa3bc83..581f5fa3bc83 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t26/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t26/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t27/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t27/after/Test.items
index eae7ba330dd9..eae7ba330dd9 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t27/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t27/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t27/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t27/after/test.java
index 5eb0cb2d97b9..5eb0cb2d97b9 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t27/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t27/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t27/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t27/before/test.java
index a18da122856d..a18da122856d 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t27/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t27/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t28/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t28/after/Test.items
index 80d6c0c3bf37..80d6c0c3bf37 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t28/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t28/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t28/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t28/after/test.java
index 0b1e27daa0ee..0b1e27daa0ee 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t28/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t28/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t28/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t28/before/test.java
index 43c040a3baf4..43c040a3baf4 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t28/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t28/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t29/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t29/after/Test.items
index 5b040a6aaa19..5b040a6aaa19 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t29/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t29/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t29/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t29/after/test.java
index 23a1f11f461e..23a1f11f461e 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t29/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t29/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t29/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t29/before/test.java
index 43c040a3baf4..43c040a3baf4 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t29/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t29/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t30/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t30/after/Test.items
index cfd748933e5d..cfd748933e5d 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t30/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t30/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t30/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t30/after/test.java
index 28f71fc98c82..28f71fc98c82 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t30/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t30/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t30/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t30/before/test.java
index 5317e2164e7b..5317e2164e7b 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t30/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t30/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t31/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t31/after/Test.items
index 7459a22f27d0..7459a22f27d0 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t31/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t31/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t31/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t31/after/test.java
index ec7fb8e9807d..ec7fb8e9807d 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t31/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t31/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t31/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t31/before/test.java
index b8c08fdfd786..b8c08fdfd786 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t31/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t31/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t32/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t32/after/Test.items
index 5638ea15f4a6..5638ea15f4a6 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t32/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t32/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t32/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t32/after/test.java
index 27e7eeb25258..27e7eeb25258 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t32/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t32/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t32/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t32/before/test.java
index a98179d5054c..a98179d5054c 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t32/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t32/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t33/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t33/after/Test.items
index df8f4d2c09d4..df8f4d2c09d4 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t33/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t33/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t33/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t33/after/test.java
index 126292ad9322..126292ad9322 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t33/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t33/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t33/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t33/before/test.java
index f604f9185e2d..f604f9185e2d 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t33/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t33/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t34/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t34/after/Test.items
index d9f0bafc62d7..d9f0bafc62d7 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t34/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t34/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t34/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t34/after/test.java
index 954f507013c6..954f507013c6 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t34/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t34/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t34/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t34/before/test.java
index f604f9185e2d..f604f9185e2d 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t34/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t34/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t35/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t35/after/Test.items
index 2b28dc8c0984..2b28dc8c0984 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t35/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t35/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t35/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t35/after/test.java
index b575a53519c4..b575a53519c4 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t35/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t35/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t35/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t35/before/test.java
index 83f66b0bea7c..83f66b0bea7c 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t35/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t35/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t36/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t36/after/Test.items
index 521251a0dd37..521251a0dd37 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t36/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t36/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t36/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t36/after/test.java
index 8fd62fdc775d..8fd62fdc775d 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t36/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t36/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t36/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t36/before/test.java
index 1cbff3a1272c..1cbff3a1272c 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t36/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t36/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t37/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t37/after/Test.items
index 26c064a26ffa..26c064a26ffa 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t37/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t37/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t37/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t37/after/test.java
index 032dc398e040..032dc398e040 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t37/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t37/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t37/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t37/before/test.java
index 2cc80bd340ed..2cc80bd340ed 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t37/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t37/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t38/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t38/after/Test.items
index ce5df8ea5fcb..ce5df8ea5fcb 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t38/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t38/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t38/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t38/after/test.java
index 7ef08a9041c0..7ef08a9041c0 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t38/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t38/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t38/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t38/before/test.java
index 7ef08a9041c0..7ef08a9041c0 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t38/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t38/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t39/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t39/after/Test.items
index 3c746805c0f1..3c746805c0f1 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t39/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t39/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t39/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t39/after/test.java
index 0b59f99cc084..0b59f99cc084 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t39/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t39/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t39/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t39/before/test.java
index 7ef08a9041c0..7ef08a9041c0 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t39/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t39/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t40/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t40/after/Test.items
index 2aff3bd8c623..2aff3bd8c623 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t40/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t40/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t40/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t40/after/test.java
index 83cae108fdd9..83cae108fdd9 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t40/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t40/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t40/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t40/before/test.java
index dd72766db414..dd72766db414 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t40/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t40/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t41/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t41/after/Test.items
index 583812d7778b..583812d7778b 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t41/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t41/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t41/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t41/after/test.java
index 3ac0475a9e96..3ac0475a9e96 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t41/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t41/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t41/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t41/before/test.java
index 8b8b5018717b..8b8b5018717b 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t41/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t41/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t42/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t42/after/Test.items
index d1417fa9ad32..d1417fa9ad32 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t42/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t42/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t42/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t42/after/test.java
index 0dd8c405b1d9..0dd8c405b1d9 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t42/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t42/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t42/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t42/before/test.java
index dd72766db414..dd72766db414 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t42/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t42/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t43/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t43/after/Test.items
index b1e94aa2143b..b1e94aa2143b 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t43/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t43/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t43/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t43/after/test.java
index c386bc247acd..c386bc247acd 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t43/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t43/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t43/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t43/before/test.java
index d7e1595d92bb..d7e1595d92bb 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t43/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t43/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t44/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t44/after/Test.items
index 3cae6713c3b0..3cae6713c3b0 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t44/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t44/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t44/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t44/after/test.java
index 60a560399b71..60a560399b71 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t44/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t44/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t44/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t44/before/test.java
index 4dee20b44e33..4dee20b44e33 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t44/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t44/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t45/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t45/after/Test.items
index c97169454693..c97169454693 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t45/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t45/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t45/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t45/after/test.java
index 45fcb1f6eb1f..45fcb1f6eb1f 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t45/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t45/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t45/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t45/before/test.java
index 4dee20b44e33..4dee20b44e33 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t45/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t45/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t46/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t46/after/Test.items
index 934d4a09ec3b..934d4a09ec3b 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t46/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t46/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t46/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t46/after/test.java
index f77f19689836..f77f19689836 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t46/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t46/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t46/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t46/before/test.java
index 5256726fdd95..5256726fdd95 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t46/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t46/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t47/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t47/after/Test.items
index d39a160ee9a7..d39a160ee9a7 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t47/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t47/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t47/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t47/after/test.java
index 99f4d773fd24..99f4d773fd24 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t47/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t47/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t47/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t47/before/test.java
index 308305e1cb41..308305e1cb41 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t47/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t47/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t48/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t48/after/Test.items
index fedb3311ad6b..fedb3311ad6b 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t48/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t48/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t48/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t48/after/test.java
index 60e1a9ddd8c7..60e1a9ddd8c7 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t48/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t48/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t48/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t48/before/test.java
index e859716610c8..e859716610c8 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t48/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t48/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t49/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t49/after/Test.items
index b65d6bce02d1..b65d6bce02d1 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t49/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t49/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t49/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t49/after/test.java
index 91c41afa26e2..91c41afa26e2 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t49/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t49/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t49/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t49/before/test.java
index 8a2a9a9054ce..8a2a9a9054ce 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t49/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t49/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t50/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t50/after/Test.items
index 895bdd4d4118..895bdd4d4118 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t50/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t50/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t50/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t50/after/test.java
index 50d5fb0229ca..50d5fb0229ca 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t50/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t50/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t50/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t50/before/test.java
index 05b20ee8b1fe..05b20ee8b1fe 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t50/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t50/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t51/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t51/after/Test.items
index 81f430c2e8ab..81f430c2e8ab 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t51/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t51/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t51/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t51/after/test.java
index bbd211f73928..bbd211f73928 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t51/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t51/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t51/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t51/before/test.java
index 7a9a090c342f..7a9a090c342f 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t51/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t51/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t52/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t52/after/Test.items
index fae3f5aa0b83..fae3f5aa0b83 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t52/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t52/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t52/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t52/after/test.java
index 034f9e2a7285..034f9e2a7285 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t52/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t52/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t52/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t52/before/test.java
index abf3b7a12aff..abf3b7a12aff 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t52/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t52/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t53/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t53/after/Test.items
index 6f10a470aef3..6f10a470aef3 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t53/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t53/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t53/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t53/after/test.java
index 52d1899803c8..52d1899803c8 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t53/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t53/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t53/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t53/before/test.java
index 50be5aada106..50be5aada106 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t53/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t53/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t54/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t54/after/Test.items
index 584021476055..584021476055 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t54/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t54/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t54/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t54/after/test.java
index 11cbc3fe7520..11cbc3fe7520 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t54/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t54/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t54/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t54/before/test.java
index 96573db084dd..96573db084dd 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t54/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t54/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t55/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t55/after/Test.items
index 465e20e4a213..465e20e4a213 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t55/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t55/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t55/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t55/after/test.java
index c895ff398fa6..c895ff398fa6 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t55/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t55/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t55/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t55/before/test.java
index 96573db084dd..96573db084dd 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t55/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t55/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t56/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t56/after/Test.items
index 05ed851f0ce0..05ed851f0ce0 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t56/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t56/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t56/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t56/after/test.java
index 2f5cc73acbbb..2f5cc73acbbb 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t56/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t56/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t56/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t56/before/test.java
index 0f9888806c18..0f9888806c18 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t56/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t56/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t57/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t57/after/Test.items
index af2ecf9c114e..af2ecf9c114e 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t57/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t57/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t57/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t57/after/test.java
index ce9df2fbb45d..ce9df2fbb45d 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t57/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t57/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t57/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t57/before/test.java
index 0f9888806c18..0f9888806c18 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t57/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t57/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t58/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t58/after/Test.items
index 19b07a44c139..19b07a44c139 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t58/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t58/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t58/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t58/after/test.java
index ff4055ac3129..ff4055ac3129 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t58/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t58/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t58/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t58/before/test.java
index 8df4d62d721a..8df4d62d721a 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t58/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t58/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t59/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t59/after/Test.items
index ea0dda8061b2..ea0dda8061b2 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t59/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t59/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t59/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t59/after/test.java
index 78a09afee42b..78a09afee42b 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t59/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t59/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t59/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t59/before/test.java
index 8df4d62d721a..8df4d62d721a 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t59/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t59/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t60/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t60/after/Test.items
index 88822343977c..88822343977c 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t60/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t60/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t60/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t60/after/test.java
index 9ab940eaf425..9ab940eaf425 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t60/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t60/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t60/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t60/before/test.java
index 26172c13d2e7..26172c13d2e7 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t60/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t60/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t61/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t61/after/Test.items
index 830074d65d6b..830074d65d6b 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t61/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t61/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t61/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t61/after/test.java
index 1b05fce5b5b9..1b05fce5b5b9 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t61/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t61/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t61/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t61/before/test.java
index e9f49f1c3846..e9f49f1c3846 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t61/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t61/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t62/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t62/after/Test.items
index 88822343977c..88822343977c 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t62/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t62/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t62/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t62/after/test.java
index 9ab940eaf425..9ab940eaf425 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t62/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t62/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t62/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t62/before/test.java
index 26172c13d2e7..26172c13d2e7 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t62/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t62/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t63/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t63/after/Test.items
index 69dcdaf945c5..69dcdaf945c5 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t63/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t63/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t63/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t63/after/test.java
index 9602f0b3d59f..9602f0b3d59f 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t63/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t63/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t63/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t63/before/test.java
index 26172c13d2e7..26172c13d2e7 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t63/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t63/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t64/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t64/after/Test.items
index 8ae72a21d857..8ae72a21d857 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t64/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t64/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t64/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t64/after/test.java
index 29f4004383eb..29f4004383eb 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t64/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t64/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t64/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t64/before/test.java
index 5583e3c06a5d..5583e3c06a5d 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t64/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t64/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t65/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t65/after/Test.items
index a1201587163f..a1201587163f 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t65/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t65/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t65/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t65/after/test.java
index 3532ce557f8c..3532ce557f8c 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t65/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t65/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t65/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t65/before/test.java
index 5583e3c06a5d..5583e3c06a5d 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t65/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t65/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t66/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t66/after/Test.items
index f8bf3a92ff7d..f8bf3a92ff7d 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t66/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t66/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t66/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t66/after/test.java
index 56608039cf5e..56608039cf5e 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t66/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t66/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t66/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t66/before/test.java
index 45ea51dddf11..45ea51dddf11 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t66/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t66/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t67/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t67/after/Test.items
index 0e5e72eb6f30..0e5e72eb6f30 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t67/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t67/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t67/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t67/after/test.java
index 8a4fda4a0fac..8a4fda4a0fac 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t67/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t67/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t67/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t67/before/test.java
index 57a1c5db091b..57a1c5db091b 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t67/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t67/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t68/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t68/after/Test.items
index e31709e870fb..e31709e870fb 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t68/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t68/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t68/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t68/after/test.java
index f9d9a9257c5d..f9d9a9257c5d 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t68/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t68/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t68/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t68/before/test.java
index 9f84d15cc993..9f84d15cc993 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t68/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t68/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t69/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t69/after/Test.items
index 6471629f221e..6471629f221e 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t69/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t69/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t69/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t69/after/test.java
index bba00df7f5ed..bba00df7f5ed 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t69/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t69/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t69/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t69/before/test.java
index 9f84d15cc993..9f84d15cc993 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t69/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t69/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t70/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t70/after/Test.items
index 9811dea4870e..9811dea4870e 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t70/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t70/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t70/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t70/after/test.java
index 7ef5f832a7d9..7ef5f832a7d9 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t70/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t70/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t70/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t70/before/test.java
index d98804a2576f..d98804a2576f 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t70/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t70/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t71/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t71/after/Test.items
index f65db392b622..f65db392b622 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t71/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t71/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t71/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t71/after/test.java
index be0143bbaafb..be0143bbaafb 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t71/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t71/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t71/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t71/before/test.java
index e3c0a3aecee2..e3c0a3aecee2 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t71/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t71/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t72/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t72/after/Test.items
index cacd1729289d..cacd1729289d 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t72/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t72/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t72/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t72/after/test.java
index ace9fbcc92a8..ace9fbcc92a8 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t72/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t72/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t72/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t72/before/test.java
index e3c0a3aecee2..e3c0a3aecee2 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t72/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t72/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t73/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t73/after/Test.items
index f46b39d67281..f46b39d67281 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t73/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t73/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t73/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t73/after/test.java
index da9d9b2e6fe8..da9d9b2e6fe8 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t73/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t73/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t73/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t73/before/test.java
index b07764b2c29f..b07764b2c29f 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t73/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t73/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t74/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t74/after/Test.items
index 236f769a7b98..236f769a7b98 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t74/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t74/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t74/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t74/after/test.java
index 25d776d7d8c6..25d776d7d8c6 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t74/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t74/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t74/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t74/before/test.java
index c6e83eedc1bd..c6e83eedc1bd 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t74/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t74/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t75/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t75/after/Test.items
index 9c3eb7b369e3..9c3eb7b369e3 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t75/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t75/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t75/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t75/after/test.java
index 750c3d1d51a4..750c3d1d51a4 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t75/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t75/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t75/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t75/before/test.java
index fdde94165b43..fdde94165b43 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t75/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t75/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t76/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t76/after/Test.items
index 7a2163c3200b..7a2163c3200b 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t76/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t76/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t76/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t76/after/test.java
index 3e6b69cf7c94..3e6b69cf7c94 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t76/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t76/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t76/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t76/before/test.java
index fdde94165b43..fdde94165b43 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t76/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t76/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t77/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t77/after/Test.items
index dc0f44202f9b..dc0f44202f9b 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t77/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t77/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t77/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t77/after/test.java
index 4e8733a49d43..4e8733a49d43 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t77/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t77/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t77/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t77/before/test.java
index 252a45c4acc5..252a45c4acc5 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t77/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t77/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t78/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t78/after/Test.items
index f935ec3be774..f935ec3be774 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t78/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t78/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t78/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t78/after/test.java
index 573deb573d11..573deb573d11 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t78/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t78/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t78/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t78/before/test.java
index 252a45c4acc5..252a45c4acc5 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t78/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t78/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t79/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t79/after/Test.items
index 9e7dba8b794e..9e7dba8b794e 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t79/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t79/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t79/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t79/after/test.java
index 37ec2cb0f5fd..37ec2cb0f5fd 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t79/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t79/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t79/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t79/before/test.java
index 30db2da5fa91..30db2da5fa91 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t79/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t79/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t80/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t80/after/Test.items
index 55661712f811..55661712f811 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t80/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t80/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t80/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t80/after/test.java
index 5fe4738b6a5e..5fe4738b6a5e 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t80/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t80/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t80/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t80/before/test.java
index 30db2da5fa91..30db2da5fa91 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t80/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t80/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t81/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t81/after/Test.items
index f89012c7c140..f89012c7c140 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t81/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t81/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t81/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t81/after/test.java
index 55deae9424fa..55deae9424fa 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t81/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t81/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t81/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t81/before/test.java
index 8bccf86ced7b..8bccf86ced7b 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t81/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t81/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t82/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t82/after/Test.items
index 5164a4b2f6d9..5164a4b2f6d9 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t82/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t82/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t82/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t82/after/test.java
index 83b747a3cb27..83b747a3cb27 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t82/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t82/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t82/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t82/before/test.java
index cb617f44766f..cb617f44766f 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t82/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t82/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t83/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t83/after/Test.items
index 9f0dab259a44..9f0dab259a44 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t83/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t83/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t83/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t83/after/test.java
index 2a6715c81d3f..2a6715c81d3f 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t83/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t83/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t83/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t83/before/test.java
index 30db2da5fa91..30db2da5fa91 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t83/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t83/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t84/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t84/after/Test.items
index 5f64399bef41..5f64399bef41 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t84/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t84/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t84/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t84/after/test.java
index b055ef3a4df9..b055ef3a4df9 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t84/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t84/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t84/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t84/before/test.java
index 7c85f93d7a57..7c85f93d7a57 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t84/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t84/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t85/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t85/after/Test.items
index 76d7b14baa5d..76d7b14baa5d 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t85/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t85/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t85/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t85/after/test.java
index c43a426e5277..c43a426e5277 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t85/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t85/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t85/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t85/before/test.java
index adde8623a884..adde8623a884 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t85/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t85/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t86/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t86/after/Test.items
index c2f8f1dd9fa6..c2f8f1dd9fa6 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t86/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t86/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t86/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t86/after/test.java
index 25f8b851603d..25f8b851603d 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t86/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t86/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t86/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t86/before/test.java
index 880c69463055..880c69463055 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t86/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t86/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t87/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t87/after/Test.items
index 45193ce9dcf4..45193ce9dcf4 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t87/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t87/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t87/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t87/after/test.java
index f0e5159bfcfd..f0e5159bfcfd 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t87/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t87/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t87/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t87/before/test.java
index 12a28fa3084c..12a28fa3084c 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t87/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t87/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t88/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t88/after/Test.items
index 60ae50f9c699..60ae50f9c699 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t88/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t88/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t88/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t88/after/test.java
index 4be724c5d907..4be724c5d907 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t88/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t88/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t88/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t88/before/test.java
index ce19bd33f20e..ce19bd33f20e 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t88/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t88/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t89/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t89/after/Test.items
index 069dfb76e5c3..069dfb76e5c3 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t89/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t89/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t89/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t89/after/test.java
index 5a625c53c286..5a625c53c286 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t89/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t89/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t89/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t89/before/test.java
index c12161d8c76d..c12161d8c76d 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t89/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t89/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t90/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t90/after/Test.items
index 721469c186fa..721469c186fa 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t90/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t90/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t90/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t90/after/test.java
index 06c072088b02..06c072088b02 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t90/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t90/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t90/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t90/before/test.java
index 80afdc6aa08b..80afdc6aa08b 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t90/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t90/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t91/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t91/after/Test.items
index 9b53aeaf2084..9b53aeaf2084 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t91/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t91/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t91/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t91/after/test.java
index 9575d720b844..9575d720b844 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t91/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t91/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t91/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t91/before/test.java
index e916bd0a5dab..e916bd0a5dab 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t91/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t91/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t92/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t92/after/Test.items
index bf241c7966a7..bf241c7966a7 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t92/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t92/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t92/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t92/after/test.java
index f70bc9515dea..f70bc9515dea 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t92/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t92/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t92/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t92/before/test.java
index 89ae1f7d3101..89ae1f7d3101 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t92/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t92/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t93/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t93/after/Test.items
index ea2fc9440478..ea2fc9440478 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t93/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t93/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t93/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t93/after/test.java
index 6b714f8e8862..6b714f8e8862 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t93/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t93/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t93/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t93/before/test.java
index 292b5f9f0361..292b5f9f0361 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t93/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t93/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t94/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t94/after/Test.items
index 76ae2a02000b..76ae2a02000b 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t94/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t94/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t94/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t94/after/test.java
index d8df3e65dd43..d8df3e65dd43 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t94/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t94/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t94/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t94/before/test.java
index 99bf050d6f00..99bf050d6f00 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t94/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t94/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t95/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t95/after/Test.items
index d3f8033938ea..d3f8033938ea 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t95/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t95/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t95/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t95/after/test.java
index 99bf050d6f00..99bf050d6f00 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t95/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t95/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t95/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t95/before/test.java
index d8df3e65dd43..d8df3e65dd43 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t95/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t95/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t96/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t96/after/Test.items
index d107b7626a41..d107b7626a41 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t96/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t96/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t96/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t96/after/test.java
index 25357fd46118..25357fd46118 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t96/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t96/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t96/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t96/before/test.java
index 55d7110ccb83..55d7110ccb83 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t96/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t96/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t97/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t97/after/Test.items
index 1d376856a7ac..1d376856a7ac 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t97/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t97/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t97/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t97/after/test.java
index 61687e78d725..61687e78d725 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t97/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t97/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t97/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t97/before/test.java
index f33899c2c3d7..f33899c2c3d7 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t97/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t97/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t98/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t98/after/Test.items
index 9b5e0b6b54e9..9b5e0b6b54e9 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t98/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t98/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t98/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t98/after/test.java
index 86e1e0b4f6c2..86e1e0b4f6c2 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t98/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t98/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t98/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t98/before/test.java
index b79f9495d4ac..b79f9495d4ac 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t98/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t98/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t99/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/t99/after/Test.items
index 93ca5aa6a01e..93ca5aa6a01e 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t99/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/t99/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t99/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/t99/after/test.java
index 1f7b49a490d9..1f7b49a490d9 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t99/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t99/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/t99/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/t99/before/test.java
index 7ae6a2b492ba..7ae6a2b492ba 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/t99/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/t99/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/typeAnno/after/Test.items b/java/typeMigration/testData/refactoring/typeMigration/typeAnno/after/Test.items
index ab263cc2b7a6..ab263cc2b7a6 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/typeAnno/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigration/typeAnno/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/typeAnno/after/test.java b/java/typeMigration/testData/refactoring/typeMigration/typeAnno/after/test.java
index 7d25d562b91d..7d25d562b91d 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/typeAnno/after/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/typeAnno/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigration/typeAnno/before/test.java b/java/typeMigration/testData/refactoring/typeMigration/typeAnno/before/test.java
index 6cc51471d8d8..6cc51471d8d8 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigration/typeAnno/before/test.java
+++ b/java/typeMigration/testData/refactoring/typeMigration/typeAnno/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/directAssignments/after/Test.items b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/directAssignments/after/Test.items
index 9d1b1894378f..9d1b1894378f 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/directAssignments/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/directAssignments/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/directAssignments/after/Test.java b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/directAssignments/after/Test.java
index 5c16607a8b70..5c16607a8b70 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/directAssignments/after/Test.java
+++ b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/directAssignments/after/Test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/directAssignments/before/Test.java b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/directAssignments/before/Test.java
index b96f02057dfd..b96f02057dfd 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/directAssignments/before/Test.java
+++ b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/directAssignments/before/Test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/directByte/after/Test.items b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/directByte/after/Test.items
index e0e121ecf00d..e0e121ecf00d 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/directByte/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/directByte/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/directByte/after/Test.java b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/directByte/after/Test.java
index a1dbfc714326..a1dbfc714326 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/directByte/after/Test.java
+++ b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/directByte/after/Test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/directByte/before/Test.java b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/directByte/before/Test.java
index fa494c28a3c4..fa494c28a3c4 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/directByte/before/Test.java
+++ b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/directByte/before/Test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/directConditions/after/Test.items b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/directConditions/after/Test.items
index 95f366691485..95f366691485 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/directConditions/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/directConditions/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/directConditions/after/Test.java b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/directConditions/after/Test.java
index 02fc40276a86..02fc40276a86 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/directConditions/after/Test.java
+++ b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/directConditions/after/Test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/directConditions/before/Test.java b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/directConditions/before/Test.java
index ef5413600c40..ef5413600c40 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/directConditions/before/Test.java
+++ b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/directConditions/before/Test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/directForeach/after/Test.items b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/directForeach/after/Test.items
index add3ea1f98e3..add3ea1f98e3 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/directForeach/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/directForeach/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/directForeach/after/Test.java b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/directForeach/after/Test.java
index 4db9a5619849..4db9a5619849 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/directForeach/after/Test.java
+++ b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/directForeach/after/Test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/directForeach/before/Test.java b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/directForeach/before/Test.java
index 1d40f4082444..1d40f4082444 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/directForeach/before/Test.java
+++ b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/directForeach/before/Test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/directIncrementDecrement/after/Test.items b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/directIncrementDecrement/after/Test.items
index 852aa470a285..852aa470a285 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/directIncrementDecrement/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/directIncrementDecrement/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/directIncrementDecrement/after/Test.java b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/directIncrementDecrement/after/Test.java
index bdcf7171016b..bdcf7171016b 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/directIncrementDecrement/after/Test.java
+++ b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/directIncrementDecrement/after/Test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/directIncrementDecrement/before/Test.java b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/directIncrementDecrement/before/Test.java
index be6aa55d5f29..be6aa55d5f29 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/directIncrementDecrement/before/Test.java
+++ b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/directIncrementDecrement/before/Test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/directIntArray/after/Test.items b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/directIntArray/after/Test.items
index 69a66c34a6cb..69a66c34a6cb 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/directIntArray/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/directIntArray/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/directIntArray/after/Test.java b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/directIntArray/after/Test.java
index 8dbba12048fe..8dbba12048fe 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/directIntArray/after/Test.java
+++ b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/directIntArray/after/Test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/directIntArray/before/Test.java b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/directIntArray/before/Test.java
index 5d39cf2963c6..5d39cf2963c6 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/directIntArray/before/Test.java
+++ b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/directIntArray/before/Test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/directString/after/Test.items b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/directString/after/Test.items
index 0d306b0b4747..0d306b0b4747 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/directString/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/directString/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/directString/after/Test.java b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/directString/after/Test.java
index cb32e0ba130b..cb32e0ba130b 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/directString/after/Test.java
+++ b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/directString/after/Test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/directString/before/Test.java b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/directString/before/Test.java
index 1770416a0295..1770416a0295 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/directString/before/Test.java
+++ b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/directString/before/Test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/directStringArray/after/Test.items b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/directStringArray/after/Test.items
index b90b4a347f40..b90b4a347f40 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/directStringArray/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/directStringArray/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/directStringArray/after/Test.java b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/directStringArray/after/Test.java
index 42415d0c3141..42415d0c3141 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/directStringArray/after/Test.java
+++ b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/directStringArray/after/Test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/directStringArray/before/Test.java b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/directStringArray/before/Test.java
index 4f19feba6479..4f19feba6479 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/directStringArray/before/Test.java
+++ b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/directStringArray/before/Test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseAssignments/after/Test.items b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseAssignments/after/Test.items
index 767993764c48..767993764c48 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseAssignments/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseAssignments/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseAssignments/after/Test.java b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseAssignments/after/Test.java
index 1372ccee2b27..1372ccee2b27 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseAssignments/after/Test.java
+++ b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseAssignments/after/Test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseAssignments/before/Test.java b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseAssignments/before/Test.java
index cfd312daa073..cfd312daa073 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseAssignments/before/Test.java
+++ b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseAssignments/before/Test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseByte/after/Test.items b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseByte/after/Test.items
index 8585bda9e020..8585bda9e020 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseByte/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseByte/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseByte/after/Test.java b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseByte/after/Test.java
index 28445dd31728..28445dd31728 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseByte/after/Test.java
+++ b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseByte/after/Test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseByte/before/Test.java b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseByte/before/Test.java
index a1dbfc714326..a1dbfc714326 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseByte/before/Test.java
+++ b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseByte/before/Test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseConditions/after/Test.items b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseConditions/after/Test.items
index 3594508bebe5..3594508bebe5 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseConditions/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseConditions/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseConditions/after/Test.java b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseConditions/after/Test.java
index 92f515c35936..92f515c35936 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseConditions/after/Test.java
+++ b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseConditions/after/Test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseConditions/before/Test.java b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseConditions/before/Test.java
index 5464f705ddeb..5464f705ddeb 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseConditions/before/Test.java
+++ b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseConditions/before/Test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseIncrementDecrement/after/Test.items b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseIncrementDecrement/after/Test.items
index cba5bc10f359..cba5bc10f359 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseIncrementDecrement/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseIncrementDecrement/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseIncrementDecrement/after/Test.java b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseIncrementDecrement/after/Test.java
index dd70e550a751..dd70e550a751 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseIncrementDecrement/after/Test.java
+++ b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseIncrementDecrement/after/Test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseIncrementDecrement/before/Test.java b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseIncrementDecrement/before/Test.java
index 853e5387aca9..853e5387aca9 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseIncrementDecrement/before/Test.java
+++ b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseIncrementDecrement/before/Test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseIntArray/after/Test.items b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseIntArray/after/Test.items
index 55c1c7bc2574..55c1c7bc2574 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseIntArray/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseIntArray/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseIntArray/after/Test.java b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseIntArray/after/Test.java
index 401714230d3c..401714230d3c 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseIntArray/after/Test.java
+++ b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseIntArray/after/Test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseIntArray/before/Test.java b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseIntArray/before/Test.java
index df31528b9d7e..df31528b9d7e 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseIntArray/before/Test.java
+++ b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseIntArray/before/Test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseString/after/Test.items b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseString/after/Test.items
index 7c23d49d8bfd..7c23d49d8bfd 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseString/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseString/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseString/after/Test.java b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseString/after/Test.java
index a0106ff8d66f..a0106ff8d66f 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseString/after/Test.java
+++ b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseString/after/Test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseString/before/Test.java b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseString/before/Test.java
index cb32e0ba130b..cb32e0ba130b 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseString/before/Test.java
+++ b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseString/before/Test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseStringArray/after/Test.items b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseStringArray/after/Test.items
index eaf82b5cc2e6..eaf82b5cc2e6 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseStringArray/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseStringArray/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseStringArray/after/Test.java b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseStringArray/after/Test.java
index 0c64ea445f01..0c64ea445f01 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseStringArray/after/Test.java
+++ b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseStringArray/after/Test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseStringArray/before/Test.java b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseStringArray/before/Test.java
index fbc97bc2eb36..fbc97bc2eb36 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseStringArray/before/Test.java
+++ b/java/typeMigration/testData/refactoring/typeMigrationByAtomic/reverseStringArray/before/Test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigrationByThreadLocal/directByte/after/Test.items b/java/typeMigration/testData/refactoring/typeMigrationByThreadLocal/directByte/after/Test.items
index e01b4b5e1f8b..e01b4b5e1f8b 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigrationByThreadLocal/directByte/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigrationByThreadLocal/directByte/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigrationByThreadLocal/directByte/after/Test.java b/java/typeMigration/testData/refactoring/typeMigrationByThreadLocal/directByte/after/Test.java
index 61b88dbefceb..61b88dbefceb 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigrationByThreadLocal/directByte/after/Test.java
+++ b/java/typeMigration/testData/refactoring/typeMigrationByThreadLocal/directByte/after/Test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigrationByThreadLocal/directByte/before/Test.java b/java/typeMigration/testData/refactoring/typeMigrationByThreadLocal/directByte/before/Test.java
index dd3fb1bca60d..dd3fb1bca60d 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigrationByThreadLocal/directByte/before/Test.java
+++ b/java/typeMigration/testData/refactoring/typeMigrationByThreadLocal/directByte/before/Test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigrationByThreadLocal/directInt/after/Test.items b/java/typeMigration/testData/refactoring/typeMigrationByThreadLocal/directInt/after/Test.items
index 1bffd7037cb6..1bffd7037cb6 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigrationByThreadLocal/directInt/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigrationByThreadLocal/directInt/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigrationByThreadLocal/directInt/after/Test.java b/java/typeMigration/testData/refactoring/typeMigrationByThreadLocal/directInt/after/Test.java
index 627739bc4b1c..627739bc4b1c 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigrationByThreadLocal/directInt/after/Test.java
+++ b/java/typeMigration/testData/refactoring/typeMigrationByThreadLocal/directInt/after/Test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigrationByThreadLocal/directInt/before/Test.java b/java/typeMigration/testData/refactoring/typeMigrationByThreadLocal/directInt/before/Test.java
index 9039f28e9617..9039f28e9617 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigrationByThreadLocal/directInt/before/Test.java
+++ b/java/typeMigration/testData/refactoring/typeMigrationByThreadLocal/directInt/before/Test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigrationByThreadLocal/directString/after/Test.items b/java/typeMigration/testData/refactoring/typeMigrationByThreadLocal/directString/after/Test.items
index 29d4312a8580..29d4312a8580 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigrationByThreadLocal/directString/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigrationByThreadLocal/directString/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigrationByThreadLocal/directString/after/Test.java b/java/typeMigration/testData/refactoring/typeMigrationByThreadLocal/directString/after/Test.java
index 949869096327..949869096327 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigrationByThreadLocal/directString/after/Test.java
+++ b/java/typeMigration/testData/refactoring/typeMigrationByThreadLocal/directString/after/Test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigrationByThreadLocal/directString/before/Test.java b/java/typeMigration/testData/refactoring/typeMigrationByThreadLocal/directString/before/Test.java
index 8ee02790f113..8ee02790f113 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigrationByThreadLocal/directString/before/Test.java
+++ b/java/typeMigration/testData/refactoring/typeMigrationByThreadLocal/directString/before/Test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigrationByThreadLocal/languageLevel/after/Test.items b/java/typeMigration/testData/refactoring/typeMigrationByThreadLocal/languageLevel/after/Test.items
index 09a2a211ae6a..09a2a211ae6a 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigrationByThreadLocal/languageLevel/after/Test.items
+++ b/java/typeMigration/testData/refactoring/typeMigrationByThreadLocal/languageLevel/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/typeMigrationByThreadLocal/languageLevel/after/Test.java b/java/typeMigration/testData/refactoring/typeMigrationByThreadLocal/languageLevel/after/Test.java
index 81e5fe05d6dd..81e5fe05d6dd 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigrationByThreadLocal/languageLevel/after/Test.java
+++ b/java/typeMigration/testData/refactoring/typeMigrationByThreadLocal/languageLevel/after/Test.java
diff --git a/plugins/typeMigration/testData/refactoring/typeMigrationByThreadLocal/languageLevel/before/Test.java b/java/typeMigration/testData/refactoring/typeMigrationByThreadLocal/languageLevel/before/Test.java
index 9039f28e9617..9039f28e9617 100644
--- a/plugins/typeMigration/testData/refactoring/typeMigrationByThreadLocal/languageLevel/before/Test.java
+++ b/java/typeMigration/testData/refactoring/typeMigrationByThreadLocal/languageLevel/before/Test.java
diff --git a/plugins/typeMigration/testData/refactoring/wildcard/assignmentExtends/after/Test.items b/java/typeMigration/testData/refactoring/wildcard/assignmentExtends/after/Test.items
index b39d716277ba..b39d716277ba 100644
--- a/plugins/typeMigration/testData/refactoring/wildcard/assignmentExtends/after/Test.items
+++ b/java/typeMigration/testData/refactoring/wildcard/assignmentExtends/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/wildcard/assignmentExtends/after/test.java b/java/typeMigration/testData/refactoring/wildcard/assignmentExtends/after/test.java
index 16a620ef2e6d..16a620ef2e6d 100644
--- a/plugins/typeMigration/testData/refactoring/wildcard/assignmentExtends/after/test.java
+++ b/java/typeMigration/testData/refactoring/wildcard/assignmentExtends/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/wildcard/assignmentExtends/before/test.java b/java/typeMigration/testData/refactoring/wildcard/assignmentExtends/before/test.java
index 4a148c3bd6fe..4a148c3bd6fe 100644
--- a/plugins/typeMigration/testData/refactoring/wildcard/assignmentExtends/before/test.java
+++ b/java/typeMigration/testData/refactoring/wildcard/assignmentExtends/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/wildcard/assignmentSuper/after/Test.items b/java/typeMigration/testData/refactoring/wildcard/assignmentSuper/after/Test.items
index 8ee86c529545..8ee86c529545 100644
--- a/plugins/typeMigration/testData/refactoring/wildcard/assignmentSuper/after/Test.items
+++ b/java/typeMigration/testData/refactoring/wildcard/assignmentSuper/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/wildcard/assignmentSuper/after/test.java b/java/typeMigration/testData/refactoring/wildcard/assignmentSuper/after/test.java
index 25cab7a9d34c..25cab7a9d34c 100644
--- a/plugins/typeMigration/testData/refactoring/wildcard/assignmentSuper/after/test.java
+++ b/java/typeMigration/testData/refactoring/wildcard/assignmentSuper/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/wildcard/assignmentSuper/before/test.java b/java/typeMigration/testData/refactoring/wildcard/assignmentSuper/before/test.java
index 4a148c3bd6fe..4a148c3bd6fe 100644
--- a/plugins/typeMigration/testData/refactoring/wildcard/assignmentSuper/before/test.java
+++ b/java/typeMigration/testData/refactoring/wildcard/assignmentSuper/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/wildcard/assignmentUnbounded/after/Test.items b/java/typeMigration/testData/refactoring/wildcard/assignmentUnbounded/after/Test.items
index e2bbfc48b834..e2bbfc48b834 100644
--- a/plugins/typeMigration/testData/refactoring/wildcard/assignmentUnbounded/after/Test.items
+++ b/java/typeMigration/testData/refactoring/wildcard/assignmentUnbounded/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/wildcard/assignmentUnbounded/after/test.java b/java/typeMigration/testData/refactoring/wildcard/assignmentUnbounded/after/test.java
index 4804293a696e..4804293a696e 100644
--- a/plugins/typeMigration/testData/refactoring/wildcard/assignmentUnbounded/after/test.java
+++ b/java/typeMigration/testData/refactoring/wildcard/assignmentUnbounded/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/wildcard/assignmentUnbounded/before/test.java b/java/typeMigration/testData/refactoring/wildcard/assignmentUnbounded/before/test.java
index 4a148c3bd6fe..4a148c3bd6fe 100644
--- a/plugins/typeMigration/testData/refactoring/wildcard/assignmentUnbounded/before/test.java
+++ b/java/typeMigration/testData/refactoring/wildcard/assignmentUnbounded/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/wildcard/consumerExtends/after/Test.items b/java/typeMigration/testData/refactoring/wildcard/consumerExtends/after/Test.items
index 455ebca21125..455ebca21125 100644
--- a/plugins/typeMigration/testData/refactoring/wildcard/consumerExtends/after/Test.items
+++ b/java/typeMigration/testData/refactoring/wildcard/consumerExtends/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/wildcard/consumerExtends/after/test.java b/java/typeMigration/testData/refactoring/wildcard/consumerExtends/after/test.java
index b403162051ad..b403162051ad 100644
--- a/plugins/typeMigration/testData/refactoring/wildcard/consumerExtends/after/test.java
+++ b/java/typeMigration/testData/refactoring/wildcard/consumerExtends/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/wildcard/consumerExtends/before/test.java b/java/typeMigration/testData/refactoring/wildcard/consumerExtends/before/test.java
index 649da301cc82..649da301cc82 100644
--- a/plugins/typeMigration/testData/refactoring/wildcard/consumerExtends/before/test.java
+++ b/java/typeMigration/testData/refactoring/wildcard/consumerExtends/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/wildcard/consumerSuper/after/Test.items b/java/typeMigration/testData/refactoring/wildcard/consumerSuper/after/Test.items
index e4f5c3fc2088..e4f5c3fc2088 100644
--- a/plugins/typeMigration/testData/refactoring/wildcard/consumerSuper/after/Test.items
+++ b/java/typeMigration/testData/refactoring/wildcard/consumerSuper/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/wildcard/consumerSuper/after/test.java b/java/typeMigration/testData/refactoring/wildcard/consumerSuper/after/test.java
index 2c315ea3a723..2c315ea3a723 100644
--- a/plugins/typeMigration/testData/refactoring/wildcard/consumerSuper/after/test.java
+++ b/java/typeMigration/testData/refactoring/wildcard/consumerSuper/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/wildcard/consumerSuper/before/test.java b/java/typeMigration/testData/refactoring/wildcard/consumerSuper/before/test.java
index 649da301cc82..649da301cc82 100644
--- a/plugins/typeMigration/testData/refactoring/wildcard/consumerSuper/before/test.java
+++ b/java/typeMigration/testData/refactoring/wildcard/consumerSuper/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/wildcard/consumerUnbounded/after/Test.items b/java/typeMigration/testData/refactoring/wildcard/consumerUnbounded/after/Test.items
index a0b14b30985e..a0b14b30985e 100644
--- a/plugins/typeMigration/testData/refactoring/wildcard/consumerUnbounded/after/Test.items
+++ b/java/typeMigration/testData/refactoring/wildcard/consumerUnbounded/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/wildcard/consumerUnbounded/after/test.java b/java/typeMigration/testData/refactoring/wildcard/consumerUnbounded/after/test.java
index f10b5e2ae860..f10b5e2ae860 100644
--- a/plugins/typeMigration/testData/refactoring/wildcard/consumerUnbounded/after/test.java
+++ b/java/typeMigration/testData/refactoring/wildcard/consumerUnbounded/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/wildcard/consumerUnbounded/before/test.java b/java/typeMigration/testData/refactoring/wildcard/consumerUnbounded/before/test.java
index 649da301cc82..649da301cc82 100644
--- a/plugins/typeMigration/testData/refactoring/wildcard/consumerUnbounded/before/test.java
+++ b/java/typeMigration/testData/refactoring/wildcard/consumerUnbounded/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/wildcard/getAssignmentExtendsToChildType/after/Test.items b/java/typeMigration/testData/refactoring/wildcard/getAssignmentExtendsToChildType/after/Test.items
index 1ac8dc86d9ca..1ac8dc86d9ca 100644
--- a/plugins/typeMigration/testData/refactoring/wildcard/getAssignmentExtendsToChildType/after/Test.items
+++ b/java/typeMigration/testData/refactoring/wildcard/getAssignmentExtendsToChildType/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/wildcard/getAssignmentExtendsToChildType/after/test.java b/java/typeMigration/testData/refactoring/wildcard/getAssignmentExtendsToChildType/after/test.java
index bfe5eb68baba..bfe5eb68baba 100644
--- a/plugins/typeMigration/testData/refactoring/wildcard/getAssignmentExtendsToChildType/after/test.java
+++ b/java/typeMigration/testData/refactoring/wildcard/getAssignmentExtendsToChildType/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/wildcard/getAssignmentExtendsToChildType/before/test.java b/java/typeMigration/testData/refactoring/wildcard/getAssignmentExtendsToChildType/before/test.java
index bbddcc1a4d79..bbddcc1a4d79 100644
--- a/plugins/typeMigration/testData/refactoring/wildcard/getAssignmentExtendsToChildType/before/test.java
+++ b/java/typeMigration/testData/refactoring/wildcard/getAssignmentExtendsToChildType/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/wildcard/getAssignmentExtendsToSuperType/after/Test.items b/java/typeMigration/testData/refactoring/wildcard/getAssignmentExtendsToSuperType/after/Test.items
index a4ea13d41b29..a4ea13d41b29 100644
--- a/plugins/typeMigration/testData/refactoring/wildcard/getAssignmentExtendsToSuperType/after/Test.items
+++ b/java/typeMigration/testData/refactoring/wildcard/getAssignmentExtendsToSuperType/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/wildcard/getAssignmentExtendsToSuperType/after/test.java b/java/typeMigration/testData/refactoring/wildcard/getAssignmentExtendsToSuperType/after/test.java
index 96208756fe87..96208756fe87 100644
--- a/plugins/typeMigration/testData/refactoring/wildcard/getAssignmentExtendsToSuperType/after/test.java
+++ b/java/typeMigration/testData/refactoring/wildcard/getAssignmentExtendsToSuperType/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/wildcard/getAssignmentExtendsToSuperType/before/test.java b/java/typeMigration/testData/refactoring/wildcard/getAssignmentExtendsToSuperType/before/test.java
index bbddcc1a4d79..bbddcc1a4d79 100644
--- a/plugins/typeMigration/testData/refactoring/wildcard/getAssignmentExtendsToSuperType/before/test.java
+++ b/java/typeMigration/testData/refactoring/wildcard/getAssignmentExtendsToSuperType/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/wildcard/getAssignmentExtendsToType/after/Test.items b/java/typeMigration/testData/refactoring/wildcard/getAssignmentExtendsToType/after/Test.items
index a0fd8df506c4..a0fd8df506c4 100644
--- a/plugins/typeMigration/testData/refactoring/wildcard/getAssignmentExtendsToType/after/Test.items
+++ b/java/typeMigration/testData/refactoring/wildcard/getAssignmentExtendsToType/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/wildcard/getAssignmentExtendsToType/after/test.java b/java/typeMigration/testData/refactoring/wildcard/getAssignmentExtendsToType/after/test.java
index 33a962b96171..33a962b96171 100644
--- a/plugins/typeMigration/testData/refactoring/wildcard/getAssignmentExtendsToType/after/test.java
+++ b/java/typeMigration/testData/refactoring/wildcard/getAssignmentExtendsToType/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/wildcard/getAssignmentExtendsToType/before/test.java b/java/typeMigration/testData/refactoring/wildcard/getAssignmentExtendsToType/before/test.java
index bbddcc1a4d79..bbddcc1a4d79 100644
--- a/plugins/typeMigration/testData/refactoring/wildcard/getAssignmentExtendsToType/before/test.java
+++ b/java/typeMigration/testData/refactoring/wildcard/getAssignmentExtendsToType/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/wildcard/getExtends/after/Test.items b/java/typeMigration/testData/refactoring/wildcard/getExtends/after/Test.items
index d68b720f5d5b..d68b720f5d5b 100644
--- a/plugins/typeMigration/testData/refactoring/wildcard/getExtends/after/Test.items
+++ b/java/typeMigration/testData/refactoring/wildcard/getExtends/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/wildcard/getExtends/after/test.java b/java/typeMigration/testData/refactoring/wildcard/getExtends/after/test.java
index 529d4942a2ce..529d4942a2ce 100644
--- a/plugins/typeMigration/testData/refactoring/wildcard/getExtends/after/test.java
+++ b/java/typeMigration/testData/refactoring/wildcard/getExtends/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/wildcard/getExtends/before/test.java b/java/typeMigration/testData/refactoring/wildcard/getExtends/before/test.java
index 685d78f23f3d..685d78f23f3d 100644
--- a/plugins/typeMigration/testData/refactoring/wildcard/getExtends/before/test.java
+++ b/java/typeMigration/testData/refactoring/wildcard/getExtends/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/wildcard/getSuper/after/Test.items b/java/typeMigration/testData/refactoring/wildcard/getSuper/after/Test.items
index 5300a386dc23..5300a386dc23 100644
--- a/plugins/typeMigration/testData/refactoring/wildcard/getSuper/after/Test.items
+++ b/java/typeMigration/testData/refactoring/wildcard/getSuper/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/wildcard/getSuper/after/test.java b/java/typeMigration/testData/refactoring/wildcard/getSuper/after/test.java
index eebb4c1f2dbb..eebb4c1f2dbb 100644
--- a/plugins/typeMigration/testData/refactoring/wildcard/getSuper/after/test.java
+++ b/java/typeMigration/testData/refactoring/wildcard/getSuper/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/wildcard/getSuper/before/test.java b/java/typeMigration/testData/refactoring/wildcard/getSuper/before/test.java
index 685d78f23f3d..685d78f23f3d 100644
--- a/plugins/typeMigration/testData/refactoring/wildcard/getSuper/before/test.java
+++ b/java/typeMigration/testData/refactoring/wildcard/getSuper/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/wildcard/getUnbounded/after/Test.items b/java/typeMigration/testData/refactoring/wildcard/getUnbounded/after/Test.items
index e2bbfc48b834..e2bbfc48b834 100644
--- a/plugins/typeMigration/testData/refactoring/wildcard/getUnbounded/after/Test.items
+++ b/java/typeMigration/testData/refactoring/wildcard/getUnbounded/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/wildcard/getUnbounded/after/test.java b/java/typeMigration/testData/refactoring/wildcard/getUnbounded/after/test.java
index 9ab43aa01dbe..9ab43aa01dbe 100644
--- a/plugins/typeMigration/testData/refactoring/wildcard/getUnbounded/after/test.java
+++ b/java/typeMigration/testData/refactoring/wildcard/getUnbounded/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/wildcard/getUnbounded/before/test.java b/java/typeMigration/testData/refactoring/wildcard/getUnbounded/before/test.java
index 685d78f23f3d..685d78f23f3d 100644
--- a/plugins/typeMigration/testData/refactoring/wildcard/getUnbounded/before/test.java
+++ b/java/typeMigration/testData/refactoring/wildcard/getUnbounded/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/wildcard/lengthSize/after/Test.items b/java/typeMigration/testData/refactoring/wildcard/lengthSize/after/Test.items
index bf63b11ab5b2..bf63b11ab5b2 100644
--- a/plugins/typeMigration/testData/refactoring/wildcard/lengthSize/after/Test.items
+++ b/java/typeMigration/testData/refactoring/wildcard/lengthSize/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/wildcard/lengthSize/after/test.java b/java/typeMigration/testData/refactoring/wildcard/lengthSize/after/test.java
index 4f0770adbfb5..4f0770adbfb5 100644
--- a/plugins/typeMigration/testData/refactoring/wildcard/lengthSize/after/test.java
+++ b/java/typeMigration/testData/refactoring/wildcard/lengthSize/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/wildcard/lengthSize/before/test.java b/java/typeMigration/testData/refactoring/wildcard/lengthSize/before/test.java
index e8758383dd0a..e8758383dd0a 100644
--- a/plugins/typeMigration/testData/refactoring/wildcard/lengthSize/before/test.java
+++ b/java/typeMigration/testData/refactoring/wildcard/lengthSize/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/wildcard/producerCollectionChanged/after/Test.items b/java/typeMigration/testData/refactoring/wildcard/producerCollectionChanged/after/Test.items
index fe9d55b37cda..fe9d55b37cda 100644
--- a/plugins/typeMigration/testData/refactoring/wildcard/producerCollectionChanged/after/Test.items
+++ b/java/typeMigration/testData/refactoring/wildcard/producerCollectionChanged/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/wildcard/producerCollectionChanged/after/test.java b/java/typeMigration/testData/refactoring/wildcard/producerCollectionChanged/after/test.java
index 25825f1f78c0..25825f1f78c0 100644
--- a/plugins/typeMigration/testData/refactoring/wildcard/producerCollectionChanged/after/test.java
+++ b/java/typeMigration/testData/refactoring/wildcard/producerCollectionChanged/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/wildcard/producerCollectionChanged/before/test.java b/java/typeMigration/testData/refactoring/wildcard/producerCollectionChanged/before/test.java
index d8cf544f6fde..d8cf544f6fde 100644
--- a/plugins/typeMigration/testData/refactoring/wildcard/producerCollectionChanged/before/test.java
+++ b/java/typeMigration/testData/refactoring/wildcard/producerCollectionChanged/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/wildcard/producerExtends/after/Test.items b/java/typeMigration/testData/refactoring/wildcard/producerExtends/after/Test.items
index 8b996f4d00e1..8b996f4d00e1 100644
--- a/plugins/typeMigration/testData/refactoring/wildcard/producerExtends/after/Test.items
+++ b/java/typeMigration/testData/refactoring/wildcard/producerExtends/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/wildcard/producerExtends/after/test.java b/java/typeMigration/testData/refactoring/wildcard/producerExtends/after/test.java
index f8f4f761d73a..f8f4f761d73a 100644
--- a/plugins/typeMigration/testData/refactoring/wildcard/producerExtends/after/test.java
+++ b/java/typeMigration/testData/refactoring/wildcard/producerExtends/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/wildcard/producerExtends/before/test.java b/java/typeMigration/testData/refactoring/wildcard/producerExtends/before/test.java
index b5e9a24ad373..b5e9a24ad373 100644
--- a/plugins/typeMigration/testData/refactoring/wildcard/producerExtends/before/test.java
+++ b/java/typeMigration/testData/refactoring/wildcard/producerExtends/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/wildcard/producerExtendsCollectionChanged/after/Test.items b/java/typeMigration/testData/refactoring/wildcard/producerExtendsCollectionChanged/after/Test.items
index 88976428ea99..88976428ea99 100644
--- a/plugins/typeMigration/testData/refactoring/wildcard/producerExtendsCollectionChanged/after/Test.items
+++ b/java/typeMigration/testData/refactoring/wildcard/producerExtendsCollectionChanged/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/wildcard/producerExtendsCollectionChanged/after/test.java b/java/typeMigration/testData/refactoring/wildcard/producerExtendsCollectionChanged/after/test.java
index 0c24d5791d14..0c24d5791d14 100644
--- a/plugins/typeMigration/testData/refactoring/wildcard/producerExtendsCollectionChanged/after/test.java
+++ b/java/typeMigration/testData/refactoring/wildcard/producerExtendsCollectionChanged/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/wildcard/producerExtendsCollectionChanged/before/test.java b/java/typeMigration/testData/refactoring/wildcard/producerExtendsCollectionChanged/before/test.java
index d8cf544f6fde..d8cf544f6fde 100644
--- a/plugins/typeMigration/testData/refactoring/wildcard/producerExtendsCollectionChanged/before/test.java
+++ b/java/typeMigration/testData/refactoring/wildcard/producerExtendsCollectionChanged/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/wildcard/producerExtendsFailToStopAtWildcard/after/Test.items b/java/typeMigration/testData/refactoring/wildcard/producerExtendsFailToStopAtWildcard/after/Test.items
index f2f5bb75a60f..f2f5bb75a60f 100644
--- a/plugins/typeMigration/testData/refactoring/wildcard/producerExtendsFailToStopAtWildcard/after/Test.items
+++ b/java/typeMigration/testData/refactoring/wildcard/producerExtendsFailToStopAtWildcard/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/wildcard/producerExtendsFailToStopAtWildcard/after/test.java b/java/typeMigration/testData/refactoring/wildcard/producerExtendsFailToStopAtWildcard/after/test.java
index 5d4d6fda25a2..5d4d6fda25a2 100644
--- a/plugins/typeMigration/testData/refactoring/wildcard/producerExtendsFailToStopAtWildcard/after/test.java
+++ b/java/typeMigration/testData/refactoring/wildcard/producerExtendsFailToStopAtWildcard/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/wildcard/producerExtendsFailToStopAtWildcard/before/test.java b/java/typeMigration/testData/refactoring/wildcard/producerExtendsFailToStopAtWildcard/before/test.java
index a2e2cb2ae329..a2e2cb2ae329 100644
--- a/plugins/typeMigration/testData/refactoring/wildcard/producerExtendsFailToStopAtWildcard/before/test.java
+++ b/java/typeMigration/testData/refactoring/wildcard/producerExtendsFailToStopAtWildcard/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/wildcard/producerFailToStopAtWildcard/after/Test.items b/java/typeMigration/testData/refactoring/wildcard/producerFailToStopAtWildcard/after/Test.items
index 9d9b2e2a447f..9d9b2e2a447f 100644
--- a/plugins/typeMigration/testData/refactoring/wildcard/producerFailToStopAtWildcard/after/Test.items
+++ b/java/typeMigration/testData/refactoring/wildcard/producerFailToStopAtWildcard/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/wildcard/producerFailToStopAtWildcard/after/test.java b/java/typeMigration/testData/refactoring/wildcard/producerFailToStopAtWildcard/after/test.java
index bbc30114137e..bbc30114137e 100644
--- a/plugins/typeMigration/testData/refactoring/wildcard/producerFailToStopAtWildcard/after/test.java
+++ b/java/typeMigration/testData/refactoring/wildcard/producerFailToStopAtWildcard/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/wildcard/producerFailToStopAtWildcard/before/test.java b/java/typeMigration/testData/refactoring/wildcard/producerFailToStopAtWildcard/before/test.java
index a2e2cb2ae329..a2e2cb2ae329 100644
--- a/plugins/typeMigration/testData/refactoring/wildcard/producerFailToStopAtWildcard/before/test.java
+++ b/java/typeMigration/testData/refactoring/wildcard/producerFailToStopAtWildcard/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/wildcard/producerStopAtWildcard/after/Test.items b/java/typeMigration/testData/refactoring/wildcard/producerStopAtWildcard/after/Test.items
index 2f3689b42ba5..2f3689b42ba5 100644
--- a/plugins/typeMigration/testData/refactoring/wildcard/producerStopAtWildcard/after/Test.items
+++ b/java/typeMigration/testData/refactoring/wildcard/producerStopAtWildcard/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/wildcard/producerStopAtWildcard/after/test.java b/java/typeMigration/testData/refactoring/wildcard/producerStopAtWildcard/after/test.java
index 353f0432f59d..353f0432f59d 100644
--- a/plugins/typeMigration/testData/refactoring/wildcard/producerStopAtWildcard/after/test.java
+++ b/java/typeMigration/testData/refactoring/wildcard/producerStopAtWildcard/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/wildcard/producerStopAtWildcard/before/test.java b/java/typeMigration/testData/refactoring/wildcard/producerStopAtWildcard/before/test.java
index a2e2cb2ae329..a2e2cb2ae329 100644
--- a/plugins/typeMigration/testData/refactoring/wildcard/producerStopAtWildcard/before/test.java
+++ b/java/typeMigration/testData/refactoring/wildcard/producerStopAtWildcard/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/wildcard/producerSuper/after/Test.items b/java/typeMigration/testData/refactoring/wildcard/producerSuper/after/Test.items
index b0c91006b9d1..b0c91006b9d1 100644
--- a/plugins/typeMigration/testData/refactoring/wildcard/producerSuper/after/Test.items
+++ b/java/typeMigration/testData/refactoring/wildcard/producerSuper/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/wildcard/producerSuper/after/test.java b/java/typeMigration/testData/refactoring/wildcard/producerSuper/after/test.java
index 0769f09a7b7a..0769f09a7b7a 100644
--- a/plugins/typeMigration/testData/refactoring/wildcard/producerSuper/after/test.java
+++ b/java/typeMigration/testData/refactoring/wildcard/producerSuper/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/wildcard/producerSuper/before/test.java b/java/typeMigration/testData/refactoring/wildcard/producerSuper/before/test.java
index b5e9a24ad373..b5e9a24ad373 100644
--- a/plugins/typeMigration/testData/refactoring/wildcard/producerSuper/before/test.java
+++ b/java/typeMigration/testData/refactoring/wildcard/producerSuper/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/wildcard/producerUnbounded/after/Test.items b/java/typeMigration/testData/refactoring/wildcard/producerUnbounded/after/Test.items
index e2b8ee35fcd2..e2b8ee35fcd2 100644
--- a/plugins/typeMigration/testData/refactoring/wildcard/producerUnbounded/after/Test.items
+++ b/java/typeMigration/testData/refactoring/wildcard/producerUnbounded/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/wildcard/producerUnbounded/after/test.java b/java/typeMigration/testData/refactoring/wildcard/producerUnbounded/after/test.java
index 37a2f8fcac83..37a2f8fcac83 100644
--- a/plugins/typeMigration/testData/refactoring/wildcard/producerUnbounded/after/test.java
+++ b/java/typeMigration/testData/refactoring/wildcard/producerUnbounded/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/wildcard/producerUnbounded/before/test.java b/java/typeMigration/testData/refactoring/wildcard/producerUnbounded/before/test.java
index b5e9a24ad373..b5e9a24ad373 100644
--- a/plugins/typeMigration/testData/refactoring/wildcard/producerUnbounded/before/test.java
+++ b/java/typeMigration/testData/refactoring/wildcard/producerUnbounded/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/wildcard/threadLocalConsumerExtends/after/Test.items b/java/typeMigration/testData/refactoring/wildcard/threadLocalConsumerExtends/after/Test.items
index 7ae170499472..7ae170499472 100644
--- a/plugins/typeMigration/testData/refactoring/wildcard/threadLocalConsumerExtends/after/Test.items
+++ b/java/typeMigration/testData/refactoring/wildcard/threadLocalConsumerExtends/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/wildcard/threadLocalConsumerExtends/after/test.java b/java/typeMigration/testData/refactoring/wildcard/threadLocalConsumerExtends/after/test.java
index 5275db851a70..5275db851a70 100644
--- a/plugins/typeMigration/testData/refactoring/wildcard/threadLocalConsumerExtends/after/test.java
+++ b/java/typeMigration/testData/refactoring/wildcard/threadLocalConsumerExtends/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/wildcard/threadLocalConsumerExtends/before/test.java b/java/typeMigration/testData/refactoring/wildcard/threadLocalConsumerExtends/before/test.java
index 8805129f7191..8805129f7191 100644
--- a/plugins/typeMigration/testData/refactoring/wildcard/threadLocalConsumerExtends/before/test.java
+++ b/java/typeMigration/testData/refactoring/wildcard/threadLocalConsumerExtends/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/wildcard/threadLocalConsumerSuper/after/Test.items b/java/typeMigration/testData/refactoring/wildcard/threadLocalConsumerSuper/after/Test.items
index d05d101463c7..d05d101463c7 100644
--- a/plugins/typeMigration/testData/refactoring/wildcard/threadLocalConsumerSuper/after/Test.items
+++ b/java/typeMigration/testData/refactoring/wildcard/threadLocalConsumerSuper/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/wildcard/threadLocalConsumerSuper/after/test.java b/java/typeMigration/testData/refactoring/wildcard/threadLocalConsumerSuper/after/test.java
index beb0d0ebef46..beb0d0ebef46 100644
--- a/plugins/typeMigration/testData/refactoring/wildcard/threadLocalConsumerSuper/after/test.java
+++ b/java/typeMigration/testData/refactoring/wildcard/threadLocalConsumerSuper/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/wildcard/threadLocalConsumerSuper/before/test.java b/java/typeMigration/testData/refactoring/wildcard/threadLocalConsumerSuper/before/test.java
index 8805129f7191..8805129f7191 100644
--- a/plugins/typeMigration/testData/refactoring/wildcard/threadLocalConsumerSuper/before/test.java
+++ b/java/typeMigration/testData/refactoring/wildcard/threadLocalConsumerSuper/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/wildcard/threadLocalProducerExtends/after/Test.items b/java/typeMigration/testData/refactoring/wildcard/threadLocalProducerExtends/after/Test.items
index 47a89e441962..47a89e441962 100644
--- a/plugins/typeMigration/testData/refactoring/wildcard/threadLocalProducerExtends/after/Test.items
+++ b/java/typeMigration/testData/refactoring/wildcard/threadLocalProducerExtends/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/wildcard/threadLocalProducerExtends/after/test.java b/java/typeMigration/testData/refactoring/wildcard/threadLocalProducerExtends/after/test.java
index 93724be5c0dd..93724be5c0dd 100644
--- a/plugins/typeMigration/testData/refactoring/wildcard/threadLocalProducerExtends/after/test.java
+++ b/java/typeMigration/testData/refactoring/wildcard/threadLocalProducerExtends/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/wildcard/threadLocalProducerExtends/before/test.java b/java/typeMigration/testData/refactoring/wildcard/threadLocalProducerExtends/before/test.java
index 8df669c77899..8df669c77899 100644
--- a/plugins/typeMigration/testData/refactoring/wildcard/threadLocalProducerExtends/before/test.java
+++ b/java/typeMigration/testData/refactoring/wildcard/threadLocalProducerExtends/before/test.java
diff --git a/plugins/typeMigration/testData/refactoring/wildcard/threadLocalProducerSuper/after/Test.items b/java/typeMigration/testData/refactoring/wildcard/threadLocalProducerSuper/after/Test.items
index 736189db2585..736189db2585 100644
--- a/plugins/typeMigration/testData/refactoring/wildcard/threadLocalProducerSuper/after/Test.items
+++ b/java/typeMigration/testData/refactoring/wildcard/threadLocalProducerSuper/after/Test.items
diff --git a/plugins/typeMigration/testData/refactoring/wildcard/threadLocalProducerSuper/after/test.java b/java/typeMigration/testData/refactoring/wildcard/threadLocalProducerSuper/after/test.java
index fb3b568ca1b0..fb3b568ca1b0 100644
--- a/plugins/typeMigration/testData/refactoring/wildcard/threadLocalProducerSuper/after/test.java
+++ b/java/typeMigration/testData/refactoring/wildcard/threadLocalProducerSuper/after/test.java
diff --git a/plugins/typeMigration/testData/refactoring/wildcard/threadLocalProducerSuper/before/test.java b/java/typeMigration/testData/refactoring/wildcard/threadLocalProducerSuper/before/test.java
index 8df669c77899..8df669c77899 100644
--- a/plugins/typeMigration/testData/refactoring/wildcard/threadLocalProducerSuper/before/test.java
+++ b/java/typeMigration/testData/refactoring/wildcard/threadLocalProducerSuper/before/test.java
diff --git a/plugins/typeMigration/typeMigration.iml b/java/typeMigration/typeMigration.iml
index ac3679760ed4..ac3679760ed4 100644
--- a/plugins/typeMigration/typeMigration.iml
+++ b/java/typeMigration/typeMigration.iml
diff --git a/jps/jps-builders/src/org/jetbrains/jps/api/CmdlineProtoUtil.java b/jps/jps-builders/src/org/jetbrains/jps/api/CmdlineProtoUtil.java
index 28aaeca9d98a..228ba507cec3 100644
--- a/jps/jps-builders/src/org/jetbrains/jps/api/CmdlineProtoUtil.java
+++ b/jps/jps-builders/src/org/jetbrains/jps/api/CmdlineProtoUtil.java
@@ -139,6 +139,10 @@ public class CmdlineProtoUtil {
.setType(CmdlineRemoteProto.Message.ControllerMessage.Type.CANCEL_BUILD_COMMAND).build();
}
+ public static BuilderMessage createCompileProgressMessageResponse(String text) {
+ return createCompileMessage(BuildMessage.Kind.PROGRESS, text, null, -1L, -1L, -1L, -1, -1, -1.0f);
+ }
+
public static BuilderMessage createCompileProgressMessageResponse(String text, float done) {
return createCompileMessage(BuildMessage.Kind.PROGRESS, text, null, -1L, -1L, -1L, -1, -1, done);
}
diff --git a/jps/jps-builders/src/org/jetbrains/jps/incremental/IncProjectBuilder.java b/jps/jps-builders/src/org/jetbrains/jps/incremental/IncProjectBuilder.java
index baa67a0216d8..88fdef9eaad2 100644
--- a/jps/jps-builders/src/org/jetbrains/jps/incremental/IncProjectBuilder.java
+++ b/jps/jps-builders/src/org/jetbrains/jps/incremental/IncProjectBuilder.java
@@ -56,6 +56,7 @@ import org.jetbrains.jps.incremental.storage.BuildTargetConfiguration;
import org.jetbrains.jps.incremental.storage.OneToManyPathsMapping;
import org.jetbrains.jps.incremental.storage.OutputToTargetRegistry;
import org.jetbrains.jps.indices.ModuleExcludeIndex;
+import org.jetbrains.jps.javac.JavacMain;
import org.jetbrains.jps.model.java.JpsJavaExtensionService;
import org.jetbrains.jps.model.java.compiler.JpsJavaCompilerConfiguration;
import org.jetbrains.jps.model.module.JpsModule;
@@ -176,6 +177,7 @@ public class IncProjectBuilder {
final LowMemoryWatcher memWatcher = LowMemoryWatcher.register(new Runnable() {
@Override
public void run() {
+ JavacMain.clearCompilerZipFileCache();
myProjectDescriptor.dataManager.flush(false);
myProjectDescriptor.timestamps.getStorage().force();
}
diff --git a/jps/jps-builders/src/org/jetbrains/jps/incremental/java/JavaBuilder.java b/jps/jps-builders/src/org/jetbrains/jps/incremental/java/JavaBuilder.java
index 52e8b280c61b..77538c6b6881 100644
--- a/jps/jps-builders/src/org/jetbrains/jps/incremental/java/JavaBuilder.java
+++ b/jps/jps-builders/src/org/jetbrains/jps/incremental/java/JavaBuilder.java
@@ -896,10 +896,10 @@ public class JavaBuilder extends ModuleLevelBuilder {
break;
case MANDATORY_WARNING:
case WARNING:
- case NOTE:
kind = BuildMessage.Kind.WARNING;
myWarningCount++;
break;
+ case NOTE:
default:
kind = BuildMessage.Kind.INFO;
}
diff --git a/jps/jps-builders/src/org/jetbrains/jps/incremental/messages/BuilderStatisticsMessage.java b/jps/jps-builders/src/org/jetbrains/jps/incremental/messages/BuilderStatisticsMessage.java
index f58546f64cec..3a54a4e06bea 100644
--- a/jps/jps-builders/src/org/jetbrains/jps/incremental/messages/BuilderStatisticsMessage.java
+++ b/jps/jps-builders/src/org/jetbrains/jps/incremental/messages/BuilderStatisticsMessage.java
@@ -23,7 +23,7 @@ public class BuilderStatisticsMessage extends BuildMessage {
private final long myElapsedTimeMs;
public BuilderStatisticsMessage(String builderName, long elapsedTimeMs) {
- super(builderName + " elapsed " + elapsedTimeMs + "ms", Kind.INFO);
+ super("", Kind.INFO);
myBuilderName = builderName;
myElapsedTimeMs = elapsedTimeMs;
}
diff --git a/jps/jps-builders/src/org/jetbrains/jps/javac/JavacMain.java b/jps/jps-builders/src/org/jetbrains/jps/javac/JavacMain.java
index c5b6d861a8e4..ac4f4a0b78fc 100644
--- a/jps/jps-builders/src/org/jetbrains/jps/javac/JavacMain.java
+++ b/jps/jps-builders/src/org/jetbrains/jps/javac/JavacMain.java
@@ -452,4 +452,59 @@ public class JavacMain {
}
}
+ private static class ZipFileIndexCleanupDataHolder {
+ @Nullable
+ static final Method cacheInstanceGetter;
+ @Nullable
+ static final Method cacheClearMethod;
+
+ static {
+ Method getterMethod = null;
+ Method clearMethod = null;
+ try {
+ //trying JDK 6
+ clearMethod = Class.forName("com.sun.tools.javac.zip.ZipFileIndex").getDeclaredMethod("clearCache");
+ clearMethod.setAccessible(true);
+ }
+ catch (Throwable e) {
+ try {
+ final Class<?> cacheClass = Class.forName("com.sun.tools.javac.file.ZipFileIndexCache");
+ clearMethod = cacheClass.getDeclaredMethod("clearCache");
+ getterMethod = cacheClass.getDeclaredMethod("getSharedInstance");
+ clearMethod.setAccessible(true);
+ getterMethod.setAccessible(true);
+ }
+ catch (Throwable ignored2) {
+ clearMethod = null;
+ getterMethod = null;
+ }
+ }
+
+ cacheInstanceGetter = getterMethod;
+ cacheClearMethod = clearMethod;
+ }
+ }
+
+ private static volatile boolean zipCacheCleanupPossible = true;
+
+ public static void clearCompilerZipFileCache() {
+ if (zipCacheCleanupPossible) {
+ final Method clearMethod = ZipFileIndexCleanupDataHolder.cacheClearMethod;
+ if (clearMethod != null) {
+ final Method getter = ZipFileIndexCleanupDataHolder.cacheInstanceGetter;
+ try {
+ Object instance = getter != null? getter.invoke(null) : null;
+ clearMethod.invoke(instance);
+ }
+ catch (Throwable e) {
+ zipCacheCleanupPossible = false;
+ }
+ }
+ else {
+ zipCacheCleanupPossible = false;
+ }
+ }
+ }
+
+
}
diff --git a/jps/jps-builders/src/org/jetbrains/jps/javac/OptimizedFileManager17.java b/jps/jps-builders/src/org/jetbrains/jps/javac/OptimizedFileManager17.java
index 16b6b683a48b..a2879478c707 100644
--- a/jps/jps-builders/src/org/jetbrains/jps/javac/OptimizedFileManager17.java
+++ b/jps/jps-builders/src/org/jetbrains/jps/javac/OptimizedFileManager17.java
@@ -33,6 +33,7 @@ import java.net.URISyntaxException;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.charset.CharsetDecoder;
+import java.nio.file.LinkOption;
import java.util.*;
/**
@@ -362,12 +363,20 @@ class OptimizedFileManager17 extends com.sun.tools.javac.file.JavacFileManager {
if (kind == Kind.OTHER && getKind() != kind) {
return false;
}
- String n = cn + kind.extension;
+ final String n = cn + kind.extension;
if (name.equals(n)) {
return true;
}
if (name.equalsIgnoreCase(n)) {
- return file.getName().equals(n);
+ // if we are on a case-insensitive file system,
+ // try to compare against the real (exactly as on the disk) file name
+ //
+ try {
+ //noinspection Since15
+ return n.equals(file.toPath().toRealPath(LinkOption.NOFOLLOW_LINKS).getFileName().toString());
+ }
+ catch (IOException ignored) {
+ }
}
return false;
}
diff --git a/jps/jps-builders/testSrc/org/jetbrains/jps/builders/ModuleClasspathTest.kt b/jps/jps-builders/testSrc/org/jetbrains/jps/builders/ModuleClasspathTest.kt
index 9d2960dc4d9c..b76196eba947 100644
--- a/jps/jps-builders/testSrc/org/jetbrains/jps/builders/ModuleClasspathTest.kt
+++ b/jps/jps-builders/testSrc/org/jetbrains/jps/builders/ModuleClasspathTest.kt
@@ -25,7 +25,6 @@ import org.jetbrains.jps.incremental.ModuleBuildTarget
import java.io.File
import com.intellij.openapi.util.text.StringUtil
import org.junit.Assert
-import java.util.Collections
/**
* @author nik
@@ -79,7 +78,7 @@ public class ModuleClasspathTest(): JpsBuildTestCase() {
private fun assertClasspath(expected: List<String>, classpath: List<String>) {
val basePath = FileUtil.toSystemIndependentName(File(getProjectPath()).getParentFile()!!.getAbsolutePath()) + "/"
val actual = toSystemIndependentPaths(classpath).map { StringUtil.trimStart(it, basePath) }
- Assert.assertEquals(expected.makeString("\n"), actual.makeString("\n"))
+ Assert.assertEquals(expected.join("\n"), actual.join("\n"))
}
private fun toSystemIndependentPaths(classpath: List<String>): List<String> {
diff --git a/jps/lib/optimizedFileManager.jar b/jps/lib/optimizedFileManager.jar
index 5f5aa8922731..59212c9c1962 100644
--- a/jps/lib/optimizedFileManager.jar
+++ b/jps/lib/optimizedFileManager.jar
Binary files differ
diff --git a/jps/standalone-builder/src/org/jetbrains/jps/idea/IdeaProjectLoader.groovy b/jps/standalone-builder/src/org/jetbrains/jps/idea/IdeaProjectLoader.groovy
index 627c9f821b99..d7e52c6d061f 100644
--- a/jps/standalone-builder/src/org/jetbrains/jps/idea/IdeaProjectLoader.groovy
+++ b/jps/standalone-builder/src/org/jetbrains/jps/idea/IdeaProjectLoader.groovy
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2012 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -14,21 +14,23 @@
* limitations under the License.
*/
package org.jetbrains.jps.idea
+
/**
* @author max
*/
public class IdeaProjectLoader {
public static String guessHome(Script script) {
- File home = new File(script["gant.file"].substring("file:".length()))
+ String uri = script["gant.file"]
+ File home = new File(new URI(uri).getSchemeSpecificPart())
while (home != null) {
- if (home.isDirectory()) {
- if (new File(home, ".idea").exists()) return home.getCanonicalPath()
+ if (home.isDirectory() && new File(home, ".idea").exists()) {
+ return home.getCanonicalPath()
}
home = home.getParentFile()
}
- return null
+ throw new IllegalArgumentException("Cannot guess project home from '" + uri + "'")
}
}
diff --git a/lib/ecj-4.3.2.jar b/lib/ecj-4.3.2.jar
deleted file mode 100644
index fd4c47a47e9e..000000000000
--- a/lib/ecj-4.3.2.jar
+++ /dev/null
Binary files differ
diff --git a/lib/ecj-4.4.jar b/lib/ecj-4.4.jar
new file mode 100644
index 000000000000..98f82dc592c4
--- /dev/null
+++ b/lib/ecj-4.4.jar
Binary files differ
diff --git a/lib/jh.jar b/lib/jh.jar
index c38233aaaccd..d0ad2e9c69c4 100644
--- a/lib/jh.jar
+++ b/lib/jh.jar
Binary files differ
diff --git a/lib/required_for_dist.txt b/lib/required_for_dist.txt
index 77d0b5b11961..6ea1f4d542ec 100644
--- a/lib/required_for_dist.txt
+++ b/lib/required_for_dist.txt
@@ -14,7 +14,7 @@ httpclient-4.3.2.jar
fluent-hc-4.3.2.jar
freemarker.jar
httpmime-4.3.2.jar
-ecj-4.3.2.jar
+ecj-4.4.jar
groovy-all-2.2.1.jar
gson-2.2.4.jar
guava-17.0.jar
diff --git a/lib/src/jhsrc.jar b/lib/src/jhsrc.jar
index d9c5b9432cae..42e4b06bfbfc 100644
--- a/lib/src/jhsrc.jar
+++ b/lib/src/jhsrc.jar
Binary files differ
diff --git a/native/WinLauncher/WinLauncher/WinLauncher.cpp b/native/WinLauncher/WinLauncher/WinLauncher.cpp
index a934a88da3d0..3249a9a1f0de 100644
--- a/native/WinLauncher/WinLauncher/WinLauncher.cpp
+++ b/native/WinLauncher/WinLauncher/WinLauncher.cpp
@@ -169,12 +169,16 @@ bool FindJVMInRegistryWithVersion(const char* version, bool wow64_32)
bool FindJVMInRegistry()
{
#ifndef _M_X64
+ if (FindJVMInRegistryWithVersion("1.8", true))
+ return true;
if (FindJVMInRegistryWithVersion("1.7", true))
return true;
if (FindJVMInRegistryWithVersion("1.6", true))
return true;
#endif
+ if (FindJVMInRegistryWithVersion("1.8", false))
+ return true;
if (FindJVMInRegistryWithVersion("1.7", false))
return true;
if (FindJVMInRegistryWithVersion("1.6", false))
diff --git a/native/fileWatcher/fileWatcher3.cpp b/native/fileWatcher/fileWatcher3.cpp
index 7e3669ecdec7..07dbe52095a5 100644
--- a/native/fileWatcher/fileWatcher3.cpp
+++ b/native/fileWatcher/fileWatcher3.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2011 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -14,20 +14,23 @@
* limitations under the License.
*/
-#include "stdafx.h"
+#include <process.h>
+#include <stdio.h>
+#include <tchar.h>
+#include <windows.h>
struct WatchRootInfo {
- char driveLetter;
- HANDLE hThread;
- HANDLE hStopEvent;
- bool bInitialized;
- bool bUsed;
- bool bFailed;
+ char driveLetter;
+ HANDLE hThread;
+ HANDLE hStopEvent;
+ bool bInitialized;
+ bool bUsed;
+ bool bFailed;
};
struct WatchRoot {
- char *path;
- WatchRoot *next;
+ char *path;
+ WatchRoot *next;
};
const int ROOT_COUNT = 26;
@@ -38,139 +41,123 @@ WatchRoot *firstWatchRoot = NULL;
CRITICAL_SECTION csOutput;
-void NormalizeSlashes(char *path, char slash)
-{
- for(char *p=path; *p; p++)
- if (*p == '\\' || *p == '/')
- *p = slash;
+void NormalizeSlashes(char *path, char slash) {
+ for (char *p = path; *p; p++)
+ if (*p == '\\' || *p == '/')
+ *p = slash;
}
// -- Watchable root checks ---------------------------------------------------
-bool IsNetworkDrive(const char *name)
-{
+bool IsNetworkDrive(const char *name) {
const int BUF_SIZE = 1024;
char buffer[BUF_SIZE];
- UNIVERSAL_NAME_INFO* uni = (UNIVERSAL_NAME_INFO*) buffer;
+ UNIVERSAL_NAME_INFO *uni = (UNIVERSAL_NAME_INFO *) buffer;
DWORD size = BUF_SIZE;
DWORD result = WNetGetUniversalNameA(
- name, // path for network resource
- UNIVERSAL_NAME_INFO_LEVEL, // level of information
- buffer, // name buffer
- &size // size of buffer
+ name, // path for network resource
+ UNIVERSAL_NAME_INFO_LEVEL, // level of information
+ buffer, // name buffer
+ &size // size of buffer
);
return result == NO_ERROR;
}
-bool IsUnwatchableFS(const char *path)
-{
+bool IsUnwatchableFS(const char *path) {
char volumeName[MAX_PATH];
- char fsName[MAX_PATH];
- DWORD fsFlags;
- DWORD maxComponentLength;
- SetErrorMode(SEM_FAILCRITICALERRORS);
- if (!GetVolumeInformationA(path, volumeName, MAX_PATH-1, NULL, &maxComponentLength, &fsFlags, fsName, MAX_PATH-1))
- return false;
- if (strcmp(fsName, "NTFS") && strcmp(fsName, "FAT") && strcmp(fsName, "FAT32") && stricmp(fsName, "exFAT"))
- return true;
-
- if (!strcmp(fsName, "NTFS") && maxComponentLength != 255 && !(fsFlags & FILE_SUPPORTS_REPARSE_POINTS))
- {
- // SAMBA reports itself as NTFS
- return true;
- }
-
- return false;
+ char fsName[MAX_PATH];
+ DWORD fsFlags;
+ DWORD maxComponentLength;
+ SetErrorMode(SEM_FAILCRITICALERRORS);
+ if (!GetVolumeInformationA(path, volumeName, MAX_PATH - 1, NULL, &maxComponentLength, &fsFlags, fsName, MAX_PATH - 1))
+ return false;
+ if (strcmp(fsName, "NTFS") && strcmp(fsName, "FAT") && strcmp(fsName, "FAT32") && _stricmp(fsName, "exFAT") && _stricmp(fsName, "reFS"))
+ return true;
+
+ if (!strcmp(fsName, "NTFS") && maxComponentLength != 255 && !(fsFlags & FILE_SUPPORTS_REPARSE_POINTS)) {
+ // SAMBA reports itself as NTFS
+ return true;
+ }
+
+ return false;
}
-bool IsWatchable(const char *path)
-{
- if (IsNetworkDrive(path))
- return false;
- if (IsUnwatchableFS(path))
- return false;
- return true;
+bool IsWatchable(const char *path) {
+ if (IsNetworkDrive(path))
+ return false;
+ if (IsUnwatchableFS(path))
+ return false;
+ return true;
}
// -- Substed drive checks ----------------------------------------------------
-void PrintRemapForSubstDrive(char driveLetter)
-{
+void PrintRemapForSubstDrive(char driveLetter) {
const int BUF_SIZE = 1024;
char targetPath[BUF_SIZE];
- char rootPath[8];
- sprintf_s(rootPath, 8, "%c:", driveLetter);
+ char rootPath[8];
+ sprintf_s(rootPath, 8, "%c:", driveLetter);
DWORD result = QueryDosDeviceA(rootPath, targetPath, BUF_SIZE);
if (result == 0) {
return;
}
- else
- {
- if (targetPath[0] == '\\' && targetPath[1] == '?' && targetPath[2] == '?' && targetPath[3] == '\\')
- {
- // example path: \??\C:\jetbrains\idea
- NormalizeSlashes(targetPath, '/');
- printf("%c:\n%s\n", driveLetter, targetPath+4);
- }
+ else {
+ if (targetPath[0] == '\\' && targetPath[1] == '?' && targetPath[2] == '?' && targetPath[3] == '\\') {
+ // example path: \??\C:\jetbrains\idea
+ NormalizeSlashes(targetPath, '/');
+ printf("%c:\n%s\n", driveLetter, targetPath + 4);
+ }
}
}
-void PrintRemapForSubstDrives()
-{
- for(int i=0; i<ROOT_COUNT; i++)
- {
- if (watchRootInfos [i].bUsed)
- {
- PrintRemapForSubstDrive(watchRootInfos [i].driveLetter);
- }
- }
+void PrintRemapForSubstDrives() {
+ for (int i = 0; i < ROOT_COUNT; i++) {
+ if (watchRootInfos[i].bUsed) {
+ PrintRemapForSubstDrive(watchRootInfos[i].driveLetter);
+ }
+ }
}
// -- Mount point enumeration -------------------------------------------------
const int BUFSIZE = 1024;
-void PrintDirectoryReparsePoint(const char *path)
-{
- int size = strlen(path)+2;
- char *directory = (char *) malloc(size);
- strcpy_s(directory, size, path);
- NormalizeSlashes(directory, '\\');
- if (directory [strlen(directory)-1] != '\\')
- strcat_s(directory, size, "\\");
-
- char volumeName[_MAX_PATH];
- int rc = GetVolumeNameForVolumeMountPointA(directory, volumeName, sizeof(volumeName));
- if (rc)
- {
- char volumePathNames[_MAX_PATH];
- DWORD returnLength;
- rc = GetVolumePathNamesForVolumeNameA(volumeName, volumePathNames, sizeof(volumePathNames), &returnLength);
- if (rc)
- {
- char *p = volumePathNames;
- while(*p)
- {
- if (_stricmp(p, directory)) // if it's not the path we've already found
- {
- NormalizeSlashes(directory, '/');
- NormalizeSlashes(p, '/');
- puts(directory);
- puts(p);
- }
- p += strlen(p)+1;
- }
- }
- }
- free(directory);
+void PrintDirectoryReparsePoint(const char *path) {
+ int size = strlen(path) + 2;
+ char *directory = (char *) malloc(size);
+ strcpy_s(directory, size, path);
+ NormalizeSlashes(directory, '\\');
+ if (directory[strlen(directory) - 1] != '\\')
+ strcat_s(directory, size, "\\");
+
+ char volumeName[_MAX_PATH];
+ int rc = GetVolumeNameForVolumeMountPointA(directory, volumeName, sizeof(volumeName));
+ if (rc) {
+ char volumePathNames[_MAX_PATH];
+ DWORD returnLength;
+ rc = GetVolumePathNamesForVolumeNameA(volumeName, volumePathNames, sizeof(volumePathNames), &returnLength);
+ if (rc) {
+ char *p = volumePathNames;
+ while (*p) {
+ if (_stricmp(p, directory)) // if it's not the path we've already found
+ {
+ NormalizeSlashes(directory, '/');
+ NormalizeSlashes(p, '/');
+ puts(directory);
+ puts(p);
+ }
+ p += strlen(p) + 1;
+ }
+ }
+ }
+ free(directory);
}
-bool PrintMountPointsForVolume(HANDLE hVol, const char* volumePath, char *Buf)
-{
+bool PrintMountPointsForVolume(HANDLE hVol, const char *volumePath, char *Buf) {
HANDLE hPt; // handle for mount point scan
char Path[BUFSIZE]; // string buffer for mount points
DWORD dwSysFlags; // flags that describe the file system
@@ -182,39 +169,38 @@ bool PrintMountPointsForVolume(HANDLE hVol, const char* volumePath, char *Buf)
// Detect support for reparse points, and therefore for volume
// mount points, which are implemented using reparse points.
- if (! (dwSysFlags & FILE_SUPPORTS_REPARSE_POINTS)) {
- return true;
+ if (!(dwSysFlags & FILE_SUPPORTS_REPARSE_POINTS)) {
+ return true;
}
// Start processing mount points on this volume.
hPt = FindFirstVolumeMountPointA(
- Buf, // root path of volume to be scanned
- Path, // pointer to output string
- BUFSIZE // size of output buffer
+ Buf, // root path of volume to be scanned
+ Path, // pointer to output string
+ BUFSIZE // size of output buffer
);
// Shall we error out?
if (hPt == INVALID_HANDLE_VALUE) {
- return GetLastError() != ERROR_ACCESS_DENIED;
+ return GetLastError() != ERROR_ACCESS_DENIED;
}
// Process the volume mount point.
- char *buf = new char[MAX_PATH];
+ char *buf = new char[MAX_PATH];
do {
- strcpy_s(buf, MAX_PATH, volumePath);
- strcat_s(buf, MAX_PATH, Path);
- PrintDirectoryReparsePoint(buf);
+ strcpy_s(buf, MAX_PATH, volumePath);
+ strcat_s(buf, MAX_PATH, Path);
+ PrintDirectoryReparsePoint(buf);
} while (FindNextVolumeMountPointA(hPt, Path, BUFSIZE));
FindVolumeMountPointClose(hPt);
- return true;
+ return true;
}
-bool PrintMountPoints(const char *path)
-{
- char volumeUniqueName[128];
- BOOL res = GetVolumeNameForVolumeMountPointA(path, volumeUniqueName, 128);
- if (!res) {
+bool PrintMountPoints(const char *path) {
+ char volumeUniqueName[128];
+ BOOL res = GetVolumeNameForVolumeMountPointA(path, volumeUniqueName, 128);
+ if (!res) {
return false;
}
@@ -222,7 +208,7 @@ bool PrintMountPoints(const char *path)
HANDLE hVol; // handle for the volume scan
// Open a scan for volumes.
- hVol = FindFirstVolumeA(buf, BUFSIZE );
+ hVol = FindFirstVolumeA(buf, BUFSIZE);
// Shall we error out?
if (hVol == INVALID_HANDLE_VALUE) {
@@ -230,329 +216,286 @@ bool PrintMountPoints(const char *path)
}
bool success = true;
- do {
- if (!strcmp(buf, volumeUniqueName)) {
- success = PrintMountPointsForVolume(hVol, path, buf);
- if (!success) break;
- }
+ do {
+ if (!strcmp(buf, volumeUniqueName)) {
+ success = PrintMountPointsForVolume(hVol, path, buf);
+ if (!success) break;
+ }
} while (FindNextVolumeA(hVol, buf, BUFSIZE));
FindVolumeClose(hVol);
- return success;
+ return success;
}
// -- Searching for mount points in watch roots (fallback) --------------------
-void PrintDirectoryReparsePoints(const char *path)
-{
- char *const buf = _strdup(path);
- while(strchr(buf, '/'))
- {
- DWORD attributes = GetFileAttributesA(buf);
- if (attributes == INVALID_FILE_ATTRIBUTES)
- break;
- if (attributes & FILE_ATTRIBUTE_REPARSE_POINT)
- {
- PrintDirectoryReparsePoint(buf);
- }
- char *pSlash = strrchr(buf, '/');
- if (pSlash)
- {
- *pSlash = '\0';
- }
- }
- free(buf);
+void PrintDirectoryReparsePoints(const char *path) {
+ char *const buf = _strdup(path);
+ while (strchr(buf, '/')) {
+ DWORD attributes = GetFileAttributesA(buf);
+ if (attributes == INVALID_FILE_ATTRIBUTES)
+ break;
+ if (attributes & FILE_ATTRIBUTE_REPARSE_POINT) {
+ PrintDirectoryReparsePoint(buf);
+ }
+ char *pSlash = strrchr(buf, '/');
+ if (pSlash) {
+ *pSlash = '\0';
+ }
+ }
+ free(buf);
}
// This is called if we got an ERROR_ACCESS_DENIED when trying to enumerate all mount points for volume.
// In this case, we walk the directory tree up from each watch root, and look at each parent directory
// to check whether it's a reparse point.
-void PrintWatchRootReparsePoints()
-{
- WatchRoot *pWatchRoot = firstWatchRoot;
- while(pWatchRoot)
- {
- PrintDirectoryReparsePoints(pWatchRoot->path);
- pWatchRoot = pWatchRoot->next;
- }
+void PrintWatchRootReparsePoints() {
+ WatchRoot *pWatchRoot = firstWatchRoot;
+ while (pWatchRoot) {
+ PrintDirectoryReparsePoints(pWatchRoot->path);
+ pWatchRoot = pWatchRoot->next;
+ }
}
// -- Watcher thread ----------------------------------------------------------
-void PrintChangeInfo(char *rootPath, FILE_NOTIFY_INFORMATION *info)
-{
- char FileNameBuffer[_MAX_PATH];
- int converted = WideCharToMultiByte(CP_ACP, 0, info->FileName, info->FileNameLength/sizeof(WCHAR), FileNameBuffer, _MAX_PATH-1, NULL, NULL);
- FileNameBuffer[converted] = '\0';
- char *command;
- if (info->Action == FILE_ACTION_ADDED || info->Action == FILE_ACTION_RENAMED_OLD_NAME)
- {
- command = "CREATE";
- }
- else if (info->Action == FILE_ACTION_REMOVED || info->Action == FILE_ACTION_RENAMED_OLD_NAME)
- {
- command = "DELETE";
- }
- else if (info->Action == FILE_ACTION_MODIFIED)
- {
- command = "CHANGE";
- }
- else
- {
- return; // unknown command
- }
-
- EnterCriticalSection(&csOutput);
- puts(command);
- printf("%s", rootPath);
- puts(FileNameBuffer);
- fflush(stdout);
- LeaveCriticalSection(&csOutput);
+void PrintChangeInfo(char *rootPath, FILE_NOTIFY_INFORMATION *info) {
+ char FileNameBuffer[_MAX_PATH];
+ int converted = WideCharToMultiByte(CP_ACP, 0, info->FileName, info->FileNameLength / sizeof(WCHAR), FileNameBuffer, _MAX_PATH - 1, NULL, NULL);
+ FileNameBuffer[converted] = '\0';
+ char *command;
+ if (info->Action == FILE_ACTION_ADDED || info->Action == FILE_ACTION_RENAMED_OLD_NAME) {
+ command = "CREATE";
+ }
+ else if (info->Action == FILE_ACTION_REMOVED || info->Action == FILE_ACTION_RENAMED_OLD_NAME) {
+ command = "DELETE";
+ }
+ else if (info->Action == FILE_ACTION_MODIFIED) {
+ command = "CHANGE";
+ }
+ else {
+ return; // unknown command
+ }
+
+ EnterCriticalSection(&csOutput);
+ puts(command);
+ printf("%s", rootPath);
+ puts(FileNameBuffer);
+ fflush(stdout);
+ LeaveCriticalSection(&csOutput);
}
-void PrintEverythingChangedUnderRoot(char *rootPath)
-{
- EnterCriticalSection(&csOutput);
- puts("RECDIRTY");
- puts(rootPath);
- fflush(stdout);
- LeaveCriticalSection(&csOutput);
+void PrintEverythingChangedUnderRoot(char *rootPath) {
+ EnterCriticalSection(&csOutput);
+ puts("RECDIRTY");
+ puts(rootPath);
+ fflush(stdout);
+ LeaveCriticalSection(&csOutput);
}
-DWORD WINAPI WatcherThread(void *param)
-{
- WatchRootInfo *info = (WatchRootInfo *) param;
-
- OVERLAPPED overlapped;
- memset(&overlapped, 0, sizeof(overlapped));
- overlapped.hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
-
- char rootPath[8];
- sprintf_s(rootPath, 8, "%c:\\", info->driveLetter);
- HANDLE hRootDir = CreateFileA(rootPath, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
- NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OVERLAPPED, NULL);
-
- int buffer_size = 10240;
- char *buffer = new char[buffer_size];
-
- HANDLE handles [2];
- handles [0] = info->hStopEvent;
- handles [1] = overlapped.hEvent;
- while(true)
- {
- int rcDir = ReadDirectoryChangesW(hRootDir, buffer, buffer_size, TRUE,
- FILE_NOTIFY_CHANGE_FILE_NAME |
- FILE_NOTIFY_CHANGE_DIR_NAME |
- FILE_NOTIFY_CHANGE_ATTRIBUTES |
- FILE_NOTIFY_CHANGE_SIZE |
- FILE_NOTIFY_CHANGE_LAST_WRITE,
- NULL,
- &overlapped,
- NULL);
- if (rcDir == 0)
- {
- info->bFailed = true;
- break;
- }
-
- int rc = WaitForMultipleObjects(2, handles, FALSE, INFINITE);
- if (rc == WAIT_OBJECT_0)
- {
- break;
- }
- if (rc == WAIT_OBJECT_0+1)
- {
- DWORD dwBytesReturned;
- if(!GetOverlappedResult(hRootDir, &overlapped, &dwBytesReturned, FALSE))
- {
- info->bFailed = true;
- break;
- }
-
- if (dwBytesReturned == 0)
- {
- // don't send dirty too much, everything is changed anyway
- if (WaitForSingleObject(info->hStopEvent, 500) == WAIT_OBJECT_0)
- break;
-
- // Got a buffer overflow => current changes lost => send RECDIRTY on root
- PrintEverythingChangedUnderRoot(rootPath);
- } else {
- FILE_NOTIFY_INFORMATION *info = (FILE_NOTIFY_INFORMATION *) buffer;
- while(true)
- {
- PrintChangeInfo(rootPath, info);
- if (!info->NextEntryOffset)
- break;
- info = (FILE_NOTIFY_INFORMATION *) ((char *) info + info->NextEntryOffset);
- }
- }
- }
- }
- CloseHandle(overlapped.hEvent);
- CloseHandle(hRootDir);
- delete[] buffer;
- return 0;
+DWORD WINAPI WatcherThread(void *param) {
+ WatchRootInfo *info = (WatchRootInfo *) param;
+
+ OVERLAPPED overlapped;
+ memset(&overlapped, 0, sizeof(overlapped));
+ overlapped.hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
+
+ char rootPath[8];
+ sprintf_s(rootPath, 8, "%c:\\", info->driveLetter);
+ HANDLE hRootDir = CreateFileA(rootPath, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
+ NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OVERLAPPED, NULL);
+
+ int buffer_size = 10240;
+ char *buffer = new char[buffer_size];
+
+ HANDLE handles[2];
+ handles[0] = info->hStopEvent;
+ handles[1] = overlapped.hEvent;
+ while (true) {
+ int rcDir = ReadDirectoryChangesW(hRootDir, buffer, buffer_size, TRUE,
+ FILE_NOTIFY_CHANGE_FILE_NAME |
+ FILE_NOTIFY_CHANGE_DIR_NAME |
+ FILE_NOTIFY_CHANGE_ATTRIBUTES |
+ FILE_NOTIFY_CHANGE_SIZE |
+ FILE_NOTIFY_CHANGE_LAST_WRITE,
+ NULL,
+ &overlapped,
+ NULL);
+ if (rcDir == 0) {
+ info->bFailed = true;
+ break;
+ }
+
+ int rc = WaitForMultipleObjects(2, handles, FALSE, INFINITE);
+ if (rc == WAIT_OBJECT_0) {
+ break;
+ }
+ if (rc == WAIT_OBJECT_0 + 1) {
+ DWORD dwBytesReturned;
+ if (!GetOverlappedResult(hRootDir, &overlapped, &dwBytesReturned, FALSE)) {
+ info->bFailed = true;
+ break;
+ }
+
+ if (dwBytesReturned == 0) {
+ // don't send dirty too much, everything is changed anyway
+ if (WaitForSingleObject(info->hStopEvent, 500) == WAIT_OBJECT_0)
+ break;
+
+ // Got a buffer overflow => current changes lost => send RECDIRTY on root
+ PrintEverythingChangedUnderRoot(rootPath);
+ } else {
+ FILE_NOTIFY_INFORMATION *info = (FILE_NOTIFY_INFORMATION *) buffer;
+ while (true) {
+ PrintChangeInfo(rootPath, info);
+ if (!info->NextEntryOffset)
+ break;
+ info = (FILE_NOTIFY_INFORMATION *)((char *) info + info->NextEntryOffset);
+ }
+ }
+ }
+ }
+ CloseHandle(overlapped.hEvent);
+ CloseHandle(hRootDir);
+ delete[] buffer;
+ return 0;
}
// -- Roots update ------------------------------------------------------------
-void MarkAllRootsUnused()
-{
- for(int i=0; i<ROOT_COUNT; i++)
- {
- watchRootInfos [i].bUsed = false;
- }
+void MarkAllRootsUnused() {
+ for (int i = 0; i < ROOT_COUNT; i++) {
+ watchRootInfos[i].bUsed = false;
+ }
}
-void StartRoot(WatchRootInfo *info)
-{
- info->hStopEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
- info->hThread = CreateThread(NULL, 0, &WatcherThread, info, 0, NULL);
- info->bInitialized = true;
+void StartRoot(WatchRootInfo *info) {
+ info->hStopEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
+ info->hThread = CreateThread(NULL, 0, &WatcherThread, info, 0, NULL);
+ info->bInitialized = true;
}
-void StopRoot(WatchRootInfo *info)
-{
- SetEvent(info->hStopEvent);
- WaitForSingleObject(info->hThread, INFINITE);
- CloseHandle(info->hThread);
- CloseHandle(info->hStopEvent);
- info->bInitialized = false;
+void StopRoot(WatchRootInfo *info) {
+ SetEvent(info->hStopEvent);
+ WaitForSingleObject(info->hThread, INFINITE);
+ CloseHandle(info->hThread);
+ CloseHandle(info->hStopEvent);
+ info->bInitialized = false;
}
-void UpdateRoots()
-{
- char infoBuffer [256];
- strcpy_s(infoBuffer, "UNWATCHEABLE\n");
- for(int i=0; i<ROOT_COUNT; i++)
- {
- if (watchRootInfos [i].bInitialized && (!watchRootInfos [i].bUsed || watchRootInfos [i].bFailed))
- {
- StopRoot(&watchRootInfos [i]);
- watchRootInfos [i].bFailed = false;
- }
- if (watchRootInfos [i].bUsed)
- {
- char rootPath[8];
- sprintf_s(rootPath, 8, "%c:\\", watchRootInfos [i].driveLetter);
- if (!IsWatchable(rootPath))
- {
- strcat_s(infoBuffer, rootPath);
- strcat_s(infoBuffer, "\n");
- continue;
- }
- if (!watchRootInfos [i].bInitialized)
- {
- StartRoot(&watchRootInfos [i]);
- }
- }
- }
- EnterCriticalSection(&csOutput);
- fprintf(stdout, "%s", infoBuffer);
- puts("#\nREMAP");
- PrintRemapForSubstDrives();
- bool printedMountPoints = true;
- for(int i=0; i<ROOT_COUNT; i++)
- {
- if (watchRootInfos [i].bUsed)
- {
- char rootPath[8];
- sprintf_s(rootPath, 8, "%c:\\", watchRootInfos [i].driveLetter);
- if (!PrintMountPoints(rootPath))
- printedMountPoints = false;
- }
- }
- if (!printedMountPoints)
- {
- PrintWatchRootReparsePoints();
- }
- puts("#");
- fflush(stdout);
- LeaveCriticalSection(&csOutput);
+void UpdateRoots() {
+ char infoBuffer[256];
+ strcpy_s(infoBuffer, "UNWATCHEABLE\n");
+ for (int i = 0; i < ROOT_COUNT; i++) {
+ if (watchRootInfos[i].bInitialized && (!watchRootInfos[i].bUsed || watchRootInfos[i].bFailed)) {
+ StopRoot(&watchRootInfos[i]);
+ watchRootInfos[i].bFailed = false;
+ }
+ if (watchRootInfos[i].bUsed) {
+ char rootPath[8];
+ sprintf_s(rootPath, 8, "%c:\\", watchRootInfos[i].driveLetter);
+ if (!IsWatchable(rootPath)) {
+ strcat_s(infoBuffer, rootPath);
+ strcat_s(infoBuffer, "\n");
+ continue;
+ }
+ if (!watchRootInfos[i].bInitialized) {
+ StartRoot(&watchRootInfos[i]);
+ }
+ }
+ }
+ EnterCriticalSection(&csOutput);
+ fprintf(stdout, "%s", infoBuffer);
+ puts("#\nREMAP");
+ PrintRemapForSubstDrives();
+ bool printedMountPoints = true;
+ for (int i = 0; i < ROOT_COUNT; i++) {
+ if (watchRootInfos[i].bUsed) {
+ char rootPath[8];
+ sprintf_s(rootPath, 8, "%c:\\", watchRootInfos[i].driveLetter);
+ if (!PrintMountPoints(rootPath))
+ printedMountPoints = false;
+ }
+ }
+ if (!printedMountPoints) {
+ PrintWatchRootReparsePoints();
+ }
+ puts("#");
+ fflush(stdout);
+ LeaveCriticalSection(&csOutput);
}
-void AddWatchRoot(const char *path)
-{
- WatchRoot *watchRoot = (WatchRoot *) malloc(sizeof(WatchRoot));
- watchRoot->next = NULL;
- watchRoot->path = _strdup(path);
- watchRoot->next = firstWatchRoot;
- firstWatchRoot = watchRoot;
+void AddWatchRoot(const char *path) {
+ WatchRoot *watchRoot = (WatchRoot *) malloc(sizeof(WatchRoot));
+ watchRoot->next = NULL;
+ watchRoot->path = _strdup(path);
+ watchRoot->next = firstWatchRoot;
+ firstWatchRoot = watchRoot;
}
-void FreeWatchRootsList()
-{
- WatchRoot *pWatchRoot = firstWatchRoot;
- WatchRoot *pNext;
- while(pWatchRoot)
- {
- pNext = pWatchRoot->next;
- free(pWatchRoot->path);
- free(pWatchRoot);
- pWatchRoot=pNext;
- }
- firstWatchRoot = NULL;
+void FreeWatchRootsList() {
+ WatchRoot *pWatchRoot = firstWatchRoot;
+ WatchRoot *pNext;
+ while (pWatchRoot) {
+ pNext = pWatchRoot->next;
+ free(pWatchRoot->path);
+ free(pWatchRoot);
+ pWatchRoot = pNext;
+ }
+ firstWatchRoot = NULL;
}
// -- Main - filewatcher protocol ---------------------------------------------
-int _tmain(int argc, _TCHAR* argv[])
-{
- InitializeCriticalSection(&csOutput);
-
- for(int i=0; i<26; i++)
- {
- watchRootInfos [i].driveLetter = 'A' + i;
- watchRootInfos [i].bInitialized = false;
- watchRootInfos [i].bUsed = false;
- }
-
- char buffer[8192];
- while(true)
- {
- if (!gets_s(buffer, sizeof(buffer)-1))
- break;
-
- if (!strcmp(buffer, "ROOTS"))
- {
- MarkAllRootsUnused();
- FreeWatchRootsList();
- bool failed = false;
- while(true)
- {
- if (!gets_s(buffer, sizeof(buffer)-1))
- {
- failed = true;
- break;
- }
- if (buffer [0] == '#')
- break;
- int driveLetterPos = 0;
- char *pDriveLetter = buffer;
- if (*pDriveLetter == '|')
- pDriveLetter++;
-
- AddWatchRoot(pDriveLetter);
-
- _strupr_s(buffer, sizeof(buffer)-1);
- char driveLetter = *pDriveLetter;
- if (driveLetter >= 'A' && driveLetter <= 'Z')
- {
- watchRootInfos [driveLetter-'A'].bUsed = true;
- }
- }
- if (failed)
- break;
-
- UpdateRoots();
- }
- if (!strcmp(buffer, "EXIT"))
- break;
- }
-
- MarkAllRootsUnused();
- UpdateRoots();
-
- DeleteCriticalSection(&csOutput);
+int _tmain(int argc, _TCHAR *argv[]) {
+ InitializeCriticalSection(&csOutput);
+
+ for (int i = 0; i < 26; i++) {
+ watchRootInfos[i].driveLetter = 'A' + i;
+ watchRootInfos[i].bInitialized = false;
+ watchRootInfos[i].bUsed = false;
+ }
+
+ char buffer[8192];
+ while (true) {
+ if (!gets_s(buffer, sizeof(buffer) - 1))
+ break;
+
+ if (!strcmp(buffer, "ROOTS")) {
+ MarkAllRootsUnused();
+ FreeWatchRootsList();
+ bool failed = false;
+ while (true) {
+ if (!gets_s(buffer, sizeof(buffer) - 1)) {
+ failed = true;
+ break;
+ }
+ if (buffer[0] == '#')
+ break;
+ int driveLetterPos = 0;
+ char *pDriveLetter = buffer;
+ if (*pDriveLetter == '|')
+ pDriveLetter++;
+
+ AddWatchRoot(pDriveLetter);
+
+ _strupr_s(buffer, sizeof(buffer) - 1);
+ char driveLetter = *pDriveLetter;
+ if (driveLetter >= 'A' && driveLetter <= 'Z') {
+ watchRootInfos[driveLetter - 'A'].bUsed = true;
+ }
+ }
+ if (failed)
+ break;
+
+ UpdateRoots();
+ }
+ if (!strcmp(buffer, "EXIT"))
+ break;
+ }
+
+ MarkAllRootsUnused();
+ UpdateRoots();
+
+ DeleteCriticalSection(&csOutput);
}
diff --git a/native/fileWatcher/fileWatcher3.rc b/native/fileWatcher/fileWatcher3.rc
index 713a55dfb34d..9006b5468442 100644
--- a/native/fileWatcher/fileWatcher3.rc
+++ b/native/fileWatcher/fileWatcher3.rc
@@ -1,100 +1,37 @@
-// Microsoft Visual C++ generated resource script.
-//
-#include "resource.h"
+#include <windows.h>
-#define APSTUDIO_READONLY_SYMBOLS
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 2 resource.
-//
-#include "afxres.h"
+#define FILE_VERSION 14,0,0,1
+#define FILE_VERSION_STR "14.0.0.1"
+#define APP_VERSION 14,0,0,0
+#define APP_VERSION_STR "14"
-/////////////////////////////////////////////////////////////////////////////
-#undef APSTUDIO_READONLY_SYMBOLS
-
-/////////////////////////////////////////////////////////////////////////////
-// Russian (Russia) resources
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_RUS)
-LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT
-#pragma code_page(1251)
-
-#ifdef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// TEXTINCLUDE
-//
-
-1 TEXTINCLUDE
-BEGIN
- "resource.h\0"
-END
-
-2 TEXTINCLUDE
-BEGIN
- "#include ""afxres.h""\r\n"
- "\0"
-END
-
-3 TEXTINCLUDE
-BEGIN
- "\r\n"
- "\0"
-END
-
-#endif // APSTUDIO_INVOKED
-
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Version
-//
+#pragma code_page(65001)
VS_VERSION_INFO VERSIONINFO
- FILEVERSION 1,0,0,1
- PRODUCTVERSION 1,0,0,1
- FILEFLAGSMASK 0x17L
-#ifdef _DEBUG
- FILEFLAGS 0x1L
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS 0x4L
- FILETYPE 0x1L
- FILESUBTYPE 0x0L
+FILEVERSION FILE_VERSION
+PRODUCTVERSION APP_VERSION
+FILEFLAGSMASK 0
+FILEFLAGS 0
+FILEOS VOS__WINDOWS32
+FILETYPE VFT_APP
+FILESUBTYPE 0
BEGIN
BLOCK "StringFileInfo"
BEGIN
- BLOCK "041904b0"
+ BLOCK "0000fde9"
BEGIN
VALUE "CompanyName", "JetBrains s.r.o."
- VALUE "FileDescription", "File System Notification Processor"
- VALUE "FileVersion", "1, 0, 0, 1"
+ VALUE "FileDescription", "Filesystem events processor"
+ VALUE "FileVersion", FILE_VERSION_STR
VALUE "InternalName", "fsnotifier"
- VALUE "LegalCopyright", "Copyright (C) 2008-13 JetBrains s.r.o."
+ VALUE "LegalCopyright", "Copyright (C) 2008-2014 JetBrains s.r.o."
VALUE "OriginalFilename", "fsnotifier.exe"
- VALUE "ProductName", "IntelliJ IDEA"
- VALUE "ProductVersion", "1, 0, 0, 1"
+ VALUE "ProductName", "IntelliJ Platform"
+ VALUE "ProductVersion", APP_VERSION_STR
END
END
BLOCK "VarFileInfo"
BEGIN
- VALUE "Translation", 0x419, 1200
+ VALUE "Translation", 0, 0xfde9
END
END
-
-#endif // Russian (Russia) resources
-/////////////////////////////////////////////////////////////////////////////
-
-
-
-#ifndef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 3 resource.
-//
-
-
-/////////////////////////////////////////////////////////////////////////////
-#endif // not APSTUDIO_INVOKED
-
diff --git a/native/fileWatcher/fileWatcher3.sln b/native/fileWatcher/fileWatcher3.sln
index 821f143003c1..7d39f3e10289 100644
--- a/native/fileWatcher/fileWatcher3.sln
+++ b/native/fileWatcher/fileWatcher3.sln
@@ -1,7 +1,9 @@

-Microsoft Visual Studio Solution File, Format Version 10.00
-# Visual Studio 2008
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fileWatcher3", "fileWatcher3.vcproj", "{0EF2C2DB-0E16-4BC3-9927-9C51AF00EB57}"
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Express 2013 for Windows Desktop
+VisualStudioVersion = 12.0.21005.1
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fileWatcher3", "fileWatcher3.vcxproj", "{0EF2C2DB-0E16-4BC3-9927-9C51AF00EB57}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
diff --git a/native/fileWatcher/fileWatcher3.vcproj b/native/fileWatcher/fileWatcher3.vcproj
deleted file mode 100644
index 14ec211e54f3..000000000000
--- a/native/fileWatcher/fileWatcher3.vcproj
+++ /dev/null
@@ -1,221 +0,0 @@
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="9,00"
- Name="fileWatcher3"
- ProjectGUID="{0EF2C2DB-0E16-4BC3-9927-9C51AF00EB57}"
- RootNamespace="fileWatcher3"
- Keyword="Win32Proj"
- TargetFrameworkVersion="196613"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="1"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="mpr.lib"
- OutputFile="$(OutDir)\fsnotifier.exe"
- LinkIncremental="1"
- GenerateDebugInformation="true"
- SubSystem="1"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="1"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- EnableIntrinsicFunctions="true"
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
- RuntimeLibrary="0"
- EnableFunctionLevelLinking="true"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="mpr.lib"
- OutputFile="$(OutDir)\fsnotifier.exe"
- LinkIncremental="1"
- GenerateDebugInformation="true"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath=".\fileWatcher3.cpp"
- >
- </File>
- <File
- RelativePath=".\stdafx.cpp"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- <File
- RelativePath=".\resource.h"
- >
- </File>
- <File
- RelativePath=".\stdafx.h"
- >
- </File>
- <File
- RelativePath=".\targetver.h"
- >
- </File>
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
- >
- <File
- RelativePath=".\fileWatcher3.rc"
- >
- </File>
- </Filter>
- <File
- RelativePath=".\ReadMe.txt"
- >
- </File>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/native/fileWatcher/fileWatcher3.vcxproj b/native/fileWatcher/fileWatcher3.vcxproj
new file mode 100644
index 000000000000..5115e0ae1b45
--- /dev/null
+++ b/native/fileWatcher/fileWatcher3.vcxproj
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{0EF2C2DB-0E16-4BC3-9927-9C51AF00EB57}</ProjectGuid>
+ <RootNamespace>fileWatcher3</RootNamespace>
+ <Keyword>Win32Proj</Keyword>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <PlatformToolset>v120_xp</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <PlatformToolset>v120_xp</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup>
+ <_ProjectFileVersion>12.0.21005.1</_ProjectFileVersion>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <OutDir>$(SolutionDir)$(Configuration)\</OutDir>
+ <IntDir>$(Configuration)\</IntDir>
+ <LinkIncremental>false</LinkIncremental>
+ <TargetName>fsnotifier</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <OutDir>$(SolutionDir)$(Configuration)\</OutDir>
+ <IntDir>$(Configuration)\</IntDir>
+ <LinkIncremental>false</LinkIncremental>
+ <TargetName>fsnotifier</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MinimalRebuild>true</MinimalRebuild>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+ <PrecompiledHeader />
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>mpr.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Console</SubSystem>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <Optimization>MaxSpeed</Optimization>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <PrecompiledHeader />
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>mpr.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Console</SubSystem>
+ <OptimizeReferences>true</OptimizeReferences>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="fileWatcher3.cpp" />
+ </ItemGroup>
+ <ItemGroup>
+ <ResourceCompile Include="fileWatcher3.rc" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project> \ No newline at end of file
diff --git a/native/fileWatcher/fileWatcher3.vcxproj.filters b/native/fileWatcher/fileWatcher3.vcxproj.filters
new file mode 100644
index 000000000000..e6b22705afd1
--- /dev/null
+++ b/native/fileWatcher/fileWatcher3.vcxproj.filters
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+ <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+ <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
+ </Filter>
+ <Filter Include="Resource Files">
+ <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+ <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="fileWatcher3.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <ResourceCompile Include="fileWatcher3.rc">
+ <Filter>Resource Files</Filter>
+ </ResourceCompile>
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/native/fileWatcher/resource.h b/native/fileWatcher/resource.h
deleted file mode 100644
index 08209cb442ed..000000000000
--- a/native/fileWatcher/resource.h
+++ /dev/null
@@ -1,14 +0,0 @@
-//{{NO_DEPENDENCIES}}
-// Microsoft Visual C++ generated include file.
-// Used by fileWatcher3.rc
-
-// Next default values for new objects
-//
-#ifdef APSTUDIO_INVOKED
-#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 101
-#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1001
-#define _APS_NEXT_SYMED_VALUE 101
-#endif
-#endif
diff --git a/native/fileWatcher/stdafx.cpp b/native/fileWatcher/stdafx.cpp
deleted file mode 100644
index 43037457f450..000000000000
--- a/native/fileWatcher/stdafx.cpp
+++ /dev/null
@@ -1,8 +0,0 @@
-// stdafx.cpp : source file that includes just the standard includes
-// fileWatcher3.pch will be the pre-compiled header
-// stdafx.obj will contain the pre-compiled type information
-
-#include "stdafx.h"
-
-// TODO: reference any additional headers you need in STDAFX.H
-// and not in this file
diff --git a/native/fileWatcher/stdafx.h b/native/fileWatcher/stdafx.h
deleted file mode 100644
index 624e5185d245..000000000000
--- a/native/fileWatcher/stdafx.h
+++ /dev/null
@@ -1,15 +0,0 @@
-// stdafx.h : include file for standard system include files,
-// or project specific include files that are used frequently, but
-// are changed infrequently
-//
-
-#pragma once
-
-#include "targetver.h"
-
-#include <stdio.h>
-#include <tchar.h>
-#include <windows.h>
-#include <process.h>
-
-// TODO: reference additional headers your program requires here
diff --git a/native/fileWatcher/targetver.h b/native/fileWatcher/targetver.h
deleted file mode 100644
index 7021c2a55bec..000000000000
--- a/native/fileWatcher/targetver.h
+++ /dev/null
@@ -1,13 +0,0 @@
-#pragma once
-
-// The following macros define the minimum required platform. The minimum required platform
-// is the earliest version of Windows, Internet Explorer etc. that has the necessary features to run
-// your application. The macros work by enabling all features available on platform versions up to and
-// including the version specified.
-
-// Modify the following defines if you have to target a platform prior to the ones specified below.
-// Refer to MSDN for the latest info on corresponding values for different platforms.
-#ifndef _WIN32_WINNT // Specifies that the minimum required platform is Windows Vista.
-#define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows.
-#endif
-
diff --git a/platform/analysis-api/src/com/intellij/analysis/AnalysisScope.java b/platform/analysis-api/src/com/intellij/analysis/AnalysisScope.java
index f1255edc01f6..b18bb042c183 100644
--- a/platform/analysis-api/src/com/intellij/analysis/AnalysisScope.java
+++ b/platform/analysis-api/src/com/intellij/analysis/AnalysisScope.java
@@ -249,7 +249,7 @@ public class AnalysisScope {
@NotNull
@Override
public Result visitFileEx(@NotNull VirtualFile file) {
- boolean ignored = fileIndex.isIgnored(file);
+ boolean ignored = fileIndex.isExcluded(file);
if (!ignored && !file.isDirectory()) {
files.add(file);
}
diff --git a/platform/analysis-api/src/com/intellij/codeHighlighting/HighlightDisplayLevel.java b/platform/analysis-api/src/com/intellij/codeHighlighting/HighlightDisplayLevel.java
index 492aa7872064..75a2eca11e43 100644
--- a/platform/analysis-api/src/com/intellij/codeHighlighting/HighlightDisplayLevel.java
+++ b/platform/analysis-api/src/com/intellij/codeHighlighting/HighlightDisplayLevel.java
@@ -107,8 +107,8 @@ public class HighlightDisplayLevel {
}
}
- private static class ImageHolder {
- private static final Image ourErrorMaskImage = ImageLoader.loadFromResource("/general/errorMask.png");
+ public static class ImageHolder {
+ public static final Image ourErrorMaskImage = ImageLoader.loadFromResource("/general/errorMask.png");
}
private static final int EMPTY_ICON_DIM = 12;
@@ -138,24 +138,35 @@ public class HighlightDisplayLevel {
@NotNull
public static Icon createIconByMask(final Color renderColor) {
- return new Icon() {
- @Override
- public void paintIcon(Component c, Graphics g, int x, int y) {
- Graphics2D g2 = (Graphics2D)g;
- g2.drawImage(ImageHolder.ourErrorMaskImage, x, y, renderColor, null);
- }
+ return new SingleColorIconWithMask(renderColor);
+ }
+ public static class SingleColorIconWithMask implements Icon {
- @Override
- public int getIconWidth() {
- return EMPTY_ICON_DIM;
- }
+ private final Color myColor;
+ public SingleColorIconWithMask(final Color color) {
+ myColor = color;
+ }
- @Override
- public int getIconHeight() {
- return EMPTY_ICON_DIM;
- }
- };
+ public Color getColor() {
+ return myColor;
+ }
+
+ @Override
+ public void paintIcon(final Component c, final Graphics g, final int x, final int y) {
+ final Graphics2D g2 = (Graphics2D)g;
+ g2.drawImage(ImageHolder.ourErrorMaskImage, x, y, myColor, null);
+ }
+
+ @Override
+ public int getIconWidth() {
+ return EMPTY_ICON_DIM;
+ }
+
+ @Override
+ public int getIconHeight() {
+ return EMPTY_ICON_DIM;
+ }
}
}
diff --git a/platform/analysis-api/src/com/intellij/codeInspection/ex/ScopeToolState.java b/platform/analysis-api/src/com/intellij/codeInspection/ex/ScopeToolState.java
index e82cbe65ffd9..3a75f1738ead 100644
--- a/platform/analysis-api/src/com/intellij/codeInspection/ex/ScopeToolState.java
+++ b/platform/analysis-api/src/com/intellij/codeInspection/ex/ScopeToolState.java
@@ -57,6 +57,10 @@ public class ScopeToolState {
myLevel = level;
}
+ public ScopeToolState copy() {
+ return new ScopeToolState(myScopeName, myToolWrapper, myEnabled, myLevel);
+ }
+
@Nullable
public NamedScope getScope(Project project) {
if (myScope == null) {
diff --git a/platform/analysis-api/src/com/intellij/psi/search/scope/ProjectFilesScope.java b/platform/analysis-api/src/com/intellij/psi/search/scope/ProjectFilesScope.java
index 52313eaaceab..e55cd9d5cfbd 100644
--- a/platform/analysis-api/src/com/intellij/psi/search/scope/ProjectFilesScope.java
+++ b/platform/analysis-api/src/com/intellij/psi/search/scope/ProjectFilesScope.java
@@ -42,7 +42,7 @@ public class ProjectFilesScope extends NamedScope {
if (file == null) return false;
final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex();
return holder.getProject().isInitialized()
- && !fileIndex.isIgnored(file)
+ && !fileIndex.isExcluded(file)
&& fileIndex.getContentRootForFile(file) != null;
}
});
diff --git a/platform/analysis-impl/src/com/intellij/codeInspection/ex/InspectionProfileImpl.java b/platform/analysis-impl/src/com/intellij/codeInspection/ex/InspectionProfileImpl.java
index e37a348a4d54..d8dc5d00656a 100644
--- a/platform/analysis-impl/src/com/intellij/codeInspection/ex/InspectionProfileImpl.java
+++ b/platform/analysis-impl/src/com/intellij/codeInspection/ex/InspectionProfileImpl.java
@@ -85,6 +85,7 @@ public class InspectionProfileImpl extends ProfileEx implements ModifiableModel,
private final ExternalInfo myExternalInfo = new ExternalInfo();
@TestOnly
public static boolean INIT_INSPECTIONS = false;
+ private List<NamedScope> myScopes = Collections.emptyList();
@Override
public void setModified(final boolean modified) {
@@ -466,8 +467,10 @@ public class InspectionProfileImpl extends ProfileEx implements ModifiableModel,
getTools(toolId, element.getProject()).disableTool(element);
}
- public void disableToolByDefault(@NotNull String toolId, Project project) {
- getToolDefaultState(toolId, project).setEnabled(false);
+ public void disableToolByDefault(@NotNull List<String> toolIds, Project project) {
+ for (final String toolId : toolIds) {
+ getToolDefaultState(toolId, project).setEnabled(false);
+ }
}
@NotNull
@@ -475,8 +478,10 @@ public class InspectionProfileImpl extends ProfileEx implements ModifiableModel,
return getTools(toolId, project).getDefaultState();
}
- public void enableToolByDefault(@NotNull String toolId, Project project) {
- getToolDefaultState(toolId, project).setEnabled(true);
+ public void enableToolsByDefault(@NotNull List<String> toolIds, Project project) {
+ for (final String toolId : toolIds) {
+ getToolDefaultState(toolId, project).setEnabled(true);
+ }
}
public boolean wasInitialized() {
@@ -587,7 +592,6 @@ public class InspectionProfileImpl extends ProfileEx implements ModifiableModel,
final ScopeToolState defaultState = toolList.getDefaultState();
tools.setDefaultState(copyToolSettings(defaultState.getTool()), defaultState.isEnabled(), defaultState.getLevel());
tools.removeAllScopes();
- tools.setEnabled(toolList.isEnabled());
final List<ScopeToolState> nonDefaultToolStates = toolList.getNonDefaultTools();
if (nonDefaultToolStates != null) {
for (ScopeToolState state : nonDefaultToolStates) {
@@ -601,6 +605,7 @@ public class InspectionProfileImpl extends ProfileEx implements ModifiableModel,
}
}
}
+ tools.setEnabled(toolList.isEnabled());
}
}
catch (WriteExternalException e) {
@@ -649,11 +654,22 @@ public class InspectionProfileImpl extends ProfileEx implements ModifiableModel,
getTools(inspectionTool, project).enableTool(namedScope, project);
}
+ public void enableTools(@NotNull List<String> inspectionTools, NamedScope namedScope, Project project) {
+ for (String inspectionTool : inspectionTools) {
+ enableTool(inspectionTool, namedScope, project);
+ }
+ }
+
@Override
public void disableTool(@NotNull String inspectionTool, NamedScope namedScope, @NotNull Project project) {
getTools(inspectionTool, project).disableTool(namedScope, project);
}
+ public void disableTools(@NotNull List<String> inspectionTools, NamedScope namedScope, @NotNull Project project) {
+ for (String inspectionTool : inspectionTools) {
+ disableTool(inspectionTool, namedScope, project);
+ }
+ }
@Override
public void disableTool(@NotNull String inspectionTool, Project project) {
@@ -833,10 +849,21 @@ public class InspectionProfileImpl extends ProfileEx implements ModifiableModel,
return getTools(key.toString(), project).isEnabled(namedScope,project);
}
+ @Deprecated
public void removeScope(@NotNull String toolId, int scopeIdx, Project project) {
getTools(toolId, project).removeScope(scopeIdx);
}
+ public void removeScope(@NotNull String toolId, @NotNull NamedScope scope, Project project) {
+ getTools(toolId, project).removeScope(scope);
+ }
+
+ public void removeScopes(@NotNull List<String> toolIds, @NotNull NamedScope scope, Project project) {
+ for (final String toolId : toolIds) {
+ removeScope(toolId, scope, project);
+ }
+ }
+
public void removeAllScopes(@NotNull String toolId, Project project) {
getTools(toolId, project).removeAllScopes();
}
@@ -884,7 +911,13 @@ public class InspectionProfileImpl extends ProfileEx implements ModifiableModel,
getTools(key.toString(), project).setLevel(level, scopeIdx, project);
}
- private ToolsImpl getTools(@NotNull String toolId, Project project) {
+ public void setErrorLevel(@NotNull List<HighlightDisplayKey> keys, @NotNull HighlightDisplayLevel level, int scopeIdx, Project project) {
+ for (HighlightDisplayKey key : keys) {
+ getTools(key.toString(), project).setLevel(level, scopeIdx, project);
+ }
+ }
+
+ public ToolsImpl getTools(@NotNull String toolId, Project project) {
initInspectionTools(project);
return myTools.get(toolId);
}
@@ -910,4 +943,11 @@ public class InspectionProfileImpl extends ProfileEx implements ModifiableModel,
public boolean equals(Object o) {
return super.equals(o) && ((InspectionProfileImpl)o).getProfileManager() == getProfileManager();
}
+
+ /**
+ * @return list of used scopes for all inspections
+ */
+ public List<NamedScope> getUsedScopes() {
+ return myScopes;
+ }
}
diff --git a/platform/analysis-impl/src/com/intellij/codeInspection/ex/ToolsImpl.java b/platform/analysis-impl/src/com/intellij/codeInspection/ex/ToolsImpl.java
index 4208c8517432..b28dad40f094 100644
--- a/platform/analysis-impl/src/com/intellij/codeInspection/ex/ToolsImpl.java
+++ b/platform/analysis-impl/src/com/intellij/codeInspection/ex/ToolsImpl.java
@@ -58,9 +58,7 @@ public class ToolsImpl implements Tools {
private boolean myEnabled;
public ToolsImpl(@NotNull InspectionToolWrapper toolWrapper, @NotNull HighlightDisplayLevel level, boolean enabled, boolean enabledByDefault) {
- myShortName = toolWrapper.getShortName();
- myEnabled = enabled;
- myDefaultState = new ScopeToolState(CustomScopesProviderEx.getAllScope(), toolWrapper, enabledByDefault, level);
+ this(toolWrapper.getShortName(), new ScopeToolState(CustomScopesProviderEx.getAllScope(), toolWrapper, enabledByDefault, level), null, enabled);
}
@TestOnly
@@ -68,6 +66,13 @@ public class ToolsImpl implements Tools {
this(toolWrapper, level, enabled, enabled);
}
+ private ToolsImpl(@NotNull String shortName, @NotNull ScopeToolState defaultState, @Nullable List<ScopeToolState> tools, boolean enabled) {
+ myShortName = shortName;
+ myDefaultState = defaultState;
+ myTools = tools;
+ myEnabled = enabled;
+ }
+
@NotNull
public ScopeToolState addTool(@NotNull NamedScope scope, @NotNull InspectionToolWrapper toolWrapper, boolean enabled, @NotNull HighlightDisplayLevel level) {
return insertTool(scope, toolWrapper, enabled, level, myTools != null ? myTools.size() : 0);
@@ -78,13 +83,23 @@ public class ToolsImpl implements Tools {
return insertTool(scope, toolWrapper, enabled, level, 0);
}
+ public ScopeToolState addTool(@NotNull String scopeName, @NotNull InspectionToolWrapper toolWrapper, boolean enabled, @NotNull HighlightDisplayLevel level) {
+ return insertTool(new ScopeToolState(scopeName, toolWrapper, enabled, level), myTools != null ? myTools.size() : 0);
+ }
+
@NotNull
private ScopeToolState insertTool(@NotNull NamedScope scope, @NotNull InspectionToolWrapper toolWrapper, boolean enabled, @NotNull HighlightDisplayLevel level, int idx) {
+ return insertTool(new ScopeToolState(scope, toolWrapper, enabled, level), idx);
+ }
+
+ @NotNull
+ private ScopeToolState insertTool(@NotNull final ScopeToolState scopeToolState, final int idx) {
if (myTools == null) {
myTools = new ArrayList<ScopeToolState>();
- setEnabled(true);
+ if (scopeToolState.isEnabled()) {
+ setEnabled(true);
+ }
}
- final ScopeToolState scopeToolState = new ScopeToolState(scope, toolWrapper, enabled, level);
myTools.add(idx, scopeToolState);
return scopeToolState;
}
@@ -166,7 +181,6 @@ public class ToolsImpl implements Tools {
myDefaultState.setLevel(level);
final String enabled = toolElement.getAttributeValue(ENABLED_ATTRIBUTE);
final boolean isEnabled = enabled != null && Boolean.parseBoolean(enabled);
- myEnabled = isEnabled;
final String enabledTool = toolElement.getAttributeValue(ENABLED_BY_DEFAULT_ATTRIBUTE);
myDefaultState.setEnabled(enabledTool != null ? Boolean.parseBoolean(enabledTool) : isEnabled);
@@ -208,16 +222,8 @@ public class ToolsImpl implements Tools {
if (toolElement.getAttributes().size() > 4 || toolElement.getChildren().size() > scopeElements.size()) {
toolWrapper.getTool().readSettings(toolElement);
}
- }
- public ScopeToolState addTool(@NotNull String scopeName, @NotNull InspectionToolWrapper toolWrapper, boolean enabled, @NotNull HighlightDisplayLevel level) {
- if (myTools == null) {
- myTools = new ArrayList<ScopeToolState>();
- setEnabled(true);
- }
- final ScopeToolState scopeToolState = new ScopeToolState(scopeName, toolWrapper, enabled, level);
- myTools.add(scopeToolState);
- return scopeToolState;
+ myEnabled = isEnabled;
}
@NotNull
@@ -252,6 +258,21 @@ public class ToolsImpl implements Tools {
}
}
+ public void removeScope(final NamedScope scope) {
+ if (myTools != null) {
+ for (final ScopeToolState tool : myTools) {
+ if (Comparing.equal(tool.getScopeName(), scope.getName())) {
+ myTools.remove(tool);
+ break;
+ }
+ }
+ if (myTools.isEmpty()) {
+ myTools = null;
+ setEnabled(myDefaultState.isEnabled());
+ }
+ }
+ }
+
public void removeAllScopes() {
myTools = null;
}
diff --git a/platform/annotations/src/org/jetbrains/annotations/NotNull.java b/platform/annotations/src/org/jetbrains/annotations/NotNull.java
index aa7c78b3d225..3ad6003f554c 100644
--- a/platform/annotations/src/org/jetbrains/annotations/NotNull.java
+++ b/platform/annotations/src/org/jetbrains/annotations/NotNull.java
@@ -30,5 +30,17 @@ import java.lang.annotation.*;
@Retention(RetentionPolicy.CLASS)
@Target({ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.LOCAL_VARIABLE})
public @interface NotNull {
+ /**
+ * @return Custom exception message
+ */
String value() default "";
+
+ /**
+ * @return Custom exception type that should be thrown when not-nullity contract is violated.
+ * The exception class should have a constructor with one String argument (message).
+ *
+ * By default, {@link java.lang.IllegalArgumentException} is thrown on null method arguments and
+ * {@link java.lang.IllegalStateException} &mdash; on null return value.
+ */
+ Class<? extends Exception> exception() default Exception.class;
}
diff --git a/platform/core-api/src/com/intellij/openapi/project/DumbService.java b/platform/core-api/src/com/intellij/openapi/project/DumbService.java
index ad5c36a5d3e2..a0f5b43ce308 100644
--- a/platform/core-api/src/com/intellij/openapi/project/DumbService.java
+++ b/platform/core-api/src/com/intellij/openapi/project/DumbService.java
@@ -87,13 +87,15 @@ public abstract class DumbService {
}
@Nullable
- public <T> T tryRunReadActionInSmartMode(@NotNull Computable<T> task, @NotNull String notification) {
+ public <T> T tryRunReadActionInSmartMode(@NotNull Computable<T> task, @Nullable String notification) {
if (ApplicationManager.getApplication().isReadAccessAllowed()) {
try {
return task.compute();
}
catch (IndexNotReadyException e) {
- showDumbModeNotification(notification);
+ if (notification != null) {
+ showDumbModeNotification(notification);
+ }
return null;
}
}
diff --git a/platform/core-api/src/com/intellij/openapi/util/AsyncValueLoader.java b/platform/core-api/src/com/intellij/openapi/util/AsyncValueLoader.java
index f3b13dc6963c..e5b230788424 100644
--- a/platform/core-api/src/com/intellij/openapi/util/AsyncValueLoader.java
+++ b/platform/core-api/src/com/intellij/openapi/util/AsyncValueLoader.java
@@ -2,6 +2,7 @@ package com.intellij.openapi.util;
import com.intellij.openapi.Disposable;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
import java.io.IOException;
import java.util.concurrent.atomic.AtomicReference;
@@ -125,7 +126,7 @@ public abstract class AsyncValueLoader<T> {
protected abstract void load(@NotNull AsyncResult<T> result) throws IOException;
- protected boolean isUpToDate(@NotNull T result) {
+ protected boolean isUpToDate(@Nullable T result) {
return loadedModificationCount == modificationCount;
}
diff --git a/platform/core-api/src/com/intellij/patterns/ElementPatternCondition.java b/platform/core-api/src/com/intellij/patterns/ElementPatternCondition.java
index 45b0a16909ad..c335dd62f716 100644
--- a/platform/core-api/src/com/intellij/patterns/ElementPatternCondition.java
+++ b/platform/core-api/src/com/intellij/patterns/ElementPatternCondition.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -15,27 +15,38 @@
*/
package com.intellij.patterns;
-import com.intellij.util.SmartList;
import com.intellij.util.ProcessingContext;
+import com.intellij.util.SmartList;
import org.jetbrains.annotations.Nullable;
+import java.util.Collections;
import java.util.List;
/**
* @author peter
*/
+@SuppressWarnings("ForLoopReplaceableByForEach")
public class ElementPatternCondition<T> {
+
private final InitialPatternCondition<T> myInitialCondition;
- private final List<PatternCondition<? super T>> myConditions = new SmartList<PatternCondition<? super T>>();
+ private final List<PatternCondition<? super T>> myConditions;
public ElementPatternCondition(final InitialPatternCondition<T> startCondition) {
myInitialCondition = startCondition;
+ myConditions = Collections.emptyList();
+ }
+
+ protected ElementPatternCondition(final ElementPatternCondition<T> original,
+ final PatternCondition<? super T> condition) {
+ myInitialCondition = original.getInitialCondition();
+ myConditions = new SmartList<PatternCondition<? super T>>(original.getConditions());
+ myConditions.add(condition);
}
public boolean accepts(@Nullable Object o, final ProcessingContext context) {
if (!myInitialCondition.accepts(o, context)) return false;
final int listSize = myConditions.size();
- for (int i=0; i<listSize; i++) {
+ for (int i = 0; i < listSize; i++) {
if (!myConditions.get(i).accepts((T)o, context)) return false;
}
return true;
@@ -66,9 +77,6 @@ public class ElementPatternCondition<T> {
}
public ElementPatternCondition<T> append(PatternCondition<? super T> condition) {
- final ElementPatternCondition<T> copy = new ElementPatternCondition<T>(myInitialCondition);
- copy.myConditions.addAll(myConditions);
- copy.myConditions.add(condition);
- return copy;
+ return new ElementPatternCondition<T>(this, condition);
}
}
diff --git a/platform/core-api/src/com/intellij/patterns/ObjectPattern.java b/platform/core-api/src/com/intellij/patterns/ObjectPattern.java
index cf9f751c9852..5a6a9c62054b 100644
--- a/platform/core-api/src/com/intellij/patterns/ObjectPattern.java
+++ b/platform/core-api/src/com/intellij/patterns/ObjectPattern.java
@@ -24,7 +24,10 @@ import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
-import java.util.*;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
/**
* @author peter
@@ -93,7 +96,11 @@ public abstract class ObjectPattern<T, Self extends ObjectPattern<T, Self>> impl
public Self oneOf(final T... values) {
final Collection<T> list;
- if (values.length >= 11) {
+ final int length = values.length;
+ if (length == 1) {
+ list = Collections.singletonList(values[0]);
+ }
+ else if (length >= 11) {
list = new HashSet<T>(Arrays.asList(values));
}
else {
diff --git a/platform/core-api/src/com/intellij/patterns/StringPattern.java b/platform/core-api/src/com/intellij/patterns/StringPattern.java
index 13e148d479c1..ad235353ebbc 100644
--- a/platform/core-api/src/com/intellij/patterns/StringPattern.java
+++ b/platform/core-api/src/com/intellij/patterns/StringPattern.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -56,7 +56,7 @@ public class StringPattern extends ObjectPattern<String, StringPattern> {
return with(new PatternCondition<String>("startsWith") {
@Override
public boolean accepts(@NotNull final String str, final ProcessingContext context) {
- return str.startsWith(s);
+ return StringUtil.startsWith(str, s);
}
});
}
@@ -66,7 +66,7 @@ public class StringPattern extends ObjectPattern<String, StringPattern> {
return with(new PatternCondition<String>("endsWith") {
@Override
public boolean accepts(@NotNull final String str, final ProcessingContext context) {
- return str.endsWith(s);
+ return StringUtil.endsWith(str, s);
}
});
}
@@ -76,9 +76,8 @@ public class StringPattern extends ObjectPattern<String, StringPattern> {
return with(new PatternCondition<String>("contains") {
@Override
public boolean accepts(@NotNull final String str, final ProcessingContext context) {
- return str.contains(s);
+ return StringUtil.contains(str, s);
}
-
});
}
@@ -87,10 +86,7 @@ public class StringPattern extends ObjectPattern<String, StringPattern> {
return with(new PatternCondition<String>("containsChars") {
@Override
public boolean accepts(@NotNull final String str, final ProcessingContext context) {
- for (int i=0, len=s.length(); i<len; i++) {
- if (str.indexOf(s.charAt(i))>-1) return true;
- }
- return false;
+ return StringUtil.containsAnyChar(str, s);
}
});
}
@@ -178,6 +174,7 @@ public class StringPattern extends ObjectPattern<String, StringPattern> {
}
});
}
+
public StringPattern shorterThan(final int maxLength) {
return with(new PatternCondition<String>("shorterThan") {
@Override
@@ -186,6 +183,7 @@ public class StringPattern extends ObjectPattern<String, StringPattern> {
}
});
}
+
public StringPattern withLength(final int length) {
return with(new PatternCondition<String>("withLength") {
@Override
diff --git a/platform/core-api/src/com/intellij/psi/stubs/DefaultStubBuilder.java b/platform/core-api/src/com/intellij/psi/stubs/DefaultStubBuilder.java
index 1a8c2003efea..b4290e83651a 100644
--- a/platform/core-api/src/com/intellij/psi/stubs/DefaultStubBuilder.java
+++ b/platform/core-api/src/com/intellij/psi/stubs/DefaultStubBuilder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -36,11 +36,13 @@ public class DefaultStubBuilder implements StubBuilder {
return buildStubTreeFor(file, createStubForFile(file));
}
+ @NotNull
protected StubElement createStubForFile(@NotNull PsiFile file) {
@SuppressWarnings("unchecked") PsiFileStubImpl stub = new PsiFileStubImpl(file);
return stub;
}
+ @NotNull
private StubElement buildStubTreeFor(@NotNull PsiElement root, @NotNull StubElement parentStub) {
Stack<StubElement> parentStubs = new Stack<StubElement>();
Stack<PsiElement> parentElements = new Stack<PsiElement>();
@@ -84,6 +86,7 @@ public class DefaultStubBuilder implements StubBuilder {
return false;
}
+ @NotNull
protected StubElement buildStubTreeFor(@NotNull ASTNode root, @NotNull StubElement parentStub) {
Stack<StubElement> parentStubs = new Stack<StubElement>();
Stack<ASTNode> parentNodes = new Stack<ASTNode>();
diff --git a/platform/core-api/src/com/intellij/ui/SimpleTextAttributes.java b/platform/core-api/src/com/intellij/ui/SimpleTextAttributes.java
index 6046a0ec108c..f56cf7ee36c1 100644
--- a/platform/core-api/src/com/intellij/ui/SimpleTextAttributes.java
+++ b/platform/core-api/src/com/intellij/ui/SimpleTextAttributes.java
@@ -54,6 +54,7 @@ public final class SimpleTextAttributes {
public static final SimpleTextAttributes GRAYED_ATTRIBUTES = new SimpleTextAttributes(STYLE_PLAIN, UIUtil.getInactiveTextColor());
public static final SimpleTextAttributes GRAYED_BOLD_ATTRIBUTES = new SimpleTextAttributes(STYLE_BOLD, UIUtil.getInactiveTextColor());
+ public static final SimpleTextAttributes GRAYED_ITALIC_ATTRIBUTES = new SimpleTextAttributes(STYLE_ITALIC, UIUtil.getInactiveTextColor());
public static final SimpleTextAttributes SYNTHETIC_ATTRIBUTES = new SimpleTextAttributes(STYLE_PLAIN, JBColor.blue);
public static final SimpleTextAttributes GRAY_ATTRIBUTES = new SimpleTextAttributes(STYLE_PLAIN, Color.GRAY);
diff --git a/platform/core-impl/src/com/intellij/ide/plugins/PluginDescriptorComparator.java b/platform/core-impl/src/com/intellij/ide/plugins/PluginDescriptorComparator.java
index 3094304a02cb..a6b957c0c508 100644
--- a/platform/core-impl/src/com/intellij/ide/plugins/PluginDescriptorComparator.java
+++ b/platform/core-impl/src/com/intellij/ide/plugins/PluginDescriptorComparator.java
@@ -15,7 +15,6 @@
*/
package com.intellij.ide.plugins;
-import com.intellij.ide.IdeBundle;
import com.intellij.openapi.extensions.PluginId;
import com.intellij.util.containers.HashMap;
import gnu.trove.TObjectIntHashMap;
@@ -32,7 +31,7 @@ public class PluginDescriptorComparator implements Comparator<IdeaPluginDescript
private final TObjectIntHashMap<PluginId> myIdToNumberMap = new TObjectIntHashMap<PluginId>();
private int myAvailableNumber = 1;
- public PluginDescriptorComparator(IdeaPluginDescriptor[] descriptors) throws Exception{
+ public PluginDescriptorComparator(IdeaPluginDescriptor[] descriptors){
final Map<PluginId, IdeaPluginDescriptor> idToDescriptorMap = new HashMap<PluginId, IdeaPluginDescriptor>();
for (final IdeaPluginDescriptor descriptor : descriptors) {
idToDescriptorMap.put(descriptor.getPluginId(), descriptor);
@@ -46,18 +45,20 @@ public class PluginDescriptorComparator implements Comparator<IdeaPluginDescript
}
}
- private void assignNumbers(PluginId id, Map<PluginId, IdeaPluginDescriptor> idToDescriptorMap, Stack<PluginId> visited) throws Exception {
+ private void assignNumbers(PluginId id, Map<PluginId, IdeaPluginDescriptor> idToDescriptorMap, Stack<PluginId> visited){
visited.push(id);
try {
final IdeaPluginDescriptor ideaPluginDescriptor = idToDescriptorMap.get(id);
- if (ideaPluginDescriptor == null) {
- // missing optional dependency
+ if (ideaPluginDescriptor == null || !ideaPluginDescriptor.isEnabled()) {
+ // missing optional dependency or already disabled due to cycles
return;
}
final PluginId[] parentIds = ideaPluginDescriptor.getDependentPluginIds();
for (final PluginId parentId : parentIds) {
if (visited.contains(parentId)) {
- throw new Exception(IdeBundle.message("error.plugins.should.not.have.cyclic.dependencies") + id + "->" + parentId + "->...->" + id);
+ //disable plugins in the cycle
+ ideaPluginDescriptor.setEnabled(false);
+ break;
}
}
for (PluginId parentId1 : parentIds) {
diff --git a/platform/core-impl/src/com/intellij/ide/plugins/PluginManagerCore.java b/platform/core-impl/src/com/intellij/ide/plugins/PluginManagerCore.java
index cf2d45ad4945..8f4fd771ebdd 100644
--- a/platform/core-impl/src/com/intellij/ide/plugins/PluginManagerCore.java
+++ b/platform/core-impl/src/com/intellij/ide/plugins/PluginManagerCore.java
@@ -25,10 +25,7 @@ import com.intellij.openapi.application.PathManager;
import com.intellij.openapi.components.ExtensionAreas;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.extensions.*;
-import com.intellij.openapi.util.BuildNumber;
-import com.intellij.openapi.util.Comparing;
-import com.intellij.openapi.util.Condition;
-import com.intellij.openapi.util.JDOMUtil;
+import com.intellij.openapi.util.*;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.StreamUtil;
import com.intellij.openapi.util.io.ZipFileCache;
@@ -479,8 +476,10 @@ public class PluginManagerCore {
}
static void prepareLoadingPluginsErrorMessage(final String errorMessage) {
- if (errorMessage != null) {
- if (!ApplicationManager.getApplication().isHeadlessEnvironment() && !ApplicationManager.getApplication().isUnitTestMode()) {
+ if (!StringUtil.isEmptyOrSpaces(errorMessage)) {
+ if (ApplicationManager.getApplication() != null
+ && !ApplicationManager.getApplication().isHeadlessEnvironment()
+ && !ApplicationManager.getApplication().isUnitTestMode()) {
if (myPluginError == null) {
myPluginError = errorMessage;
}
@@ -499,6 +498,7 @@ public class PluginManagerCore {
}
}
+ @Deprecated
static Comparator<IdeaPluginDescriptor> getPluginDescriptorComparator(Map<PluginId, IdeaPluginDescriptorImpl> idToDescriptorMap) {
final Graph<PluginId> graph = createPluginIdGraph(idToDescriptorMap);
final DFSTBuilder<PluginId> builder = new DFSTBuilder<PluginId>(graph);
@@ -549,6 +549,7 @@ public class PluginManagerCore {
}));
}
+ @Deprecated
static IdeaPluginDescriptorImpl[] findCorePlugin(IdeaPluginDescriptorImpl[] pluginDescriptors) {
for (IdeaPluginDescriptorImpl descriptor : pluginDescriptors) {
if (CORE_PLUGIN_ID.equals(descriptor.getPluginId().getIdString())) {
@@ -820,7 +821,7 @@ public class PluginManagerCore {
message.insert(0, IdeBundle.message("error.problems.found.loading.plugins"));
return message.toString();
}
- return null;
+ return "";
}
static void loadDescriptorsFromClassPath(@NotNull List<IdeaPluginDescriptorImpl> result, @Nullable StartupProgress progress) {
@@ -900,14 +901,7 @@ public class PluginManagerCore {
loadDescriptorsFromClassPath(result, fromSources ? progress : null);
IdeaPluginDescriptorImpl[] pluginDescriptors = result.toArray(new IdeaPluginDescriptorImpl[result.size()]);
- try {
- Arrays.sort(pluginDescriptors, new PluginDescriptorComparator(pluginDescriptors));
- }
- catch (Exception e) {
- prepareLoadingPluginsErrorMessage(IdeBundle.message("error.plugins.were.not.loaded", e.getMessage()));
- getLogger().info(e);
- return findCorePlugin(pluginDescriptors);
- }
+ Arrays.sort(pluginDescriptors, new PluginDescriptorComparator(pluginDescriptors));
return pluginDescriptors;
}
@@ -1090,12 +1084,13 @@ public class PluginManagerCore {
String errorMessage = filterBadPlugins(result, disabledPluginNames);
if (!brokenPluginsList.isEmpty()) {
- errorMessage = "Following plugins are incompatible with current IDE build: " + StringUtil.join(brokenPluginsList, ", ")
- + "<br>\n" + StringUtil.notNullize(errorMessage);
+ if (!StringUtil.isEmptyOrSpaces(errorMessage)) {
+ errorMessage += "<br>";
+ }
+ errorMessage += "Following plugins are incompatible with current IDE build: " + StringUtil.join(brokenPluginsList, ", ")
+ + "<br>\n" + StringUtil.notNullize(errorMessage);
}
- prepareLoadingPluginsErrorMessage(errorMessage);
-
final Map<PluginId, IdeaPluginDescriptorImpl> idToDescriptorMap = new HashMap<PluginId, IdeaPluginDescriptorImpl>();
for (final IdeaPluginDescriptorImpl descriptor : result) {
idToDescriptorMap.put(descriptor.getPluginId(), descriptor);
@@ -1112,8 +1107,28 @@ public class PluginManagerCore {
mergeOptionalConfigs(idToDescriptorMap);
addModulesAsDependents(idToDescriptorMap);
+ final Graph<PluginId> graph = createPluginIdGraph(idToDescriptorMap);
+ final DFSTBuilder<PluginId> builder = new DFSTBuilder<PluginId>(graph);
+ if (!builder.isAcyclic()) {
+ final Couple<PluginId> circularDependency = builder.getCircularDependency();
+ final PluginId id = circularDependency.getFirst();
+ final PluginId parentId = circularDependency.getSecond();
+ if (!StringUtil.isEmptyOrSpaces(errorMessage)) {
+ errorMessage += "<br>";
+ }
+ errorMessage += IdeBundle.message("error.plugins.should.not.have.cyclic.dependencies") + id + "->" + parentId + "->...->" + id;
+ }
+
+ prepareLoadingPluginsErrorMessage(errorMessage);
+
+ final Comparator<PluginId> idComparator = builder.comparator();
// sort descriptors according to plugin dependencies
- Collections.sort(result, getPluginDescriptorComparator(idToDescriptorMap));
+ Collections.sort(result, new Comparator<IdeaPluginDescriptor>() {
+ @Override
+ public int compare(IdeaPluginDescriptor o1, IdeaPluginDescriptor o2) {
+ return idComparator.compare(o1.getPluginId(), o2.getPluginId());
+ }
+ });
for (int i = 0; i < result.size(); i++) {
ourId2Index.put(result.get(i).getPluginId(), i);
diff --git a/platform/platform-impl/src/com/intellij/ide/util/PropertiesComponentImpl.java b/platform/core-impl/src/com/intellij/ide/util/PropertiesComponentImpl.java
index a743569b1798..a743569b1798 100644
--- a/platform/platform-impl/src/com/intellij/ide/util/PropertiesComponentImpl.java
+++ b/platform/core-impl/src/com/intellij/ide/util/PropertiesComponentImpl.java
diff --git a/platform/core-impl/src/com/intellij/mock/MockApplicationEx.java b/platform/core-impl/src/com/intellij/mock/MockApplicationEx.java
index 60ae5417620b..7415e0d66fad 100644
--- a/platform/core-impl/src/com/intellij/mock/MockApplicationEx.java
+++ b/platform/core-impl/src/com/intellij/mock/MockApplicationEx.java
@@ -53,11 +53,11 @@ public class MockApplicationEx extends MockApplication implements ApplicationEx
}
@Override
- public void exit(boolean force) {
+ public void exit(boolean force, boolean exitConfirmed) {
}
@Override
- public void restart(boolean force) {
+ public void restart(boolean exitConfirmed) {
}
@Override
diff --git a/platform/core-impl/src/com/intellij/openapi/application/ex/ApplicationEx.java b/platform/core-impl/src/com/intellij/openapi/application/ex/ApplicationEx.java
index acb83f1fe2fd..bf84725f7910 100644
--- a/platform/core-impl/src/com/intellij/openapi/application/ex/ApplicationEx.java
+++ b/platform/core-impl/src/com/intellij/openapi/application/ex/ApplicationEx.java
@@ -60,10 +60,18 @@ public interface ApplicationEx extends Application {
void doNotSave(boolean value);
boolean isDoNotSave();
- //force exit
- void exit(boolean force);
+ /**
+ * @param force if true, no additional confirmations will be shown. The application is guaranteed to exit
+ * @param exitConfirmed if true, suppresses any shutdown confirmation. However, if there are any background processes or tasks running,
+ * a corresponding confirmation will be shown with the possibility to cancel the operation
+ */
+ void exit(boolean force, boolean exitConfirmed);
- void restart(boolean force);
+ /**
+ * @param exitConfirmed if true, suppresses any shutdown confirmation. However, if there are any background processes or tasks running,
+ * a corresponding confirmation will be shown with the possibility to cancel the operation
+ */
+ void restart(boolean exitConfirmed);
/**
* Runs modal process. For internal use only, see {@link Task}
diff --git a/platform/core-impl/src/com/intellij/openapi/application/impl/ApplicationInfoImpl.java b/platform/core-impl/src/com/intellij/openapi/application/impl/ApplicationInfoImpl.java
index 78ce83cc5154..62fbfa502c79 100644
--- a/platform/core-impl/src/com/intellij/openapi/application/impl/ApplicationInfoImpl.java
+++ b/platform/core-impl/src/com/intellij/openapi/application/impl/ApplicationInfoImpl.java
@@ -409,7 +409,7 @@ public class ApplicationInfoImpl extends ApplicationInfoEx implements JDOMExtern
}
}
else {
- buffer.append(getBuild().asString());
+ buffer.append(getBuild().asStringWithAllDetails());
}
return buffer.toString();
}
diff --git a/platform/core-impl/src/com/intellij/psi/impl/file/impl/FileManagerImpl.java b/platform/core-impl/src/com/intellij/psi/impl/file/impl/FileManagerImpl.java
index ce3bc9559769..7b4e9ec210ac 100644
--- a/platform/core-impl/src/com/intellij/psi/impl/file/impl/FileManagerImpl.java
+++ b/platform/core-impl/src/com/intellij/psi/impl/file/impl/FileManagerImpl.java
@@ -26,12 +26,15 @@ import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.fileEditor.FileDocumentManager;
import com.intellij.openapi.fileTypes.ContentBasedFileSubstitutor;
import com.intellij.openapi.fileTypes.FileType;
+import com.intellij.openapi.fileTypes.FileTypeRegistry;
import com.intellij.openapi.fileTypes.LanguageFileType;
import com.intellij.openapi.project.DumbService;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.FileIndexFacade;
import com.intellij.openapi.util.Disposer;
+import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.LowMemoryWatcher;
+import com.intellij.openapi.util.registry.Registry;
import com.intellij.openapi.vfs.VfsUtilCore;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.VirtualFileVisitor;
@@ -55,6 +58,7 @@ import java.util.concurrent.ConcurrentMap;
public class FileManagerImpl implements FileManager {
private static final Logger LOG = Logger.getInstance("#com.intellij.psi.impl.file.impl.FileManagerImpl");
+ private final Key<FileViewProvider> myPsiHardRefKey = Key.create("HARD_REFERENCE_TO_PSI"); //non-static!
private final PsiManagerImpl myManager;
private final FileIndexFacade myFileIndex;
@@ -166,7 +170,7 @@ public class FileManagerImpl implements FileManager {
@NotNull
public FileViewProvider findViewProvider(@NotNull final VirtualFile file) {
assert !file.isDirectory();
- FileViewProvider viewProvider = getFromInjected(file);
+ FileViewProvider viewProvider = findCachedViewProvider(file);
if (viewProvider != null) return viewProvider;
viewProvider = myVFileToViewProviderMap.get(file);
if(viewProvider == null) {
@@ -178,8 +182,9 @@ public class FileManagerImpl implements FileManager {
@Override
public FileViewProvider findCachedViewProvider(@NotNull final VirtualFile file) {
FileViewProvider viewProvider = getFromInjected(file);
- if (viewProvider != null) return viewProvider;
- return myVFileToViewProviderMap.get(file);
+ if (viewProvider == null) viewProvider = myVFileToViewProviderMap.get(file);
+ if (viewProvider == null) viewProvider = file.getUserData(myPsiHardRefKey);
+ return viewProvider;
}
@Nullable
@@ -214,9 +219,14 @@ public class FileManagerImpl implements FileManager {
if (document != null) {
PsiDocumentManagerBase.cachePsi(document, null);
}
+ virtualFile.putUserData(myPsiHardRefKey, null);
}
else {
- myVFileToViewProviderMap.put(virtualFile, fileViewProvider);
+ if (virtualFile instanceof LightVirtualFile) {
+ virtualFile.putUserData(myPsiHardRefKey, fileViewProvider);
+ } else {
+ myVFileToViewProviderMap.put(virtualFile, fileViewProvider);
+ }
}
}
}
@@ -398,7 +408,12 @@ public class FileManagerImpl implements FileManager {
PsiDirectory psiDir = myVFileToPsiDirMap.get(vFile);
if (psiDir != null) return psiDir;
- if (myFileIndex.isExcludedFile(vFile)) return null;
+ if (Registry.is("ide.hide.excluded.files")) {
+ if (myFileIndex.isExcludedFile(vFile)) return null;
+ }
+ else {
+ if (FileTypeRegistry.getInstance().isFileIgnored(vFile)) return null;
+ }
VirtualFile parent = vFile.getParent();
if (parent != null) { //?
@@ -430,7 +445,8 @@ public class FileManagerImpl implements FileManager {
@Nullable
PsiFile getCachedPsiFileInner(@NotNull VirtualFile file) {
- final FileViewProvider fileViewProvider = myVFileToViewProviderMap.get(file);
+ FileViewProvider fileViewProvider = myVFileToViewProviderMap.get(file);
+ if (fileViewProvider == null) fileViewProvider = file.getUserData(myPsiHardRefKey);
return fileViewProvider instanceof SingleRootFileViewProvider
? ((SingleRootFileViewProvider)fileViewProvider).getCachedPsi(fileViewProvider.getBaseLanguage()) : null;
}
diff --git a/platform/core-impl/src/com/intellij/psi/stubs/ObjectStubTree.java b/platform/core-impl/src/com/intellij/psi/stubs/ObjectStubTree.java
index 7d597b70c0bd..2d84c928db22 100644
--- a/platform/core-impl/src/com/intellij/psi/stubs/ObjectStubTree.java
+++ b/platform/core-impl/src/com/intellij/psi/stubs/ObjectStubTree.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2012 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -48,6 +48,7 @@ public class ObjectStubTree<T extends Stub> {
return myRoot;
}
+ @NotNull
public List<T> getPlainList() {
return myPlainList;
}
@@ -65,7 +66,7 @@ public class ObjectStubTree<T extends Stub> {
return sink.getResult();
}
- protected static void enumerateStubs(final Stub root, final List<Stub> result) {
+ protected static void enumerateStubs(@NotNull Stub root, @NotNull List<Stub> result) {
((ObjectStubBase)root).id = result.size();
result.add(root);
for (Stub child : root.getChildrenStubs()) {
diff --git a/platform/core-impl/src/com/intellij/util/indexing/FileContentImpl.java b/platform/core-impl/src/com/intellij/util/indexing/FileContentImpl.java
index b440a43b0613..bd8309313e24 100644
--- a/platform/core-impl/src/com/intellij/util/indexing/FileContentImpl.java
+++ b/platform/core-impl/src/com/intellij/util/indexing/FileContentImpl.java
@@ -31,6 +31,7 @@ import com.intellij.psi.PsiDocumentManager;
import com.intellij.psi.PsiFile;
import com.intellij.psi.PsiFileFactory;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.TestOnly;
import java.io.IOException;
@@ -48,7 +49,7 @@ public final class FileContentImpl extends UserDataHolderBase implements FileCon
private byte[] myContent;
private CharSequence myContentAsText;
private final long myStamp;
- private final byte[] myHash;
+ private byte[] myHash;
@Override
public Project getProject() {
@@ -94,31 +95,26 @@ public final class FileContentImpl extends UserDataHolderBase implements FileCon
}
public FileContentImpl(@NotNull final VirtualFile file, @NotNull final CharSequence contentAsText, final Charset charset) {
- this(file, contentAsText, null, charset, -1, null);
+ this(file, contentAsText, null, charset, -1);
}
public FileContentImpl(@NotNull final VirtualFile file, @NotNull final CharSequence contentAsText, final Charset charset, long documentStamp) {
- this(file, contentAsText, null, charset, documentStamp, null);
+ this(file, contentAsText, null, charset, documentStamp);
}
public FileContentImpl(@NotNull final VirtualFile file, @NotNull final byte[] content) {
- this(file, content, null);
- }
-
- public FileContentImpl(@NotNull final VirtualFile file, @NotNull final byte[] content, byte[] hash) {
- this(file, null, content, LoadTextUtil.detectCharsetAndSetBOM(file, content), -1, hash);
+ this(file, null, content, LoadTextUtil.detectCharsetAndSetBOM(file, content), -1);
}
public FileContentImpl(@NotNull final VirtualFile file) {
- this(file, null, null, null, -1, null);
+ this(file, null, null, null, -1);
}
private FileContentImpl(@NotNull VirtualFile file,
CharSequence contentAsText,
byte[] content,
Charset charset,
- long stamp,
- byte[] hash
+ long stamp
) {
myFile = file;
myContentAsText = contentAsText;
@@ -128,7 +124,6 @@ public final class FileContentImpl extends UserDataHolderBase implements FileCon
// remember name explicitly because the file could be renamed afterwards
myFileName = file.getName();
myStamp = stamp;
- myHash = hash;
}
@NotNull
@@ -215,10 +210,14 @@ public final class FileContentImpl extends UserDataHolderBase implements FileCon
return myFileName;
}
- public byte[] getHash() {
+ public @Nullable byte[] getHash() {
return myHash;
}
+ public void setHash(byte[] hash) {
+ myHash = hash;
+ }
+
public PsiFile getPsiFileAccountingForUnsavedDocument() {
Document document = FileDocumentManager.getInstance().getCachedDocument(getFile());
PsiFile psi = null;
diff --git a/platform/editor-ui-api/src/com/intellij/openapi/editor/Caret.java b/platform/editor-ui-api/src/com/intellij/openapi/editor/Caret.java
index 43b5e75e08df..ba0743b4cfb0 100644
--- a/platform/editor-ui-api/src/com/intellij/openapi/editor/Caret.java
+++ b/platform/editor-ui-api/src/com/intellij/openapi/editor/Caret.java
@@ -26,6 +26,12 @@ import org.jetbrains.annotations.Nullable;
*/
public interface Caret extends UserDataHolderEx, Disposable {
/**
+ * Returns an instance of Editor, current caret belongs to.
+ */
+ @NotNull
+ Editor getEditor();
+
+ /**
* Returns an instance of CaretModel, current caret is associated with.
*/
@NotNull
diff --git a/platform/editor-ui-ex/src/com/intellij/openapi/editor/ex/util/LexerEditorHighlighter.java b/platform/editor-ui-ex/src/com/intellij/openapi/editor/ex/util/LexerEditorHighlighter.java
index 443e4fb3ccac..77092d91a6c1 100644
--- a/platform/editor-ui-ex/src/com/intellij/openapi/editor/ex/util/LexerEditorHighlighter.java
+++ b/platform/editor-ui-ex/src/com/intellij/openapi/editor/ex/util/LexerEditorHighlighter.java
@@ -34,6 +34,7 @@ import com.intellij.openapi.fileTypes.PlainSyntaxHighlighter;
import com.intellij.openapi.fileTypes.SyntaxHighlighter;
import com.intellij.openapi.project.DumbAwareRunnable;
import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.Comparing;
import com.intellij.psi.tree.IElementType;
import com.intellij.util.ArrayUtil;
import com.intellij.util.ui.UIUtil;
@@ -77,8 +78,7 @@ public class LexerEditorHighlighter implements EditorHighlighter, PrioritizedDoc
public final synchronized boolean checkContentIsEqualTo(CharSequence sequence) {
final Document document = getDocument();
- if (document != null) return document.getText().equals(sequence.toString());
- return false;
+ return document != null && Comparing.equal(document.getImmutableCharSequence(), sequence);
}
public EditorColorsScheme getScheme() {
diff --git a/platform/editor-ui-ex/src/com/intellij/psi/impl/cache/impl/id/PlatformIdTableBuilding.java b/platform/editor-ui-ex/src/com/intellij/psi/impl/cache/impl/id/PlatformIdTableBuilding.java
index 330dcfdf5e6a..6a3dd82b237e 100644
--- a/platform/editor-ui-ex/src/com/intellij/psi/impl/cache/impl/id/PlatformIdTableBuilding.java
+++ b/platform/editor-ui-ex/src/com/intellij/psi/impl/cache/impl/id/PlatformIdTableBuilding.java
@@ -213,7 +213,7 @@ public abstract class PlatformIdTableBuilding {
}
OccurrenceConsumer occurrenceConsumer = new OccurrenceConsumer(null, true);
for (IndexPattern indexPattern : indexPatterns) {
- Pattern pattern = indexPattern.getPattern();
+ Pattern pattern = indexPattern.getOptimizedIndexingPattern();
if (pattern != null) {
Matcher matcher = pattern.matcher(chars);
while (matcher.find()) {
diff --git a/platform/editor-ui-ex/src/com/intellij/psi/impl/cache/impl/todo/TodoIndex.java b/platform/editor-ui-ex/src/com/intellij/psi/impl/cache/impl/todo/TodoIndex.java
index 09b379e8078b..d955354cca7f 100644
--- a/platform/editor-ui-ex/src/com/intellij/psi/impl/cache/impl/todo/TodoIndex.java
+++ b/platform/editor-ui-ex/src/com/intellij/psi/impl/cache/impl/todo/TodoIndex.java
@@ -127,7 +127,7 @@ public class TodoIndex extends FileBasedIndexExtension<TodoIndexEntry, Integer>
@Override
public int getVersion() {
- return 7;
+ return 8;
}
@Override
diff --git a/platform/icons/src/general/projectConfigurable.png b/platform/icons/src/general/projectConfigurable.png
new file mode 100644
index 000000000000..d04d56ca4983
--- /dev/null
+++ b/platform/icons/src/general/projectConfigurable.png
Binary files differ
diff --git a/platform/icons/src/general/projectConfigurable@2x.png b/platform/icons/src/general/projectConfigurable@2x.png
new file mode 100644
index 000000000000..3550d5fbf390
--- /dev/null
+++ b/platform/icons/src/general/projectConfigurable@2x.png
Binary files differ
diff --git a/platform/icons/src/general/projectConfigurable@2x_dark.png b/platform/icons/src/general/projectConfigurable@2x_dark.png
new file mode 100644
index 000000000000..feca75626b08
--- /dev/null
+++ b/platform/icons/src/general/projectConfigurable@2x_dark.png
Binary files differ
diff --git a/platform/icons/src/general/projectConfigurable_dark.png b/platform/icons/src/general/projectConfigurable_dark.png
new file mode 100644
index 000000000000..60b98363afb7
--- /dev/null
+++ b/platform/icons/src/general/projectConfigurable_dark.png
Binary files differ
diff --git a/platform/indexing-api/src/com/intellij/psi/search/IndexPattern.java b/platform/indexing-api/src/com/intellij/psi/search/IndexPattern.java
index fc5de78f9407..0066c260f1b3 100644
--- a/platform/indexing-api/src/com/intellij/psi/search/IndexPattern.java
+++ b/platform/indexing-api/src/com/intellij/psi/search/IndexPattern.java
@@ -16,6 +16,7 @@
package com.intellij.psi.search;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
@@ -29,6 +30,7 @@ import java.util.regex.PatternSyntaxException;
*/
public class IndexPattern {
@NotNull private String myPatternString;
+ private Pattern myOptimizedIndexingPattern;
private boolean myCaseSensitive;
private Pattern myPattern;
@@ -49,10 +51,14 @@ public class IndexPattern {
return myPatternString;
}
- public Pattern getPattern() {
+ public @Nullable Pattern getPattern() {
return myPattern;
}
+ public @Nullable Pattern getOptimizedIndexingPattern() {
+ return myOptimizedIndexingPattern;
+ }
+
public boolean isCaseSensitive() {
return myCaseSensitive;
}
@@ -68,16 +74,21 @@ public class IndexPattern {
}
private void compilePattern() {
- try{
- if (myCaseSensitive){
- myPattern = Pattern.compile(myPatternString);
+ try {
+ int flags = 0;
+ if (!myCaseSensitive) {
+ flags = Pattern.CASE_INSENSITIVE;
}
- else{
- myPattern = Pattern.compile(myPatternString, Pattern.CASE_INSENSITIVE);
+ myPattern = Pattern.compile(myPatternString, flags);
+ String optimizedPattern = myPatternString;
+ if (optimizedPattern.startsWith(".*")) {
+ optimizedPattern = optimizedPattern.substring(".*".length());
}
+ myOptimizedIndexingPattern = Pattern.compile(optimizedPattern, flags);
}
catch(PatternSyntaxException e){
myPattern = null;
+ myOptimizedIndexingPattern = null;
}
}
diff --git a/platform/indexing-api/src/com/intellij/psi/search/PsiSearchHelper.java b/platform/indexing-api/src/com/intellij/psi/search/PsiSearchHelper.java
index 741b31cd8681..cc283d0bb2b7 100644
--- a/platform/indexing-api/src/com/intellij/psi/search/PsiSearchHelper.java
+++ b/platform/indexing-api/src/com/intellij/psi/search/PsiSearchHelper.java
@@ -23,6 +23,7 @@ import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.psi.PsiReference;
import com.intellij.util.Processor;
+import org.intellij.lang.annotations.MagicConstant;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -166,13 +167,13 @@ public interface PsiSearchHelper {
boolean processElementsWithWord(@NotNull TextOccurenceProcessor processor,
@NotNull SearchScope searchScope,
@NotNull String text,
- short searchContext,
+ @MagicConstant(flagsFromClass = UsageSearchContext.class) short searchContext,
boolean caseSensitive);
boolean processElementsWithWord(@NotNull TextOccurenceProcessor processor,
@NotNull SearchScope searchScope,
@NotNull String text,
- short searchContext,
+ @MagicConstant(flagsFromClass = UsageSearchContext.class) short searchContext,
boolean caseSensitive,
boolean processInjectedPsi);
diff --git a/platform/indexing-api/src/com/intellij/psi/search/SingleTargetRequestResultProcessor.java b/platform/indexing-api/src/com/intellij/psi/search/SingleTargetRequestResultProcessor.java
index dfc421799f7e..2cfa12ecf1dd 100644
--- a/platform/indexing-api/src/com/intellij/psi/search/SingleTargetRequestResultProcessor.java
+++ b/platform/indexing-api/src/com/intellij/psi/search/SingleTargetRequestResultProcessor.java
@@ -39,6 +39,10 @@ public final class SingleTargetRequestResultProcessor extends RequestResultProce
@Override
public boolean processTextOccurrence(@NotNull PsiElement element, int offsetInElement, @NotNull final Processor<PsiReference> consumer) {
+ if (!myTarget.isValid()) {
+ return false;
+ }
+
final List<PsiReference> references = ourReferenceService.getReferences(element,
new PsiReferenceService.Hints(myTarget, offsetInElement));
for (PsiReference ref : references) {
diff --git a/platform/indexing-api/src/com/intellij/psi/stubs/AbstractStubIndex.java b/platform/indexing-api/src/com/intellij/psi/stubs/AbstractStubIndex.java
index 6e6ce92a2108..118592a336f5 100644
--- a/platform/indexing-api/src/com/intellij/psi/stubs/AbstractStubIndex.java
+++ b/platform/indexing-api/src/com/intellij/psi/stubs/AbstractStubIndex.java
@@ -19,6 +19,7 @@ import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiElement;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.util.Processor;
+import org.jetbrains.annotations.NotNull;
import java.util.Collection;
@@ -34,7 +35,7 @@ public abstract class AbstractStubIndex<Key, Psi extends PsiElement> implements
return StubIndex.getInstance().processAllKeys(getKey(), project, processor);
}
- public Collection<Psi> get(Key key, final Project project, final GlobalSearchScope scope) {
+ public Collection<Psi> get(@NotNull Key key, @NotNull final Project project, @NotNull final GlobalSearchScope scope) {
return StubIndex.getInstance().get(getKey(), key, project, scope);
}
diff --git a/platform/indexing-api/src/com/intellij/psi/stubs/StubIndex.java b/platform/indexing-api/src/com/intellij/psi/stubs/StubIndex.java
index ce12c57e10d9..11074f83781f 100644
--- a/platform/indexing-api/src/com/intellij/psi/stubs/StubIndex.java
+++ b/platform/indexing-api/src/com/intellij/psi/stubs/StubIndex.java
@@ -26,6 +26,7 @@ import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiElement;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.psi.util.PsiUtilCore;
+import com.intellij.util.ObjectUtils;
import com.intellij.util.Processor;
import com.intellij.util.indexing.FileBasedIndex;
import com.intellij.util.indexing.IdFilter;
@@ -51,7 +52,7 @@ public abstract class StubIndex {
public abstract <Key, Psi extends PsiElement> Collection<Psi> get(@NotNull StubIndexKey<Key, Psi> indexKey,
@NotNull Key key,
@NotNull Project project,
- final GlobalSearchScope scope);
+ @Nullable final GlobalSearchScope scope);
/**
* @deprecated use {@link #getElements(StubIndexKey, Object, com.intellij.openapi.project.Project, com.intellij.psi.search.GlobalSearchScope, Class)}
@@ -59,7 +60,7 @@ public abstract class StubIndex {
public <Key, Psi extends PsiElement> Collection<Psi> get(@NotNull StubIndexKey<Key, Psi> indexKey,
@NotNull Key key,
@NotNull Project project,
- final GlobalSearchScope scope,
+ @Nullable final GlobalSearchScope scope,
IdFilter filter) {
return get(indexKey, key, project, scope);
}
@@ -70,7 +71,7 @@ public abstract class StubIndex {
public <Key, Psi extends PsiElement> boolean process(@NotNull StubIndexKey<Key, Psi> indexKey,
@NotNull Key key,
@NotNull Project project,
- GlobalSearchScope scope,
+ @Nullable GlobalSearchScope scope,
@NotNull Processor<? super Psi> processor) {
return processElements(indexKey, key, project, scope, (Class<Psi>)PsiElement.class, processor);
}
@@ -78,7 +79,7 @@ public abstract class StubIndex {
public abstract <Key, Psi extends PsiElement> boolean processElements(@NotNull StubIndexKey<Key, Psi> indexKey,
@NotNull Key key,
@NotNull Project project,
- GlobalSearchScope scope,
+ @Nullable GlobalSearchScope scope,
Class<Psi> requiredClass,
@NotNull Processor<? super Psi> processor);
@@ -88,8 +89,8 @@ public abstract class StubIndex {
public <Key, Psi extends PsiElement> boolean process(@NotNull StubIndexKey<Key, Psi> indexKey,
@NotNull Key key,
@NotNull Project project,
- GlobalSearchScope scope,
- IdFilter idFilter,
+ @Nullable GlobalSearchScope scope,
+ @SuppressWarnings("UnusedParameters") IdFilter idFilter,
@NotNull Processor<? super Psi> processor) {
return process(indexKey, key, project, scope, processor);
}
@@ -97,9 +98,9 @@ public abstract class StubIndex {
public <Key, Psi extends PsiElement> boolean processElements(@NotNull StubIndexKey<Key, Psi> indexKey,
@NotNull Key key,
@NotNull Project project,
- GlobalSearchScope scope,
+ @Nullable GlobalSearchScope scope,
IdFilter idFilter,
- Class<Psi> requiredClass,
+ @NotNull Class<Psi> requiredClass,
@NotNull Processor<? super Psi> processor) {
return process(indexKey, key, project, scope, processor);
}
@@ -109,8 +110,9 @@ public abstract class StubIndex {
public abstract <K> boolean processAllKeys(@NotNull StubIndexKey<K, ?> indexKey, @NotNull Project project, Processor<K> processor);
- public <K> boolean processAllKeys(@NotNull StubIndexKey<K, ?> indexKey, Processor<K> processor, GlobalSearchScope scope, @Nullable IdFilter idFilter) {
- return processAllKeys(indexKey, scope.getProject(), processor);
+ public <K> boolean processAllKeys(@NotNull StubIndexKey<K, ?> indexKey, @NotNull Processor<K> processor,
+ @NotNull GlobalSearchScope scope, @Nullable IdFilter idFilter) {
+ return processAllKeys(indexKey, ObjectUtils.assertNotNull(scope.getProject()), processor);
}
/**
@@ -127,7 +129,7 @@ public abstract class StubIndex {
public static <Key, Psi extends PsiElement> Collection<Psi> getElements(@NotNull StubIndexKey<Key, Psi> indexKey,
@NotNull Key key,
@NotNull final Project project,
- final GlobalSearchScope scope,
+ @Nullable final GlobalSearchScope scope,
@NotNull Class<Psi> requiredClass) {
return getElements(indexKey, key, project, scope, null, requiredClass);
}
@@ -135,7 +137,7 @@ public abstract class StubIndex {
public static <Key, Psi extends PsiElement> Collection<Psi> getElements(@NotNull StubIndexKey<Key, Psi> indexKey,
@NotNull Key key,
@NotNull final Project project,
- final GlobalSearchScope scope,
+ @Nullable final GlobalSearchScope scope,
@Nullable IdFilter idFilter,
@NotNull Class<Psi> requiredClass) {
//noinspection deprecation
diff --git a/platform/indexing-impl/src/com/intellij/openapi/module/impl/scopes/ModuleWithDependentsScope.java b/platform/indexing-impl/src/com/intellij/openapi/module/impl/scopes/ModuleWithDependentsScope.java
index 0a575acdc550..259ea3936934 100644
--- a/platform/indexing-impl/src/com/intellij/openapi/module/impl/scopes/ModuleWithDependentsScope.java
+++ b/platform/indexing-impl/src/com/intellij/openapi/module/impl/scopes/ModuleWithDependentsScope.java
@@ -50,27 +50,28 @@ class ModuleWithDependentsScope extends GlobalSearchScope {
myProjectFileIndex = ProjectRootManager.getInstance(module.getProject()).getFileIndex();
myProjectScope = ProjectScope.getProjectScope(module.getProject());
- myModules = new THashSet<Module>();
- myModules.add(module);
-
- fillModules();
+ myModules = buildDependents(myModule);
}
- private void fillModules() {
- ModuleIndex index = getModuleIndex(myModule.getProject());
+ private static Set<Module> buildDependents(Module module) {
+ Set<Module> result = new THashSet<Module>();
+ result.add(module);
+
+ ModuleIndex index = getModuleIndex(module.getProject());
Queue<Module> walkingQueue = new Queue<Module>(10);
- walkingQueue.addLast(myModule);
+ walkingQueue.addLast(module);
while (!walkingQueue.isEmpty()) {
Module current = walkingQueue.pullFirst();
- myModules.addAll(index.plainUsages.get(current));
+ result.addAll(index.plainUsages.get(current));
for (Module dependent : index.exportingUsages.get(current)) {
- if (myModules.add(dependent)) {
+ if (result.add(dependent)) {
walkingQueue.addLast(dependent);
}
}
}
+ return result;
}
private static class ModuleIndex {
diff --git a/platform/indexing-impl/src/com/intellij/psi/impl/cache/CacheManager.java b/platform/indexing-impl/src/com/intellij/psi/impl/cache/CacheManager.java
index 54a3bf5ce979..e403f60c8777 100644
--- a/platform/indexing-impl/src/com/intellij/psi/impl/cache/CacheManager.java
+++ b/platform/indexing-impl/src/com/intellij/psi/impl/cache/CacheManager.java
@@ -20,7 +20,9 @@ import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiFile;
import com.intellij.psi.search.GlobalSearchScope;
+import com.intellij.psi.search.UsageSearchContext;
import com.intellij.util.Processor;
+import org.intellij.lang.annotations.MagicConstant;
import org.jetbrains.annotations.NotNull;
public interface CacheManager {
@@ -33,7 +35,13 @@ public interface CacheManager {
}
}
- @NotNull PsiFile[] getFilesWithWord(@NotNull String word, short occurenceMask, @NotNull GlobalSearchScope scope, final boolean caseSensitively);
- boolean processFilesWithWord(@NotNull Processor<PsiFile> processor,@NotNull String word, short occurenceMask, @NotNull GlobalSearchScope scope, final boolean caseSensitively);
+ @NotNull
+ PsiFile[] getFilesWithWord(@NotNull String word, short occurenceMask, @NotNull GlobalSearchScope scope, final boolean caseSensitively);
+
+ boolean processFilesWithWord(@NotNull Processor<PsiFile> processor,
+ @NotNull String word,
+ @MagicConstant(flagsFromClass = UsageSearchContext.class) short occurenceMask,
+ @NotNull GlobalSearchScope scope,
+ final boolean caseSensitively);
}
diff --git a/platform/indexing-impl/src/com/intellij/psi/impl/cache/impl/BaseFilterLexer.java b/platform/indexing-impl/src/com/intellij/psi/impl/cache/impl/BaseFilterLexer.java
index cc9dddf396ea..ab774d182cbb 100644
--- a/platform/indexing-impl/src/com/intellij/psi/impl/cache/impl/BaseFilterLexer.java
+++ b/platform/indexing-impl/src/com/intellij/psi/impl/cache/impl/BaseFilterLexer.java
@@ -76,7 +76,7 @@ public abstract class BaseFilterLexer extends DelegateLexer implements IdTableBu
todoScanningState = new TodoScanningState(patterns, matchers);
for (int i = 0; i < patterns.length; ++i) {
- Pattern pattern = patterns[i].getPattern();
+ Pattern pattern = patterns[i].getOptimizedIndexingPattern();
if (pattern != null) {
matchers[i] = pattern.matcher("");
diff --git a/platform/indexing-impl/src/com/intellij/psi/impl/cache/impl/BaseFilterLexerUtil.java b/platform/indexing-impl/src/com/intellij/psi/impl/cache/impl/BaseFilterLexerUtil.java
index 43f6ce4aec93..3896dc380988 100644
--- a/platform/indexing-impl/src/com/intellij/psi/impl/cache/impl/BaseFilterLexerUtil.java
+++ b/platform/indexing-impl/src/com/intellij/psi/impl/cache/impl/BaseFilterLexerUtil.java
@@ -17,7 +17,6 @@ package com.intellij.psi.impl.cache.impl;
import com.intellij.lexer.Lexer;
import com.intellij.openapi.util.Key;
-import com.intellij.openapi.vfs.StandardFileSystems;
import com.intellij.psi.impl.cache.impl.id.IdIndexEntry;
import com.intellij.psi.impl.cache.impl.id.IdTableBuilding;
import com.intellij.psi.impl.cache.impl.id.LexerBasedIdIndexer;
@@ -40,7 +39,7 @@ public class BaseFilterLexerUtil {
return data;
}
- final boolean needTodo = content.getFile().getFileSystem().getProtocol().equals(StandardFileSystems.FILE_PROTOCOL);
+ final boolean needTodo = content.getFile().isInLocalFileSystem(); // same as TodoIndex.getFilter().isAcceptable
final boolean needIdIndex = IdTableBuilding.getFileTypeIndexer(content.getFileType()) instanceof LexerBasedIdIndexer;
final IdDataConsumer consumer = needIdIndex? new IdDataConsumer():null;
diff --git a/platform/indexing-impl/src/com/intellij/psi/stubs/StubProcessingHelperBase.java b/platform/indexing-impl/src/com/intellij/psi/stubs/StubProcessingHelperBase.java
index a97ae21b1d81..83bd87271fc4 100644
--- a/platform/indexing-impl/src/com/intellij/psi/stubs/StubProcessingHelperBase.java
+++ b/platform/indexing-impl/src/com/intellij/psi/stubs/StubProcessingHelperBase.java
@@ -32,11 +32,19 @@ public abstract class StubProcessingHelperBase {
return stub.getStubType();
}
- public <Psi extends PsiElement> boolean processStubsInFile(final Project project, final VirtualFile file, StubIdList value, final Processor<? super Psi> processor, Class<Psi> requiredClass) {
+ public <Psi extends PsiElement> boolean processStubsInFile(@NotNull final Project project,
+ @NotNull final VirtualFile file,
+ @NotNull StubIdList value,
+ @NotNull final Processor<? super Psi> processor,
+ @NotNull Class<Psi> requiredClass) {
return processStubsInFile(project, file, value, processor, requiredClass, false);
}
- public <Psi extends PsiElement> boolean processStubsInFile(final Project project, final VirtualFile file, StubIdList value, final Processor<? super Psi> processor, Class<Psi> requiredClass, final boolean skipOnErrors) {
+ public <Psi extends PsiElement> boolean processStubsInFile(@NotNull final Project project,
+ @NotNull final VirtualFile file,
+ @NotNull StubIdList value,
+ @NotNull final Processor<? super Psi> processor,
+ @NotNull Class<Psi> requiredClass, final boolean skipOnErrors) {
StubTree stubTree = null;
PsiFile candidatePsiFile = PsiManager.getInstance(project).findFile(file);
diff --git a/platform/lang-api/src/com/intellij/codeInsight/completion/CompletionParameters.java b/platform/lang-api/src/com/intellij/codeInsight/completion/CompletionParameters.java
index a400b201ba34..679e1c535dc1 100644
--- a/platform/lang-api/src/com/intellij/codeInsight/completion/CompletionParameters.java
+++ b/platform/lang-api/src/com/intellij/codeInsight/completion/CompletionParameters.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -33,7 +33,7 @@ public final class CompletionParameters {
private final int myInvocationCount;
CompletionParameters(@NotNull final PsiElement position, @NotNull final PsiFile originalFile,
- final CompletionType completionType, int offset, final int invocationCount, @NotNull Editor editor) {
+ @NotNull CompletionType completionType, int offset, final int invocationCount, @NotNull Editor editor) {
assert offset >= position.getTextRange().getStartOffset();
myPosition = position;
assert position.isValid();
@@ -44,14 +44,17 @@ public final class CompletionParameters {
myEditor = editor;
}
+ @NotNull
public CompletionParameters delegateToClassName() {
return withType(CompletionType.CLASS_NAME).withInvocationCount(myInvocationCount - 1);
}
- public CompletionParameters withType(CompletionType type) {
+ @NotNull
+ public CompletionParameters withType(@NotNull CompletionType type) {
return new CompletionParameters(myPosition, myOriginalFile, type, myOffset, myInvocationCount, myEditor);
}
+ @NotNull
public CompletionParameters withInvocationCount(int newCount) {
return new CompletionParameters(myPosition, myOriginalFile, myCompletionType, myOffset, newCount, myEditor);
}
@@ -94,7 +97,8 @@ public final class CompletionParameters {
return myInvocationCount == 0;
}
- public CompletionParameters withPosition(PsiElement element, int offset) {
+ @NotNull
+ public CompletionParameters withPosition(@NotNull PsiElement element, int offset) {
return new CompletionParameters(element, myOriginalFile, myCompletionType, offset, myInvocationCount, myEditor);
}
@@ -102,6 +106,7 @@ public final class CompletionParameters {
return myCompletionType == CompletionType.BASIC && myInvocationCount >= 2;
}
+ @NotNull
public Editor getEditor() {
return myEditor;
}
diff --git a/platform/lang-api/src/com/intellij/codeInsight/editorActions/smartEnter/SmartEnterProcessor.java b/platform/lang-api/src/com/intellij/codeInsight/editorActions/smartEnter/SmartEnterProcessor.java
index 2e92ef17d017..0a3f5061034b 100644
--- a/platform/lang-api/src/com/intellij/codeInsight/editorActions/smartEnter/SmartEnterProcessor.java
+++ b/platform/lang-api/src/com/intellij/codeInsight/editorActions/smartEnter/SmartEnterProcessor.java
@@ -36,6 +36,10 @@ import org.jetbrains.annotations.Nullable;
public abstract class SmartEnterProcessor {
public abstract boolean process(@NotNull final Project project, @NotNull final Editor editor, @NotNull final PsiFile psiFile);
+ public boolean processAfterCompletion(@NotNull final Editor editor, @NotNull final PsiFile psiFile) {
+ return process(psiFile.getProject(), editor, psiFile);
+ }
+
protected void reformat(PsiElement atCaret) throws IncorrectOperationException {
final TextRange range = atCaret.getTextRange();
final PsiFile file = atCaret.getContainingFile();
diff --git a/platform/lang-api/src/com/intellij/codeInspection/ui/ListTable.java b/platform/lang-api/src/com/intellij/codeInspection/ui/ListTable.java
index b921a62df6fe..c90593aef1cf 100644
--- a/platform/lang-api/src/com/intellij/codeInspection/ui/ListTable.java
+++ b/platform/lang-api/src/com/intellij/codeInspection/ui/ListTable.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2007-2010 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -62,8 +62,9 @@ public class ListTable extends JBTable {
super.setModel(dataModel);
}
+ @NotNull
@Override
- public Component prepareRenderer(TableCellRenderer renderer, int row,
+ public Component prepareRenderer(@NotNull TableCellRenderer renderer, int row,
int column) {
final Component component =
super.prepareRenderer(renderer, row, column);
diff --git a/platform/lang-api/src/com/intellij/openapi/module/ModuleUtil.java b/platform/lang-api/src/com/intellij/openapi/module/ModuleUtil.java
index bf56114a2467..f79128db39fd 100644
--- a/platform/lang-api/src/com/intellij/openapi/module/ModuleUtil.java
+++ b/platform/lang-api/src/com/intellij/openapi/module/ModuleUtil.java
@@ -108,33 +108,4 @@ public class ModuleUtil extends ModuleUtilCore {
String type = module.getOptionValue(Module.ELEMENT_TYPE);
return ModuleTypeManager.getInstance().findByID(type);
}
-
- public static void updateExcludedFoldersInWriteAction(final Module module,
- @NotNull final VirtualFile contentRoot,
- final Collection<String> urlsToUnExclude,
- final Collection<String> urlsToExclude) {
- ApplicationManager.getApplication().runWriteAction(new Runnable() {
- public void run() {
- final ModifiableRootModel modifiableModel = ModuleRootManager.getInstance(module).getModifiableModel();
- try {
- for (final ContentEntry contentEntry : modifiableModel.getContentEntries()) {
- if (contentRoot.equals(contentEntry.getFile())) {
- for (String url : urlsToUnExclude) {
- contentEntry.removeExcludeFolder(url);
- }
- for (String url : urlsToExclude) {
- contentEntry.addExcludeFolder(url);
- }
- break;
- }
- }
- modifiableModel.commit();
- }
- catch (Exception e) {
- modifiableModel.dispose();
- throw new RuntimeException(e.getMessage(), e);
- }
- }
- });
- }
}
diff --git a/platform/lang-api/src/com/intellij/psi/codeStyle/CodeStyleSettings.java b/platform/lang-api/src/com/intellij/psi/codeStyle/CodeStyleSettings.java
index 3eb09544bb7f..2c44a32d9ace 100644
--- a/platform/lang-api/src/com/intellij/psi/codeStyle/CodeStyleSettings.java
+++ b/platform/lang-api/src/com/intellij/psi/codeStyle/CodeStyleSettings.java
@@ -56,6 +56,7 @@ public class CodeStyleSettings extends CommonCodeStyleSettings implements Clonea
public CodeStyleSettings(boolean loadExtensions) {
super(null);
+ RIGHT_MARGIN = DEFAULT_RIGHT_MARGIN;
initTypeToName();
initImportsByDefault();
@@ -243,7 +244,6 @@ public class CodeStyleSettings extends CommonCodeStyleSettings implements Clonea
public int INNER_CLASSES_ORDER_WEIGHT = 7;
//----------------- WRAPPING ---------------------------
- public int RIGHT_MARGIN = 120;
public boolean WRAP_WHEN_TYPING_REACHES_RIGHT_MARGIN = false;
@@ -875,4 +875,38 @@ public class CodeStyleSettings extends CommonCodeStyleSettings implements Clonea
return myCommonSettingsManager.getCommonSettings(langName);
}
+ /**
+ * Retrieves right margin for the given language. The language may overwrite default RIGHT_MARGIN value with its own RIGHT_MARGIN
+ * in language's CommonCodeStyleSettings instance.
+ *
+ * @param language The language to get right margin for or null if root (default) right margin is requested.
+ * @return The right margin for the language if it is defined (not null) and its settings contain non-negative margin. Root (default)
+ * margin otherwise (CodeStyleSettings.RIGHT_MARGIN).
+ */
+ public int getRightMargin(@Nullable Language language) {
+ if (language != null) {
+ CommonCodeStyleSettings langSettings = getCommonSettings(language);
+ if (langSettings != null) {
+ if (langSettings.RIGHT_MARGIN >= 0) return langSettings.RIGHT_MARGIN;
+ }
+ }
+ return RIGHT_MARGIN;
+ }
+
+ /**
+ * Assigns another right margin for the language or (if it is null) to root (default) margin.
+ *
+ * @param language The language to assign the right margin to or null if root (default) right margin is to be changed.
+ * @param rightMargin New right margin.
+ */
+ public void setRightMargin(@Nullable Language language, int rightMargin) {
+ if (language != null) {
+ CommonCodeStyleSettings langSettings = getCommonSettings(language);
+ if (langSettings != null) {
+ langSettings.RIGHT_MARGIN = rightMargin;
+ return;
+ }
+ }
+ RIGHT_MARGIN = rightMargin;
+ }
}
diff --git a/platform/lang-api/src/com/intellij/psi/codeStyle/CodeStyleSettingsCustomizable.java b/platform/lang-api/src/com/intellij/psi/codeStyle/CodeStyleSettingsCustomizable.java
index 265833491ff5..290078e39aa9 100644
--- a/platform/lang-api/src/com/intellij/psi/codeStyle/CodeStyleSettingsCustomizable.java
+++ b/platform/lang-api/src/com/intellij/psi/codeStyle/CodeStyleSettingsCustomizable.java
@@ -111,6 +111,7 @@ public interface CodeStyleSettingsCustomizable {
}
enum WrappingOrBraceOption {
+ RIGHT_MARGIN,
KEEP_CONTROL_STATEMENT_IN_ONE_LINE,
LINE_COMMENT_AT_FIRST_COLUMN,
BLOCK_COMMENT_AT_FIRST_COLUMN,
diff --git a/platform/lang-api/src/com/intellij/psi/codeStyle/CommonCodeStyleSettings.java b/platform/lang-api/src/com/intellij/psi/codeStyle/CommonCodeStyleSettings.java
index 310c0053d8fa..20b96cac3920 100644
--- a/platform/lang-api/src/com/intellij/psi/codeStyle/CommonCodeStyleSettings.java
+++ b/platform/lang-api/src/com/intellij/psi/codeStyle/CommonCodeStyleSettings.java
@@ -161,7 +161,13 @@ public class CommonCodeStyleSettings {
void copyNonDefaultValuesFrom(CommonCodeStyleSettings from) {
CommonCodeStyleSettings defaultSettings = new CommonCodeStyleSettings(null);
PARENT_SETTINGS_INSTALLED =
- copyFields(getClass().getFields(), from, this, new SupportedFieldsDiffFilter(from, getSupportedFields(), defaultSettings));
+ copyFields(getClass().getFields(), from, this, new SupportedFieldsDiffFilter(from, getSupportedFields(), defaultSettings) {
+ @Override
+ public boolean isAccept(@NotNull Field field) {
+ if ("RIGHT_MARGIN".equals(field.getName())) return false; // Never copy RIGHT_MARGIN, it is inherited automatically if -1
+ return super.isAccept(field);
+ }
+ });
}
private static void copyFields(Field[] fields, Object from, Object to) {
@@ -280,6 +286,8 @@ public class CommonCodeStyleSettings {
}
//----------------- GENERAL --------------------
+ public int RIGHT_MARGIN = -1;
+ public final static int DEFAULT_RIGHT_MARGIN = 120;
public boolean LINE_COMMENT_AT_FIRST_COLUMN = true;
public boolean BLOCK_COMMENT_AT_FIRST_COLUMN = true;
diff --git a/platform/lang-api/src/com/intellij/psi/util/PsiUtilBase.java b/platform/lang-api/src/com/intellij/psi/util/PsiUtilBase.java
index df0e0b959a23..56fe91a0dc28 100644
--- a/platform/lang-api/src/com/intellij/psi/util/PsiUtilBase.java
+++ b/platform/lang-api/src/com/intellij/psi/util/PsiUtilBase.java
@@ -23,9 +23,9 @@ import com.intellij.lang.injection.InjectedLanguageManager;
import com.intellij.openapi.actionSystem.CommonDataKeys;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.Editor;
-import com.intellij.openapi.editor.SelectionModel;
import com.intellij.openapi.fileEditor.FileEditor;
import com.intellij.openapi.fileEditor.FileEditorManager;
import com.intellij.openapi.fileEditor.TextEditor;
@@ -83,20 +83,22 @@ public class PsiUtilBase extends PsiUtilCore implements PsiEditorUtil {
@Nullable
public static Language getLanguageInEditor(@NotNull final Editor editor, @NotNull final Project project) {
+ return getLanguageInEditor(editor.getCaretModel().getCurrentCaret(), project);
+ }
+
+ @Nullable
+ public static Language getLanguageInEditor(@NotNull Caret caret, @NotNull final Project project) {
+ Editor editor = caret.getEditor();
PsiFile file = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument());
if (file == null) return null;
- final SelectionModel selectionModel = editor.getSelectionModel();
- int caretOffset = editor.getCaretModel().getOffset();
- int mostProbablyCorrectLanguageOffset = caretOffset == selectionModel.getSelectionStart() ||
- caretOffset == selectionModel.getSelectionEnd()
- ? selectionModel.getSelectionStart()
- : caretOffset;
+ int caretOffset = caret.getOffset();
+ int mostProbablyCorrectLanguageOffset = caretOffset == caret.getSelectionEnd() ? caret.getSelectionStart() : caretOffset;
PsiElement elt = getElementAtOffset(file, mostProbablyCorrectLanguageOffset);
Language lang = findLanguageFromElement(elt);
- if (selectionModel.hasSelection()) {
- final Language rangeLanguage = evaluateLanguageInRange(selectionModel.getSelectionStart(), selectionModel.getSelectionEnd(), file);
+ if (caret.hasSelection()) {
+ final Language rangeLanguage = evaluateLanguageInRange(caret.getSelectionStart(), caret.getSelectionEnd(), file);
if (rangeLanguage == null) return file.getLanguage();
lang = rangeLanguage;
@@ -115,22 +117,24 @@ public class PsiUtilBase extends PsiUtilCore implements PsiEditorUtil {
@Nullable
public static PsiFile getPsiFileInEditor(@NotNull final Editor editor, @NotNull final Project project) {
+ return getPsiFileInEditor(editor.getCaretModel().getCurrentCaret(), project);
+ }
+
+ @Nullable
+ public static PsiFile getPsiFileInEditor(@NotNull Caret caret, @NotNull final Project project) {
+ Editor editor = caret.getEditor();
final PsiFile file = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument());
if (file == null) return null;
PsiUtilCore.ensureValid(file);
- final Language language = getLanguageInEditor(editor, project);
+ final Language language = getLanguageInEditor(caret, project);
if (language == null) return file;
if (language == file.getLanguage()) return file;
- final SelectionModel selectionModel = editor.getSelectionModel();
- int caretOffset = editor.getCaretModel().getOffset();
- int mostProbablyCorrectLanguageOffset = caretOffset == selectionModel.getSelectionStart() ||
- caretOffset == selectionModel.getSelectionEnd()
- ? selectionModel.getSelectionStart()
- : caretOffset;
+ int caretOffset = caret.getOffset();
+ int mostProbablyCorrectLanguageOffset = caretOffset == caret.getSelectionEnd() ? caret.getSelectionStart() : caretOffset;
return getPsiFileAtOffset(file, mostProbablyCorrectLanguageOffset);
}
diff --git a/platform/lang-impl/src/com/intellij/application/options/CodeCompletionPanel.java b/platform/lang-impl/src/com/intellij/application/options/CodeCompletionPanel.java
index 8e8eba54cbf9..6c65209d1122 100644
--- a/platform/lang-impl/src/com/intellij/application/options/CodeCompletionPanel.java
+++ b/platform/lang-impl/src/com/intellij/application/options/CodeCompletionPanel.java
@@ -28,8 +28,10 @@ import com.intellij.openapi.application.ApplicationBundle;
import com.intellij.openapi.keymap.KeymapUtil;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.openapi.util.text.StringUtilRt;
import com.intellij.ui.components.JBCheckBox;
import org.intellij.lang.annotations.MagicConstant;
+import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import java.awt.event.ActionEvent;
@@ -56,7 +58,7 @@ public class CodeCompletionPanel {
private static final String CASE_SENSITIVE_FIRST_LETTER = ApplicationBundle.message("combobox.autocomplete.case.sensitive.first.letter");
private static final String[] CASE_VARIANTS = {CASE_SENSITIVE_ALL, CASE_SENSITIVE_NONE, CASE_SENSITIVE_FIRST_LETTER};
- public CodeCompletionPanel(){
+ public CodeCompletionPanel() {
//noinspection unchecked
myCaseSensitiveCombo.setModel(new DefaultComboBoxModel(CASE_VARIANTS));
@@ -73,7 +75,7 @@ public class CodeCompletionPanel {
myCbAutocompletion.addActionListener(
new ActionListener() {
@Override
- public void actionPerformed(ActionEvent event) {
+ public void actionPerformed(@NotNull ActionEvent event) {
boolean selected = myCbAutocompletion.isSelected();
myCbSelectByChars.setEnabled(selected);
}
@@ -83,7 +85,7 @@ public class CodeCompletionPanel {
myCbAutopopupJavaDoc.addActionListener(
new ActionListener() {
@Override
- public void actionPerformed(ActionEvent event) {
+ public void actionPerformed(@NotNull ActionEvent event) {
myAutopopupJavaDocField.setEnabled(myCbAutopopupJavaDoc.isSelected());
}
}
@@ -92,7 +94,7 @@ public class CodeCompletionPanel {
myCbParameterInfoPopup.addActionListener(
new ActionListener() {
@Override
- public void actionPerformed(ActionEvent event) {
+ public void actionPerformed(@NotNull ActionEvent event) {
myParameterInfoDelayField.setEnabled(myCbParameterInfoPopup.isSelected());
}
}
@@ -205,16 +207,8 @@ public class CodeCompletionPanel {
}
private static int getIntegerValue(String s, int defaultValue) {
- int value = defaultValue;
- try {
- value = Integer.parseInt(s);
- if(value < 0) {
- return defaultValue;
- }
- }
- catch (NumberFormatException ignored) {
- }
- return value;
+ int value = StringUtilRt.parseInt(s, defaultValue);
+ return value < 0 ? defaultValue : value;
}
@MagicConstant(intValues = {CodeInsightSettings.ALL, CodeInsightSettings.NONE, CodeInsightSettings.FIRST_LETTER})
diff --git a/platform/lang-impl/src/com/intellij/application/options/CodeStyleAbstractPanel.java b/platform/lang-impl/src/com/intellij/application/options/CodeStyleAbstractPanel.java
index f7c1fd4c7e2d..2b142a4bffb2 100644
--- a/platform/lang-impl/src/com/intellij/application/options/CodeStyleAbstractPanel.java
+++ b/platform/lang-impl/src/com/intellij/application/options/CodeStyleAbstractPanel.java
@@ -201,7 +201,7 @@ public abstract class CodeStyleAbstractPanel implements Disposable {
private int getAdjustedRightMargin() {
int result = getRightMargin();
- return result > 0 ? result : CodeStyleFacade.getInstance(ProjectUtil.guessCurrentProject(getPanel())).getRightMargin();
+ return result > 0 ? result : CodeStyleFacade.getInstance(ProjectUtil.guessCurrentProject(getPanel())).getRightMargin(getDefaultLanguage());
}
protected abstract int getRightMargin();
@@ -226,7 +226,7 @@ public abstract class CodeStyleAbstractPanel implements Disposable {
catch (ConfigurationException ignore) {
}
CodeStyleSettings clone = mySettings.clone();
- clone.RIGHT_MARGIN = getAdjustedRightMargin();
+ clone.setRightMargin(getDefaultLanguage(), getAdjustedRightMargin());
CodeStyleSettingsManager.getInstance(project).setTemporarySettings(clone);
PsiFile formatted;
try {
@@ -267,7 +267,7 @@ public abstract class CodeStyleAbstractPanel implements Disposable {
Document document = documentManager.getDocument(psiFile);
if (document != null) {
CodeStyleSettings clone = mySettings.clone();
- clone.RIGHT_MARGIN = getAdjustedRightMargin();
+ clone.setRightMargin(getDefaultLanguage(), getAdjustedRightMargin());
CodeStyleSettingsManager.getInstance(project).setTemporarySettings(clone);
try {
CodeStyleManager.getInstance(project).reformat(psiFile);
diff --git a/platform/lang-impl/src/com/intellij/application/options/CodeStyleSettingsUtilImpl.java b/platform/lang-impl/src/com/intellij/application/options/CodeStyleSettingsUtilImpl.java
index 640fcac38652..418cc3ccef6d 100644
--- a/platform/lang-impl/src/com/intellij/application/options/CodeStyleSettingsUtilImpl.java
+++ b/platform/lang-impl/src/com/intellij/application/options/CodeStyleSettingsUtilImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -23,7 +23,7 @@ import com.intellij.psi.codeStyle.CodeStyleSettingsManager;
public class CodeStyleSettingsUtilImpl extends CodeStyleSettingsUtil {
/**
- * Shows code style settings sutable for the project passed. I.e. it shows project code style page if one
+ * Shows code style settings suitable for the project passed. I.e. it shows project code style page if one
* is configured to use own code style scheme or global one in other case.
* @param project
* @return Returns true if settings were modified during editing session.
diff --git a/platform/lang-impl/src/com/intellij/application/options/ModuleAwareProjectConfigurable.java b/platform/lang-impl/src/com/intellij/application/options/ModuleAwareProjectConfigurable.java
index f7d8ab8e7df1..b005b5e158fd 100644
--- a/platform/lang-impl/src/com/intellij/application/options/ModuleAwareProjectConfigurable.java
+++ b/platform/lang-impl/src/com/intellij/application/options/ModuleAwareProjectConfigurable.java
@@ -35,7 +35,6 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
-import javax.swing.border.EmptyBorder;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import java.awt.*;
@@ -116,8 +115,7 @@ public abstract class ModuleAwareProjectConfigurable<T extends UnnamedConfigurab
for (Module module : modules) {
final T configurable = createModuleConfigurable(module);
myModuleConfigurables.put(module, configurable);
- final JComponent component = new JBScrollPane(configurable.createComponent());
- component.setBorder(new EmptyBorder(0, 0, 0, 0));
+ final JComponent component = configurable.createComponent();
cardPanel.add(component, module.getName());
}
moduleList.addListSelectionListener(new ListSelectionListener() {
diff --git a/platform/lang-impl/src/com/intellij/application/options/codeStyle/OptionTableWithPreviewPanel.java b/platform/lang-impl/src/com/intellij/application/options/codeStyle/OptionTableWithPreviewPanel.java
index 099830e15902..f978d5f6dcdb 100644
--- a/platform/lang-impl/src/com/intellij/application/options/codeStyle/OptionTableWithPreviewPanel.java
+++ b/platform/lang-impl/src/com/intellij/application/options/codeStyle/OptionTableWithPreviewPanel.java
@@ -340,6 +340,16 @@ public abstract class OptionTableWithPreviewPanel extends MultilanguageCodeStyle
addOption(fieldName, title, null, options, values);
}
+ protected void addOption(@NotNull String fieldName,
+ @NotNull String title,
+ @Nullable String groupName,
+ int minValue,
+ int maxValue,
+ int defaultValue,
+ String defaultValueText) {
+ myOptions.add(new IntOption(null, fieldName, title, groupName, null, null, minValue, maxValue, defaultValue, defaultValueText));
+ }
+
protected void addOption(@NotNull String fieldName, @NotNull String title, @Nullable String groupName) {
myOptions.add(new BooleanOption(null, fieldName, title, groupName, null, null));
}
@@ -469,6 +479,78 @@ public abstract class OptionTableWithPreviewPanel extends MultilanguageCodeStyle
}
}
+ private class IntOption extends Option {
+
+ private final int myMinValue;
+ private final int myMaxValue;
+ private final int myDefaultValue;
+ @Nullable private String myDefaultValueText;
+
+ public IntOption(Class<? extends CustomCodeStyleSettings> clazz,
+ @NotNull String fieldName,
+ @NotNull String title,
+ @Nullable String groupName,
+ @Nullable OptionAnchor anchor,
+ @Nullable String anchorFiledName,
+ int minValue,
+ int maxValue,
+ int defaultValue,
+ @Nullable String defaultValueText) {
+ super(clazz, fieldName, title, groupName, anchor, anchorFiledName);
+ myMinValue = minValue;
+ myMaxValue = maxValue;
+ myDefaultValue = defaultValue;
+ myDefaultValueText = defaultValueText;
+ }
+
+ @Override
+ public Object getValue(CodeStyleSettings settings) {
+ try {
+ int value = field.getInt(getSettings(settings));
+ return value == myDefaultValue && myDefaultValueText != null ? myDefaultValueText : value;
+ }
+ catch (IllegalAccessException e) {
+ return null;
+ }
+ }
+
+ @Override
+ public void setValue(Object value, CodeStyleSettings settings) {
+ //noinspection EmptyCatchBlock
+ try {
+ if (myDefaultValueText != null && !myDefaultValueText.equals(value)) {
+ field.setInt(getSettings(settings), ((Integer)value).intValue());
+ }
+ else {
+ field.setInt(getSettings(settings), -1);
+ }
+ }
+ catch (IllegalAccessException e) {
+ }
+ }
+
+ public int getMinValue() {
+ return myMinValue;
+ }
+
+ public int getMaxValue() {
+ return myMaxValue;
+ }
+
+ public int getDefaultValue() {
+ return myDefaultValue;
+ }
+
+ public boolean isDefaultText(Object value) {
+ return myDefaultValueText != null && myDefaultValueText.equals(value);
+ }
+
+ @Nullable
+ public String getDefaultValueText() {
+ return myDefaultValueText;
+ }
+ }
+
@SuppressWarnings({"HardCodedStringLiteral"})
public final ColumnInfo TITLE = new ColumnInfo("TITLE") {
@Override
@@ -604,6 +686,7 @@ public abstract class OptionTableWithPreviewPanel extends MultilanguageCodeStyle
private final JLabel myComboBox = new JLabel();
private final JCheckBox myCheckBox = new JCheckBox();
private final JPanel myEmptyLabel = new JPanel();
+ private final JLabel myIntLabel = new JLabel();
@Override
public Component getTableCellRendererComponent(JTable table,
@@ -636,6 +719,10 @@ public abstract class OptionTableWithPreviewPanel extends MultilanguageCodeStyle
myComboBox.setEnabled(isEnabled);
return myComboBox;
}
+ else if (value instanceof Integer) {
+ myIntLabel.setText(value.toString());
+ return myIntLabel;
+ }
myCheckBox.putClientProperty("JComponent.sizeVariant", "small");
myComboBox.putClientProperty("JComponent.sizeVariant", "small");
@@ -645,12 +732,55 @@ public abstract class OptionTableWithPreviewPanel extends MultilanguageCodeStyle
}
}
+ private static class MyIntOptionEditor extends JTextField {
+ private int myMinValue;
+ private int myMaxValue;
+ private int myDefaultValue;
+ private String myDefaultValueText;
+
+ private MyIntOptionEditor() {
+ super();
+ }
+
+ public Object getPresentableValue() {
+ int value = validateAndGetIntOption();
+ return value == myDefaultValue && myDefaultValueText != null ? myDefaultValueText : value;
+ }
+
+ private int validateAndGetIntOption() {
+ try {
+ int value = Integer.parseInt(getText());
+ return value >= myMinValue && value <= myMaxValue ? value : myDefaultValue;
+ }
+ catch (NumberFormatException nfe) {
+ return myDefaultValue;
+ }
+ }
+
+ public void setMinValue(int minValue) {
+ myMinValue = minValue;
+ }
+
+ public void setMaxValue(int maxValue) {
+ myMaxValue = maxValue;
+ }
+
+ public void setDefaultValue(int defaultValue) {
+ myDefaultValue = defaultValue;
+ }
+
+ public void setDefaultValueText(String defaultValueText) {
+ myDefaultValueText = defaultValueText;
+ }
+ }
+
/**
* @author Konstantin Bulenkov
*/
private class MyValueEditor extends AbstractTableCellEditor {
private final JCheckBox myBooleanEditor = new JCheckBox();
private JBComboBoxTableCellEditorComponent myOptionsEditor = new JBComboBoxTableCellEditorComponent();
+ private MyIntOptionEditor myIntOptionsEditor = new MyIntOptionEditor();
private Component myCurrentEditor = null;
private MyTreeNode myCurrentNode = null;
@@ -684,6 +814,9 @@ public abstract class OptionTableWithPreviewPanel extends MultilanguageCodeStyle
else if (myCurrentEditor == myBooleanEditor) {
return myBooleanEditor.isSelected() ? Boolean.TRUE : Boolean.FALSE;
}
+ else if (myCurrentEditor == myIntOptionsEditor) {
+ return myIntOptionsEditor.getPresentableValue();
+ }
return null;
}
@@ -702,6 +835,15 @@ public abstract class OptionTableWithPreviewPanel extends MultilanguageCodeStyle
myBooleanEditor.setSelected(node.getValue() == Boolean.TRUE);
myBooleanEditor.setEnabled(node.isEnabled());
}
+ else if (node.getKey() instanceof IntOption) {
+ IntOption intOption = (IntOption)node.getKey();
+ myCurrentEditor = myIntOptionsEditor;
+ myIntOptionsEditor.setText(intOption.isDefaultText(node.getValue()) ? "" : node.getValue().toString());
+ myIntOptionsEditor.setMinValue(intOption.getMinValue());
+ myIntOptionsEditor.setMaxValue(intOption.getMaxValue());
+ myIntOptionsEditor.setDefaultValue(intOption.getDefaultValue());
+ myIntOptionsEditor.setDefaultValueText(intOption.getDefaultValueText());
+ }
else {
myCurrentEditor = myOptionsEditor;
myOptionsEditor.setCell(table, row, column);
diff --git a/platform/lang-impl/src/com/intellij/application/options/codeStyle/WrappingAndBracesPanel.java b/platform/lang-impl/src/com/intellij/application/options/codeStyle/WrappingAndBracesPanel.java
index 1b270874101e..c192d0e2893a 100644
--- a/platform/lang-impl/src/com/intellij/application/options/codeStyle/WrappingAndBracesPanel.java
+++ b/platform/lang-impl/src/com/intellij/application/options/codeStyle/WrappingAndBracesPanel.java
@@ -32,6 +32,8 @@ public class WrappingAndBracesPanel extends OptionTableWithPreviewPanel {
@Override
protected void initTables() {
+ addOption("RIGHT_MARGIN", ApplicationBundle.message("editbox.right.margin.columns"), null, 0, 999, -1, ApplicationBundle.message("settings.code.style.default.general"));
+
addOption("KEEP_LINE_BREAKS", ApplicationBundle.message("wrapping.keep.line.breaks"), WRAPPING_KEEP);
addOption("KEEP_FIRST_COLUMN_COMMENT", ApplicationBundle.message("wrapping.keep.comment.at.first.column"), WRAPPING_KEEP);
addOption("KEEP_CONTROL_STATEMENT_IN_ONE_LINE", ApplicationBundle.message("checkbox.keep.when.reformatting.control.statement.in.one.line"), WRAPPING_KEEP);
diff --git a/platform/lang-impl/src/com/intellij/application/options/editor/EditorSmartKeysConfigurable.java b/platform/lang-impl/src/com/intellij/application/options/editor/EditorSmartKeysConfigurable.java
index 2cabcabf74ad..a5551086daaf 100644
--- a/platform/lang-impl/src/com/intellij/application/options/editor/EditorSmartKeysConfigurable.java
+++ b/platform/lang-impl/src/com/intellij/application/options/editor/EditorSmartKeysConfigurable.java
@@ -161,7 +161,7 @@ public class EditorSmartKeysConfigurable extends CompositeConfigurable<UnnamedCo
myCbSurroundSelectionOnTyping.setSelected(codeInsightSettings.SURROUND_SELECTION_ON_QUOTE_TYPED);
- myCbIndentingBackspace.setSelected(codeInsightSettings.INDENTING_BACKSPACE);
+ myCbIndentingBackspace.setSelected(codeInsightSettings.SMART_BACKSPACE == CodeInsightSettings.AUTOINDENT);
super.reset();
}
@@ -182,7 +182,7 @@ public class EditorSmartKeysConfigurable extends CompositeConfigurable<UnnamedCo
codeInsightSettings.SURROUND_SELECTION_ON_QUOTE_TYPED = myCbSurroundSelectionOnTyping.isSelected();
editorSettings.setCamelWords(myCbCamelWords.isSelected());
codeInsightSettings.REFORMAT_ON_PASTE = getReformatPastedBlockValue();
- codeInsightSettings.INDENTING_BACKSPACE = myCbIndentingBackspace.isSelected();
+ codeInsightSettings.SMART_BACKSPACE = myCbIndentingBackspace.isSelected() ? CodeInsightSettings.AUTOINDENT : CodeInsightSettings.OFF;
super.apply();
}
@@ -208,7 +208,7 @@ public class EditorSmartKeysConfigurable extends CompositeConfigurable<UnnamedCo
isModified |= isModified(myCbSurroundSelectionOnTyping, codeInsightSettings.SURROUND_SELECTION_ON_QUOTE_TYPED);
- isModified |= isModified(myCbIndentingBackspace, codeInsightSettings.INDENTING_BACKSPACE);
+ isModified |= isModified(myCbIndentingBackspace, codeInsightSettings.SMART_BACKSPACE == CodeInsightSettings.AUTOINDENT);
return isModified;
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/CodeInsightSettings.java b/platform/lang-impl/src/com/intellij/codeInsight/CodeInsightSettings.java
index 013b0808faca..942cbfa17f1e 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/CodeInsightSettings.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/CodeInsightSettings.java
@@ -100,7 +100,10 @@ public class CodeInsightSettings implements PersistentStateComponent<Element>, C
public boolean SHOW_FULL_SIGNATURES_IN_PARAMETER_INFO = false;
- public boolean INDENTING_BACKSPACE = true;
+ @MagicConstant(intValues = {OFF, AUTOINDENT})
+ public int SMART_BACKSPACE = AUTOINDENT;
+ public static final int OFF = 0;
+ public static final int AUTOINDENT = 1;
public boolean SMART_INDENT_ON_ENTER = true;
public boolean INSERT_BRACE_ON_ENTER = true;
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/actions/MultiCaretCodeInsightAction.java b/platform/lang-impl/src/com/intellij/codeInsight/actions/MultiCaretCodeInsightAction.java
new file mode 100644
index 000000000000..568e17b58bd6
--- /dev/null
+++ b/platform/lang-impl/src/com/intellij/codeInsight/actions/MultiCaretCodeInsightAction.java
@@ -0,0 +1,153 @@
+/*
+ * Copyright 2000-2014 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.actions;
+
+import com.intellij.openapi.actionSystem.AnAction;
+import com.intellij.openapi.actionSystem.AnActionEvent;
+import com.intellij.openapi.actionSystem.CommonDataKeys;
+import com.intellij.openapi.actionSystem.Presentation;
+import com.intellij.openapi.application.ApplicationManager;
+import com.intellij.openapi.command.CommandProcessor;
+import com.intellij.openapi.editor.Caret;
+import com.intellij.openapi.editor.CaretAction;
+import com.intellij.openapi.editor.Editor;
+import com.intellij.openapi.editor.ScrollType;
+import com.intellij.openapi.editor.actionSystem.DocCommandGroupId;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.Ref;
+import com.intellij.psi.PsiDocumentManager;
+import com.intellij.psi.PsiFile;
+import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil;
+import com.intellij.psi.util.PsiUtilBase;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Base class for PSI-aware editor actions that need to support multiple carets.
+ * Recognizes multi-root PSI and injected fragments, so different carets might be processed in context of different
+ * {@link com.intellij.openapi.editor.Editor} and {@link com.intellij.psi.PsiFile} instances.
+ * <p>
+ * Implementations should implement {@link #getHandler()} method, and might override {@link
+ * #isValidFor(com.intellij.openapi.project.Project, com.intellij.openapi.editor.Editor, com.intellij.openapi.editor.Caret, com.intellij.psi.PsiFile)} method.
+ *
+ * @see com.intellij.codeInsight.actions.MultiCaretCodeInsightActionHandler
+ */
+public abstract class MultiCaretCodeInsightAction extends AnAction {
+ @Override
+ public void actionPerformed(AnActionEvent e) {
+ final Project project = e.getProject();
+ if (project == null) {
+ return;
+ }
+ final Editor hostEditor = CommonDataKeys.EDITOR.getData(e.getDataContext());
+ if (hostEditor == null) {
+ return;
+ }
+
+ actionPerformedImpl(project, hostEditor);
+ }
+
+ public void actionPerformedImpl(final Project project, final Editor hostEditor) {
+ CommandProcessor.getInstance().executeCommand(project, new Runnable() {
+ @Override
+ public void run() {
+ ApplicationManager.getApplication().runWriteAction(new Runnable() {
+ @Override
+ public void run() {
+ MultiCaretCodeInsightActionHandler handler = getHandler();
+ try {
+ iterateOverCarets(project, hostEditor, handler);
+ }
+ finally {
+ handler.postInvoke();
+ }
+ }
+ });
+ }
+ }, getCommandName(), DocCommandGroupId.noneGroupId(hostEditor.getDocument()));
+
+ hostEditor.getScrollingModel().scrollToCaret(ScrollType.RELATIVE);
+ }
+
+ @Override
+ public void update(AnActionEvent e) {
+ final Presentation presentation = e.getPresentation();
+
+ Project project = e.getProject();
+ if (project == null) {
+ presentation.setEnabled(false);
+ return;
+ }
+
+ Editor hostEditor = CommonDataKeys.EDITOR.getData(e.getDataContext());
+ if (hostEditor == null) {
+ presentation.setEnabled(false);
+ return;
+ }
+
+ final Ref<Boolean> enabled = new Ref<Boolean>(Boolean.FALSE);
+ iterateOverCarets(project, hostEditor, new MultiCaretCodeInsightActionHandler() {
+ @Override
+ public void invoke(@NotNull Project project, @NotNull Editor editor, @NotNull Caret caret, @NotNull PsiFile file) {
+ if (isValidFor(project, editor, caret, file)) {
+ enabled.set(Boolean.TRUE);
+ }
+ }
+ });
+ presentation.setEnabled(enabled.get());
+ }
+
+ private static void iterateOverCarets(@NotNull final Project project,
+ @NotNull final Editor hostEditor,
+ @NotNull final MultiCaretCodeInsightActionHandler handler) {
+ PsiDocumentManager documentManager = PsiDocumentManager.getInstance(project);
+ final PsiFile psiFile = documentManager.getCachedPsiFile(hostEditor.getDocument());
+ documentManager.commitAllDocuments();
+
+ hostEditor.getCaretModel().runForEachCaret(new CaretAction() {
+ @Override
+ public void perform(Caret caret) {
+ Editor editor = hostEditor;
+ if (psiFile != null) {
+ Caret injectedCaret = InjectedLanguageUtil.getCaretForInjectedLanguageNoCommit(caret, psiFile);
+ if (injectedCaret != null) {
+ caret = injectedCaret;
+ editor = caret.getEditor();
+ }
+ }
+ final PsiFile file = PsiUtilBase.getPsiFileInEditor(caret, project);
+ if (file != null) {
+ handler.invoke(project, editor, caret, file);
+ }
+ }
+ }, true);
+ }
+
+ /**
+ * During action status update this method is invoked for each caret in editor. If at least for a single caret it returns
+ * <code>true</code>, action is considered enabled.
+ */
+ protected boolean isValidFor(@NotNull Project project, @NotNull Editor editor, @NotNull Caret caret, @NotNull PsiFile file) {
+ return true;
+ }
+
+ @NotNull
+ protected abstract MultiCaretCodeInsightActionHandler getHandler();
+
+ protected String getCommandName() {
+ String text = getTemplatePresentation().getText();
+ return text == null ? "" : text;
+ }
+}
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/actions/MultiCaretCodeInsightActionHandler.java b/platform/lang-impl/src/com/intellij/codeInsight/actions/MultiCaretCodeInsightActionHandler.java
new file mode 100644
index 000000000000..bfe7e325b8eb
--- /dev/null
+++ b/platform/lang-impl/src/com/intellij/codeInsight/actions/MultiCaretCodeInsightActionHandler.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2000-2014 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.actions;
+
+import com.intellij.openapi.editor.Caret;
+import com.intellij.openapi.editor.Editor;
+import com.intellij.openapi.project.Project;
+import com.intellij.psi.PsiFile;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Delegate class that performs actual work for {@link com.intellij.codeInsight.actions.MultiCaretCodeInsightAction}
+ */
+public abstract class MultiCaretCodeInsightActionHandler {
+ /**
+ * Invoked for each caret in editor (in bottom-to-top order). <code>project</code> value is the same for all carets, <code>editor</code>
+ * and <code>file</code> values can be different in presence of multi-root PSI and injected fragments. For injected fragments
+ * caret instance will belong to corresponding injected editor.
+ */
+ public abstract void invoke(@NotNull Project project, @NotNull Editor editor, @NotNull Caret caret, @NotNull PsiFile file);
+
+ /**
+ * Invoked after processing all carets.
+ */
+ public void postInvoke() {}
+} \ No newline at end of file
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/actions/ReformatCodeAction.java b/platform/lang-impl/src/com/intellij/codeInsight/actions/ReformatCodeAction.java
index 50942cb06c6b..4966a9466a26 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/actions/ReformatCodeAction.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/actions/ReformatCodeAction.java
@@ -174,7 +174,8 @@ public class ReformatCodeAction extends AnAction implements DumbAware {
}
final TextRange range;
- if (!processWholeFile && editor != null && editor.getSelectionModel().hasSelection()){
+ final boolean processSelectedText = !processWholeFile && hasSelection;
+ if (processSelectedText) {
range = TextRange.create(editor.getSelectionModel().getSelectionStart(), editor.getSelectionModel().getSelectionEnd());
}
else{
@@ -185,7 +186,7 @@ public class ReformatCodeAction extends AnAction implements DumbAware {
new OptimizeImportsProcessor(new ReformatCodeProcessor(project, file, null, processChangedTextOnly)).run();
}
else {
- new ReformatCodeProcessor(project, file, range, processChangedTextOnly).run();
+ new ReformatCodeProcessor(project, file, range, !processSelectedText && processChangedTextOnly).run();
}
if (rearrangeEntries && file != null && editor != null) {
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/completion/CodeCompletionHandlerBase.java b/platform/lang-impl/src/com/intellij/codeInsight/completion/CodeCompletionHandlerBase.java
index e039cec3a424..e0a3be5f423d 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/completion/CodeCompletionHandlerBase.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/completion/CodeCompletionHandlerBase.java
@@ -772,11 +772,8 @@ public class CodeCompletionHandlerBase {
if (context.getCompletionChar() == Lookup.COMPLETE_STATEMENT_SELECT_CHAR) {
final Language language = PsiUtilBase.getLanguageInEditor(editor, project);
if (language != null) {
- final List<SmartEnterProcessor> processors = SmartEnterProcessors.INSTANCE.forKey(language);
- if (processors.size() > 0) {
- for (SmartEnterProcessor processor : processors) {
- processor.process(project, editor, indicator.getParameters().getOriginalFile());
- }
+ for (SmartEnterProcessor processor : SmartEnterProcessors.INSTANCE.forKey(language)) {
+ if (processor.processAfterCompletion(editor, indicator.getParameters().getOriginalFile())) break;
}
}
}
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionProgressIndicator.java b/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionProgressIndicator.java
index 0143e55a4e98..e25f050c8d7b 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionProgressIndicator.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionProgressIndicator.java
@@ -17,6 +17,7 @@
package com.intellij.codeInsight.completion;
import com.intellij.codeInsight.CodeInsightSettings;
+import com.intellij.codeInsight.TargetElementUtilBase;
import com.intellij.codeInsight.completion.impl.CompletionServiceImpl;
import com.intellij.codeInsight.completion.impl.CompletionSorterImpl;
import com.intellij.codeInsight.editorActions.CompletionAutoPopupHandler;
@@ -216,7 +217,7 @@ public class CompletionProgressIndicator extends ProgressIndicatorBase implement
if (!initContext.getOffsetMap().wasModified(CompletionInitializationContext.IDENTIFIER_END_OFFSET)) {
try {
final int selectionEndOffset = initContext.getSelectionEndOffset();
- final PsiReference reference = initContext.getFile().findReferenceAt(selectionEndOffset);
+ final PsiReference reference = TargetElementUtilBase.findReference(myEditor, selectionEndOffset);
if (reference != null) {
initContext.setReplacementOffset(findReplacementOffset(selectionEndOffset, reference));
}
@@ -252,7 +253,7 @@ public class CompletionProgressIndicator extends ProgressIndicatorBase implement
}
}
- return reference.getElement().getTextRange().getStartOffset() + reference.getRangeInElement().getEndOffset();
+ return selectionEndOffset;
}
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/completion/FilePathCompletionContributor.java b/platform/lang-impl/src/com/intellij/codeInsight/completion/FilePathCompletionContributor.java
index f23a7a6f6cca..4a34e9460718 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/completion/FilePathCompletionContributor.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/completion/FilePathCompletionContributor.java
@@ -48,6 +48,7 @@ import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.psi.search.ProjectScope;
import com.intellij.util.ArrayUtil;
import com.intellij.util.ProcessingContext;
+import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -71,9 +72,7 @@ public class FilePathCompletionContributor extends CompletionContributor {
final PsiReference psiReference = parameters.getPosition().getContainingFile().findReferenceAt(parameters.getOffset());
if (getReference(psiReference) != null && parameters.getInvocationCount() == 1) {
final String shortcut = getActionShortcut(IdeActions.ACTION_CODE_COMPLETION);
- if (shortcut != null) {
- result.addLookupAdvertisement(CodeInsightBundle.message("class.completion.file.path", shortcut));
- }
+ result.addLookupAdvertisement(CodeInsightBundle.message("class.completion.file.path", shortcut));
}
}
});
@@ -134,24 +133,30 @@ public class FilePathCompletionContributor extends CompletionContributor {
final PsiFile[] files = FilenameIndex.getFilesByName(project, name, scope);
- if (files.length > 0) {
- for (final PsiFile file : files) {
+ if (files.length <= 0) {
+ continue;
+ }
+ for (final PsiFile file : files) {
+ ProgressManager.checkCanceled();
+
+ final VirtualFile virtualFile = file.getVirtualFile();
+ if (virtualFile == null || !virtualFile.isValid() || Comparing.equal(virtualFile, contextFile)) {
+ continue;
+ }
+ List<FileReferenceHelper> helperList = new ArrayList<FileReferenceHelper>();
+ for (FileReferenceHelper contextHelper : helpers) {
ProgressManager.checkCanceled();
- final VirtualFile virtualFile = file.getVirtualFile();
- if (virtualFile != null && virtualFile.isValid() && !Comparing.equal(virtualFile, contextFile)) {
- for (FileReferenceHelper contextHelper : helpers) {
- ProgressManager.checkCanceled();
-
- if (contextHelper.isMine(project, virtualFile)) {
- if (pathPrefixParts == null ||
- fileMatchesPathPrefix(contextHelper.getPsiFileSystemItem(project, virtualFile), pathPrefixParts)) {
- __result.addElement(new FilePathLookupItem(file, contextHelper));
- }
- }
+ if (contextHelper.isMine(project, virtualFile)) {
+ if (pathPrefixParts == null ||
+ fileMatchesPathPrefix(contextHelper.getPsiFileSystemItem(project, virtualFile), pathPrefixParts)) {
+ helperList.add(contextHelper);
}
}
}
+ if (!helperList.isEmpty()) {
+ __result.addElement(new FilePathLookupItem(file, helperList));
+ }
}
}
}
@@ -159,9 +164,7 @@ public class FilePathCompletionContributor extends CompletionContributor {
if (set.getSuitableFileTypes().length > 0 && parameters.getInvocationCount() == 1) {
final String shortcut = getActionShortcut(IdeActions.ACTION_CODE_COMPLETION);
- if (shortcut != null) {
- result.addLookupAdvertisement(CodeInsightBundle.message("class.completion.file.path.all.variants", shortcut));
- }
+ result.addLookupAdvertisement(CodeInsightBundle.message("class.completion.file.path.all.variants", shortcut));
}
if (fileReferencePair.getSecond()) result.stopHere();
@@ -203,7 +206,7 @@ public class FilePathCompletionContributor extends CompletionContributor {
final String path = StringUtil.join(contextParts, "/");
int nextIndex = 0;
- for (final String s : pathPrefix) {
+ for (@NonNls final String s : pathPrefix) {
if ((nextIndex = path.indexOf(s.toLowerCase(), nextIndex)) == -1) return false;
}
@@ -252,19 +255,19 @@ public class FilePathCompletionContributor extends CompletionContributor {
return null;
}
- public class FilePathLookupItem extends LookupElement {
+ public static class FilePathLookupItem extends LookupElement {
private final String myName;
private final String myPath;
private final String myInfo;
private final Icon myIcon;
private final PsiFile myFile;
- private final FileReferenceHelper myReferenceHelper;
+ private final List<FileReferenceHelper> myHelpers;
- public FilePathLookupItem(@NotNull final PsiFile file, @NotNull final FileReferenceHelper referenceHelper) {
+ public FilePathLookupItem(@NotNull final PsiFile file, @NotNull final List<FileReferenceHelper> helpers) {
myName = file.getName();
myPath = file.getVirtualFile().getPath();
- myReferenceHelper = referenceHelper;
+ myHelpers = helpers;
myInfo = FileInfoManager.getFileAdditionalInfo(file);
myIcon = file.getFileType().getIcon();
@@ -306,10 +309,7 @@ public class FilePathCompletionContributor extends CompletionContributor {
@Override
public void renderElement(LookupElementPresentation presentation) {
- final VirtualFile virtualFile = myFile.getVirtualFile();
- LOG.assertTrue(virtualFile != null);
- final PsiFileSystemItem root = myReferenceHelper.findRoot(myFile.getProject(), virtualFile);
- final String relativePath = PsiFileSystemItemUtil.getRelativePath(root, myReferenceHelper.getPsiFileSystemItem(myFile.getProject(), virtualFile));
+ final String relativePath = getRelativePath();
final StringBuilder sb = new StringBuilder();
if (myInfo != null) {
@@ -340,6 +340,18 @@ public class FilePathCompletionContributor extends CompletionContributor {
presentation.setIcon(myIcon);
}
+ @Nullable
+ private String getRelativePath() {
+ final VirtualFile virtualFile = myFile.getVirtualFile();
+ LOG.assertTrue(virtualFile != null);
+ for (FileReferenceHelper helper : myHelpers) {
+ final PsiFileSystemItem root = helper.findRoot(myFile.getProject(), virtualFile);
+ String path = PsiFileSystemItemUtil.getRelativePath(root, helper.getPsiFileSystemItem(myFile.getProject(), virtualFile));
+ if (path != null) return path;
+ }
+ return null;
+ }
+
@Override
public boolean equals(Object o) {
if (this == o) return true;
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/ShowIntentionsPass.java b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/ShowIntentionsPass.java
index 1984230809c5..8ceca4c94a31 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/ShowIntentionsPass.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/ShowIntentionsPass.java
@@ -25,7 +25,6 @@ import com.intellij.codeInsight.intention.IntentionManager;
import com.intellij.codeInsight.intention.impl.IntentionHintComponent;
import com.intellij.codeInsight.intention.impl.ShowIntentionActionsHandler;
import com.intellij.codeInsight.intention.impl.config.IntentionManagerSettings;
-import com.intellij.codeInsight.lookup.LookupManager;
import com.intellij.codeInsight.template.impl.TemplateManagerImpl;
import com.intellij.codeInsight.template.impl.TemplateState;
import com.intellij.codeInspection.actions.CleanupAllIntention;
@@ -208,8 +207,6 @@ public class ShowIntentionsPass extends TextEditorHighlightingPass {
}
private void getIntentionActionsToShow() {
- if (LookupManager.getInstance(myProject).getActiveLookup() != null) return;
-
getActionsToShow(myEditor, myFile, myIntentionsInfo, myPassIdToShowIntentionsFor);
if (myFile instanceof IntentionFilterOwner) {
final IntentionFilterOwner.IntentionActionsFilter actionsFilter = ((IntentionFilterOwner)myFile).getIntentionActionsFilter();
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/analysis/encoding/EncodingReferenceInjector.java b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/analysis/encoding/EncodingReferenceInjector.java
new file mode 100644
index 000000000000..6594a5a0866d
--- /dev/null
+++ b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/analysis/encoding/EncodingReferenceInjector.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.codeInsight.daemon.impl.analysis.encoding;
+
+import com.intellij.openapi.util.TextRange;
+import com.intellij.psi.PsiElement;
+import com.intellij.psi.PsiReference;
+import com.intellij.psi.injection.ReferenceInjector;
+import com.intellij.util.ProcessingContext;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * @author peter
+ */
+public class EncodingReferenceInjector extends ReferenceInjector {
+ @NotNull
+ @Override
+ public PsiReference[] getReferences(@NotNull PsiElement element, @NotNull ProcessingContext context, @NotNull TextRange range) {
+ return new PsiReference[]{new EncodingReference(element, range.substring(element.getText()), range)};
+ }
+
+ @NotNull
+ @Override
+ public String getId() {
+ return "encoding-reference";
+ }
+
+ @NotNull
+ @Override
+ public String getDisplayName() {
+ return "Encoding Name";
+ }
+}
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/documentation/DocumentationManager.java b/platform/lang-impl/src/com/intellij/codeInsight/documentation/DocumentationManager.java
index df55cbad9346..c27ce400049e 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/documentation/DocumentationManager.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/documentation/DocumentationManager.java
@@ -54,13 +54,17 @@ import com.intellij.openapi.wm.ex.WindowManagerEx;
import com.intellij.psi.*;
import com.intellij.psi.presentation.java.SymbolPresentationUtil;
import com.intellij.psi.util.PsiTreeUtil;
+import com.intellij.psi.util.PsiUtilCore;
import com.intellij.ui.ListScrollingUtil;
import com.intellij.ui.content.Content;
import com.intellij.ui.popup.AbstractPopup;
import com.intellij.ui.popup.NotLookupOrSearchCondition;
import com.intellij.ui.popup.PopupPositionManager;
import com.intellij.ui.popup.PopupUpdateProcessor;
-import com.intellij.util.*;
+import com.intellij.util.Alarm;
+import com.intellij.util.BooleanFunction;
+import com.intellij.util.Consumer;
+import com.intellij.util.Processor;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -572,7 +576,7 @@ public class DocumentationManager extends DockablePopupManager<DocumentationComp
final PsiReference ref = TargetElementUtilBase.findReference(editor, offset);
if (ref != null) {
element = assertSameProject(util.adjustReference(ref));
- if (element == null && ref instanceof PsiPolyVariantReference) {
+ if (ref instanceof PsiPolyVariantReference) {
element = assertSameProject(ref.getElement());
}
}
@@ -595,16 +599,17 @@ public class DocumentationManager extends DockablePopupManager<DocumentationComp
int offset = editor.getCaretModel().getOffset();
if (offset > 0 && offset == editor.getDocument().getTextLength()) offset--;
- final PsiElement contextElement = file == null? null : file.findElementAt(offset);
- final PsiReference ref = TargetElementUtilBase.findReference(editor, offset);
+ PsiReference ref = TargetElementUtilBase.findReference(editor, offset);
+ PsiElement contextElement = file == null? null : file.findElementAt(offset);
+ PsiElement targetElement = ref != null ? ref.getElement() : contextElement;
+ if (targetElement != null) {
+ PsiUtilCore.ensureValid(targetElement);
+ }
- final DocumentationProvider documentationProvider = getProviderFromElement(file);
+ DocumentationProvider documentationProvider = getProviderFromElement(file);
- return documentationProvider.getDocumentationElementForLookupItem(
- PsiManager.getInstance(myProject),
- item.getObject(),
- ref != null ? ref.getElement():contextElement
- );
+ PsiManager psiManager = PsiManager.getInstance(myProject);
+ return documentationProvider.getDocumentationElementForLookupItem(psiManager, item.getObject(), targetElement);
}
}
return null;
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/CopyHandler.java b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/CopyHandler.java
index a68a1fdeee5a..2a46c08fc2dd 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/CopyHandler.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/CopyHandler.java
@@ -37,8 +37,6 @@ import java.util.ArrayList;
import java.util.List;
public class CopyHandler extends EditorActionHandler {
- private static final Logger LOG = Logger.getInstance(CopyHandler.class);
-
private final EditorActionHandler myOriginalAction;
public CopyHandler(final EditorActionHandler originalHandler) {
@@ -93,7 +91,10 @@ public class CopyHandler extends EditorActionHandler {
transferableDatas.addAll(processor.collectTransferableData(file, editor, startOffsets, endOffsets));
}
- String rawText = TextBlockTransferable.convertLineSeparators(selectionModel.getSelectedText(true), "\n", transferableDatas);
+ String text = editor.getCaretModel().supportsMultipleCarets()
+ ? CopyPasteSupport.getSelectedTextForClipboard(editor, transferableDatas)
+ : selectionModel.getSelectedText();
+ String rawText = TextBlockTransferable.convertLineSeparators(text, "\n", transferableDatas);
String escapedText = null;
for (CopyPastePreProcessor processor : Extensions.getExtensions(CopyPastePreProcessor.EP_NAME)) {
escapedText = processor.preprocessOnCopy(file, startOffsets, endOffsets, rawText);
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/IndentingBackspaceHandler.java b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/IndentingBackspaceHandler.java
index 634b8f5570a3..345cb80bae69 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/IndentingBackspaceHandler.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/IndentingBackspaceHandler.java
@@ -45,7 +45,7 @@ public class IndentingBackspaceHandler extends BackspaceHandlerDelegate {
@Override
public boolean charDeleted(char c, PsiFile file, Editor editor) {
- if (!CodeInsightSettings.getInstance().INDENTING_BACKSPACE || !StringUtil.isWhiteSpace(c)) {
+ if (CodeInsightSettings.getInstance().SMART_BACKSPACE != CodeInsightSettings.AUTOINDENT || !StringUtil.isWhiteSpace(c)) {
return false;
}
LanguageCodeStyleSettingsProvider codeStyleSettingsProvider = LanguageCodeStyleSettingsProvider.forLanguage(file.getLanguage());
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/TextBlockTransferable.java b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/TextBlockTransferable.java
deleted file mode 100644
index 075f7618eddd..000000000000
--- a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/TextBlockTransferable.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Copyright 2000-2014 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.editorActions;
-
-import com.intellij.openapi.editor.RawText;
-import com.intellij.openapi.util.Comparing;
-import com.intellij.openapi.util.text.StringUtil;
-
-import java.awt.datatransfer.DataFlavor;
-import java.awt.datatransfer.Transferable;
-import java.awt.datatransfer.UnsupportedFlavorException;
-import java.io.IOException;
-import java.io.StringReader;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-
-class TextBlockTransferable implements Transferable {
- private final Collection<TextBlockTransferableData> myExtraData;
- private final RawText myRawText;
- private final String myText;
- private final DataFlavor[] myTransferDataFlavors;
-
- public TextBlockTransferable(String text, Collection<TextBlockTransferableData> extraData, RawText rawText) {
- myText = text;
- myExtraData = extraData;
- myRawText = rawText;
-
- List<DataFlavor> dataFlavors = new ArrayList<DataFlavor>();
- Collections.addAll(dataFlavors, DataFlavor.stringFlavor, DataFlavor.plainTextFlavor);
- final DataFlavor flavor = RawText.getDataFlavor();
- if (myRawText != null && flavor != null) {
- dataFlavors.add(flavor);
- }
- for(TextBlockTransferableData data: extraData) {
- final DataFlavor blockFlavor = data.getFlavor();
- if (blockFlavor != null) {
- dataFlavors.add(blockFlavor);
- }
- }
- myTransferDataFlavors = dataFlavors.toArray(new DataFlavor[dataFlavors.size()]);
- }
-
- @Override
- public DataFlavor[] getTransferDataFlavors() {
- return myTransferDataFlavors;
- }
-
- @Override
- public boolean isDataFlavorSupported(DataFlavor flavor) {
- DataFlavor[] flavors = getTransferDataFlavors();
- for (DataFlavor flavor1 : flavors) {
- if (flavor.equals(flavor1)) {
- return true;
- }
- }
- return false;
- }
-
- @Override
- public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException {
- try {
- for(TextBlockTransferableData data: myExtraData) {
- if (Comparing.equal(data.getFlavor(), flavor)) {
- return data;
- }
- }
- if (myRawText != null && Comparing.equal(RawText.getDataFlavor(), flavor)) {
- return myRawText;
- }
- else if (DataFlavor.stringFlavor.equals(flavor)) {
- return myText;
- }
- else if (DataFlavor.plainTextFlavor.equals(flavor)) {
- return new StringReader(myText);
- }
- }
- catch(NoClassDefFoundError e) {
- // ignore
- }
- throw new UnsupportedFlavorException(flavor);
- }
-
- public static String convertLineSeparators(String text,
- String newSeparator,
- Collection<TextBlockTransferableData> transferableDatas) {
- if (transferableDatas.size() > 0){
- int size = 0;
- for(TextBlockTransferableData data: transferableDatas) {
- size += data.getOffsetCount();
- }
-
- int[] offsets = new int[size];
- int index = 0;
- for(TextBlockTransferableData data: transferableDatas) {
- index = data.getOffsets(offsets, index);
- }
-
- text = StringUtil.convertLineSeparators(text, newSeparator, offsets);
-
- index = 0;
- for(TextBlockTransferableData data: transferableDatas) {
- index = data.setOffsets(offsets, index);
- }
-
- return text;
- }
- else{
- return StringUtil.convertLineSeparators(text, newSeparator);
- }
- }
-} \ No newline at end of file
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/TextBlockTransferableData.java b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/TextBlockTransferableData.java
deleted file mode 100644
index c15a50e3019a..000000000000
--- a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/TextBlockTransferableData.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright 2000-2009 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.editorActions;
-
-import java.awt.datatransfer.DataFlavor;
-
-/**
- * @author yole
- */
-public interface TextBlockTransferableData {
- DataFlavor getFlavor();
-
- int getOffsetCount();
- int getOffsets(final int[] offsets, final int index);
- int setOffsets(final int[] offsets, final int index);
-}
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/fillParagraph/ParagraphFillHandler.java b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/fillParagraph/ParagraphFillHandler.java
index 03a72378838c..3aeefefd55ec 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/fillParagraph/ParagraphFillHandler.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/fillParagraph/ParagraphFillHandler.java
@@ -54,7 +54,7 @@ public class ParagraphFillHandler {
document.replaceString(textRange.getStartOffset(), textRange.getEndOffset(),
replacementText);
final CodeFormatterFacade codeFormatter = new CodeFormatterFacade(
- CodeStyleSettingsManager.getSettings(element.getProject()));
+ CodeStyleSettingsManager.getSettings(element.getProject()), element.getLanguage());
codeFormatter.doWrapLongLinesIfNecessary(editor, element.getProject(), document,
textRange.getStartOffset(),
textRange.getStartOffset() + replacementText.length() + 1);
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/generation/CommentByBlockCommentHandler.java b/platform/lang-impl/src/com/intellij/codeInsight/generation/CommentByBlockCommentHandler.java
index ca915119388b..3704425eb54d 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/generation/CommentByBlockCommentHandler.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/generation/CommentByBlockCommentHandler.java
@@ -16,9 +16,9 @@
package com.intellij.codeInsight.generation;
-import com.intellij.codeInsight.CodeInsightActionHandler;
import com.intellij.codeInsight.CodeInsightUtilBase;
import com.intellij.codeInsight.CommentUtil;
+import com.intellij.codeInsight.actions.MultiCaretCodeInsightActionHandler;
import com.intellij.featureStatistics.FeatureUsageTracker;
import com.intellij.ide.highlighter.custom.CustomFileTypeLexer;
import com.intellij.lang.Commenter;
@@ -52,18 +52,20 @@ import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
import java.util.List;
-public class CommentByBlockCommentHandler implements CodeInsightActionHandler {
+public class CommentByBlockCommentHandler extends MultiCaretCodeInsightActionHandler {
private Project myProject;
private Editor myEditor;
+ private Caret myCaret;
private @NotNull PsiFile myFile;
private Document myDocument;
private CommenterDataHolder mySelfManagedCommenterData;
@Override
- public void invoke(@NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file) {
+ public void invoke(@NotNull Project project, @NotNull Editor editor, @NotNull Caret caret, @NotNull PsiFile file) {
if (!CodeInsightUtilBase.prepareEditorForWrite(editor)) return;
myProject = project;
myEditor = editor;
+ myCaret = caret;
myFile = file;
myDocument = editor.getDocument();
@@ -72,19 +74,17 @@ public class CommentByBlockCommentHandler implements CodeInsightActionHandler {
return;
}
FeatureUsageTracker.getInstance().triggerFeatureUsed("codeassists.comment.block");
- final Commenter commenter = findCommenter(myFile, myEditor);
+ final Commenter commenter = findCommenter(myFile, myEditor, caret);
if (commenter == null) return;
- final SelectionModel selectionModel = myEditor.getSelectionModel();
-
final String prefix;
final String suffix;
if (commenter instanceof SelfManagingCommenter) {
final SelfManagingCommenter selfManagingCommenter = (SelfManagingCommenter)commenter;
mySelfManagedCommenterData = selfManagingCommenter.createBlockCommentingState(
- selectionModel.getSelectionStart(),
- selectionModel.getSelectionEnd(),
+ caret.getSelectionStart(),
+ caret.getSelectionEnd(),
myDocument,
myFile
);
@@ -94,12 +94,12 @@ public class CommentByBlockCommentHandler implements CodeInsightActionHandler {
}
prefix = selfManagingCommenter.getBlockCommentPrefix(
- selectionModel.getSelectionStart(),
+ caret.getSelectionStart(),
myDocument,
mySelfManagedCommenterData
);
suffix = selfManagingCommenter.getBlockCommentSuffix(
- selectionModel.getSelectionEnd(),
+ caret.getSelectionEnd(),
myDocument,
mySelfManagedCommenterData
);
@@ -117,9 +117,9 @@ public class CommentByBlockCommentHandler implements CodeInsightActionHandler {
final int commentEnd = commentedRange.getEndOffset();
int selectionStart = commentStart;
int selectionEnd = commentEnd;
- if (selectionModel.hasSelection()) {
- selectionStart = selectionModel.getSelectionStart();
- selectionEnd = selectionModel.getSelectionEnd();
+ if (myCaret.hasSelection()) {
+ selectionStart = myCaret.getSelectionStart();
+ selectionEnd = myCaret.getSelectionEnd();
}
if ((commentStart < selectionStart || commentStart >= selectionEnd) && (commentEnd <= selectionStart || commentEnd > selectionEnd)) {
commentRange(selectionStart, selectionEnd, prefix, suffix, commenter);
@@ -129,9 +129,9 @@ public class CommentByBlockCommentHandler implements CodeInsightActionHandler {
}
}
else {
- if (selectionModel.hasBlockSelection()) {
- final LogicalPosition start = selectionModel.getBlockStart();
- final LogicalPosition end = selectionModel.getBlockEnd();
+ if (myEditor.getSelectionModel().hasBlockSelection()) {
+ final LogicalPosition start = myEditor.getSelectionModel().getBlockStart();
+ final LogicalPosition end = myEditor.getSelectionModel().getBlockEnd();
assert start != null;
assert end != null;
@@ -151,9 +151,9 @@ public class CommentByBlockCommentHandler implements CodeInsightActionHandler {
EditorModificationUtil.insertStringAtCaret(editor, prefix, true, true);
}
}
- else if (selectionModel.hasSelection()) {
- int selectionStart = selectionModel.getSelectionStart();
- int selectionEnd = selectionModel.getSelectionEnd();
+ else if (myCaret.hasSelection()) {
+ int selectionStart = myCaret.getSelectionStart();
+ int selectionEnd = myCaret.getSelectionEnd();
if (commenter instanceof IndentedCommenter) {
final Boolean value = ((IndentedCommenter)commenter).forceIndentedLineComment();
if (value != null && value == Boolean.TRUE) {
@@ -165,7 +165,7 @@ public class CommentByBlockCommentHandler implements CodeInsightActionHandler {
}
else {
EditorUtil.fillVirtualSpaceUntilCaret(editor);
- int caretOffset = myEditor.getCaretModel().getOffset();
+ int caretOffset = myCaret.getOffset();
if (commenter instanceof IndentedCommenter) {
final Boolean value = ((IndentedCommenter)commenter).forceIndentedLineComment();
if (value != null && value == Boolean.TRUE) {
@@ -177,7 +177,7 @@ public class CommentByBlockCommentHandler implements CodeInsightActionHandler {
}
}
myDocument.insertString(caretOffset, prefix + suffix);
- myEditor.getCaretModel().moveToOffset(caretOffset + prefix.length());
+ myCaret.moveToOffset(caretOffset + prefix.length());
}
}
}
@@ -188,12 +188,11 @@ public class CommentByBlockCommentHandler implements CodeInsightActionHandler {
}
private boolean testSelectionForNonComments() {
- SelectionModel model = myEditor.getSelectionModel();
- if (!model.hasSelection()) {
+ if (!myCaret.hasSelection()) {
return true;
}
TextRange range
- = new TextRange(model.getSelectionStart(), model.getSelectionEnd() - 1);
+ = new TextRange(myCaret.getSelectionStart(), myCaret.getSelectionEnd() - 1);
for (PsiElement element = myFile.findElementAt(range.getStartOffset()); element != null && range.intersects(element.getTextRange());
element = element.getNextSibling()) {
if (element instanceof OuterLanguageElement) {
@@ -247,7 +246,7 @@ public class CommentByBlockCommentHandler implements CodeInsightActionHandler {
final FileType fileType = myFile.getFileType();
if (fileType instanceof CustomSyntaxTableFileType) {
Lexer lexer = new CustomFileTypeLexer(((CustomSyntaxTableFileType)fileType).getSyntaxTable());
- final int caretOffset = myEditor.getCaretModel().getOffset();
+ final int caretOffset = myCaret.getOffset();
int commentStart = CharArrayUtil.lastIndexOf(text, commenter.getBlockCommentPrefix(), caretOffset);
if (commentStart == -1) return null;
@@ -261,17 +260,16 @@ public class CommentByBlockCommentHandler implements CodeInsightActionHandler {
final String prefix;
final String suffix;
- final SelectionModel selectionModel = myEditor.getSelectionModel();
if (commenter instanceof SelfManagingCommenter) {
SelfManagingCommenter selfManagingCommenter = (SelfManagingCommenter)commenter;
prefix = selfManagingCommenter.getBlockCommentPrefix(
- selectionModel.getSelectionStart(),
+ myCaret.getSelectionStart(),
myDocument,
mySelfManagedCommenterData
);
suffix = selfManagingCommenter.getBlockCommentSuffix(
- selectionModel.getSelectionEnd(),
+ myCaret.getSelectionEnd(),
myDocument,
mySelfManagedCommenterData
);
@@ -286,8 +284,8 @@ public class CommentByBlockCommentHandler implements CodeInsightActionHandler {
if (commenter instanceof SelfManagingCommenter) {
commentedRange = ((SelfManagingCommenter)commenter).getBlockCommentRange(
- selectionModel.getSelectionStart(),
- selectionModel.getSelectionEnd(),
+ myCaret.getSelectionStart(),
+ myCaret.getSelectionEnd(),
myDocument,
mySelfManagedCommenterData
);
@@ -316,11 +314,10 @@ public class CommentByBlockCommentHandler implements CodeInsightActionHandler {
@Nullable
private TextRange getSelectedComments(CharSequence text, String prefix, String suffix) {
TextRange commentedRange = null;
- final SelectionModel selectionModel = myEditor.getSelectionModel();
- if (selectionModel.hasSelection()) {
- int selectionStart = selectionModel.getSelectionStart();
+ if (myCaret.hasSelection()) {
+ int selectionStart = myCaret.getSelectionStart();
selectionStart = CharArrayUtil.shiftForward(text, selectionStart, " \t\n");
- int selectionEnd = selectionModel.getSelectionEnd() - 1;
+ int selectionEnd = myCaret.getSelectionEnd() - 1;
selectionEnd = CharArrayUtil.shiftBackward(text, selectionEnd, " \t\n") + 1;
if (selectionEnd - selectionStart >= prefix.length() + suffix.length() &&
CharArrayUtil.regionMatches(text, selectionStart, prefix) &&
@@ -332,13 +329,13 @@ public class CommentByBlockCommentHandler implements CodeInsightActionHandler {
}
@Nullable
- private static Commenter findCommenter(PsiFile file, Editor editor) {
+ private static Commenter findCommenter(PsiFile file, Editor editor, Caret caret) {
final FileType fileType = file.getFileType();
if (fileType instanceof AbstractFileType) {
return ((AbstractFileType)fileType).getCommenter();
}
- Language lang = PsiUtilBase.getLanguageInEditor(editor, file.getProject());
+ Language lang = PsiUtilBase.getLanguageInEditor(caret, file.getProject());
return getCommenter(file, editor, lang, lang);
}
@@ -371,9 +368,8 @@ public class CommentByBlockCommentHandler implements CodeInsightActionHandler {
@Nullable
private PsiElement findCommentAtCaret() {
- int offset = myEditor.getCaretModel().getOffset();
- SelectionModel selectionModel = myEditor.getSelectionModel();
- TextRange range = new TextRange(selectionModel.getSelectionStart(), selectionModel.getSelectionEnd());
+ int offset = myCaret.getOffset();
+ TextRange range = new TextRange(myCaret.getSelectionStart(), myCaret.getSelectionEnd());
if (offset == range.getEndOffset()) {
offset--;
}
@@ -383,21 +379,16 @@ public class CommentByBlockCommentHandler implements CodeInsightActionHandler {
PsiElement elt = myFile.getViewProvider().findElementAt(offset);
if (elt == null) return null;
PsiElement comment = PsiTreeUtil.getParentOfType(elt, PsiComment.class, false);
- if (comment == null || selectionModel.hasSelection() && !range.contains(comment.getTextRange())) {
+ if (comment == null || myCaret.hasSelection() && !range.contains(comment.getTextRange())) {
return null;
}
return comment;
}
- @Override
- public boolean startInWriteAction() {
- return true;
- }
-
public void commentRange(int startOffset, int endOffset, String commentPrefix, String commentSuffix, Commenter commenter) {
CharSequence chars = myDocument.getCharsSequence();
- LogicalPosition caretPosition = myEditor.getCaretModel().getLogicalPosition();
+ LogicalPosition caretPosition = myCaret.getLogicalPosition();
if (startOffset == 0 || chars.charAt(startOffset - 1) == '\n') {
if (endOffset == myDocument.getTextLength() || endOffset > 0 && chars.charAt(endOffset - 1) == '\n') {
@@ -426,21 +417,17 @@ public class CommentByBlockCommentHandler implements CodeInsightActionHandler {
nestingSuffix.append("\n");
TextRange range =
insertNestedComments(chars, startOffset, endOffset, nestingPrefix.toString(), nestingSuffix.toString(), commenter);
- myEditor.getSelectionModel().setSelection(range.getStartOffset(), range.getEndOffset());
- //myEditor.getSelectionModel().removeSelection();
+ myCaret.setSelection(range.getStartOffset(), range.getEndOffset());
LogicalPosition pos = new LogicalPosition(caretPosition.line + 1, caretPosition.column);
- myEditor.getCaretModel().moveToLogicalPosition(pos);
- myEditor.getScrollingModel().scrollToCaret(ScrollType.RELATIVE);
+ myCaret.moveToLogicalPosition(pos);
return;
}
}
TextRange range = insertNestedComments(chars, startOffset, endOffset, commentPrefix, commentSuffix, commenter);
- myEditor.getSelectionModel().setSelection(range.getStartOffset(), range.getEndOffset());
- //myEditor.getSelectionModel().removeSelection();
+ myCaret.setSelection(range.getStartOffset(), range.getEndOffset());
LogicalPosition pos = new LogicalPosition(caretPosition.line, caretPosition.column + commentPrefix.length());
- myEditor.getCaretModel().moveToLogicalPosition(pos);
- myEditor.getScrollingModel().scrollToCaret(ScrollType.RELATIVE);
+ myCaret.moveToLogicalPosition(pos);
}
private int doBoundCommentingAndGetShift(int offset,
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/generation/CommentByLineCommentHandler.java b/platform/lang-impl/src/com/intellij/codeInsight/generation/CommentByLineCommentHandler.java
index ba73ac14d715..d62f51bb2e02 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/generation/CommentByLineCommentHandler.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/generation/CommentByLineCommentHandler.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -16,12 +16,13 @@
package com.intellij.codeInsight.generation;
-import com.intellij.codeInsight.CodeInsightActionHandler;
import com.intellij.codeInsight.CodeInsightUtilBase;
import com.intellij.codeInsight.CommentUtil;
+import com.intellij.codeInsight.actions.MultiCaretCodeInsightActionHandler;
import com.intellij.featureStatistics.FeatureUsageTracker;
import com.intellij.ide.highlighter.custom.SyntaxTable;
import com.intellij.injected.editor.EditorWindow;
+import com.intellij.injected.editor.InjectedCaret;
import com.intellij.lang.Commenter;
import com.intellij.lang.Language;
import com.intellij.lang.LanguageCommenters;
@@ -38,7 +39,6 @@ import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.TextRange;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.psi.PsiDocumentManager;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.psi.codeStyle.CodeStyleManager;
@@ -53,181 +53,245 @@ import gnu.trove.THashMap;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import java.util.ArrayList;
+import java.util.List;
import java.util.Map;
-public class CommentByLineCommentHandler implements CodeInsightActionHandler {
-
+public class CommentByLineCommentHandler extends MultiCaretCodeInsightActionHandler {
private Project myProject;
- private PsiFile myFile;
- private Document myDocument;
- private Editor myEditor;
- private int myStartOffset;
- private int myEndOffset;
- private int myStartLine;
- private int myEndLine;
- private int[] myStartOffsets;
- private int[] myEndOffsets;
- private Commenter[] myCommenters;
- private Map<SelfManagingCommenter, CommenterDataHolder> myCommenterStateMap;
private CodeStyleManager myCodeStyleManager;
+ private final List<Block> myBlocks = new ArrayList<Block>();
+
@Override
- public void invoke(@NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file) {
+ // first pass - adjacent carets are grouped into blocks
+ public void invoke(@NotNull Project project, @NotNull Editor editor, @NotNull Caret caret, @NotNull PsiFile file) {
if (!CodeInsightUtilBase.prepareEditorForWrite(editor)) return;
myProject = project;
- myFile = file.getViewProvider().getPsi(file.getViewProvider().getBaseLanguage());
- myEditor = editor;
+ file = file.getViewProvider().getPsi(file.getViewProvider().getBaseLanguage());
- PsiElement context = InjectedLanguageManager.getInstance(myFile.getProject()).getInjectionHost(myFile);
+ PsiElement context = InjectedLanguageManager.getInstance(file.getProject()).getInjectionHost(file);
if (context != null && (context.textContains('\'') || context.textContains('\"'))) {
String s = context.getText();
if (StringUtil.startsWith(s, "\"") || StringUtil.startsWith(s, "\'")) {
- myFile = context.getContainingFile();
- myEditor = editor instanceof EditorWindow ? ((EditorWindow)editor).getDelegate() : editor;
+ file = context.getContainingFile();
+ editor = editor instanceof EditorWindow ? ((EditorWindow)editor).getDelegate() : editor;
+ caret = caret instanceof InjectedCaret ? ((InjectedCaret)caret).getDelegate() : caret;
}
}
- myDocument = myEditor.getDocument();
- if (!FileDocumentManager.getInstance().requestWriting(myDocument, project)) {
+ Document document = editor.getDocument();
+ if (!FileDocumentManager.getInstance().requestWriting(document, project)) {
return;
}
- PsiDocumentManager.getInstance(project).commitDocument(myDocument);
-
- FeatureUsageTracker.getInstance().triggerFeatureUsed("codeassists.comment.line");
-
- myCodeStyleManager = CodeStyleManager.getInstance(myProject);
-
- final SelectionModel selectionModel = myEditor.getSelectionModel();
-
- boolean hasSelection = selectionModel.hasSelection();
- myStartOffset = selectionModel.getSelectionStart();
- myEndOffset = selectionModel.getSelectionEnd();
+ boolean hasSelection = caret.hasSelection();
+ int startOffset = caret.getSelectionStart();
+ int endOffset = caret.getSelectionEnd();
- FoldRegion fold = myEditor.getFoldingModel().getCollapsedRegionAtOffset(myStartOffset);
- if (fold != null && fold.shouldNeverExpand() && fold.getStartOffset() == myStartOffset && fold.getEndOffset() == myEndOffset) {
- // Foldings that never expand are automatically selected, so the fact it is selected must not interfer with commenter's logic
+ FoldRegion fold = editor.getFoldingModel().getCollapsedRegionAtOffset(startOffset);
+ if (fold != null && fold.shouldNeverExpand() && fold.getStartOffset() == startOffset && fold.getEndOffset() == endOffset) {
+ // Foldings that never expand are automatically selected, so the fact it is selected must not interfere with commenter's logic
hasSelection = false;
}
- if (myDocument.getTextLength() == 0) return;
+ if (document.getTextLength() == 0) return;
while (true) {
- int lastLineEnd = myDocument.getLineEndOffset(myDocument.getLineNumber(myEndOffset));
- FoldRegion collapsedAt = myEditor.getFoldingModel().getCollapsedRegionAtOffset(lastLineEnd);
+ int lastLineEnd = document.getLineEndOffset(document.getLineNumber(endOffset));
+ FoldRegion collapsedAt = editor.getFoldingModel().getCollapsedRegionAtOffset(lastLineEnd);
if (collapsedAt != null) {
- final int endOffset = collapsedAt.getEndOffset();
- if (endOffset <= myEndOffset) {
+ final int regionEndOffset = collapsedAt.getEndOffset();
+ if (regionEndOffset <= endOffset) {
break;
}
- myEndOffset = endOffset;
+ endOffset = regionEndOffset;
}
else {
break;
}
}
- boolean wholeLinesSelected = !hasSelection ||
- myStartOffset == myDocument.getLineStartOffset(myDocument.getLineNumber(myStartOffset)) &&
- myEndOffset == myDocument.getLineEndOffset(myDocument.getLineNumber(myEndOffset - 1)) + 1;
-
- boolean startingNewLineComment = !hasSelection && isLineEmpty(myDocument.getLineNumber(myStartOffset)) && !Comparing
- .equal(IdeActions.ACTION_COMMENT_LINE, ActionManagerEx.getInstanceEx().getPrevPreformedActionId());
- doComment();
-
- if (startingNewLineComment) {
- final Commenter commenter = myCommenters[0];
- if (commenter != null) {
- String prefix;
- if (commenter instanceof SelfManagingCommenter) {
- prefix = ((SelfManagingCommenter)commenter).getCommentPrefix(
- myStartLine,
- myDocument,
- myCommenterStateMap.get((SelfManagingCommenter)commenter)
- );
- if (prefix == null) prefix = ""; // TODO
- }
- else {
- prefix = commenter.getLineCommentPrefix();
- if (prefix == null) prefix = commenter.getBlockCommentPrefix();
- }
+ int startLine = document.getLineNumber(startOffset);
+ int endLine = document.getLineNumber(endOffset);
- int lineStart = myDocument.getLineStartOffset(myStartLine);
- lineStart = CharArrayUtil.shiftForward(myDocument.getCharsSequence(), lineStart, " \t");
- lineStart += prefix.length();
- lineStart = CharArrayUtil.shiftForward(myDocument.getCharsSequence(), lineStart, " \t");
- if (lineStart > myDocument.getTextLength()) lineStart = myDocument.getTextLength();
- myEditor.getCaretModel().moveToOffset(lineStart);
- myEditor.getScrollingModel().scrollToCaret(ScrollType.RELATIVE);
- }
+ if (endLine > startLine && document.getLineStartOffset(endLine) == endOffset) {
+ endLine--;
+ }
+
+ Block lastBlock = myBlocks.isEmpty() ? null : myBlocks.get(myBlocks.size() - 1);
+ Block currentBlock;
+ if (lastBlock == null || lastBlock.editor != editor || lastBlock.psiFile != file || endLine < (lastBlock.startLine - 1)) {
+ currentBlock = new Block();
+ currentBlock.editor = editor;
+ currentBlock.psiFile = file;
+ currentBlock.endLine = endLine;
+ myBlocks.add(currentBlock);
}
else {
- if (!hasSelection) {
- // Don't tweak caret position if we're already located on the last document line.
- LogicalPosition position = myEditor.getCaretModel().getLogicalPosition();
- if (position.line < myDocument.getLineCount() - 1) {
- int verticalShift = 1 + myEditor.getSoftWrapModel().getSoftWrapsForLine(position.line).size()
- - position.softWrapLinesOnCurrentLogicalLine;
- myEditor.getCaretModel().moveCaretRelatively(0, verticalShift, false, false, true);
- }
- }
- else {
- if (wholeLinesSelected) {
- selectionModel.setSelection(myStartOffset, selectionModel.getSelectionEnd());
- }
- }
+ currentBlock = lastBlock;
}
- }
+ currentBlock.carets.add(caret);
+ currentBlock.startLine = startLine;
- private boolean isLineEmpty(final int line) {
- final CharSequence chars = myDocument.getCharsSequence();
- int start = myDocument.getLineStartOffset(line);
- int end = Math.min(myDocument.getLineEndOffset(line), myDocument.getTextLength() - 1);
- for (int i = start; i <= end; i++) {
- if (!Character.isWhitespace(chars.charAt(i))) return false;
+ boolean wholeLinesSelected = !hasSelection ||
+ startOffset == document.getLineStartOffset(document.getLineNumber(startOffset)) &&
+ endOffset == document.getLineEndOffset(document.getLineNumber(endOffset - 1)) + 1;
+ boolean startingNewLineComment = !hasSelection
+ && isLineEmpty(document, document.getLineNumber(startOffset))
+ && !Comparing.equal(IdeActions.ACTION_COMMENT_LINE,
+ ActionManagerEx.getInstanceEx().getPrevPreformedActionId());
+ currentBlock.caretUpdate = startingNewLineComment ? CaretUpdate.PUT_AT_COMMENT_START :
+ !hasSelection ? CaretUpdate.SHIFT_DOWN :
+ wholeLinesSelected ? CaretUpdate.RESTORE_SELECTION : null;
}
- return true;
- }
@Override
- public boolean startInWriteAction() {
- return true;
- }
+ public void postInvoke() {
+ FeatureUsageTracker.getInstance().triggerFeatureUsed("codeassists.comment.line");
+
+ myCodeStyleManager = CodeStyleManager.getInstance(myProject);
- private void doComment() {
- myStartLine = myDocument.getLineNumber(myStartOffset);
- myEndLine = myDocument.getLineNumber(myEndOffset);
+ // second pass - determining whether we need to comment or to uncomment
+ boolean allLinesCommented = true;
+ for (Block block : myBlocks) {
+ int startLine = block.startLine;
+ int endLine = block.endLine;
+ Document document = block.editor.getDocument();
+ PsiFile psiFile = block.psiFile;
+
+ block.startOffsets = new int[endLine - startLine + 1];
+ block.endOffsets = new int[endLine - startLine + 1];
+ block.commenters = new Commenter[endLine - startLine + 1];
+ block.commenterStateMap = new THashMap<SelfManagingCommenter, CommenterDataHolder>();
+ CharSequence chars = document.getCharsSequence();
+
+ boolean singleline = startLine == endLine;
+ int offset = document.getLineStartOffset(startLine);
+ offset = CharArrayUtil.shiftForward(chars, offset, " \t");
- if (myEndLine > myStartLine && myDocument.getLineStartOffset(myEndLine) == myEndOffset) {
- myEndLine--;
- }
+ int endOffset = CharArrayUtil.shiftBackward(chars, document.getLineEndOffset(endLine), " \t\n");
- myStartOffsets = new int[myEndLine - myStartLine + 1];
- myEndOffsets = new int[myEndLine - myStartLine + 1];
- myCommenters = new Commenter[myEndLine - myStartLine + 1];
- myCommenterStateMap = new THashMap<SelfManagingCommenter, CommenterDataHolder>();
- CharSequence chars = myDocument.getCharsSequence();
+ block.blockSuitableCommenter = getBlockSuitableCommenter(psiFile, offset, endOffset);
+ block.commentWithIndent =
+ !CodeStyleSettingsManager.getSettings(myProject).getCommonSettings(psiFile.getLanguage()).LINE_COMMENT_AT_FIRST_COLUMN;
+
+ for (int line = startLine; line <= endLine; line++) {
+ Commenter commenter = block.blockSuitableCommenter != null ? block.blockSuitableCommenter : findCommenter(block.editor, psiFile, line);
+ if (commenter == null || commenter.getLineCommentPrefix() == null
+ && (commenter.getBlockCommentPrefix() == null || commenter.getBlockCommentSuffix() == null)) {
+ block.skip = true;
+ break;
+ }
- boolean singleline = myStartLine == myEndLine;
- int offset = myDocument.getLineStartOffset(myStartLine);
- offset = CharArrayUtil.shiftForward(myDocument.getCharsSequence(), offset, " \t");
+ if (commenter instanceof SelfManagingCommenter && block.commenterStateMap.get(commenter) == null) {
+ final SelfManagingCommenter selfManagingCommenter = (SelfManagingCommenter)commenter;
+ CommenterDataHolder state = selfManagingCommenter.createLineCommentingState(startLine, endLine, document, psiFile);
+ if (state == null) state = SelfManagingCommenter.EMPTY_STATE;
+ block.commenterStateMap.put(selfManagingCommenter, state);
+ }
- int endOffset = CharArrayUtil.shiftBackward(myDocument.getCharsSequence(), myDocument.getLineEndOffset(myEndLine), " \t\n");
+ block.commenters[line - startLine] = commenter;
+ if (!isLineCommented(block, line, commenter) && (singleline || !isLineEmpty(document, line))) {
+ allLinesCommented = false;
+ if (commenter instanceof IndentedCommenter) {
+ final Boolean value = ((IndentedCommenter)commenter).forceIndentedLineComment();
+ if (value != null) {
+ block.commentWithIndent = value;
+ }
+ }
+ break;
+ }
+ }
+ }
+ boolean moveCarets = true;
+ for (Block block : myBlocks) {
+ if (block.carets.size() > 1 && block.startLine != block.endLine) {
+ moveCarets = false;
+ break;
+ }
+ }
+ // third pass - actual change
+ for (Block block : myBlocks) {
+ if (!block.skip) {
+ if (!allLinesCommented) {
+ if (!block.commentWithIndent) {
+ doDefaultCommenting(block);
+ }
+ else {
+ doIndentCommenting(block);
+ }
+ }
+ else {
+ for (int line = block.endLine; line >= block.startLine; line--) {
+ uncommentLine(block, line);
+ }
+ }
+ }
+
+ if (!moveCarets || block.caretUpdate == null) {
+ continue;
+ }
+ Document document = block.editor.getDocument();
+ for (Caret caret : block.carets) {
+ switch (block.caretUpdate) {
+ case PUT_AT_COMMENT_START:
+ final Commenter commenter = block.commenters[0];
+ if (commenter != null) {
+ String prefix;
+ if (commenter instanceof SelfManagingCommenter) {
+ prefix = ((SelfManagingCommenter)commenter).getCommentPrefix(block.startLine,
+ document,
+ block.commenterStateMap.get((SelfManagingCommenter)commenter));
+ if (prefix == null) prefix = ""; // TODO
+ }
+ else {
+ prefix = commenter.getLineCommentPrefix();
+ if (prefix == null) prefix = commenter.getBlockCommentPrefix();
+ }
+
+ int lineStart = document.getLineStartOffset(block.startLine);
+ lineStart = CharArrayUtil.shiftForward(document.getCharsSequence(), lineStart, " \t");
+ lineStart += prefix.length();
+ lineStart = CharArrayUtil.shiftForward(document.getCharsSequence(), lineStart, " \t");
+ if (lineStart > document.getTextLength()) lineStart = document.getTextLength();
+ caret.moveToOffset(lineStart);
+ }
+ break;
+ case SHIFT_DOWN:
+ // Don't tweak caret position if we're already located on the last document line.
+ LogicalPosition position = caret.getLogicalPosition();
+ if (position.line < document.getLineCount() - 1) {
+ int verticalShift = 1 + block.editor.getSoftWrapModel().getSoftWrapsForLine(position.line).size()
+ - position.softWrapLinesOnCurrentLogicalLine;
+ caret.moveCaretRelatively(0, verticalShift, false, true);
+ }
+ break;
+ case RESTORE_SELECTION:
+ caret.setSelection(document.getLineStartOffset(document.getLineNumber(caret.getSelectionStart())), caret.getSelectionEnd());
+ }
+ }
+ }
+ }
+
+ private static Commenter getBlockSuitableCommenter(final PsiFile file, int offset, int endOffset) {
final Language languageSuitableForCompleteFragment;
if (offset >= endOffset) { // we are on empty line
- PsiElement element = myFile.findElementAt(offset);
+ PsiElement element = file.findElementAt(offset);
if (element != null) languageSuitableForCompleteFragment = element.getParent().getLanguage();
else languageSuitableForCompleteFragment = null;
- } else {
- languageSuitableForCompleteFragment = PsiUtilBase.reallyEvaluateLanguageInRange(offset, endOffset, myFile);
}
+ else {
+ languageSuitableForCompleteFragment = PsiUtilBase.reallyEvaluateLanguageInRange(offset, endOffset, file);
+ }
+
Commenter blockSuitableCommenter =
- languageSuitableForCompleteFragment == null ? LanguageCommenters.INSTANCE.forLanguage(myFile.getLanguage()) : null;
- if (blockSuitableCommenter == null && myFile.getFileType() instanceof CustomSyntaxTableFileType) {
+ languageSuitableForCompleteFragment == null ? LanguageCommenters.INSTANCE.forLanguage(file.getLanguage()) : null;
+ if (blockSuitableCommenter == null && file.getFileType() instanceof CustomSyntaxTableFileType) {
blockSuitableCommenter = new Commenter() {
- final SyntaxTable mySyntaxTable = ((CustomSyntaxTableFileType)myFile.getFileType()).getSyntaxTable();
+ final SyntaxTable mySyntaxTable = ((CustomSyntaxTableFileType)file.getFileType()).getSyntaxTable();
@Override
@Nullable
@@ -259,96 +323,30 @@ public class CommentByLineCommentHandler implements CodeInsightActionHandler {
};
}
- boolean allLineCommented = true;
- boolean commentWithIndent =
- !CodeStyleSettingsManager.getSettings(myProject).getCommonSettings(myFile.getLanguage()).LINE_COMMENT_AT_FIRST_COLUMN;
-
- for (int line = myStartLine; line <= myEndLine; line++) {
- Commenter commenter = blockSuitableCommenter != null ? blockSuitableCommenter : findCommenter(line);
- if (commenter == null) return;
- if (commenter.getLineCommentPrefix() == null &&
- (commenter.getBlockCommentPrefix() == null || commenter.getBlockCommentSuffix() == null)) {
- return;
- }
-
- if (commenter instanceof SelfManagingCommenter &&
- myCommenterStateMap.get(commenter) == null) {
- final SelfManagingCommenter selfManagingCommenter = (SelfManagingCommenter)commenter;
- CommenterDataHolder state =
- selfManagingCommenter.createLineCommentingState(myStartLine, myEndLine, myDocument, myFile);
- if (state == null) state = SelfManagingCommenter.EMPTY_STATE;
- myCommenterStateMap.put(selfManagingCommenter, state);
- }
-
- myCommenters[line - myStartLine] = commenter;
- if (!isLineCommented(line, chars, commenter) && (singleline || !isLineEmpty(line))) {
- allLineCommented = false;
- if (commenter instanceof IndentedCommenter) {
- final Boolean value = ((IndentedCommenter)commenter).forceIndentedLineComment();
- if (value != null) {
- commentWithIndent = value;
- }
- }
- break;
- }
- }
+ return blockSuitableCommenter;
+ }
- if (!allLineCommented) {
- if (!commentWithIndent) {
- doDefaultCommenting(blockSuitableCommenter);
- }
- else {
- doIndentCommenting(blockSuitableCommenter);
- }
- }
- else {
- for (int line = myEndLine; line >= myStartLine; line--) {
- uncommentLine(line);
- //int offset1 = myStartOffsets[line - myStartLine];
- //int offset2 = myEndOffsets[line - myStartLine];
- //if (offset1 == offset2) continue;
- //Commenter commenter = myCommenters[line - myStartLine];
- //String prefix = commenter.getBlockCommentPrefix();
- //if (prefix == null || !myDocument.getText().substring(offset1, myDocument.getTextLength()).startsWith(prefix)) {
- // prefix = commenter.getLineCommentPrefix();
- //}
- //
- //String suffix = commenter.getBlockCommentSuffix();
- //if (suffix == null && prefix != null) suffix = "";
- //
- //if (prefix != null && suffix != null) {
- // final int suffixLen = suffix.length();
- // final int prefixLen = prefix.length();
- // if (offset2 >= 0) {
- // if (!CharArrayUtil.regionMatches(chars, offset1 + prefixLen, prefix)) {
- // myDocument.deleteString(offset2 - suffixLen, offset2);
- // }
- // }
- // if (offset1 >= 0) {
- // for (int i = offset2 - suffixLen - 1; i > offset1 + prefixLen; --i) {
- // if (CharArrayUtil.regionMatches(chars, i, suffix)) {
- // myDocument.deleteString(i, i + suffixLen);
- // }
- // else if (CharArrayUtil.regionMatches(chars, i, prefix)) {
- // myDocument.deleteString(i, i + prefixLen);
- // }
- // }
- // myDocument.deleteString(offset1, offset1 + prefixLen);
- // }
- //}
- }
+ private static boolean isLineEmpty(Document document, final int line) {
+ final CharSequence chars = document.getCharsSequence();
+ int start = document.getLineStartOffset(line);
+ int end = Math.min(document.getLineEndOffset(line), document.getTextLength() - 1);
+ for (int i = start; i <= end; i++) {
+ if (!Character.isWhitespace(chars.charAt(i))) return false;
}
+ return true;
}
- private boolean isLineCommented(final int line, final CharSequence chars, final Commenter commenter) {
+ private static boolean isLineCommented(Block block, final int line, final Commenter commenter) {
boolean commented;
int lineEndForBlockCommenting = -1;
- int lineStart = myDocument.getLineStartOffset(line);
+ Document document = block.editor.getDocument();
+ int lineStart = document.getLineStartOffset(line);
+ CharSequence chars = document.getCharsSequence();
lineStart = CharArrayUtil.shiftForward(chars, lineStart, " \t");
if (commenter instanceof SelfManagingCommenter) {
final SelfManagingCommenter selfManagingCommenter = (SelfManagingCommenter)commenter;
- commented = selfManagingCommenter.isLineCommented(line, lineStart, myDocument, myCommenterStateMap.get(selfManagingCommenter));
+ commented = selfManagingCommenter.isLineCommented(line, lineStart, document, block.commenterStateMap.get(selfManagingCommenter));
}
else {
String prefix = commenter.getLineCommentPrefix();
@@ -359,8 +357,8 @@ public class CommentByLineCommentHandler implements CodeInsightActionHandler {
else {
prefix = commenter.getBlockCommentPrefix();
String suffix = commenter.getBlockCommentSuffix();
- final int textLength = myDocument.getTextLength();
- lineEndForBlockCommenting = myDocument.getLineEndOffset(line);
+ final int textLength = document.getTextLength();
+ lineEndForBlockCommenting = document.getLineEndOffset(line);
if (lineEndForBlockCommenting == textLength) {
final int shifted = CharArrayUtil.shiftBackward(chars, textLength - 1, " \t");
if (shifted < textLength - 1) lineEndForBlockCommenting = shifted;
@@ -368,59 +366,61 @@ public class CommentByLineCommentHandler implements CodeInsightActionHandler {
else {
lineEndForBlockCommenting = CharArrayUtil.shiftBackward(chars, lineEndForBlockCommenting, " \t");
}
- commented = lineStart == lineEndForBlockCommenting && myStartLine != myEndLine ||
+ commented = lineStart == lineEndForBlockCommenting && block.startLine != block.endLine ||
CharArrayUtil.regionMatches(chars, lineStart, prefix)
&& CharArrayUtil.regionMatches(chars, lineEndForBlockCommenting - suffix.length(), suffix);
}
}
if (commented) {
- myStartOffsets[line - myStartLine] = lineStart;
- myEndOffsets[line - myStartLine] = lineEndForBlockCommenting;
+ block.startOffsets[line - block.startLine] = lineStart;
+ block.endOffsets[line - block.startLine] = lineEndForBlockCommenting;
}
return commented;
}
@Nullable
- private Commenter findCommenter(final int line) {
- final FileType fileType = myFile.getFileType();
+ private static Commenter findCommenter(Editor editor, PsiFile file, final int line) {
+ final FileType fileType = file.getFileType();
if (fileType instanceof AbstractFileType) {
return ((AbstractFileType)fileType).getCommenter();
}
- int lineStartOffset = myDocument.getLineStartOffset(line);
- int lineEndOffset = myDocument.getLineEndOffset(line) - 1;
- final CharSequence charSequence = myDocument.getCharsSequence();
+ Document document = editor.getDocument();
+ int lineStartOffset = document.getLineStartOffset(line);
+ int lineEndOffset = document.getLineEndOffset(line) - 1;
+ final CharSequence charSequence = document.getCharsSequence();
lineStartOffset = CharArrayUtil.shiftForward(charSequence, lineStartOffset, " \t");
lineEndOffset = CharArrayUtil.shiftBackward(charSequence, lineEndOffset < 0 ? 0 : lineEndOffset, " \t");
- final Language lineStartLanguage = PsiUtilCore.getLanguageAtOffset(myFile, lineStartOffset);
- final Language lineEndLanguage = PsiUtilCore.getLanguageAtOffset(myFile, lineEndOffset);
- return CommentByBlockCommentHandler.getCommenter(myFile, myEditor, lineStartLanguage, lineEndLanguage);
+ final Language lineStartLanguage = PsiUtilCore.getLanguageAtOffset(file, lineStartOffset);
+ final Language lineEndLanguage = PsiUtilCore.getLanguageAtOffset(file, lineEndOffset);
+ return CommentByBlockCommentHandler.getCommenter(file, editor, lineStartLanguage, lineEndLanguage);
}
- private Indent computeMinIndent(int line1, int line2, CharSequence chars, CodeStyleManager codeStyleManager, FileType fileType) {
- Indent minIndent = CommentUtil.getMinLineIndent(myProject, myDocument, line1, line2, fileType);
+ private Indent computeMinIndent(Editor editor, PsiFile psiFile, int line1, int line2, FileType fileType) {
+ Document document = editor.getDocument();
+ Indent minIndent = CommentUtil.getMinLineIndent(myProject, document, line1, line2, fileType);
if (line1 > 0) {
- int commentOffset = getCommentStart(line1 - 1);
+ int commentOffset = getCommentStart(editor, psiFile, line1 - 1);
if (commentOffset >= 0) {
- int lineStart = myDocument.getLineStartOffset(line1 - 1);
- String space = chars.subSequence(lineStart, commentOffset).toString();
- Indent indent = codeStyleManager.getIndent(space, fileType);
+ int lineStart = document.getLineStartOffset(line1 - 1);
+ String space = document.getCharsSequence().subSequence(lineStart, commentOffset).toString();
+ Indent indent = myCodeStyleManager.getIndent(space, fileType);
minIndent = minIndent != null ? indent.min(minIndent) : indent;
}
}
if (minIndent == null) {
- minIndent = codeStyleManager.zeroIndent();
+ minIndent = myCodeStyleManager.zeroIndent();
}
return minIndent;
}
- private int getCommentStart(int line) {
- int offset = myDocument.getLineStartOffset(line);
- CharSequence chars = myDocument.getCharsSequence();
+ private static int getCommentStart(Editor editor, PsiFile psiFile, int line) {
+ int offset = editor.getDocument().getLineStartOffset(line);
+ CharSequence chars = editor.getDocument().getCharsSequence();
offset = CharArrayUtil.shiftForward(chars, offset, " \t");
- final Commenter commenter = findCommenter(line);
+ final Commenter commenter = findCommenter(editor, psiFile, line);
if (commenter == null) return -1;
String prefix = commenter.getLineCommentPrefix();
if (prefix == null) prefix = commenter.getBlockCommentPrefix();
@@ -428,53 +428,55 @@ public class CommentByLineCommentHandler implements CodeInsightActionHandler {
return CharArrayUtil.regionMatches(chars, offset, prefix) ? offset : -1;
}
- public void doDefaultCommenting(final Commenter commenter) {
+ public void doDefaultCommenting(final Block block) {
+ final Document document = block.editor.getDocument();
DocumentUtil.executeInBulk(
- myDocument, myEndLine - myStartLine >= Registry.intValue("comment.by.line.bulk.lines.trigger"), new Runnable() {
+ document, block.endLine - block.startLine >= Registry.intValue("comment.by.line.bulk.lines.trigger"), new Runnable() {
@Override
public void run() {
- for (int line = myEndLine; line >= myStartLine; line--) {
- int offset = myDocument.getLineStartOffset(line);
- commentLine(line, offset, commenter);
+ for (int line = block.endLine; line >= block.startLine; line--) {
+ int offset = document.getLineStartOffset(line);
+ commentLine(block, line, offset);
}
}
});
}
- private void doIndentCommenting(final Commenter commenter) {
- final CharSequence chars = myDocument.getCharsSequence();
- final FileType fileType = myFile.getFileType();
- final Indent minIndent = computeMinIndent(myStartLine, myEndLine, chars, myCodeStyleManager, fileType);
+ private void doIndentCommenting(final Block block) {
+ final Document document = block.editor.getDocument();
+ final CharSequence chars = document.getCharsSequence();
+ final FileType fileType = block.psiFile.getFileType();
+ final Indent minIndent = computeMinIndent(block.editor, block.psiFile, block.startLine, block.endLine, fileType);
DocumentUtil.executeInBulk(
- myDocument, myEndLine - myStartLine > Registry.intValue("comment.by.line.bulk.lines.trigger"), new Runnable() {
- @Override
- public void run() {
- for (int line = myEndLine; line >= myStartLine; line--) {
- int lineStart = myDocument.getLineStartOffset(line);
- int offset = lineStart;
- final StringBuilder buffer = new StringBuilder();
- while (true) {
- String space = buffer.toString();
- Indent indent = myCodeStyleManager.getIndent(space, fileType);
- if (indent.isGreaterThan(minIndent) || indent.equals(minIndent)) break;
- char c = chars.charAt(offset);
- if (c != ' ' && c != '\t') {
- String newSpace = myCodeStyleManager.fillIndent(minIndent, fileType);
- myDocument.replaceString(lineStart, offset, newSpace);
- offset = lineStart + newSpace.length();
- break;
+ document, block.endLine - block.startLine > Registry.intValue("comment.by.line.bulk.lines.trigger"), new Runnable() {
+ @Override
+ public void run() {
+ for (int line = block.endLine; line >= block.startLine; line--) {
+ int lineStart = document.getLineStartOffset(line);
+ int offset = lineStart;
+ final StringBuilder buffer = new StringBuilder();
+ while (true) {
+ String space = buffer.toString();
+ Indent indent = myCodeStyleManager.getIndent(space, fileType);
+ if (indent.isGreaterThan(minIndent) || indent.equals(minIndent)) break;
+ char c = chars.charAt(offset);
+ if (c != ' ' && c != '\t') {
+ String newSpace = myCodeStyleManager.fillIndent(minIndent, fileType);
+ document.replaceString(lineStart, offset, newSpace);
+ offset = lineStart + newSpace.length();
+ break;
+ }
+ buffer.append(c);
+ offset++;
}
- buffer.append(c);
- offset++;
+ commentLine(block, line, offset);
}
- commentLine(line, offset, commenter);
}
- }
- });
+ });
}
- private void uncommentRange(int startOffset, int endOffset, @NotNull Commenter commenter) {
+ private static void uncommentRange(Document document, int startOffset, int endOffset, @NotNull Commenter commenter) {
final String commentedSuffix = commenter.getCommentedBlockCommentSuffix();
final String commentedPrefix = commenter.getCommentedBlockCommentPrefix();
final String prefix = commenter.getBlockCommentPrefix();
@@ -482,52 +484,53 @@ public class CommentByLineCommentHandler implements CodeInsightActionHandler {
if (prefix == null || suffix == null) {
return;
}
- if (endOffset >= suffix.length() && CharArrayUtil.regionMatches(myDocument.getCharsSequence(), endOffset - suffix.length(), suffix)) {
- myDocument.deleteString(endOffset - suffix.length(), endOffset);
- endOffset = myDocument.getTextLength();
+ if (endOffset >= suffix.length() && CharArrayUtil.regionMatches(document.getCharsSequence(), endOffset - suffix.length(), suffix)) {
+ document.deleteString(endOffset - suffix.length(), endOffset);
+ endOffset = document.getTextLength();
}
if (commentedPrefix != null && commentedSuffix != null) {
- CommentByBlockCommentHandler.commentNestedComments(myDocument, new TextRange(startOffset, endOffset), commenter);
+ CommentByBlockCommentHandler.commentNestedComments(document, new TextRange(startOffset, endOffset), commenter);
}
- myDocument.deleteString(startOffset, startOffset + prefix.length());
+ document.deleteString(startOffset, startOffset + prefix.length());
}
- private void uncommentLine(int line) {
- Commenter commenter = myCommenters[line - myStartLine];
- if (commenter == null) commenter = findCommenter(line);
+ private static void uncommentLine(Block block, int line) {
+ Document document = block.editor.getDocument();
+ Commenter commenter = block.commenters[line - block.startLine];
+ if (commenter == null) commenter = findCommenter(block.editor, block.psiFile, line);
if (commenter == null) return;
- final int startOffset = myStartOffsets[line - myStartLine];
+ final int startOffset = block.startOffsets[line - block.startLine];
if (commenter instanceof SelfManagingCommenter) {
final SelfManagingCommenter selfManagingCommenter = (SelfManagingCommenter)commenter;
- selfManagingCommenter.uncommentLine(line, startOffset, myDocument, myCommenterStateMap.get(selfManagingCommenter));
+ selfManagingCommenter.uncommentLine(line, startOffset, document, block.commenterStateMap.get(selfManagingCommenter));
return;
}
- final int endOffset = myEndOffsets[line - myStartLine];
+ final int endOffset = block.endOffsets[line - block.startLine];
if (startOffset == endOffset) {
return;
}
String prefix = commenter.getLineCommentPrefix();
if (prefix != null) {
- CharSequence chars = myDocument.getCharsSequence();
+ CharSequence chars = document.getCharsSequence();
if (commenter instanceof CommenterWithLineSuffix) {
CommenterWithLineSuffix commenterWithLineSuffix = (CommenterWithLineSuffix)commenter;
String suffix = commenterWithLineSuffix.getLineCommentSuffix();
- int theEnd = endOffset > 0 ? endOffset : myDocument.getLineEndOffset(line);
+ int theEnd = endOffset > 0 ? endOffset : document.getLineEndOffset(line);
while (theEnd > startOffset && Character.isWhitespace(chars.charAt(theEnd - 1))) {
theEnd--;
}
- String lineText = myDocument.getText(new TextRange(startOffset, theEnd));
+ String lineText = document.getText(new TextRange(startOffset, theEnd));
if (lineText.indexOf(suffix) != -1) {
int start = startOffset + lineText.indexOf(suffix);
- myDocument.deleteString(start, start + suffix.length());
+ document.deleteString(start, start + suffix.length());
}
}
@@ -544,10 +547,10 @@ public class CommentByLineCommentHandler implements CodeInsightActionHandler {
charsToDelete++;
}
}
- myDocument.deleteString(startOffset, startOffset + charsToDelete);
+ document.deleteString(startOffset, startOffset + charsToDelete);
return;
}
- String text = myDocument.getCharsSequence().subSequence(startOffset, endOffset).toString();
+ String text = document.getCharsSequence().subSequence(startOffset, endOffset).toString();
prefix = commenter.getBlockCommentPrefix();
final String suffix = commenter.getBlockCommentSuffix();
@@ -575,45 +578,47 @@ public class CommentByLineCommentHandler implements CodeInsightActionHandler {
assert prefixes.size() == suffixes.size();
for (int i = prefixes.size() - 1; i >= 0; i--) {
- uncommentRange(startOffset + prefixes.get(i), Math.min(startOffset + suffixes.get(i) + suffix.length(), endOffset), commenter);
+ uncommentRange(document, startOffset + prefixes.get(i), Math.min(startOffset + suffixes.get(i) + suffix.length(), endOffset), commenter);
}
}
- private void commentLine(int line, int offset, @Nullable Commenter commenter) {
- if (commenter == null) commenter = findCommenter(line);
+ private static void commentLine(Block block, int line, int offset) {
+ Commenter commenter = block.blockSuitableCommenter;
+ Document document = block.editor.getDocument();
+ if (commenter == null) commenter = findCommenter(block.editor, block.psiFile, line);
if (commenter == null) return;
if (commenter instanceof SelfManagingCommenter) {
final SelfManagingCommenter selfManagingCommenter = (SelfManagingCommenter)commenter;
- selfManagingCommenter.commentLine(line, offset, myDocument, myCommenterStateMap.get(selfManagingCommenter));
+ selfManagingCommenter.commentLine(line, offset, document, block.commenterStateMap.get(selfManagingCommenter));
return;
}
String prefix = commenter.getLineCommentPrefix();
if (prefix != null) {
if (commenter instanceof CommenterWithLineSuffix) {
- int endOffset = myDocument.getLineEndOffset(line);
- endOffset = CharArrayUtil.shiftBackward(myDocument.getCharsSequence(), endOffset, " \t");
- int shiftedStartOffset = CharArrayUtil.shiftForward(myDocument.getCharsSequence(), offset, " \t");
+ int endOffset = document.getLineEndOffset(line);
+ endOffset = CharArrayUtil.shiftBackward(document.getCharsSequence(), endOffset, " \t");
+ int shiftedStartOffset = CharArrayUtil.shiftForward(document.getCharsSequence(), offset, " \t");
String lineSuffix = ((CommenterWithLineSuffix)commenter).getLineCommentSuffix();
- if (!CharArrayUtil.regionMatches(myDocument.getCharsSequence(), shiftedStartOffset, prefix)) {
- if (!CharArrayUtil.regionMatches(myDocument.getCharsSequence(), endOffset - lineSuffix.length(), lineSuffix)) {
- myDocument.insertString(endOffset, lineSuffix);
+ if (!CharArrayUtil.regionMatches(document.getCharsSequence(), shiftedStartOffset, prefix)) {
+ if (!CharArrayUtil.regionMatches(document.getCharsSequence(), endOffset - lineSuffix.length(), lineSuffix)) {
+ document.insertString(endOffset, lineSuffix);
}
- myDocument.insertString(offset, prefix);
+ document.insertString(offset, prefix);
}
}
else {
- myDocument.insertString(offset, prefix);
+ document.insertString(offset, prefix);
}
}
else {
prefix = commenter.getBlockCommentPrefix();
String suffix = commenter.getBlockCommentSuffix();
if (prefix == null || suffix == null) return;
- int endOffset = myDocument.getLineEndOffset(line);
- if (endOffset == offset && myStartLine != myEndLine) return;
- final int textLength = myDocument.getTextLength();
- final CharSequence chars = myDocument.getCharsSequence();
+ int endOffset = document.getLineEndOffset(line);
+ if (endOffset == offset && block.startLine != block.endLine) return;
+ final int textLength = document.getTextLength();
+ final CharSequence chars = document.getCharsSequence();
offset = CharArrayUtil.shiftForward(chars, offset, " \t");
if (endOffset == textLength) {
final int shifted = CharArrayUtil.shiftBackward(chars, textLength - 1, " \t");
@@ -623,7 +628,7 @@ public class CommentByLineCommentHandler implements CodeInsightActionHandler {
endOffset = CharArrayUtil.shiftBackward(chars, endOffset, " \t");
}
if (endOffset < offset ||
- offset == textLength - 1 && line != myDocument.getLineCount() - 1) {
+ offset == textLength - 1 && line != document.getLineCount() - 1) {
return;
}
final String text = chars.subSequence(offset, endOffset).toString();
@@ -653,7 +658,7 @@ public class CommentByLineCommentHandler implements CodeInsightActionHandler {
}
}
if (!(commentedSuffix == null && !suffixes.isEmpty() && offset + suffixes.get(suffixes.size() - 1) + suffix.length() >= endOffset)) {
- myDocument.insertString(endOffset, suffix);
+ document.insertString(endOffset, suffix);
}
int nearestPrefix = prefixes.size() - 1;
int nearestSuffix = suffixes.size() - 1;
@@ -662,26 +667,46 @@ public class CommentByLineCommentHandler implements CodeInsightActionHandler {
final int position = prefixes.get(nearestPrefix);
nearestPrefix--;
if (commentedPrefix != null) {
- myDocument.replaceString(offset + position, offset + position + prefix.length(), commentedPrefix);
+ document.replaceString(offset + position, offset + position + prefix.length(), commentedPrefix);
}
else if (position != 0) {
- myDocument.insertString(offset + position, suffix);
+ document.insertString(offset + position, suffix);
}
}
else {
final int position = suffixes.get(nearestSuffix);
nearestSuffix--;
if (commentedSuffix != null) {
- myDocument.replaceString(offset + position, offset + position + suffix.length(), commentedSuffix);
+ document.replaceString(offset + position, offset + position + suffix.length(), commentedSuffix);
}
else if (offset + position + suffix.length() < endOffset) {
- myDocument.insertString(offset + position + suffix.length(), prefix);
+ document.insertString(offset + position + suffix.length(), prefix);
}
}
}
if (!(commentedPrefix == null && !prefixes.isEmpty() && prefixes.get(0) == 0)) {
- myDocument.insertString(offset, prefix);
+ document.insertString(offset, prefix);
}
}
}
+
+ private static class Block {
+ private Editor editor;
+ private PsiFile psiFile;
+ private List<Caret> carets = new ArrayList<Caret>();
+ private int startLine;
+ private int endLine;
+ private int[] startOffsets;
+ private int[] endOffsets;
+ private Commenter blockSuitableCommenter;
+ private Commenter[] commenters;
+ private Map<SelfManagingCommenter, CommenterDataHolder> commenterStateMap;
+ private boolean commentWithIndent;
+ private CaretUpdate caretUpdate;
+ private boolean skip;
+ }
+
+ private enum CaretUpdate {
+ PUT_AT_COMMENT_START, SHIFT_DOWN, RESTORE_SELECTION
+ }
}
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/generation/actions/CommentByBlockCommentAction.java b/platform/lang-impl/src/com/intellij/codeInsight/generation/actions/CommentByBlockCommentAction.java
index ce0d3b63e6e0..bd24557744f5 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/generation/actions/CommentByBlockCommentAction.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/generation/actions/CommentByBlockCommentAction.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -16,11 +16,12 @@
package com.intellij.codeInsight.generation.actions;
-import com.intellij.codeInsight.CodeInsightActionHandler;
-import com.intellij.codeInsight.actions.BaseCodeInsightAction;
+import com.intellij.codeInsight.actions.MultiCaretCodeInsightAction;
+import com.intellij.codeInsight.actions.MultiCaretCodeInsightActionHandler;
import com.intellij.codeInsight.generation.CommentByBlockCommentHandler;
import com.intellij.lang.Commenter;
import com.intellij.lang.LanguageCommenters;
+import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.fileTypes.impl.AbstractFileType;
@@ -29,19 +30,19 @@ import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiFile;
import org.jetbrains.annotations.NotNull;
-public class CommentByBlockCommentAction extends BaseCodeInsightAction implements DumbAware {
+public class CommentByBlockCommentAction extends MultiCaretCodeInsightAction implements DumbAware {
public CommentByBlockCommentAction() {
setEnabledInModalContext(true);
}
@NotNull
@Override
- protected CodeInsightActionHandler getHandler() {
+ protected MultiCaretCodeInsightActionHandler getHandler() {
return new CommentByBlockCommentHandler();
}
@Override
- protected boolean isValidForFile(@NotNull Project project, @NotNull Editor editor, @NotNull final PsiFile file) {
+ protected boolean isValidFor(@NotNull Project project, @NotNull Editor editor, @NotNull Caret caret, @NotNull final PsiFile file) {
final FileType fileType = file.getFileType();
if (fileType instanceof AbstractFileType) {
return ((AbstractFileType)fileType).getCommenter() != null;
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/generation/actions/CommentByLineCommentAction.java b/platform/lang-impl/src/com/intellij/codeInsight/generation/actions/CommentByLineCommentAction.java
index 990e64701ce1..3ee4ecc4d65e 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/generation/actions/CommentByLineCommentAction.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/generation/actions/CommentByLineCommentAction.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -16,9 +16,10 @@
package com.intellij.codeInsight.generation.actions;
-import com.intellij.codeInsight.CodeInsightActionHandler;
-import com.intellij.codeInsight.actions.BaseCodeInsightAction;
+import com.intellij.codeInsight.actions.MultiCaretCodeInsightAction;
+import com.intellij.codeInsight.actions.MultiCaretCodeInsightActionHandler;
import com.intellij.codeInsight.generation.CommentByLineCommentHandler;
+import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.fileTypes.impl.AbstractFileType;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.fileTypes.FileType;
@@ -28,19 +29,19 @@ import com.intellij.psi.PsiFile;
import com.intellij.lang.LanguageCommenters;
import org.jetbrains.annotations.NotNull;
-public class CommentByLineCommentAction extends BaseCodeInsightAction implements DumbAware {
+public class CommentByLineCommentAction extends MultiCaretCodeInsightAction implements DumbAware {
public CommentByLineCommentAction() {
setEnabledInModalContext(true);
}
@NotNull
@Override
- protected CodeInsightActionHandler getHandler() {
+ protected MultiCaretCodeInsightActionHandler getHandler() {
return new CommentByLineCommentHandler();
}
@Override
- protected boolean isValidForFile(@NotNull Project project, @NotNull Editor editor, @NotNull final PsiFile file) {
+ protected boolean isValidFor(@NotNull Project project, @NotNull Editor editor, @NotNull Caret caret, @NotNull final PsiFile file) {
final FileType fileType = file.getFileType();
if (fileType instanceof AbstractFileType) {
return ((AbstractFileType)fileType).getCommenter() != null;
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupImpl.java b/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupImpl.java
index 284a8ecb85bf..3a1f04b80414 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupImpl.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupImpl.java
@@ -623,10 +623,6 @@ public class LookupImpl extends LightweightHint implements LookupEx, Disposable,
}
public boolean performGuardedChange(Runnable change) {
- return performGuardedChange(change, null);
- }
-
- public boolean performGuardedChange(Runnable change, @Nullable final String debug) {
checkValid();
assert !myChangeGuard : "already in change";
@@ -634,7 +630,7 @@ public class LookupImpl extends LightweightHint implements LookupEx, Disposable,
myChangeGuard = true;
boolean result;
try {
- result = myOffsets.performGuardedChange(change, debug);
+ result = myOffsets.performGuardedChange(change);
}
finally {
myEditor.getDocument().stopGuardedBlockChecking();
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupOffsets.java b/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupOffsets.java
index fe53f1796dbd..9d918cc0e175 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupOffsets.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupOffsets.java
@@ -15,27 +15,26 @@
*/
package com.intellij.codeInsight.lookup.impl;
-import com.intellij.codeInsight.completion.RangeMarkerSpy;
import com.intellij.codeInsight.lookup.LookupElement;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.RangeMarker;
+import com.intellij.openapi.editor.event.DocumentAdapter;
import com.intellij.openapi.editor.event.DocumentEvent;
-import org.jetbrains.annotations.Nullable;
+import com.intellij.psi.impl.DebugUtil;
+import org.jetbrains.annotations.NotNull;
import java.util.Collection;
/**
* @author peter
*/
-public class LookupOffsets {
- private static final Logger LOG = Logger.getInstance("#com.intellij.codeInsight.lookup.impl.LookupOffsets");
+public class LookupOffsets extends DocumentAdapter {
private String myAdditionalPrefix = "";
private String myInitialPrefix;
private boolean myStableStart;
- private RangeMarker myLookupStartMarker;
+ private String myStartDisposeTrace;
+ @NotNull private RangeMarker myLookupStartMarker;
private int myRemovedPrefix;
private final RangeMarker myLookupOriginalStartMarker;
private final Editor myEditor;
@@ -43,23 +42,22 @@ public class LookupOffsets {
public LookupOffsets(Editor editor) {
myEditor = editor;
int caret = getPivotOffset();
- myLookupOriginalStartMarker = editor.getDocument().createRangeMarker(caret, caret);
- myLookupOriginalStartMarker.setGreedyToLeft(true);
- updateLookupStart(0);
+ myLookupOriginalStartMarker = createLeftGreedyMarker(caret);
+ myLookupStartMarker = createLeftGreedyMarker(caret);
+ myEditor.getDocument().addDocumentListener(this);
}
- private void updateLookupStart(int minPrefixLength) {
- int offset = getPivotOffset();
- int start = offset - minPrefixLength - myAdditionalPrefix.length() + myRemovedPrefix;
- start = Math.max(Math.min(start, myEditor.getDocument().getTextLength()), 0);
- if (myLookupStartMarker != null) {
- if (myLookupStartMarker.isValid() && myLookupStartMarker.getStartOffset() == start && myLookupStartMarker.getEndOffset() == start) {
- return;
- }
- myLookupStartMarker.dispose();
+ @Override
+ public void documentChanged(DocumentEvent e) {
+ if (myStartDisposeTrace == null && !myLookupStartMarker.isValid()) {
+ myStartDisposeTrace = e + "\n" + DebugUtil.currentStackTrace();
}
- myLookupStartMarker = myEditor.getDocument().createRangeMarker(start, start);
- myLookupStartMarker.setGreedyToLeft(true);
+ }
+
+ private RangeMarker createLeftGreedyMarker(int start) {
+ RangeMarker marker = myEditor.getDocument().createRangeMarker(start, start);
+ marker.setGreedyToLeft(true);
+ return marker;
}
private int getPivotOffset() {
@@ -101,15 +99,20 @@ public class LookupOffsets {
}
}
- updateLookupStart(minPrefixLength);
+ int start = getPivotOffset() - minPrefixLength - myAdditionalPrefix.length() + myRemovedPrefix;
+ start = Math.max(Math.min(start, myEditor.getDocument().getTextLength()), 0);
+ if (myLookupStartMarker.isValid() && myLookupStartMarker.getStartOffset() == start && myLookupStartMarker.getEndOffset() == start) {
+ return;
+ }
+
+ myLookupStartMarker.dispose();
+ myLookupStartMarker = createLeftGreedyMarker(start);
+ myStartDisposeTrace = null;
}
int getLookupStart(String disposeTrace) {
- if (myLookupStartMarker == null) {
- LOG.error("disposed: " + disposeTrace);
- }
if (!myLookupStartMarker.isValid()) {
- LOG.error("invalid marker: " + disposeTrace);
+ throw new AssertionError("Invalid lookup start: " + disposeTrace + ";\n" + myStartDisposeTrace);
}
return myLookupStartMarker.getStartOffset();
}
@@ -118,33 +121,14 @@ public class LookupOffsets {
return myLookupOriginalStartMarker.isValid() ? myLookupOriginalStartMarker.getStartOffset() : -1;
}
- boolean performGuardedChange(Runnable change, @Nullable final String debug) {
- if (myLookupStartMarker == null) {
- throw new AssertionError("null start before");
- }
+ boolean performGuardedChange(Runnable change) {
if (!myLookupStartMarker.isValid()) {
- throw new AssertionError("invalid start");
- }
- final Document document = myEditor.getDocument();
- RangeMarkerSpy spy = new RangeMarkerSpy(myLookupStartMarker) {
- @Override
- protected void invalidated(DocumentEvent e) {
- LOG.info("Lookup start marker invalidated, say thanks to the " + e +
- ", doc=" + document +
- ", debug=" + debug);
- }
- };
- document.addDocumentListener(spy);
- try {
- change.run();
- }
- finally {
- document.removeDocumentListener(spy);
+ throw new AssertionError("Invalid start: " + myStartDisposeTrace);
}
+ change.run();
return myLookupStartMarker.isValid();
}
-
void setInitialPrefix(String presentPrefix, boolean explicitlyInvoked) {
if (myAdditionalPrefix.length() == 0 && myInitialPrefix == null && !explicitlyInvoked) {
myInitialPrefix = presentPrefix;
@@ -165,11 +149,9 @@ public class LookupOffsets {
}
}
- public void disposeMarkers() {
- if (myLookupStartMarker != null) {
- myLookupStartMarker.dispose();
- myLookupStartMarker = null;
- }
+ void disposeMarkers() {
+ myEditor.getDocument().removeDocumentListener(this);
+ myLookupStartMarker.dispose();
myLookupOriginalStartMarker.dispose();
}
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/template/LiveTemplateBuilder.java b/platform/lang-impl/src/com/intellij/codeInsight/template/LiveTemplateBuilder.java
index 512bfa1b27fb..9678ef213f45 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/template/LiveTemplateBuilder.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/template/LiveTemplateBuilder.java
@@ -247,8 +247,13 @@ public class LiveTemplateBuilder {
else {
newVarName = varName;
}
- Variable var =
- new Variable(newVarName, template.getExpressionStringAt(i), template.getDefaultValueStringAt(i), template.isAlwaysStopAt(i));
+ Variable var = new Variable(newVarName, template.getExpressionStringAt(i), template.getDefaultValueStringAt(i), template.isAlwaysStopAt(i));
+ if (mySegmentLimit >= 0 && myVariables.size() >= mySegmentLimit) {
+ if (mySegmentLimit > 0) {
+ LOGGER.warn("Template with more than " + mySegmentLimit + " segments had been build. Text: " + myText);
+ }
+ break;
+ }
myVariables.add(var);
myVarNames.add(newVarName);
}
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/template/postfix/settings/PostfixDescriptionPanel.java b/platform/lang-impl/src/com/intellij/codeInsight/template/postfix/settings/PostfixDescriptionPanel.java
index 6032cbe63e66..c5c10ceefcb1 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/template/postfix/settings/PostfixDescriptionPanel.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/template/postfix/settings/PostfixDescriptionPanel.java
@@ -42,6 +42,7 @@ class PostfixDescriptionPanel implements Disposable {
private JEditorPane myDescriptionBrowser;
public PostfixDescriptionPanel() {
+ myDescriptionBrowser.setMargin(new Insets(5, 5, 5, 5));
initializeExamplePanel(myAfterPanel);
initializeExamplePanel(myBeforePanel);
}
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/template/postfix/settings/PostfixTemplatesConfigurable.form b/platform/lang-impl/src/com/intellij/codeInsight/template/postfix/settings/PostfixTemplatesConfigurable.form
index 9af302be1d97..2417e0b689d2 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/template/postfix/settings/PostfixTemplatesConfigurable.form
+++ b/platform/lang-impl/src/com/intellij/codeInsight/template/postfix/settings/PostfixTemplatesConfigurable.form
@@ -13,7 +13,7 @@
<grid row="0" column="0" row-span="1" col-span="2" vsize-policy="1" hsize-policy="3" anchor="1" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
- <text value="&amp;Enable postfix templates"/>
+ <text value="&amp;Enable postfix completion"/>
</properties>
</component>
<component id="9f784" class="com.intellij.ui.components.JBCheckBox" binding="myCompletionEnabledCheckbox">
diff --git a/platform/lang-impl/src/com/intellij/codeInspection/InspectionApplication.java b/platform/lang-impl/src/com/intellij/codeInspection/InspectionApplication.java
index 391232cd2857..86cbe6f1d6b7 100644
--- a/platform/lang-impl/src/com/intellij/codeInspection/InspectionApplication.java
+++ b/platform/lang-impl/src/com/intellij/codeInspection/InspectionApplication.java
@@ -105,7 +105,7 @@ public class InspectionApplication {
LOG.error(e);
}
finally {
- if (myErrorCodeRequired) application.exit(true);
+ if (myErrorCodeRequired) application.exit(true, true);
}
}
});
diff --git a/platform/lang-impl/src/com/intellij/codeInspection/ex/Descriptor.java b/platform/lang-impl/src/com/intellij/codeInspection/ex/Descriptor.java
index c3d4e158c070..b27befd36b00 100644
--- a/platform/lang-impl/src/com/intellij/codeInspection/ex/Descriptor.java
+++ b/platform/lang-impl/src/com/intellij/codeInspection/ex/Descriptor.java
@@ -40,6 +40,7 @@ public class Descriptor {
private final InspectionToolWrapper myToolWrapper;
private final HighlightDisplayLevel myLevel;
private boolean myEnabled = false;
+ @Nullable
private final NamedScope myScope;
private static final Logger LOG = Logger.getInstance("#com.intellij.codeInspection.ex.Descriptor");
private final ScopeToolState myState;
@@ -99,6 +100,13 @@ public class Descriptor {
return myConfig;
}
+ public void loadConfig() {
+ if (myConfig == null) {
+ InspectionToolWrapper toolWrapper = getToolWrapper();
+ myConfig = createConfigElement(toolWrapper);
+ }
+ }
+
@NotNull
public InspectionToolWrapper getToolWrapper() {
return myToolWrapper;
@@ -106,11 +114,7 @@ public class Descriptor {
@Nullable
public String loadDescription() {
- if (myConfig == null) {
- InspectionToolWrapper toolWrapper = getToolWrapper();
- myConfig = createConfigElement(toolWrapper);
- }
-
+ loadConfig();
return myToolWrapper.loadDescription();
}
@@ -133,6 +137,7 @@ public class Descriptor {
return myGroup;
}
+ @Nullable
public NamedScope getScope() {
return myScope;
}
diff --git a/platform/lang-impl/src/com/intellij/codeInspection/ex/SeverityEditorDialog.java b/platform/lang-impl/src/com/intellij/codeInspection/ex/SeverityEditorDialog.java
index b5333e8bd63e..527235b5166c 100644
--- a/platform/lang-impl/src/com/intellij/codeInspection/ex/SeverityEditorDialog.java
+++ b/platform/lang-impl/src/com/intellij/codeInspection/ex/SeverityEditorDialog.java
@@ -301,6 +301,9 @@ public class SeverityEditorDialog extends DialogWrapper {
}
private void reset(SeverityBasedTextAttributes info) {
+ if (info == null) {
+ return;
+ }
final MyTextAttributesDescription description =
new MyTextAttributesDescription(info.getType().toString(), null, info.getAttributes(), info.getType().getAttributesKey());
@NonNls Element textAttributes = new Element("temp");
diff --git a/platform/lang-impl/src/com/intellij/codeInspection/ex/VisibleTreeState.java b/platform/lang-impl/src/com/intellij/codeInspection/ex/VisibleTreeState.java
index 8f81c0589c92..d81fbf692812 100644
--- a/platform/lang-impl/src/com/intellij/codeInspection/ex/VisibleTreeState.java
+++ b/platform/lang-impl/src/com/intellij/codeInspection/ex/VisibleTreeState.java
@@ -16,7 +16,7 @@
package com.intellij.codeInspection.ex;
-import com.intellij.profile.codeInspection.ui.InspectionConfigTreeNode;
+import com.intellij.profile.codeInspection.ui.inspectionsTree.InspectionConfigTreeNode;
import com.intellij.psi.search.scope.packageSet.NamedScope;
import com.intellij.ui.treeStructure.Tree;
import com.intellij.util.ui.tree.TreeUtil;
@@ -106,7 +106,7 @@ public class VisibleTreeState{
}
private static State getState(InspectionConfigTreeNode node) {
- Descriptor descriptor = node.getDescriptor();
+ Descriptor descriptor = node.getDefaultDescriptor();
final State expandedNode;
if (descriptor != null) {
expandedNode = new State(descriptor);
diff --git a/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionResultsViewComparator.java b/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionResultsViewComparator.java
index cab3fbeeedda..b36ab755a9ac 100644
--- a/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionResultsViewComparator.java
+++ b/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionResultsViewComparator.java
@@ -36,7 +36,7 @@ import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.profile.codeInspection.ui.InspectionsConfigTreeComparator;
+import com.intellij.profile.codeInspection.ui.inspectionsTree.InspectionsConfigTreeComparator;
import com.intellij.psi.PsiDocumentManager;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiNamedElement;
diff --git a/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionTree.java b/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionTree.java
index d50bddc322e8..d1c3c3a2d7f1 100644
--- a/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionTree.java
+++ b/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionTree.java
@@ -31,7 +31,7 @@ import com.intellij.codeInspection.reference.RefEntity;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vcs.FileStatus;
-import com.intellij.profile.codeInspection.ui.InspectionsConfigTreeComparator;
+import com.intellij.profile.codeInspection.ui.inspectionsTree.InspectionsConfigTreeComparator;
import com.intellij.ui.ColoredTreeCellRenderer;
import com.intellij.ui.JBColor;
import com.intellij.ui.SimpleTextAttributes;
diff --git a/platform/lang-impl/src/com/intellij/execution/console/LanguageConsoleViewImpl.java b/platform/lang-impl/src/com/intellij/execution/console/LanguageConsoleViewImpl.java
index bb738098f3b8..8a4b1f85125a 100644
--- a/platform/lang-impl/src/com/intellij/execution/console/LanguageConsoleViewImpl.java
+++ b/platform/lang-impl/src/com/intellij/execution/console/LanguageConsoleViewImpl.java
@@ -30,7 +30,7 @@ import javax.swing.*;
*/
public class LanguageConsoleViewImpl extends ConsoleViewImpl implements LanguageConsoleView {
@NotNull
- protected LanguageConsoleImpl myConsole;
+ protected final LanguageConsoleImpl myConsole;
public LanguageConsoleViewImpl(Project project, String title, Language language) {
this(new LanguageConsoleImpl(project, title, language));
diff --git a/platform/lang-impl/src/com/intellij/find/EditorSearchComponent.java b/platform/lang-impl/src/com/intellij/find/EditorSearchComponent.java
index 8c5864c6569b..8a36638d993c 100644
--- a/platform/lang-impl/src/com/intellij/find/EditorSearchComponent.java
+++ b/platform/lang-impl/src/com/intellij/find/EditorSearchComponent.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -48,6 +48,7 @@ import com.intellij.util.ArrayUtil;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NonNls;
+import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
@@ -68,11 +69,12 @@ public class EditorSearchComponent extends EditorHeaderComponent implements Data
private final Project myProject;
private ActionToolbar myActionsToolbar;
-
+ @NotNull
public Editor getEditor() {
return myEditor;
}
+ @NotNull
private final Editor myEditor;
public JTextComponent getSearchField() {
@@ -173,7 +175,7 @@ public class EditorSearchComponent extends EditorHeaderComponent implements Data
return findModel;
}
- public EditorSearchComponent(Editor editor, Project project) {
+ public EditorSearchComponent(@NotNull Editor editor, Project project) {
this(editor, project, createDefaultFindModel(project, editor));
}
@@ -225,7 +227,7 @@ public class EditorSearchComponent extends EditorHeaderComponent implements Data
}
@Override
- public void cursorMoved(boolean toChangeSelection) {
+ public void cursorMoved() {
updateExcludeStatus();
}
@@ -233,10 +235,7 @@ public class EditorSearchComponent extends EditorHeaderComponent implements Data
public void updateFinished() {
}
- @Override
- public void editorChanged(SearchResults sr, Editor oldEditor) { }
-
- public EditorSearchComponent(final Editor editor, final Project project, FindModel findModel) {
+ public EditorSearchComponent(@NotNull final Editor editor, final Project project, FindModel findModel) {
myFindModel = findModel;
myProject = project;
@@ -367,6 +366,9 @@ public class EditorSearchComponent extends EditorHeaderComponent implements Data
actionGroup.add(new ShowHistoryAction(mySearchFieldGetter, this));
actionGroup.add(new PrevOccurrenceAction(this, mySearchFieldGetter));
actionGroup.add(new NextOccurrenceAction(this, mySearchFieldGetter));
+ actionGroup.add(new AddOccurrenceAction(this));
+ actionGroup.add(new RemoveOccurrenceAction(this));
+ actionGroup.add(new SelectAllAction(this));
actionGroup.add(new FindAllAction(this));
actionGroup.add(new ToggleMultiline(this));
actionGroup.add(new ToggleMatchCase(this));
@@ -803,10 +805,6 @@ public class EditorSearchComponent extends EditorHeaderComponent implements Data
}
public void close() {
- if (myEditor.getSelectionModel().hasSelection()) {
- myEditor.getCaretModel().moveToOffset(myEditor.getSelectionModel().getSelectionStart());
- myEditor.getSelectionModel().removeSelection();
- }
IdeFocusManager.getInstance(myProject).requestFocus(myEditor.getContentComponent(), false);
myLivePreviewController.dispose();
@@ -937,6 +935,18 @@ public class EditorSearchComponent extends EditorHeaderComponent implements Data
return insets;
}
+ public void selectAllOccurrences() {
+ FindUtil.selectSearchResultsInEditor(myEditor, mySearchResults.getOccurrences().iterator(), -1);
+ }
+
+ public void removeOccurrence() {
+ mySearchResults.prevOccurrence(true);
+ }
+
+ public void addNextOccurrence() {
+ mySearchResults.nextOccurrence(true);
+ }
+
private static class MyUndoProvider extends TextComponentUndoProvider {
private boolean myEnabled = true;
public MyUndoProvider(JTextComponent textComponent) {
diff --git a/platform/lang-impl/src/com/intellij/find/FindUtil.java b/platform/lang-impl/src/com/intellij/find/FindUtil.java
index 0728ea07e2b3..edc906481398 100644
--- a/platform/lang-impl/src/com/intellij/find/FindUtil.java
+++ b/platform/lang-impl/src/com/intellij/find/FindUtil.java
@@ -31,6 +31,7 @@ import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.command.CommandProcessor;
import com.intellij.openapi.editor.*;
import com.intellij.openapi.editor.actionSystem.EditorActionManager;
+import com.intellij.openapi.editor.actions.EditorActionUtil;
import com.intellij.openapi.editor.actions.IncrementalFindAction;
import com.intellij.openapi.editor.colors.EditorColors;
import com.intellij.openapi.editor.colors.EditorColorsManager;
@@ -70,10 +71,7 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
+import java.util.*;
public class FindUtil {
private static final Key<Direction> KEY = Key.create("FindUtil.KEY");
@@ -385,7 +383,7 @@ public class FindUtil {
}
else {
editor.putUserData(KEY, null);
- offset = editor.getCaretModel().getOffset();
+ offset = model.isGlobal() && model.isForward() ? editor.getSelectionModel().getSelectionEnd() : editor.getCaretModel().getOffset();
if (!model.isForward() && offset > 0) {
offset--;
}
@@ -714,7 +712,18 @@ public class FindUtil {
final ScrollType scrollType = forward ? ScrollType.CENTER_DOWN : ScrollType.CENTER_UP;
if (model.isGlobal()) {
- caretModel.moveToOffset(result.getEndOffset());
+ int targetCaretPosition = result.getEndOffset();
+ if (selection.getSelectionEnd() - selection.getSelectionStart() == result.getLength()) {
+ // keeping caret's position relative to selection
+ // use case: FindNext is used after SelectNextOccurrence action
+ targetCaretPosition = caretModel.getOffset() - selection.getSelectionStart() + result.getStartOffset();
+ }
+ if (caretModel.getCaretAt(editor.offsetToVisualPosition(targetCaretPosition)) != null) {
+ // if there's a different caret at target position, don't move current caret/selection
+ // use case: FindNext is used after SelectNextOccurrence action
+ return result;
+ }
+ caretModel.moveToOffset(targetCaretPosition);
selection.removeSelection();
scrollingModel.scrollToCaret(scrollType);
scrollingModel.runActionOnScrollingFinished(
@@ -829,17 +838,12 @@ public class FindUtil {
editor.getCaretModel().addCaretListener(listener);
}
JComponent component = HintUtil.createInformationLabel(JDOMUtil.escapeText(message, false, false));
-
- if (ApplicationManager.getApplication().isUnitTestMode()) {
- LivePreview.processNotFound();
- } else {
- final LightweightHint hint = new LightweightHint(component);
- HintManagerImpl.getInstanceImpl().showEditorHint(hint, editor, position,
- HintManager.HIDE_BY_ANY_KEY |
- HintManager.HIDE_BY_TEXT_CHANGE |
- HintManager.HIDE_BY_SCROLLING,
- 0, false);
- }
+ final LightweightHint hint = new LightweightHint(component);
+ HintManagerImpl.getInstanceImpl().showEditorHint(hint, editor, position,
+ HintManager.HIDE_BY_ANY_KEY |
+ HintManager.HIDE_BY_TEXT_CHANGE |
+ HintManager.HIDE_BY_SCROLLING,
+ 0, false);
}
public static TextRange doReplace(final Project project,
@@ -954,4 +958,68 @@ public class FindUtil {
});
return view;
}
+
+ /**
+ * Creates a selection in editor per each search result. Existing carets and selections in editor are discarded.
+ *
+ * @param caretShiftFromSelectionStart if non-negative, defines caret position relative to selection start, for each created selection.
+ * if negative, carets will be positioned at selection ends
+ */
+ public static void selectSearchResultsInEditor(@NotNull Editor editor,
+ @NotNull Iterator<FindResult> resultIterator,
+ int caretShiftFromSelectionStart) {
+ if (!editor.getCaretModel().supportsMultipleCarets()) {
+ return;
+ }
+ ArrayList<CaretState> caretStates = new ArrayList<CaretState>();
+ while (resultIterator.hasNext()) {
+ FindResult findResult = resultIterator.next();
+ int caretOffset = getCaretPosition(findResult, caretShiftFromSelectionStart);
+ int selectionStartOffset = findResult.getStartOffset();
+ int selectionEndOffset = findResult.getEndOffset();
+ EditorActionUtil.makePositionVisible(editor, caretOffset);
+ EditorActionUtil.makePositionVisible(editor, selectionStartOffset);
+ EditorActionUtil.makePositionVisible(editor, selectionEndOffset);
+ caretStates.add(new CaretState(editor.offsetToLogicalPosition(caretOffset),
+ editor.offsetToLogicalPosition(selectionStartOffset),
+ editor.offsetToLogicalPosition(selectionEndOffset)));
+ }
+ if (caretStates.isEmpty()) {
+ return;
+ }
+ editor.getCaretModel().setCaretsAndSelections(caretStates);
+ }
+
+ /**
+ * Attempts to add a new caret to editor, with selection corresponding to given search result.
+ *
+ * @param caretShiftFromSelectionStart if non-negative, defines caret position relative to selection start, for each created selection.
+ * if negative, caret will be positioned at selection end
+ * @return <code>true</code> if caret was added successfully, <code>false</code> if it cannot be done, e.g. because a caret already
+ * exists at target position
+ */
+ public static boolean selectSearchResultInEditor(@NotNull Editor editor, @NotNull FindResult result, int caretShiftFromSelectionStart) {
+ if (!editor.getCaretModel().supportsMultipleCarets()) {
+ return false;
+ }
+ int caretOffset = getCaretPosition(result, caretShiftFromSelectionStart);
+ EditorActionUtil.makePositionVisible(editor, caretOffset);
+ Caret newCaret = editor.getCaretModel().addCaret(editor.offsetToVisualPosition(caretOffset));
+ if (newCaret == null) {
+ return false;
+ }
+ else {
+ int selectionStartOffset = result.getStartOffset();
+ int selectionEndOffset = result.getEndOffset();
+ EditorActionUtil.makePositionVisible(editor, selectionStartOffset);
+ EditorActionUtil.makePositionVisible(editor, selectionEndOffset);
+ newCaret.setSelection(selectionStartOffset, selectionEndOffset);
+ return true;
+ }
+ }
+
+ private static int getCaretPosition(FindResult findResult, int caretShiftFromSelectionStart) {
+ return caretShiftFromSelectionStart < 0
+ ? findResult.getEndOffset() : Math.min(findResult.getStartOffset() + caretShiftFromSelectionStart, findResult.getEndOffset());
+ }
}
diff --git a/platform/lang-impl/src/com/intellij/find/editorHeaderActions/AddOccurrenceAction.java b/platform/lang-impl/src/com/intellij/find/editorHeaderActions/AddOccurrenceAction.java
new file mode 100644
index 000000000000..9064113d9c9b
--- /dev/null
+++ b/platform/lang-impl/src/com/intellij/find/editorHeaderActions/AddOccurrenceAction.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2000-2014 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.find.editorHeaderActions;
+
+import com.intellij.find.EditorSearchComponent;
+import com.intellij.icons.AllIcons;
+import com.intellij.openapi.actionSystem.*;
+import com.intellij.openapi.project.DumbAware;
+
+import java.util.Arrays;
+
+public class AddOccurrenceAction extends EditorHeaderAction implements DumbAware {
+ public AddOccurrenceAction(EditorSearchComponent editorSearchComponent) {
+ super(editorSearchComponent);
+
+ copyFrom(ActionManager.getInstance().getAction(IdeActions.ACTION_SELECT_NEXT_OCCURENCE));
+ getTemplatePresentation().setIcon(AllIcons.General.Add);
+
+ registerShortcutsForComponent(Arrays.asList(getShortcutSet().getShortcuts()), editorSearchComponent.getSearchField());
+ }
+
+ @Override
+ public void actionPerformed(AnActionEvent e) {
+ getEditorSearchComponent().addNextOccurrence();
+ }
+
+ @Override
+ public void update(AnActionEvent e) {
+ boolean isFind = !getEditorSearchComponent().getFindModel().isReplaceState();
+ boolean hasMatches = getEditorSearchComponent().hasMatches();
+ e.getPresentation().setVisible(isFind);
+ e.getPresentation().setEnabled(isFind && hasMatches);
+ }}
diff --git a/platform/lang-impl/src/com/intellij/find/editorHeaderActions/EditorHeaderAction.java b/platform/lang-impl/src/com/intellij/find/editorHeaderActions/EditorHeaderAction.java
index 6cdba4b1e6eb..15348730a41d 100644
--- a/platform/lang-impl/src/com/intellij/find/editorHeaderActions/EditorHeaderAction.java
+++ b/platform/lang-impl/src/com/intellij/find/editorHeaderActions/EditorHeaderAction.java
@@ -1,21 +1,34 @@
+/*
+ * Copyright 2000-2014 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.find.editorHeaderActions;
import com.intellij.find.EditorSearchComponent;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.CustomShortcutSet;
-import com.intellij.openapi.actionSystem.KeyboardShortcut;
import com.intellij.openapi.actionSystem.Shortcut;
import javax.swing.*;
-import java.util.ArrayList;
import java.util.List;
public abstract class EditorHeaderAction extends AnAction {
private final EditorSearchComponent myEditorSearchComponent;
- protected static void registerShortcutsForComponent(List<Shortcut> shortcuts, JComponent component, AnAction a) {
- a.registerCustomShortcutSet(
+ protected void registerShortcutsForComponent(List<Shortcut> shortcuts, JComponent component) {
+ registerCustomShortcutSet(
new CustomShortcutSet(shortcuts.toArray(new Shortcut[shortcuts.size()])),
component);
}
diff --git a/platform/lang-impl/src/com/intellij/find/editorHeaderActions/NextOccurrenceAction.java b/platform/lang-impl/src/com/intellij/find/editorHeaderActions/NextOccurrenceAction.java
index 1eb933cf2d03..0e6e67168521 100644
--- a/platform/lang-impl/src/com/intellij/find/editorHeaderActions/NextOccurrenceAction.java
+++ b/platform/lang-impl/src/com/intellij/find/editorHeaderActions/NextOccurrenceAction.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2000-2014 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.find.editorHeaderActions;
import com.intellij.find.EditorSearchComponent;
@@ -35,7 +50,7 @@ public class NextOccurrenceAction extends EditorHeaderAction implements DumbAwar
shortcuts.add(new KeyboardShortcut(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), null));
}
- registerShortcutsForComponent(shortcuts, editorTextField.get(), this);
+ registerShortcutsForComponent(shortcuts, editorTextField.get());
}
@Override
diff --git a/platform/lang-impl/src/com/intellij/find/editorHeaderActions/PrevOccurrenceAction.java b/platform/lang-impl/src/com/intellij/find/editorHeaderActions/PrevOccurrenceAction.java
index f5a2d3911b43..586f90a835d1 100644
--- a/platform/lang-impl/src/com/intellij/find/editorHeaderActions/PrevOccurrenceAction.java
+++ b/platform/lang-impl/src/com/intellij/find/editorHeaderActions/PrevOccurrenceAction.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2000-2014 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.find.editorHeaderActions;
import com.intellij.find.EditorSearchComponent;
@@ -34,7 +49,7 @@ public class PrevOccurrenceAction extends EditorHeaderAction implements DumbAwar
shortcuts.add(new KeyboardShortcut(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, InputEvent.SHIFT_DOWN_MASK), null));
}
- registerShortcutsForComponent(shortcuts, editorTextField.get(), this);
+ registerShortcutsForComponent(shortcuts, editorTextField.get());
}
@Override
diff --git a/platform/lang-impl/src/com/intellij/find/editorHeaderActions/RemoveOccurrenceAction.java b/platform/lang-impl/src/com/intellij/find/editorHeaderActions/RemoveOccurrenceAction.java
new file mode 100644
index 000000000000..b739f942991d
--- /dev/null
+++ b/platform/lang-impl/src/com/intellij/find/editorHeaderActions/RemoveOccurrenceAction.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2000-2014 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.find.editorHeaderActions;
+
+import com.intellij.find.EditorSearchComponent;
+import com.intellij.icons.AllIcons;
+import com.intellij.openapi.actionSystem.ActionManager;
+import com.intellij.openapi.actionSystem.AnActionEvent;
+import com.intellij.openapi.actionSystem.IdeActions;
+import com.intellij.openapi.project.DumbAware;
+
+import java.util.Arrays;
+
+public class RemoveOccurrenceAction extends EditorHeaderAction implements DumbAware {
+ public RemoveOccurrenceAction(EditorSearchComponent editorSearchComponent) {
+ super(editorSearchComponent);
+
+ copyFrom(ActionManager.getInstance().getAction(IdeActions.ACTION_UNSELECT_PREVIOUS_OCCURENCE));
+ getTemplatePresentation().setIcon(AllIcons.General.Remove);
+
+ registerShortcutsForComponent(Arrays.asList(getShortcutSet().getShortcuts()), editorSearchComponent.getSearchField());
+ }
+
+ @Override
+ public void actionPerformed(AnActionEvent e) {
+ getEditorSearchComponent().removeOccurrence();
+ }
+
+ @Override
+ public void update(AnActionEvent e) {
+ boolean isFind = !getEditorSearchComponent().getFindModel().isReplaceState();
+ boolean hasMatches = getEditorSearchComponent().hasMatches();
+ e.getPresentation().setVisible(isFind);
+ e.getPresentation().setEnabled(isFind && hasMatches);
+ }
+}
diff --git a/platform/lang-impl/src/com/intellij/find/editorHeaderActions/RestorePreviousSettingsAction.java b/platform/lang-impl/src/com/intellij/find/editorHeaderActions/RestorePreviousSettingsAction.java
index cad2be2ddc20..2607ebf0557b 100644
--- a/platform/lang-impl/src/com/intellij/find/editorHeaderActions/RestorePreviousSettingsAction.java
+++ b/platform/lang-impl/src/com/intellij/find/editorHeaderActions/RestorePreviousSettingsAction.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2011 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -39,8 +39,7 @@ public class RestorePreviousSettingsAction extends EditorHeaderAction implements
public RestorePreviousSettingsAction(EditorSearchComponent editorSearchComponent, JTextComponent textField) {
super(editorSearchComponent);
myTextField = textField;
- registerShortcutsForComponent(Collections.<Shortcut>singletonList(SHORTCUT),
- textField, this);
+ registerShortcutsForComponent(Collections.<Shortcut>singletonList(SHORTCUT), textField);
}
@Override
diff --git a/platform/lang-impl/src/com/intellij/find/editorHeaderActions/SelectAllAction.java b/platform/lang-impl/src/com/intellij/find/editorHeaderActions/SelectAllAction.java
new file mode 100644
index 000000000000..0e52566f6fbc
--- /dev/null
+++ b/platform/lang-impl/src/com/intellij/find/editorHeaderActions/SelectAllAction.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2000-2014 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.find.editorHeaderActions;
+
+import com.intellij.find.EditorSearchComponent;
+import com.intellij.icons.AllIcons;
+import com.intellij.openapi.actionSystem.*;
+import com.intellij.openapi.project.DumbAware;
+import com.intellij.util.containers.ContainerUtil;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class SelectAllAction extends EditorHeaderAction implements DumbAware {
+ public SelectAllAction(EditorSearchComponent editorSearchComponent) {
+ super(editorSearchComponent);
+
+ copyFrom(ActionManager.getInstance().getAction(IdeActions.ACTION_SELECT_ALL_OCCURRENCES));
+ getTemplatePresentation().setIcon(AllIcons.Actions.Selectall);
+
+ List<Shortcut> shortcuts = new ArrayList<Shortcut>();
+ ContainerUtil.addAll(shortcuts, getShortcutSet().getShortcuts());
+ ContainerUtil.addAll(shortcuts, CommonShortcuts.ALT_ENTER.getShortcuts());
+ registerShortcutsForComponent(shortcuts, editorSearchComponent.getSearchField());
+ }
+
+ @Override
+ public void actionPerformed(AnActionEvent e) {
+ getEditorSearchComponent().selectAllOccurrences();
+ getEditorSearchComponent().close();
+ }
+
+ @Override
+ public void update(AnActionEvent e) {
+ boolean isFind = !getEditorSearchComponent().getFindModel().isReplaceState();
+ boolean hasMatches = getEditorSearchComponent().hasMatches();
+ e.getPresentation().setVisible(isFind);
+ e.getPresentation().setEnabled(isFind && hasMatches);
+ }
+}
diff --git a/platform/lang-impl/src/com/intellij/find/impl/FindInProjectUtil.java b/platform/lang-impl/src/com/intellij/find/impl/FindInProjectUtil.java
index 23f14c5eb0b4..e4570b7379bf 100644
--- a/platform/lang-impl/src/com/intellij/find/impl/FindInProjectUtil.java
+++ b/platform/lang-impl/src/com/intellij/find/impl/FindInProjectUtil.java
@@ -47,6 +47,7 @@ import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.VirtualFileManager;
import com.intellij.openapi.vfs.ex.VirtualFileManagerEx;
import com.intellij.psi.*;
+import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.psi.search.LocalSearchScope;
import com.intellij.psi.search.SearchScope;
import com.intellij.ui.content.Content;
@@ -54,6 +55,7 @@ import com.intellij.usageView.UsageInfo;
import com.intellij.usageView.UsageViewManager;
import com.intellij.usages.ConfigurableUsageTarget;
import com.intellij.usages.FindUsagesProcessPresentation;
+import com.intellij.usages.UsageView;
import com.intellij.usages.UsageViewPresentation;
import com.intellij.util.Function;
import com.intellij.util.PatternUtil;
@@ -324,7 +326,7 @@ public class FindInProjectUtil {
return processPresentation;
}
- public static class StringUsageTarget implements ConfigurableUsageTarget, ItemPresentation {
+ public static class StringUsageTarget implements ConfigurableUsageTarget, ItemPresentation, TypeSafeDataProvider {
@NotNull protected final Project myProject;
@NotNull protected final FindModel myFindModel;
@@ -423,5 +425,12 @@ public class FindInProjectUtil {
public KeyboardShortcut getShortcut() {
return ActionManager.getInstance().getKeyboardShortcut("FindInPath");
}
+
+ @Override
+ public void calcData(DataKey key, DataSink sink) {
+ if (key == UsageView.USAGE_SCOPE) {
+ sink.put(UsageView.USAGE_SCOPE, GlobalSearchScope.allScope(myProject));
+ }
+ }
}
}
diff --git a/platform/lang-impl/src/com/intellij/find/impl/livePreview/LivePreview.java b/platform/lang-impl/src/com/intellij/find/impl/livePreview/LivePreview.java
index c20b5925721d..4ba97e0151e5 100644
--- a/platform/lang-impl/src/com/intellij/find/impl/livePreview/LivePreview.java
+++ b/platform/lang-impl/src/com/intellij/find/impl/livePreview/LivePreview.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2012 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -121,7 +121,7 @@ public class LivePreview extends DocumentAdapter implements SearchResults.Search
}
highlightUsages();
- updateCursorHighlighting(false);
+ updateCursorHighlighting();
if (myInSmartUpdate) {
clearUnusedHightlighters();
myInSmartUpdate = false;
@@ -218,9 +218,9 @@ public class LivePreview extends DocumentAdapter implements SearchResults.Search
}
@Override
- public void cursorMoved(boolean toChangeSelection) {
+ public void cursorMoved() {
updateInSelectionHighlighters();
- updateCursorHighlighting(toChangeSelection);
+ updateCursorHighlighting();
}
@Override
@@ -228,14 +228,7 @@ public class LivePreview extends DocumentAdapter implements SearchResults.Search
dumpState();
}
- @Override
- public void editorChanged(SearchResults sr, Editor oldEditor) {
- removeFromEditor();
- oldEditor.getDocument().removeDocumentListener(this);
- mySearchResults.getEditor().getDocument().addDocumentListener(this);
- }
-
- private void updateCursorHighlighting(boolean scroll) {
+ private void updateCursorHighlighting() {
hideBalloon();
if (myCursorHighlighter != null) {
@@ -245,7 +238,6 @@ public class LivePreview extends DocumentAdapter implements SearchResults.Search
final FindResult cursor = mySearchResults.getCursor();
Editor editor = mySearchResults.getEditor();
- SelectionModel selection = editor.getSelectionModel();
if (cursor != null) {
Set<RangeHighlighter> dummy = new HashSet<RangeHighlighter>();
highlightRange(cursor, new TextAttributes(null, null, Color.BLACK, EffectType.ROUNDED_BOX, 0), dummy);
@@ -253,33 +245,6 @@ public class LivePreview extends DocumentAdapter implements SearchResults.Search
myCursorHighlighter = dummy.iterator().next();
}
- if (scroll) {
- if (mySearchResults.getFindModel().isGlobal()) {
- FoldingModel foldingModel = editor.getFoldingModel();
- final FoldRegion[] allRegions = editor.getFoldingModel().getAllFoldRegions();
-
- foldingModel.runBatchFoldingOperation(new Runnable() {
- @Override
- public void run() {
- for (FoldRegion region : allRegions) {
- if (!region.isValid()) continue;
- if (cursor.intersects(TextRange.create(region))) {
- region.setExpanded(true);
- }
- }
- }
- });
- selection.setSelection(cursor.getStartOffset(), cursor.getEndOffset());
-
- editor.getCaretModel().moveToOffset(cursor.getEndOffset());
- editor.getScrollingModel().scrollToCaret(ScrollType.CENTER);
- } else {
- if (!SearchResults.insideVisibleArea(editor, cursor)) {
- LogicalPosition pos = editor.offsetToLogicalPosition(cursor.getStartOffset());
- editor.getScrollingModel().scrollTo(pos, ScrollType.CENTER);
- }
- }
- }
editor.getScrollingModel().runActionOnScrollingFinished(new Runnable() {
@Override
public void run() {
@@ -496,6 +461,8 @@ public class LivePreview extends DocumentAdapter implements SearchResults.Search
new Processor<RangeHighlighterEx>() {
@Override
public boolean process(RangeHighlighterEx highlighter) {
+ if (!highlighter.getEditorFilter().avaliableIn(mySearchResults.getEditor())) return true;
+
TextAttributes textAttributes =
highlighter.getTextAttributes();
if (highlighter.getUserData(SEARCH_MARKER) != null &&
diff --git a/platform/lang-impl/src/com/intellij/find/impl/livePreview/LivePreviewController.java b/platform/lang-impl/src/com/intellij/find/impl/livePreview/LivePreviewController.java
index 8368f1b2f2aa..94a6c3f9c1bc 100644
--- a/platform/lang-impl/src/com/intellij/find/impl/livePreview/LivePreviewController.java
+++ b/platform/lang-impl/src/com/intellij/find/impl/livePreview/LivePreviewController.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2000-2014 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.find.impl.livePreview;
import com.intellij.find.*;
@@ -83,9 +98,9 @@ public class LivePreviewController implements LivePreview.Delegate, FindUtil.Rep
public void moveCursor(SearchResults.Direction direction) {
if (direction == SearchResults.Direction.UP) {
- mySearchResults.prevOccurrence();
+ mySearchResults.prevOccurrence(false);
} else {
- mySearchResults.nextOccurrence();
+ mySearchResults.nextOccurrence(false);
}
}
diff --git a/platform/lang-impl/src/com/intellij/find/impl/livePreview/SearchResults.java b/platform/lang-impl/src/com/intellij/find/impl/livePreview/SearchResults.java
index dff4989bb2f6..39b17dd2acc8 100644
--- a/platform/lang-impl/src/com/intellij/find/impl/livePreview/SearchResults.java
+++ b/platform/lang-impl/src/com/intellij/find/impl/livePreview/SearchResults.java
@@ -21,9 +21,7 @@ import com.intellij.find.FindModel;
import com.intellij.find.FindResult;
import com.intellij.find.FindUtil;
import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.editor.Editor;
-import com.intellij.openapi.editor.RangeMarker;
-import com.intellij.openapi.editor.SelectionModel;
+import com.intellij.openapi.editor.*;
import com.intellij.openapi.editor.event.DocumentEvent;
import com.intellij.openapi.editor.event.DocumentListener;
import com.intellij.openapi.fileEditor.FileDocumentManager;
@@ -38,6 +36,7 @@ import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.containers.HashSet;
import com.intellij.util.containers.Stack;
import com.intellij.util.ui.UIUtil;
+import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
@@ -70,6 +69,7 @@ public class SearchResults implements DocumentListener {
private @Nullable FindResult myCursor;
+ @NotNull
private List<FindResult> myOccurrences = new ArrayList<FindResult>();
private final Set<RangeMarker> myExcluded = new HashSet<RangeMarker>();
@@ -90,6 +90,8 @@ public class SearchResults implements DocumentListener {
private final Stack<Pair<FindModel, FindResult>> myCursorPositions = new Stack<Pair<FindModel, FindResult>>();
+ private final SelectionManager mySelectionManager = new SelectionManager(this);
+
public SearchResults(Editor editor, Project project) {
myEditor = editor;
myProject = project;
@@ -127,9 +129,8 @@ public class SearchResults implements DocumentListener {
public void exclude(FindResult occurrence) {
boolean include = false;
- final TextRange r = occurrence;
for (RangeMarker rangeMarker : myExcluded) {
- if (TextRange.areSegmentsEqual(rangeMarker, r)) {
+ if (TextRange.areSegmentsEqual(rangeMarker, occurrence)) {
myExcluded.remove(rangeMarker);
rangeMarker.dispose();
include = true;
@@ -137,7 +138,7 @@ public class SearchResults implements DocumentListener {
}
}
if (!include) {
- myExcluded.add(myEditor.getDocument().createRangeMarker(r.getStartOffset(), r.getEndOffset(), true));
+ myExcluded.add(myEditor.getDocument().createRangeMarker(occurrence.getStartOffset(), occurrence.getEndOffset(), true));
}
notifyChanged();
}
@@ -149,8 +150,7 @@ public class SearchResults implements DocumentListener {
public interface SearchResultsListener {
void searchResultsUpdated(SearchResults sr);
- void editorChanged(SearchResults sr, Editor oldEditor);
- void cursorMoved(boolean toChangeSelection);
+ void cursorMoved();
void updateFinished();
}
@@ -175,6 +175,7 @@ public class SearchResults implements DocumentListener {
return myCursor;
}
+ @NotNull
public List<FindResult> getOccurrences() {
return myOccurrences;
}
@@ -184,19 +185,7 @@ public class SearchResults implements DocumentListener {
return myProject;
}
- public synchronized void setEditor(Editor editor) {
- Editor oldOne = myEditor;
- myEditor = editor;
- notifyEditorChanged(oldOne);
- }
-
- private void notifyEditorChanged(Editor oldOne) {
- for (SearchResultsListener listener : myListeners) {
- listener.editorChanged(this, oldOne);
- }
- }
-
- public synchronized Editor getEditor() {
+ public Editor getEditor() {
return myEditor;
}
@@ -334,7 +323,7 @@ public class SearchResults implements DocumentListener {
myEditor.getDocument().removeDocumentListener(this);
}
- private void searchCompleted(List<FindResult> occurrences, Editor editor, @Nullable FindModel findModel,
+ private void searchCompleted(@NotNull List<FindResult> occurrences, Editor editor, @Nullable FindModel findModel,
boolean toChangeSelection, @Nullable TextRange next, int stamp) {
if (stamp < myLastUpdatedStamp){
return;
@@ -344,7 +333,7 @@ public class SearchResults implements DocumentListener {
return;
}
myOccurrences = occurrences;
- final TextRange oldCursorRange = myCursor != null ? myCursor : null;
+ final TextRange oldCursorRange = myCursor;
Collections.sort(myOccurrences, new Comparator<FindResult>() {
@Override
public int compare(FindResult findResult, FindResult findResult1) {
@@ -357,7 +346,10 @@ public class SearchResults implements DocumentListener {
updateExcluded();
notifyChanged();
if (oldCursorRange == null || myCursor == null || !myCursor.equals(oldCursorRange)) {
- notifyCursorMoved(toChangeSelection);
+ if (toChangeSelection) {
+ mySelectionManager.updateSelection(true, true);
+ }
+ notifyCursorMoved();
}
dumpIfNeeded();
}
@@ -389,7 +381,7 @@ public class SearchResults implements DocumentListener {
myCursor = firstOccurrenceAfterOffset(oldCursorRange.getEndOffset());
} else {
if (justReplaced) {
- nextOccurrence(false, next, false, justReplaced);
+ nextOccurrence(false, next, false, true, false);
} else {
FindResult afterCaret = oldCursorRange == null ? firstOccurrenceAtOrAfterCaret() : firstOccurrenceAfterCaret();
if (afterCaret != null) {
@@ -405,7 +397,7 @@ public class SearchResults implements DocumentListener {
}
}
if (!justReplaced && myCursor == null && hasMatches()) {
- nextOccurrence(true, oldCursorRange, false, false);
+ nextOccurrence(true, oldCursorRange, false, false, false);
}
if (toPush && myCursor != null){
push();
@@ -445,6 +437,13 @@ public class SearchResults implements DocumentListener {
return occurrence;
}
}
+ int selectionStartOffset = getEditor().getSelectionModel().getSelectionStart();
+ int selectionEndOffset = getEditor().getSelectionModel().getSelectionEnd();
+ for (FindResult occurrence : myOccurrences) {
+ if (selectionEndOffset >= occurrence.getEndOffset() && selectionStartOffset <= occurrence.getStartOffset()) {
+ return occurrence;
+ }
+ }
return firstOccurrenceAfterCaret();
}
@@ -462,25 +461,6 @@ public class SearchResults implements DocumentListener {
}
@Nullable
- private FindResult firstVisibleOccurrence() {
- int offset = Integer.MAX_VALUE;
- FindResult firstOccurrence = null;
- FindResult firstVisibleOccurrence = null;
- for (FindResult o : getOccurrences()) {
- if (insideVisibleArea(myEditor, o)) {
- if (firstVisibleOccurrence == null || o.getStartOffset() < firstVisibleOccurrence.getStartOffset()) {
- firstVisibleOccurrence = o;
- }
- }
- if (o.getStartOffset() < offset) {
- offset = o.getStartOffset();
- firstOccurrence = o;
- }
- }
- return firstVisibleOccurrence != null ? firstVisibleOccurrence : firstOccurrence;
- }
-
- @Nullable
private FindResult firstOccurrenceBeforeCaret() {
int offset = getEditor().getCaretModel().getOffset();
return firstOccurrenceBeforeOffset(offset);
@@ -554,32 +534,45 @@ public class SearchResults implements DocumentListener {
return null;
}
- public void prevOccurrence() {
- FindResult next = null;
- if (myFindModel == null) return;
- boolean processFromTheBeginning = false;
- if (myNotFoundState) {
- myNotFoundState = false;
- processFromTheBeginning = true;
- }
- if (!myFindModel.isGlobal()) {
- if (myCursor != null) {
- next = prevOccurrence(myCursor);
+ public void prevOccurrence(boolean findSelected) {
+ if (findSelected) {
+ if (mySelectionManager.removeCurrentSelection()) {
+ myCursor = firstOccurrenceAtOrAfterCaret();
}
- } else {
- next = firstOccurrenceBeforeCaret();
- }
- if (next == null) {
- if (processFromTheBeginning) {
- if (hasMatches()) {
- next = getOccurrences().get(getOccurrences().size()-1);
+ else {
+ myCursor = null;
+ }
+ notifyCursorMoved();
+ }
+ else {
+ FindResult next = null;
+ if (myFindModel == null) return;
+ boolean processFromTheBeginning = false;
+ if (myNotFoundState) {
+ myNotFoundState = false;
+ processFromTheBeginning = true;
+ }
+ if (!myFindModel.isGlobal()) {
+ if (myCursor != null) {
+ next = prevOccurrence(myCursor);
+ }
+ }
+ else {
+ next = firstOccurrenceBeforeCaret();
+ }
+ if (next == null) {
+ if (processFromTheBeginning) {
+ if (hasMatches()) {
+ next = getOccurrences().get(getOccurrences().size() - 1);
+ }
+ }
+ else {
+ setNotFoundState(false);
}
- } else {
- setNotFoundState(false);
}
- }
- moveCursorTo(next);
+ moveCursorTo(next, false);
+ }
push();
}
@@ -587,13 +580,13 @@ public class SearchResults implements DocumentListener {
myCursorPositions.push(Pair.create(myFindModel, myCursor));
}
- public void nextOccurrence() {
+ public void nextOccurrence(boolean retainOldSelection) {
if (myFindModel == null) return;
- nextOccurrence(false, myCursor != null ? myCursor : null, true, false);
+ nextOccurrence(false, myCursor, true, false, retainOldSelection);
push();
}
- private void nextOccurrence(boolean processFromTheBeginning, TextRange cursor, boolean toNotify, boolean justReplaced) {
+ private void nextOccurrence(boolean processFromTheBeginning, TextRange cursor, boolean toNotify, boolean justReplaced, boolean retainOldSelection) {
FindResult next;
if (myNotFoundState) {
myNotFoundState = false;
@@ -614,22 +607,24 @@ public class SearchResults implements DocumentListener {
}
}
if (toNotify) {
- moveCursorTo(next);
+ moveCursorTo(next, retainOldSelection);
} else {
myCursor = next;
}
}
- public void moveCursorTo(FindResult next) {
- if (next != null) {
+ public void moveCursorTo(FindResult next, boolean retainOldSelection) {
+ if (next != null && !mySelectionManager.isSelected(next)) {
+ retainOldSelection &= (myCursor != null && mySelectionManager.isSelected(myCursor));
myCursor = next;
- notifyCursorMoved(true);
+ mySelectionManager.updateSelection(!retainOldSelection, false);
+ notifyCursorMoved();
}
}
- private void notifyCursorMoved(boolean toChangeSelection) {
+ private void notifyCursorMoved() {
for (SearchResultsListener listener : myListeners) {
- listener.cursorMoved(toChangeSelection);
+ listener.cursorMoved();
}
}
}
diff --git a/platform/lang-impl/src/com/intellij/find/impl/livePreview/SelectionManager.java b/platform/lang-impl/src/com/intellij/find/impl/livePreview/SelectionManager.java
new file mode 100644
index 000000000000..50f37927c506
--- /dev/null
+++ b/platform/lang-impl/src/com/intellij/find/impl/livePreview/SelectionManager.java
@@ -0,0 +1,90 @@
+/*
+ * Copyright 2000-2014 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.find.impl.livePreview;
+
+import com.intellij.find.FindResult;
+import com.intellij.find.FindUtil;
+import com.intellij.openapi.editor.*;
+import com.intellij.openapi.util.TextRange;
+import org.jetbrains.annotations.NotNull;
+
+public class SelectionManager {
+ @NotNull private final SearchResults mySearchResults;
+
+ public SelectionManager(@NotNull SearchResults results) {
+ mySearchResults = results;
+ }
+
+ public void updateSelection(boolean removePreviousSelection, boolean removeAllPreviousSelections) {
+ Editor editor = mySearchResults.getEditor();
+ if (removeAllPreviousSelections) {
+ editor.getCaretModel().removeSecondaryCarets();
+ }
+ final FindResult cursor = mySearchResults.getCursor();
+ if (cursor == null) {
+ return;
+ }
+ if (mySearchResults.getFindModel().isGlobal()) {
+ if (removePreviousSelection || removeAllPreviousSelections) {
+ FoldingModel foldingModel = editor.getFoldingModel();
+ final FoldRegion[] allRegions = editor.getFoldingModel().getAllFoldRegions();
+
+ foldingModel.runBatchFoldingOperation(new Runnable() {
+ @Override
+ public void run() {
+ for (FoldRegion region : allRegions) {
+ if (!region.isValid()) continue;
+ if (cursor.intersects(TextRange.create(region))) {
+ region.setExpanded(true);
+ }
+ }
+ }
+ });
+ editor.getSelectionModel().setSelection(cursor.getStartOffset(), cursor.getEndOffset());
+ editor.getCaretModel().moveToOffset(cursor.getEndOffset());
+ }
+ else {
+ FindUtil.selectSearchResultInEditor(editor, cursor, -1);
+ }
+ editor.getScrollingModel().scrollToCaret(ScrollType.CENTER);
+ } else {
+ if (!SearchResults.insideVisibleArea(editor, cursor)) {
+ LogicalPosition pos = editor.offsetToLogicalPosition(cursor.getStartOffset());
+ editor.getScrollingModel().scrollTo(pos, ScrollType.CENTER);
+ }
+ }
+ }
+
+ public boolean removeCurrentSelection() {
+ Editor editor = mySearchResults.getEditor();
+ CaretModel caretModel = editor.getCaretModel();
+ Caret primaryCaret = caretModel.getPrimaryCaret();
+ if (caretModel.getCaretCount() > 1) {
+ caretModel.removeCaret(primaryCaret);
+ return true;
+ }
+ else {
+ primaryCaret.moveToOffset(primaryCaret.getSelectionStart());
+ primaryCaret.removeSelection();
+ return false;
+ }
+ }
+
+ public boolean isSelected(@NotNull FindResult result) {
+ Editor editor = mySearchResults.getEditor();
+ return editor.getCaretModel().getCaretAt(editor.offsetToVisualPosition(result.getEndOffset())) != null;
+ }
+}
diff --git a/platform/lang-impl/src/com/intellij/formatting/FormatProcessor.java b/platform/lang-impl/src/com/intellij/formatting/FormatProcessor.java
index 90f2387a157a..7d3c7c649fd2 100644
--- a/platform/lang-impl/src/com/intellij/formatting/FormatProcessor.java
+++ b/platform/lang-impl/src/com/intellij/formatting/FormatProcessor.java
@@ -16,6 +16,7 @@
package com.intellij.formatting;
+import com.intellij.lang.ASTNode;
import com.intellij.lang.Language;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Document;
@@ -25,6 +26,8 @@ import com.intellij.openapi.editor.impl.BulkChangesMerger;
import com.intellij.openapi.editor.impl.TextChangeImpl;
import com.intellij.openapi.fileTypes.StdFileTypes;
import com.intellij.openapi.util.TextRange;
+import com.intellij.psi.PsiElement;
+import com.intellij.psi.PsiFile;
import com.intellij.psi.codeStyle.CodeStyleSettings;
import com.intellij.psi.codeStyle.CommonCodeStyleSettings;
import com.intellij.util.ui.UIUtil;
@@ -145,6 +148,7 @@ class FormatProcessor {
private WhiteSpace myLastWhiteSpace;
private boolean myDisposed;
private CommonCodeStyleSettings.IndentOptions myJavaIndentOptions;
+ private final int myRightMargin;
@NotNull
private State myCurrentState;
@@ -172,6 +176,23 @@ class FormatProcessor {
mySettings = settings;
myDocument = docModel.getDocument();
myCurrentState = new WrapBlocksState(rootBlock, docModel, affectedRanges, interestingOffset);
+ myRightMargin = getRightMargin(rootBlock);
+ }
+
+ private int getRightMargin(Block rootBlock) {
+ if (rootBlock instanceof ASTBlock) {
+ ASTNode node = ((ASTBlock)rootBlock).getNode();
+ if (node != null) {
+ PsiElement psiElement = node.getPsi();
+ if (psiElement.isValid()) {
+ PsiFile psiFile = psiElement.getContainingFile();
+ if (psiFile != null) {
+ return mySettings.getRightMargin(psiFile.getViewProvider().getBaseLanguage());
+ }
+ }
+ }
+ }
+ return mySettings.RIGHT_MARGIN;
}
private LeafBlockWrapper getLastBlock() {
@@ -813,7 +834,7 @@ class FormatProcessor {
*/
private boolean lineOver() {
return !myCurrentBlock.containsLineFeeds() &&
- CoreFormatterUtil.getStartColumn(myCurrentBlock) + myCurrentBlock.getLength() > mySettings.RIGHT_MARGIN;
+ CoreFormatterUtil.getStartColumn(myCurrentBlock) + myCurrentBlock.getLength() > myRightMargin;
}
private void defineAlignOffset(final LeafBlockWrapper block) {
diff --git a/platform/lang-impl/src/com/intellij/ide/actions/GotoActionAction.java b/platform/lang-impl/src/com/intellij/ide/actions/GotoActionAction.java
index c939787fb632..e57d1eba05ef 100644
--- a/platform/lang-impl/src/com/intellij/ide/actions/GotoActionAction.java
+++ b/platform/lang-impl/src/com/intellij/ide/actions/GotoActionAction.java
@@ -20,9 +20,8 @@ import com.intellij.featureStatistics.FeatureUsageTracker;
import com.intellij.ide.DataManager;
import com.intellij.ide.ui.search.OptionDescription;
import com.intellij.ide.util.gotoByName.ChooseByNamePopup;
-import com.intellij.ide.util.gotoByName.DefaultChooseByNameItemProvider;
+import com.intellij.ide.util.gotoByName.GotoActionItemProvider;
import com.intellij.ide.util.gotoByName.GotoActionModel;
-import com.intellij.ide.util.gotoByName.MatchResult;
import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.actionSystem.ex.ActionUtil;
import com.intellij.openapi.application.ApplicationManager;
@@ -33,27 +32,11 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.popup.JBPopupFactory;
import com.intellij.openapi.util.Pair;
import com.intellij.psi.PsiFile;
-import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.awt.*;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
public class GotoActionAction extends GotoActionBase implements DumbAware {
- public static final Comparator<MatchResult> ELEMENTS_COMPARATOR = new Comparator<MatchResult>() {
- @Override
- public int compare(@NotNull MatchResult o1, @NotNull MatchResult o2) {
- if (o1.elementName.equals(GotoActionModel.INTENTIONS_KEY)) return -1;
- if (o2.elementName.equals(GotoActionModel.INTENTIONS_KEY)) return 1;
-
- if (o1.elementName.equals(GotoActionModel.SETTINGS_KEY)) return 1;
- if (o2.elementName.equals(GotoActionModel.SETTINGS_KEY)) return -1;
-
- return o1.elementName.compareToIgnoreCase(o2.elementName);
- }
- };
@Override
public void gotoActionPerformed(final AnActionEvent e) {
@@ -68,7 +51,7 @@ public class GotoActionAction extends GotoActionBase implements DumbAware {
@Override
public void elementChosen(ChooseByNamePopup popup, final Object element) {
final String enteredText = popup.getEnteredText();
- openOptionOrPerformAction(element, enteredText, project, component, e);
+ openOptionOrPerformAction(((GotoActionModel.MatchedValue)element).value, enteredText, project, component, e);
}
};
@@ -79,12 +62,7 @@ public class GotoActionAction extends GotoActionBase implements DumbAware {
private static ChooseByNamePopup createPopup(Project project, GotoActionModel model, String initialText, int initialIndex) {
return ChooseByNamePopup.createPopup(project,
model,
- new DefaultChooseByNameItemProvider(null) {
- @Override
- protected void sortNamesList(@NotNull String namePattern, @NotNull List<MatchResult> namesList) {
- Collections.sort(namesList, ELEMENTS_COMPARATOR);
- }
- },
+ new GotoActionItemProvider(model),
initialText,
false,
initialIndex);
diff --git a/platform/lang-impl/src/com/intellij/ide/actions/GotoRelatedFileAction.java b/platform/lang-impl/src/com/intellij/ide/actions/GotoRelatedFileAction.java
new file mode 100644
index 000000000000..6d734d52a584
--- /dev/null
+++ b/platform/lang-impl/src/com/intellij/ide/actions/GotoRelatedFileAction.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.ide.actions;
+
+import com.intellij.navigation.GotoRelatedItem;
+import com.intellij.openapi.actionSystem.DataContext;
+import com.intellij.openapi.ui.popup.JBPopup;
+import com.intellij.psi.PsiElement;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.List;
+
+/**
+ * @deprecated API compatibility. Utility methods will be moved to NavigationUtil
+ * @author gregsh
+ */
+public class GotoRelatedFileAction {
+
+ /**
+ * @deprecated This method will be moved to NavigationUtil
+ */
+ public static JBPopup createPopup(List<? extends GotoRelatedItem> items, final String title) {
+ return GotoRelatedSymbolAction.createPopup(items, title);
+ }
+
+ /**
+ * @deprecated This method will be moved to NavigationUtil
+ */
+ public static List<GotoRelatedItem> getItems(@NotNull PsiElement contextElement, @Nullable DataContext dataContext) {
+ return GotoRelatedSymbolAction.getItems(contextElement, dataContext);
+ }
+}
diff --git a/platform/lang-impl/src/com/intellij/ide/actions/GotoRelatedSymbolAction.java b/platform/lang-impl/src/com/intellij/ide/actions/GotoRelatedSymbolAction.java
index f333c0f35db8..2870f806ab8a 100644
--- a/platform/lang-impl/src/com/intellij/ide/actions/GotoRelatedSymbolAction.java
+++ b/platform/lang-impl/src/com/intellij/ide/actions/GotoRelatedSymbolAction.java
@@ -42,6 +42,7 @@ import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import org.jetbrains.annotations.TestOnly;
import javax.swing.*;
import java.awt.*;
@@ -56,26 +57,23 @@ public class GotoRelatedSymbolAction extends AnAction {
@Override
public void update(AnActionEvent e) {
- PsiFile file = CommonDataKeys.PSI_FILE.getData(e.getDataContext());
- PsiElement element = CommonDataKeys.PSI_ELEMENT.getData(e.getDataContext());
- e.getPresentation().setEnabled(element != null || file != null);
+ PsiElement element = getContextElement(e.getDataContext());
+ e.getPresentation().setEnabled(element != null);
}
@Override
public void actionPerformed(AnActionEvent e) {
- DataContext dataContext = e.getDataContext();
- PsiFile file = CommonDataKeys.PSI_FILE.getData(e.getDataContext());
- Editor editor = CommonDataKeys.EDITOR.getData(e.getDataContext());
- PsiElement element = CommonDataKeys.PSI_ELEMENT.getData(dataContext);
- if (element == null && file == null) return;
+ PsiElement element = getContextElement(e.getDataContext());
+ if (element == null) return;
- List<GotoRelatedItem> items = element == null? getItems(file, editor, dataContext) : getItems(element, dataContext);
+ List<GotoRelatedItem> items = getItems(element, e.getDataContext());
if (items.isEmpty()) return;
+
if (items.size() == 1 && items.get(0).getElement() != null) {
items.get(0).navigate();
return;
}
- createPopup(items, "Choose Target").showInBestPositionFor(dataContext);
+ createPopup(items, "Choose Target").showInBestPositionFor(e.getDataContext());
}
public static JBPopup createPopup(final List<? extends GotoRelatedItem> items, final String title) {
@@ -268,8 +266,25 @@ public class GotoRelatedSymbolAction extends AnAction {
return popup;
}
+ @TestOnly
@NotNull
public static List<GotoRelatedItem> getItems(@NotNull PsiFile psiFile, @Nullable Editor editor, @Nullable DataContext dataContext) {
+ return getItems(getContextElement(psiFile, editor), dataContext);
+ }
+
+ @Nullable
+ private static PsiElement getContextElement(@NotNull DataContext dataContext) {
+ PsiFile file = CommonDataKeys.PSI_FILE.getData(dataContext);
+ Editor editor = CommonDataKeys.EDITOR.getData(dataContext);
+ PsiElement element = CommonDataKeys.PSI_ELEMENT.getData(dataContext);
+ if (file != null && editor != null) {
+ return getContextElement(file, editor);
+ }
+ return element;
+ }
+
+ @NotNull
+ private static PsiElement getContextElement(@NotNull PsiFile psiFile, @Nullable Editor editor) {
PsiElement contextElement = psiFile;
if (editor != null) {
PsiElement element = psiFile.findElementAt(editor.getCaretModel().getOffset());
@@ -277,7 +292,7 @@ public class GotoRelatedSymbolAction extends AnAction {
contextElement = element;
}
}
- return getItems(contextElement, dataContext);
+ return contextElement;
}
@NotNull
diff --git a/platform/lang-impl/src/com/intellij/ide/actions/SearchEverywhereAction.java b/platform/lang-impl/src/com/intellij/ide/actions/SearchEverywhereAction.java
index 996601065278..ae7ee4363247 100644
--- a/platform/lang-impl/src/com/intellij/ide/actions/SearchEverywhereAction.java
+++ b/platform/lang-impl/src/com/intellij/ide/actions/SearchEverywhereAction.java
@@ -56,10 +56,9 @@ import com.intellij.openapi.fileEditor.impl.EditorHistoryManager;
import com.intellij.openapi.keymap.KeymapManager;
import com.intellij.openapi.keymap.KeymapUtil;
import com.intellij.openapi.keymap.MacKeymapUtil;
+import com.intellij.openapi.keymap.impl.ModifierKeyDoubleClickHandler;
import com.intellij.openapi.options.Configurable;
import com.intellij.openapi.options.SearchableConfigurable;
-import com.intellij.openapi.options.ex.IdeConfigurablesGroup;
-import com.intellij.openapi.options.ex.ProjectConfigurablesGroup;
import com.intellij.openapi.progress.ProcessCanceledException;
import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.progress.util.ProgressIndicatorBase;
@@ -96,6 +95,7 @@ import com.intellij.ui.components.panels.NonOpaquePanel;
import com.intellij.ui.popup.AbstractPopup;
import com.intellij.ui.popup.PopupPositionManager;
import com.intellij.util.*;
+import com.intellij.util.text.Matcher;
import com.intellij.util.ui.EmptyIcon;
import com.intellij.util.ui.StatusText;
import com.intellij.util.ui.UIUtil;
@@ -138,9 +138,8 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA
MySearchTextField myPopupField;
private volatile GotoClassModel2 myClassModel;
private volatile GotoFileModel myFileModel;
- private volatile GotoActionModel myActionModel;
+ private volatile GotoActionItemProvider myActionProvider;
private volatile GotoSymbolModel2 mySymbolsModel;
- private volatile String[] myActions;
private Component myFocusComponent;
private JBPopup myPopup;
private Map<String, String> myConfigurables = new HashMap<String, String>();
@@ -153,106 +152,25 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA
private Component myContextComponent;
private CalcThread myCalcThread;
private static AtomicBoolean ourShiftIsPressed = new AtomicBoolean(false);
- private final static Couple<AtomicBoolean> ourPressed = Couple.of(new AtomicBoolean(false), new AtomicBoolean(false));
- private final static Couple<AtomicBoolean> ourReleased = Couple.of(new AtomicBoolean(false), new AtomicBoolean(false));
- private static AtomicBoolean ourOtherKeyWasPressed = new AtomicBoolean(false);
- private static AtomicLong ourLastTimePressed = new AtomicLong(0);
private static AtomicBoolean showAll = new AtomicBoolean(false);
private volatile ActionCallback myCurrentWorker = ActionCallback.DONE;
private int myHistoryIndex = 0;
boolean mySkipFocusGain = false;
static {
+ ModifierKeyDoubleClickHandler.getInstance().registerAction(IdeActions.ACTION_SEARCH_EVERYWHERE, KeyEvent.VK_SHIFT, -1);
+
IdeEventQueue.getInstance().addPostprocessor(new IdeEventQueue.EventDispatcher() {
@Override
public boolean dispatch(AWTEvent event) {
if (event instanceof KeyEvent) {
- final KeyEvent keyEvent = (KeyEvent)event;
- final int keyCode = keyEvent.getKeyCode();
-
+ final int keyCode = ((KeyEvent)event).getKeyCode();
if (keyCode == KeyEvent.VK_SHIFT) {
ourShiftIsPressed.set(event.getID() == KeyEvent.KEY_PRESSED);
-
- if (keyEvent.isControlDown() || keyEvent.isAltDown() || keyEvent.isMetaDown()) {
- resetState();
- return false;
- }
- if (ourOtherKeyWasPressed.get() && System.currentTimeMillis() - ourLastTimePressed.get() < 500) {
- resetState();
- return false;
- }
- ourOtherKeyWasPressed.set(false);
- if (ourPressed.first.get() && System.currentTimeMillis() - ourLastTimePressed.get() > 500) {
- resetState();
- }
- handleShift((KeyEvent)event);
- return false;
- } else {
- ourLastTimePressed.set(System.currentTimeMillis());
- ourOtherKeyWasPressed.set(true);
- if (keyCode == KeyEvent.VK_ESCAPE || keyCode == KeyEvent.VK_TAB) {
- ourLastTimePressed.set(0);
- }
}
- resetState();
}
return false;
}
-
- private void resetState() {
- ourPressed.first.set(false);
- ourPressed.second.set(false);
- ourReleased.first.set(false);
- ourReleased.second.set(false);
- }
-
- private void handleShift(KeyEvent event) {
- if (ourPressed.first.get() && System.currentTimeMillis() - ourLastTimePressed.get() > 300) {
- resetState();
- return;
- }
-
- if (event.getID() == KeyEvent.KEY_PRESSED) {
- if (!ourPressed.first.get()) {
- resetState();
- ourPressed.first.set(true);
- ourLastTimePressed.set(System.currentTimeMillis());
- return;
- } else {
- if (ourPressed.first.get() && ourReleased.first.get()) {
- ourPressed.second.set(true);
- ourLastTimePressed.set(System.currentTimeMillis());
- return;
- }
- }
- } else if (event.getID() == KeyEvent.KEY_RELEASED) {
- if (ourPressed.first.get() && !ourReleased.first.get()) {
- ourReleased.first.set(true);
- ourLastTimePressed.set(System.currentTimeMillis());
- return;
- } else if (ourPressed.first.get() && ourReleased.first.get() && ourPressed.second.get()) {
- resetState();
- run(event);
- return;
- }
- }
- resetState();
- }
-
- private void run(KeyEvent event) {
- final ActionManager actionManager = ActionManager.getInstance();
- final AnAction action = actionManager.getAction(IdeActions.ACTION_SEARCH_EVERYWHERE);
- if (KeymapManager.getInstance().getActiveKeymap().getShortcuts(IdeActions.ACTION_SEARCH_EVERYWHERE).length > 0) {
- return;
- }
- final AnActionEvent anActionEvent = new AnActionEvent(event,
- DataManager.getInstance().getDataContext(IdeFocusManager.findInstance().getFocusOwner()),
- ActionPlaces.MAIN_MENU,
- action.getTemplatePresentation(),
- actionManager,
- 0);
- action.actionPerformed(anActionEvent);
- }
}, null);
}
@@ -840,7 +758,9 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA
if (split.length != 3 || text.equals(split[0])) {
continue;
}
- history.add(new HistoryItem(split[0], split[1], split[2]));
+ if (!StringUtil.isEmpty(split[0])) {
+ history.add(new HistoryItem(split[0], split[1], split[2]));
+ }
}
}
history.add(0, new HistoryItem(text, type == null ? null : type.name(), fqn));
@@ -1008,14 +928,18 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA
Component cmp;
PsiFile file = null;
myLocationString = null;
+ String pattern = "*" + myPopupField.getText();
+ Matcher matcher = NameUtil.buildMatcher(pattern, 0, true, true, pattern.toLowerCase().equals(pattern));
if (isMoreItem(index)) {
cmp = More.get(isSelected);
} else if (value instanceof VirtualFile
&& myProject != null
&& (((VirtualFile)value).isDirectory()
|| (file = PsiManager.getInstance(myProject).findFile((VirtualFile)value)) != null)) {
+ myFileRenderer.setPatternMatcher(matcher);
cmp = myFileRenderer.getListCellRendererComponent(list, file == null ? value : file, index, isSelected, cellHasFocus);
} else if (value instanceof PsiElement) {
+ myPsiRenderer.setPatternMatcher(matcher);
cmp = myPsiRenderer.getListCellRendererComponent(list, value, index, isSelected, isSelected);
} else {
cmp = super.getListCellRendererComponent(list, value, index, isSelected, isSelected);
@@ -1185,16 +1109,6 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA
return text;
}
- private void schedulePopupUpdate() {
- myUpdateAlarm.cancelAllRequests();
- myUpdateAlarm.addRequest(new Runnable() {
- @Override
- public void run() {
- updatePopupBounds();
- }
- }, 50);
- }
-
private static boolean isActionValue(Object o) {
return o instanceof GotoActionModel.ActionWrapper || o instanceof AnAction;
}
@@ -1353,21 +1267,16 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA
private SearchResult getActionsOrSettings(final String pattern, final int max, final boolean actions) {
final SearchResult result = new SearchResult();
final MinusculeMatcher matcher = new MinusculeMatcher("*" +pattern, NameUtil.MatchingCaseSensitivity.NONE);
- if (myActions == null) {
- if (myActionModel == null) {
- myActionModel = createActionModel();
- }
- myActions = myActionModel.getNames(true);
+ if (myActionProvider == null) {
+ myActionProvider = createActionProvider();
}
- List<MatchResult> matches = collectResults(pattern, myActions, myActionModel);
-
- for (MatchResult o : matches) {
- check();
- Object[] objects = myActionModel.getElementsByName(o.elementName, true, pattern);
- for (Object object : objects) {
+ myActionProvider.filterElements(pattern, true, new Processor<GotoActionModel.MatchedValue>() {
+ @Override
+ public boolean process(GotoActionModel.MatchedValue matched) {
check();
- if (myListModel.contains(object)) continue;
+ Object object = matched.value;
+ if (myListModel.contains(object)) return true;
if (!actions && isSetting(object)) {
if (matcher.matches(getSettingText((OptionDescription)object))) {
@@ -1376,9 +1285,10 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA
} else if (actions && !isToolWindowAction(object) && isActionValue(object)) {
result.add(object);
}
- if (result.size() == max) return result;
+ return result.size() <= max;
}
- }
+ });
+
return result;
}
@@ -1411,7 +1321,7 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA
}
private synchronized void buildFiles(final String pattern) {
- final SearchResult files = getFiles(pattern, MAX_FILES);
+ final SearchResult files = getFiles(pattern, MAX_FILES, myFileChooseByName);
check();
@@ -1434,7 +1344,7 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA
private synchronized void buildSymbols(final String pattern) {
- final SearchResult symbols = getSymbols(pattern, MAX_SYMBOLS);
+ final SearchResult symbols = getSymbols(pattern, MAX_SYMBOLS, mySymbolsChooseByName);
check();
if (symbols.size() > 0) {
@@ -1522,7 +1432,7 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA
}
check();
- final SearchResult classes = getClasses(pattern, showAll.get(), MAX_CLASSES);
+ final SearchResult classes = getClasses(pattern, showAll.get(), MAX_CLASSES, myClassChooseByName);
check();
@@ -1544,10 +1454,10 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA
}
}
- private SearchResult getSymbols(String pattern, final int max) {
+ private SearchResult getSymbols(String pattern, final int max, ChooseByNamePopup chooseByNamePopup) {
final SearchResult symbols = new SearchResult();
final GlobalSearchScope scope = GlobalSearchScope.projectScope(project);
- mySymbolsChooseByName.getProvider().filterElements(mySymbolsChooseByName, pattern, false,
+ chooseByNamePopup.getProvider().filterElements(chooseByNamePopup, pattern, false,
myProgressIndicator, new Processor<Object>() {
@Override
public boolean process(Object o) {
@@ -1567,9 +1477,12 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA
return symbols;
}
- private SearchResult getClasses(String pattern, boolean includeLibs, final int max) {
+ private SearchResult getClasses(String pattern, boolean includeLibs, final int max, ChooseByNamePopup chooseByNamePopup) {
final SearchResult classes = new SearchResult();
- myClassChooseByName.getProvider().filterElements(myClassChooseByName, pattern, includeLibs,
+ if (chooseByNamePopup == null) {
+ return classes;
+ }
+ chooseByNamePopup.getProvider().filterElements(chooseByNamePopup, pattern, includeLibs,
myProgressIndicator, new Processor<Object>() {
@Override
public boolean process(Object o) {
@@ -1584,15 +1497,18 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA
}
});
if (!includeLibs && classes.isEmpty()) {
- return getClasses(pattern, true, max);
+ return getClasses(pattern, true, max, chooseByNamePopup);
}
return classes;
}
- private SearchResult getFiles(final String pattern, final int max) {
+ private SearchResult getFiles(final String pattern, final int max, ChooseByNamePopup chooseByNamePopup) {
final SearchResult files = new SearchResult();
+ if (chooseByNamePopup == null) {
+ return files;
+ }
final GlobalSearchScope scope = GlobalSearchScope.projectScope(project);
- myFileChooseByName.getProvider().filterElements(myFileChooseByName, pattern, true,
+ chooseByNamePopup.getProvider().filterElements(chooseByNamePopup, pattern, true,
myProgressIndicator, new Processor<Object>() {
@Override
public boolean process(Object o) {
@@ -1786,10 +1702,9 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA
myClassChooseByName = ChooseByNamePopup.createPopup(project, myClassModel, (PsiElement)null);
mySymbolsChooseByName = ChooseByNamePopup.createPopup(project, mySymbolsModel, (PsiElement)null);
project.putUserData(ChooseByNamePopup.CHOOSE_BY_NAME_POPUP_IN_PROJECT_KEY, null);
- myActionModel = createActionModel();
+ myActionProvider = createActionProvider();
myConfigurables.clear();
- fillConfigurablesIds(null, new IdeConfigurablesGroup().getConfigurables());
- fillConfigurablesIds(null, new ProjectConfigurablesGroup(project).getConfigurables());
+ fillConfigurablesIds(null, ShowSettingsUtilImpl.getConfigurables(project, true));
}
}
@@ -1797,14 +1712,16 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA
buildRecentFiles("");
}
- private GotoActionModel createActionModel() {
- return new GotoActionModel(project, myFocusComponent, myEditor, myFile) {
+ private GotoActionItemProvider createActionProvider() {
+ GotoActionModel model = new GotoActionModel(project, myFocusComponent, myEditor, myFile) {
@Override
protected MatchMode actionMatches(String pattern, @NotNull AnAction anAction) {
- return NameUtil.buildMatcher("*" + pattern, NameUtil.MatchingCaseSensitivity.NONE)
- .matches(anAction.getTemplatePresentation().getText()) ? MatchMode.NAME : MatchMode.NONE;
+ String text = anAction.getTemplatePresentation().getText();
+ return text != null && NameUtil.buildMatcher("*" + pattern, NameUtil.MatchingCaseSensitivity.NONE)
+ .matches(text) ? MatchMode.NAME : MatchMode.NONE;
}
};
+ return new GotoActionItemProvider(model);
}
@SuppressWarnings("SSBasedInspection")
@@ -1880,57 +1797,6 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA
});
}
- private List<MatchResult> collectResults(String pattern, String[] names, final ChooseByNameModel model) {
- if (names == null) return Collections.emptyList();
- pattern = ChooseByNamePopup.getTransformedPattern(pattern, model);
- pattern = DefaultChooseByNameItemProvider.getNamePattern(model, pattern);
- if (model != myFileModel && model != myActionModel && !pattern.startsWith("*") && pattern.length() > 1) {
- pattern = "*" + pattern;
- }
- final ArrayList<MatchResult> results = new ArrayList<MatchResult>();
- final String p = pattern;
- MinusculeMatcher matcher = new MinusculeMatcher(pattern, NameUtil.MatchingCaseSensitivity.NONE) {
- @Override
- public boolean matches(@NotNull String name) {
- if (!(model instanceof GotoActionModel) && p.indexOf(' ') > 0 && name.trim().indexOf(' ') < 0) {
- return false;
- }
- return super.matches(name);
- }
- };
- MatchResult result;
-
- for (String name : names) {
- check();
- result = null;
- if (model instanceof CustomMatcherModel) {
- try {
- result = ((CustomMatcherModel)model).matches(name, pattern) ? new MatchResult(name, 0, true) : null;
- if (result != null && model == myActionModel) {
- ((CustomMatcherModel)model).matches(name, pattern);
- }
- }
- catch (Exception ignore) {
- }
- }
- else {
- result = matcher.matches(name) ? new MatchResult(name, matcher.matchingDegree(name), matcher.isStartMatch(name)) : null;
- }
-
- if (result != null) {
- results.add(result);
- }
- }
-
- Collections.sort(results, new Comparator<MatchResult>() {
- @Override
- public int compare(MatchResult o1, MatchResult o2) {
- return o1.compareTo(o2);
- }
- });
- return results;
- }
-
public ActionCallback cancel() {
myProgressIndicator.cancel();
myDone.setRejected();
@@ -1945,10 +1811,10 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA
public void run() {
try {
final SearchResult result
- = id == WidgetID.CLASSES ? getClasses(pattern, showAll.get(), DEFAULT_MORE_STEP_COUNT)
- : id == WidgetID.FILES ? getFiles(pattern, DEFAULT_MORE_STEP_COUNT)
+ = id == WidgetID.CLASSES ? getClasses(pattern, showAll.get(), DEFAULT_MORE_STEP_COUNT, myClassChooseByName)
+ : id == WidgetID.FILES ? getFiles(pattern, DEFAULT_MORE_STEP_COUNT, myFileChooseByName)
: id == WidgetID.RUN_CONFIGURATIONS ? getConfigurations(pattern, DEFAULT_MORE_STEP_COUNT)
- : id == WidgetID.SYMBOLS ? getSymbols(pattern, DEFAULT_MORE_STEP_COUNT)
+ : id == WidgetID.SYMBOLS ? getSymbols(pattern, DEFAULT_MORE_STEP_COUNT, mySymbolsChooseByName)
: id == WidgetID.ACTIONS ? getActionsOrSettings(pattern, DEFAULT_MORE_STEP_COUNT, true)
: id == WidgetID.SETTINGS ? getActionsOrSettings(pattern, DEFAULT_MORE_STEP_COUNT, false)
: new SearchResult();
@@ -2030,8 +1896,7 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA
if (lock != null) {
synchronized (lock) {
myClassModel = null;
- myActionModel = null;
- myActions = null;
+ myActionProvider = null;
mySymbolsModel = null;
myConfigurables.clear();
myFocusComponent = null;
diff --git a/platform/lang-impl/src/com/intellij/ide/projectView/ProjectViewPsiTreeChangeListener.java b/platform/lang-impl/src/com/intellij/ide/projectView/ProjectViewPsiTreeChangeListener.java
index 58bef64556c2..e2c79cffef46 100644
--- a/platform/lang-impl/src/com/intellij/ide/projectView/ProjectViewPsiTreeChangeListener.java
+++ b/platform/lang-impl/src/com/intellij/ide/projectView/ProjectViewPsiTreeChangeListener.java
@@ -125,8 +125,10 @@ public abstract class ProjectViewPsiTreeChangeListener extends PsiTreeChangeAdap
updater.addSubtreeToUpdate(rootNode);
return;
}
-
- updater.addSubtreeToUpdateByElement(element);
+ final PsiElement parent = element.getParent();
+ if (parent == null || !updater.addSubtreeToUpdateByElement(parent)) {
+ updater.addSubtreeToUpdateByElement(element);
+ }
}
else if (propertyName.equals(PsiTreeChangeEvent.PROP_FILE_TYPES)){
updater.addSubtreeToUpdate(rootNode);
diff --git a/platform/lang-impl/src/com/intellij/ide/projectView/actions/MarkExcludeRootAction.java b/platform/lang-impl/src/com/intellij/ide/projectView/actions/MarkExcludeRootAction.java
index 85964857c5d0..2e55b4aee11a 100644
--- a/platform/lang-impl/src/com/intellij/ide/projectView/actions/MarkExcludeRootAction.java
+++ b/platform/lang-impl/src/com/intellij/ide/projectView/actions/MarkExcludeRootAction.java
@@ -21,6 +21,7 @@ import com.intellij.openapi.module.Module;
import com.intellij.openapi.roots.ContentEntry;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.util.io.FileUtil;
+import com.intellij.openapi.util.registry.Registry;
import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.annotations.NotNull;
@@ -32,11 +33,13 @@ public class MarkExcludeRootAction extends MarkRootActionBase {
public void actionPerformed(AnActionEvent e) {
VirtualFile[] files = e.getData(CommonDataKeys.VIRTUAL_FILE_ARRAY);
- String message = files.length == 1 ? FileUtil.toSystemDependentName(files[0].getPath()) : files.length + " selected files";
- final int rc = Messages.showOkCancelDialog(e.getData(CommonDataKeys.PROJECT), getPromptText(message), "Mark as Excluded",
- Messages.getQuestionIcon());
- if (rc != Messages.OK) {
- return;
+ if (Registry.is("ide.hide.excluded.files")) {
+ String message = files.length == 1 ? FileUtil.toSystemDependentName(files[0].getPath()) : files.length + " selected files";
+ final int rc = Messages.showOkCancelDialog(e.getData(CommonDataKeys.PROJECT), getPromptText(message), "Mark as Excluded",
+ Messages.getQuestionIcon());
+ if (rc != Messages.OK) {
+ return;
+ }
}
super.actionPerformed(e);
}
diff --git a/platform/lang-impl/src/com/intellij/ide/projectView/actions/MarkRootActionBase.java b/platform/lang-impl/src/com/intellij/ide/projectView/actions/MarkRootActionBase.java
index 815c3e8815ac..ac2326da6dac 100644
--- a/platform/lang-impl/src/com/intellij/ide/projectView/actions/MarkRootActionBase.java
+++ b/platform/lang-impl/src/com/intellij/ide/projectView/actions/MarkRootActionBase.java
@@ -22,7 +22,9 @@ import com.intellij.openapi.actionSystem.LangDataKeys;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.project.DumbAwareAction;
+import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.*;
+import com.intellij.openapi.roots.impl.DirectoryIndex;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.vfs.VfsUtilCore;
import com.intellij.openapi.vfs.VirtualFile;
@@ -38,23 +40,24 @@ import java.util.List;
public abstract class MarkRootActionBase extends DumbAwareAction {
@Override
public void actionPerformed(AnActionEvent e) {
- final Module module = e.getData(LangDataKeys.MODULE);
- VirtualFile[] vFiles = e.getData(CommonDataKeys.VIRTUAL_FILE_ARRAY);
- if (module == null || vFiles == null) {
+ VirtualFile[] files = e.getData(CommonDataKeys.VIRTUAL_FILE_ARRAY);
+ final Module module = getModule(e, files);
+ if (module == null) {
return;
}
+
final ModifiableRootModel model = ModuleRootManager.getInstance(module).getModifiableModel();
- for (VirtualFile vFile : vFiles) {
- ContentEntry entry = findContentEntry(model, vFile);
+ for (VirtualFile file : files) {
+ ContentEntry entry = findContentEntry(model, file);
if (entry != null) {
final SourceFolder[] sourceFolders = entry.getSourceFolders();
for (SourceFolder sourceFolder : sourceFolders) {
- if (Comparing.equal(sourceFolder.getFile(), vFile)) {
+ if (Comparing.equal(sourceFolder.getFile(), file)) {
entry.removeSourceFolder(sourceFolder);
break;
}
}
- modifyRoots(vFile, entry);
+ modifyRoots(file, entry);
}
}
ApplicationManager.getApplication().runWriteAction(new Runnable() {
@@ -66,7 +69,7 @@ public abstract class MarkRootActionBase extends DumbAwareAction {
});
}
- protected abstract void modifyRoots(VirtualFile vFile, ContentEntry entry);
+ protected abstract void modifyRoots(VirtualFile file, ContentEntry entry);
@Nullable
public static ContentEntry findContentEntry(@NotNull ModuleRootModel model, @NotNull VirtualFile vFile) {
@@ -82,21 +85,22 @@ public abstract class MarkRootActionBase extends DumbAwareAction {
@Override
public void update(AnActionEvent e) {
- Module module = e.getData(LangDataKeys.MODULE);
RootsSelection selection = getSelection(e);
- boolean enabled = module != null && (!selection.mySelectedRoots.isEmpty() || !selection.mySelectedDirectories.isEmpty()) && isEnabled(selection, module);
- e.getPresentation().setVisible(enabled);
- e.getPresentation().setEnabled(enabled);
+ doUpdate(e, e.getData(LangDataKeys.MODULE), selection);
+ }
+
+ protected void doUpdate(@NotNull AnActionEvent e, @Nullable Module module, @NotNull RootsSelection selection) {
+ boolean enabled = module != null && (!selection.mySelectedRoots.isEmpty() || !selection.mySelectedDirectories.isEmpty())
+ && selection.mySelectedExcludeRoots.isEmpty() && isEnabled(selection, module);
+ e.getPresentation().setEnabledAndVisible(enabled);
}
protected abstract boolean isEnabled(@NotNull RootsSelection selection, @NotNull Module module);
protected static RootsSelection getSelection(AnActionEvent e) {
- Module module = e.getData(LangDataKeys.MODULE);
VirtualFile[] files = e.getData(CommonDataKeys.VIRTUAL_FILE_ARRAY);
- if (module == null || files == null) {
- return RootsSelection.EMPTY;
- }
+ Module module = getModule(e, files);
+ if (module == null) return RootsSelection.EMPTY;
RootsSelection selection = new RootsSelection();
final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(module.getProject()).getFileIndex();
@@ -105,7 +109,14 @@ public abstract class MarkRootActionBase extends DumbAwareAction {
return RootsSelection.EMPTY;
}
if (!fileIndex.isInContent(file)) {
- return RootsSelection.EMPTY;
+ ExcludeFolder excludeFolder = ProjectRootsUtil.findExcludeFolder(module, file);
+ if (excludeFolder != null) {
+ selection.mySelectedExcludeRoots.add(excludeFolder);
+ continue;
+ }
+ else {
+ return RootsSelection.EMPTY;
+ }
}
SourceFolder folder;
if (Comparing.equal(fileIndex.getSourceRootForFile(file), file) && ((folder = ProjectRootsUtil.findSourceFolder(module, file)) != null)) {
@@ -121,10 +132,39 @@ public abstract class MarkRootActionBase extends DumbAwareAction {
return selection;
}
+ @Nullable
+ private static Module getModule(@NotNull AnActionEvent e, @Nullable VirtualFile[] files) {
+ if (files == null) return null;
+ Module module = e.getData(LangDataKeys.MODULE);
+ if (module == null) {
+ module = findParentModule(e.getProject(), files);
+ }
+ return module;
+ }
+
+ @Nullable
+ private static Module findParentModule(@Nullable Project project, @NotNull VirtualFile[] files) {
+ if (project == null) return null;
+ Module result = null;
+ DirectoryIndex index = DirectoryIndex.getInstance(project);
+ for (VirtualFile file : files) {
+ Module module = index.getInfoForFile(file).getModule();
+ if (module == null) return null;
+ if (result == null) {
+ result = module;
+ }
+ else if (!result.equals(module)) {
+ return null;
+ }
+ }
+ return result;
+ }
+
protected static class RootsSelection {
public static final RootsSelection EMPTY = new RootsSelection();
public List<SourceFolder> mySelectedRoots = new ArrayList<SourceFolder>();
+ public List<ExcludeFolder> mySelectedExcludeRoots = new ArrayList<ExcludeFolder>();
public List<VirtualFile> mySelectedDirectories = new ArrayList<VirtualFile>();
public boolean myHaveSelectedFilesUnderSourceRoots;
}
diff --git a/platform/lang-impl/src/com/intellij/ide/projectView/actions/UnmarkRootAction.java b/platform/lang-impl/src/com/intellij/ide/projectView/actions/UnmarkRootAction.java
index cf2724dc039f..0689fe13c2d3 100644
--- a/platform/lang-impl/src/com/intellij/ide/projectView/actions/UnmarkRootAction.java
+++ b/platform/lang-impl/src/com/intellij/ide/projectView/actions/UnmarkRootAction.java
@@ -18,12 +18,15 @@ package com.intellij.ide.projectView.actions;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.roots.ContentEntry;
+import com.intellij.openapi.roots.ExcludeFolder;
import com.intellij.openapi.roots.SourceFolder;
import com.intellij.openapi.roots.ui.configuration.ModuleSourceRootEditHandler;
+import com.intellij.openapi.util.registry.Registry;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.containers.HashSet;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
import org.jetbrains.jps.model.module.JpsModuleSourceRootType;
import java.util.Set;
@@ -33,9 +36,16 @@ import java.util.Set;
*/
public class UnmarkRootAction extends MarkRootActionBase {
@Override
- public void update(AnActionEvent e) {
- super.update(e);
- RootsSelection selection = getSelection(e);
+ protected void doUpdate(@NotNull AnActionEvent e, @Nullable Module module, @NotNull RootsSelection selection) {
+ if (!Registry.is("ide.hide.excluded.files") && !selection.mySelectedExcludeRoots.isEmpty()
+ && selection.mySelectedDirectories.isEmpty() && selection.mySelectedRoots.isEmpty()) {
+ e.getPresentation().setEnabledAndVisible(true);
+ e.getPresentation().setText("Cancel Exclusion");
+ return;
+ }
+
+ super.doUpdate(e, module, selection);
+
Set<JpsModuleSourceRootType<?>> selectedRootTypes = new HashSet<JpsModuleSourceRootType<?>>();
for (SourceFolder root : selection.mySelectedRoots) {
selectedRootTypes.add(root.getRootType());
@@ -60,6 +70,12 @@ public class UnmarkRootAction extends MarkRootActionBase {
return selection.mySelectedDirectories.isEmpty() && !selection.mySelectedRoots.isEmpty();
}
- protected void modifyRoots(VirtualFile vFile, ContentEntry entry) {
+ protected void modifyRoots(VirtualFile file, ContentEntry entry) {
+ for (ExcludeFolder excludeFolder : entry.getExcludeFolders()) {
+ if (file.equals(excludeFolder.getFile())) {
+ entry.removeExcludeFolder(excludeFolder);
+ break;
+ }
+ }
}
}
diff --git a/platform/lang-impl/src/com/intellij/ide/projectView/impl/nodes/ProjectViewDirectoryHelper.java b/platform/lang-impl/src/com/intellij/ide/projectView/impl/nodes/ProjectViewDirectoryHelper.java
index ee05f0a10283..13ba91900521 100644
--- a/platform/lang-impl/src/com/intellij/ide/projectView/impl/nodes/ProjectViewDirectoryHelper.java
+++ b/platform/lang-impl/src/com/intellij/ide/projectView/impl/nodes/ProjectViewDirectoryHelper.java
@@ -25,6 +25,7 @@ import com.intellij.ide.projectView.ViewSettings;
import com.intellij.ide.util.treeView.AbstractTreeNode;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.openapi.fileTypes.FileTypeRegistry;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.ModuleFileIndex;
@@ -32,7 +33,9 @@ import com.intellij.openapi.roots.ModuleRootManager;
import com.intellij.openapi.roots.ProjectFileIndex;
import com.intellij.openapi.roots.ProjectRootManager;
import com.intellij.openapi.roots.impl.DirectoryIndex;
+import com.intellij.openapi.roots.impl.DirectoryInfo;
import com.intellij.openapi.util.Comparing;
+import com.intellij.openapi.util.registry.Registry;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiDirectory;
import com.intellij.psi.PsiElement;
@@ -123,7 +126,7 @@ public class ProjectViewDirectoryHelper {
final Module module = fileIndex.getModuleForFile(psiDirectory.getVirtualFile());
final ModuleFileIndex moduleFileIndex = module == null ? null : ModuleRootManager.getInstance(module).getFileIndex();
if (!settings.isFlattenPackages() || skipDirectory(psiDirectory)) {
- processPsiDirectoryChildren(psiDirectory, directoryChildrenInProject(psiDirectory),
+ processPsiDirectoryChildren(psiDirectory, directoryChildrenInProject(fileIndex, psiDirectory),
children, fileIndex, null, settings, withSubDirectories);
}
else { // source directory in "flatten packages" mode
@@ -137,7 +140,13 @@ public class ProjectViewDirectoryHelper {
continue;
}
VirtualFile directoryFile = subdir.getVirtualFile();
- if (fileIndex.isIgnored(directoryFile)) continue;
+
+ if (Registry.is("ide.hide.excluded.files")) {
+ if (fileIndex.isExcluded(directoryFile)) continue;
+ }
+ else {
+ if (FileTypeRegistry.getInstance().isFileIgnored(directoryFile)) continue;
+ }
if (withSubDirectories) {
children.add(new PsiDirectoryNode(project, subdir, settings));
@@ -163,9 +172,9 @@ public class ProjectViewDirectoryHelper {
return topLevelContentRoots;
}
- private PsiElement[] directoryChildrenInProject(PsiDirectory psiDirectory) {
+ private PsiElement[] directoryChildrenInProject(ProjectFileIndex fileIndex, PsiDirectory psiDirectory) {
VirtualFile dir = psiDirectory.getVirtualFile();
- if (myIndex.getInfoForDirectory(dir) != null) {
+ if (isInProject(dir)) {
return psiDirectory.getChildren();
}
@@ -189,6 +198,16 @@ public class ProjectViewDirectoryHelper {
return PsiUtilCore.toPsiElementArray(directoriesOnTheWayToContentRoots);
}
+ private boolean isInProject(VirtualFile dir) {
+ DirectoryInfo directoryInfo = myIndex.getInfoForFile(dir);
+ if (directoryInfo.isInProject()) return true;
+
+ if (!Registry.is("ide.hide.excluded.files")) {
+ return directoryInfo.isExcluded();
+ }
+ return false;
+ }
+
// used only for non-flatten packages mode
public void processPsiDirectoryChildren(final PsiDirectory psiDir,
PsiElement[] children,
@@ -211,7 +230,7 @@ public class ProjectViewDirectoryHelper {
vFile = dir.getVirtualFile();
if (!vFile.equals(projectFileIndex.getSourceRootForFile(vFile))) { // if is not a source root
if (viewSettings.isHideEmptyMiddlePackages() && !skipDirectory(psiDir) && isEmptyMiddleDirectory(dir, true)) {
- processPsiDirectoryChildren(dir, directoryChildrenInProject(dir),
+ processPsiDirectoryChildren(dir, directoryChildrenInProject(projectFileIndex, dir),
container, projectFileIndex, moduleFileIndex, viewSettings, withSubDirectories); // expand it recursively
continue;
}
diff --git a/platform/lang-impl/src/com/intellij/ide/projectView/impl/nodes/PsiDirectoryNode.java b/platform/lang-impl/src/com/intellij/ide/projectView/impl/nodes/PsiDirectoryNode.java
index a010828cd8ec..16aa930b806a 100644
--- a/platform/lang-impl/src/com/intellij/ide/projectView/impl/nodes/PsiDirectoryNode.java
+++ b/platform/lang-impl/src/com/intellij/ide/projectView/impl/nodes/PsiDirectoryNode.java
@@ -26,6 +26,7 @@ import com.intellij.ide.projectView.impl.ProjectRootsUtil;
import com.intellij.ide.projectView.impl.ProjectViewImpl;
import com.intellij.ide.util.treeView.AbstractTreeNode;
import com.intellij.openapi.extensions.Extensions;
+import com.intellij.openapi.fileTypes.FileTypeRegistry;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleUtil;
import com.intellij.openapi.project.Project;
@@ -38,6 +39,7 @@ import com.intellij.openapi.roots.ui.configuration.ModuleSourceRootEditHandler;
import com.intellij.openapi.roots.ui.configuration.ProjectSettingsService;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.io.FileUtil;
+import com.intellij.openapi.util.registry.Registry;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VFileProperty;
import com.intellij.openapi.vfs.VfsUtilCore;
@@ -183,9 +185,14 @@ public class PsiDirectoryNode extends BasePsiNode<PsiDirectory> implements Navig
return false;
}
- final Project project = value.getProject();
- final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex();
- return !fileIndex.isIgnored(file);
+ if (Registry.is("ide.hide.excluded.files")) {
+ final Project project = value.getProject();
+ final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex();
+ return !fileIndex.isExcluded(file);
+ }
+ else {
+ return !FileTypeRegistry.getInstance().isFileIgnored(file);
+ }
}
@Override
diff --git a/platform/lang-impl/src/com/intellij/ide/ui/search/TraverseUIStarter.java b/platform/lang-impl/src/com/intellij/ide/ui/search/TraverseUIStarter.java
index b1c1e25e978c..eb22b72eb810 100644
--- a/platform/lang-impl/src/com/intellij/ide/ui/search/TraverseUIStarter.java
+++ b/platform/lang-impl/src/com/intellij/ide/ui/search/TraverseUIStarter.java
@@ -129,7 +129,7 @@ public class TraverseUIStarter implements ApplicationStarter {
System.out.println("Searchable options index builder completed");
- ((ApplicationEx)ApplicationManager.getApplication()).exit(true);
+ ((ApplicationEx)ApplicationManager.getApplication()).exit(true, true);
}
private static void processFileTemplates(Element configurableElement) {
diff --git a/platform/lang-impl/src/com/intellij/ide/util/gotoByName/GotoActionItemProvider.java b/platform/lang-impl/src/com/intellij/ide/util/gotoByName/GotoActionItemProvider.java
new file mode 100644
index 000000000000..a6e6c8fdf658
--- /dev/null
+++ b/platform/lang-impl/src/com/intellij/ide/util/gotoByName/GotoActionItemProvider.java
@@ -0,0 +1,169 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.ide.util.gotoByName;
+
+import com.intellij.ide.DataManager;
+import com.intellij.ide.actions.ApplyIntentionAction;
+import com.intellij.ide.ui.search.ActionFromOptionDescriptorProvider;
+import com.intellij.ide.ui.search.OptionDescription;
+import com.intellij.ide.ui.search.SearchableOptionsRegistrar;
+import com.intellij.ide.ui.search.SearchableOptionsRegistrarImpl;
+import com.intellij.openapi.actionSystem.ActionManager;
+import com.intellij.openapi.actionSystem.AnAction;
+import com.intellij.openapi.actionSystem.DataContext;
+import com.intellij.openapi.actionSystem.impl.ActionManagerImpl;
+import com.intellij.openapi.progress.ProgressIndicator;
+import com.intellij.util.Function;
+import com.intellij.util.Processor;
+import com.intellij.util.containers.ContainerUtil;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.*;
+
+import static com.intellij.ide.util.gotoByName.GotoActionModel.*;
+
+/**
+ * @author peter
+ */
+public class GotoActionItemProvider implements ChooseByNameItemProvider {
+ private final ActionManager myActionManager = ActionManager.getInstance();
+ protected final SearchableOptionsRegistrar myIndex = SearchableOptionsRegistrar.getInstance();
+ private final GotoActionModel myModel;
+
+ public GotoActionItemProvider(GotoActionModel model) {
+ myModel = model;
+ }
+
+ @NotNull
+ @Override
+ public List<String> filterNames(@NotNull ChooseByNameBase base, @NotNull String[] names, @NotNull String pattern) {
+ return Collections.emptyList(); // no common prefix insertion in goto action
+ }
+
+ @Override
+ public boolean filterElements(@NotNull final ChooseByNameBase base,
+ @NotNull final String pattern,
+ boolean everywhere,
+ @NotNull ProgressIndicator cancelled,
+ @NotNull final Processor<Object> consumer) {
+ return filterElements(pattern, everywhere, new Processor<MatchedValue>() {
+ @Override
+ public boolean process(MatchedValue value) {
+ return consumer.process(value);
+ }
+ });
+ }
+
+ public boolean filterElements(String pattern, boolean everywhere, Processor<MatchedValue> consumer) {
+ DataContext dataContext = DataManager.getInstance().getDataContext(myModel.getContextComponent());
+
+ if (!processIntentions(pattern, consumer, dataContext)) return false;
+ if (!processActions(pattern, everywhere, consumer, dataContext)) return false;
+ if (!processOptions(pattern, consumer, dataContext)) return false;
+
+ return true;
+ }
+
+ private boolean processOptions(String pattern, Processor<MatchedValue> consumer, DataContext dataContext) {
+ List<Comparable> options = ContainerUtil.newArrayList();
+ final Set<String> words = myIndex.getProcessedWords(pattern);
+ Set<OptionDescription> optionDescriptions = null;
+ final String actionManagerName = myActionManager.getComponentName();
+ for (String word : words) {
+ final Set<OptionDescription> descriptions = ((SearchableOptionsRegistrarImpl)myIndex).getAcceptableDescriptions(word);
+ if (descriptions != null) {
+ for (Iterator<OptionDescription> iterator = descriptions.iterator(); iterator.hasNext(); ) {
+ OptionDescription description = iterator.next();
+ if (actionManagerName.equals(description.getPath())) {
+ iterator.remove();
+ }
+ }
+ if (!descriptions.isEmpty()) {
+ if (optionDescriptions == null) {
+ optionDescriptions = descriptions;
+ }
+ else {
+ optionDescriptions.retainAll(descriptions);
+ }
+ }
+ } else {
+ optionDescriptions = null;
+ break;
+ }
+ }
+ if (optionDescriptions != null && !optionDescriptions.isEmpty()) {
+ Set<String> currentHits = new HashSet<String>();
+ for (Iterator<OptionDescription> iterator = optionDescriptions.iterator(); iterator.hasNext(); ) {
+ OptionDescription description = iterator.next();
+ final String hit = description.getHit();
+ if (hit == null || !currentHits.add(hit.trim())) {
+ iterator.remove();
+ }
+ }
+ for (OptionDescription description : optionDescriptions) {
+ for (ActionFromOptionDescriptorProvider converter : ActionFromOptionDescriptorProvider.EP.getExtensions()) {
+ AnAction action = converter.provide(description);
+ if (action != null) options.add(new ActionWrapper(action, null, MatchMode.NAME, dataContext));
+ options.add(description);
+ }
+ }
+ }
+ return processItems(pattern, options, consumer);
+ }
+
+ private boolean processActions(String pattern, boolean everywhere, Processor<MatchedValue> consumer, DataContext dataContext) {
+ List<AnAction> actions = ContainerUtil.newArrayList();
+ if (everywhere) {
+ for (String id : ((ActionManagerImpl)myActionManager).getActionIds()) {
+ ContainerUtil.addIfNotNull(actions, myActionManager.getAction(id));
+ }
+ } else {
+ actions.addAll(myModel.myActionsMap.keySet());
+ }
+
+ List<ActionWrapper> actionWrappers = ContainerUtil.newArrayList();
+ for (AnAction action : actions) {
+ MatchMode mode = myModel.actionMatches(pattern, action);
+ if (mode != MatchMode.NONE) {
+ actionWrappers.add(new ActionWrapper(action, myModel.myActionsMap.get(action), mode, dataContext));
+ }
+ }
+ return processItems(pattern, actionWrappers, consumer);
+ }
+
+ private boolean processIntentions(String pattern, Processor<MatchedValue> consumer, DataContext dataContext) {
+ List<ActionWrapper> intentions = ContainerUtil.newArrayList();
+ for (String intentionText : myModel.myIntentions.keySet()) {
+ final ApplyIntentionAction intentionAction = myModel.myIntentions.get(intentionText);
+ if (myModel.actionMatches(pattern, intentionAction) != MatchMode.NONE) {
+ intentions.add(new ActionWrapper(intentionAction, intentionText, MatchMode.INTENTION, dataContext));
+ }
+ }
+ return processItems(pattern, intentions, consumer);
+ }
+
+ private static boolean processItems(final String pattern, List<? extends Comparable> items, Processor<MatchedValue> consumer) {
+ List<MatchedValue> matched = ContainerUtil.map(items, new Function<Comparable, MatchedValue>() {
+ @Override
+ public MatchedValue fun(Comparable comparable) {
+ return new MatchedValue(comparable, pattern);
+ }
+ });
+ Collections.sort(matched);
+ return ContainerUtil.process(matched, consumer);
+ }
+
+}
diff --git a/platform/lang-impl/src/com/intellij/ide/util/gotoByName/GotoActionModel.java b/platform/lang-impl/src/com/intellij/ide/util/gotoByName/GotoActionModel.java
index 45fe6a9a074c..91f0d3368521 100644
--- a/platform/lang-impl/src/com/intellij/ide/util/gotoByName/GotoActionModel.java
+++ b/platform/lang-impl/src/com/intellij/ide/util/gotoByName/GotoActionModel.java
@@ -16,34 +16,28 @@
package com.intellij.ide.util.gotoByName;
-import com.intellij.ide.DataManager;
import com.intellij.ide.IdeBundle;
import com.intellij.ide.actions.ApplyIntentionAction;
-import com.intellij.ide.ui.search.ActionFromOptionDescriptorProvider;
+import com.intellij.ide.actions.ShowSettingsUtilImpl;
import com.intellij.ide.ui.search.OptionDescription;
import com.intellij.ide.ui.search.SearchableOptionsRegistrar;
-import com.intellij.ide.ui.search.SearchableOptionsRegistrarImpl;
import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.actionSystem.ex.ActionUtil;
-import com.intellij.openapi.actionSystem.impl.ActionManagerImpl;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.keymap.KeymapManager;
import com.intellij.openapi.keymap.KeymapUtil;
import com.intellij.openapi.options.Configurable;
import com.intellij.openapi.options.SearchableConfigurable;
-import com.intellij.openapi.options.ex.IdeConfigurablesGroup;
-import com.intellij.openapi.options.ex.ProjectConfigurablesGroup;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.SystemInfo;
+import com.intellij.openapi.util.TextRange;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.PsiFile;
-import com.intellij.ui.ColorUtil;
-import com.intellij.ui.IdeBorderFactory;
-import com.intellij.ui.LayeredIcon;
-import com.intellij.ui.LightColors;
+import com.intellij.ui.*;
import com.intellij.ui.components.JBLabel;
+import com.intellij.ui.speedSearch.SpeedSearchUtil;
import com.intellij.util.ArrayUtil;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.ui.EmptyIcon;
@@ -58,9 +52,10 @@ import java.awt.*;
import java.util.*;
import java.util.List;
+import static com.intellij.ui.SimpleTextAttributes.STYLE_PLAIN;
+import static com.intellij.ui.SimpleTextAttributes.STYLE_SEARCH_MATCH;
+
public class GotoActionModel implements ChooseByNameModel, CustomMatcherModel, Comparator<Object>, EdtSortingModel {
- @NonNls public static final String SETTINGS_KEY = "$$$SETTINGS$$$";
- @NonNls public static final String INTENTIONS_KEY = "$$$INTENTIONS_KEY$$$";
@Nullable private final Project myProject;
private final Component myContextComponent;
@@ -103,10 +98,7 @@ public class GotoActionModel implements ChooseByNameModel, CustomMatcherModel, C
}
}
myIndex = SearchableOptionsRegistrar.getInstance();
- fillConfigurablesNames(new IdeConfigurablesGroup().getConfigurables());
- if (project != null) {
- fillConfigurablesNames(new ProjectConfigurablesGroup(project).getConfigurables());
- }
+ fillConfigurablesNames(ShowSettingsUtilImpl.getConfigurables(project, true));
}
private void fillConfigurablesNames(Configurable[] configurables) {
@@ -151,13 +143,61 @@ public class GotoActionModel implements ChooseByNameModel, CustomMatcherModel, C
public void saveInitialCheckBoxState(boolean state) {
}
+ public static class MatchedValue implements Comparable<MatchedValue> {
+ @NotNull public final Comparable value;
+ @NotNull final String pattern;
+
+ MatchedValue(@NotNull Comparable value, @NotNull String pattern) {
+ this.value = value;
+ this.pattern = pattern;
+ }
+
+ @Nullable
+ private String getValueText() {
+ if (value instanceof OptionDescription) return ((OptionDescription)value).getHit();
+ if (!(value instanceof ActionWrapper)) return null;
+ return ((ActionWrapper)value).getAction().getTemplatePresentation().getText();
+ }
+
+ private int getMatchingDegree() {
+ String text = getValueText();
+ if (text != null) {
+ if (StringUtil.equalsIgnoreCase(StringUtil.trimEnd(text, "..."), pattern)) return 3;
+ if (StringUtil.startsWithIgnoreCase(text, pattern)) return 2;
+ if (StringUtil.containsIgnoreCase(text, pattern)) return 1;
+ }
+ return 0;
+ }
+
+ @Override
+ public int compareTo(@NotNull MatchedValue o) {
+ if (value instanceof OptionDescription && !(o.value instanceof OptionDescription)) {
+ return 1;
+ }
+ if (o.value instanceof OptionDescription && !(value instanceof OptionDescription)) {
+ return -1;
+ }
+
+ if (value instanceof ActionWrapper && o.value instanceof ActionWrapper && ApplicationManager.getApplication().isDispatchThread()) {
+ boolean p1Enable = ((ActionWrapper)value).isAvailable();
+ boolean p2enable = ((ActionWrapper)o.value).isAvailable();
+ if (p1Enable && !p2enable) return -1;
+ if (!p1Enable && p2enable) return 1;
+ }
+
+ int diff = o.getMatchingDegree() - getMatchingDegree();
+ //noinspection unchecked
+ return diff != 0 ? diff : value.compareTo(o.value);
+ }
+ }
+
@Override
public ListCellRenderer getListCellRenderer() {
return new DefaultListCellRenderer() {
@Override
public Component getListCellRendererComponent(@NotNull final JList list,
- final Object value,
+ final Object matchedValue,
final int index, final boolean isSelected, final boolean cellHasFocus) {
final JPanel panel = new JPanel(new BorderLayout());
panel.setBorder(IdeBorderFactory.createEmptyBorder(2));
@@ -165,21 +205,40 @@ public class GotoActionModel implements ChooseByNameModel, CustomMatcherModel, C
Color bg = UIUtil.getListBackground(isSelected);
panel.setBackground(bg);
+ if (matchedValue instanceof String) { //...
+ final JBLabel label = new JBLabel((String)matchedValue);
+ label.setIcon(EMPTY_ICON);
+ panel.add(label, BorderLayout.WEST);
+ return panel;
+ }
+
Color groupFg = isSelected ? UIUtil.getListSelectionForeground() : UIUtil.getLabelDisabledForeground();
+ Object value = ((MatchedValue) matchedValue).value;
+ String pattern = ((MatchedValue)matchedValue).pattern;
+
+ SimpleColoredComponent nameComponent = new SimpleColoredComponent();
+ nameComponent.setBackground(bg);
+ panel.add(nameComponent, BorderLayout.CENTER);
+
if (value instanceof ActionWrapper) {
final ActionWrapper actionWithParentGroup = (ActionWrapper)value;
final AnAction anAction = actionWithParentGroup.getAction();
final Presentation templatePresentation = anAction.getTemplatePresentation();
- final Icon icon = templatePresentation.getIcon();
final Color fg = defaultActionForeground(isSelected, actionWithParentGroup.getPresentation());
- final JLabel actionLabel = createActionLabel(anAction, templatePresentation.getText(), fg, bg, icon);
- panel.add(actionLabel, BorderLayout.WEST);
+ panel.add(createIconLabel(templatePresentation.getIcon()), BorderLayout.WEST);
+
+ appendWithColoredMatches(nameComponent, templatePresentation.getText(), pattern, fg, isSelected);
- final String groupName = actionWithParentGroup.getGroupName();
+ final Shortcut shortcut = preferKeyboardShortcut(KeymapManager.getInstance().getActiveKeymap().getShortcuts(getActionId(anAction)));
+ if (shortcut != null) {
+ nameComponent.append(" (" + KeymapUtil.getShortcutText(shortcut) + ")", new SimpleTextAttributes(STYLE_PLAIN, groupFg));
+ }
+
+ String groupName = actionWithParentGroup.getAction() instanceof ApplyIntentionAction ? null : actionWithParentGroup.getGroupName();
if (groupName != null) {
final JLabel groupLabel = new JLabel(groupName);
groupLabel.setBackground(bg);
@@ -189,7 +248,9 @@ public class GotoActionModel implements ChooseByNameModel, CustomMatcherModel, C
}
else if (value instanceof OptionDescription) {
if (!isSelected) {
- panel.setBackground(UIUtil.isUnderDarcula() ? ColorUtil.brighter(UIUtil.getListBackground(), 1) : LightColors.SLIGHTLY_GRAY);
+ Color descriptorBg = UIUtil.isUnderDarcula() ? ColorUtil.brighter(UIUtil.getListBackground(), 1) : LightColors.SLIGHTLY_GRAY;
+ panel.setBackground(descriptorBg);
+ nameComponent.setBackground(descriptorBg);
}
String hit = ((OptionDescription)value).getHit();
if (hit == null) {
@@ -200,23 +261,31 @@ public class GotoActionModel implements ChooseByNameModel, CustomMatcherModel, C
hit = hit.replace(" ", " "); //avoid extra spaces from mnemonics and xml conversion
final Color fg = UIUtil.getListForeground(isSelected);
- final JLabel label = new JLabel(hit.trim());
- label.setIcon(EMPTY_ICON);
- label.setForeground(fg);
- label.setBackground(bg);
- panel.add(label, BorderLayout.WEST);
+
+ appendWithColoredMatches(nameComponent, hit.trim(), pattern, fg, isSelected);
+
+ panel.add(new JLabel(EMPTY_ICON), BorderLayout.WEST);
+
final JLabel settingsLabel = new JLabel(getGroupName((OptionDescription)value));
settingsLabel.setForeground(groupFg);
settingsLabel.setBackground(bg);
panel.add(settingsLabel, BorderLayout.EAST);
}
- else if (value instanceof String) {
- final JBLabel label = new JBLabel((String)value);
- label.setIcon(EMPTY_ICON);
- panel.add(label, BorderLayout.WEST);
- }
return panel;
}
+
+ private void appendWithColoredMatches(SimpleColoredComponent nameComponent, String name, String pattern, Color fg, boolean selected) {
+ final SimpleTextAttributes plain = new SimpleTextAttributes(STYLE_PLAIN, fg);
+ final SimpleTextAttributes highlighted = new SimpleTextAttributes(null, fg, null, STYLE_SEARCH_MATCH);
+ List<TextRange> fragments = ContainerUtil.newArrayList();
+ if (selected) {
+ int matchStart = StringUtil.indexOfIgnoreCase(name, pattern, 0);
+ if (matchStart >= 0) {
+ fragments.add(TextRange.from(matchStart, pattern.length()));
+ }
+ }
+ SpeedSearchUtil.appendColoredFragments(nameComponent, name, fragments, plain, highlighted);
+ }
};
}
@@ -224,6 +293,18 @@ public class GotoActionModel implements ChooseByNameModel, CustomMatcherModel, C
return myActionManager.getId(anAction);
}
+ private static JLabel createIconLabel(final Icon icon) {
+ final LayeredIcon layeredIcon = new LayeredIcon(2);
+ layeredIcon.setIcon(EMPTY_ICON, 0);
+ if (icon != null && icon.getIconWidth() <= EMPTY_ICON.getIconWidth() && icon.getIconHeight() <= EMPTY_ICON.getIconHeight()) {
+ layeredIcon
+ .setIcon(icon, 1, (-icon.getIconWidth() + EMPTY_ICON.getIconWidth()) / 2, (EMPTY_ICON.getIconHeight() - icon.getIconHeight()) / 2);
+ }
+
+ return new JLabel(layeredIcon);
+ }
+
+
protected JLabel createActionLabel(final AnAction anAction, final String anActionName,
final Color fg, final Color bg,
final Icon icon) {
@@ -256,23 +337,7 @@ public class GotoActionModel implements ChooseByNameModel, CustomMatcherModel, C
public int compare(@NotNull Object o1, @NotNull Object o2) {
if (ChooseByNameBase.EXTRA_ELEM.equals(o1)) return 1;
if (ChooseByNameBase.EXTRA_ELEM.equals(o2)) return -1;
-
- if (o1 instanceof OptionDescription && !(o2 instanceof OptionDescription)) {
- return 1;
- }
- if (o2 instanceof OptionDescription && !(o1 instanceof OptionDescription)) {
- return -1;
- }
-
- if (o1 instanceof OptionDescription) {
- return ((OptionDescription)o1).compareTo(o2);
- }
-
- if (o1 instanceof ActionWrapper && o2 instanceof ActionWrapper) {
- return ((ActionWrapper)o1).compareTo((ActionWrapper)o2);
- }
-
- return StringUtil.compare(getFullName(o1), getFullName(o2), true);
+ return ((MatchedValue) o1).compareTo((MatchedValue)o2);
}
public static AnActionEvent updateActionBeforeShow(AnAction anAction, DataContext dataContext) {
@@ -293,107 +358,17 @@ public class GotoActionModel implements ChooseByNameModel, CustomMatcherModel, C
@Override
@NotNull
public String[] getNames(boolean checkBoxState) {
- final LinkedHashSet<String> result = new LinkedHashSet<String>();
- result.add(INTENTIONS_KEY);
- for (AnAction action : myActionsMap.keySet()) {
- result.add(getActionId(action));
- }
- if (checkBoxState) {
- final Set<String> ids = ((ActionManagerImpl)myActionManager).getActionIds();
- for (String id : ids) {
- result.add(id);
- }
- }
- result.add(SETTINGS_KEY);
- return ArrayUtil.toStringArray(result);
+ return ArrayUtil.EMPTY_STRING_ARRAY;
}
@Override
@NotNull
public Object[] getElementsByName(final String id, final boolean checkBoxState, final String pattern) {
- List<Object> objects = new ArrayList<Object>();
- final AnAction act = myActionManager.getAction(id);
- DataContext dataContext = DataManager.getInstance().getDataContext(myContextComponent);
- if (act != null) {
- final HashMap<AnAction, String> map = new HashMap<AnAction, String>();
- final MatchMode matchMode = actionMatches(pattern, act);
- final String groupName = myActionsMap.get(act);
- if (map.put(act, groupName) == null) {
- objects.add(new ActionWrapper(act, groupName, matchMode, dataContext));
- }
- if (checkBoxState) {
- final Set<String> ids = ((ActionManagerImpl)myActionManager).getActionIds();
- for (AnAction action : map.keySet()) { //do not add already included actions
- ids.remove(getActionId(action));
- }
- if (ids.contains(id)) {
- final AnAction anAction = myActionManager.getAction(id);
- map.put(anAction, null);
- if (anAction != null) {
- objects.add(new ActionWrapper(anAction, null, MatchMode.NON_MENU, dataContext));
- }
- }
- }
- } else if (Comparing.strEqual(id, INTENTIONS_KEY)) {
- for (String intentionText : myIntentions.keySet()) {
- final ApplyIntentionAction intentionAction = myIntentions.get(intentionText);
- if (actionMatches(pattern, intentionAction) != MatchMode.NONE) {
- objects.add(new ActionWrapper(intentionAction, intentionText, MatchMode.INTENTION, dataContext));
- }
- }
- }
- if (Comparing.strEqual(id, SETTINGS_KEY)) {
- final Set<String> words = myIndex.getProcessedWords(pattern);
- Set<OptionDescription> optionDescriptions = null;
- final String actionManagerName = myActionManager.getComponentName();
- for (String word : words) {
- final Set<OptionDescription> descriptions = ((SearchableOptionsRegistrarImpl)myIndex).getAcceptableDescriptions(word);
- if (descriptions != null) {
- for (Iterator<OptionDescription> iterator = descriptions.iterator(); iterator.hasNext(); ) {
- OptionDescription description = iterator.next();
- if (actionManagerName.equals(description.getPath())) {
- iterator.remove();
- }
- }
- if (!descriptions.isEmpty()) {
- if (optionDescriptions == null) {
- optionDescriptions = descriptions;
- }
- else {
- optionDescriptions.retainAll(descriptions);
- }
- }
- } else {
- optionDescriptions = null;
- break;
- }
- }
- if (optionDescriptions != null && !optionDescriptions.isEmpty()) {
- Set<String> currentHits = new HashSet<String>();
- for (Iterator<OptionDescription> iterator = optionDescriptions.iterator(); iterator.hasNext(); ) {
- OptionDescription description = iterator.next();
- final String hit = description.getHit();
- if (hit == null || !currentHits.add(hit.trim())) {
- iterator.remove();
- }
- }
- for (OptionDescription description : optionDescriptions) {
- for (ActionFromOptionDescriptorProvider converter : ActionFromOptionDescriptorProvider.EP.getExtensions()) {
- AnAction action = converter.provide(description);
- if (action != null) {
- String title = getGroupName(description);
- objects.add(new ActionWrapper(action, title, MatchMode.NAME, dataContext));
- }
- objects.add(description);
- }
- }
- }
- }
- return objects.toArray(new Object[objects.size()]);
+ return ArrayUtil.EMPTY_OBJECT_ARRAY;
}
@NotNull
- private String getGroupName(@NotNull OptionDescription description) {
+ String getGroupName(@NotNull OptionDescription description) {
String id = description.getConfigurableId();
String name = myConfigurablesNames.get(id);
String settings = SystemInfo.isMac ? "Preferences" : "Settings";
@@ -459,10 +434,8 @@ public class GotoActionModel implements ChooseByNameModel, CustomMatcherModel, C
}
@Override
- public String getElementName(final Object element) {
- if (element instanceof OptionDescription) return ((OptionDescription)element).getHit();
- if (!(element instanceof ActionWrapper)) return null;
- return ((ActionWrapper)element).getAction().getTemplatePresentation().getText();
+ public String getElementName(final Object mv) {
+ return ((MatchedValue) mv).getValueText();
}
@Override
@@ -485,7 +458,10 @@ public class GotoActionModel implements ChooseByNameModel, CustomMatcherModel, C
return MatchMode.DESCRIPTION;
}
final String groupName = myActionsMap.get(anAction);
- return groupName != null && text != null && matcher.matches(groupName + " " + text, compiledPattern) ? MatchMode.GROUP : MatchMode.NONE;
+ if (groupName == null) {
+ return text != null && matcher.matches(text, compiledPattern) ? MatchMode.NON_MENU : MatchMode.NONE;
+ }
+ return text != null && matcher.matches(groupName + " " + text, compiledPattern) ? MatchMode.GROUP : MatchMode.NONE;
}
@Nullable
@@ -498,7 +474,7 @@ public class GotoActionModel implements ChooseByNameModel, CustomMatcherModel, C
}
@NotNull
- private Pattern getPattern(@NotNull String pattern) {
+ Pattern getPattern(@NotNull String pattern) {
String converted = convertPattern(pattern.trim());
Pattern compiledPattern = myCompiledPattern;
if (compiledPattern != null && !Comparing.strEqual(converted, compiledPattern.getPattern())) {
@@ -528,7 +504,7 @@ public class GotoActionModel implements ChooseByNameModel, CustomMatcherModel, C
NONE, INTENTION, NAME, DESCRIPTION, GROUP, NON_MENU
}
- private static String convertPattern(String pattern) {
+ static String convertPattern(String pattern) {
final int eol = pattern.indexOf('\n');
if (eol != -1) {
pattern = pattern.substring(0, eol);
@@ -632,7 +608,7 @@ public class GotoActionModel implements ChooseByNameModel, CustomMatcherModel, C
return new Perl5Matcher();
}
};
- private PatternMatcher getMatcher() {
+ PatternMatcher getMatcher() {
return myMatcher.get();
}
@@ -660,20 +636,13 @@ public class GotoActionModel implements ChooseByNameModel, CustomMatcherModel, C
@Override
public int compareTo(@NotNull ActionWrapper o) {
- if (ApplicationManager.getApplication().isDispatchThread()) {
- boolean p1Enable = visible();
- boolean p2enable = o.visible();
- if (p1Enable && !p2enable) return -1;
- if (!p1Enable && p2enable) return 1;
- }
-
int compared = myMode.compareTo(o.getMode());
return compared != 0
? compared
: StringUtil.compare(myAction.getTemplatePresentation().getText(), o.getAction().getTemplatePresentation().getText(), true);
}
- private boolean visible() {
+ private boolean isAvailable() {
return getPresentation().isEnabledAndVisible();
}
diff --git a/platform/lang-impl/src/com/intellij/injected/editor/InjectedCaret.java b/platform/lang-impl/src/com/intellij/injected/editor/InjectedCaret.java
index 19651a7f68a8..e52fa66ccefc 100644
--- a/platform/lang-impl/src/com/intellij/injected/editor/InjectedCaret.java
+++ b/platform/lang-impl/src/com/intellij/injected/editor/InjectedCaret.java
@@ -15,17 +15,14 @@
*/
package com.intellij.injected.editor;
-import com.intellij.openapi.editor.Caret;
-import com.intellij.openapi.editor.CaretModel;
-import com.intellij.openapi.editor.LogicalPosition;
-import com.intellij.openapi.editor.VisualPosition;
+import com.intellij.openapi.editor.*;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.ProperTextRange;
import com.intellij.openapi.util.TextRange;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
-class InjectedCaret implements Caret {
+public class InjectedCaret implements Caret {
private final EditorWindow myEditorWindow;
final Caret myDelegate;
@@ -36,10 +33,20 @@ class InjectedCaret implements Caret {
@NotNull
@Override
+ public Editor getEditor() {
+ return myEditorWindow;
+ }
+
+ @NotNull
+ @Override
public CaretModel getCaretModel() {
return myEditorWindow.getCaretModel();
}
+ public Caret getDelegate() {
+ return myDelegate;
+ }
+
@Override
public boolean isValid() {
return myDelegate.isValid();
diff --git a/platform/lang-impl/src/com/intellij/internal/DumpDirectoryInfoAction.java b/platform/lang-impl/src/com/intellij/internal/DumpDirectoryInfoAction.java
index b5d0ae16a0ca..2f278bb97919 100644
--- a/platform/lang-impl/src/com/intellij/internal/DumpDirectoryInfoAction.java
+++ b/platform/lang-impl/src/com/intellij/internal/DumpDirectoryInfoAction.java
@@ -18,14 +18,12 @@ package com.intellij.internal;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.CommonDataKeys;
-import com.intellij.openapi.actionSystem.PlatformDataKeys;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.progress.ProgressManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.ContentIterator;
import com.intellij.openapi.roots.ProjectRootManager;
import com.intellij.openapi.roots.impl.DirectoryIndex;
-import com.intellij.openapi.roots.impl.DirectoryInfo;
import com.intellij.openapi.vfs.VirtualFile;
/**
@@ -53,10 +51,7 @@ public class DumpDirectoryInfoAction extends AnAction {
public boolean processFile(VirtualFile fileOrDir) {
LOG.info(fileOrDir.getPath());
- final DirectoryInfo directoryInfo = index.getInfoForDirectory(fileOrDir);
- if (directoryInfo != null) {
- LOG.info(directoryInfo.toString());
- }
+ LOG.info(index.getInfoForFile(fileOrDir).toString());
return true;
}
};
diff --git a/platform/lang-impl/src/com/intellij/internal/DumpVfsInfoForExcludedFilesAction.java b/platform/lang-impl/src/com/intellij/internal/DumpVfsInfoForExcludedFilesAction.java
new file mode 100644
index 000000000000..c4fb34c5ce54
--- /dev/null
+++ b/platform/lang-impl/src/com/intellij/internal/DumpVfsInfoForExcludedFilesAction.java
@@ -0,0 +1,114 @@
+/*
+ * Copyright 2000-2014 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.internal;
+
+import com.intellij.openapi.actionSystem.AnActionEvent;
+import com.intellij.openapi.module.Module;
+import com.intellij.openapi.module.ModuleManager;
+import com.intellij.openapi.project.DumbAwareAction;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.roots.ModuleRootManager;
+import com.intellij.openapi.roots.impl.DirectoryIndexExcludePolicy;
+import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.openapi.vfs.VirtualFileManager;
+import com.intellij.openapi.vfs.newvfs.NewVirtualFile;
+import com.intellij.openapi.vfs.newvfs.persistent.FSRecords;
+import com.intellij.openapi.vfs.newvfs.persistent.PersistentFS;
+
+import java.util.*;
+
+/**
+ * @author nik
+ */
+@SuppressWarnings("UseOfSystemOutOrSystemErr")
+public class DumpVfsInfoForExcludedFilesAction extends DumbAwareAction {
+ public DumpVfsInfoForExcludedFilesAction() {
+ super("Dump VFS content for files under excluded roots");
+ }
+
+ @Override
+ public void actionPerformed(AnActionEvent e) {
+ Project project = e.getProject();
+ if (project == null) return;
+
+ Set<String> excludeRoots = new HashSet<String>();
+ for (Module module : ModuleManager.getInstance(project).getModules()) {
+ Collections.addAll(excludeRoots, ModuleRootManager.getInstance(module).getExcludeRootUrls());
+ }
+ for (DirectoryIndexExcludePolicy policy : DirectoryIndexExcludePolicy.EP_NAME.getExtensions(project)) {
+ for (VirtualFile file : policy.getExcludeRootsForProject()) {
+ excludeRoots.add(file.getUrl());
+ }
+ }
+
+ if (excludeRoots.isEmpty()) {
+ System.out.println("No excluded roots found in project.");
+ }
+
+ for (String root : excludeRoots) {
+ VirtualFile file = VirtualFileManager.getInstance().findFileByUrl(root);
+ if (file == null) {
+ System.out.println(root + " not in VFS");
+ continue;
+ }
+ dumpChildrenInDbRecursively(file, 0);
+ }
+ }
+
+ private static void dumpChildrenInDbRecursively(VirtualFile dir, int depth) {
+ if (!(dir instanceof NewVirtualFile)) {
+ System.out.println(dir.getPresentableUrl() + ": not in db (" + dir.getClass().getName() + ")");
+ return;
+ }
+
+ List<VirtualFile> dirs = new ArrayList<VirtualFile>();
+ int inDb = 0, contentInDb = 0, nullChildren = 0;
+ PersistentFS persistentFS = PersistentFS.getInstance();
+ if (persistentFS.wereChildrenAccessed(dir)) {
+ for (String name : persistentFS.listPersisted(dir)) {
+ inDb++;
+ NewVirtualFile child = ((NewVirtualFile)dir).refreshAndFindChild(name);
+ if (child == null) {
+ nullChildren++;
+ continue;
+ }
+ if (child.isDirectory()) {
+ dirs.add(child);
+ }
+ else if (FSRecords.getContentId(child.getId()) != 0) {
+ contentInDb++;
+ }
+ }
+ }
+ System.out.print(dir.getPresentableUrl() + ": " + inDb + " children in db");
+ if (contentInDb > 0) {
+ System.out.print(", content of " + contentInDb + " files in db");
+ }
+ if (nullChildren > 0) {
+ System.out.print(", " + nullChildren + " invalid files in db");
+ }
+ System.out.println();
+
+ if (depth > 10) {
+ System.out.println("too deep, skipping children");
+ }
+ else {
+ for (VirtualFile childDir : dirs) {
+ dumpChildrenInDbRecursively(childDir, depth+1);
+ }
+ }
+ }
+}
diff --git a/platform/lang-impl/src/com/intellij/lang/parser/GeneratedParserUtilBase.java b/platform/lang-impl/src/com/intellij/lang/parser/GeneratedParserUtilBase.java
index ecda31db8355..ad322c232fa0 100644
--- a/platform/lang-impl/src/com/intellij/lang/parser/GeneratedParserUtilBase.java
+++ b/platform/lang-impl/src/com/intellij/lang/parser/GeneratedParserUtilBase.java
@@ -2,6 +2,7 @@
// Do not modify or refactor without complete investigation and/or review.
package com.intellij.lang.parser;
+import com.intellij.codeInsight.completion.impl.CamelHumpMatcher;
import com.intellij.lang.*;
import com.intellij.lang.impl.PsiBuilderAdapter;
import com.intellij.lang.impl.PsiBuilderImpl;
@@ -337,18 +338,18 @@ public class GeneratedParserUtilBase {
}
else if (diff > 0 && diff <= length) {
CharSequence fragment = builder_.getOriginalText().subSequence(offset, completionState.offset);
- add = StringUtil.startsWithIgnoreCase(text, fragment.toString());
+ add = completionState.prefixMatches(fragment.toString(), text);
}
else if (diff < 0) {
for (int i=-1; ; i--) {
IElementType type = builder_.rawLookup(i);
int tokenStart = builder_.rawTokenTypeStart(i);
- if (((PsiBuilderImpl)((Builder)builder_).getDelegate()).whitespaceOrComment(type)) {
+ if (isWhitespaceOrComment(builder_, type)) {
diff = completionState.offset - tokenStart;
}
else if (type != null && tokenStart < completionState.offset) {
CharSequence fragment = builder_.getOriginalText().subSequence(tokenStart, completionState.offset);
- if (StringUtil.startsWithIgnoreCase(text, fragment.toString())) {
+ if (completionState.prefixMatches(fragment.toString(), text)) {
diff = completionState.offset - tokenStart;
}
break;
@@ -364,6 +365,10 @@ public class GeneratedParserUtilBase {
}
}
+ public static boolean isWhitespaceOrComment(@NotNull PsiBuilder builder_, @Nullable IElementType type) {
+ return ((PsiBuilderImpl)((Builder)builder_).getDelegate()).whitespaceOrComment(type);
+ }
+
// here's the new section API for compact parsers & less IntelliJ platform API exposure
public static final int _NONE_ = 0x0;
public static final int _COLLAPSE_ = 0x1;
@@ -514,7 +519,9 @@ public class GeneratedParserUtilBase {
}
// propagate errorReportedAt up the stack to avoid duplicate reporting
Frame prevFrame = willFail && eatMore == null ? null : state.frameStack.peekLast();
- if (prevFrame != null && prevFrame.errorReportedAt < frame.errorReportedAt) prevFrame.errorReportedAt = frame.errorReportedAt;
+ if (prevFrame != null && prevFrame.errorReportedAt < frame.errorReportedAt) {
+ prevFrame.errorReportedAt = frame.errorReportedAt;
+ }
state.FRAMES.recycle(frame);
}
@@ -657,9 +664,17 @@ public class GeneratedParserUtilBase {
return o.toString();
}
- public void addItem(PsiBuilder builder, String text) {
+ public void addItem(@NotNull PsiBuilder builder, @NotNull String text) {
items.add(text);
}
+
+ public boolean prefixMatches(@NotNull String prefix, @NotNull String variant) {
+ boolean matches = new CamelHumpMatcher(prefix, false).prefixMatches(variant.replace(' ', '_'));
+ if (matches && StringUtil.isWhiteSpace(prefix.charAt(prefix.length() - 1))) {
+ return StringUtil.startsWithIgnoreCase(variant, prefix);
+ }
+ return matches;
+ }
}
public static class Builder extends PsiBuilderAdapter {
diff --git a/platform/lang-impl/src/com/intellij/openapi/diff/impl/settings/DiffPreviewProvider.java b/platform/lang-impl/src/com/intellij/openapi/diff/impl/settings/DiffPreviewProvider.java
index 7aa83adfd275..1de4d4a96357 100644
--- a/platform/lang-impl/src/com/intellij/openapi/diff/impl/settings/DiffPreviewProvider.java
+++ b/platform/lang-impl/src/com/intellij/openapi/diff/impl/settings/DiffPreviewProvider.java
@@ -66,7 +66,7 @@ public abstract class DiffPreviewProvider {
" long value;\n" +
"\n" +
" void foo() {\n" +
- " // Left changes\n" +
+ " // Right changes\n" +
" }\n" +
"\n" +
" void removedFromLeft() {}\n" +
diff --git a/platform/lang-impl/src/com/intellij/openapi/editor/actions/SelectAllOccurrencesAction.java b/platform/lang-impl/src/com/intellij/openapi/editor/actions/SelectAllOccurrencesAction.java
index d135b528f5e2..3e284ff6b2cc 100644
--- a/platform/lang-impl/src/com/intellij/openapi/editor/actions/SelectAllOccurrencesAction.java
+++ b/platform/lang-impl/src/com/intellij/openapi/editor/actions/SelectAllOccurrencesAction.java
@@ -15,9 +15,9 @@
*/
package com.intellij.openapi.editor.actions;
-import com.intellij.find.FindManager;
-import com.intellij.find.FindModel;
-import com.intellij.find.FindResult;
+import com.intellij.find.*;
+import com.intellij.find.editorHeaderActions.EditorHeaderAction;
+import com.intellij.find.editorHeaderActions.SelectAllAction;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
@@ -27,6 +27,8 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.TextRange;
import org.jetbrains.annotations.Nullable;
+import java.util.Iterator;
+
public class SelectAllOccurrencesAction extends EditorAction {
protected SelectAllOccurrencesAction() {
super(new Handler());
@@ -39,7 +41,9 @@ public class SelectAllOccurrencesAction extends EditorAction {
}
@Override
- public void doExecute(Editor editor, @Nullable Caret c, DataContext dataContext) {
+ public void doExecute(final Editor editor, @Nullable Caret c, DataContext dataContext) {
+ if (executeEquivalentFindPanelAction(editor, dataContext)) return;
+
Caret caret = c == null ? editor.getCaretModel().getPrimaryCaret() : c;
boolean wholeWordsSearch = false;
@@ -58,25 +62,36 @@ public class SelectAllOccurrencesAction extends EditorAction {
}
int caretShiftFromSelectionStart = caret.getOffset() - caret.getSelectionStart();
- FindManager findManager = FindManager.getInstance(project);
+ final FindManager findManager = FindManager.getInstance(project);
+
+ final FindModel model = getFindModel(selectedText, wholeWordsSearch);
- FindModel model = new FindModel();
- model.setStringToFind(selectedText);
- model.setCaseSensitive(true);
- model.setWholeWordsOnly(wholeWordsSearch);
+ FindUtil.selectSearchResultsInEditor(editor, new Iterator<FindResult>() {
+ FindResult findResult = findManager.findString(editor.getDocument().getCharsSequence(), 0, model);
- int searchStartOffset = 0;
- FindResult findResult = findManager.findString(editor.getDocument().getCharsSequence(), searchStartOffset, model);
- while (findResult.isStringFound()) {
- int newCaretOffset = caretShiftFromSelectionStart + findResult.getStartOffset();
- EditorActionUtil.makePositionVisible(editor, newCaretOffset);
- Caret newCaret = editor.getCaretModel().addCaret(editor.offsetToVisualPosition(newCaretOffset));
- if (newCaret != null) {
- setSelection(editor, newCaret, findResult);
+ @Override
+ public boolean hasNext() {
+ return findResult.isStringFound();
}
- findResult = findManager.findString(editor.getDocument().getCharsSequence(), findResult.getEndOffset(), model);
- }
+
+ @Override
+ public FindResult next() {
+ FindResult result = findResult;
+ findResult = findManager.findString(editor.getDocument().getCharsSequence(), findResult.getEndOffset(), model);
+ return result;
+ }
+
+ @Override
+ public void remove() {
+ throw new UnsupportedOperationException();
+ }
+ }, caretShiftFromSelectionStart);
editor.getScrollingModel().scrollToCaret(ScrollType.RELATIVE);
}
+
+ @Override
+ protected EditorHeaderAction getEquivalentFindPanelAction(EditorSearchComponent searchComponent) {
+ return new SelectAllAction(searchComponent);
+ }
}
}
diff --git a/platform/lang-impl/src/com/intellij/openapi/editor/actions/SelectNextOccurrenceAction.java b/platform/lang-impl/src/com/intellij/openapi/editor/actions/SelectNextOccurrenceAction.java
index cc4783b4d4db..7d3c408ee152 100644
--- a/platform/lang-impl/src/com/intellij/openapi/editor/actions/SelectNextOccurrenceAction.java
+++ b/platform/lang-impl/src/com/intellij/openapi/editor/actions/SelectNextOccurrenceAction.java
@@ -15,9 +15,9 @@
*/
package com.intellij.openapi.editor.actions;
-import com.intellij.find.FindManager;
-import com.intellij.find.FindModel;
-import com.intellij.find.FindResult;
+import com.intellij.find.*;
+import com.intellij.find.editorHeaderActions.AddOccurrenceAction;
+import com.intellij.find.editorHeaderActions.EditorHeaderAction;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
@@ -40,6 +40,8 @@ public class SelectNextOccurrenceAction extends EditorAction {
@Override
public void doExecute(Editor editor, @Nullable Caret c, DataContext dataContext) {
+ if (executeEquivalentFindPanelAction(editor, dataContext)) return;
+
Caret caret = c == null ? editor.getCaretModel().getPrimaryCaret() : c;
TextRange wordSelectionRange = getSelectionRange(editor, caret);
boolean notFoundPreviously = getAndResetNotFoundStatus(editor);
@@ -52,26 +54,21 @@ public class SelectNextOccurrenceAction extends EditorAction {
}
FindManager findManager = FindManager.getInstance(project);
- FindModel model = new FindModel();
- model.setStringToFind(selectedText);
- model.setCaseSensitive(true);
- model.setWholeWordsOnly(wholeWordSearch);
+ FindModel model = getFindModel(selectedText, wholeWordSearch);
+
+ findManager.setFindWasPerformed();
+ findManager.setFindNextModel(model);
int searchStartOffset = notFoundPreviously ? 0 : caret.getSelectionEnd();
FindResult findResult = findManager.findString(editor.getDocument().getCharsSequence(), searchStartOffset, model);
if (findResult.isStringFound()) {
- int newCaretOffset = caret.getOffset() - caret.getSelectionStart() + findResult.getStartOffset();
- EditorActionUtil.makePositionVisible(editor, newCaretOffset);
- Caret newCaret = editor.getCaretModel().addCaret(editor.offsetToVisualPosition(newCaretOffset));
- if (newCaret == null) {
+ boolean caretAdded = FindUtil.selectSearchResultInEditor(editor, findResult, caret.getOffset() - caret.getSelectionStart());
+ if (!caretAdded) {
// this means that the found occurence is already selected
if (notFoundPreviously) {
setNotFoundStatus(editor); // to make sure we won't show hint anymore if there are no more occurrences
}
}
- else {
- setSelection(editor, newCaret, findResult);
- }
}
else {
setNotFoundStatus(editor);
@@ -87,5 +84,10 @@ public class SelectNextOccurrenceAction extends EditorAction {
}
editor.getScrollingModel().scrollToCaret(ScrollType.RELATIVE);
}
+
+ @Override
+ protected EditorHeaderAction getEquivalentFindPanelAction(EditorSearchComponent searchComponent) {
+ return new AddOccurrenceAction(searchComponent);
+ }
}
}
diff --git a/platform/lang-impl/src/com/intellij/openapi/editor/actions/SelectOccurrencesActionHandler.java b/platform/lang-impl/src/com/intellij/openapi/editor/actions/SelectOccurrencesActionHandler.java
index c43eae703fd5..7b189281dfd0 100644
--- a/platform/lang-impl/src/com/intellij/openapi/editor/actions/SelectOccurrencesActionHandler.java
+++ b/platform/lang-impl/src/com/intellij/openapi/editor/actions/SelectOccurrencesActionHandler.java
@@ -19,8 +19,11 @@ import com.intellij.codeInsight.editorActions.SelectWordUtil;
import com.intellij.codeInsight.hint.HintManager;
import com.intellij.codeInsight.hint.HintManagerImpl;
import com.intellij.codeInsight.hint.HintUtil;
+import com.intellij.find.EditorSearchComponent;
import com.intellij.find.FindBundle;
-import com.intellij.openapi.actionSystem.IdeActions;
+import com.intellij.find.FindModel;
+import com.intellij.find.editorHeaderActions.EditorHeaderAction;
+import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.EditorLastActionTracker;
@@ -28,13 +31,24 @@ import com.intellij.openapi.editor.actionSystem.EditorActionHandler;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.TextRange;
import com.intellij.ui.LightweightHint;
+import com.intellij.util.containers.HashSet;
import org.jetbrains.annotations.Nullable;
+import java.util.Arrays;
+import java.util.Set;
+
abstract public class SelectOccurrencesActionHandler extends EditorActionHandler {
private static final Key<Boolean> NOT_FOUND = Key.create("select.next.occurence.not.found");
private static final Key<Boolean> WHOLE_WORDS = Key.create("select.next.occurence.whole.words");
+ private static final Set<String> SELECT_ACTIONS = new HashSet<String>(Arrays.asList(
+ IdeActions.ACTION_SELECT_NEXT_OCCURENCE,
+ IdeActions.ACTION_UNSELECT_PREVIOUS_OCCURENCE,
+ IdeActions.ACTION_FIND_NEXT,
+ IdeActions.ACTION_FIND_PREVIOUS
+ ));
+
protected static void setSelection(Editor editor, Caret caret, TextRange selectionRange) {
EditorActionUtil.makePositionVisible(editor, selectionRange.getStartOffset());
EditorActionUtil.makePositionVisible(editor, selectionRange.getEndOffset());
@@ -83,6 +97,35 @@ abstract public class SelectOccurrencesActionHandler extends EditorActionHandler
protected static boolean isRepeatedActionInvocation() {
String lastActionId = EditorLastActionTracker.getInstance().getLastActionId();
- return IdeActions.ACTION_SELECT_NEXT_OCCURENCE.equals(lastActionId) || IdeActions.ACTION_UNSELECT_PREVIOUS_OCCURENCE.equals(lastActionId);
+ return SELECT_ACTIONS.contains(lastActionId);
+ }
+
+ protected static FindModel getFindModel(String text, boolean wholeWords) {
+ FindModel model = new FindModel();
+ model.setStringToFind(text);
+ model.setCaseSensitive(true);
+ model.setWholeWordsOnly(wholeWords);
+ return model;
+ }
+
+ protected boolean executeEquivalentFindPanelAction(Editor editor, DataContext context) {
+ if (editor.getHeaderComponent() instanceof EditorSearchComponent) {
+ EditorSearchComponent searchComponent = (EditorSearchComponent)editor.getHeaderComponent();
+ EditorHeaderAction action = getEquivalentFindPanelAction(searchComponent);
+ if (action != null) {
+ Presentation presentation = new Presentation();
+ AnActionEvent event = new AnActionEvent(null, context, ActionPlaces.MAIN_MENU, presentation, ActionManager.getInstance(), 0);
+ action.update(event);
+ if (presentation.isEnabled()) {
+ action.actionPerformed(event);
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ protected EditorHeaderAction getEquivalentFindPanelAction(EditorSearchComponent searchComponent) {
+ return null;
}
}
diff --git a/platform/lang-impl/src/com/intellij/openapi/editor/actions/UnselectPreviousOccurrenceAction.java b/platform/lang-impl/src/com/intellij/openapi/editor/actions/UnselectPreviousOccurrenceAction.java
index a5657ff89b27..fffff56b12dc 100644
--- a/platform/lang-impl/src/com/intellij/openapi/editor/actions/UnselectPreviousOccurrenceAction.java
+++ b/platform/lang-impl/src/com/intellij/openapi/editor/actions/UnselectPreviousOccurrenceAction.java
@@ -15,6 +15,9 @@
*/
package com.intellij.openapi.editor.actions;
+import com.intellij.find.EditorSearchComponent;
+import com.intellij.find.editorHeaderActions.EditorHeaderAction;
+import com.intellij.find.editorHeaderActions.RemoveOccurrenceAction;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
@@ -35,6 +38,8 @@ public class UnselectPreviousOccurrenceAction extends EditorAction {
@Override
public void doExecute(Editor editor, @Nullable Caret caret, DataContext dataContext) {
+ if (executeEquivalentFindPanelAction(editor, dataContext)) return;
+
if (editor.getCaretModel().getCaretCount() > 1) {
editor.getCaretModel().removeCaret(editor.getCaretModel().getPrimaryCaret());
}
@@ -44,5 +49,10 @@ public class UnselectPreviousOccurrenceAction extends EditorAction {
getAndResetNotFoundStatus(editor);
editor.getScrollingModel().scrollToCaret(ScrollType.RELATIVE);
}
+
+ @Override
+ protected EditorHeaderAction getEquivalentFindPanelAction(EditorSearchComponent searchComponent) {
+ return new RemoveOccurrenceAction(searchComponent);
+ }
}
}
diff --git a/platform/lang-impl/src/com/intellij/openapi/roots/impl/DirectoryIndexImpl.java b/platform/lang-impl/src/com/intellij/openapi/roots/impl/DirectoryIndexImpl.java
index 2f5485d6deae..b1385686bc3a 100644
--- a/platform/lang-impl/src/com/intellij/openapi/roots/impl/DirectoryIndexImpl.java
+++ b/platform/lang-impl/src/com/intellij/openapi/roots/impl/DirectoryIndexImpl.java
@@ -149,12 +149,19 @@ public class DirectoryIndexImpl extends DirectoryIndex {
@Override
public DirectoryInfo getInfoForDirectory(@NotNull VirtualFile dir) {
+ DirectoryInfo info = getInfoForFile(dir);
+ return info.isInProject() ? info : null;
+ }
+
+ @NotNull
+ @Override
+ public DirectoryInfo getInfoForFile(@NotNull VirtualFile file) {
checkAvailability();
dispatchPendingEvents();
- if (!(dir instanceof NewVirtualFile)) return null;
+ if (!(file instanceof NewVirtualFile)) return NonProjectDirectoryInfo.NOT_SUPPORTED_VIRTUAL_FILE_IMPLEMENTATION;
- return getRootIndex().getInfoForDirectory(dir);
+ return getRootIndex().getInfoForFile(file);
}
@Override
@@ -167,22 +174,6 @@ public class DirectoryIndexImpl extends DirectoryIndex {
}
@Override
- public boolean isProjectExcludeRoot(@NotNull VirtualFile dir) {
- checkAvailability();
- if (!(dir instanceof NewVirtualFile)) return false;
-
- return getRootIndex().isProjectExcludeRoot(dir);
- }
-
- @Override
- public boolean isModuleExcludeRoot(@NotNull VirtualFile dir) {
- checkAvailability();
- if (!(dir instanceof NewVirtualFile)) return false;
-
- return getRootIndex().isModuleExcludeRoot(dir);
- }
-
- @Override
public String getPackageName(@NotNull VirtualFile dir) {
checkAvailability();
if (!(dir instanceof NewVirtualFile)) return null;
diff --git a/platform/lang-impl/src/com/intellij/openapi/roots/impl/PushedFilePropertiesUpdater.java b/platform/lang-impl/src/com/intellij/openapi/roots/impl/PushedFilePropertiesUpdater.java
deleted file mode 100644
index cb4b94016611..000000000000
--- a/platform/lang-impl/src/com/intellij/openapi/roots/impl/PushedFilePropertiesUpdater.java
+++ /dev/null
@@ -1,350 +0,0 @@
-/*
- * Copyright 2000-2014 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.
- */
-
-/*
- * @author max
- */
-package com.intellij.openapi.roots.impl;
-
-import com.intellij.ProjectTopics;
-import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.extensions.ExtensionException;
-import com.intellij.openapi.extensions.Extensions;
-import com.intellij.openapi.module.Module;
-import com.intellij.openapi.module.ModuleManager;
-import com.intellij.openapi.progress.ProgressIndicator;
-import com.intellij.openapi.progress.ProgressManager;
-import com.intellij.openapi.project.DumbModeTask;
-import com.intellij.openapi.project.DumbService;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.project.ProjectManager;
-import com.intellij.openapi.roots.*;
-import com.intellij.openapi.startup.StartupManager;
-import com.intellij.openapi.util.Computable;
-import com.intellij.openapi.util.Condition;
-import com.intellij.openapi.util.EmptyRunnable;
-import com.intellij.openapi.vfs.*;
-import com.intellij.openapi.vfs.impl.BulkVirtualFileListenerAdapter;
-import com.intellij.psi.PsiManager;
-import com.intellij.psi.impl.PsiManagerEx;
-import com.intellij.psi.impl.file.impl.FileManagerImpl;
-import com.intellij.util.containers.ContainerUtil;
-import com.intellij.util.indexing.FileBasedIndex;
-import com.intellij.util.indexing.FileBasedIndexProjectHandler;
-import com.intellij.util.messages.MessageBusConnection;
-import com.intellij.util.ui.UIUtil;
-import org.jetbrains.annotations.NotNull;
-
-import java.io.IOException;
-import java.util.Queue;
-import java.util.concurrent.ConcurrentLinkedQueue;
-
-public class PushedFilePropertiesUpdater {
- private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.roots.impl.PushedFilePropertiesUpdater");
-
- private final Project myProject;
- private final FilePropertyPusher[] myPushers;
- private final FilePropertyPusher[] myFilePushers;
- private final Queue<Runnable> myTasks = new ConcurrentLinkedQueue<Runnable>();
- private final MessageBusConnection myConnection;
-
- @NotNull
- public static PushedFilePropertiesUpdater getInstance(Project project) {
- return project.getComponent(PushedFilePropertiesUpdater.class);
- }
-
- public PushedFilePropertiesUpdater(final Project project) {
- myProject = project;
- myPushers = Extensions.getExtensions(FilePropertyPusher.EP_NAME);
- myFilePushers = ContainerUtil.findAllAsArray(myPushers, new Condition<FilePropertyPusher>() {
- @Override
- public boolean value(FilePropertyPusher pusher) {
- return !pusher.pushDirectoriesOnly();
- }
- });
-
- myConnection = project.getMessageBus().connect();
-
- StartupManager.getInstance(project).registerPreStartupActivity(new Runnable() {
- @Override
- public void run() {
- myConnection.subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootAdapter() {
- @Override
- public void rootsChanged(final ModuleRootEvent event) {
- for (FilePropertyPusher pusher : myPushers) {
- pusher.afterRootsChanged(project);
- }
- }
- });
-
- myConnection.subscribe(VirtualFileManager.VFS_CHANGES, new BulkVirtualFileListenerAdapter(new VirtualFileAdapter() {
- @Override
- public void fileCreated(@NotNull final VirtualFileEvent event) {
- final VirtualFile file = event.getFile();
- final FilePropertyPusher[] pushers = file.isDirectory() ? myPushers : myFilePushers;
- if (!event.isFromRefresh() || !file.isDirectory()) {
- // push synchronously to avoid entering dumb mode in the middle of a meaningful write action
- // avoid dumb mode for just one file
- doPushRecursively(file, pushers, ProjectRootManager.getInstance(myProject).getFileIndex());
- }
- else {
- schedulePushRecursively(file, pushers);
- }
- }
-
- @Override
- public void fileMoved(@NotNull final VirtualFileMoveEvent event) {
- final VirtualFile file = event.getFile();
- final FilePropertyPusher[] pushers = file.isDirectory() ? myPushers : myFilePushers;
- if (pushers.length == 0) return;
- for (FilePropertyPusher pusher : pushers) {
- file.putUserData(pusher.getFileDataKey(), null);
- }
- // push synchronously to avoid entering dumb mode in the middle of a meaningful write action
- doPushRecursively(file, pushers, ProjectRootManager.getInstance(myProject).getFileIndex());
- }
- }));
- }
- });
- }
-
- public void initializeProperties() {
- for (final FilePropertyPusher pusher : myPushers) {
- pusher.initExtra(myProject, myProject.getMessageBus(), new FilePropertyPusher.Engine() {
- @Override
- public void pushAll() {
- PushedFilePropertiesUpdater.this.pushAll(pusher);
- }
-
- @Override
- public void pushRecursively(VirtualFile file, Project project) {
- PushedFilePropertiesUpdater.this.schedulePushRecursively(file, pusher);
- }
- });
- }
- }
-
- public void pushAllPropertiesNow() {
- performPushTasks();
- doPushAll(myPushers);
- }
-
- private void schedulePushRecursively(final VirtualFile dir, final FilePropertyPusher... pushers) {
- if (pushers.length == 0) return;
- final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(myProject).getFileIndex();
- if (!fileIndex.isInContent(dir)) return;
- queueTask(new Runnable() {
- @Override
- public void run() {
- doPushRecursively(dir, pushers, fileIndex);
- }
- });
- }
-
- private void doPushRecursively(VirtualFile dir, final FilePropertyPusher[] pushers, ProjectFileIndex fileIndex) {
- fileIndex.iterateContentUnderDirectory(dir, new ContentIterator() {
- @Override
- public boolean processFile(final VirtualFile fileOrDir) {
- applyPushersToFile(fileOrDir, pushers, null);
- return true;
- }
- });
- }
-
- private void queueTask(Runnable action) {
- myTasks.offer(action);
- final DumbModeTask task = new DumbModeTask() {
- @Override
- public void performInDumbMode(@NotNull ProgressIndicator indicator) {
- performPushTasks();
- }
- };
- myProject.getMessageBus().connect(task).subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootAdapter() {
- @Override
- public void rootsChanged(ModuleRootEvent event) {
- DumbService.getInstance(myProject).cancelTask(task);
- }
- });
- DumbService.getInstance(myProject).queueTask(task);
- }
-
- private void performPushTasks() {
- boolean hadTasks = false;
- while (true) {
- Runnable task = myTasks.poll();
- if (task == null) {
- break;
- }
- hadTasks = true;
- task.run();
- }
-
- if (hadTasks && !myProject.isDisposed()) {
- DumbModeTask task = FileBasedIndexProjectHandler.createChangedFilesIndexingTask(myProject);
- if (task != null) {
- DumbService.getInstance(myProject).queueTask(task);
- }
- }
- }
-
- private static <T> T findPusherValuesUpwards(Project project, VirtualFile dir, FilePropertyPusher<T> pusher, T moduleValue) {
- final T value = pusher.getImmediateValue(project, dir);
- if (value != null) return value;
- if (moduleValue != null) return moduleValue;
- final VirtualFile parent = dir.getParent();
- if (parent != null) return findPusherValuesUpwards(project, parent, pusher);
- T projectValue = pusher.getImmediateValue(project, null);
- return projectValue != null? projectValue : pusher.getDefaultValue();
- }
-
- private static <T> T findPusherValuesUpwards(Project project, VirtualFile dir, FilePropertyPusher<T> pusher) {
- final T userValue = dir.getUserData(pusher.getFileDataKey());
- if (userValue != null) return userValue;
- final T value = pusher.getImmediateValue(project, dir);
- if (value != null) return value;
- final VirtualFile parent = dir.getParent();
- if (parent != null) return findPusherValuesUpwards(project, parent, pusher);
- T projectValue = pusher.getImmediateValue(project, null);
- return projectValue != null ? projectValue : pusher.getDefaultValue();
- }
-
- public void pushAll(final FilePropertyPusher... pushers) {
- queueTask(new Runnable() {
- @Override
- public void run() {
- doPushAll(pushers);
- }
- });
- }
-
- private void doPushAll(final FilePropertyPusher[] pushers) {
- Module[] modules = ApplicationManager.getApplication().runReadAction(new Computable<Module[]>() {
- @Override
- public Module[] compute() {
- return ModuleManager.getInstance(myProject).getModules();
- }
- });
-
- for (final Module module : modules) {
- Runnable iteration = ApplicationManager.getApplication().runReadAction(new Computable<Runnable>() {
- @Override
- public Runnable compute() {
- if (module.isDisposed()) return EmptyRunnable.INSTANCE;
- ProgressManager.checkCanceled();
-
- final Object[] moduleValues = new Object[pushers.length];
- for (int i = 0; i < moduleValues.length; i++) {
- moduleValues[i] = pushers[i].getImmediateValue(module);
- }
-
- final ModuleFileIndex fileIndex = ModuleRootManager.getInstance(module).getFileIndex();
- return new Runnable() {
- @Override
- public void run() {
- fileIndex.iterateContent(new ContentIterator() {
- @Override
- public boolean processFile(final VirtualFile fileOrDir) {
- applyPushersToFile(fileOrDir, pushers, moduleValues);
- return true;
- }
- });
- }
- };
- }
- });
- iteration.run();
- }
- }
-
- private void applyPushersToFile(final VirtualFile fileOrDir, final FilePropertyPusher[] pushers, final Object[] moduleValues) {
- ApplicationManager.getApplication().runReadAction(new Runnable() {
- @Override
- public void run() {
- ProgressManager.checkCanceled();
- if (!fileOrDir.isValid()) return;
- doApplyPushersToFile(fileOrDir, pushers, moduleValues);
- }
- });
- }
- private void doApplyPushersToFile(VirtualFile fileOrDir, FilePropertyPusher[] pushers, Object[] moduleValues) {
- FilePropertyPusher<Object> pusher = null;
- try {
- final boolean isDir = fileOrDir.isDirectory();
- for (int i = 0, pushersLength = pushers.length; i < pushersLength; i++) {
- //noinspection unchecked
- pusher = pushers[i];
- if (!isDir && (pusher.pushDirectoriesOnly() || !pusher.acceptsFile(fileOrDir))) continue;
- else if (isDir && !pusher.acceptsDirectory(fileOrDir, myProject)) continue;
- findAndUpdateValue(myProject, fileOrDir, pusher, moduleValues != null ? moduleValues[i]:null);
- }
- }
- catch (AbstractMethodError ame) { // acceptsDirectory is missed
- if (pusher != null) throw new ExtensionException(pusher.getClass());
- throw ame;
- }
- }
-
- public static <T> void findAndUpdateValue(final Project project, final VirtualFile fileOrDir, final FilePropertyPusher<T> pusher, final T moduleValue) {
- final T value = findPusherValuesUpwards(project, fileOrDir, pusher, moduleValue);
- updateValue(fileOrDir, value, pusher);
- }
-
- private static <T> void updateValue(final VirtualFile fileOrDir, final T value, final FilePropertyPusher<T> pusher) {
- final T oldValue = fileOrDir.getUserData(pusher.getFileDataKey());
- if (value != oldValue) {
- fileOrDir.putUserData(pusher.getFileDataKey(), value);
- try {
- pusher.persistAttribute(fileOrDir, value);
- }
- catch (IOException e) {
- LOG.error(e);
- }
- }
- }
-
- public static void filePropertiesChanged(@NotNull final VirtualFile file) {
- ApplicationManager.getApplication().assertReadAccessAllowed();
- FileBasedIndex.getInstance().requestReindex(file);
- for (final Project project : ProjectManager.getInstance().getOpenProjects()) {
- reloadPsi(file, project);
- }
- }
-
- private static void reloadPsi(final VirtualFile file, final Project project) {
- final FileManagerImpl fileManager = (FileManagerImpl)((PsiManagerEx)PsiManager.getInstance(project)).getFileManager();
- if (fileManager.findCachedViewProvider(file) != null) {
- UIUtil.invokeLaterIfNeeded(new Runnable() {
- @Override
- public void run() {
- if (project.isDisposed()) {
- return;
- }
- ApplicationManager.getApplication().runWriteAction(new Runnable() {
- @Override
- public void run() {
- fileManager.forceReload(file);
- }
- });
- }
- });
- }
- }
-
- public void processPendingEvents() {
- myConnection.deliverImmediately();
- }
-}
diff --git a/platform/lang-impl/src/com/intellij/openapi/roots/impl/PushedFilePropertiesUpdaterImpl.java b/platform/lang-impl/src/com/intellij/openapi/roots/impl/PushedFilePropertiesUpdaterImpl.java
new file mode 100644
index 000000000000..a96432e2b64c
--- /dev/null
+++ b/platform/lang-impl/src/com/intellij/openapi/roots/impl/PushedFilePropertiesUpdaterImpl.java
@@ -0,0 +1,351 @@
+/*
+ * Copyright 2000-2014 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.
+ */
+
+/*
+ * @author max
+ */
+package com.intellij.openapi.roots.impl;
+
+import com.intellij.ProjectTopics;
+import com.intellij.openapi.application.ApplicationManager;
+import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.openapi.extensions.ExtensionException;
+import com.intellij.openapi.extensions.Extensions;
+import com.intellij.openapi.module.Module;
+import com.intellij.openapi.module.ModuleManager;
+import com.intellij.openapi.progress.ProgressIndicator;
+import com.intellij.openapi.progress.ProgressManager;
+import com.intellij.openapi.project.DumbModeTask;
+import com.intellij.openapi.project.DumbService;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.project.ProjectManager;
+import com.intellij.openapi.roots.*;
+import com.intellij.openapi.startup.StartupManager;
+import com.intellij.openapi.util.Computable;
+import com.intellij.openapi.util.Condition;
+import com.intellij.openapi.util.EmptyRunnable;
+import com.intellij.openapi.vfs.*;
+import com.intellij.openapi.vfs.impl.BulkVirtualFileListenerAdapter;
+import com.intellij.psi.PsiManager;
+import com.intellij.psi.impl.PsiManagerEx;
+import com.intellij.psi.impl.file.impl.FileManagerImpl;
+import com.intellij.util.containers.ContainerUtil;
+import com.intellij.util.indexing.FileBasedIndex;
+import com.intellij.util.indexing.FileBasedIndexProjectHandler;
+import com.intellij.util.messages.MessageBusConnection;
+import com.intellij.util.ui.UIUtil;
+import org.jetbrains.annotations.NotNull;
+
+import java.io.IOException;
+import java.util.Queue;
+import java.util.concurrent.ConcurrentLinkedQueue;
+
+public class PushedFilePropertiesUpdaterImpl extends PushedFilePropertiesUpdater {
+ private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.roots.impl.PushedFilePropertiesUpdater");
+
+ private final Project myProject;
+ private final FilePropertyPusher[] myPushers;
+ private final FilePropertyPusher[] myFilePushers;
+ private final Queue<Runnable> myTasks = new ConcurrentLinkedQueue<Runnable>();
+ private final MessageBusConnection myConnection;
+
+ public PushedFilePropertiesUpdaterImpl(final Project project) {
+ myProject = project;
+ myPushers = Extensions.getExtensions(FilePropertyPusher.EP_NAME);
+ myFilePushers = ContainerUtil.findAllAsArray(myPushers, new Condition<FilePropertyPusher>() {
+ @Override
+ public boolean value(FilePropertyPusher pusher) {
+ return !pusher.pushDirectoriesOnly();
+ }
+ });
+
+ myConnection = project.getMessageBus().connect();
+
+ StartupManager.getInstance(project).registerPreStartupActivity(new Runnable() {
+ @Override
+ public void run() {
+ myConnection.subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootAdapter() {
+ @Override
+ public void rootsChanged(final ModuleRootEvent event) {
+ for (FilePropertyPusher pusher : myPushers) {
+ pusher.afterRootsChanged(project);
+ }
+ }
+ });
+
+ myConnection.subscribe(VirtualFileManager.VFS_CHANGES, new BulkVirtualFileListenerAdapter(new VirtualFileAdapter() {
+ @Override
+ public void fileCreated(@NotNull final VirtualFileEvent event) {
+ final VirtualFile file = event.getFile();
+ final FilePropertyPusher[] pushers = file.isDirectory() ? myPushers : myFilePushers;
+ if (!event.isFromRefresh() || !file.isDirectory()) {
+ // push synchronously to avoid entering dumb mode in the middle of a meaningful write action
+ // avoid dumb mode for just one file
+ doPushRecursively(file, pushers, ProjectRootManager.getInstance(myProject).getFileIndex());
+ }
+ else {
+ schedulePushRecursively(file, pushers);
+ }
+ }
+
+ @Override
+ public void fileMoved(@NotNull final VirtualFileMoveEvent event) {
+ final VirtualFile file = event.getFile();
+ final FilePropertyPusher[] pushers = file.isDirectory() ? myPushers : myFilePushers;
+ if (pushers.length == 0) return;
+ for (FilePropertyPusher pusher : pushers) {
+ file.putUserData(pusher.getFileDataKey(), null);
+ }
+ // push synchronously to avoid entering dumb mode in the middle of a meaningful write action
+ doPushRecursively(file, pushers, ProjectRootManager.getInstance(myProject).getFileIndex());
+ }
+ }));
+ }
+ });
+ }
+
+ @Override
+ public void initializeProperties() {
+ for (final FilePropertyPusher pusher : myPushers) {
+ pusher.initExtra(myProject, myProject.getMessageBus(), new FilePropertyPusher.Engine() {
+ @Override
+ public void pushAll() {
+ PushedFilePropertiesUpdaterImpl.this.pushAll(pusher);
+ }
+
+ @Override
+ public void pushRecursively(VirtualFile file, Project project) {
+ PushedFilePropertiesUpdaterImpl.this.schedulePushRecursively(file, pusher);
+ }
+ });
+ }
+ }
+
+ @Override
+ public void pushAllPropertiesNow() {
+ performPushTasks();
+ doPushAll(myPushers);
+ }
+
+ private void schedulePushRecursively(final VirtualFile dir, final FilePropertyPusher... pushers) {
+ if (pushers.length == 0) return;
+ final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(myProject).getFileIndex();
+ if (!fileIndex.isInContent(dir)) return;
+ queueTask(new Runnable() {
+ @Override
+ public void run() {
+ doPushRecursively(dir, pushers, fileIndex);
+ }
+ });
+ }
+
+ private void doPushRecursively(VirtualFile dir, final FilePropertyPusher[] pushers, ProjectFileIndex fileIndex) {
+ fileIndex.iterateContentUnderDirectory(dir, new ContentIterator() {
+ @Override
+ public boolean processFile(final VirtualFile fileOrDir) {
+ applyPushersToFile(fileOrDir, pushers, null);
+ return true;
+ }
+ });
+ }
+
+ private void queueTask(Runnable action) {
+ myTasks.offer(action);
+ final DumbModeTask task = new DumbModeTask() {
+ @Override
+ public void performInDumbMode(@NotNull ProgressIndicator indicator) {
+ performPushTasks();
+ }
+ };
+ myProject.getMessageBus().connect(task).subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootAdapter() {
+ @Override
+ public void rootsChanged(ModuleRootEvent event) {
+ DumbService.getInstance(myProject).cancelTask(task);
+ }
+ });
+ DumbService.getInstance(myProject).queueTask(task);
+ }
+
+ private void performPushTasks() {
+ boolean hadTasks = false;
+ while (true) {
+ Runnable task = myTasks.poll();
+ if (task == null) {
+ break;
+ }
+ hadTasks = true;
+ task.run();
+ }
+
+ if (hadTasks && !myProject.isDisposed()) {
+ DumbModeTask task = FileBasedIndexProjectHandler.createChangedFilesIndexingTask(myProject);
+ if (task != null) {
+ DumbService.getInstance(myProject).queueTask(task);
+ }
+ }
+ }
+
+ private static <T> T findPusherValuesUpwards(Project project, VirtualFile dir, FilePropertyPusher<T> pusher, T moduleValue) {
+ final T value = pusher.getImmediateValue(project, dir);
+ if (value != null) return value;
+ if (moduleValue != null) return moduleValue;
+ final VirtualFile parent = dir.getParent();
+ if (parent != null) return findPusherValuesUpwards(project, parent, pusher);
+ T projectValue = pusher.getImmediateValue(project, null);
+ return projectValue != null? projectValue : pusher.getDefaultValue();
+ }
+
+ private static <T> T findPusherValuesUpwards(Project project, VirtualFile dir, FilePropertyPusher<T> pusher) {
+ final T userValue = dir.getUserData(pusher.getFileDataKey());
+ if (userValue != null) return userValue;
+ final T value = pusher.getImmediateValue(project, dir);
+ if (value != null) return value;
+ final VirtualFile parent = dir.getParent();
+ if (parent != null) return findPusherValuesUpwards(project, parent, pusher);
+ T projectValue = pusher.getImmediateValue(project, null);
+ return projectValue != null ? projectValue : pusher.getDefaultValue();
+ }
+
+ @Override
+ public void pushAll(final FilePropertyPusher... pushers) {
+ queueTask(new Runnable() {
+ @Override
+ public void run() {
+ doPushAll(pushers);
+ }
+ });
+ }
+
+ private void doPushAll(final FilePropertyPusher[] pushers) {
+ Module[] modules = ApplicationManager.getApplication().runReadAction(new Computable<Module[]>() {
+ @Override
+ public Module[] compute() {
+ return ModuleManager.getInstance(myProject).getModules();
+ }
+ });
+
+ for (final Module module : modules) {
+ Runnable iteration = ApplicationManager.getApplication().runReadAction(new Computable<Runnable>() {
+ @Override
+ public Runnable compute() {
+ if (module.isDisposed()) return EmptyRunnable.INSTANCE;
+ ProgressManager.checkCanceled();
+
+ final Object[] moduleValues = new Object[pushers.length];
+ for (int i = 0; i < moduleValues.length; i++) {
+ moduleValues[i] = pushers[i].getImmediateValue(module);
+ }
+
+ final ModuleFileIndex fileIndex = ModuleRootManager.getInstance(module).getFileIndex();
+ return new Runnable() {
+ @Override
+ public void run() {
+ fileIndex.iterateContent(new ContentIterator() {
+ @Override
+ public boolean processFile(final VirtualFile fileOrDir) {
+ applyPushersToFile(fileOrDir, pushers, moduleValues);
+ return true;
+ }
+ });
+ }
+ };
+ }
+ });
+ iteration.run();
+ }
+ }
+
+ private void applyPushersToFile(final VirtualFile fileOrDir, final FilePropertyPusher[] pushers, final Object[] moduleValues) {
+ ApplicationManager.getApplication().runReadAction(new Runnable() {
+ @Override
+ public void run() {
+ ProgressManager.checkCanceled();
+ if (!fileOrDir.isValid()) return;
+ doApplyPushersToFile(fileOrDir, pushers, moduleValues);
+ }
+ });
+ }
+ private void doApplyPushersToFile(VirtualFile fileOrDir, FilePropertyPusher[] pushers, Object[] moduleValues) {
+ FilePropertyPusher<Object> pusher = null;
+ try {
+ final boolean isDir = fileOrDir.isDirectory();
+ for (int i = 0, pushersLength = pushers.length; i < pushersLength; i++) {
+ //noinspection unchecked
+ pusher = pushers[i];
+ if (!isDir && (pusher.pushDirectoriesOnly() || !pusher.acceptsFile(fileOrDir))) continue;
+ else if (isDir && !pusher.acceptsDirectory(fileOrDir, myProject)) continue;
+ findAndUpdateValue(fileOrDir, pusher, moduleValues != null ? moduleValues[i]:null);
+ }
+ }
+ catch (AbstractMethodError ame) { // acceptsDirectory is missed
+ if (pusher != null) throw new ExtensionException(pusher.getClass());
+ throw ame;
+ }
+ }
+
+ @Override
+ public <T> void findAndUpdateValue(final VirtualFile fileOrDir, final FilePropertyPusher<T> pusher, final T moduleValue) {
+ final T value = findPusherValuesUpwards(myProject, fileOrDir, pusher, moduleValue);
+ updateValue(myProject, fileOrDir, value, pusher);
+ }
+
+ private static <T> void updateValue(final Project project, final VirtualFile fileOrDir, final T value, final FilePropertyPusher<T> pusher) {
+ final T oldValue = fileOrDir.getUserData(pusher.getFileDataKey());
+ if (value != oldValue) {
+ fileOrDir.putUserData(pusher.getFileDataKey(), value);
+ try {
+ pusher.persistAttribute(project, fileOrDir, value);
+ }
+ catch (IOException e) {
+ LOG.error(e);
+ }
+ }
+ }
+
+ @Override
+ public void filePropertiesChanged(@NotNull final VirtualFile file) {
+ ApplicationManager.getApplication().assertReadAccessAllowed();
+ FileBasedIndex.getInstance().requestReindex(file);
+ for (final Project project : ProjectManager.getInstance().getOpenProjects()) {
+ reloadPsi(file, project);
+ }
+ }
+
+ private static void reloadPsi(final VirtualFile file, final Project project) {
+ final FileManagerImpl fileManager = (FileManagerImpl)((PsiManagerEx)PsiManager.getInstance(project)).getFileManager();
+ if (fileManager.findCachedViewProvider(file) != null) {
+ UIUtil.invokeLaterIfNeeded(new Runnable() {
+ @Override
+ public void run() {
+ if (project.isDisposed()) {
+ return;
+ }
+ ApplicationManager.getApplication().runWriteAction(new Runnable() {
+ @Override
+ public void run() {
+ fileManager.forceReload(file);
+ }
+ });
+ }
+ });
+ }
+ }
+
+ @Override
+ public void processPendingEvents() {
+ myConnection.deliverImmediately();
+ }
+}
diff --git a/platform/lang-impl/src/com/intellij/openapi/util/registry/RegistryUi.java b/platform/lang-impl/src/com/intellij/openapi/util/registry/RegistryUi.java
index 5937af147648..0978f8f09ec7 100644
--- a/platform/lang-impl/src/com/intellij/openapi/util/registry/RegistryUi.java
+++ b/platform/lang-impl/src/com/intellij/openapi/util/registry/RegistryUi.java
@@ -109,11 +109,11 @@ public class RegistryUi implements Disposable {
final RegistryValue value = myModel.getRegistryValue(selected);
String desc = value.getDescription();
if (value.isRestartRequired()) {
- String required = "Requires IDE restart.";
+ String required = " Requires IDE restart.";
if (desc.endsWith(".")) {
desc += required;
} else {
- desc += ". " + required;
+ desc += "." + required;
}
}
myDescriptionLabel.setText(desc);
diff --git a/platform/lang-impl/src/com/intellij/packageDependencies/ui/ProjectPatternProvider.java b/platform/lang-impl/src/com/intellij/packageDependencies/ui/ProjectPatternProvider.java
index 5fd50cfeaf6c..df0a5caa1f97 100644
--- a/platform/lang-impl/src/com/intellij/packageDependencies/ui/ProjectPatternProvider.java
+++ b/platform/lang-impl/src/com/intellij/packageDependencies/ui/ProjectPatternProvider.java
@@ -27,11 +27,14 @@ import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.ToggleAction;
import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.openapi.module.Module;
+import com.intellij.openapi.module.ModuleUtilCore;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.ProjectRootManager;
import com.intellij.openapi.vfs.VfsUtilCore;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.packageDependencies.DependencyUISettings;
+import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.psi.search.scope.packageSet.FilePatternPackageSet;
import com.intellij.psi.search.scope.packageSet.PackageSet;
@@ -103,7 +106,10 @@ public class ProjectPatternProvider extends PatternDialectProvider {
pattern += recursively ? "*/" : "*";
}
}
- return new FilePatternPackageSet(getModulePattern(node), pattern);
+ final VirtualFile vDir = ((DirectoryNode)node).getDirectory();
+ final PsiElement psiElement = node.getPsiElement();
+ final Module module = psiElement != null ? ModuleUtilCore.findModuleForFile(vDir, psiElement.getProject()) : null;
+ return new FilePatternPackageSet(module != null ? module.getName() : null, pattern);
}
else if (node instanceof FileNode) {
if (recursively) return null;
diff --git a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/AddScopeUtil.java b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/AddScopeUtil.java
new file mode 100644
index 000000000000..d92445254f28
--- /dev/null
+++ b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/AddScopeUtil.java
@@ -0,0 +1,117 @@
+/*
+ * Copyright 2000-2012 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.
+ */
+
+/*
+ * User: anna
+ * Date: 14-May-2009
+ */
+package com.intellij.profile.codeInspection.ui;
+
+import com.intellij.codeHighlighting.HighlightDisplayLevel;
+import com.intellij.codeInspection.ex.Descriptor;
+import com.intellij.codeInspection.ex.InspectionProfileImpl;
+import com.intellij.codeInspection.ex.InspectionToolWrapper;
+import com.intellij.codeInspection.ex.ScopeToolState;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.ui.Messages;
+import com.intellij.profile.codeInspection.ui.inspectionsTree.InspectionConfigTreeNode;
+import com.intellij.psi.search.scope.packageSet.CustomScopesProviderEx;
+import com.intellij.psi.search.scope.packageSet.NamedScope;
+import com.intellij.psi.search.scope.packageSet.NamedScopesHolder;
+import com.intellij.ui.treeStructure.Tree;
+import com.intellij.ui.treeStructure.treetable.TreeTable;
+import com.intellij.util.ArrayUtil;
+
+import javax.swing.tree.DefaultTreeModel;
+import javax.swing.tree.TreePath;
+import java.util.*;
+
+public class AddScopeUtil {
+ public static ScopeToolState performAddScope(final TreeTable treeTable,
+ final Project project,
+ final InspectionProfileImpl inspectionProfile,
+ final Collection<InspectionConfigTreeNode> selectedNodes) {
+ final List<InspectionConfigTreeNode> nodes = new ArrayList<InspectionConfigTreeNode>();
+ final List<Descriptor> descriptors = new ArrayList<Descriptor>();
+ for (final InspectionConfigTreeNode node : selectedNodes) {
+ collect(descriptors, nodes, node);
+ }
+
+ final List<String> availableScopes = getAvailableScopes(descriptors, project, inspectionProfile);
+ final int idx = Messages.showChooseDialog(treeTable, "Scope:", "Choose Scope", ArrayUtil.toStringArray(availableScopes), availableScopes.get(0), Messages.getQuestionIcon());
+ if (idx == -1) return null;
+ final NamedScope chosenScope = NamedScopesHolder.getScope(project, availableScopes.get(idx));
+
+ ScopeToolState scopeToolState = null;
+ final Tree tree = treeTable.getTree();
+
+ for (final InspectionConfigTreeNode node : nodes) {
+ final Descriptor descriptor = node.getDefaultDescriptor();
+ final InspectionToolWrapper toolWrapper = descriptor.getToolWrapper().createCopy(); //copy
+ final HighlightDisplayLevel level = inspectionProfile.getErrorLevel(descriptor.getKey(), chosenScope, project);
+ final boolean enabled = inspectionProfile.isToolEnabled(descriptor.getKey());
+ scopeToolState = inspectionProfile.addScope(toolWrapper, chosenScope, level, enabled, project);
+ node.dropCache();
+ ((DefaultTreeModel)tree.getModel()).reload(node);
+ tree.expandPath(new TreePath(node.getPath()));
+ }
+ tree.revalidate();
+ return scopeToolState;
+ }
+
+ private static void collect(final List<Descriptor> descriptors,
+ final List<InspectionConfigTreeNode> nodes,
+ final InspectionConfigTreeNode node) {
+ final ToolDescriptors currentDescriptors = node.getDescriptors();
+ if (currentDescriptors != null) {
+ nodes.add(node);
+ descriptors.add(currentDescriptors.getDefaultDescriptor());
+ descriptors.addAll(currentDescriptors.getNonDefaultDescriptors());
+ } else if (node.getUserObject() instanceof String) {
+ for(int i = 0; i < node.getChildCount(); i++) {
+ final InspectionConfigTreeNode childNode = (InspectionConfigTreeNode)node.getChildAt(i);
+ collect(descriptors, nodes, childNode);
+ }
+ }
+ }
+
+ private static List<String> getAvailableScopes(final List<Descriptor> descriptors, final Project project, final InspectionProfileImpl inspectionProfile) {
+ final ArrayList<NamedScope> scopes = new ArrayList<NamedScope>();
+ for (final NamedScopesHolder holder : NamedScopesHolder.getAllNamedScopeHolders(project)) {
+ Collections.addAll(scopes, holder.getScopes());
+ }
+ scopes.remove(CustomScopesProviderEx.getAllScope());
+
+ CustomScopesProviderEx.filterNoSettingsScopes(project, scopes);
+
+ final Set<NamedScope> used = new HashSet<NamedScope>();
+ for (final Descriptor descriptor : descriptors) {
+ final List<ScopeToolState> nonDefaultTools = inspectionProfile.getNonDefaultTools(descriptor.getKey().toString(), project);
+ if (nonDefaultTools != null) {
+ for (final ScopeToolState state : nonDefaultTools) {
+ used.add(state.getScope(project));
+ }
+ }
+ }
+ scopes.removeAll(used);
+
+ final List<String> availableScopes = new ArrayList<String>();
+ for (final NamedScope scope : scopes) {
+ availableScopes.add(scope.getName());
+ }
+ return availableScopes;
+ }
+} \ No newline at end of file
diff --git a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/InspectionConfigTreeNode.java b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/InspectionConfigTreeNode.java
deleted file mode 100644
index f8fdc2c3dc5f..000000000000
--- a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/InspectionConfigTreeNode.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Copyright 2000-2012 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.profile.codeInspection.ui;
-
-import com.intellij.codeInspection.ex.Descriptor;
-import com.intellij.codeInspection.ex.ScopeToolState;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.util.ClearableLazyValue;
-import com.intellij.psi.search.scope.packageSet.NamedScope;
-import com.intellij.ui.CheckedTreeNode;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * @author anna
- * @since 14-May-2009
- */
-public class InspectionConfigTreeNode extends CheckedTreeNode {
- private final ScopeToolState myState;
- private boolean myByDefault;
- private boolean myInspectionNode;
- private final ClearableLazyValue<Boolean> myProperSetting = new ClearableLazyValue<Boolean>() {
- @NotNull
- @Override
- protected Boolean compute() {
- Descriptor descriptor = getDescriptor();
- if (descriptor != null) return descriptor.getInspectionProfile().isProperSetting(descriptor.getToolWrapper().getShortName());
- for (int i = 0; i < getChildCount(); i++) {
- InspectionConfigTreeNode node = (InspectionConfigTreeNode)getChildAt(i);
- if (node.isProperSetting()) {
- return true;
- }
- }
- return false;
- }
- };
-
- public InspectionConfigTreeNode(@NotNull Object userObject, ScopeToolState state, boolean byDefault, boolean inspectionNode) {
- super(userObject);
- myState = state;
- myByDefault = byDefault;
- myInspectionNode = inspectionNode;
- if (state != null) {
- setChecked(state.isEnabled());
- }
- }
-
- public InspectionConfigTreeNode(@NotNull Descriptor descriptor, ScopeToolState state, boolean byDefault, boolean isEnabled,
- boolean inspectionNode) {
- this(descriptor, state, byDefault, inspectionNode);
- setChecked(isEnabled);
- }
-
- @Nullable
- public Descriptor getDescriptor() {
- if (userObject instanceof String) return null;
- return (Descriptor)userObject;
- }
-
- @Nullable
- public NamedScope getScope(Project project) {
- return myState == null ? null : myState.getScope(project);
- }
-
- public boolean isByDefault() {
- return myByDefault;
- }
-
- @Nullable
- public String getGroupName() {
- return userObject instanceof String ? (String)userObject : null;
- }
-
- public boolean isInspectionNode() {
- return myInspectionNode;
- }
-
- public void setInspectionNode(boolean inspectionNode) {
- myInspectionNode = inspectionNode;
- }
-
- public void setByDefault(boolean byDefault) {
- myByDefault = byDefault;
- }
-
- @Nullable
- public String getScopeName() {
- return myState != null ? myState.getScopeName() : null;
- }
-
- public boolean isProperSetting() {
- return myProperSetting.getValue();
- }
-
- public void dropCache() {
- myProperSetting.drop();
- }
-
- @Override
- public String toString() {
- if (userObject instanceof Descriptor) {
- return ((Descriptor)userObject).getText();
- }
- return super.toString();
- }
-} \ No newline at end of file
diff --git a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/InspectionToolsConfigurable.java b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/InspectionToolsConfigurable.java
index ad2b44494044..794945268d19 100644
--- a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/InspectionToolsConfigurable.java
+++ b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/InspectionToolsConfigurable.java
@@ -151,7 +151,7 @@ public abstract class InspectionToolsConfigurable extends BaseConfigurable imple
final Set<String> levels = new HashSet<String>();
for (Object o : rootElement.getChildren("inspection_tool")) {
final Element inspectElement = (Element)o;
- levels.add(inspectElement.getAttributeValue("level"));
+ levels.add(inspectElement.getAttributeValue("l"));
for (Object s : inspectElement.getChildren("scope")) {
levels.add(((Element)s).getAttributeValue("level"));
}
diff --git a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/InspectionsAggregationUtil.java b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/InspectionsAggregationUtil.java
new file mode 100644
index 000000000000..3707c034ec04
--- /dev/null
+++ b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/InspectionsAggregationUtil.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2000-2014 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.profile.codeInspection.ui;
+
+import com.intellij.codeInsight.daemon.HighlightDisplayKey;
+import com.intellij.profile.codeInspection.ui.inspectionsTree.InspectionConfigTreeNode;
+import com.intellij.util.Function;
+import com.intellij.util.containers.ContainerUtil;
+import com.intellij.util.containers.Queue;
+import gnu.trove.THashSet;
+
+import javax.swing.tree.TreePath;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * @author Dmitry Batkovich
+ */
+public class InspectionsAggregationUtil {
+ public static List<HighlightDisplayKey> getInspectionsKeys(final InspectionConfigTreeNode node) {
+ return ContainerUtil.map(getInspectionsNodes(node), new Function<InspectionConfigTreeNode, HighlightDisplayKey>() {
+ @Override
+ public HighlightDisplayKey fun(final InspectionConfigTreeNode node) {
+ return node.getKey();
+ }
+ });
+ }
+
+ public static List<InspectionConfigTreeNode> getInspectionsNodes(final InspectionConfigTreeNode node) {
+ final Queue<InspectionConfigTreeNode> q = new Queue<InspectionConfigTreeNode>(1);
+ q.addLast(node);
+ return getInspectionsNodes(q);
+ }
+
+ public static List<InspectionConfigTreeNode> getInspectionsNodes(final TreePath[] paths) {
+ final Queue<InspectionConfigTreeNode> q = new Queue<InspectionConfigTreeNode>(paths.length);
+ for (final TreePath path : paths) {
+ if (path != null) {
+ q.addLast((InspectionConfigTreeNode)path.getLastPathComponent());
+ }
+ }
+ return getInspectionsNodes(q);
+ }
+
+ private static List<InspectionConfigTreeNode> getInspectionsNodes(final Queue<InspectionConfigTreeNode> queue) {
+ final Set<InspectionConfigTreeNode> nodes = new THashSet<InspectionConfigTreeNode>();
+ while (!queue.isEmpty()) {
+ final InspectionConfigTreeNode node = queue.pullFirst();
+ if (node.getDescriptors() == null) {
+ for (int i = 0; i < node.getChildCount(); i++) {
+ final InspectionConfigTreeNode childNode = (InspectionConfigTreeNode) node.getChildAt(i);
+ queue.addLast(childNode);
+ }
+ } else {
+ nodes.add(node);
+ }
+ }
+ return new ArrayList<InspectionConfigTreeNode>(nodes);
+ }
+}
diff --git a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/InspectionsConfigTreeComparator.java b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/InspectionsConfigTreeComparator.java
deleted file mode 100644
index fe60c51e49b9..000000000000
--- a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/InspectionsConfigTreeComparator.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright 2000-2012 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.
- */
-
-/*
- * User: anna
- * Date: 14-May-2009
- */
-package com.intellij.profile.codeInspection.ui;
-
-import com.intellij.codeInspection.ex.Descriptor;
-
-import java.util.Comparator;
-
-public class InspectionsConfigTreeComparator implements Comparator<InspectionConfigTreeNode> {
- @Override
- public int compare(InspectionConfigTreeNode o1, InspectionConfigTreeNode o2) {
- String s1 = null;
- String s2 = null;
- Object userObject1 = o1.getUserObject();
- Object userObject2 = o2.getUserObject();
-
- if (userObject1 instanceof String && userObject2 instanceof String) {
- s1 = (String)userObject1;
- s2 = (String)userObject2;
- } else {
- if (userObject1 instanceof String) return -1;
- if (userObject2 instanceof String) return 1;
- }
-
- if (s1 != null) {
- return getDisplayTextToSort(s1).compareToIgnoreCase(getDisplayTextToSort(s2));
- }
-
- final Descriptor descriptor1 = o1.getDescriptor();
- final Descriptor descriptor2 = o2.getDescriptor();
- if (descriptor1 != null && descriptor2 != null) {
- s1 = descriptor1.getText();
- s2 = descriptor2.getText();
- }
-
- if (s1 != null && s2 != null) {
- return getDisplayTextToSort(s1).compareToIgnoreCase(getDisplayTextToSort(s2));
- }
-
- //can't be
- return -1;
- }
-
- public static String getDisplayTextToSort(String s) {
- if (s.length() == 0) {
- return s;
- }
- while (!Character.isLetterOrDigit(s.charAt(0))) {
- s = s.substring(1);
- if (s.length() == 0) {
- return s;
- }
- }
- return s;
- }
-} \ No newline at end of file
diff --git a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/InspectionsConfigTreeRenderer.java b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/InspectionsConfigTreeRenderer.java
deleted file mode 100644
index 8094a1bfd415..000000000000
--- a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/InspectionsConfigTreeRenderer.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Copyright 2000-2012 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.
- */
-
-/*
- * User: anna
- * Date: 14-May-2009
- */
-package com.intellij.profile.codeInspection.ui;
-
-import com.intellij.codeInspection.InspectionsBundle;
-import com.intellij.codeInspection.ex.Descriptor;
-import com.intellij.codeInspection.ex.GlobalInspectionToolWrapper;
-import com.intellij.codeInspection.ex.InspectionToolWrapper;
-import com.intellij.codeInspection.ex.LocalInspectionToolWrapper;
-import com.intellij.ide.ui.search.SearchUtil;
-import com.intellij.openapi.project.Project;
-import com.intellij.ui.CheckboxTree;
-import com.intellij.ui.JBColor;
-import com.intellij.ui.SimpleTextAttributes;
-import com.intellij.util.ui.PlatformColors;
-import com.intellij.util.ui.UIUtil;
-import org.jetbrains.annotations.NonNls;
-import org.jetbrains.annotations.Nullable;
-
-import javax.swing.*;
-import java.awt.*;
-
-abstract class InspectionsConfigTreeRenderer extends CheckboxTree.CheckboxTreeCellRenderer {
- private final Project myProject;
-
- public InspectionsConfigTreeRenderer(Project project) {
- myProject = project;
- }
-
- protected abstract String getFilter();
-
- @Override
- public void customizeRenderer(final JTree tree,
- final Object value,
- final boolean selected,
- final boolean expanded,
- final boolean leaf,
- final int row,
- final boolean hasFocus) {
- if (!(value instanceof InspectionConfigTreeNode)) return;
- InspectionConfigTreeNode node = (InspectionConfigTreeNode)value;
-
- Object object = node.getUserObject();
-
- final Color background = selected ? UIUtil.getTreeSelectionBackground() : UIUtil.getTreeTextBackground();
- UIUtil.changeBackGround(this, background);
- Color foreground =
- selected ? UIUtil.getTreeSelectionForeground() : node.isProperSetting() ? PlatformColors.BLUE : UIUtil.getTreeTextForeground();
-
- @NonNls String text;
- int style = SimpleTextAttributes.STYLE_PLAIN;
- String hint = null;
- if (object instanceof String) {
- text = (String)object;
- style = SimpleTextAttributes.STYLE_BOLD;
- }
- else {
- final Descriptor descriptor = node.getDescriptor();
- final String scopeName = node.getScopeName();
- if (scopeName != null) {
- if (node.isByDefault()) {
- text = "Everywhere else";
- }
- else {
- text = "In scope \'" + scopeName + "\'";
- if (node.getScope(myProject) == null) {
- foreground = JBColor.RED;
- }
- }
- } else {
- text = descriptor.getText();
- }
- hint = getHint(descriptor);
- }
-
- if (text != null) {
- SearchUtil.appendFragments(getFilter(), text, style, foreground, background,
- getTextRenderer());
- }
- if (hint != null) {
- getTextRenderer()
- .append(" " + hint, selected ? new SimpleTextAttributes(Font.PLAIN, foreground) : SimpleTextAttributes.GRAYED_ATTRIBUTES);
- }
- setForeground(foreground);
- }
-
- @Nullable
- private static String getHint(Descriptor descriptor) {
- final InspectionToolWrapper toolWrapper = descriptor.getToolWrapper();
- if (toolWrapper == null) {
- return InspectionsBundle.message("inspection.tool.availability.in.tree.node");
- }
- if (toolWrapper instanceof LocalInspectionToolWrapper ||
- toolWrapper instanceof GlobalInspectionToolWrapper && !((GlobalInspectionToolWrapper)toolWrapper).worksInBatchModeOnly()) {
- return null;
- }
- return InspectionsBundle.message("inspection.tool.availability.in.tree.node1");
- }
-} \ No newline at end of file
diff --git a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/LevelChooser.java b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/LevelChooser.java
index 2229550d192f..5bc792545c96 100644
--- a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/LevelChooser.java
+++ b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/LevelChooser.java
@@ -56,7 +56,8 @@ public class LevelChooser extends ComboboxWithBrowseButton {
addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
- final SeverityEditorDialog dlg = new SeverityEditorDialog(LevelChooser.this, (HighlightSeverity)getComboBox().getSelectedItem(), severityRegistrar);
+ final SeverityEditorDialog dlg =
+ new SeverityEditorDialog(LevelChooser.this, (HighlightSeverity)getComboBox().getSelectedItem(), severityRegistrar);
dlg.show();
if (dlg.isOK()) {
final Object item = getComboBox().getSelectedItem();
@@ -64,7 +65,8 @@ public class LevelChooser extends ComboboxWithBrowseButton {
final HighlightInfoType type = dlg.getSelectedType();
if (type != null) {
getComboBox().setSelectedItem(type.getSeverity(null));
- } else {
+ }
+ else {
getComboBox().setSelectedItem(item);
}
}
diff --git a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/LevelChooserAction.java b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/LevelChooserAction.java
index ec2fbce96cc5..1067a60ed358 100644
--- a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/LevelChooserAction.java
+++ b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/LevelChooserAction.java
@@ -19,6 +19,7 @@ import com.intellij.codeHighlighting.HighlightDisplayLevel;
import com.intellij.codeInsight.daemon.impl.HighlightInfoType;
import com.intellij.codeInsight.daemon.impl.SeverityRegistrar;
import com.intellij.codeInsight.daemon.impl.SeverityUtil;
+import com.intellij.codeInspection.ex.InspectionProfileImpl;
import com.intellij.codeInspection.ex.SeverityEditorDialog;
import com.intellij.lang.annotation.HighlightSeverity;
import com.intellij.openapi.actionSystem.AnAction;
@@ -26,6 +27,7 @@ import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.DefaultActionGroup;
import com.intellij.openapi.actionSystem.Presentation;
import com.intellij.openapi.actionSystem.ex.ComboBoxAction;
+import com.intellij.profile.codeInspection.SeverityProvider;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
@@ -40,24 +42,15 @@ public abstract class LevelChooserAction extends ComboBoxAction {
private final SeverityRegistrar mySeverityRegistrar;
private HighlightSeverity myChosen = null;
- public LevelChooserAction(final SeverityRegistrar severityRegistrar) {
- mySeverityRegistrar = severityRegistrar;
+ public LevelChooserAction(final InspectionProfileImpl profile) {
+ mySeverityRegistrar = ((SeverityProvider)profile.getProfileManager()).getOwnSeverityRegistrar();
}
@NotNull
@Override
- protected DefaultActionGroup createPopupActionGroup(final JComponent button) {
+ public DefaultActionGroup createPopupActionGroup(final JComponent anchor) {
final DefaultActionGroup group = new DefaultActionGroup();
-
- final SortedSet<HighlightSeverity> severities = new TreeSet<HighlightSeverity>(mySeverityRegistrar);
- for (final SeverityRegistrar.SeverityBasedTextAttributes type : SeverityUtil.getRegisteredHighlightingInfoTypes(mySeverityRegistrar)) {
- severities.add(type.getSeverity());
- }
- severities.add(HighlightSeverity.ERROR);
- severities.add(HighlightSeverity.WARNING);
- severities.add(HighlightSeverity.WEAK_WARNING);
- severities.add(HighlightSeverity.GENERIC_SERVER_ERROR_OR_WARNING);
- for (final HighlightSeverity severity : severities) {
+ for (final HighlightSeverity severity : getSeverities(mySeverityRegistrar)) {
final HighlightSeverityAction action = new HighlightSeverityAction(severity);
if (myChosen == null) {
setChosen(action.getSeverity());
@@ -68,7 +61,7 @@ public abstract class LevelChooserAction extends ComboBoxAction {
group.add(new AnAction("Edit severities...") {
@Override
public void actionPerformed(final AnActionEvent e) {
- final SeverityEditorDialog dlg = new SeverityEditorDialog(button, myChosen, mySeverityRegistrar);
+ final SeverityEditorDialog dlg = new SeverityEditorDialog(anchor, myChosen, mySeverityRegistrar);
dlg.show();
if (dlg.isOK()) {
final HighlightInfoType type = dlg.getSelectedType();
@@ -83,6 +76,18 @@ public abstract class LevelChooserAction extends ComboBoxAction {
return group;
}
+ public static SortedSet<HighlightSeverity> getSeverities(final SeverityRegistrar severityRegistrar) {
+ final SortedSet<HighlightSeverity> severities = new TreeSet<HighlightSeverity>(severityRegistrar);
+ for (final SeverityRegistrar.SeverityBasedTextAttributes type : SeverityUtil.getRegisteredHighlightingInfoTypes(severityRegistrar)) {
+ severities.add(type.getSeverity());
+ }
+ severities.add(HighlightSeverity.ERROR);
+ severities.add(HighlightSeverity.WARNING);
+ severities.add(HighlightSeverity.WEAK_WARNING);
+ severities.add(HighlightSeverity.GENERIC_SERVER_ERROR_OR_WARNING);
+ return severities;
+ }
+
protected abstract void onChosen(final HighlightSeverity severity);
public void setChosen(final HighlightSeverity severity) {
diff --git a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/MultiScopeSeverityIcon.java b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/MultiScopeSeverityIcon.java
new file mode 100644
index 000000000000..2bf909666f82
--- /dev/null
+++ b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/MultiScopeSeverityIcon.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2000-2014 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.profile.codeInspection.ui;
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.List;
+
+/**
+ * @author Dmitry Batkovich
+ */
+public class MultiScopeSeverityIcon implements Icon {
+ private final int mySize;
+ private final List<Color> myColors;
+
+ public MultiScopeSeverityIcon(final int size, final List<Color> colors) {
+ mySize = size;
+ myColors = colors;
+ }
+
+ @Override
+ public void paintIcon(final Component c, final Graphics g, final int i, final int j) {
+ final int iconWidth = getIconWidth();
+ final int iconHeightCoordinate = j + getIconHeight();
+
+ final int partWidth = iconWidth / myColors.size();
+
+ for (int idx = 0; idx < myColors.size(); idx++) {
+ final Color color = myColors.get(idx);
+ g.setColor(color);
+ final int x = i + partWidth * idx;
+ g.fillRect(x, j, x + partWidth, iconHeightCoordinate);
+ }
+ }
+
+ @Override
+ public int getIconWidth() {
+ return mySize;
+ }
+
+ @Override
+ public int getIconHeight() {
+ return mySize;
+ }
+}
diff --git a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/ScopesChooser.java b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/ScopesChooser.java
new file mode 100644
index 000000000000..4932e7ff5ca9
--- /dev/null
+++ b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/ScopesChooser.java
@@ -0,0 +1,98 @@
+/*
+ * Copyright 2000-2014 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.profile.codeInspection.ui;
+
+import com.intellij.codeInspection.ex.Descriptor;
+import com.intellij.codeInspection.ex.InspectionProfileImpl;
+import com.intellij.openapi.actionSystem.AnAction;
+import com.intellij.openapi.actionSystem.AnActionEvent;
+import com.intellij.openapi.actionSystem.DefaultActionGroup;
+import com.intellij.openapi.actionSystem.ex.ComboBoxAction;
+import com.intellij.openapi.project.Project;
+import com.intellij.psi.search.scope.packageSet.CustomScopesProviderEx;
+import com.intellij.psi.search.scope.packageSet.NamedScope;
+import com.intellij.psi.search.scope.packageSet.NamedScopesHolder;
+import org.jetbrains.annotations.NotNull;
+
+import javax.swing.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Collections;
+
+/**
+ * @author Dmitry Batkovich
+ */
+public abstract class ScopesChooser extends ComboBoxAction {
+
+ private final List<Descriptor> myDefaultDescriptors;
+ private final InspectionProfileImpl myInspectionProfile;
+ private final Project myProject;
+
+ public ScopesChooser(final List<Descriptor> defaultDescriptors, final InspectionProfileImpl inspectionProfile, final Project project) {
+ myDefaultDescriptors = defaultDescriptors;
+ myInspectionProfile = inspectionProfile;
+ myProject = project;
+ setPopupTitle("Select a scope to change its settings");
+ getTemplatePresentation().setText("In All Scopes");
+ }
+
+ @NotNull
+ @Override
+ protected DefaultActionGroup createPopupActionGroup(final JComponent button) {
+ final DefaultActionGroup group = new DefaultActionGroup();
+
+ final List<NamedScope> predefinedScopes = new ArrayList<NamedScope>();
+ final List<NamedScope> customScopes = new ArrayList<NamedScope>();
+ for (final NamedScopesHolder holder : NamedScopesHolder.getAllNamedScopeHolders(myProject)) {
+ Collections.addAll(customScopes, holder.getEditableScopes());
+ predefinedScopes.addAll(holder.getPredefinedScopes());
+ }
+ predefinedScopes.remove(CustomScopesProviderEx.getAllScope());
+ fillActionGroup(group, predefinedScopes, myDefaultDescriptors, myInspectionProfile);
+ group.addSeparator();
+ fillActionGroup(group, customScopes, myDefaultDescriptors, myInspectionProfile);
+
+ //TODO edit scopes order
+ //group.addSeparator();
+ //group.add(new AnAction("Edit Scopes Order...") {
+ // @Override
+ // public void actionPerformed(final AnActionEvent e) {
+ //
+ // }
+ //});
+
+ return group;
+ }
+
+ protected abstract void onScopeAdded();
+
+ private void fillActionGroup(final DefaultActionGroup group,
+ final List<NamedScope> scopes,
+ final List<Descriptor> defaultDescriptors,
+ final InspectionProfileImpl inspectionProfile) {
+ for (final NamedScope scope : scopes) {
+ group.add(new AnAction(scope.getName()) {
+ @Override
+ public void actionPerformed(final AnActionEvent e) {
+ for (final Descriptor defaultDescriptor : defaultDescriptors) {
+ inspectionProfile.addScope(defaultDescriptor.getToolWrapper().createCopy(), scope, defaultDescriptor.getLevel(), true, getEventProject(e));
+ }
+ onScopeAdded();
+ }
+ });
+ }
+ }
+}
diff --git a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/SingleInspectionProfilePanel.java b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/SingleInspectionProfilePanel.java
index 62993f5cf9c8..ce5f308c1305 100644
--- a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/SingleInspectionProfilePanel.java
+++ b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/SingleInspectionProfilePanel.java
@@ -52,19 +52,25 @@ import com.intellij.profile.codeInspection.InspectionProfileManager;
import com.intellij.profile.codeInspection.InspectionProfileManagerImpl;
import com.intellij.profile.codeInspection.InspectionProjectProfileManager;
import com.intellij.profile.codeInspection.SeverityProvider;
-import com.intellij.profile.codeInspection.ui.actions.AddScopeAction;
-import com.intellij.profile.codeInspection.ui.actions.DeleteScopeAction;
-import com.intellij.profile.codeInspection.ui.actions.MoveScopeAction;
+import com.intellij.profile.codeInspection.ui.filter.InspectionFilterAction;
+import com.intellij.profile.codeInspection.ui.filter.InspectionsFilter;
+import com.intellij.profile.codeInspection.ui.inspectionsTree.InspectionConfigTreeNode;
+import com.intellij.profile.codeInspection.ui.inspectionsTree.InspectionsConfigTreeComparator;
+import com.intellij.profile.codeInspection.ui.inspectionsTree.InspectionsConfigTreeRenderer;
+import com.intellij.profile.codeInspection.ui.inspectionsTree.InspectionsConfigTreeTable;
+import com.intellij.profile.codeInspection.ui.table.ScopesAndSeveritiesTable;
import com.intellij.psi.search.scope.packageSet.NamedScope;
import com.intellij.ui.*;
+import com.intellij.ui.components.JBLabel;
import com.intellij.ui.treeStructure.Tree;
import com.intellij.util.Alarm;
-import com.intellij.util.IconUtil;
+import com.intellij.util.Function;
import com.intellij.util.config.StorageAccessors;
-import com.intellij.util.containers.Convertor;
+import com.intellij.util.containers.*;
import com.intellij.util.ui.UIUtil;
import com.intellij.util.ui.tree.TreeUtil;
import com.intellij.xml.util.XmlStringUtil;
+import gnu.trove.THashSet;
import org.jdom.Element;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
@@ -76,7 +82,6 @@ import javax.swing.event.TreeExpansionListener;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
import javax.swing.tree.DefaultTreeModel;
-import javax.swing.tree.DefaultTreeSelectionModel;
import javax.swing.tree.TreeNode;
import javax.swing.tree.TreePath;
import java.awt.*;
@@ -85,6 +90,7 @@ import java.awt.event.KeyEvent;
import java.io.IOException;
import java.io.StringReader;
import java.util.*;
+import java.util.HashSet;
import java.util.List;
/**
@@ -95,17 +101,23 @@ public class SingleInspectionProfilePanel extends JPanel {
private static final Logger LOG = Logger.getInstance("#com.intellij.codeInspection.ex.InspectionToolsPanel");
@NonNls private static final String INSPECTION_FILTER_HISTORY = "INSPECTION_FILTER_HISTORY";
private static final String UNDER_CONSTRUCTION = InspectionsBundle.message("inspection.tool.description.under.construction.text");
- private final Map<Descriptor, List<Descriptor>> myDescriptors = new HashMap<Descriptor, List<Descriptor>>();
+ private final List<ToolDescriptors> myInitialToolDescriptors = new ArrayList<ToolDescriptors>();
private InspectionProfileImpl mySelectedProfile;
private JEditorPane myBrowser;
private JPanel myOptionsPanel;
private JPanel myInspectionProfilePanel = null;
private FilterComponent myProfileFilter;
+ private final InspectionsFilter myInspectionsFilter = new InspectionsFilter() {
+ @Override
+ protected void filterChanged() {
+ filterTree(myProfileFilter.getFilter());
+ }
+ };
private final InspectionConfigTreeNode myRoot =
- new InspectionConfigTreeNode(InspectionsBundle.message("inspection.root.node.title"), null, false, false);
+ new InspectionConfigTreeNode(InspectionsBundle.message("inspection.root.node.title"));
private final Alarm myAlarm = new Alarm();
private boolean myModified = false;
- private Tree myTree;
+ private InspectionsConfigTreeTable myTreeTable;
private TreeExpander myTreeExpander;
@NotNull
private String myInitialProfile;
@@ -171,21 +183,21 @@ public class SingleInspectionProfilePanel extends JPanel {
}
public void updateSelection() {
- if (myTree != null) {
- final TreePath selectionPath = myTree.getSelectionPath();
+ if (myTreeTable != null) {
+ final TreePath selectionPath = myTreeTable.getTree().getSelectionPath();
if (selectionPath != null) {
- TreeUtil.selectNode(myTree, (TreeNode)selectionPath.getLastPathComponent());
- TreeUtil.showRowCentered(myTree, myTree.getRowForPath(selectionPath), false);
+ TreeUtil.selectNode(myTreeTable.getTree(), (TreeNode)selectionPath.getLastPathComponent());
+ TreeUtil.showRowCentered(myTreeTable.getTree(), myTreeTable.getTree().getRowForPath(selectionPath), false);
}
}
}
private void wereToolSettingsModified() {
- for (Map.Entry<Descriptor, List<Descriptor>> entry : myDescriptors.entrySet()) {
- Descriptor desc = entry.getKey();
+ for (final ToolDescriptors toolDescriptor : myInitialToolDescriptors) {
+ Descriptor desc = toolDescriptor.getDefaultDescriptor();
if (wereToolSettingsModified(desc)) return;
- List<Descriptor> descriptors = entry.getValue();
+ List<Descriptor> descriptors = toolDescriptor.getNonDefaultDescriptors();
for (Descriptor descriptor : descriptors) {
if (wereToolSettingsModified(descriptor)) return;
}
@@ -206,7 +218,7 @@ public class SingleInspectionProfilePanel extends JPanel {
myAlarm.addRequest(new Runnable() {
@Override
public void run() {
- myTree.repaint();
+ myTreeTable.repaint();
}
}, 300);
myModified = true;
@@ -216,10 +228,10 @@ public class SingleInspectionProfilePanel extends JPanel {
}
private void updateProperSettingsForSelection() {
- final TreePath selectionPath = myTree.getSelectionPath();
+ final TreePath selectionPath = myTreeTable.getTree().getSelectionPath();
if (selectionPath != null) {
InspectionConfigTreeNode node = (InspectionConfigTreeNode)selectionPath.getLastPathComponent();
- final Descriptor descriptor = node.getDescriptor();
+ final Descriptor descriptor = node.getDefaultDescriptor();
if (descriptor != null) {
final boolean properSetting = mySelectedProfile.isProperSetting(descriptor.getKey().toString());
if (node.isProperSetting() != properSetting) {
@@ -227,7 +239,7 @@ public class SingleInspectionProfilePanel extends JPanel {
myAlarm.addRequest(new Runnable() {
@Override
public void run() {
- myTree.repaint();
+ myTreeTable.repaint();
}
}, 300);
node.dropCache();
@@ -237,21 +249,14 @@ public class SingleInspectionProfilePanel extends JPanel {
}
}
- private void initDescriptors() {
+ private void initToolStates() {
final InspectionProfileImpl profile = mySelectedProfile;
if (profile == null) return;
- myDescriptors.clear();
- List<ScopeToolState> tools = profile.getDefaultStates(myProjectProfileManager.getProject());
- for (ScopeToolState state : tools) {
- final ArrayList<Descriptor> descriptors = new ArrayList<Descriptor>();
+ myInitialToolDescriptors.clear();
+ final Project project = myProjectProfileManager.getProject();
+ for (final ScopeToolState state : profile.getDefaultStates(myProjectProfileManager.getProject())) {
if (!accept(state.getTool())) continue;
- Project project = myProjectProfileManager.getProject();
- myDescriptors.put(new Descriptor(state, profile, project), descriptors);
- InspectionToolWrapper toolWrapper = state.getTool();
- final List<ScopeToolState> nonDefaultTools = profile.getNonDefaultTools(toolWrapper.getShortName(), project);
- for (ScopeToolState nonDefaultToolState : nonDefaultTools) {
- descriptors.add(new Descriptor(nonDefaultToolState, profile, project));
- }
+ myInitialToolDescriptors.add(ToolDescriptors.fromScopeToolState(state, profile, project));
}
}
@@ -267,7 +272,7 @@ public class SingleInspectionProfilePanel extends JPanel {
}
fillTreeData(myProfileFilter.getFilter(), true);
repaintTableData();
- updateOptionsAndDescriptionPanel(myTree.getSelectionPath());
+ updateOptionsAndDescriptionPanel(myTreeTable.getTree().getSelectionPaths());
}
@Nullable
@@ -311,22 +316,26 @@ public class SingleInspectionProfilePanel extends JPanel {
myProfileFilter.setFilter(filter);
}
- public void filterTree(String filter) {
- if (myTree != null) {
- getExpandedNodes(mySelectedProfile).saveVisibleState(myTree);
+ private void filterTree(@Nullable String filter) {
+ if (myTreeTable != null) {
+ getExpandedNodes(mySelectedProfile).saveVisibleState(myTreeTable.getTree());
fillTreeData(filter, true);
reloadModel();
restoreTreeState();
- if (myTree.getSelectionPath() == null) {
- TreeUtil.selectFirstNode(myTree);
+ if (myTreeTable.getTree().getSelectionPath() == null) {
+ TreeUtil.selectFirstNode(myTreeTable.getTree());
}
}
}
+ private void filterTree() {
+ filterTree(myProfileFilter != null ? myProfileFilter.getFilter() : null);
+ }
+
private void reloadModel() {
try {
myIsInRestore = true;
- ((DefaultTreeModel)myTree.getModel()).reload();
+ ((DefaultTreeModel)myTreeTable.getTree().getModel()).reload();
}
finally {
myIsInRestore = false;
@@ -338,7 +347,7 @@ public class SingleInspectionProfilePanel extends JPanel {
try {
myIsInRestore = true;
- getExpandedNodes(mySelectedProfile).restoreVisibleState(myTree);
+ getExpandedNodes(mySelectedProfile).restoreVisibleState(myTreeTable.getTree());
}
finally {
myIsInRestore = false;
@@ -349,13 +358,17 @@ public class SingleInspectionProfilePanel extends JPanel {
final CommonActionsManager actionManager = CommonActionsManager.getInstance();
DefaultActionGroup actions = new DefaultActionGroup();
- actions.add(actionManager.createExpandAllAction(myTreeExpander, myTree));
- actions.add(actionManager.createCollapseAllAction(myTreeExpander, myTree));
+
+ actions.add(new InspectionFilterAction(mySelectedProfile, myInspectionsFilter));
+ actions.addSeparator();
+
+ actions.add(actionManager.createExpandAllAction(myTreeExpander, myTreeTable));
+ actions.add(actionManager.createCollapseAllAction(myTreeExpander, myTreeTable));
actions.add(new AnAction(CommonBundle.message("button.reset.to.default"), CommonBundle.message("button.reset.to.default"),
AllIcons.General.Reset) {
{
- registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_R, InputEvent.CTRL_MASK)), myTree);
+ registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_R, InputEvent.CTRL_MASK)), myTreeTable);
}
@Override
public void update(AnActionEvent e) {
@@ -395,41 +408,14 @@ public class SingleInspectionProfilePanel extends JPanel {
}
});
- actions.addSeparator();
- actions.add(new MyAddScopeAction());
- actions.add(new MyDeleteScopeAction());
- actions.add(new MoveScopeAction(myTree, "Move Scope Up", IconUtil.getMoveUpIcon(), -1) {
- @Override
- protected boolean isEnabledFor(int idx, InspectionConfigTreeNode parent) {
- return idx > 0;
- }
-
- @Override
- protected InspectionProfileImpl getSelectedProfile() {
- return mySelectedProfile;
- }
- });
- actions.add(new MoveScopeAction(myTree, "Move Scope Down", IconUtil.getMoveDownIcon(), 1) {
- @Override
- protected boolean isEnabledFor(int idx, InspectionConfigTreeNode parent) {
- return idx < parent.getChildCount() - 2;
- }
-
- @Override
- protected InspectionProfileImpl getSelectedProfile() {
- return mySelectedProfile;
- }
- });
- actions.addSeparator();
-
final ActionToolbar actionToolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, actions, true);
actionToolbar.setTargetComponent(this);
return actionToolbar;
}
private void repaintTableData() {
- if (myTree != null) {
- getExpandedNodes(mySelectedProfile).saveVisibleState(myTree);
+ if (myTreeTable != null) {
+ getExpandedNodes(mySelectedProfile).saveVisibleState(myTreeTable.getTree());
reloadModel();
restoreTreeState();
}
@@ -438,8 +424,8 @@ public class SingleInspectionProfilePanel extends JPanel {
public void selectInspectionTool(String name) {
final InspectionConfigTreeNode node = findNodeByKey(name, myRoot);
if (node != null) {
- TreeUtil.showRowCentered(myTree, myTree.getRowForPath(new TreePath(node.getPath())) - 1, true);//myTree.isRootVisible ? 0 : 1;
- TreeUtil.selectNode(myTree, node);
+ TreeUtil.showRowCentered(myTreeTable.getTree(), myTreeTable.getTree().getRowForPath(new TreePath(node.getPath())) - 1, true);//myTree.isRootVisible ? 0 : 1;
+ TreeUtil.selectNode(myTreeTable.getTree(), node);
}
}
@@ -447,7 +433,7 @@ public class SingleInspectionProfilePanel extends JPanel {
private static InspectionConfigTreeNode findNodeByKey(String name, InspectionConfigTreeNode root) {
for (int i = 0; i < root.getChildCount(); i++) {
final InspectionConfigTreeNode child = (InspectionConfigTreeNode)root.getChildAt(i);
- final Descriptor descriptor = child.getDescriptor();
+ final Descriptor descriptor = child.getDefaultDescriptor();
if (descriptor != null) {
if (descriptor.getKey().toString().equals(name)) {
return child;
@@ -462,42 +448,37 @@ public class SingleInspectionProfilePanel extends JPanel {
}
private JScrollPane initTreeScrollPane() {
-
fillTreeData(null, true);
- final InspectionsConfigTreeRenderer renderer = new InspectionsConfigTreeRenderer(myProjectProfileManager.getProject()){
+ final InspectionsConfigTreeRenderer renderer = new InspectionsConfigTreeRenderer(){
@Override
protected String getFilter() {
return myProfileFilter != null ? myProfileFilter.getFilter() : null;
}
};
- myTree = new CheckboxTree(renderer, myRoot) {
+ myTreeTable = new InspectionsConfigTreeTable(new InspectionsConfigTreeTable.InspectionsConfigTreeTableSettings(myRoot, myProjectProfileManager.getProject()) {
@Override
- public Dimension getPreferredScrollableViewportSize() {
- Dimension size = super.getPreferredScrollableViewportSize();
- size = new Dimension(size.width + 10, size.height);
- return size;
+ protected void onChanged(final InspectionConfigTreeNode node) {
+ updateOptionsAndDescriptionPanel();
+ updateUpHierarchy(node, (InspectionConfigTreeNode)node.getParent());
}
@Override
- protected void onNodeStateChanged(final CheckedTreeNode node) {
- toggleToolNode((InspectionConfigTreeNode)node);
+ public InspectionProfileImpl getInspectionProfile() {
+ return mySelectedProfile;
}
- };
-
-
- myTree.setCellRenderer(renderer);
- myTree.setRootVisible(false);
- myTree.setShowsRootHandles(true);
- UIUtil.setLineStyleAngled(myTree);
- TreeUtil.installActions(myTree);
+ });
+ myTreeTable.setTreeCellRenderer(renderer);
+ myTreeTable.setRootVisible(false);
+ UIUtil.setLineStyleAngled(myTreeTable.getTree());
+ TreeUtil.installActions(myTreeTable.getTree());
- myTree.addTreeSelectionListener(new TreeSelectionListener() {
+ myTreeTable.getTree().addTreeSelectionListener(new TreeSelectionListener() {
@Override
public void valueChanged(TreeSelectionEvent e) {
- if (myTree.getSelectionPaths() != null && myTree.getSelectionPaths().length == 1) {
- updateOptionsAndDescriptionPanel(myTree.getSelectionPaths()[0]);
+ if (myTreeTable.getTree().getSelectionPaths() != null) {
+ updateOptionsAndDescriptionPanel(myTreeTable.getTree().getSelectionPaths());
}
else {
initOptionsAndDescriptionPanel();
@@ -508,9 +489,9 @@ public class SingleInspectionProfilePanel extends JPanel {
if (selected != null) {
InspectionProfileImpl baseProfile = (InspectionProfileImpl)selected.getParentProfile();
if (baseProfile != null) {
- getExpandedNodes(baseProfile).setSelectionPaths(myTree.getSelectionPaths());
+ getExpandedNodes(baseProfile).setSelectionPaths(myTreeTable.getTree().getSelectionPaths());
}
- getExpandedNodes(selected).setSelectionPaths(myTree.getSelectionPaths());
+ getExpandedNodes(selected).setSelectionPaths(myTreeTable.getTree().getSelectionPaths());
}
}
@@ -518,36 +499,35 @@ public class SingleInspectionProfilePanel extends JPanel {
});
- myTree.addMouseListener(new PopupHandler() {
+ myTreeTable.addMouseListener(new PopupHandler() {
@Override
public void invokePopup(Component comp, int x, int y) {
- final int[] selectionRows = myTree.getSelectionRows();
- if (selectionRows != null && myTree.getPathForLocation(x, y) != null && Arrays.binarySearch(selectionRows, myTree.getRowForLocation(x, y)) > -1)
- {
+ final int[] selectionRows = myTreeTable.getTree().getSelectionRows();
+ if (selectionRows != null &&
+ myTreeTable.getTree().getPathForLocation(x, y) != null &&
+ Arrays.binarySearch(selectionRows, myTreeTable.getTree().getRowForLocation(x, y)) > -1) {
compoundPopup().show(comp, x, y);
}
}
});
- new TreeSpeedSearch(myTree, new Convertor<TreePath, String>() {
+ new TreeSpeedSearch(myTreeTable.getTree(), new Convertor<TreePath, String>() {
@Override
public String convert(TreePath o) {
final InspectionConfigTreeNode node = (InspectionConfigTreeNode)o.getLastPathComponent();
- final Descriptor descriptor = node.getDescriptor();
+ final Descriptor descriptor = node.getDefaultDescriptor();
return descriptor != null ? InspectionsConfigTreeComparator.getDisplayTextToSort(descriptor.getText()) : InspectionsConfigTreeComparator
.getDisplayTextToSort(node.getGroupName());
}
});
- myTree.setSelectionModel(new DefaultTreeSelectionModel());
-
- final JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myTree);
+ final JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myTreeTable);
scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
- TreeUtil.collapseAll(myTree, 1);
+ TreeUtil.collapseAll(myTreeTable.getTree(), 1);
- myTree.addTreeExpansionListener(new TreeExpansionListener() {
+ myTreeTable.getTree().addTreeExpansionListener(new TreeExpansionListener() {
@Override
@@ -556,9 +536,9 @@ public class SingleInspectionProfilePanel extends JPanel {
final InspectionConfigTreeNode node = (InspectionConfigTreeNode)event.getPath().getLastPathComponent();
final InspectionProfileImpl parentProfile = (InspectionProfileImpl)selected.getParentProfile();
if (parentProfile != null) {
- getExpandedNodes(parentProfile).saveVisibleState(myTree);
+ getExpandedNodes(parentProfile).saveVisibleState(myTreeTable.getTree());
}
- getExpandedNodes(selected).saveVisibleState(myTree);
+ getExpandedNodes(selected).saveVisibleState(myTreeTable.getTree());
}
@Override
@@ -575,7 +555,17 @@ public class SingleInspectionProfilePanel extends JPanel {
}
});
- myTreeExpander = new DefaultTreeExpander(myTree);
+ myTreeExpander = new DefaultTreeExpander(myTreeTable.getTree()) {
+ @Override
+ public boolean canExpand() {
+ return myTreeTable.isShowing();
+ }
+
+ @Override
+ public boolean canCollapse() {
+ return myTreeTable.isShowing();
+ }
+ };
myProfileFilter = new MyFilterComponent();
return scrollPane;
@@ -603,54 +593,14 @@ public class SingleInspectionProfilePanel extends JPanel {
});
}
group.add(Separator.getInstance());
- group.add(new MyAddScopeAction());
- group.add(new MyDeleteScopeAction());
ActionPopupMenu menu = ActionManager.getInstance().createActionPopupMenu(ActionPlaces.UNKNOWN, group);
return menu.getComponent();
}
- static String renderSeverity(HighlightSeverity severity) {
+ public static String renderSeverity(HighlightSeverity severity) {
return StringUtil.capitalizeWords(severity.getName().toLowerCase(), true);
}
- private void toggleToolNode(final InspectionConfigTreeNode toolNode) {
- final Descriptor descriptor = toolNode.getDescriptor();
- Project project = myProjectProfileManager.getProject();
- if (descriptor!= null) {
- final HighlightDisplayKey key = descriptor.getKey();
- final String toolShortName = key.toString();
- if (toolNode.isChecked()) {
- if (toolNode.getScope(project) != null){
- if (toolNode.isByDefault()) {
- mySelectedProfile.enableToolByDefault(toolShortName, project);
- }
- else {
- mySelectedProfile.enableTool(toolShortName, toolNode.getScope(project), project);
- }
- } else {
- mySelectedProfile.enableTool(toolShortName, project);
- }
- }
- else {
- if (toolNode.getScope(project) != null) {
- if (toolNode.isByDefault()) {
- mySelectedProfile.disableToolByDefault(toolShortName, project);
- } else {
- mySelectedProfile.disableTool(toolShortName, toolNode.getScope(project), project);
- }
- } else if (toolNode.getChildCount() == 0){ //default node and no scopes configured
- mySelectedProfile.disableTool(toolShortName, project);
- }
- }
- toolNode.dropCache();
- updateUpHierarchy(toolNode, (InspectionConfigTreeNode)toolNode.getParent());
- }
- final TreePath path = new TreePath(toolNode.getPath());
- if (Comparing.equal(myTree.getSelectionPath(), path)) {
- updateOptionsAndDescriptionPanel(path);
- }
- }
-
private static void updateUpHierarchy(final InspectionConfigTreeNode node, final InspectionConfigTreeNode parent) {
if (parent != null) {
parent.dropCache();
@@ -701,10 +651,9 @@ public class SingleInspectionProfilePanel extends JPanel {
return forceInclude;
}
- private void fillTreeData(String filter, boolean forceInclude) {
+ private void fillTreeData(@Nullable String filter, boolean forceInclude) {
if (mySelectedProfile == null) return;
myRoot.removeAllChildren();
- myRoot.setChecked(false);
myRoot.dropCache();
List<Set<String>> keySetList = new ArrayList<Set<String>>();
final Set<String> quoted = new HashSet<String>();
@@ -712,23 +661,17 @@ public class SingleInspectionProfilePanel extends JPanel {
keySetList.addAll(SearchUtil.findKeys(filter, quoted));
}
Project project = myProjectProfileManager.getProject();
- for (Descriptor descriptor : myDescriptors.keySet()) {
+ final boolean emptyFilter = myInspectionsFilter.isEmptyFilter();
+ for (ToolDescriptors toolDescriptors : myInitialToolDescriptors) {
+ final Descriptor descriptor = toolDescriptors.getDefaultDescriptor();
if (filter != null && !filter.isEmpty() && !isDescriptorAccepted(descriptor, filter, forceInclude, keySetList, quoted)) {
continue;
}
- final List<ScopeToolState> nonDefaultTools = mySelectedProfile.getNonDefaultTools(descriptor.getKey().toString(), project);
- final HighlightDisplayKey key = descriptor.getKey();
- final boolean enabled = mySelectedProfile.isToolEnabled(key);
- boolean hasNonDefaultScope = !nonDefaultTools.isEmpty();
- final InspectionConfigTreeNode node = new InspectionConfigTreeNode(descriptor, null, !hasNonDefaultScope, enabled, !hasNonDefaultScope);
- getGroupNode(myRoot, descriptor.getGroup()).add(node);
- if (hasNonDefaultScope) {
- for (Descriptor desc : myDescriptors.get(descriptor)) {
- node.add(new InspectionConfigTreeNode(desc, desc.getState(), false, false));
- }
- node.add(new InspectionConfigTreeNode(descriptor, descriptor.getState(), true, false));
+ if (!emptyFilter && !myInspectionsFilter.matches(mySelectedProfile.getTools(toolDescriptors.getDefaultDescriptor().getKey().toString(), project))) {
+ continue;
}
- myRoot.setEnabled(myRoot.isEnabled() || enabled);
+ final InspectionConfigTreeNode node = new InspectionConfigTreeNode(toolDescriptors);
+ getGroupNode(myRoot, toolDescriptors.getDefaultDescriptor().getGroup()).add(node);
myRoot.dropCache();
}
if (filter != null && forceInclude && myRoot.getChildCount() == 0) {
@@ -740,19 +683,24 @@ public class SingleInspectionProfilePanel extends JPanel {
TreeUtil.sort(myRoot, new InspectionsConfigTreeComparator());
}
- private void updateOptionsAndDescriptionPanel(TreePath path) {
+ private void updateOptionsAndDescriptionPanel(final TreePath... paths) {
+ if (paths == null || paths.length == 0) {
+ return;
+ }
+ final TreePath path = paths[0];
if (path == null) return;
- final InspectionConfigTreeNode node = (InspectionConfigTreeNode)path.getLastPathComponent();
- final Descriptor descriptor = node.getDescriptor();
- if (descriptor != null) {
- final String description = descriptor.loadDescription();
-
- if (description != null) {
+ final List<InspectionConfigTreeNode> nodes = InspectionsAggregationUtil.getInspectionsNodes(paths);
+ if (!nodes.isEmpty()) {
+ final InspectionConfigTreeNode singleNode = nodes.size() == 1 ? ContainerUtil.getFirstItem(nodes) : null;
+ if (singleNode != null && singleNode.getDefaultDescriptor().loadDescription() != null) {
// need this in order to correctly load plugin-supplied descriptions
+ final Descriptor defaultDescriptor = singleNode.getDefaultDescriptor();
+ final String description = defaultDescriptor.loadDescription();
try {
final HintHint hintHint = new HintHint(myBrowser, new Point(0, 0));
hintHint.setFont(myBrowser.getFont());
- myBrowser.read(new StringReader(SearchUtil.markup(HintUtil.prepareHintText(description, hintHint), myProfileFilter.getFilter())), null);
+ myBrowser
+ .read(new StringReader(SearchUtil.markup(HintUtil.prepareHintText(description, hintHint), myProfileFilter.getFilter())), null);
}
catch (IOException e2) {
try {
@@ -764,7 +712,10 @@ public class SingleInspectionProfilePanel extends JPanel {
}
}
catch (Throwable t) {
- LOG.error("Failed to load description for: " + descriptor.getToolWrapper().getTool().getClass() + "; description: " + description, t);
+ LOG.error("Failed to load description for: " +
+ defaultDescriptor.getToolWrapper().getTool().getClass() +
+ "; description: " +
+ description, t);
}
}
@@ -778,41 +729,123 @@ public class SingleInspectionProfilePanel extends JPanel {
}
myOptionsPanel.removeAll();
+ final Project project = myProjectProfileManager.getProject();
+ final JPanel severityPanel = new JPanel(new GridBagLayout());
+ final double severityPanelWeightY;
+ final JPanel configPanelAnchor = new JPanel(new GridLayout());
+ configPanelAnchor.setBorder(IdeBorderFactory.createTitledBorder("Options", false, new Insets(0, 0, 0, 0)));
+
+ final Set<String> scopesNames = new THashSet<String>();
+ for (final InspectionConfigTreeNode node : nodes) {
+ final List<ScopeToolState> nonDefaultTools = mySelectedProfile.getNonDefaultTools(node.getDefaultDescriptor().getKey().toString(), project);
+ for (final ScopeToolState tool : nonDefaultTools) {
+ scopesNames.add(tool.getScopeName());
+ }
+ }
+
+ if (scopesNames.isEmpty()) {
- final NamedScope scope = node.getScope(myProjectProfileManager.getProject());
- if (scope != null || node.isInspectionNode()) {
- final HighlightDisplayKey key = descriptor.getKey();
- final LevelChooserAction chooser =
- new LevelChooserAction(((SeverityProvider)mySelectedProfile.getProfileManager()).getOwnSeverityRegistrar()) {
+ final LevelChooserAction severityLevelChooser =
+ new LevelChooserAction(mySelectedProfile) {
@Override
protected void onChosen(final HighlightSeverity severity) {
final HighlightDisplayLevel level = HighlightDisplayLevel.find(severity);
- final Project project = myProjectProfileManager.getProject();
- final boolean toUpdate = mySelectedProfile.getErrorLevel(key, scope, project) != level;
- mySelectedProfile.setErrorLevel(key, level,
- node.isInspectionNode() || node.isByDefault() ? -1 : node.getParent().getIndex(node),
- project);
- if (toUpdate) node.dropCache();
+ for (final InspectionConfigTreeNode node : nodes) {
+ final HighlightDisplayKey key = node.getDefaultDescriptor().getKey();
+ final NamedScope scope = node.getDefaultDescriptor().getScope();
+ final boolean toUpdate = mySelectedProfile.getErrorLevel(key, scope, project) != level;
+ mySelectedProfile.setErrorLevel(key, level, -1, project);
+ if (toUpdate) node.dropCache();
+ }
+
}
};
- chooser.setChosen(mySelectedProfile.getErrorLevel(key, scope, myProjectProfileManager.getProject()).getSeverity());
+ final HighlightSeverity severity =
+ ScopesAndSeveritiesTable.getSeverity(ContainerUtil.map(nodes, new Function<InspectionConfigTreeNode, ScopeToolState>() {
+ @Override
+ public ScopeToolState fun(InspectionConfigTreeNode node) {
+ return node.getDefaultDescriptor().getState();
+ }
+ }));
+ severityLevelChooser.setChosen(severity);
- final JPanel withSeverity = new JPanel(new GridBagLayout());
- withSeverity.add(new JLabel(InspectionsBundle.message("inspection.severity")),
- new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.WEST,
- GridBagConstraints.NONE, new Insets(0, 0, 10, 10), 0, 0));
- withSeverity.add(chooser.createCustomComponent(chooser.getTemplatePresentation()), new GridBagConstraints(1, 0, 1, 1, 1.0, 0, GridBagConstraints.WEST,
- GridBagConstraints.NONE, new Insets(0, 0, 10, 0), 0, 0));
+ final ScopesChooser scopesChooser = new ScopesChooser(ContainerUtil.map(nodes, new Function<InspectionConfigTreeNode, Descriptor>() {
+ @Override
+ public Descriptor fun(final InspectionConfigTreeNode node) {
+ return node.getDefaultDescriptor();
+ }
+ }), mySelectedProfile, project) {
+ @Override
+ protected void onScopeAdded() {
+ updateOptionsAndDescriptionPanel();
+ }
+ };
+
+ severityPanel.add(new JLabel(InspectionsBundle.message("inspection.severity")),
+ new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.VERTICAL,
+ new Insets(10, 0, 10, 10), 0, 0));
+ severityPanel.add(severityLevelChooser.createCustomComponent(severityLevelChooser.getTemplatePresentation()),
+ new GridBagConstraints(1, 0, 1, 1, 1.0, 0, GridBagConstraints.WEST, GridBagConstraints.VERTICAL,
+ new Insets(10, 0, 10, 0), 0, 0));
+ severityPanel.add(scopesChooser.createCustomComponent(scopesChooser.getTemplatePresentation()),
+ new GridBagConstraints(2, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.VERTICAL,
+ new Insets(10, 0, 10, 0), 0, 0));
+ severityPanelWeightY = 0.0;
+ if (singleNode != null) {
+ setConfigPanel(configPanelAnchor, mySelectedProfile.getToolDefaultState(singleNode.getDefaultDescriptor().getKey().toString(),
+ project));
+ }
+ }
+ else {
+ if (singleNode != null) {
+ for (final Descriptor descriptor : singleNode.getDescriptors().getNonDefaultDescriptors()) {
+ descriptor.loadConfig();
+ }
+ }
+ final JTable scopesAndScopesAndSeveritiesTable =
+ new ScopesAndSeveritiesTable(new ScopesAndSeveritiesTable.TableSettings(nodes, mySelectedProfile, myTreeTable, project) {
+ @Override
+ protected void onScopeChosen(@NotNull final ScopeToolState state) {
+ setConfigPanel(configPanelAnchor, state);
+ configPanelAnchor.revalidate();
+ configPanelAnchor.repaint();
+ }
- final JComponent comp = descriptor.getState().getAdditionalConfigPanel();
- withSeverity.add(comp,
- new GridBagConstraints(0, 1, 2, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST,
- GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
+ @Override
+ protected void onChange() {
+ myTreeTable.getTree().updateUI();
+ }
+
+ @Override
+ protected void onScopeAdded() {
+ }
- myOptionsPanel.add(withSeverity, BorderLayout.CENTER);
+ @Override
+ protected void onScopeRemoved(final int scopesCount) {
+ if (scopesCount == 1) {
+ updateOptionsAndDescriptionPanel();
+ }
+ }
+ });
+
+
+ final ToolbarDecorator wrappedTable = ToolbarDecorator.createDecorator(scopesAndScopesAndSeveritiesTable);
+ final JPanel panel = wrappedTable.createPanel();
+ severityPanel.add(new JBLabel("Scopes & Severities"),
+ new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE,
+ new Insets(5, 0, 2, 10), 0, 0));
+ severityPanel.add(new JBLabel("Add scope to change its settings", UIUtil.ComponentStyle.SMALL),
+ new GridBagConstraints(1, 0, 1, 1, 1.0, 0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE,
+ new Insets(5, 0, 2, 0), 0, 0));
+ severityPanel.add(panel, new GridBagConstraints(0, 1, 2, 1, 0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH,
+ new Insets(0, 0, 0, 0), 0, 0));
+ severityPanelWeightY = 0.3;
}
+ myOptionsPanel.add(severityPanel, new GridBagConstraints(0, 0, 1, 1, 1.0, severityPanelWeightY, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
+ myOptionsPanel.add(configPanelAnchor, new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH,
+ new Insets(0, 0, 0, 0), 0, 0));
myOptionsPanel.revalidate();
- GuiUtils.enableChildren(myOptionsPanel, node.isChecked());
+ GuiUtils.enableChildren(myOptionsPanel, isThoughOneNodeEnabled(nodes));
}
else {
initOptionsAndDescriptionPanel();
@@ -820,6 +853,26 @@ public class SingleInspectionProfilePanel extends JPanel {
myOptionsPanel.repaint();
}
+ private boolean isThoughOneNodeEnabled(final List<InspectionConfigTreeNode> nodes) {
+ final Project project = myProjectProfileManager.getProject();
+ for (final InspectionConfigTreeNode node : nodes) {
+ final String toolId = node.getDefaultDescriptor().getKey().toString();
+ if (mySelectedProfile.getTools(toolId, project).isEnabled()) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private void updateOptionsAndDescriptionPanel() {
+ final TreePath[] paths = myTreeTable.getTree().getSelectionPaths();
+ if (paths != null) {
+ updateOptionsAndDescriptionPanel(paths);
+ } else {
+ initOptionsAndDescriptionPanel();
+ }
+ }
+
private void initOptionsAndDescriptionPanel() {
myOptionsPanel.removeAll();
try {
@@ -832,6 +885,11 @@ public class SingleInspectionProfilePanel extends JPanel {
myOptionsPanel.repaint();
}
+ private static void setConfigPanel(final JPanel configPanelAnchor, final ScopeToolState state) {
+ configPanelAnchor.removeAll();
+ configPanelAnchor.add(state.getAdditionalConfigPanel());
+ }
+
private static InspectionConfigTreeNode getGroupNode(InspectionConfigTreeNode root, String[] groupPath) {
InspectionConfigTreeNode currentRoot = root;
for (final String group : groupPath) {
@@ -848,7 +906,7 @@ public class SingleInspectionProfilePanel extends JPanel {
return child;
}
}
- InspectionConfigTreeNode child = new InspectionConfigTreeNode(group, null, false, false);
+ InspectionConfigTreeNode child = new InspectionConfigTreeNode(group);
root.add(child);
return child;
}
@@ -868,8 +926,8 @@ public class SingleInspectionProfilePanel extends JPanel {
if (mySelectedProfile != null) {
myInitialProfile = mySelectedProfile.getName();
}
- initDescriptors();
- filterTree(myProfileFilter != null ? myProfileFilter.getFilter() : null);
+ initToolStates();
+ filterTree();
}
@Override
@@ -900,7 +958,7 @@ public class SingleInspectionProfilePanel extends JPanel {
myBrowser.setBorder(IdeBorderFactory.createEmptyBorder(5, 5, 5, 5));
myBrowser.addHyperlinkListener(new BrowserHyperlinkListener());
- initDescriptors();
+ initToolStates();
fillTreeData(myProfileFilter != null ? myProfileFilter.getFilter() : null, true);
JPanel descriptionPanel = new JPanel(new BorderLayout());
@@ -912,9 +970,7 @@ public class SingleInspectionProfilePanel extends JPanel {
myRightSplitter.setFirstComponent(descriptionPanel);
myRightSplitter.setProportion(myProperties.getFloat(HORIZONTAL_DIVIDER_PROPORTION, 0.5f));
- myOptionsPanel = new JPanel(new BorderLayout());
- myOptionsPanel.setBorder(IdeBorderFactory.createTitledBorder("Options", false,
- new Insets(0, 0, 0, 0)));
+ myOptionsPanel = new JPanel(new GridBagLayout());
initOptionsAndDescriptionPanel();
myRightSplitter.setSecondComponent(myOptionsPanel);
myRightSplitter.setHonorComponentsMinimumSize(true);
@@ -925,8 +981,8 @@ public class SingleInspectionProfilePanel extends JPanel {
final JPanel northPanel = new JPanel(new GridBagLayout());
northPanel.setBorder(IdeBorderFactory.createEmptyBorder(2, 0, 2, 0));
- northPanel.add(createTreeToolbarPanel().getComponent(), new GridBagConstraints(0, 0, 1, 1, 0.5, 1, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
- northPanel.add(myProfileFilter, new GridBagConstraints(1, 0, 1, 1, 1, 1, GridBagConstraints.BASELINE_TRAILING, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
+ northPanel.add(myProfileFilter, new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.BASELINE_TRAILING, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
+ northPanel.add(createTreeToolbarPanel().getComponent(), new GridBagConstraints(1, 0, 1, 1, 0.5, 1, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
treePanel.add(northPanel, BorderLayout.NORTH);
myMainSplitter = new Splitter(false);
@@ -1020,8 +1076,8 @@ public class SingleInspectionProfilePanel extends JPanel {
}
private boolean descriptorsAreChanged() {
- for (Map.Entry<Descriptor, List<Descriptor>> entry : myDescriptors.entrySet()) {
- Descriptor desc = entry.getKey();
+ for (ToolDescriptors toolDescriptors : myInitialToolDescriptors) {
+ Descriptor desc = toolDescriptors.getDefaultDescriptor();
Project project = myProjectProfileManager.getProject();
if (mySelectedProfile.isToolEnabled(desc.getKey(), null, project) != desc.isEnabled()){
return true;
@@ -1029,7 +1085,7 @@ public class SingleInspectionProfilePanel extends JPanel {
if (mySelectedProfile.getErrorLevel(desc.getKey(), desc.getScope(), project) != desc.getLevel()) {
return true;
}
- final List<Descriptor> descriptors = entry.getValue();
+ final List<Descriptor> descriptors = toolDescriptors.getNonDefaultDescriptors();
for (Descriptor descriptor : descriptors) {
if (mySelectedProfile.isToolEnabled(descriptor.getKey(), descriptor.getScope(), project) != descriptor.isEnabled()) {
return true;
@@ -1055,8 +1111,8 @@ public class SingleInspectionProfilePanel extends JPanel {
return false;
}
- public Tree getTree() {
- return myTree;
+ public Tree getTreeTable() {
+ return myTreeTable.getTree();
}
public boolean isProfileShared() {
@@ -1076,13 +1132,13 @@ public class SingleInspectionProfilePanel extends JPanel {
}
private void setNewHighlightingLevel(@NotNull HighlightDisplayLevel level) {
- final int[] rows = myTree.getSelectionRows();
+ final int[] rows = myTreeTable.getTree().getSelectionRows();
final boolean showOptionsAndDescriptorPanels = rows != null && rows.length == 1;
for (int i = 0; rows != null && i < rows.length; i++) {
- final InspectionConfigTreeNode node = (InspectionConfigTreeNode)myTree.getPathForRow(rows[i]).getLastPathComponent();
+ final InspectionConfigTreeNode node = (InspectionConfigTreeNode)myTreeTable.getTree().getPathForRow(rows[i]).getLastPathComponent();
final InspectionConfigTreeNode parent = (InspectionConfigTreeNode)node.getParent();
final Object userObject = node.getUserObject();
- if (userObject instanceof Descriptor && (node.getScopeName() != null || node.isLeaf())) {
+ if (userObject instanceof ToolDescriptors && (node.getScopeName() != null || node.isLeaf())) {
updateErrorLevel(node, showOptionsAndDescriptorPanels, level);
updateUpHierarchy(node, parent);
}
@@ -1091,8 +1147,8 @@ public class SingleInspectionProfilePanel extends JPanel {
updateUpHierarchy(node, parent);
}
}
- if (rows != null && rows.length == 1) {
- updateOptionsAndDescriptionPanel(myTree.getPathForRow(rows[0]));
+ if (rows != null) {
+ updateOptionsAndDescriptionPanel(myTreeTable.getTree().getSelectionPaths());
}
else {
initOptionsAndDescriptionPanel();
@@ -1107,7 +1163,7 @@ public class SingleInspectionProfilePanel extends JPanel {
for (int j = 0; j < node.getChildCount(); j++) {
final InspectionConfigTreeNode child = (InspectionConfigTreeNode)node.getChildAt(j);
final Object userObject = child.getUserObject();
- if (userObject instanceof Descriptor && (child.getScopeName() != null || child.isLeaf())) {
+ if (userObject instanceof ToolDescriptors && (child.getScopeName() != null || child.isLeaf())) {
updateErrorLevel(child, showOptionsAndDescriptorPanels, level);
}
else {
@@ -1119,15 +1175,18 @@ public class SingleInspectionProfilePanel extends JPanel {
private void updateErrorLevel(final InspectionConfigTreeNode child,
final boolean showOptionsAndDescriptorPanels,
@NotNull HighlightDisplayLevel level) {
- final HighlightDisplayKey key = child.getDescriptor().getKey();
- mySelectedProfile.setErrorLevel(key, level, child.isInspectionNode() || child.isByDefault() ? -1 : child.getParent().getIndex(child),
- myProjectProfileManager.getProject());
+ final HighlightDisplayKey key = child.getDefaultDescriptor().getKey();
+ mySelectedProfile.setErrorLevel(key, level, -1, myProjectProfileManager.getProject());
child.dropCache();
if (showOptionsAndDescriptorPanels) {
updateOptionsAndDescriptionPanel(new TreePath(child.getPath()));
}
}
+ public JComponent getTree() {
+ return myTreeTable.getTree();
+ }
+
private class MyFilterComponent extends FilterComponent {
private MyFilterComponent() {
super(INSPECTION_FILTER_HISTORY, 10);
@@ -1143,47 +1202,14 @@ public class SingleInspectionProfilePanel extends JPanel {
protected void onlineFilter() {
if (mySelectedProfile == null) return;
final String filter = getFilter();
- getExpandedNodes(mySelectedProfile).saveVisibleState(myTree);
+ getExpandedNodes(mySelectedProfile).saveVisibleState(myTreeTable.getTree());
fillTreeData(filter, true);
reloadModel();
if (filter == null || filter.isEmpty()) {
restoreTreeState();
} else {
- TreeUtil.expandAll(myTree);
- }
- }
- }
-
- private class MyAddScopeAction extends AddScopeAction {
- public MyAddScopeAction() {
- super(SingleInspectionProfilePanel.this.myTree);
- }
-
- @Override
- protected InspectionProfileImpl getSelectedProfile() {
- return mySelectedProfile;
- }
-
- @Override
- public void actionPerformed(AnActionEvent e) {
- super.actionPerformed(e);
- final TreePath[] paths = myTree.getSelectionPaths();
- if (paths != null && paths.length == 1) {
- updateOptionsAndDescriptionPanel(myTree.getSelectionPath());
- } else {
- initOptionsAndDescriptionPanel();
+ TreeUtil.expandAll(myTreeTable.getTree());
}
}
}
-
- private class MyDeleteScopeAction extends DeleteScopeAction {
- public MyDeleteScopeAction() {
- super(SingleInspectionProfilePanel.this.myTree);
- }
-
- @Override
- protected InspectionProfileImpl getSelectedProfile() {
- return mySelectedProfile;
- }
- }
}
diff --git a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/ToolDescriptors.java b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/ToolDescriptors.java
new file mode 100644
index 000000000000..47826735ec33
--- /dev/null
+++ b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/ToolDescriptors.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2000-2014 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.profile.codeInspection.ui;
+
+import com.intellij.codeInspection.ex.Descriptor;
+import com.intellij.codeInspection.ex.InspectionProfileImpl;
+import com.intellij.codeInspection.ex.InspectionToolWrapper;
+import com.intellij.codeInspection.ex.ScopeToolState;
+import com.intellij.openapi.project.Project;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Dmitry Batkovich
+ */
+public class ToolDescriptors {
+
+ @NotNull
+ private final Descriptor myDefaultDescriptor;
+ @NotNull
+ private final List<Descriptor> myNonDefaultDescriptors;
+
+ private ToolDescriptors(final @NotNull Descriptor defaultDescriptor,
+ final @NotNull List<Descriptor> nonDefaultDescriptors) {
+ myDefaultDescriptor = defaultDescriptor;
+ myNonDefaultDescriptors = nonDefaultDescriptors;
+ }
+
+ public static ToolDescriptors fromScopeToolState(final ScopeToolState state,
+ final InspectionProfileImpl profile,
+ final Project project) {
+ final InspectionToolWrapper toolWrapper = state.getTool();
+ final List<ScopeToolState> nonDefaultTools = profile.getNonDefaultTools(toolWrapper.getShortName(), project);
+ final ArrayList<Descriptor> descriptors = new ArrayList<Descriptor>(nonDefaultTools.size());
+ for (final ScopeToolState nonDefaultToolState : nonDefaultTools) {
+ descriptors.add(new Descriptor(nonDefaultToolState, profile, project));
+ }
+ return new ToolDescriptors(new Descriptor(state, profile, project), descriptors);
+ }
+
+ @NotNull
+ public Descriptor getDefaultDescriptor() {
+ return myDefaultDescriptor;
+ }
+
+ @NotNull
+ public List<Descriptor> getNonDefaultDescriptors() {
+ return myNonDefaultDescriptors;
+ }
+
+ @NotNull
+ public ScopeToolState getDefaultScopeToolState() {
+ return myDefaultDescriptor.getState();
+ }
+}
diff --git a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/actions/AddScopeAction.java b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/actions/AddScopeAction.java
deleted file mode 100644
index 3a1031946b6b..000000000000
--- a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/actions/AddScopeAction.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * Copyright 2000-2012 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.
- */
-
-/*
- * User: anna
- * Date: 14-May-2009
- */
-package com.intellij.profile.codeInspection.ui.actions;
-
-import com.intellij.codeHighlighting.HighlightDisplayLevel;
-import com.intellij.codeInspection.ex.Descriptor;
-import com.intellij.codeInspection.ex.InspectionProfileImpl;
-import com.intellij.codeInspection.ex.InspectionToolWrapper;
-import com.intellij.codeInspection.ex.ScopeToolState;
-import com.intellij.openapi.actionSystem.*;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.project.ProjectManager;
-import com.intellij.openapi.roots.ProjectRootManager;
-import com.intellij.openapi.ui.Messages;
-import com.intellij.packageDependencies.DefaultScopesProvider;
-import com.intellij.profile.codeInspection.ui.InspectionConfigTreeNode;
-import com.intellij.psi.search.scope.packageSet.CustomScopesProviderEx;
-import com.intellij.psi.search.scope.packageSet.NamedScope;
-import com.intellij.psi.search.scope.packageSet.NamedScopesHolder;
-import com.intellij.ui.treeStructure.Tree;
-import com.intellij.util.ArrayUtil;
-import com.intellij.util.IconUtil;
-
-import javax.swing.tree.DefaultTreeModel;
-import javax.swing.tree.TreePath;
-import java.util.*;
-
-public abstract class AddScopeAction extends AnAction {
- private final Tree myTree;
- private static final Logger LOG = Logger.getInstance("#" + AddScopeAction.class.getName());
-
- public AddScopeAction(Tree tree) {
- super("Add Scope", "Add Scope", IconUtil.getAddIcon());
- myTree = tree;
- registerCustomShortcutSet(CommonShortcuts.INSERT, myTree);
- }
-
- @Override
- public void update(AnActionEvent e) {
- final Presentation presentation = e.getPresentation();
- presentation.setEnabled(false);
- if (getSelectedProfile() == null) return;
- final Project project = getProject(e);
- final InspectionConfigTreeNode[] selectedNodes = myTree.getSelectedNodes(InspectionConfigTreeNode.class, null);
- if (selectedNodes == null) return;
- final List<Descriptor> descriptors = new ArrayList<Descriptor>();
- for (InspectionConfigTreeNode node : selectedNodes) {
- collect(descriptors, new ArrayList<InspectionConfigTreeNode>(), node);
- }
-
- presentation.setEnabled(!getAvailableScopes(project, descriptors).isEmpty());
- }
-
- private static Project getProject(AnActionEvent e) {
- Project project = CommonDataKeys.PROJECT.getData(e.getDataContext());
- if (project == null) {
- project = ProjectManager.getInstance().getDefaultProject();
- }
- return project;
- }
-
- @Override
- public void actionPerformed(AnActionEvent e) {
- final List<Descriptor> descriptors = new ArrayList<Descriptor>();
- final InspectionConfigTreeNode[] selectedNodes = myTree.getSelectedNodes(InspectionConfigTreeNode.class, null);
- LOG.assertTrue(selectedNodes != null);
-
- final List<InspectionConfigTreeNode> nodes = new ArrayList<InspectionConfigTreeNode>(Arrays.asList(selectedNodes));
- for (InspectionConfigTreeNode node : selectedNodes) {
- collect(descriptors, nodes, node);
- }
-
- final Project project = getProject(e);
- final List<String> availableScopes = getAvailableScopes(project, descriptors);
- final int idx = Messages.showChooseDialog(myTree, "Scope:", "Choose Scope", ArrayUtil.toStringArray(availableScopes), availableScopes.get(0), Messages.getQuestionIcon());
- if (idx == -1) return;
- final NamedScope chosenScope = NamedScopesHolder.getScope(project, availableScopes.get(idx));
-
- for (InspectionConfigTreeNode node : nodes) {
- final Descriptor descriptor = node.getDescriptor();
- if (node.getScopeName() != null || descriptor == null) continue;
- final InspectionToolWrapper toolWrapper = descriptor.getToolWrapper(); //copy
- InspectionProfileImpl selectedProfile = getSelectedProfile();
- HighlightDisplayLevel level = selectedProfile.getErrorLevel(descriptor.getKey(), chosenScope, project);
- boolean enabled = selectedProfile.isToolEnabled(descriptor.getKey());
- final ScopeToolState scopeToolState = selectedProfile.addScope(toolWrapper, chosenScope, level, enabled, project);
- final Descriptor addedDescriptor = new Descriptor(scopeToolState, selectedProfile, project);
- if (node.getChildCount() == 0) {
- node.add(new InspectionConfigTreeNode(descriptor, selectedProfile.getToolDefaultState(descriptor.getKey().toString(), project), true, true, false));
- }
- node.insert(new InspectionConfigTreeNode(addedDescriptor, scopeToolState, false, false), 0);
- node.setInspectionNode(false);
- node.dropCache();
- ((DefaultTreeModel)myTree.getModel()).reload(node);
- myTree.expandPath(new TreePath(node.getPath()));
- }
- myTree.revalidate();
- }
-
- private static void collect(List<Descriptor> descriptors,
- List<InspectionConfigTreeNode> nodes,
- InspectionConfigTreeNode node) {
- final Descriptor descriptor = node.getDescriptor();
- if (descriptor != null) {
- if (node.getScopeName() == null) {
- descriptors.add(descriptor);
- }
- } else if (node.getUserObject() instanceof String) {
- for(int i = 0; i < node.getChildCount(); i++) {
- final InspectionConfigTreeNode childNode = (InspectionConfigTreeNode)node.getChildAt(i);
- nodes.add(childNode);
- collect(descriptors, nodes, childNode);
- }
- }
- }
-
- private List<String> getAvailableScopes(Project project, List<Descriptor> descriptors) {
- final ArrayList<NamedScope> scopes = new ArrayList<NamedScope>();
- for (NamedScopesHolder holder : NamedScopesHolder.getAllNamedScopeHolders(project)) {
- Collections.addAll(scopes, holder.getScopes());
- }
- scopes.remove(CustomScopesProviderEx.getAllScope());
-
- CustomScopesProviderEx.filterNoSettingsScopes(project, scopes);
-
- final Set<NamedScope> used = new HashSet<NamedScope>();
- for (Descriptor descriptor : descriptors) {
- final List<ScopeToolState> nonDefaultTools = getSelectedProfile().getNonDefaultTools(descriptor.getKey().toString(), project);
- if (nonDefaultTools != null) {
- for (ScopeToolState state : nonDefaultTools) {
- used.add(state.getScope(project));
- }
- }
- }
- scopes.removeAll(used);
-
- final List<String> availableScopes = new ArrayList<String>();
- for (NamedScope scope : scopes) {
- availableScopes.add(scope.getName());
- }
- return availableScopes;
- }
-
- protected abstract InspectionProfileImpl getSelectedProfile();
-} \ No newline at end of file
diff --git a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/actions/DeleteScopeAction.java b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/actions/DeleteScopeAction.java
deleted file mode 100644
index 1fc94c2d15b2..000000000000
--- a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/actions/DeleteScopeAction.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright 2000-2012 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.
- */
-
-/*
- * User: anna
- * Date: 14-May-2009
- */
-package com.intellij.profile.codeInspection.ui.actions;
-
-import com.intellij.codeInsight.daemon.HighlightDisplayKey;
-import com.intellij.codeInspection.ex.Descriptor;
-import com.intellij.codeInspection.ex.InspectionProfileImpl;
-import com.intellij.openapi.actionSystem.AnAction;
-import com.intellij.openapi.actionSystem.AnActionEvent;
-import com.intellij.openapi.actionSystem.CommonShortcuts;
-import com.intellij.openapi.actionSystem.Presentation;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.profile.codeInspection.ui.InspectionConfigTreeNode;
-import com.intellij.ui.treeStructure.Tree;
-import com.intellij.util.PlatformIcons;
-
-import javax.swing.tree.DefaultTreeModel;
-import javax.swing.tree.TreePath;
-
-public abstract class DeleteScopeAction extends AnAction {
- private static final Logger LOG = Logger.getInstance("#" + DeleteScopeAction.class.getName());
- private final Tree myTree;
-
- public DeleteScopeAction(Tree tree) {
- super("Delete Scope", "Delete Scope", PlatformIcons.DELETE_ICON);
- myTree = tree;
- registerCustomShortcutSet(CommonShortcuts.getDelete(), myTree);
- }
-
- @Override
- public void update(AnActionEvent e) {
- final Presentation presentation = e.getPresentation();
- presentation.setEnabled(false);
- if (getSelectedProfile() == null) return;
- final InspectionConfigTreeNode[] nodes = myTree.getSelectedNodes(InspectionConfigTreeNode.class, null);
- if (nodes.length > 0) {
- for (InspectionConfigTreeNode node : nodes) {
- if (node.getScopeName() == null || node.isByDefault()) return;
- }
- presentation.setEnabled(true);
- }
- }
-
- @Override
- public void actionPerformed(AnActionEvent e) {
- InspectionConfigTreeNode parent = null;
- final InspectionConfigTreeNode[] nodes = myTree.getSelectedNodes(InspectionConfigTreeNode.class, null);
- for (InspectionConfigTreeNode node : nodes) {
- final Descriptor descriptor = node.getDescriptor();
- LOG.assertTrue(descriptor != null);
- parent = (InspectionConfigTreeNode)node.getParent();
- final HighlightDisplayKey key = descriptor.getKey();
- if (parent.getChildCount() <= 2) { //remove default with last non-default
- getSelectedProfile().removeAllScopes(key.toString(), e.getProject());
- parent.removeAllChildren();
- parent.setInspectionNode(true);
- parent.setByDefault(true);
- }
- else {
- getSelectedProfile().removeScope(key.toString(), parent.getIndex(node), e.getProject());
- node.removeFromParent();
- }
- ((DefaultTreeModel)myTree.getModel()).reload(parent);
- }
- if (parent != null) {
- myTree.setSelectionPath(new TreePath(parent.getPath()));
- }
- myTree.revalidate();
- }
-
- protected abstract InspectionProfileImpl getSelectedProfile();
-} \ No newline at end of file
diff --git a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/actions/MoveScopeAction.java b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/actions/MoveScopeAction.java
deleted file mode 100644
index 40d4b438f995..000000000000
--- a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/actions/MoveScopeAction.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright 2000-2012 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.
- */
-
-/*
- * User: anna
- * Date: 14-May-2009
- */
-package com.intellij.profile.codeInspection.ui.actions;
-
-import com.intellij.codeInspection.ex.Descriptor;
-import com.intellij.codeInspection.ex.InspectionProfileImpl;
-import com.intellij.openapi.actionSystem.AnAction;
-import com.intellij.openapi.actionSystem.AnActionEvent;
-import com.intellij.openapi.actionSystem.Presentation;
-import com.intellij.profile.codeInspection.ui.InspectionConfigTreeNode;
-import com.intellij.ui.treeStructure.Tree;
-
-import javax.swing.*;
-import javax.swing.tree.DefaultTreeModel;
-import javax.swing.tree.TreeNode;
-import javax.swing.tree.TreePath;
-
-public abstract class MoveScopeAction extends AnAction {
- private final Tree myTree;
- private final int myDir;
-
- public MoveScopeAction(Tree tree, String text, Icon icon, int dir) {
- super(text, text, icon);
- myTree = tree;
- myDir = dir;
- }
-
- protected abstract boolean isEnabledFor(int idx, InspectionConfigTreeNode parent);
-
-
- @Override
- public void update(AnActionEvent e) {
- final Presentation presentation = e.getPresentation();
- presentation.setEnabled(false);
- if (getSelectedProfile() == null) return;
- final InspectionConfigTreeNode[] nodes = myTree.getSelectedNodes(InspectionConfigTreeNode.class, null);
- if (nodes.length > 0) {
- final InspectionConfigTreeNode treeNode = nodes[0];
- if (treeNode.getScope(getEventProject(e)) != null && !treeNode.isByDefault()) {
- final TreeNode parent = treeNode.getParent();
- final int index = parent.getIndex(treeNode);
- presentation.setEnabled(isEnabledFor(index, (InspectionConfigTreeNode)parent));
- }
- }
- }
-
- @Override
- public void actionPerformed(AnActionEvent e) {
- final InspectionConfigTreeNode[] nodes = myTree.getSelectedNodes(InspectionConfigTreeNode.class, null);
- final InspectionConfigTreeNode node = nodes[0];
- final Descriptor descriptor = node.getDescriptor();
- final TreeNode parent = node.getParent();
- final int index = parent.getIndex(node);
- getSelectedProfile().moveScope(descriptor.getKey().toString(), index, myDir, e.getProject());
- node.removeFromParent();
- ((InspectionConfigTreeNode)parent).insert(node, index + myDir);
- ((DefaultTreeModel)myTree.getModel()).reload(parent);
- myTree.setSelectionPath(new TreePath(node.getPath()));
- myTree.revalidate();
- }
-
- protected abstract InspectionProfileImpl getSelectedProfile();
-} \ No newline at end of file
diff --git a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/filter/InspectionFilterAction.java b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/filter/InspectionFilterAction.java
new file mode 100644
index 000000000000..cbd1c2482032
--- /dev/null
+++ b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/filter/InspectionFilterAction.java
@@ -0,0 +1,129 @@
+/*
+ * Copyright 2000-2014 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.profile.codeInspection.ui.filter;
+
+import com.intellij.codeHighlighting.HighlightDisplayLevel;
+import com.intellij.codeInsight.daemon.impl.SeverityRegistrar;
+import com.intellij.codeInspection.ex.InspectionProfileImpl;
+import com.intellij.icons.AllIcons;
+import com.intellij.lang.annotation.HighlightSeverity;
+import com.intellij.openapi.actionSystem.AnAction;
+import com.intellij.openapi.actionSystem.AnActionEvent;
+import com.intellij.openapi.actionSystem.DefaultActionGroup;
+import com.intellij.openapi.actionSystem.ex.CheckboxAction;
+import com.intellij.profile.codeInspection.SeverityProvider;
+import com.intellij.profile.codeInspection.ui.LevelChooserAction;
+import com.intellij.profile.codeInspection.ui.SingleInspectionProfilePanel;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.SortedSet;
+
+/**
+ * @author Dmitry Batkovich
+ */
+public class InspectionFilterAction extends DefaultActionGroup {
+
+ private final SeverityRegistrar mySeverityRegistrar;
+ private final InspectionsFilter myInspectionsFilter;
+
+ public InspectionFilterAction(final InspectionProfileImpl profile, final InspectionsFilter inspectionsFilter) {
+ super("Filter Inspections", true);
+ myInspectionsFilter = inspectionsFilter;
+ mySeverityRegistrar = ((SeverityProvider)profile.getProfileManager()).getOwnSeverityRegistrar();
+ getTemplatePresentation().setIcon(AllIcons.General.Filter);
+ tune();
+ }
+
+ private void tune() {
+ addAction(new ShowEnabledOrDisabledInspectionsAction(null));
+ addAction(new ShowEnabledOrDisabledInspectionsAction(true));
+ addAction(new ShowEnabledOrDisabledInspectionsAction(false));
+ addSeparator();
+
+ final SortedSet<HighlightSeverity> severities = LevelChooserAction.getSeverities(mySeverityRegistrar);
+ for (final HighlightSeverity severity : severities) {
+ add(new ShowWithSpecifiedSeverityInspectionsAction(severity));
+ }
+ addSeparator();
+
+ add(new ShowAvailableOnlyOnAnalyzeInspectionsAction());
+ }
+
+ private class ShowAvailableOnlyOnAnalyzeInspectionsAction extends CheckboxAction {
+
+ public ShowAvailableOnlyOnAnalyzeInspectionsAction() {
+ super("Show Only \"Available only for Analyze | Inspect Code\"");
+ }
+
+ @Override
+ public boolean isSelected(final AnActionEvent e) {
+ return myInspectionsFilter.isAvailableOnlyForAnalyze();
+ }
+
+ @Override
+ public void setSelected(final AnActionEvent e, final boolean state) {
+ myInspectionsFilter.setAvailableOnlyForAnalyze(state);
+ }
+ }
+
+ private class ShowWithSpecifiedSeverityInspectionsAction extends CheckboxAction {
+
+ private final HighlightSeverity mySeverity;
+
+ private ShowWithSpecifiedSeverityInspectionsAction(final HighlightSeverity severity) {
+ super(SingleInspectionProfilePanel.renderSeverity(severity),
+ null,
+ HighlightDisplayLevel.find(severity).getIcon());
+ mySeverity = severity;
+ }
+
+
+ @Override
+ public boolean isSelected(final AnActionEvent e) {
+ return myInspectionsFilter.containsSeverity(mySeverity);
+ }
+
+ @Override
+ public void setSelected(final AnActionEvent e, final boolean state) {
+ if (state) {
+ myInspectionsFilter.add(mySeverity);
+ } else {
+ myInspectionsFilter.remove(mySeverity);
+ }
+ }
+ }
+
+ private class ShowEnabledOrDisabledInspectionsAction extends CheckboxAction {
+
+ private final Boolean myShowEnabledActions;
+
+ public ShowEnabledOrDisabledInspectionsAction(@Nullable final Boolean showEnabledActions) {
+ super(showEnabledActions == null ? "All Inspections" : (showEnabledActions ? "Enabled" : "Disabled"));
+ myShowEnabledActions = showEnabledActions;
+ }
+
+
+ @Override
+ public boolean isSelected(final AnActionEvent e) {
+ return myInspectionsFilter.getSuitableInspectionsStates() == myShowEnabledActions;
+ }
+
+ @Override
+ public void setSelected(final AnActionEvent e, final boolean state) {
+ myInspectionsFilter.setSuitableInspectionsStates(myShowEnabledActions);
+ }
+ }
+} \ No newline at end of file
diff --git a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/filter/InspectionsFilter.java b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/filter/InspectionsFilter.java
new file mode 100644
index 000000000000..432ef560ba58
--- /dev/null
+++ b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/filter/InspectionsFilter.java
@@ -0,0 +1,102 @@
+/*
+ * Copyright 2000-2014 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.profile.codeInspection.ui.filter;
+
+import com.intellij.codeInspection.ex.GlobalInspectionToolWrapper;
+import com.intellij.codeInspection.ex.InspectionToolWrapper;
+import com.intellij.codeInspection.ex.ScopeToolState;
+import com.intellij.codeInspection.ex.Tools;
+import com.intellij.lang.annotation.HighlightSeverity;
+import com.intellij.util.containers.HashSet;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.Set;
+
+/**
+ * @author Dmitry Batkovich
+ */
+public abstract class InspectionsFilter {
+
+ private final Set<HighlightSeverity> mySuitableSeverities = new HashSet<HighlightSeverity>();
+ private Boolean mySuitableInspectionsStates;
+ private boolean myAvailableOnlyForAnalyze;
+
+ public boolean isAvailableOnlyForAnalyze() {
+ return myAvailableOnlyForAnalyze;
+ }
+
+ public Boolean getSuitableInspectionsStates() {
+ return mySuitableInspectionsStates;
+ }
+
+ public boolean containsSeverity(final HighlightSeverity severity) {
+ return mySuitableSeverities.contains(severity);
+ }
+
+ public void setAvailableOnlyForAnalyze(final boolean availableOnlyForAnalyze) {
+ myAvailableOnlyForAnalyze = availableOnlyForAnalyze;
+ filterChanged();
+ }
+
+ public void setSuitableInspectionsStates(@Nullable final Boolean suitableInspectionsStates) {
+ mySuitableInspectionsStates = suitableInspectionsStates;
+ filterChanged();
+ }
+
+ public void add(final HighlightSeverity severity) {
+ mySuitableSeverities.add(severity);
+ filterChanged();
+ }
+
+ public void remove(final HighlightSeverity severity) {
+ mySuitableSeverities.remove(severity);
+ filterChanged();
+ }
+
+ public boolean isEmptyFilter() {
+ return mySuitableInspectionsStates == null && !myAvailableOnlyForAnalyze && mySuitableSeverities.isEmpty();
+ }
+
+ public boolean matches(final Tools tools) {
+ if (mySuitableInspectionsStates != null && mySuitableInspectionsStates != tools.isEnabled()) {
+ return false;
+ }
+
+ if (myAvailableOnlyForAnalyze != isAvailableOnlyForAnalyze(tools)) {
+ return false;
+ }
+
+ if (mySuitableSeverities.isEmpty()) {
+ return true;
+ }
+ for (final ScopeToolState state : tools.getTools()) {
+ if (mySuitableInspectionsStates != null && mySuitableInspectionsStates != state.isEnabled()) {
+ continue;
+ }
+ if (mySuitableSeverities.contains(tools.getDefaultState().getLevel().getSeverity())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ protected abstract void filterChanged();
+
+ private static boolean isAvailableOnlyForAnalyze(final Tools tools) {
+ final InspectionToolWrapper tool = tools.getTool();
+ return tool instanceof GlobalInspectionToolWrapper && ((GlobalInspectionToolWrapper)tool).worksInBatchModeOnly();
+ }
+} \ No newline at end of file
diff --git a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/inspectionsTree/InspectionConfigTreeNode.java b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/inspectionsTree/InspectionConfigTreeNode.java
new file mode 100644
index 000000000000..1f26308c61b1
--- /dev/null
+++ b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/inspectionsTree/InspectionConfigTreeNode.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright 2000-2012 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.profile.codeInspection.ui.inspectionsTree;
+
+import com.intellij.codeInsight.daemon.HighlightDisplayKey;
+import com.intellij.codeInspection.ex.Descriptor;
+import com.intellij.openapi.util.ClearableLazyValue;
+import com.intellij.profile.codeInspection.ui.ToolDescriptors;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import javax.swing.tree.DefaultMutableTreeNode;
+
+/**
+ * @author anna
+ * @since 14-May-2009
+ */
+public class InspectionConfigTreeNode extends DefaultMutableTreeNode {
+ private final ClearableLazyValue<Boolean> myProperSetting = new ClearableLazyValue<Boolean>() {
+ @NotNull
+ @Override
+ protected Boolean compute() {
+ ToolDescriptors descriptors = getDescriptors();
+ if (descriptors != null) {
+ final Descriptor defaultDescriptor = descriptors.getDefaultDescriptor();
+ return defaultDescriptor.getInspectionProfile().isProperSetting(defaultDescriptor.getToolWrapper().getShortName());
+ }
+ for (int i = 0; i < getChildCount(); i++) {
+ InspectionConfigTreeNode node = (InspectionConfigTreeNode)getChildAt(i);
+ if (node.isProperSetting()) {
+ return true;
+ }
+ }
+ return false;
+ }
+ };
+
+ public InspectionConfigTreeNode(@NotNull Object userObject) {
+ super(userObject);
+ }
+
+ public HighlightDisplayKey getKey() {
+ return getDefaultDescriptor().getKey();
+ }
+
+ @Nullable
+ public Descriptor getDefaultDescriptor() {
+ final ToolDescriptors descriptors = getDescriptors();
+ return descriptors == null ? null : descriptors.getDefaultDescriptor();
+ }
+
+ @Nullable
+ public ToolDescriptors getDescriptors() {
+ if (userObject instanceof String) return null;
+ return (ToolDescriptors)userObject;
+ }
+
+ @Nullable
+ public String getGroupName() {
+ return userObject instanceof String ? (String)userObject : null;
+ }
+
+ @Nullable
+ public String getScopeName() {
+ final ToolDescriptors descriptors = getDescriptors();
+ return descriptors != null ? descriptors.getDefaultScopeToolState().getScopeName() : null;
+ }
+
+ public boolean isProperSetting() {
+ return myProperSetting.getValue();
+ }
+
+ public void dropCache() {
+ myProperSetting.drop();
+ }
+
+ @Override
+ public String toString() {
+ if (userObject instanceof Descriptor) {
+ return ((Descriptor)userObject).getText();
+ }
+ return super.toString();
+ }
+} \ No newline at end of file
diff --git a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/inspectionsTree/InspectionsConfigTreeComparator.java b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/inspectionsTree/InspectionsConfigTreeComparator.java
new file mode 100644
index 000000000000..b920b0b741ab
--- /dev/null
+++ b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/inspectionsTree/InspectionsConfigTreeComparator.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2000-2012 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.
+ */
+
+/*
+ * User: anna
+ * Date: 14-May-2009
+ */
+package com.intellij.profile.codeInspection.ui.inspectionsTree;
+
+import com.intellij.profile.codeInspection.ui.ToolDescriptors;
+
+import java.util.Comparator;
+
+public class InspectionsConfigTreeComparator implements Comparator<InspectionConfigTreeNode> {
+ @Override
+ public int compare(InspectionConfigTreeNode o1, InspectionConfigTreeNode o2) {
+ String s1 = null;
+ String s2 = null;
+ Object userObject1 = o1.getUserObject();
+ Object userObject2 = o2.getUserObject();
+
+ if (userObject1 instanceof String && userObject2 instanceof String) {
+ s1 = (String)userObject1;
+ s2 = (String)userObject2;
+ } else {
+ if (userObject1 instanceof String) return -1;
+ if (userObject2 instanceof String) return 1;
+ }
+
+ if (s1 != null) {
+ return getDisplayTextToSort(s1).compareToIgnoreCase(getDisplayTextToSort(s2));
+ }
+
+ final ToolDescriptors descriptors1 = o1.getDescriptors();
+ final ToolDescriptors descriptors2 = o2.getDescriptors();
+ if (descriptors1 != null && descriptors2 != null) {
+ s1 = descriptors1.getDefaultDescriptor().getText();
+ s2 = descriptors2.getDefaultDescriptor().getText();
+ }
+
+ if (s1 != null && s2 != null) {
+ return getDisplayTextToSort(s1).compareToIgnoreCase(getDisplayTextToSort(s2));
+ }
+
+ //can't be
+ return -1;
+ }
+
+ public static String getDisplayTextToSort(String s) {
+ if (s.length() == 0) {
+ return s;
+ }
+ while (!Character.isLetterOrDigit(s.charAt(0))) {
+ s = s.substring(1);
+ if (s.length() == 0) {
+ return s;
+ }
+ }
+ return s;
+ }
+} \ No newline at end of file
diff --git a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/inspectionsTree/InspectionsConfigTreeRenderer.java b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/inspectionsTree/InspectionsConfigTreeRenderer.java
new file mode 100644
index 000000000000..43b791cbe6a2
--- /dev/null
+++ b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/inspectionsTree/InspectionsConfigTreeRenderer.java
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2000-2012 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.
+ */
+
+/*
+ * User: anna
+ * Date: 14-May-2009
+ */
+package com.intellij.profile.codeInspection.ui.inspectionsTree;
+
+import com.intellij.codeInspection.InspectionsBundle;
+import com.intellij.codeInspection.ex.Descriptor;
+import com.intellij.codeInspection.ex.GlobalInspectionToolWrapper;
+import com.intellij.codeInspection.ex.InspectionToolWrapper;
+import com.intellij.codeInspection.ex.LocalInspectionToolWrapper;
+import com.intellij.ide.ui.search.SearchUtil;
+import com.intellij.profile.codeInspection.ui.ToolDescriptors;
+import com.intellij.ui.ColoredTreeCellRenderer;
+import com.intellij.ui.SimpleTextAttributes;
+import com.intellij.util.ui.PlatformColors;
+import com.intellij.util.ui.UIUtil;
+import org.jetbrains.annotations.NonNls;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import javax.swing.*;
+import java.awt.*;
+
+public abstract class InspectionsConfigTreeRenderer extends ColoredTreeCellRenderer {
+ protected abstract String getFilter();
+
+ @Override
+ public void customizeCellRenderer(@NotNull final JTree tree,
+ final Object value,
+ final boolean selected,
+ final boolean expanded,
+ final boolean leaf,
+ final int row,
+ final boolean hasFocus) {
+ if (!(value instanceof InspectionConfigTreeNode)) return;
+ InspectionConfigTreeNode node = (InspectionConfigTreeNode)value;
+
+ Object object = node.getUserObject();
+
+ final Color background = selected ? UIUtil.getTreeSelectionBackground() : UIUtil.getTreeTextBackground();
+ UIUtil.changeBackGround(this, background);
+ Color foreground =
+ selected ? UIUtil.getTreeSelectionForeground() : node.isProperSetting() ? PlatformColors.BLUE : UIUtil.getTreeTextForeground();
+
+ @NonNls String text;
+ int style = SimpleTextAttributes.STYLE_PLAIN;
+ String hint = null;
+ if (object instanceof String) {
+ text = (String)object;
+ style = SimpleTextAttributes.STYLE_BOLD;
+ }
+ else {
+ final ToolDescriptors descriptors = node.getDescriptors();
+ assert descriptors != null;
+ final Descriptor defaultDescriptor = descriptors.getDefaultDescriptor();
+ text = defaultDescriptor.getText();
+ hint = getHint(defaultDescriptor);
+ }
+
+ if (text != null) {
+ SearchUtil.appendFragments(getFilter(), text, style, foreground, background, this);
+ }
+ if (hint != null) {
+ append(" " + hint, selected ? new SimpleTextAttributes(Font.PLAIN, foreground) : SimpleTextAttributes.GRAYED_ATTRIBUTES);
+ }
+ setForeground(foreground);
+ }
+
+ @Nullable
+ private static String getHint(final Descriptor descriptor) {
+ final InspectionToolWrapper toolWrapper = descriptor.getToolWrapper();
+ if (toolWrapper instanceof LocalInspectionToolWrapper ||
+ toolWrapper instanceof GlobalInspectionToolWrapper && !((GlobalInspectionToolWrapper)toolWrapper).worksInBatchModeOnly()) {
+ return null;
+ }
+ return InspectionsBundle.message("inspection.tool.availability.in.tree.node1");
+ }
+} \ No newline at end of file
diff --git a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/inspectionsTree/InspectionsConfigTreeTable.java b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/inspectionsTree/InspectionsConfigTreeTable.java
new file mode 100644
index 000000000000..966a456e1d38
--- /dev/null
+++ b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/inspectionsTree/InspectionsConfigTreeTable.java
@@ -0,0 +1,257 @@
+/*
+ * Copyright 2000-2014 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.profile.codeInspection.ui.inspectionsTree;
+
+import com.intellij.codeHighlighting.HighlightDisplayLevel;
+import com.intellij.codeInsight.daemon.HighlightDisplayKey;
+import com.intellij.codeInspection.ex.InspectionProfileImpl;
+import com.intellij.codeInspection.ex.ScopeToolState;
+import com.intellij.ide.IdeTooltip;
+import com.intellij.ide.IdeTooltipManager;
+import com.intellij.lang.annotation.HighlightSeverity;
+import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.Comparing;
+import com.intellij.profile.codeInspection.ui.InspectionsAggregationUtil;
+import com.intellij.profile.codeInspection.ui.table.ScopesAndSeveritiesTable;
+import com.intellij.profile.codeInspection.ui.table.ThreeStateCheckBoxRenderer;
+import com.intellij.ui.treeStructure.treetable.TreeTable;
+import com.intellij.ui.treeStructure.treetable.TreeTableModel;
+import org.jetbrains.annotations.Nullable;
+
+import javax.swing.*;
+import javax.swing.table.TableColumn;
+import javax.swing.tree.DefaultTreeModel;
+import javax.swing.tree.TreeNode;
+import java.awt.*;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.util.*;
+import java.util.List;
+
+/**
+ * @author Dmitry Batkovich
+ */
+public class InspectionsConfigTreeTable extends TreeTable {
+ private final static Logger LOG = Logger.getInstance(InspectionsConfigTreeTable.class);
+
+ private final static int TREE_COLUMN = 0;
+ private final static int SEVERITIES_COLUMN = 1;
+ private final static int IS_ENABLED_COLUMN = 2;
+
+ public InspectionsConfigTreeTable(final InspectionsConfigTreeTableSettings settings) {
+ super(new InspectionsConfigTreeTableModel(settings));
+
+ final TableColumn severitiesColumn = getColumnModel().getColumn(SEVERITIES_COLUMN);
+ severitiesColumn.setMaxWidth(20);
+
+ final TableColumn isEnabledColumn = getColumnModel().getColumn(IS_ENABLED_COLUMN);
+ isEnabledColumn.setMaxWidth(20);
+ isEnabledColumn.setCellRenderer(new ThreeStateCheckBoxRenderer());
+ isEnabledColumn.setCellEditor(new ThreeStateCheckBoxRenderer());
+
+ addMouseMotionListener(new MouseAdapter() {
+ @Override
+ public void mouseMoved(final MouseEvent e) {
+ final Point point = e.getPoint();
+ final int column = columnAtPoint(point);
+ if (column != SEVERITIES_COLUMN) {
+ return;
+ }
+ final int row = rowAtPoint(point);
+ final Object maybeIcon = getModel().getValueAt(row, column);
+ if (maybeIcon instanceof MultiScopeSeverityIcon) {
+ final LinkedHashMap<String, HighlightSeverity> scopeToAverageSeverityMap =
+ ((MultiScopeSeverityIcon)maybeIcon).getScopeToAverageSeverityMap();
+ IdeTooltipManager.getInstance().show(new IdeTooltip(InspectionsConfigTreeTable.this, point, new ScopesAndSeveritiesHintTable(scopeToAverageSeverityMap)), false);
+ }
+ }
+ });
+ }
+
+ public abstract static class InspectionsConfigTreeTableSettings {
+ private final TreeNode myRoot;
+ private final Project myProject;
+
+ public InspectionsConfigTreeTableSettings(final TreeNode root, final Project project) {
+ myRoot = root;
+ myProject = project;
+ }
+
+ public TreeNode getRoot() {
+ return myRoot;
+ }
+
+ public Project getProject() {
+ return myProject;
+ }
+
+ protected abstract InspectionProfileImpl getInspectionProfile();
+
+ protected abstract void onChanged(InspectionConfigTreeNode node);
+ }
+
+ private static class InspectionsConfigTreeTableModel extends DefaultTreeModel implements TreeTableModel {
+
+ private final InspectionsConfigTreeTableSettings mySettings;
+
+ public InspectionsConfigTreeTableModel(final InspectionsConfigTreeTableSettings settings) {
+ super(settings.getRoot());
+ mySettings = settings;
+ }
+
+ @Override
+ public int getColumnCount() {
+ return 3;
+ }
+
+ @Nullable
+ @Override
+ public String getColumnName(final int column) {
+ return null;
+ }
+
+ @Override
+ public Class getColumnClass(final int column) {
+ switch (column) {
+ case TREE_COLUMN:
+ return TreeTableModel.class;
+ case SEVERITIES_COLUMN:
+ return Icon.class;
+ case IS_ENABLED_COLUMN:
+ return Boolean.class;
+ }
+ throw new IllegalArgumentException();
+ }
+
+ @Nullable
+ @Override
+ public Object getValueAt(final Object node, final int column) {
+ if (column == TREE_COLUMN) {
+ return null;
+ }
+ final InspectionConfigTreeNode treeNode = (InspectionConfigTreeNode)node;
+ final List<HighlightDisplayKey> inspectionsKeys = InspectionsAggregationUtil.getInspectionsKeys(treeNode);
+ if (column == SEVERITIES_COLUMN) {
+ final MultiColoredHighlightSeverityIconSink sink = new MultiColoredHighlightSeverityIconSink();
+ for (final HighlightDisplayKey selectedInspectionsNode : inspectionsKeys) {
+ final String toolId = selectedInspectionsNode.toString();
+ if (mySettings.getInspectionProfile().getTools(toolId, mySettings.getProject()).isEnabled()) {
+ sink.put(mySettings.getInspectionProfile().getToolDefaultState(toolId, mySettings.getProject()),
+ mySettings.getInspectionProfile().getNonDefaultTools(toolId, mySettings.getProject()));
+ }
+ }
+ return sink.constructIcon();
+ } else if (column == IS_ENABLED_COLUMN) {
+ return isEnabled(inspectionsKeys);
+ }
+ throw new IllegalArgumentException();
+ }
+
+ @Nullable
+ private Boolean isEnabled(final List<HighlightDisplayKey> selectedInspectionsNodes) {
+ Boolean isPreviousEnabled = null;
+ for (final HighlightDisplayKey key : selectedInspectionsNodes) {
+ final boolean enabled = mySettings.getInspectionProfile().getTools(key.toString(), mySettings.getProject()).isEnabled();
+ if (isPreviousEnabled == null) {
+ isPreviousEnabled = enabled;
+ } else if (!isPreviousEnabled.equals(enabled)) {
+ return null;
+ }
+ }
+ return isPreviousEnabled;
+ }
+
+ @Override
+ public boolean isCellEditable(final Object node, final int column) {
+ return column == IS_ENABLED_COLUMN;
+ }
+
+ @Override
+ public void setValueAt(final Object aValue, final Object node, final int column) {
+ LOG.assertTrue(column == IS_ENABLED_COLUMN);
+ LOG.assertTrue(aValue != null);
+ final boolean doEnable = (Boolean) aValue;
+ for (final InspectionConfigTreeNode aNode : InspectionsAggregationUtil.getInspectionsNodes((InspectionConfigTreeNode) node)) {
+ final String toolId = aNode.getKey().toString();
+ if (doEnable) {
+ mySettings.getInspectionProfile().enableTool(toolId, mySettings.getProject());
+ } else {
+ mySettings.getInspectionProfile().disableTool(toolId, mySettings.getProject());
+ }
+ aNode.dropCache();
+ mySettings.onChanged(aNode);
+ }
+ }
+
+ @Override
+ public void setTree(final JTree tree) {
+ }
+ }
+
+ private static class MultiColoredHighlightSeverityIconSink {
+
+ private final LinkedHashMap<String, HighlightSeverity> myScopeToAverageSeverityMap = new LinkedHashMap<String, HighlightSeverity>();
+
+ private boolean myIsFirst = true;
+
+ public Icon constructIcon() {
+ if (myScopeToAverageSeverityMap.isEmpty()) {
+ return null;
+ }
+ //TODO order scopes
+ return !allScopesHasMixedSeverity()
+ ? new MultiScopeSeverityIcon(myScopeToAverageSeverityMap)
+ : ScopesAndSeveritiesTable.MIXED_FAKE_LEVEL.getIcon();
+ }
+
+ private boolean allScopesHasMixedSeverity() {
+ for (final Map.Entry<String, HighlightSeverity> e : myScopeToAverageSeverityMap.entrySet()) {
+ if (!ScopesAndSeveritiesTable.MIXED_FAKE_SEVERITY.equals(e.getValue())) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public void put(final ScopeToolState defaultState, final Collection<ScopeToolState> nonDefault) {
+ putOne(defaultState);
+ for (final ScopeToolState scopeToolState : nonDefault) {
+ putOne(scopeToolState);
+ }
+ if (myIsFirst) {
+ myIsFirst = false;
+ }
+ }
+
+ public void putOne(final ScopeToolState state) {
+ final Icon icon = state.getLevel().getIcon();
+ final String scopeName = state.getScopeName();
+ if (icon instanceof HighlightDisplayLevel.SingleColorIconWithMask) {
+ if (myIsFirst) {
+ myScopeToAverageSeverityMap.put(scopeName, state.getLevel().getSeverity());
+ } else {
+ final HighlightSeverity severity = myScopeToAverageSeverityMap.get(scopeName);
+ if (!ScopesAndSeveritiesTable.MIXED_FAKE_SEVERITY.equals(severity) && !Comparing.equal(severity, state.getLevel().getSeverity())) {
+ myScopeToAverageSeverityMap.put(scopeName, ScopesAndSeveritiesTable.MIXED_FAKE_SEVERITY);
+ }
+ }
+ } else if (!ScopesAndSeveritiesTable.MIXED_FAKE_SEVERITY.equals(myScopeToAverageSeverityMap.get(scopeName))) {
+ myScopeToAverageSeverityMap.put(scopeName, ScopesAndSeveritiesTable.MIXED_FAKE_SEVERITY);
+ }
+ }
+ }
+}
diff --git a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/inspectionsTree/MultiScopeSeverityIcon.java b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/inspectionsTree/MultiScopeSeverityIcon.java
new file mode 100644
index 000000000000..6f093ca66349
--- /dev/null
+++ b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/inspectionsTree/MultiScopeSeverityIcon.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2000-2014 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.profile.codeInspection.ui.inspectionsTree;
+
+
+import com.intellij.codeHighlighting.HighlightDisplayLevel;
+import com.intellij.lang.annotation.HighlightSeverity;
+import com.intellij.ui.JBColor;
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Collection;
+import java.util.LinkedHashMap;
+
+/**
+ * @author Dmitry Batkovich
+ */
+public class MultiScopeSeverityIcon implements Icon {
+ private final static JBColor MIXED_SEVERITY_COLOR = JBColor.DARK_GRAY;
+
+ private final static int SIZE = 12;
+
+ private final LinkedHashMap<String, HighlightSeverity> myScopeToAverageSeverityMap;
+
+ public MultiScopeSeverityIcon(final LinkedHashMap<String, HighlightSeverity> scopeToAverageSeverityMap) {
+ myScopeToAverageSeverityMap = scopeToAverageSeverityMap;
+ }
+
+ public LinkedHashMap<String, HighlightSeverity> getScopeToAverageSeverityMap() {
+ return myScopeToAverageSeverityMap;
+ }
+
+ @Override
+ public void paintIcon(final Component c, final Graphics g, final int i, final int j) {
+ final int iconWidth = getIconWidth();
+
+ final int partWidth = iconWidth / myScopeToAverageSeverityMap.size();
+
+ final Collection<HighlightSeverity> values = myScopeToAverageSeverityMap.values();
+ int idx = 0;
+ for (final HighlightSeverity severity : values) {
+ final Icon icon = HighlightDisplayLevel.find(severity).getIcon();
+ g.setColor(icon instanceof HighlightDisplayLevel.SingleColorIconWithMask ?
+ ((HighlightDisplayLevel.SingleColorIconWithMask)icon).getColor() : MIXED_SEVERITY_COLOR);
+ final int x = i + partWidth * idx;
+ g.fillRect(x, j, partWidth, getIconHeight());
+ idx++;
+ }
+ g.drawImage(HighlightDisplayLevel.ImageHolder.ourErrorMaskImage, i, j, null);
+ }
+
+ @Override
+ public int getIconWidth() {
+ return SIZE;
+ }
+
+ @Override
+ public int getIconHeight() {
+ return SIZE;
+ }
+}
diff --git a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/inspectionsTree/ScopesAndSeveritiesHintTable.java b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/inspectionsTree/ScopesAndSeveritiesHintTable.java
new file mode 100644
index 000000000000..05cb7ab193f5
--- /dev/null
+++ b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/inspectionsTree/ScopesAndSeveritiesHintTable.java
@@ -0,0 +1,106 @@
+/*
+ * Copyright 2000-2014 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.profile.codeInspection.ui.inspectionsTree;
+
+import com.intellij.codeHighlighting.HighlightDisplayLevel;
+import com.intellij.lang.annotation.HighlightSeverity;
+import com.intellij.profile.codeInspection.ui.SingleInspectionProfilePanel;
+import com.intellij.ui.table.JBTable;
+
+import javax.swing.*;
+import javax.swing.table.AbstractTableModel;
+import javax.swing.table.DefaultTableCellRenderer;
+import java.awt.*;
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+
+/**
+ * @author Dmitry Batkovich
+ */
+public class ScopesAndSeveritiesHintTable extends JBTable {
+ private final static int SCOPE_COLUMN = 0;
+ private final static int SEVERITY_COLUMN = 1;
+
+ public ScopesAndSeveritiesHintTable(final LinkedHashMap<String, HighlightSeverity> scopeToAverageSeverityMap) {
+ super(new MyModel(scopeToAverageSeverityMap));
+
+ final DefaultTableCellRenderer cellRenderer = new DefaultTableCellRenderer();
+ cellRenderer.setOpaque(false);
+ getColumnModel().getColumn(SCOPE_COLUMN).setCellRenderer(cellRenderer);
+
+ getColumnModel().getColumn(SEVERITY_COLUMN).setCellRenderer(new DefaultTableCellRenderer() {
+ @Override
+ public Component getTableCellRendererComponent(final JTable table,
+ final Object value,
+ final boolean isSelected,
+ final boolean hasFocus,
+ final int row,
+ final int column) {
+ super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
+ final HighlightSeverity severity = (HighlightSeverity)value;
+ setIcon(HighlightDisplayLevel.find(severity).getIcon());
+ setText(SingleInspectionProfilePanel.renderSeverity(severity));
+ setOpaque(false);
+ return this;
+ }
+ });
+ setShowGrid(false);
+ setRowSelectionAllowed(false);
+ setColumnSelectionAllowed(false);
+ setOpaque(false);
+ }
+
+ private final static class MyModel extends AbstractTableModel {
+
+ private final LinkedHashMap<String, HighlightSeverity> myScopeToAverageSeverityMap;
+ private final List<String> myScopes;
+
+ public MyModel(final LinkedHashMap<String, HighlightSeverity> scopeToAverageSeverityMap) {
+ myScopeToAverageSeverityMap = scopeToAverageSeverityMap;
+ myScopes = new ArrayList<String>(myScopeToAverageSeverityMap.keySet());
+ }
+
+ @Override
+ public Class<?> getColumnClass(final int columnIndex) {
+ switch (columnIndex) {
+ case SCOPE_COLUMN: return String.class;
+ case SEVERITY_COLUMN: return HighlightSeverity.class;
+ default: throw new IllegalArgumentException();
+ }
+ }
+
+ @Override
+ public int getRowCount() {
+ return myScopes.size();
+ }
+
+ @Override
+ public int getColumnCount() {
+ return 2;
+ }
+
+ @Override
+ public Object getValueAt(final int rowIndex, final int columnIndex) {
+ switch (columnIndex) {
+ case SCOPE_COLUMN: return myScopes.get(rowIndex);
+ case SEVERITY_COLUMN: return myScopeToAverageSeverityMap.get(myScopes.get(rowIndex));
+ default: throw new IllegalArgumentException();
+ }
+
+ }
+ }
+}
diff --git a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/table/ScopesAndSeveritiesTable.java b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/table/ScopesAndSeveritiesTable.java
new file mode 100644
index 000000000000..ad7dc946fff8
--- /dev/null
+++ b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/table/ScopesAndSeveritiesTable.java
@@ -0,0 +1,404 @@
+/*
+ * Copyright 2000-2014 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.profile.codeInspection.ui.table;
+
+import com.intellij.codeHighlighting.HighlightDisplayLevel;
+import com.intellij.codeInsight.daemon.HighlightDisplayKey;
+import com.intellij.codeInspection.ex.InspectionProfileImpl;
+import com.intellij.codeInspection.ex.ScopeToolState;
+import com.intellij.icons.AllIcons;
+import com.intellij.lang.annotation.HighlightSeverity;
+import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.Comparing;
+import com.intellij.profile.codeInspection.ui.AddScopeUtil;
+import com.intellij.profile.codeInspection.ui.inspectionsTree.InspectionConfigTreeNode;
+import com.intellij.psi.search.scope.packageSet.NamedScope;
+import com.intellij.ui.table.JBTable;
+import com.intellij.ui.treeStructure.treetable.TreeTable;
+import com.intellij.util.ArrayUtil;
+import com.intellij.util.SmartList;
+import com.intellij.util.ui.EditableModel;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import javax.swing.*;
+import javax.swing.event.ListSelectionEvent;
+import javax.swing.event.ListSelectionListener;
+import javax.swing.table.AbstractTableModel;
+import javax.swing.table.TableColumn;
+import javax.swing.table.TableColumnModel;
+import java.util.ArrayList;
+import java.util.LinkedHashSet;
+import java.util.List;
+
+/**
+ * @author Dmitry Batkovich
+ */
+public class ScopesAndSeveritiesTable extends JBTable {
+ private final static Logger LOG = Logger.getInstance(ScopesAndSeveritiesTable.class);
+
+ public static final HighlightSeverity MIXED_FAKE_SEVERITY = new HighlightSeverity("Mixed", -1);
+ @SuppressWarnings("UnusedDeclaration")
+ public static final HighlightDisplayLevel MIXED_FAKE_LEVEL = new HighlightDisplayLevel(MIXED_FAKE_SEVERITY, AllIcons.Actions.Help);
+
+ private final static int SCOPE_ENABLED_COLUMN = 0;
+ private final static int SCOPE_NAME_COLUMN = 1;
+ private final static int SEVERITY_COLUMN = 2;
+
+ public ScopesAndSeveritiesTable(final TableSettings tableSettings) {
+ super(new MyTableModel(tableSettings));
+
+ final TableColumnModel columnModel = getColumnModel();
+
+ final TableColumn scopeEnabledColumn = columnModel.getColumn(SCOPE_ENABLED_COLUMN);
+ scopeEnabledColumn.setMaxWidth(30);
+ scopeEnabledColumn.setCellRenderer(new ThreeStateCheckBoxRenderer());
+ scopeEnabledColumn.setCellEditor(new ThreeStateCheckBoxRenderer());
+
+ final TableColumn severityColumn = columnModel.getColumn(SEVERITY_COLUMN);
+ severityColumn.setCellRenderer(SeverityRenderer.create(tableSettings.getInspectionProfile()));
+ severityColumn.setCellEditor(SeverityRenderer.create(tableSettings.getInspectionProfile()));
+
+ setColumnSelectionAllowed(false);
+ setRowSelectionAllowed(true);
+ setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+
+ getSelectionModel().addListSelectionListener(new ListSelectionListener() {
+ @Override
+ public void valueChanged(final ListSelectionEvent e) {
+ final int idx = getSelectionModel().getMinSelectionIndex();
+ if (idx >= 0) {
+ final ExistedScopesStatesAndNonExistNames scopeToolState = ((MyTableModel)getModel()).getScopeToolState(idx);
+ final List<ScopeToolState> existedStates = scopeToolState.getExistedStates();
+ if (existedStates.size() == 1) {
+ tableSettings.onScopeChosen(existedStates.get(0));
+ }
+ }
+ }
+ });
+ setRowSelectionInterval(0, 0);
+
+ setStriped(true);
+ setShowGrid(false);
+ }
+
+ public abstract static class TableSettings {
+ private final List<InspectionConfigTreeNode> myNodes;
+ private final List<String> myKeyNames;
+ private final List<HighlightDisplayKey> myKeys;
+ private final InspectionProfileImpl myInspectionProfile;
+ private final TreeTable myTreeTable;
+ private final Project myProject;
+
+ protected TableSettings(final List<InspectionConfigTreeNode> nodes,
+ final InspectionProfileImpl inspectionProfile,
+ final TreeTable treeTable,
+ final Project project) {
+ myNodes = nodes;
+ myKeys = new ArrayList<HighlightDisplayKey>(myNodes.size());
+ myKeyNames = new ArrayList<String>(myNodes.size());
+ for(final InspectionConfigTreeNode node : nodes) {
+ final HighlightDisplayKey key = node.getDefaultDescriptor().getKey();
+ myKeys.add(key);
+ myKeyNames.add(key.toString());
+ }
+
+ myInspectionProfile = inspectionProfile;
+ myTreeTable = treeTable;
+ myProject = project;
+ }
+
+ public List<HighlightDisplayKey> getKeys() {
+ return myKeys;
+ }
+
+ public List<String> getKeyNames() {
+ return myKeyNames;
+ }
+
+ public List<InspectionConfigTreeNode> getNodes() {
+ return myNodes;
+ }
+
+ public InspectionProfileImpl getInspectionProfile() {
+ return myInspectionProfile;
+ }
+
+ public TreeTable getTreeTable() {
+ return myTreeTable;
+ }
+
+ public Project getProject() {
+ return myProject;
+ }
+
+ protected abstract void onScopeAdded();
+
+ protected abstract void onScopeRemoved(final int scopesCount);
+
+ protected abstract void onScopeChosen(final @NotNull ScopeToolState scopeToolState);
+
+ protected abstract void onChange();
+ }
+
+ @NotNull
+ public static HighlightSeverity getSeverity(final List<ScopeToolState> scopeToolStates) {
+ HighlightSeverity previousValue = null;
+ for (final ScopeToolState scopeToolState : scopeToolStates) {
+ final HighlightSeverity currentValue = scopeToolState.getLevel().getSeverity();
+ if (previousValue == null) {
+ previousValue = currentValue;
+ } else if (!previousValue.equals(currentValue)){
+ return MIXED_FAKE_SEVERITY;
+ }
+ }
+ return previousValue;
+ }
+
+ private static class MyTableModel extends AbstractTableModel implements EditableModel {
+ private final InspectionProfileImpl myInspectionProfile;
+ private final List<String> myKeyNames;
+ private final List<InspectionConfigTreeNode> myNodes;
+ private final TreeTable myTreeTable;
+ private final Project myProject;
+ private final TableSettings myTableSettings;
+ private final List<HighlightDisplayKey> myKeys;
+
+ private String[] myScopeNames;
+
+ public MyTableModel(final TableSettings tableSettings) {
+ myTableSettings = tableSettings;
+ myProject = tableSettings.getProject();
+ myInspectionProfile = tableSettings.getInspectionProfile();
+ myKeys = tableSettings.getKeys();
+ myKeyNames = tableSettings.getKeyNames();
+ myNodes = tableSettings.getNodes();
+ myTreeTable = tableSettings.getTreeTable();
+ refreshAggregatedScopes();
+ }
+
+ @Override
+ public boolean isCellEditable(final int rowIndex, final int columnIndex) {
+ return columnIndex != SCOPE_NAME_COLUMN;
+ }
+
+ @Override
+ public int getRowCount() {
+ return lastRowIndex() + 1;
+ }
+
+ @Nullable
+ @Override
+ public String getColumnName(final int column) {
+ return null;
+ }
+
+ @Override
+ public int getColumnCount() {
+ return 3;
+ }
+
+ @Override
+ public Class<?> getColumnClass(final int columnIndex) {
+ if (SCOPE_ENABLED_COLUMN == columnIndex) {
+ return Boolean.class;
+ }
+ if (SCOPE_NAME_COLUMN == columnIndex) {
+ return String.class;
+ }
+ if (SEVERITY_COLUMN == columnIndex) {
+ return HighlightSeverity.class;
+ }
+ throw new IllegalArgumentException();
+ }
+
+ @Override
+ public Object getValueAt(final int rowIndex, final int columnIndex) {
+ if (rowIndex < 0) {
+ return null;
+ }
+ switch (columnIndex) {
+ case SCOPE_ENABLED_COLUMN:
+ return isEnabled(rowIndex);
+ case SCOPE_NAME_COLUMN:
+ return getScope(rowIndex).getName();
+ case SEVERITY_COLUMN:
+ return getSeverity(rowIndex);
+ default:
+ throw new IllegalArgumentException("Invalid column index " + columnIndex);
+ }
+ }
+
+ private NamedScope getScope(final int rowIndex) {
+ return getScopeToolState(rowIndex).getExistedStates().get(0).getScope(myProject);
+ }
+
+ @NotNull
+ private HighlightSeverity getSeverity(final int rowIndex) {
+ final ExistedScopesStatesAndNonExistNames existedScopesStatesAndNonExistNames = getScopeToolState(rowIndex);
+ if (!existedScopesStatesAndNonExistNames.getNonExistNames().isEmpty()) {
+ return MIXED_FAKE_SEVERITY;
+ }
+ return ScopesAndSeveritiesTable.getSeverity(existedScopesStatesAndNonExistNames.getExistedStates());
+ }
+
+ @Nullable
+ private Boolean isEnabled(final int rowIndex) {
+ Boolean previousValue = null;
+ final ExistedScopesStatesAndNonExistNames existedScopesStatesAndNonExistNames = getScopeToolState(rowIndex);
+ for (final ScopeToolState scopeToolState : existedScopesStatesAndNonExistNames.getExistedStates()) {
+ final boolean currentValue = scopeToolState.isEnabled();
+ if (previousValue == null) {
+ previousValue = currentValue;
+ } else if (!previousValue.equals(currentValue)){
+ return null;
+ }
+ }
+ if (!existedScopesStatesAndNonExistNames.getNonExistNames().isEmpty() && !Boolean.FALSE.equals(previousValue)) {
+ return null;
+ }
+ return previousValue;
+ }
+
+ private ExistedScopesStatesAndNonExistNames getScopeToolState(final int rowIndex) {
+ final List<String> nonExistNames = new SmartList<String>();
+ final List<ScopeToolState> existedStates = new SmartList<ScopeToolState>();
+ for (final String keyName : myKeyNames) {
+ final ScopeToolState scopeToolState = getScopeToolState(keyName, rowIndex);
+ if (scopeToolState != null) {
+ existedStates.add(scopeToolState);
+ } else {
+ nonExistNames.add(keyName);
+ }
+ }
+ return new ExistedScopesStatesAndNonExistNames(existedStates, nonExistNames);
+ }
+
+ @Nullable
+ private ScopeToolState getScopeToolState(final String keyName, final int rowIndex) {
+ if (rowIndex == lastRowIndex()) {
+ return myInspectionProfile.getToolDefaultState(keyName, myProject);
+ }
+ else {
+ final String scopeName = myScopeNames[rowIndex];
+ final List<ScopeToolState> nonDefaultTools = myInspectionProfile.getNonDefaultTools(keyName, myProject);
+ for (final ScopeToolState nonDefaultTool : nonDefaultTools) {
+ if (Comparing.equal(scopeName, nonDefaultTool.getScopeName())) {
+ return nonDefaultTool;
+ }
+ }
+ }
+ return null;
+ }
+
+ private void refreshAggregatedScopes() {
+ final LinkedHashSet<String> scopesNames = new LinkedHashSet<String>();
+ for (final String keyName : myKeyNames) {
+ final List<ScopeToolState> nonDefaultTools = myInspectionProfile.getNonDefaultTools(keyName, myProject);
+ for (final ScopeToolState tool : nonDefaultTools) {
+ scopesNames.add(tool.getScopeName());
+ }
+ }
+ myScopeNames = ArrayUtil.toStringArray(scopesNames);
+ }
+
+ private int lastRowIndex() {
+ return myScopeNames.length;
+ }
+
+ @Override
+ public void setValueAt(final Object value, final int rowIndex, final int columnIndex) {
+ if (value == null) {
+ return;
+ }
+ if (columnIndex == SEVERITY_COLUMN) {
+ final HighlightDisplayLevel level = HighlightDisplayLevel.find(((HighlightSeverity)value).getName());
+ if (level == null) {
+ LOG.error("no display level found for name " + ((HighlightSeverity)value).getName());
+ return;
+ }
+ final int idx = rowIndex == lastRowIndex() ? -1 : rowIndex;
+ myInspectionProfile.setErrorLevel(myKeys, level, idx, myProject);
+ }
+ else if (columnIndex == SCOPE_ENABLED_COLUMN) {
+ final NamedScope scope = getScope(rowIndex);
+ if ((Boolean)value) {
+ if (rowIndex == lastRowIndex()) {
+ myInspectionProfile.enableToolsByDefault(myKeyNames, myProject);
+ }
+ else {
+ //TODO create scopes states if not exist (need scope sorting)
+ myInspectionProfile.enableTools(myKeyNames, scope, myProject);
+ }
+ }
+ else {
+ if (rowIndex == lastRowIndex()) {
+ myInspectionProfile.disableToolByDefault(myKeyNames, myProject);
+ }
+ else {
+ myInspectionProfile.disableTools(myKeyNames, scope, myProject);
+ }
+ }
+ }
+ myTableSettings.onChange();
+ }
+
+ @Override
+ public void removeRow(final int idx) {
+ if (idx != lastRowIndex()) {
+ myInspectionProfile.removeScopes(myKeyNames, getScope(idx), myProject);
+ refreshAggregatedScopes();
+ myTableSettings.onScopeRemoved(getRowCount());
+ }
+ }
+
+ @Override
+ public void addRow() {
+ AddScopeUtil.performAddScope(myTreeTable, myProject, myInspectionProfile, myNodes);
+ myTableSettings.onScopeAdded();
+ refreshAggregatedScopes();
+ }
+
+ @Override
+ public void exchangeRows(final int oldIndex, final int newIndex) {
+ }
+
+ @Override
+ public boolean canExchangeRows(final int oldIndex, final int newIndex) {
+ return false;
+ }
+ }
+
+ private static class ExistedScopesStatesAndNonExistNames {
+
+ private final List<ScopeToolState> myExistedStates;
+ private final List<String> myNonExistNames;
+
+ public ExistedScopesStatesAndNonExistNames(final List<ScopeToolState> existedStates, final List<String> nonExistNames) {
+ myExistedStates = existedStates;
+ myNonExistNames = nonExistNames;
+ }
+
+ public List<ScopeToolState> getExistedStates() {
+ return myExistedStates;
+ }
+
+ public List<String> getNonExistNames() {
+ return myNonExistNames;
+ }
+ }
+} \ No newline at end of file
diff --git a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/table/SeverityRenderer.java b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/table/SeverityRenderer.java
new file mode 100644
index 000000000000..2fe95e6d7224
--- /dev/null
+++ b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/table/SeverityRenderer.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2000-2014 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.profile.codeInspection.ui.table;
+
+import com.intellij.codeHighlighting.HighlightDisplayLevel;
+import com.intellij.codeInspection.ex.InspectionProfileImpl;
+import com.intellij.lang.annotation.HighlightSeverity;
+import com.intellij.openapi.ui.ComboBoxTableRenderer;
+import com.intellij.profile.codeInspection.SeverityProvider;
+import com.intellij.profile.codeInspection.ui.LevelChooserAction;
+import com.intellij.profile.codeInspection.ui.SingleInspectionProfilePanel;
+import org.jetbrains.annotations.NotNull;
+
+import javax.swing.*;
+import java.awt.event.MouseEvent;
+import java.util.EventObject;
+import java.util.SortedSet;
+
+/**
+ * @author Dmitry Batkovich
+ */
+public class SeverityRenderer extends ComboBoxTableRenderer<HighlightSeverity> {
+ public SeverityRenderer(final HighlightSeverity[] values) {
+ super(values);
+ }
+
+ public static SeverityRenderer create(final InspectionProfileImpl inspectionProfile) {
+ final SortedSet<HighlightSeverity> severities =
+ LevelChooserAction.getSeverities(((SeverityProvider)inspectionProfile.getProfileManager()).getOwnSeverityRegistrar());
+ return new SeverityRenderer(severities.toArray(new HighlightSeverity[severities.size()]));
+ }
+
+
+ @Override
+ protected String getTextFor(@NotNull final HighlightSeverity value) {
+ return SingleInspectionProfilePanel.renderSeverity(value);
+ }
+
+ @Override
+ protected Icon getIconFor(@NotNull final HighlightSeverity value) {
+ return HighlightDisplayLevel.find(value).getIcon();
+ }
+
+ @Override
+ public boolean isCellEditable(final EventObject event) {
+ if (event instanceof MouseEvent) {
+ return ((MouseEvent)event).getClickCount() >= 1;
+ }
+ return true;
+ }
+}
diff --git a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/table/ThreeStateCheckBoxRenderer.java b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/table/ThreeStateCheckBoxRenderer.java
new file mode 100644
index 000000000000..7d8cfdfc9db5
--- /dev/null
+++ b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/table/ThreeStateCheckBoxRenderer.java
@@ -0,0 +1,127 @@
+/*
+ * Copyright 2000-2014 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.profile.codeInspection.ui.table;
+
+import com.intellij.ui.ClickListener;
+import com.intellij.util.SmartList;
+import com.intellij.util.ui.ThreeStateCheckBox;
+import com.intellij.util.ui.UIUtil;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import javax.swing.*;
+import javax.swing.event.CellEditorListener;
+import javax.swing.event.ChangeEvent;
+import javax.swing.table.TableCellEditor;
+import javax.swing.table.TableCellRenderer;
+import java.awt.*;
+import java.awt.event.MouseEvent;
+import java.util.EventObject;
+import java.util.List;
+
+/**
+ * @author Dmitry Batkovich
+ */
+public class ThreeStateCheckBoxRenderer extends ThreeStateCheckBox implements TableCellRenderer, TableCellEditor {
+
+ private final List<CellEditorListener> myListeners = new SmartList<CellEditorListener>();
+
+ public ThreeStateCheckBoxRenderer() {
+ setThirdStateEnabled(false);
+ setHorizontalAlignment(CENTER);
+ setVerticalAlignment(CENTER);
+ }
+
+ @Override
+ public Component getTableCellEditorComponent(final JTable table, final Object value, final boolean isSelected, final int row, final int column) {
+ return tune(value, isSelected, row, table);
+ }
+
+ @Override
+ public Component getTableCellRendererComponent(final JTable table, final Object value, final boolean isSelected, final boolean hasFocus, final int row, final int column) {
+ return tune(value, isSelected, row, table);
+ }
+
+ private JCheckBox tune(final Object value, final boolean isSelected, final int row, final JTable table) {
+ final Color bg = UIUtil.isUnderNimbusLookAndFeel() && row % 2 == 1 ? UIUtil.TRANSPARENT_COLOR : table.getBackground();
+ final Color fg = table.getForeground();
+ final Color selBg = table.getSelectionBackground();
+ final Color selFg = table.getSelectionForeground();
+
+ setForeground(isSelected ? selFg : fg);
+ setBackground(isSelected ? selBg : bg);
+
+ if (value == null) {
+ setState(State.DONT_CARE);
+ } else {
+ setSelected((Boolean) value);
+ }
+ new ClickListener() {
+ @Override
+ public boolean onClick(@NotNull final MouseEvent event, final int clickCount) {
+ if (clickCount == 1) {
+ stopCellEditing();
+ return true;
+ }
+ return false;
+ }
+ }.installOn(this);
+ return this;
+ }
+
+ @Nullable
+ @Override
+ public Object getCellEditorValue() {
+ return getState() != State.DONT_CARE ? isSelected() : null;
+ }
+
+ @Override
+ public boolean isCellEditable(final EventObject anEvent) {
+ return true;
+ }
+
+ @Override
+ public boolean shouldSelectCell(final EventObject anEvent) {
+ return true;
+ }
+
+ @Override
+ public boolean stopCellEditing() {
+ final ChangeEvent e = new ChangeEvent(this);
+ for (final CellEditorListener listener : myListeners) {
+ listener.editingStopped(e);
+ }
+ return true;
+ }
+
+ @Override
+ public void cancelCellEditing() {
+ final ChangeEvent e = new ChangeEvent(this);
+ for (final CellEditorListener listener : myListeners) {
+ listener.editingCanceled(e);
+ }
+ }
+
+ @Override
+ public void addCellEditorListener(final CellEditorListener l) {
+ myListeners.add(l);
+ }
+
+ @Override
+ public void removeCellEditorListener(final CellEditorListener l) {
+ myListeners.remove(l);
+ }
+}
diff --git a/platform/lang-impl/src/com/intellij/psi/impl/file/DirectoryIconProvider.java b/platform/lang-impl/src/com/intellij/psi/impl/file/DirectoryIconProvider.java
index d12bc939293f..6aaa810340bd 100644
--- a/platform/lang-impl/src/com/intellij/psi/impl/file/DirectoryIconProvider.java
+++ b/platform/lang-impl/src/com/intellij/psi/impl/file/DirectoryIconProvider.java
@@ -20,11 +20,15 @@
*/
package com.intellij.psi.impl.file;
+import com.intellij.icons.AllIcons;
import com.intellij.ide.IconProvider;
import com.intellij.ide.projectView.impl.ProjectRootsUtil;
import com.intellij.openapi.project.DumbAware;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.roots.ProjectRootManager;
import com.intellij.openapi.roots.SourceFolder;
import com.intellij.openapi.roots.ui.configuration.SourceRootPresentation;
+import com.intellij.openapi.util.registry.Registry;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiDirectory;
import com.intellij.psi.PsiElement;
@@ -39,11 +43,18 @@ public class DirectoryIconProvider extends IconProvider implements DumbAware {
if (element instanceof PsiDirectory) {
final PsiDirectory psiDirectory = (PsiDirectory)element;
final VirtualFile vFile = psiDirectory.getVirtualFile();
- SourceFolder sourceFolder = ProjectRootsUtil.getModuleSourceRoot(vFile, psiDirectory.getProject());
+ Project project = psiDirectory.getProject();
+ SourceFolder sourceFolder = ProjectRootsUtil.getModuleSourceRoot(vFile, project);
if (sourceFolder != null) {
return SourceRootPresentation.getSourceRootIcon(sourceFolder);
}
else {
+ if (!Registry.is("ide.hide.excluded.files")) {
+ boolean ignored = ProjectRootManager.getInstance(project).getFileIndex().isExcluded(vFile);
+ if (ignored) {
+ return AllIcons.Modules.ExcludeRoot;
+ }
+ }
return PlatformIcons.DIRECTORY_CLOSED_ICON;
}
}
diff --git a/platform/lang-impl/src/com/intellij/psi/impl/file/impl/PsiVFSListener.java b/platform/lang-impl/src/com/intellij/psi/impl/file/impl/PsiVFSListener.java
index bb2c938e3d08..17dd2bca1f17 100644
--- a/platform/lang-impl/src/com/intellij/psi/impl/file/impl/PsiVFSListener.java
+++ b/platform/lang-impl/src/com/intellij/psi/impl/file/impl/PsiVFSListener.java
@@ -443,7 +443,7 @@ public class PsiVFSListener extends VirtualFileAdapter {
public void run() {
PsiTreeChangeEventImpl treeEvent = new PsiTreeChangeEventImpl(myManager);
- boolean isExcluded = vFile.isDirectory() && myProjectRootManager.getFileIndex().isIgnored(vFile);
+ boolean isExcluded = vFile.isDirectory() && myProjectRootManager.getFileIndex().isExcluded(vFile);
if (oldParentDir != null && !isExcluded) {
if (newParentDir != null) {
treeEvent.setOldParent(oldParentDir);
diff --git a/platform/lang-impl/src/com/intellij/psi/impl/source/PostprocessReformattingAspect.java b/platform/lang-impl/src/com/intellij/psi/impl/source/PostprocessReformattingAspect.java
index 63413321ce41..c5b183c3594b 100644
--- a/platform/lang-impl/src/com/intellij/psi/impl/source/PostprocessReformattingAspect.java
+++ b/platform/lang-impl/src/com/intellij/psi/impl/source/PostprocessReformattingAspect.java
@@ -636,7 +636,7 @@ public class PostprocessReformattingAspect implements PomModelAspect {
final PsiDocumentManager documentManager = PsiDocumentManager.getInstance(myPsiManager.getProject());
final Document document = viewProvider.getDocument();
assert document != null;
- final CodeFormatterFacade codeFormatter = new CodeFormatterFacade(styleSettings);
+ final CodeFormatterFacade codeFormatter = new CodeFormatterFacade(styleSettings, viewProvider.getBaseLanguage());
documentManager.commitDocument(document);
return codeFormatter;
diff --git a/platform/lang-impl/src/com/intellij/psi/impl/source/codeStyle/CodeFormatterFacade.java b/platform/lang-impl/src/com/intellij/psi/impl/source/codeStyle/CodeFormatterFacade.java
index e76aecfa1e0b..fa1dd9e86b4a 100644
--- a/platform/lang-impl/src/com/intellij/psi/impl/source/codeStyle/CodeFormatterFacade.java
+++ b/platform/lang-impl/src/com/intellij/psi/impl/source/codeStyle/CodeFormatterFacade.java
@@ -78,10 +78,12 @@ public class CodeFormatterFacade {
private final CodeStyleSettings mySettings;
private final FormatterTagHandler myTagHandler;
+ private final int myRightMargin;
- public CodeFormatterFacade(CodeStyleSettings settings) {
+ public CodeFormatterFacade(CodeStyleSettings settings, @Nullable Language language) {
mySettings = settings;
myTagHandler = new FormatterTagHandler(settings);
+ myRightMargin = mySettings.getRightMargin(language);
}
public ASTNode processElement(ASTNode element) {
@@ -637,8 +639,8 @@ public class CodeFormatterFacade {
}
private int wrapPositionForTextWithoutTabs(int startLineOffset, int endLineOffset, int targetRangeEndOffset) {
- if (Math.min(endLineOffset, targetRangeEndOffset) - startLineOffset > mySettings.RIGHT_MARGIN) {
- return startLineOffset + mySettings.RIGHT_MARGIN - FormatConstants.RESERVED_LINE_WRAP_WIDTH_IN_COLUMNS;
+ if (Math.min(endLineOffset, targetRangeEndOffset) - startLineOffset > myRightMargin) {
+ return startLineOffset + myRightMargin - FormatConstants.RESERVED_LINE_WRAP_WIDTH_IN_COLUMNS;
}
return -1;
}
@@ -659,13 +661,13 @@ public class CodeFormatterFacade {
case '\t': symbolWidth = tabSize - (width % tabSize); break;
default: symbolWidth = 1;
}
- if (width + symbolWidth + FormatConstants.RESERVED_LINE_WRAP_WIDTH_IN_COLUMNS >= mySettings.RIGHT_MARGIN
+ if (width + symbolWidth + FormatConstants.RESERVED_LINE_WRAP_WIDTH_IN_COLUMNS >= myRightMargin
&& (Math.min(endLineOffset, targetRangeEndOffset) - i) >= FormatConstants.RESERVED_LINE_WRAP_WIDTH_IN_COLUMNS)
{
// Remember preferred position.
result = i - 1;
}
- if (width + symbolWidth >= mySettings.RIGHT_MARGIN) {
+ if (width + symbolWidth >= myRightMargin) {
wrapLine = true;
break;
}
@@ -700,12 +702,12 @@ public class CodeFormatterFacade {
break;
default: newX = x + EditorUtil.charWidth(c, Font.PLAIN, editor); symbolWidth = 1;
}
- if (width + symbolWidth + FormatConstants.RESERVED_LINE_WRAP_WIDTH_IN_COLUMNS >= mySettings.RIGHT_MARGIN
+ if (width + symbolWidth + FormatConstants.RESERVED_LINE_WRAP_WIDTH_IN_COLUMNS >= myRightMargin
&& (Math.min(endLineOffset, targetRangeEndOffset) - i) >= FormatConstants.RESERVED_LINE_WRAP_WIDTH_IN_COLUMNS)
{
result = i - 1;
}
- if (width + symbolWidth >= mySettings.RIGHT_MARGIN) {
+ if (width + symbolWidth >= myRightMargin) {
wrapLine = true;
break;
}
diff --git a/platform/lang-impl/src/com/intellij/psi/impl/source/codeStyle/CodeStyleFacadeImpl.java b/platform/lang-impl/src/com/intellij/psi/impl/source/codeStyle/CodeStyleFacadeImpl.java
index a9031f3133a3..81eda35222dd 100644
--- a/platform/lang-impl/src/com/intellij/psi/impl/source/codeStyle/CodeStyleFacadeImpl.java
+++ b/platform/lang-impl/src/com/intellij/psi/impl/source/codeStyle/CodeStyleFacadeImpl.java
@@ -20,6 +20,7 @@
package com.intellij.psi.impl.source.codeStyle;
import com.intellij.codeStyle.CodeStyleFacade;
+import com.intellij.lang.Language;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.options.Configurable;
@@ -68,8 +69,8 @@ public class CodeStyleFacadeImpl extends CodeStyleFacade {
}
@Override
- public int getRightMargin() {
- return CodeStyleSettingsManager.getSettings(myProject).RIGHT_MARGIN;
+ public int getRightMargin(Language language) {
+ return CodeStyleSettingsManager.getSettings(myProject).getRightMargin(language);
}
@Override
diff --git a/platform/lang-impl/src/com/intellij/psi/impl/source/codeStyle/CodeStyleManagerImpl.java b/platform/lang-impl/src/com/intellij/psi/impl/source/codeStyle/CodeStyleManagerImpl.java
index 043ac483d2ed..767152fc1e2b 100644
--- a/platform/lang-impl/src/com/intellij/psi/impl/source/codeStyle/CodeStyleManagerImpl.java
+++ b/platform/lang-impl/src/com/intellij/psi/impl/source/codeStyle/CodeStyleManagerImpl.java
@@ -101,7 +101,7 @@ public class CodeStyleManagerImpl extends CodeStyleManager {
}
ASTNode treeElement = SourceTreeToPsiMap.psiElementToTree(element);
- final PsiElement formatted = SourceTreeToPsiMap.treeElementToPsi(new CodeFormatterFacade(getSettings()).processElement(treeElement));
+ final PsiElement formatted = SourceTreeToPsiMap.treeElementToPsi(new CodeFormatterFacade(getSettings(), element.getLanguage()).processElement(treeElement));
if (!canChangeWhiteSpacesOnly) {
return postProcessElement(formatted);
}
@@ -180,7 +180,7 @@ public class CodeStyleManagerImpl extends CodeStyleManager {
ASTNode treeElement = SourceTreeToPsiMap.psiElementToTree(file);
transformAllChildren(treeElement);
- final CodeFormatterFacade codeFormatter = new CodeFormatterFacade(getSettings());
+ final CodeFormatterFacade codeFormatter = new CodeFormatterFacade(getSettings(), file.getLanguage());
LOG.assertTrue(file.isValid());
if (editor == null) {
@@ -274,7 +274,7 @@ public class CodeStyleManagerImpl extends CodeStyleManager {
}
ASTNode treeElement = SourceTreeToPsiMap.psiElementToTree(element);
- final CodeFormatterFacade codeFormatter = new CodeFormatterFacade(getSettings());
+ final CodeFormatterFacade codeFormatter = new CodeFormatterFacade(getSettings(), element.getLanguage());
final PsiElement formatted = SourceTreeToPsiMap.treeElementToPsi(codeFormatter.processRange(treeElement, startOffset, endOffset));
return canChangeWhiteSpacesOnly ? formatted : postProcessElement(formatted);
diff --git a/platform/lang-impl/src/com/intellij/psi/impl/source/tree/injected/InjectedLanguageUtil.java b/platform/lang-impl/src/com/intellij/psi/impl/source/tree/injected/InjectedLanguageUtil.java
index f2863469d614..27089fa70e91 100644
--- a/platform/lang-impl/src/com/intellij/psi/impl/source/tree/injected/InjectedLanguageUtil.java
+++ b/platform/lang-impl/src/com/intellij/psi/impl/source/tree/injected/InjectedLanguageUtil.java
@@ -20,6 +20,7 @@ import com.intellij.injected.editor.*;
import com.intellij.lang.Language;
import com.intellij.lang.LanguageUtil;
import com.intellij.lang.injection.InjectedLanguageManager;
+import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.SelectionModel;
@@ -158,6 +159,22 @@ public class InjectedLanguageUtil {
return getEditorForInjectedLanguageNoCommit(editor, file, offset);
}
+ public static Caret getCaretForInjectedLanguageNoCommit(@Nullable Caret caret, @Nullable PsiFile file) {
+ if (caret == null || file == null || caret instanceof InjectedCaret) return caret;
+
+ PsiFile injectedFile = findInjectedPsiNoCommit(file, caret.getOffset());
+ Editor injectedEditor = getInjectedEditorForInjectedFile(caret.getEditor(), injectedFile);
+ if (!(injectedEditor instanceof EditorWindow)) {
+ return caret;
+ }
+ for (Caret injectedCaret : injectedEditor.getCaretModel().getAllCarets()) {
+ if (((InjectedCaret)injectedCaret).getDelegate() == caret) {
+ return injectedCaret;
+ }
+ }
+ return null;
+ }
+
public static Editor getEditorForInjectedLanguageNoCommit(@Nullable Editor editor, @Nullable PsiFile file, final int offset) {
if (editor == null || file == null || editor instanceof EditorWindow) return editor;
PsiFile injectedFile = findInjectedPsiNoCommit(file, offset);
diff --git a/platform/lang-impl/src/com/intellij/psi/stubs/StubIndexImpl.java b/platform/lang-impl/src/com/intellij/psi/stubs/StubIndexImpl.java
index fc17bf25a33f..d791f14aa841 100644
--- a/platform/lang-impl/src/com/intellij/psi/stubs/StubIndexImpl.java
+++ b/platform/lang-impl/src/com/intellij/psi/stubs/StubIndexImpl.java
@@ -154,15 +154,24 @@ public class StubIndexImpl extends StubIndex implements ApplicationComponent, Pe
break;
}
catch (IOException e) {
- LOG.info(e);
needRebuild = true;
- FileUtil.delete(indexRootDir);
- IndexingStamp.rewriteVersion(versionFile, version); // todo snapshots indices
+ onExceptionInstantiatingIndex(version, versionFile, indexRootDir, e);
+ } catch (RuntimeException e) {
+ //noinspection ThrowableResultOfMethodCallIgnored
+ Throwable cause = FileBasedIndexImpl.getCauseToRebuildIndex(e);
+ if (cause == null) throw e;
+ onExceptionInstantiatingIndex(version, versionFile, indexRootDir, e);
}
}
return needRebuild;
}
+ private static void onExceptionInstantiatingIndex(int version, File versionFile, File indexRootDir, Exception e) throws IOException {
+ LOG.info(e);
+ FileUtil.delete(indexRootDir);
+ IndexingStamp.rewriteVersion(versionFile, version); // todo snapshots indices
+ }
+
private static class StubIdExternalizer implements DataExternalizer<StubIdList> {
@Override
public void save(@NotNull final DataOutput out, @NotNull final StubIdList value) throws IOException {
@@ -207,7 +216,7 @@ public class StubIndexImpl extends StubIndex implements ApplicationComponent, Pe
public <Key, Psi extends PsiElement> Collection<Psi> get(@NotNull final StubIndexKey<Key, Psi> indexKey,
@NotNull final Key key,
@NotNull final Project project,
- final GlobalSearchScope scope) {
+ @Nullable final GlobalSearchScope scope) {
return get(indexKey, key, project, scope, null);
}
@@ -215,7 +224,7 @@ public class StubIndexImpl extends StubIndex implements ApplicationComponent, Pe
public <Key, Psi extends PsiElement> Collection<Psi> get(@NotNull StubIndexKey<Key, Psi> indexKey,
@NotNull Key key,
@NotNull Project project,
- GlobalSearchScope scope,
+ @Nullable GlobalSearchScope scope,
IdFilter filter) {
final List<Psi> result = new SmartList<Psi>();
process(indexKey, key, project, scope, filter, new CommonProcessors.CollectProcessor<Psi>(result));
@@ -226,7 +235,7 @@ public class StubIndexImpl extends StubIndex implements ApplicationComponent, Pe
public <Key, Psi extends PsiElement> boolean processElements(@NotNull StubIndexKey<Key, Psi> indexKey,
@NotNull Key key,
@NotNull Project project,
- GlobalSearchScope scope,
+ @Nullable GlobalSearchScope scope,
Class<Psi> requiredClass,
@NotNull Processor<? super Psi> processor) {
return processElements(indexKey, key, project, scope, null, requiredClass, processor);
@@ -238,7 +247,7 @@ public class StubIndexImpl extends StubIndex implements ApplicationComponent, Pe
@NotNull final Project project,
@Nullable final GlobalSearchScope scope,
@Nullable IdFilter idFilter,
- final Class<Psi> requiredClass,
+ @NotNull final Class<Psi> requiredClass,
@NotNull final Processor<? super Psi> processor) {
final FileBasedIndexImpl fileBasedIndex = (FileBasedIndexImpl)FileBasedIndex.getInstance();
fileBasedIndex.ensureUpToDate(StubUpdatingIndex.INDEX_ID, project, scope);
@@ -315,7 +324,7 @@ public class StubIndexImpl extends StubIndex implements ApplicationComponent, Pe
return processAllKeys(indexKey, processor, GlobalSearchScope.allScope(project), null);
}
- public <K> boolean processAllKeys(@NotNull StubIndexKey<K, ?> indexKey, Processor<K> processor, GlobalSearchScope scope, @Nullable IdFilter idFilter) {
+ public <K> boolean processAllKeys(@NotNull StubIndexKey<K, ?> indexKey, @NotNull Processor<K> processor, @NotNull GlobalSearchScope scope, @Nullable IdFilter idFilter) {
FileBasedIndex.getInstance().ensureUpToDate(StubUpdatingIndex.INDEX_ID, scope.getProject(), scope);
diff --git a/platform/lang-impl/src/com/intellij/refactoring/actions/RefactoringQuickListPopupAction.java b/platform/lang-impl/src/com/intellij/refactoring/actions/RefactoringQuickListPopupAction.java
index aea982678b9d..159279570cf2 100644
--- a/platform/lang-impl/src/com/intellij/refactoring/actions/RefactoringQuickListPopupAction.java
+++ b/platform/lang-impl/src/com/intellij/refactoring/actions/RefactoringQuickListPopupAction.java
@@ -26,6 +26,10 @@ import org.jetbrains.annotations.Nullable;
public class RefactoringQuickListPopupAction extends QuickSwitchSchemeAction {
+ public RefactoringQuickListPopupAction() {
+ setInjectedContext(true);
+ }
+
@Override
protected void fillActions(@Nullable final Project project,
@NotNull final DefaultActionGroup group,
@@ -64,6 +68,7 @@ public class RefactoringQuickListPopupAction extends QuickSwitchSchemeAction {
child instanceof CopyElementAction) {
final Presentation presentation = new Presentation();
final AnActionEvent event = new AnActionEvent(null, dataContext, ActionPlaces.UNKNOWN, presentation, actionManager, 0);
+ event.setInjectedContext(child.isInInjectedContext());
child.update(event);
if (presentation.isEnabled() && presentation.isVisible()) {
destinationGroup.add(child);
diff --git a/platform/lang-impl/src/com/intellij/refactoring/introduce/inplace/AbstractInplaceIntroducer.java b/platform/lang-impl/src/com/intellij/refactoring/introduce/inplace/AbstractInplaceIntroducer.java
index e761e9a3f2f3..81a2885c2022 100644
--- a/platform/lang-impl/src/com/intellij/refactoring/introduce/inplace/AbstractInplaceIntroducer.java
+++ b/platform/lang-impl/src/com/intellij/refactoring/introduce/inplace/AbstractInplaceIntroducer.java
@@ -45,6 +45,8 @@ import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil;
import com.intellij.psi.search.searches.ReferencesSearch;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.refactoring.RefactoringActionHandler;
+import com.intellij.refactoring.listeners.RefactoringEventData;
+import com.intellij.refactoring.listeners.RefactoringEventListener;
import com.intellij.refactoring.rename.inplace.InplaceRefactoring;
import com.intellij.ui.DottedBorder;
import com.intellij.util.ui.PositionTracker;
@@ -537,6 +539,13 @@ public abstract class AbstractInplaceIntroducer<V extends PsiNameIdentifierOwner
CommandProcessor.getInstance().executeCommand(myProject, new Runnable() {
@Override
public void run() {
+ final String refactoringId = getRefactoringId();
+ if (refactoringId != null) {
+ final RefactoringEventData beforeData = new RefactoringEventData();
+ beforeData.addElements(new PsiElement[] {getLocalVariable(), getExpr()});
+ myProject.getMessageBus()
+ .syncPublisher(RefactoringEventListener.REFACTORING_EVENT_TOPIC).refactoringStarted(refactoringId, beforeData);
+ }
performIntroduce();
}
}, getCommandName(), getCommandName());
@@ -567,9 +576,20 @@ public abstract class AbstractInplaceIntroducer<V extends PsiNameIdentifierOwner
}
if (success) {
performPostIntroduceTasks();
+ final String refactoringId = getRefactoringId();
+ if (refactoringId != null) {
+ final RefactoringEventData afterData = new RefactoringEventData();
+ afterData.addElement(getVariable());
+ myProject.getMessageBus()
+ .syncPublisher(RefactoringEventListener.REFACTORING_EVENT_TOPIC).refactoringDone(refactoringId, afterData);
+ }
}
}
+ protected String getRefactoringId() {
+ return null;
+ }
+
@Override
protected boolean startsOnTheSameElement(RefactoringActionHandler handler, PsiElement element) {
return super.startsOnTheSameElement(handler, element) || getLocalVariable() == element;
diff --git a/platform/lang-impl/src/com/intellij/refactoring/rename/inplace/InplaceRefactoring.java b/platform/lang-impl/src/com/intellij/refactoring/rename/inplace/InplaceRefactoring.java
index db30a105865a..aa4f696df179 100644
--- a/platform/lang-impl/src/com/intellij/refactoring/rename/inplace/InplaceRefactoring.java
+++ b/platform/lang-impl/src/com/intellij/refactoring/rename/inplace/InplaceRefactoring.java
@@ -773,32 +773,31 @@ public abstract class InplaceRefactoring {
if (ApplicationManager.getApplication().isHeadlessEnvironment()) return;
final BalloonBuilder balloonBuilder = JBPopupFactory.getInstance().createDialogBalloonBuilder(component, null).setSmallVariant(true);
myBalloon = balloonBuilder.createBalloon();
- final Editor topLevelEditor = InjectedLanguageUtil.getTopLevelEditor(myEditor);
Disposer.register(myProject, myBalloon);
Disposer.register(myBalloon, new Disposable() {
@Override
public void dispose() {
releaseIfNotRestart();
- topLevelEditor.putUserData(PopupFactoryImpl.ANCHOR_POPUP_POSITION, null);
+ myEditor.putUserData(PopupFactoryImpl.ANCHOR_POPUP_POSITION, null);
}
});
- topLevelEditor.getScrollingModel().scrollToCaret(ScrollType.MAKE_VISIBLE);
+ myEditor.getScrollingModel().scrollToCaret(ScrollType.MAKE_VISIBLE);
final JBPopupFactory popupFactory = JBPopupFactory.getInstance();
- myBalloon.show(new PositionTracker<Balloon>(topLevelEditor.getContentComponent()) {
+ myBalloon.show(new PositionTracker<Balloon>(myEditor.getContentComponent()) {
@Override
public RelativePoint recalculateLocation(Balloon object) {
- if (myTarget != null && !popupFactory.isBestPopupLocationVisible(topLevelEditor)) {
+ if (myTarget != null && !popupFactory.isBestPopupLocationVisible(myEditor)) {
return myTarget;
}
if (myCaretRangeMarker != null && myCaretRangeMarker.isValid()) {
- topLevelEditor.putUserData(PopupFactoryImpl.ANCHOR_POPUP_POSITION,
- topLevelEditor.offsetToVisualPosition(myCaretRangeMarker.getStartOffset()));
+ myEditor.putUserData(PopupFactoryImpl.ANCHOR_POPUP_POSITION,
+ myEditor.offsetToVisualPosition(myCaretRangeMarker.getStartOffset()));
}
- final RelativePoint target = popupFactory.guessBestPopupLocation(topLevelEditor);
+ final RelativePoint target = popupFactory.guessBestPopupLocation(myEditor);
final Point screenPoint = target.getScreenPoint();
int y = screenPoint.y;
- if (target.getPoint().getY() > topLevelEditor.getLineHeight() + myBalloon.getPreferredSize().getHeight()) {
- y -= topLevelEditor.getLineHeight();
+ if (target.getPoint().getY() > myEditor.getLineHeight() + myBalloon.getPreferredSize().getHeight()) {
+ y -= myEditor.getLineHeight();
}
myTarget = new RelativePoint(new Point(screenPoint.x, y));
return myTarget;
diff --git a/platform/lang-impl/src/com/intellij/refactoring/rename/inplace/MemberInplaceRenamer.java b/platform/lang-impl/src/com/intellij/refactoring/rename/inplace/MemberInplaceRenamer.java
index bd3c52aac910..5e5907c83a07 100644
--- a/platform/lang-impl/src/com/intellij/refactoring/rename/inplace/MemberInplaceRenamer.java
+++ b/platform/lang-impl/src/com/intellij/refactoring/rename/inplace/MemberInplaceRenamer.java
@@ -177,6 +177,11 @@ public class MemberInplaceRenamer extends VariableInplaceRenamer {
return false;
}
+ @Override
+ protected String getRefactoringId() {
+ return null;
+ }
+
private void appendAdditionalElement(Collection<Pair<PsiElement, TextRange>> stringUsages,
PsiNamedElement variable,
PsiElement element) {
diff --git a/platform/lang-impl/src/com/intellij/refactoring/rename/inplace/VariableInplaceRenamer.java b/platform/lang-impl/src/com/intellij/refactoring/rename/inplace/VariableInplaceRenamer.java
index 376561535a1e..6fa0ed27d8c8 100644
--- a/platform/lang-impl/src/com/intellij/refactoring/rename/inplace/VariableInplaceRenamer.java
+++ b/platform/lang-impl/src/com/intellij/refactoring/rename/inplace/VariableInplaceRenamer.java
@@ -38,6 +38,8 @@ import com.intellij.psi.util.PsiUtilCore;
import com.intellij.refactoring.RefactoringActionHandler;
import com.intellij.refactoring.RefactoringBundle;
import com.intellij.refactoring.listeners.RefactoringElementListener;
+import com.intellij.refactoring.listeners.RefactoringEventData;
+import com.intellij.refactoring.listeners.RefactoringEventListener;
import com.intellij.refactoring.rename.*;
import com.intellij.refactoring.rename.naming.AutomaticRenamer;
import com.intellij.refactoring.rename.naming.AutomaticRenamerFactory;
@@ -137,6 +139,10 @@ public class VariableInplaceRenamer extends InplaceRefactoring {
protected boolean shouldCreateSnapshot() {
return true;
}
+
+ protected String getRefactoringId() {
+ return "refactoring.rename";
+ }
@Override
protected void beforeTemplateStart() {
@@ -204,11 +210,18 @@ public class VariableInplaceRenamer extends InplaceRefactoring {
protected void performRefactoringRename(final String newName,
final StartMarkAction markAction) {
+ final String refactoringId = getRefactoringId();
try {
+ PsiNamedElement elementToRename = getVariable();
+ if (refactoringId != null) {
+ final RefactoringEventData beforeData = new RefactoringEventData();
+ beforeData.addElement(elementToRename);
+ myProject.getMessageBus()
+ .syncPublisher(RefactoringEventListener.REFACTORING_EVENT_TOPIC).refactoringStarted(refactoringId, beforeData);
+ }
if (!isIdentifier(newName, myLanguage)) {
return;
}
- PsiNamedElement elementToRename = getVariable();
if (elementToRename != null) {
new WriteCommandAction(myProject, getCommandName()) {
@Override
@@ -278,6 +291,14 @@ public class VariableInplaceRenamer extends InplaceRefactoring {
}
}
finally {
+
+ if (refactoringId != null) {
+ final RefactoringEventData afterData = new RefactoringEventData();
+ afterData.addElement(getVariable());
+ myProject.getMessageBus()
+ .syncPublisher(RefactoringEventListener.REFACTORING_EVENT_TOPIC).refactoringDone(refactoringId, afterData);
+ }
+
try {
((EditorImpl)InjectedLanguageUtil.getTopLevelEditor(myEditor)).stopDumbLater();
}
diff --git a/platform/lang-impl/src/com/intellij/unscramble/AnalyzeStacktraceOnErrorAction.java b/platform/lang-impl/src/com/intellij/unscramble/AnalyzeStacktraceOnErrorAction.java
index e1de663c9418..d3385e88b4b1 100644
--- a/platform/lang-impl/src/com/intellij/unscramble/AnalyzeStacktraceOnErrorAction.java
+++ b/platform/lang-impl/src/com/intellij/unscramble/AnalyzeStacktraceOnErrorAction.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,26 +19,28 @@ package com.intellij.unscramble;
import com.intellij.diagnostic.IdeErrorsDialog;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
-import com.intellij.openapi.actionSystem.CommonDataKeys;
-import com.intellij.openapi.actionSystem.DataContext;
-import com.intellij.openapi.actionSystem.PlatformDataKeys;
import com.intellij.openapi.project.Project;
/**
* @author spleaner
*/
public class AnalyzeStacktraceOnErrorAction extends AnAction {
+ @Override
+ public void update(AnActionEvent e) {
+ Project project = e.getProject();
+ String message = getMessage(e);
+ e.getPresentation().setEnabledAndVisible(project != null && message != null);
+ }
@Override
public void actionPerformed(AnActionEvent e) {
- final DataContext dataContext = e.getDataContext();
-
- final Project project = CommonDataKeys.PROJECT.getData(dataContext);
- if (project == null) return;
+ Project project = e.getProject();
+ String message = getMessage(e);
+ if (project == null || message == null) return;
+ AnalyzeStacktraceUtil.addConsole(project, null, "<Stacktrace>", message);
+ }
- final String message = IdeErrorsDialog.CURRENT_TRACE_KEY.getData(dataContext);
- if (message != null) {
- AnalyzeStacktraceUtil.addConsole(project, null, "<Stacktrace>", message);
- }
+ private static String getMessage(AnActionEvent e) {
+ return IdeErrorsDialog.CURRENT_TRACE_KEY.getData(e.getDataContext());
}
} \ No newline at end of file
diff --git a/platform/lang-impl/src/com/intellij/util/indexing/ContentHashesSupport.java b/platform/lang-impl/src/com/intellij/util/indexing/ContentHashesSupport.java
index d20d01dc4e03..34f80dae5cc9 100644
--- a/platform/lang-impl/src/com/intellij/util/indexing/ContentHashesSupport.java
+++ b/platform/lang-impl/src/com/intellij/util/indexing/ContentHashesSupport.java
@@ -21,6 +21,7 @@ import com.intellij.openapi.vfs.newvfs.persistent.ContentHashesUtil;
import com.intellij.openapi.vfs.newvfs.persistent.FlushingDaemon;
import com.intellij.util.io.IOUtil;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
import java.io.File;
import java.io.IOException;
@@ -63,19 +64,19 @@ class ContentHashesSupport {
}
static void flushContentHashes() {
- if (ourHashesWithFileType.isDirty()) ourHashesWithFileType.force();
+ if (ourHashesWithFileType != null && ourHashesWithFileType.isDirty()) ourHashesWithFileType.force();
}
- static int calcContentHashIdWithFileType(@NotNull byte[] bytes, @NotNull FileType fileType) throws IOException {
- return enumerateHash(calcContentHashWithFileType(bytes, fileType));
+ static int calcContentHashIdWithFileType(@NotNull byte[] bytes, @Nullable Charset charset, @NotNull FileType fileType) throws IOException {
+ return enumerateHash(calcContentHashWithFileType(bytes, charset, fileType));
}
static int enumerateHash(@NotNull byte[] digest) throws IOException {
return ourHashesWithFileType.enumerate(digest);
}
- static byte[] calcContentHashWithFileType(@NotNull byte[] bytes, @NotNull FileType fileType) throws IOException {
+ static byte[] calcContentHashWithFileType(@NotNull byte[] bytes, @Nullable Charset charset, @NotNull FileType fileType) throws IOException {
MessageDigest messageDigest = ContentHashesUtil.HASHER_CACHE.getValue();
Charset defaultCharset = Charset.defaultCharset();
@@ -83,6 +84,8 @@ class ContentHashesSupport {
messageDigest.update((byte)0);
messageDigest.update(String.valueOf(bytes.length).getBytes(defaultCharset));
messageDigest.update((byte)0);
+ messageDigest.update((charset != null ? charset.displayName():"null_charset").getBytes(defaultCharset));
+ messageDigest.update((byte)0);
messageDigest.update(bytes, 0, bytes.length);
return messageDigest.digest();
diff --git a/platform/lang-impl/src/com/intellij/util/indexing/DebugAssertions.java b/platform/lang-impl/src/com/intellij/util/indexing/DebugAssertions.java
index 0b7650aace4f..6c866ad2283f 100644
--- a/platform/lang-impl/src/com/intellij/util/indexing/DebugAssertions.java
+++ b/platform/lang-impl/src/com/intellij/util/indexing/DebugAssertions.java
@@ -19,6 +19,8 @@ import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.util.SystemProperties;
+import java.util.Formatter;
+
public class DebugAssertions {
private static final Logger LOG = Logger.getInstance(DebugAssertions.class);
@@ -29,7 +31,7 @@ public class DebugAssertions {
public static final boolean EXTRA_SANITY_CHECKS = SystemProperties.getBooleanProperty(
"intellij.idea.indices.debug.extra.sanity",
- DEBUG && ApplicationManager.getApplication().isInternal()
+ true
);
public static void assertTrue(boolean value) {
@@ -37,4 +39,14 @@ public class DebugAssertions {
LOG.assertTrue(false);
}
}
+
+ public static void assertTrue(boolean value, String message, Object ... args) {
+ if (!value) {
+ error(message, args);
+ }
+ }
+
+ public static void error(String message, Object ... args) {
+ LOG.error(new Formatter().format(message, args));
+ }
}
diff --git a/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndexImpl.java b/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndexImpl.java
index c81f7c485876..5242ee3b70cf 100644
--- a/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndexImpl.java
+++ b/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndexImpl.java
@@ -380,9 +380,9 @@ public class FileBasedIndexImpl extends FileBasedIndex {
LOG.info("Version has changed for index " + name + ". The index will be rebuilt.");
}
if (extension.hasSnapshotMapping() && (isCurrentVersionCorrupted || versionChanged)) {
- safeDelete(IndexInfrastructure.getPersistentIndexRootDir(name));
+ FileUtil.delete(IndexInfrastructure.getPersistentIndexRootDir(name));
}
- safeDelete(IndexInfrastructure.getIndexRootDir(name));
+ FileUtil.delete(IndexInfrastructure.getIndexRootDir(name));
IndexingStamp.rewriteVersion(versionFile, version);
}
@@ -458,22 +458,16 @@ public class FileBasedIndexImpl extends FileBasedIndex {
catch (Exception ignored) {
}
- safeDelete(IndexInfrastructure.getIndexRootDir(name));
+ FileUtil.delete(IndexInfrastructure.getIndexRootDir(name));
if (extension.hasSnapshotMapping() && (!contentHashesEnumeratorOk || instantiatedStorage)) {
- safeDelete(IndexInfrastructure.getPersistentIndexRootDir(name)); // todo there is possibility of corruption of storage and content hashes
+ FileUtil.delete(IndexInfrastructure.getPersistentIndexRootDir(name));
}
IndexingStamp.rewriteVersion(versionFile, version);
}
}
}
- private static boolean safeDelete(File dir) {
- File directory = FileUtil.findSequentNonexistentFile(dir.getParentFile(), dir.getName(), "");
- boolean success = dir.renameTo(directory);
- return FileUtil.delete(success ? directory:dir);
- }
-
private static void saveRegisteredIndices(@NotNull Collection<ID<?, ?>> ids) {
final File file = getRegisteredIndicesFile();
try {
@@ -1206,6 +1200,7 @@ public class FileBasedIndexImpl extends FileBasedIndex {
@Nullable
public static Throwable getCauseToRebuildIndex(@NotNull RuntimeException e) {
+ if (e instanceof IndexOutOfBoundsException) return e; // something wrong with direct byte buffer
Throwable cause = e.getCause();
if (cause instanceof StorageException || cause instanceof IOException ||
cause instanceof IllegalArgumentException) return cause;
@@ -1568,7 +1563,7 @@ public class FileBasedIndexImpl extends FileBasedIndex {
indicesToDrop.remove(key.toString());
}
for (String s : indicesToDrop) {
- safeDelete(IndexInfrastructure.getIndexRootDir(ID.create(s)));
+ FileUtil.delete(IndexInfrastructure.getIndexRootDir(ID.create(s)));
}
}
@@ -1664,21 +1659,26 @@ public class FileBasedIndexImpl extends FileBasedIndex {
}
byte[] currentBytes;
- byte[] hash;
try {
currentBytes = content.getBytes();
- if (fileType.isBinary() || !IdIndex.ourSnapshotMappingsEnabled) {
- hash = null;
- } else {
- hash = ContentHashesSupport
- .calcContentHashWithFileType(currentBytes, SubstitutedFileType.substituteFileType(file, fileType, project));
- }
}
catch (IOException e) {
currentBytes = ArrayUtil.EMPTY_BYTE_ARRAY;
- hash = null;
}
- fc = new FileContentImpl(file, currentBytes, hash);
+ fc = new FileContentImpl(file, currentBytes);
+
+ if (!fileType.isBinary() && IdIndex.ourSnapshotMappingsEnabled) {
+ try {
+ byte[] hash = ContentHashesSupport.calcContentHashWithFileType(
+ currentBytes,
+ fc.getCharset(),
+ SubstitutedFileType.substituteFileType(file, fileType, project)
+ );
+ fc.setHash(hash);
+ } catch (IOException e) {
+ LOG.error(e);
+ }
+ }
psiFile = content.getUserData(IndexingDataKeys.PSI_FILE);
initFileContent(fc, project, psiFile);
@@ -1909,21 +1909,26 @@ public class FileBasedIndexImpl extends FileBasedIndex {
@Override
public void beforePropertyChange(@NotNull final VirtualFilePropertyEvent event) {
- if (event.getPropertyName().equals(VirtualFile.PROP_NAME)) {
- // indexes may depend on file name
- final VirtualFile file = event.getFile();
+ String propertyName = event.getPropertyName();
+ if (propertyName.equals(VirtualFile.PROP_NAME)) {
+ // indexes may depend on file name
// name change may lead to filetype change so the file might become not indexable
// in general case have to 'unindex' the file and index it again if needed after the name has been changed
- invalidateIndices(file, false);
+ invalidateIndices(event.getFile(), false);
+ } else if (propertyName.equals(VirtualFile.PROP_ENCODING)) {
+ invalidateIndices(event.getFile(), true);
}
}
@Override
public void propertyChanged(@NotNull final VirtualFilePropertyEvent event) {
- if (event.getPropertyName().equals(VirtualFile.PROP_NAME)) {
+ String propertyName = event.getPropertyName();
+ if (propertyName.equals(VirtualFile.PROP_NAME)) {
// indexes may depend on file name
markDirty(event, false);
+ } else if (propertyName.equals(VirtualFile.PROP_ENCODING)) {
+ markDirty(event, true);
}
}
diff --git a/platform/lang-impl/src/com/intellij/util/indexing/IndexingStamp.java b/platform/lang-impl/src/com/intellij/util/indexing/IndexingStamp.java
index 7bea700016c8..6bdd55b1d343 100644
--- a/platform/lang-impl/src/com/intellij/util/indexing/IndexingStamp.java
+++ b/platform/lang-impl/src/com/intellij/util/indexing/IndexingStamp.java
@@ -59,7 +59,7 @@ public class IndexingStamp {
private static final long UNINDEXED_STAMP = -1L; // we don't store trivial "absent" state
private static final long INDEX_DATA_OUTDATED_STAMP = -2L;
- private static final int VERSION = 11;
+ private static final int VERSION = 12;
private static final ConcurrentHashMap<ID<?, ?>, Long> ourIndexIdToCreationStamp = new ConcurrentHashMap<ID<?, ?>, Long>();
private static volatile long ourLastStamp; // ensure any file index stamp increases
diff --git a/platform/lang-impl/src/com/intellij/util/indexing/MapReduceIndex.java b/platform/lang-impl/src/com/intellij/util/indexing/MapReduceIndex.java
index 3ad505baf207..ebb7911e82be 100644
--- a/platform/lang-impl/src/com/intellij/util/indexing/MapReduceIndex.java
+++ b/platform/lang-impl/src/com/intellij/util/indexing/MapReduceIndex.java
@@ -22,18 +22,16 @@ import com.intellij.openapi.util.*;
import com.intellij.openapi.util.io.BufferExposingByteArrayOutputStream;
import com.intellij.openapi.util.io.ByteSequence;
import com.intellij.psi.search.GlobalSearchScope;
-import com.intellij.util.Processor;
-import com.intellij.util.SmartList;
-import com.intellij.util.SystemProperties;
+import com.intellij.util.*;
import com.intellij.util.io.*;
+import com.intellij.util.io.DataOutputStream;
import gnu.trove.THashMap;
import gnu.trove.TObjectObjectProcedure;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
-import java.io.DataInputStream;
-import java.io.File;
-import java.io.IOException;
+import java.io.*;
+import java.nio.charset.Charset;
import java.util.*;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
@@ -56,6 +54,7 @@ public class MapReduceIndex<Key, Value, Input> implements UpdatableIndex<Key,Val
private PersistentHashMap<Integer, Collection<Key>> myInputsIndex;
private PersistentHashMap<Integer, ByteSequence> myContents;
private PersistentHashMap<Integer, Integer> myInputsSnapshotMapping;
+ private PersistentHashMap<Integer, String> myIndexingTrace;
private final ReentrantReadWriteLock myLock = new ReentrantReadWriteLock();
@@ -127,6 +126,10 @@ public class MapReduceIndex<Key, Value, Input> implements UpdatableIndex<Key,Val
cleanMapping(myInputsSnapshotMapping);
myInputsSnapshotMapping = createInputSnapshotMapping();
}
+ if (myIndexingTrace != null) {
+ cleanMapping(myIndexingTrace);
+ myIndexingTrace = createIndexingTrace();
+ }
if (myContents != null) {
cleanMapping(myContents);
myContents = createContentsIndex();
@@ -161,6 +164,31 @@ public class MapReduceIndex<Key, Value, Input> implements UpdatableIndex<Key,Val
}
}
+ private PersistentHashMap<Integer, String> createIndexingTrace() throws IOException {
+ assert myIndexId != null;
+ final File mapFile = new File(IndexInfrastructure.getIndexRootDir(myIndexId), "indextrace");
+ try {
+ return new PersistentHashMap<Integer, String>(mapFile, EnumeratorIntegerDescriptor.INSTANCE,
+ new DataExternalizer<String>() {
+ @Override
+ public void save(@NotNull DataOutput out, String value) throws IOException {
+ out.write((byte[])CompressionUtil.compressCharSequence(value, Charset.defaultCharset()));
+ }
+
+ @Override
+ public String read(@NotNull DataInput in) throws IOException {
+ byte[] b = new byte[((InputStream)in).available()];
+ in.readFully(b);
+ return (String)CompressionUtil.uncompressCharSequence(b, Charset.defaultCharset());
+ }
+ }, 4096);
+ }
+ catch (IOException ex) {
+ IOUtil.deleteAllFilesStartingWith(mapFile);
+ throw ex;
+ }
+ }
+
private static void cleanMapping(@NotNull PersistentHashMap<?, ?> index) {
final File baseFile = index.getBaseFile();
try {
@@ -178,6 +206,7 @@ public class MapReduceIndex<Key, Value, Input> implements UpdatableIndex<Key,Val
getReadLock().lock();
doForce(myInputsIndex);
doForce(myInputsSnapshotMapping);
+ doForce(myIndexingTrace);
doForce(myContents);
myStorage.flush();
}
@@ -216,6 +245,7 @@ public class MapReduceIndex<Key, Value, Input> implements UpdatableIndex<Key,Val
finally {
doClose(myInputsIndex);
doClose(myInputsSnapshotMapping);
+ doClose(myIndexingTrace);
doClose(myContents);
}
}
@@ -283,6 +313,9 @@ public class MapReduceIndex<Key, Value, Input> implements UpdatableIndex<Key,Val
myInputsSnapshotMapping = createInputSnapshotMapping();
}
myInputsIndex = createInputsIndex();
+ if (DebugAssertions.EXTRA_SANITY_CHECKS && myIndexId != null) {
+ myIndexingTrace = createIndexingTrace();
+ }
}
@Nullable
@@ -318,7 +351,8 @@ public class MapReduceIndex<Key, Value, Input> implements UpdatableIndex<Key,Val
if (myContents != null && weProcessPhysicalContent && content != null) {
try {
- hashId = getHashOfContent((FileContent)content);
+ FileContent fileContent = (FileContent)content;
+ hashId = getHashOfContent(fileContent);
if (doReadSavedPersistentData) {
if (!myContents.isBusyReading()) { // avoid blocking read, we can calculate index value
ByteSequence bytes = myContents.get(hashId);
@@ -326,7 +360,19 @@ public class MapReduceIndex<Key, Value, Input> implements UpdatableIndex<Key,Val
data = deserializeSavedPersistentData(bytes);
havePersistentData = true;
if (DebugAssertions.EXTRA_SANITY_CHECKS) {
- DebugAssertions.assertTrue(myIndexer.map(content).equals(data));
+ Map<Key, Value> contentData = myIndexer.map(content);
+ boolean sameValueForSavedIndexedResultAndCurrentOne = contentData.equals(data);
+ if (!sameValueForSavedIndexedResultAndCurrentOne) {
+ DebugAssertions.error(
+ "Unexpected difference in indexing of %s by index %s, file type %s, charset %s\ndiff %s\nprevious indexed info %s",
+ fileContent.getFile(),
+ myIndexId,
+ fileContent.getFileType(),
+ ((FileContentImpl)fileContent).getCharset(),
+ buildDiff(data, contentData),
+ myIndexingTrace.get(hashId)
+ );
+ }
}
}
} else {
@@ -344,16 +390,27 @@ public class MapReduceIndex<Key, Value, Input> implements UpdatableIndex<Key,Val
if (data == null) data = content != null ? myIndexer.map(content) : Collections.<Key, Value>emptyMap();
if (hashId != null && !havePersistentData) {
- savePersistentData(data, hashId, skippedReadingPersistentDataButMayHaveIt);
+ boolean saved = savePersistentData(data, hashId, skippedReadingPersistentDataButMayHaveIt);
+ if (DebugAssertions.EXTRA_SANITY_CHECKS) {
+ if (saved) {
+
+ FileContent fileContent = (FileContent)content;
+ try {
+ myIndexingTrace.put(hashId, ((FileContentImpl)fileContent).getCharset() + "," + fileContent.getFileType()+"," + fileContent.getFile().getPath() + "," +
+ ExceptionUtil.getThrowableText(new Throwable()));
+ } catch (IOException ex) {
+ LOG.error(ex);
+ }
+ }
+ }
}
ProgressManager.checkCanceled();
final NotNullComputable<Collection<Key>> oldKeysGetter;
final int savedInputId;
- if (myHasSnapshotMapping && weProcessPhysicalContent) {
+ if (myHasSnapshotMapping) {
try {
-
- oldKeysGetter = new NotNullComputable<Collection<Key>>() {
+ final NotNullComputable<Collection<Key>> keysForGivenInputId = new NotNullComputable<Collection<Key>>() {
@NotNull
@Override
public Collection<Key> compute() {
@@ -369,15 +426,38 @@ public class MapReduceIndex<Key, Value, Input> implements UpdatableIndex<Key,Val
}
return currentKeys;
- } catch (IOException e) {
+ }
+ catch (IOException e) {
throw new RuntimeException(e);
}
}
};
- if (content instanceof FileContent) {
- savedInputId = getHashOfContent((FileContent)content);
+ if (weProcessPhysicalContent) {
+ if (content instanceof FileContent) {
+ savedInputId = getHashOfContent((FileContent)content);
+ }
+ else {
+ savedInputId = NULL_MAPPING;
+ }
+ oldKeysGetter = keysForGivenInputId;
} else {
+ oldKeysGetter = new NotNullComputable<Collection<Key>>() {
+ @NotNull
+ @Override
+ public Collection<Key> compute() {
+ try {
+ Collection<Key> oldKeys = myInputsIndex.get(inputId);
+ if (oldKeys == null) {
+ return keysForGivenInputId.compute();
+ }
+ return oldKeys;
+ }
+ catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ };
savedInputId = NULL_MAPPING;
}
} catch (IOException ex) {
@@ -429,6 +509,41 @@ public class MapReduceIndex<Key, Value, Input> implements UpdatableIndex<Key,Val
};
}
+ private StringBuilder buildDiff(Map<Key, Value> data, Map<Key, Value> contentData) {
+ StringBuilder moreInfo = new StringBuilder();
+ if (contentData.size() != data.size()) {
+ moreInfo.append("Indexer has different number of elements, previously ").append(data.size()).append(" after ")
+ .append(contentData.size()).append("\n");
+ } else {
+ moreInfo.append("total ").append(contentData.size()).append(" entries\n");
+ }
+
+ for(Map.Entry<Key, Value> keyValueEntry:contentData.entrySet()) {
+ if (!data.containsKey(keyValueEntry.getKey())) {
+ moreInfo.append("Previous data doesn't contain:").append(keyValueEntry.getKey()).append( " with value ").append(keyValueEntry.getValue()).append("\n");
+ }
+ else {
+ Value value = data.get(keyValueEntry.getKey());
+ if (!Comparing.equal(keyValueEntry.getValue(), value)) {
+ moreInfo.append("Previous data has different value for key:").append(keyValueEntry.getKey()).append( ", new value ").append(keyValueEntry.getValue()).append( ", oldValue:").append(value).append("\n");
+ }
+ }
+ }
+
+ for(Map.Entry<Key, Value> keyValueEntry:data.entrySet()) {
+ if (!contentData.containsKey(keyValueEntry.getKey())) {
+ moreInfo.append("New data doesn't contain:").append(keyValueEntry.getKey()).append( " with value ").append(keyValueEntry.getValue()).append("\n");
+ }
+ else {
+ Value value = contentData.get(keyValueEntry.getKey());
+ if (!Comparing.equal(keyValueEntry.getValue(), value)) {
+ moreInfo.append("New data has different value for key:").append(keyValueEntry.getKey()).append( " new value ").append(value).append( ", oldValue:").append(keyValueEntry.getValue()).append("\n");
+ }
+ }
+ }
+ return moreInfo;
+ }
+
private Map<Key, Value> deserializeSavedPersistentData(ByteSequence bytes) throws IOException {
DataInputStream stream = new DataInputStream(new UnsyncByteArrayInputStream(bytes.getBytes(), bytes.getOffset(), bytes.getLength()));
int pairs = DataInputOutputUtil.readINT(stream);
@@ -447,8 +562,9 @@ public class MapReduceIndex<Key, Value, Input> implements UpdatableIndex<Key,Val
if (previouslyCalculatedContentHashId == null) {
byte[] hash = content instanceof FileContentImpl ? ((FileContentImpl)content).getHash():null;
if (hash == null) {
+ Charset charset = content instanceof FileContentImpl ? ((FileContentImpl)content).getCharset() : null;
previouslyCalculatedContentHashId = ContentHashesSupport
- .calcContentHashIdWithFileType(content.getContent(), content.getFileType());
+ .calcContentHashIdWithFileType(content.getContent(), charset, content.getFileType());
} else {
previouslyCalculatedContentHashId = ContentHashesSupport.enumerateHash(hash);
}
@@ -459,9 +575,9 @@ public class MapReduceIndex<Key, Value, Input> implements UpdatableIndex<Key,Val
private static final ThreadLocalCachedByteArray ourSpareByteArray = new ThreadLocalCachedByteArray();
- private void savePersistentData(Map<Key, Value> data, int id, boolean delayedReading) {
+ private boolean savePersistentData(Map<Key, Value> data, int id, boolean delayedReading) {
try {
- if (delayedReading && myContents.containsMapping(id)) return;
+ if (delayedReading && myContents.containsMapping(id)) return false;
BufferExposingByteArrayOutputStream out = new BufferExposingByteArrayOutputStream(ourSpareByteArray.getBuffer(4 * data.size()));
DataOutputStream stream = new DataOutputStream(out);
int size = data.size();
@@ -496,6 +612,7 @@ public class MapReduceIndex<Key, Value, Input> implements UpdatableIndex<Key,Val
} catch (IOException ex) {
throw new RuntimeException(ex);
}
+ return true;
}
private static final com.intellij.openapi.util.Key<Integer> ourSavedContentHashIdKey = com.intellij.openapi.util.Key.create("saved.content.hash.id");
diff --git a/platform/lang-impl/src/com/intellij/util/indexing/containers/ChangeBufferingList.java b/platform/lang-impl/src/com/intellij/util/indexing/containers/ChangeBufferingList.java
index 77c5b50581ea..103f7d5fb587 100644
--- a/platform/lang-impl/src/com/intellij/util/indexing/containers/ChangeBufferingList.java
+++ b/platform/lang-impl/src/com/intellij/util/indexing/containers/ChangeBufferingList.java
@@ -255,8 +255,9 @@ public class ChangeBufferingList implements Cloneable {
if (intContainer == null && removals == 0) {
ValueContainer.IntIterator iterator = new ChangesIterator(changes, length);
if (DEBUG) {
- iterator = SortedFileIdSetIterator.getTransientIterator(iterator);
- DebugAssertions.assertTrue(iterator.size() == length);
+ ValueContainer.IntIterator iteratorSurelyWithoutDupes = SortedFileIdSetIterator.getTransientIterator(iterator);
+ DebugAssertions.assertTrue(iteratorSurelyWithoutDupes.size() == length);
+ iterator = iterator.createCopyInInitialState();
}
return iterator;
}
diff --git a/platform/lvcs-impl/src/com/intellij/history/integration/IdeaGateway.java b/platform/lvcs-impl/src/com/intellij/history/integration/IdeaGateway.java
index 1a916917d038..30822c0aec79 100644
--- a/platform/lvcs-impl/src/com/intellij/history/integration/IdeaGateway.java
+++ b/platform/lvcs-impl/src/com/intellij/history/integration/IdeaGateway.java
@@ -73,7 +73,7 @@ public class IdeaGateway {
if (Comparing.equal(each.getWorkspaceFile(), f)) return false;
ProjectFileIndex index = ProjectRootManager.getInstance(each).getFileIndex();
- if (index.isIgnored(f)) return false;
+ if (index.isExcluded(f)) return false;
isInContent |= index.isInContent(f);
}
if (shouldBeInContent && !isInContent) return false;
diff --git a/platform/platform-api/src/com/intellij/codeInsight/editorActions/TextBlockTransferable.java b/platform/platform-api/src/com/intellij/codeInsight/editorActions/TextBlockTransferable.java
new file mode 100644
index 000000000000..7d972816769c
--- /dev/null
+++ b/platform/platform-api/src/com/intellij/codeInsight/editorActions/TextBlockTransferable.java
@@ -0,0 +1,127 @@
+/*
+ * Copyright 2000-2014 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.editorActions;
+
+import com.intellij.openapi.editor.RawText;
+import com.intellij.openapi.util.Comparing;
+import com.intellij.openapi.util.text.StringUtil;
+
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.Transferable;
+import java.awt.datatransfer.UnsupportedFlavorException;
+import java.io.IOException;
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+public class TextBlockTransferable implements Transferable {
+ private final Collection<TextBlockTransferableData> myExtraData;
+ private final RawText myRawText;
+ private final String myText;
+ private final DataFlavor[] myTransferDataFlavors;
+
+ public TextBlockTransferable(String text, Collection<TextBlockTransferableData> extraData, RawText rawText) {
+ myText = text;
+ myExtraData = extraData;
+ myRawText = rawText;
+
+ List<DataFlavor> dataFlavors = new ArrayList<DataFlavor>();
+ Collections.addAll(dataFlavors, DataFlavor.stringFlavor, DataFlavor.plainTextFlavor);
+ final DataFlavor flavor = RawText.getDataFlavor();
+ if (myRawText != null && flavor != null) {
+ dataFlavors.add(flavor);
+ }
+ for(TextBlockTransferableData data: extraData) {
+ final DataFlavor blockFlavor = data.getFlavor();
+ if (blockFlavor != null) {
+ dataFlavors.add(blockFlavor);
+ }
+ }
+ myTransferDataFlavors = dataFlavors.toArray(new DataFlavor[dataFlavors.size()]);
+ }
+
+ @Override
+ public DataFlavor[] getTransferDataFlavors() {
+ return myTransferDataFlavors;
+ }
+
+ @Override
+ public boolean isDataFlavorSupported(DataFlavor flavor) {
+ DataFlavor[] flavors = getTransferDataFlavors();
+ for (DataFlavor flavor1 : flavors) {
+ if (flavor.equals(flavor1)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException {
+ try {
+ for(TextBlockTransferableData data: myExtraData) {
+ if (Comparing.equal(data.getFlavor(), flavor)) {
+ return data;
+ }
+ }
+ if (myRawText != null && Comparing.equal(RawText.getDataFlavor(), flavor)) {
+ return myRawText;
+ }
+ else if (DataFlavor.stringFlavor.equals(flavor)) {
+ return myText;
+ }
+ else if (DataFlavor.plainTextFlavor.equals(flavor)) {
+ return new StringReader(myText);
+ }
+ }
+ catch(NoClassDefFoundError e) {
+ // ignore
+ }
+ throw new UnsupportedFlavorException(flavor);
+ }
+
+ public static String convertLineSeparators(String text,
+ String newSeparator,
+ Collection<TextBlockTransferableData> transferableDatas) {
+ if (transferableDatas.size() > 0){
+ int size = 0;
+ for(TextBlockTransferableData data: transferableDatas) {
+ size += data.getOffsetCount();
+ }
+
+ int[] offsets = new int[size];
+ int index = 0;
+ for(TextBlockTransferableData data: transferableDatas) {
+ index = data.getOffsets(offsets, index);
+ }
+
+ text = StringUtil.convertLineSeparators(text, newSeparator, offsets);
+
+ index = 0;
+ for(TextBlockTransferableData data: transferableDatas) {
+ index = data.setOffsets(offsets, index);
+ }
+
+ return text;
+ }
+ else{
+ return StringUtil.convertLineSeparators(text, newSeparator);
+ }
+ }
+} \ No newline at end of file
diff --git a/platform/platform-api/src/com/intellij/codeInsight/editorActions/TextBlockTransferableData.java b/platform/platform-api/src/com/intellij/codeInsight/editorActions/TextBlockTransferableData.java
new file mode 100644
index 000000000000..bdaf6f2ea546
--- /dev/null
+++ b/platform/platform-api/src/com/intellij/codeInsight/editorActions/TextBlockTransferableData.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2000-2014 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.editorActions;
+
+import java.awt.datatransfer.DataFlavor;
+
+/**
+ * @author yole
+ */
+public interface TextBlockTransferableData {
+ DataFlavor getFlavor();
+
+ int getOffsetCount();
+ int getOffsets(final int[] offsets, final int index);
+ int setOffsets(final int[] offsets, final int index);
+}
diff --git a/platform/platform-api/src/com/intellij/codeStyle/CodeStyleFacade.java b/platform/platform-api/src/com/intellij/codeStyle/CodeStyleFacade.java
index 8b424cce0ca4..0bc7ed42febb 100644
--- a/platform/platform-api/src/com/intellij/codeStyle/CodeStyleFacade.java
+++ b/platform/platform-api/src/com/intellij/codeStyle/CodeStyleFacade.java
@@ -19,6 +19,7 @@
*/
package com.intellij.codeStyle;
+import com.intellij.lang.Language;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.fileTypes.FileType;
@@ -53,7 +54,7 @@ public abstract class CodeStyleFacade {
public abstract boolean isSmartTabs(final FileType fileType);
- public abstract int getRightMargin();
+ public abstract int getRightMargin(Language language);
public abstract boolean isWrapWhenTypingReachesRightMargin();
diff --git a/platform/platform-api/src/com/intellij/openapi/actionSystem/IdeActions.java b/platform/platform-api/src/com/intellij/openapi/actionSystem/IdeActions.java
index d4ac053e994e..1d4fea4c01de 100644
--- a/platform/platform-api/src/com/intellij/openapi/actionSystem/IdeActions.java
+++ b/platform/platform-api/src/com/intellij/openapi/actionSystem/IdeActions.java
@@ -50,6 +50,8 @@ public interface IdeActions {
@NonNls String ACTION_EDITOR_COMPLETE_STATEMENT = "EditorCompleteStatement";
@NonNls String ACTION_EDITOR_USE_SOFT_WRAPS = "EditorToggleUseSoftWraps";
@NonNls String ACTION_EDITOR_ADD_OR_REMOVE_CARET= "EditorAddOrRemoveCaret";
+ @NonNls String ACTION_EDITOR_CLONE_CARET_BELOW= "EditorCloneCaretBelow";
+ @NonNls String ACTION_EDITOR_CLONE_CARET_ABOVE= "EditorCloneCaretAbove";
@NonNls String ACTION_EDITOR_NEXT_TEMPLATE_VARIABLE = "NextTemplateVariable";
@NonNls String ACTION_EDITOR_PREVIOUS_TEMPLATE_VARIABLE = "PreviousTemplateVariable";
@@ -267,6 +269,7 @@ public interface IdeActions {
String ACTION_UNDO = "$Undo";
String ACTION_REDO = "$Redo";
String GROUP_REFACTOR = "RefactoringMenu";
+ String SELECTED_CHANGES_ROLLBACK = "RollbackLineStatusChanges";
String CHANGES_VIEW_ROLLBACK = "ChangesView.Rollback";
String CONSOLE_CLEAR_ALL = "ConsoleView.ClearAll";
diff --git a/platform/platform-api/src/com/intellij/openapi/actionSystem/ex/ComboBoxAction.java b/platform/platform-api/src/com/intellij/openapi/actionSystem/ex/ComboBoxAction.java
index e72428804ee4..92a1d9c8b42c 100644
--- a/platform/platform-api/src/com/intellij/openapi/actionSystem/ex/ComboBoxAction.java
+++ b/platform/platform-api/src/com/intellij/openapi/actionSystem/ex/ComboBoxAction.java
@@ -47,6 +47,7 @@ public abstract class ComboBoxAction extends AnAction implements CustomComponent
private static final Icon DISABLED_ARROW_ICON = IconLoader.getDisabledIcon(ARROW_ICON);
private boolean mySmallVariant = true;
+ private String myPopupTitle;
private DataContext myDataContext;
protected ComboBoxAction() {
@@ -77,6 +78,10 @@ public abstract class ComboBoxAction extends AnAction implements CustomComponent
mySmallVariant = smallVariant;
}
+ public void setPopupTitle(String popupTitle) {
+ myPopupTitle = popupTitle;
+ }
+
@Override
public void update(AnActionEvent e) {
super.update(e);
@@ -247,7 +252,7 @@ public abstract class ComboBoxAction extends AnAction implements CustomComponent
DataContext context = getDataContext();
myDataContext = null;
final ListPopup popup = JBPopupFactory.getInstance().createActionGroupPopup(
- null, group, context, JBPopupFactory.ActionSelectionAid.SPEEDSEARCH, false, onDispose, getMaxRows());
+ myPopupTitle, group, context, JBPopupFactory.ActionSelectionAid.SPEEDSEARCH, false, onDispose, getMaxRows());
popup.setMinimumSize(new Dimension(getMinWidth(), getMinHeight()));
return popup;
}
diff --git a/platform/platform-api/src/com/intellij/openapi/editor/CaretStateTransferableData.java b/platform/platform-api/src/com/intellij/openapi/editor/CaretStateTransferableData.java
new file mode 100644
index 000000000000..f0d2085cbb6b
--- /dev/null
+++ b/platform/platform-api/src/com/intellij/openapi/editor/CaretStateTransferableData.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2000-2014 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.openapi.editor;
+
+import com.intellij.codeInsight.editorActions.TextBlockTransferableData;
+
+import java.awt.datatransfer.DataFlavor;
+
+public class CaretStateTransferableData implements TextBlockTransferableData {
+ public static final DataFlavor FLAVOR = new DataFlavor(CaretStateTransferableData.class, "Caret state");
+
+ public final int[] startOffsets;
+ public final int[] endOffsets;
+
+ public CaretStateTransferableData(int[] startOffsets, int[] endOffsets) {
+ this.startOffsets = startOffsets;
+ this.endOffsets = endOffsets;
+ }
+
+ @Override
+ public DataFlavor getFlavor() {
+ return FLAVOR;
+ }
+
+ @Override
+ public int getOffsetCount() {
+ return startOffsets.length + endOffsets.length;
+ }
+
+ @Override
+ public int getOffsets(int[] offsets, int index) {
+ System.arraycopy(startOffsets, 0, offsets, index, startOffsets.length);
+ System.arraycopy(endOffsets, 0, offsets, index + startOffsets.length, endOffsets.length);
+ return index + getOffsetCount();
+ }
+
+ @Override
+ public int setOffsets(int[] offsets, int index) {
+ System.arraycopy(offsets, index, startOffsets, 0, startOffsets.length);
+ System.arraycopy(offsets, index + startOffsets.length, endOffsets, 0, endOffsets.length);
+ return index + getOffsetCount();
+ }
+}
diff --git a/platform/platform-api/src/com/intellij/openapi/editor/ClipboardTextPerCaretSplitter.java b/platform/platform-api/src/com/intellij/openapi/editor/ClipboardTextPerCaretSplitter.java
index afc58b818bce..a3e62412f4a4 100644
--- a/platform/platform-api/src/com/intellij/openapi/editor/ClipboardTextPerCaretSplitter.java
+++ b/platform/platform-api/src/com/intellij/openapi/editor/ClipboardTextPerCaretSplitter.java
@@ -15,12 +15,16 @@
*/
package com.intellij.openapi.editor;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class ClipboardTextPerCaretSplitter {
- public List<String> split(String input, int caretCount) {
+ @NotNull
+ public List<String> split(@NotNull String input, @Nullable CaretStateTransferableData caretData, int caretCount) {
if (caretCount <= 0) {
throw new IllegalArgumentException("Caret count must be positive");
}
@@ -28,9 +32,17 @@ public class ClipboardTextPerCaretSplitter {
return Collections.singletonList(input);
}
List<String> result = new ArrayList<String>(caretCount);
- String[] lines = input.split("\n", -1);
+ int sourceCaretCount = caretData == null ? -1 : caretData.startOffsets.length;
+ String[] lines = sourceCaretCount == 1 || sourceCaretCount == caretCount ? null : input.split("\n", -1);
for (int i = 0; i < caretCount; i++) {
- if (lines.length == 0) {
+ if (sourceCaretCount == 1) {
+ result.add(input);
+ }
+ else if (sourceCaretCount == caretCount) {
+ //noinspection ConstantConditions
+ result.add(new String(input.substring(caretData.startOffsets[i], caretData.endOffsets[i])));
+ }
+ else if (lines.length == 0) {
result.add("");
}
else if (lines.length == 1) {
diff --git a/platform/platform-api/src/com/intellij/openapi/editor/CopyPasteSupport.java b/platform/platform-api/src/com/intellij/openapi/editor/CopyPasteSupport.java
new file mode 100644
index 000000000000..7095080aa13d
--- /dev/null
+++ b/platform/platform-api/src/com/intellij/openapi/editor/CopyPasteSupport.java
@@ -0,0 +1,212 @@
+/*
+ * Copyright 2000-2014 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.openapi.editor;
+
+import com.intellij.codeInsight.editorActions.TextBlockTransferable;
+import com.intellij.codeInsight.editorActions.TextBlockTransferableData;
+import com.intellij.openapi.application.ApplicationManager;
+import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.openapi.ide.CopyPasteManager;
+import com.intellij.openapi.util.TextRange;
+import com.intellij.openapi.util.text.LineTokenizer;
+import com.intellij.util.Producer;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.StringSelection;
+import java.awt.datatransfer.Transferable;
+import java.awt.datatransfer.UnsupportedFlavorException;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
+public class CopyPasteSupport {
+ private static final Logger LOG = Logger.getInstance(CopyPasteSupport.class);
+
+ private CopyPasteSupport() { }
+
+ public static void copySelectionToClipboard(@NotNull Editor editor) {
+ ApplicationManager.getApplication().assertIsDispatchThread();
+ List<TextBlockTransferableData> extraData = new ArrayList<TextBlockTransferableData>();
+ String s = editor.getCaretModel().supportsMultipleCarets() ? getSelectedTextForClipboard(editor, extraData)
+ : editor.getSelectionModel().getSelectedText();
+ if (s == null) return;
+
+ s = TextBlockTransferable.convertLineSeparators(s, "\n", extraData);
+ Transferable contents = editor.getCaretModel().supportsMultipleCarets() ? new TextBlockTransferable(s, extraData, null) : new StringSelection(s);
+ CopyPasteManager.getInstance().setContents(contents);
+ }
+
+ public static String getSelectedTextForClipboard(@NotNull Editor editor, @NotNull Collection<TextBlockTransferableData> extraDataCollector) {
+ final StringBuilder buf = new StringBuilder();
+ String separator = "";
+ List<Caret> carets = editor.getCaretModel().getAllCarets();
+ int[] startOffsets = new int[carets.size()];
+ int[] endOffsets = new int[carets.size()];
+ for (int i = 0; i < carets.size(); i++) {
+ buf.append(separator);
+ String caretSelectedText = carets.get(i).getSelectedText();
+ startOffsets[i] = buf.length();
+ if (caretSelectedText != null) {
+ buf.append(caretSelectedText);
+ }
+ endOffsets[i] = buf.length();
+ separator = "\n";
+ }
+ extraDataCollector.add(new CaretStateTransferableData(startOffsets, endOffsets));
+ return buf.toString();
+ }
+
+
+ public static TextRange pasteFromClipboard(Editor editor) {
+ return pasteTransferable(editor, (Producer<Transferable>)null);
+ }
+
+ public static TextRange pasteTransferable(Editor editor, final Transferable content) {
+ return pasteTransferable(editor, new Producer<Transferable>() {
+ @Nullable
+ @Override
+ public Transferable produce() {
+ return content;
+ }
+ });
+ }
+
+ @Nullable
+ public static TextRange pasteTransferable(final Editor editor, @Nullable Producer<Transferable> producer) {
+ Transferable content = getTransferable(producer);
+ if (content == null) return null;
+ String text = getStringContent(content);
+ if (text == null) return null;
+
+ if (editor.getCaretModel().supportsMultipleCarets()) {
+ int caretCount = editor.getCaretModel().getCaretCount();
+ if (caretCount == 1 && editor.isColumnMode()) {
+ int pastedLineCount = LineTokenizer.calcLineCount(text, true);
+ EditorModificationUtil.deleteSelectedText(editor);
+ Caret caret = editor.getCaretModel().getPrimaryCaret();
+ for (int i = 0; i < pastedLineCount - 1; i++) {
+ caret = caret.clone(false);
+ if (caret == null) {
+ break;
+ }
+ }
+ caretCount = editor.getCaretModel().getCaretCount();
+ }
+ CaretStateTransferableData caretData = null;
+ try {
+ caretData = content.isDataFlavorSupported(CaretStateTransferableData.FLAVOR)
+ ? (CaretStateTransferableData)content.getTransferData(CaretStateTransferableData.FLAVOR) : null;
+ }
+ catch (Exception e) {
+ LOG.error(e);
+ }
+ final Iterator<String> segments = new ClipboardTextPerCaretSplitter().split(text, caretData, caretCount).iterator();
+ editor.getCaretModel().runForEachCaret(new CaretAction() {
+ @Override
+ public void perform(Caret caret) {
+ EditorModificationUtil.insertStringAtCaret(editor, segments.next(), false, true);
+ }
+ });
+ return null;
+ }
+ else {
+ int caretOffset = editor.getCaretModel().getOffset();
+ EditorModificationUtil.insertStringAtCaret(editor, text, false, true);
+ return new TextRange(caretOffset, caretOffset + text.length());
+ }
+ }
+
+ public static void pasteTransferableAsBlock(Editor editor, @Nullable Producer<Transferable> producer) {
+ Transferable content = getTransferable(producer);
+ if (content == null) return;
+ String text = getStringContent(content);
+ if (text == null) return;
+
+ int caretLine = editor.getCaretModel().getLogicalPosition().line;
+ int originalCaretLine = caretLine;
+ int selectedLinesCount = 0;
+
+ final SelectionModel selectionModel = editor.getSelectionModel();
+ if (selectionModel.hasBlockSelection()) {
+ final LogicalPosition start = selectionModel.getBlockStart();
+ final LogicalPosition end = selectionModel.getBlockEnd();
+ assert start != null;
+ assert end != null;
+ LogicalPosition caret = new LogicalPosition(Math.min(start.line, end.line), Math.min(start.column, end.column));
+ selectedLinesCount = Math.abs(end.line - start.line);
+ caretLine = caret.line;
+
+ EditorModificationUtil.deleteSelectedText(editor);
+ editor.getCaretModel().moveToLogicalPosition(caret);
+ }
+
+ LogicalPosition caretToRestore = editor.getCaretModel().getLogicalPosition();
+
+ String[] lines = LineTokenizer.tokenize(text.toCharArray(), false);
+ if (lines.length > 1 || selectedLinesCount == 0) {
+ int longestLineLength = 0;
+ for (int i = 0; i < lines.length; i++) {
+ String line = lines[i];
+ longestLineLength = Math.max(longestLineLength, line.length());
+ editor.getCaretModel().moveToLogicalPosition(new LogicalPosition(caretLine + i, caretToRestore.column));
+ EditorModificationUtil.insertStringAtCaret(editor, line, false, true);
+ }
+ caretToRestore = new LogicalPosition(originalCaretLine, caretToRestore.column + longestLineLength);
+ }
+ else {
+ for (int i = 0; i <= selectedLinesCount; i++) {
+ editor.getCaretModel().moveToLogicalPosition(new LogicalPosition(caretLine + i, caretToRestore.column));
+ EditorModificationUtil.insertStringAtCaret(editor, text, false, true);
+ }
+ caretToRestore = new LogicalPosition(originalCaretLine, caretToRestore.column + text.length());
+ }
+
+ editor.getCaretModel().moveToLogicalPosition(caretToRestore);
+ EditorModificationUtil.zeroWidthBlockSelectionAtCaretColumn(editor, caretLine, caretLine + selectedLinesCount);
+ }
+
+ @Nullable
+ private static String getStringContent(@NotNull Transferable content) {
+ RawText raw = RawText.fromTransferable(content);
+ if (raw != null) return raw.rawText;
+
+ try {
+ return (String)content.getTransferData(DataFlavor.stringFlavor);
+ }
+ catch (UnsupportedFlavorException ignore) { }
+ catch (IOException ignore) { }
+
+ return null;
+ }
+
+ private static Transferable getTransferable(Producer<Transferable> producer) {
+ Transferable content = null;
+ if (producer != null) {
+ content = producer.produce();
+ }
+ else {
+ CopyPasteManager manager = CopyPasteManager.getInstance();
+ if (manager.areDataFlavorsAvailable(DataFlavor.stringFlavor)) {
+ content = manager.getContents();
+ }
+ }
+ return content;
+ }
+}
diff --git a/platform/platform-api/src/com/intellij/openapi/editor/EditorModificationUtil.java b/platform/platform-api/src/com/intellij/openapi/editor/EditorModificationUtil.java
index 3fddbc344585..ee5527967440 100644
--- a/platform/platform-api/src/com/intellij/openapi/editor/EditorModificationUtil.java
+++ b/platform/platform-api/src/com/intellij/openapi/editor/EditorModificationUtil.java
@@ -19,20 +19,14 @@ import com.intellij.codeStyle.CodeStyleFacade;
import com.intellij.openapi.editor.actionSystem.EditorActionManager;
import com.intellij.openapi.editor.event.DocumentEvent;
import com.intellij.openapi.editor.event.MockDocumentEvent;
-import com.intellij.openapi.ide.CopyPasteManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.TextRange;
-import com.intellij.openapi.util.text.LineTokenizer;
import com.intellij.psi.PsiDocumentManager;
import com.intellij.util.Producer;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
-import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
-import java.awt.datatransfer.UnsupportedFlavorException;
-import java.io.IOException;
-import java.util.Iterator;
import java.util.List;
public class EditorModificationUtil {
@@ -99,7 +93,7 @@ public class EditorModificationUtil {
zeroWidthBlockSelectionAtCaretColumn(editor, startLine, endLine);
}
- private static void zeroWidthBlockSelectionAtCaretColumn(final Editor editor, final int startLine, final int endLine) {
+ public static void zeroWidthBlockSelectionAtCaretColumn(final Editor editor, final int startLine, final int endLine) {
int caretColumn = editor.getCaretModel().getLogicalPosition().column;
editor.getSelectionModel().setBlockSelection(new LogicalPosition(startLine, caretColumn), new LogicalPosition(endLine, caretColumn));
}
@@ -181,112 +175,21 @@ public class EditorModificationUtil {
return offset;
}
+ /**
+ * @deprecated Use {@link com.intellij.openapi.editor.CopyPasteSupport#pasteTransferable(Editor, com.intellij.util.Producer)} instead.
+ * (to remove in IDEA 15)
+ */
@Nullable
public static TextRange pasteTransferable(final Editor editor, @Nullable Producer<Transferable> producer) {
- String text = getStringContent(producer);
- if (text == null) return null;
-
- if (editor.getCaretModel().supportsMultipleCarets()) {
- int caretCount = editor.getCaretModel().getCaretCount();
- if (caretCount == 1 && editor.isColumnMode()) {
- int pastedLineCount = LineTokenizer.calcLineCount(text, true);
- deleteSelectedText(editor);
- Caret caret = editor.getCaretModel().getPrimaryCaret();
- for (int i = 0; i < pastedLineCount - 1; i++) {
- caret = caret.clone(false);
- if (caret == null) {
- break;
- }
- }
- caretCount = editor.getCaretModel().getCaretCount();
- }
- final Iterator<String> segments = new ClipboardTextPerCaretSplitter().split(text, caretCount).iterator();
- editor.getCaretModel().runForEachCaret(new CaretAction() {
- @Override
- public void perform(Caret caret) {
- insertStringAtCaret(editor, segments.next(), false, true);
- }
- });
- return null;
- }
- else {
- int caretOffset = editor.getCaretModel().getOffset();
- insertStringAtCaret(editor, text, false, true);
- return new TextRange(caretOffset, caretOffset + text.length());
- }
+ return CopyPasteSupport.pasteTransferable(editor, producer);
}
+ /**
+ * @deprecated Use {@link com.intellij.openapi.editor.CopyPasteSupport#pasteTransferableAsBlock(Editor, com.intellij.util.Producer)} instead.
+ * (to remove in IDEA 15)
+ */
public static void pasteTransferableAsBlock(Editor editor, @Nullable Producer<Transferable> producer) {
- String text = getStringContent(producer);
- if (text == null) return;
-
- int caretLine = editor.getCaretModel().getLogicalPosition().line;
- int originalCaretLine = caretLine;
- int selectedLinesCount = 0;
-
- final SelectionModel selectionModel = editor.getSelectionModel();
- if (selectionModel.hasBlockSelection()) {
- final LogicalPosition start = selectionModel.getBlockStart();
- final LogicalPosition end = selectionModel.getBlockEnd();
- assert start != null;
- assert end != null;
- LogicalPosition caret = new LogicalPosition(Math.min(start.line, end.line), Math.min(start.column, end.column));
- selectedLinesCount = Math.abs(end.line - start.line);
- caretLine = caret.line;
-
- deleteSelectedText(editor);
- editor.getCaretModel().moveToLogicalPosition(caret);
- }
-
- LogicalPosition caretToRestore = editor.getCaretModel().getLogicalPosition();
-
- String[] lines = LineTokenizer.tokenize(text.toCharArray(), false);
- if (lines.length > 1 || selectedLinesCount == 0) {
- int longestLineLength = 0;
- for (int i = 0; i < lines.length; i++) {
- String line = lines[i];
- longestLineLength = Math.max(longestLineLength, line.length());
- editor.getCaretModel().moveToLogicalPosition(new LogicalPosition(caretLine + i, caretToRestore.column));
- insertStringAtCaret(editor, line, false, true);
- }
- caretToRestore = new LogicalPosition(originalCaretLine, caretToRestore.column + longestLineLength);
- }
- else {
- for (int i = 0; i <= selectedLinesCount; i++) {
- editor.getCaretModel().moveToLogicalPosition(new LogicalPosition(caretLine + i, caretToRestore.column));
- insertStringAtCaret(editor, text, false, true);
- }
- caretToRestore = new LogicalPosition(originalCaretLine, caretToRestore.column + text.length());
- }
-
- editor.getCaretModel().moveToLogicalPosition(caretToRestore);
- zeroWidthBlockSelectionAtCaretColumn(editor, caretLine, caretLine + selectedLinesCount);
- }
-
- @Nullable
- private static String getStringContent(@Nullable Producer<Transferable> producer) {
- Transferable content = null;
- if (producer != null) {
- content = producer.produce();
- }
- else {
- CopyPasteManager manager = CopyPasteManager.getInstance();
- if (manager.areDataFlavorsAvailable(DataFlavor.stringFlavor)) {
- content = manager.getContents();
- }
- }
- if (content == null) return null;
-
- RawText raw = RawText.fromTransferable(content);
- if (raw != null) return raw.rawText;
-
- try {
- return (String)content.getTransferData(DataFlavor.stringFlavor);
- }
- catch (UnsupportedFlavorException ignore) { }
- catch (IOException ignore) { }
-
- return null;
+ CopyPasteSupport.pasteTransferableAsBlock(editor, producer);
}
/**
@@ -494,40 +397,4 @@ public class EditorModificationUtil {
CaretModel caretModel = editor.getCaretModel();
caretModel.moveToOffset(caretModel.getOffset() + caretShift);
}
-
- /** @deprecated use {@link #pasteTransferable(Editor, Producer)} (to remove in IDEA 14) */
- @SuppressWarnings("UnusedDeclaration")
- public static TextRange pasteFromClipboard(Editor editor) {
- return pasteTransferable(editor, null);
- }
-
- /** @deprecated use {@link #pasteTransferable(Editor, Producer)} (to remove in IDEA 14) */
- @SuppressWarnings("SpellCheckingInspection,UnusedDeclaration")
- public static TextRange pasteFromTransferrable(final Transferable content, Editor editor) {
- return pasteTransferable(editor, new Producer<Transferable>() {
- @Nullable
- @Override
- public Transferable produce() {
- return content;
- }
- });
- }
-
- @SuppressWarnings("UnusedDeclaration")
- /** @deprecated use {@link #pasteTransferableAsBlock(Editor, Producer)} (to remove in IDEA 14) */
- public static void pasteFromClipboardAsBlock(Editor editor) {
- pasteTransferableAsBlock(editor, (Producer<Transferable>)null);
- }
-
- @SuppressWarnings("UnusedDeclaration")
- /** @deprecated use {@link #pasteTransferableAsBlock(Editor, Producer)} (to remove in IDEA 14) */
- public static void pasteTransferableAsBlock(Editor editor, @Nullable final Transferable content) {
- pasteTransferableAsBlock(editor, new Producer<Transferable>() {
- @Nullable
- @Override
- public Transferable produce() {
- return content;
- }
- });
- }
}
diff --git a/platform/platform-api/src/com/intellij/openapi/editor/highlighter/FragmentedEditorHighlighter.java b/platform/platform-api/src/com/intellij/openapi/editor/highlighter/FragmentedEditorHighlighter.java
index 13b2c43faa7b..9cd9ab29f4cd 100644
--- a/platform/platform-api/src/com/intellij/openapi/editor/highlighter/FragmentedEditorHighlighter.java
+++ b/platform/platform-api/src/com/intellij/openapi/editor/highlighter/FragmentedEditorHighlighter.java
@@ -19,6 +19,7 @@ import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.colors.EditorColorsScheme;
import com.intellij.openapi.editor.event.DocumentEvent;
import com.intellij.openapi.editor.markup.TextAttributes;
+import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.TextRange;
import com.intellij.psi.tree.IElementType;
import org.jetbrains.annotations.NotNull;
@@ -74,8 +75,8 @@ public class FragmentedEditorHighlighter implements EditorHighlighter {
if (myMergeByTextAttributes && !myPieces.isEmpty()) {
Element element = myPieces.get(myPieces.size() - 1);
if (element.getEnd() >= offset + relativeStart &&
- element.getAttributes().equals(iterator.getTextAttributes()) &&
- element.getElementType().equals(iterator.getTokenType())) {
+ Comparing.equal(element.getAttributes(), iterator.getTextAttributes()) &&
+ Comparing.equal(element.getElementType(), iterator.getTokenType())) {
merged = true;
myPieces.add(new Element(element.getStart(),
offset + relativeEnd,
diff --git a/platform/platform-api/src/com/intellij/openapi/options/ConfigurableEP.java b/platform/platform-api/src/com/intellij/openapi/options/ConfigurableEP.java
index 07430ddbad8b..11c8bdd90052 100644
--- a/platform/platform-api/src/com/intellij/openapi/options/ConfigurableEP.java
+++ b/platform/platform-api/src/com/intellij/openapi/options/ConfigurableEP.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2011 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -90,6 +90,8 @@ public class ConfigurableEP<T extends UnnamedConfigurable> extends AbstractExten
@Attribute("id")
public String id;
+ @Attribute("groupId")
+ public String groupId;
/** Marks project level configurables that do not apply to the default project. */
@Attribute("nonDefaultProject")
diff --git a/platform/platform-api/src/com/intellij/openapi/options/SearchableConfigurable.java b/platform/platform-api/src/com/intellij/openapi/options/SearchableConfigurable.java
index 634144817fa7..e98bb05aba99 100644
--- a/platform/platform-api/src/com/intellij/openapi/options/SearchableConfigurable.java
+++ b/platform/platform-api/src/com/intellij/openapi/options/SearchableConfigurable.java
@@ -36,41 +36,49 @@ public interface SearchableConfigurable extends Configurable {
boolean hasOwnContent();
boolean isVisible();
-
abstract class Abstract implements Parent {
private Configurable[] myKids;
+ @Override
public JComponent createComponent() {
return null;
}
+ @Override
public boolean hasOwnContent() {
return false;
}
+ @Override
public boolean isModified() {
return false;
}
+ @Override
public void apply() throws ConfigurationException {
}
+ @Override
public void reset() {
}
+ @Override
public void disposeUIResources() {
myKids = null;
}
+ @Override
public Runnable enableSearch(final String option) {
return null;
}
+ @Override
public boolean isVisible() {
return true;
}
+ @Override
public final Configurable[] getConfigurables() {
if (myKids != null) return myKids;
myKids = buildConfigurables();
diff --git a/platform/platform-api/src/com/intellij/openapi/ui/ComboBoxTableRenderer.java b/platform/platform-api/src/com/intellij/openapi/ui/ComboBoxTableRenderer.java
index 9e6c0aa1b965..5d2ecafb1b7e 100644
--- a/platform/platform-api/src/com/intellij/openapi/ui/ComboBoxTableRenderer.java
+++ b/platform/platform-api/src/com/intellij/openapi/ui/ComboBoxTableRenderer.java
@@ -76,6 +76,10 @@ public class ComboBoxTableRenderer<T> extends JLabel implements TableCellRendere
return value.toString();
}
+ protected Icon getIconFor(@NotNull T value) {
+ return null;
+ }
+
protected Runnable onChosen(@NotNull final T value) {
stopCellEditing(value);
@@ -137,6 +141,11 @@ public class ComboBoxTableRenderer<T> extends JLabel implements TableCellRendere
return ComboBoxTableRenderer.this.getTextFor(value);
}
+ @Override
+ public Icon getIconFor(T value) {
+ return ComboBoxTableRenderer.this.getIconFor(value);
+ }
+
public PopupStep onChosen(T selectedValue, boolean finalChoice) {
myFinalRunnable = ComboBoxTableRenderer.this.onChosen(selectedValue);
return FINAL_CHOICE;
@@ -169,6 +178,9 @@ public class ComboBoxTableRenderer<T> extends JLabel implements TableCellRendere
protected void customizeComponent(final T value, final JTable table, final boolean isSelected) {
setOpaque(true);
setText(value == null ? "" : getTextFor(value));
+ if (value != null) {
+ setIcon(getIconFor(value));
+ }
setBackground(isSelected ? table.getSelectionBackground() : table.getBackground());
setForeground(isSelected ? table.getSelectionForeground() : table.getForeground());
}
diff --git a/platform/platform-api/src/com/intellij/openapi/ui/DetailsComponent.java b/platform/platform-api/src/com/intellij/openapi/ui/DetailsComponent.java
index 5bbd3d12da6a..34aaa93d2741 100644
--- a/platform/platform-api/src/com/intellij/openapi/ui/DetailsComponent.java
+++ b/platform/platform-api/src/com/intellij/openapi/ui/DetailsComponent.java
@@ -170,11 +170,7 @@ public class DetailsComponent {
myContent.setBorder(new EmptyBorder(UIUtil.PANEL_REGULAR_INSETS));
}
else {
- if (Registry.is("ide.new.project.settings")) {
- myContent.setBorder(new EmptyBorder(16, 10, 16, 10));
- } else {
- myContent.setBorder(null);
- }
+ myContent.setBorder(null);
}
}
diff --git a/platform/platform-api/src/com/intellij/openapi/ui/FixedSizeButton.java b/platform/platform-api/src/com/intellij/openapi/ui/FixedSizeButton.java
index 6f38d9a96356..101444a9d649 100644
--- a/platform/platform-api/src/com/intellij/openapi/ui/FixedSizeButton.java
+++ b/platform/platform-api/src/com/intellij/openapi/ui/FixedSizeButton.java
@@ -87,7 +87,7 @@ public class FixedSizeButton extends JButton {
public Dimension getPreferredSize() {
if (myComponent != null) {
int size = myComponent.getPreferredSize().height;
- if (myComponent instanceof ComboBox && (UIUtil.isUnderIntelliJLaF() || UIUtil.isUnderDarcula())) {
+ if (myComponent instanceof JComboBox && (UIUtil.isUnderIntelliJLaF() || UIUtil.isUnderDarcula())) {
size -= 2; // decrement to match JTextField's preferred height
}
return new Dimension(size, size);
@@ -120,9 +120,7 @@ public class FixedSizeButton extends JButton {
public void setBounds(Rectangle r) {
if (r.width != r.height) {
int size = Math.min(r.width, r.height);
- r = new Rectangle(r);
- r.width = size;
- r.height = size;
+ r = new Rectangle(r.x, r.y, size, size);
}
super.setBounds(r);
}
diff --git a/platform/platform-api/src/com/intellij/openapi/ui/MasterDetailsComponent.java b/platform/platform-api/src/com/intellij/openapi/ui/MasterDetailsComponent.java
index 35e81b032ba5..816349ed1c37 100644
--- a/platform/platform-api/src/com/intellij/openapi/ui/MasterDetailsComponent.java
+++ b/platform/platform-api/src/com/intellij/openapi/ui/MasterDetailsComponent.java
@@ -135,11 +135,7 @@ public abstract class MasterDetailsComponent implements Configurable, DetailsCom
mySplitter.setSplitterProportionKey("ProjectStructure.SecondLevelElements");
mySplitter.setHonorComponentsMinimumSize(true);
if (Registry.is("ide.new.project.settings")) {
- mySplitter.setDividerWidth(1);
- mySplitter.setShowDividerIcon(false);
- mySplitter.getDivider().setBackground(Gray._153.withAlpha(128));
- mySplitter.setShowDividerControls(false);
- mySplitter.setOrientation(mySplitter.getOrientation());
+ mySplitter.setOnePixelMode();
}
installAutoScroll();
diff --git a/platform/platform-api/src/com/intellij/openapi/ui/ThreeComponentsSplitter.java b/platform/platform-api/src/com/intellij/openapi/ui/ThreeComponentsSplitter.java
index faa26e2415b8..62864d01b91a 100644
--- a/platform/platform-api/src/com/intellij/openapi/ui/ThreeComponentsSplitter.java
+++ b/platform/platform-api/src/com/intellij/openapi/ui/ThreeComponentsSplitter.java
@@ -26,6 +26,7 @@ import com.intellij.ui.UIBundle;
import com.intellij.util.ui.update.Activatable;
import com.intellij.util.ui.update.UiNotifyConnector;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.awt.*;
@@ -56,9 +57,9 @@ public class ThreeComponentsSplitter extends JPanel implements Disposable {
private final Divider myFirstDivider;
private final Divider myLastDivider;
- private JComponent myFirstComponent;
- private JComponent myInnerComponent;
- private JComponent myLastComponent;
+ @Nullable private JComponent myFirstComponent;
+ @Nullable private JComponent myInnerComponent;
+ @Nullable private JComponent myLastComponent;
private int myFirstSize = 10;
private int myLastSize = 10;
@@ -303,6 +304,7 @@ public class ThreeComponentsSplitter extends JPanel implements Disposable {
repaint();
}
+ @Nullable
public JComponent getFirstComponent() {
return myFirstComponent;
}
@@ -312,7 +314,7 @@ public class ThreeComponentsSplitter extends JPanel implements Disposable {
* repaint the splitter. If there is already
*
*/
- public void setFirstComponent(JComponent component) {
+ public void setFirstComponent(@Nullable JComponent component) {
if (myFirstComponent != component) {
if (myFirstComponent != null) {
remove(myFirstComponent);
@@ -325,6 +327,7 @@ public class ThreeComponentsSplitter extends JPanel implements Disposable {
}
}
+ @Nullable
public JComponent getLastComponent() {
return myLastComponent;
}
@@ -335,7 +338,7 @@ public class ThreeComponentsSplitter extends JPanel implements Disposable {
* repaint the splitter.
*
*/
- public void setLastComponent(JComponent component) {
+ public void setLastComponent(@Nullable JComponent component) {
if (myLastComponent != component) {
if (myLastComponent != null) {
remove(myLastComponent);
@@ -348,7 +351,7 @@ public class ThreeComponentsSplitter extends JPanel implements Disposable {
}
}
-
+ @Nullable
public JComponent getInnerComponent() {
return myInnerComponent;
}
@@ -359,7 +362,7 @@ public class ThreeComponentsSplitter extends JPanel implements Disposable {
* repaint the splitter.
*
*/
- public void setInnerComponent(JComponent component) {
+ public void setInnerComponent(@Nullable JComponent component) {
if (myInnerComponent != component) {
if (myInnerComponent != null) {
remove(myInnerComponent);
diff --git a/platform/platform-api/src/com/intellij/openapi/wm/FocusCommand.java b/platform/platform-api/src/com/intellij/openapi/wm/FocusCommand.java
index 6584184a1bb2..fc9eec268ece 100644
--- a/platform/platform-api/src/com/intellij/openapi/wm/FocusCommand.java
+++ b/platform/platform-api/src/com/intellij/openapi/wm/FocusCommand.java
@@ -15,6 +15,7 @@
*/
package com.intellij.openapi.wm;
+import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.openapi.ui.popup.util.PopupUtil;
import com.intellij.openapi.util.ActionCallback;
@@ -22,12 +23,13 @@ import com.intellij.openapi.util.ActiveRunnable;
import com.intellij.openapi.util.Expirable;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.util.registry.Registry;
-import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.awt.*;
+import java.awt.event.FocusAdapter;
+import java.awt.event.FocusEvent;
import java.util.Arrays;
/**
@@ -41,6 +43,8 @@ public abstract class FocusCommand extends ActiveRunnable implements Expirable {
private boolean myInvalidatesPendingFurtherRequestors = true;
private Expirable myExpirable;
+ public static final Logger LOG = Logger.getInstance("#com.intellij.openapi.wm.FocusCommand");
+
public boolean isForced() {
return myForced;
}
@@ -154,46 +158,51 @@ public abstract class FocusCommand extends ActiveRunnable implements Expirable {
public static class ByComponent extends FocusCommand {
private Component myToFocus;
+ private Throwable myAllocation;
- public ByComponent(@Nullable Component toFocus) {
- this(toFocus, toFocus);
+ public ByComponent(@Nullable Component toFocus, @NotNull Throwable allocation) {
+ this(toFocus, toFocus, allocation);
}
- public ByComponent(@Nullable Component toFocus, @Nullable Component dominationComponent) {
+ public ByComponent(@Nullable Component toFocus, @Nullable Component dominationComponent, @NotNull Throwable allocation) {
super(toFocus, dominationComponent);
+ myAllocation = allocation;
myToFocus = toFocus;
}
@NotNull
public final ActionCallback run() {
- if (myToFocus != null) {
- if (Registry.is("actionSystem.doNotStealFocus")) {
- Window topWindow = SwingUtilities.windowForComponent(myToFocus);
- UIUtil.setAutoRequestFocus(topWindow, topWindow.isActive());
- while (topWindow.getOwner() != null) {
- topWindow = SwingUtilities.windowForComponent(topWindow);
- UIUtil.setAutoRequestFocus(topWindow, topWindow.isActive());
- }
- if (topWindow.isActive()) {
- if (!myToFocus.requestFocusInWindow()) {
- myToFocus.requestFocus();
- }
- } else {
- myToFocus.requestFocusInWindow();
+ boolean shouldLogFocuses = Registry.is("ide.log.focuses");
+
+ if (shouldLogFocuses) {
+ myToFocus.addFocusListener(new FocusAdapter() {
+ @Override
+ public void focusGained(FocusEvent e) {
+ if (isExpired()) return;
+ super.focusGained(e);
+ LOG.info("Focus gained on " + myToFocus.getClass().getName());
+ myToFocus.removeFocusListener(this);
}
+ });
+ }
- } else {
- // This change seems reasonable to me. But as far as some implementations
- // can ignore the "forced" parameter we can get bad focus behaviour.
- // So let's start from mac.
- if (!(myToFocus.requestFocusInWindow())) {
- if (!SystemInfo.isMac || isForced() ) {
- myToFocus.requestFocus();
- }
+ if (!(myToFocus.requestFocusInWindow())) {
+ if (shouldLogFocuses) {
+ LOG.info("We could not request focus in window on " + myToFocus.getClass().getName());
+ LOG.info(myAllocation);
+ }
+ if (!SystemInfo.isMac || isForced() ) {
+ myToFocus.requestFocus();
+ if (shouldLogFocuses) {
+ LOG.info("Force request focus on " + myToFocus.getClass().getName());
}
}
+ } else if (shouldLogFocuses) {
+ LOG.info("We have successfully requested focus in window on " + myToFocus.getClass().getName());
+ LOG.info(myAllocation);
}
+
clear();
return new ActionCallback.Done();
}
diff --git a/platform/platform-api/src/com/intellij/ui/BooleanTableCellRenderer.java b/platform/platform-api/src/com/intellij/ui/BooleanTableCellRenderer.java
index 5c5426dd244a..4a2dc6e8b06c 100644
--- a/platform/platform-api/src/com/intellij/ui/BooleanTableCellRenderer.java
+++ b/platform/platform-api/src/com/intellij/ui/BooleanTableCellRenderer.java
@@ -30,8 +30,12 @@ public class BooleanTableCellRenderer extends JCheckBox implements TableCellRend
private final JPanel myPanel = new JPanel();
public BooleanTableCellRenderer() {
+ this(CENTER);
+ }
+
+ public BooleanTableCellRenderer(final int horizontalAlignment) {
super();
- setHorizontalAlignment(CENTER);
+ setHorizontalAlignment(horizontalAlignment);
setVerticalAlignment(CENTER);
setBorder(null);
setOpaque(true);
diff --git a/platform/platform-api/src/com/intellij/ui/ColorChooser.java b/platform/platform-api/src/com/intellij/ui/ColorChooser.java
index 9c8123ab1a49..6777ed74190f 100644
--- a/platform/platform-api/src/com/intellij/ui/ColorChooser.java
+++ b/platform/platform-api/src/com/intellij/ui/ColorChooser.java
@@ -18,6 +18,9 @@ package com.intellij.ui;
import org.jetbrains.annotations.Nullable;
import java.awt.*;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
/**
* Utility wrapper around JColorChooser. Helps to avoid memory leak through JColorChooser.ColorChooserDialog.cancelButton.
@@ -27,24 +30,38 @@ import java.awt.*;
*/
public class ColorChooser {
@Nullable
+ @Deprecated
+ /**
+ * @deprecated Use {@link #chooseColor(java.awt.Component, String, java.awt.Color, boolean, java.util.List, boolean)}
+ */
public static Color chooseColor(Component parent,
String caption,
@Nullable Color preselectedColor,
boolean enableOpacity,
ColorPickerListener[] listeners,
boolean opacityInPercent) {
+ return chooseColor(parent, caption, preselectedColor, enableOpacity, Arrays.asList(listeners), opacityInPercent);
+ }
+
+ @Nullable
+ public static Color chooseColor(Component parent,
+ String caption,
+ @Nullable Color preselectedColor,
+ boolean enableOpacity,
+ List<ColorPickerListener> listeners,
+ boolean opacityInPercent) {
return ColorChooserService.getInstance().showDialog(parent, caption, preselectedColor, enableOpacity, listeners, opacityInPercent);
}
@Nullable
public static Color chooseColor(Component parent, String caption, @Nullable Color preselectedColor, boolean enableOpacity) {
- return chooseColor(parent, caption, preselectedColor, enableOpacity, ColorPickerListener.EMPTY_ARRAY, false);
+ return chooseColor(parent, caption, preselectedColor, enableOpacity, Collections.<ColorPickerListener>emptyList(), false);
}
@Nullable
public static Color chooseColor(Component parent, String caption, @Nullable Color preselectedColor, boolean enableOpacity,
boolean opacityInPercent) {
- return chooseColor(parent, caption, preselectedColor, enableOpacity, ColorPickerListener.EMPTY_ARRAY, opacityInPercent);
+ return chooseColor(parent, caption, preselectedColor, enableOpacity, Collections.<ColorPickerListener>emptyList(), opacityInPercent);
}
@Nullable
diff --git a/platform/platform-api/src/com/intellij/ui/ColorChooserService.java b/platform/platform-api/src/com/intellij/ui/ColorChooserService.java
index 6ecad03496ef..6f34e5e7fc05 100644
--- a/platform/platform-api/src/com/intellij/ui/ColorChooserService.java
+++ b/platform/platform-api/src/com/intellij/ui/ColorChooserService.java
@@ -19,6 +19,7 @@ import com.intellij.openapi.components.ServiceManager;
import org.jetbrains.annotations.Nullable;
import java.awt.*;
+import java.util.List;
/**
* @author Konstantin Bulenkov
@@ -29,10 +30,22 @@ public abstract class ColorChooserService {
}
@Nullable
+ @Deprecated
+ /**
+ * @deprecated Use {@link #showDialog(java.awt.Component, String, java.awt.Color, boolean, java.util.List, boolean)}
+ */
public abstract Color showDialog(Component parent, String caption, Color preselectedColor, boolean enableOpacity,
ColorPickerListener[] listeners);
@Nullable
+ @Deprecated
+ /**
+ * @deprecated Use {@link #showDialog(java.awt.Component, String, java.awt.Color, boolean, java.util.List, boolean)}
+ */
public abstract Color showDialog(Component parent, String caption, Color preselectedColor, boolean enableOpacity,
ColorPickerListener[] listeners, boolean opacityInPercent);
+
+ @Nullable
+ public abstract Color showDialog(Component parent, String caption, Color preselectedColor, boolean enableOpacity,
+ List<ColorPickerListener> listeners, boolean opacityInPercent);
}
diff --git a/platform/platform-api/src/com/intellij/ui/ColorPickerListener.java b/platform/platform-api/src/com/intellij/ui/ColorPickerListener.java
index f028dde4bde9..772265f0c1ef 100644
--- a/platform/platform-api/src/com/intellij/ui/ColorPickerListener.java
+++ b/platform/platform-api/src/com/intellij/ui/ColorPickerListener.java
@@ -20,6 +20,7 @@ import org.jetbrains.annotations.Nullable;
import java.awt.*;
public interface ColorPickerListener {
+ @Deprecated
ColorPickerListener[] EMPTY_ARRAY = new ColorPickerListener[0];
/**
diff --git a/platform/platform-api/src/com/intellij/ui/ExpandedItemRendererComponentWrapper.java b/platform/platform-api/src/com/intellij/ui/ExpandedItemRendererComponentWrapper.java
index 4e6d1c5c3f41..eea201116350 100644
--- a/platform/platform-api/src/com/intellij/ui/ExpandedItemRendererComponentWrapper.java
+++ b/platform/platform-api/src/com/intellij/ui/ExpandedItemRendererComponentWrapper.java
@@ -19,6 +19,7 @@ import com.intellij.util.ui.AbstractLayoutManager;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
+import javax.swing.border.Border;
import java.awt.*;
public class ExpandedItemRendererComponentWrapper extends JComponent {
@@ -40,4 +41,16 @@ public class ExpandedItemRendererComponentWrapper extends JComponent {
}
});
}
+
+ @Override
+ public void setBorder(Border border) {
+ if (getComponentCount() == 1) {
+ Component component = getComponent(0);
+ if (component instanceof JComponent) {
+ ((JComponent)component).setBorder(border);
+ return;
+ }
+ }
+ super.setBorder(border);
+ }
}
diff --git a/platform/platform-api/src/com/intellij/ui/GroupedElementsRenderer.java b/platform/platform-api/src/com/intellij/ui/GroupedElementsRenderer.java
index 3ddbf47028f4..76bacb9cb452 100644
--- a/platform/platform-api/src/com/intellij/ui/GroupedElementsRenderer.java
+++ b/platform/platform-api/src/com/intellij/ui/GroupedElementsRenderer.java
@@ -15,9 +15,7 @@
*/
package com.intellij.ui;
-import com.intellij.openapi.util.registry.Registry;
import com.intellij.ui.components.panels.OpaquePanel;
-import com.intellij.util.ui.GraphicsUtil;
import com.intellij.util.ui.UIUtil;
import javax.swing.*;
@@ -26,38 +24,14 @@ import javax.swing.border.EmptyBorder;
import javax.swing.tree.TreeCellRenderer;
import java.awt.*;
-import static javax.swing.SwingConstants.CENTER;
-import static javax.swing.SwingConstants.LEFT;
-
public abstract class GroupedElementsRenderer {
public static final Color POPUP_SEPARATOR_FOREGROUND = new JBColor(Color.gray.brighter(), Gray._43);
public static final Color POPUP_SEPARATOR_TEXT_FOREGROUND = Color.gray;
public static final Color SELECTED_FRAME_FOREGROUND = Color.black;
- protected SeparatorWithText mySeparatorComponent = new SeparatorWithText() {
- @Override
- protected void paintComponent(Graphics g) {
- if (Registry.is("ide.new.project.settings")) {
- g.setColor(POPUP_SEPARATOR_FOREGROUND);
- Rectangle viewR = new Rectangle(0, getVgap(), getWidth() - 1, getHeight() - getVgap() - 1);
- Rectangle iconR = new Rectangle();
- Rectangle textR = new Rectangle();
- String s = SwingUtilities
- .layoutCompoundLabel(g.getFontMetrics(), getCaption(), null, CENTER,
- LEFT,
- CENTER,
- LEFT,
- viewR, iconR, textR, 0);
- GraphicsUtil.setupAAPainting(g);
- g.setColor(Gray._255.withAlpha(80));
- g.drawString(s, textR.x + 10, textR.y + 1 + g.getFontMetrics().getAscent());
- g.setColor(new Color(0x5F6D7B));
- g.drawString(s, textR.x + 10, textR.y + g.getFontMetrics().getAscent());
- } else {
- super.paintComponent(g);
- }
- }
- };
+ protected SeparatorWithText mySeparatorComponent = createSeparator();
+
+ protected abstract JComponent createItemComponent();
protected JComponent myComponent;
protected MyComponent myRendererComponent;
@@ -75,7 +49,9 @@ public abstract class GroupedElementsRenderer {
protected abstract void layout();
- protected abstract JComponent createItemComponent();
+ protected SeparatorWithText createSeparator() {
+ return new SeparatorWithText();
+ }
protected final JComponent configureComponent(String text, String tooltip, Icon icon, Icon disabledIcon, boolean isSelected, boolean hasSeparatorAbove, String separatorTextAbove, int preferredForcedWidth) {
mySeparatorComponent.setVisible(hasSeparatorAbove);
@@ -127,9 +103,9 @@ public abstract class GroupedElementsRenderer {
}
- protected final void setDeselected(JComponent aComponent) {
+ protected final void setDeselected(JComponent aComponent) {
aComponent.setBackground(getBackground());
- aComponent.setForeground(Registry.is("ide.new.project.settings") ? Gray._60 : getForeground());
+ aComponent.setForeground(getForeground());
}
protected abstract Color getSelectionBackground();
@@ -154,7 +130,7 @@ public abstract class GroupedElementsRenderer {
public abstract static class List extends GroupedElementsRenderer {
@Override
- protected final void layout() {
+ protected void layout() {
myRendererComponent.add(mySeparatorComponent, BorderLayout.NORTH);
myRendererComponent.add(myComponent, BorderLayout.CENTER);
}
diff --git a/platform/platform-api/src/com/intellij/ui/JBSplitter.java b/platform/platform-api/src/com/intellij/ui/JBSplitter.java
index f25c2aee042c..b4000dbcfae2 100644
--- a/platform/platform-api/src/com/intellij/ui/JBSplitter.java
+++ b/platform/platform-api/src/com/intellij/ui/JBSplitter.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2012 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -94,6 +94,14 @@ public class JBSplitter extends Splitter {
saveProportion();
}
+ public void setOnePixelMode() {
+ setDividerWidth(1);
+ setShowDividerIcon(false);
+ getDivider().setBackground(new JBColor(Gray._153.withAlpha(128), Gray._100.withAlpha(128)));
+ setShowDividerControls(false);
+ setOrientation(getOrientation());
+ }
+
protected void loadProportion() {
if (! StringUtil.isEmpty(mySplitterProportionKey)) {
setProportion(PropertiesComponent.getInstance().getFloat(mySplitterProportionKey, myProportion));
diff --git a/platform/platform-api/src/com/intellij/ui/TextFieldWithHistoryWithBrowseButton.java b/platform/platform-api/src/com/intellij/ui/TextFieldWithHistoryWithBrowseButton.java
index 9534bf047de9..e16e421a46a9 100644
--- a/platform/platform-api/src/com/intellij/ui/TextFieldWithHistoryWithBrowseButton.java
+++ b/platform/platform-api/src/com/intellij/ui/TextFieldWithHistoryWithBrowseButton.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2012 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -50,4 +50,8 @@ public class TextFieldWithHistoryWithBrowseButton extends ComponentWithBrowseBut
super.addBrowseFolderListener(title, description, project, fileChooserDescriptor, accessor, autoRemoveOnHide);
FileChooserFactory.getInstance().installFileCompletion(getChildComponent().getTextEditor(), fileChooserDescriptor, false, project);
}
+
+ public String getText() {
+ return getChildComponent().getText();
+ }
}
diff --git a/platform/platform-api/src/com/intellij/ui/dualView/DualView.java b/platform/platform-api/src/com/intellij/ui/dualView/DualView.java
index 56fe3200f03b..475220cb6d34 100644
--- a/platform/platform-api/src/com/intellij/ui/dualView/DualView.java
+++ b/platform/platform-api/src/com/intellij/ui/dualView/DualView.java
@@ -36,6 +36,7 @@ import com.intellij.util.config.Storage;
import com.intellij.util.ui.ColumnInfo;
import com.intellij.util.ui.ListTableModel;
import org.jetbrains.annotations.NonNls;
+import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import javax.swing.border.Border;
@@ -239,8 +240,9 @@ public class DualView extends JPanel {
return createWrappedRenderer(super.getCellRenderer(row, column));
}
+ @NotNull
@Override
- public Component prepareRenderer(TableCellRenderer renderer, int row, int column) {
+ public Component prepareRenderer(@NotNull TableCellRenderer renderer, int row, int column) {
final Component c = super.prepareRenderer(renderer, row, column);
if (c instanceof JComponent && !myFlatView.getCellSelectionEnabled()) {
((JComponent)c).setBorder(null);
diff --git a/platform/platform-api/src/com/intellij/ui/speedSearch/SpeedSearchSupply.java b/platform/platform-api/src/com/intellij/ui/speedSearch/SpeedSearchSupply.java
index de3452d8e61f..736c4db0b677 100644
--- a/platform/platform-api/src/com/intellij/ui/speedSearch/SpeedSearchSupply.java
+++ b/platform/platform-api/src/com/intellij/ui/speedSearch/SpeedSearchSupply.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2010 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -30,6 +30,10 @@ import java.beans.PropertyChangeListener;
* @author Konstantin Bulenkov
*/
public abstract class SpeedSearchSupply {
+ /**
+ * Client property key to use in jcomponents for passing the actual search query to renderers
+ */
+ public static final String SEARCH_QUERY_KEY = "SEARCH_QUERY";
private static final Key SPEED_SEARCH_COMPONENT_MARKER = new Key("SPEED_SEARCH_COMPONENT_MARKER");
public static final DataKey<String> SPEED_SEARCH_CURRENT_QUERY = DataKey.create("SPEED_SEARCH_CURRENT_QUERY");
diff --git a/platform/platform-api/src/com/intellij/ui/table/JBTable.java b/platform/platform-api/src/com/intellij/ui/table/JBTable.java
index d8736f6fc08e..e7ff935e57f9 100644
--- a/platform/platform-api/src/com/intellij/ui/table/JBTable.java
+++ b/platform/platform-api/src/com/intellij/ui/table/JBTable.java
@@ -38,6 +38,8 @@ import java.util.Comparator;
import java.util.EventObject;
public class JBTable extends JTable implements ComponentWithEmptyText, ComponentWithExpandableItems<TableCell> {
+ public static final int PREFERRED_SCROLLABLE_VIEWPORT_HEIGHT_IN_ROWS = 7;
+
private final StatusText myEmptyText;
private final ExpandableItemsHandler<TableCell> myExpandableItemsHandler;
@@ -84,30 +86,29 @@ public class JBTable extends JTable implements ComponentWithEmptyText, Component
}
@Override
- public void columnSelectionChanged(ListSelectionEvent e) {
+ public void columnSelectionChanged(@NotNull ListSelectionEvent e) {
}
@Override
- public void columnAdded(TableColumnModelEvent e) {
+ public void columnAdded(@NotNull TableColumnModelEvent e) {
}
@Override
- public void columnMoved(TableColumnModelEvent e) {
+ public void columnMoved(@NotNull TableColumnModelEvent e) {
}
@Override
- public void columnRemoved(TableColumnModelEvent e) {
+ public void columnRemoved(@NotNull TableColumnModelEvent e) {
}
});
final TableModelListener modelListener = new TableModelListener() {
@Override
- public void tableChanged(final TableModelEvent e) {
+ public void tableChanged(@NotNull final TableModelEvent e) {
if (!myRowHeightIsExplicitlySet) {
myRowHeight = -1;
}
- if ((e.getType() == TableModelEvent.DELETE && isEmpty())
- || (e.getType() == TableModelEvent.INSERT && !isEmpty())) {
+ if (e.getType() == TableModelEvent.DELETE && isEmpty() || e.getType() == TableModelEvent.INSERT && !isEmpty()) {
repaintViewport();
}
}
@@ -116,7 +117,7 @@ public class JBTable extends JTable implements ComponentWithEmptyText, Component
if (getModel() != null) getModel().addTableModelListener(modelListener);
addPropertyChangeListener("model", new PropertyChangeListener() {
@Override
- public void propertyChange(PropertyChangeEvent evt) {
+ public void propertyChange(@NotNull PropertyChangeEvent evt) {
repaintViewport();
if (evt.getOldValue() instanceof TableModel) {
@@ -197,6 +198,7 @@ public class JBTable extends JTable implements ComponentWithEmptyText, Component
}
}
+ @NotNull
@Override
protected JTableHeader createDefaultTableHeader() {
return new JBTableHeader();
@@ -237,7 +239,7 @@ public class JBTable extends JTable implements ComponentWithEmptyText, Component
}
@Override
- protected void paintComponent(Graphics g) {
+ protected void paintComponent(@NotNull Graphics g) {
if (myEnableAntialiasing) {
GraphicsUtil.setupAntialiasing(g);
}
@@ -320,7 +322,7 @@ public class JBTable extends JTable implements ComponentWithEmptyText, Component
}
@Override
- public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction) {
+ public int getScrollableUnitIncrement(@NotNull Rectangle visibleRect, int orientation, int direction) {
if (orientation == SwingConstants.VERTICAL) {
return super.getScrollableUnitIncrement(visibleRect, orientation, direction);
}
@@ -339,7 +341,7 @@ public class JBTable extends JTable implements ComponentWithEmptyText, Component
}
@Override
- public void paint(Graphics g) {
+ public void paint(@NotNull Graphics g) {
if (!isEnabled()) {
g = new TableGrayer((Graphics2D)g);
}
@@ -470,8 +472,9 @@ public class JBTable extends JTable implements ComponentWithEmptyText, Component
isTypeAhead = false;
}
+ @NotNull
@Override
- public Component prepareRenderer(TableCellRenderer renderer, int row, int column) {
+ public Component prepareRenderer(@NotNull TableCellRenderer renderer, int row, int column) {
Component result = super.prepareRenderer(renderer, row, column);
// Fix GTK background
@@ -506,7 +509,7 @@ public class JBTable extends JTable implements ComponentWithEmptyText, Component
}
@Override
- public void propertyChange(final PropertyChangeEvent e) {
+ public void propertyChange(@NotNull final PropertyChangeEvent e) {
if (!isEditing()) {
return;
}
@@ -541,7 +544,7 @@ public class JBTable extends JTable implements ComponentWithEmptyText, Component
private final class MyMouseListener extends MouseAdapter {
@Override
- public void mousePressed(final MouseEvent e) {
+ public void mousePressed(@NotNull final MouseEvent e) {
if (SwingUtilities.isRightMouseButton(e)) {
final int[] selectedRows = getSelectedRows();
if (selectedRows.length < 2) {
@@ -629,6 +632,7 @@ public class JBTable extends JTable implements ComponentWithEmptyText, Component
return myModel.getValueAt(row, column);
}
+ @NotNull
@Override
public String getStringValueAt(int row, int column) {
TableStringConverter converter = getStringConverter();
@@ -666,7 +670,7 @@ public class JBTable extends JTable implements ComponentWithEmptyText, Component
super(JBTable.this.columnModel);
JBTable.this.addPropertyChangeListener(new PropertyChangeListener() {
@Override
- public void propertyChange(PropertyChangeEvent evt) {
+ public void propertyChange(@NotNull PropertyChangeEvent evt) {
JBTableHeader.this.revalidate();
JBTableHeader.this.repaint();
}
@@ -674,7 +678,7 @@ public class JBTable extends JTable implements ComponentWithEmptyText, Component
}
@Override
- public void paint(Graphics g) {
+ public void paint(@NotNull Graphics g) {
if (myEnableAntialiasing) {
GraphicsUtil.setupAntialiasing(g);
}
@@ -685,7 +689,7 @@ public class JBTable extends JTable implements ComponentWithEmptyText, Component
}
@Override
- public String getToolTipText(final MouseEvent event) {
+ public String getToolTipText(@NotNull final MouseEvent event) {
final TableModel model = getModel();
if (model instanceof SortableColumnModel) {
final int i = columnAtPoint(event.getPoint());
@@ -719,6 +723,7 @@ public class JBTable extends JTable implements ComponentWithEmptyText, Component
super.setColor(color);
}
+ @NotNull
@Override
public Graphics create() {
return new TableGrayer((Graphics2D)super.create());
diff --git a/platform/platform-api/src/com/intellij/ui/table/TableView.java b/platform/platform-api/src/com/intellij/ui/table/TableView.java
index a563c820f815..44b40e938cdb 100644
--- a/platform/platform-api/src/com/intellij/ui/table/TableView.java
+++ b/platform/platform-api/src/com/intellij/ui/table/TableView.java
@@ -101,10 +101,12 @@ public class TableView<Item> extends BaseTableView implements ItemsProvider, Sel
final RowSorter<? extends TableModel> sorter = getRowSorter();
final RowSorter.SortKey sortKey = sorter == null ? null : ContainerUtil.getFirstItem(sorter.getSortKeys());
- ColumnInfo[] columns = getListTableModel().getColumnInfos();
- int[] sizeMode = new int[columns.length];
- int[] headers = new int[columns.length];
- int[] widths = new int[columns.length];
+ ColumnInfo[] columnInfos = getListTableModel().getColumnInfos();
+ TableColumnModel columnModel = getColumnModel();
+ int visibleColumnCount = columnModel.getColumnCount();
+ int[] sizeMode = new int[visibleColumnCount];
+ int[] headers = new int[visibleColumnCount];
+ int[] widths = new int[visibleColumnCount];
int allColumnWidth = 0;
int allColumnCurrent = 0;
int varCount = 0;
@@ -112,9 +114,9 @@ public class TableView<Item> extends BaseTableView implements ItemsProvider, Sel
Icon sortIcon = UIManager.getIcon("Table.ascendingSortIcon");
// calculate
- for (int i = 0; i < columns.length; i++) {
- final ColumnInfo columnInfo = columns[i];
- final TableColumn column = getColumnModel().getColumn(i);
+ for (int i = 0; i < visibleColumnCount; i++) {
+ final TableColumn column = columnModel.getColumn(i);
+ final ColumnInfo columnInfo = columnInfos[column.getModelIndex()];
TableCellRenderer columnHeaderRenderer = column.getHeaderRenderer();
if (columnHeaderRenderer == null) {
@@ -162,8 +164,8 @@ public class TableView<Item> extends BaseTableView implements ItemsProvider, Sel
allColumnWidth < (1 - gold) * viewWidth ? (1 - gold) * viewWidth :
viewWidth) - allColumnWidth) / varCount;
- for (int i=0 ; i<columns.length; i ++) {
- TableColumn column = getColumnModel().getColumn(i);
+ for (int i = 0 ; i < visibleColumnCount; i++) {
+ TableColumn column = columnModel.getColumn(i);
int width = widths[i];
if (sizeMode[i] == 1) {
column.setMaxWidth(width);
diff --git a/platform/platform-api/src/com/intellij/ui/tabs/impl/JBTabsImpl.java b/platform/platform-api/src/com/intellij/ui/tabs/impl/JBTabsImpl.java
index 532c95a52a17..a058badddd41 100644
--- a/platform/platform-api/src/com/intellij/ui/tabs/impl/JBTabsImpl.java
+++ b/platform/platform-api/src/com/intellij/ui/tabs/impl/JBTabsImpl.java
@@ -930,7 +930,7 @@ public class JBTabsImpl extends JComponent
if (isShowing()) {
- return myFocusManager.requestFocus(new FocusCommand.ByComponent(toFocus), true);
+ return myFocusManager.requestFocus(new FocusCommand.ByComponent(toFocus, new Exception()), true);
}
else {
final ActionCallback result = new ActionCallback();
@@ -948,7 +948,7 @@ public class JBTabsImpl extends JComponent
@Override
public void run() {
queued.set(true);
- requestor.requestFocus(new FocusCommand.ByComponent(toFocus), true).notify(result);
+ requestor.requestFocus(new FocusCommand.ByComponent(toFocus, new Exception()), true).notify(result);
}
};
return result;
diff --git a/platform/platform-api/src/com/intellij/util/net/HTTPProxySettings.form b/platform/platform-api/src/com/intellij/util/net/HTTPProxySettings.form
index 72db5886d23b..5ffe378667d3 100644
--- a/platform/platform-api/src/com/intellij/util/net/HTTPProxySettings.form
+++ b/platform/platform-api/src/com/intellij/util/net/HTTPProxySettings.form
@@ -117,6 +117,7 @@
</grid>
</constraints>
<properties>
+ <lineWrap value="true"/>
<toolTipText value=""/>
</properties>
</component>
diff --git a/platform/platform-api/src/com/intellij/util/ui/NSScrollerHelper.java b/platform/platform-api/src/com/intellij/util/ui/NSScrollerHelper.java
index db8244255db7..6498ed4e063b 100644
--- a/platform/platform-api/src/com/intellij/util/ui/NSScrollerHelper.java
+++ b/platform/platform-api/src/com/intellij/util/ui/NSScrollerHelper.java
@@ -75,6 +75,8 @@ class NSScrollerHelper {
ID delegateClass = Foundation.allocateObjcClassPair(Foundation.getObjcClass("NSObject"), "NSScrollerChangesObserver");
if (!ID.NIL.equals(delegateClass)) {
+ // This static initializer might be called more than once (with different class loaders). In that case NSScrollerChangesObserver
+ // already exists.
if (!Foundation.addMethod(delegateClass, Foundation.createSelector("handleScrollerStyleChanged:"), APPEARANCE_CALLBACK, "v@")) {
throw new RuntimeException("Cannot add observer method");
}
diff --git a/platform/platform-impl/src/com/intellij/codeStyle/DefaultCodeStyleFacade.java b/platform/platform-impl/src/com/intellij/codeStyle/DefaultCodeStyleFacade.java
index bf748ab945ba..4d9a34a029b5 100644
--- a/platform/platform-impl/src/com/intellij/codeStyle/DefaultCodeStyleFacade.java
+++ b/platform/platform-impl/src/com/intellij/codeStyle/DefaultCodeStyleFacade.java
@@ -19,6 +19,7 @@
*/
package com.intellij.codeStyle;
+import com.intellij.lang.Language;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.options.Configurable;
@@ -39,7 +40,7 @@ public class DefaultCodeStyleFacade extends CodeStyleFacade {
return "\n";
}
- public int getRightMargin() {
+ public int getRightMargin(Language language) {
return 80;
}
diff --git a/platform/platform-impl/src/com/intellij/diagnostic/PerformanceWatcher.java b/platform/platform-impl/src/com/intellij/diagnostic/PerformanceWatcher.java
index 88d3aa285960..26a6f6356d2a 100644
--- a/platform/platform-impl/src/com/intellij/diagnostic/PerformanceWatcher.java
+++ b/platform/platform-impl/src/com/intellij/diagnostic/PerformanceWatcher.java
@@ -45,7 +45,7 @@ public class PerformanceWatcher implements ApplicationComponent {
private ThreadMXBean myThreadMXBean;
private final DateFormat myDateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss");
//private DateFormat myPrintDateFormat = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss");
- private File myLogDir;
+ private File mySessionLogDir;
private int myUnresponsiveDuration = 0;
private File myCurHangLogDir;
private List<StackTraceElement> myStacktraceCommonPart;
@@ -98,9 +98,9 @@ public class PerformanceWatcher implements ApplicationComponent {
}
});
- myLogDir = new File(PathManager.getLogPath() + "/threadDumps-" + myDateFormat.format(new Date())
+ mySessionLogDir = new File(PathManager.getLogPath() + "/threadDumps-" + myDateFormat.format(new Date())
+ "-" + ApplicationInfo.getInstance().getBuild().asString());
- myCurHangLogDir = myLogDir;
+ myCurHangLogDir = mySessionLogDir;
try {
myShutdownSemaphore.acquire();
@@ -164,22 +164,22 @@ public class PerformanceWatcher implements ApplicationComponent {
}
if (mySwingThreadCounter != myLoopCounter) {
myUnresponsiveDuration += UNRESPONSIVE_INTERVAL;
- if (myUnresponsiveDuration == UNRESPONSIVE_THRESHOLD) {
- //System.out.println("EDT is not responding at " + myPrintDateFormat.format(new Date()));
- myCurHangLogDir = new File(myLogDir, myDateFormat.format(new Date()));
- }
if (myUnresponsiveDuration >= UNRESPONSIVE_THRESHOLD) {
+ if (myCurHangLogDir == mySessionLogDir) {
+ //System.out.println("EDT is not responding at " + myPrintDateFormat.format(new Date()));
+ myCurHangLogDir = new File(mySessionLogDir, myDateFormat.format(new Date()));
+ }
dumpThreads(false);
}
}
else {
if (myUnresponsiveDuration >= UNRESPONSIVE_THRESHOLD) {
//System.out.println("EDT was unresponsive for " + myUnresponsiveDuration + " seconds");
- if (myCurHangLogDir.exists()) {
- myCurHangLogDir.renameTo(new File(myLogDir, getLogDirForHang()));
+ if (myCurHangLogDir != mySessionLogDir && myCurHangLogDir.exists()) {
+ myCurHangLogDir.renameTo(new File(mySessionLogDir, getLogDirForHang()));
}
myUnresponsiveDuration = 0;
- myCurHangLogDir = myLogDir;
+ myCurHangLogDir = mySessionLogDir;
myStacktraceCommonPart = null;
}
diff --git a/platform/platform-impl/src/com/intellij/execution/impl/EditorHyperlinkSupport.java b/platform/platform-impl/src/com/intellij/execution/impl/EditorHyperlinkSupport.java
index 26429fc0e896..d263288634b7 100644
--- a/platform/platform-impl/src/com/intellij/execution/impl/EditorHyperlinkSupport.java
+++ b/platform/platform-impl/src/com/intellij/execution/impl/EditorHyperlinkSupport.java
@@ -181,7 +181,8 @@ public class EditorHyperlinkSupport {
new FilteringProcessor<RangeHighlighterEx>(new Condition<RangeHighlighterEx>() {
@Override
public boolean value(RangeHighlighterEx rangeHighlighterEx) {
- return HYPERLINK_LAYER == rangeHighlighterEx.getLayer() &&
+ return rangeHighlighterEx.getEditorFilter().avaliableIn(editor) &&
+ HYPERLINK_LAYER == rangeHighlighterEx.getLayer() &&
rangeHighlighterEx.isValid() &&
getHyperlinkInfo(rangeHighlighterEx) != null;
}
diff --git a/platform/platform-impl/src/com/intellij/help/impl/KeymapGenerator.java b/platform/platform-impl/src/com/intellij/help/impl/KeymapGenerator.java
index acd74f9c8f54..f38ef84a2b93 100644
--- a/platform/platform-impl/src/com/intellij/help/impl/KeymapGenerator.java
+++ b/platform/platform-impl/src/com/intellij/help/impl/KeymapGenerator.java
@@ -23,9 +23,11 @@ import com.intellij.openapi.keymap.KeymapUtil;
import com.intellij.openapi.keymap.ex.KeymapManagerEx;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.text.StringUtil;
+import gnu.trove.THashSet;
import java.io.File;
import java.io.IOException;
+import java.util.Set;
/**
* @author Konstantin Bulenkov
@@ -47,13 +49,20 @@ public class KeymapGenerator implements ApplicationStarter {
xml.append("<Keymaps>\n");
for (Keymap keymap : KeymapManagerEx.getInstanceEx().getAllKeymaps()) {
- xml.append(" <Keymap name=\"").append(keymap.getName()).append("\">\n");
+
+ xml.append(" <Keymap name=\"").append(keymap.getPresentableName()).append("\">\n");
for (String id : keymap.getActionIds()) {
String shortcuts = KeymapUtil.getShortcutsText(keymap.getShortcuts(id));
if (!StringUtil.isEmpty(shortcuts)) {
xml.append(" <Action id=\"").append(id).append("\">\n");
+ Set<String> addedShortcuts = new THashSet<String>();
for (Shortcut shortcut : keymap.getShortcuts(id)) {
- xml.append(" <Shortcut>").append(KeymapUtil.getShortcutText(shortcut)).append("</Shortcut>\n");
+ // Different shortcuts may have equal display strings (e.g. shift+minus and shift+subtract)
+ // We don't want them do be duplicated for users
+ String shortcutText = KeymapUtil.getShortcutText(shortcut);
+ if (addedShortcuts.add(shortcutText)) {
+ xml.append(" <Shortcut>").append(shortcutText).append("</Shortcut>\n");
+ }
}
xml.append(" </Action>\n");
}
diff --git a/platform/platform-impl/src/com/intellij/ide/IdeEventQueue.java b/platform/platform-impl/src/com/intellij/ide/IdeEventQueue.java
index e92f80ffc95c..1bbd74984fcc 100644
--- a/platform/platform-impl/src/com/intellij/ide/IdeEventQueue.java
+++ b/platform/platform-impl/src/com/intellij/ide/IdeEventQueue.java
@@ -44,6 +44,7 @@ import com.intellij.util.ReflectionUtil;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.containers.HashMap;
import com.intellij.util.ui.UIUtil;
+import com.sun.java.swing.plaf.windows.WindowsLookAndFeel;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -53,6 +54,7 @@ import java.awt.*;
import java.awt.event.*;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
+import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.*;
import java.util.List;
@@ -731,9 +733,29 @@ public class IdeEventQueue extends EventQueue {
}
}
+ private static Field stickyAltField;
//IDEA-17359
private static void fixStickyAlt(AWTEvent e) {
- if (SystemInfo.isWindowsXP && e instanceof KeyEvent && ((KeyEvent)e).getKeyCode() == KeyEvent.VK_ALT) {
+ if (Registry.is("actionSystem.win.suppressAlt.new")) {
+ if (SystemInfo.isWindows
+ && UIManager.getLookAndFeel() instanceof WindowsLookAndFeel
+ && e instanceof InputEvent
+ && (((InputEvent)e).getModifiers() & (InputEvent.ALT_MASK | InputEvent.ALT_DOWN_MASK)) != 0
+ && !(e instanceof KeyEvent && ((KeyEvent)e).getKeyCode() == KeyEvent.VK_ALT)) {
+ try {
+ if (stickyAltField == null) {
+ stickyAltField = Class
+ .forName("com.sun.java.swing.plaf.windows.WindowsRootPaneUI$AltProcessor")
+ .getDeclaredField("menuCanceledOnPress");
+ stickyAltField.setAccessible(true);
+ }
+ stickyAltField.set(null, true);
+ }
+ catch (Exception exception) {
+ LOG.error(exception);
+ }
+ }
+ } else if (SystemInfo.isWindowsXP && e instanceof KeyEvent && ((KeyEvent)e).getKeyCode() == KeyEvent.VK_ALT) {
((KeyEvent)e).consume();
}
}
@@ -940,7 +962,7 @@ public class IdeEventQueue extends EventQueue {
@Override
public boolean dispatch(AWTEvent e) {
boolean dispatch = true;
- if (e instanceof KeyEvent) {
+ if (!Registry.is("actionSystem.win.suppressAlt.new") && e instanceof KeyEvent) {
KeyEvent ke = (KeyEvent)e;
final Component component = ke.getComponent();
final Window window = component == null ? null : SwingUtilities.windowForComponent(component);
diff --git a/platform/platform-impl/src/com/intellij/ide/MacOSApplicationProvider.java b/platform/platform-impl/src/com/intellij/ide/MacOSApplicationProvider.java
index 798c029e01a8..a90d0df033ff 100644
--- a/platform/platform-impl/src/com/intellij/ide/MacOSApplicationProvider.java
+++ b/platform/platform-impl/src/com/intellij/ide/MacOSApplicationProvider.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -28,8 +28,6 @@ import com.intellij.openapi.actionSystem.ex.ActionManagerEx;
import com.intellij.openapi.application.ex.ApplicationManagerEx;
import com.intellij.openapi.components.ApplicationComponent;
import com.intellij.openapi.options.ShowSettingsUtil;
-import com.intellij.openapi.options.ex.IdeConfigurablesGroup;
-import com.intellij.openapi.options.ex.ProjectConfigurablesGroup;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.project.ProjectManager;
import com.intellij.openapi.util.SystemInfo;
@@ -98,8 +96,7 @@ public class MacOSApplicationProvider implements ApplicationComponent {
}
if (!((ShowSettingsUtilImpl)ShowSettingsUtil.getInstance()).isAlreadyShown()) {
- ShowSettingsUtil.getInstance().showSettingsDialog(project, new ProjectConfigurablesGroup(project),
- new IdeConfigurablesGroup());
+ ShowSettingsUtil.getInstance().showSettingsDialog(project, ShowSettingsUtilImpl.getConfigurableGroups(project, true));
}
applicationEvent.setHandled(true);
}
diff --git a/platform/platform-impl/src/com/intellij/ide/TipOfTheDayManager.java b/platform/platform-impl/src/com/intellij/ide/TipOfTheDayManager.java
index 3c510c0a7ac8..a93fea76ca67 100644
--- a/platform/platform-impl/src/com/intellij/ide/TipOfTheDayManager.java
+++ b/platform/platform-impl/src/com/intellij/ide/TipOfTheDayManager.java
@@ -39,7 +39,7 @@ public class TipOfTheDayManager implements StartupActivity, DumbAware {
ToolWindowManager.getInstance(project).invokeLater(new Runnable() {
public void run() {
if (project.isDisposed()) return;
- new TipDialog().show();
+ TipDialog.createForProject(project).show();
}
});
}
diff --git a/platform/platform-impl/src/com/intellij/ide/actions/ShowSettingsAction.java b/platform/platform-impl/src/com/intellij/ide/actions/ShowSettingsAction.java
index e89a7a328b28..eda6ec9f2d7c 100644
--- a/platform/platform-impl/src/com/intellij/ide/actions/ShowSettingsAction.java
+++ b/platform/platform-impl/src/com/intellij/ide/actions/ShowSettingsAction.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,8 +20,6 @@ import com.intellij.icons.AllIcons;
import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.application.ex.ApplicationManagerEx;
import com.intellij.openapi.options.ShowSettingsUtil;
-import com.intellij.openapi.options.ex.IdeConfigurablesGroup;
-import com.intellij.openapi.options.ex.ProjectConfigurablesGroup;
import com.intellij.openapi.project.DumbAware;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.project.ProjectManager;
@@ -60,7 +58,6 @@ public class ShowSettingsAction extends AnAction implements DumbAware {
}
}
});
- ShowSettingsUtil.getInstance().showSettingsDialog(project, new ProjectConfigurablesGroup(project),
- new IdeConfigurablesGroup());
+ ShowSettingsUtil.getInstance().showSettingsDialog(project, ShowSettingsUtilImpl.getConfigurableGroups(project, true));
}
}
diff --git a/platform/platform-impl/src/com/intellij/ide/actions/ShowSettingsUtilImpl.java b/platform/platform-impl/src/com/intellij/ide/actions/ShowSettingsUtilImpl.java
index 7e31726d5f97..4df11f7261ca 100644
--- a/platform/platform-impl/src/com/intellij/ide/actions/ShowSettingsUtilImpl.java
+++ b/platform/platform-impl/src/com/intellij/ide/actions/ShowSettingsUtilImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -22,6 +22,7 @@ import com.intellij.openapi.options.SearchableConfigurable;
import com.intellij.openapi.options.ShowSettingsUtil;
import com.intellij.openapi.options.ex.ConfigurableExtensionPointUtil;
import com.intellij.openapi.options.ex.IdeConfigurablesGroup;
+import com.intellij.openapi.options.ex.MixedConfigurableGroup;
import com.intellij.openapi.options.ex.ProjectConfigurablesGroup;
import com.intellij.openapi.options.ex.SingleConfigurableEditor;
import com.intellij.openapi.options.newEditor.OptionsEditor;
@@ -29,6 +30,7 @@ import com.intellij.openapi.options.newEditor.OptionsEditorDialog;
import com.intellij.openapi.options.newEditor.PreferencesDialog;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.project.ProjectManager;
+import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.util.ui.update.Activatable;
import com.intellij.util.ui.update.UiNotifyConnector;
@@ -47,11 +49,62 @@ public class ShowSettingsUtilImpl extends ShowSettingsUtil {
private static final Logger LOG = Logger.getInstance("#com.intellij.ide.actions.ShowSettingsUtilImpl");
private AtomicBoolean myShown = new AtomicBoolean(false);
+ @NotNull
+ private static Project getProject(@Nullable Project project) {
+ return project != null ? project : ProjectManager.getInstance().getDefaultProject();
+ }
+
+ @NotNull
+ private static DialogWrapper getDialog(@Nullable Project project, @NotNull ConfigurableGroup[] groups, @Nullable Configurable toSelect) {
+ return Registry.is("ide.perProjectModality")
+ ? new OptionsEditorDialog(getProject(project), filterEmptyGroups(groups), toSelect, true)
+ : Registry.is("ide.new.preferences")
+ ? new PreferencesDialog(getProject(project), filterEmptyGroups(groups))
+ : new OptionsEditorDialog(getProject(project), filterEmptyGroups(groups), toSelect);
+ }
+
+ @NotNull
+ public static ConfigurableGroup[] getConfigurableGroups(@Nullable Project project, boolean withIdeSettings) {
+ ConfigurableGroup[] groups = !withIdeSettings
+ ? new ConfigurableGroup[]{new ProjectConfigurablesGroup(getProject(project))}
+ : (project == null)
+ ? new ConfigurableGroup[]{new IdeConfigurablesGroup()}
+ : new ConfigurableGroup[]{
+ new ProjectConfigurablesGroup(project),
+ new IdeConfigurablesGroup()};
+
+ return Registry.is("ide.file.settings.order.new")
+ ? MixedConfigurableGroup.getGroups(getConfigurables(groups, true))
+ : groups;
+ }
+
+ @NotNull
+ public static Configurable[] getConfigurables(@Nullable Project project, boolean withGroupReverseOrder) {
+ return getConfigurables(getConfigurableGroups(project, true), withGroupReverseOrder);
+ }
+
+ @NotNull
+ private static Configurable[] getConfigurables(@NotNull ConfigurableGroup[] groups, boolean withGroupReverseOrder) {
+ Configurable[][] arrays = new Configurable[groups.length][];
+ int length = 0;
+ for (int i = 0; i < groups.length; i++) {
+ arrays[i] = groups[withGroupReverseOrder ? groups.length - 1 - i : i].getConfigurables();
+ length += arrays[i].length;
+ }
+ Configurable[] configurables = new Configurable[length];
+ int offset = 0;
+ for (Configurable[] array : arrays) {
+ System.arraycopy(array, 0, configurables, offset, array.length);
+ offset += array.length;
+ }
+ return configurables;
+ }
+
@Override
public void showSettingsDialog(@NotNull Project project, @NotNull ConfigurableGroup[] group) {
try {
myShown.set(true);
- _showSettingsDialog(project, group, null);
+ getDialog(project, group, null).show();
}
catch (Exception e) {
LOG.error(e);
@@ -61,41 +114,17 @@ public class ShowSettingsUtilImpl extends ShowSettingsUtil {
}
}
- private static void _showSettingsDialog(@NotNull final Project project, @NotNull ConfigurableGroup[] group, @Nullable Configurable toSelect) {
- group = filterEmptyGroups(group);
- if (Registry.is("ide.perProjectModality")) {
- new OptionsEditorDialog(project, group, toSelect, true).show();
- } else {
- if (Registry.is("ide.new.preferences")) {
- new PreferencesDialog(project, group).show();
- } else {
- new OptionsEditorDialog(project, group, toSelect).show();
- }
- }
- }
-
@Override
public void showSettingsDialog(@Nullable final Project project, final Class configurableClass) {
assert Configurable.class.isAssignableFrom(configurableClass) : "Not a configurable: " + configurableClass.getName();
- ConfigurableGroup[] groups;
- IdeConfigurablesGroup commonGroup = new IdeConfigurablesGroup();
- ProjectConfigurablesGroup projectGroup = project == null ? null : new ProjectConfigurablesGroup(project);
- if (projectGroup == null) {
- groups = new ConfigurableGroup[] {commonGroup};
- } else {
- groups = new ConfigurableGroup[] {projectGroup, commonGroup};
- }
+ ConfigurableGroup[] groups = getConfigurableGroups(project, true);
- Configurable config = findByClass(commonGroup.getConfigurables(), configurableClass);
- if (config == null && projectGroup != null) {
- config = findByClass(projectGroup.getConfigurables(), configurableClass);
- }
+ Configurable config = findByClass(getConfigurables(groups, true), configurableClass);
assert config != null : "Cannot find configurable: " + configurableClass.getName();
- @NotNull Project nnProject = project != null ? project : ProjectManager.getInstance().getDefaultProject();
- _showSettingsDialog(nnProject, groups, config);
+ getDialog(project, groups, config).show();
}
@Nullable
@@ -110,15 +139,9 @@ public class ShowSettingsUtilImpl extends ShowSettingsUtil {
@Override
public void showSettingsDialog(@Nullable final Project project, @NotNull final String nameToSelect) {
- ConfigurableGroup[] group;
- if (project == null) {
- group = new ConfigurableGroup[]{new IdeConfigurablesGroup()};
- }
- else {
- group = new ConfigurableGroup[]{new ProjectConfigurablesGroup(project), new IdeConfigurablesGroup()};
- }
+ ConfigurableGroup[] group = getConfigurableGroups(project, true);
- Project actualProject = project != null ? project : ProjectManager.getInstance().getDefaultProject();
+ Project actualProject = getProject(project);
group = filterEmptyGroups(group);
@@ -133,15 +156,9 @@ public class ShowSettingsUtilImpl extends ShowSettingsUtil {
}
public static void showSettingsDialog(@Nullable Project project, final String id2Select, final String filter) {
- ConfigurableGroup[] group;
- if (project == null) {
- group = new ConfigurableGroup[]{new IdeConfigurablesGroup()};
- }
- else {
- group = new ConfigurableGroup[]{new ProjectConfigurablesGroup(project), new IdeConfigurablesGroup()};
- }
+ ConfigurableGroup[] group = getConfigurableGroups(project, true);
- Project actualProject = project != null ? project : ProjectManager.getInstance().getDefaultProject();
+ Project actualProject = getProject(project);
group = filterEmptyGroups(group);
final Configurable configurable2Select = findConfigurable2Select(id2Select, group);
@@ -191,10 +208,7 @@ public class ShowSettingsUtilImpl extends ShowSettingsUtil {
@Override
public void showSettingsDialog(@NotNull final Project project, final Configurable toSelect) {
- _showSettingsDialog(project, new ConfigurableGroup[]{
- new ProjectConfigurablesGroup(project),
- new IdeConfigurablesGroup()
- }, toSelect);
+ getDialog(project, getConfigurableGroups(project, true), toSelect).show();
}
@NotNull
diff --git a/platform/platform-impl/src/com/intellij/ide/actions/TemplateProjectPropertiesAction.java b/platform/platform-impl/src/com/intellij/ide/actions/TemplateProjectPropertiesAction.java
index 75657c517ecb..6c2b7d8e62f6 100644
--- a/platform/platform-impl/src/com/intellij/ide/actions/TemplateProjectPropertiesAction.java
+++ b/platform/platform-impl/src/com/intellij/ide/actions/TemplateProjectPropertiesAction.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,7 +18,6 @@ package com.intellij.ide.actions;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.options.ShowSettingsUtil;
-import com.intellij.openapi.options.ex.ProjectConfigurablesGroup;
import com.intellij.openapi.project.DumbAware;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.project.ex.ProjectManagerEx;
@@ -26,6 +25,6 @@ import com.intellij.openapi.project.ex.ProjectManagerEx;
public class TemplateProjectPropertiesAction extends AnAction implements DumbAware {
public void actionPerformed(AnActionEvent e) {
Project defaultProject = ProjectManagerEx.getInstanceEx().getDefaultProject();
- ShowSettingsUtil.getInstance().showSettingsDialog(defaultProject, new ProjectConfigurablesGroup(defaultProject));
+ ShowSettingsUtil.getInstance().showSettingsDialog(defaultProject, ShowSettingsUtilImpl.getConfigurableGroups(defaultProject, false));
}
}
diff --git a/platform/platform-impl/src/com/intellij/ide/customize/PluginGroups.java b/platform/platform-impl/src/com/intellij/ide/customize/PluginGroups.java
index de154f249c9e..930901d55105 100644
--- a/platform/platform-impl/src/com/intellij/ide/customize/PluginGroups.java
+++ b/platform/platform-impl/src/com/intellij/ide/customize/PluginGroups.java
@@ -17,6 +17,7 @@ package com.intellij.ide.customize;
import com.intellij.ide.plugins.IdeaPluginDescriptor;
import com.intellij.ide.plugins.PluginManager;
+import com.intellij.ide.plugins.PluginManagerCore;
import com.intellij.ide.plugins.RepositoryHelper;
import com.intellij.idea.StartupUtil;
import com.intellij.openapi.application.PathManager;
@@ -58,14 +59,14 @@ class PluginGroups {
}
private PluginGroups() {
- myAllPlugins = PluginManager.loadDescriptors(null);
+ myAllPlugins = PluginManagerCore.loadDescriptors(null);
try {
myPluginsFromRepository.addAll(RepositoryHelper.loadPluginsFromRepository(null));
}
catch (Exception e) {
//OK, it's offline
}
- PluginManager.loadDisabledPlugins(new File(PathManager.getConfigPath()).getPath(), myDisabledPluginIds);
+ PluginManagerCore.loadDisabledPlugins(new File(PathManager.getConfigPath()).getPath(), myDisabledPluginIds);
myTree.put(CORE, Pair.create((String)null, Arrays.asList(
@@ -74,7 +75,6 @@ class PluginGroups {
"org.intellij.intelliLang",
"com.intellij.properties",
"Refactor-X",//?
- "Structural Search",
"Type Migration",
"ZKM"
)));
diff --git a/platform/platform-impl/src/com/intellij/ide/file/BatchFileChangeListener.java b/platform/platform-impl/src/com/intellij/ide/file/BatchFileChangeListener.java
new file mode 100644
index 000000000000..593c39885a46
--- /dev/null
+++ b/platform/platform-impl/src/com/intellij/ide/file/BatchFileChangeListener.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.ide.file;
+
+import com.intellij.openapi.project.Project;
+import com.intellij.util.messages.Topic;
+
+/**
+ * This listener is notified when some operation performs a massive batch file change, and when this change is completed.
+ * <p/>
+ * To subscribe to such batch file changes, connect to the Project's {@link com.intellij.util.messages.MessageBus}
+ * via the {@link #TOPIC} defined below.
+ */
+public interface BatchFileChangeListener {
+
+ Topic<BatchFileChangeListener> TOPIC = Topic.create("Batch File Update", BatchFileChangeListener.class);
+
+ class Adapter implements BatchFileChangeListener {
+ @Override
+ public void batchChangeStarted(Project project) {
+ }
+ @Override
+ public void batchChangeCompleted(Project project) {
+ }
+ }
+
+
+ void batchChangeStarted(Project project);
+
+ void batchChangeCompleted(Project project);
+
+}
diff --git a/platform/platform-impl/src/com/intellij/ide/passwordSafe/HelpID.java b/platform/platform-impl/src/com/intellij/ide/passwordSafe/HelpID.java
index b05021ff7d72..a805638501be 100644
--- a/platform/platform-impl/src/com/intellij/ide/passwordSafe/HelpID.java
+++ b/platform/platform-impl/src/com/intellij/ide/passwordSafe/HelpID.java
@@ -24,6 +24,8 @@ import org.jetbrains.annotations.NonNls;
* Time: 2:09 PM
*/
public interface HelpID {
- @NonNls String RESET_PASSWORD = "reference_ide_settings_master_password_reset";
- @NonNls String CHANGE_PASSWORD = "reference_settings_password_safe_master_password";
+ @NonNls String INIT_PASSWORD = "settings_passwords_master_password_init";
+ @NonNls String ENTER_PASSWORD = "settings_passwords_master_password_enter";
+ @NonNls String RESET_PASSWORD = "settings_passwords_master_password_reset";
+ @NonNls String CHANGE_PASSWORD = "settings_passwords_master_password_change";
}
diff --git a/platform/platform-impl/src/com/intellij/ide/passwordSafe/PasswordStorage.java b/platform/platform-impl/src/com/intellij/ide/passwordSafe/PasswordStorage.java
index b1ea1332986e..e5b9f1530256 100644
--- a/platform/platform-impl/src/com/intellij/ide/passwordSafe/PasswordStorage.java
+++ b/platform/platform-impl/src/com/intellij/ide/passwordSafe/PasswordStorage.java
@@ -25,15 +25,21 @@ import org.jetbrains.annotations.Nullable;
* The interface defines basic password management operations
*/
public interface PasswordStorage {
+
/**
- * <p>Get password stored in a password safe.</p>
- *
- * <p><b>NB: </b>
- * This method may be called from the background,
- * and it may need to ask user to enter the master password to access the database by calling
- * {@link Application#invokeAndWait(Runnable, ModalityState) invokeAndWait()} to show a modal dialog.
- * So make sure not to call it from the read action.
- * Calling this method from the dispatch thread is allowed.</p>
+ * @deprecated To remove in IDEA 15. Use {@link #getPassword(Project, Class, String, ModalityState)}
+ */
+ @Deprecated
+ @Nullable
+ String getPassword(@Nullable Project project, @NotNull Class requestor, String key) throws PasswordSafeException;
+
+ /**
+ * Get password stored in a password safe.
+ * <p/>
+ * The method may be called from any thread. It may need to show a master password dialog to unlock the password database,
+ * and then will use {@link Application#invokeAndWait(Runnable, ModalityState) invokeAndWait()}.
+ * So make sure to pass correct {@link ModalityState} to the method to make sure the dialog is shown above all other dialog or progress
+ * windows.
*
* @param project the project, that is used to ask for the master password if this is the first access to password safe
* @param requestor the requestor class
@@ -43,25 +49,53 @@ public interface PasswordStorage {
* @throws IllegalStateException if the method is called from the read action.
*/
@Nullable
- String getPassword(@Nullable Project project, @NotNull Class requestor, String key) throws PasswordSafeException;
+ String getPassword(@Nullable Project project, @NotNull Class requestor, String key,
+ @Nullable ModalityState state) throws PasswordSafeException;
+
/**
- * Remove password stored in a password safe
+ * Store password in password safe
+ * <p/>
+ * The method may be called from any thread. It may need to show a master password dialog to unlock the password database,
+ * and then will use {@link Application#invokeAndWait(Runnable, ModalityState) invokeAndWait()}.
+ * So make sure to pass correct {@link ModalityState} to the method to make sure the dialog is shown above all other dialog or progress
+ * windows.
*
* @param project the project, that is used to ask for the master password if this is the first access to password safe
* @param requestor the requestor class
* @param key the key for the password
- * @return the plugin key
+ * @param value the value to store
* @throws PasswordSafeException if password safe cannot be accessed
*/
+ void storePassword(@Nullable Project project, @NotNull Class requestor, String key, String value,
+ @Nullable ModalityState modalityState) throws PasswordSafeException;
+
+ /**
+ * @deprecated To remove in IDEA 15. Use {@link #storePassword(Project, Class, String, String, ModalityState)}
+ */
+ @Deprecated
+ void storePassword(@Nullable Project project, @NotNull Class requestor, String key, String value) throws PasswordSafeException;
+
+ /**
+ * @deprecated To remove in IDEA 15. Use {@link #removePassword(Project, Class, String, ModalityState)}
+ */
+ @Deprecated
void removePassword(@Nullable Project project, @NotNull Class requestor, String key) throws PasswordSafeException;
+
/**
- * Store password in password safe
+ * Remove password stored in a password safe
+ * <p/>
+ * The method may be called from any thread. It may need to show a master password dialog to unlock the password database,
+ * and then will use {@link Application#invokeAndWait(Runnable, ModalityState) invokeAndWait()}.
+ * So make sure to pass correct {@link ModalityState} to the method to make sure the dialog is shown above all other dialog or progress
+ * windows.
*
* @param project the project, that is used to ask for the master password if this is the first access to password safe
* @param requestor the requestor class
* @param key the key for the password
- * @param value the value to store
+ * @return the plugin key
* @throws PasswordSafeException if password safe cannot be accessed
*/
- void storePassword(@Nullable Project project, @NotNull Class requestor, String key, String value) throws PasswordSafeException;
+ void removePassword(@Nullable Project project, @NotNull Class requestor, String key,
+ @Nullable ModalityState modalityState) throws PasswordSafeException;
+
}
diff --git a/platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/PasswordSafeImpl.java b/platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/PasswordSafeImpl.java
index 11dc4d7d018b..34aee7aaad38 100644
--- a/platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/PasswordSafeImpl.java
+++ b/platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/PasswordSafeImpl.java
@@ -22,42 +22,19 @@ import com.intellij.ide.passwordSafe.impl.providers.masterKey.MasterKeyPasswordS
import com.intellij.ide.passwordSafe.impl.providers.masterKey.PasswordDatabase;
import com.intellij.ide.passwordSafe.impl.providers.memory.MemoryPasswordSafe;
import com.intellij.ide.passwordSafe.impl.providers.nil.NilProvider;
+import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
-/**
- * The implementation of password safe service
- */
public class PasswordSafeImpl extends PasswordSafe {
- /**
- * The logger instance
- */
private static final Logger LOG = Logger.getInstance(PasswordSafeImpl.class.getName());
- /**
- * The current settings
- */
private final PasswordSafeSettings mySettings;
- /**
- * The master key provider
- */
private final MasterKeyPasswordSafe myMasterKeyProvider;
- /**
- * The nil provider
- */
private final NilProvider myNilProvider;
- /**
- * The memory provider
- */
private final MemoryPasswordSafe myMemoryProvider;
- /**
- * The constructor
- *
- * @param settings the settings for the password safe
- * @param database the password database
- */
public PasswordSafeImpl(PasswordSafeSettings settings, PasswordDatabase database) {
mySettings = settings;
myMasterKeyProvider = new MasterKeyPasswordSafe(database);
@@ -89,21 +66,24 @@ public class PasswordSafeImpl extends PasswordSafe {
return p;
}
-
- /**
- * @return settings for the passwords safe
- */
public PasswordSafeSettings getSettings() {
return mySettings;
}
-
@Nullable
+ @Override
public String getPassword(@Nullable Project project, @NotNull Class requester, String key) throws PasswordSafeException {
+ return getPassword(project, requester, key, null);
+ }
+
+ @Nullable
+ @Override
+ public String getPassword(@Nullable Project project, @NotNull Class requester, String key,
+ @Nullable ModalityState modalityState) throws PasswordSafeException {
if (mySettings.getProviderType().equals(PasswordSafeSettings.ProviderType.MASTER_PASSWORD)) {
- String password = getMemoryProvider().getPassword(project, requester, key);
+ String password = getMemoryProvider().getPassword(project, requester, key, modalityState);
if (password == null) {
- password = provider().getPassword(project, requester, key);
+ password = provider().getPassword(project, requester, key, modalityState);
if (password != null) {
// cache the password in memory as well for easier access during the session
getMemoryProvider().storePassword(project, requester, key, password);
@@ -111,27 +91,35 @@ public class PasswordSafeImpl extends PasswordSafe {
}
return password;
}
- return provider().getPassword(project, requester, key);
+ return provider().getPassword(project, requester, key, modalityState);
}
- /**
- * {@inheritDoc}
- */
- public void removePassword(@Nullable Project project, @NotNull Class requester, String key) throws PasswordSafeException {
+ @Override
+ public void removePassword(@Nullable Project project, @NotNull Class requestor, String key) throws PasswordSafeException {
+ removePassword(project, requestor, key, null);
+ }
+
+ @Override
+ public void removePassword(@Nullable Project project, @NotNull Class requester, String key,
+ @Nullable ModalityState modalityState) throws PasswordSafeException {
if (mySettings.getProviderType().equals(PasswordSafeSettings.ProviderType.MASTER_PASSWORD)) {
getMemoryProvider().removePassword(project, requester, key);
}
- provider().removePassword(project, requester, key);
+ provider().removePassword(project, requester, key, modalityState);
}
- /**
- * {@inheritDoc}
- */
- public void storePassword(@Nullable Project project, @NotNull Class requester, String key, String value) throws PasswordSafeException {
+ @Override
+ public void storePassword(@Nullable Project project, @NotNull Class requestor, String key, String value) throws PasswordSafeException {
+ storePassword(project, requestor, key, value, null);
+ }
+
+ @Override
+ public void storePassword(@Nullable Project project, @NotNull Class requester, String key, String value,
+ @Nullable ModalityState modalityState) throws PasswordSafeException {
if (mySettings.getProviderType().equals(PasswordSafeSettings.ProviderType.MASTER_PASSWORD)) {
getMemoryProvider().storePassword(project, requester, key, value);
}
- provider().storePassword(project, requester, key, value);
+ provider().storePassword(project, requester, key, value, modalityState);
}
/**
diff --git a/platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/PasswordSafeProvider.java b/platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/PasswordSafeProvider.java
index 18dee7c755f5..3a40d617e99b 100644
--- a/platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/PasswordSafeProvider.java
+++ b/platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/PasswordSafeProvider.java
@@ -15,7 +15,11 @@
*/
package com.intellij.ide.passwordSafe.impl;
+import com.intellij.ide.passwordSafe.PasswordSafeException;
import com.intellij.ide.passwordSafe.PasswordStorage;
+import com.intellij.openapi.project.Project;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
/**
* The provider for password safe component
@@ -34,4 +38,21 @@ public abstract class PasswordSafeProvider implements PasswordStorage {
* @return the name of provider
*/
public abstract String getName();
+
+ @Nullable
+ @Override
+ public String getPassword(@Nullable Project project, @NotNull Class requestor, String key) throws PasswordSafeException {
+ return getPassword(project, requestor, key, null);
+ }
+
+ @Override
+ public void storePassword(@Nullable Project project, @NotNull Class requestor, String key, String value) throws PasswordSafeException {
+ storePassword(project, requestor, key, value, null);
+ }
+
+ @Override
+ public void removePassword(@Nullable Project project, @NotNull Class requestor, String key) throws PasswordSafeException {
+ removePassword(project, requestor, key, null);
+ }
+
}
diff --git a/platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/BasePasswordSafeProvider.java b/platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/BasePasswordSafeProvider.java
index c72c65d0d528..8c8f921f18b8 100644
--- a/platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/BasePasswordSafeProvider.java
+++ b/platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/BasePasswordSafeProvider.java
@@ -43,16 +43,15 @@ public abstract class BasePasswordSafeProvider extends PasswordSafeProvider {
* @throws PasswordSafeException in case of problems with access to the password database.
* @throws IllegalStateException if the method is called from the read action.
*/
- protected abstract byte[] key(@Nullable Project project, @NotNull Class requestor) throws PasswordSafeException;
+ protected abstract byte[] key(@Nullable Project project, @NotNull Class requestor,
+ @Nullable ModalityState modalityState) throws PasswordSafeException;
- /**
- * {@inheritDoc}
- */
@Nullable
- public String getPassword(@Nullable Project project, @NotNull Class requestor, String key) throws PasswordSafeException {
- byte[] k = dbKey(project, requestor, key);
+ public String getPassword(@Nullable Project project, @NotNull Class requestor, String key,
+ @Nullable ModalityState modalityState) throws PasswordSafeException {
+ byte[] k = dbKey(project, requestor, key, modalityState);
byte[] ct = getEncryptedPassword(k);
- return ct == null ? null : EncryptionUtil.decryptText(key(project, requestor), ct);
+ return ct == null ? null : EncryptionUtil.decryptText(key(project, requestor, modalityState), ct);
}
/**
@@ -69,17 +68,17 @@ public abstract class BasePasswordSafeProvider extends PasswordSafeProvider {
* @param project
* @param requestor the requestor class
* @param key the key to use
+ * @param modalityState
* @return the key to use for map
*/
- private byte[] dbKey(@Nullable Project project, Class requestor, String key) throws PasswordSafeException {
- return EncryptionUtil.dbKey(key(project, requestor), requestor, key);
+ private byte[] dbKey(@Nullable Project project, @NotNull Class requestor, String key,
+ @Nullable ModalityState modalityState) throws PasswordSafeException {
+ return EncryptionUtil.dbKey(key(project, requestor, modalityState), requestor, key);
}
- /**
- * {@inheritDoc}
- */
- public void removePassword(@Nullable Project project, @NotNull Class requester, String key) throws PasswordSafeException {
- byte[] k = dbKey(project, requester, key);
+ public void removePassword(@Nullable Project project, @NotNull Class requester, String key,
+ @Nullable ModalityState modalityState) throws PasswordSafeException {
+ byte[] k = dbKey(project, requester, key, modalityState);
removeEncryptedPassword(k);
}
@@ -90,12 +89,10 @@ public abstract class BasePasswordSafeProvider extends PasswordSafeProvider {
*/
protected abstract void removeEncryptedPassword(byte[] key);
- /**
- * {@inheritDoc}
- */
- public void storePassword(@Nullable Project project, @NotNull Class requestor, String key, String value) throws PasswordSafeException {
- byte[] k = dbKey(project, requestor, key);
- byte[] ct = EncryptionUtil.encryptText(key(project, requestor), value);
+ public void storePassword(@Nullable Project project, @NotNull Class requestor, String key, String value,
+ @Nullable ModalityState modalityState) throws PasswordSafeException {
+ byte[] k = dbKey(project, requestor, key, modalityState);
+ byte[] ct = EncryptionUtil.encryptText(key(project, requestor, modalityState), value);
storeEncryptedPassword(k, ct);
}
diff --git a/platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/masterKey/EnterPasswordComponent.java b/platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/masterKey/EnterPasswordComponent.java
index 638e2e23c1f9..304b31e3bee1 100644
--- a/platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/masterKey/EnterPasswordComponent.java
+++ b/platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/masterKey/EnterPasswordComponent.java
@@ -16,6 +16,7 @@
package com.intellij.ide.passwordSafe.impl.providers.masterKey;
import com.intellij.ide.TypePresentationService;
+import com.intellij.ide.passwordSafe.HelpID;
import com.intellij.openapi.ui.ValidationInfo;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NotNull;
@@ -46,4 +47,9 @@ public class EnterPasswordComponent extends PasswordComponentBase {
String password = new String(myPasswordField.getPassword());
return mySafe.changeMasterPassword(password, password, myEncryptCheckBox.isSelected());
}
+
+ @Override
+ public String getHelpId() {
+ return HelpID.ENTER_PASSWORD;
+ }
}
diff --git a/platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/masterKey/MasterKeyPasswordSafe.java b/platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/masterKey/MasterKeyPasswordSafe.java
index 95fba48afabe..b74e51315cd5 100644
--- a/platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/masterKey/MasterKeyPasswordSafe.java
+++ b/platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/masterKey/MasterKeyPasswordSafe.java
@@ -42,17 +42,8 @@ import java.util.concurrent.atomic.AtomicReference;
* The password safe that stores information in configuration file encrypted by master password
*/
public class MasterKeyPasswordSafe extends BasePasswordSafeProvider {
- /**
- * The test password key
- */
private static final String TEST_PASSWORD_KEY = "TEST_PASSWORD:";
- /**
- * The test password value
- */
private static final String TEST_PASSWORD_VALUE = "test password";
- /**
- * The password database instance
- */
final PasswordDatabase database;
/**
* The key to use to encrypt data
@@ -68,18 +59,10 @@ public class MasterKeyPasswordSafe extends BasePasswordSafeProvider {
}
};
- /**
- * The constructor
- *
- * @param database the password database
- */
public MasterKeyPasswordSafe(PasswordDatabase database) {
this.database = database;
}
- /**
- * @return true if the component is running in the test mode
- */
protected boolean isTestMode() {
return false;
}
@@ -130,7 +113,6 @@ public class MasterKeyPasswordSafe extends BasePasswordSafeProvider {
else {
return true;
}
-
}
/**
@@ -167,18 +149,13 @@ public class MasterKeyPasswordSafe extends BasePasswordSafeProvider {
}
- /**
- * The test key
- *
- * @param password the password for the test key
- * @return the test key
- */
private static String testKey(String password) {
return TEST_PASSWORD_KEY + password;
}
@Override
- protected byte[] key(@Nullable final Project project, @NotNull final Class requestor) throws PasswordSafeException {
+ protected byte[] key(@Nullable final Project project, @NotNull final Class requestor,
+ @Nullable ModalityState modalityState) throws PasswordSafeException {
Application application = ApplicationManager.getApplication();
if (!isTestMode() && application.isHeadlessEnvironment()) {
throw new MasterPasswordUnavailableException("The provider is not available in headless environment");
@@ -223,7 +200,7 @@ public class MasterKeyPasswordSafe extends BasePasswordSafeProvider {
}
}
}
- }, ModalityState.defaultModalityState());
+ }, modalityState == null ? ModalityState.defaultModalityState() : modalityState);
//noinspection ThrowableResultOfMethodCallIgnored
if (ex.get() != null) {
throw ex.get();
@@ -233,20 +210,15 @@ public class MasterKeyPasswordSafe extends BasePasswordSafeProvider {
return result.get();
}
- /**
- * {@inheritDoc}
- */
@Override
- public String getPassword(@Nullable Project project, @NotNull Class requestor, String key) throws PasswordSafeException {
+ public String getPassword(@Nullable Project project, @NotNull Class requestor, String key,
+ @Nullable ModalityState modalityState) throws PasswordSafeException {
if (database.isEmpty()) {
return null;
}
- return super.getPassword(project, requestor, key);
+ return super.getPassword(project, requestor, key, modalityState);
}
- /**
- * {@inheritDoc}
- */
@Override
public void removePassword(@Nullable Project project, @NotNull Class requester, String key) throws PasswordSafeException {
if (database.isEmpty()) {
@@ -255,50 +227,32 @@ public class MasterKeyPasswordSafe extends BasePasswordSafeProvider {
super.removePassword(project, requester, key);
}
- /**
- * {@inheritDoc}
- */
@Override
protected byte[] getEncryptedPassword(byte[] key) {
return database.get(key);
}
- /**
- * {@inheritDoc}
- */
@Override
protected void removeEncryptedPassword(byte[] key) {
database.remove(key);
}
- /**
- * {@inheritDoc}
- */
@Override
protected void storeEncryptedPassword(byte[] key, byte[] encryptedPassword) {
database.put(key, encryptedPassword);
}
- /**
- * {@inheritDoc}
- */
@Override
public boolean isSupported() {
return !ApplicationManager.getApplication().isHeadlessEnvironment();
}
- /**
- * {@inheritDoc}
- */
@Override
public String getDescription() {
return "This provider stores passwords in IDEA config and uses master password to encrypt other passwords. " +
"The passwords for the same resources are shared between different projects.";
}
- /**
- * {@inheritDoc}
- */
@Override
public String getName() {
return "Master Key PasswordSafe";
@@ -309,9 +263,6 @@ public class MasterKeyPasswordSafe extends BasePasswordSafeProvider {
return setMasterPassword("");
}
- /**
- * @return true, if OS protected passwords are supported for the current platform
- */
@SuppressWarnings({"MethodMayBeStatic"})
public boolean isOsProtectedPasswordSupported() {
// TODO extension point needed?
@@ -351,9 +302,6 @@ public class MasterKeyPasswordSafe extends BasePasswordSafeProvider {
}
}
- /**
- * @return true, if the password is currently encrypted in the database
- */
public boolean isPasswordEncrypted() {
if (!isOsProtectedPasswordSupported()) return false;
@@ -361,9 +309,6 @@ public class MasterKeyPasswordSafe extends BasePasswordSafeProvider {
return i != null && i.length > 0;
}
- /**
- * @return check if provider database is empty
- */
public boolean isEmpty() {
return database.isEmpty();
}
diff --git a/platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/masterKey/ResetPasswordComponent.java b/platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/masterKey/ResetPasswordComponent.java
index ce75bdb2165a..faa36c121ec9 100644
--- a/platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/masterKey/ResetPasswordComponent.java
+++ b/platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/masterKey/ResetPasswordComponent.java
@@ -49,7 +49,7 @@ public class ResetPasswordComponent extends PasswordComponentBase {
@Override
public String getHelpId() {
- return HelpID.RESET_PASSWORD;
+ return myFirstTime ? HelpID.INIT_PASSWORD : HelpID.RESET_PASSWORD;
}
@Override
diff --git a/platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/memory/MemoryPasswordSafe.java b/platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/memory/MemoryPasswordSafe.java
index 5be4a25df859..da82bb986fdb 100644
--- a/platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/memory/MemoryPasswordSafe.java
+++ b/platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/memory/MemoryPasswordSafe.java
@@ -19,10 +19,12 @@ import com.intellij.ide.passwordSafe.impl.PasswordSafeTimed;
import com.intellij.ide.passwordSafe.impl.providers.BasePasswordSafeProvider;
import com.intellij.ide.passwordSafe.impl.providers.ByteArrayWrapper;
import com.intellij.ide.passwordSafe.impl.providers.EncryptionUtil;
+import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
import java.security.SecureRandom;
import java.util.Collections;
@@ -57,13 +59,8 @@ public class MemoryPasswordSafe extends BasePasswordSafeProvider {
return Registry.intValue("passwordSafe.memorySafe.ttl");
}
- /**
- * @param project the project to use
- * @param requestor
- * @return the secret key used by provider
- */
@Override
- protected byte[] key(Project project, @NotNull Class requestor) {
+ protected byte[] key(Project project, @NotNull Class requestor, @Nullable ModalityState modalityState) {
if (key.get() == null) {
byte[] rnd = new byte[EncryptionUtil.SECRET_KEY_SIZE_BYTES * 16];
new SecureRandom().nextBytes(rnd);
@@ -72,49 +69,31 @@ public class MemoryPasswordSafe extends BasePasswordSafeProvider {
return key.get();
}
- /**
- * {@inheritDoc}
- */
@Override
protected byte[] getEncryptedPassword(byte[] key) {
return database.get().get(new ByteArrayWrapper(key));
}
- /**
- * {@inheritDoc}
- */
@Override
protected void removeEncryptedPassword(byte[] key) {
database.get().remove(new ByteArrayWrapper(key));
}
- /**
- * {@inheritDoc}
- */
@Override
protected void storeEncryptedPassword(byte[] key, byte[] encryptedPassword) {
database.get().put(new ByteArrayWrapper(key), encryptedPassword);
}
- /**
- * {@inheritDoc}
- */
@Override
public boolean isSupported() {
return true;
}
- /**
- * {@inheritDoc}
- */
@Override
public String getDescription() {
return "Memory-based password safe provider. The passwords are stored only for the duration of IDEA process.";
}
- /**
- * {@inheritDoc}
- */
@Override
public String getName() {
return "Memory PasswordSafe";
diff --git a/platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/nil/NilProvider.java b/platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/nil/NilProvider.java
index 581df18ea317..e3a77325b06e 100644
--- a/platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/nil/NilProvider.java
+++ b/platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/nil/NilProvider.java
@@ -17,6 +17,7 @@ package com.intellij.ide.passwordSafe.impl.providers.nil;
import com.intellij.ide.passwordSafe.PasswordSafeException;
import com.intellij.ide.passwordSafe.impl.PasswordSafeProvider;
+import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.project.Project;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -25,49 +26,38 @@ import org.jetbrains.annotations.Nullable;
* The most secure provider that does not store anything, so it cannot be cracked
*/
public final class NilProvider extends PasswordSafeProvider {
- /**
- * {@inheritDoc}
- */
+
@Override
public boolean isSupported() {
return true;
}
- /**
- * {@inheritDoc}
- */
@Override
public String getDescription() {
return "The provider that does not remembers password.";
}
- /**
- * {@inheritDoc}
- */
@Override
public String getName() {
return "Do not Store";
}
- /**
- * {@inheritDoc}
- */
- public String getPassword(@Nullable Project project, @NotNull Class requester, String key) throws PasswordSafeException {
+ @Nullable
+ public String getPassword(@Nullable Project project, @NotNull Class requester, String key,
+ @Nullable ModalityState modalityState) throws PasswordSafeException {
// nothing is stored
return null;
}
- /**
- * {@inheritDoc}
- */
- public void removePassword(@Nullable Project project, @NotNull Class requester, String key) throws PasswordSafeException {
+ @Override
+ public void removePassword(@Nullable Project project, @NotNull Class requester, String key,
+ @Nullable ModalityState modalityState) throws PasswordSafeException {
// do nothing
}
- /**
- * {@inheritDoc}
- */
- public void storePassword(@Nullable Project project, @NotNull Class requester, String key, String value) throws PasswordSafeException {
+ @Override
+ public void storePassword(@Nullable Project project, @NotNull Class requester, String key, String value,
+ @Nullable ModalityState modalityState) throws PasswordSafeException {
// just forget about password
}
}
diff --git a/platform/platform-impl/src/com/intellij/ide/passwordSafe/ui/PasswordSafePromptDialog.java b/platform/platform-impl/src/com/intellij/ide/passwordSafe/ui/PasswordSafePromptDialog.java
index def7aa96ce9b..353e836f3f33 100644
--- a/platform/platform-impl/src/com/intellij/ide/passwordSafe/ui/PasswordSafePromptDialog.java
+++ b/platform/platform-impl/src/com/intellij/ide/passwordSafe/ui/PasswordSafePromptDialog.java
@@ -176,7 +176,7 @@ public class PasswordSafePromptDialog extends DialogWrapper {
ps.removePassword(project, requestor, key);
}
else {
- String pw = ps.getPassword(project, requestor, key);
+ String pw = ps.getPassword(project, requestor, key, modalityState);
if (pw != null) {
return pw;
}
diff --git a/platform/platform-impl/src/com/intellij/ide/plugins/PluginInstaller.java b/platform/platform-impl/src/com/intellij/ide/plugins/PluginInstaller.java
index 7919d1f894d0..b093773bc0fb 100644
--- a/platform/platform-impl/src/com/intellij/ide/plugins/PluginInstaller.java
+++ b/platform/platform-impl/src/com/intellij/ide/plugins/PluginInstaller.java
@@ -159,33 +159,35 @@ public class PluginInstaller {
}
}
- synchronized (myLock) {
- PluginDownloader downloader = null;
- final String repositoryName = pluginNode.getRepositoryName();
- if (repositoryName != null) {
- try {
- final Map<PluginId, PluginDownloader> downloaders = new HashMap<PluginId, PluginDownloader>();
- if (!UpdateChecker.checkPluginsHost(repositoryName, downloaders)) {
- return false;
- }
- downloader = downloaders.get(pluginNode.getPluginId());
- if (downloader == null) return false;
- }
- catch (Exception e) {
+ PluginDownloader downloader = null;
+ final String repositoryName = pluginNode.getRepositoryName();
+ if (repositoryName != null) {
+ try {
+ final Map<PluginId, PluginDownloader> downloaders = new HashMap<PluginId, PluginDownloader>();
+ if (!UpdateChecker.checkPluginsHost(repositoryName, downloaders)) {
return false;
}
+ downloader = downloaders.get(pluginNode.getPluginId());
+ if (downloader == null) return false;
}
- else {
- downloader = PluginDownloader.createDownloader(pluginNode);
+ catch (Exception e) {
+ return false;
}
- if (downloader.prepareToInstall(ProgressManager.getInstance().getProgressIndicator())) {
+ }
+ else {
+ downloader = PluginDownloader.createDownloader(pluginNode);
+ }
+
+ if (downloader.prepareToInstall(ProgressManager.getInstance().getProgressIndicator())) {
+ synchronized (myLock) {
downloader.install();
- pluginNode.setStatus(PluginNode.STATUS_DOWNLOADED);
- }
- else {
- return false;
}
+ pluginNode.setStatus(PluginNode.STATUS_DOWNLOADED);
+ }
+ else {
+ return false;
}
+
return true;
}
diff --git a/platform/platform-impl/src/com/intellij/ide/plugins/PluginManagerMain.java b/platform/platform-impl/src/com/intellij/ide/plugins/PluginManagerMain.java
index 49b20d27a585..20a41e3a886a 100644
--- a/platform/platform-impl/src/com/intellij/ide/plugins/PluginManagerMain.java
+++ b/platform/platform-impl/src/com/intellij/ide/plugins/PluginManagerMain.java
@@ -49,6 +49,7 @@ import com.intellij.openapi.util.text.StringUtil;
import com.intellij.ui.*;
import com.intellij.ui.border.CustomLineBorder;
import com.intellij.ui.components.JBLabel;
+import com.intellij.ui.speedSearch.SpeedSearchSupply;
import com.intellij.util.concurrency.SwingWorker;
import com.intellij.util.ui.UIUtil;
import com.intellij.util.ui.update.UiNotifyConnector;
@@ -663,7 +664,7 @@ public abstract class PluginManagerMain implements Disposable {
app.restart(true);
}
else {
- app.exit(true);
+ app.exit(false, true);
}
}
}).notify(project);
@@ -676,6 +677,7 @@ public abstract class PluginManagerMain implements Disposable {
}
public void filter() {
+ getPluginTable().putClientProperty(SpeedSearchSupply.SEARCH_QUERY_KEY, getFilter());
pluginsModel.filter(getFilter().toLowerCase());
TableUtil.ensureSelectionExists(getPluginTable());
}
diff --git a/platform/platform-impl/src/com/intellij/ide/plugins/PluginsTableRenderer.form b/platform/platform-impl/src/com/intellij/ide/plugins/PluginsTableRenderer.form
index 2e09735db57f..1791089faf85 100644
--- a/platform/platform-impl/src/com/intellij/ide/plugins/PluginsTableRenderer.form
+++ b/platform/platform-impl/src/com/intellij/ide/plugins/PluginsTableRenderer.form
@@ -69,13 +69,11 @@
<size top="0" left="0" bottom="2" right="0"/>
</border>
<children>
- <component id="a5e28" class="com.intellij.ui.components.JBLabel" binding="myName">
+ <component id="edd99" class="com.intellij.ui.SimpleColoredComponent" binding="myName">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
- <properties>
- <text value="Plugin Name"/>
- </properties>
+ <properties/>
</component>
</children>
</grid>
diff --git a/platform/platform-impl/src/com/intellij/ide/plugins/PluginsTableRenderer.java b/platform/platform-impl/src/com/intellij/ide/plugins/PluginsTableRenderer.java
index be7fd44fb7cc..c90306210856 100644
--- a/platform/platform-impl/src/com/intellij/ide/plugins/PluginsTableRenderer.java
+++ b/platform/platform-impl/src/com/intellij/ide/plugins/PluginsTableRenderer.java
@@ -23,10 +23,16 @@ import com.intellij.openapi.util.IconLoader;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vcs.FileStatus;
+import com.intellij.psi.codeStyle.NameUtil;
import com.intellij.ui.Gray;
import com.intellij.ui.JBColor;
+import com.intellij.ui.SimpleColoredComponent;
+import com.intellij.ui.SimpleTextAttributes;
+import com.intellij.ui.speedSearch.SpeedSearchSupply;
+import com.intellij.ui.speedSearch.SpeedSearchUtil;
import com.intellij.util.Function;
import com.intellij.util.text.DateFormatUtil;
+import com.intellij.util.text.Matcher;
import com.intellij.util.ui.UIUtil;
import javax.swing.*;
@@ -40,7 +46,7 @@ import java.util.Set;
* @author Konstantin Bulenkov
*/
public class PluginsTableRenderer extends DefaultTableCellRenderer {
- private JLabel myName;
+ private SimpleColoredComponent myName;
private JLabel myStatus;
private RatesPanel myRating;
private JLabel myDownloads;
@@ -85,7 +91,23 @@ public class PluginsTableRenderer extends DefaultTableCellRenderer {
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
if (myPluginDescriptor != null) {
final PluginId pluginId = myPluginDescriptor.getPluginId();
- myName.setText(myPluginDescriptor.getName() + " ");
+ myName.clear();
+ myName.setOpaque(false);
+ String pluginName = myPluginDescriptor.getName() + " ";
+ Object query = table.getClientProperty(SpeedSearchSupply.SEARCH_QUERY_KEY);
+ if (query instanceof String) {
+ String pattern = "*" + query;
+ Matcher matcher = NameUtil.buildMatcher(pattern, 0, true, true, pattern.toLowerCase().equals(pattern));
+ SimpleTextAttributes attr = new SimpleTextAttributes(UIUtil.getListBackground(isSelected),
+ UIUtil.getListForeground(isSelected),
+ JBColor.RED,
+ SimpleTextAttributes.STYLE_PLAIN);
+
+ SpeedSearchUtil.appendColoredFragmentForMatcher(pluginName, myName, attr, matcher,
+ UIUtil.getTableBackground(isSelected), true);
+ } else {
+ myName.append(pluginName);
+ }
final Color fg = UIUtil.getTableForeground(isSelected);
final Color bg = UIUtil.getTableBackground(isSelected);
diff --git a/platform/platform-impl/src/com/intellij/ide/ui/search/SearchUtil.java b/platform/platform-impl/src/com/intellij/ide/ui/search/SearchUtil.java
index 0a7b70e07616..8febc9ad392a 100644
--- a/platform/platform-impl/src/com/intellij/ide/ui/search/SearchUtil.java
+++ b/platform/platform-impl/src/com/intellij/ide/ui/search/SearchUtil.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2012 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -17,13 +17,12 @@
package com.intellij.ide.ui.search;
import com.intellij.application.options.SkipSelfSearchComponent;
+import com.intellij.ide.actions.ShowSettingsUtilImpl;
import com.intellij.openapi.options.Configurable;
import com.intellij.openapi.options.ConfigurableGroup;
import com.intellij.openapi.options.MasterDetails;
import com.intellij.openapi.options.SearchableConfigurable;
import com.intellij.openapi.options.ex.GlassPanel;
-import com.intellij.openapi.options.ex.IdeConfigurablesGroup;
-import com.intellij.openapi.options.ex.ProjectConfigurablesGroup;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.popup.JBPopup;
import com.intellij.openapi.ui.popup.JBPopupFactory;
@@ -66,8 +65,7 @@ public class SearchUtil {
}
public static void processProjectConfigurables(Project project, HashMap<SearchableConfigurable, TreeSet<OptionDescription>> options) {
- processConfigurables(new ProjectConfigurablesGroup(project).getConfigurables(), options);
- processConfigurables(new IdeConfigurablesGroup().getConfigurables(), options);
+ processConfigurables(ShowSettingsUtilImpl.getConfigurables(project, false), options);
}
private static void processConfigurables(final Configurable[] configurables,
diff --git a/platform/platform-impl/src/com/intellij/ide/util/TipDialog.java b/platform/platform-impl/src/com/intellij/ide/util/TipDialog.java
index 33501b503477..0744e377e6c5 100644
--- a/platform/platform-impl/src/com/intellij/ide/util/TipDialog.java
+++ b/platform/platform-impl/src/com/intellij/ide/util/TipDialog.java
@@ -19,32 +19,44 @@ package com.intellij.ide.util;
import com.intellij.CommonBundle;
import com.intellij.ide.IdeBundle;
import com.intellij.internal.statistic.UsageTrigger;
+import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.openapi.ui.impl.DialogWrapperPeerImpl;
+import com.intellij.openapi.wm.ex.WindowManagerEx;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
+import java.awt.*;
import java.awt.event.ActionEvent;
public class TipDialog extends DialogWrapper{
- private final TipPanel myTipPanel;
+ private TipPanel myTipPanel;
public TipDialog(){
- super(true);
- setModal(false);
- setTitle(IdeBundle.message("title.tip.of.the.day"));
- setCancelButtonText(CommonBundle.getCloseButtonText());
- myTipPanel = new TipPanel();
- myTipPanel.nextTip();
- setHorizontalStretch(1.33f);
- setVerticalStretch(1.25f);
- init();
- if (getPeer() instanceof DialogWrapperPeerImpl) {
- ((DialogWrapperPeerImpl)getPeer()).setAutoRequestFocus(false);
- }
+ super(WindowManagerEx.getInstanceEx().findVisibleFrame(), true);
+ initialize();
+ }
+
+ public TipDialog(@NotNull final Window parent) {
+ super(parent, true);
+ initialize();
}
+ private void initialize () {
+ setModal(false);
+ setTitle(IdeBundle.message("title.tip.of.the.day"));
+ setCancelButtonText(CommonBundle.getCloseButtonText());
+ myTipPanel = new TipPanel();
+ myTipPanel.nextTip();
+ setHorizontalStretch(1.33f);
+ setVerticalStretch(1.25f);
+ init();
+ if (getPeer() instanceof DialogWrapperPeerImpl) {
+ ((DialogWrapperPeerImpl)getPeer()).setAutoRequestFocus(false);
+ }
+ }
+
@NotNull
protected Action[] createActions(){
return new Action[]{new PreviousTipAction(),new NextTipAction(),getCancelAction()};
@@ -58,6 +70,11 @@ public class TipDialog extends DialogWrapper{
super.dispose();
}
+ public static TipDialog createForProject(final Project project) {
+ final Window w = WindowManagerEx.getInstanceEx().suggestParentWindow(project);
+ return (w == null) ? new TipDialog() : new TipDialog(w);
+ }
+
private class PreviousTipAction extends AbstractAction{
public PreviousTipAction(){
super(IdeBundle.message("action.previous.tip"));
diff --git a/platform/platform-impl/src/com/intellij/idea/IdeaLogger.java b/platform/platform-impl/src/com/intellij/idea/IdeaLogger.java
index 3a8f73348640..67a7c0f88532 100644
--- a/platform/platform-impl/src/com/intellij/idea/IdeaLogger.java
+++ b/platform/platform-impl/src/com/intellij/idea/IdeaLogger.java
@@ -199,7 +199,7 @@ public class IdeaLogger extends Logger {
@Override
public String getInfo() {
final ApplicationInfoEx info = ApplicationInfoImpl.getShadowInstance();
- return info.getFullApplicationName() + " " + "Build #" + info.getBuild().asString();
+ return info.getFullApplicationName() + " " + "Build #" + info.getBuild().asStringWithAllDetails();
}
};
}
diff --git a/platform/platform-impl/src/com/intellij/idea/StartupUtil.java b/platform/platform-impl/src/com/intellij/idea/StartupUtil.java
index 54e81ab8458e..43c0a2d298f1 100755
--- a/platform/platform-impl/src/com/intellij/idea/StartupUtil.java
+++ b/platform/platform-impl/src/com/intellij/idea/StartupUtil.java
@@ -320,7 +320,7 @@ public class StartupUtil {
ApplicationInfo appInfo = ApplicationInfoImpl.getShadowInstance();
ApplicationNamesInfo namesInfo = ApplicationNamesInfo.getInstance();
String buildDate = new SimpleDateFormat("dd MMM yyyy HH:ss", Locale.US).format(appInfo.getBuildDate().getTime());
- log.info("IDE: " + namesInfo.getFullProductName() + " (build #" + appInfo.getBuild() + ", " + buildDate + ")");
+ log.info("IDE: " + namesInfo.getFullProductName() + " (build #" + appInfo.getBuild().asStringWithAllDetails() + ", " + buildDate + ")");
log.info("OS: " + SystemInfoRt.OS_NAME + " (" + SystemInfoRt.OS_VERSION + ", " + SystemInfo.OS_ARCH + ")");
log.info("JRE: " + System.getProperty("java.runtime.version", "-") + " (" + System.getProperty("java.vendor", "-") + ")");
log.info("JVM: " + System.getProperty("java.vm.version", "-") + " (" + System.getProperty("java.vm.name", "-") + ")");
diff --git a/platform/platform-impl/src/com/intellij/jps/impl/JpsIdePluginManagerImpl.java b/platform/platform-impl/src/com/intellij/jps/impl/JpsIdePluginManagerImpl.java
index 72e7b8a4973e..a4d4637fa81d 100644
--- a/platform/platform-impl/src/com/intellij/jps/impl/JpsIdePluginManagerImpl.java
+++ b/platform/platform-impl/src/com/intellij/jps/impl/JpsIdePluginManagerImpl.java
@@ -37,15 +37,26 @@ public class JpsIdePluginManagerImpl extends JpsPluginManager {
public JpsIdePluginManagerImpl() {
ExtensionsArea rootArea = Extensions.getRootArea();
- //todo[nik] introduce more generic platform extension for JPS plugins instead
+ //todo[nik] get rid of this check: currently this class is used in jps-builders tests instead of JpsPluginManagerImpl because platform-impl module is added to classpath via testFramework
+ if (rootArea.hasExtensionPoint(JpsPluginBean.EP_NAME.getName())) {
+ rootArea.getExtensionPoint(JpsPluginBean.EP_NAME).addExtensionPointListener(new ExtensionPointListener<JpsPluginBean>() {
+ @Override
+ public void extensionAdded(@NotNull JpsPluginBean extension, @Nullable PluginDescriptor pluginDescriptor) {
+ ContainerUtil.addIfNotNull(pluginDescriptor, myExternalBuildPlugins);
+ }
+
+ @Override
+ public void extensionRemoved(@NotNull JpsPluginBean extension, @Nullable PluginDescriptor pluginDescriptor) {
+ }
+ });
+ }
if (rootArea.hasExtensionPoint("com.intellij.compileServer.plugin")) {
ExtensionPoint extensionPoint = rootArea.getExtensionPoint("com.intellij.compileServer.plugin");
+ //noinspection unchecked
extensionPoint.addExtensionPointListener(new ExtensionPointListener() {
@Override
public void extensionAdded(@NotNull Object extension, @Nullable PluginDescriptor pluginDescriptor) {
- if (pluginDescriptor != null) {
- myExternalBuildPlugins.add(pluginDescriptor);
- }
+ ContainerUtil.addIfNotNull(pluginDescriptor, myExternalBuildPlugins);
}
@Override
diff --git a/platform/platform-impl/src/com/intellij/jps/impl/JpsPluginBean.java b/platform/platform-impl/src/com/intellij/jps/impl/JpsPluginBean.java
new file mode 100644
index 000000000000..4979dd78cfe6
--- /dev/null
+++ b/platform/platform-impl/src/com/intellij/jps/impl/JpsPluginBean.java
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2000-2014 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.jps.impl;
+
+import com.intellij.openapi.extensions.AbstractExtensionPointBean;
+import com.intellij.openapi.extensions.ExtensionPointName;
+
+/**
+ * @author nik
+ */
+public class JpsPluginBean extends AbstractExtensionPointBean {
+ public static final ExtensionPointName<JpsPluginBean> EP_NAME = ExtensionPointName.create("com.intellij.jps.plugin");
+}
diff --git a/platform/platform-impl/src/com/intellij/openapi/application/impl/ApplicationImpl.java b/platform/platform-impl/src/com/intellij/openapi/application/impl/ApplicationImpl.java
index 308d5dbb1835..7c8acbc4c25c 100644
--- a/platform/platform-impl/src/com/intellij/openapi/application/impl/ApplicationImpl.java
+++ b/platform/platform-impl/src/com/intellij/openapi/application/impl/ApplicationImpl.java
@@ -767,12 +767,12 @@ public class ApplicationImpl extends PlatformComponentManagerImpl implements App
@Override
public void exit() {
- exit(false);
+ exit(false, false);
}
@Override
- public void exit(final boolean force) {
- exit(force, true, false);
+ public void exit(boolean force, final boolean exitConfirmed) {
+ exit(false, exitConfirmed, true, false);
}
@Override
@@ -781,8 +781,8 @@ public class ApplicationImpl extends PlatformComponentManagerImpl implements App
}
@Override
- public void restart(boolean force) {
- exit(force, true, true);
+ public void restart(boolean exitConfirmed) {
+ exit(false, exitConfirmed, true, true);
}
/*
@@ -796,7 +796,7 @@ public class ApplicationImpl extends PlatformComponentManagerImpl implements App
*/
private static volatile boolean exiting = false;
- public void exit(final boolean force, final boolean allowListenersToCancel, final boolean restart) {
+ public void exit(final boolean force, final boolean exitConfirmed, final boolean allowListenersToCancel, final boolean restart) {
if (exiting) return;
exiting = true;
@@ -808,7 +808,7 @@ public class ApplicationImpl extends PlatformComponentManagerImpl implements App
Runnable runnable = new Runnable() {
@Override
public void run() {
- if (!confirmExitIfNeeded(force)) {
+ if (!force && !confirmExitIfNeeded(exitConfirmed)) {
saveAll();
return;
}
@@ -857,9 +857,9 @@ public class ApplicationImpl extends PlatformComponentManagerImpl implements App
return true;
}
- private static boolean confirmExitIfNeeded(boolean force) {
+ private static boolean confirmExitIfNeeded(boolean exitConfirmed) {
final boolean hasUnsafeBgTasks = ProgressManager.getInstance().hasUnsafeProgressIndicator();
- if (force && !hasUnsafeBgTasks) {
+ if (exitConfirmed && !hasUnsafeBgTasks) {
return true;
}
diff --git a/platform/platform-impl/src/com/intellij/openapi/diff/impl/Rediffers.java b/platform/platform-impl/src/com/intellij/openapi/diff/impl/Rediffers.java
index a29e51930119..3a1f8b055ab5 100644
--- a/platform/platform-impl/src/com/intellij/openapi/diff/impl/Rediffers.java
+++ b/platform/platform-impl/src/com/intellij/openapi/diff/impl/Rediffers.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -24,8 +24,6 @@ import com.intellij.openapi.util.text.StringUtil;
import com.intellij.util.Alarm;
import com.intellij.util.containers.HashMap;
-import java.util.Iterator;
-
public class Rediffers {
private final HashMap<EditorSource, Rediff> myRediffers = new HashMap<EditorSource, Rediff>();
private final DiffPanelImpl myPanel;
@@ -43,8 +41,7 @@ public class Rediffers {
}
public void dispose() {
- for (Iterator<Rediff> iterator = myRediffers.values().iterator(); iterator.hasNext();) {
- Rediff rediff = iterator.next();
+ for (Rediff rediff : myRediffers.values()) {
rediff.stopListen();
}
myRediffers.clear();
diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/actions/EditorActionUtil.java b/platform/platform-impl/src/com/intellij/openapi/editor/actions/EditorActionUtil.java
index 8b7791086014..a0355cf71222 100644
--- a/platform/platform-impl/src/com/intellij/openapi/editor/actions/EditorActionUtil.java
+++ b/platform/platform-impl/src/com/intellij/openapi/editor/actions/EditorActionUtil.java
@@ -601,7 +601,9 @@ public class EditorActionUtil {
}
}
caretModel.moveToOffset(newOffset);
- editor.getScrollingModel().scrollToCaret(ScrollType.RELATIVE);
+ if (editor.getCaretModel().getCurrentCaret() == editor.getCaretModel().getPrimaryCaret()) {
+ editor.getScrollingModel().scrollToCaret(ScrollType.RELATIVE);
+ }
setupSelection(editor, isWithSelection, selectionStart, blockSelectionStart);
}
@@ -673,7 +675,9 @@ public class EditorActionUtil {
if (isWordStart(text, newOffset, camel)) break;
}
editor.getCaretModel().moveToOffset(newOffset);
- editor.getScrollingModel().scrollToCaret(ScrollType.RELATIVE);
+ if (editor.getCaretModel().getCurrentCaret() == editor.getCaretModel().getPrimaryCaret()) {
+ editor.getScrollingModel().scrollToCaret(ScrollType.RELATIVE);
+ }
setupSelection(editor, isWithSelection, selectionStart, blockSelectionStart);
}
diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/ex/SoftWrapModelEx.java b/platform/platform-impl/src/com/intellij/openapi/editor/ex/SoftWrapModelEx.java
index 48d43bcce8bd..e3c03c2fbbd4 100644
--- a/platform/platform-impl/src/com/intellij/openapi/editor/ex/SoftWrapModelEx.java
+++ b/platform/platform-impl/src/com/intellij/openapi/editor/ex/SoftWrapModelEx.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2011 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -16,6 +16,7 @@
package com.intellij.openapi.editor.ex;
import com.intellij.openapi.editor.*;
+import com.intellij.openapi.editor.impl.EditorTextRepresentationHelper;
import com.intellij.openapi.editor.impl.softwrap.SoftWrapDrawingType;
import org.jetbrains.annotations.NotNull;
@@ -149,4 +150,6 @@ public interface SoftWrapModelEx extends SoftWrapModel {
* Allows to instruct current model to always return <code>'true'</code> from {@link #isRespectAdditionalColumns()}.
*/
void forceAdditionalColumnsUsage();
+
+ EditorTextRepresentationHelper getEditorTextRepresentationHelper();
}
diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/BorderEffect.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/BorderEffect.java
index cc1a23f6f8e5..2872699c8012 100644
--- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/BorderEffect.java
+++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/BorderEffect.java
@@ -86,6 +86,8 @@ public class BorderEffect {
markupModel.processRangeHighlightersOverlappingWith(myStartOffset, myEndOffset, new Processor<RangeHighlighterEx>() {
@Override
public boolean process(RangeHighlighterEx rangeHighlighter) {
+ if (!rangeHighlighter.getEditorFilter().avaliableIn(myEditor)) return true;
+
TextAttributes textAttributes = rangeHighlighter.getTextAttributes();
if (isBorder(textAttributes) && intersectsRange(rangeHighlighter)) {
paintBorder(rangeHighlighter, textAttributes);
diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/CaretImpl.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/CaretImpl.java
index 068f25e16565..cfd039a5d504 100644
--- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/CaretImpl.java
+++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/CaretImpl.java
@@ -1453,10 +1453,17 @@ public class CaretImpl extends UserDataHolderBase implements Caret {
return marker != null && marker.isValid() && isVirtualSelectionEnabled() && myEndVirtualOffset > myStartVirtualOffset;
}
+ @Override
+ @NotNull
public EditorImpl getEditor() {
return myEditor;
}
+ @Override
+ public String toString() {
+ return "Caret at " + myVisibleCaret + (mySelectionMarker == null ? "" : (", selection marker: " + mySelectionMarker.toString()));
+ }
+
/**
* Encapsulates information about target vertical range info - its <code>'y'</code> coordinate and height in pixels.
*/
diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/CaretModelImpl.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/CaretModelImpl.java
index a18d45472454..8d6608e63dd9 100644
--- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/CaretModelImpl.java
+++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/CaretModelImpl.java
@@ -282,11 +282,9 @@ public class CaretModelImpl implements CaretModel, PrioritizedDocumentListener,
}
}
- boolean addCaret(CaretImpl caretToAdd) {
+ boolean addCaret(@NotNull CaretImpl caretToAdd) {
for (CaretImpl caret : myCarets) {
- VisualPosition newVisualPosition = caretToAdd.getVisualPosition();
- int newOffset = myEditor.logicalPositionToOffset(myEditor.visualToLogicalPosition(newVisualPosition));
- if (caret.getVisualPosition().equals(newVisualPosition) || newOffset >= caret.getSelectionStart() && newOffset <= caret.getSelectionEnd()) {
+ if (caretsOverlap(caret, caretToAdd)) {
return false;
}
}
@@ -384,8 +382,7 @@ public class CaretModelImpl implements CaretModel, PrioritizedDocumentListener,
it.next();
}
CaretImpl currCaret = it.next();
- if (prevCaret != null && (currCaret.getVisualPosition().equals(prevCaret.getVisualPosition())
- || selectionsIntersect(currCaret, prevCaret))) {
+ if (prevCaret != null && caretsOverlap(currCaret, prevCaret)) {
int newSelectionStart = Math.min(currCaret.getSelectionStart(), prevCaret.getSelectionStart());
int newSelectionEnd = Math.max(currCaret.getSelectionEnd(), prevCaret.getSelectionEnd());
CaretImpl toRetain, toRemove;
@@ -410,7 +407,10 @@ public class CaretModelImpl implements CaretModel, PrioritizedDocumentListener,
}
}
- private static boolean selectionsIntersect(CaretImpl firstCaret, CaretImpl secondCaret) {
+ private static boolean caretsOverlap(@NotNull CaretImpl firstCaret, @NotNull CaretImpl secondCaret) {
+ if (firstCaret.getVisualPosition().equals(secondCaret.getVisualPosition())) {
+ return true;
+ }
int firstStart = firstCaret.getSelectionStart();
int secondStart = secondCaret.getSelectionStart();
int firstEnd = firstCaret.getSelectionEnd();
diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/DefaultEditorTextRepresentationHelper.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/DefaultEditorTextRepresentationHelper.java
index 9b2e473a0da5..61415eb90ce4 100644
--- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/DefaultEditorTextRepresentationHelper.java
+++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/DefaultEditorTextRepresentationHelper.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2012 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -16,14 +16,14 @@
package com.intellij.openapi.editor.impl;
import com.intellij.openapi.editor.Editor;
-import com.intellij.openapi.editor.colors.EditorColorsScheme;
import com.intellij.openapi.editor.ex.util.EditorUtil;
import gnu.trove.TObjectIntHashMap;
import org.intellij.lang.annotations.JdkConstants;
import org.jetbrains.annotations.NotNull;
/**
- * Not thread-safe.
+ * Not thread-safe. Performs caching of char widths, so cache reset must be invoked (via {@link #clearSymbolWidthCache()} method) when
+ * font settings are changed in editor.
*
* @author Denis Zhdanov
* @since Jul 27, 2010 4:06:27 PM
@@ -60,9 +60,6 @@ public class DefaultEditorTextRepresentationHelper implements EditorTextRepresen
public int charWidth(char c, int fontType) {
// Symbol width retrieval is detected to be a bottleneck, hence, we perform a caching here in assumption that every representation
// helper is editor-bound and cache size is not too big.
- EditorColorsScheme colorsScheme = myEditor.getColorsScheme();
- mySharedKey.fontName = colorsScheme.getEditorFontName();
- mySharedKey.fontSize = colorsScheme.getEditorFontSize();
mySharedKey.fontType = fontType;
mySharedKey.c = c;
@@ -83,9 +80,6 @@ public class DefaultEditorTextRepresentationHelper implements EditorTextRepresen
// Symbol width retrieval is detected to be a bottleneck, hence, we perform a caching here in assumption that every representation
// helper is editor-bound and cache size is not too big.
- EditorColorsScheme colorsScheme = myEditor.getColorsScheme();
- mySharedKey.fontName = colorsScheme.getEditorFontName();
- mySharedKey.fontSize = colorsScheme.getEditorFontSize();
mySharedKey.fontType = fontType;
for (int i = startToUse; i < end; i++) {
@@ -107,7 +101,7 @@ public class DefaultEditorTextRepresentationHelper implements EditorTextRepresen
return result;
}
Key key = mySharedKey.clone();
- FontInfo font = ComplementaryFontsRegistry.getFontAbleToDisplay(c, key.fontSize, key.fontType, key.fontName);
+ FontInfo font = ComplementaryFontsRegistry.getFontAbleToDisplay(c, key.fontType, myEditor.getColorsScheme().getFontPreferences());
result = font.charWidth(c);
if (mySymbolWidthCache.size() >= MAX_SYMBOLS_WIDTHS_CACHE_SIZE) {
// Don't expect to be here.
@@ -117,33 +111,31 @@ public class DefaultEditorTextRepresentationHelper implements EditorTextRepresen
return result;
}
+ public void clearSymbolWidthCache() {
+ mySymbolWidthCache.clear();
+ }
+
private static class Key {
- public String fontName;
- private int fontSize;
@JdkConstants.FontStyle private int fontType;
private char c;
private Key() {
- this(null, 0, 0, ' ');
+ this(0, ' ');
}
- Key(String fontName, int fontSize, @JdkConstants.FontStyle int fontType, char c) {
- this.fontName = fontName;
- this.fontSize = fontSize;
+ Key(@JdkConstants.FontStyle int fontType, char c) {
this.fontType = fontType;
this.c = c;
}
@Override
protected Key clone() {
- return new Key(fontName, fontSize, fontType, c);
+ return new Key(fontType, c);
}
@Override
public int hashCode() {
- int result = fontName != null ? fontName.hashCode() : 0;
- result = 31 * result + fontSize;
- result = 31 * result + fontType;
+ int result = fontType;
result = 31 * result + c;
return result;
}
@@ -155,10 +147,8 @@ public class DefaultEditorTextRepresentationHelper implements EditorTextRepresen
Key key = (Key)o;
- if (fontSize != key.fontSize) return false;
if (fontType != key.fontType) return false;
if (c != key.c) return false;
- if (fontName != null ? !fontName.equals(key.fontName) : key.fontName != null) return false;
return true;
}
diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorImpl.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorImpl.java
index e37ad8f968ad..b708f38a9190 100644
--- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorImpl.java
+++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorImpl.java
@@ -66,6 +66,8 @@ import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.wm.IdeFocusManager;
import com.intellij.openapi.wm.IdeGlassPane;
+import com.intellij.openapi.wm.ToolWindowAnchor;
+import com.intellij.openapi.wm.ex.ToolWindowManagerEx;
import com.intellij.psi.PsiDocumentManager;
import com.intellij.psi.PsiFile;
import com.intellij.ui.*;
@@ -320,7 +322,7 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
myScheme = createBoundColorSchemeDelegate(null);
initTabPainter();
myIsViewer = viewer;
- mySettings = new SettingsImpl(this);
+ mySettings = new SettingsImpl(this, project);
mySelectionModel = new SelectionModelImpl(this);
myMarkupModel = new EditorMarkupModelImpl(this);
@@ -1979,6 +1981,8 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
myMarkupModel.processRangeHighlightersOverlappingWith(clipStartOffset, clipEndOffset, new Processor<RangeHighlighterEx>() {
@Override
public boolean process(@NotNull RangeHighlighterEx highlighter) {
+ if (!highlighter.getEditorFilter().avaliableIn(EditorImpl.this)) return true;
+
final CustomHighlighterRenderer customRenderer = highlighter.getCustomRenderer();
if (customRenderer != null && clipStartOffset < highlighter.getEndOffset() && highlighter.getStartOffset() < clipEndOffset) {
customRenderer.paint(EditorImpl.this, highlighter, g);
@@ -2124,6 +2128,8 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
Processor<RangeHighlighterEx> paintProcessor = new Processor<RangeHighlighterEx>() {
@Override
public boolean process(@NotNull RangeHighlighterEx highlighter) {
+ if (!highlighter.getEditorFilter().avaliableIn(EditorImpl.this)) return true;
+
paintSegmentHighlighterAfterEndOfLine(g, highlighter, startLine, endLine);
return true;
}
@@ -2978,6 +2984,8 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
markupModel.processRangeHighlightersOverlappingWith(clipStartOffset, clipEndOffset, new Processor<RangeHighlighterEx>() {
@Override
public boolean process(@NotNull RangeHighlighterEx lineMarker) {
+ if (!lineMarker.getEditorFilter().avaliableIn(EditorImpl.this)) return true;
+
paintLineMarkerSeparator(lineMarker, clip, g);
return true;
}
@@ -6735,7 +6743,7 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
}
}
- private static class TablessBorder extends SideBorder {
+ private class TablessBorder extends SideBorder {
private TablessBorder() {
super(UIUtil.getBorderColor(), SideBorder.ALL);
}
@@ -6760,7 +6768,9 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
@Override
public Insets getBorderInsets(Component c) {
Container splitters = SwingUtilities.getAncestorOfClass(EditorsSplitters.class, c);
- return splitters == null ? super.getBorderInsets(c) : new Insets(1, 0, 0, 0);
+ boolean thereIsSomethingAbove = !SystemInfo.isMac || UISettings.getInstance().SHOW_MAIN_TOOLBAR || UISettings.getInstance().SHOW_NAVIGATION_BAR ||
+ EditorImpl.this.myProject != null && !ToolWindowManagerEx.getInstanceEx(EditorImpl.this.myProject).getIdsOn(ToolWindowAnchor.TOP).isEmpty();
+ return splitters == null ? super.getBorderInsets(c) : new Insets(thereIsSomethingAbove ? 1 : 0, 0, 0, 0);
}
@Override
diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorMarkupModelImpl.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorMarkupModelImpl.java
index c721a5a5873b..a2f45fe33857 100644
--- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorMarkupModelImpl.java
+++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorMarkupModelImpl.java
@@ -45,6 +45,7 @@ import com.intellij.openapi.ui.MessageType;
import com.intellij.openapi.ui.popup.Balloon;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.ProperTextRange;
+import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.wm.ToolWindowAnchor;
import com.intellij.openapi.wm.ex.ToolWindowManagerEx;
import com.intellij.ui.*;
@@ -229,6 +230,8 @@ public class EditorMarkupModelImpl extends MarkupModelImpl implements EditorMark
markupModel.processRangeHighlightersOverlappingWith(startOffset, endOffset, new Processor<RangeHighlighterEx>() {
@Override
public boolean process(RangeHighlighterEx highlighter) {
+ if (!highlighter.getEditorFilter().avaliableIn(myEditor)) return true;
+
if (highlighter.getErrorStripeMarkColor() != null) {
if (highlighter.getStartOffset() < endOffset && highlighter.getEndOffset() > startOffset) {
highlighters.add(highlighter);
@@ -266,6 +269,8 @@ public class EditorMarkupModelImpl extends MarkupModelImpl implements EditorMark
markupModel.processRangeHighlightersOverlappingWith(startOffset, endOffset, new Processor<RangeHighlighterEx>() {
@Override
public boolean process(RangeHighlighterEx highlighter) {
+ if (!highlighter.getEditorFilter().avaliableIn(myEditor)) return true;
+
if (highlighter.getErrorStripeMarkColor() != null) {
ProperTextRange range = offsetsToYPositions(highlighter.getStartOffset(), highlighter.getEndOffset());
if (scrollBarY >= range.getStartOffset() - myMinMarkHeight * 2 &&
@@ -432,7 +437,7 @@ public class EditorMarkupModelImpl extends MarkupModelImpl implements EditorMark
errorIconBounds.y = bounds.height / 2 - errorIconBounds.height / 2;
try {
- if (UISettings.getInstance().PRESENTATION_MODE) {
+ if (UISettings.getInstance().PRESENTATION_MODE || SystemInfo.isMac) {
g.setColor(getEditor().getColorsScheme().getDefaultBackground());
g.fillRect(0, 0, bounds.width, bounds.height);
@@ -523,7 +528,7 @@ public class EditorMarkupModelImpl extends MarkupModelImpl implements EditorMark
@Override
protected void paintThumb(Graphics g, JComponent c, Rectangle thumbBounds) {
- if (UISettings.getInstance().PRESENTATION_MODE) {
+ if (UISettings.getInstance().PRESENTATION_MODE || SystemInfo.isMac) {
super.paintThumb(g, c, thumbBounds);
return;
}
@@ -560,16 +565,16 @@ public class EditorMarkupModelImpl extends MarkupModelImpl implements EditorMark
@Override
protected int getThickness() {
- if (UISettings.getInstance().PRESENTATION_MODE) return super.getThickness();
+ if (UISettings.getInstance().PRESENTATION_MODE || SystemInfo.isMac) return super.getThickness();
return super.getThickness() + (isMacOverlayScrollbar() ? 2 : 7);
}
@Override
protected void doPaintTrack(Graphics g, JComponent c, Rectangle bounds) {
- if (UISettings.getInstance().PRESENTATION_MODE) {
+ if (UISettings.getInstance().PRESENTATION_MODE || SystemInfo.isMac) {
g.setColor(getEditor().getColorsScheme().getDefaultBackground());
g.fillRect(bounds.x, bounds.y, bounds.width, bounds.height);
- return;
+ //return;
}
Rectangle clip = g.getClipBounds().intersection(bounds);
if (clip.height == 0) return;
@@ -604,7 +609,7 @@ public class EditorMarkupModelImpl extends MarkupModelImpl implements EditorMark
}
private void paintTrackBasement(Graphics g, Rectangle bounds) {
- if (UISettings.getInstance().PRESENTATION_MODE) {
+ if (UISettings.getInstance().PRESENTATION_MODE || SystemInfo.isMac) {
return;
}
@@ -661,6 +666,8 @@ public class EditorMarkupModelImpl extends MarkupModelImpl implements EditorMark
markup.processRangeHighlightersOverlappingWith(startOffset, endOffset, new Processor<RangeHighlighterEx>() {
@Override
public boolean process(RangeHighlighterEx highlighter) {
+ if (!highlighter.getEditorFilter().avaliableIn(myEditor)) return true;
+
Color color = highlighter.getErrorStripeMarkColor();
if (color == null) return true;
boolean isThin = highlighter.isThinErrorStripeMark();
diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/FoldingModelImpl.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/FoldingModelImpl.java
index 694bc75a5751..b92970425e99 100644
--- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/FoldingModelImpl.java
+++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/FoldingModelImpl.java
@@ -265,9 +265,6 @@ public class FoldingModelImpl implements FoldingModelEx, PrioritizedDocumentList
if (line >= myEditor.getDocument().getLineCount()) return null;
- //leftmost folded block position
- if (myEditor.xyToVisualPosition(p).equals(myEditor.logicalToVisualPosition(pos))) return null;
-
int offset = myEditor.logicalPositionToOffset(pos);
return myFoldTree.fetchOutermost(offset);
diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/SelectionModelImpl.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/SelectionModelImpl.java
index 263ea77c286f..2f5a81153579 100644
--- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/SelectionModelImpl.java
+++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/SelectionModelImpl.java
@@ -36,16 +36,13 @@ import com.intellij.openapi.editor.ex.DocumentEx;
import com.intellij.openapi.editor.ex.PrioritizedDocumentListener;
import com.intellij.openapi.editor.ex.util.EditorUtil;
import com.intellij.openapi.editor.markup.TextAttributes;
-import com.intellij.openapi.ide.CopyPasteManager;
import com.intellij.openapi.util.Pair;
-import com.intellij.openapi.util.text.StringUtil;
import com.intellij.util.ArrayUtil;
import com.intellij.util.containers.ContainerUtil;
import gnu.trove.TIntArrayList;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
-import java.awt.datatransfer.StringSelection;
import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedList;
@@ -570,13 +567,7 @@ public class SelectionModelImpl implements SelectionModel, PrioritizedDocumentLi
@Override
public void copySelectionToClipboard() {
- validateContext(true);
- String s = getSelectedText(true);
- if (s == null) return;
-
- s = StringUtil.convertLineSeparators(s);
- StringSelection contents = new StringSelection(s);
- CopyPasteManager.getInstance().setContents(contents);
+ CopyPasteSupport.copySelectionToClipboard(myEditor);
}
@Override
diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/SettingsImpl.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/SettingsImpl.java
index dabf5e9d2a2f..f2dbc6756ef5 100644
--- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/SettingsImpl.java
+++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/SettingsImpl.java
@@ -25,6 +25,8 @@
package com.intellij.openapi.editor.impl;
import com.intellij.codeStyle.CodeStyleFacade;
+import com.intellij.lang.Language;
+import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.EditorSettings;
import com.intellij.openapi.editor.ex.EditorEx;
import com.intellij.openapi.editor.ex.EditorSettingsExternalizable;
@@ -32,10 +34,14 @@ import com.intellij.openapi.editor.impl.softwrap.SoftWrapAppliancePlaces;
import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.psi.PsiDocumentManager;
+import com.intellij.psi.PsiFile;
+import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class SettingsImpl implements EditorSettings {
@Nullable private final EditorEx myEditor;
+ @Nullable private final Language myLanguage;
private Boolean myIsCamelWords;
// This group of settings does not have UI
@@ -78,9 +84,14 @@ public class SettingsImpl implements EditorSettings {
private Boolean myRenamePreselect = null;
private Boolean myWrapWhenTypingReachesRightMargin = null;
private Boolean myShowIntentionBulb = null;
+
+ public SettingsImpl() {
+ this(null, null);
+ }
- public SettingsImpl(@Nullable EditorEx editor) {
+ public SettingsImpl(@Nullable EditorEx editor, @Nullable Project project) {
myEditor = editor;
+ myLanguage = editor != null && project != null ? getDocumentLanguage(project, editor.getDocument()) : null;
}
@Override
@@ -144,7 +155,17 @@ public class SettingsImpl implements EditorSettings {
@Override
public int getRightMargin(Project project) {
return myRightMargin != null ? myRightMargin.intValue() :
- CodeStyleFacade.getInstance(project).getRightMargin();
+ CodeStyleFacade.getInstance(project).getRightMargin(myLanguage);
+ }
+
+ @Nullable
+ private static Language getDocumentLanguage(@Nullable Project project, @NotNull Document document) {
+ if (project != null) {
+ PsiDocumentManager documentManager = PsiDocumentManager.getInstance(project);
+ PsiFile file = documentManager.getPsiFile(document);
+ if (file != null) return file.getLanguage();
+ }
+ return null;
}
@Override
diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/SoftWrapModelImpl.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/SoftWrapModelImpl.java
index cccf86c5f98e..6f1b9820132b 100644
--- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/SoftWrapModelImpl.java
+++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/SoftWrapModelImpl.java
@@ -21,6 +21,7 @@ import com.intellij.openapi.application.Application;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.*;
+import com.intellij.openapi.editor.colors.FontPreferences;
import com.intellij.openapi.editor.event.DocumentEvent;
import com.intellij.openapi.editor.event.DocumentListener;
import com.intellij.openapi.editor.ex.*;
@@ -89,9 +90,10 @@ public class SoftWrapModelImpl implements SoftWrapModelEx, PrioritizedDocumentLi
private SoftWrapPainter myPainter;
private final SoftWrapApplianceManager myApplianceManager;
private final SoftWrapAwareVisualSizeManager myVisualSizeManager;
+ private EditorTextRepresentationHelper myEditorTextRepresentationHelper;
private final EditorEx myEditor;
-
+
/**
* We don't want to use soft wraps-aware processing from non-EDT and profiling shows that 'is EDT' check that is called too
* often is rather expensive. Hence, we use caching here for performance improvement.
@@ -101,6 +103,8 @@ public class SoftWrapModelImpl implements SoftWrapModelEx, PrioritizedDocumentLi
private int myActive;
private boolean myUseSoftWraps;
private int myTabWidth = -1;
+ @NotNull
+ private FontPreferences myFontPreferences;
/**
* Soft wraps need to be kept up-to-date on all editor modification (changing text, adding/removing/expanding/collapsing fold
@@ -132,9 +136,9 @@ public class SoftWrapModelImpl implements SoftWrapModelEx, PrioritizedDocumentLi
myEditor = editor;
myStorage = new SoftWrapsStorage();
myPainter = new CompositeSoftWrapPainter(editor);
- DefaultEditorTextRepresentationHelper representationHelper = new DefaultEditorTextRepresentationHelper(editor);
- myDataMapper = new CachingSoftWrapDataMapper(editor, myStorage, representationHelper);
- myApplianceManager = new SoftWrapApplianceManager(myStorage, editor, myPainter, representationHelper, myDataMapper);
+ myEditorTextRepresentationHelper = new DefaultEditorTextRepresentationHelper(editor);
+ myDataMapper = new CachingSoftWrapDataMapper(editor, myStorage);
+ myApplianceManager = new SoftWrapApplianceManager(myStorage, editor, myPainter, myDataMapper);
myFoldBasedApplianceStrategy = new SoftWrapFoldBasedApplianceStrategy(editor);
myVisualSizeManager = new SoftWrapAwareVisualSizeManager(myPainter);
@@ -150,6 +154,7 @@ public class SoftWrapModelImpl implements SoftWrapModelEx, PrioritizedDocumentLi
});
EditorSettings settings = myEditor.getSettings();
myUseSoftWraps = settings.isUseSoftWraps();
+ myFontPreferences = myEditor.getColorsScheme().getFontPreferences();
editor.addPropertyChangeListener(this);
@@ -168,8 +173,16 @@ public class SoftWrapModelImpl implements SoftWrapModelEx, PrioritizedDocumentLi
int tabWidthBefore = myTabWidth;
myTabWidth = getCurrentTabWidth();
+
+ boolean fontsChanged = false;
+ if (!myFontPreferences.equals(myEditor.getColorsScheme().getFontPreferences())
+ && myEditorTextRepresentationHelper instanceof DefaultEditorTextRepresentationHelper) {
+ fontsChanged = true;
+ myFontPreferences = myEditor.getColorsScheme().getFontPreferences();
+ ((DefaultEditorTextRepresentationHelper)myEditorTextRepresentationHelper).clearSymbolWidthCache();
+ }
- if ((myUseSoftWraps ^ softWrapsUsedBefore) || (tabWidthBefore >= 0 && myTabWidth != tabWidthBefore)) {
+ if ((myUseSoftWraps ^ softWrapsUsedBefore) || (tabWidthBefore >= 0 && myTabWidth != tabWidthBefore) || fontsChanged) {
myApplianceManager.reset();
myDeferredFoldRegions.clear();
myEditor.getScrollingModel().scrollToCaret(ScrollType.CENTER);
@@ -705,6 +718,20 @@ public class SoftWrapModelImpl implements SoftWrapModelEx, PrioritizedDocumentLi
myVisualSizeManager.setSoftWrapPainter(painter);
}
+ public static EditorTextRepresentationHelper getEditorTextRepresentationHelper(@NotNull Editor editor) {
+ return ((SoftWrapModelEx)editor.getSoftWrapModel()).getEditorTextRepresentationHelper();
+ }
+
+ public EditorTextRepresentationHelper getEditorTextRepresentationHelper() {
+ return myEditorTextRepresentationHelper;
+ }
+
+ @TestOnly
+ public void setEditorTextRepresentationHelper(EditorTextRepresentationHelper editorTextRepresentationHelper) {
+ myEditorTextRepresentationHelper = editorTextRepresentationHelper;
+ myApplianceManager.reset();
+ }
+
@NotNull
@Override
public String dumpState() {
diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/AbstractMappingStrategy.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/AbstractMappingStrategy.java
index 26c8086beb72..bccdf4c59336 100644
--- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/AbstractMappingStrategy.java
+++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/AbstractMappingStrategy.java
@@ -15,12 +15,10 @@
*/
package com.intellij.openapi.editor.impl.softwrap.mapping;
-import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.FoldRegion;
import com.intellij.openapi.editor.LogicalPosition;
-import com.intellij.openapi.editor.impl.EditorTextRepresentationHelper;
import com.intellij.openapi.editor.impl.softwrap.SoftWrapsStorage;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -39,10 +37,7 @@ import java.util.List;
*/
abstract class AbstractMappingStrategy<T> implements MappingStrategy<T> {
- private static final Logger LOG = Logger.getInstance("#" + AbstractMappingStrategy.class.getName());
-
protected final Editor myEditor;
- protected final EditorTextRepresentationHelper myRepresentationHelper;
protected final SoftWrapsStorage myStorage;
protected final List<CacheEntry> myCache;
@@ -53,13 +48,11 @@ abstract class AbstractMappingStrategy<T> implements MappingStrategy<T> {
AbstractMappingStrategy(@NotNull Editor editor,
@NotNull SoftWrapsStorage storage,
- @NotNull List<CacheEntry> cache,
- @NotNull EditorTextRepresentationHelper representationHelper)
+ @NotNull List<CacheEntry> cache)
{
myEditor = editor;
myStorage = storage;
myCache = cache;
- myRepresentationHelper = representationHelper;
}
@Nullable
@@ -73,7 +66,7 @@ abstract class AbstractMappingStrategy<T> implements MappingStrategy<T> {
}
protected void setFirstInitialPosition() {
- myInitialPosition = new EditorPosition(new LogicalPosition(0, 0), 0, myEditor, myRepresentationHelper);
+ myInitialPosition = new EditorPosition(new LogicalPosition(0, 0), 0, myEditor);
}
@Nullable
diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/CacheEntry.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/CacheEntry.java
index 57ef56c178e9..27362b52527a 100644
--- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/CacheEntry.java
+++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/CacheEntry.java
@@ -17,7 +17,6 @@ package com.intellij.openapi.editor.impl.softwrap.mapping;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.FoldRegion;
-import com.intellij.openapi.editor.impl.EditorTextRepresentationHelper;
import com.intellij.openapi.util.Ref;
import gnu.trove.TIntObjectHashMap;
import gnu.trove.TIntObjectProcedure;
@@ -25,7 +24,10 @@ import gnu.trove.TObjectProcedure;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
/**
* Encapsulates information to cache for the single visual line.
@@ -59,7 +61,6 @@ class CacheEntry implements Comparable<CacheEntry>, Cloneable {
public boolean locked;
private final Editor myEditor;
- private final EditorTextRepresentationHelper myRepresentationHelper;
/** Holds positions for the tabulation symbols on a target visual line sorted by offset in ascending order. */
private List<TabData> myTabPositions = Collections.EMPTY_LIST;
@@ -67,10 +68,9 @@ class CacheEntry implements Comparable<CacheEntry>, Cloneable {
/** Holds information about single line fold regions representation data. */
private TIntObjectHashMap<FoldingData> myFoldingData = DUMMY;
- CacheEntry(int visualLine, @NotNull Editor editor, @NotNull EditorTextRepresentationHelper representationHelper) {
+ CacheEntry(int visualLine, @NotNull Editor editor) {
this.visualLine = visualLine;
myEditor = editor;
- myRepresentationHelper = representationHelper;
}
public void setLineStartPosition(@NotNull EditorPosition context) {
@@ -99,7 +99,7 @@ class CacheEntry implements Comparable<CacheEntry>, Cloneable {
}
public EditorPosition buildStartLinePosition() {
- EditorPosition result = new EditorPosition(myEditor, myRepresentationHelper);
+ EditorPosition result = new EditorPosition(myEditor);
result.logicalLine = startLogicalLine;
result.logicalColumn = startLogicalColumn;
result.offset = startOffset;
@@ -114,7 +114,7 @@ class CacheEntry implements Comparable<CacheEntry>, Cloneable {
}
public EditorPosition buildEndLinePosition() {
- EditorPosition result = new EditorPosition(myEditor, myRepresentationHelper);
+ EditorPosition result = new EditorPosition(myEditor);
result.logicalLine = endLogicalLine;
result.logicalColumn = endLogicalColumn;
result.offset = endOffset;
@@ -246,7 +246,7 @@ class CacheEntry implements Comparable<CacheEntry>, Cloneable {
@Override
protected CacheEntry clone() {
- final CacheEntry result = new CacheEntry(visualLine, myEditor, myRepresentationHelper);
+ final CacheEntry result = new CacheEntry(visualLine, myEditor);
result.startLogicalLine = startLogicalLine;
result.startLogicalColumn = startLogicalColumn;
diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/CachingSoftWrapDataMapper.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/CachingSoftWrapDataMapper.java
index 08bf0211dbc8..2f21b0319af2 100644
--- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/CachingSoftWrapDataMapper.java
+++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/CachingSoftWrapDataMapper.java
@@ -21,7 +21,7 @@ import com.intellij.openapi.editor.*;
import com.intellij.openapi.editor.ex.EditorEx;
import com.intellij.openapi.editor.ex.FoldingModelEx;
import com.intellij.openapi.editor.impl.EditorImpl;
-import com.intellij.openapi.editor.impl.EditorTextRepresentationHelper;
+import com.intellij.openapi.editor.impl.SoftWrapModelImpl;
import com.intellij.openapi.editor.impl.softwrap.SoftWrapDataMapper;
import com.intellij.openapi.editor.impl.softwrap.SoftWrapImpl;
import com.intellij.openapi.editor.impl.softwrap.SoftWrapsStorage;
@@ -71,19 +71,16 @@ public class CachingSoftWrapDataMapper implements SoftWrapDataMapper, SoftWrapAw
private final VisualToLogicalCalculationStrategy myVisualToLogicalStrategy;
private final EditorEx myEditor;
private final SoftWrapsStorage myStorage;
- private final EditorTextRepresentationHelper myRepresentationHelper;
private final CacheEntry mySearchKey;
- public CachingSoftWrapDataMapper(@NotNull EditorEx editor, @NotNull SoftWrapsStorage storage,
- @NotNull EditorTextRepresentationHelper representationHelper)
+ public CachingSoftWrapDataMapper(@NotNull EditorEx editor, @NotNull SoftWrapsStorage storage)
{
myEditor = editor;
myStorage = storage;
- myRepresentationHelper = representationHelper;
- mySearchKey = new CacheEntry(0, editor, representationHelper);
+ mySearchKey = new CacheEntry(0, editor);
- myOffsetToLogicalStrategy = new OffsetToLogicalCalculationStrategy(editor, storage, myCache, representationHelper);
- myVisualToLogicalStrategy = new VisualToLogicalCalculationStrategy(editor, storage, myCache, representationHelper);
+ myOffsetToLogicalStrategy = new OffsetToLogicalCalculationStrategy(editor, storage, myCache);
+ myVisualToLogicalStrategy = new VisualToLogicalCalculationStrategy(editor, storage, myCache);
}
@NotNull
@@ -146,7 +143,7 @@ public class CachingSoftWrapDataMapper implements SoftWrapDataMapper, SoftWrapAw
// Count soft wrap column offset only if it's located at the same line as the target offset.
if (column < 0 && softWrap.getStart() >= targetLogicalLineStartOffset) {
- column = softWrap.getIndentInColumns() + myRepresentationHelper.toVisualColumnSymbolsNumber(
+ column = softWrap.getIndentInColumns() + SoftWrapModelImpl.getEditorTextRepresentationHelper(myEditor).toVisualColumnSymbolsNumber(
myEditor.getDocument().getCharsSequence(), softWrap.getStart(), maxOffset, softWrap.getIndentInPixels()
);
@@ -326,7 +323,7 @@ public class CachingSoftWrapDataMapper implements SoftWrapDataMapper, SoftWrapAw
return lastEntry;
}
else if (lastEntry.visualLine < visualLine && createIfNecessary) {
- CacheEntry result = new CacheEntry(visualLine, myEditor, myRepresentationHelper);
+ CacheEntry result = new CacheEntry(visualLine, myEditor);
myCache.add(result);
return result;
}
@@ -357,7 +354,7 @@ public class CachingSoftWrapDataMapper implements SoftWrapDataMapper, SoftWrapAw
if (cacheEntryIndex < 0) {
cacheEntryIndex = start;
if (createIfNecessary) {
- myCache.add(cacheEntryIndex, result = new CacheEntry(visualLine, myEditor, myRepresentationHelper));
+ myCache.add(cacheEntryIndex, result = new CacheEntry(visualLine, myEditor));
}
}
else {
@@ -666,7 +663,7 @@ public class CachingSoftWrapDataMapper implements SoftWrapDataMapper, SoftWrapAw
@NotNull List<Pair<Integer, FoldRegion>> foldRegions,
@NotNull List<Pair<Integer, Integer>> tabData)
{
- final CacheEntry entry = new CacheEntry(visualLine, myEditor, myRepresentationHelper);
+ final CacheEntry entry = new CacheEntry(visualLine, myEditor);
entry.startOffset = startOffset;
entry.endOffset = endOffset;
entry.startLogicalLine = startLogicalLine;
diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/EditorPosition.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/EditorPosition.java
index 903243cfa766..1097f2824445 100644
--- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/EditorPosition.java
+++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/EditorPosition.java
@@ -16,7 +16,7 @@
package com.intellij.openapi.editor.impl.softwrap.mapping;
import com.intellij.openapi.editor.*;
-import com.intellij.openapi.editor.impl.EditorTextRepresentationHelper;
+import com.intellij.openapi.editor.impl.SoftWrapModelImpl;
import org.jetbrains.annotations.NotNull;
/**
@@ -46,29 +46,24 @@ class EditorPosition implements Cloneable {
public int symbolWidthInPixels;
private final Editor myEditor;
- private final EditorTextRepresentationHelper myRepresentationHelper;
- EditorPosition(@NotNull Editor editor, @NotNull EditorTextRepresentationHelper representationHelper) {
+ EditorPosition(@NotNull Editor editor) {
myEditor = editor;
- myRepresentationHelper = representationHelper;
}
EditorPosition(@NotNull LogicalPosition logical,
int offset,
- @NotNull Editor editor,
- @NotNull EditorTextRepresentationHelper representationHelper)
+ @NotNull Editor editor)
{
- this(logical, logical.toVisualPosition(), offset, editor, representationHelper);
+ this(logical, logical.toVisualPosition(), offset, editor);
}
EditorPosition(@NotNull LogicalPosition logical,
@NotNull VisualPosition visual,
int offset,
- @NotNull Editor editor,
- @NotNull EditorTextRepresentationHelper representationHelper)
+ @NotNull Editor editor)
{
myEditor = editor;
- myRepresentationHelper = representationHelper;
logicalLine = logical.line;
logicalColumn = logical.column;
softWrapLinesBefore = logical.softWrapLinesBeforeCurrentLogicalLine;
@@ -148,10 +143,11 @@ class EditorPosition implements Cloneable {
if (logicalLine == endOffsetLogicalLine) {
// Single-line fold region.
if (collapsedSymbolsWidthInColumns < 0) {
- collapsedSymbolsWidthInColumns = myRepresentationHelper.toVisualColumnSymbolsNumber(document.getCharsSequence(),
- foldRegion.getStartOffset(),
- foldRegion.getEndOffset(),
- x);
+ collapsedSymbolsWidthInColumns = SoftWrapModelImpl.getEditorTextRepresentationHelper(myEditor)
+ .toVisualColumnSymbolsNumber(document.getCharsSequence(),
+ foldRegion.getStartOffset(),
+ foldRegion.getEndOffset(),
+ x);
}
logicalColumn += collapsedSymbolsWidthInColumns;
foldingColumnDiff += placeholder.length() - collapsedSymbolsWidthInColumns;
@@ -159,10 +155,11 @@ class EditorPosition implements Cloneable {
else {
// Multi-line fold region.
if (collapsedSymbolsWidthInColumns < 0) {
- collapsedSymbolsWidthInColumns = myRepresentationHelper.toVisualColumnSymbolsNumber(document.getCharsSequence(),
- foldRegion.getStartOffset(),
- foldRegion.getEndOffset(),
- 0);
+ collapsedSymbolsWidthInColumns = SoftWrapModelImpl.getEditorTextRepresentationHelper(myEditor)
+ .toVisualColumnSymbolsNumber(document.getCharsSequence(),
+ foldRegion.getStartOffset(),
+ foldRegion.getEndOffset(),
+ 0);
}
int linesDiff = endOffsetLogicalLine - logicalLine;
logicalLine += linesDiff;
@@ -191,7 +188,7 @@ class EditorPosition implements Cloneable {
@Override
protected EditorPosition clone() {
- EditorPosition result = new EditorPosition(myEditor, myRepresentationHelper);
+ EditorPosition result = new EditorPosition(myEditor);
result.logicalLine = logicalLine;
result.logicalColumn = logicalColumn;
result.visualLine = visualLine;
diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/LogicalToVisualMappingStrategy.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/LogicalToVisualMappingStrategy.java
index 773d4fdc4d82..6ed904624fa6 100644
--- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/LogicalToVisualMappingStrategy.java
+++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/LogicalToVisualMappingStrategy.java
@@ -16,7 +16,7 @@
package com.intellij.openapi.editor.impl.softwrap.mapping;
import com.intellij.openapi.editor.*;
-import com.intellij.openapi.editor.impl.EditorTextRepresentationHelper;
+import com.intellij.openapi.editor.impl.SoftWrapModelImpl;
import com.intellij.openapi.editor.impl.softwrap.SoftWrapsStorage;
import org.jetbrains.annotations.NotNull;
@@ -32,10 +32,10 @@ class LogicalToVisualMappingStrategy extends AbstractMappingStrategy<VisualPosit
private LogicalPosition myTargetLogical;
LogicalToVisualMappingStrategy(@NotNull LogicalPosition logical, @NotNull Editor editor, @NotNull SoftWrapsStorage storage,
- @NotNull EditorTextRepresentationHelper representationHelper, @NotNull List<CacheEntry> cache)
+ @NotNull List<CacheEntry> cache)
throws IllegalStateException
{
- super(editor, storage, cache, representationHelper);
+ super(editor, storage, cache);
myTargetLogical = logical;
}
@@ -121,7 +121,7 @@ class LogicalToVisualMappingStrategy extends AbstractMappingStrategy<VisualPosit
int foldEndColumn;
if (data == null) {
int xStart = myEditor.getDocument().getLineNumber(foldRegion.getStartOffset()) == foldEndLine ? context.x : 0;
- foldEndColumn = myRepresentationHelper.toVisualColumnSymbolsNumber(
+ foldEndColumn = SoftWrapModelImpl.getEditorTextRepresentationHelper(myEditor).toVisualColumnSymbolsNumber(
myEditor.getDocument().getCharsSequence(), foldRegion.getStartOffset(), foldRegion.getEndOffset(), xStart
);
} else {
diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/OffsetToLogicalCalculationStrategy.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/OffsetToLogicalCalculationStrategy.java
index 39fe252ec623..399406f2db32 100644
--- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/OffsetToLogicalCalculationStrategy.java
+++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/OffsetToLogicalCalculationStrategy.java
@@ -16,7 +16,7 @@
package com.intellij.openapi.editor.impl.softwrap.mapping;
import com.intellij.openapi.editor.*;
-import com.intellij.openapi.editor.impl.EditorTextRepresentationHelper;
+import com.intellij.openapi.editor.impl.SoftWrapModelImpl;
import com.intellij.openapi.editor.impl.softwrap.SoftWrapsStorage;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -31,10 +31,9 @@ class OffsetToLogicalCalculationStrategy extends AbstractMappingStrategy<Logical
private int myTargetOffset;
- OffsetToLogicalCalculationStrategy(@NotNull Editor editor, @NotNull SoftWrapsStorage storage, @NotNull List<CacheEntry> cache,
- @NotNull EditorTextRepresentationHelper representationHelper)
+ OffsetToLogicalCalculationStrategy(@NotNull Editor editor, @NotNull SoftWrapsStorage storage, @NotNull List<CacheEntry> cache)
{
- super(editor, storage, cache, representationHelper);
+ super(editor, storage, cache);
}
public void init(final int targetOffset, final List<CacheEntry> cache) {
@@ -157,13 +156,13 @@ class OffsetToLogicalCalculationStrategy extends AbstractMappingStrategy<Logical
int targetLogicalLine = document.getLineNumber(myTargetOffset);
if (targetLogicalLine == position.logicalLine) {
// Target offset is located on the same logical line as folding start.
- position.logicalColumn += myRepresentationHelper.toVisualColumnSymbolsNumber(
+ position.logicalColumn += SoftWrapModelImpl.getEditorTextRepresentationHelper(myEditor).toVisualColumnSymbolsNumber(
document.getCharsSequence(), foldRegion.getStartOffset(), myTargetOffset, position.x
);
}
else {
// Target offset is located on a different line with folding start.
- position.logicalColumn = myRepresentationHelper.toVisualColumnSymbolsNumber(
+ position.logicalColumn = SoftWrapModelImpl.getEditorTextRepresentationHelper(myEditor).toVisualColumnSymbolsNumber(
document.getCharsSequence(), foldRegion.getStartOffset(), myTargetOffset, 0
);
position.softWrapColumnDiff = 0;
diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/SoftWrapApplianceManager.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/SoftWrapApplianceManager.java
index 549cd1833779..3a819d88a370 100644
--- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/SoftWrapApplianceManager.java
+++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/SoftWrapApplianceManager.java
@@ -28,10 +28,7 @@ import com.intellij.openapi.editor.ex.DocumentEx;
import com.intellij.openapi.editor.ex.EditorEx;
import com.intellij.openapi.editor.ex.ScrollingModelEx;
import com.intellij.openapi.editor.ex.util.EditorUtil;
-import com.intellij.openapi.editor.impl.EditorImpl;
-import com.intellij.openapi.editor.impl.EditorTextRepresentationHelper;
-import com.intellij.openapi.editor.impl.IterationState;
-import com.intellij.openapi.editor.impl.TextChangeImpl;
+import com.intellij.openapi.editor.impl.*;
import com.intellij.openapi.editor.impl.softwrap.*;
import com.intellij.openapi.editor.markup.TextAttributes;
import com.intellij.openapi.util.text.StringUtil;
@@ -99,7 +96,6 @@ public class SoftWrapApplianceManager implements DocumentListener, Dumpable {
private int myVerticalScrollBarWidth = -1;
private VisibleAreaWidthProvider myWidthProvider;
- private EditorTextRepresentationHelper myRepresentationHelper;
private LineWrapPositionStrategy myLineWrapPositionStrategy;
private IncrementalCacheUpdateEvent myEventBeingProcessed;
private boolean myVisualAreaListenerAttached;
@@ -112,12 +108,11 @@ public class SoftWrapApplianceManager implements DocumentListener, Dumpable {
public SoftWrapApplianceManager(@NotNull SoftWrapsStorage storage,
@NotNull EditorEx editor,
@NotNull SoftWrapPainter painter,
- @NotNull EditorTextRepresentationHelper representationHelper, SoftWrapDataMapper dataMapper)
+ SoftWrapDataMapper dataMapper)
{
myStorage = storage;
myEditor = editor;
myPainter = painter;
- myRepresentationHelper = representationHelper;
myDataMapper = dataMapper;
myWidthProvider = new DefaultVisibleAreaWidthProvider(editor);
}
@@ -272,7 +267,7 @@ public class SoftWrapApplianceManager implements DocumentListener, Dumpable {
myContext.fontType = attributes.getFontType();
myContext.rangeEndOffset = event.getNewEndOffset();
- EditorPosition position = new EditorPosition(logical, start, myEditor, myRepresentationHelper);
+ EditorPosition position = new EditorPosition(logical, start, myEditor);
position.x = point.x;
int spaceWidth = EditorUtil.getSpaceWidth(myContext.fontType, myEditor);
@@ -333,7 +328,8 @@ public class SoftWrapApplianceManager implements DocumentListener, Dumpable {
}
int placeholderWidthInPixels = 0;
for (int i = 0; i < placeholder.length(); i++) {
- placeholderWidthInPixels += myRepresentationHelper.charWidth(placeholder.charAt(i), myContext.fontType);
+ placeholderWidthInPixels += SoftWrapModelImpl.getEditorTextRepresentationHelper(myEditor)
+ .charWidth(placeholder.charAt(i), myContext.fontType);
}
int newX = myContext.currentPosition.x + placeholderWidthInPixels;
@@ -617,7 +613,7 @@ public class SoftWrapApplianceManager implements DocumentListener, Dumpable {
return EditorUtil.nextTabStop(myContext.currentPosition.x, myEditor);
}
else {
- return myContext.currentPosition.x + myRepresentationHelper.charWidth(c, myContext.fontType);
+ return myContext.currentPosition.x + SoftWrapModelImpl.getEditorTextRepresentationHelper(myEditor).charWidth(c, myContext.fontType);
//FontInfo fontInfo = EditorUtil.fontForChar(c, myContext.fontType, myEditor);
//return myContext.currentPosition.x + fontInfo.charWidth(c, myContext.contentComponent);
}
@@ -1009,11 +1005,6 @@ public class SoftWrapApplianceManager implements DocumentListener, Dumpable {
reset();
}
- public void setRepresentationHelper(@NotNull EditorTextRepresentationHelper representationHelper) {
- myRepresentationHelper = representationHelper;
- reset();
- }
-
@NotNull
@Override
public String dumpState() {
diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/VisualToLogicalCalculationStrategy.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/VisualToLogicalCalculationStrategy.java
index d79e3bff8f63..7c7c6e475a4f 100644
--- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/VisualToLogicalCalculationStrategy.java
+++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/VisualToLogicalCalculationStrategy.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2011 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -16,7 +16,6 @@
package com.intellij.openapi.editor.impl.softwrap.mapping;
import com.intellij.openapi.editor.*;
-import com.intellij.openapi.editor.impl.EditorTextRepresentationHelper;
import com.intellij.openapi.editor.impl.softwrap.SoftWrapsStorage;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -33,11 +32,10 @@ class VisualToLogicalCalculationStrategy extends AbstractMappingStrategy<Logical
private final CacheEntry mySearchKey;
private VisualPosition myTargetVisual;
- VisualToLogicalCalculationStrategy(@NotNull Editor editor, @NotNull SoftWrapsStorage storage, @NotNull List<CacheEntry> cache,
- @NotNull EditorTextRepresentationHelper representationHelper)
+ VisualToLogicalCalculationStrategy(@NotNull Editor editor, @NotNull SoftWrapsStorage storage, @NotNull List<CacheEntry> cache)
{
- super(editor, storage, cache, representationHelper);
- mySearchKey = new CacheEntry(0, editor, representationHelper);
+ super(editor, storage, cache);
+ mySearchKey = new CacheEntry(0, editor);
}
public void init(@NotNull final VisualPosition targetVisual, @NotNull final List<CacheEntry> cache) {
diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/textarea/TextComponentCaret.java b/platform/platform-impl/src/com/intellij/openapi/editor/textarea/TextComponentCaret.java
index 5541e61f54fb..92ef12c46558 100644
--- a/platform/platform-impl/src/com/intellij/openapi/editor/textarea/TextComponentCaret.java
+++ b/platform/platform-impl/src/com/intellij/openapi/editor/textarea/TextComponentCaret.java
@@ -29,6 +29,12 @@ public class TextComponentCaret extends UserDataHolderBase implements Caret {
@NotNull
@Override
+ public Editor getEditor() {
+ return myEditor;
+ }
+
+ @NotNull
+ @Override
public CaretModel getCaretModel() {
return myEditor.getCaretModel();
}
diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/textarea/TextComponentEditor.java b/platform/platform-impl/src/com/intellij/openapi/editor/textarea/TextComponentEditor.java
index 80e0cbbc128b..486a7c511016 100644
--- a/platform/platform-impl/src/com/intellij/openapi/editor/textarea/TextComponentEditor.java
+++ b/platform/platform-impl/src/com/intellij/openapi/editor/textarea/TextComponentEditor.java
@@ -136,7 +136,7 @@ public class TextComponentEditor extends UserDataHolderBase implements Editor {
@NotNull
public EditorSettings getSettings() {
if (mySettings == null) {
- mySettings = new SettingsImpl(null);
+ mySettings = new SettingsImpl();
}
return mySettings;
}
diff --git a/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorWindow.java b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorWindow.java
index 860ba3211c4b..3519ab6a1af4 100644
--- a/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorWindow.java
+++ b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorWindow.java
@@ -264,11 +264,11 @@ public class EditorWindow {
}
public void closeFile(final VirtualFile file) {
- closeFile (file, true);
+ closeFile(file, true);
}
- public void closeFile(final VirtualFile file, final boolean unsplit) {
- closeFile(file, unsplit, true);
+ public void closeFile(final VirtualFile file, final boolean disposeIfNeeded) {
+ closeFile(file, disposeIfNeeded, true);
}
public boolean hasClosedTabs() {
@@ -286,7 +286,7 @@ public class EditorWindow {
}
}
- public void closeFile(final VirtualFile file, final boolean unsplit, final boolean transferFocus) {
+ public void closeFile(final VirtualFile file, final boolean disposeIfNeeded, final boolean transferFocus) {
final FileEditorManagerImpl editorManager = getManager();
editorManager.runChange(new FileEditorManagerChange() {
@Override
@@ -317,13 +317,15 @@ public class EditorWindow {
}
}
- if (unsplit && getTabCount() == 0) {
- unsplit (true);
+ if (disposeIfNeeded && getTabCount() == 0) {
+ removeFromSplitter();
}
- myPanel.revalidate ();
- if (myTabbedPane == null) {
- // in tabless mode
- myPanel.repaint();
+ else {
+ myPanel.revalidate();
+ if (myTabbedPane == null) {
+ // in tabless mode
+ myPanel.repaint();
+ }
}
}
finally {
@@ -347,6 +349,39 @@ public class EditorWindow {
}, myOwner);
}
+ private void removeFromSplitter() {
+ if (!inSplitter()) return;
+
+ if (myOwner.getCurrentWindow() == this) {
+ EditorWindow[] siblings = findSiblings();
+ myOwner.setCurrentWindow(siblings[0], false);
+ }
+
+ Splitter splitter = (Splitter)myPanel.getParent();
+ JComponent otherComponent = splitter.getOtherComponent(myPanel);
+
+ Container parent = splitter.getParent().getParent();
+ if (parent instanceof Splitter) {
+ Splitter parentSplitter = (Splitter)parent;
+ if (parentSplitter.getFirstComponent() == splitter.getParent()) {
+ parentSplitter.setFirstComponent(otherComponent);
+ }
+ else {
+ parentSplitter.setSecondComponent(otherComponent);
+ }
+ }
+ else if (parent instanceof EditorsSplitters) {
+ parent.removeAll();
+ parent.add(otherComponent, BorderLayout.CENTER);
+ ((JComponent)parent).revalidate();
+ }
+ else {
+ throw new IllegalStateException("Unknown container: " + parent);
+ }
+
+ dispose();
+ }
+
private int calcIndexToSelect(VirtualFile fileBeingClosed, final int fileIndex) {
final int currentlySelectedIndex = myTabbedPane.getSelectedIndex();
if (currentlySelectedIndex != fileIndex) {
@@ -503,6 +538,8 @@ public class EditorWindow {
public void requestFocus(boolean forced) {
if (myTabbedPane != null) {
myTabbedPane.requestFocus(forced);
+ } else {
+ IdeFocusManager.findInstanceByComponent(myPanel).requestFocus(myPanel, forced);
}
}
diff --git a/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/FileDocumentManagerImpl.java b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/FileDocumentManagerImpl.java
index 5def1e1fc161..f396b1eed399 100644
--- a/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/FileDocumentManagerImpl.java
+++ b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/FileDocumentManagerImpl.java
@@ -173,8 +173,12 @@ public class FileDocumentManagerImpl extends FileDocumentManager implements Virt
document.setModificationStamp(file.getModificationStamp());
final FileType fileType = file.getFileType();
document.setReadOnly(!file.isWritable() || fileType.isBinary());
- myDocuments.put(file, document);
- document.putUserData(FILE_KEY, file);
+ if (file instanceof LightVirtualFile) {
+ registerDocument(document, file);
+ } else {
+ myDocuments.put(file, document);
+ document.putUserData(FILE_KEY, file);
+ }
if (!(file instanceof LightVirtualFile || file.getFileSystem() instanceof DummyFileSystem)) {
document.addDocumentListener(
diff --git a/platform/platform-impl/src/com/intellij/openapi/keymap/impl/IdeKeyEventDispatcher.java b/platform/platform-impl/src/com/intellij/openapi/keymap/impl/IdeKeyEventDispatcher.java
index 34be36b69435..9a566e9915ef 100644
--- a/platform/platform-impl/src/com/intellij/openapi/keymap/impl/IdeKeyEventDispatcher.java
+++ b/platform/platform-impl/src/com/intellij/openapi/keymap/impl/IdeKeyEventDispatcher.java
@@ -314,6 +314,30 @@ public final class IdeKeyEventDispatcher implements Disposable {
}
}
+ private static KeyStroke getKeyStrokeWithoutCtrlModifier(KeyStroke originalKeyStroke){
+ int modifier=originalKeyStroke.getModifiers()&~InputEvent.CTRL_MASK&~InputEvent.CTRL_DOWN_MASK;
+ try {
+ Method[] methods=AWTKeyStroke.class.getDeclaredMethods();
+ Method getCachedStrokeMethod=null;
+ for (Method method : methods) {
+ if (GET_CACHED_STROKE_METHOD_NAME.equals(method.getName())) {
+ getCachedStrokeMethod = method;
+ getCachedStrokeMethod.setAccessible(true);
+ break;
+ }
+ }
+ if(getCachedStrokeMethod==null){
+ throw new IllegalStateException("not found method with name getCachedStrokeMethod");
+ }
+ Object[] getCachedStrokeMethodArgs=
+ {originalKeyStroke.getKeyChar(), originalKeyStroke.getKeyCode(), modifier, originalKeyStroke.isOnKeyRelease()};
+ return (KeyStroke)getCachedStrokeMethod.invoke(originalKeyStroke, getCachedStrokeMethodArgs);
+ }
+ catch(Exception exc){
+ throw new IllegalStateException(exc.getMessage());
+ }
+ }
+
private boolean inSecondStrokeInProgressState() {
KeyEvent e = myContext.getInputEvent();
@@ -396,6 +420,15 @@ public final class IdeKeyEventDispatcher implements Disposable {
KeyStroke originalKeyStroke=KeyStroke.getKeyStrokeForEvent(e);
KeyStroke keyStroke=getKeyStrokeWithoutMouseModifiers(originalKeyStroke);
+
+
+ if (Registry.is("fix.jdk7.alt.shortcuts") && SystemInfo.isMac && SystemInfo.isOracleJvm && (keyStroke.getModifiers() & InputEvent.ALT_MASK) == InputEvent.ALT_MASK)
+ {
+ if (KeymapManager.getInstance().getActiveKeymap().getActionIds(new KeyboardShortcut(keyStroke, null)).length == 0) {
+ keyStroke = getKeyStrokeWithoutCtrlModifier(keyStroke);
+ }
+ }
+
if (myKeyGestureProcessor.processInitState()) {
return true;
}
@@ -601,7 +634,9 @@ public final class IdeKeyEventDispatcher implements Disposable {
processor.onUpdatePassed(e, action, actionEvent);
- ((DataManagerImpl.MyDataContext)myContext.getDataContext()).setEventCount(IdeEventQueue.getInstance().getEventCount(), this);
+ if (myContext.getDataContext() instanceof DataManagerImpl.MyDataContext) { // this is not true for test data contexts
+ ((DataManagerImpl.MyDataContext)myContext.getDataContext()).setEventCount(IdeEventQueue.getInstance().getEventCount(), this);
+ }
actionManager.fireBeforeActionPerformed(action, actionEvent.getDataContext(), actionEvent);
Component component = PlatformDataKeys.CONTEXT_COMPONENT.getData(actionEvent.getDataContext());
if (component != null && !component.isShowing()) {
diff --git a/platform/platform-impl/src/com/intellij/openapi/keymap/impl/KeymapManagerImpl.java b/platform/platform-impl/src/com/intellij/openapi/keymap/impl/KeymapManagerImpl.java
index 4c093211cfd6..7b4f5a0371ba 100644
--- a/platform/platform-impl/src/com/intellij/openapi/keymap/impl/KeymapManagerImpl.java
+++ b/platform/platform-impl/src/com/intellij/openapi/keymap/impl/KeymapManagerImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -15,6 +15,7 @@
*/
package com.intellij.openapi.keymap.impl;
+import com.intellij.openapi.actionSystem.IdeActions;
import com.intellij.openapi.application.PathManager;
import com.intellij.openapi.components.*;
import com.intellij.openapi.diagnostic.Logger;
@@ -27,6 +28,7 @@ import com.intellij.openapi.options.SchemesManager;
import com.intellij.openapi.options.SchemesManagerFactory;
import com.intellij.openapi.util.InvalidDataException;
import com.intellij.openapi.util.WriteExternalException;
+import com.intellij.openapi.util.registry.Registry;
import com.intellij.util.containers.ContainerUtil;
import org.jdom.Document;
import org.jdom.Element;
@@ -35,6 +37,7 @@ import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import java.awt.event.KeyEvent;
import java.io.File;
import java.io.IOException;
import java.util.*;
@@ -92,6 +95,14 @@ public class KeymapManagerImpl extends KeymapManagerEx implements PersistentStat
}
}
load();
+
+ if (Registry.is("editor.add.carets.on.double.control.arrows")) {
+ ModifierKeyDoubleClickHandler.getInstance().registerAction(IdeActions.ACTION_EDITOR_CLONE_CARET_ABOVE, KeyEvent.VK_CONTROL, KeyEvent.VK_UP);
+ ModifierKeyDoubleClickHandler.getInstance().registerAction(IdeActions.ACTION_EDITOR_CLONE_CARET_BELOW, KeyEvent.VK_CONTROL, KeyEvent.VK_DOWN);
+ ModifierKeyDoubleClickHandler.getInstance().registerAction(IdeActions.ACTION_EDITOR_MOVE_CARET_LEFT, KeyEvent.VK_CONTROL, KeyEvent.VK_LEFT);
+ ModifierKeyDoubleClickHandler.getInstance().registerAction(IdeActions.ACTION_EDITOR_MOVE_CARET_RIGHT, KeyEvent.VK_CONTROL, KeyEvent.VK_RIGHT);
+ }
+
ourKeymapManagerInitialized = true;
}
diff --git a/platform/platform-impl/src/com/intellij/openapi/keymap/impl/ModifierKeyDoubleClickHandler.java b/platform/platform-impl/src/com/intellij/openapi/keymap/impl/ModifierKeyDoubleClickHandler.java
new file mode 100644
index 000000000000..28536453b713
--- /dev/null
+++ b/platform/platform-impl/src/com/intellij/openapi/keymap/impl/ModifierKeyDoubleClickHandler.java
@@ -0,0 +1,210 @@
+/*
+ * Copyright 2000-2014 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.openapi.keymap.impl;
+
+import com.intellij.ide.DataManager;
+import com.intellij.ide.IdeEventQueue;
+import com.intellij.openapi.actionSystem.ActionManager;
+import com.intellij.openapi.actionSystem.ActionPlaces;
+import com.intellij.openapi.actionSystem.AnAction;
+import com.intellij.openapi.actionSystem.AnActionEvent;
+import com.intellij.openapi.keymap.KeymapManager;
+import com.intellij.openapi.util.Clock;
+import com.intellij.openapi.util.Couple;
+import com.intellij.openapi.wm.IdeFocusManager;
+import com.intellij.util.containers.ConcurrentHashMap;
+import gnu.trove.TIntIntHashMap;
+import gnu.trove.TIntIntProcedure;
+import org.jetbrains.annotations.NotNull;
+
+import java.awt.*;
+import java.awt.event.InputEvent;
+import java.awt.event.KeyEvent;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicLong;
+
+/**
+ * Support for keyboard shortcuts like Control-double-click or Control-double-click+A
+ */
+public class ModifierKeyDoubleClickHandler {
+ private static final ModifierKeyDoubleClickHandler INSTANCE = new ModifierKeyDoubleClickHandler();
+
+ private final ConcurrentMap<String, IdeEventQueue.EventDispatcher> myDispatchers = new ConcurrentHashMap<String, IdeEventQueue.EventDispatcher>();
+
+ private ModifierKeyDoubleClickHandler() { }
+
+ public static ModifierKeyDoubleClickHandler getInstance() {
+ return INSTANCE;
+ }
+
+ /**
+ * @param actionId Id of action to be triggered on modifier+modifier[+actionKey]
+ * @param modifierKeyCode keyCode for modifier, e.g. KeyEvent.VK_SHIFT
+ * @param actionKeyCode keyCode for actionKey, or -1 if action should be triggered on bare modifier double click
+ */
+ public void registerAction(@NotNull String actionId,
+ int modifierKeyCode,
+ int actionKeyCode) {
+ final MyDispatcher dispatcher = new MyDispatcher(actionId, modifierKeyCode, actionKeyCode);
+ IdeEventQueue.EventDispatcher oldDispatcher = myDispatchers.put(actionId, dispatcher);
+ IdeEventQueue.getInstance().addDispatcher(dispatcher, null);
+ if (oldDispatcher != null) {
+ IdeEventQueue.getInstance().removeDispatcher(oldDispatcher);
+ }
+ }
+
+ public void unregisterAction(@NotNull String actionId) {
+ IdeEventQueue.EventDispatcher oldDispatcher = myDispatchers.remove(actionId);
+ if (oldDispatcher != null) {
+ IdeEventQueue.getInstance().removeDispatcher(oldDispatcher);
+ }
+ }
+
+ private static class MyDispatcher implements IdeEventQueue.EventDispatcher {
+ private static final TIntIntHashMap KEY_CODE_TO_MODIFIER_MAP = new TIntIntHashMap();
+ static {
+ KEY_CODE_TO_MODIFIER_MAP.put(KeyEvent.VK_ALT, InputEvent.ALT_MASK);
+ KEY_CODE_TO_MODIFIER_MAP.put(KeyEvent.VK_CONTROL, InputEvent.CTRL_MASK);
+ KEY_CODE_TO_MODIFIER_MAP.put(KeyEvent.VK_META, InputEvent.META_MASK);
+ KEY_CODE_TO_MODIFIER_MAP.put(KeyEvent.VK_SHIFT, InputEvent.SHIFT_MASK);
+ }
+
+ private final String myActionId;
+ private final int myModifierKeyCode;
+ private final int myActionKeyCode;
+
+ private final Couple<AtomicBoolean> ourPressed = Couple.of(new AtomicBoolean(false), new AtomicBoolean(false));
+ private final Couple<AtomicBoolean> ourReleased = Couple.of(new AtomicBoolean(false), new AtomicBoolean(false));
+ private final AtomicBoolean ourOtherKeyWasPressed = new AtomicBoolean(false);
+ private final AtomicLong ourLastTimePressed = new AtomicLong(0);
+
+ public MyDispatcher(@NotNull String actionId, int modifierKeyCode, int actionKeyCode) {
+ myActionId = actionId;
+ myModifierKeyCode = modifierKeyCode;
+ myActionKeyCode = actionKeyCode;
+ }
+
+ @Override
+ public boolean dispatch(AWTEvent event) {
+ if (event instanceof KeyEvent) {
+ final KeyEvent keyEvent = (KeyEvent)event;
+ final int keyCode = keyEvent.getKeyCode();
+
+ if (keyCode == myModifierKeyCode) {
+ if (hasOtherModifiers(keyEvent)) {
+ resetState();
+ return false;
+ }
+ if (ourOtherKeyWasPressed.get() && Clock.getTime() - ourLastTimePressed.get() < 500) {
+ resetState();
+ return false;
+ }
+ ourOtherKeyWasPressed.set(false);
+ if (ourPressed.first.get() && Clock.getTime() - ourLastTimePressed.get() > 500) {
+ resetState();
+ }
+ handleModifier((KeyEvent)event);
+ return false;
+ } else if (ourPressed.first.get() && ourReleased.first.get() && ourPressed.second.get() && myActionKeyCode != -1) {
+ if (keyCode == myActionKeyCode) {
+ if (event.getID() == KeyEvent.KEY_RELEASED) {
+ run(keyEvent);
+ }
+ return true;
+ }
+ return false;
+ } else {
+ ourLastTimePressed.set(Clock.getTime());
+ ourOtherKeyWasPressed.set(true);
+ if (keyCode == KeyEvent.VK_ESCAPE || keyCode == KeyEvent.VK_TAB) {
+ ourLastTimePressed.set(0);
+ }
+ }
+ resetState();
+ }
+ return false;
+ }
+
+ private boolean hasOtherModifiers(KeyEvent keyEvent) {
+ final int modifiers = keyEvent.getModifiers();
+ return !KEY_CODE_TO_MODIFIER_MAP.forEachEntry(new TIntIntProcedure() {
+ @Override
+ public boolean execute(int keyCode, int modifierMask) {
+ return keyCode == myModifierKeyCode || (modifiers & modifierMask) == 0;
+ }
+ });
+ }
+
+ private void handleModifier(KeyEvent event) {
+ if (ourPressed.first.get() && Clock.getTime() - ourLastTimePressed.get() > 300) {
+ resetState();
+ return;
+ }
+
+ if (event.getID() == KeyEvent.KEY_PRESSED) {
+ if (!ourPressed.first.get()) {
+ resetState();
+ ourPressed.first.set(true);
+ ourLastTimePressed.set(Clock.getTime());
+ return;
+ } else {
+ if (ourPressed.first.get() && ourReleased.first.get()) {
+ ourPressed.second.set(true);
+ ourLastTimePressed.set(Clock.getTime());
+ return;
+ }
+ }
+ } else if (event.getID() == KeyEvent.KEY_RELEASED) {
+ if (ourPressed.first.get() && !ourReleased.first.get()) {
+ ourReleased.first.set(true);
+ ourLastTimePressed.set(Clock.getTime());
+ return;
+ } else if (ourPressed.first.get() && ourReleased.first.get() && ourPressed.second.get()) {
+ resetState();
+ if (myActionKeyCode == -1 && !isActionBound()) {
+ run(event);
+ }
+ return;
+ }
+ }
+ resetState();
+ }
+
+ private void resetState() {
+ ourPressed.first.set(false);
+ ourPressed.second.set(false);
+ ourReleased.first.set(false);
+ ourReleased.second.set(false);
+ }
+
+ private void run(KeyEvent event) {
+ final ActionManager actionManager = ActionManager.getInstance();
+ final AnAction action = actionManager.getAction(myActionId);
+ final AnActionEvent anActionEvent = new AnActionEvent(event,
+ DataManager.getInstance().getDataContext(IdeFocusManager.findInstance().getFocusOwner()),
+ ActionPlaces.MAIN_MENU,
+ action.getTemplatePresentation(),
+ actionManager,
+ 0);
+ action.actionPerformed(anActionEvent);
+ }
+
+ private boolean isActionBound() {
+ return KeymapManager.getInstance().getActiveKeymap().getShortcuts(myActionId).length > 0;
+ }
+ }
+}
diff --git a/platform/platform-impl/src/com/intellij/openapi/options/ConfigurableBase.java b/platform/platform-impl/src/com/intellij/openapi/options/ConfigurableBase.java
new file mode 100644
index 000000000000..104dc7b30ec7
--- /dev/null
+++ b/platform/platform-impl/src/com/intellij/openapi/options/ConfigurableBase.java
@@ -0,0 +1,52 @@
+package com.intellij.openapi.options;
+
+import org.jetbrains.annotations.Nullable;
+
+import javax.swing.*;
+
+public abstract class ConfigurableBase<UI extends ConfigurableUi<S>, S> implements SearchableConfigurable, Configurable.NoScroll {
+ private UI ui;
+
+ @Nullable
+ @Override
+ public Runnable enableSearch(String option) {
+ return null;
+ }
+
+ protected abstract S getSettings();
+
+ @Override
+ public void reset() {
+ if (ui != null) {
+ ui.reset(getSettings());
+ }
+ }
+
+ @Nullable
+ @Override
+ public final JComponent createComponent() {
+ if (ui == null) {
+ ui = createUi();
+ }
+ return ui.getComponent();
+ }
+
+ protected abstract UI createUi();
+
+ @Override
+ public final boolean isModified() {
+ return ui != null && ui.isModified(getSettings());
+ }
+
+ @Override
+ public final void apply() {
+ if (ui != null) {
+ ui.apply(getSettings());
+ }
+ }
+
+ @Override
+ public void disposeUIResources() {
+ ui = null;
+ }
+} \ No newline at end of file
diff --git a/platform/platform-impl/src/com/intellij/openapi/options/ConfigurableUi.java b/platform/platform-impl/src/com/intellij/openapi/options/ConfigurableUi.java
new file mode 100644
index 000000000000..e454099318ea
--- /dev/null
+++ b/platform/platform-impl/src/com/intellij/openapi/options/ConfigurableUi.java
@@ -0,0 +1,16 @@
+package com.intellij.openapi.options;
+
+import org.jetbrains.annotations.NotNull;
+
+import javax.swing.*;
+
+public interface ConfigurableUi<S> {
+ void reset(@NotNull S settings);
+
+ boolean isModified(@NotNull S settings);
+
+ void apply(@NotNull S settings);
+
+ @NotNull
+ JComponent getComponent();
+} \ No newline at end of file
diff --git a/platform/platform-impl/src/com/intellij/openapi/options/ex/ConfigurableWrapper.java b/platform/platform-impl/src/com/intellij/openapi/options/ex/ConfigurableWrapper.java
index ed72e27e8c22..5f8dc0e890df 100644
--- a/platform/platform-impl/src/com/intellij/openapi/options/ex/ConfigurableWrapper.java
+++ b/platform/platform-impl/src/com/intellij/openapi/options/ex/ConfigurableWrapper.java
@@ -47,8 +47,17 @@ public class ConfigurableWrapper implements SearchableConfigurable {
@Nullable
public static <T extends UnnamedConfigurable> T wrapConfigurable(ConfigurableEP<T> ep) {
- if (ep.displayName != null || ep.key != null) {
- return (T)(ep.children != null || ep.childrenEPName != null || ep.dynamic ? new CompositeWrapper(ep) : new ConfigurableWrapper(ep));
+ if (ep.displayName != null || ep.key != null || ep.groupId != null) {
+ T configurable = null;
+ if (ep.providerClass != null) {
+ configurable = ep.createConfigurable();
+ if (configurable == null) {
+ return null; // it is allowed to return null from provider
+ }
+ }
+ return ep.children != null || ep.childrenEPName != null || ep.dynamic
+ ? (T)new CompositeWrapper(ep, configurable)
+ : (T)new ConfigurableWrapper(ep, configurable);
}
else {
return ep.createConfigurable();
@@ -76,8 +85,9 @@ public class ConfigurableWrapper implements SearchableConfigurable {
private final ConfigurableEP myEp;
- private ConfigurableWrapper(@NotNull ConfigurableEP ep) {
+ private ConfigurableWrapper(@NotNull ConfigurableEP ep, @Nullable UnnamedConfigurable configurable) {
myEp = ep;
+ myConfigurable = configurable;
}
private UnnamedConfigurable myConfigurable;
@@ -95,6 +105,12 @@ public class ConfigurableWrapper implements SearchableConfigurable {
@Nls
@Override
public String getDisplayName() {
+ if (myEp.displayName == null && myEp.key == null) {
+ UnnamedConfigurable configurable = getConfigurable();
+ if (configurable instanceof Configurable) {
+ return ((Configurable)configurable).getDisplayName();
+ }
+ }
return myEp.getDisplayName();
}
@@ -141,16 +157,24 @@ public class ConfigurableWrapper implements SearchableConfigurable {
@NotNull
@Override
public String getId() {
- return myEp.id == null ? myEp.instanceClass : myEp.id;
+ return myEp.id == null ? myEp.instanceClass == null ? myEp.providerClass : myEp.instanceClass : myEp.id;
}
+ @NotNull
+ public ConfigurableEP getExtensionPoint() {
+ return myEp;
+ }
+
+ public String getGroupId() {
+ return myEp.groupId;
+ }
public String getParentId() {
return myEp.parentId;
}
public ConfigurableWrapper addChild(Configurable configurable) {
- return new CompositeWrapper(myEp, configurable);
+ return new CompositeWrapper(myEp, null, configurable);
}
@Override
@@ -169,8 +193,8 @@ public class ConfigurableWrapper implements SearchableConfigurable {
private Configurable[] myKids;
- private CompositeWrapper(ConfigurableEP ep, Configurable... kids) {
- super(ep);
+ private CompositeWrapper(@NotNull ConfigurableEP ep, @Nullable UnnamedConfigurable configurable, Configurable... kids) {
+ super(ep, configurable);
if (ep.dynamic) {
kids = ((Composite)getConfigurable()).getConfigurables();
}
diff --git a/platform/platform-impl/src/com/intellij/openapi/options/ex/MixedConfigurableGroup.java b/platform/platform-impl/src/com/intellij/openapi/options/ex/MixedConfigurableGroup.java
new file mode 100644
index 000000000000..f465e2d0fecb
--- /dev/null
+++ b/platform/platform-impl/src/com/intellij/openapi/options/ex/MixedConfigurableGroup.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2000-2014 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.openapi.options.ex;
+
+import com.intellij.openapi.options.Configurable;
+import com.intellij.openapi.options.ConfigurableGroup;
+import com.intellij.openapi.options.OptionsBundle;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map.Entry;
+
+public final class MixedConfigurableGroup implements ConfigurableGroup {
+ private final String myGroupId;
+ private Configurable[] myConfigurables;
+
+ private MixedConfigurableGroup(String groupId, ArrayList<Configurable> configurables) {
+ myGroupId = groupId;
+ myConfigurables = (configurables != null)
+ ? configurables.toArray(new Configurable[configurables.size()])
+ : new Configurable[0];
+ }
+
+ private MixedConfigurableGroup(String groupId, HashMap<String, ArrayList<Configurable>> configurables) {
+ this(groupId, configurables.remove(groupId));
+ }
+
+ @Override
+ public String getDisplayName() {
+ return OptionsBundle.message("configurable.group." + myGroupId + ".settings.display.name");
+ }
+
+ @Override
+ public String getShortName() {
+ return getDisplayName();
+ }
+
+ @Override
+ public Configurable[] getConfigurables() {
+ return myConfigurables;
+ }
+
+ public static ConfigurableGroup[] getGroups(Configurable... configurables) {
+ HashMap<String, ArrayList<Configurable>> map = new HashMap<String, ArrayList<Configurable>>();
+ for (Configurable configurable : configurables) {
+ String groupId = null;
+ if (configurable instanceof ConfigurableWrapper) {
+ groupId = ((ConfigurableWrapper)configurable).getGroupId();
+ }
+ ArrayList<Configurable> list = map.get(groupId);
+ if (list == null) {
+ map.put(groupId, list = new ArrayList<Configurable>());
+ }
+ list.add(configurable);
+ }
+ ArrayList<ConfigurableGroup> groups = new ArrayList<ConfigurableGroup>(map.size());
+ groups.add(new MixedConfigurableGroup("appearance", map));
+ groups.add(new MixedConfigurableGroup("editor", map));
+ groups.add(new MixedConfigurableGroup("project", map));
+ groups.add(new MixedConfigurableGroup("build", map));
+ groups.add(new MixedConfigurableGroup("language", map));
+ groups.add(new MixedConfigurableGroup("tools", map));
+ ConfigurableGroup other = new MixedConfigurableGroup(null, map);
+ for(Entry<String, ArrayList<Configurable>>entry: map.entrySet()){
+ groups.add(new MixedConfigurableGroup(entry.getKey(), entry.getValue()));
+ }
+ groups.add(other);
+ return groups.toArray(new ConfigurableGroup[groups.size()]);
+ }
+}
diff --git a/platform/platform-impl/src/com/intellij/openapi/options/newEditor/OptionsTree.java b/platform/platform-impl/src/com/intellij/openapi/options/newEditor/OptionsTree.java
index bd843131e16a..5524df2bb2cb 100644
--- a/platform/platform-impl/src/com/intellij/openapi/options/newEditor/OptionsTree.java
+++ b/platform/platform-impl/src/com/intellij/openapi/options/newEditor/OptionsTree.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2012 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -15,15 +15,19 @@
*/
package com.intellij.openapi.options.newEditor;
+import com.intellij.icons.AllIcons;
import com.intellij.ide.util.treeView.NodeDescriptor;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.options.Configurable;
import com.intellij.openapi.options.ConfigurableGroup;
+import com.intellij.openapi.options.OptionsBundle;
import com.intellij.openapi.options.SearchableConfigurable;
+import com.intellij.openapi.options.ex.ConfigurableWrapper;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.ActionCallback;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.SystemInfo;
+import com.intellij.openapi.util.registry.Registry;
import com.intellij.ui.*;
import com.intellij.ui.components.panels.NonOpaquePanel;
import com.intellij.ui.treeStructure.*;
@@ -287,7 +291,7 @@ public class OptionsTree extends JPanel implements Disposable, OptionsEditorColl
class Renderer extends GroupedElementsRenderer.Tree {
-
+ private JLabel myProjectIcon;
private JLabel myHandle;
@Override
@@ -304,6 +308,9 @@ public class OptionsTree extends JPanel implements Disposable, OptionsEditorColl
myHandle.setOpaque(false);
content.add(myHandle, BorderLayout.WEST);
content.add(myComponent, BorderLayout.CENTER);
+ myProjectIcon = new JLabel(" ", AllIcons.General.ProjectConfigurable, SwingConstants.LEFT);
+ myProjectIcon.setOpaque(true);
+ content.add(myProjectIcon, BorderLayout.EAST);
myRendererComponent.add(content, BorderLayout.CENTER);
}
@@ -393,10 +400,39 @@ public class OptionsTree extends JPanel implements Disposable, OptionsEditorColl
myTextLabel.setForeground(selected ? UIUtil.getTreeSelectionForeground() : fg);
myTextLabel.setOpaque(selected);
+ if (Registry.is("ide.file.settings.order.new")) {
+ myTextLabel.setBorder(new EmptyBorder(1,2,1,0));
+ }
+ Project project = getConfigurableProject(base);
+ if (project != null && Registry.is("ide.file.settings.order.new")) {
+ myProjectIcon.setBackground(selected ? getSelectionBackground() : getBackground());
+ myProjectIcon.setVisible(true);
+ tree.setToolTipText(OptionsBundle.message(project.isDefault()
+ ? "configurable.default.project.tooltip"
+ : "configurable.current.project.tooltip"));
+ } else {
+ myProjectIcon.setVisible(false);
+ tree.setToolTipText(null);
+ }
return result;
}
+ private Project getConfigurableProject(SimpleNode node) {
+ if (node == null) {
+ return null;
+ }
+ if (node instanceof EditorNode) {
+ EditorNode editor = (EditorNode)node;
+ Configurable configurable = editor.getConfigurable();
+ if (configurable instanceof ConfigurableWrapper) {
+ ConfigurableWrapper wrapper = (ConfigurableWrapper)configurable;
+ return wrapper.getExtensionPoint().getProject();
+ }
+ }
+ return getConfigurableProject(node.getParent());
+ }
+
protected JComponent createItemComponent() {
myTextLabel = new ErrorLabel();
return myTextLabel;
@@ -602,6 +638,12 @@ public class OptionsTree extends JPanel implements Disposable, OptionsEditorColl
private MyTree() {
getInputMap().clear();
+ setOpaque(true);
+ }
+
+ @Override
+ protected boolean paintNodes() {
+ return false;
}
@Override
diff --git a/platform/platform-impl/src/com/intellij/openapi/project/impl/ProjectManagerImpl.java b/platform/platform-impl/src/com/intellij/openapi/project/impl/ProjectManagerImpl.java
index c79e4118f36c..2f95c21cb558 100644
--- a/platform/platform-impl/src/com/intellij/openapi/project/impl/ProjectManagerImpl.java
+++ b/platform/platform-impl/src/com/intellij/openapi/project/impl/ProjectManagerImpl.java
@@ -752,8 +752,11 @@ public class ProjectManagerImpl extends ProjectManagerEx implements NamedJDOMExt
message = ProjectBundle.message("project.reload.external.change.multiple", filesBuilder.toString());
}
- return Messages.showTwoStepConfirmationDialog(message, ProjectBundle.message("project.reload.external.change.title"), "Reload project",
- Messages.getQuestionIcon()) == 0;
+ return Messages.showDialog(message,
+ ProjectBundle.message("project.reload.external.change.title"),
+ new String[]{"&Reload Project", "&Discard Changes"},
+ -1,
+ Messages.getQuestionIcon()) == 0;
}
@Override
diff --git a/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/PluginUpdateInfoPanel.form b/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/PluginUpdateInfoPanel.form
index 167e5ef8ab00..0e86badb08c5 100644
--- a/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/PluginUpdateInfoPanel.form
+++ b/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/PluginUpdateInfoPanel.form
@@ -20,7 +20,7 @@
<grid id="3559e" binding="myPluginsPanel" layout-manager="BorderLayout" hgap="0" vgap="0">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
- <gridbag top="3" left="0" bottom="3" right="0" weightx="1.0" weighty="0.0"/>
+ <gridbag top="3" left="0" bottom="3" right="0" weightx="1.0" weighty="1.0"/>
</constraints>
<properties>
<autoscrolls value="false"/>
@@ -41,12 +41,6 @@
<contentType value="text/html"/>
</properties>
</component>
- <vspacer id="bf1d9">
- <constraints>
- <grid row="3" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
- <gridbag weightx="0.0" weighty="1.0"/>
- </constraints>
- </vspacer>
</children>
</grid>
</form>
diff --git a/platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/FileWatcher.java b/platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/FileWatcher.java
index f7346548124a..8d00a82d4814 100644
--- a/platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/FileWatcher.java
+++ b/platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/FileWatcher.java
@@ -120,9 +120,6 @@ public class FileWatcher {
}
});
}
- else if (!isUpToDate(myExecutable)) {
- notifyOnFailure(ApplicationBundle.message("watcher.exe.outdated"), null);
- }
else {
try {
startupProcess(false);
@@ -181,30 +178,16 @@ public class FileWatcher {
@Nullable
private static File getExecutable() {
- String execPath = null;
-
- final String altExecPath = System.getProperty(PROPERTY_WATCHER_EXECUTABLE_PATH);
- if (altExecPath != null && new File(altExecPath).isFile()) {
- execPath = FileUtil.toSystemDependentName(altExecPath);
- }
+ String execPath = System.getProperty(PROPERTY_WATCHER_EXECUTABLE_PATH);
+ if (execPath != null) return new File(execPath);
- if (execPath == null) {
- final String execName = getExecutableName(false);
- if (execName == null) {
- return null;
- }
- execPath = FileUtil.join(PathManager.getBinPath(), execName);
- }
+ String execName = getExecutableName(false);
+ if (execName == null) return null;
- File exec = new File(execPath);
- if (!exec.exists()) {
- String homePath = PathManager.getHomePath();
- if (new File(homePath, "community").exists()) {
- homePath += File.separator + "community";
- }
- exec = new File(FileUtil.join(homePath, "bin", getExecutableName(true)));
- }
- return exec;
+ return FileUtil.findFirstThatExist(
+ FileUtil.join(PathManager.getBinPath(), execName),
+ FileUtil.join(PathManager.getHomePath(), "community", "bin", getExecutableName(true)),
+ FileUtil.join(PathManager.getBinPath(), getExecutableName(true)));
}
@Nullable
@@ -215,14 +198,6 @@ public class FileWatcher {
return null;
}
- private static boolean isUpToDate(File executable) {
- long length = SystemInfo.isWindows ? 71208 :
- SystemInfo.isMac ? 13984 :
- SystemInfo.isLinux ? SystemInfo.isAMD64 ? 29155 : 22791 :
- -1;
- return length < 0 || length == executable.length();
- }
-
public void notifyOnFailure(final String cause, @Nullable final NotificationListener listener) {
LOG.warn(cause);
@@ -580,8 +555,11 @@ public class FileWatcher {
case CREATE:
case DELETE:
for (String p : paths) {
+ myDirtyPaths.dirtyPaths.add(p);
String parentPath = new File(p).getParent();
- myDirtyPaths.dirtyPaths.add(parentPath != null ? parentPath : p);
+ if (parentPath != null) {
+ myDirtyPaths.dirtyPaths.add(parentPath);
+ }
}
break;
diff --git a/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/FSRecords.java b/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/FSRecords.java
index 72cd066472c6..b05b7a285e7b 100644
--- a/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/FSRecords.java
+++ b/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/FSRecords.java
@@ -1338,7 +1338,11 @@ public class FSRecords implements Forceable {
private static final MessageDigest myDigest = ContentHashesUtil.createHashDigest();
public static void writeContent(int fileId, ByteSequence bytes, boolean readOnly) throws IOException {
- new ContentOutputStream(fileId, readOnly).writeBytes(bytes);
+ try {
+ new ContentOutputStream(fileId, readOnly).writeBytes(bytes);
+ } catch (Throwable e) {
+ throw DbConnection.handleError(e);
+ }
}
public static int storeUnlinkedContent(byte[] bytes) {
diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/FocusManagerImpl.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/FocusManagerImpl.java
index 36a79f23cf89..c302cce7572e 100644
--- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/FocusManagerImpl.java
+++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/FocusManagerImpl.java
@@ -195,7 +195,7 @@ public class FocusManagerImpl extends IdeFocusManager implements Disposable {
@Override
@NotNull
public ActionCallback requestFocus(@NotNull final Component c, final boolean forced) {
- return requestFocus(new FocusCommand.ByComponent(c), forced);
+ return requestFocus(new FocusCommand.ByComponent(c, new Exception()), forced);
}
@Override
@@ -1148,7 +1148,7 @@ public class FocusManagerImpl extends IdeFocusManager implements Disposable {
}
if (toFocus != null) {
- return requestFocus(new FocusCommand.ByComponent(toFocus).setToInvalidateRequestors(false), forced);
+ return requestFocus(new FocusCommand.ByComponent(toFocus, new Exception()).setToInvalidateRequestors(false), forced);
}
diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/StripeButton.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/StripeButton.java
index 7d534d5be545..f62ff2c1819a 100644
--- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/StripeButton.java
+++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/StripeButton.java
@@ -30,6 +30,7 @@ import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.wm.ToolWindowAnchor;
import com.intellij.ui.MouseDragHelper;
import com.intellij.ui.PopupHandler;
+import com.intellij.util.ui.JBImageIcon;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -183,12 +184,22 @@ public final class StripeButton extends AnchoredButton implements ActionListener
if (myDragPane == null) return;
final BufferedImage image = UIUtil.createImage(getWidth(), getHeight(), BufferedImage.TYPE_INT_ARGB);
paint(image.getGraphics());
- myDragButtonImage = new JLabel(new ImageIcon(image)) {
+ myDragButtonImage = new JLabel(new JBImageIcon(image)) {
public String toString() {
return "Image for: " + StripeButton.this.toString();
}
};
+
+ myDragButtonImage.addMouseListener(new MouseAdapter() {
+ @Override
+ public void mouseReleased(MouseEvent e) {
+ finishDragging();
+ myPressedPoint = null;
+ myDragButtonImage = null;
+ super.mouseReleased(e);
+ }
+ });
myDragPane.add(myDragButtonImage, JLayeredPane.POPUP_LAYER);
myDragButtonImage.setSize(myDragButtonImage.getPreferredSize());
setVisible(false);
diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/TestWindowManager.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/TestWindowManager.java
index b2fc056d0a71..aa7d022a4b5e 100644
--- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/TestWindowManager.java
+++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/TestWindowManager.java
@@ -22,6 +22,7 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.MessageType;
import com.intellij.openapi.ui.popup.BalloonHandler;
import com.intellij.openapi.util.Disposer;
+import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.wm.IdeFrame;
import com.intellij.openapi.wm.StatusBar;
@@ -38,14 +39,16 @@ import javax.swing.event.HyperlinkListener;
import java.awt.*;
import java.awt.event.ComponentEvent;
import java.util.Collections;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
/**
* @author Anton Katilin
* @author Vladimir Kondratyev
*/
public final class TestWindowManager extends WindowManagerEx {
- private static final StatusBarEx ourStatusBar = new DummyStatusBar();
+ private static final Key<StatusBar> STATUS_BAR = Key.create("STATUS_BAR");
public final void doNotSuggestAsParent(final Window window) { }
@@ -66,7 +69,13 @@ public final class TestWindowManager extends WindowManagerEx {
@Override
public final StatusBar getStatusBar(final Project project) {
- return ourStatusBar;
+ synchronized (STATUS_BAR) {
+ StatusBar statusBar = project.getUserData(STATUS_BAR);
+ if (statusBar == null) {
+ project.putUserData(STATUS_BAR, statusBar = new DummyStatusBar());
+ }
+ return statusBar;
+ }
}
@Override
@@ -86,6 +95,8 @@ public final class TestWindowManager extends WindowManagerEx {
public void resetWindow(final Window window) { }
private static final class DummyStatusBar implements StatusBarEx {
+ private final Map<String, StatusBarWidget> myWidgetMap = new HashMap<String, StatusBarWidget>();
+
@Override
public Dimension getSize() {
return new Dimension(0, 0);
@@ -140,33 +151,39 @@ public final class TestWindowManager extends WindowManagerEx {
}
@Override
+ public void addWidget(@NotNull StatusBarWidget widget) {
+ myWidgetMap.put(widget.ID(), widget);
+ }
+
+ @Override
+ public void addWidget(@NotNull StatusBarWidget widget, @NotNull String anchor) {
+ addWidget(widget);
+ }
+
+ @Override
public void addWidget(@NotNull StatusBarWidget widget, @NotNull Disposable parentDisposable) {
Disposer.register(parentDisposable, widget);
+ addWidget(widget);
}
@Override
public void addWidget(@NotNull StatusBarWidget widget, @NotNull String anchor, @NotNull Disposable parentDisposable) {
Disposer.register(parentDisposable, widget);
+ addWidget(widget);
}
@Override
public void updateWidgets() { }
@Override
- public void addWidget(@NotNull StatusBarWidget widget) { }
-
- @Override
public void dispose() { }
@Override
- public void addWidget(@NotNull StatusBarWidget widget, @NotNull String anchor) { }
-
- @Override
public void updateWidget(@NotNull String id) { }
@Override
public StatusBarWidget getWidget(String id) {
- return null;
+ return myWidgetMap.get(id);
}
@Override
diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowImpl.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowImpl.java
index ae1e5336e9fe..efcdd148d57b 100644
--- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowImpl.java
+++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowImpl.java
@@ -357,7 +357,7 @@ public final class ToolWindowImpl implements ToolWindowEx {
ApplicationManager.getApplication().assertIsDispatchThread();
final Icon oldIcon = getIcon();
if (oldIcon != icon && !(icon instanceof LayeredIcon) && (icon.getIconHeight() != 13 || icon.getIconWidth() != 13)) {
- LOG.warn("ToolWindow icons should be 13x13. Please fix " + icon);
+ LOG.warn("ToolWindow icons should be 13x13. Please fix ToolWindow (ID: " + getId() + ") or icon " + icon);
}
getSelectedContent().setIcon(icon);
myIcon = icon;
diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/commands/RequestFocusInToolWindowCmd.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/commands/RequestFocusInToolWindowCmd.java
index d58d3b914849..c8f542133149 100644
--- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/commands/RequestFocusInToolWindowCmd.java
+++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/commands/RequestFocusInToolWindowCmd.java
@@ -184,7 +184,7 @@ public final class RequestFocusInToolWindowCmd extends FinalizableCommand {
}).notify(result);
}
else {
- myManager.getFocusManager().requestFocus(new FocusCommand.ByComponent(c, myToolWindow.getComponent()), myForced)
+ myManager.getFocusManager().requestFocus(new FocusCommand.ByComponent(c, myToolWindow.getComponent(), new Exception()), myForced)
.doWhenProcessed(new Runnable() {
@Override
public void run() {
diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/InfoAndProgressPanel.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/InfoAndProgressPanel.java
index 84b6e6a7e0ce..e00c195be9ce 100644
--- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/InfoAndProgressPanel.java
+++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/InfoAndProgressPanel.java
@@ -368,7 +368,8 @@ public class InfoAndProgressPanel extends JPanel implements CustomStatusBarWidge
myRefreshAndInfoPanel.revalidate();
myRefreshAndInfoPanel.repaint();
- if (UISettings.getInstance().PRESENTATION_MODE) {
+ UISettings uiSettings = UISettings.getInstance();
+ if (uiSettings.PRESENTATION_MODE || !uiSettings.SHOW_STATUS_BAR && Registry.is("ide.show.progress.without.status.bar")) {
final JRootPane pane = myInfoPanel.getRootPane();
final RelativePoint point = new RelativePoint(pane, new Point(pane.getWidth() - 250, 60));
final PresentationModeProgressPanel panel = new PresentationModeProgressPanel(inline);
diff --git a/platform/platform-impl/src/com/intellij/remote/PathMappingProvider.java b/platform/platform-impl/src/com/intellij/remote/PathMappingProvider.java
index 2d4a76f1df1c..4e5482d3d422 100644
--- a/platform/platform-impl/src/com/intellij/remote/PathMappingProvider.java
+++ b/platform/platform-impl/src/com/intellij/remote/PathMappingProvider.java
@@ -5,7 +5,6 @@ import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.openapi.project.Project;
-import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.util.PathMappingSettings;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -33,8 +32,4 @@ public abstract class PathMappingProvider {
@NotNull
public abstract PathMappingSettings getPathMappingSettings(@NotNull Project project, @NotNull RemoteSdkAdditionalData data);
-
- @Deprecated //Remove in IDEA 14
- @NotNull
- public abstract PathMappingSettings getPathMapping(@NotNull Project project, @NotNull com.intellij.remotesdk.RemoteSdkAdditionalData data);
}
diff --git a/platform/platform-impl/src/com/intellij/remote/RemoteFile.java b/platform/platform-impl/src/com/intellij/remote/RemoteFile.java
index 4a2e11379364..724ec31fe1ef 100644
--- a/platform/platform-impl/src/com/intellij/remote/RemoteFile.java
+++ b/platform/platform-impl/src/com/intellij/remote/RemoteFile.java
@@ -2,7 +2,6 @@ package com.intellij.remote;
import com.intellij.openapi.util.io.FileUtil;
import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
/**
* @author traff
@@ -25,14 +24,14 @@ public class RemoteFile {
this(resolveChild(parent, child, isWin), isWin);
}
- @Nullable
+ @NotNull
public String getName() {
int ind = myPath.lastIndexOf(getSeparator(myWin));
if (ind != -1 && ind < myPath.length() - 1) { //not last char
return myPath.substring(ind + 1);
}
else {
- return null;
+ return myPath;
}
}
@@ -88,6 +87,10 @@ public class RemoteFile {
return detectSystemByPath(path).createRemoteFile(path, script);
}
+ public static RemoteFile createRemoteFile(String path) {
+ return detectSystemByPath(path).createRemoteFile(path);
+ }
+
public static RemoteFile createRemoteFile(final String path, final String script, final boolean isWindows) {
return new RemoteFileBuilder(isWindows).createRemoteFile(path, script);
}
diff --git a/platform/platform-impl/src/com/intellij/remotesdk/MutableRemoteCredentials.java b/platform/platform-impl/src/com/intellij/remotesdk/MutableRemoteCredentials.java
deleted file mode 100644
index 0b630fec6a8b..000000000000
--- a/platform/platform-impl/src/com/intellij/remotesdk/MutableRemoteCredentials.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright 2000-2014 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.remotesdk;
-
-/**
- * @deprecated Remove in IDEA 14
- * @author traff
- */
-public interface MutableRemoteCredentials extends com.intellij.remote.MutableRemoteCredentials {
-}
diff --git a/platform/platform-impl/src/com/intellij/remotesdk/RemoteCancelledException.java b/platform/platform-impl/src/com/intellij/remotesdk/RemoteCancelledException.java
deleted file mode 100644
index 2a249209b8e8..000000000000
--- a/platform/platform-impl/src/com/intellij/remotesdk/RemoteCancelledException.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright 2000-2014 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.remotesdk;
-
-/**
- * @deprecated Remove in IDEA 14
- *
- * @author traff
- */
-public class RemoteCancelledException extends com.intellij.remote.RemoteCancelledException {
- public RemoteCancelledException(String s) {
- super(s);
- }
-}
diff --git a/platform/platform-impl/src/com/intellij/remotesdk/RemoteCredentials.java b/platform/platform-impl/src/com/intellij/remotesdk/RemoteCredentials.java
deleted file mode 100644
index e6be766ca826..000000000000
--- a/platform/platform-impl/src/com/intellij/remotesdk/RemoteCredentials.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright 2000-2014 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.remotesdk;
-
-/**
- * @deprecated Remove in IDEA 14
- *
- * @author traff
- */
-public interface RemoteCredentials extends com.intellij.remote.RemoteCredentials {
-}
diff --git a/platform/platform-impl/src/com/intellij/remotesdk/RemoteCredentialsHolder.java b/platform/platform-impl/src/com/intellij/remotesdk/RemoteCredentialsHolder.java
deleted file mode 100644
index 886052957f32..000000000000
--- a/platform/platform-impl/src/com/intellij/remotesdk/RemoteCredentialsHolder.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright 2000-2014 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.remotesdk;
-
-/**
- * @deprecated Remove in IDEA 14
- *
- * @author traff
- */
-public class RemoteCredentialsHolder extends com.intellij.remote.RemoteCredentialsHolder {
-}
diff --git a/platform/platform-impl/src/com/intellij/remotesdk/RemoteFile.java b/platform/platform-impl/src/com/intellij/remotesdk/RemoteFile.java
deleted file mode 100644
index 73274cc0f356..000000000000
--- a/platform/platform-impl/src/com/intellij/remotesdk/RemoteFile.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright 2000-2014 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.remotesdk;
-
-import org.jetbrains.annotations.NotNull;
-
-/**
- * @deprecated Remove in IDEA 14
- *
- * @author traff
- */
-public class RemoteFile extends com.intellij.remote.RemoteFile {
-
- public RemoteFile(@NotNull String path, boolean isWin) {
- super(path, isWin);
- }
-
- public RemoteFile(@NotNull String parent, String child) {
- super(parent, child);
- }
-
- public RemoteFile(@NotNull String parent, String child, boolean isWin) {
- super(parent, child, isWin);
- }
-}
diff --git a/platform/platform-impl/src/com/intellij/remotesdk/RemoteInterpreterException.java b/platform/platform-impl/src/com/intellij/remotesdk/RemoteInterpreterException.java
deleted file mode 100644
index b3d3b35b5aa2..000000000000
--- a/platform/platform-impl/src/com/intellij/remotesdk/RemoteInterpreterException.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright 2000-2014 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.remotesdk;
-
-import com.intellij.remote.RemoteSdkException;
-
-/**
- * @deprecated Remove in IDEA 14
- *
- * @author traff
- */
-public class RemoteInterpreterException extends RemoteSdkException {
- public RemoteInterpreterException(String s, Throwable throwable) {
- super(s, throwable);
- }
-}
diff --git a/platform/platform-impl/src/com/intellij/remotesdk/RemoteProcessHandlerBase.java b/platform/platform-impl/src/com/intellij/remotesdk/RemoteProcessHandlerBase.java
deleted file mode 100644
index a83d2bdc2455..000000000000
--- a/platform/platform-impl/src/com/intellij/remotesdk/RemoteProcessHandlerBase.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright 2000-2014 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.remotesdk;
-
-/**
- * @deprecated Remove in IDEA 14
- *
- * @author traff
- */
-public interface RemoteProcessHandlerBase extends com.intellij.remote.RemoteProcessHandlerBase {
-}
diff --git a/platform/platform-impl/src/com/intellij/remotesdk/RemoteSdkAdditionalData.java b/platform/platform-impl/src/com/intellij/remotesdk/RemoteSdkAdditionalData.java
deleted file mode 100644
index e4c79ed8d7f2..000000000000
--- a/platform/platform-impl/src/com/intellij/remotesdk/RemoteSdkAdditionalData.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.intellij.remotesdk;
-
-import com.intellij.openapi.projectRoots.SdkAdditionalData;
-import com.intellij.remote.RemoteSdkCredentials;
-
-/**
- * @deprecated Remove in IDEA 14
- * @author traff
- */
-public interface RemoteSdkAdditionalData extends RemoteSdkCredentials, SdkAdditionalData {
- void completeInitialization();
-}
diff --git a/platform/platform-impl/src/com/intellij/remotesdk/RemoteSdkData.java b/platform/platform-impl/src/com/intellij/remotesdk/RemoteSdkData.java
deleted file mode 100644
index d99ea338db00..000000000000
--- a/platform/platform-impl/src/com/intellij/remotesdk/RemoteSdkData.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright 2000-2014 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.remotesdk;
-
-import com.intellij.remote.RemoteSdkCredentials;
-
-/**
- * @deprecated Remove in IDEA 14
- *
- * @author traff
- */
-public interface RemoteSdkData extends RemoteSdkCredentials {
-}
diff --git a/platform/platform-impl/src/com/intellij/remotesdk/RemoteSdkDataBuilder.java b/platform/platform-impl/src/com/intellij/remotesdk/RemoteSdkDataBuilder.java
deleted file mode 100644
index f2dd26589392..000000000000
--- a/platform/platform-impl/src/com/intellij/remotesdk/RemoteSdkDataBuilder.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright 2000-2014 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.remotesdk;
-
-import com.intellij.remote.RemoteSdkCredentialsBuilder;
-
-/**
- * @deprecated Remove in IDEA 14
- *
- * @author traff
- */
-public class RemoteSdkDataBuilder extends RemoteSdkCredentialsBuilder {
-}
diff --git a/platform/platform-impl/src/com/intellij/remotesdk/RemoteSdkDataHolder.java b/platform/platform-impl/src/com/intellij/remotesdk/RemoteSdkDataHolder.java
deleted file mode 100644
index b4f837c72a3f..000000000000
--- a/platform/platform-impl/src/com/intellij/remotesdk/RemoteSdkDataHolder.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright 2000-2014 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.remotesdk;
-
-import com.intellij.remote.RemoteSdkCredentialsHolder;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * @deprecated Remove in IDEA 14
- *
- * @author traff
- */
-public class RemoteSdkDataHolder extends RemoteSdkCredentialsHolder {
- public RemoteSdkDataHolder(@NotNull String defaultHelpersDirName) {
- super(defaultHelpersDirName);
- }
-}
diff --git a/platform/platform-impl/src/com/intellij/remotesdk/RemoteSdkFactory.java b/platform/platform-impl/src/com/intellij/remotesdk/RemoteSdkFactory.java
deleted file mode 100644
index 1934d1aa36a2..000000000000
--- a/platform/platform-impl/src/com/intellij/remotesdk/RemoteSdkFactory.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright 2000-2013 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.remotesdk;
-
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.projectRoots.Sdk;
-import com.intellij.remote.RemoteSdkException;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.awt.*;
-import java.util.Collection;
-
-/**
- * @deprecated Remove in IDEA 14
- * @author traff
- */
-public interface RemoteSdkFactory<T extends RemoteSdkAdditionalData> {
- Sdk createRemoteSdk(@Nullable Project project, @NotNull T data, @Nullable String sdkName, Collection<Sdk> existingSdks)
- throws RemoteInterpreterException;
-
- Sdk createUnfinished(T data, Collection<Sdk> existingSdks);
-
- String getDefaultUnfinishedName();
-
- @NotNull
- String sdkName();
-
- boolean canSaveUnfinished();
-
- void initSdk(@NotNull Sdk sdk, @Nullable Project project, @Nullable Component ownerComponent);
-}
diff --git a/platform/platform-impl/src/com/intellij/remotesdk/RemoteSshProcess.java b/platform/platform-impl/src/com/intellij/remotesdk/RemoteSshProcess.java
deleted file mode 100644
index 3abe39bd1aba..000000000000
--- a/platform/platform-impl/src/com/intellij/remotesdk/RemoteSshProcess.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright 2000-2014 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.remotesdk;
-
-/**
- * @deprecated Remove in IDEA 14
- * @author traff
- */
-public abstract class RemoteSshProcess extends com.intellij.remote.RemoteSshProcess {
-}
diff --git a/platform/platform-impl/src/com/intellij/ui/AbstractExpandableItemsHandler.java b/platform/platform-impl/src/com/intellij/ui/AbstractExpandableItemsHandler.java
index 7226ee84e0c6..4e65063e7939 100644
--- a/platform/platform-impl/src/com/intellij/ui/AbstractExpandableItemsHandler.java
+++ b/platform/platform-impl/src/com/intellij/ui/AbstractExpandableItemsHandler.java
@@ -54,6 +54,16 @@ public abstract class AbstractExpandableItemsHandler<KeyType, ComponentType exte
myTipComponent = new TipComponent();
+ myTipComponent.addMouseListener(new MouseAdapter() {
+ @Override
+ public void mouseExited(MouseEvent e) {
+ // don't hide the hint if mouse exited to myComponent
+ if (myComponent.getMousePosition() == null) {
+ hideHint();
+ }
+ }
+ });
+
myComponent.addMouseListener(
new MouseListener() {
@Override
@@ -63,7 +73,10 @@ public abstract class AbstractExpandableItemsHandler<KeyType, ComponentType exte
@Override
public void mouseExited(MouseEvent e) {
- hideHint();
+ // don't hide the hint if mouse exited to it
+ if (myTipComponent.getMousePosition() == null) {
+ hideHint();
+ }
}
@Override
@@ -319,7 +332,7 @@ public abstract class AbstractExpandableItemsHandler<KeyType, ComponentType exte
g.setClip(null);
doFillBackground(height, width, g);
g.translate(-(visibleRect.x + visibleRect.width - cellBounds.x), 0);
- doPaintTooltipImage(renderer, cellBounds, height, g, key);
+ doPaintTooltipImage(renderer, cellBounds, g, key);
if (isPaintBorder()) {
g.translate(visibleRect.x + visibleRect.width - cellBounds.x, 0);
@@ -354,8 +367,8 @@ public abstract class AbstractExpandableItemsHandler<KeyType, ComponentType exte
g.fillRect(0, 0, width, height);
}
- protected void doPaintTooltipImage(Component rComponent, Rectangle cellBounds, int height, Graphics2D g, KeyType key) {
- myRendererPane.paintComponent(g, rComponent, myComponent, 0, 0, cellBounds.width, height, true);
+ protected void doPaintTooltipImage(Component rComponent, Rectangle cellBounds, Graphics2D g, KeyType key) {
+ myRendererPane.paintComponent(g, rComponent, myComponent, 0, 0, cellBounds.width, cellBounds.height, true);
}
protected Rectangle getVisibleRect(KeyType key) {
diff --git a/platform/platform-impl/src/com/intellij/ui/CellRendererPanel.java b/platform/platform-impl/src/com/intellij/ui/CellRendererPanel.java
index 2c33b7cd1b61..653aba26dae8 100644
--- a/platform/platform-impl/src/com/intellij/ui/CellRendererPanel.java
+++ b/platform/platform-impl/src/com/intellij/ui/CellRendererPanel.java
@@ -25,6 +25,9 @@ import java.awt.*;
* @author gregsh
*/
public class CellRendererPanel extends JPanel {
+ public CellRendererPanel() {
+ super(null); // we do the layout ourselves
+ }
// property change support ----------------
protected void firePropertyChange(String propertyName, Object oldValue, Object newValue) {
@@ -46,7 +49,10 @@ public class CellRendererPanel extends JPanel {
@Override
public void doLayout() {
if (getComponentCount() != 1) return;
- getComponent(0).setBounds(0, 0, getWidth(), getHeight());
+ Insets insets = getInsets();
+ getComponent(0).setBounds(insets.left, insets.top,
+ getWidth() - insets.left - insets.right,
+ getHeight() - insets.top - insets.bottom);
}
@Override
diff --git a/platform/platform-impl/src/com/intellij/ui/ColorChooserServiceImpl.java b/platform/platform-impl/src/com/intellij/ui/ColorChooserServiceImpl.java
index 4bc4213a78ec..355c2a8de3e3 100644
--- a/platform/platform-impl/src/com/intellij/ui/ColorChooserServiceImpl.java
+++ b/platform/platform-impl/src/com/intellij/ui/ColorChooserServiceImpl.java
@@ -15,10 +15,11 @@
*/
package com.intellij.ui;
-import com.intellij.psi.PsiElement;
import org.jetbrains.annotations.Nullable;
import java.awt.*;
+import java.util.Arrays;
+import java.util.List;
/**
* @author Konstantin Bulenkov
@@ -31,7 +32,7 @@ public class ColorChooserServiceImpl extends ColorChooserService {
Color preselectedColor,
boolean enableOpacity,
ColorPickerListener[] listeners) {
- return ColorPicker.showDialog(parent, caption, preselectedColor, enableOpacity, listeners, false);
+ return showDialog(parent, caption, preselectedColor, enableOpacity, Arrays.asList(listeners), false);
}
@Nullable
@@ -42,6 +43,17 @@ public class ColorChooserServiceImpl extends ColorChooserService {
boolean enableOpacity,
ColorPickerListener[] listeners,
boolean opacityInPercent) {
+ return showDialog(parent, caption, preselectedColor, enableOpacity, Arrays.asList(listeners), opacityInPercent);
+ }
+
+ @Nullable
+ @Override
+ public Color showDialog(Component parent,
+ String caption,
+ Color preselectedColor,
+ boolean enableOpacity,
+ List<ColorPickerListener> listeners,
+ boolean opacityInPercent) {
return ColorPicker.showDialog(parent, caption, preselectedColor, enableOpacity, listeners, opacityInPercent);
}
}
diff --git a/platform/platform-impl/src/com/intellij/ui/ColorPicker.java b/platform/platform-impl/src/com/intellij/ui/ColorPicker.java
index d78e68137df1..e7b93684ace8 100644
--- a/platform/platform-impl/src/com/intellij/ui/ColorPicker.java
+++ b/platform/platform-impl/src/com/intellij/ui/ColorPicker.java
@@ -46,6 +46,7 @@ import java.awt.image.ImageObserver;
import java.awt.image.MemoryImageSource;
import java.text.ParseException;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
/**
@@ -64,7 +65,7 @@ public class ColorPicker extends JPanel implements ColorListener, DocumentListen
private final JTextField myBlue;
private final JTextField myHex;
private final Alarm myUpdateQueue;
- private final ColorPickerListener[] myExternalListeners;
+ private final List<ColorPickerListener> myExternalListeners;
private final boolean myOpacityInPercent;
@@ -88,13 +89,13 @@ public class ColorPicker extends JPanel implements ColorListener, DocumentListen
};
public ColorPicker(@NotNull Disposable parent, @Nullable Color color, boolean enableOpacity) {
- this(parent, color, true, enableOpacity, new ColorPickerListener[0], false);
+ this(parent, color, true, enableOpacity, Collections.<ColorPickerListener>emptyList(), false);
}
private ColorPicker(Disposable parent,
@Nullable Color color,
boolean restoreColors, boolean enableOpacity,
- ColorPickerListener[] listeners, boolean opacityInPercent) {
+ List<ColorPickerListener> listeners, boolean opacityInPercent) {
myUpdateQueue = new Alarm(Alarm.ThreadToUse.SWING_THREAD, parent);
myRed = createColorField(false);
myGreen = createColorField(false);
@@ -332,7 +333,7 @@ public class ColorPicker extends JPanel implements ColorListener, DocumentListen
String caption,
Color preselectedColor,
boolean enableOpacity,
- ColorPickerListener[] listeners,
+ List<ColorPickerListener> listeners,
boolean opacityInPercent) {
final ColorPickerDialog dialog = new ColorPickerDialog(parent, caption, preselectedColor, enableOpacity, listeners, opacityInPercent);
dialog.show();
@@ -884,7 +885,7 @@ public class ColorPicker extends JPanel implements ColorListener, DocumentListen
static class ColorPickerDialog extends DialogWrapper {
private final Color myPreselectedColor;
- private final ColorPickerListener[] myListeners;
+ private final List<ColorPickerListener> myListeners;
private ColorPicker myColorPicker;
private final boolean myEnableOpacity;
private ColorPipette myPicker;
@@ -894,7 +895,7 @@ public class ColorPicker extends JPanel implements ColorListener, DocumentListen
String caption,
@Nullable Color preselectedColor,
boolean enableOpacity,
- ColorPickerListener[] listeners,
+ List<ColorPickerListener> listeners,
boolean opacityInPercent) {
super(parent, true);
myListeners = listeners;
diff --git a/platform/platform-impl/src/com/intellij/ui/ColorPickerListenerFactory.java b/platform/platform-impl/src/com/intellij/ui/ColorPickerListenerFactory.java
index 6f1c0479eeca..dbed5e5abb24 100644
--- a/platform/platform-impl/src/com/intellij/ui/ColorPickerListenerFactory.java
+++ b/platform/platform-impl/src/com/intellij/ui/ColorPickerListenerFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2012 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -17,29 +17,32 @@ package com.intellij.ui;
import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.psi.PsiElement;
-import com.intellij.util.Function;
+import com.intellij.util.SmartList;
import com.intellij.util.containers.ContainerUtil;
+import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.List;
-/**
- * User: ksafonov
- */
public abstract class ColorPickerListenerFactory {
private static final ExtensionPointName<ColorPickerListenerFactory> EP_NAME =
ExtensionPointName.create("com.intellij.colorPickerListenerFactory");
- public static ColorPickerListener[] createListenersFor(@Nullable final PsiElement element) {
- final List<ColorPickerListener> listeners =
- ContainerUtil.mapNotNull(EP_NAME.getExtensions(), new Function<ColorPickerListenerFactory, ColorPickerListener>() {
- @Override
- public ColorPickerListener fun(ColorPickerListenerFactory factory) {
- return factory.createListener(element);
+ @NotNull
+ public static List<ColorPickerListener> createListenersFor(@Nullable PsiElement element) {
+ List<ColorPickerListener> listeners = null;
+ for (ColorPickerListenerFactory factory : EP_NAME.getExtensions()) {
+ ColorPickerListener listener = factory.createListener(element);
+ if (listener != null) {
+ if (listeners == null) {
+ listeners = new SmartList<ColorPickerListener>();
}
- });
- return listeners.toArray(new ColorPickerListener[listeners.size()]);
+ listeners.add(listener);
+ }
+ }
+ return ContainerUtil.notNullize(listeners);
}
+ @Nullable
public abstract ColorPickerListener createListener(@Nullable PsiElement element);
}
diff --git a/platform/platform-impl/src/com/intellij/ui/EditorTextFieldCellRenderer.java b/platform/platform-impl/src/com/intellij/ui/EditorTextFieldCellRenderer.java
index e803fa5fd63d..d11e990f8dba 100644
--- a/platform/platform-impl/src/com/intellij/ui/EditorTextFieldCellRenderer.java
+++ b/platform/platform-impl/src/com/intellij/ui/EditorTextFieldCellRenderer.java
@@ -57,39 +57,39 @@ public abstract class EditorTextFieldCellRenderer implements TableCellRenderer,
protected abstract EditorColorsScheme getColorScheme();
- protected abstract String getText(JTable table, Object value, int row, int column);
+ protected abstract String getText(FontMetrics fontMetrics, JTable table, Object value, int row, int column);
protected void customizeEditor(EditorEx editor, Object value, boolean selected, int row, int col) {
}
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
- String text = getText(table, value, row, column);
MyPanel panel = getEditorPanel(table);
EditorEx editor = panel.editor;
int tableFontSize = table.getFont().getSize();
if (editor.getColorsScheme().getEditorFontSize() != tableFontSize) {
editor.getColorsScheme().setEditorFontSize(tableFontSize);
}
- setText(editor, text);
-
- if (isSelected) {
- ((EditorImpl)editor).setPaintSelection(true);
- editor.getColorsScheme().setColor(EditorColors.SELECTION_BACKGROUND_COLOR, table.getSelectionBackground());
- editor.getColorsScheme().setColor(EditorColors.SELECTION_FOREGROUND_COLOR, table.getSelectionForeground());
- editor.getSelectionModel().setSelection(0, editor.getDocument().getTextLength());
- editor.setBackgroundColor(table.getSelectionBackground());
- }
- else {
- ((EditorImpl)editor).setPaintSelection(false);
- editor.getSelectionModel().setSelection(0, 0);
- boolean selectedRow = table.getSelectedRowCount() > 0 && table.getSelectedRows()[table.getSelectedRowCount() - 1] == row;
- editor.setBackgroundColor(!selectedRow ? table.getBackground() : getColorScheme().getColor(EditorColors.CARET_ROW_COLOR));
- }
+ setText(editor, getText(((EditorImpl)editor).getFontMetrics(Font.PLAIN), table, value, row, column));
+
+ ((EditorImpl)editor).setPaintSelection(isSelected);
+ editor.getSelectionModel().setSelection(0, isSelected ? editor.getDocument().getTextLength() : 0);
+ editor.getColorsScheme().setColor(EditorColors.SELECTION_BACKGROUND_COLOR, table.getSelectionBackground());
+ editor.getColorsScheme().setColor(EditorColors.SELECTION_FOREGROUND_COLOR, table.getSelectionForeground());
+ editor.setBackgroundColor(getCellBackgroundColor(getColorScheme(), table, isSelected, row));
+
+ panel.setBorder(null); // prevents double border painting when ExtendedItemRendererComponentWrapper is used
+
customizeEditor(editor, value, isSelected, row, column);
return panel;
}
+ public static Color getCellBackgroundColor(EditorColorsScheme colorsScheme, JTable table, boolean isSelected, int row) {
+ return isSelected ? table.getSelectionBackground() :
+ table.getSelectionModel().getLeadSelectionIndex() == row ? colorsScheme.getColor(EditorColors.CARET_ROW_COLOR) :
+ table.getBackground();
+ }
+
@NotNull
private MyPanel getEditorPanel(JTable table) {
MyPanel panel = (MyPanel)table.getClientProperty(MY_PANEL_PROPERTY);
@@ -142,6 +142,16 @@ public abstract class EditorTextFieldCellRenderer implements TableCellRenderer,
}
@Override
+ protected void paintComponent(Graphics g) {
+ if (getBorder() == null) return;
+ Color oldColor = g.getColor();
+ Rectangle clip = g.getClipBounds();
+ g.setColor(editor.getBackgroundColor());
+ g.fillRect(clip.x, clip.y, clip.width, clip.height);
+ g.setColor(oldColor);
+ }
+
+ @Override
public void dispose() {
EditorFactory.getInstance().releaseEditor(editor);
}
diff --git a/platform/platform-impl/src/com/intellij/ui/ShowColorPickerAction.java b/platform/platform-impl/src/com/intellij/ui/ShowColorPickerAction.java
index 95f4b7e33861..5327c84c3c8d 100644
--- a/platform/platform-impl/src/com/intellij/ui/ShowColorPickerAction.java
+++ b/platform/platform-impl/src/com/intellij/ui/ShowColorPickerAction.java
@@ -18,12 +18,12 @@ package com.intellij.ui;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.CommonDataKeys;
-import com.intellij.openapi.actionSystem.LangDataKeys;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.wm.IdeFrame;
import com.intellij.openapi.wm.WindowManager;
import javax.swing.*;
+import java.util.List;
/**
* @author Konstantin Bulenkov
@@ -34,9 +34,8 @@ public class ShowColorPickerAction extends AnAction {
final Project project = e.getProject();
JComponent root = rootComponent(project);
if (root != null) {
- ColorPickerListener[] listeners = ColorPickerListenerFactory.createListenersFor(e.getData(CommonDataKeys.PSI_ELEMENT));
- final ColorPicker.ColorPickerDialog picker =
- new ColorPicker.ColorPickerDialog(root, "Color Picker", null, true, listeners, true);
+ List<ColorPickerListener> listeners = ColorPickerListenerFactory.createListenersFor(e.getData(CommonDataKeys.PSI_ELEMENT));
+ ColorPicker.ColorPickerDialog picker = new ColorPicker.ColorPickerDialog(root, "Color Picker", null, true, listeners, true);
picker.setModal(false);
picker.show();
}
diff --git a/platform/platform-impl/src/com/intellij/ui/Splash.java b/platform/platform-impl/src/com/intellij/ui/Splash.java
index 0f4147f61753..023cef7bac06 100644
--- a/platform/platform-impl/src/com/intellij/ui/Splash.java
+++ b/platform/platform-impl/src/com/intellij/ui/Splash.java
@@ -44,6 +44,7 @@ import java.util.List;
*/
public class Splash extends JDialog implements StartupProgress {
@Nullable public static Rectangle BOUNDS;
+
private final Icon myImage;
private int myProgressHeight = 2;
private Color myProgressColor = null;
@@ -84,8 +85,16 @@ public class Splash extends JDialog implements StartupProgress {
}
private void setLocationInTheCenterOfScreen() {
- Rectangle deviceBounds = getGraphicsConfiguration().getBounds();
- setLocation((deviceBounds.width - getWidth()) / 2, (deviceBounds.height - getHeight()) / 2);
+ Rectangle bounds = getGraphicsConfiguration().getBounds();
+ if (SystemInfo.isWindows) {
+ Insets insets = Toolkit.getDefaultToolkit().getScreenInsets(getGraphicsConfiguration());
+ int x = insets.left + (bounds.width - insets.left - insets.right - getWidth()) / 2;
+ int y = insets.top + (bounds.height - insets.top - insets.bottom - getHeight()) / 2;
+ setLocation(x, y);
+ }
+ else {
+ setLocation((bounds.width - getWidth()) / 2, (bounds.height - getHeight()) / 2);
+ }
}
public Splash(ApplicationInfoEx info) {
diff --git a/platform/platform-impl/src/com/intellij/ui/TableExpandableItemsHandler.java b/platform/platform-impl/src/com/intellij/ui/TableExpandableItemsHandler.java
index af4707c60ec3..b7704a687441 100644
--- a/platform/platform-impl/src/com/intellij/ui/TableExpandableItemsHandler.java
+++ b/platform/platform-impl/src/com/intellij/ui/TableExpandableItemsHandler.java
@@ -106,22 +106,12 @@ public class TableExpandableItemsHandler extends AbstractExpandableItemsHandler<
}
public Pair<Component, Rectangle> getCellRendererAndBounds(TableCell key) {
- Rectangle cellRect = getCellRect(key);
-
- int modelColumnIndex = myComponent.convertColumnIndexToModel(key.column);
- final int modelRowIndex = myComponent.convertRowIndexToModel(key.row);
- TableModel model = myComponent.getModel();
- if (key.row < 0 || key.row >= model.getRowCount() || key.column < 0 || key.column >= model.getColumnCount()) {
+ if (key.row < 0 || key.row >= myComponent.getRowCount() || key.column < 0 || key.column >= myComponent.getColumnCount()) {
return null;
}
- Component renderer = myComponent
- .getCellRenderer(key.row, key.column)
- .getTableCellRendererComponent(myComponent,
- model.getValueAt(modelRowIndex, modelColumnIndex),
- myComponent.getSelectionModel().isSelectedIndex(key.row),
- myComponent.hasFocus(),
- key.row, key.column);
+ Rectangle cellRect = getCellRect(key);
+ Component renderer = myComponent.prepareRenderer(myComponent.getCellRenderer(key.row, key.column), key.row, key.column);
cellRect.width = renderer.getPreferredSize().width;
return Pair.create(renderer, cellRect);
diff --git a/platform/platform-impl/src/com/intellij/ui/TableSpeedSearch.java b/platform/platform-impl/src/com/intellij/ui/TableSpeedSearch.java
index 93a9d9390d33..b596204e6ad2 100644
--- a/platform/platform-impl/src/com/intellij/ui/TableSpeedSearch.java
+++ b/platform/platform-impl/src/com/intellij/ui/TableSpeedSearch.java
@@ -55,7 +55,9 @@ public class TableSpeedSearch extends SpeedSearchBase<JTable> {
@Override
protected boolean isSpeedSearchEnabled() {
- return !getComponent().isEditing() && super.isSpeedSearchEnabled();
+ JTable table = getComponent();
+ boolean tableIsNotEmpty = table.getRowCount() != 0 && table.getColumnCount() != 0;
+ return tableIsNotEmpty && !table.isEditing() && super.isSpeedSearchEnabled();
}
@Override
diff --git a/platform/platform-impl/src/com/intellij/ui/TreeExpandableItemsHandler.java b/platform/platform-impl/src/com/intellij/ui/TreeExpandableItemsHandler.java
index ad5466267dba..b24e10b943f4 100644
--- a/platform/platform-impl/src/com/intellij/ui/TreeExpandableItemsHandler.java
+++ b/platform/platform-impl/src/com/intellij/ui/TreeExpandableItemsHandler.java
@@ -148,7 +148,6 @@ public class TreeExpandableItemsHandler extends AbstractExpandableItemsHandler<I
@Override
protected void doPaintTooltipImage(final Component rComponent,
final Rectangle cellBounds,
- final int height,
final Graphics2D g,
Integer key) {
final boolean opaque = rComponent.isOpaque();
@@ -169,7 +168,7 @@ public class TreeExpandableItemsHandler extends AbstractExpandableItemsHandler<I
rComponent.setBackground(bg);
}
- super.doPaintTooltipImage(rComponent, cellBounds, height, g, key);
+ super.doPaintTooltipImage(rComponent, cellBounds, g, key);
if (rComponent instanceof JComponent) {
((JComponent)rComponent).setOpaque(opaque);
diff --git a/platform/platform-impl/src/com/intellij/ui/messages/JBMacMessages.java b/platform/platform-impl/src/com/intellij/ui/messages/JBMacMessages.java
index 6ce0375e75aa..2a70b61c6e8a 100644
--- a/platform/platform-impl/src/com/intellij/ui/messages/JBMacMessages.java
+++ b/platform/platform-impl/src/com/intellij/ui/messages/JBMacMessages.java
@@ -73,10 +73,14 @@ public class JBMacMessages extends MacMessagesEmulation {
Icon icon = errorStyle ? UIUtil.getErrorIcon() : UIUtil.getInformationIcon();
- focusedOptionIndex = (defaultOptionIndex == focusedOptionIndex) ? buttons.length - 1 : focusedOptionIndex;
+ if (focusedOptionIndex != -1) {
+ focusedOptionIndex = (defaultOptionIndex == focusedOptionIndex) ? buttons.length - 1 : focusedOptionIndex;
+ }
+
+ final String defaultOptionTitle = defaultOptionIndex == -1 ? null : buttons[defaultOptionIndex];
+ final String focusedButtonTitle = focusedOptionIndex == -1 ? null : buttons[focusedOptionIndex];
- SheetMessage sheetMessage = new SheetMessage(window, title, message, icon, buttons, doNotAskDialogOption, buttons[defaultOptionIndex],
- buttons[focusedOptionIndex]);
+ final SheetMessage sheetMessage = new SheetMessage(window, title, message, icon, buttons, doNotAskDialogOption, defaultOptionTitle, focusedButtonTitle);
String result = sheetMessage.getResult();
for (int i = 0; i < buttons.length; i++) {
if (result.equals(buttons[i])) {
diff --git a/platform/platform-impl/src/com/intellij/ui/popup/AbstractPopup.java b/platform/platform-impl/src/com/intellij/ui/popup/AbstractPopup.java
index e1c326d33cd8..78802ccdf6bb 100644
--- a/platform/platform-impl/src/com/intellij/ui/popup/AbstractPopup.java
+++ b/platform/platform-impl/src/com/intellij/ui/popup/AbstractPopup.java
@@ -337,7 +337,7 @@ public class AbstractPopup implements JBPopup {
}
public void setShowHints(boolean show) {
- final Window ancestor = SwingUtilities.getWindowAncestor(myComponent);
+ final Window ancestor = getContentWindow(myComponent);
if (ancestor instanceof RootPaneContainer) {
final JRootPane rootPane = ((RootPaneContainer)ancestor).getRootPane();
if (rootPane != null) {
@@ -757,7 +757,33 @@ public class AbstractPopup implements JBPopup {
PopupComponent.Factory factory = getFactory(myForcedHeavyweight || myResizable, forcedDialog);
myNativePopup = factory.isNativePopup();
- myPopup = factory.getPopup(myOwner, myContent, targetBounds.x, targetBounds.y, this);
+ Component popupOwner = myOwner;
+ if (popupOwner instanceof RootPaneContainer) {
+ // JDK uses cached heavyweight popup for a window ancestor
+ RootPaneContainer root = (RootPaneContainer)popupOwner;
+ popupOwner = root.getRootPane();
+ }
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("expected preferred size: " + myContent.getPreferredSize());
+ }
+ myPopup = factory.getPopup(popupOwner, myContent, targetBounds.x, targetBounds.y, this);
+ if (LOG.isDebugEnabled()) {
+ LOG.debug(" actual preferred size: " + myContent.getPreferredSize());
+ }
+ if ((targetBounds.width != myContent.getWidth()) || (targetBounds.height != myContent.getHeight())) {
+ // JDK uses cached heavyweight popup that is not initialized properly
+ LOG.debug("the expected size is not equal to the actual size");
+ Window popup = myPopup.getWindow();
+ if (popup != null) {
+ popup.setSize(targetBounds.width, targetBounds.height);
+ if (myContent.getParent().getComponentCount() != 1) {
+ LOG.debug("unexpected count of components in heavy-weight popup");
+ }
+ }
+ else {
+ LOG.debug("cannot fix size for non-heavy-weight popup");
+ }
+ }
if (myResizable) {
final JRootPane root = myContent.getRootPane();
@@ -799,13 +825,10 @@ public class AbstractPopup implements JBPopup {
listener.beforeShown(new LightweightWindowEvent(this));
}
- // can be improved by moving in myPopup code
- myPopup.getWindow().setSize(myContent.getSize());
-
myPopup.setRequestFocus(myRequestFocus);
myPopup.show();
- final Window window = SwingUtilities.getWindowAncestor(myContent);
+ final Window window = getContentWindow(myContent);
myWindow = window;
@@ -1185,14 +1208,17 @@ public class AbstractPopup implements JBPopup {
size = computeWindowSize(size);
- final Window window = SwingUtilities.getWindowAncestor(myContent);
- window.setSize(size);
+ final Window window = getContentWindow(myContent);
+ if (window != null) {
+ window.setSize(size);
+ }
}
public void pack() {
- final Window window = SwingUtilities.getWindowAncestor(myContent);
-
- window.pack();
+ final Window window = getContentWindow(myContent);
+ if (window != null) {
+ window.pack();
+ }
}
public JComponent getComponent() {
@@ -1211,6 +1237,10 @@ public class AbstractPopup implements JBPopup {
}
myDisposed = true;
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("start disposing " + myContent);
+ }
+
Disposer.dispose(this, false);
ApplicationManager.getApplication().assertIsDispatchThread();
@@ -1257,6 +1287,10 @@ public class AbstractPopup implements JBPopup {
IdeFocusManager.getInstance(myProject).typeAheadUntil(typeAheadDone);
getFocusManager().doWhenFocusSettlesDown(runFinal);
}
+
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("stop disposing content");
+ }
}
private void resetWindow() {
@@ -1385,15 +1419,27 @@ public class AbstractPopup implements JBPopup {
}
public static Window moveTo(JComponent content, Point screenPoint, final Dimension headerCorrectionSize) {
- setDefaultCursor(content);
- final Window wnd = SwingUtilities.getWindowAncestor(content);
- if (headerCorrectionSize != null) {
- screenPoint.y -= headerCorrectionSize.height;
+ final Window wnd = getContentWindow(content);
+ if (wnd != null) {
+ wnd.setCursor(Cursor.getDefaultCursor());
+ if (headerCorrectionSize != null) {
+ screenPoint.y -= headerCorrectionSize.height;
+ }
+ wnd.setLocation(screenPoint);
}
- wnd.setLocation(screenPoint);
return wnd;
}
+ private static Window getContentWindow(Component content) {
+ Window window = SwingUtilities.getWindowAncestor(content);
+ if (window == null) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("no window ancestor for " + content);
+ }
+ }
+ return window;
+ }
+
@Override
public Point getLocationOnScreen() {
Dimension headerCorrectionSize = myLocateByContent ? myHeaderPanel.getPreferredSize() : null;
@@ -1467,7 +1513,7 @@ public class AbstractPopup implements JBPopup {
}
public static void setDefaultCursor(JComponent content) {
- final Window wnd = SwingUtilities.getWindowAncestor(content);
+ final Window wnd = getContentWindow(content);
if (wnd != null) {
wnd.setCursor(Cursor.getDefaultCursor());
}
diff --git a/platform/platform-impl/src/com/intellij/ui/popup/PopupFactoryImpl.java b/platform/platform-impl/src/com/intellij/ui/popup/PopupFactoryImpl.java
index c7194ca5b4c4..2d7a8e3fb276 100644
--- a/platform/platform-impl/src/com/intellij/ui/popup/PopupFactoryImpl.java
+++ b/platform/platform-impl/src/com/intellij/ui/popup/PopupFactoryImpl.java
@@ -227,8 +227,11 @@ public class PopupFactoryImpl extends JBPopupFactory {
Presentation presentation = new Presentation();
presentation.setDescription(action.getTemplatePresentation().getDescription());
final String actualActionPlace = actionPlace == null ? ActionPlaces.UNKNOWN : actionPlace;
- action.update(new AnActionEvent(null, DataManager.getInstance().getDataContext(myComponent), actualActionPlace, presentation,
- ActionManager.getInstance(), 0));
+ final AnActionEvent actionEvent =
+ new AnActionEvent(null, DataManager.getInstance().getDataContext(myComponent), actualActionPlace, presentation,
+ ActionManager.getInstance(), 0);
+ actionEvent.setInjectedContext(action.isInInjectedContext());
+ action.update(actionEvent);
ActionMenu.showDescriptionInStatusBar(true, myComponent, presentation.getDescription());
}
});
@@ -730,7 +733,10 @@ public class PopupFactoryImpl extends JBPopupFactory {
myFinalRunnable = new Runnable() {
@Override
public void run() {
- action.actionPerformed(new AnActionEvent(null, dataContext, ActionPlaces.UNKNOWN, action.getTemplatePresentation().clone(), ActionManager.getInstance(), eventModifiers));
+ final AnActionEvent event = new AnActionEvent(null, dataContext, ActionPlaces.UNKNOWN, action.getTemplatePresentation().clone(),
+ ActionManager.getInstance(), eventModifiers);
+ event.setInjectedContext(action.isInInjectedContext());
+ action.actionPerformed(event);
}
};
return FINAL_CHOICE;
@@ -879,7 +885,10 @@ public class PopupFactoryImpl extends JBPopupFactory {
@NotNull
private AnActionEvent createActionEvent(@NotNull AnAction actionGroup) {
- return new AnActionEvent(null, myDataContext, myActionPlace, getPresentation(actionGroup), ActionManager.getInstance(), 0);
+ final AnActionEvent actionEvent =
+ new AnActionEvent(null, myDataContext, myActionPlace, getPresentation(actionGroup), ActionManager.getInstance(), 0);
+ actionEvent.setInjectedContext(actionGroup.isInInjectedContext());
+ return actionEvent;
}
private void appendActionsFromGroup(@NotNull ActionGroup actionGroup) {
diff --git a/platform/platform-impl/src/com/intellij/ui/popup/list/GroupedItemsListRenderer.java b/platform/platform-impl/src/com/intellij/ui/popup/list/GroupedItemsListRenderer.java
index 72f2e1dc3b37..9383f5c3f08e 100644
--- a/platform/platform-impl/src/com/intellij/ui/popup/list/GroupedItemsListRenderer.java
+++ b/platform/platform-impl/src/com/intellij/ui/popup/list/GroupedItemsListRenderer.java
@@ -18,9 +18,7 @@ package com.intellij.ui.popup.list;
import com.intellij.openapi.ui.popup.ListItemDescriptor;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.ui.EngravedLabel;
import com.intellij.ui.ErrorLabel;
-import com.intellij.ui.Gray;
import com.intellij.ui.GroupedElementsRenderer;
import com.intellij.ui.components.panels.OpaquePanel;
@@ -58,15 +56,8 @@ public class GroupedItemsListRenderer extends GroupedElementsRenderer.List imple
@Override
protected JComponent createItemComponent() {
- if (Registry.is("ide.new.project.settings")) {
- myTextLabel = new EngravedLabel();
- myTextLabel.setFont(myTextLabel.getFont().deriveFont(Font.BOLD));
- myTextLabel.setForeground(Gray._240);
- } else {
- myTextLabel = new ErrorLabel();
- myTextLabel.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
- }
-
+ myTextLabel = new ErrorLabel();
+ myTextLabel.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
myTextLabel.setOpaque(true);
return layoutComponent(myTextLabel);
}
diff --git a/platform/platform-impl/src/com/intellij/util/ui/SwingHelper.java b/platform/platform-impl/src/com/intellij/util/ui/SwingHelper.java
new file mode 100644
index 000000000000..ac4c1b12373c
--- /dev/null
+++ b/platform/platform-impl/src/com/intellij/util/ui/SwingHelper.java
@@ -0,0 +1,465 @@
+package com.intellij.util.ui;
+
+import com.intellij.ide.BrowserUtil;
+import com.intellij.openapi.actionSystem.ActionManager;
+import com.intellij.openapi.actionSystem.AnAction;
+import com.intellij.openapi.actionSystem.AnActionEvent;
+import com.intellij.openapi.actionSystem.DefaultActionGroup;
+import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.openapi.fileChooser.FileChooserDescriptor;
+import com.intellij.openapi.fileChooser.FileChooserFactory;
+import com.intellij.openapi.ide.CopyPasteManager;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.ui.ComponentWithBrowseButton;
+import com.intellij.openapi.ui.DialogWrapper;
+import com.intellij.openapi.ui.TextComponentAccessor;
+import com.intellij.openapi.ui.TextFieldWithBrowseButton;
+import com.intellij.openapi.util.SystemInfo;
+import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.ui.HyperlinkLabel;
+import com.intellij.ui.TextFieldWithHistory;
+import com.intellij.ui.TextFieldWithHistoryWithBrowseButton;
+import com.intellij.util.NotNullProducer;
+import com.intellij.util.PlatformIcons;
+import com.intellij.util.containers.ComparatorUtil;
+import com.intellij.util.containers.ContainerUtil;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import javax.swing.*;
+import javax.swing.event.PopupMenuEvent;
+import javax.swing.event.PopupMenuListener;
+import javax.swing.table.DefaultTableCellRenderer;
+import javax.swing.table.TableCellRenderer;
+import javax.swing.table.TableColumn;
+import java.awt.*;
+import java.awt.datatransfer.StringSelection;
+import java.awt.datatransfer.Transferable;
+import java.util.Collection;
+import java.util.List;
+import java.util.Set;
+
+public class SwingHelper {
+
+ private static final Logger LOG = Logger.getInstance(SwingHelper.class);
+
+ /**
+ * Creates panel whose content consists of given {@code children} components
+ * stacked vertically each on another in a given order.
+ *
+ * @param childAlignmentX Component.LEFT_ALIGNMENT, Component.CENTER_ALIGNMENT or Component.RIGHT_ALIGNMENT
+ * @param children children components
+ * @return created panel
+ */
+ @NotNull
+ public static JPanel newVerticalPanel(float childAlignmentX, Component... children) {
+ return newGenericBoxPanel(true, childAlignmentX, children);
+ }
+
+ @NotNull
+ public static JPanel newLeftAlignedVerticalPanel(Component... children) {
+ return newVerticalPanel(Component.LEFT_ALIGNMENT, children);
+ }
+
+ @NotNull
+ public static JPanel newLeftAlignedVerticalPanel(@NotNull Collection<Component> children) {
+ return newVerticalPanel(Component.LEFT_ALIGNMENT, children);
+ }
+
+ @NotNull
+ public static JPanel newVerticalPanel(float childAlignmentX, @NotNull Collection<Component> children) {
+ return newVerticalPanel(childAlignmentX, children.toArray(new Component[children.size()]));
+ }
+
+ /**
+ * Creates panel whose content consists of given {@code children} components horizontally
+ * stacked each on another in a given order.
+ *
+ * @param childAlignmentY Component.TOP_ALIGNMENT, Component.CENTER_ALIGNMENT or Component.BOTTOM_ALIGNMENT
+ * @param children children components
+ * @return created panel
+ */
+ @NotNull
+ public static JPanel newHorizontalPanel(float childAlignmentY, Component... children) {
+ return newGenericBoxPanel(false, childAlignmentY, children);
+ }
+
+ @NotNull
+ public static JPanel newHorizontalPanel(float childAlignmentY, @NotNull Collection<Component> children) {
+ return newHorizontalPanel(childAlignmentY, children.toArray(new Component[children.size()]));
+ }
+
+ private static JPanel newGenericBoxPanel(boolean verticalOrientation,
+ float childAlignment,
+ Component... children) {
+ JPanel panel = new JPanel();
+ int axis = verticalOrientation ? BoxLayout.Y_AXIS : BoxLayout.X_AXIS;
+ panel.setLayout(new BoxLayout(panel, axis));
+ for (Component child : children) {
+ panel.add(child, childAlignment);
+ if (child instanceof JComponent) {
+ JComponent jChild = (JComponent) child;
+ if (verticalOrientation) {
+ jChild.setAlignmentX(childAlignment);
+ } else {
+ jChild.setAlignmentY(childAlignment);
+ }
+ }
+ }
+ return panel;
+ }
+
+ @NotNull
+ public static JPanel wrapWithoutStretch(@NotNull JComponent component) {
+ JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
+ panel.add(component);
+ return panel;
+ }
+
+ @NotNull
+ public static JPanel wrapWithHorizontalStretch(@NotNull JComponent component) {
+ JPanel panel = new JPanel(new BorderLayout(0, 0));
+ panel.add(component, BorderLayout.NORTH);
+ return panel;
+ }
+
+ public static void setPreferredWidthToFitText(@NotNull TextFieldWithHistoryWithBrowseButton component) {
+ int childWidth = calcWidthToFitText(component.getChildComponent().getTextEditor(), 35);
+ setPreferredWidthForComponentWithBrowseButton(component, childWidth);
+ }
+
+ public static void setPreferredWidthToFitText(@NotNull TextFieldWithBrowseButton component) {
+ int childWidth = calcWidthToFitText(component.getChildComponent(), 20);
+ setPreferredWidthForComponentWithBrowseButton(component, childWidth);
+ }
+
+ private static <T extends JComponent> void setPreferredWidthForComponentWithBrowseButton(@NotNull ComponentWithBrowseButton<T> component,
+ int childPrefWidth) {
+ Dimension buttonPrefSize = component.getButton().getPreferredSize();
+ setPreferredWidth(component, childPrefWidth + buttonPrefSize.width);
+ }
+
+ public static void setPreferredWidthToFitText(@NotNull JTextField textField) {
+ setPreferredWidthToFitText(textField, 15);
+ }
+
+ public static void setPreferredWidthToFitText(@NotNull JTextField textField, int additionalWidth) {
+ setPreferredSizeToFitText(textField, StringUtil.notNullize(textField.getText()), additionalWidth);
+ }
+
+ public static void setPreferredWidthToFitText(@NotNull JTextField textField, @NotNull String text) {
+ setPreferredSizeToFitText(textField, text, 15);
+ }
+
+ private static void setPreferredSizeToFitText(@NotNull JTextField textField, @NotNull String text, int additionalWidth) {
+ int width = calcWidthToFitText(textField, text, additionalWidth);
+ setPreferredWidth(textField, width);
+ }
+
+ private static int calcWidthToFitText(@NotNull JTextField textField, int additionalWidth) {
+ return calcWidthToFitText(textField, textField.getText(), additionalWidth);
+ }
+
+ private static int calcWidthToFitText(@NotNull JTextField textField, @NotNull String text, int additionalWidth) {
+ return textField.getFontMetrics(textField.getFont()).stringWidth(text) + additionalWidth;
+ }
+
+ public static void adjustDialogSizeToFitPreferredSize(@NotNull DialogWrapper dialogWrapper) {
+ JRootPane rootPane = dialogWrapper.getRootPane();
+ Dimension componentSize = rootPane.getSize();
+ Dimension componentPreferredSize = rootPane.getPreferredSize();
+ if (componentPreferredSize.width <= componentSize.width && componentPreferredSize.height <= componentSize.height) {
+ return;
+ }
+ int dw = Math.max(0, componentPreferredSize.width - componentSize.width);
+ int dh = Math.max(0, componentPreferredSize.height - componentSize.height);
+
+ Dimension oldDialogSize = dialogWrapper.getSize();
+ Dimension newDialogSize = new Dimension(oldDialogSize.width + dw, oldDialogSize.height + dh);
+
+ dialogWrapper.setSize(newDialogSize.width, newDialogSize.height);
+ rootPane.revalidate();
+ rootPane.repaint();
+
+ LOG.info("DialogWrapper '" + dialogWrapper.getTitle() + "' has been resized (added width: " + dw + ", added height: " + dh + ")");
+ }
+
+ public static <T> void updateItems(@NotNull JComboBox comboBox,
+ @NotNull List<T> newItems,
+ @Nullable T newSelectedItemIfSelectionCannotBePreserved) {
+ if (!shouldUpdate(comboBox, newItems)) {
+ return;
+ }
+ Object selectedItem = comboBox.getSelectedItem();
+ //noinspection SuspiciousMethodCalls
+ if (selectedItem != null && !newItems.contains(selectedItem)) {
+ selectedItem = null;
+ }
+ if (selectedItem == null && newItems.contains(newSelectedItemIfSelectionCannotBePreserved)) {
+ selectedItem = newSelectedItemIfSelectionCannotBePreserved;
+ }
+ comboBox.removeAllItems();
+ for (T newItem : newItems) {
+ comboBox.addItem(newItem);
+ }
+ if (selectedItem != null) {
+ int count = comboBox.getItemCount();
+ for (int i = 0; i < count; i++) {
+ Object item = comboBox.getItemAt(i);
+ if (selectedItem.equals(item)) {
+ comboBox.setSelectedIndex(i);
+ break;
+ }
+ }
+ }
+ }
+
+ private static <T> boolean shouldUpdate(@NotNull JComboBox comboBox, @NotNull List<T> newItems) {
+ int count = comboBox.getItemCount();
+ if (newItems.size() != count) {
+ return true;
+ }
+ for (int i = 0; i < count; i++) {
+ Object oldItem = comboBox.getItemAt(i);
+ T newItem = newItems.get(i);
+ if (!ComparatorUtil.equalsNullable(oldItem, newItem)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public static void setNoBorderCellRendererFor(@NotNull TableColumn column) {
+ final TableCellRenderer previous = column.getCellRenderer();
+ column.setCellRenderer(new DefaultTableCellRenderer() {
+ @Override
+ public Component getTableCellRendererComponent(JTable table,
+ Object value,
+ boolean isSelected,
+ boolean hasFocus,
+ int row,
+ int column) {
+ Component component;
+ if (previous != null) {
+ component = previous.getTableCellRendererComponent(table, value, isSelected, false, row, column);
+ }
+ else {
+ component = super.getTableCellRendererComponent(table, value, isSelected, false, row, column);
+ }
+ if (component instanceof JComponent) {
+ ((JComponent)component).setBorder(null);
+ }
+ return component;
+ }
+ });
+ }
+
+ public static void addHistoryOnExpansion(@NotNull final TextFieldWithHistory textFieldWithHistory,
+ @NotNull final NotNullProducer<List<String>> historyProvider) {
+ textFieldWithHistory.addPopupMenuListener(new PopupMenuListener() {
+ @Override
+ public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
+ List<String> newHistory = historyProvider.produce();
+ Set<String> newHistorySet = ContainerUtil.newHashSet(newHistory);
+ List<String> oldHistory = textFieldWithHistory.getHistory();
+ List<String> mergedHistory = ContainerUtil.newArrayList();
+ for (String item : oldHistory) {
+ if (!newHistorySet.contains(item)) {
+ mergedHistory.add(item);
+ }
+ }
+ mergedHistory.addAll(newHistory);
+ textFieldWithHistory.setHistory(mergedHistory);
+
+ setLongestAsPrototype(textFieldWithHistory, mergedHistory);
+
+ // one-time initialization
+ textFieldWithHistory.removePopupMenuListener(this);
+ }
+
+ @Override
+ public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
+ }
+
+ @Override
+ public void popupMenuCanceled(PopupMenuEvent e) {
+ }
+ });
+ }
+
+ private static void setLongestAsPrototype(@NotNull JComboBox comboBox, @NotNull List<String> variants) {
+ Object prototypeDisplayValue = comboBox.getPrototypeDisplayValue();
+ String prototypeDisplayValueStr = null;
+ if (prototypeDisplayValue instanceof String) {
+ prototypeDisplayValueStr = (String) prototypeDisplayValue;
+ }
+ else if (prototypeDisplayValue != null) {
+ return;
+ }
+ String longest = StringUtil.notNullize(prototypeDisplayValueStr);
+ boolean updated = false;
+ for (String s : variants) {
+ if (longest.length() < s.length()) {
+ longest = s;
+ updated = true;
+ }
+ }
+ if (updated) {
+ comboBox.setPrototypeDisplayValue(longest);
+ }
+ }
+
+ public static void installFileCompletionAndBrowseDialog(@Nullable Project project,
+ @NotNull TextFieldWithHistoryWithBrowseButton textFieldWithHistoryWithBrowseButton,
+ @NotNull String browseDialogTitle,
+ @NotNull FileChooserDescriptor fileChooserDescriptor) {
+ doInstall(project,
+ textFieldWithHistoryWithBrowseButton,
+ textFieldWithHistoryWithBrowseButton.getChildComponent().getTextEditor(),
+ browseDialogTitle,
+ fileChooserDescriptor,
+ TextComponentAccessor.TEXT_FIELD_WITH_HISTORY_WHOLE_TEXT);
+ }
+
+ public static void installFileCompletionAndBrowseDialog(@Nullable Project project,
+ @NotNull TextFieldWithBrowseButton textFieldWithBrowseButton,
+ @NotNull String browseDialogTitle,
+ @NotNull FileChooserDescriptor fileChooserDescriptor) {
+ doInstall(project,
+ textFieldWithBrowseButton,
+ textFieldWithBrowseButton.getTextField(),
+ browseDialogTitle,
+ fileChooserDescriptor,
+ TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT);
+ }
+
+ private static <T extends JComponent> void doInstall(@Nullable Project project,
+ @NotNull ComponentWithBrowseButton<T> componentWithBrowseButton,
+ @NotNull JTextField textField,
+ @NotNull String browseDialogTitle,
+ @NotNull FileChooserDescriptor fileChooserDescriptor,
+ @NotNull TextComponentAccessor<T> textComponentAccessor) {
+ fileChooserDescriptor = fileChooserDescriptor.withShowHiddenFiles(SystemInfo.isUnix);
+ componentWithBrowseButton.addBrowseFolderListener(
+ project,
+ new ComponentWithBrowseButton.BrowseFolderActionListener<T>(
+ browseDialogTitle,
+ null,
+ componentWithBrowseButton,
+ project,
+ fileChooserDescriptor,
+ textComponentAccessor
+ ),
+ true
+ );
+ FileChooserFactory.getInstance().installFileCompletion(
+ textField,
+ fileChooserDescriptor,
+ true,
+ project
+ );
+ }
+
+ @NotNull
+ public static HyperlinkLabel createWebHyperlink(@NotNull String url) {
+ return createWebHyperlink(url, url);
+ }
+
+ @NotNull
+ public static HyperlinkLabel createWebHyperlink(@NotNull String text, @NotNull String url) {
+ HyperlinkLabel hyperlink = new HyperlinkLabel(text);
+ hyperlink.setHyperlinkTarget(url);
+
+ DefaultActionGroup actionGroup = new DefaultActionGroup();
+ actionGroup.add(new OpenLinkInBrowser(url));
+ actionGroup.add(new CopyLinkAction(url));
+
+ hyperlink.setComponentPopupMenu(ActionManager.getInstance().createActionPopupMenu("web hyperlink", actionGroup).getComponent());
+ return hyperlink;
+ }
+
+ public static void setPreferredWidth(@NotNull JComponent component, int width) {
+ Dimension preferredSize = component.getPreferredSize();
+ preferredSize.width = width;
+ component.setPreferredSize(preferredSize);
+ }
+
+ @NotNull
+ public static JEditorPane createHtmlViewer(boolean carryTextOver,
+ @Nullable Font font,
+ @Nullable Color background,
+ @Nullable Color foreground) {
+ final JEditorPane textPane;
+ if (carryTextOver) {
+ textPane = new JEditorPane() {
+ @Override
+ public Dimension getPreferredSize() {
+ // This trick makes text component to carry text over to the next line
+ // if the text line width exceeds parent's width
+ Dimension dimension = super.getPreferredSize();
+ dimension.width = 0;
+ return dimension;
+ }
+ };
+ }
+ else {
+ textPane = new JEditorPane();
+ }
+ textPane.setFont(font != null ? font : UIUtil.getLabelFont());
+ textPane.setContentType(UIUtil.HTML_MIME);
+ textPane.setEditable(false);
+ textPane.setBackground(background != null ? background : UIUtil.getLabelBackground());
+ textPane.setForeground(foreground != null ? foreground : UIUtil.getLabelForeground());
+ return textPane;
+ }
+
+ public static void setHtml(@NotNull JEditorPane editorPane, @NotNull String bodyInnerHtml) {
+ String html = String.format(
+ "<html><head>%s</head><body>%s</body></html>",
+ UIUtil.getCssFontDeclaration(editorPane.getFont(), null, null, null),
+ bodyInnerHtml
+ );
+ editorPane.setText(html);
+ }
+
+ private static class CopyLinkAction extends AnAction {
+
+ private final String myUrl;
+
+ private CopyLinkAction(@NotNull String url) {
+ super("Copy Link Address", null, PlatformIcons.COPY_ICON);
+ myUrl = url;
+ }
+
+ @Override
+ public void update(AnActionEvent e) {
+ e.getPresentation().setEnabled(true);
+ }
+
+ @Override
+ public void actionPerformed(AnActionEvent e) {
+ Transferable content = new StringSelection(myUrl);
+ CopyPasteManager.getInstance().setContents(content);
+ }
+ }
+
+ private static class OpenLinkInBrowser extends AnAction {
+
+ private final String myUrl;
+
+ private OpenLinkInBrowser(@NotNull String url) {
+ super("Open Link in Browser", null, PlatformIcons.WEB_ICON);
+ myUrl = url;
+ }
+
+ @Override
+ public void update(AnActionEvent e) {
+ e.getPresentation().setEnabled(true);
+ }
+
+ @Override
+ public void actionPerformed(AnActionEvent e) {
+ BrowserUtil.browse(myUrl);
+ }
+ }
+} \ No newline at end of file
diff --git a/platform/platform-impl/src/com/intellij/util/ui/table/TableModelEditor.java b/platform/platform-impl/src/com/intellij/util/ui/table/TableModelEditor.java
index dd41a33a9d15..8b148a3d791d 100644
--- a/platform/platform-impl/src/com/intellij/util/ui/table/TableModelEditor.java
+++ b/platform/platform-impl/src/com/intellij/util/ui/table/TableModelEditor.java
@@ -22,6 +22,7 @@ import com.intellij.openapi.util.JDOMUtil;
import com.intellij.openapi.util.Ref;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.ui.*;
+import com.intellij.ui.table.JBTable;
import com.intellij.ui.table.TableView;
import com.intellij.util.Function;
import com.intellij.util.FunctionUtil;
@@ -42,6 +43,7 @@ import javax.swing.*;
import javax.swing.event.TableModelEvent;
import javax.swing.event.TableModelListener;
import javax.swing.table.TableModel;
+import java.awt.*;
import java.lang.reflect.Constructor;
import java.util.ArrayList;
import java.util.Collections;
@@ -71,6 +73,8 @@ public class TableModelEditor<T> implements ElementProducer<T> {
table = new TableView<T>(model);
table.setDefaultEditor(Enum.class, ComboBoxTableCellEditor.INSTANCE);
table.setStriped(true);
+ table.setEnableAntialiasing(true);
+ preferredScrollableViewportHeightInRows(JBTable.PREFERRED_SCROLLABLE_VIEWPORT_HEIGHT_IN_ROWS);
new TableSpeedSearch(table);
if (columns[0].getColumnClass() == Boolean.class && columns[0].getName().isEmpty()) {
TableUtil.setupCheckboxColumn(table.getColumnModel().getColumn(0));
@@ -97,6 +101,11 @@ public class TableModelEditor<T> implements ElementProducer<T> {
}
}
+ public TableModelEditor<T> preferredScrollableViewportHeightInRows(int rows) {
+ table.setPreferredScrollableViewportSize(new Dimension(200, table.getRowHeight() * rows));
+ return this;
+ }
+
private void addDialogActions() {
toolbarDecorator.setEditAction(new AnActionButtonRunnable() {
@Override
diff --git a/platform/platform-resources-en/src/messages/ActionsBundle.properties b/platform/platform-resources-en/src/messages/ActionsBundle.properties
index cf3ca0152b2d..1c05af27102c 100644
--- a/platform/platform-resources-en/src/messages/ActionsBundle.properties
+++ b/platform/platform-resources-en/src/messages/ActionsBundle.properties
@@ -110,7 +110,7 @@ action.EditorMoveDownAndScrollWithSelection.text=Move Down and Scroll with Selec
action.EditorAddOrRemoveCaret.text=Add or Remove Caret
action.EditorCloneCaretBelow.text=Clone Caret Below
action.EditorCloneCaretAbove.text=Clone Caret Above
-action.SelectNextOccurrence.text=Select Next Occurrence
+action.SelectNextOccurrence.text=Add Selection for Next Occurrence
action.SelectAllOccurrences.text=Select All Occurrences
action.UnselectPreviousOccurrence.text=Unselect Occurrence
action.EditorToggleStickySelection.text=Toggle Sticky Selection
@@ -329,10 +329,10 @@ action.FindModal.text=_Find...
action.FindModal.description=Find a string in active editor, shows modal dialog
action.Replace.text=_Replace...
action.Replace.description=Replace a string in active editor with another string
-action.FindNext.text=Find _Next
-action.FindNext.description=Repeat the last Find/Replace operation
-action.FindPrevious.text=Find Pre_vious
-action.FindPrevious.description=Repeat the last Find/Replace operation in reverse direction
+action.FindNext.text=Find _Next / Move to Next Occurrence
+action.FindNext.description=Repeat the last Find/Replace operation, or moving to next occurrence of selected text
+action.FindPrevious.text=Find Pre_vious / Move to Previous Occurrence
+action.FindPrevious.description=Repeat the last Find/Replace operation in reverse direction, or moving to previous occurrence of selected text
action.FindWordAtCaret.text=Find _Word at Caret
action.FindWordAtCaret.description=Find next occurrence of the word at caret
action.IncrementalSearch.text=Incrementa_l Search
@@ -1014,6 +1014,8 @@ action.Vcs.ShowDiffAction.text=Show Changes
action.Vcs.ShowDiffAction.description=Show changes
action.Vcs.RollbackChanges.text=Rollback Changes
action.Vcs.RollbackChanges.description=Rollback changes
+action.RollbackLineStatusChanges.text=Rollback
+action.RollbackLineStatusChanges.description=Rollback selected local changes
action.Vcs.EditSourceAction.text=Edit Source
action.Vcs.EditSourceAction.description=Edit source
action.Vcs.ExcludeAction.text=Exclude from Commit
@@ -1391,3 +1393,9 @@ action.FillParagraph.description=Reformat string literal or comment to fit maxim
action.SaveDocument.text=Save Document
action.SaveDocument.description=Saves only the file opened in the current editor
+
+action.StructuralSearchPlugin.StructuralSearchAction.text=Search S_tructurally...
+action.StructuralSearchPlugin.StructuralSearchAction.description=Structural Search
+action.StructuralSearchPlugin.StructuralReplaceAction.text=Repla_ce Structurally...
+action.StructuralSearchPlugin.StructuralReplaceAction.description=Structural Replace
+
diff --git a/platform/platform-resources-en/src/messages/ApplicationBundle.properties b/platform/platform-resources-en/src/messages/ApplicationBundle.properties
index fb3d47133256..bbd737afedf1 100644
--- a/platform/platform-resources-en/src/messages/ApplicationBundle.properties
+++ b/platform/platform-resources-en/src/messages/ApplicationBundle.properties
@@ -575,7 +575,6 @@ title.tabs.and.indents=Tabs and Indents
watcher.slow.sync=External file changes sync may be slow
watcher.exe.not.found=Native file watcher executable not found
watcher.exe.not.exe=Native file watcher is not executable: <a href="{0}">{0}</a>
-watcher.exe.outdated=Native file watcher executable is outdated
watcher.failed.to.start=File watcher failed to start
watcher.gave.up=File watcher gave up to operate
watcher.non.watchable.project=Project files cannot be watched (are they under network mount?)
@@ -642,4 +641,6 @@ checkbox.reformat.on.typing.rbrace=Reformat block on typing '}'
group.richcopy=Rich-text copy
combobox.richcopy.color.scheme=Color scheme
-combobox.richcopy.color.scheme.active=Active scheme \ No newline at end of file
+combobox.richcopy.color.scheme.active=Active scheme
+
+settings.code.style.default.general=Default (General) \ No newline at end of file
diff --git a/platform/platform-resources-en/src/messages/CodeInsightBundle.properties b/platform/platform-resources-en/src/messages/CodeInsightBundle.properties
index 23931e72104b..e7a7b43bf223 100644
--- a/platform/platform-resources-en/src/messages/CodeInsightBundle.properties
+++ b/platform/platform-resources-en/src/messages/CodeInsightBundle.properties
@@ -244,11 +244,11 @@ intention.settings.category.text=<html><body><font face=\"verdana\" size=\"-1\">
<center>To enable/disable a particular intention, select the intention inside this category.</center>\
</font></body></html>
templates.postfix.settings.category.text=<html><body><font face=\"verdana\" size=\"-1\">\
- <center>You have selected the postfix completion language.</center>\
- <center>By clicking the checkbox, you can enable/disable all postfix completions for the language.</center>\
- <center>To enable/disable a particular postfix completion select the postfix completion inside the language.</center>\
+ You have selected the postfix completion language.<br>\
+ By clicking the checkbox, you can enable/disable all postfix templates for the language.<br>\
+ To enable/disable a postfix template select it inside the group.<br>\
</font></body></html>
-templates.postfix.settings.category.before=The sample code featuring selected intention will be shown here.\n \
+templates.postfix.settings.category.before=The sample code featuring selected template will be shown here.\n \
<spot>Flashing rectangle</spot> shows the place where intention is applicable.
templates.postfix.settings.category.after=Postfix completion invocation result will be shown here.
javadoc.description.copied.from.interface=Description copied from interface:
diff --git a/platform/platform-resources-en/src/messages/IdeBundle.properties b/platform/platform-resources-en/src/messages/IdeBundle.properties
index b6180094abd1..05e73117e044 100644
--- a/platform/platform-resources-en/src/messages/IdeBundle.properties
+++ b/platform/platform-resources-en/src/messages/IdeBundle.properties
@@ -23,7 +23,7 @@ button.wizard.previous=&Previous
button.wizard.next=&Next
title.system.error=System Error
title.select.path.to.browser=Select Path to Browser
-title.general=General
+title.general=System Settings
editbox.default.encoding.for.properties.files=Default encoding for properties files:
checkbox.transparent.native.to.ascii.conversion=Transparent native-to-ascii conversion
checkbox.autodetect.utf=Autodetect UTF-encoded files
diff --git a/platform/platform-resources-en/src/messages/InspectionsBundle.properties b/platform/platform-resources-en/src/messages/InspectionsBundle.properties
index 0e423f5e6a6e..40940d687471 100644
--- a/platform/platform-resources-en/src/messages/InspectionsBundle.properties
+++ b/platform/platform-resources-en/src/messages/InspectionsBundle.properties
@@ -347,6 +347,7 @@ inspection.error.loading.message=Error reading inspection profile {0, choice, 0#
inspection.errors.occurred.dialog.title=Errors Occurred
inspection.profiles.presentable.name=Inspection profiles
inspection.severity=Se&verity:
+inspection.scopes.and.severities=Scopes and Se&vereties:
inspection.description.title=Description
inspection.as=As {0}
inspection.new.profile.dialog.title=Create new profile
diff --git a/platform/platform-resources-en/src/messages/OptionsBundle.properties b/platform/platform-resources-en/src/messages/OptionsBundle.properties
index b1c60ece9896..aa2d1047c66e 100644
--- a/platform/platform-resources-en/src/messages/OptionsBundle.properties
+++ b/platform/platform-resources-en/src/messages/OptionsBundle.properties
@@ -198,6 +198,17 @@ options.xml.display.name=XML
settings.panel.title=Settings
+configurable.group.appearance.settings.display.name=Appearance and Behavior
+configurable.group.editor.settings.display.name=Editor
+configurable.group.project.settings.display.name=Current Project
+configurable.group.build.settings.display.name=Build, Execution, Deployment
+configurable.group.language.settings.display.name=Languages and Frameworks
+configurable.group.tools.settings.display.name=Tools
+configurable.group.null.settings.display.name=Other Settings
+
+configurable.default.project.tooltip=For default project
+configurable.current.project.tooltip=For current project
+
control.panel.classic.view.button=Classic &View
options.page.modified.save.message.text=The page has been modified. Save changes made on this page?
options.save.changes.message.title=Save Changes
diff --git a/platform/platform-resources-en/src/messages/XDebuggerBundle.properties b/platform/platform-resources-en/src/messages/XDebuggerBundle.properties
index 523c8b697627..878c814e4764 100644
--- a/platform/platform-resources-en/src/messages/XDebuggerBundle.properties
+++ b/platform/platform-resources-en/src/messages/XDebuggerBundle.properties
@@ -1,6 +1,8 @@
xdebugger.colors.page.name=Debugger
debugger.configurable.display.name=Debugger
+debugger.dataViews.display.name=Data Views
+debugger.stepping.display.name=Stepping
xdebugger.default.content.title=Debug
xdebugger.debugger.tab.title=Debugger
@@ -52,6 +54,7 @@ xdebugger.button.evaluate=E&valuate
xdebugger.evaluate.dialog.close=Close
xdebugger.dialog.title.evaluate.expression=Evaluate Expression
xdebugger.evaluate.label.expression=Expression:
+xdebugger.evaluate.addtowatches.hint=Use Control+Enter to add to Watches
dialog.title.evaluate.code.fragment=Evaluate Code Fragment
button.text.code.fragment.mode=Code Fragment &Mode
button.text.expression.mode=Expression &Mode
@@ -110,4 +113,11 @@ scope.catch = Catch
scope.class = Class
scope.instance = Instance
scope.library = Library
-scope.unknown = Unknown \ No newline at end of file
+scope.unknown = Unknown
+
+setting.value.tooltip.delay.label=&Value tooltip delay (ms):
+setting.enable.auto.expressions.label=Enable auto expressions in Variables view
+setting.sort.alphabetically.label=Sort a&lphabetically
+
+setting.hide.window.label=Hide debug &window on process termination
+setting.focus.app.on.breakpoint.label=Focus application on breakpoint
diff --git a/platform/platform-resources-en/src/misc/registry.properties b/platform/platform-resources-en/src/misc/registry.properties
index 8febeb004c43..0f430e0fee58 100644
--- a/platform/platform-resources-en/src/misc/registry.properties
+++ b/platform/platform-resources-en/src/misc/registry.properties
@@ -1,26 +1,21 @@
localHistory.daysToKeep=5
-# suppress inspection "UnusedProperty"
localHistory.daysToKeep.description=Specify how many working days changes should be remembered.\n\
WARNING: Do not use local history as main version control since it may become corrupted if the IDE hangs.
undo.globalUndoLimit=10
undo.documentUndoLimit=100
actionSystem.fixLostTyping=true
-# suppress inspection "UnusedProperty"
actionSystem.fixLostTyping.description=Redispatch events, lost between actions and dialog show/close.
actionSystem.fixStickyFocusedWindows=true
actionSystem.fixNullFocusedComponent=true
actionSystem.noDefaultComponent=true
actionSystem.commandProcessingTimeout=30000
-# suppress inspection "UnusedProperty"
actionSystem.commandProcessingTimeout.description=Timeout after which currently processed command is forcibly cancelled.
actionSystem.typeAheadTimeBeforeDialog=2000
-# suppress inspection "UnusedProperty"
actionSystem.typeAheadTimeBeforeDialog.description=If dialog shown as a result of some typing, all key types withing this time\
will be re-dispatched after dialog is closed.
actionSystem.typeAheadTimeAfterPopupAction=500
actionSystem.playback.delay=20
-# suppress inspection "UnusedProperty"
actionSystem.playback.delay.description=Delay between events generated by the playback runner.
actionSystem.playback.useDirectActionCall=true
actionSystem.playback.useTypingTargets=true
@@ -29,7 +24,6 @@ actionSystem.mac.screenMenuNotUpdatedFix=false
actionSystem.keyGestures.enabled=false
actionSystem.keyGestureDblClickTime=650
actionSystem.suspendFocusTransferIfApplicationInactive=true
-actionSystem.doNotStealFocus=false
actionSystem.xWindow.remove.focus.from.nonFocusable.popups=true
actionSystem.xWindow.remove.focus.from.nonFocusable.popups.delay=50
actionSystem.noContextComponentWhileFocusTransfer=true
@@ -42,31 +36,33 @@ actionSystem.quickAccessEnabled=false
actionSystem.quickAccessModifiers=
actionSystem.quickAccessShowSpotsTime=1500
actionSystem.win.suppressAlt=true
+actionSystem.win.suppressAlt.new=true
actionSystem.mouseGesturesEnabled=true
actionSystem.assertFocusAccessFromEdt=true
actionSystem.enableAbbreviations=true
ide.firstStartup=true
ide.debugMode=false
-# suppress inspection "UnusedProperty"
ide.debugMode.description=Record additional information to make bug reports more informative.
ide.debug.minProgressTime=0
ide.forcedShowTooltip=alt
-# suppress inspection "UnusedProperty"
ide.forcedShowTooltip.description=Shortcut for forced show tooltip.
ide.popup.dropShadow=false
ide.consumeKnownToolkitBugs=true
ide.highlight.match.in.selected.only=true
ide.lazyIconLoading=true
ide.checkDuplicateMnemonics=false
-# suppress inspection "UnusedProperty"
ide.checkDuplicateMnemonics.description=Check for duplicate mnemonics.
ide.dnd.textHints=false
ide.max.recent.projects=25
+ide.hide.excluded.files=true
+ide.hide.excluded.files.restartRequired=true
+ide.hide.excluded.files.description=Do not show excluded files in Project View and exclude them from VCS
+
idea.fix.mac.env=true
-# suppress inspection "UnusedProperty"
-idea.fix.mac.env.description=On Mac, use shell environment for external processes (effective on restart).
+idea.fix.mac.env.restartRequired=true
+idea.fix.mac.env.description=On Mac, use shell environment for external processes.
ide.x11.override.wm=true
@@ -125,6 +121,8 @@ editor.smarterSelectionQuoting=true
editor.skip.copy.and.cut.for.empty.selection=false
editor.distraction.free.mode=false
+editor.add.carets.on.double.control.arrows=true
+
ide.showIndexRebuildMessage=false
ide.tabbedPane.bufferedPaint=true
@@ -143,9 +141,9 @@ ide.mac.show.native.help=true
ide.mac.useNativeClipboard=false
ide.mac.boldEditorTabs=false
ide.mac.disableMacScrollbars=false
-ide.mac.disableMacScrollbars.description=Disables OS X overlay scrollbars (effective on restart)
+ide.mac.disableMacScrollbars.restartRequired=true
+ide.mac.disableMacScrollbars.description=Disables OS X overlay scrollbars
ide.perProjectModality=false
-# suppress inspection "UnusedProperty"
ide.perProjectModality.description=New modality approach. All dialogs are DOCUMENT_MODAL expect ide-wide dialogs
ide.mac.retina.disableDrawingFix=false
@@ -154,25 +152,21 @@ ide.new.preferences=false
ide.new.license.dialog=true
debugger.valueTooltipAutoShow=true
-# suppress inspection "UnusedProperty"
debugger.valueTooltipAutoShow.description=Auto show tooltip on mouse over.
debugger.mayBringFrameToFrontOnBreakpoint=true
debugger.breakpoint.message.full.trace=false
-# suppress inspection "UnusedProperty"
debugger.breakpoint.message.full.trace.description='Log message to console' breakpoint action will out full stacktrace\
for the thread that hit the breakpoint.
+debugger.batch.evaluation=false
analyze.exceptions.on.the.fly=false
-# suppress inspection "UnusedProperty"
analyze.exceptions.on.the.fly.description=Automatically analyze clipboard on frame activation,\
and if there is a stacktrace calls Analyze Stacktrace.
compiler.perform.outputs.refresh.on.start=false
-# suppress inspection "UnusedProperty"
compiler.perform.outputs.refresh.on.start.description=Whether to perform initial FS refresh before compilation starts.\
Need this to detect external changes to output dirs.
compiler.max.static.constants.searches=3000
-# suppress inspection "UnusedProperty"
compiler.max.static.constants.searches.description=If the number of changed compile time constants exceeds this value,\
make will start full-project rebuild
@@ -180,29 +174,24 @@ compiler.process.jdk=
compiler.process.jdk.description=Path to a JDK home. Force build process to be run using the JDK specified. It is assumed that the jdk is at least of version 1.6.
compiler.process.32bit.vm.on.mac=true
-# suppress inspection "UnusedProperty"
compiler.process.32bit.vm.on.mac.description=Force -d32 VM option on Mac (recommended for faster startup and lower memory footprint).
compiler.process.use.memory.temp.cache=true
-# suppress inspection "UnusedProperty"
compiler.process.use.memory.temp.cache.description=Store temporary data in memory for faster compilation;\
requires larger heap size for the build process. If parallel build is enabled, the option is ignored and temp data is always stored in memory.
compiler.process.use.external.javac=false
-# suppress inspection "UnusedProperty"
compiler.process.use.external.javac.description=Run javac compiler in a separate process (allows to run build process with smaller heap size).
compiler.process.debug.port=-1
compiler.automake.trigger.delay=300
-# suppress inspection "UnusedProperty"
compiler.automake.trigger.delay.description=Delay in milliseconds before triggering auto-make in response to file system events
compiler.automake.force.fs.rescan=false
compiler.automake.force.fs.rescan.description=When enabled, for all automatically started builds (automake) collected VFS changes will be ignored and modified files will be determined with FS rescan will be forces
compiler.document.save.trigger.delay=1500
-# suppress inspection "UnusedProperty"
compiler.document.save.trigger.delay.description=Delay in milliseconds before triggering save in response to document changes
vcs.show.colored.annotations=true
@@ -244,22 +233,17 @@ java.completion.make.outer.variables.final.description=Make variables accessed f
documentation.component.editor.font=false
ide.completion.show.better.matching.classes=true
-# suppress inspection "UnusedProperty"
ide.completion.show.better.matching.classes.description=Show non-imported but good matching classes in basic completion
ide.completion.show.lower.case.classes=false
-# suppress inspection "UnusedProperty"
ide.completion.show.lower.case.classes.description=Show non-imported classes starting with a lowercase letter in basic completion
ide.completion.delay.autopopup.until.completed=false
-# suppress inspection "UnusedProperty"
ide.completion.delay.autopopup.until.completed.description=Controls if completion autopopup is shown immediately and populated in background, or delayed until all suggestion are calculated
ide.completion.middle.matching=true
-# suppress inspection "UnusedProperty"
ide.completion.middle.matching.description=Suggest items in completion that contain the entered string somewhere in the middle.
ide.goto.middle.matching=true
-# suppress inspection "UnusedProperty"
ide.goto.middle.matching.description=Suggest items in goto actions that contain the entered string somewhere in the middle.
ide.goto.rebuild.delay=0
@@ -275,21 +259,17 @@ ide.dfa.getters.with.side.effects.description=A regex on qualified names of meth
ide.enable.toolwindow.stack=false
change.signature.awesome.mode=true
-# suppress inspection "UnusedProperty"
change.signature.awesome.mode.description=Enables list view for change signature.
enable.groovy.hotswap=true
-# suppress inspection "UnusedProperty"
enable.groovy.hotswap.description=Whether IDEA should add a special java agent to the debugged process\
which allows to hot-swap Groovy changes in some cases
dump.threads.on.empty.lookup=false
-# suppress inspection "UnusedProperty"
dump.threads.on.empty.lookup.description=Whether IDEA should issue a thread dump when an empty completion lookup appears.
file.structure.tree.mode=true
disable.toolwindow.overlay=true
-# suppress inspection "UnusedProperty"
disable.toolwindow.overlay.description=Disable transparent toolwindow stripes.
core.pooled.threads=20
@@ -300,7 +280,6 @@ type.ahead.logging.enabled=false
fast.tree.expand.in.structure.view=false
ide.goto.implementation.show.interfaces=true
-# suppress inspection "UnusedProperty"
ide.goto.implementation.show.interfaces.description=Whether to show sub-interfaces when invoking\
'Go to Implementation' action (Ctrl+Alt+B) on an interface.
@@ -340,20 +319,15 @@ svn.use.incoming.optimization=false
completion.enable.relevant.method.chain.suggestions=false
ide.mac.message.sheets.java.emulation=false
-# suppress inspection "UnusedProperty"
ide.mac.message.sheets.java.emulation.description=Use Java message sheets instead of native ones
ide.mac.message.sheets.java.emulation.dialogs=true
-# suppress inspection "UnusedProperty"
ide.mac.message.sheets.java.emulation.dialogs.description=Use Java message sheets based on awt dialogs instead of native sheets
linux.native.menu=false
linux.native.menu.description=Enables native menu on Ubuntu
windows.jumplist=true
-# suppress inspection "UnusedProperty"
windows.jumplist.description=Enables JumpLists on Windows
-# suppress inspection "UnusedProperty"
GRADLE.system.in.process=true
-# suppress inspection "UnusedProperty"
GRADLE.system.in.process.description=Whether IDEA should use 'in-process' mode for interaction with gradle api
grails.advanced.mode=false
@@ -363,7 +337,6 @@ darcula.use.native.fonts.on.linux=true
darcula.use.native.fonts.on.linux.description=If false, uses DejaVu Sans 13pt
idea.4.5.laf.enabled=false
ide.libnotify.enabled=true
-# suppress inspection "UnusedProperty"
ide.libnotify.enabled.description=Enables notifications via LibNotify
cvs.roots.refresh.uses.vfs=true
cvs.roots.refresh.uses.vfs.description=Should CVS roots refresh after update use VFS
@@ -378,6 +351,7 @@ dsm.retina.darcula.legend=true
dsm.retina.darcula.legend.description=Experimental DSM legend component
ide.scratch.enabled=false
+ide.show.progress.without.status.bar=false
editor.injected.highlighting.enabled=true
editor.injected.highlighting.enabled.description=Disables injected fragments highlighting (requires project reopening)
@@ -398,15 +372,24 @@ focus.fix.lost.cursor.description=See IDEA-79312
ide.inertial.mouse.fix=false
ide.inertial.mouse.fix.description=See IDEA-71508
+ide.log.focuses=false
+ide.log.focuses.description=Enables logging of focuses (Time consuming)
+
emmet.segments.limit=50
+emmet.template.length.limit.kilobytes=15
command.line.execution.timeout=30
console.too.much.text.buffer.ratio=10
console.too.much.text.buffer.ratio.description=Used for disabling of console processing(console filters for highlights, foldings...),\n\
when there is too much of text to process.\n\
The ratio is used against the console cycle buffer size (idea.cycle.buffer.size/theRatio=maxTextLength).
+ide.file.settings.order.new=false
ide.new.project.settings=false
ide.new.project.settings.description=Temporary key for new project settings dialog UI
commonjs.complete.required.filename.with.extension=false
commonjs.complete.required.filename.with.extension.description=If checked, required filenames are completed with extension
+
+
+fix.jdk7.alt.shortcuts=true
+fix.jdk7.alt.shortcuts.description=Allow to use alt for shortcuts on MacOSX with jdk7+ \ No newline at end of file
diff --git a/platform/platform-resources-en/src/tips/QuickEvaluateExpression.html b/platform/platform-resources-en/src/tips/QuickEvaluateExpression.html
new file mode 100644
index 000000000000..f625c3e3b0bd
--- /dev/null
+++ b/platform/platform-resources-en/src/tips/QuickEvaluateExpression.html
@@ -0,0 +1,15 @@
+<html>
+<head>
+ <link rel="stylesheet" type="text/css" href="css/tips.css">
+</head>
+<body>
+
+ <p>To quickly evaluate the value of any expression while debugging the program,
+ hold Alt and click this expression to see its value and calculate it, call a method, etc. </p>
+
+ <p class="image">
+ <img src="images/quick_evaluate.png">
+ </p>
+
+</body>
+</html>
diff --git a/platform/platform-resources-en/src/tips/images/quick_evaluate.png b/platform/platform-resources-en/src/tips/images/quick_evaluate.png
new file mode 100644
index 000000000000..13c6c4a2a1e6
--- /dev/null
+++ b/platform/platform-resources-en/src/tips/images/quick_evaluate.png
Binary files differ
diff --git a/platform/platform-resources/src/META-INF/LangExtensions.xml b/platform/platform-resources/src/META-INF/LangExtensions.xml
index 0e6680392f94..aaae5ddfab28 100644
--- a/platform/platform-resources/src/META-INF/LangExtensions.xml
+++ b/platform/platform-resources/src/META-INF/LangExtensions.xml
@@ -361,25 +361,25 @@
serviceImplementation="com.intellij.codeInspection.ex.ProjectInspectionProfilesVisibleTreeState"/>
<!-- Editor -->
- <applicationConfigurable instance="com.intellij.application.options.editor.EditorOptions" id="editor" key="title.editor"
+ <applicationConfigurable groupId="editor" instance="com.intellij.application.options.editor.EditorOptions" id="editor" key="title.editor"
bundle="messages.ApplicationBundle" order="after appearance"
childrenEPName="com.intellij.editorOptionsProvider"/>
<projectService serviceInterface="com.intellij.semantic.SemService" serviceImplementation="com.intellij.semantic.SemServiceImpl"/>
<!-- Global Code Style -->
- <projectConfigurable instance="com.intellij.application.options.CodeStyleSchemesConfigurable" order="after colors"/>
+ <projectConfigurable groupId="editor" dynamic="true" displayName="Code Style" instance="com.intellij.application.options.CodeStyleSchemesConfigurable" order="after colors"/>
<applicationService serviceInterface="com.intellij.application.options.codeStyle.CodeStyleSchemesUIConfiguration"
serviceImplementation="com.intellij.application.options.codeStyle.CodeStyleSchemesUIConfiguration"/>
<!-- File Types -->
- <applicationConfigurable instance="com.intellij.openapi.fileTypes.impl.FileTypeConfigurable" id="preferences.fileTypes"
+ <applicationConfigurable groupId="editor" instance="com.intellij.openapi.fileTypes.impl.FileTypeConfigurable" id="preferences.fileTypes"
key="filetype.settings.title" bundle="messages.FileTypesBundle"/>
- <applicationConfigurable instance="com.intellij.codeInsight.intention.impl.config.IntentionSettingsConfigurable" id="intentions"/>
+ <applicationConfigurable groupId="editor" key="intention.settings" bundle="messages.CodeInsightBundle" instance="com.intellij.codeInsight.intention.impl.config.IntentionSettingsConfigurable" id="intentions"/>
<!-- Live Templates -->
- <applicationConfigurable instance="com.intellij.codeInsight.template.impl.LiveTemplatesConfigurable" id="editing.templates"
+ <applicationConfigurable groupId="editor" instance="com.intellij.codeInsight.template.impl.LiveTemplatesConfigurable" id="editing.templates"
key="templates.settings.page.title" bundle="messages.CodeInsightBundle"/>
<lookup.actionProvider implementation="com.intellij.codeInsight.template.impl.LiveTemplateLookupActionProvider"/>
<documentationProvider implementation="com.intellij.codeInsight.template.impl.LiveTemplateDocumentationProvider"/>
@@ -387,15 +387,15 @@
serviceImplementation="com.intellij.codeInsight.template.impl.TemplateManagerImpl"/>
<!-- File Templates-->
- <applicationConfigurable instance="com.intellij.ide.fileTemplates.impl.AllFileTemplatesConfigurable" id="fileTemplates"
+ <applicationConfigurable groupId="editor" instance="com.intellij.ide.fileTemplates.impl.AllFileTemplatesConfigurable" id="fileTemplates"
key="title.file.templates" bundle="messages.IdeBundle"/>
<!-- T.O.D.O -->
- <applicationConfigurable instance="com.intellij.ide.todo.configurable.TodoConfigurable" id="preferences.toDoOptions" key="title.todo"
+ <applicationConfigurable groupId="editor" instance="com.intellij.ide.todo.configurable.TodoConfigurable" id="preferences.toDoOptions" key="title.todo"
bundle="messages.IdeBundle"/>
<!-- External Tools -->
- <applicationConfigurable instance="com.intellij.tools.ToolConfigurable" id="preferences.externalTools" key="tools.settings.title"
+ <applicationConfigurable groupId="tools" instance="com.intellij.tools.ToolConfigurable" id="preferences.externalTools" key="tools.settings.title"
bundle="messages.ToolsBundle"/>
<stepsBeforeRunProvider implementation="com.intellij.tools.ToolBeforeRunTaskProvider"/>
<checkinHandlerFactory implementation="com.intellij.tools.ExternalToolsCheckinHandlerFactory"/>
@@ -551,6 +551,8 @@
<customPasteProvider implementation="com.intellij.ide.actions.PasteReferenceProvider"/>
+ <referenceInjector implementation="com.intellij.codeInsight.daemon.impl.analysis.encoding.EncodingReferenceInjector"/>
+
<usageFilteringRuleProvider implementation="com.intellij.usages.impl.UsageFilteringRuleProviderImpl"/>
<usageGroupingRuleProvider implementation="com.intellij.usages.impl.UsageGroupingRuleProviderImpl"/>
@@ -751,8 +753,8 @@
<psi.fileReferenceHelper implementation="com.intellij.psi.impl.source.resolve.reference.impl.providers.HttpFileReferenceHelper"/>
<psi.fileReferenceHelper implementation="com.intellij.psi.impl.source.resolve.reference.impl.providers.NullFileReferenceHelper" order="last"/>
- <projectConfigurable instance="com.intellij.openapi.vfs.encoding.FileEncodingConfigurable"/>
- <projectConfigurable instance="com.intellij.ui.tabs.FileColorsConfigurable" id="fileColors" displayName="File Colors"/>
+ <projectConfigurable groupId="editor" key="file.encodings.configurable" bundle="messages.IdeBundle" instance="com.intellij.openapi.vfs.encoding.FileEncodingConfigurable"/>
+ <projectConfigurable groupId="appearance" instance="com.intellij.ui.tabs.FileColorsConfigurable" id="fileColors" displayName="File Colors"/>
<uiDebuggerExtension implementation="com.intellij.ui.debugger.extensions.PlaybackDebugger"/>
<uiDebuggerExtension implementation="com.intellij.ui.debugger.extensions.ActionTracer"/>
diff --git a/platform/platform-resources/src/META-INF/PlatformExtensionPoints.xml b/platform/platform-resources/src/META-INF/PlatformExtensionPoints.xml
index 61ee24ebe543..e8a45edbf138 100644
--- a/platform/platform-resources/src/META-INF/PlatformExtensionPoints.xml
+++ b/platform/platform-resources/src/META-INF/PlatformExtensionPoints.xml
@@ -12,6 +12,9 @@
<extensionPoint name="errorHandler"
interface="com.intellij.openapi.diagnostic.ErrorReportSubmitter"/>
+ <extensionPoint name="jps.plugin"
+ beanClass="com.intellij.jps.impl.JpsPluginBean"/>
+
<extensionPoint name="codeInsight.containerProvider"
interface="com.intellij.codeInsight.ContainerProvider"/>
diff --git a/platform/platform-resources/src/META-INF/PlatformExtensions.xml b/platform/platform-resources/src/META-INF/PlatformExtensions.xml
index 851a91d314ab..1f40bacf983c 100644
--- a/platform/platform-resources/src/META-INF/PlatformExtensions.xml
+++ b/platform/platform-resources/src/META-INF/PlatformExtensions.xml
@@ -124,7 +124,7 @@
serviceImplementation="com.intellij.ide.passwordSafe.config.PasswordSafeSettings"/>
<applicationService serviceInterface="com.intellij.ide.passwordSafe.PasswordSafe"
serviceImplementation="com.intellij.ide.passwordSafe.impl.PasswordSafeImpl"/>
- <applicationConfigurable instance="com.intellij.ide.passwordSafe.config.PasswordSafeConfigurable" id="application.passwordSafe"
+ <applicationConfigurable parentId="preferences.general" instance="com.intellij.ide.passwordSafe.config.PasswordSafeConfigurable" id="application.passwordSafe"
displayName="Passwords"/>
<applicationService serviceInterface="com.intellij.execution.process.ColoredOutputTypeRegistry"
serviceImplementation="com.intellij.execution.process.ColoredOutputTypeRegistry"/>
@@ -193,32 +193,32 @@
<projectService serviceImplementation="com.intellij.openapi.editor.LazyRangeMarkerFactory"/>
<!-- General -->
- <applicationConfigurable instance="com.intellij.ide.GeneralSettingsConfigurable"/>
+ <applicationConfigurable groupId="appearance" key="title.general" bundle="messages.IdeBundle" id="preferences.general" instance="com.intellij.ide.GeneralSettingsConfigurable"/>
<!-- Appearance -->
- <applicationConfigurable instance="com.intellij.ide.ui.AppearanceConfigurable" id="appearance" key="title.appearance"
+ <applicationConfigurable groupId="appearance" instance="com.intellij.ide.ui.AppearanceConfigurable" id="appearance" key="title.appearance"
bundle="messages.IdeBundle"/>
<!-- Keymap -->
- <applicationConfigurable instance="com.intellij.openapi.keymap.impl.ui.KeymapPanel" id="preferences.keymap" key="keymap.display.name"
+ <applicationConfigurable groupId="appearance" instance="com.intellij.openapi.keymap.impl.ui.KeymapPanel" id="preferences.keymap" key="keymap.display.name"
bundle="messages.KeyMapBundle"/>
- <applicationConfigurable instance="com.intellij.openapi.keymap.impl.ui.QuickListsPanel" id="reference.idesettings.quicklists"
+ <applicationConfigurable parentId="appearance" instance="com.intellij.openapi.keymap.impl.ui.QuickListsPanel" id="reference.idesettings.quicklists"
displayName="Quick Lists"/>
<!-- Customizations -->
- <applicationConfigurable instance="com.intellij.ide.ui.customization.CustomizationConfigurable" id="preferences.customizations"
+ <applicationConfigurable parentId="appearance" instance="com.intellij.ide.ui.customization.CustomizationConfigurable" id="preferences.customizations"
key="title.customizations" bundle="messages.IdeBundle"/>
<!-- Notifications -->
- <applicationConfigurable instance="com.intellij.notification.impl.NotificationsConfigurable"/>
+ <applicationConfigurable groupId="appearance" displayName="Notifications" instance="com.intellij.notification.impl.NotificationsConfigurable"/>
<!-- Plugins -->
- <applicationConfigurable instance="com.intellij.ide.plugins.PluginManagerConfigurable" id="preferences.pluginManager"
+ <applicationConfigurable groupId="appearance" instance="com.intellij.ide.plugins.PluginManagerConfigurable" id="preferences.pluginManager"
displayName="Plugins"/>
<actionFromOptionDescriptorProvider implementation="com.intellij.ide.plugins.InstalledPluginsManagerMain$PluginsActionFromOptionDescriptorProvider"/>
- <applicationConfigurable instance="com.intellij.util.net.HTTPProxySettingsPanel" id="http.proxy" displayName="HTTP Proxy" />
- <applicationConfigurable instance="com.intellij.util.net.ssl.CertificateConfigurable"/>
- <applicationConfigurable instance="com.intellij.openapi.diff.impl.external.DiffOptionsForm" id="diff" displayName="External Diff Tools" />
+ <applicationConfigurable parentId="preferences.general" instance="com.intellij.util.net.HTTPProxySettingsPanel" id="http.proxy" displayName="HTTP Proxy" />
+ <applicationConfigurable groupId="tools" displayName="Server Certificates" instance="com.intellij.util.net.ssl.CertificateConfigurable"/>
+ <applicationConfigurable groupId="tools" instance="com.intellij.openapi.diff.impl.external.DiffOptionsForm" id="diff" displayName="External Diff Tools" />
<!--<applicationConfigurable instance="com.intellij.ui.switcher.QuickAccessConfigurable"/>-->
<fileTypeFactory implementation="com.intellij.openapi.fileTypes.impl.PlatformFileTypeFactory"/>
@@ -226,7 +226,7 @@
<applicationService serviceInterface="com.intellij.openapi.options.colors.ColorSettingsPages"
serviceImplementation="com.intellij.openapi.options.colors.pages.ColorSettingsPagesImpl"/>
- <applicationConfigurable instance="com.intellij.openapi.updateSettings.impl.UpdateSettingsConfigurable" id="preferences.updates"
+ <applicationConfigurable parentId="preferences.general" instance="com.intellij.openapi.updateSettings.impl.UpdateSettingsConfigurable" id="preferences.updates"
key="updates.settings.title" bundle="messages.IdeBundle"/>
<applicationService serviceInterface="com.intellij.psi.search.scope.packageSet.PackageSetFactory"
@@ -242,7 +242,7 @@
<componentConfigurationMerger implementation="com.intellij.openapi.vcs.changes.shelf.ShelfManagerConfigurationMerger"/>
<editorActionHandler action="EditorEscape" implementationClass="com.intellij.codeInsight.hint.EscapeHandler" id="hide-hints"/>
- <projectConfigurable instance="com.intellij.javaee.ExternalResourceConfigurable" key="display.name.edit.external.resource"
+ <projectConfigurable groupId="language" instance="com.intellij.javaee.ExternalResourceConfigurable" key="display.name.edit.external.resource"
bundle="messages.XmlBundle" id="preferences.externalResources">
<configurable instance="com.intellij.javaee.XMLCatalogConfigurable" displayName="XML Catalog" id="xml.catalog"/>
</projectConfigurable>
@@ -262,7 +262,7 @@
<statistics.usagesCollector implementation="com.intellij.internal.statistic.UiInfoUsageCollector"/>
<statistics.usagesCollector implementation="com.intellij.internal.statistic.JdkInfoUsageCollector"/>
- <applicationConfigurable instance="com.intellij.internal.statistic.configurable.StatisticsConfigurable" id="usage.statistics"
+ <applicationConfigurable parentId="preferences.general" instance="com.intellij.internal.statistic.configurable.StatisticsConfigurable" id="usage.statistics"
displayName="Usage Statistics"/>
<virtualFileSystem key="dummy" implementationClass="com.intellij.openapi.vfs.ex.dummy.DummyFileSystem"/>
diff --git a/platform/platform-resources/src/META-INF/PlatformLangPlugin.xml b/platform/platform-resources/src/META-INF/PlatformLangPlugin.xml
index baee8add1483..b7a11c39ecae 100644
--- a/platform/platform-resources/src/META-INF/PlatformLangPlugin.xml
+++ b/platform/platform-resources/src/META-INF/PlatformLangPlugin.xml
@@ -81,8 +81,8 @@
<programRunner implementation="com.intellij.execution.runners.BasicProgramRunner" order="last"/>
- <projectConfigurable provider="com.intellij.profile.codeInspection.ui.ProjectInspectionToolsConfigurableProvider" order="before intentions"/>
- <projectConfigurable instance="com.intellij.ide.util.scopeChooser.ScopeChooserConfigurable" id="project.scopes" key="scopes.display.name" bundle="messages.IdeBundle" />
+ <projectConfigurable groupId="editor" displayName="Inspections" provider="com.intellij.profile.codeInspection.ui.ProjectInspectionToolsConfigurableProvider" order="before intentions"/>
+ <projectConfigurable groupId="project" instance="com.intellij.ide.util.scopeChooser.ScopeChooserConfigurable" id="project.scopes" key="scopes.display.name" bundle="messages.IdeBundle" />
<checkoutCompletedListener implementation="com.intellij.openapi.vcs.checkout.PlatformProjectCheckoutListener" id="PlatformProjectCheckoutListener"/>
diff --git a/platform/platform-resources/src/META-INF/VcsExtensions.xml b/platform/platform-resources/src/META-INF/VcsExtensions.xml
index 9d40b359f59b..a05f28107034 100644
--- a/platform/platform-resources/src/META-INF/VcsExtensions.xml
+++ b/platform/platform-resources/src/META-INF/VcsExtensions.xml
@@ -25,7 +25,7 @@
<selectInTarget implementation="com.intellij.openapi.vcs.changes.SelectInChangesViewTarget"/>
- <projectConfigurable instance="com.intellij.openapi.vcs.configurable.VcsManagerConfigurable" id="vcs"/>
+ <projectConfigurable groupId="project" dynamic="true" key="version.control.main.configurable.name" bundle="messages.VcsBundle" instance="com.intellij.openapi.vcs.configurable.VcsManagerConfigurable" id="vcs"/>
<changesViewContent tabName="Repository" className="com.intellij.openapi.vcs.changes.committed.CommittedChangesViewManager"
predicateClassName="com.intellij.openapi.vcs.changes.committed.CommittedChangesVisibilityPredicate"/>
diff --git a/platform/platform-resources/src/META-INF/XmlPlugin.xml b/platform/platform-resources/src/META-INF/XmlPlugin.xml
index 9da1e3317e13..9a737df77ef6 100644
--- a/platform/platform-resources/src/META-INF/XmlPlugin.xml
+++ b/platform/platform-resources/src/META-INF/XmlPlugin.xml
@@ -182,7 +182,7 @@
serviceImplementation="com.intellij.application.options.editor.WebEditorOptions"/>
<exportable serviceInterface="com.intellij.application.options.editor.WebEditorOptions"/>
- <applicationConfigurable provider="com.intellij.application.options.emmet.EmmetConfigurableProvider"/>
+ <applicationConfigurable groupId="editor" key="emmet.configuration.title" bundle="messages.XmlBundle" provider="com.intellij.application.options.emmet.EmmetConfigurableProvider"/>
<applicationService serviceInterface="com.intellij.application.options.emmet.EmmetOptions"
serviceImplementation="com.intellij.application.options.emmet.EmmetOptions"/>
<exportable serviceInterface="com.intellij.application.options.emmet.EmmetOptions"/>
@@ -527,7 +527,7 @@
<selectInTarget implementation="com.intellij.ide.browsers.actions.SelectInDefaultBrowserTarget"/>
<xml.xmlExtension implementation="com.intellij.xml.HtmlXmlExtension"/>
- <applicationConfigurable instance="com.intellij.ide.browsers.BrowserSettings" id="reference.settings.ide.settings.web.browsers"
+ <applicationConfigurable groupId="tools" instance="com.intellij.ide.browsers.BrowserSettings" id="reference.settings.ide.settings.web.browsers"
key="browsers.settings" bundle="messages.IdeBundle"/>
<lang.inspectionSuppressor language="XML" implementationClass="com.intellij.codeInspection.XmlInspectionSuppressor"/>
</extensions>
diff --git a/platform/platform-resources/src/META-INF/xdebugger.xml b/platform/platform-resources/src/META-INF/xdebugger.xml
index 013a4d881a12..68111b8eb7b2 100644
--- a/platform/platform-resources/src/META-INF/xdebugger.xml
+++ b/platform/platform-resources/src/META-INF/xdebugger.xml
@@ -15,7 +15,7 @@
<extensions defaultExtensionNs="com.intellij">
<colorSettingsPage implementation="com.intellij.xdebugger.impl.ui.DebuggerColorsPage"/>
- <applicationService serviceInterface="com.intellij.xdebugger.impl.settings.XDebuggerSettingsManager"
+ <applicationService serviceInterface="com.intellij.xdebugger.settings.XDebuggerSettingsManager"
serviceImplementation="com.intellij.xdebugger.impl.settings.XDebuggerSettingsManager"/>
<applicationService serviceInterface="com.intellij.xdebugger.XDebuggerUtil"
@@ -29,7 +29,7 @@
<projectService serviceInterface="com.intellij.xdebugger.impl.XDebuggerHistoryManager"
serviceImplementation="com.intellij.xdebugger.impl.XDebuggerHistoryManager"/>
- <applicationConfigurable provider="com.intellij.xdebugger.impl.settings.DebuggerConfigurableProvider"/>
+ <applicationConfigurable groupId="build" dynamic="true" key="debugger.configurable.display.name" bundle="messages.XDebuggerBundle" provider="com.intellij.xdebugger.impl.settings.DebuggerConfigurableProvider"/>
<customizableActionGroupProvider implementation="com.intellij.xdebugger.impl.ui.XDebugTabCustomizableActionGroupProvider"/>
diff --git a/platform/platform-resources/src/brokenPlugins.txt b/platform/platform-resources/src/brokenPlugins.txt
index d5678fdd8977..438c23f2ffd2 100644
--- a/platform/platform-resources/src/brokenPlugins.txt
+++ b/platform/platform-resources/src/brokenPlugins.txt
@@ -15,4 +15,5 @@ org.jetbrains.kotlin 0.7.1360 0.7.1376 0.8.7
SBT 1.0.0 1.1.0 1.2.0 1.3.0 1.3.1 1.4.0 1.5.0
"JSTestDriver Plugin" 138.21 136.1141 134.1163 134.686 134.31 134.307 134.1039
AngularJS 134.1094 0.1.8 0.1.9
-org.jetbrains.plugins.vagrant 0.1 0.2 \ No newline at end of file
+org.jetbrains.plugins.vagrant 0.1 0.2
+org.intellij.clojure 0.2.1.178 \ No newline at end of file
diff --git a/platform/platform-resources/src/componentSets/Lang.xml b/platform/platform-resources/src/componentSets/Lang.xml
index bd3879e67a90..89a9b361a4f0 100644
--- a/platform/platform-resources/src/componentSets/Lang.xml
+++ b/platform/platform-resources/src/componentSets/Lang.xml
@@ -37,6 +37,7 @@
<component>
<implementation-class>com.intellij.codeInsight.preview.ImageOrColorPreviewManager</implementation-class>
</component>
+
</application-components>
<project-components>
@@ -203,7 +204,8 @@
</component>
<component>
- <implementation-class>com.intellij.openapi.roots.impl.PushedFilePropertiesUpdater</implementation-class>
+ <interface-class>com.intellij.openapi.roots.impl.PushedFilePropertiesUpdater</interface-class>
+ <implementation-class>com.intellij.openapi.roots.impl.PushedFilePropertiesUpdaterImpl</implementation-class>
</component>
<component>
@@ -225,6 +227,7 @@
<interface-class>com.intellij.ide.GeneratedSourceFileChangeTracker</interface-class>
<implementation-class>com.intellij.ide.GeneratedSourceFileChangeTrackerImpl</implementation-class>
</component>
+
</project-components>
<module-components>
diff --git a/platform/platform-resources/src/idea/PlatformLangActionManager.xml b/platform/platform-resources/src/idea/PlatformLangActionManager.xml
index c5d83d776ce4..a5431feb2538 100644
--- a/platform/platform-resources/src/idea/PlatformLangActionManager.xml
+++ b/platform/platform-resources/src/idea/PlatformLangActionManager.xml
@@ -42,7 +42,7 @@
<group id="InspectCodeGroup">
<separator/>
<action id="InspectCode" class="com.intellij.codeInspection.actions.CodeInspectionAction"/>
- <action id="CodeCleanup" class="com.intellij.codeInspection.actions.CodeCleanupAction" internal="true"/>
+ <action id="CodeCleanup" class="com.intellij.codeInspection.actions.CodeCleanupAction"/>
<action id="RunInspection" class="com.intellij.codeInspection.actions.RunInspectionAction" />
<action id="PopupHector" class="com.intellij.codeInsight.daemon.impl.PopupHectorAction"/>
<action id="ViewOfflineInspection" class="com.intellij.codeInspection.actions.ViewOfflineResultsAction"/>
diff --git a/platform/platform-resources/src/idea/VcsActions.xml b/platform/platform-resources/src/idea/VcsActions.xml
index 935bcc7b4df8..dc15f19282bf 100644
--- a/platform/platform-resources/src/idea/VcsActions.xml
+++ b/platform/platform-resources/src/idea/VcsActions.xml
@@ -265,6 +265,9 @@
<add-to-group group-id="CloseEditorsGroup" anchor="before" relative-to-action="CloseAllUnpinnedEditors"/>
</action>
+ <action id="RollbackLineStatusChanges" class="com.intellij.openapi.vcs.ex.RollbackLineStatusAction">
+ </action>
+
<action id="WelcomeScreen.GetFromVcs" class="com.intellij.openapi.wm.impl.welcomeScreen.GetFromVcsAction"
icon="AllIcons.General.GetProjectfromVCS">
<add-to-group group-id="WelcomeScreen.QuickStart" anchor="first"/>
diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/editor/EditorMultiCaretTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/editor/EditorMultiCaretTest.java
index 26be81d2f341..fdaf7c6ed5b0 100644
--- a/platform/platform-tests/testSrc/com/intellij/openapi/editor/EditorMultiCaretTest.java
+++ b/platform/platform-tests/testSrc/com/intellij/openapi/editor/EditorMultiCaretTest.java
@@ -245,6 +245,38 @@ public class EditorMultiCaretTest extends AbstractEditorTest {
"seven<caret>");
}
+ public void testCopyMultilineFromOneCaretPasteIntoTwo() throws Exception {
+ init("<selection>one\n" +
+ "two<caret></selection>\n" +
+ "three\n" +
+ "four",
+ TestFileType.TEXT);
+ executeAction("EditorCopy");
+ executeAction("EditorTextStart");
+ executeAction("EditorCloneCaretBelow");
+ executeAction("EditorPaste");
+ checkResultByText("one\n" +
+ "two<caret>one\n" +
+ "one\n" +
+ "two<caret>two\n" +
+ "three\n" +
+ "four");
+ }
+
+ public void testCopyPasteDoesNothingWithUnevenSelection() throws Exception {
+ init("<selection>one\n" +
+ "two<caret></selection>\n" +
+ "<selection>three<caret></selection>\n" +
+ "four",
+ TestFileType.TEXT);
+ executeAction("EditorCopy");
+ executeAction("EditorPaste");
+ checkResultByText("one\n" +
+ "two<caret>\n" +
+ "three<caret>\n" +
+ "four");
+ }
+
public void testEscapeAfterDragDown() throws Exception {
init("line1\n" +
"line2",
diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/editor/actions/EditorActionTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/editor/actions/EditorActionTest.java
index deb63c13abf8..20bfdaced5e8 100644
--- a/platform/platform-tests/testSrc/com/intellij/openapi/editor/actions/EditorActionTest.java
+++ b/platform/platform-tests/testSrc/com/intellij/openapi/editor/actions/EditorActionTest.java
@@ -102,4 +102,15 @@ public class EditorActionTest extends AbstractEditorTest {
deleteLine();
checkResultByText("");
}
+
+ public void testDeleteLineHonorSelection() throws Exception {
+ init("xxxx\n" +
+ "bla <selection><caret>bla\n" +
+ "bla</selection> bla\n" +
+ "yyy",
+ TestFileType.TEXT);
+ deleteLine();
+ checkResultByText("xxxx\n" +
+ "yyy<caret>");
+ }
} \ No newline at end of file
diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/editor/actions/SelectUnselectOccurrenceActionsTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/editor/actions/SelectUnselectOccurrenceActionsTest.java
index 34a08c0483bb..c1cc85768aed 100644
--- a/platform/platform-tests/testSrc/com/intellij/openapi/editor/actions/SelectUnselectOccurrenceActionsTest.java
+++ b/platform/platform-tests/testSrc/com/intellij/openapi/editor/actions/SelectUnselectOccurrenceActionsTest.java
@@ -194,6 +194,63 @@ public class SelectUnselectOccurrenceActionsTest extends LightPlatformCodeInsigh
"another line");
}
+ public void testSelectingAdjacentFragments() throws Exception {
+ init("fragment<selection>fragment<caret></selection>");
+ executeAction();
+ executeAction();
+ checkResult("<selection>fragment<caret></selection><selection>fragment<caret></selection>");
+ }
+
+ public void testSkippingOccurrence() throws Exception {
+ init("fr<caret>uit\n" +
+ "fruits\n" +
+ "fruit\n" +
+ "fruits\n" +
+ "fruit");
+ executeAction();
+ executeAction();
+ executeFindNext();
+ checkResult("<selection>fr<caret>uit</selection>\n" +
+ "fruits\n" +
+ "fruit\n" +
+ "fruits\n" +
+ "<selection>fr<caret>uit</selection>");
+ }
+
+ public void testMovingSelectionBackAndForth() throws Exception {
+ init("fr<caret>uit\n" +
+ "fruits\n" +
+ "fruit\n" +
+ "fruits\n" +
+ "fruit");
+ executeAction();
+ executeAction();
+ executeFindNext();
+ executeFindPrevious();
+ executeAction();
+ checkResult("<selection>fr<caret>uit</selection>\n" +
+ "fruits\n" +
+ "<selection>fr<caret>uit</selection>\n" +
+ "fruits\n" +
+ "<selection>fr<caret>uit</selection>");
+ }
+
+ public void testSkipDoesNotRemovePreviousSelections() throws Exception {
+ init("<caret>fruit\n" +
+ "fruit\n" +
+ "fruit");
+ executeAction();
+ executeAction();
+ executeFindNext();
+ executeFindNext();
+ assertEquals(1, hintCount);
+ executeFindNext();
+ assertEquals(1, hintCount);
+ checkResult("<selection><caret>fruit</selection>\n" +
+ "fruit\n" +
+ "<selection><caret>fruit</selection>");
+ }
+
private void init(String text) {
myFixture.configureByText(FileTypes.PLAIN_TEXT, text);
}
@@ -206,6 +263,14 @@ public class SelectUnselectOccurrenceActionsTest extends LightPlatformCodeInsigh
myFixture.performEditorAction(IdeActions.ACTION_SELECT_NEXT_OCCURENCE);
}
+ private void executeFindNext() {
+ myFixture.performEditorAction(IdeActions.ACTION_FIND_NEXT);
+ }
+
+ private void executeFindPrevious() {
+ myFixture.performEditorAction(IdeActions.ACTION_FIND_PREVIOUS);
+ }
+
private void executeReverseAction() {
myFixture.performEditorAction(IdeActions.ACTION_UNSELECT_PREVIOUS_OCCURENCE);
}
diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/softwrap/mapping/CachingSoftWrapDataMapperTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/softwrap/mapping/CachingSoftWrapDataMapperTest.java
index 6589fb35368b..7448c6c867f6 100644
--- a/platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/softwrap/mapping/CachingSoftWrapDataMapperTest.java
+++ b/platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/softwrap/mapping/CachingSoftWrapDataMapperTest.java
@@ -122,6 +122,8 @@ public class CachingSoftWrapDataMapperTest {
final Project project = myMockery.mock(Project.class);
final SoftWrapPainter painter = myMockery.mock(SoftWrapPainter.class);
+ myRepresentationHelper = new MockEditorTextRepresentationHelper(SPACE_SIZE, TAB_SIZE);
+
myMockery.checking(new Expectations() {{
// Document
allowing(myEditor).getDocument();will(returnValue(myDocument));
@@ -165,6 +167,7 @@ public class CachingSoftWrapDataMapperTest {
return getSoftWrap((Integer)invocation.getParameter(0));
}
});
+ allowing(mySoftWrapModel).getEditorTextRepresentationHelper(); will(returnValue(myRepresentationHelper));
// Folding.
allowing(myEditor).getFoldingModel();will(returnValue(myFoldingModel));
@@ -220,9 +223,7 @@ public class CachingSoftWrapDataMapperTest {
allowing(painter).getMinDrawingWidth(SoftWrapDrawingType.AFTER_SOFT_WRAP); will(returnValue(SOFT_WRAP_DRAWING_WIDTH));
}});
- myRepresentationHelper = new MockEditorTextRepresentationHelper(SPACE_SIZE, TAB_SIZE);
-
- myMapper = new CachingSoftWrapDataMapper(myEditor, myStorage, myRepresentationHelper);
+ myMapper = new CachingSoftWrapDataMapper(myEditor, myStorage);
}
@After
@@ -699,7 +700,7 @@ public class CachingSoftWrapDataMapperTest {
int foldingStartVisualColumn;
TestEditorPosition() {
- super(myEditor, myRepresentationHelper);
+ super(myEditor);
lineStartPosition = clone();
}
diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/fileEditor/FileEditorManagerTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/fileEditor/FileEditorManagerTest.java
index db9cebf954f6..9695bf8529fb 100644
--- a/platform/platform-tests/testSrc/com/intellij/openapi/fileEditor/FileEditorManagerTest.java
+++ b/platform/platform-tests/testSrc/com/intellij/openapi/fileEditor/FileEditorManagerTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -17,6 +17,7 @@ package com.intellij.openapi.fileEditor;
import com.intellij.ide.ui.UISettings;
import com.intellij.mock.Mock;
+import com.intellij.openapi.fileEditor.impl.EditorWindow;
import com.intellij.openapi.fileEditor.impl.EditorWithProviderComposite;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
@@ -101,6 +102,20 @@ public class FileEditorManagerTest extends FileEditorManagerTestCase {
assertEquals("mockEditor", myManager.getSelectedEditor(file).getName());
}
+ public void testWindowClosingRetainsOtherWindows() throws Exception {
+ VirtualFile file = getFile("/src/1.txt");
+ assertNotNull(file);
+ myManager.openFile(file, false);
+ EditorWindow primaryWindow = myManager.getCurrentWindow();
+ assertNotNull(primaryWindow);
+ myManager.createSplitter(SwingConstants.VERTICAL, primaryWindow);
+ EditorWindow secondaryWindow = myManager.getNextWindow(primaryWindow);
+ assertNotNull(secondaryWindow);
+ myManager.createSplitter(SwingConstants.VERTICAL, secondaryWindow);
+ myManager.closeFile(file, primaryWindow);
+ assertEquals(2, myManager.getWindows().length);
+ }
+
private static final String STRING = "<component name=\"FileEditorManager\">\n" +
" <leaf>\n" +
" <file leaf-file-name=\"1.txt\" pinned=\"false\" current=\"false\" current-in-tab=\"false\">\n" +
diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/keymap/impl/ModifierKeyDoubleClickHandlerTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/keymap/impl/ModifierKeyDoubleClickHandlerTest.java
new file mode 100644
index 000000000000..490aa294974d
--- /dev/null
+++ b/platform/platform-tests/testSrc/com/intellij/openapi/keymap/impl/ModifierKeyDoubleClickHandlerTest.java
@@ -0,0 +1,169 @@
+/*
+ * Copyright 2000-2014 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.openapi.keymap.impl;
+
+import com.intellij.ide.IdeEventQueue;
+import com.intellij.openapi.actionSystem.ActionManager;
+import com.intellij.openapi.actionSystem.AnAction;
+import com.intellij.openapi.actionSystem.AnActionEvent;
+import com.intellij.openapi.actionSystem.KeyboardShortcut;
+import com.intellij.openapi.keymap.KeymapManager;
+import com.intellij.openapi.util.Clock;
+import com.intellij.testFramework.LightPlatformTestCase;
+
+import javax.swing.*;
+import java.awt.event.InputEvent;
+import java.awt.event.KeyEvent;
+
+public class ModifierKeyDoubleClickHandlerTest extends LightPlatformTestCase {
+ private static final String MY_SHIFT_SHIFT_ACTION = "ModifierKeyDoubleClickHandlerTest.action1";
+ private static final String MY_SHIFT_KEY_ACTION = "ModifierKeyDoubleClickHandlerTest.action2";
+ private static final String MY_SHIFT_SHIFT_KEY_ACTION = "ModifierKeyDoubleClickHandlerTest.action3";
+
+ public static final KeyboardShortcut SHIFT_KEY_SHORTCUT = new KeyboardShortcut(KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE,
+ InputEvent.SHIFT_MASK),
+ null);
+
+ private final JComponent myComponent = new JPanel();
+
+ private long myCurrentTime;
+ private int myShiftShiftActionInvocationCount;
+ private int myShiftKeyActionInvocationCount;
+ private int myShiftShiftKeyActionInvocationCount;
+
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+ Clock.setTime(0);
+ ActionManager.getInstance().registerAction(MY_SHIFT_SHIFT_ACTION, new AnAction() {
+ @Override
+ public void actionPerformed(AnActionEvent e) {
+ myShiftShiftActionInvocationCount++;
+ }
+ });
+ ActionManager.getInstance().registerAction(MY_SHIFT_KEY_ACTION, new AnAction() {
+ @Override
+ public void actionPerformed(AnActionEvent e) {
+ myShiftKeyActionInvocationCount++;
+ }
+ });
+ ActionManager.getInstance().registerAction(MY_SHIFT_SHIFT_KEY_ACTION, new AnAction() {
+ @Override
+ public void actionPerformed(AnActionEvent e) {
+ myShiftShiftKeyActionInvocationCount++;
+ }
+ });
+ KeymapManager.getInstance().getActiveKeymap().addShortcut(MY_SHIFT_KEY_ACTION, SHIFT_KEY_SHORTCUT);
+ ModifierKeyDoubleClickHandler.getInstance().registerAction(MY_SHIFT_SHIFT_ACTION, KeyEvent.VK_SHIFT, -1);
+ ModifierKeyDoubleClickHandler.getInstance().registerAction(MY_SHIFT_SHIFT_KEY_ACTION, KeyEvent.VK_SHIFT, KeyEvent.VK_BACK_SPACE);
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ ModifierKeyDoubleClickHandler.getInstance().unregisterAction(MY_SHIFT_SHIFT_KEY_ACTION);
+ ModifierKeyDoubleClickHandler.getInstance().unregisterAction(MY_SHIFT_SHIFT_ACTION);
+ KeymapManager.getInstance().getActiveKeymap().removeShortcut(MY_SHIFT_KEY_ACTION, SHIFT_KEY_SHORTCUT);
+ ActionManager.getInstance().unregisterAction(MY_SHIFT_SHIFT_KEY_ACTION);
+ ActionManager.getInstance().unregisterAction(MY_SHIFT_KEY_ACTION);
+ ActionManager.getInstance().unregisterAction(MY_SHIFT_SHIFT_ACTION);
+ Clock.reset();
+ super.tearDown();
+ }
+
+ public void testShiftShiftSuccessfulCase() {
+ press();
+ release();
+ press();
+ assertInvocationCounts(0, 0, 0);
+ release();
+ assertInvocationCounts(0, 1, 0);
+ }
+
+ public void testLongSecondClick() {
+ press();
+ release();
+ press();
+ timeStep(400);
+ release();
+ assertInvocationCounts(0, 0, 0);
+ }
+
+ public void testShiftShiftKeySuccessfulCase() {
+ press();
+ release();
+ press();
+ key();
+ assertInvocationCounts(0, 0, 1);
+ release();
+ assertInvocationCounts(0, 0, 1);
+ }
+
+ public void testShiftKey() {
+ press();
+ key();
+ assertInvocationCounts(1, 0, 0);
+ release();
+ }
+
+ public void assertInvocationCounts(int shiftKeyCount, int shiftShiftCount, int shiftShiftKeyCount) {
+ assertEquals(shiftKeyCount, myShiftKeyActionInvocationCount);
+ assertEquals(shiftShiftCount, myShiftShiftActionInvocationCount);
+ assertEquals(shiftShiftKeyCount, myShiftShiftKeyActionInvocationCount);
+ }
+
+ private void press() {
+ IdeEventQueue.getInstance().dispatchEvent(new KeyEvent(myComponent,
+ KeyEvent.KEY_PRESSED,
+ Clock.getTime(),
+ InputEvent.SHIFT_MASK,
+ KeyEvent.VK_SHIFT,
+ KeyEvent.CHAR_UNDEFINED));
+ }
+
+ private void release() {
+ IdeEventQueue.getInstance().dispatchEvent(new KeyEvent(myComponent,
+ KeyEvent.KEY_RELEASED,
+ Clock.getTime(),
+ 0,
+ KeyEvent.VK_SHIFT,
+ KeyEvent.CHAR_UNDEFINED));
+ }
+
+ private void key() {
+ IdeEventQueue.getInstance().dispatchEvent(new KeyEvent(myComponent,
+ KeyEvent.KEY_PRESSED,
+ Clock.getTime(),
+ InputEvent.SHIFT_MASK,
+ KeyEvent.VK_BACK_SPACE,
+ '\b'));
+ IdeEventQueue.getInstance().dispatchEvent(new KeyEvent(myComponent,
+ KeyEvent.KEY_TYPED,
+ Clock.getTime(),
+ InputEvent.SHIFT_MASK,
+ 0,
+ '\b'));
+ IdeEventQueue.getInstance().dispatchEvent(new KeyEvent(myComponent,
+ KeyEvent.KEY_RELEASED,
+ Clock.getTime(),
+ InputEvent.SHIFT_MASK,
+ KeyEvent.VK_BACK_SPACE,
+ '\b'));
+ }
+
+ private void timeStep(long step) {
+ Clock.setTime(myCurrentTime += step);
+ }
+}
diff --git a/platform/platform-tests/testSrc/com/intellij/patterns/StandardPatternsTest.java b/platform/platform-tests/testSrc/com/intellij/patterns/StandardPatternsTest.java
index 1e05add24302..1db3f319b250 100644
--- a/platform/platform-tests/testSrc/com/intellij/patterns/StandardPatternsTest.java
+++ b/platform/platform-tests/testSrc/com/intellij/patterns/StandardPatternsTest.java
@@ -1,11 +1,23 @@
/*
- * Copyright (c) 2000-2007 JetBrains s.r.o. All Rights Reserved.
+ * Copyright 2000-2014 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.patterns;
import com.intellij.openapi.util.Key;
-import com.intellij.testFramework.UsefulTestCase;
import com.intellij.util.ProcessingContext;
+import junit.framework.TestCase;
import java.util.Arrays;
@@ -14,37 +26,15 @@ import static com.intellij.patterns.StandardPatterns.*;
/**
* @author peter
*/
-public class StandardPatternsTest extends UsefulTestCase {
+public class StandardPatternsTest extends TestCase {
- public void testNull() throws Throwable {
+ public void testNull() {
assertTrue(object().isNull().accepts(null));
assertFalse(object().isNull().accepts(""));
assertFalse(string().isNull().accepts(""));
assertTrue(string().isNull().accepts(null));
}
- public void testString() throws Throwable {
- final ElementPattern pattern = string();
- assertFalse(string().accepts(new Object()));
- assertTrue(pattern.accepts(""));
- }
-
- public void testStartsWith() throws Throwable {
- final ElementPattern pattern = string().startsWith("abc");
- assertFalse(pattern.accepts(""));
- assertTrue(pattern.accepts("abcd"));
- assertTrue(pattern.accepts("abc"));
-
- assertFalse(string().startsWith("abc").accepts(new Object()));
- }
-
- public void testEndsWith() throws Throwable {
- final ElementPattern pattern = string().endsWith("abc");
- assertFalse(pattern.accepts(""));
- assertFalse(pattern.accepts("abcd"));
- assertTrue(pattern.accepts("abc"));
- }
-
private static void checkPrefixSuffix(final ElementPattern pattern) {
assertFalse(pattern.accepts(""));
assertFalse(pattern.accepts("abcd"));
@@ -53,23 +43,23 @@ public class StandardPatternsTest extends UsefulTestCase {
assertFalse(pattern.accepts("abcdab"));
}
- public void testPrefixSuffix() throws Throwable {
+ public void testPrefixSuffix() {
checkPrefixSuffix(string().endsWith("abc").startsWith("abc"));
}
- public void testAnd1() throws Throwable {
+ public void testAnd1() {
checkPrefixSuffix(and(string().endsWith("abc"), string().startsWith("abc")));
}
- public void testAnd2() throws Throwable {
+ public void testAnd2() {
checkPrefixSuffix(string().endsWith("abc").and(string().startsWith("abc")));
}
- public void testOr1() throws Throwable {
+ public void testOr1() {
checkOr(or(string().endsWith("abc"), string().startsWith("abc")));
}
- public void testNot1() throws Throwable {
+ public void testNot1() {
final ElementPattern pattern = not(or(string().endsWith("abc"), string().startsWith("abc")));
assertTrue(pattern.accepts(""));
assertTrue(pattern.accepts("xxx"));
@@ -90,7 +80,7 @@ public class StandardPatternsTest extends UsefulTestCase {
assertTrue(filterFactory.accepts("abcdab"));
}
- public void testEquals() throws Throwable {
+ public void testEquals() {
final Object foo = new Object();
final Object bar = new Object();
ElementPattern objectPattern = object().equalTo(foo);
@@ -103,15 +93,14 @@ public class StandardPatternsTest extends UsefulTestCase {
}
-
- public void testAll() throws Throwable {
+ public void testAll() {
ElementPattern pattern = collection(String.class).all(string().startsWith("abc"));
assertTrue(pattern.accepts(Arrays.asList("abc")));
assertTrue(pattern.accepts(Arrays.asList("abc", "abcd")));
assertFalse(pattern.accepts(Arrays.asList("abc", "bcd")));
}
- public void testAtLeastOne() throws Throwable {
+ public void testAtLeastOne() {
ElementPattern pattern = collection(String.class).atLeastOne(string().startsWith("abc"));
assertTrue(pattern.accepts(Arrays.asList("abc")));
assertTrue(pattern.accepts(Arrays.asList("abc", "abcd")));
@@ -120,15 +109,16 @@ public class StandardPatternsTest extends UsefulTestCase {
assertTrue(pattern.accepts(Arrays.asList("bc", "abc")));
}
- public void testFilter() throws Throwable {
- ElementPattern pattern = collection(String.class).filter(string().endsWith("x"), collection(String.class).all(string().startsWith("abc")));
+ public void testFilter() {
+ ElementPattern pattern =
+ collection(String.class).filter(string().endsWith("x"), collection(String.class).all(string().startsWith("abc")));
assertTrue(pattern.accepts(Arrays.asList("abc")));
assertTrue(pattern.accepts(Arrays.asList("abc", "abcd")));
assertFalse(pattern.accepts(Arrays.asList("bcx", "bcd")));
assertTrue(pattern.accepts(Arrays.asList("abcx", "abc")));
}
- public void testFirst() throws Throwable {
+ public void testFirst() {
ElementPattern pattern = collection(String.class).first(string().startsWith("abc"));
assertFalse(pattern.accepts(Arrays.<String>asList()));
assertTrue(pattern.accepts(Arrays.asList("abc")));
@@ -138,7 +128,7 @@ public class StandardPatternsTest extends UsefulTestCase {
assertFalse(pattern.accepts(Arrays.asList("bc", "abc")));
}
- public void testLast() throws Throwable {
+ public void testLast() {
//collection(String.class)
ElementPattern pattern = collection(String.class).last(string().startsWith("abc"));
@@ -150,7 +140,7 @@ public class StandardPatternsTest extends UsefulTestCase {
assertTrue(pattern.accepts(Arrays.asList("bc", "abc")));
}
- public void testSize() throws Throwable {
+ public void testSize() {
final CollectionPattern<String> filter = collection(String.class);
assertTrue(filter.size(0).accepts(Arrays.<String>asList()));
assertFalse(filter.size(0).accepts(Arrays.asList("abc")));
@@ -165,7 +155,7 @@ public class StandardPatternsTest extends UsefulTestCase {
assertTrue(filter.size(2).accepts(Arrays.asList("abc", "abc")));
}
- public void testEmpty() throws Throwable {
+ public void testEmpty() {
final CollectionPattern<String> filter = collection(String.class);
assertTrue(filter.empty().accepts(Arrays.<String>asList()));
assertFalse(filter.empty().accepts(Arrays.asList("abc")));
@@ -176,7 +166,7 @@ public class StandardPatternsTest extends UsefulTestCase {
assertTrue(not(filter.empty()).accepts(Arrays.asList("abc", "abc")));
}
- public void testSave() throws Throwable {
+ public void testSave() {
Key<String> key = Key.create("abc");
final ProcessingContext context = new ProcessingContext();
assertFalse(string().contains("abc").save(key).accepts(null));
@@ -189,6 +179,4 @@ public class StandardPatternsTest extends UsefulTestCase {
assertTrue(string().contains("abc").save(key).accepts(s, context));
assertSame(s, context.get(key));
}
-
-
}
diff --git a/platform/platform-tests/testSrc/com/intellij/patterns/StringPatternTest.java b/platform/platform-tests/testSrc/com/intellij/patterns/StringPatternTest.java
new file mode 100644
index 000000000000..11a6eac867df
--- /dev/null
+++ b/platform/platform-tests/testSrc/com/intellij/patterns/StringPatternTest.java
@@ -0,0 +1,92 @@
+/*
+ * Copyright 2000-2014 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.patterns;
+
+import junit.framework.TestCase;
+
+import static com.intellij.patterns.StandardPatterns.string;
+
+public class StringPatternTest extends TestCase {
+
+ public void testString() {
+ final ElementPattern pattern = string();
+ assertFalse(string().accepts(new Object()));
+ assertTrue(pattern.accepts(""));
+ }
+
+ public void testStartsWith() {
+ final ElementPattern pattern = string().startsWith("abc");
+ assertFalse(pattern.accepts(""));
+ assertTrue(pattern.accepts("abcd"));
+ assertTrue(pattern.accepts("abc"));
+
+ assertFalse(string().startsWith("abc").accepts(new Object()));
+ }
+
+ public void testEndsWith() {
+ final ElementPattern pattern = string().endsWith("abc");
+ assertFalse(pattern.accepts(""));
+ assertFalse(pattern.accepts("abcd"));
+ assertTrue(pattern.accepts("abc"));
+ }
+
+ public void testLongerThan() {
+ final ElementPattern pattern = string().longerThan(2);
+ assertFalse(pattern.accepts(""));
+ assertFalse(pattern.accepts("01"));
+ assertTrue(pattern.accepts("012"));
+ }
+
+ public void testShorterThan() {
+ final ElementPattern pattern = string().shorterThan(2);
+ assertTrue(pattern.accepts(""));
+ assertTrue(pattern.accepts("1"));
+ assertFalse(pattern.accepts("12"));
+ }
+
+ public void testWithLength() {
+ final ElementPattern pattern = string().withLength(2);
+ assertFalse(pattern.accepts(""));
+ assertFalse(pattern.accepts("1"));
+ assertTrue(pattern.accepts("12"));
+ }
+
+ public void testContains() {
+ final ElementPattern pattern = string().contains("abc");
+ assertFalse(pattern.accepts(""));
+ assertFalse(pattern.accepts("acb"));
+ assertFalse(pattern.accepts("ABC"));
+ assertTrue(pattern.accepts("01abcd"));
+ }
+
+ public void testContainsChars() {
+ final ElementPattern pattern = string().containsChars("abc");
+ assertFalse(pattern.accepts(""));
+ assertFalse(pattern.accepts("ABC"));
+ assertTrue(pattern.accepts("01a"));
+ assertTrue(pattern.accepts("01c"));
+ assertTrue(pattern.accepts("01b"));
+ }
+
+ public void testOneOfIgnoreCase() {
+ final ElementPattern pattern = string().oneOfIgnoreCase("a", "B");
+ assertFalse(pattern.accepts(""));
+ assertFalse(pattern.accepts("ab"));
+ assertFalse(pattern.accepts("d01x"));
+ assertTrue(pattern.accepts("A"));
+ assertTrue(pattern.accepts("b"));
+ }
+}
diff --git a/platform/platform-tests/testSrc/com/intellij/psi/PsiDocumentManagerImplTest.java b/platform/platform-tests/testSrc/com/intellij/psi/PsiDocumentManagerImplTest.java
index 718ee8ebe5f7..2ab0446e86a4 100644
--- a/platform/platform-tests/testSrc/com/intellij/psi/PsiDocumentManagerImplTest.java
+++ b/platform/platform-tests/testSrc/com/intellij/psi/PsiDocumentManagerImplTest.java
@@ -75,7 +75,7 @@ public class PsiDocumentManagerImplTest extends PlatformLangTestCase {
}
public void testDocumentGced() throws Exception {
- VirtualFile vFile = createFile();
+ VirtualFile vFile = getVirtualFile(createTempFile("txt", "abc"));
PsiDocumentManagerImpl documentManager = getPsiDocumentManager();
long id = System.identityHashCode(documentManager.getDocument(getPsiManager().findFile(vFile)));
@@ -93,7 +93,7 @@ public class PsiDocumentManagerImplTest extends PlatformLangTestCase {
});
//Class.forName("com.intellij.util.ProfilingUtil").getDeclaredMethod("forceCaptureMemorySnapshot").invoke(null);
- for (int i=0;i<1000;i++) {
+ for (int i = 0; i < 1000; i++) {
PlatformTestUtil.tryGcSoftlyReachableObjects();
UIUtil.dispatchAllInvocationEvents();
if (documentManager.getCachedDocument(getPsiManager().findFile(vFile)) == null) break;
diff --git a/platform/platform-tests/testSrc/com/intellij/usages/impl/UsageViewTest.java b/platform/platform-tests/testSrc/com/intellij/usages/impl/UsageViewTest.java
index 085afbf5c126..3fcc42baa645 100644
--- a/platform/platform-tests/testSrc/com/intellij/usages/impl/UsageViewTest.java
+++ b/platform/platform-tests/testSrc/com/intellij/usages/impl/UsageViewTest.java
@@ -26,7 +26,7 @@ import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.psi.impl.source.PsiFileImpl;
import com.intellij.testFramework.LeakHunter;
-import com.intellij.testFramework.LightPlatformCodeInsightTestCase;
+import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase;
import com.intellij.usageView.UsageInfo;
import com.intellij.usages.*;
import com.intellij.util.ui.UIUtil;
@@ -34,9 +34,9 @@ import com.intellij.util.ui.UIUtil;
/**
* User: cdr
*/
-public class UsageViewTest extends LightPlatformCodeInsightTestCase{
+public class UsageViewTest extends LightPlatformCodeInsightFixtureTestCase {
public void testUsageViewDoesNotHoldPsiFilesOrDocuments() throws Exception {
- PsiFile psiFile = createFile("X.java", "public class X{} //iuggjhfg");
+ PsiFile psiFile = myFixture.addFileToProject("X.java", "public class X{} //iuggjhfg");
Usage[] usages = new Usage[100];
for (int i = 0; i < usages.length; i++) {
usages[i] = createUsage(psiFile,i);
@@ -55,7 +55,7 @@ public class UsageViewTest extends LightPlatformCodeInsightTestCase{
}
public void testUsageViewHandlesDocumentChange() throws Exception {
- PsiFile psiFile = createFile("X.java", "public class X{ int xxx; } //comment");
+ PsiFile psiFile = myFixture.addFileToProject("X.java", "public class X{ int xxx; } //comment");
Usage usage = createUsage(psiFile, psiFile.getText().indexOf("xxx"));
UsageView usageView = UsageViewManager.getInstance(getProject()).createUsageView(UsageTarget.EMPTY_ARRAY, new Usage[]{usage}, new UsageViewPresentation(), null);
@@ -69,7 +69,7 @@ public class UsageViewTest extends LightPlatformCodeInsightTestCase{
assertEquals(psiFile.getText().indexOf("xxx"), navigationOffset);
}
public void testTextUsageInfoHandlesDocumentChange() throws Exception {
- PsiFile psiFile = createFile("X.java", "public class X{ int xxx; } //comment");
+ PsiFile psiFile = myFixture.addFileToProject("X.java", "public class X{ int xxx; } //comment");
Usage usage = new UsageInfo2UsageAdapter(new UsageInfo(psiFile, psiFile.getText().indexOf("xxx"), StringUtil.indexOfSubstringEnd(psiFile.getText(),"xxx")));
UsageView usageView = UsageViewManager.getInstance(getProject()).createUsageView(UsageTarget.EMPTY_ARRAY, new Usage[]{usage}, new UsageViewPresentation(), null);
diff --git a/platform/projectModel-api/src/com/intellij/openapi/roots/ProjectFileIndex.java b/platform/projectModel-api/src/com/intellij/openapi/roots/ProjectFileIndex.java
index 8ada83981017..b06cf065fd95 100644
--- a/platform/projectModel-api/src/com/intellij/openapi/roots/ProjectFileIndex.java
+++ b/platform/projectModel-api/src/com/intellij/openapi/roots/ProjectFileIndex.java
@@ -129,11 +129,18 @@ public interface ProjectFileIndex extends FileIndex {
boolean isInLibrarySource(@NotNull VirtualFile fileOrDir);
/**
- * Checks if the specified file or directory is ignored (either excluded by exclude roots
- * or ignored by {@link com.intellij.openapi.fileTypes.FileTypeManager#isFileIgnored(String)}).
+ * @deprecated name of this method may be confusing. If you want to check if the file is excluded or ignored use {@link #isExcluded(com.intellij.openapi.vfs.VirtualFile)}.
+ * If you want to check if the file is ignored use {@link com.intellij.openapi.fileTypes.FileTypeRegistry#isFileIgnored(com.intellij.openapi.vfs.VirtualFile)}.
+ */
+ @Deprecated
+ boolean isIgnored(@NotNull VirtualFile file);
+
+ /**
+ * Checks if the specified file or directory is located under project roots but the file itself or one of its parent directories is
+ * either excluded from the project or ignored by {@link com.intellij.openapi.fileTypes.FileTypeRegistry#isFileIgnored(com.intellij.openapi.vfs.VirtualFile)}).
*
* @param file the file to check.
- * @return true if <code>file</code> is ignored, false otherwise.
+ * @return true if <code>file</code> is excluded or ignored, false otherwise.
*/
- boolean isIgnored(@NotNull VirtualFile file);
+ boolean isExcluded(@NotNull VirtualFile file);
}
diff --git a/platform/projectModel-impl/src/com/intellij/ide/projectView/impl/ProjectRootsUtil.java b/platform/projectModel-impl/src/com/intellij/ide/projectView/impl/ProjectRootsUtil.java
index c0c4c4956211..7acb0fb12243 100644
--- a/platform/projectModel-impl/src/com/intellij/ide/projectView/impl/ProjectRootsUtil.java
+++ b/platform/projectModel-impl/src/com/intellij/ide/projectView/impl/ProjectRootsUtil.java
@@ -109,4 +109,16 @@ public class ProjectRootsUtil {
}
return null;
}
+
+ @Nullable
+ public static ExcludeFolder findExcludeFolder(@NotNull Module module, @NotNull VirtualFile root) {
+ for (ContentEntry entry : ModuleRootManager.getInstance(module).getContentEntries()) {
+ for (ExcludeFolder folder : entry.getExcludeFolders()) {
+ if (root.equals(folder.getFile())) {
+ return folder;
+ }
+ }
+ }
+ return null;
+ }
} \ No newline at end of file
diff --git a/platform/lang-impl/src/com/intellij/lang/LanguagePerFileMappings.java b/platform/projectModel-impl/src/com/intellij/lang/LanguagePerFileMappings.java
index c1a186b614c7..c1a186b614c7 100644
--- a/platform/lang-impl/src/com/intellij/lang/LanguagePerFileMappings.java
+++ b/platform/projectModel-impl/src/com/intellij/lang/LanguagePerFileMappings.java
diff --git a/platform/projectModel-impl/src/com/intellij/openapi/roots/ModuleRootModificationUtil.java b/platform/projectModel-impl/src/com/intellij/openapi/roots/ModuleRootModificationUtil.java
index 3bf16fcca67c..0b4f135837c9 100644
--- a/platform/projectModel-impl/src/com/intellij/openapi/roots/ModuleRootModificationUtil.java
+++ b/platform/projectModel-impl/src/com/intellij/openapi/roots/ModuleRootModificationUtil.java
@@ -22,10 +22,12 @@ import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.roots.impl.libraries.LibraryEx;
import com.intellij.openapi.roots.libraries.Library;
import com.intellij.openapi.util.Computable;
+import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.Consumer;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import java.util.Collection;
import java.util.Collections;
import java.util.List;
@@ -167,6 +169,28 @@ public class ModuleRootModificationUtil {
}
}
+ public static void updateExcludedFolders(final Module module,
+ @NotNull final VirtualFile contentRoot,
+ final Collection<String> urlsToUnExclude,
+ final Collection<String> urlsToExclude) {
+ updateModel(module, new Consumer<ModifiableRootModel>() {
+ @Override
+ public void consume(ModifiableRootModel modifiableModel) {
+ for (final ContentEntry contentEntry : modifiableModel.getContentEntries()) {
+ if (contentRoot.equals(contentEntry.getFile())) {
+ for (String url : urlsToUnExclude) {
+ contentEntry.removeExcludeFolder(url);
+ }
+ for (String url : urlsToExclude) {
+ contentEntry.addExcludeFolder(url);
+ }
+ break;
+ }
+ }
+ }
+ });
+ }
+
private static void doWriteAction(final Runnable action) {
final Application application = ApplicationManager.getApplication();
application.invokeAndWait(new Runnable() {
diff --git a/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/DirectoryIndex.java b/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/DirectoryIndex.java
index 635a6f1afc1f..9fdd8e09a57d 100644
--- a/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/DirectoryIndex.java
+++ b/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/DirectoryIndex.java
@@ -34,14 +34,20 @@ public abstract class DirectoryIndex {
@TestOnly
public abstract void checkConsistency();
+ /**
+ * The same as {@link #getInfoForFile} but works only for directories or file roots and returns {@code null} for directories
+ * which aren't included in project content or libraries
+ * @deprecated use {@link #getInfoForFile(com.intellij.openapi.vfs.VirtualFile)} instead
+ */
+ @Deprecated
public abstract DirectoryInfo getInfoForDirectory(@NotNull VirtualFile dir);
+ @NotNull
+ public abstract DirectoryInfo getInfoForFile(@NotNull VirtualFile file);
+
@Nullable
public abstract JpsModuleSourceRootType<?> getSourceRootType(@NotNull DirectoryInfo info);
- public abstract boolean isProjectExcludeRoot(@NotNull VirtualFile dir);
- public abstract boolean isModuleExcludeRoot(@NotNull VirtualFile dir);
-
@NotNull
public abstract
Query<VirtualFile> getDirectoriesByPackageName(@NotNull String packageName, boolean includeLibrarySources);
diff --git a/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/DirectoryInfo.java b/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/DirectoryInfo.java
index dfff4973a5a6..87448a584a23 100644
--- a/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/DirectoryInfo.java
+++ b/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/DirectoryInfo.java
@@ -18,229 +18,59 @@ package com.intellij.openapi.roots.impl;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.roots.OrderEntry;
-import com.intellij.openapi.roots.OrderRootType;
-import com.intellij.openapi.roots.RootPolicy;
-import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.util.BitUtil;
-import com.intellij.util.IncorrectOperationException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.TestOnly;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Comparator;
import java.util.List;
public abstract class DirectoryInfo {
- public static final int MAX_ROOT_TYPE_ID = (1 << (Byte.SIZE - 2)) - 1;
- private final Module module; // module to which content it belongs or null
- private final VirtualFile libraryClassRoot; // class root in library
- private final VirtualFile contentRoot;
- private final VirtualFile sourceRoot;
-
- private static final byte MODULE_SOURCE_FLAG = 1; // set if files in this directory belongs to sources of the module (if field 'module' is not null)
- private static final byte LIBRARY_SOURCE_FLAG = 2; // set if it's a directory with sources of some library
- private final byte sourceRootTypeData;//two least significant bits are used for MODULE_SOURCE_FLAG and LIBRARY_SOURCE_FLAG, the remaining bits store module root type id (source/tests/resources/...)
-
- DirectoryInfo(Module module,
- VirtualFile contentRoot,
- VirtualFile sourceRoot,
- VirtualFile libraryClassRoot,
- byte sourceRootTypeData) {
- this.module = module;
- this.libraryClassRoot = libraryClassRoot;
- this.contentRoot = contentRoot;
- this.sourceRoot = sourceRoot;
- this.sourceRootTypeData = sourceRootTypeData;
- }
+ /**
+ * @return {@code true} if located under project content or library roots and not excluded or ignored
+ */
+ public abstract boolean isInProject();
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
+ /**
+ * @return {@code true} if located under ignored directory
+ */
+ public abstract boolean isIgnored();
- DirectoryInfo info = (DirectoryInfo)o;
+ /**
+ * @return {@code true} if located project content, output or library root but excluded from the project
+ */
+ public abstract boolean isExcluded();
- return sourceRootTypeData == info.sourceRootTypeData &&
- Comparing.equal(contentRoot, info.contentRoot) &&
- Comparing.equal(libraryClassRoot, info.libraryClassRoot) &&
- Comparing.equal(module, info.module) &&
- Arrays.equals(getOrderEntries(), info.getOrderEntries()) &&
- Comparing.equal(sourceRoot, info.sourceRoot);
- }
+ public abstract boolean isInModuleSource();
- @Override
- public int hashCode() {
- int result = module != null ? module.hashCode() : 0;
- result = 31 * result + (libraryClassRoot != null ? libraryClassRoot.hashCode() : 0);
- result = 31 * result + (contentRoot != null ? contentRoot.hashCode() : 0);
- result = 31 * result + (sourceRoot != null ? sourceRoot.hashCode() : 0);
- result = 31 * result + (int)sourceRootTypeData;
- return result;
- }
-
- @SuppressWarnings({"HardCodedStringLiteral"})
- public String toString() {
- return "DirectoryInfo{" +
- "module=" + getModule() +
- ", isInModuleSource=" + isInModuleSource() +
- ", rootTypeId=" + getSourceRootTypeId() +
- ", isInLibrarySource=" + isInLibrarySource() +
- ", libraryClassRoot=" + getLibraryClassRoot() +
- ", contentRoot=" + getContentRoot() +
- ", sourceRoot=" + getSourceRoot() +
- ", orderEntries=" + Arrays.toString(getOrderEntries()) +
- "}";
- }
-
- @NotNull
- public abstract OrderEntry[] getOrderEntries();
+ public abstract boolean isInLibrarySource();
@Nullable
- OrderEntry findOrderEntryWithOwnerModule(@NotNull Module ownerModule) {
- OrderEntry[] entries = getOrderEntries();
- if (entries.length < 10) {
- for (OrderEntry entry : entries) {
- if (entry.getOwnerModule() == ownerModule) return entry;
- }
- return null;
- }
- int index = Arrays.binarySearch(entries, createFakeOrderEntry(ownerModule), BY_OWNER_MODULE);
- return index < 0 ? null : entries[index];
- }
+ public abstract VirtualFile getSourceRoot();
- @NotNull
- List<OrderEntry> findAllOrderEntriesWithOwnerModule(@NotNull Module ownerModule) {
- OrderEntry[] entries = getOrderEntries();
- if (entries.length == 1) {
- OrderEntry entry = entries[0];
- return entry.getOwnerModule() == ownerModule ? Arrays.asList(entries) : Collections.<OrderEntry>emptyList();
- }
- int index = Arrays.binarySearch(entries, createFakeOrderEntry(ownerModule), BY_OWNER_MODULE);
- if (index < 0) {
- return Collections.emptyList();
- }
- int firstIndex = index;
- while (firstIndex-1 >= 0 && entries[firstIndex-1].getOwnerModule() == ownerModule) {
- firstIndex--;
- }
- int lastIndex = index+1;
- while (lastIndex < entries.length && entries[lastIndex].getOwnerModule() == ownerModule) {
- lastIndex++;
- }
-
- OrderEntry[] subArray = new OrderEntry[lastIndex - firstIndex];
- System.arraycopy(entries, firstIndex, subArray, 0, lastIndex - firstIndex);
-
- return Arrays.asList(subArray);
- }
+ public abstract int getSourceRootTypeId();
- @NotNull
- private static OrderEntry createFakeOrderEntry(@NotNull final Module ownerModule) {
- return new OrderEntry() {
- @NotNull
- @Override
- public VirtualFile[] getFiles(OrderRootType type) {
- throw new IncorrectOperationException();
- }
-
- @NotNull
- @Override
- public String[] getUrls(OrderRootType rootType) {
- throw new IncorrectOperationException();
- }
-
- @NotNull
- @Override
- public String getPresentableName() {
- throw new IncorrectOperationException();
- }
-
- @Override
- public boolean isValid() {
- throw new IncorrectOperationException();
- }
-
- @NotNull
- @Override
- public Module getOwnerModule() {
- return ownerModule;
- }
-
- @Override
- public <R> R accept(RootPolicy<R> policy, @Nullable R initialValue) {
- throw new IncorrectOperationException();
- }
-
- @Override
- public int compareTo(@NotNull OrderEntry o) {
- throw new IncorrectOperationException();
- }
-
- @Override
- public boolean isSynthetic() {
- throw new IncorrectOperationException();
- }
- };
+ public boolean hasLibraryClassRoot() {
+ return getLibraryClassRoot() != null;
}
- public static final Comparator<OrderEntry> BY_OWNER_MODULE = new Comparator<OrderEntry>() {
- @Override
- public int compare(OrderEntry o1, OrderEntry o2) {
- String name1 = o1.getOwnerModule().getName();
- String name2 = o2.getOwnerModule().getName();
- return name1.compareTo(name2);
- }
- };
+ public abstract VirtualFile getLibraryClassRoot();
@Nullable
- public VirtualFile getSourceRoot() {
- return sourceRoot;
- }
-
- public VirtualFile getLibraryClassRoot() {
- return libraryClassRoot;
- }
-
- public boolean hasLibraryClassRoot() {
- return getLibraryClassRoot() != null;
- }
+ public abstract VirtualFile getContentRoot();
@Nullable
- public VirtualFile getContentRoot() {
- return contentRoot;
- }
+ public abstract Module getModule();
- public boolean isInModuleSource() {
- return BitUtil.isSet(sourceRootTypeData, MODULE_SOURCE_FLAG);
- }
+ @NotNull
+ public abstract OrderEntry[] getOrderEntries();
- public boolean isInLibrarySource() {
- return BitUtil.isSet(sourceRootTypeData, LIBRARY_SOURCE_FLAG);
- }
+ @Nullable
+ abstract OrderEntry findOrderEntryWithOwnerModule(@NotNull Module ownerModule);
- public Module getModule() {
- return module;
- }
+ @NotNull
+ abstract List<OrderEntry> findAllOrderEntriesWithOwnerModule(@NotNull Module ownerModule);
@TestOnly
- void assertConsistency() {
- OrderEntry[] entries = getOrderEntries();
- for (int i=1; i<entries.length; i++) {
- assert BY_OWNER_MODULE.compare(entries[i-1], entries[i]) <= 0;
- }
- }
-
- public int getSourceRootTypeId() {
- return sourceRootTypeData >> 2;
- }
-
- public static int createSourceRootTypeData(boolean isInModuleSources, boolean isInLibrarySource, int moduleSourceRootTypeId) {
- if (moduleSourceRootTypeId > MAX_ROOT_TYPE_ID) {
- throw new IllegalArgumentException("Module source root type id " + moduleSourceRootTypeId + " exceeds the maximum allowable value (" + MAX_ROOT_TYPE_ID + ")");
- }
- return (isInModuleSources ? MODULE_SOURCE_FLAG : 0) | (isInLibrarySource ? LIBRARY_SOURCE_FLAG : 0) | moduleSourceRootTypeId << 2;
- }
+ abstract void assertConsistency();
}
diff --git a/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/DirectoryInfoImpl.java b/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/DirectoryInfoImpl.java
new file mode 100644
index 000000000000..0be339bf3c5f
--- /dev/null
+++ b/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/DirectoryInfoImpl.java
@@ -0,0 +1,255 @@
+/*
+ * Copyright 2000-2014 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.openapi.roots.impl;
+
+import com.intellij.openapi.module.Module;
+import com.intellij.openapi.roots.OrderEntry;
+import com.intellij.openapi.roots.OrderRootType;
+import com.intellij.openapi.roots.RootPolicy;
+import com.intellij.openapi.util.Comparing;
+import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.util.IncorrectOperationException;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+import org.jetbrains.annotations.TestOnly;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+/**
+ * @author nik
+ */
+public abstract class DirectoryInfoImpl extends DirectoryInfo {
+ public static final Comparator<OrderEntry> BY_OWNER_MODULE = new Comparator<OrderEntry>() {
+ @Override
+ public int compare(OrderEntry o1, OrderEntry o2) {
+ String name1 = o1.getOwnerModule().getName();
+ String name2 = o2.getOwnerModule().getName();
+ return name1.compareTo(name2);
+ }
+ };
+ public static final int MAX_ROOT_TYPE_ID = Byte.MAX_VALUE;
+ private final Module module; // module to which content it belongs or null
+ private final VirtualFile libraryClassRoot; // class root in library
+ private final VirtualFile contentRoot;
+ private final VirtualFile sourceRoot;
+ private final boolean myInModuleSource;
+ private final boolean myInLibrarySource;
+ private final boolean myExcluded;
+ private final byte mySourceRootTypeId;
+
+ DirectoryInfoImpl(Module module, VirtualFile contentRoot, VirtualFile sourceRoot, VirtualFile libraryClassRoot,
+ boolean inModuleSource, boolean inLibrarySource, boolean isExcluded, int sourceRootTypeId) {
+ this.module = module;
+ this.libraryClassRoot = libraryClassRoot;
+ this.contentRoot = contentRoot;
+ this.sourceRoot = sourceRoot;
+ myInModuleSource = inModuleSource;
+ myInLibrarySource = inLibrarySource;
+ myExcluded = isExcluded;
+ if (sourceRootTypeId > MAX_ROOT_TYPE_ID) {
+ throw new IllegalArgumentException(
+ "Module source root type id " + sourceRootTypeId + " exceeds the maximum allowable value (" + MAX_ROOT_TYPE_ID + ")");
+ }
+ mySourceRootTypeId = (byte)sourceRootTypeId;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ DirectoryInfoImpl info = (DirectoryInfoImpl)o;
+
+ return mySourceRootTypeId == info.mySourceRootTypeId &&
+ myInModuleSource == info.myInModuleSource &&
+ myInLibrarySource == info.myInLibrarySource &&
+ myExcluded == info.myExcluded &&
+ Comparing.equal(contentRoot, info.contentRoot) &&
+ Comparing.equal(libraryClassRoot, info.libraryClassRoot) &&
+ Comparing.equal(module, info.module) &&
+ Arrays.equals(getOrderEntries(), info.getOrderEntries()) &&
+ Comparing.equal(sourceRoot, info.sourceRoot);
+ }
+
+ @Override
+ public int hashCode() {
+ int result = module != null ? module.hashCode() : 0;
+ result = 31 * result + (libraryClassRoot != null ? libraryClassRoot.hashCode() : 0);
+ result = 31 * result + (contentRoot != null ? contentRoot.hashCode() : 0);
+ result = 31 * result + (sourceRoot != null ? sourceRoot.hashCode() : 0);
+ result = 31 * result + (myInModuleSource ? 1 : 0);
+ result = 31 * result + (myInLibrarySource ? 1 : 0);
+ result = 31 * result + (myExcluded ? 1 : 0);
+ result = 31 * result + (int)mySourceRootTypeId;
+ return result;
+ }
+
+ @SuppressWarnings({"HardCodedStringLiteral"})
+ public String toString() {
+ return "DirectoryInfo{" +
+ "module=" + getModule() +
+ ", isInModuleSource=" + isInModuleSource() +
+ ", rootTypeId=" + getSourceRootTypeId() +
+ ", isInLibrarySource=" + isInLibrarySource() +
+ ", isExcludedFromModule=" + isExcluded() +
+ ", libraryClassRoot=" + getLibraryClassRoot() +
+ ", contentRoot=" + getContentRoot() +
+ ", sourceRoot=" + getSourceRoot() +
+ ", orderEntries=" + Arrays.toString(getOrderEntries()) +
+ "}";
+ }
+
+ @NotNull
+ private static OrderEntry createFakeOrderEntry(@NotNull final Module ownerModule) {
+ return new OrderEntry() {
+ @NotNull
+ @Override
+ public VirtualFile[] getFiles(OrderRootType type) {
+ throw new IncorrectOperationException();
+ }
+
+ @NotNull
+ @Override
+ public String[] getUrls(OrderRootType rootType) {
+ throw new IncorrectOperationException();
+ }
+
+ @NotNull
+ @Override
+ public String getPresentableName() {
+ throw new IncorrectOperationException();
+ }
+
+ @Override
+ public boolean isValid() {
+ throw new IncorrectOperationException();
+ }
+
+ @NotNull
+ @Override
+ public Module getOwnerModule() {
+ return ownerModule;
+ }
+
+ @Override
+ public <R> R accept(RootPolicy<R> policy, @Nullable R initialValue) {
+ throw new IncorrectOperationException();
+ }
+
+ @Override
+ public int compareTo(@NotNull OrderEntry o) {
+ throw new IncorrectOperationException();
+ }
+
+ @Override
+ public boolean isSynthetic() {
+ throw new IncorrectOperationException();
+ }
+ };
+ }
+
+ @Nullable
+ OrderEntry findOrderEntryWithOwnerModule(@NotNull Module ownerModule) {
+ OrderEntry[] entries = getOrderEntries();
+ if (entries.length < 10) {
+ for (OrderEntry entry : entries) {
+ if (entry.getOwnerModule() == ownerModule) return entry;
+ }
+ return null;
+ }
+ int index = Arrays.binarySearch(entries, createFakeOrderEntry(ownerModule), BY_OWNER_MODULE);
+ return index < 0 ? null : entries[index];
+ }
+
+ @NotNull
+ List<OrderEntry> findAllOrderEntriesWithOwnerModule(@NotNull Module ownerModule) {
+ OrderEntry[] entries = getOrderEntries();
+ if (entries.length == 1) {
+ OrderEntry entry = entries[0];
+ return entry.getOwnerModule() == ownerModule ? Arrays.asList(entries) : Collections.<OrderEntry>emptyList();
+ }
+ int index = Arrays.binarySearch(entries, createFakeOrderEntry(ownerModule), BY_OWNER_MODULE);
+ if (index < 0) {
+ return Collections.emptyList();
+ }
+ int firstIndex = index;
+ while (firstIndex-1 >= 0 && entries[firstIndex-1].getOwnerModule() == ownerModule) {
+ firstIndex--;
+ }
+ int lastIndex = index+1;
+ while (lastIndex < entries.length && entries[lastIndex].getOwnerModule() == ownerModule) {
+ lastIndex++;
+ }
+
+ OrderEntry[] subArray = new OrderEntry[lastIndex - firstIndex];
+ System.arraycopy(entries, firstIndex, subArray, 0, lastIndex - firstIndex);
+
+ return Arrays.asList(subArray);
+ }
+
+ public boolean isInProject() {
+ return !isExcluded();
+ }
+
+ public boolean isIgnored() {
+ return false;
+ }
+
+ @Nullable
+ public VirtualFile getSourceRoot() {
+ return sourceRoot;
+ }
+
+ public VirtualFile getLibraryClassRoot() {
+ return libraryClassRoot;
+ }
+
+ @Nullable
+ public VirtualFile getContentRoot() {
+ return contentRoot;
+ }
+
+ public boolean isInModuleSource() {
+ return myInModuleSource;
+ }
+
+ public boolean isInLibrarySource() {
+ return myInLibrarySource;
+ }
+
+ public boolean isExcluded() {
+ return myExcluded;
+ }
+
+ public Module getModule() {
+ return module;
+ }
+
+ @TestOnly
+ void assertConsistency() {
+ OrderEntry[] entries = getOrderEntries();
+ for (int i=1; i<entries.length; i++) {
+ assert BY_OWNER_MODULE.compare(entries[i-1], entries[i]) <= 0;
+ }
+ }
+
+ public int getSourceRootTypeId() {
+ return mySourceRootTypeId;
+ }
+}
diff --git a/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/FileIndexBase.java b/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/FileIndexBase.java
index 565bb432bad7..746e227fdf82 100644
--- a/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/FileIndexBase.java
+++ b/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/FileIndexBase.java
@@ -5,7 +5,6 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.FileIndex;
import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
/**
* @author nik
@@ -19,21 +18,9 @@ public abstract class FileIndexBase implements FileIndex {
myFileTypeRegistry = fileTypeManager;
}
- @Nullable
+ @NotNull
protected DirectoryInfo getInfoForFileOrDirectory(@NotNull VirtualFile file) {
- if (!file.isDirectory() && file.getParent() == null) return null; // e.g. LightVirtualFile in test
- DirectoryInfo info = myDirectoryIndex.getInfoForDirectory(file);
- if (info != null) {
- return info;
- }
-
- if (!file.isDirectory() && !myDirectoryIndex.isModuleExcludeRoot(file)) {
- VirtualFile dir = file.getParent();
- if (dir != null) {
- return myDirectoryIndex.getInfoForDirectory(dir);
- }
- }
- return null;
+ return myDirectoryIndex.getInfoForFile(file);
}
@Override
diff --git a/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/FilePropertyPusher.java b/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/FilePropertyPusher.java
index 7a22aefbf833..b8af3172bef9 100644
--- a/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/FilePropertyPusher.java
+++ b/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/FilePropertyPusher.java
@@ -50,7 +50,7 @@ public interface FilePropertyPusher<T> {
boolean acceptsFile(@NotNull VirtualFile file);
boolean acceptsDirectory(@NotNull VirtualFile file, @NotNull Project project);
- void persistAttribute(@NotNull VirtualFile fileOrDir, @NotNull T value) throws IOException;
+ void persistAttribute(@NotNull Project project, @NotNull VirtualFile fileOrDir, @NotNull T value) throws IOException;
interface Engine {
void pushAll();
diff --git a/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/ModuleFileIndexImpl.java b/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/ModuleFileIndexImpl.java
index 1e009d14f0cd..3b5ea4fa1610 100644
--- a/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/ModuleFileIndexImpl.java
+++ b/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/ModuleFileIndexImpl.java
@@ -29,7 +29,6 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.model.java.JavaModuleSourceRootTypes;
import org.jetbrains.jps.model.module.JpsModuleSourceRootType;
-import java.util.Collections;
import java.util.List;
import java.util.Set;
@@ -49,8 +48,8 @@ public class ModuleFileIndexImpl extends FileIndexBase implements ModuleFileInde
for (VirtualFile contentRoot : contentRoots) {
VirtualFile parent = contentRoot.getParent();
if (parent != null) {
- DirectoryInfo parentInfo = myDirectoryIndex.getInfoForDirectory(parent);
- if (parentInfo != null && myModule.equals(parentInfo.getModule())) continue; // inner content - skip it
+ DirectoryInfo parentInfo = myDirectoryIndex.getInfoForFile(parent);
+ if (parentInfo.isInProject() && myModule.equals(parentInfo.getModule())) continue; // inner content - skip it
}
boolean finished = VfsUtilCore.iterateChildrenRecursively(contentRoot, myContentFilter, iterator);
@@ -68,50 +67,45 @@ public class ModuleFileIndexImpl extends FileIndexBase implements ModuleFileInde
@Override
public boolean isInContent(@NotNull VirtualFile fileOrDir) {
DirectoryInfo info = getInfoForFileOrDirectory(fileOrDir);
- return info != null && myModule.equals(info.getModule());
+ return info.isInProject() && myModule.equals(info.getModule());
}
@Override
public boolean isInSourceContent(@NotNull VirtualFile fileOrDir) {
DirectoryInfo info = getInfoForFileOrDirectory(fileOrDir);
- return info != null && info.isInModuleSource() && myModule.equals(info.getModule());
+ return info.isInModuleSource() && myModule.equals(info.getModule());
}
@Override
@NotNull
public List<OrderEntry> getOrderEntriesForFile(@NotNull VirtualFile fileOrDir) {
- DirectoryInfo info = getInfoForFileOrDirectory(fileOrDir);
- if (info == null) return Collections.emptyList();
- return info.findAllOrderEntriesWithOwnerModule(myModule);
+ return getInfoForFileOrDirectory(fileOrDir).findAllOrderEntriesWithOwnerModule(myModule);
}
@Override
public OrderEntry getOrderEntryForFile(@NotNull VirtualFile fileOrDir) {
- DirectoryInfo info = getInfoForFileOrDirectory(fileOrDir);
- if (info == null) return null;
- return info.findOrderEntryWithOwnerModule(myModule);
+ return getInfoForFileOrDirectory(fileOrDir).findOrderEntryWithOwnerModule(myModule);
}
@Override
public boolean isInTestSourceContent(@NotNull VirtualFile fileOrDir) {
DirectoryInfo info = getInfoForFileOrDirectory(fileOrDir);
- return info != null && info.isInModuleSource() && myModule.equals(info.getModule())
+ return info.isInModuleSource() && myModule.equals(info.getModule())
&& JavaModuleSourceRootTypes.isTestSourceOrResource(myDirectoryIndex.getSourceRootType(info));
}
@Override
public boolean isUnderSourceRootOfType(@NotNull VirtualFile fileOrDir, @NotNull Set<? extends JpsModuleSourceRootType<?>> rootTypes) {
DirectoryInfo info = getInfoForFileOrDirectory(fileOrDir);
- return info != null && info.isInModuleSource() && myModule.equals(info.getModule())
- && rootTypes.contains(myDirectoryIndex.getSourceRootType(info));
+ return info.isInModuleSource() && myModule.equals(info.getModule()) && rootTypes.contains(myDirectoryIndex.getSourceRootType(info));
}
private class ContentFilter implements VirtualFileFilter {
@Override
public boolean accept(@NotNull VirtualFile file) {
if (file.isDirectory()) {
- DirectoryInfo info = myDirectoryIndex.getInfoForDirectory(file);
- return info != null && myModule.equals(info.getModule());
+ DirectoryInfo info = myDirectoryIndex.getInfoForFile(file);
+ return info.isInProject() && myModule.equals(info.getModule());
}
else {
return !myFileTypeRegistry.isFileIgnored(file);
diff --git a/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/NonProjectDirectoryInfo.java b/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/NonProjectDirectoryInfo.java
new file mode 100644
index 000000000000..7937f08fc7b4
--- /dev/null
+++ b/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/NonProjectDirectoryInfo.java
@@ -0,0 +1,127 @@
+/*
+ * Copyright 2000-2014 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.openapi.roots.impl;
+
+import com.intellij.openapi.module.Module;
+import com.intellij.openapi.roots.OrderEntry;
+import com.intellij.openapi.vfs.VirtualFile;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * @author nik
+ */
+class NonProjectDirectoryInfo extends DirectoryInfo {
+ public static final NonProjectDirectoryInfo IGNORED = new NonProjectDirectoryInfo("ignored") {
+ @Override
+ public boolean isIgnored() {
+ return true;
+ }
+ };
+ public static final NonProjectDirectoryInfo EXCLUDED = new NonProjectDirectoryInfo("excluded from project") {
+ @Override
+ public boolean isExcluded() {
+ return true;
+ }
+ };
+ public static final NonProjectDirectoryInfo NOT_UNDER_PROJECT_ROOTS = new NonProjectDirectoryInfo("not under project roots");
+ public static final NonProjectDirectoryInfo INVALID = new NonProjectDirectoryInfo("invalid");
+ public static final NonProjectDirectoryInfo NOT_SUPPORTED_VIRTUAL_FILE_IMPLEMENTATION = new NonProjectDirectoryInfo("not supported VirtualFile implementation");
+ private final String myDebugName;
+
+ private NonProjectDirectoryInfo(String debugName) {
+ myDebugName = debugName;
+ }
+
+ public boolean isInProject() {
+ return false;
+ }
+
+ @NotNull
+ @Override
+ public OrderEntry[] getOrderEntries() {
+ return OrderEntry.EMPTY_ARRAY;
+ }
+
+ @Nullable
+ OrderEntry findOrderEntryWithOwnerModule(@NotNull Module ownerModule) {
+ return null;
+ }
+
+ @NotNull
+ List<OrderEntry> findAllOrderEntriesWithOwnerModule(@NotNull Module ownerModule) {
+ return Collections.emptyList();
+ }
+
+ @Override
+ public String toString() {
+ return "DirectoryInfo: " + myDebugName;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ return this == o;
+ }
+
+ @Override
+ public int hashCode() {
+ return System.identityHashCode(this);
+ }
+
+ public boolean isIgnored() {
+ return false;
+ }
+
+ @Nullable
+ public VirtualFile getSourceRoot() {
+ return null;
+ }
+
+ public VirtualFile getLibraryClassRoot() {
+ return null;
+ }
+
+ @Nullable
+ public VirtualFile getContentRoot() {
+ return null;
+ }
+
+ public boolean isInModuleSource() {
+ return false;
+ }
+
+ public boolean isInLibrarySource() {
+ return false;
+ }
+
+ public boolean isExcluded() {
+ return false;
+ }
+
+ public Module getModule() {
+ return null;
+ }
+
+ void assertConsistency() {
+ }
+
+ public int getSourceRootTypeId() {
+ return 0;
+ }
+}
diff --git a/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/ProjectFileIndexFacade.java b/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/ProjectFileIndexFacade.java
index 057f6b076070..0bb65c600083 100644
--- a/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/ProjectFileIndexFacade.java
+++ b/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/ProjectFileIndexFacade.java
@@ -66,7 +66,7 @@ public class ProjectFileIndexFacade extends FileIndexFacade {
@Override
public boolean isExcludedFile(@NotNull final VirtualFile file) {
- return myFileIndex.isIgnored(file);
+ return myFileIndex.isExcluded(file);
}
@Nullable
@@ -83,7 +83,7 @@ public class ProjectFileIndexFacade extends FileIndexFacade {
while (true) {
if (childDir == null) return false;
if (childDir.equals(baseDir)) return true;
- if (myDirectoryIndex.getInfoForDirectory(childDir) == null) return false;
+ if (!myDirectoryIndex.getInfoForFile(childDir).isInProject()) return false;
childDir = childDir.getParent();
}
}
diff --git a/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/ProjectFileIndexImpl.java b/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/ProjectFileIndexImpl.java
index d3fd78289771..acb6598f55c8 100644
--- a/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/ProjectFileIndexImpl.java
+++ b/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/ProjectFileIndexImpl.java
@@ -34,7 +34,6 @@ import org.jetbrains.jps.model.java.JavaModuleSourceRootTypes;
import org.jetbrains.jps.model.module.JpsModuleSourceRootType;
import java.util.Arrays;
-import java.util.Collections;
import java.util.List;
import java.util.Set;
@@ -57,13 +56,13 @@ public class ProjectFileIndexImpl extends FileIndexBase implements ProjectFileIn
VirtualFile[] contentRoots = ModuleRootManager.getInstance(module).getContentRoots();
for (VirtualFile contentRoot : contentRoots) {
DirectoryInfo info = getInfoForFileOrDirectory(contentRoot);
- if (info == null) continue; // is excluded or ignored
+ if (!info.isInProject()) continue; // is excluded or ignored
if (!module.equals(info.getModule())) continue; // maybe 2 modules have the same content root?
VirtualFile parent = contentRoot.getParent();
if (parent != null) {
DirectoryInfo parentInfo = getInfoForFileOrDirectory(parent);
- if (parentInfo != null && parentInfo.getModule() != null) continue; // inner content - skip it
+ if (parentInfo.isInProject() && parentInfo.getModule() != null) continue; // inner content - skip it
}
boolean finished = VfsUtilCore.iterateChildrenRecursively(contentRoot, myContentFilter, iterator);
@@ -80,61 +79,43 @@ public class ProjectFileIndexImpl extends FileIndexBase implements ProjectFileIn
}
@Override
- public boolean isIgnored(@NotNull VirtualFile file) {
- if (myFileTypeRegistry.isFileIgnored(file)) return true;
- VirtualFile dir = file.isDirectory() ? file : file.getParent();
- if (dir == null) return false;
-
- DirectoryInfo info = getInfoForFileOrDirectory(dir);
- if (info != null) return false;
- if (myDirectoryIndex.isProjectExcludeRoot(dir)) return true;
-
- VirtualFile parent = dir.getParent();
- while (true) {
- if (parent == null) return false;
- DirectoryInfo parentInfo = getInfoForFileOrDirectory(parent);
- if (parentInfo != null) return true;
- if (myDirectoryIndex.isProjectExcludeRoot(parent)) return true;
- parent = parent.getParent();
- }
+ public boolean isExcluded(@NotNull VirtualFile file) {
+ DirectoryInfo info = getInfoForFileOrDirectory(file);
+ return info.isIgnored() || info.isExcluded();
}
@Override
public Module getModuleForFile(@NotNull VirtualFile file) {
if (file instanceof VirtualFileWindow) file = ((VirtualFileWindow)file).getDelegate();
- VirtualFile dir = file.isDirectory() ? file : file.getParent();
- if (dir == null) return null;
- DirectoryInfo info = getInfoForFileOrDirectory(dir);
- if (info == null) return null;
+ DirectoryInfo info = getInfoForFileOrDirectory(file);
+ if (!info.isInProject()) return null;
return info.getModule();
}
@Override
@NotNull
public List<OrderEntry> getOrderEntriesForFile(@NotNull VirtualFile file) {
- DirectoryInfo info = getInfoForFileOrDirectory(file);
- if (info == null) return Collections.emptyList();
- return Arrays.asList(info.getOrderEntries());
+ return Arrays.asList(getInfoForFileOrDirectory(file).getOrderEntries());
}
@Override
public VirtualFile getClassRootForFile(@NotNull VirtualFile file) {
final DirectoryInfo info = getInfoForFileOrDirectory(file);
- if (info == null) return null;
+ if (!info.isInProject()) return null;
return info.getLibraryClassRoot();
}
@Override
public VirtualFile getSourceRootForFile(@NotNull VirtualFile file) {
final DirectoryInfo info = getInfoForFileOrDirectory(file);
- if (info == null) return null;
+ if (!info.isInProject()) return null;
return info.getSourceRoot();
}
@Override
public VirtualFile getContentRootForFile(@NotNull VirtualFile file) {
final DirectoryInfo info = getInfoForFileOrDirectory(file);
- if (info == null) return null;
+ if (!info.isInProject()) return null;
return info.getContentRoot();
}
@@ -147,58 +128,60 @@ public class ProjectFileIndexImpl extends FileIndexBase implements ProjectFileIn
@Override
public boolean isLibraryClassFile(@NotNull VirtualFile file) {
if (file.isDirectory()) return false;
- if (myFileTypeRegistry.isFileIgnored(file)) return false;
DirectoryInfo parentInfo = getInfoForFileOrDirectory(file);
- return parentInfo != null && parentInfo.hasLibraryClassRoot();
+ return parentInfo.isInProject() && parentInfo.hasLibraryClassRoot();
}
@Override
public boolean isInSource(@NotNull VirtualFile fileOrDir) {
DirectoryInfo info = getInfoForFileOrDirectory(fileOrDir);
- return info != null && (info.isInModuleSource() || info.isInLibrarySource());
+ return info.isInModuleSource() || info.isInLibrarySource();
}
@Override
public boolean isInLibraryClasses(@NotNull VirtualFile fileOrDir) {
DirectoryInfo info = getInfoForFileOrDirectory(fileOrDir);
- return info != null && info.hasLibraryClassRoot();
+ return info.isInProject() && info.hasLibraryClassRoot();
}
@Override
public boolean isInLibrarySource(@NotNull VirtualFile fileOrDir) {
- DirectoryInfo info = getInfoForFileOrDirectory(fileOrDir);
- return info != null && info.isInLibrarySource();
+ return getInfoForFileOrDirectory(fileOrDir).isInLibrarySource();
+ }
+
+ @Override
+ public boolean isIgnored(@NotNull VirtualFile file) {
+ return isExcluded(file);
}
@Override
public boolean isInContent(@NotNull VirtualFile fileOrDir) {
DirectoryInfo info = getInfoForFileOrDirectory(fileOrDir);
- return info != null && info.getModule() != null;
+ return info.isInProject() && info.getModule() != null;
}
@Override
public boolean isInSourceContent(@NotNull VirtualFile fileOrDir) {
- DirectoryInfo info = getInfoForFileOrDirectory(fileOrDir);
- return info != null && info.isInModuleSource();
+ return getInfoForFileOrDirectory(fileOrDir).isInModuleSource();
}
@Override
public boolean isInTestSourceContent(@NotNull VirtualFile fileOrDir) {
DirectoryInfo info = getInfoForFileOrDirectory(fileOrDir);
- return info != null && info.isInModuleSource() && JavaModuleSourceRootTypes.isTestSourceOrResource(myDirectoryIndex.getSourceRootType(info));
+ return info.isInModuleSource() && JavaModuleSourceRootTypes.isTestSourceOrResource(myDirectoryIndex.getSourceRootType(info));
}
@Override
public boolean isUnderSourceRootOfType(@NotNull VirtualFile fileOrDir, @NotNull Set<? extends JpsModuleSourceRootType<?>> rootTypes) {
DirectoryInfo info = getInfoForFileOrDirectory(fileOrDir);
- return info != null && info.isInModuleSource() && rootTypes.contains(myDirectoryIndex.getSourceRootType(info));
+ return info.isInModuleSource() && rootTypes.contains(myDirectoryIndex.getSourceRootType(info));
}
private class ContentFilter implements VirtualFileFilter {
@Override
public boolean accept(@NotNull VirtualFile file) {
DirectoryInfo info = getInfoForFileOrDirectory(file);
- if (info == null || info.getModule() == null) return false;
+ if (!info.isInProject() || info.getModule() == null) return false;
if (file.isDirectory()) {
return true;
diff --git a/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/PushedFilePropertiesUpdater.java b/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/PushedFilePropertiesUpdater.java
new file mode 100644
index 000000000000..63fcc111df5d
--- /dev/null
+++ b/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/PushedFilePropertiesUpdater.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2000-2014 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.openapi.roots.impl;
+
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.vfs.VirtualFile;
+import org.jetbrains.annotations.NotNull;
+
+public abstract class PushedFilePropertiesUpdater {
+ @NotNull
+ public static PushedFilePropertiesUpdater getInstance(Project project) {
+ return project.getComponent(PushedFilePropertiesUpdater.class);
+ }
+
+ public abstract void initializeProperties();
+ public abstract void pushAll(final FilePropertyPusher... pushers);
+ public abstract void filePropertiesChanged(@NotNull final VirtualFile file);
+ public abstract void processPendingEvents();
+ public abstract void pushAllPropertiesNow();
+ public abstract <T> void findAndUpdateValue(final VirtualFile fileOrDir, final FilePropertyPusher<T> pusher, final T moduleValue);
+}
diff --git a/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/RootIndex.java b/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/RootIndex.java
index ad3b851cf2f6..ca68cee3d061 100644
--- a/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/RootIndex.java
+++ b/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/RootIndex.java
@@ -43,16 +43,8 @@ import java.util.*;
public class RootIndex extends DirectoryIndex {
private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.roots.impl.RootIndex");
- private static final DirectoryInfo NULL_INFO = new DirectoryInfo(null, null, null, null, (byte)0) {
- @NotNull
- @Override
- public OrderEntry[] getOrderEntries() {
- throw new UnsupportedOperationException("Not implemented");
- }
- };
private final Set<VirtualFile> myProjectExcludedRoots = ContainerUtil.newHashSet();
- private final Set<VirtualFile> myModuleExcludedRoots;
private final MultiMap<String, VirtualFile> myPackagePrefixRoots = new MultiMap<String, VirtualFile>() {
@NotNull
@Override
@@ -77,15 +69,15 @@ public class RootIndex extends DirectoryIndex {
Set<VirtualFile> allRoots = info.getAllRoots();
for (VirtualFile root : allRoots) {
List<VirtualFile> hierarchy = getHierarchy(root, allRoots, info);
- Pair<DirectoryInfo, String> pair = hierarchy == null ? new Pair<DirectoryInfo, String>(null, null) : calcDirectoryInfo(root, hierarchy, info);
+ Pair<DirectoryInfo, String> pair = hierarchy != null
+ ? calcDirectoryInfo(root, hierarchy, info)
+ : new Pair<DirectoryInfo, String>(NonProjectDirectoryInfo.IGNORED, null);
cacheInfos(root, root, pair.first);
myPackagePrefixRoots.putValue(pair.second, root);
if (info.shouldMarkAsProjectExcluded(root, hierarchy)) {
myProjectExcludedRoots.add(root);
}
}
-
- myModuleExcludedRoots = info.excludedFromModule.keySet();
}
@NotNull
@@ -232,7 +224,7 @@ public class RootIndex extends DirectoryIndex {
}
OrderEntry[] array = orderEntries.toArray(new OrderEntry[orderEntries.size()]);
- Arrays.sort(array, DirectoryInfo.BY_OWNER_MODULE);
+ Arrays.sort(array, DirectoryInfoImpl.BY_OWNER_MODULE);
return array;
}
@@ -254,7 +246,7 @@ public class RootIndex extends DirectoryIndex {
}
int id = myRootTypes.size();
- if (id > DirectoryInfo.MAX_ROOT_TYPE_ID) {
+ if (id > DirectoryInfoImpl.MAX_ROOT_TYPE_ID) {
LOG.error("Too many different types of module source roots (" + id + ") registered: " + myRootTypes);
}
myRootTypes.add(rootType);
@@ -263,14 +255,30 @@ public class RootIndex extends DirectoryIndex {
}
@Override
- @Nullable
- public DirectoryInfo getInfoForDirectory(@NotNull final VirtualFile dir) {
- if (!dir.isValid()) {
- return null;
+ public DirectoryInfo getInfoForDirectory(@NotNull VirtualFile dir) {
+ DirectoryInfo info = getInfoForFile(dir);
+ return info.isInProject() ? info : null;
+ }
+
+ @NotNull
+ @Override
+ public DirectoryInfo getInfoForFile(@NotNull VirtualFile file) {
+ if (!file.isValid()) {
+ return NonProjectDirectoryInfo.INVALID;
+ }
+ VirtualFile dir;
+ if (!file.isDirectory()) {
+ DirectoryInfo info = myInfoCache.getCachedInfo(file);
+ if (info != null) {
+ return info;
+ }
+ if (isIgnored(file)) {
+ return NonProjectDirectoryInfo.IGNORED;
+ }
+ dir = file.getParent();
}
- if (!dir.isDirectory()) {
- DirectoryInfo info = myInfoCache.getCachedInfo(dir);
- return info == NULL_INFO ? null : info;
+ else {
+ dir = file;
}
int count = 0;
@@ -283,21 +291,21 @@ public class RootIndex extends DirectoryIndex {
if (!dir.equals(root)) {
cacheInfos(dir, root, info);
}
- return info == NULL_INFO ? null : info;
+ return info;
}
if (isIgnored(root)) {
- return cacheInfos(dir, root, null);
+ return cacheInfos(dir, root, NonProjectDirectoryInfo.IGNORED);
}
}
- return cacheInfos(dir, null, null);
+ return cacheInfos(dir, null, NonProjectDirectoryInfo.NOT_UNDER_PROJECT_ROOTS);
}
- @Nullable
- private DirectoryInfo cacheInfos(VirtualFile dir, @Nullable VirtualFile stopAt, @Nullable DirectoryInfo info) {
+ @NotNull
+ private DirectoryInfo cacheInfos(VirtualFile dir, @Nullable VirtualFile stopAt, @NotNull DirectoryInfo info) {
while (dir != null) {
- myInfoCache.cacheInfo(dir, info == null ? NULL_INFO : info);
+ myInfoCache.cacheInfo(dir, info);
if (dir.equals(stopAt)) {
break;
}
@@ -307,16 +315,6 @@ public class RootIndex extends DirectoryIndex {
}
@Override
- public boolean isProjectExcludeRoot(@NotNull final VirtualFile dir) {
- return myProjectExcludedRoots.contains(dir);
- }
-
- @Override
- public boolean isModuleExcludeRoot(@NotNull final VirtualFile dir) {
- return myModuleExcludedRoots.contains(dir);
- }
-
- @Override
@NotNull
public Query<VirtualFile> getDirectoriesByPackageName(@NotNull final String packageName, final boolean includeLibrarySources) {
List<VirtualFile> result = myDirectoriesByPackageNameCache.get(packageName);
@@ -327,7 +325,8 @@ public class RootIndex extends DirectoryIndex {
String shortName = StringUtil.getShortName(packageName);
for (VirtualFile parentDir : getDirectoriesByPackageName(StringUtil.getPackageName(packageName), true)) {
VirtualFile child = parentDir.findChild(shortName);
- if (child != null && child.isDirectory() && getInfoForDirectory(child) != null && packageName.equals(getPackageName(child))) {
+ if (child != null && child.isDirectory() && getInfoForFile(child).isInProject()
+ && packageName.equals(getPackageName(child))) {
result.add(child);
}
}
@@ -344,8 +343,8 @@ public class RootIndex extends DirectoryIndex {
result = ContainerUtil.filter(result, new Condition<VirtualFile>() {
@Override
public boolean value(VirtualFile file) {
- DirectoryInfo info = getInfoForDirectory(file);
- return info != null && (!info.isInLibrarySource() || info.isInModuleSource() || info.hasLibraryClassRoot());
+ DirectoryInfo info = getInfoForFile(file);
+ return info.isInProject() && (!info.isInLibrarySource() || info.isInModuleSource() || info.hasLibraryClassRoot());
}
});
}
@@ -397,7 +396,7 @@ public class RootIndex extends DirectoryIndex {
return false;
}
- @Nullable
+ @Nullable("returns null only if dir is under ignored folder")
private static List<VirtualFile> getHierarchy(VirtualFile dir, @NotNull Set<VirtualFile> allRoots, @NotNull RootInfo info) {
List<VirtualFile> hierarchy = ContainerUtil.newArrayList();
boolean hasContentRoots = false;
@@ -472,6 +471,15 @@ public class RootIndex extends DirectoryIndex {
}
@Nullable
+ private Module findParentModuleForExcluded(@NotNull List<VirtualFile> hierarchy) {
+ for (VirtualFile root : hierarchy) {
+ Module module = contentRootOf.get(root);
+ if (module != null) return module;
+ }
+ return null;
+ }
+
+ @Nullable
private VirtualFile findLibraryRootInfo(@NotNull List<VirtualFile> hierarchy, boolean source) {
Set<Library> librariesToIgnore = ContainerUtil.newHashSet();
for (VirtualFile root : hierarchy) {
@@ -566,8 +574,12 @@ public class RootIndex extends DirectoryIndex {
VirtualFile moduleContentRoot = info.findModuleRootInfo(hierarchy);
VirtualFile libraryClassRoot = info.findLibraryRootInfo(hierarchy, false);
VirtualFile librarySourceRoot = info.findLibraryRootInfo(hierarchy, true);
+ Module parentModuleForExcluded = null;
if (moduleContentRoot == null && libraryClassRoot == null && librarySourceRoot == null) {
- return new Pair<DirectoryInfo, String>(null, null);
+ parentModuleForExcluded = info.findParentModuleForExcluded(hierarchy);
+ if (parentModuleForExcluded == null) {
+ return new Pair<DirectoryInfo, String>(NonProjectDirectoryInfo.EXCLUDED, null);
+ }
}
VirtualFile sourceRoot = info.findPackageRootInfo(hierarchy, moduleContentRoot, null, librarySourceRoot);
@@ -577,11 +589,9 @@ public class RootIndex extends DirectoryIndex {
boolean inLibrarySource = librarySourceRoot != null;
int typeId = moduleSourceRoot != null ? info.rootTypeId.get(moduleSourceRoot) : 0;
- DirectoryInfo directoryInfo = new DirectoryInfo(info.contentRootOf.get(moduleContentRoot),
- moduleContentRoot,
- sourceRoot,
- libraryClassRoot,
- (byte)DirectoryInfo.createSourceRootTypeData(inModuleSources, inLibrarySource, typeId)) {
+ Module module = parentModuleForExcluded != null ? parentModuleForExcluded : info.contentRootOf.get(moduleContentRoot);
+ DirectoryInfo directoryInfo = new DirectoryInfoImpl(module, moduleContentRoot, sourceRoot, libraryClassRoot, inModuleSources, inLibrarySource,
+ parentModuleForExcluded != null, typeId) {
@NotNull
@Override
public OrderEntry[] getOrderEntries() {
diff --git a/platform/remote-servers/impl/resources/resources/cloud.properties b/platform/remote-servers/impl/resources/resources/cloud.properties
index 82c23fecf0a9..38329f10f163 100644
--- a/platform/remote-servers/impl/resources/resources/cloud.properties
+++ b/platform/remote-servers/impl/resources/resources/cloud.properties
@@ -9,3 +9,6 @@ run.configuration.name={0} - {1}
choose.account.title=Choose {0} account\:
git.cloud.app.detected=<b>{0} application detected</b> at\: {1}.<br/>You may <a href\="\#">setup deployment run configuration</a> for the application
choose.account.wizzard.title={0} deployment run configuration
+cloud.support={0} Support
+cloud.support.added=Finished adding {0} support\!
+detect.module.structure=Detecting {0} module structure
diff --git a/platform/remote-servers/impl/src/META-INF/RemoteServers.xml b/platform/remote-servers/impl/src/META-INF/RemoteServers.xml
index c18f18d43304..41067b075460 100644
--- a/platform/remote-servers/impl/src/META-INF/RemoteServers.xml
+++ b/platform/remote-servers/impl/src/META-INF/RemoteServers.xml
@@ -17,7 +17,7 @@
serviceImplementation="com.intellij.remoteServer.agent.impl.RemoteAgentManagerImpl"/>
<applicationService serviceInterface="com.intellij.remoteServer.runtime.clientLibrary.ClientLibraryManager"
serviceImplementation="com.intellij.remoteServer.impl.runtime.clientLibrary.ClientLibraryManagerImpl"/>
- <applicationConfigurable instance="com.intellij.remoteServer.impl.configuration.RemoteServerListConfigurable"/>
+ <applicationConfigurable groupId="build" displayName="Clouds" instance="com.intellij.remoteServer.impl.configuration.RemoteServerListConfigurable"/>
<programRunner implementation="com.intellij.remoteServer.impl.runtime.DeployToServerRunner"/>
<projectService serviceInterface="com.intellij.remoteServer.runtime.ui.RemoteServersView"
serviceImplementation="com.intellij.remoteServer.impl.runtime.ui.RemoteServersViewImpl"/>
diff --git a/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/configuration/RemoteServerConfigurable.java b/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/configuration/RemoteServerConfigurable.java
index a614c4e642c9..7e68ca4c5b69 100644
--- a/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/configuration/RemoteServerConfigurable.java
+++ b/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/configuration/RemoteServerConfigurable.java
@@ -7,6 +7,7 @@ import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.progress.Task;
import com.intellij.openapi.ui.NamedConfigurable;
import com.intellij.openapi.util.Disposer;
+import com.intellij.openapi.util.text.StringUtil;
import com.intellij.remoteServer.configuration.RemoteServer;
import com.intellij.remoteServer.configuration.ServerConfiguration;
import com.intellij.remoteServer.runtime.ServerConnection;
@@ -79,7 +80,7 @@ public class RemoteServerConfigurable extends NamedConfigurable<RemoteServer<?>>
if (result) {
myUncheckedApply = false;
- setConnectionStatus("");
+ setConnectionStatus(false, false, "");
myConnectionTester = null;
if (modified) {
@@ -88,7 +89,7 @@ public class RemoteServerConfigurable extends NamedConfigurable<RemoteServer<?>>
myInnerApplied = true;
}
catch (ConfigurationException e) {
- setConnectionStatus(e.getMessage());
+ setConnectionStatus(true, false, e.getMessage());
}
}
}
@@ -97,7 +98,7 @@ public class RemoteServerConfigurable extends NamedConfigurable<RemoteServer<?>>
@Override
protected void run() {
- setConnectionStatus("Connecting...");
+ setConnectionStatus(false, false, "Connecting...");
myConnectionTester = new ConnectionTester();
myConnectionTester.testConnection();
@@ -105,19 +106,20 @@ public class RemoteServerConfigurable extends NamedConfigurable<RemoteServer<?>>
};
}
- private void setConnectionStatus(String text) {
- setConnectionStatus(false, text);
- }
-
- private void setConnectionStatus(boolean connected, String text) {
+ private void setConnectionStatus(boolean error, boolean connected, String text) {
boolean changed = myConnected != connected;
myConnected = connected;
- myConnectionStatusLabel.setText(UIUtil.toHtml(text));
+ setConnectionStatusText(error, text);
if (changed) {
notifyDataLoader();
}
}
+ protected void setConnectionStatusText(boolean error, String text) {
+ myConnectionStatusLabel.setText(UIUtil.toHtml(text));
+ myConnectionStatusLabel.setVisible(StringUtil.isNotEmpty(text));
+ }
+
public void setDataLoader(CloudDataLoader dataLoader) {
myDataLoader = dataLoader;
notifyDataLoader();
@@ -238,7 +240,7 @@ public class RemoteServerConfigurable extends NamedConfigurable<RemoteServer<?>>
@Override
public void run() {
if (myConnectionTester == ConnectionTester.this) {
- setConnectionStatus(connected, connected ? "Connection successful" : "Cannot connect: " + connection.getStatusText());
+ setConnectionStatus(!connected, connected, connected ? "Connection successful" : "Cannot connect: " + connection.getStatusText());
}
}
});
diff --git a/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ui/ServersToolWindowContent.java b/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ui/ServersToolWindowContent.java
index f860d6dfa98c..7a1f27f3b8ee 100644
--- a/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ui/ServersToolWindowContent.java
+++ b/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ui/ServersToolWindowContent.java
@@ -146,6 +146,9 @@ public class ServersToolWindowContent extends JPanel implements Disposable {
}
myPropertiesPanelLayout.show(myPropertiesPanel, cardName);
}
+ else {
+ showMessageLabel("");
+ }
}
else if (node instanceof ServersTreeStructure.RemoteServerNode) {
updateServerDetails((ServersTreeStructure.RemoteServerNode)node);
diff --git a/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ui/tree/ServersTreeStructure.java b/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ui/tree/ServersTreeStructure.java
index 4cb1c01943be..5895be279f85 100644
--- a/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ui/tree/ServersTreeStructure.java
+++ b/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ui/tree/ServersTreeStructure.java
@@ -287,16 +287,6 @@ public class ServersTreeStructure extends AbstractTreeStructureBase {
myParentNode = parentNode;
}
- @Override
- public boolean equals(Object object) {
- return object instanceof DeploymentNodeImpl && getValue().getName().equals(((DeploymentNodeImpl)object).getValue().getName());
- }
-
- @Override
- public int hashCode() {
- return getValue().getName().hashCode();
- }
-
@NotNull
@Override
public ServerNode getServerNode() {
@@ -377,10 +367,14 @@ public class ServersTreeStructure extends AbstractTreeStructureBase {
return (DeploymentLogManagerImpl)myConnection.getLogManager(getValue());
}
+ public String getId() {
+ return myParentNode.getName() + ";deployment" + getValue().getName();
+ }
+
@NotNull
@Override
public String getLogId() {
- return "deployment:" + getValue().getName();
+ return getId() + ";main-log";
}
@NotNull
@@ -451,7 +445,7 @@ public class ServersTreeStructure extends AbstractTreeStructureBase {
@NotNull
@Override
public String getLogId() {
- return "deployment:" + myDeploymentNode.getValue().getName() + ";log:" + getLogName();
+ return myDeploymentNode.getId() + ";log:" + getLogName();
}
}
}
diff --git a/platform/remote-servers/impl/src/com/intellij/remoteServer/util/CloudAccountSelectionEditor.form b/platform/remote-servers/impl/src/com/intellij/remoteServer/util/CloudAccountSelectionEditor.form
index bbfd6da1afcc..3e8f941ff13a 100644
--- a/platform/remote-servers/impl/src/com/intellij/remoteServer/util/CloudAccountSelectionEditor.form
+++ b/platform/remote-servers/impl/src/com/intellij/remoteServer/util/CloudAccountSelectionEditor.form
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.remoteServer.util.CloudAccountSelectionEditor">
- <grid id="27dc6" binding="myMainPanel" layout-manager="GridLayoutManager" row-count="3" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
+ <grid id="27dc6" binding="myMainPanel" layout-manager="GridLayoutManager" row-count="2" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<xy x="20" y="20" width="500" height="400"/>
@@ -8,26 +8,27 @@
<properties/>
<border type="none"/>
<children>
- <component id="82588" class="javax.swing.JComboBox" binding="myServerComboBox">
+ <vspacer id="e6946">
<constraints>
- <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
+ <grid row="1" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="5" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
- <properties/>
- </component>
- <grid id="27f9c" binding="myServerConfigurablePanel" custom-create="true" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
- <margin top="0" left="0" bottom="0" right="0"/>
+ </vspacer>
+ <component id="a54bb" class="javax.swing.JButton" binding="myNewButton">
<constraints>
- <grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
+ <grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
- <properties/>
- <border type="none"/>
- <children/>
- </grid>
- <vspacer id="dcc88">
+ <properties>
+ <text value="New..."/>
+ </properties>
+ </component>
+ <component id="54cd4" class="com.intellij.openapi.ui.ComboBox" binding="myAccountComboBox">
<constraints>
- <grid row="2" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
+ <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="0" fill="1" indent="0" use-parent-layout="false">
+ <preferred-size width="200" height="-1"/>
+ </grid>
</constraints>
- </vspacer>
+ <properties/>
+ </component>
</children>
</grid>
</form>
diff --git a/platform/remote-servers/impl/src/com/intellij/remoteServer/util/CloudAccountSelectionEditor.java b/platform/remote-servers/impl/src/com/intellij/remoteServer/util/CloudAccountSelectionEditor.java
index 7bd38b481cbb..fa4355eb356c 100644
--- a/platform/remote-servers/impl/src/com/intellij/remoteServer/util/CloudAccountSelectionEditor.java
+++ b/platform/remote-servers/impl/src/com/intellij/remoteServer/util/CloudAccountSelectionEditor.java
@@ -18,133 +18,164 @@ package com.intellij.remoteServer.util;
import com.intellij.execution.RunManagerEx;
import com.intellij.execution.RunnerAndConfigurationSettings;
import com.intellij.execution.configurations.ConfigurationType;
-import com.intellij.openapi.Disposable;
-import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.ide.DataManager;
+import com.intellij.ide.actions.ShowSettingsUtilImpl;
+import com.intellij.ide.util.projectWizard.WizardContext;
+import com.intellij.openapi.actionSystem.AnAction;
+import com.intellij.openapi.actionSystem.AnActionEvent;
+import com.intellij.openapi.actionSystem.DefaultActionGroup;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModulePointer;
import com.intellij.openapi.module.ModulePointerManager;
import com.intellij.openapi.options.ConfigurationException;
+import com.intellij.openapi.options.ex.SingleConfigurableEditor;
import com.intellij.openapi.project.Project;
+import com.intellij.openapi.ui.ComboBox;
+import com.intellij.openapi.ui.popup.JBPopupFactory;
import com.intellij.openapi.util.Condition;
-import com.intellij.openapi.util.Disposer;
+import com.intellij.openapi.util.Key;
+import com.intellij.openapi.util.Ref;
import com.intellij.remoteServer.ServerType;
import com.intellij.remoteServer.configuration.RemoteServer;
import com.intellij.remoteServer.configuration.RemoteServersManager;
+import com.intellij.remoteServer.configuration.ServerConfiguration;
+import com.intellij.remoteServer.configuration.deployment.DeploymentConfiguration;
import com.intellij.remoteServer.impl.configuration.RemoteServerConfigurable;
import com.intellij.remoteServer.impl.configuration.deployment.DeployToServerConfigurationType;
import com.intellij.remoteServer.impl.configuration.deployment.DeployToServerRunConfiguration;
import com.intellij.remoteServer.impl.configuration.deployment.ModuleDeploymentSourceImpl;
+import com.intellij.util.Consumer;
+import com.intellij.util.containers.ContainerUtil;
+import com.intellij.util.containers.hash.HashMap;
import com.intellij.util.text.UniqueNameGenerator;
+import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
+import java.util.List;
+import java.util.Map;
-/**
- * @author michael.golubev
- */
-public class CloudAccountSelectionEditor<SC extends CloudConfigurationBase,
- DC extends CloudDeploymentNameConfiguration,
- ST extends ServerType<SC>> implements Disposable {
- private static final Logger LOG = Logger.getInstance("#" + CloudAccountSelectionEditor.class.getName());
+public class CloudAccountSelectionEditor {
- private JComboBox myServerComboBox;
- private JPanel myServerConfigurablePanel;
- private JPanel myMainPanel;
+ private static final Map<ServerType<?>, Key<RemoteServer<?>>> ourCloudType2AccountKey
+ = new HashMap<ServerType<?>, Key<RemoteServer<?>>>();
- private final ST myCloudType;
- private RemoteServer<SC> myNewServer;
- private RemoteServerConfigurable myServerConfigurable;
+ private JButton myNewButton;
+ private ComboBox myAccountComboBox;
+ private JPanel myMainPanel;
+ private final List<ServerType<?>> myCloudTypes;
- private DelayedRunner myRunner;
+ private Runnable myServerSelectionListener;
- private CloudDataLoader myDataLoader = CloudDataLoader.NULL;
+ public CloudAccountSelectionEditor(List<ServerType<?>> cloudTypes) {
+ myCloudTypes = cloudTypes;
- public CloudAccountSelectionEditor(ST cloudType) {
- myCloudType = cloudType;
- }
+ for (ServerType<?> cloudType : cloudTypes) {
+ for (RemoteServer<?> account : RemoteServersManager.getInstance().getServers(cloudType)) {
+ myAccountComboBox.addItem(new AccountItem(account));
+ }
+ }
- private void createUIComponents() {
- myServerConfigurablePanel = createServerConfigurablePanel();
- myServerConfigurablePanel.setVisible(false);
- }
+ myNewButton.addActionListener(new ActionListener() {
- public void initUI() {
- myServerComboBox.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ onNewButton();
+ }
+ });
+
+ myAccountComboBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
- onAccountSelectionChanged();
+ if (myServerSelectionListener != null) {
+ myServerSelectionListener.run();
+ }
}
});
+ }
- for (RemoteServer<SC> server : RemoteServersManager.getInstance().getServers(myCloudType)) {
- myServerComboBox.addItem(new ServerItem(server));
+ public void setAccountSelectionListener(Runnable listener) {
+ myServerSelectionListener = listener;
+ }
+
+ private void onNewButton() {
+ if (myCloudTypes.size() == 1) {
+ createAccount(ContainerUtil.getFirstItem(myCloudTypes));
+ return;
}
- myServerComboBox.addItem(new ServerItem(myNewServer));
- myRunner= new DelayedRunner(myMainPanel) {
+ DefaultActionGroup group = new DefaultActionGroup();
+ for (final ServerType<?> cloudType : myCloudTypes) {
+ group.add(new AnAction(cloudType.getPresentableName(), cloudType.getPresentableName(), cloudType.getIcon()) {
- private ServerItem myPreviousServerItem;
+ @Override
+ public void actionPerformed(AnActionEvent e) {
+ createAccount(cloudType);
+ }
+ });
+ }
+ JBPopupFactory.getInstance().createActionGroupPopup("New Account", group, DataManager.getInstance().getDataContext(myMainPanel),
+ JBPopupFactory.ActionSelectionAid.SPEEDSEARCH, false)
+ .showUnderneathOf(myNewButton);
+ }
+
+ private void createAccount(ServerType<?> cloudType) {
+ RemoteServer<?> newAccount = RemoteServersManager.getInstance().createServer(cloudType, generateServerName(cloudType));
+
+ final Ref<Consumer<String>> errorConsumerRef = new Ref<Consumer<String>>();
+
+ RemoteServerConfigurable configurable = new RemoteServerConfigurable(newAccount, null, true) {
@Override
- protected boolean wasChanged() {
- ServerItem currentServerItem = getSelectedServerItem();
- boolean result = myPreviousServerItem != currentServerItem;
- if (result) {
- myPreviousServerItem = currentServerItem;
- myDataLoader.clearCloudData();
- }
- return result;
+ protected void setConnectionStatusText(boolean error, String text) {
+ super.setConnectionStatusText(error, error ? "" : text);
+ errorConsumerRef.get().consume(error ? text : null);
}
+ };
- @Override
- protected void run() {
- if (getSelectedServerItem().isNew()) {
- myServerConfigurable.setDataLoader(new CloudDataLoader() {
-
- @Override
- public void clearCloudData() {
- if (getSelectedServerItem().isNew()) {
- myDataLoader.clearCloudData();
- }
- }
-
- @Override
- public void loadCloudData() {
- if (getSelectedServerItem().isNew()) {
- myDataLoader.loadCloudData();
- }
- }
- });
- }
- else {
- myDataLoader.loadCloudData();
- }
+ final SingleConfigurableEditor configurableEditor
+ = new SingleConfigurableEditor(myMainPanel, configurable, ShowSettingsUtilImpl.createDimensionKey(configurable), false) {
+
+ {
+ errorConsumerRef.set(new Consumer<String>() {
+
+ @Override
+ public void consume(String s) {
+ setErrorText(s);
+ }
+ });
}
};
- }
- public void setDataLoader(CloudDataLoader dataLoader) {
- myDataLoader = dataLoader;
+ if (!configurableEditor.showAndGet()) {
+ return;
+ }
+
+ newAccount.setName(configurable.getDisplayName());
+
+ RemoteServersManager.getInstance().addServer(newAccount);
+ AccountItem newAccountItem = new AccountItem(newAccount);
+ myAccountComboBox.addItem(newAccountItem);
+ myAccountComboBox.setSelectedItem(newAccountItem);
}
- private void onAccountSelectionChanged() {
- myServerConfigurablePanel.setVisible(getSelectedServerItem().isNew());
+ public JComponent getMainPanel() {
+ return myMainPanel;
}
- protected JPanel createServerConfigurablePanel() {
- myNewServer = RemoteServersManager.getInstance().createServer(myCloudType, generateServerName());
- myServerConfigurable = new RemoteServerConfigurable(myNewServer, null, true);
- myServerConfigurablePanel = (JPanel)myServerConfigurable.createComponent();
- return myServerConfigurablePanel;
+ @Nullable
+ public RemoteServer<?> getSelectedAccount() {
+ AccountItem selectedItem = (AccountItem)myAccountComboBox.getSelectedItem();
+ return selectedItem == null ? null : selectedItem.getAccount();
}
- private String generateServerName() {
- return UniqueNameGenerator.generateUniqueName(myCloudType.getPresentableName(), new Condition<String>() {
+ private static String generateServerName(ServerType<?> cloudType) {
+ return UniqueNameGenerator.generateUniqueName(cloudType.getPresentableName(), new Condition<String>() {
@Override
public boolean value(String s) {
@@ -158,30 +189,60 @@ public class CloudAccountSelectionEditor<SC extends CloudConfigurationBase,
});
}
- public DeployToServerRunConfiguration<SC, DC> createRunConfiguration(Module module, DC deploymentConfiguration) {
- Project project = module.getProject();
+ public void validate() throws ConfigurationException {
+ if (getSelectedAccount() == null) {
+ throw new ConfigurationException("Account required");
+ }
+ }
- RemoteServer<SC> server = getServer();
- if (server == null) {
- return null;
+ public void setAccountOnContext(WizardContext context) {
+ RemoteServer<?> account = getSelectedAccount();
+ if (account == null) {
+ return;
}
+ context.putUserData(getKey(account.getType()), account);
+ }
+
+ public static void unsetAccountOnContext(WizardContext context, ServerType<?> cloudType) {
+ context.putUserData(getKey(cloudType), null);
+ }
+
+ private static Key<RemoteServer<?>> getKey(ServerType<?> cloudType) {
+ Key<RemoteServer<?>> result = ourCloudType2AccountKey.get(cloudType);
+ if (result == null) {
+ result = new Key<RemoteServer<?>>("cloud-account-" + cloudType.getId());
+ ourCloudType2AccountKey.put(cloudType, result);
+ }
+ return result;
+ }
- if (getSelectedServerItem().isNew()) {
- RemoteServersManager.getInstance().addServer(server);
- myNewServer = null;
+ public static void createRunConfiguration(WizardContext context,
+ ServerType<?> cloudType,
+ Module module,
+ CloudDeploymentNameConfiguration configuration) {
+ RemoteServer<?> account = context.getUserData(getKey(cloudType));
+ if (account == null) {
+ return;
}
+ createRunConfiguration(account, module, configuration);
+ }
+
+ public static <SC extends ServerConfiguration, DC extends DeploymentConfiguration>
+ DeployToServerRunConfiguration<SC, DC> createRunConfiguration(RemoteServer<SC> account, Module module, DC deploymentConfiguration) {
- String serverName = server.getName();
+ Project project = module.getProject();
- String name = generateRunConfigurationName(serverName, module.getName());
+ String accountName = account.getName();
+
+ String name = generateRunConfigurationName(accountName, module.getName());
final RunManagerEx runManager = RunManagerEx.getInstanceEx(project);
final RunnerAndConfigurationSettings runSettings
- = runManager.createRunConfiguration(name, getRunConfigurationType().getConfigurationFactories()[0]);
+ = runManager.createRunConfiguration(name, getRunConfigurationType(account.getType()).getConfigurationFactories()[0]);
final DeployToServerRunConfiguration<SC, DC> result = (DeployToServerRunConfiguration<SC, DC>)runSettings.getConfiguration();
- result.setServerName(serverName);
+ result.setServerName(accountName);
final ModulePointer modulePointer = ModulePointerManager.getInstance(project).create(module);
result.setDeploymentSource(new ModuleDeploymentSourceImpl(modulePointer));
@@ -194,43 +255,8 @@ public class CloudAccountSelectionEditor<SC extends CloudConfigurationBase,
return result;
}
- protected String generateRunConfigurationName(String serverName, String moduleName) {
- return CloudBundle.getText("run.configuration.name", serverName, moduleName);
- }
-
- protected void handleError(ConfigurationException e) {
- LOG.info(e);
- }
-
- public RemoteServer<SC> getServer() {
- try {
- return doGetServer();
- }
- catch (ConfigurationException e) {
- handleError(e);
- return null;
- }
- }
-
- private RemoteServer<SC> doGetServer() throws ConfigurationException {
- ServerItem serverItem = getSelectedServerItem();
- if (serverItem.isNew()) {
- myServerConfigurable.apply();
- myNewServer.setName(myServerConfigurable.getDisplayName());
- }
- return serverItem.getServer();
- }
-
- public void validate() throws ConfigurationException {
- doGetServer();
- }
-
- private ServerItem getSelectedServerItem() {
- return (ServerItem)myServerComboBox.getSelectedItem();
- }
-
- private DeployToServerConfigurationType getRunConfigurationType() {
- String id = DeployToServerConfigurationType.getId(myCloudType);
+ private static DeployToServerConfigurationType getRunConfigurationType(ServerType<?> cloudType) {
+ String id = DeployToServerConfigurationType.getId(cloudType);
for (ConfigurationType configurationType : ConfigurationType.CONFIGURATION_TYPE_EP.getExtensions()) {
if (configurationType instanceof DeployToServerConfigurationType) {
DeployToServerConfigurationType deployConfigurationType = (DeployToServerConfigurationType)configurationType;
@@ -242,35 +268,25 @@ public class CloudAccountSelectionEditor<SC extends CloudConfigurationBase,
return null;
}
- public JPanel getMainPanel() {
- return myMainPanel;
- }
-
- @Override
- public void dispose() {
- myServerConfigurable.disposeUIResources();
- Disposer.dispose(myRunner);
+ private static String generateRunConfigurationName(String serverName, String moduleName) {
+ return CloudBundle.getText("run.configuration.name", serverName, moduleName);
}
- private class ServerItem {
+ private static class AccountItem {
- private final RemoteServer<SC> myServer;
-
- public ServerItem(RemoteServer<SC> server) {
- myServer = server;
- }
+ private final RemoteServer<?> myAccount;
- public boolean isNew() {
- return myServer == myNewServer;
+ public AccountItem(RemoteServer<?> account) {
+ myAccount = account;
}
- public RemoteServer<SC> getServer() {
- return myServer;
+ public RemoteServer<?> getAccount() {
+ return myAccount;
}
@Override
public String toString() {
- return isNew() ? "New account..." : myServer.getName();
+ return myAccount.getName();
}
}
}
diff --git a/platform/remote-servers/impl/src/com/intellij/remoteServer/util/CloudRuntimeTask.java b/platform/remote-servers/impl/src/com/intellij/remoteServer/util/CloudRuntimeTask.java
index 1e0326471d75..c8109dce3d29 100644
--- a/platform/remote-servers/impl/src/com/intellij/remoteServer/util/CloudRuntimeTask.java
+++ b/platform/remote-servers/impl/src/com/intellij/remoteServer/util/CloudRuntimeTask.java
@@ -109,6 +109,11 @@ public abstract class CloudRuntimeTask<
public void run(@NotNull ProgressIndicator indicator) {
progressive.run(indicator);
}
+
+ @Override
+ public boolean shouldStartInBackground() {
+ return CloudRuntimeTask.this.shouldStartInBackground();
+ }
};
}
@@ -122,6 +127,10 @@ public abstract class CloudRuntimeTask<
return result.get();
}
+ protected boolean shouldStartInBackground() {
+ return true;
+ }
+
protected void postPerform(T result) {
}
diff --git a/platform/remote-servers/impl/src/com/intellij/remoteServer/util/CloudSupportConfigurableBase.java b/platform/remote-servers/impl/src/com/intellij/remoteServer/util/CloudSupportConfigurableBase.java
deleted file mode 100644
index 421e75da7eae..000000000000
--- a/platform/remote-servers/impl/src/com/intellij/remoteServer/util/CloudSupportConfigurableBase.java
+++ /dev/null
@@ -1,190 +0,0 @@
-package com.intellij.remoteServer.util;
-
-import com.intellij.ProjectTopics;
-import com.intellij.ide.util.frameworkSupport.FrameworkSupportConfigurable;
-import com.intellij.ide.util.frameworkSupport.FrameworkSupportModel;
-import com.intellij.openapi.module.Module;
-import com.intellij.openapi.options.ConfigurationException;
-import com.intellij.openapi.project.ModuleAdapter;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.startup.StartupManager;
-import com.intellij.openapi.ui.MessageType;
-import com.intellij.openapi.util.Disposer;
-import com.intellij.remoteServer.ServerType;
-import com.intellij.remoteServer.configuration.RemoteServer;
-import com.intellij.remoteServer.runtime.Deployment;
-import com.intellij.remoteServer.runtime.ServerConnection;
-import com.intellij.remoteServer.runtime.ServerConnector;
-import com.intellij.remoteServer.runtime.deployment.ServerRuntimeInstance;
-import com.intellij.util.concurrency.Semaphore;
-import com.intellij.util.messages.MessageBusConnection;
-import com.intellij.util.ui.UIUtil;
-import org.jetbrains.annotations.NotNull;
-
-import javax.swing.*;
-import java.util.Collection;
-import java.util.concurrent.atomic.AtomicReference;
-
-/**
- * @author michael.golubev
- */
-public abstract class CloudSupportConfigurableBase<
- SC extends CloudConfigurationBase,
- DC extends CloudDeploymentNameConfiguration,
- SR extends CloudMultiSourceServerRuntimeInstance<DC, ?, ?, ?>,
- ST extends ServerType<SC>>
- extends FrameworkSupportConfigurable implements CloudDataLoader {
-
- private final ST myCloudType;
- private final Project myModelProject;
-
- private final CloudNotifier myNotifier;
-
- private boolean myInitialized = false;
-
- private CloudAccountSelectionEditor<SC, DC, ST> myAccountSelectionEditor;
-
- public CloudSupportConfigurableBase(ST cloudType, FrameworkSupportModel frameworkSupportModel) {
- myCloudType = cloudType;
- myModelProject = frameworkSupportModel.getProject();
- myNotifier = new CloudNotifier(cloudType.getPresentableName());
- }
-
- @Override
- public void dispose() {
- Disposer.dispose(getAccountSelectionEditor());
- }
-
- protected void initUI() {
- getAccountSelectionEditor().initUI();
- }
-
- @Override
- public void clearCloudData() {
- getExistingComboBox().removeAllItems();
- }
-
- @Override
- public void loadCloudData() {
- new ConnectionTask<Collection<Deployment>>("Loading existing applications list") {
-
- @Override
- protected void run(final ServerConnection<DC> connection,
- final Semaphore semaphore,
- final AtomicReference<Collection<Deployment>> result) {
- connection.connectIfNeeded(new ServerConnector.ConnectionCallback<DC>() {
-
- @Override
- public void connected(@NotNull ServerRuntimeInstance<DC> serverRuntimeInstance) {
- connection.computeDeployments(new Runnable() {
-
- @Override
- public void run() {
- result.set(connection.getDeployments());
- semaphore.up();
- UIUtil.invokeLaterIfNeeded(new Runnable() {
- @Override
- public void run() {
- if (!Disposer.isDisposed(CloudSupportConfigurableBase.this)) {
- setupExistingApplications(result.get());
- }
- }
- });
- }
- });
- }
-
- @Override
- public void errorOccurred(@NotNull String errorMessage) {
- runtimeErrorOccurred(errorMessage);
- semaphore.up();
- }
- });
- }
-
- @Override
- protected Collection<Deployment> run(SR serverRuntimeInstance) throws ServerRuntimeException {
- return null;
- }
- }.performAsync();
- }
-
- private void setupExistingApplications(Collection<Deployment> deployments) {
- JComboBox existingComboBox = getExistingComboBox();
- existingComboBox.removeAllItems();
- for (Deployment deployment : deployments) {
- existingComboBox.addItem(deployment.getName());
- }
- }
-
- @Override
- public void onFrameworkSelectionChanged(boolean selected) {
- if (selected && !myInitialized) {
- myInitialized = true;
- initUI();
- updateApplicationUI();
- }
- }
-
- protected void showMessage(String message, MessageType messageType) {
- getNotifier().showMessage(message, messageType);
- }
-
- protected Project getProject() {
- return myModelProject;
- }
-
- protected RemoteServer<SC> getServer() {
- return getAccountSelectionEditor().getServer();
- }
-
- protected void runOnModuleAdded(final Module module, final Runnable runnable) {
- if (myModelProject == null) {
- StartupManager.getInstance(module.getProject()).runWhenProjectIsInitialized(runnable);
- }
- else {
- MessageBusConnection connection = myModelProject.getMessageBus().connect(myModelProject);
- connection.subscribe(ProjectTopics.MODULES, new ModuleAdapter() {
-
- public void moduleAdded(Project project, Module addedModule) {
- if (addedModule == module) {
- runnable.run();
- }
- }
- });
- }
- }
-
- protected CloudAccountSelectionEditor<SC, DC, ST> getAccountSelectionEditor() {
- if (myAccountSelectionEditor == null) {
- myAccountSelectionEditor = new CloudAccountSelectionEditor<SC, DC, ST>(myCloudType) {
-
- @Override
- protected void handleError(ConfigurationException e) {
- getNotifier().showMessage(e.getMessage(), MessageType.ERROR);
- }
- };
- myAccountSelectionEditor.setDataLoader(this);
- }
- return myAccountSelectionEditor;
- }
-
- protected CloudNotifier getNotifier() {
- return myNotifier;
- }
-
- protected abstract JComboBox getExistingComboBox();
-
- protected abstract void updateApplicationUI();
-
- protected abstract class ConnectionTask<T> extends CloudConnectionTask<T, SC, DC, SR> {
-
- public ConnectionTask(String title) {
- super(myModelProject, title, CloudSupportConfigurableBase.this.getServer());
- }
-
- public ConnectionTask(Module module, String title) {
- super(module.getProject(), title, CloudSupportConfigurableBase.this.getServer());
- }
- }
-}
diff --git a/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/BasicDebuggerViewSupport.java b/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/BasicDebuggerViewSupport.java
index 53fa54a3e9c3..a5cf778db7e2 100644
--- a/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/BasicDebuggerViewSupport.java
+++ b/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/BasicDebuggerViewSupport.java
@@ -106,4 +106,9 @@ public class BasicDebuggerViewSupport implements DebuggerViewSupport, MemberFilt
public Value transformErrorOnGetUsedReferenceValue(@Nullable Value value, @Nullable String error) {
return value;
}
+
+ @Override
+ public boolean isInLibraryContent(@NotNull SourceInfo sourceInfo, @Nullable Script script) {
+ return false;
+ }
} \ No newline at end of file
diff --git a/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/DebuggerViewSupport.java b/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/DebuggerViewSupport.java
index cf24d062cada..d341dda0bec1 100644
--- a/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/DebuggerViewSupport.java
+++ b/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/DebuggerViewSupport.java
@@ -56,4 +56,6 @@ public interface DebuggerViewSupport {
@Nullable
Value transformErrorOnGetUsedReferenceValue(@Nullable Value value, @Nullable String error);
+
+ boolean isInLibraryContent(@NotNull SourceInfo sourceInfo, @Nullable Script script);
} \ No newline at end of file
diff --git a/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/VariableView.java b/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/VariableView.java
index 352b67351f63..ada850da074b 100644
--- a/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/VariableView.java
+++ b/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/VariableView.java
@@ -164,7 +164,7 @@ public final class VariableView extends XNamedValue implements VariableContext {
if (!node.isObsolete()) {
value = getViewSupport().transformErrorOnGetUsedReferenceValue(value, error);
if (value == null) {
- node.setPresentation(getIcon(), null, error, false);
+ node.setPresentation(AllIcons.Debugger.Db_primitive, null, error, false);
}
else {
VariableView.this.value = value;
diff --git a/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/frame/CallFrameView.java b/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/frame/CallFrameView.java
index eb698e685403..3cb993a01194 100644
--- a/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/frame/CallFrameView.java
+++ b/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/frame/CallFrameView.java
@@ -16,6 +16,8 @@ public final class CallFrameView extends StackFrameImplBase implements VariableC
private final Script script;
+ private final boolean inLibraryContent;
+
public CallFrameView(@NotNull CallFrame callFrame, @NotNull DebuggerViewSupport debugProcess, @Nullable Script script) {
this(callFrame, debugProcess.getSourceInfo(script, callFrame), debugProcess, script);
}
@@ -29,6 +31,9 @@ public final class CallFrameView extends StackFrameImplBase implements VariableC
this.debugProcess = debugProcess;
this.callFrame = callFrame;
this.script = script;
+
+ // isInLibraryContent call could be costly, so we compute it only once (our customizePresentation called on each repaint)
+ inLibraryContent = sourceInfo != null && debugProcess.isInLibraryContent(sourceInfo, script);
}
@Override
@@ -48,6 +53,11 @@ public final class CallFrameView extends StackFrameImplBase implements VariableC
}
@Override
+ protected boolean isInLibraryContent() {
+ return inLibraryContent;
+ }
+
+ @Override
protected void customizeInvalidFramePresentation(ColoredTextContainer component) {
assert sourceInfo == null;
diff --git a/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/frame/StackFrameImplBase.java b/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/frame/StackFrameImplBase.java
index adc67ba57ba8..fb4e8771a48b 100644
--- a/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/frame/StackFrameImplBase.java
+++ b/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/frame/StackFrameImplBase.java
@@ -38,6 +38,10 @@ public abstract class StackFrameImplBase extends XStackFrame {
return false;
}
+ protected boolean isInLibraryContent() {
+ return false;
+ }
+
@Override
public final void customizePresentation(@NotNull ColoredTextContainer component) {
if (sourceInfo == null) {
@@ -48,18 +52,21 @@ public abstract class StackFrameImplBase extends XStackFrame {
String fileName = sourceInfo.getFile().getName();
int line = sourceInfo.getLine() + 1;
+ boolean isInLibraryContent = isInLibraryContent();
+ SimpleTextAttributes textAttributes = isInLibraryContent ? SimpleTextAttributes.GRAYED_ATTRIBUTES : SimpleTextAttributes.REGULAR_ATTRIBUTES;
+
String functionName = sourceInfo.getFunctionName();
if (functionName == null || (functionName.isEmpty() && isInFileScope())) {
- component.append(fileName + ":" + line, SimpleTextAttributes.REGULAR_ATTRIBUTES);
+ component.append(fileName + ":" + line, textAttributes);
}
else {
if (functionName.isEmpty()) {
- component.append("anonymous", SimpleTextAttributes.REGULAR_ITALIC_ATTRIBUTES);
+ component.append("anonymous", isInLibraryContent ? SimpleTextAttributes.GRAYED_ITALIC_ATTRIBUTES : SimpleTextAttributes.REGULAR_ITALIC_ATTRIBUTES);
}
else {
- component.append(functionName, SimpleTextAttributes.REGULAR_ATTRIBUTES);
+ component.append(functionName, textAttributes);
}
- component.append("(), " + fileName + ":" + line, SimpleTextAttributes.REGULAR_ATTRIBUTES);
+ component.append("(), " + fileName + ":" + line, textAttributes);
}
component.setIcon(AllIcons.Debugger.StackFrame);
}
diff --git a/platform/structuralsearch/build.xml b/platform/structuralsearch/build.xml
new file mode 100644
index 000000000000..4472cf7ab550
--- /dev/null
+++ b/platform/structuralsearch/build.xml
@@ -0,0 +1,53 @@
+<project name="StructuralSearchPlugin" default="jar_plugin" basedir="">
+ <property name="plugname" value="StructuralSearchPlugin"/>
+ <property name="releasePlugname" value="SS"/>
+ <property name="build.path" value="${project.path}/build_out"/>
+ <property name="version" value="0.7.0.1"/>
+ <property name="description" value="This is experimental yet useful plugin for searching source code
+ in terms of java syntax (query code by example :-). It is intended to be used for:
+ &amp;lt;LI&amp;gt;understanding new libraries, finding highlevel code patterns (singletons, serialization implementation,
+ Struts actions, ejbs, servlets, filters, source metadata, etc), analyzing
+ opportunities for aspect refactoring (finding exception handling, methods with
+ specific signatures and structure, etc). For instance, for exploring source code of JDK 1.5 with Aurora
+ one could use search to find added entities (classes, methods, etc), generic classes, methods and declarations or just
+ parameterized symbols. Note, that the plugin could miss some generic stuff that is not supported by Aurora (e.g. anonymous typed vars).
+ &amp;lt;LI&amp;gt; finding expressions, statements or group of statements regardsless of particular whitespace indentation.
+ This could be useful e.g. after applying extract method refactoring to find the other occurences the such extracted code.
+ &amp;lt;LI&amp;gt;Find code fragments (symbols, references, constants) like given pattern.
+ &amp;lt;BR&amp;gt;Warning, the plugin is PSI dependent, works with 1156 and 706" />
+ <target name="clean">
+ <delete includeEmptyDirs="true" failonerror="false">
+ <fileset dir="${build.path}" includes="**/*.class,**/*.html,META-INF/*.xml,META-INF/*.txt"/>
+ </delete>
+ <mkdir dir="${build.path}"/>
+ </target>
+ <target name="copy_files">
+ <copy todir="${build.path}/META-INF" >
+ <fileset dir="${project.path}/META-INF" includes="plugin.xml,version.txt"/>
+ </copy>
+ <copy todir="${build.path}/resources">
+ <fileset dir="${project.path}/resources"/>
+ </copy>
+ <copy todir="${build.path}">
+ <fileset dir="${project.path}/classes" includes="**/*.class">
+ </fileset>
+ </copy>
+ </target>
+
+ <target name="version" depends="copy_files">
+ <replace dir="${build.path}" includes="**/*.xml **/*.html **/*.txt">
+ <replacefilter token="@PLUGIN.VERSION@" value="${version}"/>
+ <replacefilter token="@PLUGIN.DESCRIPTION@" value="${description}"/>
+ </replace>
+ </target>
+ <target name="jar_plugin" depends="clean,copy_files,version" >
+
+ <jar jarfile="${build.path}/${plugname}.jar" basedir="${build.path}"
+ excludes="${plugname}.jar"
+ />
+
+ <copy todir="${idea.path}/debug/plugins">
+ <fileset dir="${build.path}" includes="*.jar" />
+ </copy>
+ </target>
+</project>
diff --git a/platform/structuralsearch/source/META-INF/structuralsearch.xml b/platform/structuralsearch/source/META-INF/structuralsearch.xml
new file mode 100644
index 000000000000..d42c61a3c073
--- /dev/null
+++ b/platform/structuralsearch/source/META-INF/structuralsearch.xml
@@ -0,0 +1,39 @@
+<idea-plugin>
+ <extensionPoints>
+ <extensionPoint qualifiedName="com.intellij.structuralsearch.profile"
+ interface="com.intellij.structuralsearch.StructuralSearchProfile"/>
+ <extensionPoint qualifiedName="com.intellij.tokenindex.tokenizer" beanClass="com.intellij.lang.LanguageExtensionPoint"/>
+ <extensionPoint qualifiedName="com.intellij.structuralsearch.matchPredicateProvider"
+ interface="com.intellij.structuralsearch.impl.matcher.MatchPredicateProvider"/>
+ </extensionPoints>
+
+ <extensions defaultExtensionNs="com.intellij">
+ <errorHandler implementation="com.intellij.diagnostic.ITNReporter"/>
+ <localInspection shortName="SSBasedInspection" bundle="messages.SSRBundle" key="SSRInspection.display.name" groupName="General"
+ enabledByDefault="false" level="WARNING"
+ implementationClass="com.intellij.structuralsearch.inspection.highlightTemplate.SSBasedInspection"/>
+ <postStartupActivity
+ implementation="com.intellij.structuralsearch.inspection.highlightTemplate.SSBasedInspectionCompiledPatternsCache"/>
+ <!--<fileBasedIndex implementation="com.intellij.tokenindex.TokenIndex"/>-->
+ <structuralsearch.profile implementation="com.intellij.structuralsearch.XmlStructuralSearchProfile"/>
+ </extensions>
+
+ <project-components>
+ <component>
+ <implementation-class>com.intellij.structuralsearch.plugin.StructuralSearchPlugin</implementation-class>
+ <option name="workspace" value="true"/>
+ </component>
+ </project-components>
+
+ <actions>
+ <group id="StructuralSearchActions">
+ <action id="StructuralSearchPlugin.StructuralSearchAction" class="com.intellij.structuralsearch.plugin.StructuralSearchAction">
+ <add-to-group group-id="FindMenuGroup" anchor="after" relative-to-action="ReplaceInPath"/>
+ </action>
+
+ <action id="StructuralSearchPlugin.StructuralReplaceAction" class="com.intellij.structuralsearch.plugin.StructuralReplaceAction">
+ <add-to-group group-id="FindMenuGroup" anchor="after" relative-to-action="StructuralSearchPlugin.StructuralSearchAction"/>
+ </action>
+ </group>
+ </actions>
+</idea-plugin>
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/DocumentBasedReplaceHandler.java b/platform/structuralsearch/source/com/intellij/structuralsearch/DocumentBasedReplaceHandler.java
index 1f319b8f15e5..1f319b8f15e5 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/DocumentBasedReplaceHandler.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/DocumentBasedReplaceHandler.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/MalformedPatternException.java b/platform/structuralsearch/source/com/intellij/structuralsearch/MalformedPatternException.java
index e73eddc19550..e73eddc19550 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/MalformedPatternException.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/MalformedPatternException.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/MatchOptions.java b/platform/structuralsearch/source/com/intellij/structuralsearch/MatchOptions.java
index fb22f39990fa..fb22f39990fa 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/MatchOptions.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/MatchOptions.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/MatchResult.java b/platform/structuralsearch/source/com/intellij/structuralsearch/MatchResult.java
index c5196e67178d..c5196e67178d 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/MatchResult.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/MatchResult.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/MatchResultSink.java b/platform/structuralsearch/source/com/intellij/structuralsearch/MatchResultSink.java
index 8a4fdf968a8c..8a4fdf968a8c 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/MatchResultSink.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/MatchResultSink.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/MatchVariableConstraint.java b/platform/structuralsearch/source/com/intellij/structuralsearch/MatchVariableConstraint.java
index db2aaa901c54..db2aaa901c54 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/MatchVariableConstraint.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/MatchVariableConstraint.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/Matcher.java b/platform/structuralsearch/source/com/intellij/structuralsearch/Matcher.java
index 594686e14d49..594686e14d49 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/Matcher.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/Matcher.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/MatchingProcess.java b/platform/structuralsearch/source/com/intellij/structuralsearch/MatchingProcess.java
index 6ecb42d800c3..6ecb42d800c3 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/MatchingProcess.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/MatchingProcess.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/NamedScriptableDefinition.java b/platform/structuralsearch/source/com/intellij/structuralsearch/NamedScriptableDefinition.java
index 8c954ab5a0ef..8c954ab5a0ef 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/NamedScriptableDefinition.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/NamedScriptableDefinition.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/PredefinedConfigurationUtil.java b/platform/structuralsearch/source/com/intellij/structuralsearch/PredefinedConfigurationUtil.java
index 6e14ce437025..6e14ce437025 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/PredefinedConfigurationUtil.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/PredefinedConfigurationUtil.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/ReplacementVariableDefinition.java b/platform/structuralsearch/source/com/intellij/structuralsearch/ReplacementVariableDefinition.java
index 1010db48c1f8..1010db48c1f8 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/ReplacementVariableDefinition.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/ReplacementVariableDefinition.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/SSRBundle.java b/platform/structuralsearch/source/com/intellij/structuralsearch/SSRBundle.java
index 8ef278154b24..8ef278154b24 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/SSRBundle.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/SSRBundle.java
diff --git a/platform/structuralsearch/source/com/intellij/structuralsearch/StructuralReplaceHandler.java b/platform/structuralsearch/source/com/intellij/structuralsearch/StructuralReplaceHandler.java
new file mode 100644
index 000000000000..2a9bf219fe37
--- /dev/null
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/StructuralReplaceHandler.java
@@ -0,0 +1,16 @@
+package com.intellij.structuralsearch;
+
+import com.intellij.psi.PsiElement;
+import com.intellij.structuralsearch.plugin.replace.ReplaceOptions;
+import com.intellij.structuralsearch.plugin.replace.ReplacementInfo;
+
+/**
+ * @author Eugene.Kudelevsky
+ */
+public abstract class StructuralReplaceHandler {
+ public abstract void replace(final ReplacementInfo info, ReplaceOptions options);
+
+ public void prepare(ReplacementInfo info) {}
+
+ public void postProcess(PsiElement affectedElement, ReplaceOptions options) {}
+}
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/StructuralSearchException.java b/platform/structuralsearch/source/com/intellij/structuralsearch/StructuralSearchException.java
index f925285054f0..f925285054f0 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/StructuralSearchException.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/StructuralSearchException.java
diff --git a/platform/structuralsearch/source/com/intellij/structuralsearch/StructuralSearchProfile.java b/platform/structuralsearch/source/com/intellij/structuralsearch/StructuralSearchProfile.java
new file mode 100644
index 000000000000..e40683dce04e
--- /dev/null
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/StructuralSearchProfile.java
@@ -0,0 +1,281 @@
+package com.intellij.structuralsearch;
+
+import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer;
+import com.intellij.codeInsight.template.TemplateContextType;
+import com.intellij.lang.Language;
+import com.intellij.openapi.editor.Document;
+import com.intellij.openapi.editor.Editor;
+import com.intellij.openapi.editor.EditorFactory;
+import com.intellij.openapi.editor.ex.EditorEx;
+import com.intellij.openapi.extensions.ExtensionPointName;
+import com.intellij.openapi.fileTypes.FileType;
+import com.intellij.openapi.fileTypes.LanguageFileType;
+import com.intellij.openapi.project.Project;
+import com.intellij.psi.*;
+import com.intellij.structuralsearch.impl.matcher.CompiledPattern;
+import com.intellij.structuralsearch.impl.matcher.GlobalMatchingVisitor;
+import com.intellij.structuralsearch.impl.matcher.PatternTreeContext;
+import com.intellij.structuralsearch.impl.matcher.compiler.GlobalCompilingVisitor;
+import com.intellij.structuralsearch.impl.matcher.filters.LexicalNodesFilter;
+import com.intellij.structuralsearch.plugin.replace.ReplaceOptions;
+import com.intellij.structuralsearch.plugin.replace.impl.ParameterInfo;
+import com.intellij.structuralsearch.plugin.replace.impl.ReplacementBuilder;
+import com.intellij.structuralsearch.plugin.replace.impl.ReplacementContext;
+import com.intellij.structuralsearch.plugin.replace.impl.Replacer;
+import com.intellij.structuralsearch.plugin.ui.Configuration;
+import com.intellij.structuralsearch.plugin.ui.SearchContext;
+import com.intellij.structuralsearch.plugin.ui.UIUtil;
+import com.intellij.util.ArrayUtil;
+import com.intellij.util.LocalTimeCounter;
+import com.intellij.util.containers.ContainerUtil;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+
+/**
+ * @author Eugene.Kudelevsky
+ */
+public abstract class StructuralSearchProfile {
+ public static final ExtensionPointName<StructuralSearchProfile> EP_NAME =
+ ExtensionPointName.create("com.intellij.structuralsearch.profile");
+
+ public abstract void compile(PsiElement[] elements, @NotNull GlobalCompilingVisitor globalVisitor);
+
+ @NotNull
+ public abstract PsiElementVisitor createMatchingVisitor(@NotNull GlobalMatchingVisitor globalVisitor);
+
+ @NotNull
+ public abstract PsiElementVisitor getLexicalNodesFilter(@NotNull LexicalNodesFilter filter);
+
+ @NotNull
+ public abstract CompiledPattern createCompiledPattern();
+
+ public static String getTypeName(FileType fileType) {
+ return fileType.getName().toLowerCase();
+ }
+
+ public abstract boolean canProcess(@NotNull FileType fileType);
+
+ public abstract boolean isMyLanguage(@NotNull Language language);
+
+ public boolean isMyFile(PsiFile file, @NotNull Language language, Language... patternLanguages) {
+ if (isMyLanguage(language) && ArrayUtil.find(patternLanguages, language) >= 0) {
+ return true;
+ }
+ return false;
+ }
+
+ @NotNull
+ public PsiElement[] createPatternTree(@NotNull String text,
+ @NotNull PatternTreeContext context,
+ @NotNull FileType fileType,
+ @Nullable Language language,
+ @Nullable String contextName,
+ @Nullable String extension,
+ @NotNull Project project,
+ boolean physical) {
+ final String ext = extension != null ? extension : fileType.getDefaultExtension();
+ final String name = "__dummy." + ext;
+ final PsiFileFactory factory = PsiFileFactory.getInstance(project);
+
+ final PsiFile file = language == null
+ ? factory.createFileFromText(name, fileType, text, LocalTimeCounter.currentTime(), physical, true)
+ : factory.createFileFromText(name, language, text, physical, true);
+
+ return file != null ? file.getChildren() : PsiElement.EMPTY_ARRAY;
+ }
+
+ @NotNull
+ public PsiElement[] createPatternTree(@NotNull String text,
+ @NotNull PatternTreeContext context,
+ @NotNull FileType fileType,
+ @NotNull Project project,
+ boolean physical) {
+ return createPatternTree(text, context, fileType, null, null, null, project, physical);
+ }
+
+ @NotNull
+ public Editor createEditor(@NotNull SearchContext searchContext,
+ @NotNull FileType fileType,
+ Language dialect,
+ String text,
+ boolean useLastConfiguration) {
+ PsiFile codeFragment = createCodeFragment(searchContext.getProject(), text, null);
+ if (codeFragment == null) {
+ codeFragment = createFileFragment(searchContext, fileType, dialect, text);
+ }
+
+ if (codeFragment != null) {
+ final Document doc = PsiDocumentManager.getInstance(searchContext.getProject()).getDocument(codeFragment);
+ assert doc != null : "code fragment element should be physical";
+ DaemonCodeAnalyzer.getInstance(searchContext.getProject()).setHighlightingEnabled(codeFragment, false);
+ return UIUtil.createEditor(doc, searchContext.getProject(), true, true, getTemplateContextType());
+ }
+
+ final EditorFactory factory = EditorFactory.getInstance();
+ final Document document = factory.createDocument(text);
+ final EditorEx editor = (EditorEx)factory.createEditor(document, searchContext.getProject());
+ editor.getSettings().setFoldingOutlineShown(false);
+ return editor;
+ }
+
+ private static PsiFile createFileFragment(SearchContext searchContext, FileType fileType, Language dialect, String text) {
+ final String name = "__dummy." + fileType.getDefaultExtension();
+ final PsiFileFactory factory = PsiFileFactory.getInstance(searchContext.getProject());
+
+ return dialect == null ?
+ factory.createFileFromText(name, fileType, text, LocalTimeCounter.currentTime(), true, true) :
+ factory.createFileFromText(name, dialect, text, true, true);
+ }
+
+ @Nullable
+ public PsiCodeFragment createCodeFragment(Project project, String text, @Nullable PsiElement context) {
+ return null;
+ }
+
+ @Nullable
+ public Class<? extends TemplateContextType> getTemplateContextTypeClass() {
+ return null;
+ }
+
+ public final TemplateContextType getTemplateContextType() {
+ final Class<? extends TemplateContextType> clazz = getTemplateContextTypeClass();
+ return clazz != null ? ContainerUtil.findInstance(TemplateContextType.EP_NAME.getExtensions(), clazz) : null;
+ }
+
+ @Nullable
+ public FileType detectFileType(@NotNull PsiElement context) {
+ return null;
+ }
+
+ @Nullable
+ public StructuralReplaceHandler getReplaceHandler(@NotNull ReplacementContext context) {
+ return null;
+ }
+
+ public void checkSearchPattern(Project project, MatchOptions options) {
+ }
+
+ public void checkReplacementPattern(Project project, ReplaceOptions options) {
+ String fileType = getTypeName(options.getMatchOptions().getFileType());
+ throw new UnsupportedPatternException(SSRBundle.message("replacement.not.supported.for.filetype", fileType));
+ }
+
+ @NotNull
+ public Language getLanguage(PsiElement element) {
+ return element.getLanguage();
+ }
+
+ // only for nodes not filtered by lexical-nodes filter; they can be by default
+ public boolean canBeVarDelimeter(@NotNull PsiElement element) {
+ return false;
+ }
+
+ public String getText(PsiElement match, int start, int end) {
+ final String matchText = match.getText();
+ if (start==0 && end==-1) return matchText;
+ return matchText.substring(start, end == -1 ? matchText.length() : end);
+ }
+
+ public Class getElementContextByPsi(PsiElement element) {
+ return element.getClass();
+ }
+
+ public String getTypedVarString(PsiElement element) {
+ if (element instanceof PsiNamedElement) {
+ return ((PsiNamedElement)element).getName();
+ }
+ return element.getText();
+ }
+
+ public String getMeaningfulText(PsiElement element) {
+ return getTypedVarString(element);
+ }
+
+ public PsiElement updateCurrentNode(PsiElement node) {
+ return node;
+ }
+
+ public PsiElement extendMatchedByDownUp(PsiElement node) {
+ return node;
+ }
+
+ public PsiElement extendMatchOnePsiFile(PsiElement file) {
+ return file;
+ }
+
+ public LanguageFileType getDefaultFileType(@Nullable LanguageFileType fileType) {
+ return fileType;
+ }
+
+ Configuration[] getPredefinedTemplates() {
+ return Configuration.EMPTY_ARRAY;
+ }
+
+ public void provideAdditionalReplaceOptions(@NotNull PsiElement node, ReplaceOptions options, ReplacementBuilder builder) {}
+
+ public int handleSubstitution(final ParameterInfo info,
+ MatchResult match,
+ StringBuilder result,
+ int offset,
+ HashMap<String, MatchResult> matchMap) {
+ return defaultHandleSubstitution(info, match, result, offset);
+ }
+
+ public static int defaultHandleSubstitution(ParameterInfo info, MatchResult match, StringBuilder result, int offset) {
+ if (info.getName().equals(match.getName())) {
+ String replacementString = match.getMatchImage();
+ boolean forceAddingNewLine = false;
+ if (match.getAllSons().size() > 0 && !match.isScopeMatch()) {
+ // compound matches
+ StringBuilder buf = new StringBuilder();
+
+ for (final MatchResult matchResult : match.getAllSons()) {
+ final PsiElement currentElement = matchResult.getMatch();
+
+ if (buf.length() > 0) {
+ if (info.isArgumentContext()) {
+ buf.append(',');
+ } else {
+ buf.append(' ');
+ }
+ }
+
+ buf.append(matchResult.getMatchImage());
+ forceAddingNewLine = currentElement instanceof PsiComment;
+ }
+ replacementString = buf.toString();
+ } else {
+ if (info.isStatementContext()) {
+ forceAddingNewLine = match.getMatch() instanceof PsiComment;
+ }
+ }
+
+ offset = Replacer.insertSubstitution(result, offset, info, replacementString);
+ if (forceAddingNewLine && info.isStatementContext()) {
+ result.insert(info.getStartIndex() + offset + 1, '\n');
+ offset ++;
+ }
+ }
+ return offset;
+ }
+
+ public int processAdditionalOptions(ParameterInfo info, int offset, StringBuilder result, MatchResult r) {
+ return offset;
+ }
+
+ public boolean isIdentifier(PsiElement element) {
+ return false;
+ }
+
+ public Collection<String> getReservedWords() {
+ return Collections.emptySet();
+ }
+
+ public boolean isDocCommentOwner(PsiElement match) {
+ return false;
+ }
+}
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/StructuralSearchProfileBase.java b/platform/structuralsearch/source/com/intellij/structuralsearch/StructuralSearchProfileBase.java
index 9e9496115809..9e9496115809 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/StructuralSearchProfileBase.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/StructuralSearchProfileBase.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/StructuralSearchUtil.java b/platform/structuralsearch/source/com/intellij/structuralsearch/StructuralSearchUtil.java
index b37c10143636..b37c10143636 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/StructuralSearchUtil.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/StructuralSearchUtil.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/UnsupportedPatternException.java b/platform/structuralsearch/source/com/intellij/structuralsearch/UnsupportedPatternException.java
index 1236264118c2..1236264118c2 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/UnsupportedPatternException.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/UnsupportedPatternException.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/XmlStructuralSearchProfile.java b/platform/structuralsearch/source/com/intellij/structuralsearch/XmlStructuralSearchProfile.java
index 5e0ca8bde957..5e0ca8bde957 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/XmlStructuralSearchProfile.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/XmlStructuralSearchProfile.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/CompiledPattern.java b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/CompiledPattern.java
index 565f80ac01ce..565f80ac01ce 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/CompiledPattern.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/CompiledPattern.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/DataProvider.java b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/DataProvider.java
index e7327fad7e5e..e7327fad7e5e 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/DataProvider.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/DataProvider.java
diff --git a/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/GlobalMatchingVisitor.java b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/GlobalMatchingVisitor.java
new file mode 100644
index 000000000000..5577db0d8540
--- /dev/null
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/GlobalMatchingVisitor.java
@@ -0,0 +1,315 @@
+package com.intellij.structuralsearch.impl.matcher;
+
+import com.intellij.dupLocator.AbstractMatchingVisitor;
+import com.intellij.dupLocator.iterators.NodeIterator;
+import com.intellij.dupLocator.util.NodeFilter;
+import com.intellij.lang.Language;
+import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.psi.PsiElement;
+import com.intellij.psi.PsiElementVisitor;
+import com.intellij.structuralsearch.MatchResult;
+import com.intellij.structuralsearch.StructuralSearchProfile;
+import com.intellij.structuralsearch.StructuralSearchUtil;
+import com.intellij.structuralsearch.impl.matcher.filters.LexicalNodesFilter;
+import com.intellij.structuralsearch.impl.matcher.handlers.DelegatingHandler;
+import com.intellij.structuralsearch.impl.matcher.handlers.MatchingHandler;
+import com.intellij.structuralsearch.impl.matcher.handlers.SubstitutionHandler;
+import com.intellij.structuralsearch.plugin.ui.Configuration;
+import com.intellij.structuralsearch.plugin.util.SmartPsiPointer;
+import com.intellij.util.containers.HashMap;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Visitor class to manage pattern matching
+ */
+@SuppressWarnings({"RefusedBequest"})
+public class GlobalMatchingVisitor extends AbstractMatchingVisitor {
+ private static final Logger LOG = Logger.getInstance("#com.intellij.structuralsearch.impl.matcher.GlobalMatchingVisitor");
+
+ // the pattern element for visitor check
+ private PsiElement myElement;
+
+ // the result of matching in visitor
+ private boolean myResult;
+
+ // context of matching
+ private MatchContext matchContext;
+
+ private MatchingHandler myLastHandler;
+
+ private Map<Language, PsiElementVisitor> myLanguage2MatchingVisitor = new HashMap<Language, PsiElementVisitor>(1);
+
+ public PsiElement getElement() {
+ return myElement;
+ }
+
+ public boolean getResult() {
+ return myResult;
+ }
+
+ public void setResult(boolean result) {
+ this.myResult = result;
+ }
+
+ public MatchContext getMatchContext() {
+ return matchContext;
+ }
+
+ @Override
+ protected boolean doMatchInAnyOrder(NodeIterator elements, NodeIterator elements2) {
+ return matchContext.getPattern().getHandler(elements.current()).matchInAnyOrder(
+ elements,
+ elements2,
+ matchContext
+ );
+ }
+
+ @NotNull
+ @Override
+ protected NodeFilter getNodeFilter() {
+ return LexicalNodesFilter.getInstance();
+ }
+
+ public final boolean handleTypedElement(final PsiElement typedElement, final PsiElement match) {
+ MatchingHandler handler = matchContext.getPattern().getHandler(typedElement);
+ final MatchingHandler initialHandler = handler;
+ if (handler instanceof DelegatingHandler) {
+ handler = ((DelegatingHandler)handler).getDelegate();
+ }
+ assert handler instanceof SubstitutionHandler :
+ handler != null ? handler.getClass() : "null" + ' ' + (initialHandler != null ? initialHandler.getClass() : "null");
+
+ return ((SubstitutionHandler)handler).handle(match, matchContext);
+ }
+
+ /**
+ * Identifies the match between given element of program tree and pattern element
+ *
+ * @param el1 the pattern for matching
+ * @param el2 the tree element for matching
+ * @return true if equal and false otherwise
+ */
+ public boolean match(final PsiElement el1, final PsiElement el2) {
+ // null
+ if (el1 == el2) return true;
+ if (el2 == null || el1 == null) {
+ // this a bug!
+ return false;
+ }
+
+ // copy changed data to local stack
+ PsiElement prevElement = myElement;
+ myElement = el2;
+
+ try {
+ /*if (el1 instanceof XmlElement) {
+ el1.accept(myXmlVisitor);
+ }
+ else {
+ el1.accept(myJavaVisitor);
+ }*/
+ PsiElementVisitor visitor = getVisitorForElement(el1);
+ if (visitor != null) {
+ el1.accept(visitor);
+ }
+ }
+ catch (ClassCastException ex) {
+ myResult = false;
+ }
+ finally {
+ myElement = prevElement;
+ }
+
+ return myResult;
+ }
+
+ @Nullable
+ private PsiElementVisitor getVisitorForElement(PsiElement element) {
+ Language language = element.getLanguage();
+ PsiElementVisitor visitor = myLanguage2MatchingVisitor.get(language);
+ if (visitor == null) {
+ visitor = createMatchingVisitor(language);
+ myLanguage2MatchingVisitor.put(language, visitor);
+ }
+ return visitor;
+ }
+
+ @Nullable
+ private PsiElementVisitor createMatchingVisitor(Language language) {
+ StructuralSearchProfile profile = StructuralSearchUtil.getProfileByLanguage(language);
+ if (profile == null) {
+ LOG.warn("there is no StructuralSearchProfile for language " + language.getID());
+ return null;
+ }
+ else {
+ return profile.createMatchingVisitor(this);
+ }
+ }
+
+ /**
+ * Matches tree segments starting with given elements to find equality
+ *
+ * @param nodes the pattern element for matching
+ * @param nodes2 the tree element for matching
+ * @return if they are equal and false otherwise
+ */
+ public boolean matchSequentially(NodeIterator nodes, NodeIterator nodes2) {
+ if (!nodes.hasNext()) {
+ return nodes.hasNext() == nodes2.hasNext();
+ }
+
+ myLastHandler = matchContext.getPattern().getHandler(nodes.current());
+ return myLastHandler.matchSequentially(
+ nodes,
+ nodes2,
+ matchContext
+ );
+ }
+
+ public static boolean continueMatchingSequentially(final NodeIterator nodes, final NodeIterator nodes2, MatchContext matchContext) {
+ if (!nodes.hasNext()) {
+ return nodes.hasNext() == nodes2.hasNext();
+ }
+
+ return matchContext.getPattern().getHandler(nodes.current()).matchSequentially(
+ nodes,
+ nodes2,
+ matchContext
+ );
+ }
+
+ /**
+ * Descents the tree in depth finding matches
+ *
+ * @param elements the element for which the sons are looked for match
+ */
+ public void matchContext(final NodeIterator elements) {
+ final CompiledPattern pattern = matchContext.getPattern();
+ final NodeIterator patternNodes = pattern.getNodes().clone();
+ final MatchResultImpl saveResult = matchContext.hasResult() ? matchContext.getResult() : null;
+ final List<PsiElement> saveMatchedNodes = matchContext.getMatchedNodes();
+
+ try {
+ matchContext.setResult(null);
+ matchContext.setMatchedNodes(null);
+
+ if (!patternNodes.hasNext()) return;
+ final MatchingHandler firstMatchingHandler = pattern.getHandler(patternNodes.current());
+
+ for (; elements.hasNext(); elements.advance()) {
+ final PsiElement elementNode = elements.current();
+
+ boolean matched = firstMatchingHandler.matchSequentially(patternNodes, elements, matchContext);
+
+ if (matched) {
+ MatchingHandler matchingHandler = matchContext.getPattern().getHandler(Configuration.CONTEXT_VAR_NAME);
+ if (matchingHandler != null) {
+ matched = ((SubstitutionHandler)matchingHandler).handle(elementNode, matchContext);
+ }
+ }
+
+ final List<PsiElement> matchedNodes = matchContext.getMatchedNodes();
+
+ if (matched) {
+ dispatchMatched(matchedNodes, matchContext.getResult());
+ }
+
+ matchContext.setMatchedNodes(null);
+ matchContext.setResult(null);
+
+ patternNodes.reset();
+ if (matchedNodes != null && matchedNodes.size() > 0 && matched) {
+ elements.rewind();
+ }
+ }
+ }
+ finally {
+ matchContext.setResult(saveResult);
+ matchContext.setMatchedNodes(saveMatchedNodes);
+ }
+ }
+
+ private void dispatchMatched(final List<PsiElement> matchedNodes, MatchResultImpl result) {
+ if (!matchContext.getOptions().isResultIsContextMatch() && doDispatch(result, result)) return;
+
+ // There is no substitutions so show the context
+
+ processNoSubstitutionMatch(matchedNodes, result);
+ matchContext.getSink().newMatch(result);
+ }
+
+ private boolean doDispatch(final MatchResultImpl result, MatchResultImpl context) {
+ boolean ret = false;
+
+ for (MatchResult _r : result.getAllSons()) {
+ final MatchResultImpl r = (MatchResultImpl)_r;
+
+ if ((r.isScopeMatch() && !r.isTarget()) || r.isMultipleMatch()) {
+ ret |= doDispatch(r, context);
+ }
+ else if (r.isTarget()) {
+ r.setContext(context);
+ matchContext.getSink().newMatch(r);
+ ret = true;
+ }
+ }
+ return ret;
+ }
+
+ private static void processNoSubstitutionMatch(List<PsiElement> matchedNodes, MatchResultImpl result) {
+ boolean complexMatch = matchedNodes.size() > 1;
+ final PsiElement match = matchedNodes.get(0);
+
+ if (!complexMatch) {
+ result.setMatchRef(new SmartPsiPointer(match));
+ result.setMatchImage(match.getText());
+ }
+ else {
+ MatchResultImpl sonresult;
+
+ for (final PsiElement matchStatement : matchedNodes) {
+ result.getMatches().add(
+ sonresult = new MatchResultImpl(
+ MatchResult.LINE_MATCH,
+ matchStatement.getText(),
+ new SmartPsiPointer(matchStatement),
+ true
+ )
+ );
+
+ sonresult.setParent(result);
+ }
+
+ result.setMatchRef(
+ new SmartPsiPointer(match)
+ );
+ result.setMatchImage(
+ match.getText()
+ );
+ result.setName(MatchResult.MULTI_LINE_MATCH);
+ }
+ }
+
+ public void setMatchContext(MatchContext matchContext) {
+ this.matchContext = matchContext;
+ }
+
+ // Matches the sons of given elements to find equality
+ // @param el1 the pattern element for matching
+ // @param el2 the tree element for matching
+ // @return if they are equal and false otherwise
+
+ @Override
+ protected boolean isLeftLooseMatching() {
+ return matchContext.getOptions().isLooseMatching();
+ }
+
+ @Override
+ protected boolean isRightLooseMatching() {
+ return false;
+ }
+}
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/MatchConstraintsSink.java b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/MatchConstraintsSink.java
index 2036c83d56f4..2036c83d56f4 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/MatchConstraintsSink.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/MatchConstraintsSink.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/MatchContext.java b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/MatchContext.java
index c4c8d21e3ab3..c4c8d21e3ab3 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/MatchContext.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/MatchContext.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/MatchPredicateProvider.java b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/MatchPredicateProvider.java
index b75ffb5d0f5d..b75ffb5d0f5d 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/MatchPredicateProvider.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/MatchPredicateProvider.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/MatchResultImpl.java b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/MatchResultImpl.java
index 8761472d813a..8761472d813a 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/MatchResultImpl.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/MatchResultImpl.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/MatchUtils.java b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/MatchUtils.java
index 38c31d16524f..38c31d16524f 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/MatchUtils.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/MatchUtils.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/MatcherImpl.java b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/MatcherImpl.java
index d667b068ee48..d667b068ee48 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/MatcherImpl.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/MatcherImpl.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/MatcherImplUtil.java b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/MatcherImplUtil.java
index ffc9ae78e876..ffc9ae78e876 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/MatcherImplUtil.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/MatcherImplUtil.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/PatternTreeContext.java b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/PatternTreeContext.java
index 7d93c9ae82e0..7d93c9ae82e0 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/PatternTreeContext.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/PatternTreeContext.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/XmlCompiledPattern.java b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/XmlCompiledPattern.java
index 0c9f4945e3a5..0c9f4945e3a5 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/XmlCompiledPattern.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/XmlCompiledPattern.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/XmlMatchingVisitor.java b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/XmlMatchingVisitor.java
index d2e1e210534b..d2e1e210534b 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/XmlMatchingVisitor.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/XmlMatchingVisitor.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/compiler/CompileContext.java b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/compiler/CompileContext.java
index 09758a5e2191..09758a5e2191 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/compiler/CompileContext.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/compiler/CompileContext.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/compiler/DeleteNodesAction.java b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/compiler/DeleteNodesAction.java
index 4b5ad7c64545..4b5ad7c64545 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/compiler/DeleteNodesAction.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/compiler/DeleteNodesAction.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/compiler/FindInFilesOptimizingSearchHelper.java b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/compiler/FindInFilesOptimizingSearchHelper.java
index ff7f06a36d5b..ff7f06a36d5b 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/compiler/FindInFilesOptimizingSearchHelper.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/compiler/FindInFilesOptimizingSearchHelper.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/compiler/GlobalCompilingVisitor.java b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/compiler/GlobalCompilingVisitor.java
index 130751adec67..130751adec67 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/compiler/GlobalCompilingVisitor.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/compiler/GlobalCompilingVisitor.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/compiler/OptimizingSearchHelper.java b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/compiler/OptimizingSearchHelper.java
index 8d6a08b6ef95..8d6a08b6ef95 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/compiler/OptimizingSearchHelper.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/compiler/OptimizingSearchHelper.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/compiler/OptimizingSearchHelperBase.java b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/compiler/OptimizingSearchHelperBase.java
index 2d6f2bc41b37..2d6f2bc41b37 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/compiler/OptimizingSearchHelperBase.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/compiler/OptimizingSearchHelperBase.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/compiler/PatternCompiler.java b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/compiler/PatternCompiler.java
index e290ebb70793..e290ebb70793 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/compiler/PatternCompiler.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/compiler/PatternCompiler.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/compiler/StringToConstraintsTransformer.java b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/compiler/StringToConstraintsTransformer.java
index 0d684503a14d..0d684503a14d 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/compiler/StringToConstraintsTransformer.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/compiler/StringToConstraintsTransformer.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/compiler/TestModeOptimizingSearchHelper.java b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/compiler/TestModeOptimizingSearchHelper.java
index e341b57da8ce..e341b57da8ce 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/compiler/TestModeOptimizingSearchHelper.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/compiler/TestModeOptimizingSearchHelper.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/compiler/XmlCompilingVisitor.java b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/compiler/XmlCompilingVisitor.java
index 99917ad23240..99917ad23240 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/compiler/XmlCompilingVisitor.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/compiler/XmlCompilingVisitor.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/filters/CompositeFilter.java b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/filters/CompositeFilter.java
index db962ed8edf1..db962ed8edf1 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/filters/CompositeFilter.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/filters/CompositeFilter.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/filters/DefaultFilter.java b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/filters/DefaultFilter.java
index 267f37699945..267f37699945 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/filters/DefaultFilter.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/filters/DefaultFilter.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/filters/LexicalNodesFilter.java b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/filters/LexicalNodesFilter.java
index 3cef402b09d3..3cef402b09d3 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/filters/LexicalNodesFilter.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/filters/LexicalNodesFilter.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/filters/TagValueFilter.java b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/filters/TagValueFilter.java
index 97ed9627e3fc..97ed9627e3fc 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/filters/TagValueFilter.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/filters/TagValueFilter.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/filters/XmlLexicalNodesFilter.java b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/filters/XmlLexicalNodesFilter.java
index 89c295ce1d80..89c295ce1d80 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/filters/XmlLexicalNodesFilter.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/filters/XmlLexicalNodesFilter.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/handlers/DelegatingHandler.java b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/handlers/DelegatingHandler.java
index c95a85623753..c95a85623753 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/handlers/DelegatingHandler.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/handlers/DelegatingHandler.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/handlers/LightTopLevelMatchingHandler.java b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/handlers/LightTopLevelMatchingHandler.java
index 34941cfa0257..34941cfa0257 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/handlers/LightTopLevelMatchingHandler.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/handlers/LightTopLevelMatchingHandler.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/handlers/LiteralWithSubstitutionHandler.java b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/handlers/LiteralWithSubstitutionHandler.java
index 78967106755f..78967106755f 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/handlers/LiteralWithSubstitutionHandler.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/handlers/LiteralWithSubstitutionHandler.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/handlers/MatchPredicate.java b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/handlers/MatchPredicate.java
index cba96681ab71..cba96681ab71 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/handlers/MatchPredicate.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/handlers/MatchPredicate.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/handlers/MatchingHandler.java b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/handlers/MatchingHandler.java
index c53b08412b6b..c53b08412b6b 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/handlers/MatchingHandler.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/handlers/MatchingHandler.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/handlers/SimpleHandler.java b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/handlers/SimpleHandler.java
index 3dffe792e308..3dffe792e308 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/handlers/SimpleHandler.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/handlers/SimpleHandler.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/handlers/SkippingHandler.java b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/handlers/SkippingHandler.java
index 389c4a7916c2..389c4a7916c2 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/handlers/SkippingHandler.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/handlers/SkippingHandler.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/handlers/SubstitutionHandler.java b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/handlers/SubstitutionHandler.java
index 0c84e3bb2436..0c84e3bb2436 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/handlers/SubstitutionHandler.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/handlers/SubstitutionHandler.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/handlers/SymbolHandler.java b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/handlers/SymbolHandler.java
index 4d1f9a852940..4d1f9a852940 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/handlers/SymbolHandler.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/handlers/SymbolHandler.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/handlers/TopLevelMatchingHandler.java b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/handlers/TopLevelMatchingHandler.java
index 6711bcb1fc7f..6711bcb1fc7f 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/handlers/TopLevelMatchingHandler.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/handlers/TopLevelMatchingHandler.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/handlers/TypedSymbolHandler.java b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/handlers/TypedSymbolHandler.java
index 08e335614d5a..08e335614d5a 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/handlers/TypedSymbolHandler.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/handlers/TypedSymbolHandler.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/handlers/XmlTextHandler.java b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/handlers/XmlTextHandler.java
index cc71c02ee403..cc71c02ee403 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/handlers/XmlTextHandler.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/handlers/XmlTextHandler.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/iterators/SsrFilteringNodeIterator.java b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/iterators/SsrFilteringNodeIterator.java
index a2b14ae83e17..a2b14ae83e17 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/iterators/SsrFilteringNodeIterator.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/iterators/SsrFilteringNodeIterator.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/predicates/AbstractStringBasedPredicate.java b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/predicates/AbstractStringBasedPredicate.java
index 916fc1e15639..916fc1e15639 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/predicates/AbstractStringBasedPredicate.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/predicates/AbstractStringBasedPredicate.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/predicates/BinaryPredicate.java b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/predicates/BinaryPredicate.java
index b7d5432964d4..b7d5432964d4 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/predicates/BinaryPredicate.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/predicates/BinaryPredicate.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/predicates/ContainsPredicate.java b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/predicates/ContainsPredicate.java
index 2ed894fe6b64..2ed894fe6b64 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/predicates/ContainsPredicate.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/predicates/ContainsPredicate.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/predicates/NotPredicate.java b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/predicates/NotPredicate.java
index 3d28a635e3af..3d28a635e3af 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/predicates/NotPredicate.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/predicates/NotPredicate.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/predicates/ReferencePredicate.java b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/predicates/ReferencePredicate.java
index 17570ed8f5df..17570ed8f5df 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/predicates/ReferencePredicate.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/predicates/ReferencePredicate.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/predicates/RegExpPredicate.java b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/predicates/RegExpPredicate.java
index f7b8ecedcf3d..f7b8ecedcf3d 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/predicates/RegExpPredicate.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/predicates/RegExpPredicate.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/predicates/ScriptPredicate.java b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/predicates/ScriptPredicate.java
index 9310eb9e70a0..9310eb9e70a0 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/predicates/ScriptPredicate.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/predicates/ScriptPredicate.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/predicates/ScriptSupport.java b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/predicates/ScriptSupport.java
index e4136ede2831..e4136ede2831 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/predicates/ScriptSupport.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/predicates/ScriptSupport.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/predicates/WithinPredicate.java b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/predicates/WithinPredicate.java
index 3904eb397bce..3904eb397bce 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/predicates/WithinPredicate.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/predicates/WithinPredicate.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/strategies/MatchingStrategy.java b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/strategies/MatchingStrategy.java
index 8f5b5bc2fc20..8f5b5bc2fc20 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/strategies/MatchingStrategy.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/strategies/MatchingStrategy.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/strategies/XmlMatchingStrategy.java b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/strategies/XmlMatchingStrategy.java
index b2ca87a176e8..b2ca87a176e8 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/strategies/XmlMatchingStrategy.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/strategies/XmlMatchingStrategy.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/inspection/highlightTemplate/SSBasedInspection.java b/platform/structuralsearch/source/com/intellij/structuralsearch/inspection/highlightTemplate/SSBasedInspection.java
index 7a38ddb2ea65..7a38ddb2ea65 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/inspection/highlightTemplate/SSBasedInspection.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/inspection/highlightTemplate/SSBasedInspection.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/inspection/highlightTemplate/SSBasedInspectionCompiledPatternsCache.java b/platform/structuralsearch/source/com/intellij/structuralsearch/inspection/highlightTemplate/SSBasedInspectionCompiledPatternsCache.java
index 2d6335fe10ce..2d6335fe10ce 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/inspection/highlightTemplate/SSBasedInspectionCompiledPatternsCache.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/inspection/highlightTemplate/SSBasedInspectionCompiledPatternsCache.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/inspection/highlightTemplate/SSBasedInspectionOptions.java b/platform/structuralsearch/source/com/intellij/structuralsearch/inspection/highlightTemplate/SSBasedInspectionOptions.java
index 8dd7211eefb4..8dd7211eefb4 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/inspection/highlightTemplate/SSBasedInspectionOptions.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/inspection/highlightTemplate/SSBasedInspectionOptions.java
diff --git a/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/StructuralReplaceAction.java b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/StructuralReplaceAction.java
new file mode 100644
index 000000000000..974d04a2b621
--- /dev/null
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/StructuralReplaceAction.java
@@ -0,0 +1,50 @@
+package com.intellij.structuralsearch.plugin;
+
+import com.intellij.openapi.actionSystem.*;
+import com.intellij.openapi.project.Project;
+import com.intellij.structuralsearch.plugin.replace.ui.ReplaceDialog;
+import com.intellij.structuralsearch.plugin.ui.Configuration;
+import com.intellij.structuralsearch.plugin.ui.SearchContext;
+
+/**
+ * Search and replace structural java code patterns action.
+ */
+public class StructuralReplaceAction extends AnAction {
+
+ /** Handles IDEA action event
+ * @param event the event of action
+ */
+ public void actionPerformed(AnActionEvent event) {
+ triggerAction(null, SearchContext.buildFromDataContext(event.getDataContext()));
+ }
+
+ public static void triggerAction(Configuration config, SearchContext searchContext) {
+ ReplaceDialog replaceDialog = new ReplaceDialog(searchContext);
+
+ if (config!=null) {
+ replaceDialog.setUseLastConfiguration(true);
+ replaceDialog.setValuesFromConfig(config);
+ }
+
+ replaceDialog.show();
+ }
+
+ /** Updates the state of the action
+ * @param event the action event
+ */
+ public void update(AnActionEvent event) {
+ final Presentation presentation = event.getPresentation();
+ final DataContext context = event.getDataContext();
+ final Project project = CommonDataKeys.PROJECT.getData(context);
+ final StructuralSearchPlugin plugin = (project == null)? null:StructuralSearchPlugin.getInstance( project );
+
+ if (plugin== null || plugin.isSearchInProgress() || plugin.isReplaceInProgress() || plugin.isDialogVisible()) {
+ presentation.setEnabled( false );
+ } else {
+ presentation.setEnabled( true );
+ }
+
+ super.update(event);
+ }
+}
+
diff --git a/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/StructuralSearchAction.java b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/StructuralSearchAction.java
new file mode 100644
index 000000000000..fdfccb951361
--- /dev/null
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/StructuralSearchAction.java
@@ -0,0 +1,49 @@
+package com.intellij.structuralsearch.plugin;
+
+import com.intellij.openapi.actionSystem.*;
+import com.intellij.openapi.project.Project;
+import com.intellij.structuralsearch.plugin.ui.Configuration;
+import com.intellij.structuralsearch.plugin.ui.SearchContext;
+import com.intellij.structuralsearch.plugin.ui.SearchDialog;
+
+public class StructuralSearchAction extends AnAction {
+
+ /** Handles IDEA action event
+ * @param event the event of action
+ */
+ public void actionPerformed(AnActionEvent event) {
+ triggerAction(null, SearchContext.buildFromDataContext(event.getDataContext()));
+ }
+
+ public static void triggerAction(Configuration config, SearchContext searchContext) {
+ //StructuralSearchPlugin.getInstance(searchContext.getProject());
+ final SearchDialog searchDialog = new SearchDialog(searchContext);
+
+ if (config!=null) {
+ searchDialog.setUseLastConfiguration(true);
+ searchDialog.setValuesFromConfig(config);
+ }
+
+ searchDialog.show();
+ }
+
+ /** Updates the state of the action
+ * @param event the action event
+ */
+ public void update(AnActionEvent event) {
+ final Presentation presentation = event.getPresentation();
+ final DataContext context = event.getDataContext();
+ final Project project = CommonDataKeys.PROJECT.getData(context);
+ final StructuralSearchPlugin plugin = project==null ? null:StructuralSearchPlugin.getInstance( project );
+
+ if (plugin == null || plugin.isSearchInProgress() || plugin.isDialogVisible()) {
+ presentation.setEnabled( false );
+ } else {
+ presentation.setEnabled( true );
+ }
+
+ super.update(event);
+ }
+
+}
+
diff --git a/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/StructuralSearchPlugin.java b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/StructuralSearchPlugin.java
new file mode 100644
index 000000000000..9acc1dba66d4
--- /dev/null
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/StructuralSearchPlugin.java
@@ -0,0 +1,111 @@
+package com.intellij.structuralsearch.plugin;
+
+import com.intellij.openapi.components.ProjectComponent;
+import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.JDOMExternalizable;
+import com.intellij.structuralsearch.plugin.ui.ConfigurationManager;
+import com.intellij.structuralsearch.plugin.ui.ExistingTemplatesComponent;
+import org.jdom.Element;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Structural search plugin main class.
+ */
+public final class StructuralSearchPlugin implements ProjectComponent, JDOMExternalizable {
+ private boolean searchInProgress;
+ private boolean replaceInProgress;
+ private boolean myDialogVisible;
+ private final ConfigurationManager myConfigurationManager = new ConfigurationManager();
+ private ExistingTemplatesComponent myExistingTemplatesComponent;
+
+ public boolean isSearchInProgress() {
+ return searchInProgress;
+ }
+
+ public void setSearchInProgress(boolean searchInProgress) {
+ this.searchInProgress = searchInProgress;
+ }
+
+ public boolean isReplaceInProgress() {
+ return replaceInProgress;
+ }
+
+ public void setReplaceInProgress(boolean replaceInProgress) {
+ this.replaceInProgress = replaceInProgress;
+ }
+
+ public boolean isDialogVisible() {
+ return myDialogVisible;
+ }
+
+ public void setDialogVisible(boolean dialogVisible) {
+ myDialogVisible = dialogVisible;
+ }
+
+ /**
+ * Method is called after plugin is already created and configured. Plugin can start to communicate with
+ * other plugins only in this method.
+ */
+ public void initComponent() {
+ }
+
+ /**
+ * This method is called on plugin disposal.
+ */
+ public void disposeComponent() {
+ }
+
+ /**
+ * Returns the name of component
+ *
+ * @return String representing component name. Use PluginName.ComponentName notation
+ * to avoid conflicts.
+ */
+ @NotNull
+ public String getComponentName() {
+ return "StructuralSearchPlugin";
+ }
+
+ // Simple logging facility
+
+ // Logs given string to IDEA logger
+
+ private static class LoggerHolder {
+ private static final Logger logger = Logger.getInstance("Structural search");
+ }
+
+ public static void debug(String str) {
+ LoggerHolder.logger.info(str);
+ }
+
+ public void readExternal(Element element) {
+ myConfigurationManager.loadConfigurations(element);
+ }
+
+ public void writeExternal(Element element) {
+ myConfigurationManager.saveConfigurations(element);
+ }
+
+ public void projectOpened() {
+ }
+
+ public void projectClosed() {
+ }
+
+ public static StructuralSearchPlugin getInstance(Project project) {
+ return project.getComponent(StructuralSearchPlugin.class);
+ }
+
+ public ConfigurationManager getConfigurationManager() {
+ return myConfigurationManager;
+ }
+
+ public ExistingTemplatesComponent getExistingTemplatesComponent() {
+ return myExistingTemplatesComponent;
+ }
+
+ public void setExistingTemplatesComponent(ExistingTemplatesComponent existingTemplatesComponent) {
+ myExistingTemplatesComponent = existingTemplatesComponent;
+ }
+}
diff --git a/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/ReplaceOptions.java b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/ReplaceOptions.java
new file mode 100644
index 000000000000..31642aa80e22
--- /dev/null
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/ReplaceOptions.java
@@ -0,0 +1,185 @@
+package com.intellij.structuralsearch.plugin.replace;
+
+import com.intellij.openapi.util.JDOMExternalizable;
+import com.intellij.structuralsearch.MatchOptions;
+import com.intellij.structuralsearch.ReplacementVariableDefinition;
+import org.jdom.Attribute;
+import org.jdom.DataConversionException;
+import org.jdom.Element;
+import org.jetbrains.annotations.NonNls;
+
+import java.util.*;
+
+/**
+ * @author Maxim.Mossienko
+ * Date: Mar 5, 2004
+ * Time: 7:51:38 PM
+ */
+public class ReplaceOptions implements JDOMExternalizable, Cloneable {
+ private Map<String, ReplacementVariableDefinition> variableDefs;
+ private String replacement = "";
+ private boolean toShortenFQN;
+ private boolean myToReformatAccordingToStyle;
+ private boolean myToUseStaticImport = false;
+ private MatchOptions matchOptions = new MatchOptions();
+
+ @NonNls private static final String REFORMAT_ATTR_NAME = "reformatAccordingToStyle";
+ @NonNls private static final String REPLACEMENT_ATTR_NAME = "replacement";
+ @NonNls private static final String SHORTEN_FQN_ATTR_NAME = "shortenFQN";
+ @NonNls private static final String USE_STATIC_IMPORT_ATTR_NAME = "useStaticImport";
+
+ @NonNls private static final String VARIABLE_DEFINITION_TAG_NAME = "variableDefinition";
+
+ public String getReplacement() {
+ return replacement;
+ }
+
+ public void setReplacement(String replacement) {
+ this.replacement = replacement;
+ }
+
+ public boolean isToShortenFQN() {
+ return toShortenFQN;
+ }
+
+ public void setToShortenFQN(boolean shortedFQN) {
+ this.toShortenFQN = shortedFQN;
+ }
+
+ public boolean isToReformatAccordingToStyle() {
+ return myToReformatAccordingToStyle;
+ }
+
+ public MatchOptions getMatchOptions() {
+ return matchOptions;
+ }
+
+ public void setMatchOptions(MatchOptions matchOptions) {
+ this.matchOptions = matchOptions;
+ }
+
+ public void setToReformatAccordingToStyle(boolean reformatAccordingToStyle) {
+ myToReformatAccordingToStyle = reformatAccordingToStyle;
+ }
+
+ public boolean isToUseStaticImport() {
+ return myToUseStaticImport;
+ }
+
+ public void setToUseStaticImport(boolean useStaticImport) {
+ myToUseStaticImport = useStaticImport;
+ }
+
+ public void readExternal(Element element) {
+ matchOptions.readExternal(element);
+
+ Attribute attribute = element.getAttribute(REFORMAT_ATTR_NAME);
+ try {
+ myToReformatAccordingToStyle = attribute.getBooleanValue();
+ } catch(DataConversionException ex) {
+ }
+
+ attribute = element.getAttribute(SHORTEN_FQN_ATTR_NAME);
+ try {
+ toShortenFQN = attribute.getBooleanValue();
+ } catch(DataConversionException ex) {}
+
+ attribute = element.getAttribute(USE_STATIC_IMPORT_ATTR_NAME);
+ if (attribute != null) { // old saved configurations without this attribute present
+ try {
+ myToUseStaticImport = attribute.getBooleanValue();
+ }
+ catch (DataConversionException ignore) {}
+ }
+
+ replacement = element.getAttributeValue(REPLACEMENT_ATTR_NAME);
+
+ List<Element> elements = element.getChildren(VARIABLE_DEFINITION_TAG_NAME);
+
+ if (elements!=null && elements.size() > 0) {
+ for (final Element element1 : elements) {
+ final ReplacementVariableDefinition variableDefinition = new ReplacementVariableDefinition();
+ variableDefinition.readExternal(element1);
+ addVariableDefinition(variableDefinition);
+ }
+ }
+ }
+
+ public void writeExternal(Element element) {
+ matchOptions.writeExternal(element);
+
+ element.setAttribute(REFORMAT_ATTR_NAME,String.valueOf(myToReformatAccordingToStyle));
+ element.setAttribute(SHORTEN_FQN_ATTR_NAME,String.valueOf(toShortenFQN));
+ if (isToUseStaticImport()) {
+ element.setAttribute(USE_STATIC_IMPORT_ATTR_NAME, String.valueOf(isToUseStaticImport()));
+ }
+ element.setAttribute(REPLACEMENT_ATTR_NAME,replacement);
+
+ if (variableDefs!=null) {
+ for (final ReplacementVariableDefinition variableDefinition : variableDefs.values()) {
+ final Element infoElement = new Element(VARIABLE_DEFINITION_TAG_NAME);
+ element.addContent(infoElement);
+ variableDefinition.writeExternal(infoElement);
+ }
+ }
+ }
+
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof ReplaceOptions)) return false;
+
+ final ReplaceOptions replaceOptions = (ReplaceOptions)o;
+
+ if (myToReformatAccordingToStyle != replaceOptions.myToReformatAccordingToStyle) return false;
+ if (toShortenFQN != replaceOptions.toShortenFQN) return false;
+ if (myToUseStaticImport != replaceOptions.myToUseStaticImport) return false;
+ if (matchOptions != null ? !matchOptions.equals(replaceOptions.matchOptions) : replaceOptions.matchOptions != null) return false;
+ if (replacement != null ? !replacement.equals(replaceOptions.replacement) : replaceOptions.replacement != null) return false;
+ if (variableDefs != null ? !variableDefs.equals(replaceOptions.variableDefs) : replaceOptions.variableDefs != null) {
+ return false;
+ }
+
+ return true;
+ }
+
+ public int hashCode() {
+ int result;
+ result = (replacement != null ? replacement.hashCode() : 0);
+ result = 29 * result + (toShortenFQN ? 1 : 0);
+ result = 29 * result + (myToReformatAccordingToStyle ? 1 : 0);
+ result = 29 * result + (myToUseStaticImport ? 1 : 0);
+ result = 29 * result + (matchOptions != null ? matchOptions.hashCode() : 0);
+ result = 29 * result + (variableDefs != null ? variableDefs.hashCode() : 0);
+ return result;
+ }
+
+ public ReplaceOptions clone() {
+ try {
+ ReplaceOptions replaceOptions = (ReplaceOptions) super.clone();
+ replaceOptions.matchOptions = matchOptions.clone();
+ return replaceOptions;
+ } catch (CloneNotSupportedException e) {
+ e.printStackTrace();
+ return null;
+ }
+ }
+
+ public ReplacementVariableDefinition getVariableDefinition(String name) {
+ return variableDefs != null ? variableDefs.get(name): null;
+ }
+
+ public void addVariableDefinition(ReplacementVariableDefinition definition) {
+ if (variableDefs==null) {
+ variableDefs = new LinkedHashMap<String, ReplacementVariableDefinition>();
+ }
+ variableDefs.put( definition.getName(), definition );
+ }
+
+ public Collection<ReplacementVariableDefinition> getReplacementVariableDefinitions() {
+ return variableDefs != null ? variableDefs.values() : Collections.<ReplacementVariableDefinition>emptyList();
+ }
+
+ public void clearVariableDefinitions() {
+ variableDefs = null;
+ }
+}
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/ReplacementInfo.java b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/ReplacementInfo.java
index 6b74197c19dd..6b74197c19dd 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/ReplacementInfo.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/ReplacementInfo.java
diff --git a/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/impl/ParameterInfo.java b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/impl/ParameterInfo.java
new file mode 100644
index 000000000000..3e232731bd88
--- /dev/null
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/impl/ParameterInfo.java
@@ -0,0 +1,114 @@
+package com.intellij.structuralsearch.plugin.replace.impl;
+
+import com.intellij.psi.PsiElement;
+
+public final class ParameterInfo {
+ private String name;
+ private int startIndex;
+ private boolean argumentContext;
+ private boolean methodParameterContext;
+ private boolean statementContext;
+ private boolean variableInitializerContext;
+ private int afterDelimiterPos;
+ private boolean hasCommaBefore;
+ private int beforeDelimiterPos;
+ private boolean hasCommaAfter;
+ private boolean replacementVariable;
+ private PsiElement myElement;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public int getStartIndex() {
+ return startIndex;
+ }
+
+ public void setStartIndex(int startIndex) {
+ this.startIndex = startIndex;
+ }
+
+ public boolean isArgumentContext() {
+ return argumentContext;
+ }
+
+ public void setArgumentContext(boolean argumentContext) {
+ this.argumentContext = argumentContext;
+ }
+
+ public boolean isMethodParameterContext() {
+ return methodParameterContext;
+ }
+
+ public void setMethodParameterContext(boolean methodParameterContext) {
+ this.methodParameterContext = methodParameterContext;
+ }
+
+ public boolean isStatementContext() {
+ return statementContext;
+ }
+
+ public void setStatementContext(boolean statementContext) {
+ this.statementContext = statementContext;
+ }
+
+ public boolean isVariableInitializerContext() {
+ return variableInitializerContext;
+ }
+
+ public void setVariableInitializerContext(boolean variableInitializerContext) {
+ this.variableInitializerContext = variableInitializerContext;
+ }
+
+ public int getAfterDelimiterPos() {
+ return afterDelimiterPos;
+ }
+
+ public void setAfterDelimiterPos(int afterDelimiterPos) {
+ this.afterDelimiterPos = afterDelimiterPos;
+ }
+
+ public boolean isHasCommaBefore() {
+ return hasCommaBefore;
+ }
+
+ public void setHasCommaBefore(boolean hasCommaBefore) {
+ this.hasCommaBefore = hasCommaBefore;
+ }
+
+ public int getBeforeDelimiterPos() {
+ return beforeDelimiterPos;
+ }
+
+ public void setBeforeDelimiterPos(int beforeDelimiterPos) {
+ this.beforeDelimiterPos = beforeDelimiterPos;
+ }
+
+ public boolean isHasCommaAfter() {
+ return hasCommaAfter;
+ }
+
+ public void setHasCommaAfter(boolean hasCommaAfter) {
+ this.hasCommaAfter = hasCommaAfter;
+ }
+
+ public boolean isReplacementVariable() {
+ return replacementVariable;
+ }
+
+ public void setReplacementVariable(boolean replacementVariable) {
+ this.replacementVariable = replacementVariable;
+ }
+
+ public PsiElement getElement() {
+ return myElement;
+ }
+
+ public void setElement(PsiElement element) {
+ myElement = element;
+ }
+}
diff --git a/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/impl/ReplacementBuilder.java b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/impl/ReplacementBuilder.java
new file mode 100644
index 000000000000..e72fd5555531
--- /dev/null
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/impl/ReplacementBuilder.java
@@ -0,0 +1,218 @@
+package com.intellij.structuralsearch.plugin.replace.impl;
+
+import com.intellij.codeInsight.template.Template;
+import com.intellij.codeInsight.template.TemplateManager;
+import com.intellij.openapi.fileTypes.FileType;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.psi.*;
+import com.intellij.structuralsearch.MalformedPatternException;
+import com.intellij.structuralsearch.MatchResult;
+import com.intellij.structuralsearch.StructuralSearchProfile;
+import com.intellij.structuralsearch.StructuralSearchUtil;
+import com.intellij.structuralsearch.impl.matcher.MatchResultImpl;
+import com.intellij.structuralsearch.impl.matcher.MatcherImplUtil;
+import com.intellij.structuralsearch.impl.matcher.PatternTreeContext;
+import com.intellij.structuralsearch.impl.matcher.predicates.ScriptSupport;
+import com.intellij.structuralsearch.plugin.replace.ReplaceOptions;
+import com.intellij.util.IncorrectOperationException;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.*;
+
+/**
+ * @author maxim
+ * Date: 24.02.2004
+ * Time: 15:34:57
+ */
+public final class ReplacementBuilder {
+ private String replacement;
+ private List<ParameterInfo> parameterizations;
+ private final Map<String, ScriptSupport> replacementVarsMap;
+ private final ReplaceOptions options;
+
+ ReplacementBuilder(final Project project,final ReplaceOptions options) {
+ replacementVarsMap = new HashMap<String, ScriptSupport>();
+ this.options = options;
+ String _replacement = options.getReplacement();
+ FileType fileType = options.getMatchOptions().getFileType();
+
+ final Template template = TemplateManager.getInstance(project).createTemplate("","",_replacement);
+
+ final int segmentsCount = template.getSegmentsCount();
+ replacement = template.getTemplateText();
+
+ for(int i=0;i<segmentsCount;++i) {
+ final int offset = template.getSegmentOffset(i);
+ final String name = template.getSegmentName(i);
+
+ final ParameterInfo info = new ParameterInfo();
+ info.setStartIndex(offset);
+ info.setName(name);
+ info.setReplacementVariable(options.getVariableDefinition(name) != null);
+
+ // find delimiter
+ int pos;
+ for(pos = offset-1; pos >=0 && pos < replacement.length() && Character.isWhitespace(replacement.charAt(pos));) {
+ --pos;
+ }
+
+ if (pos >= 0) {
+ if (replacement.charAt(pos) == ',') {
+ info.setHasCommaBefore(true);
+ }
+ info.setBeforeDelimiterPos(pos);
+ }
+
+ for(pos = offset; pos < replacement.length() && Character.isWhitespace(replacement.charAt(pos));) {
+ ++pos;
+ }
+
+ if (pos < replacement.length()) {
+ final char ch = replacement.charAt(pos);
+
+ if (ch == ';') {
+ info.setStatementContext(true);
+ }
+ else if (ch == ',' || ch == ')') {
+ info.setArgumentContext(true);
+ info.setHasCommaAfter(ch == ',');
+ }
+ info.setAfterDelimiterPos(pos);
+ }
+
+ if (parameterizations==null) {
+ parameterizations = new ArrayList<ParameterInfo>();
+ }
+
+ parameterizations.add(info);
+ }
+
+ final StructuralSearchProfile profile = parameterizations != null ? StructuralSearchUtil.getProfileByFileType(fileType) : null;
+ if (profile != null) {
+ try {
+ final PsiElement[] elements = MatcherImplUtil.createTreeFromText(
+ _replacement,
+ PatternTreeContext.Block,
+ fileType,
+ options.getMatchOptions().getDialect(),
+ options.getMatchOptions().getPatternContext(),
+ project,
+ false
+ );
+ if (elements.length > 0) {
+ final PsiElement patternNode = elements[0].getParent();
+ profile.provideAdditionalReplaceOptions(patternNode, options, this);
+ }
+ } catch (IncorrectOperationException e) {
+ throw new MalformedPatternException();
+ }
+ }
+ }
+
+ private static void fill(MatchResult r,Map<String,MatchResult> m) {
+ if (r.getName()!=null) {
+ if (m.get(r.getName()) == null) {
+ m.put(r.getName(), r);
+ }
+ }
+
+ if (!r.isScopeMatch() || !r.isMultipleMatch()) {
+ for (final MatchResult matchResult : r.getAllSons()) {
+ fill(matchResult, m);
+ }
+ } else if (r.hasSons()) {
+ final List<MatchResult> allSons = r.getAllSons();
+ if (allSons.size() > 0) {
+ fill(allSons.get(0),m);
+ }
+ }
+ }
+
+ String process(MatchResult match, ReplacementInfoImpl replacementInfo, FileType type) {
+ if (parameterizations==null) {
+ return replacement;
+ }
+
+ final StringBuilder result = new StringBuilder(replacement);
+ HashMap<String, MatchResult> matchMap = new HashMap<String, MatchResult>();
+ fill(match, matchMap);
+
+ int offset = 0;
+
+ final StructuralSearchProfile profile = StructuralSearchUtil.getProfileByFileType(type);
+
+ for (final ParameterInfo info : parameterizations) {
+ MatchResult r = matchMap.get(info.getName());
+ if (info.isReplacementVariable()) {
+ offset = Replacer.insertSubstitution(result, offset, info, generateReplacement(info, match));
+ }
+ else if (r != null) {
+ offset = profile != null ? profile.handleSubstitution(info, r, result, offset, matchMap) : StructuralSearchProfile.defaultHandleSubstitution(info, r, result, offset);
+ }
+ else {
+ if (info.isHasCommaBefore()) {
+ result.delete(info.getBeforeDelimiterPos() + offset, info.getBeforeDelimiterPos() + 1 + offset);
+ --offset;
+ }
+ else if (info.isHasCommaAfter()) {
+ result.delete(info.getAfterDelimiterPos() + offset, info.getAfterDelimiterPos() + 1 + offset);
+ --offset;
+ }
+ else if (info.isVariableInitializerContext()) {
+ //if (info.afterDelimiterPos > 0) {
+ result.delete(info.getBeforeDelimiterPos() + offset, info.getAfterDelimiterPos() + offset - 1);
+ offset -= (info.getAfterDelimiterPos() - info.getBeforeDelimiterPos() - 1);
+ //}
+ } else if (profile != null) {
+ offset = profile.processAdditionalOptions(info, offset, result, r);
+ }
+ offset = Replacer.insertSubstitution(result, offset, info, "");
+ }
+ }
+
+ replacementInfo.variableMap = (HashMap<String, MatchResult>)matchMap.clone();
+ matchMap.clear();
+ return result.toString();
+ }
+
+ private String generateReplacement(ParameterInfo info, MatchResult match) {
+ ScriptSupport scriptSupport = replacementVarsMap.get(info.getName());
+
+ if (scriptSupport == null) {
+ String constraint = options.getVariableDefinition(info.getName()).getScriptCodeConstraint();
+ scriptSupport = new ScriptSupport(StringUtil.stripQuotesAroundValue(constraint), info.getName());
+ replacementVarsMap.put(info.getName(), scriptSupport);
+ }
+ return scriptSupport.evaluate((MatchResultImpl)match, null);
+ }
+
+ @Nullable
+ public ParameterInfo findParameterization(String name) {
+ if (parameterizations==null) return null;
+
+ for (final ParameterInfo info : parameterizations) {
+
+ if (info.getName().equals(name)) {
+ return info;
+ }
+ }
+
+ return null;
+ }
+
+ public void clear() {
+ replacement = null;
+
+ if (parameterizations!=null) {
+ parameterizations.clear();
+ parameterizations = null;
+ }
+ }
+
+ public void addParametrization(@NotNull ParameterInfo e) {
+ assert parameterizations != null;
+ parameterizations.add(e);
+ }
+}
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/impl/ReplacementContext.java b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/impl/ReplacementContext.java
index c77d0b7ce1f1..c77d0b7ce1f1 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/impl/ReplacementContext.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/impl/ReplacementContext.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/impl/ReplacementInfoImpl.java b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/impl/ReplacementInfoImpl.java
index 318e88f27c24..318e88f27c24 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/impl/ReplacementInfoImpl.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/impl/ReplacementInfoImpl.java
diff --git a/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/impl/Replacer.java b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/impl/Replacer.java
new file mode 100644
index 000000000000..32cb2f83c36f
--- /dev/null
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/impl/Replacer.java
@@ -0,0 +1,426 @@
+package com.intellij.structuralsearch.plugin.replace.impl;
+
+import com.intellij.codeInsight.template.Template;
+import com.intellij.codeInsight.template.TemplateManager;
+import com.intellij.lang.Language;
+import com.intellij.openapi.application.ApplicationManager;
+import com.intellij.openapi.command.CommandProcessor;
+import com.intellij.openapi.fileEditor.FileDocumentManager;
+import com.intellij.openapi.fileTypes.FileType;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.psi.*;
+import com.intellij.psi.codeStyle.CodeStyleManager;
+import com.intellij.psi.search.LocalSearchScope;
+import com.intellij.structuralsearch.*;
+import com.intellij.structuralsearch.impl.matcher.MatcherImplUtil;
+import com.intellij.structuralsearch.impl.matcher.PatternTreeContext;
+import com.intellij.structuralsearch.impl.matcher.predicates.ScriptSupport;
+import com.intellij.structuralsearch.plugin.replace.ReplaceOptions;
+import com.intellij.structuralsearch.plugin.replace.ReplacementInfo;
+import com.intellij.structuralsearch.plugin.util.CollectingMatchResultSink;
+import com.intellij.util.IncorrectOperationException;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.*;
+
+/**
+ * @author Maxim.Mossienko
+ * Date: Mar 4, 2004
+ * Time: 9:19:34 PM
+ */
+public class Replacer {
+ private final Project project;
+ private ReplacementBuilder replacementBuilder;
+ private ReplaceOptions options;
+ private ReplacementContext context;
+ private StructuralReplaceHandler replaceHandler;
+
+ public Replacer(Project project, ReplaceOptions options) {
+ this.project = project;
+ this.options = options;
+ }
+
+ public static String stripTypedVariableDecoration(final String type) {
+ return type.substring(1,type.length()-1);
+ }
+
+ public static int insertSubstitution(StringBuilder result, int offset, final ParameterInfo info, String image) {
+ if (image.length() > 0) result.insert(offset+ info.getStartIndex(),image);
+ offset += image.length();
+ return offset;
+ }
+
+ public String testReplace(String in, String what, String by, ReplaceOptions options) throws IncorrectOperationException {
+ return testReplace(in, what, by, options,false);
+ }
+
+ public String testReplace(String in, String what, String by, ReplaceOptions options, boolean filePattern) {
+ FileType type = options.getMatchOptions().getFileType();
+ return testReplace(in, what, by, options, filePattern, false, type, null);
+ }
+
+ public String testReplace(String in, String what, String by, ReplaceOptions options, boolean filePattern, boolean createPhysicalFile,
+ FileType sourceFileType, Language sourceDialect) {
+ this.options = options;
+ this.options.getMatchOptions().setSearchPattern(what);
+ this.options.setReplacement(by);
+ replacementBuilder=null;
+ context = null;
+ replaceHandler = null;
+
+ this.options.getMatchOptions().clearVariableConstraints();
+ MatcherImplUtil.transform(this.options.getMatchOptions());
+
+ checkSupportedReplacementPattern(project, options);
+
+ Matcher matcher = new Matcher(project);
+ try {
+ PsiElement firstElement, lastElement, parent;
+
+ if (options.getMatchOptions().getScope() == null) {
+ PsiElement[] elements = MatcherImplUtil.createTreeFromText(
+ in,
+ filePattern ? PatternTreeContext.File : PatternTreeContext.Block,
+ sourceFileType, sourceDialect, null,
+ project,
+ createPhysicalFile
+ );
+
+ firstElement = elements[0];
+ lastElement = elements[elements.length-1];
+ parent = firstElement.getParent();
+
+ this.options.getMatchOptions().setScope(
+ new LocalSearchScope(parent)
+ );
+ } else {
+ parent = ((LocalSearchScope)options.getMatchOptions().getScope()).getScope()[0];
+ firstElement = parent.getFirstChild();
+ lastElement = parent.getLastChild();
+ }
+
+ this.options.getMatchOptions().setResultIsContextMatch(true);
+ CollectingMatchResultSink sink = new CollectingMatchResultSink();
+ matcher.testFindMatches(sink, this.options.getMatchOptions());
+
+ final List<ReplacementInfo> resultPtrList = new ArrayList<ReplacementInfo>();
+
+ for (final MatchResult result : sink.getMatches()) {
+ resultPtrList.add(buildReplacement(result));
+ }
+
+ sink.getMatches().clear();
+
+ int startOffset = firstElement.getTextRange().getStartOffset();
+ int endOffset = filePattern ?0: parent.getTextLength() - (lastElement.getTextRange().getEndOffset());
+
+ // get nodes from text may contain
+ PsiElement prevSibling = firstElement.getPrevSibling();
+ if (prevSibling instanceof PsiWhiteSpace) {
+ startOffset -= prevSibling.getTextLength() - 1;
+ }
+
+ PsiElement nextSibling = lastElement.getNextSibling();
+ if (nextSibling instanceof PsiWhiteSpace) {
+ endOffset -= nextSibling.getTextLength() - 1;
+ }
+
+ replaceAll(resultPtrList);
+
+ String result = parent.getText();
+ result = result.substring(startOffset);
+ result = result.substring(0,result.length() - endOffset);
+
+ return result;
+ }
+ catch (Exception e) {
+ throw new IncorrectOperationException(e);
+ }
+ finally {
+ options.getMatchOptions().setScope(null);
+ }
+ }
+
+ public void replaceAll(final List<ReplacementInfo> resultPtrList) {
+ PsiElement lastAffectedElement = null;
+ PsiElement currentAffectedElement;
+
+ for (ReplacementInfo info : resultPtrList) {
+ PsiElement element = info.getMatch(0);
+ initContextAndHandler(element);
+ if (replaceHandler != null) {
+ replaceHandler.prepare(info);
+ }
+ }
+
+ for (final ReplacementInfo aResultPtrList : resultPtrList) {
+ currentAffectedElement = doReplace(aResultPtrList);
+
+ if (currentAffectedElement != lastAffectedElement) {
+ if (lastAffectedElement != null) reformatAndPostProcess(lastAffectedElement);
+ lastAffectedElement = currentAffectedElement;
+ }
+ }
+
+ reformatAndPostProcess(lastAffectedElement);
+ }
+
+ public void replace(ReplacementInfo info) {
+ PsiElement element = info.getMatch(0);
+ initContextAndHandler(element);
+
+ if (replaceHandler != null) {
+ replaceHandler.prepare(info);
+ }
+ reformatAndPostProcess(doReplace(info));
+ }
+
+ @Nullable
+ private PsiElement doReplace(final ReplacementInfo info) {
+ final ReplacementInfoImpl replacementInfo = (ReplacementInfoImpl)info;
+ final PsiElement element = replacementInfo.matchesPtrList.get(0).getElement();
+
+ if (element==null || !element.isWritable() || !element.isValid()) return null;
+
+ final PsiElement elementParent = element.getParent();
+
+ //noinspection HardCodedStringLiteral
+ CommandProcessor.getInstance().executeCommand(
+ project,
+ new Runnable() {
+ public void run() {
+ ApplicationManager.getApplication().runWriteAction(
+ new Runnable() {
+ public void run() {
+ doReplace(element, replacementInfo);
+ }
+ }
+ );
+ PsiDocumentManager.getInstance(project).commitAllDocuments();
+ }
+ },
+ "ssreplace",
+ "test"
+ );
+
+ if (!elementParent.isValid() || !elementParent.isWritable()) {
+ return null;
+ }
+
+ return elementParent;
+ }
+
+ private void reformatAndPostProcess(final PsiElement elementParent) {
+ if (elementParent == null) return;
+ final Runnable action = new Runnable() {
+ public void run() {
+ final PsiFile containingFile = elementParent.getContainingFile();
+
+ if (containingFile != null && options.isToReformatAccordingToStyle()) {
+ if (containingFile.getVirtualFile() != null) {
+ PsiDocumentManager.getInstance(project)
+ .commitDocument(FileDocumentManager.getInstance().getDocument(containingFile.getVirtualFile()));
+ }
+
+ final int parentOffset = elementParent.getTextRange().getStartOffset();
+ CodeStyleManager.getInstance(project)
+ .reformatRange(containingFile, parentOffset, parentOffset + elementParent.getTextLength(), true);
+ }
+ if (replaceHandler != null) {
+ replaceHandler.postProcess(elementParent, options);
+ }
+ }
+ };
+
+ CommandProcessor.getInstance().executeCommand(
+ project,
+ new Runnable() {
+ public void run() {
+ ApplicationManager.getApplication().runWriteAction(action);
+ }
+ },
+ "reformat and shorten refs after ssr",
+ "test"
+ );
+ }
+
+ private void doReplace(final PsiElement elementToReplace,
+ final ReplacementInfoImpl info) {
+ CodeStyleManager.getInstance(project).performActionWithFormatterDisabled(new Runnable() {
+ public void run() {
+ initContextAndHandler(elementToReplace);
+
+ context.replacementInfo = info;
+
+ if (replaceHandler != null) {
+ replaceHandler.replace(info, options);
+ }
+ }
+ }
+ );
+ }
+
+ private void initContextAndHandler(PsiElement psiContext) {
+ if (context == null) {
+ context = new ReplacementContext(options, project);
+ }
+ if (replaceHandler == null) {
+ StructuralSearchProfile profile = StructuralSearchUtil.getProfileByPsiElement(psiContext);
+ if (profile != null) {
+ replaceHandler = profile.getReplaceHandler(this.context);
+ }
+ }
+ }
+
+ public static void handleComments(final PsiElement el, final PsiElement replacement, ReplacementContext context) throws IncorrectOperationException {
+ ReplacementInfoImpl replacementInfo = context.replacementInfo;
+ if (replacementInfo.elementToVariableNameMap == null) {
+ replacementInfo.elementToVariableNameMap = new HashMap<PsiElement, String>(1);
+ Map<String, MatchResult> variableMap = replacementInfo.variableMap;
+ if (variableMap != null) {
+ for(String name:variableMap.keySet()) {
+ fill(name,replacementInfo.variableMap.get(name),replacementInfo.elementToVariableNameMap);
+ }
+ }
+ }
+
+ PsiElement lastChild = el.getLastChild();
+ if (lastChild instanceof PsiComment &&
+ replacementInfo.elementToVariableNameMap.get(lastChild) == null &&
+ !(replacement.getLastChild() instanceof PsiComment)
+ ) {
+ PsiElement firstElementAfterStatementEnd = lastChild;
+ for(PsiElement curElement=firstElementAfterStatementEnd.getPrevSibling();curElement!=null;curElement = curElement.getPrevSibling()) {
+ if (!(curElement instanceof PsiWhiteSpace) && !(curElement instanceof PsiComment)) break;
+ firstElementAfterStatementEnd = curElement;
+ }
+ replacement.addRangeAfter(firstElementAfterStatementEnd,lastChild,replacement.getLastChild());
+ }
+
+ final PsiElement firstChild = el.getFirstChild();
+ if (firstChild instanceof PsiComment &&
+ !(firstChild instanceof PsiDocCommentBase) &&
+ replacementInfo.elementToVariableNameMap.get(firstChild) == null
+ ) {
+ PsiElement lastElementBeforeStatementStart = firstChild;
+
+ for(PsiElement curElement=lastElementBeforeStatementStart.getNextSibling();curElement!=null;curElement = curElement.getNextSibling()) {
+ if (!(curElement instanceof PsiWhiteSpace) && !(curElement instanceof PsiComment)) break;
+ lastElementBeforeStatementStart = curElement;
+ }
+ replacement.addRangeBefore(firstChild,lastElementBeforeStatementStart,replacement.getFirstChild());
+ }
+ }
+
+ private static void fill(final String name, final MatchResult matchResult, final Map<PsiElement, String> elementToVariableNameMap) {
+ boolean b = matchResult.isMultipleMatch() || matchResult.isScopeMatch();
+ if(matchResult.hasSons() && b) {
+ for(MatchResult r:matchResult.getAllSons()) {
+ fill(name, r, elementToVariableNameMap);
+ }
+ } else if (!b && matchResult.getMatchRef() != null) {
+ elementToVariableNameMap.put(matchResult.getMatch(),name);
+ }
+ }
+
+ public static void checkSupportedReplacementPattern(Project project, ReplaceOptions options) throws UnsupportedPatternException {
+ try {
+ String search = options.getMatchOptions().getSearchPattern();
+ String replacement = options.getReplacement();
+ FileType fileType = options.getMatchOptions().getFileType();
+ Template template = TemplateManager.getInstance(project).createTemplate("","",search);
+ Template template2 = TemplateManager.getInstance(project).createTemplate("","",replacement);
+
+ int segmentCount = template2.getSegmentsCount();
+ for(int i=0;i<segmentCount;++i) {
+ final String replacementSegmentName = template2.getSegmentName(i);
+ final int segmentCount2 = template.getSegmentsCount();
+ int j;
+
+ for(j=0;j<segmentCount2;++j) {
+ final String searchSegmentName = template.getSegmentName(j);
+
+ if (replacementSegmentName.equals(searchSegmentName)) break;
+
+ // Reference to
+ if (replacementSegmentName.startsWith(searchSegmentName) &&
+ replacementSegmentName.charAt(searchSegmentName.length())=='_'
+ ) {
+ try {
+ Integer.parseInt(replacementSegmentName.substring(searchSegmentName.length()+1));
+ break;
+ } catch(NumberFormatException ex) {}
+ }
+ }
+
+ if (j==segmentCount2) {
+ ReplacementVariableDefinition definition = options.getVariableDefinition(replacementSegmentName);
+
+ if (definition == null || definition.getScriptCodeConstraint().length() <= 2 /*empty quotes*/) {
+ throw new UnsupportedPatternException(
+ SSRBundle.message("replacement.variable.is.not.defined.message", replacementSegmentName)
+ );
+ } else {
+ String message = ScriptSupport.checkValidScript(StringUtil.stripQuotesAroundValue(definition.getScriptCodeConstraint()));
+ if (message != null) {
+ throw new UnsupportedPatternException(
+ SSRBundle.message("replacement.variable.is.not.valid", replacementSegmentName, message)
+ );
+ }
+ }
+ }
+ }
+
+ StructuralSearchProfile profile = StructuralSearchUtil.getProfileByFileType(fileType);
+
+ profile.checkReplacementPattern(project, options);
+
+ } catch(IncorrectOperationException ex) {
+ throw new UnsupportedPatternException(SSRBundle.message("incorrect.pattern.message"));
+ }
+ }
+
+ public ReplacementInfo buildReplacement(MatchResult result) {
+ List<SmartPsiElementPointer> l = new ArrayList<SmartPsiElementPointer>();
+ SmartPointerManager manager = SmartPointerManager.getInstance(project);
+
+ if (MatchResult.MULTI_LINE_MATCH.equals(result.getName())) {
+ for(Iterator<MatchResult> i=result.getAllSons().iterator();i.hasNext();) {
+ final MatchResult r = i.next();
+
+ if (MatchResult.LINE_MATCH.equals(r.getName())) {
+ PsiElement element = r.getMatchRef().getElement();
+
+ if (element instanceof PsiDocCommentBase) { // doc comment is not collapsed when created in block
+ if (i.hasNext()) {
+ MatchResult matchResult = i.next();
+
+ if (MatchResult.LINE_MATCH.equals(matchResult.getName()) &&
+ StructuralSearchUtil.isDocCommentOwner(matchResult.getMatch())) {
+ element = matchResult.getMatch();
+ } else {
+ l.add( manager.createSmartPsiElementPointer(element) );
+ element = matchResult.getMatch();
+ }
+ }
+ }
+ l.add( manager.createSmartPsiElementPointer(element) );
+ }
+ }
+ } else {
+ l.add( manager.createSmartPsiElementPointer(result.getMatchRef().getElement()));
+ }
+
+ ReplacementInfoImpl replacementInfo = new ReplacementInfoImpl();
+
+ replacementInfo.matchesPtrList = l;
+ if (replacementBuilder==null) {
+ replacementBuilder = new ReplacementBuilder(project,options);
+ }
+ replacementInfo.result = replacementBuilder.process(result, replacementInfo, options.getMatchOptions().getFileType());
+ replacementInfo.matchResult = result;
+
+ return replacementInfo;
+ }
+}
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/impl/ReplacerUtil.java b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/impl/ReplacerUtil.java
index 365ec74bc01e..365ec74bc01e 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/impl/ReplacerUtil.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/impl/ReplacerUtil.java
diff --git a/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/ui/ReplaceCommand.java b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/ui/ReplaceCommand.java
new file mode 100644
index 000000000000..1b704f7c968e
--- /dev/null
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/ui/ReplaceCommand.java
@@ -0,0 +1,40 @@
+package com.intellij.structuralsearch.plugin.replace.ui;
+
+import com.intellij.openapi.project.Project;
+import com.intellij.structuralsearch.MatchResult;
+import com.intellij.structuralsearch.plugin.StructuralSearchPlugin;
+import com.intellij.structuralsearch.plugin.ui.SearchCommand;
+import com.intellij.usages.Usage;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: Maxim.Mossienko
+ * Date: Mar 31, 2004
+ * Time: 3:54:03 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class ReplaceCommand extends SearchCommand {
+
+ public ReplaceCommand(Project project, ReplaceUsageViewContext context) {
+ super( project, context );
+ }
+
+ protected void findStarted() {
+ super.findStarted();
+
+ StructuralSearchPlugin.getInstance(project).setReplaceInProgress(true);
+ }
+
+ protected void findEnded() {
+ StructuralSearchPlugin.getInstance(project).setReplaceInProgress( false );
+
+ super.findEnded();
+ }
+
+ protected void foundUsage(MatchResult result, Usage usage) {
+ super.foundUsage(result, usage);
+
+ final ReplaceUsageViewContext replaceUsageViewContext = ((ReplaceUsageViewContext)context);
+ replaceUsageViewContext.addReplaceUsage(usage,replaceUsageViewContext.getReplacer().buildReplacement(result));
+ }
+}
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/ui/ReplaceConfiguration.java b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/ui/ReplaceConfiguration.java
index fa9beaa36a23..fa9beaa36a23 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/ui/ReplaceConfiguration.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/ui/ReplaceConfiguration.java
diff --git a/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/ui/ReplaceDialog.java b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/ui/ReplaceDialog.java
new file mode 100644
index 000000000000..b02fadab8245
--- /dev/null
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/ui/ReplaceDialog.java
@@ -0,0 +1,195 @@
+package com.intellij.structuralsearch.plugin.replace.ui;
+
+import com.intellij.codeInsight.CodeInsightBundle;
+import com.intellij.codeInsight.template.impl.Variable;
+import com.intellij.openapi.editor.Editor;
+import com.intellij.openapi.editor.EditorFactory;
+import com.intellij.openapi.ui.Splitter;
+import com.intellij.structuralsearch.MalformedPatternException;
+import com.intellij.structuralsearch.ReplacementVariableDefinition;
+import com.intellij.structuralsearch.SSRBundle;
+import com.intellij.structuralsearch.UnsupportedPatternException;
+import com.intellij.structuralsearch.plugin.replace.ReplaceOptions;
+import com.intellij.structuralsearch.plugin.replace.impl.Replacer;
+import com.intellij.structuralsearch.plugin.ui.*;
+import com.intellij.util.containers.hash.LinkedHashMap;
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+// Class to show the user the request for search
+
+@SuppressWarnings({"RefusedBequest"})
+public class ReplaceDialog extends SearchDialog {
+ private Editor replaceCriteriaEdit;
+ private JCheckBox shortenFQN;
+ private JCheckBox formatAccordingToStyle;
+ private JCheckBox useStaticImport;
+
+ private String mySavedEditorText;
+
+ protected String getDefaultTitle() {
+ return SSRBundle.message("structural.replace.title");
+ }
+
+ protected JComponent createEditorContent() {
+ JPanel result = new JPanel(new BorderLayout());
+ Splitter p;
+
+ result.add(BorderLayout.CENTER, p = new Splitter(true, 0.5f));
+ p.setFirstComponent(super.createEditorContent());
+
+ replaceCriteriaEdit = createEditor(searchContext, mySavedEditorText != null ? mySavedEditorText : "");
+ JPanel replace = new JPanel(new BorderLayout());
+ replace.add(BorderLayout.NORTH, new JLabel(SSRBundle.message("replacement.template.label")));
+ replace.add(BorderLayout.CENTER, replaceCriteriaEdit.getComponent());
+ replaceCriteriaEdit.getComponent().setMinimumSize(new Dimension(150, 100));
+
+ p.setSecondComponent(replace);
+
+ return result;
+ }
+
+ protected int getRowsCount() {
+ return super.getRowsCount() + 1;
+ }
+
+ protected String getDimensionServiceKey() {
+ return "#com.intellij.structuralsearch.plugin.replace.ui.ReplaceDialog";
+ }
+
+ protected void buildOptions(JPanel searchOptions) {
+ super.buildOptions(searchOptions);
+ searchOptions.add(UIUtil.createOptionLine(shortenFQN = new JCheckBox(
+ SSRBundle.message("shorten.fully.qualified.names.checkbox"), true)));
+
+ searchOptions.add(UIUtil.createOptionLine(formatAccordingToStyle = new JCheckBox(
+ CodeInsightBundle.message("dialog.edit.template.checkbox.reformat.according.to.style"), true)));
+
+ searchOptions.add(UIUtil.createOptionLine(useStaticImport = new JCheckBox(
+ CodeInsightBundle.message("dialog.edit.template.checkbox.use.static.import"), true)));
+ }
+
+ protected UsageViewContext createUsageViewContext(Configuration configuration) {
+ return new ReplaceUsageViewContext(searchContext, configuration);
+ }
+
+ public ReplaceDialog(SearchContext searchContext) {
+ super(searchContext);
+ }
+
+ public ReplaceDialog(SearchContext searchContext, boolean showScope, boolean runFindActionOnClose) {
+ super(searchContext, showScope, runFindActionOnClose);
+ }
+
+
+ public Configuration createConfiguration() {
+ ReplaceConfiguration configuration = new ReplaceConfiguration();
+ configuration.setName(USER_DEFINED);
+ return configuration;
+ }
+
+ protected void disposeEditorContent() {
+ mySavedEditorText = replaceCriteriaEdit.getDocument().getText();
+ EditorFactory.getInstance().releaseEditor(replaceCriteriaEdit);
+ super.disposeEditorContent();
+ }
+
+ public void setValuesFromConfig(Configuration configuration) {
+ //replaceCriteriaEdit.putUserData(SubstitutionShortInfoHandler.CURRENT_CONFIGURATION_KEY, configuration);
+
+ if (configuration instanceof ReplaceConfiguration) {
+ final ReplaceConfiguration config = (ReplaceConfiguration)configuration;
+ final ReplaceOptions options = config.getOptions();
+ super.setValuesFromConfig(config);
+
+ UIUtil.setContent(replaceCriteriaEdit, config.getOptions().getReplacement(), 0, replaceCriteriaEdit.getDocument().getTextLength(),
+ searchContext.getProject());
+
+ shortenFQN.setSelected(options.isToShortenFQN());
+ formatAccordingToStyle.setSelected(options.isToReformatAccordingToStyle());
+ useStaticImport.setSelected(options.isToUseStaticImport());
+
+ ReplaceOptions newReplaceOptions = ((ReplaceConfiguration)model.getConfig()).getOptions();
+ newReplaceOptions.clearVariableDefinitions();
+
+ for (ReplacementVariableDefinition def : options.getReplacementVariableDefinitions()) {
+ newReplaceOptions.addVariableDefinition((ReplacementVariableDefinition)def.clone());
+ }
+ }
+ else {
+ super.setValuesFromConfig(configuration);
+
+ UIUtil.setContent(replaceCriteriaEdit, configuration.getMatchOptions().getSearchPattern(), 0,
+ replaceCriteriaEdit.getDocument().getTextLength(), searchContext.getProject());
+ }
+ }
+
+ protected void setValuesToConfig(Configuration config) {
+ super.setValuesToConfig(config);
+
+ final ReplaceConfiguration replaceConfiguration = (ReplaceConfiguration)config;
+ final ReplaceOptions options = replaceConfiguration.getOptions();
+
+ options.setMatchOptions(replaceConfiguration.getMatchOptions());
+ options.setReplacement(replaceCriteriaEdit.getDocument().getText());
+ options.setToShortenFQN(shortenFQN.isSelected());
+ options.setToReformatAccordingToStyle(formatAccordingToStyle.isSelected());
+ options.setToUseStaticImport(useStaticImport.isSelected());
+ }
+
+ protected boolean isRecursiveSearchEnabled() {
+ return false;
+ }
+
+ protected java.util.List<Variable> getVariablesFromListeners() {
+ ArrayList<Variable> vars = getVarsFrom(replaceCriteriaEdit);
+ List<Variable> searchVars = super.getVariablesFromListeners();
+ Map<String, Variable> varsMap = new LinkedHashMap<String, Variable>(searchVars.size());
+
+ for(Variable var:searchVars) varsMap.put(var.getName(), var);
+ for(Variable var:vars) {
+ if (!varsMap.containsKey(var.getName())) {
+ String newVarName = var.getName() + ReplaceConfiguration.REPLACEMENT_VARIABLE_SUFFIX;
+ varsMap.put(newVarName, new Variable(newVarName, null, null, false, false));
+ }
+ }
+ return new ArrayList<Variable>(varsMap.values());
+ }
+
+ protected boolean isValid() {
+ if (!super.isValid()) return false;
+
+ try {
+ Replacer.checkSupportedReplacementPattern(searchContext.getProject(), ((ReplaceConfiguration)model.getConfig()).getOptions());
+ }
+ catch (UnsupportedPatternException ex) {
+ reportMessage("unsupported.replacement.pattern.message", replaceCriteriaEdit, ex.getMessage());
+ return false;
+ }
+ catch (MalformedPatternException ex) {
+ reportMessage("malformed.replacement.pattern.message", replaceCriteriaEdit, ex.getMessage());
+ return false;
+ }
+
+ return true;
+ }
+
+ public void show() {
+ replaceCriteriaEdit.putUserData(SubstitutionShortInfoHandler.CURRENT_CONFIGURATION_KEY, model.getConfig());
+
+ super.show();
+ }
+
+ protected boolean isReplaceDialog() {
+ return true;
+ }
+
+ protected void addOrReplaceSelection(final String selection) {
+ super.addOrReplaceSelection(selection);
+ addOrReplaceSelectionForEditor(selection, replaceCriteriaEdit);
+ }
+}
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/ui/ReplaceUsageViewContext.java b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/ui/ReplaceUsageViewContext.java
index 6a0d352d3284..6a0d352d3284 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/ui/ReplaceUsageViewContext.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/ui/ReplaceUsageViewContext.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/ui/ReplacementPreviewDialog.java b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/ui/ReplacementPreviewDialog.java
index 5bec5a920b45..5bec5a920b45 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/ui/ReplacementPreviewDialog.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/ui/ReplacementPreviewDialog.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/Configuration.java b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/Configuration.java
index 440d33164f1d..440d33164f1d 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/Configuration.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/Configuration.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/ConfigurationCreator.java b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/ConfigurationCreator.java
index 74332fd72e74..74332fd72e74 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/ConfigurationCreator.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/ConfigurationCreator.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/ConfigurationManager.java b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/ConfigurationManager.java
index 151e78d6863f..151e78d6863f 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/ConfigurationManager.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/ConfigurationManager.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/DialogBase.java b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/DialogBase.java
index 83d93ba0d05c..83d93ba0d05c 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/DialogBase.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/DialogBase.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/EditVarConstraintsDialog.java b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/EditVarConstraintsDialog.java
index 368240ff50be..368240ff50be 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/EditVarConstraintsDialog.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/EditVarConstraintsDialog.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/ExistingTemplatesComponent.java b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/ExistingTemplatesComponent.java
index 3dd79e16175c..3dd79e16175c 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/ExistingTemplatesComponent.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/ExistingTemplatesComponent.java
diff --git a/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/SearchCommand.java b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/SearchCommand.java
new file mode 100644
index 000000000000..8cb7e55ea290
--- /dev/null
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/SearchCommand.java
@@ -0,0 +1,142 @@
+package com.intellij.structuralsearch.plugin.ui;
+
+import com.intellij.notification.NotificationGroup;
+import com.intellij.openapi.application.ModalityState;
+import com.intellij.openapi.progress.ProgressIndicator;
+import com.intellij.openapi.progress.ProgressManager;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.ui.MessageType;
+import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.openapi.wm.ToolWindowId;
+import com.intellij.psi.PsiElement;
+import com.intellij.psi.PsiFile;
+import com.intellij.psi.PsiNameIdentifierOwner;
+import com.intellij.structuralsearch.*;
+import com.intellij.structuralsearch.impl.matcher.MatchResultImpl;
+import com.intellij.structuralsearch.plugin.StructuralSearchPlugin;
+import com.intellij.usageView.UsageInfo;
+import com.intellij.usages.Usage;
+import com.intellij.usages.UsageInfo2UsageAdapter;
+import com.intellij.util.Alarm;
+import com.intellij.util.ObjectUtils;
+import com.intellij.util.Processor;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: Maxim.Mossienko
+ * Date: Mar 15, 2004
+ * Time: 4:49:07 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class SearchCommand {
+ protected UsageViewContext context;
+ private MatchingProcess process;
+ protected Project project;
+
+ public SearchCommand(Project _project, UsageViewContext _context) {
+ project = _project;
+ context = _context;
+ }
+
+ public void findUsages(final Processor<Usage> processor) {
+ final ProgressIndicator progress = ProgressManager.getInstance().getProgressIndicator();
+
+ final MatchResultSink sink = new MatchResultSink() {
+ int count;
+
+ public void setMatchingProcess(MatchingProcess _process) {
+ process = _process;
+ findStarted();
+ }
+
+ public void processFile(PsiFile element) {
+ final VirtualFile virtualFile = element.getVirtualFile();
+ if (virtualFile != null)
+ progress.setText(SSRBundle.message("looking.in.progress.message", virtualFile.getPresentableName()));
+ }
+
+ public void matchingFinished() {
+ findEnded();
+ progress.setText(SSRBundle.message("found.progress.message", count));
+ }
+
+ public ProgressIndicator getProgressIndicator() {
+ return progress;
+ }
+
+ public void newMatch(MatchResult result) {
+ UsageInfo info;
+
+ if (MatchResult.MULTI_LINE_MATCH.equals(result.getName())) {
+ int start = -1;
+ int end = -1;
+ PsiElement parent = result.getMatchRef().getElement().getParent();
+
+ for (final MatchResult matchResult : ((MatchResultImpl)result).getMatches()) {
+ PsiElement el = matchResult.getMatchRef().getElement();
+ final int elementStart = el.getTextRange().getStartOffset();
+
+ if (start == -1 || start > elementStart) {
+ start = elementStart;
+ }
+ final int newend = elementStart + el.getTextLength();
+
+ if (newend > end) {
+ end = newend;
+ }
+ }
+
+ final int parentStart = parent.getTextRange().getStartOffset();
+ int startOffset = start - parentStart;
+ info = new UsageInfo(parent, startOffset, end - parentStart);
+ }
+ else {
+ PsiElement element = result.getMatch();
+ if (element instanceof PsiNameIdentifierOwner) {
+ element = ObjectUtils.notNull(((PsiNameIdentifierOwner)element).getNameIdentifier(), element);
+ }
+ info = new UsageInfo(element, result.getStart(), result.getEnd() == -1 ? element.getTextLength() : result.getEnd());
+ }
+
+ Usage usage = new UsageInfo2UsageAdapter(info);
+ processor.process(usage);
+ foundUsage(result, usage);
+ ++count;
+ }
+ };
+
+ try {
+ new Matcher(project).findMatches(sink, context.getConfiguration().getMatchOptions());
+ }
+ catch (final StructuralSearchException e) {
+ final Alarm alarm = new Alarm();
+ alarm.addRequest(
+ new Runnable() {
+ @Override
+ public void run() {
+ NotificationGroup.toolWindowGroup("Structural Search", ToolWindowId.FIND, true)
+ .createNotification(SSRBundle.message("problem", e.getMessage()), MessageType.ERROR).notify(project);
+ }
+ },
+ 100, ModalityState.NON_MODAL
+ );
+ }
+ }
+
+ public void stopAsyncSearch() {
+ if (process!=null) process.stop();
+ }
+
+ protected void findStarted() {
+ StructuralSearchPlugin.getInstance(project).setSearchInProgress(true);
+ }
+
+ protected void findEnded() {
+ if (!project.isDisposed()) {
+ StructuralSearchPlugin.getInstance(project).setSearchInProgress(false);
+ }
+ }
+
+ protected void foundUsage(MatchResult result, Usage usage) {
+ }
+}
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/SearchConfiguration.java b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/SearchConfiguration.java
index afb2f9451bbe..afb2f9451bbe 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/SearchConfiguration.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/SearchConfiguration.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/SearchContext.java b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/SearchContext.java
index 62371e7e29d1..62371e7e29d1 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/SearchContext.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/SearchContext.java
diff --git a/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/SearchDialog.java b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/SearchDialog.java
new file mode 100644
index 000000000000..a3bee702563e
--- /dev/null
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/SearchDialog.java
@@ -0,0 +1,995 @@
+package com.intellij.structuralsearch.plugin.ui;
+
+import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer;
+import com.intellij.codeInsight.template.impl.Variable;
+import com.intellij.find.FindBundle;
+import com.intellij.find.FindProgressIndicator;
+import com.intellij.find.FindSettings;
+import com.intellij.ide.IdeBundle;
+import com.intellij.ide.util.scopeChooser.ScopeChooserCombo;
+import com.intellij.lang.Language;
+import com.intellij.lang.LanguageUtil;
+import com.intellij.openapi.application.Result;
+import com.intellij.openapi.application.WriteAction;
+import com.intellij.openapi.command.WriteCommandAction;
+import com.intellij.openapi.editor.Document;
+import com.intellij.openapi.editor.Editor;
+import com.intellij.openapi.editor.EditorFactory;
+import com.intellij.openapi.editor.SelectionModel;
+import com.intellij.openapi.editor.event.DocumentEvent;
+import com.intellij.openapi.editor.event.DocumentListener;
+import com.intellij.openapi.fileEditor.FileEditorManager;
+import com.intellij.openapi.fileTypes.FileType;
+import com.intellij.openapi.fileTypes.LanguageFileType;
+import com.intellij.openapi.fileTypes.impl.FileTypeRenderer;
+import com.intellij.openapi.progress.ProgressIndicator;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.ui.ComboBox;
+import com.intellij.openapi.ui.DialogWrapper;
+import com.intellij.openapi.util.Disposer;
+import com.intellij.openapi.util.Factory;
+import com.intellij.openapi.util.TextRange;
+import com.intellij.openapi.wm.ToolWindow;
+import com.intellij.openapi.wm.ToolWindowId;
+import com.intellij.openapi.wm.ToolWindowManager;
+import com.intellij.psi.PsiDocumentManager;
+import com.intellij.psi.PsiElement;
+import com.intellij.psi.PsiFile;
+import com.intellij.psi.codeStyle.CodeStyleManager;
+import com.intellij.psi.search.GlobalSearchScope;
+import com.intellij.psi.search.SearchScope;
+import com.intellij.structuralsearch.*;
+import com.intellij.structuralsearch.impl.matcher.MatcherImpl;
+import com.intellij.structuralsearch.plugin.StructuralSearchPlugin;
+import com.intellij.ui.ComboboxSpeedSearch;
+import com.intellij.ui.IdeBorderFactory;
+import com.intellij.ui.ListCellRendererWrapper;
+import com.intellij.ui.TitledSeparator;
+import com.intellij.usages.*;
+import com.intellij.util.Alarm;
+import com.intellij.util.Processor;
+import org.jetbrains.annotations.NonNls;
+import org.jetbrains.annotations.NotNull;
+
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.ActionEvent;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.util.*;
+import java.util.List;
+
+/**
+ * Class to show the user the request for search
+ */
+@SuppressWarnings({"RefusedBequest", "AssignmentToStaticFieldFromInstanceMethod"})
+public class SearchDialog extends DialogWrapper implements ConfigurationCreator {
+ protected SearchContext searchContext;
+
+ // text for search
+ protected Editor searchCriteriaEdit;
+
+ // options of search scope
+ private ScopeChooserCombo myScopeChooserCombo;
+
+ private JCheckBox recursiveMatching;
+ private JCheckBox caseSensitiveMatch;
+
+ private JComboBox fileTypes;
+ private JComboBox contexts;
+ private JComboBox dialects;
+ private JLabel status;
+ private JLabel statusText;
+
+ protected SearchModel model;
+ private JCheckBox openInNewTab;
+ private final Alarm myAlarm = new Alarm(Alarm.ThreadToUse.SHARED_THREAD);
+
+ public static final String USER_DEFINED = SSRBundle.message("new.template.defaultname");
+ protected final ExistingTemplatesComponent existingTemplatesComponent;
+
+ private boolean useLastConfiguration;
+
+ private static boolean ourOpenInNewTab;
+
+ @NonNls private FileType ourFtSearchVariant = StructuralSearchUtil.getDefaultFileType();
+ private static Language ourDialect = null;
+ private static String ourContext = null;
+
+ private final boolean myShowScopePanel;
+ private final boolean myRunFindActionOnClose;
+ private boolean myDoingOkAction;
+
+ private String mySavedEditorText;
+ private JPanel myContentPanel;
+ private JComponent myEditorPanel;
+
+ public SearchDialog(SearchContext searchContext) {
+ this(searchContext, true, true);
+ }
+
+ public SearchDialog(SearchContext searchContext, boolean showScope, boolean runFindActionOnClose) {
+ super(searchContext.getProject(), true);
+
+ if (showScope) setModal(false);
+ myShowScopePanel = showScope;
+ myRunFindActionOnClose = runFindActionOnClose;
+ this.searchContext = (SearchContext)searchContext.clone();
+ setTitle(getDefaultTitle());
+
+ if (runFindActionOnClose) {
+ setOKButtonText(FindBundle.message("find.dialog.find.button"));
+ }
+
+ existingTemplatesComponent = ExistingTemplatesComponent.getInstance(this.searchContext.getProject());
+ model = new SearchModel(createConfiguration());
+
+ init();
+ }
+
+ protected UsageViewContext createUsageViewContext(Configuration configuration) {
+ return new UsageViewContext(searchContext, configuration);
+ }
+
+ public void setUseLastConfiguration(boolean useLastConfiguration) {
+ this.useLastConfiguration = useLastConfiguration;
+ }
+
+ public void setSearchPattern(final Configuration config) {
+ model.setShadowConfig(config);
+ setValuesFromConfig(config);
+ initiateValidation();
+ }
+
+ protected Editor createEditor(final SearchContext searchContext, String text) {
+ Editor editor = null;
+
+ if (fileTypes != null) {
+ final FileType fileType = (FileType)fileTypes.getSelectedItem();
+ final Language dialect = (Language)dialects.getSelectedItem();
+
+ final StructuralSearchProfile profile = StructuralSearchUtil.getProfileByFileType(fileType);
+ if (profile != null) {
+ editor = profile.createEditor(searchContext, fileType, dialect, text, useLastConfiguration);
+ }
+ }
+
+ if (editor == null) {
+ final EditorFactory factory = EditorFactory.getInstance();
+ final Document document = factory.createDocument("");
+ editor = factory.createEditor(document, searchContext.getProject());
+ editor.getSettings().setFoldingOutlineShown(false);
+ }
+
+ editor.getDocument().addDocumentListener(new DocumentListener() {
+ @Override
+ public void beforeDocumentChange(final DocumentEvent event) {
+ }
+
+ @Override
+ public void documentChanged(final DocumentEvent event) {
+ initiateValidation();
+ }
+ });
+
+ return editor;
+ }
+
+ private void initiateValidation() {
+ myAlarm.cancelAllRequests();
+ myAlarm.addRequest(new Runnable() {
+
+ @Override
+ public void run() {
+ try {
+ new WriteAction(){
+ @Override
+ protected void run(Result result) throws Throwable {
+ if (!isValid()) {
+ getOKAction().setEnabled(false);
+ }
+ else {
+ getOKAction().setEnabled(true);
+ reportMessage(null, null);
+ }
+ }
+ }.execute();
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }, 500);
+ }
+
+ protected void buildOptions(JPanel searchOptions) {
+ recursiveMatching = new JCheckBox(SSRBundle.message("recursive.matching.checkbox"), true);
+ if (isRecursiveSearchEnabled()) {
+ searchOptions.add(UIUtil.createOptionLine(recursiveMatching));
+ }
+
+ caseSensitiveMatch = new JCheckBox(FindBundle.message("find.options.case.sensitive"), true);
+ searchOptions.add(UIUtil.createOptionLine(caseSensitiveMatch));
+
+ final List<FileType> types = new ArrayList<FileType>();
+
+ for (FileType fileType : StructuralSearchUtil.getSuitableFileTypes()) {
+ if (StructuralSearchUtil.getProfileByFileType(fileType) != null) {
+ types.add(fileType);
+ }
+ }
+ Collections.sort(types, new Comparator<FileType>() {
+ @Override
+ public int compare(FileType o1, FileType o2) {
+ return o1.getName().compareToIgnoreCase(o2.getName());
+ }
+ });
+
+ final DefaultComboBoxModel comboBoxModel = new DefaultComboBoxModel(types.toArray(new FileType[types.size()]));
+ comboBoxModel.setSelectedItem(ourFtSearchVariant);
+ fileTypes = new ComboBox(comboBoxModel);
+ fileTypes.setRenderer(new FileTypeRenderer());
+ new ComboboxSpeedSearch(fileTypes) {
+ @Override
+ protected String getElementText(Object element) {
+ return ((FileType)element).getName();
+ }
+ };
+ fileTypes.addItemListener(new ItemListener() {
+ @Override
+ public void itemStateChanged(ItemEvent e) {
+ updateDialectsAndContexts();
+ updateEditor();
+ }
+ });
+
+ contexts = new JComboBox(new DefaultComboBoxModel());
+ contexts.setPreferredSize(new Dimension(60, -1));
+
+ dialects = new JComboBox(new DefaultComboBoxModel());
+ dialects.setRenderer(new ListCellRendererWrapper() {
+ @Override
+ public void customize(JList list, Object value, int index, boolean selected, boolean hasFocus) {
+ if (value == null) {
+ setText("None");
+ }
+ else if (value instanceof Language) {
+ setText(((Language)value).getDisplayName());
+ }
+ }
+ });
+ dialects.addItemListener(new ItemListener() {
+ @Override
+ public void itemStateChanged(ItemEvent e) {
+ updateEditor();
+ }
+ });
+ new ComboboxSpeedSearch(dialects);
+ dialects.setPreferredSize(new Dimension(120, -1));
+
+ final JLabel jLabel = new JLabel(SSRBundle.message("search.dialog.file.type.label"));
+ final JLabel jLabel2 = new JLabel(SSRBundle.message("search.dialog.context.label"));
+ final JLabel jLabel3 = new JLabel(SSRBundle.message("search.dialog.file.dialect.label"));
+ searchOptions.add(
+ UIUtil.createOptionLine(
+ new JComponent[]{
+ jLabel,
+ fileTypes,
+ (JComponent)Box.createHorizontalStrut(8),
+ jLabel2,
+ contexts,
+ (JComponent)Box.createHorizontalStrut(8),
+ jLabel3,
+ dialects,
+ }
+ )
+ );
+
+ jLabel.setLabelFor(fileTypes);
+ jLabel2.setLabelFor(contexts);
+ jLabel3.setLabelFor(dialects);
+
+ detectFileTypeAndDialect();
+
+ fileTypes.setSelectedItem(ourFtSearchVariant);
+ fileTypes.addItemListener(new ItemListener() {
+ @Override
+ public void itemStateChanged(ItemEvent e) {
+ if (e.getStateChange() == ItemEvent.SELECTED) initiateValidation();
+ }
+ });
+
+ dialects.setSelectedItem(ourDialect);
+ contexts.setSelectedItem(ourContext);
+
+ updateDialectsAndContexts();
+ }
+
+ private void updateEditor() {
+ if (myContentPanel != null) {
+ if (myEditorPanel != null) {
+ myContentPanel.remove(myEditorPanel);
+ }
+ disposeEditorContent();
+ myEditorPanel = createEditorContent();
+ myContentPanel.add(myEditorPanel, BorderLayout.CENTER);
+ myContentPanel.revalidate();
+ }
+ }
+
+ private void updateDialectsAndContexts() {
+ final FileType fileType = (FileType)fileTypes.getSelectedItem();
+ if (fileType instanceof LanguageFileType) {
+ Language language = ((LanguageFileType)fileType).getLanguage();
+ Language[] languageDialects = LanguageUtil.getLanguageDialects(language);
+ Arrays.sort(languageDialects, new Comparator<Language>() {
+ @Override
+ public int compare(Language o1, Language o2) {
+ return o1.getDisplayName().compareTo(o2.getDisplayName());
+ }
+ });
+ Language[] variants = new Language[languageDialects.length + 1];
+ variants[0] = null;
+ System.arraycopy(languageDialects, 0, variants, 1, languageDialects.length);
+ dialects.setModel(new DefaultComboBoxModel(variants));
+ dialects.setEnabled(variants.length > 1);
+ }
+
+ final StructuralSearchProfile profile = StructuralSearchUtil.getProfileByFileType(fileType);
+
+ if (profile instanceof StructuralSearchProfileBase) {
+ final String[] contextNames = ((StructuralSearchProfileBase)profile).getContextNames();
+ if (contextNames.length > 0) {
+ contexts.setModel(new DefaultComboBoxModel(contextNames));
+ contexts.setSelectedItem(contextNames[0]);
+ contexts.setEnabled(true);
+ return;
+ }
+ }
+ contexts.setSelectedItem(null);
+ contexts.setEnabled(false);
+ }
+
+ private void detectFileTypeAndDialect() {
+ final PsiFile file = searchContext.getFile();
+ if (file != null) {
+ PsiElement context = null;
+
+ if (searchContext.getEditor() != null) {
+ context = file.findElementAt(searchContext.getEditor().getCaretModel().getOffset());
+ if (context != null) {
+ context = context.getParent();
+ }
+ }
+ if (context == null) {
+ context = file;
+ }
+
+ FileType detectedFileType = null;
+
+ StructuralSearchProfile profile = StructuralSearchUtil.getProfileByPsiElement(context);
+ if (profile != null) {
+ FileType fileType = profile.detectFileType(context);
+ if (fileType != null) {
+ detectedFileType = fileType;
+ }
+ }
+
+ if (detectedFileType == null) {
+ for (FileType fileType : StructuralSearchUtil.getSuitableFileTypes()) {
+ if (fileType instanceof LanguageFileType && ((LanguageFileType)fileType).getLanguage().equals(context.getLanguage())) {
+ detectedFileType = fileType;
+ break;
+ }
+ }
+ }
+
+ ourFtSearchVariant = detectedFileType != null ?
+ detectedFileType :
+ StructuralSearchUtil.getDefaultFileType();
+
+ // todo: detect dialect
+
+ /*if (file.getLanguage() == StdLanguages.HTML ||
+ (file.getFileType() == StdFileTypes.JSP &&
+ contextLanguage == StdLanguages.HTML
+ )
+ ) {
+ ourFileType = "html";
+ }
+ else if (file.getLanguage() == StdLanguages.XHTML ||
+ (file.getFileType() == StdFileTypes.JSPX &&
+ contextLanguage == StdLanguages.HTML
+ )) {
+ ourFileType = "xml";
+ }
+ else {
+ ourFileType = DEFAULT_TYPE_NAME;
+ }*/
+ }
+ }
+
+ protected boolean isRecursiveSearchEnabled() {
+ return true;
+ }
+
+ public void setValuesFromConfig(Configuration configuration) {
+ //searchCriteriaEdit.putUserData(SubstitutionShortInfoHandler.CURRENT_CONFIGURATION_KEY, configuration);
+
+ setDialogTitle(configuration);
+ final MatchOptions matchOptions = configuration.getMatchOptions();
+
+ UIUtil.setContent(
+ searchCriteriaEdit,
+ matchOptions.getSearchPattern(),
+ 0,
+ searchCriteriaEdit.getDocument().getTextLength(),
+ searchContext.getProject()
+ );
+
+ model.getConfig().getMatchOptions().setSearchPattern(
+ matchOptions.getSearchPattern()
+ );
+
+ recursiveMatching.setSelected(
+ isRecursiveSearchEnabled() && matchOptions.isRecursiveSearch()
+ );
+
+ caseSensitiveMatch.setSelected(
+ matchOptions.isCaseSensitiveMatch()
+ );
+
+ model.getConfig().getMatchOptions().clearVariableConstraints();
+ if (matchOptions.hasVariableConstraints()) {
+ for (Iterator<String> i = matchOptions.getVariableConstraintNames(); i.hasNext(); ) {
+ final MatchVariableConstraint constraint = (MatchVariableConstraint)matchOptions.getVariableConstraint(i.next()).clone();
+ model.getConfig().getMatchOptions().addVariableConstraint(constraint);
+ }
+ }
+
+ MatchOptions options = configuration.getMatchOptions();
+ StructuralSearchProfile profile = StructuralSearchUtil.getProfileByFileType(options.getFileType());
+ assert profile != null;
+ fileTypes.setSelectedItem(options.getFileType());
+ dialects.setSelectedItem(options.getDialect());
+ if (options.getPatternContext() != null) {
+ contexts.setSelectedItem(options.getPatternContext());
+ }
+ }
+
+ private void setDialogTitle(final Configuration configuration) {
+ setTitle(getDefaultTitle() + " - " + configuration.getName());
+ }
+
+ @Override
+ public Configuration createConfiguration() {
+ SearchConfiguration configuration = new SearchConfiguration();
+ configuration.setName(USER_DEFINED);
+ return configuration;
+ }
+
+ protected void addOrReplaceSelection(final String selection) {
+ addOrReplaceSelectionForEditor(selection, searchCriteriaEdit);
+ }
+
+ protected final void addOrReplaceSelectionForEditor(final String selection, Editor editor) {
+ final Project project = searchContext.getProject();
+ UIUtil.setContent(editor, selection, 0, -1, project);
+ final Document document = editor.getDocument();
+ editor.getSelectionModel().setSelection(0, document.getTextLength());
+ final PsiDocumentManager documentManager = PsiDocumentManager.getInstance(project);
+ documentManager.commitDocument(document);
+ final PsiFile file = documentManager.getPsiFile(document);
+ if (file == null) return;
+
+ new WriteCommandAction(project, file) {
+ @Override protected void run(@NotNull Result result) throws Throwable {
+ CodeStyleManager.getInstance(project).adjustLineIndent(file, new TextRange(0, document.getTextLength()));
+ }
+ }.execute();
+ }
+
+ protected void runAction(final Configuration config, final SearchContext searchContext) {
+ createUsageView(searchContext, config);
+ }
+
+ protected void createUsageView(final SearchContext searchContext, final Configuration config) {
+ UsageViewManager manager = UsageViewManager.getInstance(searchContext.getProject());
+
+ final UsageViewContext context = createUsageViewContext(config);
+ final UsageViewPresentation presentation = new UsageViewPresentation();
+ presentation.setOpenInNewTab(openInNewTab.isSelected());
+ presentation.setScopeText(config.getMatchOptions().getScope().getDisplayName());
+ context.configure(presentation);
+
+ final FindUsagesProcessPresentation processPresentation = new FindUsagesProcessPresentation(presentation);
+ processPresentation.setShowNotFoundMessage(true);
+ processPresentation.setShowPanelIfOnlyOneUsage(true);
+
+ processPresentation.setProgressIndicatorFactory(
+ new Factory<ProgressIndicator>() {
+ @Override
+ public ProgressIndicator create() {
+ return new FindProgressIndicator(searchContext.getProject(), presentation.getScopeText()) {
+ @Override
+ public void cancel() {
+ context.getCommand().stopAsyncSearch();
+ super.cancel();
+ }
+ };
+ }
+ }
+ );
+
+ PsiDocumentManager.getInstance(getProject()).commitAllDocuments();
+
+ manager.searchAndShowUsages(
+ new UsageTarget[]{
+ context.getTarget()
+ },
+ new Factory<UsageSearcher>() {
+ @Override
+ public UsageSearcher create() {
+ return new UsageSearcher() {
+ @Override
+ public void generate(@NotNull final Processor<Usage> processor) {
+ context.getCommand().findUsages(processor);
+ }
+ };
+ }
+ },
+ processPresentation,
+ presentation,
+ new UsageViewManager.UsageViewStateListener() {
+ @Override
+ public void usageViewCreated(@NotNull UsageView usageView) {
+ context.setUsageView(usageView);
+ context.configureActions();
+ }
+
+ @Override
+ public void findingUsagesFinished(final UsageView usageView) {
+ }
+ }
+ );
+ }
+
+ protected String getDefaultTitle() {
+ return SSRBundle.message("structural.search.title");
+ }
+
+ protected JComponent createEditorContent() {
+ JPanel result = new JPanel(new BorderLayout());
+
+ result.add(BorderLayout.NORTH, new JLabel(SSRBundle.message("search.template")));
+ searchCriteriaEdit = createEditor(searchContext, mySavedEditorText != null ? mySavedEditorText : "");
+ result.add(BorderLayout.CENTER, searchCriteriaEdit.getComponent());
+ result.setMinimumSize(new Dimension(150, 100));
+
+ return result;
+ }
+
+ protected int getRowsCount() {
+ return 4;
+ }
+
+ @Override
+ protected JComponent createCenterPanel() {
+ myContentPanel = new JPanel(new BorderLayout());
+ myEditorPanel = createEditorContent();
+ myContentPanel.add(BorderLayout.CENTER, myEditorPanel);
+ myContentPanel.add(BorderLayout.SOUTH, Box.createVerticalStrut(8));
+ JComponent centerPanel = new JPanel(new BorderLayout());
+ {
+ JPanel panel = new JPanel(new BorderLayout());
+ panel.add(BorderLayout.CENTER, myContentPanel);
+ panel.add(BorderLayout.SOUTH, createTemplateManagementButtons());
+ centerPanel.add(BorderLayout.CENTER, panel);
+ }
+
+ JPanel optionsContent = new JPanel(new BorderLayout());
+ centerPanel.add(BorderLayout.SOUTH, optionsContent);
+
+ JPanel searchOptions = new JPanel();
+ searchOptions.setLayout(new GridLayout(getRowsCount(), 1, 0, 0));
+ searchOptions.setBorder(IdeBorderFactory.createTitledBorder(SSRBundle.message("ssdialog.options.group.border"),
+ true));
+
+ myScopeChooserCombo = new ScopeChooserCombo(
+ searchContext.getProject(),
+ true,
+ false,
+ FindSettings.getInstance().getDefaultScopeName()
+ );
+ Disposer.register(myDisposable, myScopeChooserCombo);
+ JPanel allOptions = new JPanel(new BorderLayout());
+ if (myShowScopePanel) {
+ JPanel scopePanel = new JPanel(new GridBagLayout());
+
+ TitledSeparator separator = new TitledSeparator(SSRBundle.message("search.dialog.scope.label"), myScopeChooserCombo.getComboBox());
+ scopePanel.add(separator, new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
+ new Insets(5, 0, 0, 0), 0, 0));
+
+ scopePanel.add(myScopeChooserCombo, new GridBagConstraints(0, 1, 1, 1, 1, 1, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
+ new Insets(0, 10, 0, 0), 0, 0));
+
+ allOptions.add(
+ scopePanel,
+ BorderLayout.SOUTH
+ );
+
+ myScopeChooserCombo.getComboBox().addItemListener(new ItemListener() {
+ @Override
+ public void itemStateChanged(ItemEvent e) {
+ initiateValidation();
+ }
+ });
+ }
+
+ buildOptions(searchOptions);
+
+ allOptions.add(searchOptions, BorderLayout.CENTER);
+ optionsContent.add(allOptions, BorderLayout.CENTER);
+
+ if (myRunFindActionOnClose) {
+ JPanel panel = new JPanel(new BorderLayout());
+ panel.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 0));
+ openInNewTab = new JCheckBox(FindBundle.message("find.open.in.new.tab.checkbox"));
+ openInNewTab.setSelected(ourOpenInNewTab);
+ ToolWindow findWindow = ToolWindowManager.getInstance(searchContext.getProject()).getToolWindow(ToolWindowId.FIND);
+ openInNewTab.setEnabled(findWindow != null && findWindow.isAvailable());
+ panel.add(openInNewTab, BorderLayout.EAST);
+
+ optionsContent.add(BorderLayout.SOUTH, panel);
+ }
+
+ updateEditor();
+ return centerPanel;
+ }
+
+
+ @Override
+ protected JComponent createSouthPanel() {
+ final JPanel statusPanel = new JPanel(new BorderLayout(5, 0));
+ statusPanel.add(super.createSouthPanel(), BorderLayout.NORTH);
+ statusPanel.add(statusText = new JLabel(SSRBundle.message("status.message")), BorderLayout.WEST);
+ statusPanel.add(status = new JLabel(), BorderLayout.CENTER);
+ return statusPanel;
+ }
+
+ private JPanel createTemplateManagementButtons() {
+ JPanel panel = new JPanel(null);
+ panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
+ panel.add(Box.createHorizontalGlue());
+
+ panel.add(
+ createJButtonForAction(new AbstractAction() {
+ {
+ putValue(NAME, SSRBundle.message("save.template.text.button"));
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ String name = showSaveTemplateAsDialog();
+
+ if (name != null) {
+ final Project project = searchContext.getProject();
+ final ConfigurationManager configurationManager = StructuralSearchPlugin.getInstance(project).getConfigurationManager();
+ final Collection<Configuration> configurations = configurationManager.getConfigurations();
+
+ if (configurations != null) {
+ name = ConfigurationManager.findAppropriateName(configurations, name, project);
+ if (name == null) return;
+ }
+
+ model.getConfig().setName(name);
+ setValuesToConfig(model.getConfig());
+ setDialogTitle(model.getConfig());
+
+ if (model.getShadowConfig() == null ||
+ model.getShadowConfig().isPredefined()) {
+ existingTemplatesComponent.addConfigurationToUserTemplates(model.getConfig());
+ }
+ else { // ???
+ setValuesToConfig(model.getShadowConfig());
+ model.getShadowConfig().setName(name);
+ }
+ }
+ }
+ })
+ );
+
+ panel.add(
+ Box.createHorizontalStrut(8)
+ );
+
+ panel.add(
+ createJButtonForAction(
+ new AbstractAction() {
+ {
+ putValue(NAME, SSRBundle.message("edit.variables.button"));
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ EditVarConstraintsDialog.setProject(searchContext.getProject());
+ new EditVarConstraintsDialog(
+ searchContext.getProject(),
+ model, getVariablesFromListeners(),
+ isReplaceDialog(),
+ (FileType)fileTypes.getSelectedItem()
+ ).show();
+ initiateValidation();
+ EditVarConstraintsDialog.setProject(null);
+ }
+ }
+ )
+ );
+
+ panel.add(
+ Box.createHorizontalStrut(8)
+ );
+
+ panel.add(
+ createJButtonForAction(
+ new AbstractAction() {
+ {
+ putValue(NAME, SSRBundle.message("history.button"));
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ SelectTemplateDialog dialog = new SelectTemplateDialog(searchContext.getProject(), true, isReplaceDialog());
+ dialog.show();
+
+ if (!dialog.isOK()) {
+ return;
+ }
+ Configuration[] configurations = dialog.getSelectedConfigurations();
+ if (configurations.length == 1) {
+ setSearchPattern(configurations[0]);
+ }
+ }
+ }
+ )
+ );
+
+ panel.add(
+ Box.createHorizontalStrut(8)
+ );
+
+ panel.add(
+ createJButtonForAction(
+ new AbstractAction() {
+ {
+ putValue(NAME, SSRBundle.message("copy.existing.template.button"));
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ SelectTemplateDialog dialog = new SelectTemplateDialog(searchContext.getProject(), false, isReplaceDialog());
+ dialog.show();
+
+ if (!dialog.isOK()) {
+ return;
+ }
+ Configuration[] configurations = dialog.getSelectedConfigurations();
+ if (configurations.length == 1) {
+ setSearchPattern(configurations[0]);
+ }
+ }
+ }
+ )
+ );
+
+ return panel;
+ }
+
+ protected List<Variable> getVariablesFromListeners() {
+ return getVarsFrom(searchCriteriaEdit);
+ }
+
+ protected static ArrayList<Variable> getVarsFrom(Editor searchCriteriaEdit) {
+ SubstitutionShortInfoHandler handler = searchCriteriaEdit.getUserData(UIUtil.LISTENER_KEY);
+ return new ArrayList<Variable>(handler.getVariables());
+ }
+
+ public final Project getProject() {
+ return searchContext.getProject();
+ }
+
+ public String showSaveTemplateAsDialog() {
+ return ConfigurationManager.showSaveTemplateAsDialog(
+ model.getShadowConfig() != null ? model.getShadowConfig().getName() : SSRBundle.message("user.defined.category"),
+ searchContext.getProject()
+ );
+ }
+
+ protected boolean isReplaceDialog() {
+ return false;
+ }
+
+ @Override
+ public void show() {
+ StructuralSearchPlugin.getInstance(getProject()).setDialogVisible(true);
+ Configuration.setActiveCreator(this);
+ searchCriteriaEdit.putUserData(
+ SubstitutionShortInfoHandler.CURRENT_CONFIGURATION_KEY,
+ model.getConfig()
+ );
+
+ if (!useLastConfiguration) {
+ final Editor editor = FileEditorManager.getInstance(searchContext.getProject()).getSelectedTextEditor();
+ boolean setSomeText = false;
+
+ if (editor != null) {
+ final SelectionModel selectionModel = editor.getSelectionModel();
+
+ if (selectionModel.hasSelection()) {
+ addOrReplaceSelection(selectionModel.getSelectedText());
+ existingTemplatesComponent.getPatternTree().setSelectionPath(null);
+ existingTemplatesComponent.getHistoryList().setSelectedIndex(-1);
+ setSomeText = true;
+ }
+ }
+
+ if (!setSomeText) {
+ int selection = existingTemplatesComponent.getHistoryList().getSelectedIndex();
+ if (selection != -1) {
+ setValuesFromConfig(
+ (Configuration)existingTemplatesComponent.getHistoryList().getSelectedValue()
+ );
+ }
+ }
+ }
+
+ initiateValidation();
+
+ super.show();
+ }
+
+ @Override
+ public JComponent getPreferredFocusedComponent() {
+ return searchCriteriaEdit.getContentComponent();
+ }
+
+ // Performs ok action
+ @Override
+ protected void doOKAction() {
+ SearchScope selectedScope = getSelectedScope();
+ if (selectedScope == null) return;
+
+ myDoingOkAction = true;
+ boolean result = isValid();
+ myDoingOkAction = false;
+ if (!result) return;
+
+ myAlarm.cancelAllRequests();
+ super.doOKAction();
+ if (!myRunFindActionOnClose) return;
+
+ FindSettings.getInstance().setDefaultScopeName(selectedScope.getDisplayName());
+ ourOpenInNewTab = openInNewTab.isSelected();
+
+ try {
+ if (model.getShadowConfig() != null) {
+ if (model.getShadowConfig().isPredefined()) {
+ model.getConfig().setName(
+ model.getShadowConfig().getName()
+ );
+ } //else {
+ // // user template, save it
+ // setValuesToConfig(model.getShadowConfig());
+ //}
+ }
+ existingTemplatesComponent.addConfigurationToHistory(model.getConfig());
+
+ runAction(model.getConfig(), searchContext);
+ }
+ catch (MalformedPatternException ex) {
+ reportMessage("this.pattern.is.malformed.message", searchCriteriaEdit, ex.getMessage());
+ }
+ }
+
+ public Configuration getConfiguration() {
+ return model.getConfig();
+ }
+
+ private SearchScope getSelectedScope() {
+ return myScopeChooserCombo.getSelectedScope();
+ }
+
+ protected boolean isValid() {
+ setValuesToConfig(model.getConfig());
+ boolean result = true;
+
+ try {
+ MatcherImpl.validate(searchContext.getProject(), model.getConfig().getMatchOptions());
+ }
+ catch (MalformedPatternException ex) {
+ if (myRunFindActionOnClose) {
+ reportMessage(
+ "this.pattern.is.malformed.message",
+ searchCriteriaEdit,
+ ex.getMessage() != null ? ex.getMessage() : ""
+ );
+ result = false;
+ }
+ }
+ catch (UnsupportedPatternException ex) {
+ reportMessage("this.pattern.is.unsupported.message", searchCriteriaEdit, ex.getMessage());
+ result = false;
+ }
+
+ //getOKAction().setEnabled(result);
+ return result;
+ }
+
+ protected void reportMessage(@NonNls String messageId, Editor editor, Object... params) {
+ final String message = messageId != null ? SSRBundle.message(messageId, params) : "";
+ status.setText(message);
+ status.setToolTipText(message);
+ status.revalidate();
+ statusText.setLabelFor(editor != null ? editor.getContentComponent() : null);
+ }
+
+ protected void setValuesToConfig(Configuration config) {
+
+ MatchOptions options = config.getMatchOptions();
+
+ boolean searchWithinHierarchy = IdeBundle.message("scope.class.hierarchy").equals(myScopeChooserCombo.getSelectedScopeName());
+ // We need to reset search within hierarchy scope during online validation since the scope works with user participation
+ options.setScope(
+ searchWithinHierarchy && !myDoingOkAction ? GlobalSearchScope.projectScope(getProject()) : myScopeChooserCombo.getSelectedScope());
+ options.setLooseMatching(true);
+ options.setRecursiveSearch(isRecursiveSearchEnabled() && recursiveMatching.isSelected());
+
+ ourFtSearchVariant = (FileType)fileTypes.getSelectedItem();
+ ourDialect = (Language)dialects.getSelectedItem();
+ ourContext = (String)contexts.getSelectedItem();
+ FileType fileType = ourFtSearchVariant;
+ options.setFileType(fileType);
+ options.setDialect(ourDialect);
+ options.setPatternContext(ourContext);
+
+ options.setSearchPattern(searchCriteriaEdit.getDocument().getText());
+ options.setCaseSensitiveMatch(caseSensitiveMatch.isSelected());
+ }
+
+ @Override
+ protected String getDimensionServiceKey() {
+ return "#com.intellij.structuralsearch.plugin.ui.SearchDialog";
+ }
+
+ @Override
+ public void dispose() {
+ Configuration.setActiveCreator(null);
+ disposeEditorContent();
+
+ myAlarm.cancelAllRequests();
+
+ super.dispose();
+ StructuralSearchPlugin.getInstance(getProject()).setDialogVisible(false);
+ }
+
+ protected void disposeEditorContent() {
+ mySavedEditorText = searchCriteriaEdit.getDocument().getText();
+
+ // this will remove from myExcludedSet
+ final PsiFile file = PsiDocumentManager.getInstance(searchContext.getProject()).getPsiFile(searchCriteriaEdit.getDocument());
+ if (file != null) {
+ DaemonCodeAnalyzer.getInstance(searchContext.getProject()).setHighlightingEnabled(file, true);
+ }
+
+ EditorFactory.getInstance().releaseEditor(searchCriteriaEdit);
+ }
+
+ @Override
+ protected String getHelpId() {
+ return "find.structuredSearch";
+ }
+
+ public SearchContext getSearchContext() {
+ return searchContext;
+ }
+}
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/SearchModel.java b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/SearchModel.java
index 812ca6b0dc9b..812ca6b0dc9b 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/SearchModel.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/SearchModel.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/SelectTemplateDialog.java b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/SelectTemplateDialog.java
index b74715ecf07a..b74715ecf07a 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/SelectTemplateDialog.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/SelectTemplateDialog.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/SubstitutionShortInfoHandler.java b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/SubstitutionShortInfoHandler.java
index 32f1302336f3..32f1302336f3 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/SubstitutionShortInfoHandler.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/SubstitutionShortInfoHandler.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/UIUtil.java b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/UIUtil.java
index aa3ca82725b0..aa3ca82725b0 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/UIUtil.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/UIUtil.java
diff --git a/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/UsageViewContext.java b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/UsageViewContext.java
new file mode 100644
index 000000000000..afd2ae1b029d
--- /dev/null
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/UsageViewContext.java
@@ -0,0 +1,190 @@
+package com.intellij.structuralsearch.plugin.ui;
+
+import com.intellij.navigation.ItemPresentation;
+import com.intellij.openapi.actionSystem.*;
+import com.intellij.openapi.editor.Editor;
+import com.intellij.openapi.fileEditor.FileEditor;
+import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.psi.PsiFile;
+import com.intellij.psi.search.GlobalSearchScope;
+import com.intellij.structuralsearch.SSRBundle;
+import com.intellij.structuralsearch.plugin.replace.ui.ReplaceCommand;
+import com.intellij.usages.*;
+import org.jetbrains.annotations.NotNull;
+
+import javax.swing.*;
+import java.util.Set;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: Maxim.Mossienko
+ * Date: Mar 9, 2005
+ * Time: 2:47:49 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class UsageViewContext {
+ protected final SearchContext mySearchContext;
+ private UsageView myUsageView;
+ protected final Configuration myConfiguration;
+ private Set<Usage> myExcludedSet;
+ private SearchCommand myCommand;
+
+ protected UsageViewContext(SearchContext _searchContext,Configuration _configuration) {
+ myConfiguration = _configuration;
+ mySearchContext = _searchContext;
+ }
+
+ public boolean isExcluded(Usage usage) {
+ if (myExcludedSet == null) myExcludedSet = myUsageView.getExcludedUsages();
+ return myExcludedSet.contains(usage);
+ }
+
+ public UsageView getUsageView() {
+ return myUsageView;
+ }
+
+ public void setUsageView(final UsageView usageView) {
+ myUsageView = usageView;
+ }
+
+ public Configuration getConfiguration() {
+ return myConfiguration;
+ }
+
+ public SearchCommand getCommand() {
+ if (myCommand == null) myCommand = createCommand();
+ return myCommand;
+ }
+
+ protected SearchCommand createCommand() {
+ return new SearchCommand(mySearchContext.getProject(), this);
+ }
+
+ protected String _getPresentableText() {
+ return myConfiguration.getMatchOptions().getSearchPattern();
+ }
+
+ public UsageTarget getTarget() {
+ return new MyUsageTarget(_getPresentableText());
+ }
+
+ public void configure(@NotNull UsageViewPresentation presentation) {
+ String s = _getPresentableText();
+ if (s.length() > 15) s = s.substring(0,15) + "...";
+ final String usagesString = SSRBundle.message("occurrences.of", s);
+ presentation.setUsagesString(usagesString);
+ presentation.setTabText(StringUtil.capitalize(usagesString));
+ presentation.setUsagesWord(SSRBundle.message("occurrence"));
+ presentation.setCodeUsagesString(SSRBundle.message("found.occurrences"));
+ }
+
+ protected void configureActions() {}
+
+ private class MyUsageTarget implements ConfigurableUsageTarget,ItemPresentation, TypeSafeDataProvider {
+ private final String myPresentableText;
+
+ MyUsageTarget(String str) {
+ myPresentableText = str;
+ }
+
+ @Override
+ public String getPresentableText() {
+ return myPresentableText;
+ }
+
+ @Override
+ public String getLocationString() {
+ //noinspection HardCodedStringLiteral
+ return "Do Not Know Where";
+ }
+
+ @Override
+ public Icon getIcon(boolean open) {
+ return null;
+ }
+
+ @Override
+ public void findUsages() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void findUsagesInEditor(@NotNull FileEditor editor) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void highlightUsages(@NotNull PsiFile file, @NotNull Editor editor, boolean clearHighlights) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public boolean isValid() {
+ return true;
+ }
+
+ @Override
+ public boolean isReadOnly() {
+ return true;
+ }
+
+ @Override
+ public VirtualFile[] getFiles() {
+ return null;
+ }
+
+ @Override
+ public void update() {
+ }
+
+ @Override
+ public String getName() {
+ //noinspection HardCodedStringLiteral
+ return "my name";
+ }
+
+ @Override
+ public ItemPresentation getPresentation() {
+ return this;
+ }
+
+ @Override
+ public void navigate(boolean requestFocus) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public boolean canNavigate() {
+ return false;
+ }
+
+ @Override
+ public boolean canNavigateToSource() {
+ return false;
+ }
+
+ @Override
+ public void showSettings() {
+ UIUtil.invokeAction(myConfiguration, mySearchContext);
+ }
+
+ @Override
+ public KeyboardShortcut getShortcut() {
+ return ActionManager.getInstance().getKeyboardShortcut(getCommand() instanceof ReplaceCommand ? "StructuralSearchPlugin.StructuralReplaceAction":"StructuralSearchPlugin.StructuralSearchAction");
+ }
+
+ @NotNull
+ @Override
+ public String getLongDescriptiveName() {
+ return _getPresentableText();
+ }
+
+ @Override
+ public void calcData(DataKey key, DataSink sink) {
+ if (key == UsageView.USAGE_SCOPE) {
+ sink.put(UsageView.USAGE_SCOPE, GlobalSearchScope.allScope(mySearchContext.getProject()));
+ }
+ }
+ }
+}
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/VarConstraints.form b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/VarConstraints.form
index 20094b213e64..20094b213e64 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/VarConstraints.form
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/VarConstraints.form
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/util/CollectingMatchResultSink.java b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/util/CollectingMatchResultSink.java
index 4caff77bdc06..4caff77bdc06 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/util/CollectingMatchResultSink.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/util/CollectingMatchResultSink.java
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/util/SmartPsiPointer.java b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/util/SmartPsiPointer.java
index 0fee846c77b0..0fee846c77b0 100644
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/util/SmartPsiPointer.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/util/SmartPsiPointer.java
diff --git a/plugins/structuralsearch/source/com/intellij/tokenindex/AnonymToken.java b/platform/structuralsearch/source/com/intellij/tokenindex/AnonymToken.java
index c364ccc3f9c5..c364ccc3f9c5 100644
--- a/plugins/structuralsearch/source/com/intellij/tokenindex/AnonymToken.java
+++ b/platform/structuralsearch/source/com/intellij/tokenindex/AnonymToken.java
diff --git a/plugins/structuralsearch/source/com/intellij/tokenindex/IndentToken.java b/platform/structuralsearch/source/com/intellij/tokenindex/IndentToken.java
index 9409d185c808..9409d185c808 100644
--- a/plugins/structuralsearch/source/com/intellij/tokenindex/IndentToken.java
+++ b/platform/structuralsearch/source/com/intellij/tokenindex/IndentToken.java
diff --git a/plugins/structuralsearch/source/com/intellij/tokenindex/LanguageTokenizer.java b/platform/structuralsearch/source/com/intellij/tokenindex/LanguageTokenizer.java
index 7e8986b25ada..7e8986b25ada 100644
--- a/plugins/structuralsearch/source/com/intellij/tokenindex/LanguageTokenizer.java
+++ b/platform/structuralsearch/source/com/intellij/tokenindex/LanguageTokenizer.java
diff --git a/plugins/structuralsearch/source/com/intellij/tokenindex/PathMarkerToken.java b/platform/structuralsearch/source/com/intellij/tokenindex/PathMarkerToken.java
index f74590f46bb1..f74590f46bb1 100644
--- a/plugins/structuralsearch/source/com/intellij/tokenindex/PathMarkerToken.java
+++ b/platform/structuralsearch/source/com/intellij/tokenindex/PathMarkerToken.java
diff --git a/plugins/structuralsearch/source/com/intellij/tokenindex/PsiMarkerToken.java b/platform/structuralsearch/source/com/intellij/tokenindex/PsiMarkerToken.java
index c2e7c8b3cf89..c2e7c8b3cf89 100644
--- a/plugins/structuralsearch/source/com/intellij/tokenindex/PsiMarkerToken.java
+++ b/platform/structuralsearch/source/com/intellij/tokenindex/PsiMarkerToken.java
diff --git a/plugins/structuralsearch/source/com/intellij/tokenindex/RecursiveTokenizingVisitor.java b/platform/structuralsearch/source/com/intellij/tokenindex/RecursiveTokenizingVisitor.java
index 013f804a8225..013f804a8225 100644
--- a/plugins/structuralsearch/source/com/intellij/tokenindex/RecursiveTokenizingVisitor.java
+++ b/platform/structuralsearch/source/com/intellij/tokenindex/RecursiveTokenizingVisitor.java
diff --git a/plugins/structuralsearch/source/com/intellij/tokenindex/TextToken.java b/platform/structuralsearch/source/com/intellij/tokenindex/TextToken.java
index 729491935cfe..729491935cfe 100644
--- a/plugins/structuralsearch/source/com/intellij/tokenindex/TextToken.java
+++ b/platform/structuralsearch/source/com/intellij/tokenindex/TextToken.java
diff --git a/plugins/structuralsearch/source/com/intellij/tokenindex/Token.java b/platform/structuralsearch/source/com/intellij/tokenindex/Token.java
index 2b5428d31826..2b5428d31826 100644
--- a/plugins/structuralsearch/source/com/intellij/tokenindex/Token.java
+++ b/platform/structuralsearch/source/com/intellij/tokenindex/Token.java
diff --git a/plugins/structuralsearch/source/com/intellij/tokenindex/TokenIndex.java b/platform/structuralsearch/source/com/intellij/tokenindex/TokenIndex.java
index 4547092eb58f..4547092eb58f 100644
--- a/plugins/structuralsearch/source/com/intellij/tokenindex/TokenIndex.java
+++ b/platform/structuralsearch/source/com/intellij/tokenindex/TokenIndex.java
diff --git a/plugins/structuralsearch/source/com/intellij/tokenindex/TokenIndexKey.java b/platform/structuralsearch/source/com/intellij/tokenindex/TokenIndexKey.java
index 8c6ec1d93875..8c6ec1d93875 100644
--- a/plugins/structuralsearch/source/com/intellij/tokenindex/TokenIndexKey.java
+++ b/platform/structuralsearch/source/com/intellij/tokenindex/TokenIndexKey.java
diff --git a/plugins/structuralsearch/source/com/intellij/tokenindex/TokenIndexKeyDescriptor.java b/platform/structuralsearch/source/com/intellij/tokenindex/TokenIndexKeyDescriptor.java
index 901508ce371d..901508ce371d 100644
--- a/plugins/structuralsearch/source/com/intellij/tokenindex/TokenIndexKeyDescriptor.java
+++ b/platform/structuralsearch/source/com/intellij/tokenindex/TokenIndexKeyDescriptor.java
diff --git a/plugins/structuralsearch/source/com/intellij/tokenindex/Tokenizer.java b/platform/structuralsearch/source/com/intellij/tokenindex/Tokenizer.java
index c1ce0c70e264..c1ce0c70e264 100644
--- a/plugins/structuralsearch/source/com/intellij/tokenindex/Tokenizer.java
+++ b/platform/structuralsearch/source/com/intellij/tokenindex/Tokenizer.java
diff --git a/plugins/structuralsearch/source/inspectionDescriptions/SSBasedInspection.html b/platform/structuralsearch/source/inspectionDescriptions/SSBasedInspection.html
index b013f6beba4b..b013f6beba4b 100644
--- a/plugins/structuralsearch/source/inspectionDescriptions/SSBasedInspection.html
+++ b/platform/structuralsearch/source/inspectionDescriptions/SSBasedInspection.html
diff --git a/platform/structuralsearch/source/messages/SSRBundle.properties b/platform/structuralsearch/source/messages/SSRBundle.properties
new file mode 100644
index 000000000000..bfd12890ffb9
--- /dev/null
+++ b/platform/structuralsearch/source/messages/SSRBundle.properties
@@ -0,0 +1,233 @@
+search.produced.too.many.results.message=Search produced too many results, stopping the search process
+
+#replacement dialog preview
+structural.replace.preview.dialog.title=Structural Replace Preview
+replace.preview.oktext=&Replace
+replacement.code=Replacement code
+
+# Search Dialog specific titles/options
+structural.search.title=Structural Search
+search.template=Search template:
+template.name.button=Template name
+
+save.template.description.button=Save Template
+save.template.text.button=S&ave template...
+ssdialog.options.group.border=Options
+new.template.defaultname=user defined
+
+recursive.matching.checkbox=&Recursive matching
+
+edit.variables.button=E&dit variables...
+history.button=&History...
+copy.existing.template.button=Co&py existing template...
+
+open.in.new.tab.checkbox=Open in new &tab
+
+search.dialog.scope.label=&Scope
+search.dialog.file.type.label=File t&ype:
+search.dialog.context.label=C&ontext:
+search.dialog.file.dialect.label=D&ialect:
+
+#search usage view specific
+looking.in.progress.message=Looking in {0}
+found.progress.message=Found {0} occurrences
+occurrences.of=occurrences of {0}
+occurrence=occurrence
+found.occurrences=Found occurrence
+
+# search dialog messages
+this.pattern.is.malformed.message=This pattern is malformed\n {0}
+this.pattern.is.unsupported.message=This pattern is unsupported
+incorrect.pattern.message=Incorrect pattern
+
+used.templates.history.dialog.title=Used Templates History
+existing.templates.dialog.title=Existing Templates
+selecttemplate.template.preview=Template preview:
+selecttemplate.template.label.please.select.template=<html><body><center>Please select template in the tree on the left.</center></body></html>
+
+# Replace Dialog specific titles/options
+structural.replace.title=Structural Replace
+shorten.fully.qualified.names.checkbox=Sh&orten fully qualified names
+format.according.to.style.checkbox=Fo&rmat according to style
+replacement.template.label=Replacement template:
+
+# Replace validation messages
+unsupported.replacement.pattern.message=Unsupported Replacement Pattern {0}
+malformed.replacement.pattern.message=Malformed Replacement Pattern {0}
+
+#replacement usage view specific
+preview.replacement.button=&Preview Replacement
+do.replace.all.button=Replace &All
+replace.selected.button=&Replace Selected
+replaceusageview.text={0} by {1}
+
+# predefined configuration categories
+expressions.category=expressions
+user.defined.category=user defined
+xml_html.category=xml/html
+generics.category=generics
+misc.category=miscellaneous
+metadata.category=comments, javadoc and metadata
+class.category=class-based
+operators.category=operators
+j2ee.category=j2ee
+interesting.category=interesting
+used.templates=Used templates:
+
+# predefined configuration names
+
+predefined.configuration.method.calls=method calls
+predefined.configuration.struts.1.1.actions=Struts 1.1 actions
+predefined.configuration.ejb.interface=ejb interface
+predefined.configuration.servlets=servlets
+predefined.configuration.unboxing.in.method.calls=unboxing in method calls
+predefined.configuration.boxing.in.method.calls=boxing in method calls
+predefined.configuration.unboxing.in.declarations=unboxing in declarations
+predefined.configuration.boxing.in.declarations=boxing in declarations
+predefined.configuration.filters=filters
+predefined.configuration.session.ejb=session ejb
+predefined.configuration.fields.variables.read=fields/variables read
+predefined.configuration.symbol=symbol
+predefined.configuration.inner.classes=inner classes
+predefined.configuration.]junit.test.cases=junit test cases
+predefined.configuration.ifs=if's
+predefined.configuration.anonymous.classes=anonymous classes
+predefined.configuration.javadoc.tags=javadoc tags
+predefined.configuration.all.methods.of.the.class.within.hierarchy=all methods of the class (within hierarchy)
+predefined.configuration.similar.methods.structure=similar methods structure
+predefined.configuration.class.implements.two.interfaces=class implementing two interfaces
+predefined.configuration.bean.info.classes=Bean info classes
+predefined.configuration.all.expressions.of.some.type=all expressions of some type
+predefined.configuration.variables.of.generic.types=variables of generic types
+predefined.configuration.comments=comments
+predefined.configuration.fields_variables.with.given.name.pattern.updated=fields/variables with given name pattern updated
+predefined.configuration.trys=try's
+predefined.configuration.block.dcls=block dcls
+predefined.configuration.methods.of.the.class=methods of the class
+predefined.configuration.instanceof=instanceof
+predefined.configuration.implementors.of.interface.within.hierarchy=implementors of interface (within hierarchy)
+predefined.configuration.generic.casts=generic casts
+predefined.configuration.field.selections=field selections
+predefined.configuration.fields.of.the.class=fields of the class
+predefined.configuration.array.access=array access
+predefined.configuration.usage.of.derived.type.in.cast=usage of derived type in cast
+predefined.configuration.annotated.methods=annotated methods
+predefined.configuration.not.annotated.methods=not annotated methods
+predefined.configuration.annotation.declarations=annotation declarations
+predefined.configuration.annotated.class=annotated class
+predefined.configuration.entity.ejb=entity ejb
+predefined.configuration.generic.methods=generic methods
+predefined.configuration.cloneable.implementations=Cloneable implementations
+predefined.configuration.xdoclet.metadata=XDoclet metadata
+predefined.configuration.type.var.substitutions.in.intanceof.with.generic.types=type var substitutions in intanceof with generic types
+predefined.configuration.singletons=singletons
+predefined.configuration.switches=switches
+predefined.configuration.foreaches=foreach loops
+predefined.configuration.interfaces=interfaces
+predefined.configuration.string.literals=string literals
+predefined.configuration.all.inner.classes.within.hierarchy=all inner classes (within hierarchy)
+predefined.configuration.direct.subclasses=direct subclasses
+predefined.configuration.javadoc.annotated.methods=javadoc annotated methods
+predefined.configuration.javadoc.annotated.fields=javadoc annotated fields
+predefined.configuration.assignments=assignments
+predefined.configuration.casts=casts
+predefined.configuration.serializable.classes.and.their.serialization.implementation=Serializable classes and their serialization implementation
+predefined.configuration.annotated.fields=annotated fields
+predefined.configuration.generic.classes=generic classes
+predefined.configuration.javadoc.annotated.class=javadoc annotated class
+predefined.configuration.constructors.of.the.class=constructors of the class
+predefined.configuration.typed.symbol=typed symbol
+predefined.configuration.all.fields.of.the.class=all fields of the class
+predefined.configuration.instance.fields.of.the.class=instance fields of the class
+predefined.configuration.packagelocal.fields.of.the.class=package local fields of the class
+predefined.configuration.classes=classes
+predefined.configuration.new.expressions=new expressions
+predefined.configuration.lambdas=lambdas
+
+# edit variable constraint dialog options
+invalid.regular.expression=Invalid regular expression
+invalid.occurence.count=Invalid occurrence count
+editvarcontraints.this.variable.is.target.of.the.search=This variable is target of the search
+editvarcontraints.unlimited=Unlimited
+editvarcontraints.maximum.count=Maximum count\:
+editvarcontraints.minimum.count=Minimum count\:
+editvarcontraints.apply.constraint.within.type.hierarchy=Apply constraint within type hierarchy
+editvarcontraints.invert.condition=Invert condition
+editvarcontraints.text.regular.expression.for.formal.argument.type.of.the.method=Text/regexp for formal argument type of the method\:
+editvarcontraints.text.regular.expression.for.java.expression.type=Text/regexp for java expression type\:
+editvarcontraints.value.is.written=Value is written
+editvarcontraints.value.is.read=Value is read
+editvarcontraints.whole.words.only=Whole words only
+editvarcontraints.text.regular.expression=Text/regexp\:
+editvarcontraints.edit.variables=Edit Variables
+
+# tooltip message fragment on ss variables
+no.constraints.specified.tooltip.message=no constraints specified
+script.option.text=Script text\:
+occurs.tooltip.message=occurs: {0}
+min.occurs.tooltip.message=min occurs: {0}, max occurs: {1}
+target.tooltip.message=target
+text.tooltip.message={0} like: {1}{2}
+exprtype.tooltip.message={0} like: {1}{2}
+not.tooltip.message=not
+within.hierarchy.tooltip.message=\ within hierarchy
+script.tooltip.message=script: {0}
+replacement.variable.is.not.defined.message=Replacement variable {0} is not defined.
+replacement.variable.is.not.valid=Replacement variable {0} has script code problem {1}
+replacement.template.is.not.expression.error.message=The search template is a well formed expression, but the replacement template is not an expression.
+replacement.template.expression.not.supported=Replacement of expression is not supported for {0}
+replacement.not.supported.for.filetype=Replacement is not supported for {0} file type
+search.template.is.not.expression.error.message=The search template is not an expression, but the replacement template is a well formed expression.
+create.template.action.name=Create Template
+remove.template.action.name=Remove Template
+
+modify.editor.content.command.name=modify editor content
+var.constraints.variables.border=Variables
+var.constraints.occurrences.count.border=Occurrences count
+var.constraints.script.constraints.border=Script constraints
+var.constraints.expression.constraints.border=Expression constraints
+var.constraints.text.constraints.border=Text constraints
+different.strategies.for.top.level.nodes.error.message=Different strategies for top level nodes
+option.is.not.recognized.error.message={0} condition is not recognized
+reg.exp.should.be.delimited.with.spaces.error.message=Reg exp should be delimited with spaces
+reg.exp.in.expr.type.should.be.delimited.with.spaces.error.message=Reg exp in expr type should be delimited with spaces
+reg.exp.in.formal.arg.type.should.be.delimited.with.spaces.error.message=Reg exp in formal arg type should be delimited with spaces
+no.reg.exp.specified.error.message=Missing regular expression
+script.should.be.delimited.with.spaces.error.message=Script should be delimited with spaces
+
+error.two.different.type.constraints=Two different type constraints
+error.incorrect.regexp.constraint=Incorrect reg exp constraint:{0} for {1}
+error.expected.character=Character expected after single quote
+error.overflow=Value overflow
+error.expected.brace1="Digit, '}' or ',' expected"
+error.expected.brace2="Digit or '}' expected"
+error.expected.condition=Condition expected after ''{0}''
+error.expected.condition.or.bracket=Condition or ']' expected
+invalid.modifier.type=Invalid modifier type {0}
+
+SSRInspection.replace.with=Replace with ''{0}''
+SSRInspection.family.name=Replace Structurally
+SSRInspection.display.name=Structural Search Inspection
+SSRInspection.add.search.template.button=Add Search template...
+SSRInspection.add.replace.template.button=Add Replace template...
+SSRInspection.selected.templates=Selected templates:
+status.message=Status:
+overwrite.message=Confirm overwrite configuration with the same name
+overwrite.title=Confirm Overwrite Saved Configuration
+ssr.will.not.find.anything=It does not match anything in selected scope
+predefined.configuration.class.static.blocks=static blocks in class
+predefined.configuration.class.instance.initialization.blocks=instance initialization blocks
+predefined.configuration.class.any.initialization.blocks=any class initialization block
+predefined.configuration.logging.without.if=logging without if
+predefined.configuration.class.with.parameterless.constructors=classes with parameterless constructors
+predefined.configuration.static.fields.without.final=static fields that are not final
+invalid.groovy.script=Invalid Groovy Script
+groovy.script.error=Groovy Script execution error: {0}
+template.problem=Structural Search Inspection problem in template ''{0}''
+problem=Structural Search problem: {0}
+complete.match.variable.name=Complete Match
+predefined.configuration.sample.method.invokation.with.constant.argument=sample method invocation with constant parameter
+predefined.configuration.interfaces.having.no.descendants=interface that is not implemented or extended
+predefined.configuration.enums=enums
+regular.expression.help.label=Regular Expressions Help
+edit.groovy.script.constraint.title=Edit Groovy Script Constraint
diff --git a/plugins/structuralsearch/structuralsearch-tests.iml b/platform/structuralsearch/structuralsearch-tests.iml
index a05a995fe450..a05a995fe450 100644
--- a/plugins/structuralsearch/structuralsearch-tests.iml
+++ b/platform/structuralsearch/structuralsearch-tests.iml
diff --git a/plugins/structuralsearch/structuralsearch.iml b/platform/structuralsearch/structuralsearch.iml
index 5bc64abd229c..5bc64abd229c 100644
--- a/plugins/structuralsearch/structuralsearch.iml
+++ b/platform/structuralsearch/structuralsearch.iml
diff --git a/plugins/structuralsearch/testData/java/DoNotFindReturn.java b/platform/structuralsearch/testData/java/DoNotFindReturn.java
index 2a97989b7564..2a97989b7564 100644
--- a/plugins/structuralsearch/testData/java/DoNotFindReturn.java
+++ b/platform/structuralsearch/testData/java/DoNotFindReturn.java
diff --git a/plugins/structuralsearch/testData/java/ReformatAndShortenClassRefPerformance_pattern.java b/platform/structuralsearch/testData/java/ReformatAndShortenClassRefPerformance_pattern.java
index 1200d6f9624f..1200d6f9624f 100644
--- a/plugins/structuralsearch/testData/java/ReformatAndShortenClassRefPerformance_pattern.java
+++ b/platform/structuralsearch/testData/java/ReformatAndShortenClassRefPerformance_pattern.java
diff --git a/plugins/structuralsearch/testData/java/ReformatAndShortenClassRefPerformance_replacement.java b/platform/structuralsearch/testData/java/ReformatAndShortenClassRefPerformance_replacement.java
index 00a1012699b2..00a1012699b2 100644
--- a/plugins/structuralsearch/testData/java/ReformatAndShortenClassRefPerformance_replacement.java
+++ b/platform/structuralsearch/testData/java/ReformatAndShortenClassRefPerformance_replacement.java
diff --git a/plugins/structuralsearch/testData/java/ReformatAndShortenClassRefPerformance_result.java b/platform/structuralsearch/testData/java/ReformatAndShortenClassRefPerformance_result.java
index 2084a8da5075..2084a8da5075 100644
--- a/plugins/structuralsearch/testData/java/ReformatAndShortenClassRefPerformance_result.java
+++ b/platform/structuralsearch/testData/java/ReformatAndShortenClassRefPerformance_result.java
diff --git a/plugins/structuralsearch/testData/java/ReformatAndShortenClassRefPerformance_source.java b/platform/structuralsearch/testData/java/ReformatAndShortenClassRefPerformance_source.java
index edb15cbfa968..edb15cbfa968 100644
--- a/plugins/structuralsearch/testData/java/ReformatAndShortenClassRefPerformance_source.java
+++ b/platform/structuralsearch/testData/java/ReformatAndShortenClassRefPerformance_source.java
diff --git a/plugins/structuralsearch/testData/java/after1.java b/platform/structuralsearch/testData/java/after1.java
index 156cc38f997a..156cc38f997a 100644
--- a/plugins/structuralsearch/testData/java/after1.java
+++ b/platform/structuralsearch/testData/java/after1.java
diff --git a/plugins/structuralsearch/testData/java/after2.java b/platform/structuralsearch/testData/java/after2.java
index 20974011a39b..20974011a39b 100644
--- a/plugins/structuralsearch/testData/java/after2.java
+++ b/platform/structuralsearch/testData/java/after2.java
diff --git a/plugins/structuralsearch/testData/java/before1.java b/platform/structuralsearch/testData/java/before1.java
index 948dc10eb3d8..948dc10eb3d8 100644
--- a/plugins/structuralsearch/testData/java/before1.java
+++ b/platform/structuralsearch/testData/java/before1.java
diff --git a/plugins/structuralsearch/testData/java/before2.java b/platform/structuralsearch/testData/java/before2.java
index 371bbb3cbe30..371bbb3cbe30 100644
--- a/plugins/structuralsearch/testData/java/before2.java
+++ b/platform/structuralsearch/testData/java/before2.java
diff --git a/plugins/structuralsearch/testData/ssBased/ExpressionStatement.java b/platform/structuralsearch/testData/ssBased/ExpressionStatement.java
index 383f6d8a484c..383f6d8a484c 100644
--- a/plugins/structuralsearch/testData/ssBased/ExpressionStatement.java
+++ b/platform/structuralsearch/testData/ssBased/ExpressionStatement.java
diff --git a/plugins/structuralsearch/testData/ssBased/TwoStatementPattern.java b/platform/structuralsearch/testData/ssBased/TwoStatementPattern.java
index e41879cd2f62..e41879cd2f62 100644
--- a/plugins/structuralsearch/testData/ssBased/TwoStatementPattern.java
+++ b/platform/structuralsearch/testData/ssBased/TwoStatementPattern.java
diff --git a/plugins/structuralsearch/testData/ssBased/simple/expected.xml b/platform/structuralsearch/testData/ssBased/simple/expected.xml
index f2a97d264f8e..f2a97d264f8e 100644
--- a/plugins/structuralsearch/testData/ssBased/simple/expected.xml
+++ b/platform/structuralsearch/testData/ssBased/simple/expected.xml
diff --git a/plugins/structuralsearch/testData/ssBased/simple/src/x/X.java b/platform/structuralsearch/testData/ssBased/simple/src/x/X.java
index 3f5dc2f67974..3f5dc2f67974 100644
--- a/plugins/structuralsearch/testData/ssBased/simple/src/x/X.java
+++ b/platform/structuralsearch/testData/ssBased/simple/src/x/X.java
diff --git a/plugins/structuralsearch/testSource/com/intellij/structuralsearch/OptimizedSearchScanTest.java b/platform/structuralsearch/testSource/com/intellij/structuralsearch/OptimizedSearchScanTest.java
index f17c45bfcf3d..f17c45bfcf3d 100644
--- a/plugins/structuralsearch/testSource/com/intellij/structuralsearch/OptimizedSearchScanTest.java
+++ b/platform/structuralsearch/testSource/com/intellij/structuralsearch/OptimizedSearchScanTest.java
diff --git a/platform/structuralsearch/testSource/com/intellij/structuralsearch/SSBasedInspectionTest.java b/platform/structuralsearch/testSource/com/intellij/structuralsearch/SSBasedInspectionTest.java
new file mode 100644
index 000000000000..ff2083ebfbfa
--- /dev/null
+++ b/platform/structuralsearch/testSource/com/intellij/structuralsearch/SSBasedInspectionTest.java
@@ -0,0 +1,47 @@
+package com.intellij.structuralsearch;
+
+import com.intellij.codeInspection.ex.LocalInspectionToolWrapper;
+import com.intellij.structuralsearch.inspection.highlightTemplate.SSBasedInspection;
+import com.intellij.structuralsearch.plugin.ui.Configuration;
+import com.intellij.structuralsearch.plugin.ui.SearchConfiguration;
+import com.intellij.testFramework.InspectionTestCase;
+import com.intellij.testFramework.PlatformTestUtil;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class SSBasedInspectionTest extends InspectionTestCase {
+ private LocalInspectionToolWrapper myWrapper;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ SSBasedInspection inspection = new SSBasedInspection();
+ List<Configuration> configurations = new ArrayList<Configuration>();
+ SearchConfiguration configuration = new SearchConfiguration();
+ MatchOptions options = new MatchOptions();
+ options.setSearchPattern("int i;");
+ configuration.setMatchOptions(options);
+ configurations.add(configuration);
+ configuration = new SearchConfiguration();
+ options = new MatchOptions();
+ options.setSearchPattern("f();");
+ configuration.setMatchOptions(options);
+ configurations.add(configuration);
+ inspection.setConfigurations(configurations, myProject);
+ inspection.projectOpened(getProject());
+ myWrapper = new LocalInspectionToolWrapper(inspection);
+ }
+
+ public void testSimple() throws Exception {
+ doTest();
+ }
+
+ private void doTest() throws Exception {
+ doTest("ssBased/" + getTestName(true), myWrapper,"java 1.5");
+ }
+
+ protected String getTestDataPath() {
+ return PlatformTestUtil.getCommunityPath() + "/platform/structuralsearch/testData/";
+ }
+}
diff --git a/platform/structuralsearch/testSource/com/intellij/structuralsearch/SSRCodeInsightTest.java b/platform/structuralsearch/testSource/com/intellij/structuralsearch/SSRCodeInsightTest.java
new file mode 100644
index 000000000000..95cd33b0845a
--- /dev/null
+++ b/platform/structuralsearch/testSource/com/intellij/structuralsearch/SSRCodeInsightTest.java
@@ -0,0 +1,75 @@
+package com.intellij.structuralsearch;
+
+import com.intellij.structuralsearch.inspection.highlightTemplate.SSBasedInspection;
+import com.intellij.structuralsearch.plugin.ui.Configuration;
+import com.intellij.structuralsearch.plugin.ui.SearchConfiguration;
+import com.intellij.testFramework.IdeaTestCase;
+import com.intellij.testFramework.PlatformTestUtil;
+import com.intellij.testFramework.UsefulTestCase;
+import com.intellij.testFramework.fixtures.*;
+import com.intellij.testFramework.fixtures.impl.LightTempDirTestFixtureImpl;
+
+import java.util.Collections;
+
+public class SSRCodeInsightTest extends UsefulTestCase {
+ protected CodeInsightTestFixture myFixture;
+ private SSBasedInspection myInspection;
+
+ public SSRCodeInsightTest() {
+ IdeaTestCase.initPlatformPrefix();
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ IdeaTestFixtureFactory factory = IdeaTestFixtureFactory.getFixtureFactory();
+ TestFixtureBuilder<IdeaProjectTestFixture> fixtureBuilder = factory.createLightFixtureBuilder(new DefaultLightProjectDescriptor());
+ final IdeaProjectTestFixture fixture = fixtureBuilder.getFixture();
+ myFixture = IdeaTestFixtureFactory.getFixtureFactory().createCodeInsightFixture(fixture,
+ new LightTempDirTestFixtureImpl(true));
+ myInspection = new SSBasedInspection();
+ myFixture.enableInspections(myInspection);
+ myFixture.setUp();
+ myFixture.setTestDataPath(getTestDataPath());
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ myFixture.tearDown();
+ myFixture = null;
+ myInspection = null;
+ super.tearDown();
+ }
+
+ public void testExpressionStatement() {
+ doTest("File.createTempFile($p1$, $p2$)", "Forbid File.createTempFile");
+ }
+
+ public void testTwoStatementPattern() {
+ doTest("$field$ = $something$;\n" +
+ "if ($field$ == null) {\n" +
+ " throw new $Exception$($msg$);\n" +
+ "}",
+ "silly null check");
+ }
+
+ private void doTest(final String searchPattern, final String patternName) {
+ final SearchConfiguration configuration = new SearchConfiguration();
+ //display name
+ configuration.setName(patternName);
+
+ //search pattern
+ final MatchOptions options = new MatchOptions();
+ options.setSearchPattern(searchPattern);
+ configuration.setMatchOptions(options);
+
+ myInspection.setConfigurations(Collections.<Configuration>singletonList(configuration), myFixture.getProject());
+ myInspection.projectOpened(myFixture.getProject());
+
+ myFixture.testHighlighting(true, false, false, getTestName(false) + ".java");
+ }
+
+ protected String getTestDataPath() {
+ return PlatformTestUtil.getCommunityPath() + "/platform/structuralsearch/testData/ssBased";
+ }
+}
diff --git a/platform/structuralsearch/testSource/com/intellij/structuralsearch/StructuralReplaceTest.java b/platform/structuralsearch/testSource/com/intellij/structuralsearch/StructuralReplaceTest.java
new file mode 100644
index 000000000000..de9b668be4d3
--- /dev/null
+++ b/platform/structuralsearch/testSource/com/intellij/structuralsearch/StructuralReplaceTest.java
@@ -0,0 +1,2132 @@
+package com.intellij.structuralsearch;
+
+import com.intellij.psi.CommonClassNames;
+import com.intellij.testFramework.PlatformTestUtil;
+import com.intellij.util.ThrowableRunnable;
+import org.jetbrains.annotations.NotNull;
+
+import java.io.IOException;
+
+/**
+ * @by Maxim.Mossienko
+ */
+@SuppressWarnings({"ALL"})
+public class StructuralReplaceTest extends StructuralReplaceTestCase {
+ public void testReplaceInLiterals() {
+ String s1 = "String ID_SPEED = \"Speed\";";
+ String s2 = "String 'name = \"'string\";";
+ String s2_2 = "String 'name = \"'string:[regex( .* )]\";";
+ String s3 = "VSegAttribute $name$ = new VSegAttribute(\"$string$\");";
+ String expectedResult = "VSegAttribute ID_SPEED = new VSegAttribute(\"Speed\");";
+
+ String actualResult = replacer.testReplace(s1,s2,s3,options);
+ assertEquals(
+ "Matching/replacing literals",
+ expectedResult,
+ actualResult
+ );
+
+ actualResult = replacer.testReplace(s1,s2_2,s3,options);
+ assertEquals(
+ "Matching/replacing literals",
+ expectedResult,
+ actualResult
+ );
+
+ String s4 = "params.put(\"BACKGROUND\", \"#7B528D\");";
+ String s5 = "params.put(\"$FieldName$\", \"#$exp$\");";
+ String s6 = "String $FieldName$ = \"$FieldName$\";\n" +
+ "params.put($FieldName$, \"$exp$\");";
+ String expectedResult2 = "String BACKGROUND = \"BACKGROUND\";\n" +
+ "params.put(BACKGROUND, \"7B528D\");";
+
+ actualResult = replacer.testReplace(s4,s5,s6,options);
+
+ assertEquals(
+ "string literal replacement 2",
+ expectedResult2,
+ actualResult
+ );
+
+ String s7 = "IconLoader.getIcon(\"/ant/property.png\");\n" +
+ "IconLoader.getIcon(\"/ant/another/property.png\");\n";
+ String s8 = "IconLoader.getIcon(\"/'module/'name:[regex( \\w+ )].png\");";
+ String s9 = "Icons.$module$.$name$;";
+ String expectedResult3 = "Icons.ant.property;\n" +
+ "IconLoader.getIcon(\"/ant/another/property.png\");\n";
+
+ actualResult = replacer.testReplace(s7,s8,s9,options);
+
+ assertEquals(
+ "string literal replacement 3",
+ expectedResult3,
+ actualResult
+ );
+
+ String s10 = "configureByFile(path + \"1.html\");\n" +
+ " checkResultByFile(path + \"1_after.html\");\n" +
+ " checkResultByFile(path + \"1_after2.html\");\n" +
+ " checkResultByFile(path + \"1_after3.html\");";
+ String s11 = "\"'a.html\"";
+ String s12 = "\"$a$.\"+ext";
+ String expectedResult4 = "configureByFile(path + \"1.\"+ext);\n" +
+ " checkResultByFile(path + \"1_after.\"+ext);\n" +
+ " checkResultByFile(path + \"1_after2.\"+ext);\n" +
+ " checkResultByFile(path + \"1_after3.\"+ext);";
+
+ actualResult = replacer.testReplace(s10,s11,s12,options);
+ assertEquals(
+ "string literal replacement 4",
+ expectedResult4,
+ actualResult
+ );
+ }
+
+ public void testReplace2() {
+ String s1 = "package com.www.xxx.yyy;\n" +
+ "\n" +
+ "import javax.swing.*;\n" +
+ "\n" +
+ "public class Test {\n" +
+ " public static void main(String[] args) {\n" +
+ " if (1==1)\n" +
+ " JOptionPane.showMessageDialog(null, \"MESSAGE\");\n" +
+ " }\n" +
+ "}";
+ String s2 = "JOptionPane.'showDialog(null, 'msg);";
+ String s3 = "//FIXME provide a parent frame\n" +
+ "JOptionPane.$showDialog$(null, $msg$);";
+
+ String expectedResult = "package com.www.xxx.yyy;\n" +
+ "\n" +
+ "import javax.swing.*;\n" +
+ "\n" +
+ "public class Test {\n" +
+ " public static void main(String[] args) {\n" +
+ " if (1==1)\n" +
+ " //FIXME provide a parent frame\n" +
+ "JOptionPane.showMessageDialog(null, \"MESSAGE\");\n" +
+ " }\n" +
+ "}";
+
+ actualResult = replacer.testReplace(s1,s2,s3,options);
+ assertEquals(
+ "adding comment to statement inside the if body",
+ expectedResult,
+ actualResult
+ );
+
+ String s4 = "myButton.setText(\"Ok\");";
+ String s5 = "'Instance.'MethodCall:[regex( setText )]('Parameter*:[regex( \"Ok\" )]);";
+ String s6 = "$Instance$.$MethodCall$(\"OK\");";
+
+ String expectedResult2 = "myButton.setText(\"OK\");";
+
+ actualResult = replacer.testReplace(s4,s5,s6,options);
+ assertEquals(
+ "adding comment to statement inside the if body",
+ expectedResult2,
+ actualResult
+ );
+ }
+
+ public void testReplace() {
+ String str = "// searching for several constructions\n" +
+ " lastTest = \"several constructions match\";\n" +
+ " matches = testMatcher.findMatches(s5,s4, options);\n" +
+ " if (matches==null || matches.size()!=3) return false;\n" +
+ "\n" +
+ " // searching for several constructions\n" +
+ " lastTest = \"several constructions 2\";\n" +
+ " matches = testMatcher.findMatches(s5,s6, options);\n" +
+ " if (matches.size()!=0) return false;\n" +
+ "\n" +
+ " //options.setLooseMatching(true);\n" +
+ " // searching for several constructions\n" +
+ " lastTest = \"several constructions 3\";\n" +
+ " matches = testMatcher.findMatches(s7,s8, options);\n" +
+ " if (matches.size()!=2) return false;";
+
+ String str2=" lastTest = 'Descr;\n" +
+ " matches = testMatcher.findMatches('In,'Pattern, options);\n" +
+ " if (matches.size()!='Number) return false;";
+ String str3 = "assertEquals($Descr$,testMatcher.findMatches($In$,$Pattern$, options).size(),$Number$);";
+ String expectedResult1 = "// searching for several constructions\n" +
+ " lastTest = \"several constructions match\";\n" +
+ " matches = testMatcher.findMatches(s5, s4, options);\n" +
+ " if (matches == null || matches.size() != 3) return false;\n" +
+ "\n" +
+ " // searching for several constructions\n" +
+ " assertEquals(\"several constructions 2\", testMatcher.findMatches(s5, s6, options).size(), 0);\n" +
+ "\n" +
+ " //options.setLooseMatching(true);\n" +
+ " // searching for several constructions\n" +
+ " assertEquals(\"several constructions 3\", testMatcher.findMatches(s7, s8, options).size(), 2);";
+
+ String str4 = "";
+
+ options.setToReformatAccordingToStyle(true);
+ actualResult = replacer.testReplace(str,str2,str3,options);
+ options.setToReformatAccordingToStyle(false);
+ assertEquals("Basic replacement with formatter",expectedResult1,actualResult);
+
+ actualResult = replacer.testReplace(str,str2,str4,options);
+ String expectedResult2 = "// searching for several constructions\n" +
+ " lastTest = \"several constructions match\";\n" +
+ " matches = testMatcher.findMatches(s5,s4, options);\n" +
+ " if (matches==null || matches.size()!=3) return false;\n" +
+ "\n" +
+ " // searching for several constructions\n" +
+ "\n" +
+ " //options.setLooseMatching(true);\n" +
+ " // searching for several constructions";
+
+ assertEquals("Empty replacement",expectedResult2,actualResult);
+
+ String str5 = "testMatcher.findMatches('In,'Pattern, options).size()";
+ String str6 = "findMatchesCount($In$,$Pattern$)";
+ String expectedResult3="// searching for several constructions\n" +
+ " lastTest = \"several constructions match\";\n" +
+ " matches = testMatcher.findMatches(s5, s4, options);\n" +
+ " if (matches == null || matches.size() != 3) return false;\n" +
+ "\n" +
+ " // searching for several constructions\n" +
+ " assertEquals(\"several constructions 2\", findMatchesCount(s5,s6), 0);\n" +
+ "\n" +
+ " //options.setLooseMatching(true);\n" +
+ " // searching for several constructions\n" +
+ " assertEquals(\"several constructions 3\", findMatchesCount(s7,s8), 2);";
+ actualResult = replacer.testReplace(expectedResult1,str5,str6,options);
+
+ assertEquals( "Expression replacement", expectedResult3,actualResult );
+
+ String str7 = "try { a.doSomething(); b.doSomething(); } catch(IOException ex) { ex.printStackTrace(); throw new RuntimeException(ex); }";
+ String str8 = "try { 'Statements+; } catch('_ '_) { 'HandlerStatements+; }";
+ String str9 = "$Statements$;";
+ String expectedResult4 = "a.doSomething(); b.doSomething();";
+
+ actualResult = replacer.testReplace(str7,str8,str9,options);
+ assertEquals( "Multi line match in replacement", expectedResult4,actualResult );
+
+ String str10 = " parentNode.insert(compositeNode, i);\n" +
+ " if (asyncMode) {\n" +
+ " myTreeModel.nodesWereInserted(parentNode,new int[] {i} );\n" +
+ " }";
+ String str11 = " 'parentNode.insert('newNode, 'i);\n" +
+ " if (asyncMode) {\n" +
+ " myTreeModel.nodesWereInserted('parentNode,new int[] {'i} );\n" +
+ " }";
+ String str12 = "addChild($parentNode$,$newNode$, $i$);";
+ String expectedResult5 = " addChild(parentNode,compositeNode, i);";
+
+ actualResult = replacer.testReplace(str10,str11,str12,options);
+ assertEquals( "Array initializer replacement", expectedResult5,actualResult);
+
+ String str13 = " aaa(5,6,3,4,1,2);";
+ String str14 = "aaa('t{2,2},3,4,'q{2,2});";
+ String str15 = "aaa($q$,3,4,$t$);";
+ String expectedResult6 = " aaa(1,2,3,4,5,6);";
+
+ actualResult = replacer.testReplace(str13,str14,str15,options);
+ assertEquals("Parameter multiple match",expectedResult6,actualResult);
+
+ String str16 = " int c = a();";
+ String str17 = "'t:a ('q*,'p*)";
+ String str18 = "$t$($q$,1,$p$)";
+ String expectedResult7 = " int c = a(1);";
+
+ actualResult = replacer.testReplace(str16,str17,str18,options);
+ assertEquals("Replacement of init in definition + empty substitution",expectedResult7,actualResult);
+
+ String str19 = " aaa(bbb);";
+ String str20 = "'t('_);";
+ String str21 = "$t$(ccc);";
+ String expectedResult8 = " aaa(ccc);";
+
+ actualResult = replacer.testReplace(str19,str20,str21,options);
+ assertEquals("One substition replacement",expectedResult8,actualResult);
+
+ String str22 = " instance.setAAA(anotherInstance.getBBB());";
+ String str23 = " 'i.'m:set(.+) ('a.'m2:get(.+) ());";
+ String str24 = " $a$.set$m2_1$( $i$.get$m_1$() );";
+ String expectedResult9 = " anotherInstance.setBBB( instance.getAAA() );";
+
+ actualResult = replacer.testReplace(str22,str23,str24,options);
+ assertEquals("Reg exp substitution replacement",expectedResult9,actualResult);
+
+ String str25 = " LaterInvocator.invokeLater(new Runnable() {\n" +
+ " public void run() {\n" +
+ " LOG.info(\"refreshFilesAsync, modalityState=\" + ModalityState.current());\n" +
+ " myHandler.getFiles().refreshFilesAsync(new Runnable() {\n" +
+ " public void run() {\n" +
+ " semaphore.up();\n" +
+ " }\n" +
+ " });\n" +
+ " }\n" +
+ " });";
+ String str26 = " LaterInvocator.invokeLater('Params{1,10});";
+ String str27 = " com.intellij.openapi.application.ApplicationManager.getApplication().invokeLater($Params$);";
+ String expectedResult10 = " com.intellij.openapi.application.ApplicationManager.getApplication().invokeLater(new Runnable() {\n" +
+ " public void run() {\n" +
+ " LOG.info(\"refreshFilesAsync, modalityState=\" + ModalityState.current());\n" +
+ " myHandler.getFiles().refreshFilesAsync(new Runnable() {\n" +
+ " public void run() {\n" +
+ " semaphore.up();\n" +
+ " }\n" +
+ " });\n" +
+ " }\n" +
+ " });";
+
+ actualResult = replacer.testReplace(str25,str26,str27,options);
+ assertEquals("Anonymous in parameter",expectedResult10,actualResult);
+
+ String str28 = "UTElementNode elementNode = new UTElementNode(myProject, processedElement, psiFile,\n" +
+ " processedElement.getTextOffset(), true,\n" +
+ " !myUsageViewDescriptor.toMarkInvalidOrReadonlyUsages(), null);";
+ String str29 = "new UTElementNode('param, 'directory, 'null, '0, 'true, !'descr.toMarkInvalidOrReadonlyUsages(),\n" +
+ " 'referencesWord)";
+ String str30 = "new UTElementNode($param$, $directory$, $null$, $0$, $true$, true,\n" +
+ " $referencesWord$)";
+
+ String expectedResult11 = "UTElementNode elementNode = new UTElementNode(myProject, processedElement, psiFile, processedElement.getTextOffset(), true, true,\n" +
+ " null);";
+ actualResult = replacer.testReplace(str28,str29,str30,options);
+ assertEquals("Replace in def initializer",expectedResult11,actualResult);
+
+ String s31 = "a = b; b = c; a=a; c=c;";
+ String s32 = "'a = 'a;";
+ String s33 = "1 = 1;";
+ String expectedResult12 = "a = b; b = c; 1 = 1; 1 = 1;";
+
+ actualResult = replacer.testReplace(s31,s32,s33,options);
+ assertEquals(
+ "replace silly assignments",
+ expectedResult12,
+ actualResult
+ );
+
+ String s34 = "ParamChecker.isTrue(1==1, \"!!!\");";
+ String s35 = "ParamChecker.isTrue('expr, 'msg)";
+ String s36 = "assert $expr$ : $msg$";
+
+ String expectedResult13 = "assert 1==1 : \"!!!\";";
+ actualResult = replacer.testReplace(s34,s35,s36,options);
+ assertEquals(
+ "replace with assert",
+ expectedResult13,
+ actualResult
+ );
+
+ String s37 = "try { \n" +
+ " ParamChecker.isTrue(1==1, \"!!!\");\n \n" +
+ " // comment we want to leave\n \n" +
+ " ParamChecker.isTrue(2==2, \"!!!\");\n" +
+ "} catch(Exception ex) {}";
+ String s38 = "try {\n" +
+ " 'Statement{0,100};\n" +
+ "} catch(Exception ex) {}";
+ String s39 = "$Statement$;";
+
+ String expectedResult14 = "ParamChecker.isTrue(1==1, \"!!!\");\n \n" +
+ " // comment we want to leave\n \n" +
+ " ParamChecker.isTrue(2==2, \"!!!\");";
+ actualResult = replacer.testReplace(s37,s38,s39,options);
+ assertEquals(
+ "remove try with comments inside",
+ expectedResult14,
+ actualResult
+ );
+
+ String s40 = "ParamChecker.instanceOf(queryKey, GroupBySqlTypePolicy.GroupKey.class);";
+ String s41 = "ParamChecker.instanceOf('obj, 'class.class);";
+ String s42 = "assert $obj$ instanceof $class$ : \"$obj$ is an instance of \" + $obj$.getClass() + \"; expected \" + $class$.class;";
+ String expectedResult15 = "assert queryKey instanceof GroupBySqlTypePolicy.GroupKey : \"queryKey is an instance of \" + queryKey.getClass() + \"; expected \" + GroupBySqlTypePolicy.GroupKey.class;";
+
+ actualResult = replacer.testReplace(s40,s41,s42,options);
+ assertEquals(
+ "Matching/replacing .class literals",
+ expectedResult15,
+ actualResult
+ );
+
+ String s43 = "class Wpd {\n" +
+ " static final String TAG_BEAN_VALUE = \"\";\n" +
+ "}\n" +
+ "XmlTag beanTag = rootTag.findSubTag(Wpd.TAG_BEAN_VALUE);";
+ String s44 = "'Instance?.findSubTag( 'Parameter:[exprtype( *String ) ])";
+ String s45 = "jetbrains.fabrique.util.XmlApiUtil.findSubTag($Instance$, $Parameter$)";
+ String expectedResult16 = "class Wpd {\n" +
+ " static final String TAG_BEAN_VALUE = \"\";\n" +
+ "}\n" +
+ "XmlTag beanTag = jetbrains.fabrique.util.XmlApiUtil.findSubTag(rootTag, Wpd.TAG_BEAN_VALUE);";
+
+ actualResult = replacer.testReplace(s43,s44,s45,options);
+ assertEquals(
+ "Matching/replacing static fields",
+ expectedResult16,
+ actualResult
+ );
+
+ String s46 = "Rectangle2D rec = new Rectangle2D.Double(\n" +
+ " drec.getX(),\n" +
+ " drec.getY(),\n" +
+ " drec.getWidth(),\n" +
+ " drec.getWidth());";
+ String s47 = "$Instance$.$MethodCall$()";
+ String s48 = "OtherClass.round($Instance$.$MethodCall$(),5)";
+ String expectedResult17 = "Rectangle2D rec = new Rectangle2D.Double(\n" +
+ " OtherClass.round(drec.getX(),5),\n" +
+ " OtherClass.round(drec.getY(),5),\n" +
+ " OtherClass.round(drec.getWidth(),5),\n" +
+ " OtherClass.round(drec.getWidth(),5));";
+ actualResult = replacer.testReplace(s46,s47,s48,options);
+
+ assertEquals(
+ "Replace in constructor",
+ expectedResult17,
+ actualResult
+ );
+
+ String s49 = "class A {}\n" +
+ "class B extends A {}\n" +
+ "A a = new B();";
+ String s50 = "A 'b = new 'B:*A ();";
+ String s51 = "A $b$ = new $B$(\"$b$\");";
+ String expectedResult18 = "class A {}\n" +
+ "class B extends A {}\n" +
+ "A a = new B(\"a\");";
+
+ actualResult = replacer.testReplace(s49,s50,s51,options);
+
+ assertEquals(
+ "Class navigation",
+ expectedResult18,
+ actualResult
+ );
+
+ String s52 = "try {\n" +
+ " aaa();\n" +
+ "} finally {\n" +
+ " System.out.println();" +
+ "}\n" +
+ "try {\n" +
+ " aaa2();\n" +
+ "} catch(Exception ex) {\n" +
+ " aaa3();\n" +
+ "}\n" +
+ "finally {\n" +
+ " System.out.println();\n" +
+ "}\n" +
+ "try {\n" +
+ " aaa4();\n" +
+ "} catch(Exception ex) {\n" +
+ " aaa5();\n" +
+ "}\n";
+ String s53 = "try { 'a; } finally {\n" +
+ " 'b;" +
+ "}";
+ String s54 = "$a$;";
+ String expectedResult19 = "aaa();\n" +
+ "try {\n" +
+ " aaa2();\n" +
+ "} catch(Exception ex) {\n" +
+ " aaa3();\n" +
+ "}\n" +
+ "finally {\n" +
+ " System.out.println();\n" +
+ "}\n" +
+ "try {\n" +
+ " aaa4();\n" +
+ "} catch(Exception ex) {\n" +
+ " aaa5();\n" +
+ "}\n";
+
+ actualResult = replacer.testReplace(s52,s53,s54,options);
+
+ assertEquals(
+ "Try/ catch/ finally is replace with try/finally",
+ expectedResult19,
+ actualResult
+ );
+
+ String s55 = "for(Iterator<String> iterator = stringlist.iterator(); iterator.hasNext();) {\n" +
+ " String str = iterator.next();\n" +
+ " System.out.println( str );\n" +
+ "}";
+ String s56 = "for (Iterator<$Type$> $variable$ = $container$.iterator(); $variable$.hasNext();) {\n" +
+ " $Type$ $var$ = $variable$.next();\n" +
+ " $Statements$;\n" +
+ "}";
+ String s57 = "for($Type$ $var$:$container$) {\n" +
+ " $Statements$;\n" +
+ "}";
+ String expectedResult20 = "for(String str :stringlist) {\n" +
+ " System.out.println( str );\n" +
+ "}";
+
+ actualResult = replacer.testReplace(s55,s56,s57,options);
+
+ assertEquals(
+ "for with foreach",
+ expectedResult20,
+ actualResult
+ );
+
+ String s58 = "class A {\n" +
+ " static Set<String> b_MAP = new HashSet<String>();\n" +
+ " int c;\n" +
+ "}";
+ String s59 = "'a:[ regex( (.*)_MAP ) ]";
+ String s60 = "$a_1$_SET";
+ String expectedResult21 = "class A {\n" +
+ " static Set<String> b_SET = new HashSet<String>();\n" +
+ " int c;\n" +
+ "}";
+
+ actualResult = replacer.testReplace(s58,s59,s60,options);
+
+ assertEquals(
+ "replace symbol in definition",
+ expectedResult21,
+ actualResult
+ );
+
+ String s64 = "int x = 42;\n" +
+ "int y = 42; // Stuff";
+ String s65 = "'Type 'Variable = 'Value; // 'Comment";
+ String s66 = "/**\n" +
+ " *$Comment$\n" +
+ " */\n" +
+ "$Type$ $Variable$ = $Value$;";
+ String expectedResult23 = "int x = 42;\n" +
+ "/**\n" +
+ " * Stuff\n" +
+ " */\n" +
+ "int y = 42;";
+
+ actualResult = replacer.testReplace(s64,s65,s66,options);
+
+ assertEquals(
+ "Replacement of the comment with javadoc",
+ expectedResult23,
+ actualResult
+ );
+
+ String s61 = "try { 1=1; } catch(Exception e) { 1=1; } catch(Throwable t) { 2=2; }";
+ String s62 = "try { 'a; } catch(Exception e) { 'b; }";
+ String s63 = "try { $a$; } catch(Exception1 e) { $b$; } catch(Exception2 e) { $b$; }";
+ String expectedResult22 = "try { 1=1; } catch(Exception1 e) { 1=1; } catch(Exception2 e) { 1=1; } catch (Throwable t) { 2=2; }";
+
+ actualResult = replacer.testReplace(s61,s62,s63,options);
+
+ assertEquals(
+ "try replacement by another try will leave the unmatched catch",
+ expectedResult22,
+ actualResult
+ );
+
+ }
+
+ public void testReplaceExpr() {
+ String s1 = "new SimpleDateFormat(\"yyyyMMddHHmmss\")";
+ String s2 = "'expr";
+ String s3 = "new AtomicReference<DateFormat>($expr$)";
+ String expectedResult = "new AtomicReference<DateFormat>(new SimpleDateFormat(\"yyyyMMddHHmmss\"))";
+
+ actualResult = replacer.testReplace(s1, s2, s3, options);
+
+ assertEquals("Replacement of top-level expression only", expectedResult, actualResult);
+
+ String s4 = "get(\"smth\")";
+ String s5 = "'expr";
+ String s6 = "new Integer($expr$)";
+ String expectedResult1 = "new Integer(get(\"smth\"))";
+
+ actualResult = replacer.testReplace(s4, s5, s6, options);
+ assertEquals("Replacement of top-level expression only", expectedResult1, actualResult);
+ }
+
+ public void testReplaceParameter() {
+ String s1 = "class A { void b(int c, int d, int e) {} }";
+ String s2 = "int d";
+ String s3 = "int d2";
+ String expectedResult = "class A { void b(int c, int d2, int e) {} }";
+
+ actualResult = replacer.testReplace(s1,s2,s3,options);
+
+ assertEquals(
+ "replace method parameter",
+ expectedResult,
+ actualResult
+ );
+ }
+
+ public void testReplaceWithComments() {
+ String s1 = "map.put(key, value); // line 1";
+ String s2 = "map.put(key, value); // line 1";
+ String s3 = "map.put(key, value); // line 1";
+ String expectedResult = "map.put(key, value); // line 1";
+
+ actualResult = replacer.testReplace(s1,s2,s3,options);
+
+ assertEquals(
+ "replace self with comment after",
+ expectedResult,
+ actualResult
+ );
+
+ String s4 = "if (true) System.out.println(\"1111\"); else System.out.println(\"2222\");\n" +
+ "while(true) System.out.println(\"1111\");";
+ String s5 = "System.out.println('Test);";
+ String s6 = "/* System.out.println($Test$); */";
+ actualResult = replacer.testReplace(s4,s5,s6,options);
+ String expectedResult2 = "if (true) /* System.out.println(\"1111\"); */; else /* System.out.println(\"2222\"); */;\n" +
+ "while(true) /* System.out.println(\"1111\"); */;";
+
+ assertEquals(
+ "replace with comment",
+ expectedResult2,
+ actualResult
+ );
+ }
+
+ public void testSeveralStatements() {
+ String s1 = "{\n" +
+ " System.out.println(1);\n" +
+ " System.out.println(2);\n" +
+ " System.out.println(3);\n" +
+ " }\n" +
+ "{\n" +
+ " System.out.println(1);\n" +
+ " System.out.println(2);\n" +
+ " System.out.println(3);\n" +
+ " }\n" +
+ "{\n" +
+ " System.out.println(1);\n" +
+ " System.out.println(2);\n" +
+ " System.out.println(3);\n" +
+ " }";
+ String s2 =
+ " System.out.println(1);\n" +
+ " System.out.println(2);\n" +
+ " System.out.println(3);\n";
+ String s3 = " System.out.println(3);\n" +
+ " System.out.println(2);\n" +
+ " System.out.println(1);\n";
+ String expectedResult1 = " {\n" +
+ " System.out.println(3);\n" +
+ " System.out.println(2);\n" +
+ " System.out.println(1);\n" +
+ " }\n" +
+ " {\n" +
+ " System.out.println(3);\n" +
+ " System.out.println(2);\n" +
+ " System.out.println(1);\n" +
+ " }\n" +
+ " {\n" +
+ " System.out.println(3);\n" +
+ " System.out.println(2);\n" +
+ " System.out.println(1);\n" +
+ " }";
+ options.setToReformatAccordingToStyle(true);
+ actualResult = replacer.testReplace(s1,s2,s3,options);
+ options.setToReformatAccordingToStyle(false);
+ assertEquals(
+ "three statements replacement",
+ expectedResult1,
+ actualResult
+ );
+
+ String s4 = "ProgressManager.getInstance().startNonCancelableAction();\n" +
+ " try {\n" +
+ " read(id, READ_PARENT);\n" +
+ " return myViewport.parent;\n" +
+ " }\n" +
+ " finally {\n" +
+ " ProgressManager.getInstance().finishNonCancelableAction();\n" +
+ " }";
+ String s5 = "ProgressManager.getInstance().startNonCancelableAction();\n" +
+ " try {\n" +
+ " '_statement{2,2};\n" +
+ " }\n" +
+ " finally {\n" +
+ " ProgressManager.getInstance().finishNonCancelableAction();\n" +
+ " }";
+ String s6 = "$statement$;";
+ String expectedResult2 = "read(id, READ_PARENT);\n" +
+ " return myViewport.parent;";
+ actualResult = replacer.testReplace(s4,s5,s6,options);
+ assertEquals(
+ "extra ;",
+ expectedResult2,
+ actualResult
+ );
+
+ String s7 = "public class A {\n" +
+ " void f() {\n" +
+ " new Runnable() {\n" +
+ " public void run() {\n" +
+ " l();\n" +
+ " }\n" +
+ "\n" +
+ " private void l() {\n" +
+ " int i = 9;\n" +
+ " int j = 9;\n" +
+ " }\n" +
+ " };\n" +
+ " new Runnable() {\n" +
+ " public void run() {\n" +
+ " l();\n" +
+ " }\n" +
+ "\n" +
+ " private void l() {\n" +
+ " l();\n" +
+ " l();\n" +
+ " }\n" +
+ " };\n" +
+ " }\n" +
+ "\n" +
+ "}";
+ String s8 = "new Runnable() {\n" +
+ " public void run() {\n" +
+ " 'l ();\n" +
+ " }\n" +
+ " private void 'l () {\n" +
+ " 'st{2,2};\n" +
+ " }\n" +
+ "};";
+ String s9 = "new My() {\n" +
+ " public void f() {\n" +
+ " $st$;\n" +
+ " }\n" +
+ "};";
+
+ String expectedResult3 = "public class A {\n" +
+ " void f() {\n" +
+ " new My() {\n" +
+ " public void f() {\n" +
+ " int i = 9;\n" +
+ " int j = 9;\n" +
+ " }\n" +
+ " };\n" +
+ " new My() {\n" +
+ " public void f() {\n" +
+ " l();\n" +
+ " l();\n" +
+ " }\n" +
+ " };\n" +
+ " }\n" +
+ "\n" +
+ "}";
+ boolean formatAccordingToStyle = options.isToReformatAccordingToStyle();
+ options.setToReformatAccordingToStyle(true);
+ actualResult = replacer.testReplace(s7,s8,s9,options);
+ assertEquals(
+ "extra ; 2",
+ expectedResult3,
+ actualResult
+ );
+
+ String s10 = "public class A {\n" +
+ " void f() {\n" +
+ " new Runnable() {\n" +
+ " public void run() {\n" +
+ " l();\n" +
+ " l();\n" +
+ " }\n" +
+ " public void run2() {\n" +
+ " l();\n" +
+ " l();\n" +
+ " }\n" +
+ "\n" +
+ " };\n" +
+ " new Runnable() {\n" +
+ " public void run() {\n" +
+ " l();\n" +
+ " l();\n" +
+ " }\n" +
+ " public void run2() {\n" +
+ " l();\n" +
+ " l();\n" +
+ " }\n" +
+ "\n" +
+ " };\n" +
+ "new Runnable() {\n" +
+ " public void run() {\n" +
+ " l();\n" +
+ " l();\n" +
+ " }\n" +
+ " public void run2() {\n" +
+ " l2();\n" +
+ " l2();\n" +
+ " }\n" +
+ "\n" +
+ " };\n" +
+ " }\n" +
+ "\n" +
+ " private void l() {\n" +
+ " int i = 9;\n" +
+ " int j = 9;\n" +
+ " }\n" +
+ "}\n" +
+ "\n" +
+ "abstract class My {\n" +
+ " abstract void f();\n" +
+ "}";
+ String s11 = "new Runnable() {\n" +
+ " public void run() {\n" +
+ " 'l{2,2};\n" +
+ " }\n" +
+ " public void run2() {\n" +
+ " 'l{2,2};\n" +
+ " }\n" +
+ "\n" +
+ " };";
+ String s12 = "new My() {\n" +
+ " public void f() {\n" +
+ " $l$;\n" +
+ " }\n" +
+ " };";
+ String expectedResult4 = "public class A {\n" +
+ " void f() {\n" +
+ " new My() {\n" +
+ " public void f() {\n" +
+ " l();\n" +
+ " l();\n" +
+ " }\n" +
+ " };\n" +
+ " new My() {\n" +
+ " public void f() {\n" +
+ " l();\n" +
+ " l();\n" +
+ " }\n" +
+ " };\n" +
+ " new Runnable() {\n" +
+ " public void run() {\n" +
+ " l();\n" +
+ " l();\n" +
+ " }\n" +
+ "\n" +
+ " public void run2() {\n" +
+ " l2();\n" +
+ " l2();\n" +
+ " }\n" +
+ "\n" +
+ " };\n" +
+ " }\n" +
+ "\n" +
+ " private void l() {\n" +
+ " int i = 9;\n" +
+ " int j = 9;\n" +
+ " }\n" +
+ "}\n" +
+ "\n" +
+ "abstract class My {\n" +
+ " abstract void f();\n" +
+ "}";
+
+ actualResult = replacer.testReplace(s10,s11,s12,options);
+ assertEquals(
+ "same multiple occurences 2 times",
+ expectedResult4,
+ actualResult
+ );
+
+ options.setToReformatAccordingToStyle(formatAccordingToStyle);
+
+ String s13 = " PsiLock.LOCK.acquire();\n" +
+ " try {\n" +
+ " return value;\n" +
+ " }\n" +
+ " finally {\n" +
+ " PsiLock.LOCK.release();\n" +
+ " }";
+ String s13_2 = " PsiLock.LOCK.acquire();\n" +
+ " try {\n" +
+ " if (true) { return value; }\n" +
+ " }\n" +
+ " finally {\n" +
+ " PsiLock.LOCK.release();\n" +
+ " }";
+ String s13_3 = " PsiLock.LOCK.acquire();\n" +
+ " try {\n" +
+ " if (true) { return value; }\n\n" +
+ " if (true) { return value; }\n" +
+ " }\n" +
+ " finally {\n" +
+ " PsiLock.LOCK.release();\n" +
+ " }";
+ String s14 = " PsiLock.LOCK.acquire();\n" +
+ " try {\n" +
+ " 'T{1,1000};\n" +
+ " }\n" +
+ " finally {\n" +
+ " PsiLock.LOCK.release();\n" +
+ " }";
+ String s15 = "synchronized(PsiLock.LOCK) {\n" +
+ " $T$;\n" +
+ "}";
+
+ String expectedResult5 = " synchronized (PsiLock.LOCK) {\n" +
+ " return value;\n" +
+ " }";
+ options.setToReformatAccordingToStyle(true);
+ actualResult = replacer.testReplace(s13,s14,s15,options);
+ options.setToReformatAccordingToStyle(false);
+
+ assertEquals(
+ "extra ; over return",
+ expectedResult5,
+ actualResult
+ );
+
+ String expectedResult6 = " synchronized (PsiLock.LOCK) {\n" +
+ " if (true) {\n" +
+ " return value;\n" +
+ " }\n" +
+ " }";
+ options.setToReformatAccordingToStyle(true);
+ actualResult = replacer.testReplace(s13_2,s14,s15,options);
+ options.setToReformatAccordingToStyle(false);
+
+ assertEquals(
+ "extra ; over if",
+ expectedResult6,
+ actualResult
+ );
+
+ String expectedResult7 = " synchronized (PsiLock.LOCK) {\n" +
+ " if (true) {\n" +
+ " return value;\n" +
+ " }\n" +
+ "\n" +
+ " if (true) {\n" +
+ " return value;\n" +
+ " }\n" +
+ " }";
+ options.setToReformatAccordingToStyle(true);
+ actualResult = replacer.testReplace(s13_3,s14,s15,options);
+ options.setToReformatAccordingToStyle(false);
+ assertEquals(
+ "newlines in matches of several lines",
+ expectedResult7,
+ actualResult
+ );
+
+ String s16 = "public class SSTest {\n" +
+ " Object lock;\n" +
+ " public Object getProducts (String[] productNames) {\n" +
+ " synchronized (lock) {\n" +
+ " Object o = new Object ();\n" +
+ " assert o != null;\n" +
+ " return o;\n" +
+ " }\n" +
+ " }\n" +
+ "}";
+ String s16_2 = "public class SSTest {\n" +
+ " Object lock;\n" +
+ " public void getProducts (String[] productNames) {\n" +
+ " synchronized (lock) {\n" +
+ " boolean[] v = {true};\n" +
+ " }\n" +
+ " }\n" +
+ "}";
+
+ String s17 = "synchronized(lock) {\n" +
+ " 'Statement*;\n" +
+ "}";
+
+ String s18 = "$Statement$;";
+ String expectedResult8 = "public class SSTest {\n" +
+ " Object lock;\n" +
+ " public Object getProducts (String[] productNames) {\n" +
+ " Object o = new Object ();\n" +
+ " assert o != null;\n" +
+ " return o;\n" +
+ " }\n" +
+ "}";
+ String expectedResult8_2 = "public class SSTest {\n" +
+ " Object lock;\n" +
+ " public void getProducts (String[] productNames) {\n" +
+ " boolean[] v = {true};\n" +
+ " }\n" +
+ "}";
+
+ actualResult = replacer.testReplace(s16,s17,s18,options);
+ assertEquals(
+ "extra ;",
+ expectedResult8,
+ actualResult
+ );
+
+ actualResult = replacer.testReplace(s16_2,s17,s18,options);
+ assertEquals(
+ "missed ;",
+ expectedResult8_2,
+ actualResult
+ );
+ }
+
+ public void testClassReplacement() {
+ boolean formatAccordingToStyle = options.isToReformatAccordingToStyle();
+ options.setToReformatAccordingToStyle(true);
+
+ String s1 = "class A { public void b() {} }";
+ String s2 = "class 'a { 'Other* }";
+ String s3 = "class $a$New { Logger LOG; $Other$ }";
+ String expectedResult = " class ANew {\n" +
+ " Logger LOG;\n\n" +
+ " public void b() {\n" +
+ " }\n" +
+ " }";
+ String actualResult;
+ actualResult = replacer.testReplace(s1,s2,s3,options);
+ assertEquals(
+ "Basic class replacement",
+ expectedResult,
+ actualResult
+ );
+
+ String s4 = "class A { class C {} public void b() {} int f; }";
+ String s5 = "class 'a { 'Other* }";
+ String s6 = "class $a$ { Logger LOG; $Other$ }";
+ String expectedResult2 = " class A {\n" +
+ " Logger LOG;\n\n" +
+ " class C {\n" +
+ " }\n\n" +
+ " public void b() {\n" +
+ " }\n\n" +
+ " int f;\n" +
+ " }";
+
+ actualResult = replacer.testReplace(s4,s5,s6,options);
+ assertEquals(
+ "Order of members in class replacement",
+ expectedResult2,
+ actualResult
+ );
+
+ String s7 = "class A extends B { int c; void b() {} { a = 1; } }";
+ String s8 = "class 'A extends B { 'Other* }";
+ String s9 = "class $A$ extends B2 { $Other$ }";
+ String expectedResult3 = " class A extends B2 {\n" +
+ " int c;\n\n" +
+ " void b() {\n" +
+ " }\n\n" +
+ " {\n" +
+ " a = 1;\n" +
+ " }\n" +
+ " }";
+
+ actualResult = replacer.testReplace(s7,s8,s9,options);
+ assertEquals("Unsupported pattern exception",actualResult,expectedResult3);
+ options.setToReformatAccordingToStyle(formatAccordingToStyle);
+
+ String s10 = "/** @example */\n" +
+ "class A {\n" +
+ " class C {}\n" +
+ " public void b() {}\n" +
+ " int f;\n" +
+ "}";
+ String s11 = "class 'a { 'Other* }";
+ String s12 = "public class $a$ {\n" +
+ " $Other$\n" +
+ "}";
+ String expectedResult4 = "/** @example */\n" +
+ " public class A {\n" +
+ " class C {\n" +
+ " }\n\n" +
+ " public void b() {\n" +
+ " }\n\n" +
+ " int f;\n" +
+ " }";
+
+ options.setToReformatAccordingToStyle(true);
+ actualResult = replacer.testReplace(s10,s11,s12,options);
+ options.setToReformatAccordingToStyle(false);
+ assertEquals("Make class public",expectedResult4,actualResult);
+
+ String s13 = "class CustomThread extends Thread {\n" +
+ "public CustomThread(InputStream in, OutputStream out, boolean closeOutOnExit) {\n" +
+ " super(CustomThreadGroup.getThreadGroup(), \"CustomThread\");\n" +
+ " setDaemon(true);\n" +
+ " if (in instanceof BufferedInputStream) {\n" +
+ " bis = (BufferedInputStream)in;\n" +
+ " } else {\n" +
+ " bis = new BufferedInputStream(in);\n" +
+ " }\n" +
+ " this.out = out;\n" +
+ " this.closeOutOnExit = closeOutOnExit;\n" +
+ "}\n" +
+ "}";
+ String s14 = "class 'Class extends Thread {\n" +
+ " 'Class('ParameterType* 'ParameterName*) {\n" +
+ "\t super (CustomThreadGroup.getThreadGroup(), 'superarg* );\n" +
+ " 'Statement*;\n" +
+ " }\n" +
+ "}";
+ String s15 = "class $Class$ extends CustomThread {\n" +
+ " $Class$($ParameterType$ $ParameterName$) {\n" +
+ "\t super($superarg$);\n" +
+ " $Statement$;\n" +
+ " }\n" +
+ "}";
+
+ String expectedResult5 = " class CustomThread extends CustomThread {\n" +
+ " CustomThread(InputStream in, OutputStream out, boolean closeOutOnExit) {\n" +
+ " super(\"CustomThread\");\n" +
+ " setDaemon(true);\n" +
+ " if (in instanceof BufferedInputStream) {\n" +
+ " bis = (BufferedInputStream) in;\n" +
+ " } else {\n" +
+ " bis = new BufferedInputStream(in);\n" +
+ " }\n" +
+ " this.out = out;\n" +
+ " this.closeOutOnExit = closeOutOnExit;\n" +
+ " }\n" +
+ " }";
+ options.setToReformatAccordingToStyle(true);
+ actualResult = replacer.testReplace(s13,s14,s15,options);
+ options.setToReformatAccordingToStyle(false);
+ assertEquals("Constructor replacement",expectedResult5,actualResult);
+
+ String s16 = "public class A {}\n" +
+ "final class B {}";
+ String s17 = "class 'A { 'Other* }";
+ String s17_2 = "class 'A { private Log log = LogFactory.createLog(); 'Other* }";
+ String s18 = "class $A$ { private Log log = LogFactory.createLog(); $Other$ }";
+ String s18_2 = "class $A$ { $Other$ }";
+
+ actualResult = replacer.testReplace(s16,s17,s18,options);
+ String expectedResult6 = "public class A { private Log log = LogFactory.createLog(); }\n" +
+ "final class B { private Log log = LogFactory.createLog(); }";
+ assertEquals("Modifier list for class",expectedResult6,actualResult);
+
+ actualResult = replacer.testReplace(actualResult,s17_2,s18_2,options);
+ String expectedResult7 = "public class A { }\n" +
+ "final class B { }";
+ assertEquals("Removing field",expectedResult7,actualResult);
+
+ String s19 = "public class A extends Object implements Cloneable {}\n";
+ String s20 = "class 'A { 'Other* }";
+ String s21 = "class $A$ { private Log log = LogFactory.createLog(); $Other$ }";
+
+ actualResult = replacer.testReplace(s19,s20,s21,options);
+ String expectedResult8 = "public class A extends Object implements Cloneable { private Log log = LogFactory.createLog(); }\n";
+ assertEquals("Extends / implements list for class",expectedResult8,actualResult);
+
+ String s22 = "public class A<T> { int Afield; }\n";
+ String s23 = "class 'A { 'Other* }";
+ String s24 = "class $A$ { private Log log = LogFactory.createLog(); $Other$ }";
+
+ actualResult = replacer.testReplace(s22,s23,s24,options);
+ String expectedResult9 = "public class A<T> { private Log log = LogFactory.createLog(); int Afield; }\n";
+ assertEquals("Type parameters for the class",expectedResult9,actualResult);
+
+ String s25 = "class A {\n" +
+ " // comment before\n" +
+ " protected short a; // comment after\n" +
+ "}";
+ String s26 = "short a;";
+ String s27 = "Object a;";
+ String expectedResult10 = "class A {\n" +
+ " // comment before\n" +
+ " protected Object a; // comment after\n" +
+ "}";
+
+ actualResult = replacer.testReplace(s25,s26,s27,options);
+
+ assertEquals(
+ "Replacing dcl with saving access modifiers",
+ expectedResult10,
+ actualResult
+ );
+
+ String s28 = "aaa";
+ String s29 = "class 'Class {\n" +
+ " 'Class('ParameterType 'ParameterName) {\n" +
+ " 'Class('ParameterName);\n" +
+ " }\n" +
+ "}";
+ String s30 = "class $Class$ {\n" +
+ " $Class$($ParameterType$ $ParameterName$) {\n" +
+ " this($ParameterName$);\n" +
+ " }\n" +
+ "}";
+ String expectedResult11 = "aaa";
+
+ actualResult = replacer.testReplace(s28,s29,s30,options);
+
+ assertEquals(
+ "Complex class replacement",
+ expectedResult11,
+ actualResult
+ );
+
+ String s31 = "class A {\n" +
+ " int a; // comment\n" +
+ " char b;\n" +
+ " int c; // comment2\n" +
+ "}";
+
+ String s32 = "'Type 'Variable = 'Value?; //'Comment";
+ String s33 = "/**$Comment$*/\n" +
+ "$Type$ $Variable$ = $Value$;";
+
+ String expectedResult12 = " class A {\n" +
+ " /**\n" +
+ " * comment\n" +
+ " */\n" +
+ " int a;\n" +
+ " char b;\n" +
+ " /**\n" +
+ " * comment2\n" +
+ " */\n" +
+ " int c;\n" +
+ " }";
+ options.setToReformatAccordingToStyle(true);
+ actualResult = replacer.testReplace(s31,s32,s33,options);
+ options.setToReformatAccordingToStyle(false);
+
+ assertEquals(
+ "Replacing comments with javadoc for fields",
+ expectedResult12,
+ actualResult
+ );
+
+ String s34 = "/**\n" +
+ " * This interface stores XXX\n" +
+ " * <p/>\n" +
+ " */\n" +
+ "public interface X {\n" +
+ " public static final String HEADER = Headers.HEADER;\n" +
+ "\n" +
+ "}";
+
+ String s35 = "public interface 'MessageInterface {\n" +
+ " public static final String 'X = 'VALUE;\n" +
+ " 'blah*" +
+ "}";
+ String s36 = "public interface $MessageInterface$ {\n" +
+ " public static final String HEADER = $VALUE$;\n" +
+ " $blah$\n" +
+ "}";
+
+ String expectedResult13 = "/**\n" +
+ " * This interface stores XXX\n" +
+ " * <p/>\n" +
+ " */\n" +
+ "public interface X {\n" +
+ " public static final String HEADER = Headers.HEADER;\n" +
+ " \n" +
+ "}";
+
+ actualResult = replacer.testReplace(s34,s35,s36,options, true);
+
+ assertEquals(
+ "Replacing interface with interface, saving comments properly",
+ expectedResult13,
+ actualResult
+ );
+ }
+
+ public void testClassReplacement3() {
+ if (true) return;
+ final String actualResult;
+ String s37 = "class A { int a = 1; void B() {} int C(char ch) { int z = 1; } int b = 2; }";
+
+ String s38 = "class 'A { 'T* 'M*('PT* 'PN*) { 'S*; } 'O* }";
+ String s39 = "class $A$ { $T$ $M$($PT$ $PN$) { System.out.println(\"$M$\"); $S$; } $O$ }";
+
+ String expectedResult14 = "class A { int a = 1; void B( ) { System.out.println(\"B\"); } int C(char ch) { System.out.println(\"C\"); int z = 1; } int b = 2;}";
+ String expectedResult14_2 = "class A { int a = 1; void B( ) { System.out.println(\"B\"); } int C(char ch) { System.out.println(\"C\"); int z = 1; } int b = 2;}";
+
+ actualResult = replacer.testReplace(s37,s38,s39,options, true);
+
+ assertEquals(
+ "Multiple methods replacement",
+ expectedResult14,
+ actualResult
+ );
+ }
+
+ public void testClassReplacement4() {
+ final String actualResult;
+ String s1 = "class A {\n" +
+ " int a = 1;\n" +
+ " int b;\n" +
+ " private int c = 2;\n" +
+ "}";
+
+ String s2 = "@Modifier(\"PackageLocal\") 'Type 'Instance = 'Init?;";
+ String s3 = "public $Type$ $Instance$ = $Init$;";
+
+ String expectedResult = "class A {\n" +
+ " public int a = 1;\n" +
+ " public int b ;\n" +
+ " private int c = 2;\n" +
+ "}";
+
+ actualResult = replacer.testReplace(s1,s2,s3,options, true);
+
+ assertEquals(
+ "Multiple fields replacement",
+ expectedResult,
+ actualResult
+ );
+ }
+
+ public void testClassReplacement5() {
+ final String actualResult;
+ String s1 = "public class X {\n" +
+ " /**\n" +
+ " * zzz\n" +
+ " */\n" +
+ " void f() {\n" +
+ "\n" +
+ " }\n" +
+ "}";
+
+ String s2 = "class 'c {\n" +
+ " /**\n" +
+ " * zzz\n" +
+ " */\n" +
+ " void f(){}\n" +
+ "}";
+ String s3 = "class $c$ {\n" +
+ " /**\n" +
+ " * ppp\n" +
+ " */\n" +
+ " void f(){}\n" +
+ "}";
+
+ String expectedResult = "public class X {\n" +
+ " /**\n" +
+ " * ppp\n" +
+ " */\n" +
+ " void f(){}\n" +
+ "}";
+
+ actualResult = replacer.testReplace(s1,s2,s3,options, true);
+
+ assertEquals(
+ "Not preserving comment if it is present",
+ expectedResult,
+ actualResult
+ );
+ }
+
+ public void testClassReplacement6() {
+ String actualResult;
+ String s1 = "public class X {\n" +
+ " /**\n" +
+ " * zzz\n" +
+ " */\n" +
+ " private void f(int i) {\n" +
+ " //s\n" +
+ " }\n" +
+ "}";
+ String s1_2 = "public class X {\n" +
+ " /**\n" +
+ " * zzz\n" +
+ " */\n" +
+ " private void f(int i) {\n" +
+ " int a = 1;\n" +
+ " //s\n" +
+ " }\n" +
+ "}";
+
+ String s2 = "class 'c {\n" +
+ " /**\n" +
+ " * zzz\n" +
+ " */\n" +
+ " void f('t 'p){'s+;}\n" +
+ "}";
+ String s3 = "class $c$ {\n" +
+ " /**\n" +
+ " * ppp\n" +
+ " */\n" +
+ " void f($t$ $p$){$s$;}\n" +
+ "}";
+
+ String expectedResult = "public class X {\n" +
+ " /**\n" +
+ " * ppp\n" +
+ " */\n" +
+ " private void f(int i ){//s\n" +
+ "}\n" +
+ "}";
+
+ actualResult = replacer.testReplace(s1,s2,s3,options);
+
+ assertEquals(
+ "Correct class replacement",
+ expectedResult,
+ actualResult
+ );
+
+ String expectedResult2 = "public class X {\n" +
+ " /**\n" +
+ " * ppp\n" +
+ " */\n" +
+ " private void f(int i ){int a = 1;\n" +
+ " //s\n" +
+ "}\n" +
+ "}";
+
+ actualResult = replacer.testReplace(s1_2,s2,s3,options);
+
+ assertEquals(
+ "Correct class replacement, 2",
+ expectedResult2,
+ actualResult
+ );
+ }
+
+ public void testClassReplacement7() {
+ String s1 = "/**\n" +
+ "* Created by IntelliJ IDEA.\n" +
+ "* User: cdr\n" +
+ "* Date: Nov 15, 2005\n" +
+ "* Time: 4:23:29 PM\n" +
+ "* To change this template use File | Settings | File Templates.\n" +
+ "*/\n" +
+ "public class CC {\n" +
+ " /** My Comment */ int a = 3; // aaa\n" +
+ " // bbb\n" +
+ " long c = 2;\n" +
+ " void f() {\n" +
+ " }\n" +
+ "}";
+ String s2 = "/**\n" +
+ "* Created by IntelliJ IDEA.\n" +
+ "* User: 'USER\n" +
+ "* Date: 'DATE\n" +
+ "* Time: 'TIME\n" +
+ "* To change this template use File | Settings | File Templates.\n" +
+ "*/\n" +
+ "class 'c {\n" +
+ " 'other*\n" +
+ "}";
+ String s3 = "/**\n" +
+ "* by: $USER$\n" +
+ "*/\n" +
+ "class $c$ {\n" +
+ " $other$\n" +
+ "}";
+ String expectedResult = "/**\n" +
+ "* by: cdr\n" +
+ "*/\n" +
+ "public class CC {\n" +
+ " /** My Comment */ int a = 3; // aaa\n" +
+ "// bbb\n" +
+ " long c = 2;\n" +
+ "void f() {\n" +
+ " }\n" +
+ "}";
+
+ actualResult = replacer.testReplace(s1,s2,s3,options,true);
+
+ assertEquals(
+ "Class with comment replacement",
+ expectedResult,
+ actualResult
+ );
+ }
+
+ public void testClassReplacement8() {
+ String s1 = "public class CC {\n" +
+ " /** AAA*/ int b = 1; // comment\n" +
+ "}";
+ String s2 = "int b = 1;";
+ String s3 = "long c = 2;";
+ String expectedResult = "public class CC {\n" +
+ " /** AAA*/ long c = 2; // comment\n" +
+ "}";
+
+ actualResult = replacer.testReplace(s1,s2,s3,options,true);
+
+ assertEquals(
+ "Class field replacement with simple pattern",
+ expectedResult,
+ actualResult
+ );
+ }
+
+ @NotNull
+ @Override
+ protected String getTestDataPath() {
+ return PlatformTestUtil.getCommunityPath() + "/platform/structuralsearch/testData/";
+ }
+
+ public void testClassReplacement9() throws IOException {
+ String s1 = loadFile("before1.java");
+ String s2 = "class 'A extends 'TestCaseCass:[regex( .*TestCase ) ] {\n" +
+ " 'OtherStatement*;\n" +
+ " public void 'testMethod*:[regex( test.* )] () {\n" +
+ " }\n" +
+ " 'OtherStatement2*;\n" +
+ "}";
+ String s3 = "class $A$ extends $TestCaseCass$ {\n" +
+ " $OtherStatement$;\n" +
+ " $OtherStatement2$;\n" +
+ "}";
+ String expectedResult = loadFile("after1.java");
+
+ options.setToReformatAccordingToStyle(true);
+ actualResult = replacer.testReplace(s1,s2,s3,options,true);
+
+ assertEquals(
+ "Class replacement 9",
+ expectedResult,
+ actualResult
+ );
+ }
+
+ public void testReplaceReturnWithArrayInitializer() {
+ String searchIn = "return ( new String[]{CoreVars.CMUAudioPort + \"\"} );";
+ String searchFor = "return ( 'A );";
+ String replaceBy = "return $A$;";
+ String expectedResult = "return new String[]{CoreVars.CMUAudioPort + \"\"};";
+
+ actualResult = replacer.testReplace(searchIn,searchFor,replaceBy,options);
+
+ assertEquals(
+ "ReplaceReturnWithArrayInitializer",
+ expectedResult,
+ actualResult
+ );
+ }
+
+ public void _testClassReplacement10() throws IOException {
+ String s1 = loadFile("before2.java");
+ String s2 = "class '_Class {\n" +
+ " '_ReturnType+ '_MethodName+('_ParameterType* '_Parameter*){\n" +
+ " '_content*;\n" +
+ " }\n" +
+ " '_remainingclass*" +
+ "}";
+ String s3 = "class $Class$ {\n" +
+ " $remainingclass$\n" +
+ " @Override $ReturnType$ $MethodName$($ParameterType$ $Parameter$){\n" +
+ " $content$;\n" +
+ " }\n" +
+ "}";
+ String expectedResult = loadFile("after2.java");
+
+ options.setToReformatAccordingToStyle(true);
+ actualResult = replacer.testReplace(s1,s2,s3,options,true);
+
+ assertEquals(
+ "Class replacement 10",
+ expectedResult,
+ actualResult
+ );
+ }
+
+ public void testCatchReplacement() throws Exception {
+ String s1 = "try {\n" +
+ " aaa();\n" +
+ "} catch(Exception ex) {\n" +
+ " LOG.assertTrue(false);\n" +
+ "}";
+ String s2 = "{ LOG.assertTrue(false); }";
+ String s3 = "{ if (false) LOG.assertTrue(false); }";
+ String expectedResult = "try {\n" +
+ " aaa();\n" +
+ "} catch (Exception ex) {\n" +
+ " if (false) LOG.assertTrue(false);\n" +
+ "}";
+ options.setToReformatAccordingToStyle(true);
+ actualResult = replacer.testReplace(s1,s2,s3,options);
+ options.setToReformatAccordingToStyle(false);
+
+ assertEquals(
+ "Catch replacement by block",
+ expectedResult,
+ actualResult
+ );
+ }
+
+ public void testSavingAccessModifiersDuringClassReplacement() {
+ String actualResult;
+
+ String s43 = "public @Deprecated class Foo implements Comparable<Foo> {\n int x;\n void m(){}\n }";
+ String s44 = "class 'Class implements 'Interface { 'Content* }";
+ String s45 = "@MyAnnotation\n" +
+ "class $Class$ implements $Interface$ {$Content$}";
+ String expectedResult16 = "@MyAnnotation public @Deprecated\n" +
+ "class Foo implements Comparable<Foo> {int x;\n" +
+ "void m(){}}";
+
+ actualResult = replacer.testReplace(s43,s44,s45,options, true);
+ assertEquals(
+ "Preserving var modifiers and generic information in type during replacement",
+ expectedResult16,
+ actualResult
+ );
+ }
+
+ public void testDontRequireSpecialVarsForUnmatchedContent() {
+ String actualResult;
+
+ String s43 = "public @Deprecated class Foo implements Comparable<Foo> {\n int x;\n void m(){}\n }";
+ String s44 = "class 'Class implements 'Interface {}";
+ String s45 = "@MyAnnotation\n" +
+ "class $Class$ implements $Interface$ {}";
+ String expectedResult16 = "@MyAnnotation public @Deprecated\n" +
+ "class Foo implements Comparable<Foo> {int x;\nvoid m(){}}";
+
+ actualResult = replacer.testReplace(s43,s44,s45,options, true);
+ assertEquals(
+ "Preserving class modifiers and generic information in type during replacement",
+ expectedResult16,
+ actualResult
+ );
+ }
+
+ public void _testClassReplacement2() {
+ final String actualResult;
+ String s40 = "class A {\n" +
+ " /* special comment*/\n" +
+ " private List<String> a = new ArrayList();\n" +
+ " static {\n" +
+ " int a = 1;" +
+ " }\n" +
+ "}";
+ String s41 = "class 'Class {\n" +
+ " 'Stuff2*\n" +
+ " 'FieldType 'FieldName = 'Init?;\n" +
+ " static {\n" +
+ " 'Stmt*;\n" +
+ " }\n" +
+ " 'Stuff*\n" +
+ "}";
+ String s42 = "class $Class$ {\n" +
+ " $Stuff2$\n" +
+ " $FieldType$ $FieldName$ = build$FieldName$Map();\n" +
+ " private static $FieldType$ build$FieldName$Map() {\n" +
+ " $FieldType$ $FieldName$ = $Init$;\n" +
+ " $Stmt$;\n" +
+ " return $FieldName$;\n" +
+ " }\n" +
+ " $Stuff$\n" +
+ "}";
+ String expectedResult15 = "class A {\n" +
+ " \n" +
+ " /* special comment*/\n" +
+ " private List<String> a = buildaMap();\n" +
+ " private static List<String> buildaMap() {\n" +
+ " List<String> a = new ArrayList();\n" +
+ " int a = 1;\n" +
+ " return a;\n" +
+ " }\n" +
+ " \n" +
+ "}";
+
+ actualResult = replacer.testReplace(s40,s41,s42,options, true);
+
+ assertEquals(
+ "Preserving var modifiers and generic information in type during replacement",
+ expectedResult15,
+ actualResult
+ );
+
+ String s46 = "class Foo { int xxx; void foo() { assert false; } void yyy() {}}";
+ String s47 = "class 'Class { void 'foo:[regex( foo )](); }";
+ String s48 = "class $Class$ { void $foo$(int a); }";
+ String expectedResult17 = "class Foo { int xxx; void foo(int a) { assert false; } void yyy() {}}";
+
+ String actualResult2 = replacer.testReplace(s46,s47,s48,options, true);
+ assertEquals(
+ "Preserving method bodies",
+ expectedResult17,
+ actualResult2
+ );
+ }
+
+ public void testReplaceExceptions() {
+ String s1 = "a=a;";
+ String s2 = "'a";
+ String s3 = "$b$";
+
+ try {
+ replacer.testReplace(s1,s2,s3,options);
+ assertTrue("Undefined replace variable is not checked",false);
+ } catch(UnsupportedPatternException ex) {
+
+ }
+
+ String s4 = "a=a;";
+ String s5 = "a=a;";
+ String s6 = "a=a";
+
+ try {
+ replacer.testReplace(s4,s5,s6,options);
+ assertTrue("Undefined no ; in replace",false);
+ } catch(UnsupportedPatternException ex) {
+ }
+
+ try {
+ replacer.testReplace(s4,s6,s5,options);
+ assertTrue("Undefined no ; in search",false);
+ } catch(UnsupportedPatternException ex) {
+ }
+ }
+
+ public void testActualParameterReplacementInConstructorInvokation() {
+ String s1 = "filterActions[0] = new Action(TEXT,\n" +
+ " LifeUtil.getIcon(\"search\")) {\n" +
+ " void test() {\n" +
+ " int a = 1;\n" +
+ " }\n" +
+ "};";
+ String s2 = "LifeUtil.getIcon(\"search\")";
+ String s3 = "StdIcons.SEARCH_LIFE";
+ String expectedResult = "filterActions[0] = new Action(TEXT,\n" +
+ " StdIcons.SEARCH_LIFE) {\n" +
+ " void test() {\n" +
+ " int a = 1;\n" +
+ " }\n" +
+ "};";
+ options.setToReformatAccordingToStyle(true);
+ options.setToShortenFQN(true);
+
+ String actualResult = replacer.testReplace(s1, s2, s3, options);
+ assertEquals("Replace in anonymous class parameter", expectedResult, actualResult);
+ options.setToShortenFQN(false);
+ options.setToReformatAccordingToStyle(false);
+ }
+
+ public void testRemove() {
+ String s1 = "class A {\n" +
+ " /* */\n" +
+ " void a() {\n" +
+ " }\n" +
+ " /*\n" +
+ " */\n" +
+ " int b = 1;\n" +
+ " /*\n" +
+ " *\n" +
+ " */\n" +
+ " class C {}\n" +
+ " {\n" +
+ " /* aaa */\n" +
+ " int a;\n" +
+ " /* */\n" +
+ " a = 1;\n" +
+ " }\n" +
+ "}";
+ String s2 = "/* 'a:[regex( .* )] */";
+ String s2_2 = "/* */";
+ String s3 = "";
+ String expectedResult = "class A {\n" +
+ " void a() {\n" +
+ " }\n" +
+ "\n" +
+ " int b = 1;\n" +
+ "\n" +
+ " class C {\n" +
+ " }\n" +
+ "\n" +
+ " {\n" +
+ " int a;\n" +
+ " a = 1;\n" +
+ " }\n" +
+ "}";
+ options.setToReformatAccordingToStyle(true);
+ actualResult = replacer.testReplace(s1,s2,s3,options);
+ options.setToReformatAccordingToStyle(false);
+
+ assertEquals(
+ "Removing comments",
+ expectedResult,
+ actualResult
+ );
+
+ String expectedResult2 = "class A {\n" +
+ " void a() {\n" +
+ " }\n" +
+ " /*\n" +
+ " */\n" +
+ " int b = 1;\n" +
+ " /*\n" +
+ " *\n" +
+ " */\n" +
+ " class C {}\n" +
+ " {\n" +
+ " /* aaa */\n" +
+ " int a;\n" +
+ " a = 1;\n" +
+ " }\n" +
+ "}";
+
+ actualResult = replacer.testReplace(s1,s2_2,s3,options);
+
+ assertEquals(
+ "Removing comments",
+ expectedResult2,
+ actualResult
+ );
+ }
+
+ public void testTryCatchInLoop() throws Exception {
+ String code = "for (int i = 0; i < MIMEHelper.MIME_MAP.length; i++)\n" +
+ "{\n" +
+ " String s = aFileNameWithOutExtention + MIMEHelper.MIME_MAP[i][0][0];\n" +
+ " try\n" +
+ " {\n" +
+ " if (ENABLE_Z107_READING)\n" +
+ " { in = aFileNameWithOutExtention.getClass().getResourceAsStream(s); }\n" +
+ " else\n" +
+ " { data = ResourceHelper.readResource(s); }\n" +
+ " mime = MIMEHelper.MIME_MAP[i][1][0];\n" +
+ " break;\n" +
+ " }\n" +
+ " catch (final Exception e)\n" +
+ " { continue; }\n" +
+ "}";
+ String toFind = "try { 'TryStatement*; } catch(Exception 'ExceptionDcl) { 'CatchStatement*; }";
+ String replacement = "try { $TryStatement$; }\n" + "catch(Throwable $ExceptionDcl$) { $CatchStatement$; }";
+ String expectedResult = "for (int i = 0; i < MIMEHelper.MIME_MAP.length; i++)\n" +
+ "{\n" +
+ " String s = aFileNameWithOutExtention + MIMEHelper.MIME_MAP[i][0][0];\n" +
+ " try { if (ENABLE_Z107_READING)\n" +
+ " { in = aFileNameWithOutExtention.getClass().getResourceAsStream(s); }\n" +
+ " else\n" +
+ " { data = ResourceHelper.readResource(s); }\n" +
+ " mime = MIMEHelper.MIME_MAP[i][1][0];\n" +
+ " break; }\n" +
+ "catch(final Throwable e) { continue; }\n" +
+ "}";
+
+ actualResult = replacer.testReplace(code,toFind,replacement,options);
+
+ assertEquals(
+ "Replacing try/catch in loop",
+ expectedResult,
+ actualResult
+ );
+ }
+
+ public void testReformatAndShortenClassRefPerformance() throws IOException {
+ final String testName = getTestName(false);
+ final String ext = "java";
+ final String message = "Reformat And Shorten Class Ref Performance";
+
+ options.setToReformatAccordingToStyle(true);
+ options.setToShortenFQN(true);
+
+ PlatformTestUtil.startPerformanceTest("SSR should work fast", 3500, new ThrowableRunnable() {
+ public void run() {
+ doTest(testName, ext, message);
+ }
+ }
+ ).cpuBound().assertTiming();
+
+ options.setToReformatAccordingToStyle(false);
+ options.setToShortenFQN(false);
+ }
+
+ private void doTest(final String testName, final String ext, final String message) {
+ try {
+ String source = loadFile(testName + "_source." + ext);
+ String pattern = loadFile(testName + "_pattern." + ext);
+ String replacement = loadFile(testName + "_replacement." + ext);
+ String expected = loadFile(testName + "_result." + ext);
+
+ actualResult = replacer.testReplace(source,pattern,replacement,options);
+
+ assertEquals(
+ message,
+ expected,
+ actualResult
+ );
+ }
+ catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public void testLeastSurprise() {
+ String s1 = "@Nullable (a=String.class) @String class Test {\n" +
+ " void aaa(String t) {\n" +
+ " String a = String.valueOf(' ');" +
+ " String2 a2 = String2.valueOf(' ');" +
+ " }\n" +
+ "}";
+ String s2 = "'String:String";
+ String s2_2 = "String";
+ String s2_3 = "'String:java\\.lang\\.String";
+ String s2_4 = "java.lang.String";
+ String replacement = CommonClassNames.JAVA_UTIL_LIST;
+ String expected = "@Nullable (a=java.util.List.class) @java.util.List class Test {\n" +
+ " void aaa(java.util.List t) {\n" +
+ " java.util.List a = java.util.List.valueOf(' ');" +
+ " String2 a2 = String2.valueOf(' ');" +
+ " }\n" +
+ "}";
+
+ actualResult = replacer.testReplace(s1,s2,replacement,options);
+
+ assertEquals(
+ expected,
+ actualResult
+ );
+
+ actualResult = replacer.testReplace(s1,s2_2,replacement,options);
+
+ assertEquals(
+ expected,
+ actualResult
+ );
+
+ actualResult = replacer.testReplace(s1,s2_3,replacement,options);
+
+ assertEquals(
+ expected,
+ actualResult
+ );
+
+ actualResult = replacer.testReplace(s1,s2_4,replacement,options);
+
+ assertEquals(
+ expected,
+ actualResult
+ );
+ }
+
+ public void testLeastSurprise2() {
+ String s1 = "class B { int s(int a) { a = 1; a = 2; c(a); } }";
+ String s2 = "a";
+ String replacement = "a2";
+ String expected = "class B { int s(int a2) { a2 = 1; a2 = 2; c(a2); } }";
+
+ actualResult = replacer.testReplace(s1,s2,replacement,options);
+
+ assertEquals(
+ expected,
+ actualResult
+ );
+ }
+
+ public void testReplaceTry() {
+ String s1 = "try {\n" +
+ " em.persist(p);\n" +
+ " } catch (PersistenceException e) {\n" +
+ " // good\n" +
+ " }";
+ String s2 = "try { 'TryStatement; } catch('ExceptionType 'ExceptionDcl) { /* 'CommentContent */ }";
+ String replacement = "try { $TryStatement$; } catch($ExceptionType$ $ExceptionDcl$) { _logger.warning(\"$CommentContent$\", $ExceptionDcl$); }";
+ String expected = "try { em.persist(p); } catch(PersistenceException e) { _logger.warning(\" good\", e); }";
+
+ actualResult = replacer.testReplace(s1,s2,replacement,options);
+
+ assertEquals(
+ expected,
+ actualResult
+ );
+ }
+
+ public void testReplaceExtraSemicolon() {
+ String s1 = "try {\n" +
+ " String[] a = {\"a\"};\n" +
+ " System.out.println(\"blah\");\n" +
+ "} finally {\n" +
+ "}\n";
+ String s2 = "try {\n" + " 'statement*;\n" + "} finally {\n" + " \n" + "}";
+ String replacement = "$statement$;";
+ String expected = "String[] a = {\"a\"};\n" +
+ " System.out.println(\"blah\");\n";
+
+ actualResult = replacer.testReplace(s1,s2,replacement,options);
+
+ assertEquals(
+ expected,
+ actualResult
+ );
+
+ String s1_2 = "try {\n" +
+ " if (args == null) return ;\n" +
+ " while(true) return ;\n" +
+ " System.out.println(\"blah2\");\n" +
+ "} finally {\n" +
+ "}";
+ String expected_2 = "if (args == null) return ;\n" +
+ " while(true) return ;\n" +
+ " System.out.println(\"blah2\");";
+
+ actualResult = replacer.testReplace(s1_2,s2,replacement,options);
+
+ assertEquals(
+ expected_2,
+ actualResult
+ );
+
+ String s1_3 = "{\n" +
+ " try {\n" +
+ " System.out.println(\"blah1\");\n" +
+ "\n" +
+ " System.out.println(\"blah2\");\n" +
+ " } finally {\n" +
+ " }\n" +
+ "}";
+ String expected_3 = "{\n" +
+ " System.out.println(\"blah1\");\n" +
+ "\n" +
+ " System.out.println(\"blah2\");\n" +
+ "}";
+ actualResult = replacer.testReplace(s1_3,s2,replacement,options);
+
+ assertEquals(
+ expected_3,
+ actualResult
+ );
+
+ String s1_4 = "{\n" +
+ " try {\n" +
+ " System.out.println(\"blah1\");\n" +
+ " // indented comment\n" +
+ " System.out.println(\"blah2\");\n" +
+ " } finally {\n" +
+ " }\n" +
+ "}";
+ String expected_4 = "{\n" +
+ " System.out.println(\"blah1\");\n" +
+ " // indented comment\n" +
+ " System.out.println(\"blah2\");\n" +
+ "}";
+ actualResult = replacer.testReplace(s1_4,s2,replacement,options);
+
+ assertEquals(
+ expected_4,
+ actualResult
+ );
+ }
+
+ public void _testReplaceFinalModifier() throws Exception {
+ String s1 = "class Foo {\n" +
+ " void foo(final int i,final int i2, final int i3) {\n" +
+ " final int x = 5;\n" +
+ " }\n" +
+ "}";
+ String s2 = "final '_type 'var = '_init?";
+ String s3 = "$type$ $var$ = $init$";
+
+ String expected = "2 = 1;\nint b = a;\nb2 = 3;";
+
+ actualResult = replacer.testReplace(s1,s2,s3,options);
+
+ assertEquals(
+ expected,
+ actualResult
+ );
+ }
+
+ public void testRemovingRedundancy() throws Exception {
+ String s1 = "int a = 1;\n" +
+ "a = 2;\n" +
+ "int b = a;\n" +
+ "b2 = 3;";
+ String s2 = "int 'a = 'i;\n" +
+ "'st*;\n" +
+ "'a = 'c;";
+ String s3 = "$st$;\n" +
+ "$c$ = $i$;";
+
+ String expected = "2 = 1;\nint b = a;\nb2 = 3;";
+
+ actualResult = replacer.testReplace(s1,s2,s3,options);
+
+ assertEquals(
+ expected,
+ actualResult
+ );
+
+ String s2_2 = "int 'a = 'i;\n" +
+ "'st*;\n" +
+ "int 'c = 'a;";
+ String s3_2 = "$st$;\n" +
+ "int $c$ = $i$;";
+ String expected_2 = "a = 2;\nint b = 1;\nb2 = 3;";
+
+ actualResult = replacer.testReplace(s1,s2_2,s3_2,options);
+
+ assertEquals(
+ expected_2,
+ actualResult
+ );
+ }
+
+ public void testReplaceWithEmptyString() {
+ String source = "public class Peepers {\n public long serialVersionUID = 1L; \n}";
+ String search = "long serialVersionUID = $value$;";
+ String replace = "";
+ String expectedResult = "public class Peepers { \n}";
+
+ String actualResult = replacer.testReplace(source, search, replace, options, true);
+
+ assertEquals(
+ expectedResult,
+ actualResult
+ );
+ }
+
+ public void testReplaceMultipleFieldsInSingleDeclaration() {
+ String source = "abstract class MyClass implements java.util.List {\n private String a, b;\n}";
+ String search = "class 'Name implements java.util.List {\n 'ClassContent*\n}";
+ String replace = "class $Name$ {\n $ClassContent$\n}";
+ String expectedResult = "abstract class MyClass {\n private String a,b;\n}";
+
+ String actualResult = replacer.testReplace(source, search, replace, options, true);
+
+ assertEquals(
+ expectedResult,
+ actualResult
+ );
+ }
+
+ public void testReplaceInImplementsList() {
+ String source = "import java.io.Externalizable;\n" +
+ "import java.io.Serializable;\n" +
+ "abstract class MyClass implements Serializable, java.util.List, Externalizable {}";
+ String search = "class 'TestCase implements java.util.List, 'others* {\n 'MyClassContent\n}";
+ String replace = "class $TestCase$ implements $others$ {\n $MyClassContent$\n}";
+ String expectedResult = "import java.io.Externalizable;\n" +
+ "import java.io.Serializable;\n" +
+ "abstract class MyClass implements Externalizable,Serializable {\n \n}";
+
+ String actualResult = replacer.testReplace(source, search, replace, options, true);
+ assertEquals(
+ expectedResult,
+ actualResult
+ );
+ }
+
+ public void testReplaceFieldWithEndOfLineComment() {
+ String source = "class MyClass {\n" +
+ " private String b;// comment\n" +
+ " public void foo() {\n" +
+ " }\n" +
+ "}";
+ String search = "class 'Class {\n 'Content*\n}";
+ String replace = "class $Class$ {\n" +
+ " void x() {}\n" +
+ " $Content$\n" +
+ " void bar() {}\n" +
+ "}";
+ String expectedResult = "class MyClass {\n" +
+ " void x() {}\n" +
+ " private String b;// comment\n" +
+ "public void foo() {\n" +
+ " }\n" +
+ " void bar() {}\n" +
+ "}";
+
+ String actualResult = replacer.testReplace(source, search, replace, options, true);
+ assertEquals(
+ expectedResult,
+ actualResult
+ );
+ }
+} \ No newline at end of file
diff --git a/plugins/structuralsearch/testSource/com/intellij/structuralsearch/StructuralReplaceTestCase.java b/platform/structuralsearch/testSource/com/intellij/structuralsearch/StructuralReplaceTestCase.java
index 9a9fbb362a63..9a9fbb362a63 100644
--- a/plugins/structuralsearch/testSource/com/intellij/structuralsearch/StructuralReplaceTestCase.java
+++ b/platform/structuralsearch/testSource/com/intellij/structuralsearch/StructuralReplaceTestCase.java
diff --git a/platform/structuralsearch/testSource/com/intellij/structuralsearch/StructuralSearchTest.java b/platform/structuralsearch/testSource/com/intellij/structuralsearch/StructuralSearchTest.java
new file mode 100644
index 000000000000..da479a70f93c
--- /dev/null
+++ b/platform/structuralsearch/testSource/com/intellij/structuralsearch/StructuralSearchTest.java
@@ -0,0 +1,2946 @@
+package com.intellij.structuralsearch;
+
+import com.intellij.idea.Bombed;
+import com.intellij.openapi.application.PluginPathManager;
+import com.intellij.openapi.fileTypes.StdFileTypes;
+import com.intellij.psi.*;
+import com.intellij.structuralsearch.impl.matcher.MatcherImplUtil;
+import com.intellij.testFramework.PlatformTestUtil;
+import org.jetbrains.annotations.NotNull;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.List;
+
+/**
+ * @author Maxim.Mossienko
+ */
+@SuppressWarnings({"HardCodedStringLiteral"})
+public class StructuralSearchTest extends StructuralSearchTestCase {
+ private static final String s1 =
+ "debug(\"In action performed:\"+event);"+
+ "project = (Project)event.getDataContext().getData(DataConstants.PROJECT);" +
+ "CodeEditorManager.getInstance(project).commitAllToPsiFile();" +
+ "file = (PsiFile) event.getDataContext().getData(\"psi.File\"); " +
+ "((dialog==null)?" +
+ " (dialog = new SearchDialog()):" +
+ " dialog" +
+ ").show();";
+
+ private static final String s2 = "((dialog==null)? (dialog = new SearchDialog()): dialog).show();";
+ private static final String s3 = "dialog = new SearchDialog()";
+
+ private static final String s4 =
+ " do { " +
+ " pattern = pattern.getNextSibling(); " +
+ " } " +
+ " while (pattern!=null && filterLexicalNodes(pattern));";
+
+ private static final String s5 =
+ "{ System.out.println();" +
+ " while(false) { " +
+ " do { " +
+ " pattern = pattern.getNextSibling(); " +
+ " } " +
+ " while (pattern!=null && filterLexicalNodes(pattern)); " +
+ " } " +
+ " do { " +
+ " pattern = pattern.getNextSibling(); " +
+ " } while (pattern!=null && filterLexicalNodes(pattern));" +
+ " { { " +
+ " do { " +
+ " pattern = pattern.getNextSibling(); " +
+ " } while (pattern!=null && filterLexicalNodes(pattern));" +
+ " } }" +
+ "}";
+
+ private static final String s6 =
+ " do { " +
+ " pattern.getNextSibling(); " +
+ " } " +
+ " while (pattern!=null && filterLexicalNodes(pattern));";
+
+ private static final String s7 =
+ " if (true) throw new UnsupportedPatternException(statement.toString());" +
+ " if (true) { " +
+ " throw new UnsupportedPatternException(statement.toString());" +
+ " } ";
+
+ private static final String s8 =
+ " if (true) { " +
+ " throw new UnsupportedPatternException(statement.toString());" +
+ " } ";
+
+ private static final String s9 = " if (true) throw new UnsupportedPatternException(statement.toString());";
+
+ private static final String s10 = "listener.add(new Runnable() { public void run() {} });";
+ private static final String s11 = " new XXX()";
+
+ private static final String s12 =
+ "new Runnable() {" +
+ " public void run() {" +
+ " matchContext.getSink().matchingFinished();" +
+ " } " +
+ " }";
+
+ private static final String s13 = "new Runnable() {}";
+ private static final String s14_1 = "if (true) { aaa(var); }";
+ private static final String s14_2 = "if (true) { aaa(var); bbb(var2); }\n if(1==1) { system.out.println('o'); }";
+ private static final String s15 = "'T;";
+ private static final String s16 = "if('_T) { '_T2; }";
+ private static final String s17 =
+ "token.getText().equals(token2.getText());" +
+ "token.getText().equals(token2.getText2());" +
+ "token.a.equals(token2.b);" +
+ "token.a.equals(token2.a);";
+ private static final String s18_1 = "'_T1.'_T2.equals('_T3.'_T2);";
+ private static final String s18_2 = "'_T1.'_T2().equals('_T3.'_T2());";
+ private static final String s18_3 = "'_T1.'_T2";
+ private static final String s19 = "Aaa a = (Aaa)b; Aaa c = (Bbb)d;";
+ private static final String s20 = "'_T1 'T2 = ('_T1)'_T3;";
+ private static final String s20_2 = "'_T1 '_T2 = ('_T1)'_T3;";
+ private static final String s21_1 = "'_T1:Aa* 'T2 = ('_T1)'_T3;";
+ private static final String s21_2 = "'_T1:A* 'T2 = ( '_T1:A+ )'_T3;";
+ private static final String s21_3 = "'_T1:Aa* 'T2 = ( '_T1:Aa* )'_T3;";
+
+ private static final String s22 = "Aaa a = (Aaa)b; Bbb c = (Bbb)d;";
+
+ private static final String s23 = "a[i] = 1; b[a[i]] = f(); if (a[i]==1) return b[c[i]];";
+ private static final String s24_1 = "'T['_T2:.*i.* ] = '_T3;";
+ private static final String s24_2 = "'T['_T2:.*i.* ]";
+ private static final String s25 = "class MatcherImpl { void doMatch(int a) {} }\n" +
+ "class Matcher { abstract void doMatch(int a);}\n " +
+ "class Matcher2Impl { void doMatch(int a, int b) {} } ";
+ private static final String s26 = "class 'T:.*Impl { '_T2 '_T3('_T4 '_T5) {\n\n} } ";
+ private static final String s27 = "class A {} interface B {}";
+ private static final String s28 = "interface 'T {}";
+
+ private static final String s29 = "class A { void B(int C) {} } class D { void E(double e) {} }";
+ private static final String s30 = "class '_ { void '_('_:int '_); } ";
+
+ private static final String s31 = "class A extends B { } class D extends B { } class C extends C {}";
+ private static final String s32 = "class '_ extends B { } ";
+
+ private static final String s33 = "class A implements B,C { } class D implements B,D { } class C2 implements C,B {}";
+ private static final String s34 = "class '_ implements B,C { } ";
+
+ private static final String s35 = "class A { int b; double c; void d() {} int e() {} } " +
+ "class A2 { int b; void d() {} }";
+ private static final String s36 = "class '_ { double '_; int '_; int '_() {} void '_() {} } ";
+
+ private static final String s37 = "class A { void d() throws B,C,D {} } class A2 { void d() throws B,C {} }";
+ private static final String s38 = "class 'T { '_ '_() throws D,C {} } ";
+
+ private static final String s39 = "class A extends B { } class A2 { }";
+ private static final String s40 = "class 'T { } ";
+
+ private static final String s41 = "class A extends B { int a = 1; } class B { int[] c= new int[2]; } " +
+ "class D { double e; } class E { int d; } ";
+ private static final String s42_1 = "class '_ { '_T '_T2 = '_T3; } ";
+ private static final String s42_2 = "class '_ { '_T '_T2; } ";
+
+ private static final String s43 = "interface A extends B { int B = 1; } " +
+ "interface D { public final static double e = 1; } " +
+ "interface E { final static ind d = 2; } " +
+ "interface F { } ";
+ private static final String s44 = "interface '_ { '_T 'T2 = '_T3; } ";
+ private static final String s45 = "class A extends B { private static final int B = 1; } " +
+ "class C extends D { int B = 1; }" +
+ "class E { }";
+
+ private static final String s46 = "class '_ { final static private '_T 'T2 = '_T3; } ";
+ private static final String s46_2 = "class '_ { '_T 'T2 = '_T3; } ";
+
+ private static final String s47 = "class C { java.lang.String t; } class B { BufferedString t2;} class A { String p;} ";
+ private static final String s48 = "class '_ { String '_; }";
+
+ private static final String s49 = "class C { void a() throws java.lang.RuntimeException {} } class B { BufferedString t2;}";
+ private static final String s50 = "class '_ { '_ '_() throws RuntimeException; }";
+
+ private static final String s51 = "class C extends B { } class B extends A { } class E {}";
+ private static final String s52 = "class '_ extends '_ { }";
+
+ private static final String s53 = "class C { " +
+ " String a = System.getProperty(\"abcd\"); " +
+ " static { String s = System.getProperty(a); }" +
+ " static void b() { String s = System.getProperty(a); }" +
+ " }";
+ private static final String s54 = "System.getProperty('T)";
+
+ private static final String s55 = " a = b.class; ";
+ private static final String s56 = "'T.class";
+
+ private static final String s57 = "{ /** @author Maxim */ class C { " +
+ "} " +
+ "class D {" +
+ "/** @serializable */ private int value; " +
+ "/** @since 1.4 */ void a() {} "+
+ "}" +
+ "class F { " +
+ "/** @since 1.4 */ void a() {} "+
+ "/** @serializable */ private int value2; " +
+ "}" +
+ "class G { /** @param a*/ void a() {} } }";
+ private static final String s57_2 = "/** @author Maxim */ class C { " +
+ "} " +
+ "class D {" +
+ "/** @serializable */ private int value; " +
+ "/** @since 1.4 */ void a() {} "+
+ "}" +
+ "class F { " +
+ "/** @since 1.4 */ void a() {} "+
+ "/** @serializable */ private int value2; " +
+ "}" +
+ "class G { /** @param a*/ void a() {} }";
+ private static final String s58 = "/** @'T '_T2 */ class '_ { }";
+ private static final String s58_2 = "class '_ { /** @serializable '_ */ '_ '_; }";
+ private static final String s58_3 = "class '_ { /** @'T 1.4 */ '_ '_() {} }";
+ private static final String s58_4 = "/** @'T '_T2 */";
+ private static final String s58_5 = "/** @'T '_T2? */";
+
+ private static final String s59 = "interface A { void B(); }";
+ private static final String s60 = "interface '_ { void '_(); }";
+
+ private static final String s61 = "{ a=b; c=d; return; } { e=f; } {}";
+ private static final String s62_1 = "{ 'T*; }";
+ private static final String s62_2 = "{ 'T+; }";
+ private static final String s62_3 = "{ 'T?; }";
+
+ private static final String s62_4 = "{ '_*; }";
+ private static final String s62_5 = "{ '_+; }";
+ private static final String s62_6 = "{ '_?; }";
+
+ private static final String s63 = " class A { A() {} } class B { public void run() {} }";
+ private static final String s63_2 = " class A { A() {} " +
+ "class B { public void run() {} } " +
+ "class D { public void run() {} } " +
+ "} " +
+ "class C {}";
+ private static final String s64 = " class 'T { public void '_T2:run () {} }";
+ private static final String s64_2 = "class '_ { class 'T { public void '_T2:run () {} } }";
+
+ private static final String s65 = " if (A instanceof B) {} else if (B instanceof C) {}";
+ private static final String s66 = " '_T instanceof '_T2:B";
+
+ private static final String s67 = " buf.append((VirtualFile)a);";
+ private static final String s68 = " (VirtualFile)'T";
+
+ private static final String s69 = " System.getProperties(); System.out.println(); java.lang.System.out.println(); some.other.System.out.println();";
+ private static final String s70 = " System.out ";
+ private static final String s70_2 = " java.lang.System.out ";
+
+ private static final String s71 = " class A { " +
+ "class D { D() { c(); } }" +
+ "void a() { c(); new MouseListenener() { void b() { c(); } } }" +
+ " }";
+ private static final String s72 = " c(); ";
+
+ private static final String s73 = " class A { int A; static int B=5; public abstract void a(int c); void q() { ind d=7; } }";
+ private static final String s74 = " '_Type 'Var = '_Init?; ";
+ private static final String s75 = "{ /** @class aClass\n @author the author */ class A {}\n" +
+ " /** */ class B {}\n" +
+ " /** @class aClass */ class C {} }";
+ private static final String s76 = " /** @'_tag+ '_value+ */";
+ private static final String s76_2 = " /** @'_tag* '_value* */";
+ private static final String s76_3 = " /** @'_tag? '_value? */ class 't {}";
+
+ private static final String s77 = " new ActionListener() {} ";
+ private static final String s78 = " class 'T:.*aaa {} ";
+
+ private static final String s79 = " class A { static { int c; } void a() { int b; b=1; }} ";
+ private static final String s80 = " { '_T 'T3 = '_T2?; '_*; } ";
+
+ private static final String s81 = "class Pair<First,Second> {" +
+ " <C,F> void a(B<C> b, D<F> e) throws C {" +
+ " P<Q> r = (S<T>)null;"+
+ " Q q = null; "+
+ " if (r instanceof S<T>) {}"+
+ " } " +
+ "} class Q { void b() {} } ";
+
+ private static final String s81_2 = "class Double<T> {} class T {} class Single<First extends A & B> {}";
+
+ private static final String s82 = "class '_<'T+> {}";
+ private static final String s82_2 = "'_Expr instanceof '_Type<'_Parameter+>";
+ private static final String s82_3 = "( '_Type<'_Parameter+> ) '_Expr";
+ private static final String s82_4 = "'_Type<'_Parameter+> 'a = '_Init?;";
+ private static final String s82_5 = "class '_ { <'_+> '_Type 'Method('_* '_*); }";
+ private static final String s82_6 = "class '_<'_+ extends 'res+> {}";
+ private static final String s82_7 = "'Type";
+
+ private static final String s83 = "/**\n" +
+ " * @hibernate.class\n" +
+ " * table=\"CATS\"\n" +
+ " */\n" +
+ "public class Cat {\n" +
+ " private Long id; // identifier\n" +
+ " private Date birthdate;\n" +
+ " /**\n" +
+ " * @hibernate.id\n" +
+ " * generator-class=\"native\"\n" +
+ " * column=\"CAT_ID\"\n" +
+ " */\n" +
+ " public Long getId() {\n" +
+ " return id;\n" +
+ " }\n" +
+ " private void setId(Long id) {\n" +
+ " this.id=id;\n" +
+ " }\n" +
+ "\n" +
+ " /**\n" +
+ " * @hibernate.property\n" +
+ " * column=\"BIRTH_DATE\"\n" +
+ " */\n" +
+ " public Date getBirthdate() {\n" +
+ " return birthdate;\n" +
+ " }\n" +
+ " void setBirthdate(Date date) {\n" +
+ " birthdate = date;\n" +
+ " }\n" +
+ " /**\n" +
+ " * @hibernate.property\n" +
+ " * column=\"SEX\"\n" +
+ " * not-null=\"true\"\n" +
+ " * update=\"false\"\n" +
+ " */\n" +
+ " public char getSex() {\n" +
+ " return sex;\n" +
+ " }\n" +
+ " void setSex(char sex) {\n" +
+ " this.sex=sex;\n" +
+ " }\n" +
+ "}";
+
+ private static final String s84 = " /**\n" +
+ " * @hibernate.property\n" +
+ " * 'Property+\n" +
+ " */\n";
+
+ private static final String s84_2 = " /**\n" +
+ " * @hibernate.property\n" +
+ " * update=\"fa.se\"\n" +
+ " */\n";
+
+ private static final String s85 = "{ int a; a=1; a=1; return a; }";
+ private static final String s86 = "'T; 'T;";
+
+ private static final String s87 = " getSomething(\"1\"); a.call(); ";
+ private static final String s88 = " '_Instance.'Call('_*); ";
+ private static final String s88_2 = " 'Call('_*); ";
+ private static final String s88_3 = " '_Instance?.'Call('_*); ";
+ private static final String s89 = "{ a = 1; b = 2; c=3; }";
+ private static final String s90 = "{ '_T*; '_T2*; }";
+ private static final String s90_2 = " { '_T*; '_T2*; '_T3+; } ";
+ private static final String s90_3 = " { '_T+; '_T2+; '_T3+; '_T4+; } ";
+ private static final String s90_4 = " { '_T{1,3}; '_T2{2}; } ";
+ private static final String s90_5 = " { '_T{1}?; '_T2*?; '_T3+?; } ";
+ private static final String s90_6 = " { '_T{1}?; '_T2{1,2}?; '_T3+?; '_T4+?; } ";
+
+ private static final String s91 = "class a {\n" +
+ " void b() {\n" +
+ " int c;\n" +
+ "\n" +
+ " c = 1;\n" +
+ " b();\n" +
+ " a a1;\n" +
+ " }\n" +
+ "}";
+ private static final String s92 = "'T:a";
+ private static final String s92_2 = "'T:b";
+ private static final String s92_3 = "'T:c";
+
+ private static final String s93 = " class A {" +
+ "private int field;" +
+ "public void b() {}" +
+ "}";
+ private static final String s94 = " class '_ {" +
+ "private void b() {}" +
+ "}";
+ private static final String s94_2 = " class '_ {" +
+ "public void b() {}" +
+ "}";
+ private static final String s94_3 = " class '_ {" +
+ "protected int field;" +
+ "}";
+ private static final String s94_4 = " class '_ {" +
+ "private int field;" +
+ "}";
+
+ private static final String s95 = " class Clazz {" +
+ "private int field;" +
+ "private int field2;" +
+ "private int fiel-d2;" +
+ "}";
+
+ private static final String s96 = " class '_ {" +
+ "private int 'T+:field.* ;" +
+ "}";
+
+ public void testSearchExpressions() {
+ assertFalse("subexpr match",findMatchesCount(s2,s3)==0);
+ assertEquals("search for new ",findMatchesCount(s10,s11),0);
+ assertEquals("search for anonymous classes",findMatchesCount(s12,s13),1);
+ // expr in definition initializer
+ assertEquals(
+ "expr in def initializer",
+ 3,
+ findMatchesCount(s53,s54)
+ );
+
+ // a.class expression search
+ assertEquals(
+ "a.class pattern",
+ findMatchesCount(s55,s56),
+ 1
+ );
+
+ String complexCode = "interface I { void b(); } interface I2 extends I {} class I3 extends I {} " +
+ "class A implements I2 { void b() {} } class B implements I3 { void b() {}} " +
+ "I2 a; I3 b; a.b(); b.b(); b.b(); A c; B d; c.b(); d.b(); d.b(); ";
+
+ String exprTypePattern1 = "'t:[exprtype( I2 )].b();";
+ String exprTypePattern2 = "'t:[!exprtype( I2 )].b();";
+
+ String exprTypePattern3 = "'t:[exprtype( *I2 )].b();";
+ String exprTypePattern4 = "'t:[!exprtype( *I2 )].b();";
+
+ assertEquals(
+ "expr type condition",
+ findMatchesCount(complexCode,exprTypePattern1),
+ 1
+ );
+
+ assertEquals(
+ "expr type condition 2",
+ 5,
+ findMatchesCount(complexCode,exprTypePattern2)
+ );
+
+ assertEquals(
+ "expr type condition 3",
+ findMatchesCount(complexCode,exprTypePattern3),
+ 2
+ );
+
+ assertEquals(
+ "expr type condition 4",
+ findMatchesCount(complexCode,exprTypePattern4),
+ 4
+ );
+
+ String complexCode2 = "enum X { XXX, YYY }\n class C { static void ordinal() {} void test() { C c; c.ordinal(); c.ordinal(); X.XXX.ordinal(); } }";
+ assertEquals(
+ "expr type condition with enums",
+ findMatchesCount(complexCode2, "'t:[exprtype( *java\\.lang\\.Enum )].ordinal()"),
+ 1
+ );
+
+ assertEquals(
+ "no smart detection of search target",
+ findMatchesCount("processInheritors(1,2,3,4); processInheritors(1,2,3); processInheritors(1,2,3,4,5,6);","'instance?.processInheritors('_param1{1,6});"),
+ 3
+ );
+
+ String arrays = "int[] a = new int[20];\n" +
+ "byte[] b = new byte[30]";
+ String arrayPattern = "new int[$a$]";
+ assertEquals(
+ "Improper array search",
+ 1,
+ findMatchesCount(arrays,arrayPattern)
+ );
+
+ String someCode = "a *= 2; a+=2;";
+ String otherCode = "a *= 2;";
+
+ assertEquals(
+ "Improper *= 2 search",
+ 1,
+ findMatchesCount(someCode,otherCode)
+ );
+
+ String s1 = "Thread t = new Thread(\"my thread\",\"my another thread\") {\n" +
+ " public void run() {\n" +
+ " // do stuff\n" +
+ " }\n" +
+ "}";
+ String s2 = "new Thread('args*) { '_Other* }";
+
+ assertEquals(
+ "Find inner class parameters",
+ 2,
+ findMatchesCount(s1,s2)
+ );
+
+ String s3 = "Thread t = new Thread(\"my thread\") {\n" +
+ " public void run() {\n" +
+ " // do stuff\n" +
+ " }\n" +
+ "};";
+ String s4 = "new Thread($args$)";
+
+ assertEquals(
+ "Find inner class by new",
+ 1,
+ findMatchesCount(s3,s4)
+ );
+
+ String s5 = "class A {\n" +
+ "public static <T> T[] copy(T[] array, Class<T> aClass) {\n" +
+ " int i = (int)0;\n" +
+ " int b = (int)0;\n" +
+ " return (T[])array.clone();\n" +
+ " }\n" +
+ "}";
+ String s6 = "($T$[])$expr$";
+
+ assertEquals(
+ "Find cast to array",
+ 1,
+ findMatchesCount(s5,s6)
+ );
+
+ String s7 = "import java.math.BigDecimal;\n" +
+ "\n" +
+ "public class Prorator {\n" +
+ " public void prorate(BigDecimal[] array) {\n" +
+ " // do nothing\n" +
+ " }\n" +
+ " public void prorate2(java.math.BigDecimal[] array) {\n" +
+ " // do nothing\n" +
+ " }\n" +
+ " public void prorate(BigDecimal bd) {\n" +
+ " // do nothing\n" +
+ " }\n" +
+ "\n" +
+ " public static void main(String[] args) {\n" +
+ " BigDecimal[] something = new BigDecimal[2];\n" +
+ " java.math.BigDecimal[] something2 = new BigDecimal[2];\n" +
+ " something[0] = new BigDecimal(1.0);\n" +
+ " something[1] = new BigDecimal(1.0);\n" +
+ "\n" +
+ " Prorator prorator = new Prorator();\n" +
+ "\n" +
+ "// ---------------------------------------------------\n" +
+ "// the line below should've been found, in my opinion.\n" +
+ "// --------------------------------------------------\n" +
+ " prorator.prorate(something);\n" +
+ " prorator.prorate(something2);\n" +
+
+ " prorator.prorate(something[0]);\n" +
+ " prorator.prorate(something[1]);\n" +
+ " prorator.prorate(something[0]);\n" +
+ " }\n" +
+ "}";
+ String s8 = "'_Instance.'_MethodCall:[regex( prorate )]('_Param:[exprtype( BigDecimal\\[\\] )]) ";
+
+ assertEquals(
+ "Find method call with array for parameter expr type",
+ 2,
+ findMatchesCount(s7,s8,true)
+ );
+
+ String s13 = "try { } catch(Exception e) { e.printStackTrace(); }";
+ String s14 = "'_Instance.'_MethodCall('_Parameter*)";
+
+ assertEquals(
+ "Find statement in catch",
+ 1,
+ findMatchesCount(s13,s14)
+ );
+
+ String s9 = "int a[] = new int[] { 1,2,3,4};\n" +
+ "int b[] = { 2,3,4,5 };\n" +
+ "Object[] c = new Object[] { \"\", null};";
+ String s10 = "new '_ []{ '_* }";
+ String s10_2 = "new int []{ '_* }";
+
+ assertEquals(
+ "Find array instatiation",
+ 3,
+ findMatchesCount(s9,s10)
+ );
+
+ assertEquals(
+ "Find array instatiation, 2",
+ 2,
+ findMatchesCount(s9,s10_2)
+ );
+ }
+
+ public void testLiteral() {
+ String s = "class A {\n" +
+ " static String a = 1;\n" +
+ " static String s = \"aaa\";\n" +
+ " static String s2;\n" +
+ "}";
+ String s2 = "static String '_FieldName = '_Init?:[!regex( \".*\" )];";
+ String s2_2 = "static String '_FieldName = '_Init:[!regex( \".*\" )];";
+
+ assertEquals(
+ "Literal",
+ 2,
+ findMatchesCount(s,s2)
+ );
+
+ assertEquals(
+ "Literal, 2",
+ 1,
+ findMatchesCount(s,s2_2)
+ );
+ }
+
+ public void testCovariantArraySearch() {
+ String s1 = "String[] argv;";
+ String s2 = "String argv;";
+ String s3 = "'T[] argv;";
+ String s3_2 = "'T:*Object [] argv;";
+
+ assertEquals(
+ "Find array types",
+ 0,
+ findMatchesCount(s1,s2)
+ );
+
+ assertEquals(
+ "Find array types, 2",
+ 0,
+ findMatchesCount(s2,s1)
+ );
+
+ assertEquals(
+ "Find array types, 3",
+ 0,
+ findMatchesCount(s2,s3)
+ );
+
+ assertEquals(
+ "Find array types, 3",
+ 1,
+ findMatchesCount(s1,s3_2)
+ );
+
+ String s11 = "class A {\n" +
+ " void main(String[] argv);" +
+ " void main(String argv[]);" +
+ " void main(String argv);" +
+ "}";
+ String s12 = "'_t:[regex( *Object\\[\\] ) ] '_t2";
+ String s12_2 = "'_t:[regex( *Object ) ] '_t2 []";
+ String s12_3 = "'_t:[regex( *Object ) ] '_t2";
+
+ assertEquals(
+ "Find array covariant types",
+ 2,
+ findMatchesCount(s11,s12)
+ );
+
+ assertEquals(
+ "Find array covariant types, 2",
+ 2,
+ findMatchesCount(s11,s12_2)
+ );
+
+ assertEquals(
+ "Find array covariant types, 3",
+ 1,
+ findMatchesCount(s11,s12_3)
+ );
+
+ String source = "class A { String ss[][]; }";
+ String target = "String[][] $s$;";
+ assertEquals(
+ "should find multi dimensional c-style array declarations",
+ 1,
+ findMatchesCount(source, target)
+ );
+ }
+
+ // @todo support back references (\1 in another reg exp or as fild member)
+ //private static final String s1002 = " setSSS( instance.getSSS() ); " +
+ // " setSSS( instance.SSS ); ";
+ //private static final String s1003 = " 't:set(.+) ( '_.get't_1() ); ";
+ //private static final String s1003_2 = " 't:set(.+) ( '_.'t_1 ); ";
+
+ public void testSearchStatements() {
+ assertEquals("statement search",findMatchesCount(s1,s2),1);
+ assertEquals("several constructions match",findMatchesCount(s5,s4),3);
+ assertFalse("several constructions 2",(findMatchesCount(s5,s6))!=0);
+
+ assertEquals("several constructions 3",findMatchesCount(s7,s8),2);
+ assertEquals("several constructions 4",findMatchesCount(s7,s9),2);
+
+ final String s1000 = "{ lastTest = \"search for parameterized pattern\";\n" +
+ " matches = testMatcher.findMatches(s14_1,s15, options);\n" +
+ " if (matches.size()!=2 ) return false;\n" +
+ "lastTest = \"search for parameterized pattern\";\n" +
+ " matches = testMatcher.findMatches(s14_1,s15, options);\n" +
+ " if (matches.size()!=2 ) return false; }";
+ final String s1001 = "lastTest = '_Descr; " +
+ " matches = testMatcher.findMatches('_In,'_Pattern, options);\n" +
+ " if (matches.size()!='_Number ) return false;";
+
+ assertEquals("several operators 5",findMatchesCount(s1000,s1001),2);
+
+ assertEquals(
+ "two the same statements search",
+ findMatchesCount(s85,s86),
+ 1
+ );
+
+ assertEquals(
+ "search for simple call",
+ findMatchesCount(s87,s88),
+ 1
+ );
+
+ assertEquals(
+ "search for simple call 2",
+ findMatchesCount(s87,s88_2),
+ 1
+ );
+
+ assertEquals(
+ "search for simple call 3",
+ findMatchesCount(s87,s88_3),
+ 2
+ );
+
+ String s10015 = "DocumentListener[] listeners = getCachedListeners();";
+ String s10016 = "'_Type 'Var = '_Call();";
+
+ assertEquals(
+ "search for definition with init",
+ 1,
+ findMatchesCount(s10015,s10016)
+ );
+
+ String s10017 = "a = b; b = c; a=a; c=c;";
+ String s10018 = "'_a = '_a;";
+
+ assertEquals(
+ "search silly assignments",
+ 2,
+ findMatchesCount(s10017,s10018)
+ );
+
+ String s10019 = "a.b(); a.b(null); a.b(null, 1);";
+ String s10020 = "a.b(null);";
+
+ assertEquals(
+ "search parameter",
+ 1,
+ findMatchesCount(s10019,s10020)
+ );
+
+ String s1008 = "int a, b, c, d; int a,b,c; int c,d; int e;";
+ String s1009 = "int '_a{3,4};";
+
+ assertEquals(
+ "search many declarations",
+ 2,
+ findMatchesCount(s1008,s1009)
+ );
+
+ String s1 = "super(1,1); call(1,1); call(2,2);";
+ String s2 = "super('_t*);";
+
+ assertEquals(
+ "search super",
+ 1,
+ findMatchesCount(s1,s2)
+ );
+
+ String s10021 = "short a = 1;\n" +
+ "short b = 2;\n" +
+ "short c = a.b();";
+ String s10022 = "short '_a = '_b.b();";
+
+ assertEquals(
+ "search def init bug",
+ 1,
+ findMatchesCount(s10021,s10022)
+ );
+
+ String s10023 = "abstract class A { public abstract short getType(); }\n" +
+ "A a;\n" +
+ "switch(a.getType()) {\n" +
+ " default:\n" +
+ " return 0;\n" +
+ "}\n" +
+ "switch(a.getType()) {\n" +
+ " case 1:\n" +
+ " { return 0; }\n" +
+ "}";
+ String s10024 = "switch('_a:[exprtype( short )]) { '_statement*; }";
+ assertEquals(
+ "finding switch",
+ 2,
+ findMatchesCount(s10023,s10024)
+ );
+
+ String s10025 = "A[] a;\n" +
+ "A b[];\n" +
+ "A c;";
+ String s10026 = "A[] 'a;";
+ String s10026_2 = "A 'a[];";
+
+ assertEquals(
+ "array types in dcl",
+ 2,
+ findMatchesCount(s10025,s10026)
+ );
+
+ assertEquals(
+ "array types in dcl 2",
+ 2,
+ findMatchesCount(s10025,s10026_2)
+ );
+
+ String s10027 = "try { a(); } catch(Exception ex) {}\n" +
+ "try { a(); } finally {}\n" +
+ "try { a(); } catch(Exception ex) {} finally {} \n";
+ String s10028 = "try { a(); } finally {}\n";
+ assertEquals(
+ "finally matching",
+ 2,
+ findMatchesCount(s10027,s10028)
+ );
+
+ String s10029 = "for(String a:b) { System.out.println(a); }";
+ String s10030 = "for(String a:b) { '_a; }";
+ assertEquals(
+ "for each matching",
+ 1,
+ findMatchesCount(s10029,s10030)
+ );
+
+ String s10031 = "try { a(); } catch(Exception ex) {} catch(Error error) { 1=1; }\n" +
+ "try { a(); } catch(Exception ex) {}";
+ String s10032 = "try { a(); } catch('_Type+ 'Arg+) { 'Statements*; }\n";
+ assertEquals(
+ "finally matching",
+ 2,
+ findMatchesCount(s10031,s10032)
+ );
+
+ String s10033 = "return x;\n" +
+ "return !x;\n" +
+ "return (x);\n" +
+ "return (x);\n" +
+ "return !(x);";
+ String s10034 = "return ('a);";
+ assertEquals("Find statement with parenthesized expr",2,findMatchesCount(s10033,s10034));
+ }
+
+ public void testSearchClass() {
+ // no modifier list in interface vars
+ assertEquals(
+ "no modifier for interface vars",
+ findMatchesCount(s43,s44),
+ 3
+ );
+
+ // different order of access modifiers
+ assertEquals(
+ "different order of access modifiers",
+ findMatchesCount(s45,s46),
+ 1
+ );
+
+ // no access modifiers
+ assertEquals(
+ "no access modifier",
+ findMatchesCount(s45,s46_2),
+ 2
+ );
+
+ // type could differ with package
+ assertEquals(
+ "type differs with package",
+ findMatchesCount(s47,s48),
+ 2
+ );
+
+ // reference element could differ in package
+ assertEquals(
+ "reference could differ in package",
+ findMatchesCount(s49,s50),
+ 1
+ );
+
+ String s51 = "class C extends java.awt.List {} class A extends java.util.List {} class B extends java.awt.List {} ";
+ String s52 = "class 'B extends '_C:java\\.awt\\.List {}";
+
+ assertEquals(
+ "reference could differ in package 2",
+ findMatchesCount(s51,s52),
+ 2
+ );
+
+ assertEquals(
+ "method access modifier",
+ findMatchesCount(s93,s94),
+ 0
+ );
+
+ assertEquals(
+ "method access modifier 2",
+ findMatchesCount(s93,s94_2),
+ 1
+ );
+
+ assertEquals(
+ "field access modifier",
+ findMatchesCount(s93,s94_3),
+ 0
+ );
+
+ assertEquals(
+ "field access modifier 2",
+ findMatchesCount(s93,s94_4),
+ 1
+ );
+
+ final String s127 = "class a { void b() { new c() {}; } }";
+ final String s128 = "class 't {}";
+ assertEquals(
+ "class finds anonymous class",
+ findMatchesCount(s127,s128),
+ 2
+ );
+
+ final String s129 = "class a { public void run() {} }\n" +
+ "class a2 { public void run() { run(); } }\n" +
+ "class a3 { public void run() { run(); } }\n" +
+ "class a4 { public void run(); }";
+
+ final String s130 = "class 'a { public void run() {} }";
+ final String s130_2 = "class 'a { public void run() { '_statement; } }";
+ final String s130_3 = "class 'a { public void run(); }";
+
+ assertEquals(
+ "empty method finds empty method only",
+ findMatchesCount(s129,s130),
+ 1
+ );
+
+ assertEquals(
+ "nonempty method finds nonempty method",
+ findMatchesCount(s129,s130_2),
+ 2
+ );
+
+ assertEquals(
+ "nonempty method finds nonempty method",
+ findMatchesCount(s129,s130_3),
+ 4
+ );
+
+ final String s133 = "class S {\n" +
+ "void cc() {\n" +
+ " new Runnable() {\n" +
+ " public void run() {\n" +
+ " f();\n" +
+ " }\n" +
+ " private void f() {\n" +
+ " //To change body of created methods use File | Settings | File Templates.\n" +
+ " }\n" +
+ " };\n" +
+ " new Runnable() {\n" +
+ " public void run() {\n" +
+ " f();\n" +
+ " }\n" +
+ " private void g() {\n" +
+ " //To change body of created methods use File | Settings | File Templates.\n" +
+ " }\n" +
+ " };\n" +
+ " new Runnable() {\n" +
+ " public void run() {\n" +
+ " f();\n" +
+ " }\n" +
+ " };\n" +
+ " }\n" +
+ " private void f() {\n" +
+ " //To change body of created methods use File | Settings | File Templates.\n" +
+ " }\n" +
+ "} ";
+ final String s134 = "new Runnable() {\n" +
+ " public void run() {\n" +
+ " '_f ();\n" +
+ " }\n" +
+ " private void '_f ();\n" +
+ " }";
+ assertEquals(
+ "complex expr matching",
+ 1,
+ findMatchesCount(s133,s134)
+ );
+
+ final String s135 = "abstract class My {\n" +
+ " abstract void f();\n" +
+ "}\n" +
+ "abstract class My2 {\n" +
+ " abstract void f();\n" +
+ " void fg() {}\n" +
+ "}";
+ final String s136 = "class 'm {\n" +
+ " void f();\n" +
+ " '_type '_method{0,0} ('_paramtype* '_paramname* );\n" +
+ "}";
+ assertEquals(
+ "reject method with 0 max occurence",
+ findMatchesCount(s135,s136),
+ 1
+ );
+
+ final String s137 = "abstract class My {\n" +
+ " int a;\n" +
+ "}\n" +
+ "abstract class My2 {\n" +
+ " Project b;\n" +
+ "}" +
+ "abstract class My3 {\n" +
+ " Class clazz;"+
+ " Project b = null;\n" +
+ "}" +
+ "abstract class My {\n" +
+ " int a = 1;\n" +
+ "}\n";
+ final String s138 = "class 'm {\n" +
+ " Project '_f{0,0} = '_t?;\n" +
+ "}";
+ assertEquals(
+ "reject field with 0 max occurence",
+ findMatchesCount(s137,s138),
+ 2
+ );
+
+ final String s139 = "class My { boolean equals(Object o); int hashCode(); }";
+ final String s139_2 = "class My { boolean equals(Object o); }";
+ final String s140 = "class 'A { boolean equals(Object '_o ); int '_hashCode{0,0}:hashCode (); }";
+
+ assertEquals(
+ "reject method with constraint",
+ findMatchesCount(s139,s140),
+ 0
+ );
+
+ assertEquals(
+ "reject field with 0 max occurence",
+ findMatchesCount(s139_2,s140),
+ 1
+ );
+
+ final String s141 = "class A { static { a = 10 } }\n" +
+ "class B { { a = 10; } }\n" +
+ "class C { { a = 10; } }";
+ final String s142 = "class '_ { static { a = 10; } } ";
+ assertEquals(
+ "static block search",
+ findMatchesCount(s141,s142),
+ 1
+ );
+ }
+
+ public void testParameterlessContructorSearch() {
+ final String s143 = "class A { A() {} };\n" +
+ "class B { B(int a) {} };\n" +
+ "class C { C() {} C(int a) {} };\n" +
+ "class D {}\n" +
+ "class E {}";
+ final String s144 = "class '_a { '_d{0,0}:[ script( \"__context__.constructor\" ) ]('_b+ '_c+); }";
+ assertEquals(
+ "parameterless contructor search",
+ 3,
+ findMatchesCount(s143,s144)
+ );
+ }
+
+ public void testCheckScriptValidation() {
+ final String s1 = "";
+ final String s2 = "'_b:[script( \"^^^\" )]";
+
+ try {
+ final int count = findMatchesCount(s1, s2);
+ assertFalse("Validation does not work", true);
+ } catch (MalformedPatternException ex) {}
+ }
+
+ //public void testRelationBetweenVars() {
+ // final String s1 = "public class Foo {\n" +
+ // " public static final Logger log = Logger.getInstance(Foo.class);\n" +
+ // " public static final Logger log2 = Logger.getInstance(Foo2.class);\n" +
+ // " public static final Logger log3 = Logger.getInstance(Foo2.class);\n" +
+ // "}";
+ // final String s2 = "class '_a { static Logger 'log+ = Logger.getInstance('_b:[script( \"_a != _b\" )].class); }";
+ // assertEquals(
+ // "relation between vars in script",
+ // 2,
+ // findMatchesCount(s1,s2)
+ // );
+ //}
+
+ public void testExprTypeWithObject() {
+ String s1 = "import java.util.*;\n" +
+ "class A {\n" +
+ " void b() {\n" +
+ " Map map = new HashMap();" +
+ " class AppPreferences {}\n" +
+ " String key = \"key\";\n" +
+ " AppPreferences value = new AppPreferences();\n" +
+ " map.put(key, value );\n" +
+ " map.put(value, value );\n" +
+ " map.put(\"key\", value );\n" +
+ " map.put(\"key\", new AppPreferences());\n" +
+ " }\n" +
+ "}";
+ String s2 = "'_map:[exprtype( *java\\.util\\.Map )].put('_key:[ exprtype( *Object ) ], '_value:[ exprtype( *AppPreferences ) ]);";
+
+ assertEquals(
+ "expr type with object",
+ 4,
+ findMatchesCount(s1,s2,true)
+ );
+ }
+
+ public void testInterfaceImplementationsSearch() {
+ String in = "class A implements Cloneable {\n" +
+ " \n" +
+ " }\n" +
+ " \n" +
+ " class B implements Serializable {\n" +
+ " \n" +
+ " }\n" +
+ " \n" +
+ " class C implements Cloneable,Serializable {\n" +
+ " \n" +
+ " }\n" +
+ " class C2 implements Serializable,Cloneable {\n" +
+ " \n" +
+ " }\n" +
+ " \n" +
+ " class E extends B implements Cloneable {\n" +
+ " \n" +
+ " }\n" +
+ " \n" +
+ " class F extends A implements Serializable {\n" +
+ " \n" +
+ " }\n" +
+ " \n" +
+ " class D extends C {\n" +
+ " \n" +
+ " }";
+ String what = "class 'A implements '_B:*Serializable , '_C:*Cloneable {}";
+ assertEquals(
+ "search interface within hierarchy",
+ 5,
+ findMatchesCount(in, what)
+ );
+ }
+
+ public void testSearchBacktracking() {
+ assertEquals(
+ "backtracking greedy regexp",
+ findMatchesCount(s89,s90),
+ 1
+ );
+
+ assertEquals(
+ "backtracking greedy regexp 2",
+ findMatchesCount(s89,s90_2),
+ 1
+ );
+
+ assertEquals(
+ "backtracking greedy regexp 3",
+ findMatchesCount(s89,s90_3),
+ 0
+ );
+
+ assertEquals(
+ "counted regexp (with back tracking)",
+ findMatchesCount(s89,s90_4),
+ 1
+ );
+
+ assertEquals(
+ "nongreedy regexp (counted, with back tracking)",
+ findMatchesCount(s89,s90_5),
+ 1
+ );
+
+ assertEquals(
+ "nongreedy regexp (counted, with back tracking) 2",
+ findMatchesCount(s89,s90_6),
+ 0
+ );
+
+ String s1000 = "class A {\n" +
+ " void _() {}\n" +
+ " void a(String in, String pattern) {}\n" +
+ " }";
+ String s1001 = "class '_Class { \n" +
+ " '_ReturnType+ 'MethodName+ ('_ParameterType* '_Parameter* );\n" +
+ "}";
+ assertEquals(
+ "handling of no match",
+ findMatchesCount(s1000,s1001),
+ 2
+ );
+ }
+
+ public void testSearchSymbol() {
+ final String s131 = "a.b(); c.d = 1; ";
+ final String s132 = "'T:b|d";
+
+ assertEquals(
+ "symbol match",
+ 2,
+ findMatchesCount(s131,s132)
+ );
+
+ final String s129 = "A a = new A();";
+ final String s130 = "'Sym:A";
+
+ options.setCaseSensitiveMatch(true);
+ assertEquals(
+ "case sensitive match",
+ findMatchesCount(s129,s130),
+ 2
+ );
+
+ options.setDistinct(true);
+ assertEquals(
+ "case sensitive disitinct match",
+ findMatchesCount(s129,s130),
+ 1
+ );
+
+ options.setDistinct(false);
+
+ final String s133 = "class C { int a; int A() { a = 1; }} void c(int a) { a = 2; }";
+ final String s133_2 = "class C { int a() {} int A() { a(1); }}";
+ final String s134 = "a";
+
+ List<MatchResult> results = findMatches(s133, s134, true, StdFileTypes.JAVA);
+ assertEquals(
+ "find sym finds declaration",
+ 4, results.size()
+ );
+
+ assertEquals(
+ "find sym finds declaration",
+ 2, findMatchesCount(s133_2, s134, true)
+ );
+ }
+
+ public void testSearchGenerics() {
+ assertEquals(
+ "parameterized class match",
+ findMatchesCount(s81,s82),
+ 2
+ );
+
+ assertEquals(
+ "parameterized instanceof match",
+ findMatchesCount(s81,s82_2),
+ 1
+ );
+
+ assertEquals(
+ "parameterized cast match",
+ findMatchesCount(s81,s82_3),
+ 1
+ );
+
+ assertEquals(
+ "parameterized definition match",
+ findMatchesCount(s81,s82_4),
+ 3
+ );
+
+ assertEquals(
+ "parameterized method match",
+ findMatchesCount(s81,s82_5),
+ 1
+ );
+
+ assertEquals(
+ "parameterized constraint match",
+ findMatchesCount(s81_2,s82_6),
+ 2
+ );
+
+ assertEquals(
+ "symbol matches parameterization",
+ findMatchesCount(s81,s82_7),
+ 29
+ );
+
+ assertEquals(
+ "symbol matches parameterization 2",
+ findMatchesCount(s81_2,s82_7),
+ 7
+ );
+
+ String s81_3 = " class A {\n" +
+ " public static <T> Collection<T> unmodifiableCollection(int c) {\n" +
+ " return new d<T>(c);\n" +
+ " }\n" +
+ " static class d<E> implements Collection<E>, Serializable {\n" +
+ " public <T> T[] toArray(T[] a) {return c.toArray(a);}\n" +
+ " }\n" +
+ "}";
+ assertEquals(
+ "typed symbol symbol",
+ findMatchesCount(s81_3,s82_5),
+ 2
+ );
+
+ String s81_4="class A<B> { \n" +
+ " static <C> void c(D<E> f) throws R<S> {\n" +
+ " if ( f instanceof G<H>) {\n" +
+ " ((I<G<K>>)l).a();\n" +
+ " throw new P<Q>();" +
+ " }\n" +
+ " }\n" +
+ "} " +
+ "class C {\n" +
+ " void d(E f) throws Q {\n" +
+ " if (g instanceof H) { a.c(); b.d(new A() {}); throw new Exception(((I)k)); }"+
+ " }\n" +
+ "}";
+ String s82_8 = "'T<'_Subst+>";
+ assertEquals(
+ "typed symbol",
+ findMatchesCount(s81_4,s82_8),
+ 6
+ );
+
+ String s81_5 = "class A { HashMap<String, Integer> variable = new HashMap<String, Integer>(\"aaa\");}";
+ String s82_9 = "'_Type<'_GType, '_GType2> '_instance = new '_Type<'_GType, '_GType2>('_Param);";
+ assertEquals(
+ "generic vars in new",
+ findMatchesCount(s81_5,s82_9),
+ 1
+ );
+ String source1 = "class Comparator<T> { private Comparator<String> c; private Comparator d; }";
+ String target1 = "java.util.Comparator 'a;";
+ assertEquals(
+ "qualified type should not match 1",
+ 0,
+ findMatchesCount(source1, target1)
+ );
+
+ String target2 = "java.util.Comparator<String> 'a;";
+ assertEquals(
+ "qualified type should not match 2",
+ 0,
+ findMatchesCount(source1, target2)
+ );
+
+ // @todo typed vars constrains (super),
+ // @todo generic method invocation
+
+ //String s83 = "class A {} List<A> a; List b;";
+ //String s84 = "'a:List 'c;";
+ //String s84_2 = "'a:List\\<'_\\> 'c;";
+ //String s84_3 = "'a:List(?>\\<'_\\>) 'c;";
+ //
+ //assertEquals(
+ // "finding list",
+ // findMatchesCount(s83,s84),
+ // 2
+ //);
+ //
+ //assertEquals(
+ // "finding list 2",
+ // findMatchesCount(s83,s84_2),
+ // 1
+ //);
+ //
+ //assertEquals(
+ // "finding list 3",
+ // findMatchesCount(s83,s84_3),
+ // 1
+ //);
+ }
+
+ public void testSearchSubstitutions() {
+ // searching for parameterized pattern
+ assertEquals("search for parameterized pattern",findMatchesCount(s14_1,s15),2);
+
+ assertEquals("search for parameterized pattern 2",findMatchesCount(s14_2,s15),5);
+
+ options.setRecursiveSearch(false);
+
+ assertEquals("search for parameterized pattern-non-recursive",findMatchesCount(s14_1,s15),1);
+
+ assertEquals("search for parameterized pattern 2-non-recursive",findMatchesCount(s14_2,s15),2);
+
+ // typed vars with arrays
+ assertEquals("typed pattern with array 2-non-recursive",findMatchesCount(s23,s24_2),4);
+
+ options.setRecursiveSearch(true);
+
+ // searching for parameterized pattern
+ assertEquals("search for parameterized pattern 3",findMatchesCount(s14_2,s16),1);
+
+ // searching for parameterized pattern in complex expr (with field selection)
+ assertEquals("search for parameterized pattern in field selection",findMatchesCount(s17,s18_1),1);
+
+ // searching for parameterized pattern in complex expr (with method call)
+ assertEquals("search for parameterized pattern with method call",findMatchesCount(s17,s18_2),1);
+
+ // searching for parameterized pattern in complex expr (with method call)
+ assertEquals("search for parameterized pattern with method call ep.2",findMatchesCount(s17,s18_3),4);
+
+ // searching for parameterized pattern in definition with initializer
+ assertEquals("search for same var constraint",findMatchesCount(s19,s20),1);
+
+ // searching for semi anonymous parameterized pattern in definition with initializer
+ assertEquals("search for same var constraint for semi anonymous typed vars",findMatchesCount(s19,s20_2),1);
+
+ // support for type var constraint
+ assertEquals("search for typed var constraint",findMatchesCount(s22,s21_1),1);
+
+ // noncompatible same typed var constraints
+ try {
+ findMatchesCount(s22,s21_2);
+ assertFalse("search for noncompatible typed var constraint",false);
+ } catch(MalformedPatternException e) {
+ }
+
+ // compatible same typed var constraints
+ assertEquals("search for same typed var constraint",findMatchesCount(s22,s21_3),1);
+
+ // typed var with instanceof
+ assertEquals("typed instanceof",findMatchesCount(s65,s66),1);
+
+ // typed vars with arrays
+ assertEquals("typed pattern with array",findMatchesCount(s23,s24_1),2);
+
+ // typed vars with arrays
+ assertEquals("typed pattern with array 2",findMatchesCount(s23,s24_2),6);
+
+ // typed vars in class name, method name, its return type, parameter type and name
+ assertEquals("typed pattern in class name, method name, return type, parameter type and name",findMatchesCount(s25,s26),1);
+
+ assertEquals(
+ "finding interface",
+ findMatchesCount(s27,s28),
+ 1
+ );
+
+ // finding anonymous type vars
+ assertEquals(
+ "anonymous typed vars",
+ findMatchesCount(s29,s30),
+ 1
+ );
+
+ // finding descedants
+ assertEquals(
+ "finding class descendants",
+ findMatchesCount(s31,s32),
+ 2
+ );
+
+ // finding interface implementation
+ assertEquals(
+ "interface implementation",
+ findMatchesCount(s33,s34),
+ 2
+ );
+
+ // different order of fields and methods
+ assertEquals(
+ "different order of fields and methods",
+ findMatchesCount(s35,s36),
+ 1
+ );
+
+ // different order of exceptions in throws
+ assertEquals(
+ "differend order in throws",
+ findMatchesCount(s37,s38),
+ 1
+ );
+
+ // class pattern without extends matches pattern with extends
+ assertEquals(
+ "match of class without extends to class with it",
+ findMatchesCount(s39,s40),
+ 2
+ );
+
+ // class pattern without extends matches pattern with extends
+ assertEquals(
+ "match of class without extends to class with it, ep. 2",
+ findMatchesCount(s41,s42_1),
+ 2
+ );
+
+ // class pattern without extends matches pattern with extends
+ assertEquals(
+ "match of class without extends to class with it, ep 3",
+ findMatchesCount(s41,s42_2),
+ 2
+ );
+
+ // typed reference element
+ assertEquals(
+ "typed reference element",
+ findMatchesCount(s51,s52),
+ 2
+ );
+
+ // empty name of type var
+ assertEquals(
+ "empty name for typed var",
+ findMatchesCount(s59,s60),
+ 1
+ );
+
+ // comparing method with constructor
+ assertEquals(
+ "comparing method with constructor",
+ findMatchesCount(s63,s64),
+ 1
+ );
+
+ // comparing method with constructor
+ assertEquals(
+ "finding nested class",
+ findMatchesCount(s63_2,s64),
+ 2
+ );
+
+ // comparing method with constructor
+ assertEquals(
+ "finded nested class by special pattern",
+ findMatchesCount(s63_2,s64_2),
+ 1
+ );
+
+ assertEquals(
+ "* regexp for typed var",
+ findMatchesCount(s61,s62_1),
+ 5
+ );
+
+ assertEquals(
+ "+ regexp for typed var",
+ findMatchesCount(s61,s62_2),
+ 4
+ );
+
+ assertEquals(
+ "? regexp for typed var",
+ findMatchesCount(s61,s62_3),
+ 2
+ );
+
+ assertEquals(
+ "cast in method parameters",
+ findMatchesCount(s67,s68),
+ 1
+ );
+
+ assertEquals(
+ "searching for static field in static call",
+ 2,
+ findMatchesCount(s69,s70)
+ );
+
+ assertEquals(
+ "searching for static field in static call, 2",
+ 2,
+ findMatchesCount(s69,s70_2)
+ );
+
+ assertEquals(
+ "* regexp for anonymous typed var",
+ findMatchesCount(s61,s62_4),
+ 3
+ );
+
+ assertEquals(
+ "+ regexp for anonymous typed var",
+ findMatchesCount(s61,s62_5),
+ 2
+ );
+
+ assertEquals(
+ "? regexp for anonymous typed var",
+ findMatchesCount(s61,s62_6),
+ 2
+ );
+
+ assertEquals(
+ "statement inside anonymous class",
+ findMatchesCount(s71,s72),
+ 3
+ );
+
+ assertEquals(
+ "clever regexp match",
+ findMatchesCount(s91,s92),
+ 2
+ );
+
+ assertEquals(
+ "clever regexp match 2",
+ findMatchesCount(s91,s92_2),
+ 2
+ );
+
+ assertEquals(
+ "clever regexp match 3",
+ findMatchesCount(s91,s92_3),
+ 2
+ );
+ }
+
+ public void testSearchJavaDoc() {
+ // javadoc comment in class
+ assertEquals(
+ "java doc comment in class",
+ 1,
+ findMatchesCount(s57,s58)
+ );
+
+ assertEquals(
+ "java doc comment in class in file",
+ 1,
+ findMatchesCount(s57_2,s58,true)
+ );
+
+ // javadoc comment for field
+ assertEquals(
+ "javadoc comment for field",
+ 2,
+ findMatchesCount(s57, s58_2)
+ );
+
+ // javadoc comment for method
+ assertEquals(
+ "javadoc comment for method",
+ 3,
+ findMatchesCount(s57, s58_3)
+ );
+
+ // just javadoc comment search
+ assertEquals(
+ "just javadoc comment search",
+ 4,
+ findMatchesCount(s57,s58_4)
+ );
+
+ assertEquals(
+ "XDoclet metadata",
+ 2,
+ findMatchesCount(s83,s84)
+ );
+
+ assertEquals(
+ "XDoclet metadata 2",
+ 1,
+ findMatchesCount(s83,s84_2)
+ );
+
+ assertEquals(
+ "optional tag value match",
+ 6,
+ findMatchesCount(s57, s58_5)
+ );
+
+ assertEquals(
+ "multiple tags match +",
+ 2,
+ findMatchesCount(s75,s76)
+ );
+
+ assertEquals(
+ "multiple tags match *",
+ 3,
+ findMatchesCount(s75, s76_2)
+ );
+
+ assertEquals(
+ "multiple tags match ?",
+ 3,
+ findMatchesCount(s75, s76_3)
+ );
+
+ }
+
+ public void testNamedPatterns() {
+ String s133 = "class String1 implements java.io.Serializable { " +
+ "private static final long serialVersionUID = -6849794470754667710L;" +
+ "private static final ObjectStreamField[] serialPersistentFields = new ObjectStreamField[0];" +
+ "}" +
+ "class StringBuilder1 implements java.io.Serializable {" +
+ " private void writeObject(java.io.ObjectOutputStream s)\n" +
+ " throws java.io.IOException {\n" +
+ " s.defaultWriteObject();\n" +
+ " }" +
+ "private void readObject(java.io.ObjectInputStream s)\n" +
+ " throws java.io.IOException, ClassNotFoundException {\n" +
+ " s.defaultReadObject();\n" +
+ " }" +
+ " static final long serialVersionUID = 4383685877147921099L;" +
+ "}";
+ String s134 = "class '_ implements '_:*Serializable {\n" +
+ " static final long 'VersionField?:serialVersionUID = '_?;\n" +
+ " private static final ObjectStreamField[] '_?:serialPersistentFields = '_?; \n" +
+ " private void '_SerializationWriteHandler?:writeObject (ObjectOutputStream s) throws IOException;\n" +
+ " private void '_SerializationReadHandler?:readObject (ObjectInputStream s) throws IOException, ClassNotFoundException;\n" +
+ " Object '_SpecialSerializationReadHandler?:readResolve () throws ObjectStreamException;" +
+ " Object '_SpecialSerializationWriteHandler?:writeReplace () throws ObjectStreamException;" +
+ "}";
+
+ assertEquals(
+ "serialization match",
+ findMatchesCount(s133,s134),
+ 2
+ );
+
+ String s135 = "class SimpleStudentEventActionImpl extends Action { " +
+ " public ActionForward execute(ActionMapping mapping,\n" +
+ " ActionForm _form,\n" +
+ " HttpServletRequest _request,\n" +
+ " HttpServletResponse _response)" +
+ " throws Exception {}" +
+ "} " +
+ "public class DoEnrollStudent extends SimpleStudentEventActionImpl { }" +
+ "public class DoCancelStudent extends SimpleStudentEventActionImpl { }";
+ String s136 = "public class 'StrutsActionClass extends '_*:Action {" +
+ " public ActionForward '_AnActionMethod:*execute (ActionMapping '_,\n" +
+ " ActionForm '_,\n" +
+ " HttpServletRequest '_,\n" +
+ " HttpServletResponse '_);" +
+ "}";
+
+ assertEquals(
+ "Struts actions",
+ findMatchesCount(s135,s136),
+ 2
+ );
+
+ final String s123 = "class NodeFilter {} public class MethodFilter extends NodeFilter {\n" +
+ " private MethodFilter() {}\n" +
+ "\n" +
+ " public static NodeFilter getInstance() {\n" +
+ " if (instance==null) instance = new MethodFilter();\n" +
+ " return instance;\n" +
+ " }\n" +
+ " private static NodeFilter instance;\n" +
+ "}";
+ final String s124 = "class 'Class {\n" +
+ " private 'Class('_* '_*) {\n" +
+ " '_*;\n" +
+ " }\n" +
+ " private static '_Class2:* '_Instance;\n" +
+ " static '_Class2:* '_GetInstance() {\n" +
+ " '_*;\n" +
+ " return '_Instance;\n" +
+ " }\n" +
+ "}";
+
+ assertEquals(
+ "singleton search",
+ findMatchesCount(s123,s124),
+ 1
+ );
+
+ String s1111 = "if (true) { a=1; b=1; } else { a=1; }\n" +
+ "if(true) { a=1; } else { a=1; b=1; }\n" +
+ "if(true) { a=1; b=2; } else { a = 1; b=2; }";
+ String s1112 = "if (true) { '_a{1,2}; } else { '_a; }";
+
+ assertEquals(
+ "same multiple name pattern",
+ findMatchesCount(s1111,s1112),
+ 1
+ );
+ }
+
+ public void testHierarchy() {
+ final String s105 = "class B {} class A extends B { }";
+ final String s106 = "class '_ extends '_:[ref('T)] {}";
+ assertEquals(
+ "extends match",
+ findMatchesCount(s105,s106),
+ 1
+ );
+
+ final String s107 = "interface IA {} interface IB extends IA { } interface IC extends IB {} interface ID extends IC {}" +
+ "class A implements IA {} class B extends A { } class C extends B implements IC {} class D extends C {}";
+ final String s108 = "class '_ extends 'Type:+A {}";
+ final String s108_2 = "class '_ implements 'Type:+IA {}";
+
+ assertEquals(
+ "extends navigation match",
+ findMatchesCount(s107,s108),
+ 2
+ );
+
+ assertEquals(
+ "implements navigation match",
+ 3,
+ findMatchesCount(s107,s108_2)
+ );
+
+ final String s109 = "interface I {} interface I2 extends I {} class A implements I2 {} class B extends A { } class C extends B {} class D { void e() { C c; B b; A a;} }";
+ final String s110 = "'_:*A '_;";
+ final String s110_2 = "'_:*I '_;";
+ final String s110_3 = "'_:*[regex( I ) && ref('T)] '_;";
+ final String s110_4 = "'_:*[regex( I ) && ref2('T)] '_;";
+ assertEquals(
+ "extends navigation match in definition",
+ findMatchesCount(s109,s110),
+ 3
+ );
+
+ assertEquals(
+ "implements navigation match in definition 2",
+ findMatchesCount(s109,s110_2),
+ 3
+ );
+
+ assertEquals(
+ "implements navigation match in definition 2 with nested conditions",
+ findMatchesCount(s109,s110_3),
+ 1
+ );
+
+ try {
+ findMatchesCount(s109,s110_4);
+ assertFalse("implements navigation match in definition 2 with nested conditions - incorrect cond",false);
+ } catch(UnsupportedPatternException ex) {}
+
+ final String s111 = "interface E {} class A implements E {} class B extends A { int f = 0; } class C extends B {} class D { void e() { C c; B b; A a;} }";
+ final String s112 = "'_";
+ assertEquals(
+ "symbol match",
+ findMatchesCount(s111,s112),
+ 17
+ );
+
+ final String s113 = "class B {int c; void d() {} } int a; B b; a = 1; b.d(); ++a; int c=a; System.out.println(a); " +
+ "b.c = 1; System.out.println(b.c); b.c++;";
+ final String s114 = "'_:[read]";
+ final String s114_2 = "'_:[write]";
+ assertEquals(
+ "read symbol match",
+ findMatchesCount(s113,s114),
+ 11
+ );
+
+ assertEquals(
+ "write symbol match",
+ findMatchesCount(s113,s114_2),
+ 5
+ );
+
+ final String s115 = "class B {} public class C {}";
+ final String s116 = "public class '_ {}";
+ assertEquals(
+ "public modifier for class",
+ findMatchesCount(s115,s116),
+ 1
+ );
+
+ final String s117 = "class A { int b; void c() { int e; b=1; this.b=1; e=5; " +
+ "System.out.println(e); " +
+ "System.out.println(b); System.out.println(this.b);} }";
+ final String s118 = "this.'Field";
+ final String s118_2 = "this.'Field:[read]";
+ final String s118_3 = "this.'Field:[write]";
+
+ assertEquals(
+ "fields of class",
+ 4,
+ findMatchesCount(s117,s118)
+ );
+
+ assertEquals(
+ "fields of class read",
+ findMatchesCount(s117,s118_2),
+ 2
+ );
+
+ assertEquals(
+ "fields of class written",
+ findMatchesCount(s117,s118_3),
+ 2
+ );
+
+ final String s119 = "try { a.b(); } catch(IOException e) { c(); } catch(Exception ex) { d(); }";
+ final String s120 = "try { '_; } catch('_ '_) { '_; }";
+ final String s120_2 = "try { '_; } catch(Throwable '_) { '_; }";
+ assertEquals(
+ "catches loose matching",
+ findMatchesCount(s119,s120),
+ 1
+ );
+
+ assertEquals(
+ "catches loose matching 2",
+ findMatchesCount(s119,s120_2),
+ 0
+ );
+
+ final String s121 = "class A { private int a; class Inner {} } " +
+ "class B extends A { private int a; class Inner2 {} }";
+ final String s122 = "class '_ { int '_:* ; }";
+ final String s122_2 = "class '_ { int '_:+hashCode (); }";
+ final String s122_3 = "class '_ { class '_:* {} }";
+ assertEquals(
+ "hierarchical matching",
+ findMatchesCount(s121,s122),
+ 2
+ );
+
+ assertEquals(
+ "hierarchical matching 2",
+ findMatchesCount(s121,s122_2),
+ 4
+ );
+
+ assertEquals(
+ "hierarchical matching 3",
+ findMatchesCount(s121,s122_3),
+ 2
+ );
+ }
+
+ public void testSearchInCommentsAndLiterals() {
+ String s1 = "{" +
+ "// This is some comment\n" +
+ "/* This is another\n comment*/\n" +
+ "// Some garbage\n"+
+ "/** And now third comment*/\n" +
+ "/** Some garbage*/ }";
+ String s2 = "// 'Comment:[regex( .*(?:comment).* )]";
+ String s3 = "/** 'Comment:[regex( .*(?:comment).* )] */";
+ String s2_2 = "/* 'Comment:[regex( .*(?:comment).* )] */";
+
+ assertEquals(
+ "Comment matching",
+ findMatchesCount(s1,s2),
+ 3
+ );
+
+ assertEquals(
+ "Comment matching, 2",
+ 3,
+ findMatchesCount(s1,s2_2)
+ );
+
+ assertEquals(
+ "Java doc matching",
+ findMatchesCount(s1,s3),
+ 1
+ );
+
+ String s4 = "\"'test\", \"another test\", \"garbage\"";
+ String s5 = "\"'test:[regex( .*test.* )]\"";
+ String s6 = "\"''test\"";
+
+ assertEquals(
+ "Literal content",
+ findMatchesCount(s4,s5),
+ 2
+ );
+
+ assertEquals(
+ "Literal content with escaping",
+ findMatchesCount(s4,s6),
+ 1
+ );
+
+ String s7 = "\"aaa\"";
+ String s8 = "\"'test:[regex( aaa )]\"";
+
+ assertEquals(
+ "Simple literal content",
+ findMatchesCount(s7,s8),
+ 1
+ );
+
+ String s9 = "\" aaa \" \" bbb \" \" ccc ccc aaa\"";
+ String s10 = "\"'test:[regexw( aaa|ccc )]\"";
+ String s11 = "\"'test:[regexw( bbb )]\"";
+
+ assertEquals(
+ "Whole word literal content with alternations",
+ findMatchesCount(s9,s10),
+ 2
+ );
+
+ assertEquals(
+ "Whole word literal content",
+ findMatchesCount(s9,s11),
+ 1
+ );
+
+ String s12 = "assert agentInfo != null : \"agentInfo is null\";\n" +
+ "assert addresses != null : \"addresses is null\";";
+ String s13 = "assert $exp$ != null : \"$exp$ is null\";";
+
+ assertEquals(
+ "reference to substitution in comment",
+ findMatchesCount(s12,s13),
+ 2
+ );
+
+ String s14 = "\"(some text with special chars)\"," +
+ "\" some\"," +
+ "\"(some)\"";
+ String s15 = "\"('a:[regexw( some )])\"";
+
+ assertEquals(
+ "meta char in literal",
+ 2,
+ findMatchesCount(s14,s15)
+ );
+
+ String s16 = "/**\n" +
+ "* Created by IntelliJ IDEA.\n" +
+ "* User: cdr\n" +
+ "* Date: Nov 15, 2005\n" +
+ "* Time: 4:23:29 PM\n" +
+ "* To change this template use File | Settings | File Templates.\n" +
+ "*/\n" +
+ "public class Y {\n" +
+ "}";
+ String s17 = "/**\n" +
+ "* Created by IntelliJ IDEA.\n" +
+ "* User: '_USER\n" +
+ "* Date: '_DATE\n" +
+ "* Time: '_TIME\n" +
+ "* To change this template use File | Settings | File Templates.\n" +
+ "*/\n" +
+ "class 'c {\n" +
+ "}";
+ assertEquals(
+ "complete comment match",
+ 1,
+ findMatchesCount(s16,s17,true)
+ );
+
+ String s18 = "public class A {\n" +
+ " private void f(int i) {\n" +
+ " int g=0; //sss\n" +
+ " }\n" +
+ "}";
+ String s19 = "class $c$ {\n" +
+ " $type$ $f$($t$ $p$){\n" +
+ " $s$; // sss\n" +
+ " }\n" +
+ "}";
+ assertEquals(
+ "statement match with comment",
+ 1,
+ findMatchesCount(s18,s19)
+ );
+ }
+
+ public void testOther() {
+ assertEquals(
+ "optional init match in definition",
+ findMatchesCount(s73,s74),
+ 4
+ );
+
+ assertEquals(
+ "null match",
+ findMatchesCount(s77,s78),
+ 0
+ );
+
+ assertEquals(
+ "body of method by block search",
+ findMatchesCount(s79,s80),
+ 2
+ );
+
+
+ assertEquals(
+ "first matches, next not",
+ findMatchesCount(s95,s96),
+ 2
+ );
+
+ final String s97 = "class A { int c; void b() { C d; } } class C { C() { A a; a.b(); a.c=1; } }";
+ final String s98 = "'_.'_:[ref('T)] ()";
+ final String s98_2 = "'_.'_:[ref('T)]";
+ final String s98_3 = "'_:[ref('T)].'_ ();";
+ final String s98_4 = "'_:[ref('T)] '_;";
+
+ assertEquals(
+ "method predicate match",
+ findMatchesCount(s97,s98),
+ 1
+ );
+
+ assertEquals(
+ "field predicate match",
+ findMatchesCount(s97,s98_2),
+ 1
+ );
+
+ assertEquals(
+ "dcl predicate match",
+ findMatchesCount(s97,s98_3),
+ 1
+ );
+
+ final String s99 = " char s = '\\u1111'; char s1 = '\\n'; ";
+ final String s100 = " char 'var = '\\u1111'; ";
+ final String s100_2 = " char 'var = '\\n'; ";
+ assertEquals(
+ "char constants in pattern",
+ findMatchesCount(s99,s100),
+ 1
+ );
+
+ assertEquals(
+ "char constants in pattern 2",
+ findMatchesCount(s99,s100_2),
+ 1
+ );
+
+ assertEquals(
+ "class predicate match (from definition)",
+ findMatchesCount(s97,s98_4),
+ 3
+ );
+
+ final String s125 = "a=1;";
+ final String s126 = "'t:[regex(a)]";
+
+ try {
+ findMatchesCount(s125,s126);
+ assertFalse("spaces around reg exp check",false);
+ } catch(MalformedPatternException ex) {}
+
+ options.setDistinct(true);
+
+ final String s101 = "class A { void b() { String d; String e; String[] f; f.length=1; f.length=1; } }";
+ final String s102 = "'_:[ref('T)] '_;";
+
+ assertEquals(
+ "distinct match",
+ findMatchesCount(s101,s102),
+ 1
+ );
+
+ options.setDistinct(false);
+
+ final String s103 = " a=1; ";
+ final String s104 = "'T:{ ;";
+ try {
+ findMatchesCount(s103,s104);
+ assertFalse("incorrect reg exp",false);
+ } catch(MalformedPatternException ex) {
+ }
+
+ final String s106 = "$_ReturnType$ $MethodName$($_ParameterType$ $_Parameter$);";
+ final String s105 = " aaa; ";
+
+ try {
+ findMatchesCount(s105,s106);
+ assertFalse("incorrect reg exp 2",false);
+ } catch(UnsupportedPatternException ex) {
+ }
+
+ String s107 = "class A {\n" +
+ " /* */\n" +
+ " void a() {\n" +
+ " }" +
+ " /* */\n" +
+ " int b = 1;\n" +
+ " /*" +
+ " *" +
+ " */\n" +
+ " class C {}" +
+ "}";
+ String s108 = " /*" +
+ " *" +
+ " */";
+
+ assertEquals("finding comments without typed var", 1, findMatchesCount(s107,s108));
+
+ String s109 = "class A { void b(); int b(int c); char d(char e); }\n" +
+ "A a; a.b(1); a.b(2); a.b(); a.d('e'); a.d('f'); a.d('g');";
+ String s110 = "'_a.'_b:[exprtype( int ) ]('_c*);";
+ assertEquals("caring about method return type", 2, findMatchesCount(s109,s110));
+
+ String s111 = "class A { void getManager() { getManager(); } };\n" +
+ "class B { void getManager() { getManager(); getManager(); } };";
+ String s112 = "'Instance?:[exprtype( B )].getManager()";
+ assertEquals("caring about missing qualifier type", 2, findMatchesCount(s111,s112));
+
+ String s112a = "'Instance?:[regex( B )].getManager()";
+ assertEquals("static query should not match instance method", 0, findMatchesCount(s111, s112a));
+
+ String s112b = "B.getManager()";
+ assertEquals("static query should not match instance method 2", 0, findMatchesCount(s111, s112b));
+
+ String s113 = "class A { static void a() { a(); }}\n" +
+ "class B { static void a() { a(); a(); }}\n";
+ String s114 = "'_Q?:[regex( B )].a()";
+ assertEquals("should care about implicit class qualifier", 2, findMatchesCount(s113, s114));
+
+ String s114a = "B.a()";
+ assertEquals("should match simple implicit class qualifier query", 2, findMatchesCount(s113, s114a));
+
+ String s114b = "'_Q?:[exprtype( B )].a()";
+ assertEquals("instance query should not match static method", 0, findMatchesCount(s113, s114b));
+
+ String s115 = "class A { int a; int f() { return a; }}\n" +
+ "class B { int a; int g() { return a + a; }}\n";
+ String s116 = "'_Instance?:[exprtype( B )].a";
+ assertEquals("should care about implicit instance qualifier", 2, findMatchesCount(s115, s116));
+
+ String s116a = "A.a";
+ assertEquals("should not match instance method", 0, findMatchesCount(s115, s116a));
+
+ String s117 = "class A { static int a; static int f() { return a; }}\n" +
+ "class B { static int a; static int g() { return a + a; }}\n";
+ String s118 = "'_Q?:[regex( B )].a";
+ assertEquals("should care about implicit class qualifier for field", 2, findMatchesCount(s117, s118));
+
+ // b) hierarchy navigation support
+ // c) or search support
+
+ // e) xml search (down-up, nested query), navigation from xml representation <-> java code
+ // f) impl data conversion (jdk 1.5 style) <-> other from (replace support)
+
+ // Directions:
+ // @todo different navigation on sub/supertyping relation (fixed depth), methods implementing interface,
+ // g. like predicates
+ // i. performance
+ // more context for top level classes, difference with interface, etc
+
+ // global issues:
+ // @todo matches out of context
+ // @todo proper regexp support
+
+ // @todo define strict equality of the matches
+ // @todo search for field selection retrieves packages also
+ }
+
+ public void testFQNInPatternAndVariableConstraints() {
+ String s1 = "import java.awt.List;\n" +
+ "class A { List l; }";
+ String s1_2 = "import java.util.List;\n" +
+ "class A { List l; }";
+ String s2 = "class '_ { 'Type:java\\.util\\.List '_Field; }";
+
+ assertEquals("No matches for qualified class",findMatchesCount(s1,s2,true),0);
+ assertEquals("Matches for qualified class",findMatchesCount(s1_2,s2,true),1);
+
+ String s3 = "import java.util.ArrayList;\n" +
+ "class A { ArrayList l; }";
+ String s4 = "class '_ { 'Type:*java\\.util\\.Collection '_Field; }";
+ assertEquals("Matches for qualified class in hierarchy",findMatchesCount(s3,s4,true),1);
+
+ String s5 = "import java.util.List;\n" +
+ "class A { { List l = new List(); l.add(\"1\"); } }";
+ String s5_2 = "import java.awt.List;\n" +
+ "class A { { List l = new List(); l.add(\"1\"); } }";
+ String s6 = "'a:[exprtype( java\\.util\\.List )]";
+ String s6_2 = "'a:[exprtype( *java\\.util\\.Collection )]";
+ String s6_3 = "java.util.List '_a = '_b?;";
+
+ assertEquals("Matches for qualified expr type",findMatchesCount(s5,s6,true), 2);
+ assertEquals("No matches for qualified expr type",findMatchesCount(s5_2,s6,true),0);
+ assertEquals("Matches for qualified expr type in hierarchy",findMatchesCount(s5,s6_2,true), 2);
+
+ assertEquals("Matches for qualified var type in pattern",findMatchesCount(s5,s6_3,true),1);
+ assertEquals("No matches for qualified var type in pattern",findMatchesCount(s5_2,s6_3,true),0);
+
+ String s7 = "import java.util.List;\n" +
+ "class A extends List { }";
+ String s7_2 = "import java.awt.List;\n" +
+ "class A extends List {}";
+
+ String s8 = "class 'a extends java.util.List {}";
+
+ assertEquals("Matches for qualified type in pattern",findMatchesCount(s7,s8,true),1);
+ assertEquals("No matches for qualified type in pattern",findMatchesCount(s7_2,s8,true),0);
+
+ String s9 = "String.intern(\"1\");\n" +
+ "java.util.Collections.sort(null);" +
+ "java.util.Collections.sort(null);";
+ String s10 = "java.lang.String.'_method ( '_params* )";
+ assertEquals("FQN in class name",1,findMatchesCount(s9,s10,false));
+ }
+
+ public void testAnnotations() throws Exception {
+ String s1 = "@MyBean(\"\")\n" +
+ "@MyBean2(\"\")\n" +
+ "public class TestBean {}\n" +
+ "@MyBean2(\"\")\n" +
+ "@MyBean(value=\"\")\n" +
+ "public class TestBean2 {}\n" +
+ "public class TestBean3 {}\n" +
+ "@MyBean(\"a\")\n" +
+ "@MyBean2(\"a\")\n" +
+ "public class TestBean4";
+ String s2 = "@MyBean(\"\")\n" +
+ "@MyBean2(\"\")\n" +
+ "public class $a$ {}\n";
+
+ assertEquals("Simple find annotated class",2,findMatchesCount(s1,s2,false));
+ assertEquals("Match value of anonymous name value pair 1", 1, findMatchesCount(s1, "@MyBean(\"a\") class $a$ {}"));
+ assertEquals("Match value of anonymous name value pair 2", 2, findMatchesCount(s1, "@MyBean(\"\") class $a$ {}"));
+
+ String s3 = "@VisualBean(\"????????? ?????????? ? ??\")\n" +
+ "public class TestBean\n" +
+ "{\n" +
+ " @VisualBeanField(\n" +
+ " name = \"??? ????????????\",\n" +
+ " initialValue = \"?????????????\"\n" +
+ " )\n" +
+ " public String user;\n" +
+ "\n" +
+ " @VisualBeanField(\n" +
+ " name = \"??????\",\n" +
+ " initialValue = \"\",\n" +
+ " fieldType = FieldTypeEnum.PASSWORD_FIELD\n" +
+ " )\n" +
+ " public String password;\n" +
+ "\n" +
+ " @VisualBeanField(\n" +
+ " initialValue = \"User\",\n" +
+ " name = \"????? ???????\",\n" +
+ " name = \"Second name\",\n" +
+ " fieldType = FieldTypeEnum.COMBOBOX_FIELD,\n" +
+ " comboValues = {\n" +
+ " @ComboFieldValue(\"Administrator\"),\n" +
+ " @ComboFieldValue(\"User\"),\n" +
+ " @ComboFieldValue(\"Guest\")}\n" +
+ " ) \n" +
+ " public String accessRights;\n" +
+ " \n" +
+ " public String otherField;\n" +
+ "}";
+ String s4 = "class '_a {\n" +
+ " @'_Annotation+ ( 'AnnotationMember*:name = '_AnnotationValue* )\n" +
+ " String '_field* ;\n" +
+ "}";
+ String s4_2 = "class '_a {\n" +
+ " @'_Annotation+ ()\n" +
+ " String 'field* ;\n" +
+ "}";
+
+ assertEquals("Find annotation members of annotated field class",4,findMatchesCount(s3,s4,false));
+ assertEquals("Find annotation fields",3,findMatchesCount(s3,s4_2,false));
+
+ String s5 = "class A {" +
+ " @NotNull private static Collection<PsiElement> resolveElements(final PsiReference reference, final Project project) {}\n" +
+ " @NotNull private static Collection resolveElements2(final PsiReference reference, final Project project) {}\n" +
+ "}";
+ String s6 = "class '_c {@NotNull '_rt 'method* ('_pt* '_p*){ '_inst*; } }";
+ String s6_2 = "class '_c {@'_:NotNull '_rt 'method* ('_pt* '_p*){ '_inst*; } }";
+
+ assertEquals("Find annotated methods",2,findMatchesCount(s5,s6));
+ assertEquals("Find annotated methods, 2",2,findMatchesCount(s5,s6_2));
+
+ String s7 = "class A { void message(@NonNls String msg); }\n" +
+ "class B { void message2(String msg); }\n" +
+ "class C { void message2(String msg); }";
+ String s8 = "class '_A { void 'b( @'_Ann{0,0}:NonNls String '_); }";
+ assertEquals("Find not annotated methods",2,findMatchesCount(s7,s8));
+
+ String s9 = "class A {\n" +
+ " Object[] method1() {}\n" +
+ " Object method1_2() {}\n" +
+ " Object method1_3() {}\n" +
+ " Object method1_4() {}\n" +
+ " @MyAnnotation Object[] method2(int a) {}\n" +
+ " @NonNls Object[] method3() {}\n" +
+ "}";
+ String s10 = "class '_A { @'_Ann{0,0}:NonNls '_Type:Object\\[\\] 'b+( '_pt* '_p* ); }";
+ String s10_2 = "class '_A { @'_Ann{0,0}:NonNls '_Type [] 'b+( '_pt* '_p* ); }";
+ String s10_3 = "class '_A { @'_Ann{0,0}:NonNls '_Type:Object [] 'b+( '_pt* '_p* ); }";
+ assertEquals("Find not annotated methods, 2",2,findMatchesCount(s9,s10));
+ assertEquals("Find not annotated methods, 2",2,findMatchesCount(s9,s10_2));
+ assertEquals("Find not annotated methods, 2",2,findMatchesCount(s9,s10_3));
+
+ String s11 = "class A {\n" +
+ "@Foo(value=baz) int a;\n" +
+ "@Foo(value=baz2) int a2;\n" +
+ "@Foo(value=baz2) int a3;\n" +
+ "@Foo(value2=baz3) int a3;\n" +
+ "@Foo(value2=baz3) int a3;\n" +
+ "@Foo(value2=baz3) int a3;\n" +
+ "@Foo(value2=baz4) int a3;\n" +
+ "}";
+ String s12 = "@Foo(value=baz) int 'a;)";
+ String s12_2 = "@Foo(value='baz:baz2 ) int 'a;)";
+ String s12_3 = "@Foo('value:value2 = baz3 ) int 'a;)";
+ String s12_4 = "@Foo('value:value2 = 'baz3:baz3 ) int 'a;)";
+ String s12_5 = "@Foo('value:value2 = 'baz3:baz ) int 'a;)";
+ String s12_6 = "@Foo('value:value2 = 'baz3 ) int 'a;)";
+ String s12_7 = "@Foo('value:value2 = ) int 'a;";
+
+ assertEquals("Find anno parameter value",1,findMatchesCount(s11,s12));
+ assertEquals("Find anno parameter value",2,findMatchesCount(s11,s12_2));
+ assertEquals("Find anno parameter value",3,findMatchesCount(s11,s12_3));
+ assertEquals("Find anno parameter value",3,findMatchesCount(s11,s12_4));
+ assertEquals("Find anno parameter value",0,findMatchesCount(s11,s12_5));
+ assertEquals("Find anno parameter value",4,findMatchesCount(s11,s12_6));
+ assertEquals("Find anno parameter value",4,findMatchesCount(s11,s12_7));
+ }
+
+ public void testBoxingAndUnboxing() {
+ String s1 = " class A { void b(Integer i); void b2(int i); void c(int d); void c2(Integer d); }\n" +
+ "A a;\n" +
+ "a.b2(1)\n;" +
+ "a.b2(1)\n;" +
+ "a.b(1)\n;" +
+ "a.b( new Integer(0) )\n;" +
+ "a.b( new Integer(0) )\n;" +
+ "a.c(new Integer(2));\n" +
+ "a.c(new Integer(3));\n" +
+ "a.c2(new Integer(3));\n" +
+ "a.c(3);";
+ String s2 = "a.'b('_Params:[formal( Integer ) && exprtype( int ) ])";
+ String s2_2 = "a.c('_Params:[formal( int ) && exprtype( Integer ) ])";
+
+ assertEquals("Find boxing in method call",1,findMatchesCount(s1,s2,false));
+ assertEquals("Find unboxing in method call",2,findMatchesCount(s1,s2_2,false));
+ }
+
+ public void testCommentsInDclSearch() {
+ String s1 = "class A {\n" +
+ " int a; // comment\n" +
+ " char b;\n" +
+ " int c; // comment2\n" +
+ "}";
+ String s1_2 = "class A {\n" +
+ " // comment\n" +
+ " int a;\n" +
+ " char b;\n" +
+ " // comment2\n" +
+ " int c;\n" +
+ "}";
+
+ String s2 = "'_Type '_Variable = '_Value?; //'Comment";
+ String s2_2 = "//'Comment\n" +
+ "'_Type '_Variable = '_Value?;";
+
+ assertEquals("Find field by dcl with comment",2,findMatchesCount(s1,s2));
+ assertEquals("Find field by dcl with comment 2",2,findMatchesCount(s1_2,s2_2));
+ }
+
+ public void testSearchingEmptyModifiers() {
+
+ String s1 = "class A {\n" +
+ " int a;\n" +
+ " private char b;\n" +
+ " private char b2;\n" +
+ " public int c;\n" +
+ " public int c2;\n" +
+ "}";
+ String s2 = "@Modifier(\"packageLocal\") '_Type '_Variable = '_Value?;";
+ String s2_2 = "@Modifier({\"packageLocal\",\"private\"}) '_Type '_Variable = '_Value?;";
+ String s2_3 = "@Modifier({\"PackageLocal\",\"private\"}) '_Type '_Variable = '_Value?;";
+
+ assertEquals("Finding package local dcls",1,findMatchesCount(s1,s2));
+ assertEquals("Finding package local dcls",3,findMatchesCount(s1,s2_2));
+
+ try {
+ findMatchesCount(s1,s2_3);
+ assertTrue("Finding package local dcls",false);
+ } catch(MalformedPatternException ex) {
+
+ }
+
+ String s3 = "class A {\n" +
+ " int a;\n" +
+ " static char b;\n" +
+ " static char b2;\n" +
+ "}";
+ String s4 = "@Modifier(\"Instance\") '_Type '_Variable = '_Value?;";
+ String s4_2 = "@Modifier({\"static\",\"Instance\"}) '_Type '_Variable = '_Value?;";
+ assertEquals("Finding instance fields",1,findMatchesCount(s3,s4));
+ assertEquals("Finding all fields",3,findMatchesCount(s3,s4_2));
+
+ String s5 = "class A {}\n" +
+ "abstract class B {}\n" +
+ "final class C {}\n" +
+ "class D {}";
+ String s6 = "@Modifier(\"Instance\") class 'Type {}";
+ String s6_2 = "@Modifier({\"abstract\",\"final\",\"Instance\"}) class 'Type {}";
+ assertEquals("Finding instance classes",3,findMatchesCount(s5,s6));
+ assertEquals("Finding all classes",4,findMatchesCount(s5,s6_2));
+ }
+
+ public void testSearchTransientFieldsWithModifier() {
+ String source =
+ "public class TestClass {\n" +
+ " transient private String field1;\n" +
+ " transient String field2;\n" +
+ " String field3;\n" +
+ "}";
+
+ String template = "transient @Modifier(\"packageLocal\") '_Type '_Variable = '_Value?;";
+
+ assertEquals("Finding package-local transient fields", 1, findMatchesCount(source, template));
+ }
+
+ public void test() {
+ String s1 = "if (LOG.isDebugEnabled()) {\n" +
+ " int a = 1;\n" +
+ " int a = 1;\n" +
+ "}";
+ String s2 = "if ('_Log.isDebugEnabled()) {\n" +
+ " '_ThenStatement;\n" +
+ " '_ThenStatement;\n" +
+ "}";
+ assertEquals("Comparing declarations",1,findMatchesCount(s1,s2));
+ }
+
+ public void testFindStaticMethodsWithinHierarchy() {
+ String s1 = "class A {}\n" +
+ "class B extends A { static void foo(); }\n" +
+ "class B2 extends A { static void foo(int a); }\n" +
+ "class B3 extends A { static void foo(int a, int b); }\n" +
+ "class C { static void foo(); }\n" +
+ "B.foo();\n" +
+ "B2.foo(1);\n" +
+ "B3.foo(2,3);\n" +
+ "C.foo();";
+ String s2 = "'_Instance:[regex( *A )].'_Method:[regex( foo )] ( '_Params* )";
+ assertEquals("Find static methods within expr type hierarchy", 3, findMatchesCount(s1,s2));
+ }
+
+ public void testFindClassesWithinHierarchy() {
+ String s1 = "class A implements I {}\n" +
+ "interface I {}\n" +
+ "class B extends A implements I { }\n" +
+ "class B2 implements I { }\n" +
+ "class B3 extends A { }\n" +
+ "class C extends B2 { static void foo(); }\n";
+ String s2 = "class '_ extends '_Extends:[!regex( *A )] implements '_Implements:[regex( I )] {}";
+ String s2_2 = "class '_ extends '_Extends:[!regex( *A )]{}";
+ assertEquals("Find class within type hierarchy with not", 1, findMatchesCount(s1,s2));
+ assertEquals("Find class within type hierarchy with not, 2", 1, findMatchesCount(s1,s2_2));
+ }
+
+ public void testFindTryWithoutProperFinally() {
+ String s1 = "try {\n" +
+ " conn = 1;\n" +
+ "} finally {\n" +
+ " conn.close();\n" +
+ "}\n" +
+ "try {\n" +
+ " conn = 1;\n" +
+ "} finally {\n" +
+ " int a = 1;\n" +
+ "}\n" +
+ "try {\n" +
+ " conn = 1;\n" +
+ "} finally {\n" +
+ " int a = 1;\n" +
+ "}";
+ String s2 = "try { '_StatementBefore*; '_Dcl:[regex( conn = 1 )]; '_StatementAfter*; } finally { '_Finally*:[!regex( .*conn.* ) ]; }";
+ assertEquals("FindTryWithoutProperFinally", 2, findMatchesCount(s1,s2));
+ }
+
+ public void testBug() {
+ String s1 = "public class DiallingNumber extends DataGroup\n" + "{\n" + " protected static byte [] CLEAR = { };\n" + "\n" +
+ " private static DataItemTemplate template;\n" + "\n" + "\tprotected DataTemplate createDefaultTemplate()\n" + "\t{\n" +
+ " return null;\n" + " }\n" + "}";
+ String s2 = "class '_Class {\n" + " static '_FieldType '_FieldName:.*template.* = '_FieldInitial?;\n" +
+ " '_RetType createDefaultTemplate() { '_Statements*; }\n" + "\t'_Content*\n" + "}";
+ assertEquals("Bug in class matching", 1, findMatchesCount(s1,s2));
+ }
+
+ //public void testFindFieldUsageByQName() {
+ // String s1 = "{ class A { int b; { b = 1; } } class B extends A { { this.b = 2} } { B i; i.b = 3; } }";
+ // String s2 = "A.b";
+ // assertEquals( 3, findMatchesCount(s1,s2));
+ //}
+ //
+ //public void testFindMethodUsageByQName() {
+ // String s1 = "{ class A { void b(int a) {} { b(1); } } class B extends A { { this.b(2); } } { B i; i.b(3); } }";
+ // String s2 = "A.b";
+ // assertEquals( 3, findMatchesCount(s1,s2));
+ //}
+
+ public void _testStaticInstanceInitializers() {
+ String s1 = "public class DiallingNumber {\n static { int a = 1; } static { int b = 1; } { int c = 2; }}";
+ String s2 = "class '_Class {\n" + " static { 't*; } }";
+ String s2_2 = "class '_Class {\n" + " { 't*; } }";
+ String s2_3 = "class '_Class {\n" + " @Modifier(\"Instance\") { 't*; } }";
+ assertEquals("Static / instance initializers", 2, findMatchesCount(s1,s2));
+ assertEquals("Static / instance initializers", 1, findMatchesCount(s1,s2_3));
+ assertEquals("Static / instance initializers", 3, findMatchesCount(s1,s2_2));
+ }
+
+ @NotNull
+ @Override
+ protected String getTestDataPath() {
+ return PlatformTestUtil.getCommunityPath() + "/platform/structuralsearch/testData/java/";
+ }
+
+ public void testDoNotFindReturn() throws IOException {
+ String s1 = loadFile(getTestName(false) + ".java");
+ String s2 = "ApplicationManager.getApplication().runReadAction(new Runnable() {\n" +
+ " public void run() {\n" +
+ " 't*:[ !regex( .*return.* ) ];\n" +
+ " }});";
+ assertEquals(0, findMatchesCount(s1,s2));
+ }
+
+ public void testDownUpMatch() {
+ String s1 = "class A {\n" +
+ " int bbb(int c, int ddd, int eee) {\n" +
+ " int a = 1;\n" +
+ " try { int b = 1; } catch(Type t) { a = 2; } catch(Type2 t2) { a = 3; }\n" +
+ " }\n" +
+ "}";
+ String s2 = "try { '_st*; } catch('_Type 't+) { '_st2*; }";
+
+ final List<PsiVariable> vars = new ArrayList<PsiVariable>();
+ final PsiFile file = PsiFileFactory.getInstance(getProject()).createFileFromText("_.java", s1);
+
+ file.acceptChildren(new JavaRecursiveElementWalkingVisitor() {
+ @Override public void visitVariable(final PsiVariable variable) {
+ super.visitVariable(variable);
+ vars.add(variable);
+ }
+ });
+
+ assertEquals(7, vars.size());
+ List<MatchResult> results = new ArrayList<MatchResult>();
+
+ Matcher testMatcher = new Matcher(getProject());
+ MatchOptions options = new MatchOptions();
+ options.setSearchPattern(s2);
+ MatcherImplUtil.transform(options);
+ options.setFileType(StdFileTypes.JAVA);
+
+ for(PsiVariable var:vars) {
+ final MatchResult matchResult = testMatcher.isMatchedByDownUp(var, options);
+ if (matchResult != null) results.add(matchResult);
+ assertTrue(
+ (var instanceof PsiParameter && var.getParent() instanceof PsiCatchSection && matchResult != null) ||
+ matchResult == null
+ );
+ }
+
+ assertEquals(2, results.size());
+ MatchResult result = results.get(0);
+ assertEquals("t", result.getMatchImage());
+
+ result = results.get(1);
+ assertEquals("t2", result.getMatchImage());
+
+ results.clear();
+ String s2_2 = "try { '_st*; } catch('Type:Type2 '_t) { '_st2*; }";
+
+ options.clearVariableConstraints();
+ options.setSearchPattern(s2_2);
+ MatcherImplUtil.transform(options);
+
+ for(PsiVariable var:vars) {
+ final PsiTypeElement typeElement = var.getTypeElement();
+ final MatchResult matchResult = testMatcher.isMatchedByDownUp(typeElement, options);
+ if (matchResult != null) results.add(matchResult);
+ assertTrue(
+ (var instanceof PsiParameter && var.getParent() instanceof PsiCatchSection && matchResult != null) ||
+ matchResult == null
+ );
+ }
+
+ assertEquals(1, results.size());
+
+ result = results.get(0);
+ assertEquals("Type2", result.getMatchImage());
+ }
+
+ @Bombed(day = 28, description = "support it", month = Calendar.JULY, user = "maxim.mossienko")
+ public void _testContainsPredicate() {
+ String s1 = "{{\n" +
+ " int a;\n" +
+ " a = 1;\n" +
+ "}\n" +
+ "{\n" +
+ " int b = 1;\n" +
+ " b = 1;\n" +
+ "}\n" +
+ "{\n" +
+ " int c = 2;\n" +
+ " c = 2;\n" +
+ "}}";
+ String s2 = "{\n" +
+ " '_a*:[contains( \"'type $a$ = $b$;\" )];\n" +
+ "}";
+
+ String s2_2 = "{\n" +
+ " '_a*:[!contains( \"$type$ $a$ = $b$;\" )];\n" +
+ "}";
+
+ assertEquals(2, findMatchesCount(s1, s2));
+ assertEquals(1, findMatchesCount(s1, s2_2));
+ }
+
+ public void testWithinPredicate() {
+ String s1 = "if (true) {\n" +
+ " int a = 1;\n" +
+ "}\n" +
+ "if (true) {\n" +
+ " int b = 1;\n" +
+ "}\n" +
+ "while(true) {\n" +
+ " int c = 2;\n" +
+ "}";
+ String s2 = "'_type 'a:[within( \"if ('_a) { '_st*; }\" )] = '_b;";
+ String s2_2 = "'_type 'a:[!within( \"if ('_a) { '_st*; }\" )] = '_b;";
+
+ assertEquals(2,findMatchesCount(s1, s2));
+ assertEquals(1,findMatchesCount(s1, s2_2));
+
+ // TODO: xxx
+ //String s3 = "if (true) {\n" +
+ // " if (true) return;\n" +
+ // " int a = 1;\n" +
+ // "}\n else if (true) {\n" +
+ // " return;\n" +
+ // "}";
+ //assertEquals(2,findMatchesCount(s3, s2));
+ //assertEquals(1,findMatchesCount(s3, s2_2));
+ }
+
+ public void testWithinPredicate2() {
+ String s3 = "class C {\n" +
+ " void aaa() {\n" +
+ " LOG.debug(true);\n" +
+ " LOG.debug(true);\n" +
+ " LOG.debug(true);\n" +
+ " LOG.debug(true);\n" +
+ " LOG.debug(true);\n" +
+ " if (true) {\n" +
+ " LOG.debug(true);\n" +
+ " }\n" +
+ " if (true) LOG.debug(true);\n" +
+ " if (true) { int 1 = 1; } else { LOG.debug(true); }\n" +
+ " }" +
+ "}";
+ String s4 = "LOG.debug('_params*:[!within( \"if('_a) { 'st*; }\" )]);";
+
+ assertEquals(6,findMatchesCount(s3, s4));
+ }
+
+ public void testMultiStatementPatternWithTypedVariable() throws Exception {
+ String s = "Integer i;\ni.valueOf();";
+ String s_2 = "Integer i;\nint a = 1;\ni.valueOf();";
+ String s2 = "Integer '_i;\n'_i.valueOf();";
+ String s2_2 = "Integer '_i;\n'_st; '_i.valueOf();";
+ String s2_3 = "Integer '_i;\n'_st*; '_i.valueOf();";
+
+ assertEquals(1, findMatchesCount(s,s2));
+ assertEquals(1, findMatchesCount(s_2,s2_2));
+ assertEquals(1, findMatchesCount(s_2,s2_3));
+ assertEquals(1, findMatchesCount(s,s2_3));
+ }
+
+ public void testFindAnnotationDeclarations() throws Exception {
+ String s = "interface Foo {} interface Bar {} @interface X {}";
+ String s2 = "@interface 'x {}";
+
+ assertEquals(1, findMatchesCount(s,s2));
+ }
+
+ public void testFindEnums() throws Exception {
+ String s = "class Foo {} class Bar {} enum X {}";
+ String s2 = "enum 'x {}";
+
+ assertEquals(1, findMatchesCount(s,s2));
+ }
+
+ public void testFindDeclaration() throws Exception {
+ String s = "public class F {\n" +
+ " static Category cat = Category.getInstance(F.class.getName());\n" +
+ " Category cat2 = Category.getInstance(F.class.getName());\n" +
+ " Category cat3 = Category.getInstance(F.class.getName());\n" +
+ "}";
+ String s2 = "static $Category$ $cat$ = $Category$.getInstance($Arg$);";
+
+ assertEquals(1, findMatchesCount(s,s2));
+ }
+
+ public void testFindMethodCallWithTwoOrThreeParameters() {
+ String source = "{ String.format(\"\"); String.format(\"\", 1); String.format(\"\", 1, 2); String.format(\"\", 1, 2, 3); }";
+ String pattern = "'_Instance.'_MethodCall('_Parameter{2,3})";
+
+ assertEquals(2, findMatchesCount(source, pattern));
+ }
+
+ public void testFindMethodWithCountedExceptionsInThrows() {
+ String source = "class A {" +
+ " void a() {}" +
+ " void b() throws E1 {}" +
+ " void c() throws E1, E2{}" +
+ " void d() throws E1, E2, E3 {}" +
+ "}";
+
+ String pattern1 = "class '_A {" +
+ " '_type+ 'method+ () throws '_E{0,0}" +
+ "}";
+ assertEquals(1, findMatchesCount(source, pattern1));
+
+ String pattern2 = "class '_A {" +
+ " '_type+ 'method+ () throws '_E{1,2}" +
+ "}";
+ assertEquals(2, findMatchesCount(source, pattern2));
+
+ String pattern3 = "class '_A {" +
+ " '_type+ 'method+ () throws '_E{2,2}" +
+ "}";
+ assertEquals(1, findMatchesCount(source, pattern3));
+
+ String pattern4 = "class '_A {" +
+ " '_type+ 'method+ () throws '_E{0,0}:[ regex( E2 )]" +
+ "}";
+ assertEquals(2, findMatchesCount(source, pattern4));
+ }
+
+ public void testFindMethodsCalledWithinClass() {
+ String source = "class A {" +
+ " void a() {}" +
+ " static void b() {}" +
+ " void c() {" +
+ " a();" +
+ " b();" +
+ " }" +
+ "}" +
+ "class B extends A {" +
+ " void d() {" +
+ " a();" +
+ " b();" +
+ " }" +
+ "}";
+ String pattern1 = "this.a()";
+ assertEquals(2, findMatchesCount(source, pattern1));
+ }
+
+ public void testFindReferenceWithParentheses() {
+ String source = "class A {" +
+ " String value;" +
+ " A(String v) {" +
+ " value = (value);" +
+ " System.out.println(((2)));" +
+ " System.out.println(2);" +
+ " }" +
+ "}";
+
+ String pattern1 = "'_value='_value";
+ assertEquals(1, findMatchesCount(source, pattern1));
+
+ String pattern2 = "System.out.println('_v);" +
+ "System.out.println('_v);";
+ assertEquals(1, findMatchesCount(source, pattern2));
+ }
+
+ public void testFindSelfAssignment() {
+ String source = "class A {" +
+ " protected String s;" +
+ " A(String t) {" +
+ " this.s = s;" +
+ " t = t;" +
+ " s = this.s;" +
+ " }" +
+ //"}" +
+ //"class B {" +
+ //" B(String t) {" +
+ //" super.s = s;" + // would be nice if found also
+ //" }" +
+ "}";
+
+ String pattern = "'_var='_var";
+ assertEquals(3, findMatchesCount(source, pattern));
+ }
+
+ public void testFindLambdas() {
+ String source = "public interface IntFunction<R> {" +
+ " R apply(int value);" +
+ "}" +
+ "public interface Function<T, R> {" +
+ " R apply(T t);" +
+ "}" +
+ "class A {" +
+ " void m() {" +
+ " Runnable q = () -> { /*comment*/ };" +
+ " Runnable r = () -> { System.out.println(); };" +
+ " IntFunction<String> f = a -> \"hello\";" +
+ " Function<String, String> g = a -> \"world\";" +
+ " }" +
+ "}";
+
+ String pattern1 = "() ->";
+ assertEquals("should find lamdas", 4, findMatchesCount(source, pattern1));
+
+ String pattern2 = "(int '_a) -> {}";
+ assertEquals("should find lambdas with specific parameter type", 1, findMatchesCount(source, pattern2));
+
+ String pattern3 = "('_a{0,0})->{}";
+ assertEquals("should find lambdas without any parameters", 2, findMatchesCount(source, pattern3));
+
+ String pattern4 = "()->System.out.println()";
+ assertEquals("should find lambdas with matching body", 1, findMatchesCount(source, pattern4));
+
+ String pattern5 = "()->{/*comment*/}";
+ assertEquals("should find lambdas with comment body", 1, findMatchesCount(source, pattern5));
+ }
+
+ public void testFindDefaultMethods() {
+ String source = "interface XYZ {" +
+ " default void m() {" +
+ " System.out.println();" +
+ " }" +
+ " void f();" +
+ " void g();" +
+ "}" +
+ "interface ABC {" +
+ " void m();" +
+ "}";
+
+ String pattern1 = "interface '_Class { default '_ReturnType+ 'MethodName+('_ParameterType* '_Parameter*);}";
+ assertEquals("should find default method", 1, findMatchesCount(source, pattern1));
+
+ String pattern2 = "interface 'Class { default '_ReturnType+ '_MethodName{0,0}('_ParameterType* '_Parameter*);}";
+ assertEquals("should find interface without default methods", 1, findMatchesCount(source, pattern2));
+ }
+
+ public void testFindMethodReferences() {
+ String source = "class A {" +
+ " Runnable r = System.out::println;" +
+ " Runnable s = this::hashCode;" +
+ " Runnable t = this::new;" +
+ " static {" +
+ " System.out.println();" +
+ " }" +
+ "}";
+
+ String pattern1 = "System . out :: println";
+ assertEquals("should find method reference", 1, findMatchesCount(source, pattern1));
+
+ String pattern2 = "this::'_a";
+ assertEquals("should find method reference 2", 2, findMatchesCount(source, pattern2));
+
+ String pattern3 = "'_a::'_b";
+ assertEquals("should find all method references", 3, findMatchesCount(source, pattern3));
+ }
+}
diff --git a/plugins/structuralsearch/testSource/com/intellij/structuralsearch/StructuralSearchTestCase.java b/platform/structuralsearch/testSource/com/intellij/structuralsearch/StructuralSearchTestCase.java
index 6b8aceaba590..6b8aceaba590 100644
--- a/plugins/structuralsearch/testSource/com/intellij/structuralsearch/StructuralSearchTestCase.java
+++ b/platform/structuralsearch/testSource/com/intellij/structuralsearch/StructuralSearchTestCase.java
diff --git a/plugins/structuralsearch/testSource/com/intellij/structuralsearch/impl/matcher/compiler/StringToConstraintsTransformerTest.java b/platform/structuralsearch/testSource/com/intellij/structuralsearch/impl/matcher/compiler/StringToConstraintsTransformerTest.java
index dc1cbc5802f2..dc1cbc5802f2 100644
--- a/plugins/structuralsearch/testSource/com/intellij/structuralsearch/impl/matcher/compiler/StringToConstraintsTransformerTest.java
+++ b/platform/structuralsearch/testSource/com/intellij/structuralsearch/impl/matcher/compiler/StringToConstraintsTransformerTest.java
diff --git a/platform/testFramework/src/com/intellij/GroupBasedTestClassFilter.java b/platform/testFramework/src/com/intellij/GroupBasedTestClassFilter.java
index b3811750841d..3fa50dec3032 100644
--- a/platform/testFramework/src/com/intellij/GroupBasedTestClassFilter.java
+++ b/platform/testFramework/src/com/intellij/GroupBasedTestClassFilter.java
@@ -15,7 +15,7 @@
*/
package com.intellij;
-import com.intellij.openapi.util.text.StringUtil;
+import org.jetbrains.annotations.NotNull;
import java.io.BufferedReader;
import java.io.IOException;
@@ -39,7 +39,7 @@ import java.util.regex.Pattern;
* {@link PatternListTestClassFilter#PatternListTestClassFilter(List) PatternListTestClassFilter};
* </li>
* <li>
- * Read class name filters (at regexp format) from the given stream - see {@link #createOn(Reader, String)};
+ * Read class name filters (at regexp format) from the given stream - see {@link #createOn(java.io.Reader, java.util.List)};
* </li>
* </ul>
*/
@@ -54,18 +54,18 @@ public class GroupBasedTestClassFilter extends TestClassesFilter {
private final Map<String, List<Pattern>> myPatterns = new HashMap<String, List<Pattern>>();
private final List<Pattern> myAllPatterns = new ArrayList<Pattern>();
private final List<Pattern> myTestGroupPatterns;
- private boolean myAllExcludeDefinedGroup;
+ private boolean myContainsAllExcludeDefinedGroup;
- private GroupBasedTestClassFilter(Map<String, List<String>> filters, String testGroupName) {
+ private GroupBasedTestClassFilter(Map<String, List<String>> filters, List<String> testGroupNames) {
//empty group means all patterns from each defined group should be excluded
- myAllExcludeDefinedGroup = isAllExcludeDefinedGroup(testGroupName);
+ myContainsAllExcludeDefinedGroup = containsAllExcludeDefinedGroup(testGroupNames);
for (String groupName : filters.keySet()) {
List<String> filterList = filters.get(groupName);
addPatterns(groupName, filterList);
}
- myTestGroupPatterns = collectPatternsFor(testGroupName);
+ myTestGroupPatterns = collectPatternsFor(testGroupNames);
}
private void addPatterns(String groupName, List<String> filterList) {
@@ -114,11 +114,12 @@ public class GroupBasedTestClassFilter extends TestClassesFilter {
*
*
* @param reader reader that points to the target test groups config
- * @param testGroupName
+ * @param testGroupNames
* @return newly created {@link GroupBasedTestClassFilter} object with the data contained at the given reader
* @see #matches(String)
*/
- public static TestClassesFilter createOn(Reader reader, String testGroupName) throws IOException {
+ @NotNull
+ public static TestClassesFilter createOn(@NotNull Reader reader, @NotNull List<String> testGroupNames) throws IOException {
Map<String, List<String>> groupNameToPatternsMap = new HashMap<String, List<String>>();
String currentGroupName = "";
@@ -137,7 +138,7 @@ public class GroupBasedTestClassFilter extends TestClassesFilter {
}
}
- return new GroupBasedTestClassFilter(groupNameToPatternsMap, testGroupName);
+ return new GroupBasedTestClassFilter(groupNameToPatternsMap, testGroupNames);
}
/**
@@ -157,28 +158,26 @@ public class GroupBasedTestClassFilter extends TestClassesFilter {
*/
@Override
public boolean matches(String className) {
- boolean result = matchesAnyPattern(myTestGroupPatterns, className);
- if (myAllExcludeDefinedGroup) {
- return !result;
+ if (matchesAnyPattern(myTestGroupPatterns, className)) {
+ return true;
}
- else {
- return result;
+ if (myContainsAllExcludeDefinedGroup && !matchesAnyPattern(myAllPatterns, className)) {
+ return true;
}
+ return false;
}
- private static boolean isAllExcludeDefinedGroup(String groupName) {
- return StringUtil.isEmpty(groupName) || ALL_EXCLUDE_DEFINED.equalsIgnoreCase(groupName.trim());
+ private static boolean containsAllExcludeDefinedGroup(List<String> groupNames) {
+ return groupNames.isEmpty() || groupNames.contains(ALL_EXCLUDE_DEFINED);
}
- private List<Pattern> collectPatternsFor(String groupName) {
- if (isAllExcludeDefinedGroup(groupName)) {
- return myAllPatterns;
- }
- else if (myPatterns.containsKey(groupName)) {
- return myPatterns.get(groupName);
- }
- else {
- return Collections.emptyList();
+ private List<Pattern> collectPatternsFor(List<String> groupNames) {
+ List<Pattern> patterns = new ArrayList<Pattern>();
+ for (String groupName : groupNames) {
+ if (myPatterns.containsKey(groupName)) {
+ patterns.addAll(myPatterns.get(groupName));
+ }
}
+ return patterns;
}
}
diff --git a/platform/testFramework/src/com/intellij/TestCaseLoader.java b/platform/testFramework/src/com/intellij/TestCaseLoader.java
index a81a2d2a1370..5d11e48548b8 100644
--- a/platform/testFramework/src/com/intellij/TestCaseLoader.java
+++ b/platform/testFramework/src/com/intellij/TestCaseLoader.java
@@ -66,11 +66,11 @@ public class TestCaseLoader {
if (excludedStream != null) {
TestClassesFilter filter;
try {
- String testGroupName = System.getProperty(TARGET_TEST_GROUP, "").trim();
+ List<String> testGroupNames = StringUtil.split(System.getProperty(TARGET_TEST_GROUP, "").trim(), ";");
InputStreamReader reader = new InputStreamReader(excludedStream.openStream());
try {
- filter = GroupBasedTestClassFilter.createOn(reader, testGroupName);
- System.out.println("Using test group: [" + testGroupName +"]");
+ filter = GroupBasedTestClassFilter.createOn(reader, testGroupNames);
+ System.out.println("Using test groups: " + testGroupNames);
}
finally {
reader.close();
diff --git a/platform/testFramework/src/com/intellij/openapi/application/ex/PathManagerEx.java b/platform/testFramework/src/com/intellij/openapi/application/ex/PathManagerEx.java
index 4844851b81e2..4616c4f86c08 100644
--- a/platform/testFramework/src/com/intellij/openapi/application/ex/PathManagerEx.java
+++ b/platform/testFramework/src/com/intellij/openapi/application/ex/PathManagerEx.java
@@ -424,7 +424,7 @@ public class PathManagerEx {
* @return project type implied by its file system location
*/
private static FileSystemLocation parseProjectLocation() {
- return new File(PathManager.getHomePath(), "community").isDirectory() ? FileSystemLocation.ULTIMATE : FileSystemLocation.COMMUNITY;
+ return new File(PathManager.getHomePath(), "community/.idea").isDirectory() ? FileSystemLocation.ULTIMATE : FileSystemLocation.COMMUNITY;
}
/**
diff --git a/platform/testFramework/src/com/intellij/testFramework/EditorTestUtil.java b/platform/testFramework/src/com/intellij/testFramework/EditorTestUtil.java
index d42e639438c2..870d6d53b998 100644
--- a/platform/testFramework/src/com/intellij/testFramework/EditorTestUtil.java
+++ b/platform/testFramework/src/com/intellij/testFramework/EditorTestUtil.java
@@ -208,7 +208,7 @@ public class EditorTestUtil {
return visibleWidth;
}
});
- applianceManager.setRepresentationHelper(new DefaultEditorTextRepresentationHelper(editor) {
+ model.setEditorTextRepresentationHelper(new DefaultEditorTextRepresentationHelper(editor) {
@Override
public int charWidth(char c, int fontType) {
return charWidthInPixels;
diff --git a/platform/testFramework/src/com/intellij/testFramework/FileEditorManagerTestCase.java b/platform/testFramework/src/com/intellij/testFramework/FileEditorManagerTestCase.java
index 77b93ac6f88f..e3f0d0788cfb 100644
--- a/platform/testFramework/src/com/intellij/testFramework/FileEditorManagerTestCase.java
+++ b/platform/testFramework/src/com/intellij/testFramework/FileEditorManagerTestCase.java
@@ -54,6 +54,7 @@ public abstract class FileEditorManagerTestCase extends LightPlatformCodeInsight
super.setUp();
myManager = new FileEditorManagerImpl(getProject(), DockManager.getInstance(getProject()), EditorHistoryManager.getInstance(getProject()));
myOldManager = ((ComponentManagerImpl)getProject()).registerComponentInstance(FileEditorManager.class, myManager);
+ ((FileEditorProviderManagerImpl)FileEditorProviderManager.getInstance()).clearSelectedProviders();
}
@Override
diff --git a/platform/testFramework/src/com/intellij/testFramework/LightPlatformCodeInsightTestCase.java b/platform/testFramework/src/com/intellij/testFramework/LightPlatformCodeInsightTestCase.java
index 90c2ca11b49a..24e4074ed4ee 100644
--- a/platform/testFramework/src/com/intellij/testFramework/LightPlatformCodeInsightTestCase.java
+++ b/platform/testFramework/src/com/intellij/testFramework/LightPlatformCodeInsightTestCase.java
@@ -15,7 +15,7 @@
*/
package com.intellij.testFramework;
-import com.intellij.codeInsight.generation.CommentByLineCommentHandler;
+import com.intellij.codeInsight.generation.actions.CommentByLineCommentAction;
import com.intellij.ide.DataManager;
import com.intellij.injected.editor.DocumentWindow;
import com.intellij.injected.editor.EditorWindow;
@@ -501,7 +501,7 @@ public abstract class LightPlatformCodeInsightTestCase extends LightPlatformTest
}
protected static void lineComment() {
- new CommentByLineCommentHandler().invoke(getProject(), getEditor(), getFile());
+ new CommentByLineCommentAction().actionPerformedImpl(getProject(), getEditor());
}
protected static void executeAction(@NonNls @NotNull final String actionId) {
diff --git a/platform/testFramework/src/com/intellij/testFramework/PlatformTestUtil.java b/platform/testFramework/src/com/intellij/testFramework/PlatformTestUtil.java
index 37fd23da6741..0c46f14b98e0 100644
--- a/platform/testFramework/src/com/intellij/testFramework/PlatformTestUtil.java
+++ b/platform/testFramework/src/com/intellij/testFramework/PlatformTestUtil.java
@@ -762,7 +762,7 @@ public class PlatformTestUtil {
public static String getCommunityPath() {
final String homePath = PathManager.getHomePath();
- if (new File(homePath, "community").exists()) {
+ if (new File(homePath, "community/.idea").isDirectory()) {
return homePath + File.separatorChar + "community";
}
return homePath;
diff --git a/platform/testFramework/src/com/intellij/testFramework/TestDataProvider.java b/platform/testFramework/src/com/intellij/testFramework/TestDataProvider.java
index b5f84d33c6c4..cc8376832e36 100644
--- a/platform/testFramework/src/com/intellij/testFramework/TestDataProvider.java
+++ b/platform/testFramework/src/com/intellij/testFramework/TestDataProvider.java
@@ -17,11 +17,13 @@ package com.intellij.testFramework;
import com.intellij.openapi.actionSystem.CommonDataKeys;
import com.intellij.openapi.actionSystem.DataProvider;
+import com.intellij.openapi.actionSystem.PlatformDataKeys;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.impl.EditorComponentImpl;
import com.intellij.openapi.fileEditor.FileEditorManager;
import com.intellij.openapi.fileEditor.OpenFileDescriptor;
import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx;
+import com.intellij.openapi.fileEditor.impl.text.TextEditorProvider;
import com.intellij.openapi.project.Project;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
@@ -51,6 +53,10 @@ public class TestDataProvider implements DataProvider {
else if (CommonDataKeys.EDITOR.is(dataId) || OpenFileDescriptor.NAVIGATE_IN_EDITOR.is(dataId)) {
return FileEditorManager.getInstance(myProject).getSelectedTextEditor();
}
+ else if (PlatformDataKeys.FILE_EDITOR.is(dataId)) {
+ Editor editor = FileEditorManager.getInstance(myProject).getSelectedTextEditor();
+ return editor == null ? null : TextEditorProvider.getInstance().getTextEditor(editor);
+ }
else {
Editor editor = (Editor)getData(CommonDataKeys.EDITOR.getName());
if (editor != null) {
diff --git a/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java b/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java
index ce58f3071581..4857acd2d328 100644
--- a/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java
+++ b/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java
@@ -1061,19 +1061,19 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig
final CaretModel caretModel = myEditor.getCaretModel();
final List<Caret> carets = caretModel.getAllCarets();
- final Collection<Integer> originalOffsets = new ArrayList<Integer>(carets.size());
+ final List<Integer> originalOffsets = new ArrayList<Integer>(carets.size());
for (final Caret caret : carets) {
originalOffsets.add(caret.getOffset());
}
caretModel.removeSecondaryCarets();
- int newOffset = 0; // To be incremented each time we complete something
+ // We do it in reverse order because completions would affect offsets
+ // i.e.: when you complete "spa" to "spam", next caret offset increased by 1
+ Collections.reverse(originalOffsets);
for (final int originalOffset : originalOffsets) {
- final int realOffsetBeforeCompletion = originalOffset + newOffset;
- caretModel.moveToOffset(realOffsetBeforeCompletion);
+ caretModel.moveToOffset(originalOffset);
completeBasic();
- newOffset += (getCaretOffset() - realOffsetBeforeCompletion);
}
}
diff --git a/platform/testRunner/src/com/intellij/execution/testframework/TestsUIUtil.java b/platform/testRunner/src/com/intellij/execution/testframework/TestsUIUtil.java
index 01a6921a8949..836635a58b0e 100644
--- a/platform/testRunner/src/com/intellij/execution/testframework/TestsUIUtil.java
+++ b/platform/testRunner/src/com/intellij/execution/testframework/TestsUIUtil.java
@@ -21,7 +21,6 @@ import com.intellij.execution.configurations.RunConfiguration;
import com.intellij.notification.NotificationGroup;
import com.intellij.openapi.actionSystem.CommonDataKeys;
import com.intellij.openapi.actionSystem.DataContext;
-import com.intellij.openapi.actionSystem.LangDataKeys;
import com.intellij.openapi.actionSystem.PlatformDataKeys;
import com.intellij.openapi.fileEditor.OpenFileDescriptor;
import com.intellij.openapi.project.Project;
@@ -234,7 +233,7 @@ public class TestsUIUtil {
else if (notStartedCount > 0) {
myTitle = !notStarted.isEmpty() ? ExecutionBundle.message("junit.runing.info.failed.to.start.error.message") : "Tests Ignored";
myText = passedCount + " passed, " + notStartedCount + (!notStarted.isEmpty() ? " not started" : " ignored");
- myType = MessageType.ERROR;
+ myType = notStarted.isEmpty() ? MessageType.WARNING : MessageType.ERROR;
}
else {
myTitle = ExecutionBundle.message("junit.runing.info.tests.passed.label");
diff --git a/platform/util-rt/src/com/intellij/execution/rmi/RemoteServer.java b/platform/util-rt/src/com/intellij/execution/rmi/RemoteServer.java
index 46e7b25a6be8..908f40a37295 100644
--- a/platform/util-rt/src/com/intellij/execution/rmi/RemoteServer.java
+++ b/platform/util-rt/src/com/intellij/execution/rmi/RemoteServer.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2012 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -16,11 +16,15 @@
package com.intellij.execution.rmi;
import com.intellij.execution.rmi.ssl.SslSocketFactory;
+import com.intellij.openapi.util.io.FileUtilRt;
+import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.naming.Context;
import javax.naming.NamingException;
import javax.naming.spi.InitialContextFactory;
+import java.io.*;
+import java.lang.reflect.Field;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
@@ -39,6 +43,8 @@ public class RemoteServer {
System.setProperty("apple.awt.UIElement", "true");
}
+ public static final String DOMAIN_AUTH_LIBRARY_PATH = "domain.auth.library";
+
private static Remote ourRemote;
@SuppressWarnings("UseOfSystemOutOrSystemErr")
@@ -46,6 +52,7 @@ public class RemoteServer {
setupRMI();
banJNDI();
setupSSL();
+ setupDomainAuth();
if (ourRemote != null) throw new AssertionError("Already started");
ourRemote = remote;
@@ -104,7 +111,7 @@ public class RemoteServer {
}
}
- public static void setupSSL() {
+ private static void setupSSL() {
boolean caCert = System.getProperty(SslSocketFactory.SSL_CA_CERT_PATH) != null;
boolean clientCert = System.getProperty(SslSocketFactory.SSL_CLIENT_CERT_PATH) != null;
boolean clientKey = System.getProperty(SslSocketFactory.SSL_CLIENT_KEY_PATH) != null;
@@ -113,18 +120,71 @@ public class RemoteServer {
}
}
+ private static void setupDomainAuth() {
+ String property = System.getProperty(DOMAIN_AUTH_LIBRARY_PATH);
+ if (property != null) {
+ try {
+ File extracted = extractLibraryFromJar(property);
+ setLibraryPath(extracted.getParentFile().getAbsolutePath());
+ }
+ catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+
@SuppressWarnings("UnusedDeclaration")
public static class Jndi implements InitialContextFactory, InvocationHandler {
+ @NotNull
public Context getInitialContext(final Hashtable<?, ?> environment) throws NamingException {
return (Context)Proxy.newProxyInstance(getClass().getClassLoader(), new Class[]{Context.class}, this);
}
@Nullable
- public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable {
+ public Object invoke(final Object proxy, @NotNull final Method method, final Object[] args) throws Throwable {
if (Object.class.equals(method.getDeclaringClass())) {
return method.invoke(this, args);
}
throw new NamingException("JNDI service is disabled");
}
}
+
+ @NotNull
+ public static File extractLibraryFromJar(@NotNull String path) throws Exception {
+ if (!path.startsWith("/")) throw new IllegalArgumentException("The path to be absolute (start with '/').");
+
+ String[] parts = path.split("/");
+ String filename = parts.length > 1 ? parts[parts.length - 1] : null;
+
+ if (filename == null) throw new IllegalArgumentException("The filename extracted from the path: '" + path + "' is null");
+
+ File auth = FileUtilRt.createTempDirectory("win_auth", null, true);
+ File temp = new File(auth, filename);
+ temp.deleteOnExit();
+ if (!temp.createNewFile() || !temp.exists()) throw new FileNotFoundException("File " + temp.getAbsolutePath() + " does not exist.");
+
+ byte[] buffer = new byte[5 * 1024];
+ int readBytes;
+
+ //noinspection IOResourceOpenedButNotSafelyClosed
+ InputStream is = RemoteServer.class.getResourceAsStream(path);
+ if (is == null) throw new FileNotFoundException("File " + path + " was not found inside JAR.");
+
+ OutputStream os = new FileOutputStream(temp);
+ try {
+ while ((readBytes = is.read(buffer)) != -1) os.write(buffer, 0, readBytes);
+ }
+ finally {
+ os.close();
+ is.close();
+ }
+ return temp;
+ }
+
+ private static void setLibraryPath(@NotNull String path) throws NoSuchFieldException, IllegalAccessException {
+ System.setProperty("java.library.path", path);
+ Field fieldSysPath = ClassLoader.class.getDeclaredField("sys_paths");
+ fieldSysPath.setAccessible(true);
+ fieldSysPath.set(null, null);
+ }
}
diff --git a/platform/util-rt/src/com/intellij/execution/rmi/ssl/SslSocketFactory.java b/platform/util-rt/src/com/intellij/execution/rmi/ssl/SslSocketFactory.java
index 3ce4efe55a98..dfbdf74068be 100644
--- a/platform/util-rt/src/com/intellij/execution/rmi/ssl/SslSocketFactory.java
+++ b/platform/util-rt/src/com/intellij/execution/rmi/ssl/SslSocketFactory.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2000-2014 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.execution.rmi.ssl;
import com.intellij.openapi.util.text.StringUtilRt;
@@ -47,18 +62,22 @@ public class SslSocketFactory extends SSLSocketFactory {
myFactory = ctx.getSocketFactory();
}
+ @NotNull
public Socket createSocket(InetAddress host, int port) throws IOException {
return myFactory.createSocket(host, port);
}
+ @NotNull
public Socket createSocket(String host, int port) throws IOException {
return myFactory.createSocket(host, port);
}
+ @NotNull
public Socket createSocket(String host, int port, InetAddress localHost, int localPort) throws IOException {
return myFactory.createSocket(host, port, localHost, localPort);
}
+ @NotNull
public Socket createSocket(InetAddress address, int port, InetAddress localAddress, int localPort) throws IOException {
return myFactory.createSocket(address, port, localAddress, localPort);
}
@@ -67,10 +86,12 @@ public class SslSocketFactory extends SSLSocketFactory {
return myFactory.createSocket(socket, host, port, autoClose);
}
+ @NotNull
public String[] getDefaultCipherSuites() {
return myFactory.getDefaultCipherSuites();
}
+ @NotNull
public String[] getSupportedCipherSuites() {
return myFactory.getSupportedCipherSuites();
}
diff --git a/platform/util/src/com/intellij/icons/AllIcons.java b/platform/util/src/com/intellij/icons/AllIcons.java
index 9d10f4136383..db897fd8c52d 100644
--- a/platform/util/src/com/intellij/icons/AllIcons.java
+++ b/platform/util/src/com/intellij/icons/AllIcons.java
@@ -458,6 +458,7 @@ public class AllIcons {
public static final Icon Pin_tab = IconLoader.getIcon("/general/pin_tab.png"); // 16x16
public static final Icon PluginManager = IconLoader.getIcon("/general/pluginManager.png"); // 32x32
public static final Icon Progress = IconLoader.getIcon("/general/progress.png"); // 8x10
+ public static final Icon ProjectConfigurable = IconLoader.getIcon("/general/projectConfigurable.png"); // 9x9
public static final Icon ProjectSettings = IconLoader.getIcon("/general/projectSettings.png"); // 16x16
public static final Icon ProjectStructure = IconLoader.getIcon("/general/projectStructure.png"); // 16x16
public static final Icon ProjectTab = IconLoader.getIcon("/general/projectTab.png"); // 16x16
diff --git a/platform/util/src/com/intellij/openapi/ui/VerticalFlowLayout.java b/platform/util/src/com/intellij/openapi/ui/VerticalFlowLayout.java
index 884a11711992..43aa9b37b510 100644
--- a/platform/util/src/com/intellij/openapi/ui/VerticalFlowLayout.java
+++ b/platform/util/src/com/intellij/openapi/ui/VerticalFlowLayout.java
@@ -48,6 +48,10 @@ public class VerticalFlowLayout extends FlowLayout implements Serializable {
this(alignment, 5, 5, fillHorizontally, fillVertically);
}
+ public VerticalFlowLayout(int hGap, int vGap) {
+ this(TOP, hGap, vGap, true, false);
+ }
+
public VerticalFlowLayout(@VerticalFlowAlignment int alignment, int hGap, int vGap, boolean fillHorizontally, boolean fillVertically) {
setAlignment(alignment);
this.hGap = hGap;
diff --git a/platform/util/src/com/intellij/openapi/util/BuildNumber.java b/platform/util/src/com/intellij/openapi/util/BuildNumber.java
index a888db7becf9..22cf77504a63 100644
--- a/platform/util/src/com/intellij/openapi/util/BuildNumber.java
+++ b/platform/util/src/com/intellij/openapi/util/BuildNumber.java
@@ -38,22 +38,28 @@ public class BuildNumber implements Comparable<BuildNumber> {
private final String myProductCode;
private final int myBaselineVersion;
private final int myBuildNumber;
+ private final String myAttemptInfo;
public BuildNumber(String productCode, int baselineVersion, int buildNumber) {
+ this(productCode, baselineVersion, buildNumber, null);
+ }
+
+ public BuildNumber(String productCode, int baselineVersion, int buildNumber, String attemptInfo) {
myProductCode = productCode;
myBaselineVersion = baselineVersion;
myBuildNumber = buildNumber;
+ myAttemptInfo = StringUtil.isEmpty(attemptInfo) ? null : attemptInfo;
}
public String asString() {
- return asString(true);
+ return asString(true, false);
}
public String asStringWithoutProductCode() {
- return asString(false);
+ return asString(false, false);
}
- private String asString(boolean includeProductCode) {
+ private String asString(boolean includeProductCode, boolean withBuildAttempt) {
StringBuilder builder = new StringBuilder();
if (includeProductCode && !StringUtil.isEmpty(myProductCode)) {
@@ -69,6 +75,10 @@ public class BuildNumber implements Comparable<BuildNumber> {
builder.append(SNAPSHOT);
}
+ if (withBuildAttempt && myAttemptInfo != null) {
+ builder.append('.').append(myAttemptInfo);
+ }
+
return builder.toString();
}
@@ -98,9 +108,11 @@ public class BuildNumber implements Comparable<BuildNumber> {
int baselineVersionSeparator = code.indexOf('.');
int baselineVersion;
int buildNumber;
+ String attemptInfo = null;
+
if (baselineVersionSeparator > 0) {
try {
- final String baselineVersionString = code.substring(0, baselineVersionSeparator);
+ String baselineVersionString = code.substring(0, baselineVersionSeparator);
if (baselineVersionString.trim().isEmpty()) return null;
baselineVersion = Integer.parseInt(baselineVersionString);
code = code.substring(baselineVersionSeparator + 1);
@@ -109,6 +121,11 @@ public class BuildNumber implements Comparable<BuildNumber> {
throw new RuntimeException("Invalid version number: " + version + "; plugin name: " + name);
}
+ int minorBuildSeparator = code.indexOf('.'); // allow <BuildNumber>.<BuildAttemptNumber> skipping BuildAttemptNumber
+ if (minorBuildSeparator > 0) {
+ attemptInfo = code.substring(minorBuildSeparator + 1);
+ code = code.substring(0, minorBuildSeparator);
+ }
buildNumber = parseBuildNumber(version, code, name);
}
else {
@@ -116,13 +133,13 @@ public class BuildNumber implements Comparable<BuildNumber> {
if (buildNumber <= 2000) {
// it's probably a baseline, not a build number
- return new BuildNumber(productCode, buildNumber, 0);
+ return new BuildNumber(productCode, buildNumber, 0, null);
}
baselineVersion = getBaseLineForHistoricBuilds(buildNumber);
}
- return new BuildNumber(productCode, baselineVersion, buildNumber);
+ return new BuildNumber(productCode, baselineVersion, buildNumber, attemptInfo);
}
private static int parseBuildNumber(String version, String code, String name) {
@@ -188,6 +205,7 @@ public class BuildNumber implements Comparable<BuildNumber> {
if (myBaselineVersion != that.myBaselineVersion) return false;
if (myBuildNumber != that.myBuildNumber) return false;
if (!myProductCode.equals(that.myProductCode)) return false;
+ if (!Comparing.equal(myAttemptInfo, that.myAttemptInfo)) return false;
return true;
}
@@ -197,6 +215,7 @@ public class BuildNumber implements Comparable<BuildNumber> {
int result = myProductCode.hashCode();
result = 31 * result + myBaselineVersion;
result = 31 * result + myBuildNumber;
+ if (myAttemptInfo != null) result = 31 * result + myAttemptInfo.hashCode();
return result;
}
@@ -256,4 +275,8 @@ public class BuildNumber implements Comparable<BuildNumber> {
public boolean isSnapshot() {
return myBuildNumber == Integer.MAX_VALUE;
}
+
+ public String asStringWithAllDetails() {
+ return asString(true, true);
+ }
}
diff --git a/platform/util/src/com/intellij/openapi/util/IconLoader.java b/platform/util/src/com/intellij/openapi/util/IconLoader.java
index 37948dfd49d8..cc87d0dcfc43 100644
--- a/platform/util/src/com/intellij/openapi/util/IconLoader.java
+++ b/platform/util/src/com/intellij/openapi/util/IconLoader.java
@@ -159,10 +159,6 @@ public final class IconLoader {
ourIsActivated = true;
}
- public static void deactivate() {
- ourIsActivated = false;
- }
-
private static boolean isLoaderDisabled() {
return !ourIsActivated;
}
diff --git a/platform/util/src/com/intellij/openapi/util/io/FileUtil.java b/platform/util/src/com/intellij/openapi/util/io/FileUtil.java
index fa67b7462bec..0f95577cf2b5 100644
--- a/platform/util/src/com/intellij/openapi/util/io/FileUtil.java
+++ b/platform/util/src/com/intellij/openapi/util/io/FileUtil.java
@@ -415,6 +415,17 @@ public class FileUtil extends FileUtilRt {
}
public static boolean delete(@NotNull File file) {
+ if (SystemInfo.isWindows) {
+ File tempFile = findSequentNonexistentFile(file.getParentFile(), file.getName(), "");
+ if (file.renameTo(tempFile)) {
+ file = tempFile;
+ }
+ }
+
+ return doDelete(file);
+ }
+
+ private static boolean doDelete(File file) {
FileAttributes attributes = FileSystemUtil.getAttributes(file);
if (attributes == null) return true;
@@ -422,7 +433,7 @@ public class FileUtil extends FileUtilRt {
File[] files = file.listFiles();
if (files != null) {
for (File child : files) {
- if (!delete(child)) return false;
+ if (!doDelete(child)) return false;
}
}
}
diff --git a/platform/util/src/com/intellij/openapi/util/registry/ui/RegistryCheckBox.java b/platform/util/src/com/intellij/openapi/util/registry/ui/RegistryCheckBox.java
index 657f8dd85a38..ffc664eacab1 100644
--- a/platform/util/src/com/intellij/openapi/util/registry/ui/RegistryCheckBox.java
+++ b/platform/util/src/com/intellij/openapi/util/registry/ui/RegistryCheckBox.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -22,8 +22,7 @@ import org.jetbrains.annotations.Nullable;
import javax.swing.*;
public class RegistryCheckBox extends CheckBoxWithDescription {
-
- private RegistryValue myValue;
+ private final RegistryValue myValue;
public RegistryCheckBox(RegistryValue value) {
this(value, value.getDescription(), null);
@@ -31,6 +30,7 @@ public class RegistryCheckBox extends CheckBoxWithDescription {
public RegistryCheckBox(RegistryValue value, String text, @Nullable String longDescription) {
super(new JCheckBox(text), longDescription);
+
myValue = value;
getCheckBox().setSelected(myValue.asBoolean());
}
@@ -42,5 +42,4 @@ public class RegistryCheckBox extends CheckBoxWithDescription {
public void save() {
myValue.setValue(Boolean.valueOf(getCheckBox().isSelected()).toString());
}
-
} \ No newline at end of file
diff --git a/platform/util/src/com/intellij/psi/codeStyle/MinusculeMatcher.java b/platform/util/src/com/intellij/psi/codeStyle/MinusculeMatcher.java
index 23afc188dfbd..559b6d0d1092 100644
--- a/platform/util/src/com/intellij/psi/codeStyle/MinusculeMatcher.java
+++ b/platform/util/src/com/intellij/psi/codeStyle/MinusculeMatcher.java
@@ -15,7 +15,6 @@
*/
package com.intellij.psi.codeStyle;
-import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.TextRange;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.util.containers.FList;
@@ -32,7 +31,6 @@ import java.util.Iterator;
* @author peter
*/
public class MinusculeMatcher implements Matcher {
- private static final Logger LOG = Logger.getInstance("#com.intellij.psi.codeStyle.MinusculeMatcher");
/**
* Lowercase humps don't work for parts separated by these characters
* Need either an explicit uppercase letter or the same separator character in prefix
@@ -220,7 +218,7 @@ public class MinusculeMatcher implements Matcher {
}
@Nullable
- private FList<TextRange> calcMatchingFragments(@NotNull String name) {
+ public FList<TextRange> matchingFragments(@NotNull String name) {
MatchingState state = myMatchingState.get();
state.initializeState(name);
try {
@@ -231,22 +229,6 @@ public class MinusculeMatcher implements Matcher {
}
}
- @Nullable
- public FList<TextRange> matchingFragments(@NotNull String name) {
- long start = System.currentTimeMillis();
- FList<TextRange> result = calcMatchingFragments(name);
- if (System.currentTimeMillis() - start > 1000 &&
- // if there's little free memory, it might have been the gc affecting the performance
- Runtime.getRuntime().freeMemory() > Runtime.getRuntime().totalMemory() * 3 / 10) {
- start = System.currentTimeMillis();
- calcMatchingFragments(name);
- if (System.currentTimeMillis() - start > 1000) {
- LOG.error("Too long name matching: name=" + name + "; prefix=" + new String(myPattern));
- }
- }
- return result;
- }
-
/**
* After a wildcard (* or space), search for the first non-wildcard pattern character in the name starting from nameIndex
* and try to {@link #matchFragment(String, int, int, com.intellij.psi.codeStyle.MinusculeMatcher.MatchingState)} for it.
diff --git a/platform/util/src/com/intellij/ui/Graphics2DDelegate.java b/platform/util/src/com/intellij/ui/Graphics2DDelegate.java
index 0bc765eb625c..1d13b77b367c 100644
--- a/platform/util/src/com/intellij/ui/Graphics2DDelegate.java
+++ b/platform/util/src/com/intellij/ui/Graphics2DDelegate.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -16,6 +16,7 @@
package com.intellij.ui;
import com.intellij.util.ui.UIUtil;
+import org.jetbrains.annotations.NotNull;
import java.awt.*;
import java.awt.font.FontRenderContext;
@@ -61,6 +62,7 @@ public class Graphics2DDelegate extends Graphics2D{
myDelegate.copyArea(x, y, width, height, dx, dy);
}
+ @NotNull
@Override
public Graphics create() {
return new Graphics2DDelegate((Graphics2D)myDelegate.create());
diff --git a/platform/util/src/com/intellij/util/containers/ContainerUtil.java b/platform/util/src/com/intellij/util/containers/ContainerUtil.java
index 4a9c7bde5614..6052df2b701e 100644
--- a/platform/util/src/com/intellij/util/containers/ContainerUtil.java
+++ b/platform/util/src/com/intellij/util/containers/ContainerUtil.java
@@ -1417,6 +1417,13 @@ public class ContainerUtil extends ContainerUtilRt {
}
}
+ @NotNull
+ public static <T> List<T> sorted(@NotNull Collection<T> list, @NotNull Comparator<T> comparator) {
+ List<T> sorted = newArrayList(list);
+ sort(sorted, comparator);
+ return sorted;
+ }
+
public static <T> void sort(@NotNull T[] a, @NotNull Comparator<T> comparator) {
int size = a.length;
@@ -2065,6 +2072,17 @@ public class ContainerUtil extends ContainerUtilRt {
return collection == null || collection.isEmpty();
}
+ @NotNull
+ public static <T, C extends Collection<T>> C notNullize(@Nullable C collection) {
+ //noinspection unchecked
+ return collection == null ? (C)ContainerUtilRt.emptyList() : collection;
+ }
+
+ @Nullable
+ public static <T, C extends Collection<T>> C nullize(@Nullable C collection) {
+ return isEmpty(collection) ? null : collection;
+ }
+
private interface ConcurrentMapFactory {
@NotNull <T, V> ConcurrentMap<T, V> createMap();
@NotNull <T, V> ConcurrentMap<T, V> createMap(int initialCapacity);
diff --git a/platform/util/src/com/intellij/util/containers/OrderedSet.java b/platform/util/src/com/intellij/util/containers/OrderedSet.java
index 9900eb92e800..0ff04acbe345 100644
--- a/platform/util/src/com/intellij/util/containers/OrderedSet.java
+++ b/platform/util/src/com/intellij/util/containers/OrderedSet.java
@@ -104,19 +104,19 @@ public class OrderedSet<T> extends ArrayList<T> implements Set<T>, RandomAccess
}
@Override
- public boolean addAll(final int index, final Collection<? extends T> c) {
+ public boolean addAll(final int index, @NotNull final Collection<? extends T> c) {
throw new UnsupportedOperationException();
}
@Override
- public T set(final int index, final T element) {
+ public T set(final int index, @NotNull final T element) {
final T removed = remove(index);
add(index, element);
return removed;
}
@Override
- public void add(final int index, final T element) {
+ public void add(final int index, @NotNull final T element) {
if (myHashSet.add(element)){
super.add(index, element);
}
diff --git a/platform/util/src/com/intellij/util/io/AbstractStringEnumerator.java b/platform/util/src/com/intellij/util/io/AbstractStringEnumerator.java
index 589fa0add6fe..a8145d5351dd 100644
--- a/platform/util/src/com/intellij/util/io/AbstractStringEnumerator.java
+++ b/platform/util/src/com/intellij/util/io/AbstractStringEnumerator.java
@@ -16,19 +16,13 @@
package com.intellij.util.io;
import com.intellij.openapi.Forceable;
-import org.jetbrains.annotations.Nullable;
import java.io.Closeable;
-import java.io.IOException;
/**
* Author: dmitrylomov
*/
-public interface AbstractStringEnumerator extends Closeable, Forceable {
- int enumerate(@Nullable String value) throws IOException;
-
- @Nullable
- String valueOf(int idx) throws IOException;
+public interface AbstractStringEnumerator extends Closeable, Forceable, DataEnumerator<String> {
void markCorrupted();
}
diff --git a/platform/util/src/com/intellij/util/io/AppendableStorageBackedByResizableMappedFile.java b/platform/util/src/com/intellij/util/io/AppendableStorageBackedByResizableMappedFile.java
index 6f936d75849a..c4381da1a406 100644
--- a/platform/util/src/com/intellij/util/io/AppendableStorageBackedByResizableMappedFile.java
+++ b/platform/util/src/com/intellij/util/io/AppendableStorageBackedByResizableMappedFile.java
@@ -158,7 +158,7 @@ public class AppendableStorageBackedByResizableMappedFile extends ResizeableMapp
int base = addr;
int address = storage.getOffsetInPage(addr);
boolean same = true;
- ByteBuffer buffer = storage.getByteBuffer(addr, false);
+ ByteBuffer buffer = storage.getByteBuffer(addr, false).getCachedBuffer();
final int myPageSize = storage.myPageSize;
@Override
@@ -166,7 +166,7 @@ public class AppendableStorageBackedByResizableMappedFile extends ResizeableMapp
if (same) {
if (myPageSize == address && address < myFileLength) { // reached end of current byte buffer
base += address;
- buffer = storage.getByteBuffer(base, false);
+ buffer = storage.getByteBuffer(base, false).getCachedBuffer();
address = 0;
}
same = address < myFileLength && buffer.get(address++) == (byte)b;
diff --git a/platform/util/src/com/intellij/util/io/CachingEnumerator.java b/platform/util/src/com/intellij/util/io/CachingEnumerator.java
new file mode 100644
index 000000000000..94ce68c981ca
--- /dev/null
+++ b/platform/util/src/com/intellij/util/io/CachingEnumerator.java
@@ -0,0 +1,149 @@
+/*
+ * Copyright 2000-2014 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.util.io;
+
+import com.intellij.util.containers.SLRUMap;
+import jsr166e.extra.SequenceLock;
+import org.jetbrains.annotations.Nullable;
+
+import java.io.IOException;
+import java.util.concurrent.locks.Lock;
+
+/**
+ * @author peter
+ */
+public class CachingEnumerator<Data> implements DataEnumerator<Data> {
+ private static final int STRIPE_POWER = 4;
+ private static final int STRIPE_COUNT = 1 << STRIPE_POWER;
+ private static final int STRIPE_MASK = STRIPE_COUNT - 1;
+ @SuppressWarnings("unchecked") private final SLRUMap<Integer, Integer>[] myHashcodeToIdCache = new SLRUMap[STRIPE_COUNT];
+ @SuppressWarnings("unchecked") private final SLRUMap<Integer, Data>[] myIdToStringCache = new SLRUMap[STRIPE_COUNT];
+ private final Lock[] myStripeLocks = new Lock[STRIPE_COUNT];
+ private final DataEnumerator<Data> myBase;
+ private final KeyDescriptor<Data> myDataDescriptor;
+
+ public CachingEnumerator(DataEnumerator<Data> base, KeyDescriptor<Data> dataDescriptor) {
+ myBase = base;
+ myDataDescriptor = dataDescriptor;
+ int protectedSize = 8192;
+ int probationalSize = 8192;
+
+ for(int i = 0; i < STRIPE_COUNT; ++i) {
+ myHashcodeToIdCache[i] = new SLRUMap<Integer, Integer>(protectedSize / STRIPE_COUNT, probationalSize / STRIPE_COUNT);
+ myIdToStringCache[i] = new SLRUMap<Integer, Data>(protectedSize / STRIPE_COUNT, probationalSize / STRIPE_COUNT);
+ myStripeLocks[i] = new SequenceLock();
+ }
+
+ }
+
+ public int enumerate(@Nullable Data value) throws IOException {
+ int valueHashCode =-1;
+ int stripe = -1;
+
+ if (myHashcodeToIdCache != null && value != null) {
+ valueHashCode = myDataDescriptor.getHashCode(value);
+ stripe = Math.abs(valueHashCode) & STRIPE_MASK;
+
+ Integer cachedId;
+
+ myStripeLocks[stripe].lock();
+ try {
+ cachedId = myHashcodeToIdCache[stripe].get(valueHashCode);
+ }
+ finally {
+ myStripeLocks[stripe].unlock();
+ }
+
+ if (cachedId != null) {
+ int stripe2 = idStripe(cachedId.intValue());
+ myStripeLocks[stripe2].lock();
+ try {
+ Data s = myIdToStringCache[stripe2].get(cachedId);
+ if (s != null && myDataDescriptor.isEqual(value, s)) return cachedId.intValue();
+ }
+ finally {
+ myStripeLocks[stripe2].unlock();
+ }
+ }
+ }
+
+ int enumerate = myBase.enumerate(value);
+
+ if (stripe != -1) {
+ Integer enumeratedInteger;
+
+ myStripeLocks[stripe].lock();
+ try {
+ enumeratedInteger = enumerate;
+ myHashcodeToIdCache[stripe].put(valueHashCode, enumeratedInteger);
+ } finally {
+ myStripeLocks[stripe].unlock();
+ }
+
+ int stripe2 = idStripe(enumerate);
+ myStripeLocks[stripe2].lock();
+ try {
+ myIdToStringCache[stripe2].put(enumeratedInteger, value);
+ } finally {
+ myStripeLocks[stripe2].unlock();
+ }
+ }
+
+ return enumerate;
+ }
+
+ private static int idStripe(int h) {
+ h ^= (h >>> 20) ^ (h >>> 12);
+ return Math.abs(h ^ (h >>> 7) ^ (h >>> 4)) & STRIPE_MASK;
+ }
+
+ @Nullable
+ public Data valueOf(int idx) throws IOException {
+ int stripe = -1;
+ if (myIdToStringCache != null) {
+ stripe = idStripe(idx);
+ myStripeLocks[stripe].lock();
+ try {
+ Data s = myIdToStringCache[stripe].get(idx);
+ if (s != null) return s;
+ }
+ finally {
+ myStripeLocks[stripe].unlock();
+ }
+ }
+ Data s = myBase.valueOf(idx);
+
+ if (stripe != -1 && s != null) {
+ myStripeLocks[stripe].lock();
+ try {
+ myIdToStringCache[stripe].put(idx, s);
+ }
+ finally {
+ myStripeLocks[stripe].unlock();
+ }
+ }
+ return s;
+ }
+
+ public void close() throws IOException {
+ for(int i = 0; i < myIdToStringCache.length; ++i) {
+ myStripeLocks[i].lock();
+ myIdToStringCache[i].clear();
+ myHashcodeToIdCache[i].clear();
+ myStripeLocks[i].unlock();
+ }
+ }
+}
diff --git a/platform/util/src/com/intellij/util/io/DataEnumerator.java b/platform/util/src/com/intellij/util/io/DataEnumerator.java
new file mode 100644
index 000000000000..3a7a1131b638
--- /dev/null
+++ b/platform/util/src/com/intellij/util/io/DataEnumerator.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2000-2014 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.util.io;
+
+import org.jetbrains.annotations.Nullable;
+
+import java.io.IOException;
+
+/**
+ * @author peter
+ */
+public interface DataEnumerator<Data> {
+ int enumerate(@Nullable Data value) throws IOException;
+
+ @Nullable
+ Data valueOf(int idx) throws IOException;
+}
diff --git a/platform/util/src/com/intellij/util/io/EnumeratorStringDescriptor.java b/platform/util/src/com/intellij/util/io/EnumeratorStringDescriptor.java
index dce1d4990623..922701542394 100644
--- a/platform/util/src/com/intellij/util/io/EnumeratorStringDescriptor.java
+++ b/platform/util/src/com/intellij/util/io/EnumeratorStringDescriptor.java
@@ -26,6 +26,7 @@ import java.io.IOException;
* Date: Dec 18, 2007
*/
public class EnumeratorStringDescriptor implements KeyDescriptor<String> {
+ public static final EnumeratorStringDescriptor INSTANCE = new EnumeratorStringDescriptor();
@Override
public int getHashCode(final String value) {
return value.hashCode();
diff --git a/platform/util/src/com/intellij/util/io/IntToIntBtree.java b/platform/util/src/com/intellij/util/io/IntToIntBtree.java
index 8cddbcee32c8..b17fc6cc5c6c 100644
--- a/platform/util/src/com/intellij/util/io/IntToIntBtree.java
+++ b/platform/util/src/com/intellij/util/io/IntToIntBtree.java
@@ -203,7 +203,7 @@ class IntToIntBtree {
boolean canUseLastKey = myCanUseLastKey;
if (canUseLastKey) {
myCanUseLastKey = false;
- if (key == myLastGetKey && !myAccessNodeView.myHasFullPagesAlongPath) {
+ if (key == myLastGetKey && !myAccessNodeView.myHasFullPagesAlongPath && myAccessNodeView.isValid()) {
++myOptimizedInserts;
++count;
myAccessNodeView.insert(key, value);
@@ -284,6 +284,7 @@ class IntToIntBtree {
private short myChildrenCount;
protected int myAddressInBuffer;
protected ByteBuffer myBuffer;
+ protected ByteBufferWrapper myBufferWrapper;
protected boolean myHasFullPagesAlongPath;
protected boolean myIsDirty;
@@ -302,7 +303,8 @@ class IntToIntBtree {
protected void syncWithStore() {
PagedFileStorage pagedFileStorage = btree.storage.getPagedFileStorage();
myAddressInBuffer = pagedFileStorage.getOffsetInPage(address);
- myBuffer = pagedFileStorage.getByteBuffer(address, false);
+ myBufferWrapper = pagedFileStorage.getByteBuffer(address, false);
+ myBuffer = myBufferWrapper.getCachedBuffer();
myIsDirty = false; // we will mark dirty on child count change, attrs change or existing key put
doInitFlags(myBuffer.getInt(myAddressInBuffer));
}
@@ -541,6 +543,10 @@ class IntToIntBtree {
setAddress(address);
}
+ public boolean isValid() {
+ return myBufferWrapper.getCachedBuffer() == myBuffer;
+ }
+
private static class HashLeafData {
final BtreeIndexNodeView nodeView;
final int[] keys;
diff --git a/platform/util/src/com/intellij/util/io/PagedFileStorage.java b/platform/util/src/com/intellij/util/io/PagedFileStorage.java
index 1d5e9d76d04e..69315f1b3764 100644
--- a/platform/util/src/com/intellij/util/io/PagedFileStorage.java
+++ b/platform/util/src/com/intellij/util/io/PagedFileStorage.java
@@ -151,7 +151,7 @@ public class PagedFileStorage implements Forceable {
if (myValuesAreBufferAligned) {
long page = addr / myPageSize;
int page_offset = (int) (addr % myPageSize);
- return getBuffer(page, false).getInt(page_offset);
+ return getReadOnlyBuffer(page).getInt(page_offset);
} else {
get(addr, myTypedIOBuffer, 0, 4);
return Bits.getInt(myTypedIOBuffer, 0);
@@ -173,15 +173,15 @@ public class PagedFileStorage implements Forceable {
return (int)(addr % myPageSize);
}
- ByteBuffer getByteBuffer(long address, boolean modify) {
- return getBuffer(address / myPageSize, modify);
+ ByteBufferWrapper getByteBuffer(long address, boolean modify) {
+ return getBufferWrapper(address / myPageSize, modify);
}
public final short getShort(long addr) {
if (myValuesAreBufferAligned) {
long page = addr / myPageSize;
int page_offset = (int)(addr % myPageSize);
- return getBuffer(page, false).getShort(page_offset);
+ return getReadOnlyBuffer(page).getShort(page_offset);
} else {
get(addr, myTypedIOBuffer, 0, 2);
return Bits.getShort(myTypedIOBuffer, 0);
@@ -212,7 +212,7 @@ public class PagedFileStorage implements Forceable {
if (myValuesAreBufferAligned) {
long page = addr / myPageSize;
int page_offset = (int)(addr % myPageSize);
- return getBuffer(page, false).getLong(page_offset);
+ return getReadOnlyBuffer(page).getLong(page_offset);
} else {
get(addr, myTypedIOBuffer, 0, 8);
return Bits.getLong(myTypedIOBuffer, 0);
@@ -223,7 +223,7 @@ public class PagedFileStorage implements Forceable {
long page = index / myPageSize;
int offset = (int)(index % myPageSize);
- return getBuffer(page, false).get(offset);
+ return getReadOnlyBuffer(page).get(offset);
}
public void put(long index, byte value) {
@@ -243,7 +243,7 @@ public class PagedFileStorage implements Forceable {
int page_offset = (int) (i % myPageSize);
int page_len = Math.min(l, myPageSize - page_offset);
- final ByteBuffer buffer = getBuffer(page, false);
+ final ByteBuffer buffer = getReadOnlyBuffer(page);
try {
buffer.position(page_offset);
}
@@ -369,28 +369,32 @@ public class PagedFileStorage implements Forceable {
}
private ByteBuffer getBuffer(long page) {
- return getBuffer(page, true);
+ return getBufferWrapper(page, true).getCachedBuffer();
}
- private ByteBuffer getBuffer(long page, boolean modify) {
+ private ByteBuffer getReadOnlyBuffer(long page) {
+ return getBufferWrapper(page, false).getCachedBuffer();
+ }
+
+ private ByteBufferWrapper getBufferWrapper(long page, boolean modify) {
synchronized (myLastAccessedBufferCacheLock) {
if (myLastPage == page) {
ByteBuffer buf = myLastBuffer.getCachedBuffer();
if (buf != null && myLastChangeCount == myStorageLockContext.myStorageLock.myMappingChangeCount) {
if (modify) markDirty(myLastBuffer);
- return buf;
+ return myLastBuffer;
}
} else if (myLastPage2 == page) {
ByteBuffer buf = myLastBuffer2.getCachedBuffer();
if (buf != null && myLastChangeCount2 == myStorageLockContext.myStorageLock.myMappingChangeCount) {
if (modify) markDirty(myLastBuffer2);
- return buf;
+ return myLastBuffer2;
}
} else if (myLastPage3 == page) {
ByteBuffer buf = myLastBuffer3.getCachedBuffer();
if (buf != null && myLastChangeCount3 == myStorageLockContext.myStorageLock.myMappingChangeCount) {
if (modify) markDirty(myLastBuffer3);
- return buf;
+ return myLastBuffer3;
}
}
}
@@ -427,7 +431,7 @@ public class PagedFileStorage implements Forceable {
myLastChangeCount = myStorageLockContext.myStorageLock.myMappingChangeCount;
}
- return buf;
+ return byteBufferWrapper;
}
catch (IOException e) {
throw new MappingFailedException("Cannot map buffer", e);
diff --git a/platform/util/src/com/intellij/util/io/PersistentHashMap.java b/platform/util/src/com/intellij/util/io/PersistentHashMap.java
index de43fbd11b1b..dde187d804b5 100644
--- a/platform/util/src/com/intellij/util/io/PersistentHashMap.java
+++ b/platform/util/src/com/intellij/util/io/PersistentHashMap.java
@@ -80,7 +80,7 @@ public class PersistentHashMap<Key, Value> extends PersistentEnumeratorDelegate<
private final boolean myCanReEnumerate;
private int myLargeIndexWatermarkId; // starting with this id we store offset in adjacent file in long format
private boolean myIntAddressForNewRecord;
- private static final boolean doHardConsistencyChecks = true;
+ private static final boolean doHardConsistencyChecks = false;
private volatile boolean myBusyReading;
private static class AppendStream extends DataOutputStream {
diff --git a/platform/util/src/com/intellij/util/io/PersistentStringEnumerator.java b/platform/util/src/com/intellij/util/io/PersistentStringEnumerator.java
index 19755778f2ec..996798734253 100644
--- a/platform/util/src/com/intellij/util/io/PersistentStringEnumerator.java
+++ b/platform/util/src/com/intellij/util/io/PersistentStringEnumerator.java
@@ -15,22 +15,14 @@
*/
package com.intellij.util.io;
-import com.intellij.util.containers.SLRUMap;
-import jsr166e.extra.SequenceLock;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.io.File;
import java.io.IOException;
-import java.util.concurrent.locks.Lock;
public class PersistentStringEnumerator extends PersistentEnumeratorDelegate<String> implements AbstractStringEnumerator {
- private static final int STRIPE_POWER = 4;
- private static final int STRIPE_COUNT = 1 << STRIPE_POWER;
- private static final int STRIPE_MASK = STRIPE_COUNT - 1;
- @Nullable private final SLRUMap<Integer, Integer>[] myHashcodeToIdCache;
- @Nullable private final SLRUMap<Integer, String>[] myIdToStringCache;
- @Nullable private final Lock[] myStripeLocks;
+ @Nullable private final CachingEnumerator<String> myCache;
public PersistentStringEnumerator(@NotNull final File file) throws IOException {
this(file, null);
@@ -58,129 +50,36 @@ public class PersistentStringEnumerator extends PersistentEnumeratorDelegate<Str
final int initialSize,
boolean cacheLastMappings,
@Nullable PagedFileStorage.StorageLockContext lockContext) throws IOException {
- super(file, new EnumeratorStringDescriptor(), initialSize, lockContext);
- if (cacheLastMappings) {
- myIdToStringCache = new SLRUMap[STRIPE_COUNT];
- myHashcodeToIdCache = new SLRUMap[STRIPE_COUNT];
- myStripeLocks = new Lock[STRIPE_COUNT];
- int protectedSize = 8192;
- int probationalSize = 8192;
+ super(file, EnumeratorStringDescriptor.INSTANCE, initialSize, lockContext);
+ myCache = cacheLastMappings ? new CachingEnumerator<String>(new DataEnumerator<String>() {
+ @Override
+ public int enumerate(@Nullable String value) throws IOException {
+ return PersistentStringEnumerator.super.enumerate(value);
+ }
- for(int i = 0; i < STRIPE_COUNT; ++i) {
- myHashcodeToIdCache[i] = new SLRUMap<Integer, Integer>(protectedSize / STRIPE_COUNT, probationalSize / STRIPE_COUNT);
- myIdToStringCache[i] = new SLRUMap<Integer, String>(protectedSize / STRIPE_COUNT, probationalSize / STRIPE_COUNT);
- myStripeLocks[i] = new SequenceLock();
+ @Nullable
+ @Override
+ public String valueOf(int idx) throws IOException {
+ return PersistentStringEnumerator.super.valueOf(idx);
}
- } else {
- myIdToStringCache = null;
- myHashcodeToIdCache = null;
- myStripeLocks = null;
- }
+ }, EnumeratorStringDescriptor.INSTANCE) : null;
}
@Override
public int enumerate(@Nullable String value) throws IOException {
- int valueHashCode =-1;
- int stripe = -1;
-
- if (myHashcodeToIdCache != null && value != null) {
- valueHashCode = value.hashCode();
- stripe = Math.abs(valueHashCode) & STRIPE_MASK;
-
- Integer cachedId;
-
- myStripeLocks[stripe].lock();
- try {
- cachedId = myHashcodeToIdCache[stripe].get(valueHashCode);
- }
- finally {
- myStripeLocks[stripe].unlock();
- }
-
- if (cachedId != null) {
- int stripe2 = idStripe(cachedId.intValue());
- myStripeLocks[stripe2].lock();
- try {
- String s = myIdToStringCache[stripe2].get(cachedId);
- if (s != null && value.equals(s)) return cachedId.intValue();
- }
- finally {
- myStripeLocks[stripe2].unlock();
- }
- }
- }
-
- int enumerate = super.enumerate(value);
-
- if (stripe != -1) {
- Integer enumeratedInteger;
-
- myStripeLocks[stripe].lock();
- try {
- enumeratedInteger = enumerate;
- myHashcodeToIdCache[stripe].put(valueHashCode, enumeratedInteger);
- } finally {
- myStripeLocks[stripe].unlock();
- }
-
- int stripe2 = idStripe(enumerate);
- myStripeLocks[stripe2].lock();
- try {
- myIdToStringCache[stripe2].put(enumeratedInteger, value);
- } finally {
- myStripeLocks[stripe2].unlock();
- }
- }
-
- return enumerate;
- }
-
- private int idStripe(int h) {
- h ^= (h >>> 20) ^ (h >>> 12);
- return Math.abs(h ^ (h >>> 7) ^ (h >>> 4)) & STRIPE_MASK;
+ return myCache != null ? myCache.enumerate(value) : super.enumerate(value);
}
@Nullable
@Override
public String valueOf(int idx) throws IOException {
- int stripe = -1;
- if (myIdToStringCache != null) {
- stripe = idStripe(idx);
- myStripeLocks[stripe].lock();
- try {
- String s = myIdToStringCache[stripe].get(idx);
- if (s != null) return s;
- }
- finally {
- myStripeLocks[stripe].unlock();
- }
- }
- String s = super.valueOf(idx);
-
- if (stripe != -1 && s != null) {
- myStripeLocks[stripe].lock();
- try {
- myIdToStringCache[stripe].put(idx, s);
- }
- finally {
- myStripeLocks[stripe].unlock();
- }
- }
- return s;
+ return myCache != null ? myCache.valueOf(idx) : super.valueOf(idx);
}
@Override
public void close() throws IOException {
super.close();
-
- if (myIdToStringCache != null) {
- for(int i = 0; i < myIdToStringCache.length; ++i) {
- myStripeLocks[i].lock();
- myIdToStringCache[i].clear();
- myHashcodeToIdCache[i].clear();
- myStripeLocks[i].unlock();
- }
- }
+ if (myCache != null) myCache.close();
}
@Override
diff --git a/platform/util/src/com/intellij/util/ui/ColumnInfo.java b/platform/util/src/com/intellij/util/ui/ColumnInfo.java
index 8289633b111d..2ad54e6f81b9 100644
--- a/platform/util/src/com/intellij/util/ui/ColumnInfo.java
+++ b/platform/util/src/com/intellij/util/ui/ColumnInfo.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2011 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -23,18 +23,6 @@ import javax.swing.table.TableCellRenderer;
import java.util.Comparator;
public abstract class ColumnInfo <Item, Aspect> {
-
- public static class StringColumn extends ColumnInfo<String, String> {
- public StringColumn(final String name) {
- super(name);
- }
-
- @Override
- public String valueOf(final String item) {
- return item;
- }
- }
-
private String myName;
public static final ColumnInfo[] EMPTY_ARRAY = new ColumnInfo[0];
diff --git a/platform/util/src/com/intellij/util/ui/UIUtil.java b/platform/util/src/com/intellij/util/ui/UIUtil.java
index cc6d5a305bf5..7ed8021bd94b 100644
--- a/platform/util/src/com/intellij/util/ui/UIUtil.java
+++ b/platform/util/src/com/intellij/util/ui/UIUtil.java
@@ -48,7 +48,9 @@ import javax.swing.plaf.basic.BasicComboBoxUI;
import javax.swing.plaf.basic.BasicRadioButtonUI;
import javax.swing.plaf.basic.ComboPopup;
import javax.swing.text.DefaultEditorKit;
+import javax.swing.text.DefaultFormatterFactory;
import javax.swing.text.JTextComponent;
+import javax.swing.text.NumberFormatter;
import javax.swing.text.html.HTMLEditorKit;
import javax.swing.text.html.StyleSheet;
import javax.swing.undo.UndoManager;
@@ -70,6 +72,7 @@ import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.URL;
+import java.text.NumberFormat;
import java.util.*;
import java.util.List;
import java.util.concurrent.BlockingQueue;
@@ -2982,4 +2985,23 @@ public class UIUtil {
}
return new EmptyBorder(0, leftGap, 0, 0);
}
+
+ public static Color getSidePanelColor() {
+ return new JBColor(new Color(0xD2D6DD), new Color(60, 68, 71));
+ }
+
+ /**
+ * It is your responsibility to set correct horizontal align (left in case of UI Designer)
+ */
+ public static void configureNumericFormattedTextField(@NotNull JFormattedTextField textField) {
+ NumberFormat format = NumberFormat.getIntegerInstance();
+ format.setParseIntegerOnly(true);
+ format.setGroupingUsed(false);
+ NumberFormatter numberFormatter = new NumberFormatter(format);
+ numberFormatter.setMinimum(0);
+ textField.setFormatterFactory(new DefaultFormatterFactory(numberFormatter));
+ textField.setHorizontalAlignment(SwingConstants.TRAILING);
+
+ textField.setColumns(4);
+ }
}
diff --git a/platform/util/testSrc/com/intellij/util/containers/ConcurrentMapsTest.java b/platform/util/testSrc/com/intellij/util/containers/ConcurrentMapsTest.java
index 2972091e78a5..c85b8d3516a7 100644
--- a/platform/util/testSrc/com/intellij/util/containers/ConcurrentMapsTest.java
+++ b/platform/util/testSrc/com/intellij/util/containers/ConcurrentMapsTest.java
@@ -98,7 +98,7 @@ public class ConcurrentMapsTest {
List<Object> list = ContainerUtil.newArrayList();
while (reference.get() != null) {
int chunk = (int)Math.min(Runtime.getRuntime().freeMemory() / 2, Integer.MAX_VALUE);
- list.add(new SoftReference<byte[]>(new byte[chunk / 2]));
+ list.add(new SoftReference<byte[]>(new byte[chunk]));
}
}
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/actions/AnnotateToggleAction.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/actions/AnnotateToggleAction.java
index 3008138c60a2..291289854fa7 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/actions/AnnotateToggleAction.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/actions/AnnotateToggleAction.java
@@ -169,6 +169,7 @@ public class AnnotateToggleAction extends ToggleAction implements DumbAware, Ann
if (vcs == null) return;
final AnnotationProvider annotationProvider = vcs.getCachingAnnotationProvider();
+ assert annotationProvider != null;
final Ref<FileAnnotation> fileAnnotationRef = new Ref<FileAnnotation>();
final Ref<VcsException> exceptionRef = new Ref<VcsException>();
@@ -190,7 +191,7 @@ public class AnnotateToggleAction extends ToggleAction implements DumbAware, Ann
exceptionRef.set(e);
}
catch (Throwable t) {
- handler.completed(file.getPath());
+ exceptionRef.set(new VcsException(t));
}
}
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/MapIgnoredFilesHolder.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/MapIgnoredFilesHolder.java
index 297e46482135..5ba7ce8cab0e 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/MapIgnoredFilesHolder.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/MapIgnoredFilesHolder.java
@@ -20,7 +20,7 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.vcs.AbstractVcs;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.containers.ContainerUtil;
-import com.intellij.util.containers.hash.HashSet;
+import gnu.trove.THashSet;
import java.util.Collection;
import java.util.Set;
@@ -40,8 +40,8 @@ public class MapIgnoredFilesHolder extends AbstractIgnoredFilesHolder {
public MapIgnoredFilesHolder(Project project) {
super(project);
myProject = project;
- mySet = new HashSet<VirtualFile>();
- myVcsIgnoredSet = new HashSet<VirtualFile>(); //collect ignored files from VcsChangeProvider -> processIgnored
+ mySet = new THashSet<VirtualFile>();
+ myVcsIgnoredSet = new THashSet<VirtualFile>(); //collect ignored files from VcsChangeProvider -> processIgnored
}
@Override
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/RemoteRevisionsCache.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/RemoteRevisionsCache.java
index 0ff134eb723a..7870b7ddbe02 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/RemoteRevisionsCache.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/RemoteRevisionsCache.java
@@ -16,13 +16,11 @@
package com.intellij.openapi.vcs.changes;
import com.intellij.lifecycle.PeriodicalTasksCloser;
-import com.intellij.openapi.Disposable;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.progress.ProcessCanceledException;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Couple;
-import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.Getter;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.vcs.*;
@@ -57,12 +55,12 @@ public class RemoteRevisionsCache implements PlusMinus<Pair<String, AbstractVcs>
private final Object myLock;
private final Map<String, RemoteDifferenceStrategy> myKinds;
private final ControlledCycle myControlledCycle;
- private final MessageBusConnection myConnection;
public static RemoteRevisionsCache getInstance(final Project project) {
return PeriodicalTasksCloser.getInstance().safeGetService(project, RemoteRevisionsCache.class);
}
+ @SuppressWarnings("UnusedDeclaration") // initialized as a Service
private RemoteRevisionsCache(final Project project) {
myProject = project;
myLock = new Object();
@@ -73,15 +71,11 @@ public class RemoteRevisionsCache implements PlusMinus<Pair<String, AbstractVcs>
myChangeDecorator = new RemoteStatusChangeNodeDecorator(this);
myVcsManager = ProjectLevelVcsManager.getInstance(project);
- myConnection = myProject.getMessageBus().connect();
- myConnection.subscribe(ProjectLevelVcsManager.VCS_CONFIGURATION_CHANGED, this);
- myConnection.subscribe(ProjectLevelVcsManager.VCS_CONFIGURATION_CHANGED_IN_PLUGIN, this);
+ MessageBusConnection connection = myProject.getMessageBus().connect();
+ connection.subscribe(ProjectLevelVcsManager.VCS_CONFIGURATION_CHANGED, this);
+ connection.subscribe(ProjectLevelVcsManager.VCS_CONFIGURATION_CHANGED_IN_PLUGIN, this);
myKinds = new HashMap<String, RemoteDifferenceStrategy>();
- Disposer.register(project, new Disposable() {
- public void dispose() {
- myConnection.disconnect();
- }
- });
+
final VcsConfiguration vcsConfiguration = VcsConfiguration.getInstance(myProject);
myControlledCycle = new ControlledCycle(project, new Getter<Boolean>() {
@Override
@@ -92,7 +86,14 @@ public class RemoteRevisionsCache implements PlusMinus<Pair<String, AbstractVcs>
boolean somethingChanged = myRemoteRevisionsNumbersCache.updateStep();
somethingChanged |= myRemoteRevisionsStateCache.updateStep();
if (somethingChanged) {
- myProject.getMessageBus().syncPublisher(REMOTE_VERSION_CHANGED).run();
+ ApplicationManager.getApplication().runReadAction(new Runnable() {
+ @Override
+ public void run() {
+ if (!myProject.isDisposed()) {
+ myProject.getMessageBus().syncPublisher(REMOTE_VERSION_CHANGED).run();
+ }
+ }
+ });
}
}
return shouldBeDone;
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/UpdatingChangeListBuilder.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/UpdatingChangeListBuilder.java
index 93919fcb2bd0..fdc079641b68 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/UpdatingChangeListBuilder.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/UpdatingChangeListBuilder.java
@@ -66,14 +66,14 @@ class UpdatingChangeListBuilder implements ChangelistBuilder {
}
public void processChange(final Change change, VcsKey vcsKey) {
- processChangeInList( change, (ChangeList) null, vcsKey);
+ processChangeInList(change, (ChangeList)null, vcsKey);
}
public void processChangeInList(final Change change, @Nullable final ChangeList changeList, final VcsKey vcsKey) {
checkIfDisposed();
LOG.debug("[processChangeInList-1] entering, cl name: " + ((changeList == null) ? null: changeList.getName()) +
- " change: " + ChangesUtil.getFilePath(change).getPath());
+ " change: " + ChangesUtil.getFilePath(change).getPath());
final String fileName = ChangesUtil.getFilePath(change).getName();
if (FileTypeManager.getInstance().isFileIgnored(fileName)) {
LOG.debug("[processChangeInList-1] file type ignored");
@@ -86,11 +86,13 @@ class UpdatingChangeListBuilder implements ChangelistBuilder {
if (changeList != null) {
LOG.debug("[processChangeInList-1] to add change to cl");
myChangeListWorker.addChangeToList(changeList.getName(), change, vcsKey);
- } else {
+ }
+ else {
LOG.debug("[processChangeInList-1] to add to corresponding list");
myChangeListWorker.addChangeToCorrespondingList(change, vcsKey);
}
- } else {
+ }
+ else {
LOG.debug("[processChangeInList-1] not under scope");
}
}
@@ -203,7 +205,7 @@ class UpdatingChangeListBuilder implements ChangelistBuilder {
if (file == null) return;
checkIfDisposed();
if (myScope.belongsTo(new FilePathImpl(file))) {
- ((LogicallyLockedHolder) myComposite.get(FileHolder.HolderType.LOGICALLY_LOCKED)).add(file, logicalLock);
+ ((LogicallyLockedHolder)myComposite.get(FileHolder.HolderType.LOGICALLY_LOCKED)).add(file, logicalLock);
}
}
@@ -220,7 +222,7 @@ class UpdatingChangeListBuilder implements ChangelistBuilder {
if (file == null) return;
checkIfDisposed();
if (myScope.belongsTo(new FilePathImpl(file))) {
- ((SwitchedFileHolder) myComposite.get(FileHolder.HolderType.ROOT_SWITCH)).addFile(file, branch, false);
+ ((SwitchedFileHolder)myComposite.get(FileHolder.HolderType.ROOT_SWITCH)).addFile(file, branch, false);
}
}
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/VcsGuess.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/VcsGuess.java
index f5abcf039ece..00ca9f2ebf4f 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/VcsGuess.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/VcsGuess.java
@@ -22,6 +22,7 @@ import com.intellij.openapi.roots.FileIndexFacade;
import com.intellij.openapi.util.Computable;
import com.intellij.openapi.vcs.AbstractVcs;
import com.intellij.openapi.vcs.FilePath;
+import com.intellij.openapi.vcs.ProjectLevelVcsManager;
import com.intellij.openapi.vcs.impl.ProjectLevelVcsManagerImpl;
import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.annotations.NotNull;
@@ -34,7 +35,7 @@ public class VcsGuess {
VcsGuess(final Project project) {
myProject = project;
- myVcsManager = (ProjectLevelVcsManagerImpl) ProjectLevelVcsManagerImpl.getInstance(myProject);
+ myVcsManager = (ProjectLevelVcsManagerImpl)ProjectLevelVcsManager.getInstance(myProject);
myExcludedFileIndex = PeriodicalTasksCloser.getInstance().safeGetService(myProject, FileIndexFacade.class);
}
@@ -72,14 +73,14 @@ public class VcsGuess {
final boolean inContent = myVcsManager.isFileInContent(validParent);
if (inContent) return true;
if (filePath != null) {
- return isFileInBaseDir(filePath, myProject.getBaseDir()) && ! myExcludedFileIndex.isExcludedFile(validParent);
+ return isFileInBaseDir(filePath, myProject.getBaseDir()) && !myExcludedFileIndex.isExcludedFile(validParent);
}
return false;
}
});
}
- private boolean isFileInBaseDir(final FilePath filePath, final VirtualFile baseDir) {
+ private static boolean isFileInBaseDir(final FilePath filePath, final VirtualFile baseDir) {
final VirtualFile parent = filePath.getVirtualFileParent();
return !filePath.isDirectory() && parent != null && parent.equals(baseDir);
}
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesTreeList.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesTreeList.java
index 21ee42093193..2b4ea995448b 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesTreeList.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesTreeList.java
@@ -27,6 +27,7 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.EmptyRunnable;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.SystemInfo;
+import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vcs.FilePath;
@@ -445,7 +446,7 @@ public abstract class ChangesTreeList<T> extends JPanel implements TypeSafeDataP
ContentRevision afterRevision = change.getAfterRevision();
if (afterRevision == null) return false;
FilePath file = afterRevision.getFile();
- return file.getName().equals(toSelect.getName());
+ return FileUtil.pathsEqual(file.getPath(), toSelect.getPath());
}
protected abstract DefaultTreeModel buildTreeModel(final List<T> changes, final ChangeNodeDecorator changeNodeDecorator);
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/CopyLineStatusRangeAction.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/CopyLineStatusRangeAction.java
index 83dc7ebd8b21..aaa512c4e674 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/CopyLineStatusRangeAction.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/CopyLineStatusRangeAction.java
@@ -35,7 +35,7 @@ public class CopyLineStatusRangeAction extends BaseLineStatusRangeAction {
}
public void actionPerformed(final AnActionEvent e) {
- final String content = myLineStatusTracker.getUpToDateContent(myRange);
+ final String content = myLineStatusTracker.getUpToDateContent(myRange).toString();
CopyPasteManager.getInstance().setContents(new StringSelection(content));
}
}
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/DocumentWrapper.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/DocumentWrapper.java
index d6362ffe19c9..1674b55ff3b6 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/DocumentWrapper.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/DocumentWrapper.java
@@ -38,21 +38,14 @@ public class DocumentWrapper {
@NotNull
public List<String> getLines() {
- return getLines(0, myDocument.getLineCount() - 1);
+ return getLines(0, getLineCount(myDocument) - 1);
}
@NotNull
public List<String> getLines(int from, int to) {
ArrayList<String> result = new ArrayList<String>();
for (int i = from; i <= to; i++) {
- if (i >= myDocument.getLineCount()) break;
- final String line = getLine(i);
- /*
- if (line.length() > 0 || i < to) {
- result.add(line);
- }
- */
- result.add(line);
+ result.add(getLine(i));
}
return result;
}
@@ -65,5 +58,9 @@ public class DocumentWrapper {
}
return myDocument.getText(range);
}
+
+ private static int getLineCount(@NotNull Document document) {
+ return Math.max(document.getLineCount(), 1);
+ }
}
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/LineStatusTracker.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/LineStatusTracker.java
index ac0bc8608368..44a56e7df517 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/LineStatusTracker.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/LineStatusTracker.java
@@ -175,10 +175,10 @@ public class LineStatusTracker {
LOG.assertTrue(!myReleased, "Already released");
int first =
- range.getOffset1() >= myDocument.getLineCount() ? myDocument.getTextLength() : myDocument.getLineStartOffset(range.getOffset1());
+ range.getOffset1() >= getLineCount(myDocument) ? myDocument.getTextLength() : myDocument.getLineStartOffset(range.getOffset1());
int second =
- range.getOffset2() >= myDocument.getLineCount() ? myDocument.getTextLength() : myDocument.getLineStartOffset(range.getOffset2());
+ range.getOffset2() >= getLineCount(myDocument) ? myDocument.getTextLength() : myDocument.getLineStartOffset(range.getOffset2());
final RangeHighlighter highlighter = DocumentMarkupModel.forDocument(myDocument, myProject, true)
.addRangeHighlighter(first, second, HighlighterLayer.FIRST - 1, null, HighlighterTargetArea.LINES_IN_RANGE);
@@ -259,6 +259,7 @@ public class LineStatusTracker {
if (range.getHighlighter() != null) {
range.getHighlighter().dispose();
}
+ range.invalidate();
}
myRanges.clear();
}
@@ -316,10 +317,10 @@ public class LineStatusTracker {
if (myBulkUpdate || myAnathemaThrown || BaseLoadState.LOADED != myBaseLoaded) return;
try {
myFirstChangedLine = myDocument.getLineNumber(e.getOffset());
- myLastChangedLine = myDocument.getLineNumber(e.getOffset() + e.getOldLength());
- myChangedLines = myLastChangedLine - myFirstChangedLine;
+ myLastChangedLine = e.getOldLength() == 0 ? myFirstChangedLine : myDocument.getLineNumber(e.getOffset() + e.getOldLength() - 1);
if (StringUtil.endsWithChar(e.getOldFragment(), '\n')) myLastChangedLine++;
- myTotalLines = e.getDocument().getLineCount();
+ myChangedLines = myLastChangedLine - myFirstChangedLine;
+ myTotalLines = getLineCount(e.getDocument());
}
catch (ProcessCanceledException ignore) {
}
@@ -334,9 +335,14 @@ public class LineStatusTracker {
if (myReleased) return;
if (myBulkUpdate || myAnathemaThrown || BaseLoadState.LOADED != myBaseLoaded) return;
try {
- int currentChangedLines = myDocument.getLineNumber(e.getOffset() + e.getNewLength()) - myDocument.getLineNumber(e.getOffset());
+ int currentFirstChangedLine = myFirstChangedLine;
+ int currentLastChangedLine =
+ e.getNewLength() == 0 ? currentFirstChangedLine : myDocument.getLineNumber(e.getOffset() + e.getNewLength() - 1);
+ if (StringUtil.endsWithChar(e.getNewFragment(), '\n')) currentLastChangedLine++;
+ int currentChangedLines = currentLastChangedLine - currentFirstChangedLine;
+ int upToDateTotalLine = getLineCount(myUpToDateDocument);
+
int linesShift = currentChangedLines - myChangedLines;
- int upToDateTotalLine = myUpToDateDocument.getLineCount();
List<Range> rangesBeforeChange = new ArrayList<Range>();
List<Range> rangesAfterChange = new ArrayList<Range>();
@@ -355,13 +361,14 @@ public class LineStatusTracker {
myLastChangedLine = lastChangedRange.getOffset2() - 1;
}
- int currentFirstLine = myFirstChangedLine;
- int currentLastLine = myLastChangedLine + linesShift;
+ currentFirstChangedLine = myFirstChangedLine;
+ currentLastChangedLine = myLastChangedLine + linesShift;
int upToDateFirstLine = getUpToDateLine1(lastRangeBefore, myFirstChangedLine);
int upToDateLastLine = getUpToDateLine2(firstRangeAfter, myLastChangedLine, myTotalLines, upToDateTotalLine);
- List<Range> newChangedRanges = getNewChangedRanges(currentFirstLine, currentLastLine, upToDateFirstLine, upToDateLastLine);
+ List<Range> newChangedRanges =
+ getNewChangedRanges(currentFirstChangedLine, currentLastChangedLine, upToDateFirstLine, upToDateLastLine);
shiftRanges(rangesAfterChange, linesShift);
@@ -426,6 +433,7 @@ public class LineStatusTracker {
range.getHighlighter().dispose();
}
range.setHighlighter(null);
+ range.invalidate();
}
for (Range range : newRangesInChange) {
range.setHighlighter(createHighlighter(range));
@@ -531,98 +539,207 @@ public class LineStatusTracker {
}
}
- public void rollbackChanges(final Range range) {
+ public void rollbackChanges(@NotNull Range range) {
myApplication.assertWriteAccessAllowed();
synchronized (myLock) {
- TextRange currentTextRange = getCurrentTextRangeWithMagic(range);
+ if (!range.isValid()) {
+ LOG.warn("Rollback of invalid range");
+ return;
+ }
+
+ if (range.getType() == Range.MODIFIED) {
+ TextRange currentTextRange = getCurrentTextRange(range);
+ int offset1 = currentTextRange.getStartOffset();
+ int offset2 = currentTextRange.getEndOffset();
- int offset1 = currentTextRange.getStartOffset();
- int offset2 = Math.min(currentTextRange.getEndOffset() + 1, myDocument.getTextLength());
- if (range.getType() == Range.INSERTED) {
- myDocument.replaceString(offset1, offset2, "");
+ CharSequence upToDateContent = getUpToDateContent(range);
+ myDocument.replaceString(offset1, offset2, upToDateContent);
+ }
+ else if (range.getType() == Range.INSERTED) {
+ TextRange currentTextRange = getCurrentTextRange(range);
+ int offset1 = currentTextRange.getStartOffset();
+ int offset2 = currentTextRange.getEndOffset();
+
+ if (offset1 > 0) {
+ offset1--;
+ }
+ else if (offset2 < myDocument.getTextLength()) {
+ offset2++;
+ }
+ myDocument.deleteString(offset1, offset2);
}
else if (range.getType() == Range.DELETED) {
- String upToDateContent = getUpToDateContentWithMagic(range);
- myDocument.insertString(offset1, upToDateContent);
+ CharSequence content = getUpToDateContent(range);
+ if (range.getOffset2() == getLineCount(myDocument)) {
+ myDocument.insertString(myDocument.getTextLength(), "\n" + content);
+ }
+ else {
+ myDocument.insertString(myDocument.getLineStartOffset(range.getOffset2()), content + "\n");
+ }
}
else {
- String upToDateContent = getUpToDateContentWithMagic(range);
- myDocument.replaceString(offset1, offset2, upToDateContent);
+ throw new IllegalArgumentException("Unknown range type: " + range.getType());
}
}
}
- public String getUpToDateContentWithMagic(Range range) {
- synchronized (myLock) {
- TextRange textRange = getUpToDateRangeWithMagic(range);
- final int startOffset = textRange.getStartOffset();
- final int endOffset = Math.min(textRange.getEndOffset() + 1, myUpToDateDocument.getTextLength());
- return myUpToDateDocument.getCharsSequence().subSequence(startOffset, endOffset).toString();
- }
- }
+ public void rollbackChanges(@NotNull SegmentTree lines) {
+ myApplication.assertWriteAccessAllowed();
- public String getUpToDateContent(Range range) {
synchronized (myLock) {
- TextRange textRange = getUpToDateRange(range);
- final int startOffset = textRange.getStartOffset();
- final int endOffset = Math.min(textRange.getEndOffset() + 1, myUpToDateDocument.getTextLength());
- return myUpToDateDocument.getCharsSequence().subSequence(startOffset, endOffset).toString();
+ List<Range> affectedRanges = new ArrayList<Range>();
+
+ boolean wasEnd = false;
+ boolean simple = true;
+ for (Range range : myRanges) {
+ if (!range.isValid()) {
+ LOG.warn("Rollback of invalid range");
+ return;
+ }
+
+ boolean check;
+ if (range.getOffset1() == range.getOffset2()) {
+ check = lines.check(range.getOffset1());
+ }
+ else {
+ check = lines.check(range.getOffset1(), range.getOffset2());
+ }
+ if (check) {
+ if (wasEnd) simple = false;
+ affectedRanges.add(range);
+ }
+ else {
+ if (!affectedRanges.isEmpty()) wasEnd = true;
+ }
+ }
+
+ if (simple) {
+ rollbackChangesSimple(affectedRanges);
+ }
+ else {
+ rollbackChangesComplex(affectedRanges);
+ }
}
}
- Project getProject() {
- return myProject;
+ private void rollbackChangesSimple(@NotNull List<Range> ranges) {
+ if (ranges.isEmpty()) return;
+
+ Range first = ranges.get(0);
+ Range last = ranges.get(ranges.size() - 1);
+
+ byte type = first == last ? first.getType() : Range.MODIFIED;
+ final Range merged = new Range(first.getOffset1(), last.getOffset2(), first.getUOffset1(), last.getUOffset2(), type);
+
+ // We don't expect complex Insertion/Deletion operation - they shouldn't exist
+ assert type != Range.MODIFIED || (first.getOffset1() != last.getOffset2() && first.getUOffset1() != last.getUOffset2());
+
+ rollbackChanges(merged);
}
- @NotNull
- TextRange getCurrentTextRangeWithMagic(@NotNull Range range) {
- return getRangeWithMagic(range.getType(), range.getOffset1(), range.getOffset2(), Range.DELETED, myDocument);
+ private void rollbackChangesComplex(@NotNull List<Range> ranges) {
+ // We can't relay on assumption, that revert of a single change will not affect any other.
+ // This, among the others, is because of 'magic' ranges for revert, that will affect nearby lines implicitly.
+ // So it's dangerous to apply ranges ony-by-one and we have to create single atomic modification.
+ // Usage of Bulk mode will lead to full rebuild of tracker, and therefore will be slow..
+
+ if (ranges.isEmpty()) return;
+ if (ranges.size() == 1) {
+ rollbackChanges(ranges.get(0));
+ return;
+ }
+
+ Range first = ranges.get(0);
+ Range last = ranges.get(ranges.size() - 1);
+
+ // We don't expect complex Insertion/Deletion operation - they shouldn't exist.
+ assert first != last && first.getOffset1() != last.getOffset2() && first.getUOffset1() != last.getUOffset2();
+
+ final int start = getCurrentTextRange(first).getStartOffset();
+ final int end = getCurrentTextRange(last).getEndOffset();
+
+ StringBuilder builder = new StringBuilder();
+
+ int lastOffset = start;
+ for (Range range : ranges) {
+ TextRange textRange = getCurrentTextRange(range);
+
+ builder.append(myDocument.getText(new TextRange(lastOffset, textRange.getStartOffset())));
+ lastOffset = textRange.getEndOffset();
+
+ if (range.getType() == Range.MODIFIED) {
+ builder.append(getUpToDateContent(range));
+ }
+ else if (range.getType() == Range.INSERTED) {
+ if (builder.length() > 0) {
+ builder.deleteCharAt(builder.length() - 1);
+ }
+ else {
+ lastOffset++;
+ }
+ }
+ else if (range.getType() == Range.DELETED) {
+ CharSequence content = getUpToDateContent(range);
+ if (range.getOffset2() == getLineCount(myDocument)) {
+ builder.append('\n').append(content);
+ }
+ else {
+ builder.append(content).append('\n');
+ }
+ }
+ else {
+ throw new IllegalArgumentException("Unknown range type: " + range.getType());
+ }
+ }
+ builder.append(myDocument.getText(new TextRange(lastOffset, end)));
+
+ final String s = builder.toString();
+
+ myDocument.replaceString(start, end, s);
}
- @NotNull
- TextRange getUpToDateRangeWithMagic(@NotNull Range range) {
- return getRangeWithMagic(range.getType(), range.getUOffset1(), range.getUOffset2(), Range.INSERTED, myUpToDateDocument);
+ public CharSequence getUpToDateContent(@NotNull Range range) {
+ synchronized (myLock) {
+ TextRange textRange = getUpToDateRange(range);
+ final int startOffset = textRange.getStartOffset();
+ final int endOffset = textRange.getEndOffset();
+ return myUpToDateDocument.getCharsSequence().subSequence(startOffset, endOffset);
+ }
}
@NotNull
TextRange getCurrentTextRange(@NotNull Range range) {
- return getRange(range.getType(), range.getOffset1(), range.getOffset2(), Range.DELETED, myDocument);
- }
+ synchronized (myLock) {
+ if (!range.isValid()) {
+ LOG.warn("Current TextRange of invalid range");
+ }
- @NotNull
- TextRange getUpToDateRange(@NotNull Range range) {
- return getRange(range.getType(), range.getUOffset1(), range.getUOffset2(), Range.INSERTED, myUpToDateDocument);
+ return getRange(range.getOffset1(), range.getOffset2(), myDocument);
+ }
}
@NotNull
- private static TextRange getRangeWithMagic(byte rangeType, int offset1, int offset2, byte emptyRangeCondition, Document document) {
- if (rangeType == emptyRangeCondition) {
- int lineStartOffset;
- if (offset1 == 0) {
- lineStartOffset = 0;
- }
- else {
- lineStartOffset = document.getLineEndOffset(offset1 - 1);
- }
- //if (lineStartOffset > 0) lineStartOffset--;
- return new TextRange(lineStartOffset, lineStartOffset);
- }
- else {
- int startOffset = document.getLineStartOffset(offset1);
- int endOffset = document.getLineEndOffset(offset2 - 1);
- if (startOffset > 0) {
- --startOffset;
- --endOffset;
+ TextRange getUpToDateRange(@NotNull Range range) {
+ synchronized (myLock) {
+ if (!range.isValid()) {
+ LOG.warn("UpToDate TextRange of invalid range");
}
- return new TextRange(startOffset, endOffset);
+
+ return getRange(range.getUOffset1(), range.getUOffset2(), myUpToDateDocument);
}
}
+ /**
+ * Return affected range, without non-internal '\n'
+ * so if last line is not empty, the last symbol will be not '\n'
+ * <p/>
+ * So we consider '\n' not as a part of line, but a separator between lines
+ */
@NotNull
- private static TextRange getRange(byte rangeType, int offset1, int offset2, byte emptyRangeCondition, Document document) {
- if (rangeType == emptyRangeCondition) {
- int lineStartOffset = offset1 < document.getLineCount() ? document.getLineStartOffset(offset1) : document.getTextLength();
+ private static TextRange getRange(int offset1, int offset2, @NotNull Document document) {
+ if (offset1 == offset2) {
+ int lineStartOffset = offset1 < getLineCount(document) ? document.getLineStartOffset(offset1) : document.getTextLength();
return new TextRange(lineStartOffset, lineStartOffset);
}
else {
@@ -643,7 +760,11 @@ public class LineStatusTracker {
}
}
- public static enum BaseLoadState {
+ Project getProject() {
+ return myProject;
+ }
+
+ public enum BaseLoadState {
LOADING,
FAILED,
LOADED
@@ -705,4 +826,8 @@ public class LineStatusTracker {
myLabel.setText("Can not highlight changed lines. File is too big and there are too many changes.");
}
}
+
+ private static int getLineCount(@NotNull Document document) {
+ return Math.max(document.getLineCount(), 1);
+ }
}
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/LineStatusTrackerDrawing.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/LineStatusTrackerDrawing.java
index 24884b4a101c..6f1cd15ef018 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/LineStatusTrackerDrawing.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/LineStatusTrackerDrawing.java
@@ -160,7 +160,7 @@ public class LineStatusTrackerDrawing {
localShowPrevAction.copyFrom(globalShowPrevAction);
final RollbackLineStatusRangeAction rollback = new RollbackLineStatusRangeAction(tracker, range, editor);
- EmptyAction.setupAction(rollback, IdeActions.CHANGES_VIEW_ROLLBACK, editorComponent);
+ EmptyAction.setupAction(rollback, IdeActions.SELECTED_CHANGES_ROLLBACK, editorComponent);
group.add(rollback);
group.add(new ShowLineStatusRangeDiffAction(tracker, range, editor));
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/Range.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/Range.java
index 5727c62f4d14..e166acd30fec 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/Range.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/Range.java
@@ -42,6 +42,8 @@ public class Range {
private final byte myType;
@Nullable private RangeHighlighter myRangeHighlighter;
+ private boolean myValid = true;
+
public static Range createOn(@NotNull Diff.Change change, int shift, int upToDateShift) {
byte type = getChangeTypeFrom(change);
@@ -158,4 +160,12 @@ public class Range {
public RangeHighlighter getHighlighter() {
return myRangeHighlighter;
}
+
+ public boolean isValid() {
+ return myValid;
+ }
+
+ public void invalidate() {
+ myValid = false;
+ }
}
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/RollbackLineStatusAction.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/RollbackLineStatusAction.java
new file mode 100644
index 000000000000..59697f1222dd
--- /dev/null
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/RollbackLineStatusAction.java
@@ -0,0 +1,136 @@
+/*
+ * Copyright 2000-2010 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.openapi.vcs.ex;
+
+import com.intellij.icons.AllIcons;
+import com.intellij.openapi.actionSystem.AnActionEvent;
+import com.intellij.openapi.actionSystem.CommonDataKeys;
+import com.intellij.openapi.application.ApplicationManager;
+import com.intellij.openapi.command.CommandProcessor;
+import com.intellij.openapi.editor.Caret;
+import com.intellij.openapi.editor.Document;
+import com.intellij.openapi.editor.Editor;
+import com.intellij.openapi.project.DumbAwareAction;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.vcs.VcsBundle;
+import com.intellij.openapi.vcs.impl.LineStatusTrackerManager;
+import com.intellij.openapi.vfs.ReadonlyStatusHandler;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.List;
+
+public class RollbackLineStatusAction extends DumbAwareAction {
+ public RollbackLineStatusAction() {
+ super("Rollback", "Rollback selected changes", AllIcons.Actions.Reset);
+ }
+
+ @Override
+ public void update(AnActionEvent e) {
+ Project project = e.getProject();
+ if (project == null) {
+ e.getPresentation().setEnabled(false);
+ return;
+ }
+ Editor editor = CommonDataKeys.EDITOR.getData(e.getDataContext());
+ if (editor == null) {
+ e.getPresentation().setEnabled(false);
+ return;
+ }
+ LineStatusTracker tracker = LineStatusTrackerManager.getInstance(project).getLineStatusTracker(editor.getDocument());
+ if (tracker == null) {
+ e.getPresentation().setEnabled(false);
+ return;
+ }
+ e.getPresentation().setEnabled(true);
+ }
+
+ @Override
+ public void actionPerformed(AnActionEvent e) {
+ Project project = e.getProject();
+ Editor editor = CommonDataKeys.EDITOR.getData(e.getDataContext());
+ LineStatusTracker tracker = LineStatusTrackerManager.getInstance(project).getLineStatusTracker(editor.getDocument());
+ if (tracker == null) return;
+
+ rollback(tracker, editor, null);
+ }
+
+ protected static void rollback(@NotNull LineStatusTracker tracker, @Nullable Editor editor, @Nullable Range range) {
+ if (range != null) {
+ doRollback(tracker, range);
+ return;
+ }
+
+ if (editor == null) return;
+ Document document = editor.getDocument();
+ int totalLines = getLineCount(document);
+
+ SegmentTree lines = new SegmentTree(totalLines + 1);
+
+ List<Caret> carets = editor.getCaretModel().getAllCarets();
+ for (Caret caret : carets) {
+ if (caret.hasSelection()) {
+ int line1 = editor.offsetToLogicalPosition(caret.getSelectionStart()).line;
+ int line2 = editor.offsetToLogicalPosition(caret.getSelectionEnd()).line;
+ lines.mark(line1, line2 + 1);
+ if (caret.getSelectionEnd() == document.getTextLength()) lines.mark(totalLines);
+ }
+ else {
+ lines.mark(caret.getLogicalPosition().line);
+ if (caret.getOffset() == document.getTextLength()) lines.mark(totalLines);
+ }
+ }
+
+ doRollback(tracker, lines);
+ }
+
+ private static void doRollback(@NotNull final LineStatusTracker tracker, @NotNull final Range range) {
+ execute(tracker, new Runnable() {
+ @Override
+ public void run() {
+ tracker.rollbackChanges(range);
+ }
+ });
+ }
+
+ private static void doRollback(@NotNull final LineStatusTracker tracker, @NotNull final SegmentTree lines) {
+ execute(tracker, new Runnable() {
+ @Override
+ public void run() {
+ tracker.rollbackChanges(lines);
+ }
+ });
+ }
+
+ private static void execute(@NotNull final LineStatusTracker tracker, @NotNull final Runnable task) {
+ // TODO: is there possible data races?
+ CommandProcessor.getInstance().executeCommand(tracker.getProject(), new Runnable() {
+ public void run() {
+ ApplicationManager.getApplication().runWriteAction(new Runnable() {
+ public void run() {
+ if (!tracker.getDocument().isWritable()) {
+ final ReadonlyStatusHandler.OperationStatus operationStatus = ReadonlyStatusHandler
+ .getInstance(tracker.getProject()).ensureFilesWritable(tracker.getVirtualFile());
+ if (operationStatus.hasReadonlyFiles()) return;
+ }
+ task.run();
+ }
+ });
+ }
+ }, VcsBundle.message("command.name.rollback.change"), null);
+ }
+
+ private static int getLineCount(@NotNull Document document) {
+ return Math.max(document.getLineCount(), 1);
+ }
+}
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/RollbackLineStatusRangeAction.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/RollbackLineStatusRangeAction.java
index ed5846d20ade..f1795b5efc3c 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/RollbackLineStatusRangeAction.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/RollbackLineStatusRangeAction.java
@@ -12,41 +12,28 @@
*/
package com.intellij.openapi.vcs.ex;
-import com.intellij.icons.AllIcons;
import com.intellij.openapi.actionSystem.AnActionEvent;
-import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.command.CommandProcessor;
import com.intellij.openapi.editor.Editor;
-import com.intellij.openapi.vcs.VcsBundle;
-import com.intellij.openapi.vfs.ReadonlyStatusHandler;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
-/**
-* @author irengrig
-*/
-public class RollbackLineStatusRangeAction extends BaseLineStatusRangeAction {
- public RollbackLineStatusRangeAction(final LineStatusTracker lineStatusTracker, final Range range, final Editor editor) {
- super(VcsBundle.message("action.name.rollback"), AllIcons.Actions.Reset, lineStatusTracker, range);
+public class RollbackLineStatusRangeAction extends RollbackLineStatusAction {
+ @NotNull private final LineStatusTracker myTracker;
+ @Nullable private final Editor myEditor;
+ @NotNull private final Range myRange;
+
+ public RollbackLineStatusRangeAction(@NotNull LineStatusTracker tracker, @NotNull Range range, @Nullable Editor editor) {
+ myTracker = tracker;
+ myEditor = editor;
+ myRange = range;
}
- public boolean isEnabled() {
- return true;
+ @Override
+ public void update(AnActionEvent e) {
+ e.getPresentation().setEnabled(true);
}
public void actionPerformed(final AnActionEvent e) {
- CommandProcessor.getInstance().executeCommand(myLineStatusTracker.getProject(), new Runnable() {
- public void run() {
- ApplicationManager.getApplication().runWriteAction(new Runnable() {
- public void run() {
- if (!myLineStatusTracker.getDocument().isWritable()) {
- final ReadonlyStatusHandler.OperationStatus operationStatus = ReadonlyStatusHandler
- .getInstance(myLineStatusTracker.getProject()).ensureFilesWritable(myLineStatusTracker.getVirtualFile());
- if (operationStatus.hasReadonlyFiles()) return;
- }
- myLineStatusTracker.rollbackChanges(myRange);
- }
- });
- }
- }, VcsBundle.message("command.name.rollback.change"), null);
-
+ rollback(myTracker, myEditor, myRange);
}
}
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/SegmentTree.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/SegmentTree.java
new file mode 100644
index 000000000000..68307129c13e
--- /dev/null
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/SegmentTree.java
@@ -0,0 +1,116 @@
+package com.intellij.openapi.vcs.ex;
+
+import org.jetbrains.annotations.Nullable;
+
+public class SegmentTree {
+ private final int myActualLength;
+ private final int myLength;
+
+ private final Node myRoot;
+
+ public SegmentTree(int length) {
+ myActualLength = length;
+ myLength = toUpperSquare(length);
+ myRoot = new Node();
+ }
+
+ public void mark(int pos) {
+ mark(pos, pos + 1);
+ }
+
+ public void mark(int start, int end) {
+ start = correct(0, myActualLength, start);
+ end = correct(0, myActualLength, end);
+
+ myRoot.mark(0, myLength, start, end);
+ }
+
+ public boolean check(int pos) {
+ return check(pos, pos + 1);
+ }
+
+ public boolean check(int start, int end) {
+ start = correct(0, myActualLength, start);
+ end = correct(0, myActualLength, end);
+
+ return myRoot.check(0, myLength, start, end);
+ }
+
+ private static int toUpperSquare(int value) {
+ int high = Integer.highestOneBit(value);
+ return high == value ? value : high * 2;
+ }
+
+ private static class Node {
+ @Nullable
+ public Node myLeft;
+
+ @Nullable
+ public Node myRight;
+
+ public boolean myMarked;
+
+ public boolean mark(int thisStart, int thisEnd, int start, int end) {
+ if (myLeft == null && myMarked) return true;
+
+ if (start == end) return false;
+
+ myMarked = true;
+
+ if (thisStart == start && thisEnd == end) {
+ myLeft = null;
+ myRight = null;
+ return true;
+ }
+
+ if (myLeft == null) {
+ myLeft = new Node();
+ myRight = new Node();
+ }
+
+ int mid = thisStart + (thisEnd - thisStart) / 2;
+ int start1 = correct(thisStart, mid, start);
+ int end1 = correct(thisStart, mid, end);
+ int start2 = correct(mid, thisEnd, start);
+ int end2 = correct(mid, thisEnd, end);
+
+ boolean marked = true;
+ marked &= myLeft.mark(thisStart, mid, start1, end1);
+ marked &= myRight.mark(mid, thisEnd, start2, end2);
+
+ if (marked) {
+ myLeft = null;
+ myRight = null;
+ }
+
+ return marked;
+ }
+
+ public boolean check(int thisStart, int thisEnd, int start, int end) {
+ if (start == end) return false;
+
+ if (thisStart == start && thisEnd == end) {
+ return myMarked;
+ }
+
+ if (myLeft == null) return myMarked;
+
+ int mid = thisStart + (thisEnd - thisStart) / 2;
+ int start1 = correct(thisStart, mid, start);
+ int end1 = correct(thisStart, mid, end);
+ int start2 = correct(mid, thisEnd, start);
+ int end2 = correct(mid, thisEnd, end);
+
+ if (myLeft.check(thisStart, mid, start1, end1)) return true;
+ if (myRight.check(mid, thisEnd, start2, end2)) return true;
+
+ return false;
+ }
+ }
+
+ private static int correct(int start, int end, int value) {
+ if (value < start) return start;
+ if (value > end) return end;
+ return value;
+ }
+}
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/ShowLineStatusRangeDiffAction.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/ShowLineStatusRangeDiffAction.java
index c5dba0cab29c..38f65446a56f 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/ShowLineStatusRangeDiffAction.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/ShowLineStatusRangeDiffAction.java
@@ -25,27 +25,22 @@ import com.intellij.openapi.util.TextRange;
import com.intellij.openapi.vcs.VcsBundle;
import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
/**
* @author irengrig
*/
public class ShowLineStatusRangeDiffAction extends BaseLineStatusRangeAction {
- public ShowLineStatusRangeDiffAction(final LineStatusTracker lineStatusTracker, final Range range, final Editor editor) {
+ public ShowLineStatusRangeDiffAction(@NotNull LineStatusTracker lineStatusTracker, @NotNull Range range, @Nullable Editor editor) {
super(VcsBundle.message("action.name.show.difference"), AllIcons.Actions.Diff, lineStatusTracker, range);
}
+ @Override
public boolean isEnabled() {
- return isModifiedRange() || isDeletedRange();
- }
-
- private boolean isDeletedRange() {
- return Range.DELETED == myRange.getType();
- }
-
- private boolean isModifiedRange() {
- return Range.MODIFIED == myRange.getType();
+ return true;
}
+ @Override
public void actionPerformed(final AnActionEvent e) {
DiffManager.getInstance().getDiffTool().show(createDiffData());
}
@@ -54,12 +49,13 @@ public class ShowLineStatusRangeDiffAction extends BaseLineStatusRangeAction {
return new DiffRequest(myLineStatusTracker.getProject()) {
@NotNull
public DiffContent[] getContents() {
+ Range range = expand(myRange, myLineStatusTracker.getDocument(), myLineStatusTracker.getUpToDateDocument());
return new DiffContent[]{
createDiffContent(myLineStatusTracker.getUpToDateDocument(),
- myLineStatusTracker.getUpToDateRange(myRange),
+ myLineStatusTracker.getUpToDateRange(range),
null),
createDiffContent(myLineStatusTracker.getDocument(),
- myLineStatusTracker.getCurrentTextRange(myRange),
+ myLineStatusTracker.getCurrentTextRange(range),
myLineStatusTracker.getVirtualFile())};
}
@@ -74,9 +70,25 @@ public class ShowLineStatusRangeDiffAction extends BaseLineStatusRangeAction {
};
}
- private DiffContent createDiffContent(final Document uDocument, final TextRange textRange, final VirtualFile file) {
+ @NotNull
+ private DiffContent createDiffContent(@NotNull Document uDocument, @NotNull TextRange textRange, @Nullable VirtualFile file) {
final Project project = myLineStatusTracker.getProject();
final DiffContent diffContent = new DocumentContent(project, uDocument);
return new FragmentContent(diffContent, textRange, project, file);
}
+
+ @NotNull
+ private static Range expand(@NotNull Range range, @NotNull Document document, @NotNull Document uDocument) {
+ if (range.getType() == Range.MODIFIED) return range;
+ if (range.getType() == Range.INSERTED || range.getType() == Range.DELETED) {
+ boolean canExpandBefore = range.getOffset1() != 0 && range.getUOffset1() != 0;
+ boolean canExpandAfter = range.getOffset2() < document.getLineCount() && range.getUOffset2() < uDocument.getLineCount();
+ int offset1 = range.getOffset1() - (canExpandBefore ? 1 : 0);
+ int uOffset1 = range.getUOffset1() - (canExpandBefore ? 1 : 0);
+ int offset2 = range.getOffset2() + (canExpandAfter ? 1 : 0);
+ int uOffset2 = range.getUOffset2() + (canExpandAfter ? 1 : 0);
+ return new Range(offset1, offset2, uOffset1, uOffset2, range.getType());
+ }
+ throw new IllegalArgumentException("Unknown range type: " + range.getType());
+ }
}
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/history/FileHistoryPanelImpl.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/history/FileHistoryPanelImpl.java
index a1fa2baeb1d2..172edc75d02a 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/history/FileHistoryPanelImpl.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/history/FileHistoryPanelImpl.java
@@ -56,6 +56,7 @@ import com.intellij.openapi.vcs.ui.ReplaceFileConfirmationDialog;
import com.intellij.openapi.vcs.versionBrowser.CommittedChangeList;
import com.intellij.openapi.vcs.vfs.VcsFileSystem;
import com.intellij.openapi.vcs.vfs.VcsVirtualFile;
+import com.intellij.openapi.vcs.vfs.VcsVirtualFolder;
import com.intellij.openapi.vfs.ReadonlyStatusHandler;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.ui.*;
@@ -1123,8 +1124,9 @@ public class FileHistoryPanelImpl extends PanelWithActionsAndCloseButton {
VcsFileRevision revision = e.getData( VcsDataKeys.VCS_FILE_REVISION );
final Boolean nonLocal = e.getData(VcsDataKeys.VCS_NON_LOCAL_HISTORY_SESSION);
- FileType fileType = revVFile == null ? null : revVFile.getFileType();
- boolean enabled = revision != null && revVFile != null && !fileType.isBinary() && ! Boolean.TRUE.equals(nonLocal);
+ boolean isFile = revVFile != null && !revVFile.isDirectory();
+ FileType fileType = isFile ? revVFile.getFileType() : null;
+ boolean enabled = revision != null && isFile && !fileType.isBinary() && !Boolean.TRUE.equals(nonLocal);
if (enabled) {
final ProjectLevelVcsManager plVcsManager = ProjectLevelVcsManager.getInstance(myVcs.getProject());
@@ -1309,7 +1311,9 @@ public class FileHistoryPanelImpl extends PanelWithActionsAndCloseButton {
private VirtualFile createVirtualFileForRevision(VcsFileRevision revision) {
if (!myRevisionToVirtualFile.containsKey(revision)) {
FilePath filePath = (revision instanceof VcsFileRevisionEx ? ((VcsFileRevisionEx)revision).getPath() : myFilePath);
- myRevisionToVirtualFile.put(revision, new VcsVirtualFile(filePath.getPath(), revision, VcsFileSystem.getInstance()));
+ myRevisionToVirtualFile.put(revision, filePath.isDirectory()
+ ? new VcsVirtualFolder(filePath.getPath(), null, VcsFileSystem.getInstance())
+ : new VcsVirtualFile(filePath.getPath(), revision, VcsFileSystem.getInstance()));
}
return myRevisionToVirtualFile.get(revision);
}
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/ModuleDefaultVcsRootPolicy.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/ModuleDefaultVcsRootPolicy.java
index 4f4efe5137a3..4b057f49b282 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/ModuleDefaultVcsRootPolicy.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/ModuleDefaultVcsRootPolicy.java
@@ -21,7 +21,6 @@ import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.components.StorageScheme;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleManager;
-import com.intellij.openapi.module.ModuleUtil;
import com.intellij.openapi.module.ModuleUtilCore;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.project.ex.ProjectEx;
@@ -35,7 +34,6 @@ import com.intellij.openapi.vcs.changes.FilePathUnderVcs;
import com.intellij.openapi.vcs.changes.VcsGuess;
import com.intellij.openapi.vcs.ex.ProjectLevelVcsManagerEx;
import com.intellij.openapi.vcs.impl.projectlevelman.NewMappings;
-import com.intellij.openapi.vfs.VfsUtil;
import com.intellij.openapi.vfs.VfsUtilCore;
import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.annotations.NotNull;
@@ -102,10 +100,7 @@ public class ModuleDefaultVcsRootPolicy extends DefaultVcsRootPolicy {
if (matchContext != null) {
return true;
}
- if (myBaseDir != null && VfsUtilCore.isAncestor(myBaseDir, file, false)) {
- return !ProjectRootManager.getInstance(myProject).getFileIndex().isIgnored(file);
- }
- return false;
+ return myBaseDir != null && VfsUtilCore.isAncestor(myBaseDir, file, false);
}
@Override
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/ProjectLevelVcsManagerImpl.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/ProjectLevelVcsManagerImpl.java
index cbf9d2b1889a..5cc3a8a9ca92 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/ProjectLevelVcsManagerImpl.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/ProjectLevelVcsManagerImpl.java
@@ -135,7 +135,7 @@ public class ProjectLevelVcsManagerImpl extends ProjectLevelVcsManagerEx impleme
myMappings = new NewMappings(myProject, myMessageBus, this, manager, excludedFileIndex);
myMappingsToRoots = new MappingsToRoots(myMappings, myProject);
- if (! myProject.isDefault()) {
+ if (!myProject.isDefault()) {
myVcsEventListenerManager = new VcsEventsListenerManagerImpl();
}
@@ -203,7 +203,7 @@ public class ProjectLevelVcsManagerImpl extends ProjectLevelVcsManagerEx impleme
}
public boolean haveVcses() {
- return ! AllVcses.getInstance(myProject).isEmpty();
+ return !AllVcses.getInstance(myProject).isEmpty();
}
@Override
@@ -356,7 +356,7 @@ public class ProjectLevelVcsManagerImpl extends ProjectLevelVcsManagerEx impleme
}
public void unregisterVcs(AbstractVcs vcs) {
- if (! ApplicationManager.getApplication().isUnitTestMode() && myMappings.haveActiveVcs(vcs.getName())) {
+ if (!ApplicationManager.getApplication().isUnitTestMode() && myMappings.haveActiveVcs(vcs.getName())) {
// unlikely
LOG.warn("Active vcs '" + vcs.getName() + "' is being unregistered. Remove from mappings first.");
}
@@ -391,7 +391,7 @@ public class ProjectLevelVcsManagerImpl extends ProjectLevelVcsManagerEx impleme
@Override
public boolean hasAnyMappings() {
- return ! myMappings.isEmpty();
+ return !myMappings.isEmpty();
}
@Override
@@ -452,7 +452,7 @@ public class ProjectLevelVcsManagerImpl extends ProjectLevelVcsManagerEx impleme
private void releaseEditor() {
if (myEditorAdapter != null) {
final Editor editor = myEditorAdapter.getEditor();
- if (! editor.isDisposed()) {
+ if (!editor.isDisposed()) {
EditorFactory.getInstance().releaseEditor(editor);
}
}
@@ -472,7 +472,7 @@ public class ProjectLevelVcsManagerImpl extends ProjectLevelVcsManagerEx impleme
@Override
@NotNull
public VcsShowSettingOption getStandardOption(@NotNull VcsConfiguration.StandardOption option, @NotNull AbstractVcs vcs) {
- final VcsShowOptionsSettingImpl options = (VcsShowOptionsSettingImpl) getOptions(option);
+ final VcsShowOptionsSettingImpl options = (VcsShowOptionsSettingImpl)getOptions(option);
options.addApplicableVcs(vcs);
return options;
}
@@ -490,7 +490,7 @@ public class ProjectLevelVcsManagerImpl extends ProjectLevelVcsManagerEx impleme
@Override
public UpdateInfoTree showUpdateProjectInfo(UpdatedFiles updatedFiles, String displayActionName, ActionInfo actionInfo, boolean canceled) {
- if (! myProject.isOpen() || myProject.isDisposed()) return null;
+ if (!myProject.isOpen() || myProject.isDisposed()) return null;
ContentManager contentManager = getContentManager();
if (contentManager == null) {
return null; // content manager is made null during dispose; flag is set later
@@ -537,7 +537,7 @@ public class ProjectLevelVcsManagerImpl extends ProjectLevelVcsManagerEx impleme
public boolean hasExplicitMapping(final VirtualFile vFile) {
final VcsDirectoryMapping mapping = myMappings.getMappingFor(vFile);
- return mapping != null && ! mapping.isDefaultMapping();
+ return mapping != null && !mapping.isDefaultMapping();
}
@Override
@@ -687,7 +687,7 @@ public class ProjectLevelVcsManagerImpl extends ProjectLevelVcsManagerEx impleme
final AbstractVcs[] vcses = myMappings.getActiveVcses();
for (AbstractVcs vcs : vcses) {
final VirtualFile[] roots = getRootsUnderVcs(vcs);
- for(VirtualFile root: roots) {
+ for (VirtualFile root : roots) {
vcsRoots.add(new VcsRoot(vcs, root));
}
}
@@ -708,10 +708,8 @@ public class ProjectLevelVcsManagerImpl extends ProjectLevelVcsManagerEx impleme
myMappings.clear();
final List<VcsDirectoryMapping> mappingsList = new ArrayList<VcsDirectoryMapping>();
- final List list = element.getChildren(ELEMENT_MAPPING);
boolean haveNonEmptyMappings = false;
- for(Object childObj: list) {
- Element child = (Element) childObj;
+ for (Element child : element.getChildren(ELEMENT_MAPPING)) {
final String vcs = child.getAttributeValue(ATTRIBUTE_VCS);
if (vcs != null && !vcs.isEmpty()) {
haveNonEmptyMappings = true;
@@ -729,8 +727,9 @@ public class ProjectLevelVcsManagerImpl extends ProjectLevelVcsManagerEx impleme
try {
rootSettings.readExternal(rootSettingsElement);
mapping.setRootSettings(rootSettings);
- } catch (InvalidDataException e) {
- LOG.error("Failed to load VCS root settings class "+ className + " for VCS " + vcsInstance.getClass().getName(), e);
+ }
+ catch (InvalidDataException e) {
+ LOG.error("Failed to load VCS root settings class " + className + " for VCS " + vcsInstance.getClass().getName(), e);
}
}
}
@@ -748,7 +747,7 @@ public class ProjectLevelVcsManagerImpl extends ProjectLevelVcsManagerEx impleme
if (myProject.isDefault()) {
element.setAttribute(ATTRIBUTE_DEFAULT_PROJECT, Boolean.TRUE.toString());
}
- for(VcsDirectoryMapping mapping: getDirectoryMappings()) {
+ for (VcsDirectoryMapping mapping : getDirectoryMappings()) {
Element child = new Element(ELEMENT_MAPPING);
child.setAttribute(ATTRIBUTE_DIRECTORY, mapping.getDirectory());
child.setAttribute(ATTRIBUTE_VCS, mapping.getVcs());
@@ -803,7 +802,7 @@ public class ProjectLevelVcsManagerImpl extends ProjectLevelVcsManagerEx impleme
@Override
public void fireDirectoryMappingsChanged() {
- if (myProject.isOpen() && ! myProject.isDisposed()) {
+ if (myProject.isOpen() && !myProject.isDisposed()) {
myMappings.mappingsChanged();
}
}
@@ -844,7 +843,7 @@ public class ProjectLevelVcsManagerImpl extends ProjectLevelVcsManagerEx impleme
@Override
public Boolean compute() {
return vf != null && (myExcludedIndex.isInContent(vf) || isFileInBaseDir(vf) || vf.equals(myProject.getBaseDir()) ||
- hasExplicitMapping(vf) || isInDirectoryBasedRoot(vf)) && ! myExcludedIndex.isExcludedFile(vf);
+ hasExplicitMapping(vf) || isInDirectoryBasedRoot(vf)) && !myExcludedIndex.isExcludedFile(vf);
}
});
}
@@ -862,7 +861,7 @@ public class ProjectLevelVcsManagerImpl extends ProjectLevelVcsManagerEx impleme
private boolean isInDirectoryBasedRoot(final VirtualFile file) {
if (file == null) return false;
- final StorageScheme storageScheme = ((ProjectEx) myProject).getStateStore().getStorageScheme();
+ final StorageScheme storageScheme = ((ProjectEx)myProject).getStateStore().getStorageScheme();
if (StorageScheme.DIRECTORY_BASED.equals(storageScheme)) {
final VirtualFile baseDir = myProject.getBaseDir();
if (baseDir == null) return false;
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/VcsRootIterator.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/VcsRootIterator.java
index 8caa6f2bc981..122988896cb2 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/VcsRootIterator.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/VcsRootIterator.java
@@ -54,12 +54,10 @@ public class VcsRootIterator {
public boolean acceptFolderUnderVcs(final VirtualFile vcsRoot, final VirtualFile file) {
final String vcsUrl = vcsRoot.getUrl();
final MyRootFilter rootFilter = myOtherVcsFolders.get(vcsUrl);
- if ((rootFilter != null) && (! rootFilter.accept(file))) {
+ if ((rootFilter != null) && (!rootFilter.accept(file))) {
return false;
}
- final Boolean excluded = isExcluded(myExcludedFileIndex, file);
- if (excluded) return false;
- return true;
+ return !isExcluded(myExcludedFileIndex, file);
}
private static boolean isExcluded(final FileIndexFacade indexFacade, final VirtualFile file) {
@@ -128,9 +126,9 @@ public class VcsRootIterator {
}
public static void iterateVcsRoot(final Project project,
- final VirtualFile root,
- final Processor<FilePath> processor,
- @Nullable VirtualFileFilter directoryFilter) {
+ final VirtualFile root,
+ final Processor<FilePath> processor,
+ @Nullable VirtualFileFilter directoryFilter) {
final MyRootIterator rootIterator = new MyRootIterator(project, root, processor, null, directoryFilter);
rootIterator.iterate();
}
@@ -177,9 +175,9 @@ public class VcsRootIterator {
@Override
public Result visitFileEx(@NotNull VirtualFile file) {
if (isExcluded(myExcludedFileIndex, file)) return SKIP_CHILDREN;
- if (myRootPresentFilter != null && ! myRootPresentFilter.accept(file)) return SKIP_CHILDREN;
- if (myProject.isDisposed() || ! process(file)) return skipTo(myRoot);
- if (myDirectoryFilter != null && file.isDirectory() && ! myDirectoryFilter.shouldGoIntoDirectory(file)) return SKIP_CHILDREN;
+ if (myRootPresentFilter != null && !myRootPresentFilter.accept(file)) return SKIP_CHILDREN;
+ if (myProject.isDisposed() || !process(file)) return skipTo(myRoot);
+ if (myDirectoryFilter != null && file.isDirectory() && !myDirectoryFilter.shouldGoIntoDirectory(file)) return SKIP_CHILDREN;
return CONTINUE;
}
});
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/projectlevelman/NewMappings.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/projectlevelman/NewMappings.java
index de1a40d80f36..32fe920fc4db 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/projectlevelman/NewMappings.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/projectlevelman/NewMappings.java
@@ -53,30 +53,31 @@ public class NewMappings {
private final DefaultVcsRootPolicy myDefaultVcsRootPolicy;
private final MessageBus myMessageBus;
private final FileStatusManager myFileStatusManager;
- private final FileIndexFacade myExcludedFileIndex;
+ private final FileIndexFacade myFileIndexFacade;
private final Project myProject;
private boolean myActivated;
public NewMappings(final Project project, final MessageBus messageBus,
- final ProjectLevelVcsManagerImpl vcsManager, FileStatusManager fileStatusManager, FileIndexFacade excludedFileIndex) {
+ final ProjectLevelVcsManagerImpl vcsManager, FileStatusManager fileStatusManager, FileIndexFacade fileIndexFacade) {
myProject = project;
myMessageBus = messageBus;
myFileStatusManager = fileStatusManager;
- myExcludedFileIndex = excludedFileIndex;
+ myFileIndexFacade = fileIndexFacade;
myLock = new Object();
myVcsToPaths = new HashMap<String, List<VcsDirectoryMapping>>();
myFileWatchRequestsManager = new FileWatchRequestsManager(myProject, this, LocalFileSystem.getInstance());
myDefaultVcsRootPolicy = DefaultVcsRootPolicy.getInstance(project);
myActiveVcses = new AbstractVcs[0];
- if (! myProject.isDefault()) {
+ if (!myProject.isDefault()) {
final ArrayList<VcsDirectoryMapping> listStr = new ArrayList<VcsDirectoryMapping>();
final VcsDirectoryMapping mapping = new VcsDirectoryMapping("", "");
listStr.add(mapping);
myVcsToPaths.put("", listStr);
- mySortedMappings = new VcsDirectoryMapping[] {mapping};
- } else {
+ mySortedMappings = new VcsDirectoryMapping[]{mapping};
+ }
+ else {
mySortedMappings = VcsDirectoryMapping.EMPTY_ARRAY;
}
myActivated = false;
@@ -131,7 +132,6 @@ public class NewMappings {
return;
}
}
-
}
final Ref<Boolean> switched = new Ref<Boolean>(Boolean.FALSE);
@@ -139,7 +139,7 @@ public class NewMappings {
public void run() {
// sorted -> map. sorted mappings are NOT changed;
switched.set(trySwitchVcs(path, activeVcsName));
- if (! switched.get().booleanValue()) {
+ if (!switched.get().booleanValue()) {
final List<VcsDirectoryMapping> newList = listForVcsFromMap(newMapping.getVcs());
newList.add(newMapping);
sortedMappingsByMap();
@@ -153,7 +153,7 @@ public class NewMappings {
private void keepActiveVcs(@NotNull Runnable runnable) {
final MyVcsActivator activator;
synchronized (myLock) {
- if (! myActivated) {
+ if (!myActivated) {
runnable.run();
return;
}
@@ -204,7 +204,8 @@ public class NewMappings {
final List<VcsDirectoryMapping> itemsCopy;
if (items.isEmpty()) {
itemsCopy = Collections.singletonList(new VcsDirectoryMapping("", ""));
- } else {
+ }
+ else {
itemsCopy = items;
}
@@ -224,7 +225,7 @@ public class NewMappings {
@Nullable
public VcsDirectoryMapping getMappingFor(@Nullable VirtualFile file) {
if (file == null) return null;
- if (! file.isInLocalFileSystem()) {
+ if (!file.isInLocalFileSystem()) {
return null;
}
@@ -232,17 +233,22 @@ public class NewMappings {
}
@Nullable
- public VcsDirectoryMapping getMappingFor(final VirtualFile file, final Object matchContext) {
+ public VcsDirectoryMapping getMappingFor(final VirtualFile file, final Object parentModule) {
+ // if parentModule is not null it means that file belongs to the module so it isn't excluded
+ if (parentModule == null && myFileIndexFacade.isExcludedFile(file)) {
+ return null;
+ }
+
// performance: calculate file path just once, rather than once per mapping
String path = file.getPath();
- final String systemIndependentPath = FileUtil.toSystemIndependentName((file.isDirectory() && (! path.endsWith("/"))) ? (path + "/") : path);
+ final String systemIndependentPath = FileUtil.toSystemIndependentName((file.isDirectory() && (!path.endsWith("/"))) ? (path + "/") : path);
final VcsDirectoryMapping[] mappings;
synchronized (myLock) {
mappings = mySortedMappings;
}
- for (int i = mappings.length - 1; i >= 0; -- i) {
+ for (int i = mappings.length - 1; i >= 0; --i) {
final VcsDirectoryMapping mapping = mappings[i];
- if (fileMatchesMapping(file, matchContext, systemIndependentPath, mapping)) {
+ if (fileMatchesMapping(file, parentModule, systemIndependentPath, mapping)) {
return mapping;
}
}
@@ -258,12 +264,14 @@ public class NewMappings {
return mapping.getVcs();
}
- private boolean fileMatchesMapping(final VirtualFile file, final Object matchContext, final String systemIndependentPath, final VcsDirectoryMapping mapping) {
+ private boolean fileMatchesMapping(final VirtualFile file,
+ final Object matchContext,
+ final String systemIndependentPath,
+ final VcsDirectoryMapping mapping) {
if (mapping.getDirectory().length() == 0) {
return myDefaultVcsRootPolicy.matchesDefaultMapping(file, matchContext);
}
- return FileUtil.startsWith(systemIndependentPath, mapping.systemIndependentPath()) &&
- ! myExcludedFileIndex.isExcludedFile(file);
+ return FileUtil.startsWith(systemIndependentPath, mapping.systemIndependentPath());
}
public List<VirtualFile> getMappingsAsFilesUnderVcs(final AbstractVcs vcs) {
@@ -281,7 +289,8 @@ public class NewMappings {
if (mapping.isDefaultMapping()) {
// todo callback here; don't like it
myDefaultVcsRootPolicy.addDefaultVcsRoots(this, vcsName, result);
- } else {
+ }
+ else {
final VirtualFile file = LocalFileSystem.getInstance().findFileByPath(mapping.getDirectory());
if (file != null) {
result.add(file);
@@ -307,7 +316,7 @@ public class NewMappings {
private void clearImpl() {
// if vcses were not mapped, there's nothing to clear
- if ((myActiveVcses == null) || (myActiveVcses.length == 0)) return;
+ if ((myActiveVcses == null) || (myActiveVcses.length == 0)) return;
keepActiveVcs(new Runnable() {
public void run() {
@@ -374,7 +383,7 @@ public class NewMappings {
final LocalFileSystem lfs = LocalFileSystem.getInstance();
final AllVcsesI allVcses = AllVcses.getInstance(myProject);
- for (Iterator<String> iterator = myVcsToPaths.keySet().iterator(); iterator.hasNext();) {
+ for (Iterator<String> iterator = myVcsToPaths.keySet().iterator(); iterator.hasNext(); ) {
final String vcsName = iterator.next();
final List<VcsDirectoryMapping> mappings = myVcsToPaths.get(vcsName);
@@ -399,8 +408,9 @@ public class NewMappings {
};
if (StringUtil.isEmptyOrSpaces(vcsName)) {
filteredFiles = AbstractVcs.filterUniqueRootsDefault(objects, fileConvertor);
- } else {
- final AbstractVcs vcs = allVcses.getByName(vcsName);
+ }
+ else {
+ final AbstractVcs<?> vcs = allVcses.getByName(vcsName);
if (vcs == null) {
VcsBalloonProblemNotifier.showOverChangesView(myProject, "VCS plugin not found for mapping to : '" + vcsName + "'", MessageType.ERROR);
continue;
@@ -420,7 +430,8 @@ public class NewMappings {
if (filteredMappings.isEmpty()) {
iterator.remove();
- } else {
+ }
+ else {
mappings.clear();
mappings.addAll(filteredMappings);
}
@@ -434,7 +445,7 @@ public class NewMappings {
for (VcsDirectoryMapping mapping : mySortedMappings) {
if (mapping.systemIndependentPath().equals(fixedPath)) {
final String oldVcs = mapping.getVcs();
- if (! oldVcs.equals(activeVcsName)) {
+ if (!oldVcs.equals(activeVcsName)) {
migrateVcs(activeVcsName, mapping, oldVcs);
}
return true;
@@ -489,7 +500,7 @@ public class NewMappings {
return ourInstance;
}
- public int compare(VcsDirectoryMapping m1, VcsDirectoryMapping m2) {
+ public int compare(@NotNull VcsDirectoryMapping m1, @NotNull VcsDirectoryMapping m2) {
return m1.getDirectory().compareTo(m2.getDirectory());
}
}
@@ -514,7 +525,8 @@ public class NewMappings {
catch (VcsException e) {
// actually is not thrown (AbstractVcs#actualActivate())
}
- } else {
+ }
+ else {
LOG.info("Error: activating non existing vcs: " + s);
}
}
@@ -529,7 +541,8 @@ public class NewMappings {
catch (VcsException e) {
// actually is not thrown (AbstractVcs#actualDeactivate())
}
- } else {
+ }
+ else {
LOG.info("Error: removing non existing vcs: " + s);
}
}
@@ -543,7 +556,7 @@ public class NewMappings {
// omit empty vcs: not a vcs
if (topItem.trim().length() == 0) continue;
- if (! bottom.contains(topItem)) {
+ if (!bottom.contains(topItem)) {
if (notInBottom == null) {
notInBottom = new HashSet<String>();
}
@@ -589,7 +602,8 @@ public class NewMappings {
public void invoke() {
if (myItems.isEmpty()) {
myItemsCopy = Collections.singletonList(new VcsDirectoryMapping("", ""));
- } else {
+ }
+ else {
myItemsCopy = myItems;
}
}
@@ -606,8 +620,9 @@ public class NewMappings {
myDefaultVcsRootPolicy.addDefaultVcsRoots(this, defaultVcs, list);
if (StringUtil.isEmptyOrSpaces(defaultVcs)) {
return AbstractVcs.filterUniqueRootsDefault(list, Convertor.SELF);
- } else {
- final AbstractVcs vcs = AllVcses.getInstance(myProject).getByName(defaultVcs);
+ }
+ else {
+ final AbstractVcs<?> vcs = AllVcses.getInstance(myProject).getByName(defaultVcs);
if (vcs == null) {
return AbstractVcs.filterUniqueRootsDefault(list, Convertor.SELF);
}
diff --git a/platform/vcs-log/api/src/com/intellij/vcs/log/VcsLogRefManager.java b/platform/vcs-log/api/src/com/intellij/vcs/log/VcsLogRefManager.java
index 735ad0060b88..39b001f279b8 100644
--- a/platform/vcs-log/api/src/com/intellij/vcs/log/VcsLogRefManager.java
+++ b/platform/vcs-log/api/src/com/intellij/vcs/log/VcsLogRefManager.java
@@ -3,6 +3,7 @@ package com.intellij.vcs.log;
import org.jetbrains.annotations.NotNull;
import java.util.Collection;
+import java.util.Comparator;
import java.util.List;
/**
@@ -16,11 +17,16 @@ import java.util.List;
public interface VcsLogRefManager {
/**
- * Sorts the given references.
- * TODO better provide compareTo
+ * Return the comparator which compares two given references in terms of their "importance",
+ * which is later is used in the log to order branches and branch labels.
+ * <p><ul>
+ * <li>Negative value is returned if first reference is <b>more</b> important than the second (i.e. it will be at the left in the log).
+ * <li>Positive value is returned if first reference is <b>less</b> important than the second (i.e. it will be at the right in the log).
+ * <li>Zero is returned if referenced are considered equally important.
+ * </ul>
*/
@NotNull
- List<VcsRef> sort(Collection<VcsRef> refs);
+ Comparator<VcsRef> getComparator();
/**
* <p>Groups VCS references to show them on the branches panel.</p>
diff --git a/platform/vcs-log/api/src/com/intellij/vcs/log/graph/GraphColorManager.java b/platform/vcs-log/api/src/com/intellij/vcs/log/graph/GraphColorManager.java
index e4e9b87ad4e3..496329ec5190 100644
--- a/platform/vcs-log/api/src/com/intellij/vcs/log/graph/GraphColorManager.java
+++ b/platform/vcs-log/api/src/com/intellij/vcs/log/graph/GraphColorManager.java
@@ -36,11 +36,20 @@ public interface GraphColorManager<CommitId> {
int getColorOfFragment(CommitId headCommit, int magicIndex);
/**
- * Returns 1, 0 or -1 if branch identified by commit {@code head1} is "more powerful", "equally powerful" or "less powerful"
- * than the branch identified by commit {@code head2}.
- * <p/>
- * If branch1 is more powerful than branch2, it means that its color will be reused by the subgraph below the point when these branches
+ * Compares two head commits in terms of "importance" of reference labels pointing to these commits.
+ * It is used to order branches, branch labels, and for branch coloring. <br/>
+ * E.g. if branch1 is more important than branch2, its color will be reused by the subgraph below the point when these branches
* were diverged.
+ * <p/>
+ * Then head1 is more important than head2, if its most important reference is more important than head2's most important reference
+ * (if they are the same, next are compared).
+ * <p/>
+ * References are compared by the following logic (see {@link com.intellij.vcs.log.VcsLogRefManager}: <ul>
+ * <li>Negative value is returned if first reference is <b>more</b> important than the second (i.e. it will be at the left in the log).
+ * <li>Positive value is returned if first reference is <b>less</b> important than the second (i.e. it will be at the right in the log).
+ * <li>Zero is returned if referenced are considered equally important.
+ * </ul>
+ * <p>
*/
int compareHeads(CommitId head1, CommitId head2); // todo drop this
diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/graph/GraphColorManagerImpl.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/graph/GraphColorManagerImpl.java
index c14ee206c954..ec74038a66e4 100644
--- a/platform/vcs-log/impl/src/com/intellij/vcs/log/graph/GraphColorManagerImpl.java
+++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/graph/GraphColorManagerImpl.java
@@ -26,8 +26,7 @@ import com.intellij.vcs.log.VcsRef;
import com.intellij.vcs.log.data.RefsModel;
import org.jetbrains.annotations.NotNull;
-import java.util.Collection;
-import java.util.Map;
+import java.util.*;
public class GraphColorManagerImpl implements GraphColorManager<Integer> {
@@ -59,7 +58,7 @@ public class GraphColorManagerImpl implements GraphColorManager<Integer> {
if (isEmptyRefs(refs, headCommit)) {
return DEFAULT_COLOR;
}
- VcsRef firstRef = getRefManager(refs).sort(refs).get(0);
+ VcsRef firstRef = ContainerUtil.sorted(refs, getRefManager(refs).getComparator()).get(0);
// TODO dark variant
return firstRef.getName().hashCode();
}
@@ -94,28 +93,36 @@ public class GraphColorManagerImpl implements GraphColorManager<Integer> {
return 0;
}
if (firstEmpty) {
- return -1;
+ return 1;
}
if (secondEmpty) {
- return 1;
+ return -1;
}
VcsLogRefManager refManager1 = getRefManager(refs1);
VcsLogRefManager refManager2 = getRefManager(refs2);
- if (!refManager1.equals(refManager2)) {
+ if (!refManager1.equals(refManager2)) { // heads from different VCSs are not comparable => are considered equal for now
return 0;
}
- Map<VcsRef, Boolean> positions = ContainerUtil.newHashMap();
- for (VcsRef ref : refs1) {
- positions.put(ref, true);
+ Comparator<VcsRef> comparator = refManager1.getComparator();
+ Iterator<VcsRef> it1 = ContainerUtil.sorted(refs1, comparator).iterator();
+ Iterator<VcsRef> it2 = ContainerUtil.sorted(refs2, comparator).iterator();
+ while (it1.hasNext() && it2.hasNext()) {
+ VcsRef ref1 = it1.next();
+ VcsRef ref2 = it2.next();
+ int compare = comparator.compare(ref1, ref2);
+ if (compare != 0) {
+ return compare;
+ }
}
- for (VcsRef ref : refs2) {
- positions.put(ref, false);
+ if (it1.hasNext()) {
+ return -1;
}
-
- VcsRef firstRef = refManager1.sort(positions.keySet()).get(0);
- return positions.get(firstRef) ? 1 : -1;
+ if (it2.hasNext()) {
+ return 1;
+ }
+ return 0;
}
@NotNull
diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/filter/StructureFilterPopupComponent.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/filter/StructureFilterPopupComponent.java
index 3ac9464002bc..c134b1aa330d 100644
--- a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/filter/StructureFilterPopupComponent.java
+++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/filter/StructureFilterPopupComponent.java
@@ -32,7 +32,6 @@ import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Collections;
import java.util.List;
class StructureFilterPopupComponent extends FilterPopupComponent<VcsLogStructureFilter> {
@@ -89,13 +88,7 @@ class StructureFilterPopupComponent extends FilterPopupComponent<VcsLogStructure
return tooltip;
}
- @NotNull
- private static <T> Collection<T> notNullize(@Nullable Collection<T> items) {
- return items != null ? items : Collections.<T>emptyList();
- }
-
private class SelectAction extends DumbAwareAction {
-
SelectAction() {
super("Select...");
}
@@ -108,7 +101,7 @@ class StructureFilterPopupComponent extends FilterPopupComponent<VcsLogStructure
new ArrayList<VirtualFile>(myRoots));
if (chooser.showAndGet()) {
myFiles.clear();
- myFiles.addAll(notNullize(chooser.getSelectedFiles()));
+ myFiles.addAll(ContainerUtil.notNullize(chooser.getSelectedFiles()));
setValue(myFiles);
applyFilters();
}
diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/DetailsPanel.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/DetailsPanel.java
index d963bb3aedaa..dc876657c428 100644
--- a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/DetailsPanel.java
+++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/DetailsPanel.java
@@ -11,6 +11,7 @@ import com.intellij.ui.ScrollPaneFactory;
import com.intellij.ui.components.JBLabel;
import com.intellij.ui.components.JBLoadingPanel;
import com.intellij.ui.components.JBTextField;
+import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.text.DateFormatUtil;
import com.intellij.util.ui.AsyncProcessIcon;
import com.intellij.util.ui.UIUtil;
@@ -146,7 +147,7 @@ class DetailsPanel extends JPanel implements ListSelectionListener {
@NotNull
private List<VcsRef> sortRefs(@NotNull Hash hash, @NotNull VirtualFile root) {
Collection<VcsRef> refs = myDataPack.getRefsModel().refsToCommit(hash);
- return myLogDataHolder.getLogProvider(root).getReferenceManager().sort(refs);
+ return ContainerUtil.sorted(refs, myLogDataHolder.getLogProvider(root).getReferenceManager().getComparator());
}
private static class DataPanel extends JEditorPane {
diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/VcsLogGraphTable.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/VcsLogGraphTable.java
index 11e9c843fc60..f033f752e1ec 100644
--- a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/VcsLogGraphTable.java
+++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/VcsLogGraphTable.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2000-2014 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.vcs.log.ui.frame;
import com.intellij.ide.CopyProvider;
@@ -175,7 +190,7 @@ public class VcsLogGraphTable extends JBTable implements TypeSafeDataProvider, C
}
@Override
- protected void paintComponent(Graphics g) {
+ protected void paintComponent(@NotNull Graphics g) {
if (myRepaintFreezedCounter.get() > 0) {
return;
}
diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/render/AbstractPaddingCellRender.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/render/AbstractPaddingCellRender.java
index 973252db6af6..23c736b4420b 100644
--- a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/render/AbstractPaddingCellRender.java
+++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/render/AbstractPaddingCellRender.java
@@ -107,7 +107,7 @@ public abstract class AbstractPaddingCellRender extends ColoredTableCellRenderer
return Collections.emptyMap();
}
VirtualFile root = refs.iterator().next().getRoot(); // all refs are from the same commit => they have the same root
- refs = myDataHolder.getLogProvider(root).getReferenceManager().sort(refs);
+ refs = ContainerUtil.sorted(refs, myDataHolder.getLogProvider(root).getReferenceManager().getComparator());
List<VcsRef> branches = getBranches(refs);
Collection<VcsRef> tags = ContainerUtil.subtract(refs, branches);
return getLabelsForRefs(branches, tags);
diff --git a/platform/vcs-log/impl/test/com/intellij/vcs/log/impl/TestVcsLogProvider.java b/platform/vcs-log/impl/test/com/intellij/vcs/log/impl/TestVcsLogProvider.java
index 08fae0c8822f..d3709b2d8f55 100644
--- a/platform/vcs-log/impl/test/com/intellij/vcs/log/impl/TestVcsLogProvider.java
+++ b/platform/vcs-log/impl/test/com/intellij/vcs/log/impl/TestVcsLogProvider.java
@@ -27,6 +27,7 @@ import org.jetbrains.annotations.Nullable;
import java.awt.*;
import java.util.Collection;
+import java.util.Comparator;
import java.util.List;
import java.util.Set;
import java.util.concurrent.Semaphore;
@@ -200,8 +201,13 @@ public class TestVcsLogProvider implements VcsLogProvider {
private static class MockRefManager implements VcsLogRefManager {
@NotNull
@Override
- public List<VcsRef> sort(Collection<VcsRef> refs) {
- return ContainerUtil.newArrayList(refs);
+ public Comparator<VcsRef> getComparator() {
+ return new Comparator<VcsRef>() {
+ @Override
+ public int compare(VcsRef o1, VcsRef o2) {
+ return 0;
+ }
+ };
}
@NotNull
diff --git a/platform/xdebugger-api/src/com/intellij/xdebugger/XDebuggerBundle.java b/platform/xdebugger-api/src/com/intellij/xdebugger/XDebuggerBundle.java
index a9594ca27ba7..23a262c32654 100644
--- a/platform/xdebugger-api/src/com/intellij/xdebugger/XDebuggerBundle.java
+++ b/platform/xdebugger-api/src/com/intellij/xdebugger/XDebuggerBundle.java
@@ -29,7 +29,6 @@ import java.util.ResourceBundle;
* @author nik
*/
public class XDebuggerBundle {
-
public static String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, @NotNull Object... params) {
return CommonBundle.message(getBundle(), key, params);
}
diff --git a/platform/xdebugger-api/src/com/intellij/xdebugger/breakpoints/XBreakpointType.java b/platform/xdebugger-api/src/com/intellij/xdebugger/breakpoints/XBreakpointType.java
index a6857c67c8d8..4f9ff38d6583 100644
--- a/platform/xdebugger-api/src/com/intellij/xdebugger/breakpoints/XBreakpointType.java
+++ b/platform/xdebugger-api/src/com/intellij/xdebugger/breakpoints/XBreakpointType.java
@@ -103,6 +103,16 @@ public abstract class XBreakpointType<B extends XBreakpoint<P>, P extends XBreak
return AllIcons.Debugger.Db_disabled_breakpoint;
}
+ @NotNull
+ public Icon getMutedEnabledIcon() {
+ return AllIcons.Debugger.Db_muted_breakpoint;
+ }
+
+ @NotNull
+ public Icon getMutedDisabledIcon() {
+ return AllIcons.Debugger.Db_muted_disabled_breakpoint;
+ }
+
/**
* @return the icon which is shown for a dependent breakpoint until its master breakpoint is reached
*/
diff --git a/platform/xdebugger-api/src/com/intellij/xdebugger/evaluation/XDebuggerEvaluator.java b/platform/xdebugger-api/src/com/intellij/xdebugger/evaluation/XDebuggerEvaluator.java
index 3065a2e05dba..098501af7489 100644
--- a/platform/xdebugger-api/src/com/intellij/xdebugger/evaluation/XDebuggerEvaluator.java
+++ b/platform/xdebugger-api/src/com/intellij/xdebugger/evaluation/XDebuggerEvaluator.java
@@ -26,6 +26,7 @@ import com.intellij.xdebugger.breakpoints.XBreakpoint;
import com.intellij.xdebugger.frame.XSuspendContext;
import com.intellij.xdebugger.frame.XValue;
import com.intellij.xdebugger.frame.XValueCallback;
+import com.intellij.xdebugger.settings.XDebuggerSettingsManager;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -167,7 +168,7 @@ public abstract class XDebuggerEvaluator {
* @return delay before showing value tooltip (in ms)
*/
public int getValuePopupDelay() {
- return 700;
+ return XDebuggerSettingsManager.getInstance().getDataViewSettings().getValueLookupDelay();
}
public interface XEvaluationCallback extends XValueCallback {
diff --git a/platform/xdebugger-api/src/com/intellij/xdebugger/settings/XDebuggerSettings.java b/platform/xdebugger-api/src/com/intellij/xdebugger/settings/XDebuggerSettings.java
index e3b101d2cb9b..52049f76ae72 100644
--- a/platform/xdebugger-api/src/com/intellij/xdebugger/settings/XDebuggerSettings.java
+++ b/platform/xdebugger-api/src/com/intellij/xdebugger/settings/XDebuggerSettings.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,8 +19,9 @@ import com.intellij.openapi.components.PersistentStateComponent;
import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.openapi.options.Configurable;
import com.intellij.xdebugger.XDebuggerUtil;
-import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.NonNls;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
/**
* Implement this class to provide settings page for debugger. Settings page will be placed under 'Debugger' node in the 'Settings' dialog.
@@ -29,11 +30,16 @@ import org.jetbrains.annotations.NonNls;
* &lt;extensions defaultExtensionNs="com.intellij"&gt;<br>
* &nbsp;&nbsp;&lt;xdebugger.settings implementation="qualified-class-name"/&gt;<br>
* &lt;/extensions&gt;
- *
+ *
* @author nik
*/
public abstract class XDebuggerSettings<T> implements PersistentStateComponent<T> {
+ public enum Category {
+ ROOT, DATA_VIEWS, STEPPING
+ }
+
public static final ExtensionPointName<XDebuggerSettings> EXTENSION_POINT = ExtensionPointName.create("com.intellij.xdebugger.settings");
+
private final String myId;
protected XDebuggerSettings(final @NotNull @NonNls String id) {
@@ -48,6 +54,16 @@ public abstract class XDebuggerSettings<T> implements PersistentStateComponent<T
return myId;
}
- @NotNull
- public abstract Configurable createConfigurable();
+ @Nullable
+ public Configurable createConfigurable() {
+ return null;
+ }
+
+ @Nullable
+ public Configurable createConfigurable(@NotNull Category category) {
+ return null;
+ }
+
+ public void generalApplied(@NotNull Category category) {
+ }
}
diff --git a/platform/xdebugger-api/src/com/intellij/xdebugger/settings/XDebuggerSettingsManager.java b/platform/xdebugger-api/src/com/intellij/xdebugger/settings/XDebuggerSettingsManager.java
new file mode 100644
index 000000000000..2fa473d93935
--- /dev/null
+++ b/platform/xdebugger-api/src/com/intellij/xdebugger/settings/XDebuggerSettingsManager.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2000-2014 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.xdebugger.settings;
+
+import com.intellij.openapi.components.ServiceManager;
+import org.jetbrains.annotations.NotNull;
+
+public abstract class XDebuggerSettingsManager {
+ public static XDebuggerSettingsManager getInstance() {
+ return ServiceManager.getService(XDebuggerSettingsManager.class);
+ }
+
+ public interface DataViewSettings {
+ boolean isSortValues();
+
+ boolean isAutoExpressions();
+
+ int getValueLookupDelay();
+ }
+
+ @NotNull
+ public abstract DataViewSettings getDataViewSettings();
+} \ No newline at end of file
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/DebuggerSupport.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/DebuggerSupport.java
index 82c052240673..840163bb9e43 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/DebuggerSupport.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/DebuggerSupport.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -36,6 +36,9 @@ import org.jetbrains.annotations.Nullable;
public abstract class DebuggerSupport {
private static final ExtensionPointName<DebuggerSupport> EXTENSION_POINT = ExtensionPointName.create("com.intellij.xdebugger.debuggerSupport");
+ private static final DebuggerSettingsPanelProvider EMPTY_SETTINGS_PANEL_PROVIDER = new DebuggerSettingsPanelProvider() {
+ };
+
protected static final class DisabledActionHandler extends DebuggerActionHandler {
public static final DisabledActionHandler INSTANCE = new DisabledActionHandler();
@@ -58,7 +61,9 @@ public abstract class DebuggerSupport {
public abstract BreakpointPanelProvider<?> getBreakpointPanelProvider();
@NotNull
- public abstract DebuggerSettingsPanelProvider getSettingsPanelProvider();
+ public DebuggerSettingsPanelProvider getSettingsPanelProvider() {
+ return EMPTY_SETTINGS_PANEL_PROVIDER;
+ }
@NotNull
public abstract DebuggerActionHandler getStepOverHandler();
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebugSessionImpl.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebugSessionImpl.java
index bdedcc29091a..9ab13ba0ae74 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebugSessionImpl.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebugSessionImpl.java
@@ -865,7 +865,7 @@ public class XDebugSessionImpl implements XDebugSession {
if (myValueMarkers != null) {
myValueMarkers.clear();
}
- if (XDebuggerSettingsManager.getInstance().getGeneralSettings().isUnmuteOnStop()) {
+ if (XDebuggerSettingsManager.getInstanceImpl().getGeneralSettings().isUnmuteOnStop()) {
mySessionData.setBreakpointsMuted(false);
}
myStopped = true;
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerManagerImpl.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerManagerImpl.java
index eee1f28ad451..b974150d2c56 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerManagerImpl.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerManagerImpl.java
@@ -17,6 +17,7 @@ package com.intellij.xdebugger.impl;
import com.intellij.AppTopics;
import com.intellij.execution.ExecutionException;
+import com.intellij.execution.ExecutionManager;
import com.intellij.execution.Executor;
import com.intellij.execution.executors.DefaultDebugExecutor;
import com.intellij.execution.process.ProcessHandler;
@@ -27,6 +28,7 @@ import com.intellij.execution.ui.RunContentDescriptor;
import com.intellij.execution.ui.RunContentManagerImpl;
import com.intellij.execution.ui.RunContentWithExecutorListener;
import com.intellij.openapi.Disposable;
+import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.components.*;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.markup.GutterIconRenderer;
@@ -45,6 +47,7 @@ import com.intellij.xdebugger.breakpoints.XBreakpointAdapter;
import com.intellij.xdebugger.breakpoints.XLineBreakpoint;
import com.intellij.xdebugger.impl.breakpoints.XBreakpointBase;
import com.intellij.xdebugger.impl.breakpoints.XBreakpointManagerImpl;
+import com.intellij.xdebugger.impl.settings.XDebuggerSettingsManager;
import com.intellij.xdebugger.impl.ui.ExecutionPointHighlighter;
import com.intellij.xdebugger.impl.ui.XDebugSessionData;
import com.intellij.xdebugger.impl.ui.XDebugSessionTab;
@@ -245,6 +248,10 @@ public class XDebuggerManagerImpl extends XDebuggerManager
mySessions.remove(session.getDebugProcess().getProcessHandler());
}
});
+
+ if (!myProject.isDisposed() && !ApplicationManager.getApplication().isUnitTestMode() && XDebuggerSettingsManager.getInstanceImpl().getGeneralSettings().isHideDebuggerOnProcessTermination()) {
+ ExecutionManager.getInstance(myProject).getContentManager().hideRunContent(DefaultDebugExecutor.getDebugExecutorInstance(), descriptor);
+ }
}
if (myActiveSession == session) {
myActiveSession = null;
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerUtilImpl.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerUtilImpl.java
index 6db46f58d266..8e51cefab29a 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerUtilImpl.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerUtilImpl.java
@@ -156,7 +156,7 @@ public class XDebuggerUtilImpl extends XDebuggerUtil {
@Override
public <T extends XDebuggerSettings<?>> T getDebuggerSettings(Class<T> aClass) {
- return XDebuggerSettingsManager.getInstance().getSettings(aClass);
+ return XDebuggerSettingsManager.getInstanceImpl().getSettings(aClass);
}
@Override
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/UnmuteOnStopAction.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/UnmuteOnStopAction.java
index 79cef654c089..e9f36996dda7 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/UnmuteOnStopAction.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/UnmuteOnStopAction.java
@@ -26,11 +26,11 @@ import com.intellij.xdebugger.impl.settings.XDebuggerSettingsManager;
public class UnmuteOnStopAction extends ToggleAction implements DumbAware {
@Override
public boolean isSelected(AnActionEvent e) {
- return XDebuggerSettingsManager.getInstance().getGeneralSettings().isUnmuteOnStop();
+ return XDebuggerSettingsManager.getInstanceImpl().getGeneralSettings().isUnmuteOnStop();
}
@Override
public void setSelected(AnActionEvent e, boolean state) {
- XDebuggerSettingsManager.getInstance().getGeneralSettings().setUnmuteOnStop(state);
+ XDebuggerSettingsManager.getInstanceImpl().getGeneralSettings().setUnmuteOnStop(state);
}
} \ No newline at end of file
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/BreakpointState.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/BreakpointState.java
index 8631b8fc901b..364353c2ac63 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/BreakpointState.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/BreakpointState.java
@@ -156,11 +156,11 @@ public class BreakpointState<B extends XBreakpoint<P>, P extends XBreakpointProp
}
public boolean isLogExpressionEnabled() {
- return myLogExpression == null || !myLogExpression.myDisabled;
+ return myLogExpression != null && !myLogExpression.myDisabled;
}
public boolean isConditionEnabled() {
- return myCondition == null || !myCondition.myDisabled;
+ return myCondition != null && !myCondition.myDisabled;
}
@Property(surroundWithTag = false)
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XBreakpointBase.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XBreakpointBase.java
index 6184ad9857b3..ddf673fe2504 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XBreakpointBase.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XBreakpointBase.java
@@ -192,6 +192,7 @@ public class XBreakpointBase<Self extends XBreakpoint<P>, P extends XBreakpointP
@Override
public void setLogExpression(@Nullable final String expression) {
+ setLogExpressionEnabled(true);
if (!Comparing.equal(getLogExpression(), expression)) {
myLogExpression = XExpressionImpl.fromText(expression);
fireBreakpointChanged();
@@ -210,6 +211,7 @@ public class XBreakpointBase<Self extends XBreakpoint<P>, P extends XBreakpointP
@Override
public void setLogExpressionObject(@Nullable XExpression expression) {
+ setLogExpressionEnabled(true);
if (!Comparing.equal(myLogExpression, expression)) {
myLogExpression = expression;
fireBreakpointChanged();
@@ -224,6 +226,7 @@ public class XBreakpointBase<Self extends XBreakpoint<P>, P extends XBreakpointP
@Override
public void setCondition(@Nullable final String condition) {
+ setConditionEnabled(true);
if (!Comparing.equal(condition, getCondition())) {
myCondition = XExpressionImpl.fromText(condition);
fireBreakpointChanged();
@@ -242,6 +245,7 @@ public class XBreakpointBase<Self extends XBreakpoint<P>, P extends XBreakpointP
@Override
public void setConditionExpression(@Nullable XExpression condition) {
+ setConditionEnabled(true);
if (!Comparing.equal(condition, myCondition)) {
myCondition = condition;
fireBreakpointChanged();
@@ -387,13 +391,18 @@ public class XBreakpointBase<Self extends XBreakpoint<P>, P extends XBreakpointP
@Nullable
protected final Icon calculateSpecialIcon() {
+ XDebugSessionImpl session = getBreakpointManager().getDebuggerManager().getCurrentSession();
if (!isEnabled()) {
// disabled icon takes precedence to other to visually distinguish it and provide feedback then it is enabled/disabled
// (e.g. in case of mute-mode we would like to differentiate muted but enabled breakpoints from simply disabled ones)
- return getType().getDisabledIcon();
+ if (session == null || !session.areBreakpointsMuted()) {
+ return getType().getDisabledIcon();
+ }
+ else {
+ return getType().getMutedDisabledIcon();
+ }
}
- XDebugSessionImpl session = getBreakpointManager().getDebuggerManager().getCurrentSession();
if (session == null) {
if (getBreakpointManager().getDependentBreakpointManager().getMasterBreakpoint(this) != null) {
return getType().getInactiveDependentIcon();
@@ -401,7 +410,7 @@ public class XBreakpointBase<Self extends XBreakpoint<P>, P extends XBreakpointP
}
else {
if (session.areBreakpointsMuted()) {
- return AllIcons.Debugger.Db_muted_breakpoint;
+ return getType().getMutedEnabledIcon();
}
if (session.isInactiveSlaveBreakpoint(this)) {
return getType().getInactiveDependentIcon();
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XLineBreakpointImpl.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XLineBreakpointImpl.java
index d86970b463f4..e2ce9ca7c63d 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XLineBreakpointImpl.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XLineBreakpointImpl.java
@@ -90,8 +90,9 @@ public class XLineBreakpointImpl<P extends XBreakpointProperties> extends XBreak
RangeHighlighterEx highlighter = myHighlighter;
if (highlighter != null &&
- (!highlighter.isValid() ||
- highlighter.getStartOffset() >= document.getTextLength()
+ (!highlighter.isValid()
+ || highlighter.getStartOffset() >= document.getTextLength()
+ || !Comparing.equal(highlighter.getTextAttributes(), attributes)
// it seems that this check is not needed - we always update line number from the highlighter
// and highlighter is removed on line and file change anyway
/*|| document.getLineNumber(highlighter.getStartOffset()) != getLine()*/)) {
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XLineBreakpointManager.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XLineBreakpointManager.java
index e2252ea642a9..098b64052284 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XLineBreakpointManager.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XLineBreakpointManager.java
@@ -118,14 +118,7 @@ public class XLineBreakpointManager {
// Update breakpoints colors if global color schema was changed
final EditorColorsManager colorsManager = EditorColorsManager.getInstance();
if (colorsManager != null) { // in some debugger tests EditorColorsManager component isn't loaded
- final MyEditorColorsListener myColorsSchemeListener = new MyEditorColorsListener();
- Disposer.register(project, new Disposable() {
- @Override
- public void dispose() {
- colorsManager.removeEditorColorsListener(myColorsSchemeListener);
- }
- });
- colorsManager.addEditorColorsListener(myColorsSchemeListener);
+ colorsManager.addEditorColorsListener(new MyEditorColorsListener(), project);
}
}
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/XBreakpointActionsPanel.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/XBreakpointActionsPanel.java
index 0f98bce57af0..6ee8eadbe0ad 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/XBreakpointActionsPanel.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/XBreakpointActionsPanel.java
@@ -114,9 +114,10 @@ public class XBreakpointActionsPanel<B extends XBreakpointBase<?,?,?>> extends X
}
if (myLogExpressionComboBox != null) {
- myBreakpoint.setLogExpressionEnabled(myLogExpressionCheckBox.isSelected());
XExpression expression = myLogExpressionComboBox.getExpression();
- myBreakpoint.setLogExpressionObject(!XDebuggerUtilImpl.isEmptyExpression(expression) ? expression : null);
+ XExpression logExpression = !XDebuggerUtilImpl.isEmptyExpression(expression) ? expression : null;
+ myBreakpoint.setLogExpressionEnabled(myLogExpressionCheckBox.isSelected() && logExpression != null);
+ myBreakpoint.setLogExpressionObject(logExpression);
myLogExpressionComboBox.saveTextInHistory();
}
}
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/XLightBreakpointPropertiesPanel.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/XLightBreakpointPropertiesPanel.java
index 9f869ac25def..0e847d7db05d 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/XLightBreakpointPropertiesPanel.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/XLightBreakpointPropertiesPanel.java
@@ -206,9 +206,10 @@ public class XLightBreakpointPropertiesPanel<B extends XBreakpointBase<?,?,?>> i
}
if (myConditionComboBox != null) {
- myBreakpoint.setConditionEnabled(myConditionEnabledCheckbox.isSelected());
XExpression expression = myConditionComboBox.getExpression();
- myBreakpoint.setConditionExpression(!XDebuggerUtilImpl.isEmptyExpression(expression) ? expression : null);
+ XExpression condition = !XDebuggerUtilImpl.isEmptyExpression(expression) ? expression : null;
+ myBreakpoint.setConditionEnabled(myConditionEnabledCheckbox.isSelected() && condition != null);
+ myBreakpoint.setConditionExpression(condition);
myConditionComboBox.saveTextInHistory();
}
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/ExpressionInputComponent.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/ExpressionInputComponent.java
index a272cb30321f..15a8bf6aed84 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/ExpressionInputComponent.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/ExpressionInputComponent.java
@@ -16,6 +16,9 @@
package com.intellij.xdebugger.impl.evaluate;
import com.intellij.openapi.project.Project;
+import com.intellij.ui.IdeBorderFactory;
+import com.intellij.ui.components.JBLabel;
+import com.intellij.util.ui.UIUtil;
import com.intellij.xdebugger.XDebuggerBundle;
import com.intellij.xdebugger.XExpression;
import com.intellij.xdebugger.XSourcePosition;
@@ -53,6 +56,11 @@ public class ExpressionInputComponent extends EvaluationInputComponent {
public void addComponent(JPanel contentPanel, JPanel resultPanel) {
contentPanel.add(resultPanel, BorderLayout.CENTER);
contentPanel.add(myMainPanel, BorderLayout.NORTH);
+ final JBLabel hint = new JBLabel(XDebuggerBundle.message("xdebugger.evaluate.addtowatches.hint"), SwingConstants.RIGHT);
+ hint.setBorder(IdeBorderFactory.createEmptyBorder(2, 0, 6, 0));
+ hint.setComponentStyle(UIUtil.ComponentStyle.SMALL);
+ hint.setFontColor(UIUtil.FontColor.BRIGHTER);
+ contentPanel.add(hint, BorderLayout.SOUTH);
}
protected XDebuggerEditorBase getInputEditor() {
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/XDebuggerEvaluationDialog.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/XDebuggerEvaluationDialog.java
index 2ad50e1240f7..2273ab698768 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/XDebuggerEvaluationDialog.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/XDebuggerEvaluationDialog.java
@@ -21,6 +21,7 @@ import com.intellij.openapi.actionSystem.CustomShortcutSet;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.DialogWrapper;
+import com.intellij.openapi.util.Condition;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.wm.IdeFocusManager;
import com.intellij.xdebugger.*;
@@ -28,26 +29,23 @@ import com.intellij.xdebugger.evaluation.EvaluationMode;
import com.intellij.xdebugger.evaluation.XDebuggerEditorsProvider;
import com.intellij.xdebugger.evaluation.XDebuggerEvaluator;
import com.intellij.xdebugger.impl.XDebugSessionImpl;
+import com.intellij.xdebugger.impl.XDebuggerUtilImpl;
import com.intellij.xdebugger.impl.actions.XDebuggerActions;
import com.intellij.xdebugger.impl.breakpoints.XExpressionImpl;
import com.intellij.xdebugger.impl.settings.XDebuggerSettingsManager;
import com.intellij.xdebugger.impl.ui.XDebuggerEditorBase;
import com.intellij.xdebugger.impl.ui.tree.XDebuggerTree;
-import com.intellij.xdebugger.impl.ui.tree.XDebuggerTreeListener;
import com.intellij.xdebugger.impl.ui.tree.XDebuggerTreePanel;
import com.intellij.xdebugger.impl.ui.tree.nodes.EvaluatingExpressionRootNode;
-import com.intellij.xdebugger.impl.ui.tree.nodes.RestorableStateNode;
-import com.intellij.xdebugger.impl.ui.tree.nodes.XDebuggerTreeNode;
-import com.intellij.xdebugger.impl.ui.tree.nodes.XValueContainerNode;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
+import javax.swing.tree.TreeNode;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
-import java.util.List;
/**
* @author nik
@@ -98,12 +96,6 @@ public class XDebuggerEvaluationDialog extends DialogWrapper {
mySwitchModeAction = new SwitchModeAction();
- new AnAction(){
- @Override
- public void actionPerformed(AnActionEvent e) {
- doOKAction();
- }
- }.registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, InputEvent.CTRL_DOWN_MASK)), getRootPane(), myDisposable);
new AnAction() {
@Override
public void actionPerformed(AnActionEvent e) {
@@ -112,9 +104,14 @@ public class XDebuggerEvaluationDialog extends DialogWrapper {
}.registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_R, InputEvent.ALT_DOWN_MASK)), getRootPane(),
myDisposable);
- myTreePanel.getTree().addTreeListener(new MyTreeListener());
+ myTreePanel.getTree().expandNodesOnLoad(new Condition<TreeNode>() {
+ @Override
+ public boolean value(TreeNode node) {
+ return node.getParent() instanceof EvaluatingExpressionRootNode;
+ }
+ });
- EvaluationMode mode = XDebuggerSettingsManager.getInstance().getGeneralSettings().getEvaluationDialogMode();
+ EvaluationMode mode = XDebuggerSettingsManager.getInstanceImpl().getGeneralSettings().getEvaluationDialogMode();
myIsCodeFragmentEvaluationSupported = evaluator.isCodeFragmentEvaluationSupported();
if (mode == EvaluationMode.CODE_FRAGMENT && !myIsCodeFragmentEvaluationSupported) {
mode = EvaluationMode.EXPRESSION;
@@ -131,6 +128,23 @@ public class XDebuggerEvaluationDialog extends DialogWrapper {
evaluate();
}
+ protected void createDefaultActions() {
+ super.createDefaultActions();
+ myOKAction = new OkAction(){
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ super.actionPerformed(e);
+ if (myMode == EvaluationMode.EXPRESSION && ((e.getModifiers() & InputEvent.CTRL_MASK) != 0)) {
+ // add to watches
+ XExpression expression = myInputComponent.getInputEditor().getExpression();
+ if (!XDebuggerUtilImpl.isEmptyExpression(expression)) {
+ ((XDebugSessionImpl)mySession).getSessionTab().getWatchesView().addWatchExpression(expression, -1, false);
+ }
+ }
+ }
+ };
+ }
+
@NotNull
@Override
protected Action[] createActions() {
@@ -171,7 +185,7 @@ public class XDebuggerEvaluationDialog extends DialogWrapper {
private void switchToMode(EvaluationMode mode, XExpression text) {
if (myMode == mode) return;
- XDebuggerSettingsManager.getInstance().getGeneralSettings().setEvaluationDialogMode(mode);
+ XDebuggerSettingsManager.getInstanceImpl().getGeneralSettings().setEvaluationDialogMode(mode);
myMode = mode;
@@ -227,25 +241,6 @@ public class XDebuggerEvaluationDialog extends DialogWrapper {
}
}
- private class MyTreeListener implements XDebuggerTreeListener {
- @Override
- public void nodeLoaded(@NotNull RestorableStateNode node, String name) {
- if (node.getParent() instanceof EvaluatingExpressionRootNode) {
- if (!node.isLeaf()) {
- // cause children computing
- node.getChildCount();
- }
- }
- }
-
- @Override
- public void childrenLoaded(@NotNull XDebuggerTreeNode node, @NotNull List<XValueContainerNode<?>> children, boolean last) {
- if (node.getParent() instanceof EvaluatingExpressionRootNode) {
- myTreePanel.getTree().expandPath(node.getPath());
- }
- }
- }
-
@Override
protected String getDimensionServiceKey() {
return "#xdebugger.evaluate";
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/quick/XDebuggerTreeCreator.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/quick/XDebuggerTreeCreator.java
index 8f53dba017f9..c07b140e2622 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/quick/XDebuggerTreeCreator.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/quick/XDebuggerTreeCreator.java
@@ -17,6 +17,7 @@ package com.intellij.xdebugger.impl.evaluate.quick;
import com.intellij.concurrency.ResultConsumer;
import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.Condition;
import com.intellij.openapi.util.Pair;
import com.intellij.ui.treeStructure.Tree;
import com.intellij.xdebugger.XSourcePosition;
@@ -26,14 +27,10 @@ import com.intellij.xdebugger.impl.actions.XDebuggerActions;
import com.intellij.xdebugger.impl.evaluate.quick.common.DebuggerTreeCreator;
import com.intellij.xdebugger.impl.frame.XValueMarkers;
import com.intellij.xdebugger.impl.ui.tree.XDebuggerTree;
-import com.intellij.xdebugger.impl.ui.tree.XDebuggerTreeListener;
-import com.intellij.xdebugger.impl.ui.tree.nodes.RestorableStateNode;
-import com.intellij.xdebugger.impl.ui.tree.nodes.XDebuggerTreeNode;
-import com.intellij.xdebugger.impl.ui.tree.nodes.XValueContainerNode;
import com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl;
import org.jetbrains.annotations.NotNull;
-import java.util.List;
+import javax.swing.tree.TreeNode;
public class XDebuggerTreeCreator implements DebuggerTreeCreator<Pair<XValue,String>> {
@NotNull private final Project myProject;
@@ -56,19 +53,10 @@ public class XDebuggerTreeCreator implements DebuggerTreeCreator<Pair<XValue,Str
final XValueNodeImpl root = new XValueNodeImpl(tree, null, descriptor.getSecond(), descriptor.getFirst());
tree.setRoot(root, true);
// expand root on load
- tree.addTreeListener(new XDebuggerTreeListener() {
+ tree.expandNodesOnLoad(new Condition<TreeNode>() {
@Override
- public void nodeLoaded(@NotNull RestorableStateNode node, String name) {
- if (node == root && !node.isLeaf()) {
- node.getChildCount();
- }
- }
-
- @Override
- public void childrenLoaded(@NotNull XDebuggerTreeNode node, @NotNull List<XValueContainerNode<?>> children, boolean last) {
- if (node == root) {
- tree.expandPath(node.getPath());
- }
+ public boolean value(TreeNode node) {
+ return node == root;
}
});
return tree;
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/quick/XQuickEvaluateHandler.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/quick/XQuickEvaluateHandler.java
index 1669e102f15f..bf3e0010e6cf 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/quick/XQuickEvaluateHandler.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/quick/XQuickEvaluateHandler.java
@@ -29,6 +29,7 @@ import com.intellij.xdebugger.evaluation.XDebuggerEvaluator;
import com.intellij.xdebugger.impl.evaluate.quick.common.AbstractValueHint;
import com.intellij.xdebugger.impl.evaluate.quick.common.QuickEvaluateHandler;
import com.intellij.xdebugger.impl.evaluate.quick.common.ValueHintType;
+import com.intellij.xdebugger.settings.XDebuggerSettingsManager;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -107,6 +108,6 @@ public class XQuickEvaluateHandler extends QuickEvaluateHandler {
return evaluator.getValuePopupDelay();
}
}
- return 700;
+ return XDebuggerSettingsManager.getInstance().getDataViewSettings().getValueLookupDelay();
}
}
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/DataViewsConfigurable.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/DataViewsConfigurable.java
new file mode 100644
index 000000000000..d140a74f35c8
--- /dev/null
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/DataViewsConfigurable.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2000-2014 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.xdebugger.impl.settings;
+
+import com.intellij.openapi.options.Configurable;
+import com.intellij.xdebugger.XDebuggerBundle;
+import com.intellij.xdebugger.settings.XDebuggerSettings;
+import org.jetbrains.annotations.Nls;
+import org.jetbrains.annotations.NotNull;
+
+class DataViewsConfigurable extends SubCompositeConfigurable implements Configurable.NoScroll {
+ @NotNull
+ @Override
+ public String getId() {
+ return "debugger.dataViews";
+ }
+
+ @Nls
+ @Override
+ public String getDisplayName() {
+ return XDebuggerBundle.message("debugger.dataViews.display.name");
+ }
+
+ @Override
+ protected DataViewsConfigurableUi createRootUi() {
+ return new DataViewsConfigurableUi();
+ }
+
+ @NotNull
+ @Override
+ protected XDebuggerSettings.Category getCategory() {
+ return XDebuggerSettings.Category.DATA_VIEWS;
+ }
+
+ @NotNull
+ @Override
+ protected XDebuggerDataViewSettings getSettings() {
+ return XDebuggerSettingsManager.getInstanceImpl().getDataViewSettings();
+ }
+} \ No newline at end of file
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/DataViewsConfigurableUi.form b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/DataViewsConfigurableUi.form
new file mode 100644
index 000000000000..a6e3f94f3bec
--- /dev/null
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/DataViewsConfigurableUi.form
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.xdebugger.impl.settings.DataViewsConfigurableUi">
+ <grid id="27dc6" binding="panel" layout-manager="GridLayoutManager" row-count="4" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
+ <margin top="0" left="0" bottom="0" right="0"/>
+ <constraints>
+ <xy x="20" y="20" width="500" height="400"/>
+ </constraints>
+ <properties/>
+ <border type="none"/>
+ <children>
+ <vspacer id="4eb98">
+ <constraints>
+ <grid row="3" column="0" row-span="1" col-span="2" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
+ </constraints>
+ </vspacer>
+ <component id="9a000" class="javax.swing.JLabel">
+ <constraints>
+ <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
+ </constraints>
+ <properties>
+ <text resource-bundle="messages/XDebuggerBundle" key="setting.value.tooltip.delay.label"/>
+ </properties>
+ </component>
+ <component id="fdcd5" class="javax.swing.JFormattedTextField" binding="valueTooltipDelayTextField">
+ <constraints>
+ <grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
+ </constraints>
+ <properties>
+ <columns value="4"/>
+ </properties>
+ </component>
+ <component id="98130" class="javax.swing.JCheckBox" binding="enableAutoExpressionsCheckBox">
+ <constraints>
+ <grid row="2" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
+ </constraints>
+ <properties>
+ <text resource-bundle="messages/XDebuggerBundle" key="setting.enable.auto.expressions.label"/>
+ </properties>
+ </component>
+ <component id="a57b4" class="javax.swing.JCheckBox" binding="sortAlphabeticallyCheckBox" default-binding="true">
+ <constraints>
+ <grid row="1" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
+ </constraints>
+ <properties>
+ <text resource-bundle="messages/XDebuggerBundle" key="setting.sort.alphabetically.label"/>
+ </properties>
+ </component>
+ </children>
+ </grid>
+</form>
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/DataViewsConfigurableUi.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/DataViewsConfigurableUi.java
new file mode 100644
index 000000000000..76645db3a3d3
--- /dev/null
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/DataViewsConfigurableUi.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2000-2014 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.xdebugger.impl.settings;
+
+import com.intellij.openapi.util.text.StringUtilRt;
+import com.intellij.util.ui.UIUtil;
+import org.jetbrains.annotations.NotNull;
+
+import javax.swing.*;
+
+public class DataViewsConfigurableUi {
+ private JCheckBox enableAutoExpressionsCheckBox;
+ private JFormattedTextField valueTooltipDelayTextField;
+ private JPanel panel;
+ private JCheckBox sortAlphabeticallyCheckBox;
+
+ public DataViewsConfigurableUi() {
+ UIUtil.configureNumericFormattedTextField(valueTooltipDelayTextField);
+ }
+
+ private int getValueTooltipDelay() {
+ Object value = valueTooltipDelayTextField.getValue();
+ return value instanceof Number ? ((Number)value).intValue() : StringUtilRt.parseInt((String)value, XDebuggerDataViewSettings.DEFAULT_VALUE_TOOLTIP_DELAY);
+ }
+
+ @NotNull
+ public JComponent getComponent() {
+ return panel;
+ }
+
+ public boolean isModified(@NotNull XDebuggerDataViewSettings settings) {
+ return getValueTooltipDelay() != settings.getValueLookupDelay() ||
+ sortAlphabeticallyCheckBox.isSelected() != settings.isSortValues() ||
+ enableAutoExpressionsCheckBox.isSelected() != settings.isAutoExpressions();
+ }
+
+ public void reset(@NotNull XDebuggerDataViewSettings settings) {
+ valueTooltipDelayTextField.setValue(settings.getValueLookupDelay());
+ sortAlphabeticallyCheckBox.setSelected(settings.isSortValues());
+ enableAutoExpressionsCheckBox.setSelected(settings.isAutoExpressions());
+ }
+
+ public void apply(@NotNull XDebuggerDataViewSettings settings) {
+ settings.setValueLookupDelay(getValueTooltipDelay());
+ settings.setSortValues(sortAlphabeticallyCheckBox.isSelected());
+ settings.setAutoExpressions(enableAutoExpressionsCheckBox.isSelected());
+ }
+} \ No newline at end of file
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/DebuggerConfigurable.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/DebuggerConfigurable.java
index ae0b71eaa20f..a3f4e847288c 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/DebuggerConfigurable.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/DebuggerConfigurable.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,12 +18,19 @@ package com.intellij.xdebugger.impl.settings;
import com.intellij.openapi.options.Configurable;
import com.intellij.openapi.options.ConfigurationException;
import com.intellij.openapi.options.SearchableConfigurable;
+import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.util.SmartList;
import com.intellij.xdebugger.XDebuggerBundle;
import com.intellij.xdebugger.impl.DebuggerSupport;
+import com.intellij.xdebugger.settings.XDebuggerSettings;
+import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
import javax.swing.*;
+import java.util.Arrays;
+import java.util.Comparator;
import java.util.List;
/**
@@ -31,26 +38,118 @@ import java.util.List;
*/
public class DebuggerConfigurable implements SearchableConfigurable.Parent {
public static final String DISPLAY_NAME = XDebuggerBundle.message("debugger.configurable.display.name");
+
+ static final Configurable[] EMPTY_CONFIGURABLES = new Configurable[0];
+
private Configurable myRootConfigurable;
private Configurable[] myChildren;
- public DebuggerConfigurable(Configurable rootConfigurable, List<Configurable> children) {
- myRootConfigurable = rootConfigurable;
- myChildren = children.toArray(new Configurable[children.size()]);
- }
-
+ @Override
public String getDisplayName() {
return DISPLAY_NAME;
}
+ @Override
public String getHelpTopic() {
- return myRootConfigurable != null? myRootConfigurable.getHelpTopic() : null;
+ return myRootConfigurable != null ? myRootConfigurable.getHelpTopic() : null;
}
+ @Override
public Configurable[] getConfigurables() {
- return myChildren;
+ compute();
+
+ if (myChildren.length == 0 && myRootConfigurable instanceof SearchableConfigurable.Parent) {
+ return ((Parent)myRootConfigurable).getConfigurables();
+ }
+ else {
+ return myChildren;
+ }
+ }
+
+ private void compute() {
+ if (myChildren != null) {
+ return;
+ }
+
+ List<DebuggerSettingsPanelProvider> providers = DebuggerConfigurableProvider.getSortedProviders();
+
+ List<Configurable> configurables = new SmartList<Configurable>();
+ configurables.add(new DataViewsConfigurable());
+
+ List<Configurable> steppingConfigurables = DebuggerConfigurableProvider.getConfigurables(XDebuggerSettings.Category.STEPPING, providers);
+ if (!steppingConfigurables.isEmpty()) {
+ configurables.add(new SteppingConfigurable(steppingConfigurables));
+ }
+
+ Configurable rootConfigurable = computeRootConfigurable(providers, configurables);
+
+ if (configurables.isEmpty() && rootConfigurable == null) {
+ myChildren = EMPTY_CONFIGURABLES;
+ }
+ else if (rootConfigurable == null && configurables.size() == 1) {
+ myRootConfigurable = configurables.get(0);
+ myChildren = EMPTY_CONFIGURABLES;
+ }
+ else {
+ myChildren = configurables.toArray(new Configurable[configurables.size()]);
+ myRootConfigurable = rootConfigurable;
+ }
+ }
+
+ @Nullable
+ private static Configurable computeRootConfigurable(@NotNull List<DebuggerSettingsPanelProvider> providers, @NotNull List<Configurable> configurables) {
+ Configurable deprecatedRootConfigurable = null;
+ for (DebuggerSettingsPanelProvider provider : providers) {
+ configurables.addAll(provider.getConfigurables());
+ @SuppressWarnings("deprecation")
+ Configurable providerRootConfigurable = provider.getRootConfigurable();
+ if (providerRootConfigurable != null) {
+ if (deprecatedRootConfigurable == null) {
+ deprecatedRootConfigurable = providerRootConfigurable;
+ }
+ else {
+ configurables.add(providerRootConfigurable);
+ }
+ }
+ }
+
+ List<Configurable> rootConfigurables = DebuggerConfigurableProvider.getConfigurables(XDebuggerSettings.Category.ROOT, providers);
+ if (rootConfigurables.isEmpty()) {
+ return deprecatedRootConfigurable;
+ }
+ else {
+ Configurable[] mergedRootConfigurables = new Configurable[rootConfigurables.size() + (deprecatedRootConfigurable == null ? 0 : 1)];
+ rootConfigurables.toArray(mergedRootConfigurables);
+ if (deprecatedRootConfigurable != null) {
+ mergedRootConfigurables[rootConfigurables.size()] = deprecatedRootConfigurable;
+ }
+
+ // move unnamed to top
+ Arrays.sort(mergedRootConfigurables, new Comparator<Configurable>() {
+ @Override
+ public int compare(Configurable o1, Configurable o2) {
+ boolean c1e = StringUtil.isEmpty(o1.getDisplayName());
+ return c1e == StringUtil.isEmpty(o2.getDisplayName()) ? 0 : (c1e ? -1 : 1);
+ }
+ });
+
+ return new MergedCompositeConfigurable(mergedRootConfigurables) {
+ @NotNull
+ @Override
+ public String getId() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Nls
+ @Override
+ public String getDisplayName() {
+ throw new UnsupportedOperationException();
+ }
+ };
+ }
}
+ @Override
public void apply() throws ConfigurationException {
for (DebuggerSupport support : DebuggerSupport.getDebuggerSupports()) {
support.getSettingsPanelProvider().apply();
@@ -60,38 +159,48 @@ public class DebuggerConfigurable implements SearchableConfigurable.Parent {
}
}
+ @Override
public boolean hasOwnContent() {
+ compute();
return myRootConfigurable != null;
}
+ @Override
public boolean isVisible() {
return true;
}
+ @Override
public Runnable enableSearch(final String option) {
return null;
}
+ @Override
public JComponent createComponent() {
+ compute();
return myRootConfigurable != null ? myRootConfigurable.createComponent() : null;
}
+ @Override
public boolean isModified() {
return myRootConfigurable != null && myRootConfigurable.isModified();
}
+ @Override
public void reset() {
if (myRootConfigurable != null) {
myRootConfigurable.reset();
}
}
+ @Override
public void disposeUIResources() {
if (myRootConfigurable != null) {
myRootConfigurable.disposeUIResources();
}
}
+ @Override
@NotNull
@NonNls
public String getId() {
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/DebuggerConfigurableProvider.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/DebuggerConfigurableProvider.java
index 49e2e4ac6fcd..80651cadc830 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/DebuggerConfigurableProvider.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/DebuggerConfigurableProvider.java
@@ -17,10 +17,13 @@ package com.intellij.xdebugger.impl.settings;
import com.intellij.openapi.options.Configurable;
import com.intellij.openapi.options.ConfigurableProvider;
-import com.intellij.util.PlatformUtils;
+import com.intellij.util.SmartList;
+import com.intellij.util.containers.ContainerUtil;
import com.intellij.xdebugger.impl.DebuggerSupport;
+import com.intellij.xdebugger.settings.XDebuggerSettings;
+import org.jetbrains.annotations.NotNull;
-import java.util.ArrayList;
+import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
@@ -29,46 +32,55 @@ import java.util.List;
* @author nik
*/
public class DebuggerConfigurableProvider extends ConfigurableProvider {
+ @NotNull
+ static List<DebuggerSettingsPanelProvider> getSortedProviders() {
+ List<DebuggerSettingsPanelProvider> providers = null;
+ for (DebuggerSupport support : DebuggerSupport.getDebuggerSupports()) {
+ DebuggerSettingsPanelProvider provider = support.getSettingsPanelProvider();
+ if (providers == null) {
+ providers = new SmartList<DebuggerSettingsPanelProvider>();
+ }
+ providers.add(provider);
+ }
+
+ if (ContainerUtil.isEmpty(providers)) {
+ return Collections.emptyList();
+ }
+
+ if (providers.size() > 1) {
+ Collections.sort(providers, new Comparator<DebuggerSettingsPanelProvider>() {
+ @Override
+ public int compare(DebuggerSettingsPanelProvider o1, DebuggerSettingsPanelProvider o2) {
+ return o2.getPriority() - o1.getPriority();
+ }
+ });
+ }
+ return providers;
+ }
+
@Override
public Configurable createConfigurable() {
- final List<DebuggerSettingsPanelProvider> providers = new ArrayList<DebuggerSettingsPanelProvider>();
- final DebuggerSupport[] supports = DebuggerSupport.getDebuggerSupports();
- for (DebuggerSupport support : supports) {
- providers.add(support.getSettingsPanelProvider());
- }
+ return new DebuggerConfigurable();
+ }
- List<Configurable> configurables = new ArrayList<Configurable>();
- Collections.sort(providers, new Comparator<DebuggerSettingsPanelProvider>() {
- public int compare(final DebuggerSettingsPanelProvider o1, final DebuggerSettingsPanelProvider o2) {
- return o2.getPriority() - o1.getPriority();
- }
- });
+ @NotNull
+ static List<Configurable> getConfigurables(@NotNull XDebuggerSettings.Category category) {
+ List<DebuggerSettingsPanelProvider> providers = getSortedProviders();
+ return providers.isEmpty() ? Collections.<Configurable>emptyList() : getConfigurables(category, providers);
+ }
- Configurable rootConfigurable = null;
+ @NotNull
+ static List<Configurable> getConfigurables(@NotNull XDebuggerSettings.Category category, @NotNull List<DebuggerSettingsPanelProvider> providers) {
+ List<Configurable> configurables = null;
for (DebuggerSettingsPanelProvider provider : providers) {
- configurables.addAll(provider.getConfigurables());
- final Configurable aRootConfigurable = provider.getRootConfigurable();
- if (aRootConfigurable != null) {
- if (rootConfigurable != null) {
- configurables.add(aRootConfigurable);
- }
- else {
- rootConfigurable = aRootConfigurable;
+ Collection<? extends Configurable> providerConfigurables = provider.getConfigurable(category);
+ if (!providerConfigurables.isEmpty()) {
+ if (configurables == null) {
+ configurables = new SmartList<Configurable>();
}
+ configurables.addAll(providerConfigurables);
}
}
- if (configurables.isEmpty() && rootConfigurable == null) {
- return null;
- }
-
- //Perhaps we always should have a root node 'Debugger' with separate nodes for language-specific settings under it.
- //However for AppCode there is only one language which is clearly associated with the product
- //This code should removed when we extract the common debugger settings to the root node.
- if (PlatformUtils.isCidr() && rootConfigurable == null && configurables.size() == 1) {
- rootConfigurable = configurables.get(0);
- configurables = Collections.emptyList();
- }
-
- return new DebuggerConfigurable(rootConfigurable, configurables);
+ return ContainerUtil.notNullize(configurables);
}
}
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/DebuggerSettingsPanelProvider.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/DebuggerSettingsPanelProvider.java
index ba0bb43621e9..68e6de064b9a 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/DebuggerSettingsPanelProvider.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/DebuggerSettingsPanelProvider.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -16,24 +16,43 @@
package com.intellij.xdebugger.impl.settings;
import com.intellij.openapi.options.Configurable;
+import com.intellij.xdebugger.settings.XDebuggerSettings;
+import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.Collection;
+import java.util.Collections;
/**
* @author nik
*/
public abstract class DebuggerSettingsPanelProvider {
+ public int getPriority() {
+ return 0;
+ }
- public abstract int getPriority();
-
- public abstract Collection<? extends Configurable> getConfigurables();
+ @NotNull
+ public Collection<? extends Configurable> getConfigurables() {
+ return Collections.emptyList();
+ }
public void apply() {
}
@Nullable
+ @Deprecated
public Configurable getRootConfigurable() {
return null;
}
+
+ @NotNull
+ public Collection<? extends Configurable> getConfigurable(@NotNull XDebuggerSettings.Category category) {
+ return Collections.emptyList();
+ }
+
+ /**
+ * General settings of category were applied
+ */
+ public void generalApplied(@NotNull XDebuggerSettings.Category category) {
+ }
}
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/GeneralConfigurable.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/GeneralConfigurable.java
new file mode 100644
index 000000000000..466279bce977
--- /dev/null
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/GeneralConfigurable.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2000-2014 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.xdebugger.impl.settings;
+
+import com.intellij.openapi.options.ConfigurableBase;
+import org.jetbrains.annotations.Nls;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+class GeneralConfigurable extends ConfigurableBase<GeneralConfigurableUi, XDebuggerGeneralSettings> {
+ @Override
+ protected XDebuggerGeneralSettings getSettings() {
+ return XDebuggerSettingsManager.getInstanceImpl().getGeneralSettings();
+ }
+
+ @Override
+ protected GeneralConfigurableUi createUi() {
+ return new GeneralConfigurableUi();
+ }
+
+ @NotNull
+ @Override
+ public String getId() {
+ return "debugger.general";
+ }
+
+ @Nls
+ @Override
+ public String getDisplayName() {
+ return "";
+ }
+
+ @Nullable
+ @Override
+ public String getHelpTopic() {
+ return null;
+ }
+} \ No newline at end of file
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/GeneralConfigurableUi.form b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/GeneralConfigurableUi.form
new file mode 100644
index 000000000000..4d1f8e52d24f
--- /dev/null
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/GeneralConfigurableUi.form
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.xdebugger.impl.settings.GeneralConfigurableUi">
+ <grid id="27dc6" binding="rootPanel" layout-manager="GridLayoutManager" row-count="3" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
+ <margin top="0" left="0" bottom="0" right="0"/>
+ <constraints>
+ <xy x="20" y="20" width="500" height="400"/>
+ </constraints>
+ <properties/>
+ <border type="none"/>
+ <children>
+ <component id="4b50" class="javax.swing.JCheckBox" binding="hideDebugWindowCheckBox">
+ <constraints>
+ <grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
+ </constraints>
+ <properties>
+ <text resource-bundle="messages/XDebuggerBundle" key="setting.hide.window.label"/>
+ </properties>
+ </component>
+ <vspacer id="8e2ed">
+ <constraints>
+ <grid row="2" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
+ </constraints>
+ </vspacer>
+ <component id="fc652" class="javax.swing.JCheckBox" binding="focusApplicationOnBreakpointCheckBox" default-binding="true">
+ <constraints>
+ <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
+ </constraints>
+ <properties>
+ <text resource-bundle="messages/XDebuggerBundle" key="setting.focus.app.on.breakpoint.label"/>
+ </properties>
+ </component>
+ </children>
+ </grid>
+</form>
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/GeneralConfigurableUi.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/GeneralConfigurableUi.java
new file mode 100644
index 000000000000..273c5490e35d
--- /dev/null
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/GeneralConfigurableUi.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2000-2014 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.xdebugger.impl.settings;
+
+import com.intellij.openapi.options.ConfigurableUi;
+import com.intellij.openapi.util.registry.Registry;
+import org.jetbrains.annotations.NotNull;
+
+import javax.swing.*;
+
+class GeneralConfigurableUi implements ConfigurableUi<XDebuggerGeneralSettings> {
+ private JPanel rootPanel;
+ private JCheckBox hideDebugWindowCheckBox;
+ private JCheckBox focusApplicationOnBreakpointCheckBox;
+
+ @Override
+ public void reset(@NotNull XDebuggerGeneralSettings settings) {
+ focusApplicationOnBreakpointCheckBox.setSelected(Registry.is("debugger.mayBringFrameToFrontOnBreakpoint"));
+ hideDebugWindowCheckBox.setSelected(settings.isHideDebuggerOnProcessTermination());
+ }
+
+ @Override
+ public boolean isModified(@NotNull XDebuggerGeneralSettings settings) {
+ return focusApplicationOnBreakpointCheckBox.isSelected() != Registry.is("debugger.mayBringFrameToFrontOnBreakpoint") ||
+ hideDebugWindowCheckBox.isSelected() != settings.isHideDebuggerOnProcessTermination();
+ }
+
+ @Override
+ public void apply(@NotNull XDebuggerGeneralSettings settings) {
+ Registry.get("debugger.mayBringFrameToFrontOnBreakpoint").setValue(focusApplicationOnBreakpointCheckBox.isSelected());
+ settings.setHideDebuggerOnProcessTermination(hideDebugWindowCheckBox.isSelected());
+ }
+
+ @NotNull
+ @Override
+ public JComponent getComponent() {
+ return rootPanel;
+ }
+} \ No newline at end of file
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/MergedCompositeConfigurable.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/MergedCompositeConfigurable.java
new file mode 100644
index 000000000000..be0bdbf0ab2f
--- /dev/null
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/MergedCompositeConfigurable.java
@@ -0,0 +1,118 @@
+package com.intellij.xdebugger.impl.settings;
+
+import com.intellij.openapi.options.Configurable;
+import com.intellij.openapi.options.ConfigurationException;
+import com.intellij.openapi.options.SearchableConfigurable;
+import com.intellij.openapi.ui.VerticalFlowLayout;
+import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.ui.IdeBorderFactory;
+import com.intellij.ui.TitledSeparator;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import javax.swing.*;
+import javax.swing.border.EmptyBorder;
+import java.awt.*;
+
+abstract class MergedCompositeConfigurable implements SearchableConfigurable {
+ static final EmptyBorder BOTTOM_INSETS = new EmptyBorder(0, 0, IdeBorderFactory.TITLED_BORDER_BOTTOM_INSET, 0);
+
+ protected final Configurable[] children;
+ protected JComponent rootComponent;
+
+ protected MergedCompositeConfigurable(@NotNull Configurable[] children) {
+ this.children = children;
+ }
+
+ protected boolean isUseTitledBorder() {
+ return true;
+ }
+
+ @Nullable
+ @Override
+ public Runnable enableSearch(String option) {
+ return null;
+ }
+
+ @Nullable
+ @Override
+ public String getHelpTopic() {
+ return children.length == 1 ? children[0].getHelpTopic() : null;
+ }
+
+ @Nullable
+ @Override
+ public JComponent createComponent() {
+ if (rootComponent == null) {
+ if (children.length == 1) {
+ rootComponent = children[0].createComponent();
+ }
+ else {
+ JPanel panel = createPanel(isUseTitledBorder());
+ for (Configurable child : children) {
+ JComponent component = child.createComponent();
+ assert component != null;
+ if (isUseTitledBorder()) {
+ String displayName = child.getDisplayName();
+ if (StringUtil.isEmpty(displayName)) {
+ component.setBorder(BOTTOM_INSETS);
+ }
+ else {
+ Insets insets = new Insets(children[0] == child ? 0 : IdeBorderFactory.TITLED_BORDER_TOP_INSET, 0, IdeBorderFactory.TITLED_BORDER_BOTTOM_INSET, 0);
+ component.setBorder(IdeBorderFactory.createTitledBorder(displayName, false, insets));
+ }
+ }
+ panel.add(component);
+ }
+ rootComponent = panel;
+ }
+ }
+ return rootComponent;
+ }
+
+ @NotNull
+ static JPanel createPanel(boolean isUseTitledBorder) {
+ int verticalGap = TitledSeparator.TOP_INSET;
+ JPanel panel = new JPanel(new VerticalFlowLayout(0, isUseTitledBorder ? 0 : verticalGap));
+ // VerticalFlowLayout incorrectly use vertical gap as top inset
+ if (!isUseTitledBorder) {
+ panel.setBorder(new EmptyBorder(-verticalGap, 0, 0, 0));
+ }
+ return panel;
+ }
+
+ @Override
+ public boolean isModified() {
+ for (Configurable child : children) {
+ if (child.isModified()) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public void apply() throws ConfigurationException {
+ for (Configurable child : children) {
+ if (child.isModified()) {
+ child.apply();
+ }
+ }
+ }
+
+ @Override
+ public void reset() {
+ for (Configurable child : children) {
+ child.reset();
+ }
+ }
+
+ @Override
+ public void disposeUIResources() {
+ rootComponent = null;
+
+ for (Configurable child : children) {
+ child.disposeUIResources();
+ }
+ }
+} \ No newline at end of file
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/SteppingConfigurable.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/SteppingConfigurable.java
new file mode 100644
index 000000000000..5f16424c1790
--- /dev/null
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/SteppingConfigurable.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2000-2014 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.xdebugger.impl.settings;
+
+import com.intellij.openapi.options.Configurable;
+import com.intellij.xdebugger.XDebuggerBundle;
+import org.jetbrains.annotations.Nls;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.List;
+
+class SteppingConfigurable extends MergedCompositeConfigurable {
+ public SteppingConfigurable(@NotNull List<Configurable> configurables) {
+ super(configurables.toArray(new Configurable[configurables.size()]));
+ }
+
+ @NotNull
+ @Override
+ public String getId() {
+ return "debugger.stepping";
+ }
+
+ @Nls
+ @Override
+ public String getDisplayName() {
+ return XDebuggerBundle.message("debugger.stepping.display.name");
+ }
+} \ No newline at end of file
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/SubCompositeConfigurable.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/SubCompositeConfigurable.java
new file mode 100644
index 000000000000..489e4bd80307
--- /dev/null
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/SubCompositeConfigurable.java
@@ -0,0 +1,180 @@
+/*
+ * Copyright 2000-2014 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.xdebugger.impl.settings;
+
+import com.intellij.openapi.options.Configurable;
+import com.intellij.openapi.options.ConfigurationException;
+import com.intellij.openapi.options.SearchableConfigurable;
+import com.intellij.openapi.ui.VerticalFlowLayout;
+import com.intellij.ui.IdeBorderFactory;
+import com.intellij.xdebugger.impl.DebuggerSupport;
+import com.intellij.xdebugger.settings.XDebuggerSettings;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import javax.swing.*;
+import java.util.List;
+
+abstract class SubCompositeConfigurable implements SearchableConfigurable.Parent {
+ protected DataViewsConfigurableUi root;
+ protected Configurable[] children;
+ protected JComponent rootComponent;
+
+ @Override
+ public boolean hasOwnContent() {
+ return true;
+ }
+
+ @Override
+ public boolean isVisible() {
+ return true;
+ }
+
+ @Nullable
+ @Override
+ public Runnable enableSearch(String option) {
+ return null;
+ }
+
+ @Nullable
+ @Override
+ public String getHelpTopic() {
+ getConfigurables();
+ return children != null && children.length == 1 ? children[0].getHelpTopic() : null;
+ }
+
+ @Override
+ public final void disposeUIResources() {
+ root = null;
+ rootComponent = null;
+
+ if (isChildrenMerged()) {
+ for (Configurable child : children) {
+ child.disposeUIResources();
+ }
+ }
+ children = null;
+ }
+
+ protected XDebuggerDataViewSettings getSettings() {
+ return null;
+ }
+
+ @Nullable
+ protected abstract DataViewsConfigurableUi createRootUi();
+
+ @NotNull
+ protected abstract XDebuggerSettings.Category getCategory();
+
+ private boolean isChildrenMerged() {
+ return children != null && children.length == 1;
+ }
+
+ @Override
+ public final Configurable[] getConfigurables() {
+ if (children == null) {
+ List<Configurable> configurables = DebuggerConfigurableProvider.getConfigurables(getCategory());
+ children = configurables.toArray(new Configurable[configurables.size()]);
+ }
+ return isChildrenMerged() ? DebuggerConfigurable.EMPTY_CONFIGURABLES : children;
+ }
+
+ @Nullable
+ @Override
+ public final JComponent createComponent() {
+ if (rootComponent == null) {
+ if (root == null) {
+ root = createRootUi();
+ }
+
+ getConfigurables();
+ if (isChildrenMerged()) {
+ if (children.length == 0) {
+ rootComponent = root == null ? null : root.getComponent();
+ }
+ else if (root == null && children.length == 1) {
+ rootComponent = children[0].createComponent();
+ }
+ else {
+ JPanel panel = new JPanel(new VerticalFlowLayout(0, 0));
+ if (root != null) {
+ JComponent c = root.getComponent();
+ c.setBorder(MergedCompositeConfigurable.BOTTOM_INSETS);
+ panel.add(c);
+ }
+ for (Configurable child : children) {
+ JComponent component = child.createComponent();
+ if (component != null) {
+ component.setBorder(IdeBorderFactory.createTitledBorder(child.getDisplayName(), false));
+ panel.add(component);
+ }
+ }
+ rootComponent = panel;
+ }
+ }
+ else {
+ rootComponent = root == null ? null : root.getComponent();
+ }
+ }
+ return rootComponent;
+ }
+
+ @Override
+ public final void reset() {
+ if (root != null) {
+ root.reset(getSettings());
+ }
+
+ if (isChildrenMerged()) {
+ for (Configurable child : children) {
+ child.reset();
+ }
+ }
+ }
+
+ @Override
+ public final boolean isModified() {
+ if (root != null && root.isModified(getSettings())) {
+ return true;
+ }
+ else if (isChildrenMerged()) {
+ for (Configurable child : children) {
+ if (child.isModified()) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public final void apply() throws ConfigurationException {
+ if (root != null) {
+ root.apply(getSettings());
+ for (DebuggerSupport support : DebuggerSupport.getDebuggerSupports()) {
+ support.getSettingsPanelProvider().generalApplied(getCategory());
+ }
+ }
+
+ if (isChildrenMerged()) {
+ for (Configurable child : children) {
+ if (child.isModified()) {
+ child.apply();
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/XDebuggerDataViewSettings.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/XDebuggerDataViewSettings.java
index bff7c531119d..3dd802430ecf 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/XDebuggerDataViewSettings.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/XDebuggerDataViewSettings.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2011 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -16,15 +16,21 @@
package com.intellij.xdebugger.impl.settings;
import com.intellij.util.xmlb.annotations.Tag;
-import com.intellij.xdebugger.evaluation.EvaluationMode;
+import com.intellij.xdebugger.settings.XDebuggerSettingsManager;
/**
* @author nik
*/
@Tag("data-views")
-public class XDebuggerDataViewSettings {
+public class XDebuggerDataViewSettings implements XDebuggerSettingsManager.DataViewSettings {
+ static final int DEFAULT_VALUE_TOOLTIP_DELAY = 700;
+
private boolean mySortValues;
+ private boolean autoExpressions = true;
+ private int valueLookupDelay = DEFAULT_VALUE_TOOLTIP_DELAY;
+
+ @Override
@Tag("sort-values")
public boolean isSortValues() {
return mySortValues;
@@ -33,4 +39,22 @@ public class XDebuggerDataViewSettings {
public void setSortValues(boolean sortValues) {
mySortValues = sortValues;
}
+
+ @Override
+ public int getValueLookupDelay() {
+ return valueLookupDelay;
+ }
+
+ public void setValueLookupDelay(int value) {
+ valueLookupDelay = value;
+ }
+
+ @Override
+ public boolean isAutoExpressions() {
+ return autoExpressions;
+ }
+
+ public void setAutoExpressions(boolean autoExpressions) {
+ this.autoExpressions = autoExpressions;
+ }
}
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/XDebuggerGeneralSettings.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/XDebuggerGeneralSettings.java
index 1f89b1445fd1..9720d9517c51 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/XDebuggerGeneralSettings.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/XDebuggerGeneralSettings.java
@@ -26,6 +26,8 @@ public class XDebuggerGeneralSettings {
private EvaluationMode myEvaluationDialogMode = EvaluationMode.EXPRESSION;
private boolean myUnmuteOnStop = false;
+ private boolean hideDebuggerOnProcessTermination;
+
@Tag("evaluation-dialog-mode")
public EvaluationMode getEvaluationDialogMode() {
return myEvaluationDialogMode;
@@ -43,4 +45,12 @@ public class XDebuggerGeneralSettings {
public void setUnmuteOnStop(boolean unmuteOnStop) {
myUnmuteOnStop = unmuteOnStop;
}
+
+ public boolean isHideDebuggerOnProcessTermination() {
+ return hideDebuggerOnProcessTermination;
+ }
+
+ public void setHideDebuggerOnProcessTermination(boolean hideDebuggerOnProcessTermination) {
+ this.hideDebuggerOnProcessTermination = hideDebuggerOnProcessTermination;
+ }
}
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/XDebuggerSettingsManager.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/XDebuggerSettingsManager.java
index ae2dcbc4cca1..ad025dfc8d65 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/XDebuggerSettingsManager.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/XDebuggerSettingsManager.java
@@ -16,7 +16,6 @@
package com.intellij.xdebugger.impl.settings;
import com.intellij.openapi.components.*;
-import com.intellij.openapi.extensions.Extensions;
import com.intellij.util.xmlb.SkipDefaultValuesSerializationFilters;
import com.intellij.util.xmlb.XmlSerializer;
import com.intellij.util.xmlb.annotations.AbstractCollection;
@@ -26,12 +25,15 @@ import com.intellij.util.xmlb.annotations.Tag;
import com.intellij.xdebugger.settings.XDebuggerSettings;
import org.jdom.Element;
import org.jetbrains.annotations.NonNls;
+import org.jetbrains.annotations.NotNull;
import java.util.*;
/**
* @author nik
+ * todo rename to XDebuggerSettingsManagerImpl
*/
+@SuppressWarnings("ClassNameSameAsAncestorName")
@State(
name = XDebuggerSettingsManager.COMPONENT_NAME,
storages = {
@@ -40,26 +42,30 @@ import java.util.*;
)
}
)
-public class XDebuggerSettingsManager implements PersistentStateComponent<XDebuggerSettingsManager.SettingsState>{
+public class XDebuggerSettingsManager extends com.intellij.xdebugger.settings.XDebuggerSettingsManager implements PersistentStateComponent<XDebuggerSettingsManager.SettingsState> {
@NonNls public static final String COMPONENT_NAME = "XDebuggerSettings";
private Map<String, XDebuggerSettings<?>> mySettingsById;
private Map<Class<? extends XDebuggerSettings>, XDebuggerSettings<?>> mySettingsByClass;
private XDebuggerDataViewSettings myDataViewSettings = new XDebuggerDataViewSettings();
private XDebuggerGeneralSettings myGeneralSettings = new XDebuggerGeneralSettings();
- public static XDebuggerSettingsManager getInstance() {
- return ServiceManager.getService(XDebuggerSettingsManager.class);
+ public static XDebuggerSettingsManager getInstanceImpl() {
+ return (XDebuggerSettingsManager)com.intellij.xdebugger.settings.XDebuggerSettingsManager.getInstance();
}
+ @Override
public SettingsState getState() {
SettingsState settingsState = new SettingsState();
settingsState.setDataViewSettings(myDataViewSettings);
settingsState.setGeneralSettings(myGeneralSettings);
for (XDebuggerSettings<?> settings : getSettingsList()) {
- SpecificSettingsState state = new SpecificSettingsState();
- state.setId(settings.getId());
- state.setSettingsElement(XmlSerializer.serialize(settings.getState(), new SkipDefaultValuesSerializationFilters()));
- settingsState.getSpecificStates().add(state);
+ Object subState = settings.getState();
+ if (subState != null) {
+ SpecificSettingsState state = new SpecificSettingsState();
+ state.setId(settings.getId());
+ state.setSettingsElement(XmlSerializer.serialize(subState, new SkipDefaultValuesSerializationFilters()));
+ settingsState.getSpecificStates().add(state);
+ }
}
return settingsState;
}
@@ -69,6 +75,8 @@ public class XDebuggerSettingsManager implements PersistentStateComponent<XDebug
return Collections.unmodifiableCollection(mySettingsById.values());
}
+ @Override
+ @NotNull
public XDebuggerDataViewSettings getDataViewSettings() {
return myDataViewSettings;
}
@@ -77,6 +85,7 @@ public class XDebuggerSettingsManager implements PersistentStateComponent<XDebug
return myGeneralSettings;
}
+ @Override
public void loadState(final SettingsState state) {
myDataViewSettings = state.getDataViewSettings();
myGeneralSettings = state.getGeneralSettings();
@@ -95,9 +104,10 @@ public class XDebuggerSettingsManager implements PersistentStateComponent<XDebug
private void initSettings() {
if (mySettingsById == null) {
- mySettingsById = new HashMap<String, XDebuggerSettings<?>>();
- mySettingsByClass = new HashMap<Class<? extends XDebuggerSettings>, XDebuggerSettings<?>>();
- for (XDebuggerSettings settings : Extensions.getExtensions(XDebuggerSettings.EXTENSION_POINT)) {
+ XDebuggerSettings[] extensions = XDebuggerSettings.EXTENSION_POINT.getExtensions();
+ mySettingsById = new LinkedHashMap<String, XDebuggerSettings<?>>(extensions.length);
+ mySettingsByClass = new LinkedHashMap<Class<? extends XDebuggerSettings>, XDebuggerSettings<?>>(extensions.length);
+ for (XDebuggerSettings settings : extensions) {
mySettingsById.put(settings.getId(), settings);
mySettingsByClass.put(settings.getClass(), settings);
}
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/XDebuggerSettingsPanelProviderImpl.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/XDebuggerSettingsPanelProviderImpl.java
index 6dc0a5bc21d9..2e20230198c6 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/XDebuggerSettingsPanelProviderImpl.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/XDebuggerSettingsPanelProviderImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -16,26 +16,55 @@
package com.intellij.xdebugger.impl.settings;
import com.intellij.openapi.options.Configurable;
-import com.intellij.openapi.project.Project;
+import com.intellij.util.SmartList;
+import com.intellij.util.containers.ContainerUtil;
import com.intellij.xdebugger.settings.XDebuggerSettings;
+import org.jetbrains.annotations.NotNull;
-import java.util.ArrayList;
import java.util.Collection;
+import java.util.List;
/**
* @author nik
*/
public class XDebuggerSettingsPanelProviderImpl extends DebuggerSettingsPanelProvider {
- public int getPriority() {
- return 0;
- }
-
+ @NotNull
+ @Override
public Collection<? extends Configurable> getConfigurables() {
- ArrayList<Configurable> list = new ArrayList<Configurable>();
- for (XDebuggerSettings settings : XDebuggerSettingsManager.getInstance().getSettingsList()) {
- list.add(settings.createConfigurable());
+ List<Configurable> list = new SmartList<Configurable>();
+ for (XDebuggerSettings settings : XDebuggerSettingsManager.getInstanceImpl().getSettingsList()) {
+ ContainerUtil.addIfNotNull(list, settings.createConfigurable());
}
return list;
}
+ @NotNull
+ @Override
+ public Collection<? extends Configurable> getConfigurable(@NotNull XDebuggerSettings.Category category) {
+ List<Configurable> list;
+ if (category == XDebuggerSettings.Category.ROOT) {
+ list = new SmartList<Configurable>(new GeneralConfigurable());
+ }
+ else {
+ list = null;
+ }
+
+ for (XDebuggerSettings settings : XDebuggerSettingsManager.getInstanceImpl().getSettingsList()) {
+ Configurable configurable = settings.createConfigurable(category);
+ if (configurable != null) {
+ if (list == null) {
+ list = new SmartList<Configurable>();
+ }
+ list.add(configurable);
+ }
+ }
+ return ContainerUtil.notNullize(list);
+ }
+
+ @Override
+ public void generalApplied(@NotNull XDebuggerSettings.Category category) {
+ for (XDebuggerSettings settings : XDebuggerSettingsManager.getInstanceImpl().getSettingsList()) {
+ settings.generalApplied(category);
+ }
+ }
}
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/ExecutionPointHighlighter.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/ExecutionPointHighlighter.java
index 0065a2843aac..853611b62d7d 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/ExecutionPointHighlighter.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/ExecutionPointHighlighter.java
@@ -18,6 +18,7 @@ package com.intellij.xdebugger.impl.ui;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.Editor;
+import com.intellij.openapi.editor.colors.EditorColorsListener;
import com.intellij.openapi.editor.colors.EditorColorsManager;
import com.intellij.openapi.editor.colors.EditorColorsScheme;
import com.intellij.openapi.editor.markup.GutterIconRenderer;
@@ -53,6 +54,17 @@ public class ExecutionPointHighlighter {
public ExecutionPointHighlighter(final Project project) {
myProject = project;
+
+ // Update highlighter colors if global color schema was changed
+ final EditorColorsManager colorsManager = EditorColorsManager.getInstance();
+ if (colorsManager != null) { // in some debugger tests EditorColorsManager component isn't loaded
+ colorsManager.addEditorColorsListener(new EditorColorsListener() {
+ @Override
+ public void globalSchemeChange(EditorColorsScheme scheme) {
+ update();
+ }
+ }, project);
+ }
}
public void show(final @NotNull XSourcePosition position, final boolean useSelection,
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/XDebuggerTree.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/XDebuggerTree.java
index afb22607d5d6..d097b09ac3ac 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/XDebuggerTree.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/XDebuggerTree.java
@@ -20,6 +20,7 @@ import com.intellij.openapi.Disposable;
import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.keymap.KeymapManager;
import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.Condition;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vcs.changes.issueLinks.TreeLinkMouseListener;
import com.intellij.ui.DoubleClickListener;
@@ -331,4 +332,23 @@ public class XDebuggerTree extends DnDAwareTree implements DataProvider, Disposa
public TransferToEDTQueue<Runnable> getLaterInvocator() {
return myLaterInvocator;
}
+
+ public void expandNodesOnLoad(final Condition<TreeNode> nodeFilter) {
+ addTreeListener(new XDebuggerTreeListener() {
+ @Override
+ public void nodeLoaded(@NotNull RestorableStateNode node, String name) {
+ if (nodeFilter.value(node) && !node.isLeaf()) {
+ // cause children computing
+ node.getChildCount();
+ }
+ }
+
+ @Override
+ public void childrenLoaded(@NotNull XDebuggerTreeNode node, @NotNull List<XValueContainerNode<?>> children, boolean last) {
+ if (nodeFilter.value(node)) {
+ expandPath(node.getPath());
+ }
+ }
+ });
+ }
}
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/actions/SortValuesToggleAction.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/actions/SortValuesToggleAction.java
index 00d803d68244..e399dbd96eba 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/actions/SortValuesToggleAction.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/actions/SortValuesToggleAction.java
@@ -27,12 +27,12 @@ import com.intellij.xdebugger.impl.settings.XDebuggerSettingsManager;
public class SortValuesToggleAction extends ToggleAction implements DumbAware {
@Override
public boolean isSelected(AnActionEvent e) {
- return XDebuggerSettingsManager.getInstance().getDataViewSettings().isSortValues();
+ return XDebuggerSettingsManager.getInstanceImpl().getDataViewSettings().isSortValues();
}
@Override
public void setSelected(AnActionEvent e, boolean state) {
- XDebuggerSettingsManager.getInstance().getDataViewSettings().setSortValues(state);
+ XDebuggerSettingsManager.getInstanceImpl().getDataViewSettings().setSortValues(state);
XDebuggerUtilImpl.rebuildAllSessionsViews(e.getProject());
}
}
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/nodes/XValueContainerNode.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/nodes/XValueContainerNode.java
index 38d2547831fe..b9f90fe86b2b 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/nodes/XValueContainerNode.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/nodes/XValueContainerNode.java
@@ -21,9 +21,9 @@ import com.intellij.util.SmartList;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.containers.SortedList;
import com.intellij.xdebugger.frame.*;
-import com.intellij.xdebugger.impl.settings.XDebuggerSettingsManager;
import com.intellij.xdebugger.impl.ui.XDebuggerUIConstants;
import com.intellij.xdebugger.impl.ui.tree.XDebuggerTree;
+import com.intellij.xdebugger.settings.XDebuggerSettingsManager;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
diff --git a/platform/xdebugger-impl/testSrc/com/intellij/xdebugger/XDebuggerSettingsTest.java b/platform/xdebugger-impl/testSrc/com/intellij/xdebugger/XDebuggerSettingsTest.java
index ff4b0d2f1a89..a4b7431d276f 100644
--- a/platform/xdebugger-impl/testSrc/com/intellij/xdebugger/XDebuggerSettingsTest.java
+++ b/platform/xdebugger-impl/testSrc/com/intellij/xdebugger/XDebuggerSettingsTest.java
@@ -36,11 +36,11 @@ public class XDebuggerSettingsTest extends PlatformLiteFixture {
registerExtensionPoint(XDebuggerSettings.EXTENSION_POINT, XDebuggerSettings.class);
registerExtension(XDebuggerSettings.EXTENSION_POINT, new MyDebuggerSettings());
getApplication().registerService(XDebuggerUtil.class, XDebuggerUtilImpl.class);
- getApplication().registerService(XDebuggerSettingsManager.class, XDebuggerSettingsManager.class);
+ getApplication().registerService(com.intellij.xdebugger.settings.XDebuggerSettingsManager.class, XDebuggerSettingsManager.class);
}
public void testSerialize() throws Exception {
- XDebuggerSettingsManager settingsManager = XDebuggerSettingsManager.getInstance();
+ XDebuggerSettingsManager settingsManager = XDebuggerSettingsManager.getInstanceImpl();
MyDebuggerSettings settings = MyDebuggerSettings.getInstance();
assertNotNull(settings);
diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/META-INF/InspectionGadgets.xml b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/META-INF/InspectionGadgets.xml
index 890da15b546b..164c690d4da3 100644
--- a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/META-INF/InspectionGadgets.xml
+++ b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/META-INF/InspectionGadgets.xml
@@ -408,6 +408,10 @@
key="class.name.differs.from.file.name.display.name" groupBundle="messages.InspectionsBundle"
groupKey="group.names.class.structure" enabledByDefault="false" level="WARNING"
implementationClass="com.siyeh.ig.classlayout.ClassNameDiffersFromFileNameInspection"/>
+ <localInspection language="JAVA" shortName="ClassWithOnlyPrivateConstructors" bundle="com.siyeh.InspectionGadgetsBundle"
+ key="class.with.only.private.constructors.display.name" groupBundle="messages.InspectionsBundle"
+ groupKey="group.names.class.structure" enabledByDefault="false" level="WARNING"
+ implementationClass="com.siyeh.ig.classlayout.ClassWithOnlyPrivateConstructorsInspection"/>
<localInspection language="JAVA" shortName="ConstantDeclaredInAbstractClass" bundle="com.siyeh.InspectionGadgetsBundle"
key="constant.declared.in.abstract.class.display.name" groupBundle="messages.InspectionsBundle"
groupKey="group.names.class.structure" enabledByDefault="false" level="WARNING"
diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/InspectionGadgetsBundle.properties b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/InspectionGadgetsBundle.properties
index efeb65889a93..f92925b33bc0 100644
--- a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/InspectionGadgetsBundle.properties
+++ b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/InspectionGadgetsBundle.properties
@@ -2096,3 +2096,5 @@ serializable.local.class.stores.non.serializable.problem.descriptor=Serializable
serializable.anonymous.class.stores.non.serializable.problem.descriptor=Serializable anonymous class implicitly stores non-Serializable object of type ''{0}''
assignment.to.lambda.parameter.display.name=Assignment to lambda parameter
assignment.to.lambda.parameter.problem.descriptor=Assignment to lambda parameter <code>#ref</code> #loc
+class.with.only.private.constructors.display.name=Class with only 'private' constructors should be declared 'final'
+class.with.only.private.constructors.problem.descriptor=Class <code>#ref</code> with only 'private' constructors should be declared 'final'
diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/BaseGlobalInspection.java b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/BaseGlobalInspection.java
index b0f4a3633ad9..8d2e5049cdbc 100644
--- a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/BaseGlobalInspection.java
+++ b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/BaseGlobalInspection.java
@@ -16,6 +16,7 @@
package com.siyeh.ig;
import com.intellij.codeInspection.GlobalJavaBatchInspectionTool;
+import com.intellij.codeInspection.InspectionProfileEntry;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
@@ -34,8 +35,7 @@ public abstract class BaseGlobalInspection extends GlobalJavaBatchInspectionTool
assert name.endsWith(INSPECTION) :
"class name must end with 'Inspection' to correctly" +
" calculate the short name: " + name;
- shortName = name.substring(name.lastIndexOf((int)'.') + 1,
- name.length() - INSPECTION.length());
+ shortName = InspectionProfileEntry.getShortName(getClass().getSimpleName());
}
return shortName;
}
diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/assignment/AssignmentToMethodParameterInspection.java b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/assignment/AssignmentToMethodParameterInspection.java
index 56dbecc83d6b..5fb2f2b8ff5e 100644
--- a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/assignment/AssignmentToMethodParameterInspection.java
+++ b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/assignment/AssignmentToMethodParameterInspection.java
@@ -26,9 +26,6 @@ import javax.swing.*;
public class AssignmentToMethodParameterInspection extends BaseAssignmentToParameterInspection {
- @SuppressWarnings({"PublicField"})
- public boolean ignoreTransformationOfOriginalParameter = false;
-
@Override
@NotNull
public String getDisplayName() {
diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/classlayout/ClassWithOnlyPrivateConstructorsInspectionBase.java b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/classlayout/ClassWithOnlyPrivateConstructorsInspectionBase.java
new file mode 100644
index 000000000000..6d091699ce82
--- /dev/null
+++ b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/classlayout/ClassWithOnlyPrivateConstructorsInspectionBase.java
@@ -0,0 +1,91 @@
+/*
+ * Copyright 2000-2014 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.siyeh.ig.classlayout;
+
+import com.intellij.psi.PsiClass;
+import com.intellij.psi.PsiMethod;
+import com.intellij.psi.PsiModifier;
+import com.siyeh.InspectionGadgetsBundle;
+import com.siyeh.ig.BaseInspection;
+import com.siyeh.ig.BaseInspectionVisitor;
+import org.jetbrains.annotations.Nls;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * @author Bas Leijdekkers
+ */
+public class ClassWithOnlyPrivateConstructorsInspectionBase extends BaseInspection {
+ @Nls
+ @NotNull
+ @Override
+ public String getDisplayName() {
+ return InspectionGadgetsBundle.message("class.with.only.private.constructors.display.name");
+ }
+
+ @NotNull
+ @Override
+ protected String buildErrorString(Object... infos) {
+ return InspectionGadgetsBundle.message("class.with.only.private.constructors.problem.descriptor");
+ }
+
+ @Override
+ public BaseInspectionVisitor buildVisitor() {
+ return new ClassWithOnlyPrivateConstructorsVisitor();
+ }
+
+ private static class ClassWithOnlyPrivateConstructorsVisitor extends BaseInspectionVisitor {
+
+ @Override
+ public void visitClass(PsiClass aClass) {
+ super.visitClass(aClass);
+ final PsiMethod[] constructors = aClass.getConstructors();
+ if (constructors.length == 0) {
+ return;
+ }
+ for (PsiMethod constructor : constructors) {
+ if (constructor.hasModifierProperty(PsiModifier.FINAL)) {
+ return;
+ }
+ }
+ final PsiClass[] innerClasses = aClass.getInnerClasses();
+ for (PsiClass innerClass : innerClasses) {
+ if (isExtendedByInnerClass(innerClass, aClass, new HashSet<PsiClass>())) {
+ return;
+ }
+ }
+ registerClassError(aClass, aClass);
+ }
+
+ private static boolean isExtendedByInnerClass(PsiClass innerClass, PsiClass superClass, Set<PsiClass> visited) {
+ if (!visited.add(innerClass)) {
+ return false;
+ }
+ if (innerClass.isInheritor(superClass, false)) {
+ return true;
+ }
+ final PsiClass[] innerClasses = innerClass.getInnerClasses();
+ for (PsiClass aClass : innerClasses) {
+ if (isExtendedByInnerClass(aClass, superClass, visited)) {
+ return true;
+ }
+ }
+ return false;
+ }
+ }
+}
diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/controlflow/IfStatementWithIdenticalBranchesInspection.java b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/controlflow/IfStatementWithIdenticalBranchesInspection.java
index 755a4c349e21..0b7524de01a4 100644
--- a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/controlflow/IfStatementWithIdenticalBranchesInspection.java
+++ b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/controlflow/IfStatementWithIdenticalBranchesInspection.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2003-2011 Dave Griffith, Bas Leijdekkers
+ * Copyright 2003-2014 Dave Griffith, Bas Leijdekkers
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,12 +17,15 @@ package com.siyeh.ig.controlflow;
import com.intellij.codeInspection.ProblemDescriptor;
import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.Ref;
import com.intellij.psi.*;
import com.intellij.psi.search.LocalSearchScope;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.refactoring.extractMethod.InputVariables;
+import com.intellij.refactoring.util.duplicates.ConditionalReturnStatementValue;
import com.intellij.refactoring.util.duplicates.DuplicatesFinder;
import com.intellij.refactoring.util.duplicates.Match;
+import com.intellij.refactoring.util.duplicates.ReturnValue;
import com.intellij.util.IncorrectOperationException;
import com.siyeh.InspectionGadgetsBundle;
import com.siyeh.ig.BaseInspection;
@@ -158,12 +161,10 @@ public class IfStatementWithIdenticalBranchesInspection
return new IfStatementWithIdenticalBranchesVisitor();
}
- private static class IfStatementWithIdenticalBranchesVisitor
- extends BaseInspectionVisitor {
+ private static class IfStatementWithIdenticalBranchesVisitor extends BaseInspectionVisitor {
@Override
- public void visitIfStatement(
- @NotNull PsiIfStatement ifStatement) {
+ public void visitIfStatement(@NotNull PsiIfStatement ifStatement) {
super.visitIfStatement(ifStatement);
final PsiStatement elseBranch = ifStatement.getElseBranch();
final PsiStatement thenBranch = ifStatement.getThenBranch();
@@ -179,14 +180,18 @@ public class IfStatementWithIdenticalBranchesInspection
inputVariables, null,
Collections.<PsiVariable>emptyList());
if (elseBranch instanceof PsiIfStatement) {
- final PsiIfStatement statement =
- (PsiIfStatement)elseBranch;
+ final PsiIfStatement statement = (PsiIfStatement)elseBranch;
final PsiStatement branch = statement.getThenBranch();
if (branch == null) {
return;
}
final Match match = finder.isDuplicate(branch, true);
- if (match != null && match.getReturnValue() == null) {
+ if (match != null) {
+ final ReturnValue matchReturnValue = match.getReturnValue();
+ if (matchReturnValue instanceof ConditionalReturnStatementValue &&
+ !matchReturnValue.isEquivalent(buildReturnValue(thenBranch))) {
+ return;
+ }
registerStatementError(ifStatement, statement);
return;
}
@@ -197,11 +202,37 @@ public class IfStatementWithIdenticalBranchesInspection
else {
final Match match = finder.isDuplicate(elseBranch, true);
if (match != null) {
+ final ReturnValue matchReturnValue = match.getReturnValue();
+ if (matchReturnValue instanceof ConditionalReturnStatementValue &&
+ !matchReturnValue.isEquivalent(buildReturnValue(thenBranch))) {
+ return;
+ }
registerStatementError(ifStatement);
}
}
}
+ @Nullable
+ private ReturnValue buildReturnValue(PsiElement element) {
+ final Ref<PsiReturnStatement> result = Ref.create(null);
+ element.accept(new JavaRecursiveElementWalkingVisitor() {
+ @Override
+ public void visitReturnStatement(PsiReturnStatement statement) {
+ super.visitReturnStatement(statement);
+ result.set(statement);
+ }
+ });
+ final PsiReturnStatement returnStatement = result.get();
+ if (returnStatement == null) {
+ return null;
+ }
+ final PsiExpression expression = returnStatement.getReturnValue();
+ if (expression == null) {
+ return null;
+ }
+ return new ConditionalReturnStatementValue(expression);
+ }
+
private void checkIfStatementWithoutElseBranch(
PsiIfStatement ifStatement) {
final PsiStatement thenBranch = ifStatement.getThenBranch();
diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/dataflow/UnnecessaryLocalVariableInspectionBase.java b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/dataflow/UnnecessaryLocalVariableInspectionBase.java
index ad4273156865..0bc871664bfd 100644
--- a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/dataflow/UnnecessaryLocalVariableInspectionBase.java
+++ b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/dataflow/UnnecessaryLocalVariableInspectionBase.java
@@ -97,11 +97,6 @@ public class UnnecessaryLocalVariableInspectionBase extends BaseInspection {
}
@Override
- protected boolean buildQuickFixesOnlyForOnTheFlyErrors() {
- return true;
- }
-
- @Override
public BaseInspectionVisitor buildVisitor() {
return new UnnecessaryLocalVariableVisitor();
}
diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/numeric/PointlessArithmeticExpressionInspection.java b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/numeric/PointlessArithmeticExpressionInspection.java
index bebf5a559d15..023b4bc9f949 100644
--- a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/numeric/PointlessArithmeticExpressionInspection.java
+++ b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/numeric/PointlessArithmeticExpressionInspection.java
@@ -105,7 +105,7 @@ public class PointlessArithmeticExpressionInspection
fromTarget = (i == length - 1) ? polyadicExpression.getTokenBeforeOperand(operand) : operand;
break;
}
- else if ((tokenType.equals(JavaTokenType.MINUS) || tokenType.equals(JavaTokenType.DIV)) &&
+ else if ((tokenType.equals(JavaTokenType.MINUS) && i == 1 || tokenType.equals(JavaTokenType.DIV)) &&
EquivalenceChecker.expressionsAreEquivalent(previousOperand, operand)) {
fromTarget = previousOperand;
untilTarget = operand;
@@ -229,9 +229,10 @@ public class PointlessArithmeticExpressionInspection
private boolean subtractionExpressionIsPointless(PsiExpression[] expressions) {
PsiExpression previousExpression = null;
- for (PsiExpression expression : expressions) {
+ for (int i = 0; i < expressions.length; i++) {
+ PsiExpression expression = expressions[i];
if (previousExpression != null &&
- (isZero(expression) || EquivalenceChecker.expressionsAreEquivalent(previousExpression, expression))) {
+ (isZero(expression) || i == 1 && EquivalenceChecker.expressionsAreEquivalent(previousExpression, expression))) {
return true;
}
previousExpression = expression;
diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/performance/CallToSimpleGetterInClassInspection.java b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/performance/CallToSimpleGetterInClassInspection.java
deleted file mode 100644
index 997e57ba0cda..000000000000
--- a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/performance/CallToSimpleGetterInClassInspection.java
+++ /dev/null
@@ -1,198 +0,0 @@
-/*
- * Copyright 2003-2011 Dave Griffith, Bas Leijdekkers
- *
- * 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.siyeh.ig.performance;
-
-import com.intellij.codeInspection.ProblemDescriptor;
-import com.intellij.codeInspection.ui.MultipleCheckboxOptionsPanel;
-import com.intellij.openapi.project.Project;
-import com.intellij.psi.*;
-import com.intellij.psi.search.searches.OverridingMethodsSearch;
-import com.intellij.psi.util.PropertyUtil;
-import com.intellij.util.IncorrectOperationException;
-import com.intellij.util.Query;
-import com.siyeh.InspectionGadgetsBundle;
-import com.siyeh.ig.BaseInspection;
-import com.siyeh.ig.BaseInspectionVisitor;
-import com.siyeh.ig.InspectionGadgetsFix;
-import com.siyeh.ig.PsiReplacementUtil;
-import com.siyeh.ig.psiutils.ClassUtils;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import javax.swing.*;
-
-public class CallToSimpleGetterInClassInspection extends BaseInspection {
-
- @SuppressWarnings("UnusedDeclaration")
- public boolean ignoreGetterCallsOnOtherObjects = false;
-
- @SuppressWarnings("UnusedDeclaration")
- public boolean onlyReportPrivateGetter = false;
-
- @Override
- @NotNull
- public String getID() {
- return "CallToSimpleGetterFromWithinClass";
- }
-
- @Override
- @NotNull
- public String getDisplayName() {
- return InspectionGadgetsBundle.message("call.to.simple.getter.in.class.display.name");
- }
-
- @Override
- @NotNull
- public String buildErrorString(Object... infos) {
- return InspectionGadgetsBundle.message("call.to.simple.getter.in.class.problem.descriptor");
- }
-
- @Override
- @Nullable
- public JComponent createOptionsPanel() {
- final MultipleCheckboxOptionsPanel optionsPanel = new MultipleCheckboxOptionsPanel(this);
- optionsPanel.addCheckbox(InspectionGadgetsBundle.message("call.to.simple.getter.in.class.ignore.option"),
- "ignoreGetterCallsOnOtherObjects");
- optionsPanel.addCheckbox(InspectionGadgetsBundle.message("call.to.private.simple.getter.in.class.option"),
- "onlyReportPrivateGetter");
- return optionsPanel;
- }
-
- @Override
- public InspectionGadgetsFix buildFix(Object... infos) {
- return new InlineCallFix();
- }
-
- private static class InlineCallFix extends InspectionGadgetsFix {
- @NotNull
- @Override
- public String getFamilyName() {
- return getName();
- }
-
- @Override
- @NotNull
- public String getName() {
- return InspectionGadgetsBundle.message("call.to.simple.getter.in.class.inline.quickfix");
- }
-
- @Override
- public void doFix(Project project, ProblemDescriptor descriptor) throws IncorrectOperationException {
- final PsiElement methodIdentifier = descriptor.getPsiElement();
- final PsiReferenceExpression methodExpression = (PsiReferenceExpression)methodIdentifier.getParent();
- if (methodExpression == null) {
- return;
- }
- final PsiMethodCallExpression call = (PsiMethodCallExpression)methodExpression.getParent();
- if (call == null) {
- return;
- }
- final PsiMethod method = call.resolveMethod();
- if (method == null) {
- return;
- }
- final PsiCodeBlock body = method.getBody();
- if (body == null) {
- return;
- }
- final PsiStatement[] statements = body.getStatements();
- final PsiReturnStatement returnStatement = (PsiReturnStatement)statements[0];
- final PsiExpression returnValue = returnStatement.getReturnValue();
- if (!(returnValue instanceof PsiReferenceExpression)) {
- return;
- }
- final PsiReferenceExpression referenceExpression = (PsiReferenceExpression)returnValue;
- final PsiField field = (PsiField)referenceExpression.resolve();
- if (field == null) {
- return;
- }
- final String fieldName = field.getName();
- if (fieldName == null) {
- return;
- }
- final PsiExpression qualifier = methodExpression.getQualifierExpression();
- if (qualifier == null) {
- final JavaPsiFacade facade = JavaPsiFacade.getInstance(call.getProject());
- final PsiResolveHelper resolveHelper = facade.getResolveHelper();
- final PsiVariable variable = resolveHelper.resolveReferencedVariable(fieldName, call);
- if (variable == null) {
- return;
- }
- if (variable.equals(field)) {
- PsiReplacementUtil.replaceExpression(call, fieldName);
- }
- else {
- PsiReplacementUtil.replaceExpression(call, "this." + fieldName);
- }
- }
- else {
- PsiReplacementUtil.replaceExpression(call, qualifier.getText() + '.' + fieldName);
- }
- }
- }
-
- @Override
- public BaseInspectionVisitor buildVisitor() {
- return new CallToSimpleGetterInClassVisitor();
- }
-
- private class CallToSimpleGetterInClassVisitor extends BaseInspectionVisitor {
-
- @Override
- public void visitMethodCallExpression(@NotNull PsiMethodCallExpression call) {
- super.visitMethodCallExpression(call);
- final PsiClass containingClass = ClassUtils.getContainingClass(call);
- if (containingClass == null) {
- return;
- }
- final PsiMethod method = call.resolveMethod();
- if (method == null) {
- return;
- }
- if (!containingClass.equals(method.getContainingClass())) {
- return;
- }
- final PsiReferenceExpression methodExpression = call.getMethodExpression();
- final PsiExpression qualifier = methodExpression.getQualifierExpression();
- if (qualifier != null && !(qualifier instanceof PsiThisExpression)) {
- if (ignoreGetterCallsOnOtherObjects) {
- return;
- }
- final PsiType type = qualifier.getType();
- if (!(type instanceof PsiClassType)) {
- return;
- }
- final PsiClassType classType = (PsiClassType)type;
- final PsiClass qualifierClass = classType.resolve();
- if (!containingClass.equals(qualifierClass)) {
- return;
- }
- }
- if (!PropertyUtil.isSimpleGetter(method)) {
- return;
- }
- if (onlyReportPrivateGetter && !method.hasModifierProperty(PsiModifier.PRIVATE)) {
- return;
- }
- final Query<PsiMethod> query = OverridingMethodsSearch.search(method, true);
- final PsiMethod overridingMethod = query.findFirst();
- if (overridingMethod != null) {
- return;
- }
- registerMethodCallError(call);
- }
- }
-} \ No newline at end of file
diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/performance/CallToSimpleGetterInClassInspectionBase.java b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/performance/CallToSimpleGetterInClassInspectionBase.java
new file mode 100644
index 000000000000..f21fd50918da
--- /dev/null
+++ b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/performance/CallToSimpleGetterInClassInspectionBase.java
@@ -0,0 +1,103 @@
+/*
+ * Copyright 2000-2014 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.siyeh.ig.performance;
+
+import com.intellij.psi.*;
+import com.intellij.psi.search.searches.OverridingMethodsSearch;
+import com.intellij.psi.util.PropertyUtil;
+import com.intellij.util.Query;
+import com.siyeh.InspectionGadgetsBundle;
+import com.siyeh.ig.BaseInspection;
+import com.siyeh.ig.BaseInspectionVisitor;
+import com.siyeh.ig.psiutils.ClassUtils;
+import org.jetbrains.annotations.NotNull;
+
+public class CallToSimpleGetterInClassInspectionBase extends BaseInspection {
+ @SuppressWarnings("UnusedDeclaration")
+ public boolean ignoreGetterCallsOnOtherObjects = false;
+ @SuppressWarnings("UnusedDeclaration")
+ public boolean onlyReportPrivateGetter = false;
+
+ @Override
+ @NotNull
+ public String getID() {
+ return "CallToSimpleGetterFromWithinClass";
+ }
+
+ @Override
+ @NotNull
+ public String getDisplayName() {
+ return InspectionGadgetsBundle.message("call.to.simple.getter.in.class.display.name");
+ }
+
+ @Override
+ @NotNull
+ public String buildErrorString(Object... infos) {
+ return InspectionGadgetsBundle.message("call.to.simple.getter.in.class.problem.descriptor");
+ }
+
+ @Override
+ public BaseInspectionVisitor buildVisitor() {
+ return new CallToSimpleGetterInClassVisitor();
+ }
+
+ private class CallToSimpleGetterInClassVisitor extends BaseInspectionVisitor {
+
+ @Override
+ public void visitMethodCallExpression(@NotNull PsiMethodCallExpression call) {
+ super.visitMethodCallExpression(call);
+ final PsiClass containingClass = ClassUtils.getContainingClass(call);
+ if (containingClass == null) {
+ return;
+ }
+ final PsiMethod method = call.resolveMethod();
+ if (method == null) {
+ return;
+ }
+ if (!containingClass.equals(method.getContainingClass())) {
+ return;
+ }
+ final PsiReferenceExpression methodExpression = call.getMethodExpression();
+ final PsiExpression qualifier = methodExpression.getQualifierExpression();
+ if (qualifier != null && !(qualifier instanceof PsiThisExpression)) {
+ if (ignoreGetterCallsOnOtherObjects) {
+ return;
+ }
+ final PsiType type = qualifier.getType();
+ if (!(type instanceof PsiClassType)) {
+ return;
+ }
+ final PsiClassType classType = (PsiClassType)type;
+ final PsiClass qualifierClass = classType.resolve();
+ if (!containingClass.equals(qualifierClass)) {
+ return;
+ }
+ }
+ if (!PropertyUtil.isSimpleGetter(method)) {
+ return;
+ }
+ if (onlyReportPrivateGetter && !method.hasModifierProperty(PsiModifier.PRIVATE)) {
+ return;
+ }
+ final Query<PsiMethod> query = OverridingMethodsSearch.search(method, true);
+ final PsiMethod overridingMethod = query.findFirst();
+ if (overridingMethod != null) {
+ return;
+ }
+ registerMethodCallError(call);
+ }
+ }
+}
diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/performance/CallToSimpleSetterInClassInspection.java b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/performance/CallToSimpleSetterInClassInspection.java
deleted file mode 100644
index bfcf47cd0465..000000000000
--- a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/performance/CallToSimpleSetterInClassInspection.java
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- * Copyright 2003-2011 Dave Griffith, Bas Leijdekkers
- *
- * 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.siyeh.ig.performance;
-
-import com.intellij.codeInspection.ProblemDescriptor;
-import com.intellij.codeInspection.ui.MultipleCheckboxOptionsPanel;
-import com.intellij.openapi.project.Project;
-import com.intellij.psi.*;
-import com.intellij.psi.search.searches.OverridingMethodsSearch;
-import com.intellij.psi.util.PropertyUtil;
-import com.intellij.util.IncorrectOperationException;
-import com.intellij.util.Query;
-import com.siyeh.InspectionGadgetsBundle;
-import com.siyeh.ig.BaseInspection;
-import com.siyeh.ig.BaseInspectionVisitor;
-import com.siyeh.ig.InspectionGadgetsFix;
-import com.siyeh.ig.PsiReplacementUtil;
-import com.siyeh.ig.psiutils.ClassUtils;
-import org.jetbrains.annotations.NonNls;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import javax.swing.*;
-
-public class CallToSimpleSetterInClassInspection extends BaseInspection {
-
- @SuppressWarnings("UnusedDeclaration")
- public boolean ignoreSetterCallsOnOtherObjects = false;
-
- @SuppressWarnings("UnusedDeclaration")
- public boolean onlyReportPrivateSetter = false;
-
- @Override
- @NotNull
- public String getID() {
- return "CallToSimpleSetterFromWithinClass";
- }
-
- @Override
- @NotNull
- public String getDisplayName() {
- return InspectionGadgetsBundle.message("call.to.simple.setter.in.class.display.name");
- }
-
- @Override
- @NotNull
- public String buildErrorString(Object... infos) {
- return InspectionGadgetsBundle.message("call.to.simple.setter.in.class.problem.descriptor");
- }
-
- @Override
- @Nullable
- public JComponent createOptionsPanel() {
- final MultipleCheckboxOptionsPanel optionsPanel = new MultipleCheckboxOptionsPanel(this);
- optionsPanel.addCheckbox(InspectionGadgetsBundle.message("call.to.simple.setter.in.class.ignore.option"),
- "ignoreSetterCallsOnOtherObjects");
- optionsPanel.addCheckbox(InspectionGadgetsBundle.message("call.to.private.setter.in.class.option"),
- "onlyReportPrivateSetter");
- return optionsPanel;
- }
-
- @Override
- public InspectionGadgetsFix buildFix(Object... infos) {
- return new InlineCallFix();
- }
-
- private static class InlineCallFix extends InspectionGadgetsFix {
-
- @Override
- @NotNull
- public String getName() {
- return InspectionGadgetsBundle.message("call.to.simple.setter.in.class.inline.quickfix");
- }
-
- @NotNull
- @Override
- public String getFamilyName() {
- return getName();
- }
-
- @Override
- public void doFix(Project project, ProblemDescriptor descriptor)
- throws IncorrectOperationException {
- final PsiElement methodIdentifier = descriptor.getPsiElement();
- final PsiReferenceExpression methodExpression = (PsiReferenceExpression)methodIdentifier.getParent();
- if (methodExpression == null) {
- return;
- }
- final PsiMethodCallExpression call = (PsiMethodCallExpression)methodExpression.getParent();
- if (call == null) {
- return;
- }
- final PsiExpressionList argumentList = call.getArgumentList();
- final PsiExpression[] arguments = argumentList.getExpressions();
- final PsiExpression argument = arguments[0];
- final PsiMethod method = call.resolveMethod();
- if (method == null) {
- return;
- }
- final PsiCodeBlock body = method.getBody();
- if (body == null) {
- return;
- }
- final PsiStatement[] statements = body.getStatements();
- final PsiExpressionStatement assignmentStatement = (PsiExpressionStatement)statements[0];
- final PsiAssignmentExpression assignment = (PsiAssignmentExpression)assignmentStatement.getExpression();
- final PsiExpression qualifier = methodExpression.getQualifierExpression();
- final PsiReferenceExpression lhs = (PsiReferenceExpression)assignment.getLExpression();
- final PsiField field = (PsiField)lhs.resolve();
- if (field == null) {
- return;
- }
- final String fieldName = field.getName();
- if (qualifier == null) {
- final JavaPsiFacade manager = JavaPsiFacade.getInstance(call.getProject());
- final PsiResolveHelper resolveHelper = manager.getResolveHelper();
- final PsiVariable variable = resolveHelper.resolveReferencedVariable(fieldName, call);
- if (variable == null) {
- return;
- }
- @NonNls final String newExpression;
- if (variable.equals(field)) {
- newExpression = fieldName + " = " + argument.getText();
- }
- else {
- newExpression = "this." + fieldName + " = " + argument.getText();
- }
- PsiReplacementUtil.replaceExpression(call, newExpression);
- }
- else {
- final String newExpression = qualifier.getText() + '.' + fieldName + " = " + argument.getText();
- PsiReplacementUtil.replaceExpression(call, newExpression);
- }
- }
- }
-
- @Override
- public BaseInspectionVisitor buildVisitor() {
- return new CallToSimpleSetterInClassVisitor();
- }
-
- private class CallToSimpleSetterInClassVisitor extends BaseInspectionVisitor {
-
- @Override
- public void visitMethodCallExpression(@NotNull PsiMethodCallExpression call) {
- super.visitMethodCallExpression(call);
- final PsiClass containingClass = ClassUtils.getContainingClass(call);
- if (containingClass == null) {
- return;
- }
- final PsiMethod method = call.resolveMethod();
- if (method == null) {
- return;
- }
- if (!containingClass.equals(method.getContainingClass())) {
- return;
- }
- final PsiReferenceExpression methodExpression = call.getMethodExpression();
- final PsiExpression qualifier = methodExpression.getQualifierExpression();
- if (qualifier != null && !(qualifier instanceof PsiThisExpression)) {
- if (ignoreSetterCallsOnOtherObjects) {
- return;
- }
- final PsiType type = qualifier.getType();
- if (!(type instanceof PsiClassType)) {
- return;
- }
- final PsiClassType classType = (PsiClassType)type;
- final PsiClass qualifierClass = classType.resolve();
- if (!containingClass.equals(qualifierClass)) {
- return;
- }
- }
- if (!PropertyUtil.isSimpleSetter(method)) {
- return;
- }
- if (onlyReportPrivateSetter && !method.hasModifierProperty(PsiModifier.PRIVATE)) {
- return;
- }
- final Query<PsiMethod> query = OverridingMethodsSearch.search(method, true);
- final PsiMethod overridingMethod = query.findFirst();
- if (overridingMethod != null) {
- return;
- }
- registerMethodCallError(call);
- }
- }
-} \ No newline at end of file
diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/performance/CallToSimpleSetterInClassInspectionBase.java b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/performance/CallToSimpleSetterInClassInspectionBase.java
new file mode 100644
index 000000000000..6e6512a8866a
--- /dev/null
+++ b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/performance/CallToSimpleSetterInClassInspectionBase.java
@@ -0,0 +1,103 @@
+/*
+ * Copyright 2000-2014 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.siyeh.ig.performance;
+
+import com.intellij.psi.*;
+import com.intellij.psi.search.searches.OverridingMethodsSearch;
+import com.intellij.psi.util.PropertyUtil;
+import com.intellij.util.Query;
+import com.siyeh.InspectionGadgetsBundle;
+import com.siyeh.ig.BaseInspection;
+import com.siyeh.ig.BaseInspectionVisitor;
+import com.siyeh.ig.psiutils.ClassUtils;
+import org.jetbrains.annotations.NotNull;
+
+public class CallToSimpleSetterInClassInspectionBase extends BaseInspection {
+ @SuppressWarnings("UnusedDeclaration")
+ public boolean ignoreSetterCallsOnOtherObjects = false;
+ @SuppressWarnings("UnusedDeclaration")
+ public boolean onlyReportPrivateSetter = false;
+
+ @Override
+ @NotNull
+ public String getID() {
+ return "CallToSimpleSetterFromWithinClass";
+ }
+
+ @Override
+ @NotNull
+ public String getDisplayName() {
+ return InspectionGadgetsBundle.message("call.to.simple.setter.in.class.display.name");
+ }
+
+ @Override
+ @NotNull
+ public String buildErrorString(Object... infos) {
+ return InspectionGadgetsBundle.message("call.to.simple.setter.in.class.problem.descriptor");
+ }
+
+ @Override
+ public BaseInspectionVisitor buildVisitor() {
+ return new CallToSimpleSetterInClassVisitor();
+ }
+
+ private class CallToSimpleSetterInClassVisitor extends BaseInspectionVisitor {
+
+ @Override
+ public void visitMethodCallExpression(@NotNull PsiMethodCallExpression call) {
+ super.visitMethodCallExpression(call);
+ final PsiClass containingClass = ClassUtils.getContainingClass(call);
+ if (containingClass == null) {
+ return;
+ }
+ final PsiMethod method = call.resolveMethod();
+ if (method == null) {
+ return;
+ }
+ if (!containingClass.equals(method.getContainingClass())) {
+ return;
+ }
+ final PsiReferenceExpression methodExpression = call.getMethodExpression();
+ final PsiExpression qualifier = methodExpression.getQualifierExpression();
+ if (qualifier != null && !(qualifier instanceof PsiThisExpression)) {
+ if (ignoreSetterCallsOnOtherObjects) {
+ return;
+ }
+ final PsiType type = qualifier.getType();
+ if (!(type instanceof PsiClassType)) {
+ return;
+ }
+ final PsiClassType classType = (PsiClassType)type;
+ final PsiClass qualifierClass = classType.resolve();
+ if (!containingClass.equals(qualifierClass)) {
+ return;
+ }
+ }
+ if (!PropertyUtil.isSimpleSetter(method)) {
+ return;
+ }
+ if (onlyReportPrivateSetter && !method.hasModifierProperty(PsiModifier.PRIVATE)) {
+ return;
+ }
+ final Query<PsiMethod> query = OverridingMethodsSearch.search(method, true);
+ final PsiMethod overridingMethod = query.findFirst();
+ if (overridingMethod != null) {
+ return;
+ }
+ registerMethodCallError(call);
+ }
+ }
+}
diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/psiutils/ImportUtils.java b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/psiutils/ImportUtils.java
index 712449655cdd..375e0f6a8017 100644
--- a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/psiutils/ImportUtils.java
+++ b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/psiutils/ImportUtils.java
@@ -388,6 +388,14 @@ public class ImportUtils {
}
final PsiImportStatementBase existingImportStatement = importList.findSingleImportStatement(memberName);
if (existingImportStatement != null) {
+ if (existingImportStatement instanceof PsiImportStaticStatement) {
+ final PsiImportStaticStatement importStaticStatement = (PsiImportStaticStatement)existingImportStatement;
+ if (!memberName.equals(importStaticStatement.getReferenceName())) {
+ return false;
+ }
+ final PsiClass targetClass = importStaticStatement.resolveTargetClass();
+ return targetClass != null && qualifierClass.equals(targetClass.getQualifiedName());
+ }
return false;
}
final PsiImportStaticStatement onDemandImportStatement = findOnDemandImportStaticStatement(importList, qualifierClass);
diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/style/UnnecessaryInterfaceModifierInspection.java b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/style/UnnecessaryInterfaceModifierInspection.java
index 0a4b57e8543b..310cc20c30b6 100644
--- a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/style/UnnecessaryInterfaceModifierInspection.java
+++ b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/style/UnnecessaryInterfaceModifierInspection.java
@@ -19,6 +19,7 @@ import com.intellij.codeInspection.CleanupLocalInspectionTool;
import com.intellij.codeInspection.ProblemDescriptor;
import com.intellij.openapi.project.Project;
import com.intellij.psi.*;
+import com.intellij.psi.util.PsiUtil;
import com.siyeh.InspectionGadgetsBundle;
import com.siyeh.ig.BaseInspection;
import com.siyeh.ig.BaseInspectionVisitor;
@@ -121,8 +122,10 @@ public class UnnecessaryInterfaceModifierInspection extends BaseInspection imple
}
modifierList = (PsiModifierList)parent;
}
- modifierList.setModifierProperty(PsiModifier.STATIC, false);
final PsiElement modifierOwner = modifierList.getParent();
+ if (!(modifierOwner instanceof PsiMethod && PsiUtil.isLanguageLevel8OrHigher(modifierList))) {
+ modifierList.setModifierProperty(PsiModifier.STATIC, false);
+ }
assert modifierOwner != null;
if (modifierOwner instanceof PsiClass) {
final PsiClass aClass = (PsiClass)modifierOwner;
diff --git a/plugins/InspectionGadgets/src/com/siyeh/ig/classlayout/ClassWithOnlyPrivateConstructorsInspection.java b/plugins/InspectionGadgets/src/com/siyeh/ig/classlayout/ClassWithOnlyPrivateConstructorsInspection.java
new file mode 100644
index 000000000000..3aeebcd724e8
--- /dev/null
+++ b/plugins/InspectionGadgets/src/com/siyeh/ig/classlayout/ClassWithOnlyPrivateConstructorsInspection.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2000-2014 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.siyeh.ig.classlayout;
+
+import com.intellij.psi.PsiClass;
+import com.siyeh.ig.InspectionGadgetsFix;
+import com.siyeh.ig.fixes.MakeClassFinalFix;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * @author Bas Leijdekkers
+ */
+public class ClassWithOnlyPrivateConstructorsInspection extends ClassWithOnlyPrivateConstructorsInspectionBase {
+
+ @Nullable
+ @Override
+ protected InspectionGadgetsFix buildFix(Object... infos) {
+ return new MakeClassFinalFix((PsiClass)infos[0]);
+ }
+}
diff --git a/plugins/InspectionGadgets/src/com/siyeh/ig/fixes/InlineCallFix.java b/plugins/InspectionGadgets/src/com/siyeh/ig/fixes/InlineCallFix.java
index 43e57741bbe3..b9503e220c68 100644
--- a/plugins/InspectionGadgets/src/com/siyeh/ig/fixes/InlineCallFix.java
+++ b/plugins/InspectionGadgets/src/com/siyeh/ig/fixes/InlineCallFix.java
@@ -16,52 +16,54 @@
package com.siyeh.ig.fixes;
import com.intellij.codeInspection.ProblemDescriptor;
-import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiElement;
+import com.intellij.psi.PsiMethod;
import com.intellij.psi.PsiMethodCallExpression;
import com.intellij.psi.PsiReferenceExpression;
-import com.intellij.refactoring.JavaRefactoringActionHandlerFactory;
-import com.intellij.refactoring.RefactoringActionHandler;
+import com.intellij.refactoring.JavaRefactoringSettings;
+import com.intellij.refactoring.inline.InlineMethodProcessor;
import com.siyeh.InspectionGadgetsBundle;
import com.siyeh.ig.InspectionGadgetsFix;
import org.jetbrains.annotations.NotNull;
public class InlineCallFix extends InspectionGadgetsFix {
- @Override
- @NotNull
- public String getFamilyName() {
- return getName();
- }
+ private String myName;
+
+ public InlineCallFix(String name) {
+ myName = name;
+ }
+
+ public InlineCallFix() {
+ this(InspectionGadgetsBundle.message("inline.call.quickfix"));
+ }
+
+ @Override
+ @NotNull
+ public String getFamilyName() {
+ return myName;
+ }
@Override
@NotNull
public String getName() {
- return InspectionGadgetsBundle.message("inline.call.quickfix");
+ return getFamilyName();
}
@Override
public void doFix(final Project project, ProblemDescriptor descriptor) {
final PsiElement nameElement = descriptor.getPsiElement();
- final PsiReferenceExpression methodExpression =
- (PsiReferenceExpression)nameElement.getParent();
- assert methodExpression != null;
- final PsiMethodCallExpression methodCallExpression =
- (PsiMethodCallExpression)methodExpression.getParent();
- final JavaRefactoringActionHandlerFactory factory =
- JavaRefactoringActionHandlerFactory.getInstance();
- final RefactoringActionHandler inlineHandler = factory.createInlineHandler();
- final Runnable runnable = new Runnable() {
- @Override
- public void run() {
- inlineHandler.invoke(project, new PsiElement[]{methodCallExpression}, null);
- }
- };
- if (ApplicationManager.getApplication().isUnitTestMode()) {
- runnable.run();
- }
- else {
- ApplicationManager.getApplication().invokeLater(runnable, project.getDisposed());
- }
+ final PsiReferenceExpression methodExpression = (PsiReferenceExpression)nameElement.getParent();
+ if (methodExpression == null) return;
+ final PsiMethodCallExpression methodCallExpression = (PsiMethodCallExpression)methodExpression.getParent();
+ final PsiMethod method = methodCallExpression.resolveMethod();
+ if (method == null) return;
+ inline(project, methodExpression, method);
+ }
+
+ protected void inline(Project project, PsiReferenceExpression methodExpression, PsiMethod method) {
+ new InlineMethodProcessor(project, method, methodExpression, null, true,
+ JavaRefactoringSettings.getInstance().RENAME_SEARCH_IN_COMMENTS_FOR_METHOD,
+ JavaRefactoringSettings.getInstance().RENAME_SEARCH_FOR_TEXT_FOR_METHOD).inlineMethodCall(methodExpression);
}
}
diff --git a/plugins/InspectionGadgets/src/com/siyeh/ig/performance/CallToSimpleGetterInClassInspection.java b/plugins/InspectionGadgets/src/com/siyeh/ig/performance/CallToSimpleGetterInClassInspection.java
new file mode 100644
index 000000000000..c550093cef63
--- /dev/null
+++ b/plugins/InspectionGadgets/src/com/siyeh/ig/performance/CallToSimpleGetterInClassInspection.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2003-2011 Dave Griffith, Bas Leijdekkers
+ *
+ * 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.siyeh.ig.performance;
+
+import com.intellij.codeInspection.ui.MultipleCheckboxOptionsPanel;
+import com.intellij.openapi.project.Project;
+import com.intellij.psi.PsiElement;
+import com.intellij.psi.PsiExpressionStatement;
+import com.intellij.psi.PsiMethod;
+import com.intellij.psi.PsiReferenceExpression;
+import com.siyeh.InspectionGadgetsBundle;
+import com.siyeh.ig.InspectionGadgetsFix;
+import com.siyeh.ig.fixes.InlineCallFix;
+import org.jetbrains.annotations.Nullable;
+
+import javax.swing.*;
+
+public class CallToSimpleGetterInClassInspection extends CallToSimpleGetterInClassInspectionBase {
+ @Override
+ @Nullable
+ public JComponent createOptionsPanel() {
+ final MultipleCheckboxOptionsPanel optionsPanel = new MultipleCheckboxOptionsPanel(this);
+ optionsPanel.addCheckbox(InspectionGadgetsBundle.message("call.to.simple.getter.in.class.ignore.option"),
+ "ignoreGetterCallsOnOtherObjects");
+ optionsPanel.addCheckbox(InspectionGadgetsBundle.message("call.to.private.simple.getter.in.class.option"),
+ "onlyReportPrivateGetter");
+ return optionsPanel;
+ }
+
+ @Override
+ public InspectionGadgetsFix buildFix(Object... infos) {
+ return new InlineOrDeleteCallFix(InspectionGadgetsBundle.message("call.to.simple.getter.in.class.inline.quickfix"));
+ }
+
+ private static class InlineOrDeleteCallFix extends InlineCallFix {
+ public InlineOrDeleteCallFix(String name) {
+ super(name);
+ }
+
+ @Override
+ protected void inline(Project project, PsiReferenceExpression methodExpression, PsiMethod method) {
+ final PsiElement statement = methodExpression.getParent().getParent();
+ if (statement instanceof PsiExpressionStatement) {
+ statement.delete();
+ } else {
+ super.inline(project, methodExpression, method);
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/plugins/InspectionGadgets/src/com/siyeh/ig/performance/CallToSimpleSetterInClassInspection.java b/plugins/InspectionGadgets/src/com/siyeh/ig/performance/CallToSimpleSetterInClassInspection.java
new file mode 100644
index 000000000000..652a8e89ea98
--- /dev/null
+++ b/plugins/InspectionGadgets/src/com/siyeh/ig/performance/CallToSimpleSetterInClassInspection.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2003-2011 Dave Griffith, Bas Leijdekkers
+ *
+ * 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.siyeh.ig.performance;
+
+import com.intellij.codeInspection.ui.MultipleCheckboxOptionsPanel;
+import com.siyeh.InspectionGadgetsBundle;
+import com.siyeh.ig.InspectionGadgetsFix;
+import com.siyeh.ig.fixes.InlineCallFix;
+import org.jetbrains.annotations.Nullable;
+
+import javax.swing.*;
+
+public class CallToSimpleSetterInClassInspection extends CallToSimpleSetterInClassInspectionBase {
+
+ @Override
+ @Nullable
+ public JComponent createOptionsPanel() {
+ final MultipleCheckboxOptionsPanel optionsPanel = new MultipleCheckboxOptionsPanel(this);
+ optionsPanel.addCheckbox(InspectionGadgetsBundle.message("call.to.simple.setter.in.class.ignore.option"),
+ "ignoreSetterCallsOnOtherObjects");
+ optionsPanel.addCheckbox(InspectionGadgetsBundle.message("call.to.private.setter.in.class.option"),
+ "onlyReportPrivateSetter");
+ return optionsPanel;
+ }
+
+ @Override
+ public InspectionGadgetsFix buildFix(Object... infos) {
+ return new InlineCallFix(InspectionGadgetsBundle.message("call.to.simple.setter.in.class.inline.quickfix"));
+ }
+} \ No newline at end of file
diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/ClassWithOnlyPrivateConstructors.html b/plugins/InspectionGadgets/src/inspectionDescriptions/ClassWithOnlyPrivateConstructors.html
new file mode 100644
index 000000000000..87122815ae53
--- /dev/null
+++ b/plugins/InspectionGadgets/src/inspectionDescriptions/ClassWithOnlyPrivateConstructors.html
@@ -0,0 +1,9 @@
+<html>
+<body>
+Reports classes with only <b>private</b> constructors that are not extended by any nested class.
+Such classes can not be extended and should be declared <b>final</b>.
+<!-- tooltip end -->
+<p>
+<small>New in 14</small>
+</body>
+</html> \ No newline at end of file
diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/ClassWithoutConstructor.html b/plugins/InspectionGadgets/src/inspectionDescriptions/ClassWithoutConstructor.html
index 24229c1d262b..184a994f90cd 100644
--- a/plugins/InspectionGadgets/src/inspectionDescriptions/ClassWithoutConstructor.html
+++ b/plugins/InspectionGadgets/src/inspectionDescriptions/ClassWithoutConstructor.html
@@ -1,6 +1,6 @@
<html>
<body>
-Reports a classes without constructors. Some coding standards prohibit such classes.
+Reports classes without constructors. Some coding standards prohibit such classes.
<!-- tooltip end -->
<p>
diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/ClassWithoutNoArgConstructor.html b/plugins/InspectionGadgets/src/inspectionDescriptions/ClassWithoutNoArgConstructor.html
index fbc102e8154c..0ce4bbb23575 100644
--- a/plugins/InspectionGadgets/src/inspectionDescriptions/ClassWithoutNoArgConstructor.html
+++ b/plugins/InspectionGadgets/src/inspectionDescriptions/ClassWithoutNoArgConstructor.html
@@ -1,6 +1,6 @@
<html>
<body>
-Reports a classes without a no-argument constructor.
+Reports classes without a no-argument constructor.
Such constructors are necessary in some contexts if a class is to be created reflexively.
<!-- tooltip end -->
<p>
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/controlflow/if_statement_with_identical_branches/IfStatementWithIdenticalBranches.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/controlflow/if_statement_with_identical_branches/IfStatementWithIdenticalBranches.java
index 377e50fa8a21..666651d71e21 100644
--- a/plugins/InspectionGadgets/test/com/siyeh/igtest/controlflow/if_statement_with_identical_branches/IfStatementWithIdenticalBranches.java
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/controlflow/if_statement_with_identical_branches/IfStatementWithIdenticalBranches.java
@@ -7,20 +7,20 @@ import java.util.Set;
public class IfStatementWithIdenticalBranches {
void one() {
- if (true) {
+ <warning descr="'if' statement with identical branches">if</warning> (true) {
} else {
}
- if (false) {
+ <warning descr="'if' statement with identical branches">if</warning> (false) {
System.out.println();
return;
}
System.out.println();
}
- int two() {
- if (true) {
+ int two() {
+ <warning descr="'if' statement with identical branches">if</warning> (true) {
int i = 2;
return i;
} else {
@@ -41,7 +41,7 @@ public class IfStatementWithIdenticalBranches {
void four() {
if (true) {
- if (false) {
+ <warning descr="'if' statement with identical branches">if</warning> (false) {
System.out.println();
return;
}
@@ -61,7 +61,7 @@ public class IfStatementWithIdenticalBranches {
void six() {
if (true) {
- if (false) {
+ <warning descr="'if' statement with identical branches">if</warning> (false) {
System.out.println();
System.out.println();
return;
@@ -93,11 +93,11 @@ public class IfStatementWithIdenticalBranches {
}
void nine() {
- if (true) {
+ <warning descr="'if' statement with identical branches">if</warning> (true) {
- } else if (true) {
+ } else <warning descr="'if' statement with identical branches">if</warning> (true) {
- } else if (true) {
+ } else <warning descr="'if' statement with identical branches">if</warning> (true) {
} else {
@@ -105,7 +105,7 @@ public class IfStatementWithIdenticalBranches {
}
void blocks() {
- if (true) {
+ <warning descr="'if' statement with identical branches">if</warning> (true) {
System.out.println();
return;
}
@@ -135,4 +135,31 @@ class NotADup {
return null;
}
+ public static String calculate(int someNumber) {
+ if (someNumber == 0 ) {
+ try {
+ return placeOrder(3, null);
+ }
+ catch( Exception e ) {
+ System.out.println("e = " + e);
+ }
+ }
+ else if (someNumber == 1) {
+ try {
+ return placeOrder(3, someNumber, null);
+ }
+ catch(Exception e ) {
+ System.out.println("e = " + e);
+ }
+ }
+ return null;
+ }
+
+ private static String placeOrder(int i, int someNumber, Object o) {
+ return null;
+ }
+
+ private static String placeOrder(int i, Object o) {
+ return null;
+ }
}
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/controlflow/if_statement_with_identical_branches/expected.xml b/plugins/InspectionGadgets/test/com/siyeh/igtest/controlflow/if_statement_with_identical_branches/expected.xml
deleted file mode 100644
index c85bba14ea3b..000000000000
--- a/plugins/InspectionGadgets/test/com/siyeh/igtest/controlflow/if_statement_with_identical_branches/expected.xml
+++ /dev/null
@@ -1,65 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<problems>
- <problem>
- <file>IfStatementWithIdenticalBranches.java</file>
- <line>10</line>
- <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">'if' statement with identical branches</problem_class>
- <description>&lt;code&gt;if&lt;/code&gt; statement with identical branches #loc</description>
- </problem>
-
- <problem>
- <file>IfStatementWithIdenticalBranches.java</file>
- <line>15</line>
- <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">'if' statement with identical branches</problem_class>
- <description>&lt;code&gt;if&lt;/code&gt; statement with identical branches #loc</description>
- </problem>
-
- <problem>
- <file>IfStatementWithIdenticalBranches.java</file>
- <line>23</line>
- <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">'if' statement with identical branches</problem_class>
- <description>&lt;code&gt;if&lt;/code&gt; statement with identical branches #loc</description>
- </problem>
-
- <problem>
- <file>IfStatementWithIdenticalBranches.java</file>
- <line>44</line>
- <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">'if' statement with identical branches</problem_class>
- <description>&lt;code&gt;if&lt;/code&gt; statement with identical branches #loc</description>
- </problem>
-
- <problem>
- <file>IfStatementWithIdenticalBranches.java</file>
- <line>64</line>
- <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">'if' statement with identical branches</problem_class>
- <description>&lt;code&gt;if&lt;/code&gt; statement with identical branches #loc</description>
- </problem>
-
- <problem>
- <file>IfStatementWithIdenticalBranches.java</file>
- <line>96</line>
- <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">'if' statement with identical branches</problem_class>
- <description>&lt;code&gt;if&lt;/code&gt; statement with identical branches #loc</description>
- </problem>
-
- <problem>
- <file>IfStatementWithIdenticalBranches.java</file>
- <line>98</line>
- <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">'if' statement with identical branches</problem_class>
- <description>&lt;code&gt;if&lt;/code&gt; statement with identical branches #loc</description>
- </problem>
-
- <problem>
- <file>IfStatementWithIdenticalBranches.java</file>
- <line>100</line>
- <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">'if' statement with identical branches</problem_class>
- <description>&lt;code&gt;if&lt;/code&gt; statement with identical branches #loc</description>
- </problem>
-
- <problem>
- <file>IfStatementWithIdenticalBranches.java</file>
- <line>108</line>
- <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">'if' statement with identical branches</problem_class>
- <description>&lt;code&gt;if&lt;/code&gt; statement with identical branches #loc</description>
- </problem>
-</problems> \ No newline at end of file
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/numeric/pointless_arithmetic_expression/PointlessArithmeticExpression.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/numeric/pointless_arithmetic_expression/PointlessArithmeticExpression.java
index 019805adcf17..4ba7a97033ad 100644
--- a/plugins/InspectionGadgets/test/com/siyeh/igtest/numeric/pointless_arithmetic_expression/PointlessArithmeticExpression.java
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/numeric/pointless_arithmetic_expression/PointlessArithmeticExpression.java
@@ -124,4 +124,5 @@ class Expanded {{
long g = 8L / 8L;
long h = 9L * 0L;
int a = 8 * 0 * 8 * ; // don't warn
+ int minus = 2 - 1 - 1;
}} \ No newline at end of file
diff --git a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/classlayout/ClassWithOnlyPrivateConstructorsInspectionTest.java b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/classlayout/ClassWithOnlyPrivateConstructorsInspectionTest.java
new file mode 100644
index 000000000000..a177242537d2
--- /dev/null
+++ b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/classlayout/ClassWithOnlyPrivateConstructorsInspectionTest.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2000-2014 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.siyeh.ig.classlayout;
+
+import com.intellij.codeInspection.InspectionProfileEntry;
+import com.siyeh.ig.LightInspectionTestCase;
+import org.jetbrains.annotations.Nullable;
+
+public class ClassWithOnlyPrivateConstructorsInspectionTest extends LightInspectionTestCase {
+
+ public void testSimple() {
+ doTest("class /*Class 'X' with only 'private' constructors should be declared 'final'*/X/**/ {" +
+ " private X() {}" +
+ " private X(int i) {}" +
+ "}");
+ }
+
+ public void testExtendingInnerClass() {
+ doTest("class X {\n" +
+ " private X() {}\n" +
+ " class Y {\n" +
+ " class Z extends X{}\n" +
+ " }\n" +
+ "}");
+ }
+
+ public void testNoConstructors() {
+ doTest("class X {}");
+ }
+
+ @Nullable
+ @Override
+ protected InspectionProfileEntry getInspection() {
+ return new ClassWithOnlyPrivateConstructorsInspection();
+ }
+} \ No newline at end of file
diff --git a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/controlflow/IfStatementWithIdenticalBranchesInspectionTest.java b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/controlflow/IfStatementWithIdenticalBranchesInspectionTest.java
index 1562b8c9053c..e3e2f9c8a857 100644
--- a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/controlflow/IfStatementWithIdenticalBranchesInspectionTest.java
+++ b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/controlflow/IfStatementWithIdenticalBranchesInspectionTest.java
@@ -1,12 +1,18 @@
package com.siyeh.ig.controlflow;
-import com.siyeh.ig.IGInspectionTestCase;
+import com.intellij.codeInspection.InspectionProfileEntry;
+import com.siyeh.ig.LightInspectionTestCase;
+import org.jetbrains.annotations.Nullable;
-public class IfStatementWithIdenticalBranchesInspectionTest
- extends IGInspectionTestCase {
+public class IfStatementWithIdenticalBranchesInspectionTest extends LightInspectionTestCase {
- public void test() throws Exception {
- doTest("com/siyeh/igtest/controlflow/if_statement_with_identical_branches",
- new IfStatementWithIdenticalBranchesInspection());
+ public void testIfStatementWithIdenticalBranches() throws Exception {
+ doTest();
+ }
+
+ @Nullable
+ @Override
+ protected InspectionProfileEntry getInspection() {
+ return new IfStatementWithIdenticalBranchesInspection();
}
} \ No newline at end of file
diff --git a/plugins/IntelliLang/java-support/resources/javaInjections.xml b/plugins/IntelliLang/java-support/resources/javaInjections.xml
index 7bbd374ae8b1..4b66c8b13713 100644
--- a/plugins/IntelliLang/java-support/resources/javaInjections.xml
+++ b/plugins/IntelliLang/java-support/resources/javaInjections.xml
@@ -115,5 +115,21 @@
<place><![CDATA[psiParameter().ofMethod(1, psiMethod().withName("selectNodes").withParameters("java.lang.Object", "java.lang.String").definedInClass("org.jdom.xpath.XPath"))]]></place>
<place><![CDATA[psiParameter().ofMethod(1, psiMethod().withName("selectSingleNode").withParameters("java.lang.Object", "java.lang.String").definedInClass("org.jdom.xpath.XPath"))]]></place>
</injection>
+ <injection language="encoding-reference" injector-id="java">
+ <display-name>Charset Name</display-name>
+ <place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("forName").withParameters("java.lang.String").definedInClass("java.nio.charset.Charset"))]]></place>
+ <place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("isSupported").withParameters("java.lang.String").definedInClass("java.nio.charset.Charset"))]]></place>
+ <place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("getBytes").withParameters("java.lang.String").definedInClass("java.lang.String"))]]></place>
+ <place><![CDATA[psiParameter().ofMethod(3, psiMethod().withName("String").withParameters("byte[]", "int", "int", "java.lang.String").definedInClass("java.lang.String"))]]></place>
+ <place><![CDATA[psiParameter().ofMethod(1, psiMethod().withName("String").withParameters("byte[]", "java.lang.String").definedInClass("java.lang.String"))]]></place>
+ <place><![CDATA[psiParameter().ofMethod(1, psiMethod().withName("InputStreamReader").withParameters("java.io.InputStream", "java.lang.String").definedInClass("java.io.InputStreamReader"))]]></place>
+ <place><![CDATA[psiParameter().ofMethod(1, psiMethod().withName("OutputStreamWriter").withParameters("java.io.OutputStream", "java.lang.String").definedInClass("java.io.OutputStreamWriter"))]]></place>
+ <place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("toString").withParameters("java.lang.String").definedInClass("java.io.ByteArrayOutputStream"))]]></place>
+ <place><![CDATA[psiParameter().ofMethod(1, psiMethod().withName("PrintStream").withParameters("java.io.File", "java.lang.String").definedInClass("java.io.PrintStream"))]]></place>
+ <place><![CDATA[psiParameter().ofMethod(2, psiMethod().withName("PrintStream").withParameters("java.io.OutputStream", "boolean", "java.lang.String").definedInClass("java.io.PrintStream"))]]></place>
+ <place><![CDATA[psiParameter().ofMethod(1, psiMethod().withName("PrintStream").withParameters("java.lang.String", "java.lang.String").definedInClass("java.io.PrintStream"))]]></place>
+ <place><![CDATA[psiParameter().ofMethod(1, psiMethod().withName("encode").withParameters("java.lang.String", "java.lang.String").definedInClass("java.net.URLEncoder"))]]></place>
+ <place><![CDATA[psiParameter().ofMethod(1, psiMethod().withName("decode").withParameters("java.lang.String", "java.lang.String").definedInClass("java.net.URLDecoder"))]]></place>
+ </injection>
</component>
diff --git a/plugins/IntelliLang/src/META-INF/plugin.xml b/plugins/IntelliLang/src/META-INF/plugin.xml
index a7f600958250..8f8806a8b2ec 100644
--- a/plugins/IntelliLang/src/META-INF/plugin.xml
+++ b/plugins/IntelliLang/src/META-INF/plugin.xml
@@ -45,7 +45,7 @@
<highlightErrorFilter implementation="org.intellij.plugins.intelliLang.inject.FrankensteinErrorFilter"/>
<daemon.highlightInfoFilter implementation="org.intellij.plugins.intelliLang.inject.FrankensteinErrorFilter"/>
- <projectConfigurable displayName="Language Injections" dynamic="true" instance="org.intellij.plugins.intelliLang.InjectionsSettingsUI" nonDefaultProject="true"/>
+ <projectConfigurable groupId="editor" displayName="Language Injections" dynamic="true" instance="org.intellij.plugins.intelliLang.InjectionsSettingsUI" nonDefaultProject="true"/>
<multiHostInjector implementation="org.intellij.plugins.intelliLang.inject.CommentLanguageInjector"/>
<multiHostInjector implementation="org.intellij.plugins.intelliLang.inject.TemporaryPlacesInjector"/>
diff --git a/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/inject/InjectorUtils.java b/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/inject/InjectorUtils.java
index 4211fdf53a74..48ee3b51fac2 100644
--- a/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/inject/InjectorUtils.java
+++ b/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/inject/InjectorUtils.java
@@ -16,6 +16,7 @@
package org.intellij.plugins.intelliLang.inject;
+import com.intellij.codeInsight.completion.CompletionUtil;
import com.intellij.lang.Language;
import com.intellij.lang.injection.MultiHostRegistrar;
import com.intellij.openapi.extensions.Extensions;
@@ -25,12 +26,16 @@ import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.*;
import com.intellij.psi.impl.source.tree.injected.MultiHostRegistrarImpl;
import com.intellij.psi.impl.source.tree.injected.Place;
+import com.intellij.psi.util.CachedValueProvider;
+import com.intellij.psi.util.CachedValuesManager;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.util.ArrayUtil;
-import com.intellij.util.NullableFunction;
import com.intellij.util.ObjectUtils;
-import com.intellij.util.SmartList;
+import com.intellij.util.Producer;
import com.intellij.util.containers.ContainerUtil;
+import com.intellij.util.text.CharArrayUtil;
+import com.intellij.util.text.StringSearcher;
+import gnu.trove.TIntArrayList;
import org.intellij.plugins.intelliLang.Configuration;
import org.intellij.plugins.intelliLang.inject.config.BaseInjection;
import org.jetbrains.annotations.NotNull;
@@ -220,18 +225,117 @@ public class InjectorUtils {
return true;
}
+ @Nullable
public static BaseInjection findCommentInjection(PsiElement context, final String supportId, final Ref<PsiElement> causeRef) {
- return findNearestComment(context, new NullableFunction<PsiComment, BaseInjection>() {
+ PsiElement target = CompletionUtil.getOriginalOrSelf(context);
+ PsiFile file = target.getContainingFile();
+ TreeMap<TextRange, BaseInjection> map = getInjectionMap(file);
+ Map.Entry<TextRange, BaseInjection> entry = map == null ? null : map.lowerEntry(target.getTextRange());
+ if (entry == null) return null;
+
+ PsiComment psiComment = PsiTreeUtil.findElementOfClassAtOffset(file, entry.getKey().getStartOffset(), PsiComment.class, false);
+ if (psiComment == null) return null;
+ TextRange r0 = psiComment.getTextRange();
+
+ // calulate topmost siblings & heights
+ PsiElement commonParent = PsiTreeUtil.findCommonParent(psiComment, target);
+ int h1 = 0, h2 = 0;
+ PsiElement e1 = psiComment, e2 = target;
+ for (PsiElement e = e1; e != commonParent; e1 = e, e = e.getParent(), h1++);
+ for (PsiElement e = e2; e != commonParent; e2 = e, e = e.getParent(), h2++);
+
+ // make sure comment is close enough and ...
+ int off1 = r0.getEndOffset();
+ int off2 = e2.getTextRange().getStartOffset();
+ if (off2 - off1 > 120) return null;
+ if (off2 - off1 > 2) {
+ // ... there's nothing in between on the top level and ...
+ for (PsiElement e = e1; e != e2; e = e.getNextSibling()) {
+ if (!isWhitespaceCommentOrBlank(e)) return null;
+ }
+ // ... there's no non-empty host in the left (comment) subtree
+ Producer<PsiElement> producer = prevWalker(PsiTreeUtil.getDeepestLast(e1), e1);
+ PsiElement e;
+ while ( (e = producer.produce()) != null && e != psiComment) {
+ if (e instanceof PsiLanguageInjectionHost && !StringUtil.isEmptyOrSpaces(e.getText())) {
+ return null;
+ }
+ }
+ }
+ if (causeRef != null) {
+ causeRef.set(psiComment);
+ }
+ return new BaseInjection(supportId).copyFrom(entry.getValue());
+ }
+
+ protected static boolean isWhitespaceCommentOrBlank(PsiElement e) {
+ return e instanceof PsiWhiteSpace || e instanceof PsiComment ||
+ e instanceof PsiLanguageInjectionHost && StringUtil.isEmptyOrSpaces(e.getText());
+ }
+
+ protected static TreeMap<TextRange, BaseInjection> getInjectionMap(final PsiFile file) {
+ return CachedValuesManager.getCachedValue(file, new CachedValueProvider<TreeMap<TextRange, BaseInjection>>() {
@Nullable
@Override
- public BaseInjection fun(PsiComment comment) {
- if (causeRef != null) causeRef.set(comment);
- String text = ElementManipulators.getValueText(comment).trim();
- return detectInjectionFromText(supportId, text);
+ public Result<TreeMap<TextRange, BaseInjection>> compute() {
+ TreeMap<TextRange, BaseInjection> map = calcInjections(file);
+ return Result.create(map.isEmpty() ? null : map, file);
}
});
}
+ @NotNull
+ protected static TreeMap<TextRange, BaseInjection> calcInjections(PsiFile file) {
+ final TreeMap<TextRange, BaseInjection> injectionMap = new TreeMap<TextRange, BaseInjection>(RANGE_COMPARATOR);
+
+ TIntArrayList ints = new TIntArrayList();
+ StringSearcher searcher = new StringSearcher("language=", true, true, false);
+ CharSequence contents = file.getViewProvider().getContents();
+ final char[] contentsArray = CharArrayUtil.fromSequenceWithoutCopying(contents);
+
+ //long time = System.currentTimeMillis();
+
+ int s0 = 0, s1 = contents.length();
+ for (int idx = searcher.scan(contents, contentsArray, s0, s1);
+ idx != -1;
+ idx = searcher.scan(contents, contentsArray, idx + 1, s1)) {
+ ints.add(idx);
+ PsiComment element = PsiTreeUtil.findElementOfClassAtOffset(file, idx, PsiComment.class, false);
+ if (element != null) {
+ String str = ElementManipulators.getValueText(element).trim();
+ BaseInjection injection = detectInjectionFromText("", str);
+ if (injection != null) {
+ injectionMap.put(element.getTextRange(), injection);
+ }
+ }
+ }
+
+ //VirtualFile virtualFile = file.getVirtualFile();
+ //Document document = FileDocumentManager.getInstance().getDocument(virtualFile);
+ //EditorHighlighter highlighter = EditorHighlighterCache.getEditorHighlighterForCachesBuilding(document);
+ //
+ //ParserDefinition definition = LanguageParserDefinitions.INSTANCE.forLanguage(file.getLanguage());
+ //TokenSet commentTokens = definition.getCommentTokens();
+ //HighlighterIterator it = highlighter != null && PlatformIdTableBuilding.checkCanUseCachedEditorHighlighter(contents, highlighter) ?
+ // highlighter.createIterator(0) : null;
+ //
+ //do {
+ // if (it != null) {
+ // while (!it.atEnd() && !commentTokens.contains(it.getTokenType())) it.advance();
+ // if (it.atEnd()) break;
+ // }
+ // int s0 = it == null ? 0 : it.getStart();
+ // int s1 = it == null ? contents.length() : it.getEnd();
+ //
+ // for () { .. }
+ //
+ // if (it != null && !it.atEnd()) it.advance();
+ //} while (it != null && !it.atEnd());
+
+ //System.out.println(Thread.currentThread().getName() + ": " + file.getName() + "@" + file.hashCode() + " indexed: " + (System.currentTimeMillis() - time));
+ return injectionMap;
+ }
+
private static final Pattern MAP_ENTRY_PATTERN = Pattern.compile("([\\S&&[^=]]+)=(\"(?:[^\"]|\\\\\")*\"|\\S*)");
public static Map<String, String> decodeMap(CharSequence charSequence) {
if (StringUtil.isEmpty(charSequence)) return Collections.emptyMap();
@@ -259,68 +363,30 @@ public class InjectorUtils {
return injection;
}
- @Nullable
- public static <T> T findNearestComment(PsiElement element, NullableFunction<PsiComment, T> processor) {
- if (element instanceof PsiComment) return null;
- PsiFile containingFile = element.getContainingFile();
-
- List<PsiLanguageInjectionHost> otherHosts = new SmartList<PsiLanguageInjectionHost>();
-
- boolean commentOrSpaces = false;
-
- PsiElement prev = element, e = prevOrParent(element, containingFile);
- for (int counter = 0; e != null && counter < 100; prev = e, e = prevOrParent(e, containingFile), counter ++) {
- if (e instanceof PsiComment) {
- commentOrSpaces = true;
- PsiComment comment = (PsiComment)e;
- if (!checkDepth(otherHosts, element, comment)) continue;
- T value = processor.fun(comment);
- if (value != null) return value;
- }
- else if (e instanceof PsiWhiteSpace) {
- commentOrSpaces = true;
- }
- else if (e instanceof PsiLanguageInjectionHost) {
- commentOrSpaces = StringUtil.isEmptyOrSpaces(e.getText()); // check getText only for hosts (XmlText)
- if (!commentOrSpaces) otherHosts.add((PsiLanguageInjectionHost)e);
- }
- else {
- commentOrSpaces = false;
- }
- }
- if (commentOrSpaces) { // allow several comments
- for (e = prevOrParent(prev, containingFile); e != null; e = e.getPrevSibling()) {
- if (e instanceof PsiComment) {
- PsiComment comment = (PsiComment)e;
- if (!checkDepth(otherHosts, element, comment)) continue;
- T value = processor.fun(comment);
- if (value != null) return value;
+ private static Producer<PsiElement> prevWalker(final PsiElement element, final PsiElement scope) {
+ return new Producer<PsiElement>() {
+ PsiElement e = element;
+
+ @Nullable
+ @Override
+ public PsiElement produce() {
+ if (e == null || e == scope) return null;
+ PsiElement prev = e.getPrevSibling();
+ if (prev != null) {
+ e = prev;
+ while (true) {
+ PsiElement lastChild = e.getLastChild();
+ if (lastChild == null) break;
+ e = lastChild;
+ }
+ return e;
}
- else if (!(e instanceof PsiWhiteSpace)) {
- break;
+ else {
+ PsiElement parent = e.getParent();
+ e = parent == scope || parent instanceof PsiFile ? null : parent;
+ return e;
}
}
- }
- return null;
- }
-
- // allow java-like multi variable commenting: String s = "s", t = "t"
- // a comment should cover all hosts in a subtree
- private static boolean checkDepth(List<PsiLanguageInjectionHost> hosts, PsiElement element, PsiComment comment) {
- if (hosts.isEmpty()) return true;
- PsiElement parent = PsiTreeUtil.findCommonParent(comment, element);
- for (PsiLanguageInjectionHost host : hosts) {
- if (!PsiTreeUtil.isAncestor(parent, PsiTreeUtil.findCommonParent(host, element), true)) return false;
- }
- return true;
- }
-
- @Nullable
- public static PsiElement prevOrParent(PsiElement e, PsiElement scope) {
- if (e == null || e == scope) return null;
- PsiElement prev = e.getPrevSibling();
- if (prev != null) return PsiTreeUtil.getDeepestLast(prev);
- PsiElement parent = e.getParent();
- return parent == scope || parent instanceof PsiFile ? null : parent;
+ };
}
}
diff --git a/plugins/IntentionPowerPak/src/com/siyeh/ipp/junit/FlipAssertLiteralIntention.java b/plugins/IntentionPowerPak/src/com/siyeh/ipp/junit/FlipAssertLiteralIntention.java
index d3a8d4cefc7b..d331042244a6 100644
--- a/plugins/IntentionPowerPak/src/com/siyeh/ipp/junit/FlipAssertLiteralIntention.java
+++ b/plugins/IntentionPowerPak/src/com/siyeh/ipp/junit/FlipAssertLiteralIntention.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2003-2013 Dave Griffith, Bas Leijdekkers
+ * Copyright 2003-2014 Dave Griffith, Bas Leijdekkers
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,8 +15,8 @@
*/
package com.siyeh.ipp.junit;
-import com.intellij.codeInsight.AnnotationUtil;
import com.intellij.psi.*;
+import com.intellij.psi.util.InheritanceUtil;
import com.intellij.psi.util.PsiTreeUtil;
import com.siyeh.IntentionPowerPackBundle;
import com.siyeh.ig.PsiReplacementUtil;
@@ -67,11 +67,10 @@ public class FlipAssertLiteralIntention extends MutablyNamedIntention {
@NonNls final StringBuilder newCall = new StringBuilder();
final PsiElement qualifier = methodExpression.getQualifier();
if (qualifier == null) {
- final PsiMethod containingMethod = PsiTreeUtil.getParentOfType(call, PsiMethod.class);
- if (containingMethod != null && AnnotationUtil.isAnnotated(containingMethod, "org.junit.Test", true)) {
- if (!ImportUtils.addStaticImport("org.junit.Assert", toMethodName, element)) {
- newCall.append("org.junit.Assert.");
- }
+ final PsiClass containingClass = PsiTreeUtil.getParentOfType(element, PsiClass.class);
+ if (!InheritanceUtil.isInheritor(containingClass, "junit.framework.Assert") &&
+ !ImportUtils.addStaticImport("org.junit.Assert", toMethodName, element)) {
+ newCall.append("org.junit.Assert.");
}
}
else {
@@ -88,6 +87,6 @@ public class FlipAssertLiteralIntention extends MutablyNamedIntention {
newCall.append(BoolUtils.getNegatedExpressionText(arguments[1]));
}
newCall.append(')');
- PsiReplacementUtil.replaceExpression(call, newCall.toString());
+ PsiReplacementUtil.replaceExpressionAndShorten(call, newCall.toString());
}
} \ No newline at end of file
diff --git a/plugins/IntentionPowerPak/src/com/siyeh/ipp/junit/ReplaceAssertEqualsWithAssertLiteralIntention.java b/plugins/IntentionPowerPak/src/com/siyeh/ipp/junit/ReplaceAssertEqualsWithAssertLiteralIntention.java
index cb27659e0cc2..e972b18665ae 100644
--- a/plugins/IntentionPowerPak/src/com/siyeh/ipp/junit/ReplaceAssertEqualsWithAssertLiteralIntention.java
+++ b/plugins/IntentionPowerPak/src/com/siyeh/ipp/junit/ReplaceAssertEqualsWithAssertLiteralIntention.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2003-2013 Dave Griffith, Bas Leijdekkers
+ * Copyright 2003-2014 Dave Griffith, Bas Leijdekkers
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,8 +15,8 @@
*/
package com.siyeh.ipp.junit;
-import com.intellij.codeInsight.AnnotationUtil;
import com.intellij.psi.*;
+import com.intellij.psi.util.InheritanceUtil;
import com.intellij.psi.util.PsiTreeUtil;
import com.siyeh.IntentionPowerPackBundle;
import com.siyeh.ig.PsiReplacementUtil;
@@ -86,11 +86,10 @@ public class ReplaceAssertEqualsWithAssertLiteralIntention extends MutablyNamedI
final PsiElement qualifier = expression.getQualifier();
@NonNls final StringBuilder newExpression = new StringBuilder();
if (qualifier == null) {
- final PsiMethod containingMethod = PsiTreeUtil.getParentOfType(call, PsiMethod.class);
- if (containingMethod != null && AnnotationUtil.isAnnotated(containingMethod, "org.junit.Test", true)) {
- if (!ImportUtils.addStaticImport("org.junit.Assert", assertString, element)) {
- newExpression.append("org.junit.Assert.");
- }
+ final PsiClass containingClass = PsiTreeUtil.getParentOfType(element, PsiClass.class);
+ if (!InheritanceUtil.isInheritor(containingClass, "junit.framework.Assert") &&
+ !ImportUtils.addStaticImport("org.junit.Assert", assertString, element)) {
+ newExpression.append("org.junit.Assert.");
}
}
else {
diff --git a/plugins/IntentionPowerPak/src/com/siyeh/ipp/junit/ReplaceAssertLiteralWithAssertEqualsIntention.java b/plugins/IntentionPowerPak/src/com/siyeh/ipp/junit/ReplaceAssertLiteralWithAssertEqualsIntention.java
index 7bc8b2beec90..a3e318e5196a 100644
--- a/plugins/IntentionPowerPak/src/com/siyeh/ipp/junit/ReplaceAssertLiteralWithAssertEqualsIntention.java
+++ b/plugins/IntentionPowerPak/src/com/siyeh/ipp/junit/ReplaceAssertLiteralWithAssertEqualsIntention.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2003-2013 Dave Griffith, Bas Leijdekkers
+ * Copyright 2003-2014 Dave Griffith, Bas Leijdekkers
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,9 +15,9 @@
*/
package com.siyeh.ipp.junit;
-import com.intellij.codeInsight.AnnotationUtil;
import com.intellij.psi.*;
import com.intellij.psi.tree.IElementType;
+import com.intellij.psi.util.InheritanceUtil;
import com.intellij.psi.util.PsiTreeUtil;
import com.siyeh.IntentionPowerPackBundle;
import com.siyeh.ig.PsiReplacementUtil;
@@ -73,11 +73,10 @@ public class ReplaceAssertLiteralWithAssertEqualsIntention extends MutablyNamedI
@NonNls final StringBuilder newExpression = new StringBuilder();
final PsiElement qualifier = methodExpression.getQualifier();
if (qualifier == null) {
- final PsiMethod containingMethod = PsiTreeUtil.getParentOfType(call, PsiMethod.class);
- if (containingMethod != null && AnnotationUtil.isAnnotated(containingMethod, "org.junit.Test", true)) {
- if (!ImportUtils.addStaticImport("org.junit.Assert", "assertEquals", element)) {
- newExpression.append("org.junit.Assert.");
- }
+ final PsiClass containingClass = PsiTreeUtil.getParentOfType(element, PsiClass.class);
+ if (!InheritanceUtil.isInheritor(containingClass, "junit.framework.Assert") &&
+ !ImportUtils.addStaticImport("org.junit.Assert", "assertEquals", element)) {
+ newExpression.append("org.junit.Assert.");
}
}
else {
diff --git a/plugins/IntentionPowerPak/src/com/siyeh/ipp/types/ReplaceMethodRefWithLambdaIntention.java b/plugins/IntentionPowerPak/src/com/siyeh/ipp/types/ReplaceMethodRefWithLambdaIntention.java
index 8ffc5eebfbe0..f26a41771228 100644
--- a/plugins/IntentionPowerPak/src/com/siyeh/ipp/types/ReplaceMethodRefWithLambdaIntention.java
+++ b/plugins/IntentionPowerPak/src/com/siyeh/ipp/types/ReplaceMethodRefWithLambdaIntention.java
@@ -19,6 +19,7 @@ import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.*;
import com.intellij.psi.codeStyle.JavaCodeStyleManager;
+import com.intellij.psi.codeStyle.SuggestedNameInfo;
import com.intellij.psi.codeStyle.VariableKind;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.psi.util.PsiUtil;
@@ -45,24 +46,38 @@ public class ReplaceMethodRefWithLambdaIntention extends Intention {
protected void processIntention(@NotNull PsiElement element) throws IncorrectOperationException {
final PsiMethodReferenceExpression referenceExpression = PsiTreeUtil.getParentOfType(element, PsiMethodReferenceExpression.class);
LOG.assertTrue(referenceExpression != null);
+ final PsiElement resolve = referenceExpression.resolve();
+ final boolean isReceiver = resolve instanceof PsiMethod && PsiMethodReferenceUtil.hasReceiver(referenceExpression, (PsiMethod)resolve);
+ final PsiParameter[] psiParameters = resolve instanceof PsiMethod ? ((PsiMethod)resolve).getParameterList().getParameters() : null;
final PsiType functionalInterfaceType = referenceExpression.getFunctionalInterfaceType();
final PsiClassType.ClassResolveResult functionalInterfaceResolveResult = PsiUtil.resolveGenericsClassInType(functionalInterfaceType);
final PsiMethod interfaceMethod = LambdaUtil.getFunctionalInterfaceMethod(functionalInterfaceType);
+ LOG.assertTrue(interfaceMethod != null);
+ final PsiSubstitutor psiSubstitutor = LambdaUtil.getSubstitutor(interfaceMethod, functionalInterfaceResolveResult);
final StringBuilder buf = new StringBuilder("(");
LOG.assertTrue(functionalInterfaceType != null);
buf.append(functionalInterfaceType.getCanonicalText()).append(")(");
- LOG.assertTrue(interfaceMethod != null);
- final PsiParameter[] parameters = interfaceMethod.getParameterList().getParameters();
+ final PsiParameterList parameterList = interfaceMethod.getParameterList();
+ final PsiParameter[] parameters = parameterList.getParameters();
final Map<PsiParameter, String> map = new HashMap<PsiParameter, String>();
final JavaCodeStyleManager codeStyleManager = JavaCodeStyleManager.getInstance(element.getProject());
final String paramsString = StringUtil.join(parameters, new Function<PsiParameter, String>() {
@Override
public String fun(PsiParameter parameter) {
- String parameterName = parameter.getName();
- if (parameterName != null) {
- final String baseName = codeStyleManager.variableNameToPropertyName(parameterName, VariableKind.PARAMETER);
- parameterName = codeStyleManager.suggestUniqueVariableName(baseName, referenceExpression, true);
+ final int parameterIndex = parameterList.getParameterIndex(parameter);
+ String baseName;
+ if (isReceiver && parameterIndex == 0) {
+ final SuggestedNameInfo nameInfo = codeStyleManager.suggestVariableName(VariableKind.PARAMETER, null, null, psiSubstitutor.substitute(parameter.getType()));
+ baseName = nameInfo.names.length > 0 ? nameInfo.names[0] : parameter.getName();
+ }
+ else {
+ final String initialName = psiParameters != null ? psiParameters[parameterIndex - (isReceiver ? 1 : 0)].getName() : parameter.getName();
+ baseName = codeStyleManager.variableNameToPropertyName(initialName, VariableKind.PARAMETER);
+ }
+
+ if (baseName != null) {
+ String parameterName = codeStyleManager.suggestUniqueVariableName(baseName, referenceExpression, true);
map.put(parameter, parameterName);
return parameterName;
}
@@ -92,11 +107,10 @@ public class ReplaceMethodRefWithLambdaIntention extends Intention {
final boolean onArrayRef =
JavaPsiFacade.getElementFactory(element.getProject()).getArrayClass(PsiUtil.getLanguageLevel(element)) == containingClass;
- boolean isReceiver = PsiMethodReferenceUtil.isReceiverType(functionalInterfaceType, containingClass, resolveElement instanceof PsiMethod ? (PsiMethod)resolveElement : null);
final PsiElement referenceNameElement = referenceExpression.getReferenceNameElement();
if (isReceiver){
- buf.append(parameters[0].getName()).append(".");
+ buf.append(map.get(parameters[0])).append(".");
} else {
if (!(referenceNameElement instanceof PsiKeyword)) {
if (qualifier instanceof PsiTypeElement) {
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/junit/flip_assert_literal/ExistingStaticImport.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/junit/flip_assert_literal/ExistingStaticImport.java
new file mode 100644
index 000000000000..96be19ed47a7
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/junit/flip_assert_literal/ExistingStaticImport.java
@@ -0,0 +1,11 @@
+import org.junit.Test;
+
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertFalse;
+
+class X {
+ @Test
+ void t() {
+ <caret>assertTrue(true);
+ }
+} \ No newline at end of file
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/junit/flip_assert_literal/ExistingStaticImport_after.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/junit/flip_assert_literal/ExistingStaticImport_after.java
new file mode 100644
index 000000000000..8eccf08eb0ad
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/junit/flip_assert_literal/ExistingStaticImport_after.java
@@ -0,0 +1,11 @@
+import org.junit.Test;
+
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertFalse;
+
+class X {
+ @Test
+ void t() {
+ assertFalse(!true);
+ }
+} \ No newline at end of file
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/junit/flip_assert_literal/StaticImportWithoutTestMethod.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/junit/flip_assert_literal/StaticImportWithoutTestMethod.java
new file mode 100644
index 000000000000..369c92ea185f
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/junit/flip_assert_literal/StaticImportWithoutTestMethod.java
@@ -0,0 +1,8 @@
+import static org.junit.Assert.assertTrue;
+
+class StaticImportWithoutTestMethod {
+
+ void t() {
+ <caret>assertTrue(false);
+ }
+} \ No newline at end of file
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/junit/flip_assert_literal/StaticImportWithoutTestMethod_after.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/junit/flip_assert_literal/StaticImportWithoutTestMethod_after.java
new file mode 100644
index 000000000000..5bf7c4d7c1fb
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/junit/flip_assert_literal/StaticImportWithoutTestMethod_after.java
@@ -0,0 +1,9 @@
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+class StaticImportWithoutTestMethod {
+
+ void t() {
+ assertFalse(!false);
+ }
+} \ No newline at end of file
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/junit/replace_assert_equals_with_assert_literal/OutsideTestMethod.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/junit/replace_assert_equals_with_assert_literal/OutsideTestMethod.java
new file mode 100644
index 000000000000..5af128b5478b
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/junit/replace_assert_equals_with_assert_literal/OutsideTestMethod.java
@@ -0,0 +1,8 @@
+import static org.junit.Assert.assertEquals;
+
+class OutsideTestMethod {
+
+ void m() {
+ <caret>assertEquals("asdf", null);
+ }
+} \ No newline at end of file
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/junit/replace_assert_equals_with_assert_literal/OutsideTestMethod_after.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/junit/replace_assert_equals_with_assert_literal/OutsideTestMethod_after.java
new file mode 100644
index 000000000000..e3291d9d271f
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/junit/replace_assert_equals_with_assert_literal/OutsideTestMethod_after.java
@@ -0,0 +1,9 @@
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+class OutsideTestMethod {
+
+ void m() {
+ assertNull("asdf");
+ }
+} \ No newline at end of file
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/junit/replace_assert_literal_with_assert_equals/OutsideTestMethod.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/junit/replace_assert_literal_with_assert_equals/OutsideTestMethod.java
new file mode 100644
index 000000000000..34c98500412e
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/junit/replace_assert_literal_with_assert_equals/OutsideTestMethod.java
@@ -0,0 +1,8 @@
+import static org.junit.Assert.assertNull;
+
+class OutsideTestMethod {
+
+ void m() {
+ <caret>assertNull("asdf");
+ }
+} \ No newline at end of file
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/junit/replace_assert_literal_with_assert_equals/OutsideTestMethod_after.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/junit/replace_assert_literal_with_assert_equals/OutsideTestMethod_after.java
new file mode 100644
index 000000000000..0d6315f93c7b
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/junit/replace_assert_literal_with_assert_equals/OutsideTestMethod_after.java
@@ -0,0 +1,9 @@
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+class OutsideTestMethod {
+
+ void m() {
+ assertEquals(null, "asdf");
+ }
+} \ No newline at end of file
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/types/methodRefs2lambda/Ambiguity_after.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/types/methodRefs2lambda/Ambiguity_after.java
index b0e14f13dad8..2d27aef15301 100644
--- a/plugins/IntentionPowerPak/test/com/siyeh/ipp/types/methodRefs2lambda/Ambiguity_after.java
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/types/methodRefs2lambda/Ambiguity_after.java
@@ -14,6 +14,6 @@ public class MyTest {
static void call(int i, I2 s) {}
public static void main(String[] args) {
- call(1, (x) -> MyTest.m(x));
+ call(1, (i) -> MyTest.m(i));
}
}
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/types/methodRefs2lambda/ArrayMethodRef_after.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/types/methodRefs2lambda/ArrayMethodRef_after.java
index 65a55a55e8aa..94c8d2f42151 100644
--- a/plugins/IntentionPowerPak/test/com/siyeh/ipp/types/methodRefs2lambda/ArrayMethodRef_after.java
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/types/methodRefs2lambda/ArrayMethodRef_after.java
@@ -1,6 +1,6 @@
public class Foo {
static void foo() {
- Cln j = (p) -> p.clone();
+ Cln j = (ints) -> ints.clone();
}
interface Cln {
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/types/methodRefs2lambda/NewRefsInference1_after.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/types/methodRefs2lambda/NewRefsInference1_after.java
index b61947e47488..bd874395a9f5 100644
--- a/plugins/IntentionPowerPak/test/com/siyeh/ipp/types/methodRefs2lambda/NewRefsInference1_after.java
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/types/methodRefs2lambda/NewRefsInference1_after.java
@@ -10,8 +10,8 @@ public class MyTest {
static void m(I s) {}
static {
- m((s) -> {
- new Foo<Integer>(s);
+ m((x) -> {
+ new Foo<Integer>(x);
});
}
}
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/types/methodRefs2lambda/NewRefsInference_after.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/types/methodRefs2lambda/NewRefsInference_after.java
index 22e5bef35348..cd937894625e 100644
--- a/plugins/IntentionPowerPak/test/com/siyeh/ipp/types/methodRefs2lambda/NewRefsInference_after.java
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/types/methodRefs2lambda/NewRefsInference_after.java
@@ -11,6 +11,6 @@ public class MyTest<X> {
}
static {
- I<String> s = (z) -> new MyTest<String>(z);
+ I<String> s = (x) -> new MyTest<String>(x);
}
} \ No newline at end of file
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/types/methodRefs2lambda/NewRefsInnerClass_after.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/types/methodRefs2lambda/NewRefsInnerClass_after.java
index 600af263857a..0d1106d8e4b6 100644
--- a/plugins/IntentionPowerPak/test/com/siyeh/ipp/types/methodRefs2lambda/NewRefsInnerClass_after.java
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/types/methodRefs2lambda/NewRefsInnerClass_after.java
@@ -8,6 +8,6 @@ class MyTest {
}
static {
- I i1 = (receiver) -> new Inner(receiver);
+ I i1 = (mt) -> new Inner(mt);
}
}
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/types/methodRefs2lambda/NewRefsStaticInnerClass_after.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/types/methodRefs2lambda/NewRefsStaticInnerClass_after.java
index fdce48211ed4..c26cd8a6d244 100644
--- a/plugins/IntentionPowerPak/test/com/siyeh/ipp/types/methodRefs2lambda/NewRefsStaticInnerClass_after.java
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/types/methodRefs2lambda/NewRefsStaticInnerClass_after.java
@@ -10,6 +10,6 @@ class MyTest {
static {
- I i1 = (receiver) -> new Inner(receiver);
+ I i1 = (outer) -> new Inner(outer);
}
}
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/types/methodRefs2lambda/Receiver_after.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/types/methodRefs2lambda/Receiver_after.java
index 9f5bcafa929d..5b3eaf82c2b9 100644
--- a/plugins/IntentionPowerPak/test/com/siyeh/ipp/types/methodRefs2lambda/Receiver_after.java
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/types/methodRefs2lambda/Receiver_after.java
@@ -11,6 +11,6 @@ public class MyTest {
}
static {
- I i = (I) (receiver) -> receiver.m();
+ I i = (I) (myTest) -> myTest.m();
}
}
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/types/methodRefs2lambda/Subst_after.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/types/methodRefs2lambda/Subst_after.java
index c719ccefa15b..2ff6feee03b9 100644
--- a/plugins/IntentionPowerPak/test/com/siyeh/ipp/types/methodRefs2lambda/Subst_after.java
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/types/methodRefs2lambda/Subst_after.java
@@ -5,5 +5,5 @@ class Bar {
}
class Test {
- Comparator<Bar> comparator = (o1, o2) -> o1.xxx(o2);
+ Comparator<Bar> comparator = (bar, p) -> bar.xxx(p);
} \ No newline at end of file
diff --git a/plugins/IntentionPowerPak/testSrc/com/siyeh/ipp/junit/FlipAssertLiteralIntentionTest.java b/plugins/IntentionPowerPak/testSrc/com/siyeh/ipp/junit/FlipAssertLiteralIntentionTest.java
index 98371872da52..4bd28a435688 100644
--- a/plugins/IntentionPowerPak/testSrc/com/siyeh/ipp/junit/FlipAssertLiteralIntentionTest.java
+++ b/plugins/IntentionPowerPak/testSrc/com/siyeh/ipp/junit/FlipAssertLiteralIntentionTest.java
@@ -10,6 +10,8 @@ import com.siyeh.ipp.IPPTestCase;
public class FlipAssertLiteralIntentionTest extends IPPTestCase {
public void testMessage() { doTest(); }
+ public void testExistingStaticImport() { doTest(); }
+ public void testStaticImportWithoutTestMethod() { doTest(); }
@Override
protected void setUp() throws Exception {
@@ -18,6 +20,10 @@ public class FlipAssertLiteralIntentionTest extends IPPTestCase {
"class Assert {" +
" public static void assertTrue(java.lang.String message, boolean condition) {}" +
"}");
+ myFixture.addClass("package org.junit;" +
+ "@Retention(RetentionPolicy.RUNTIME)" +
+ "@Target({ElementType.METHOD})" +
+ "public @interface Test {}");
}
@Override
diff --git a/plugins/IntentionPowerPak/testSrc/com/siyeh/ipp/junit/ReplaceAssertEqualsWithAssertLiteralIntentionTest.java b/plugins/IntentionPowerPak/testSrc/com/siyeh/ipp/junit/ReplaceAssertEqualsWithAssertLiteralIntentionTest.java
new file mode 100644
index 000000000000..529beaa1c348
--- /dev/null
+++ b/plugins/IntentionPowerPak/testSrc/com/siyeh/ipp/junit/ReplaceAssertEqualsWithAssertLiteralIntentionTest.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2000-2014 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.siyeh.ipp.junit;
+
+import com.siyeh.IntentionPowerPackBundle;
+import com.siyeh.ipp.IPPTestCase;
+
+/**
+ * @see ReplaceAssertEqualsWithAssertLiteralIntention
+ * @author Bas Leijdekkers
+ */
+public class ReplaceAssertEqualsWithAssertLiteralIntentionTest extends IPPTestCase {
+
+ public void testOutsideTestMethod() { doTest(); }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ myFixture.addClass("package org.junit;" +
+ "class Assert {" +
+ " static public void assertEquals(Object expected, Object actual) {}" +
+ "}");
+ }
+
+ @Override
+ protected String getRelativePath() {
+ return "junit/replace_assert_equals_with_assert_literal";
+ }
+
+ @Override
+ protected String getIntentionName() {
+ return IntentionPowerPackBundle.message("replace.assert.equals.with.assert.literal.intention.name", "assertNull");
+ }
+}
diff --git a/plugins/IntentionPowerPak/testSrc/com/siyeh/ipp/junit/ReplaceAssertLiteralWithAssertEqualsIntentionTest.java b/plugins/IntentionPowerPak/testSrc/com/siyeh/ipp/junit/ReplaceAssertLiteralWithAssertEqualsIntentionTest.java
new file mode 100644
index 000000000000..00be3ec3e87f
--- /dev/null
+++ b/plugins/IntentionPowerPak/testSrc/com/siyeh/ipp/junit/ReplaceAssertLiteralWithAssertEqualsIntentionTest.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2000-2014 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.siyeh.ipp.junit;
+
+import com.siyeh.IntentionPowerPackBundle;
+import com.siyeh.ipp.IPPTestCase;
+
+/**
+ * @see com.siyeh.ipp.junit.ReplaceAssertLiteralWithAssertEqualsIntention
+ * @author Bas Leijdekkers
+ */
+public class ReplaceAssertLiteralWithAssertEqualsIntentionTest extends IPPTestCase {
+
+ public void testOutsideTestMethod() { doTest(); }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ myFixture.addClass("package org.junit;" +
+ "class Assert {" +
+ " static public void assertNull(Object actual) {}" +
+ "}");
+ }
+
+ @Override
+ protected String getRelativePath() {
+ return "junit/replace_assert_literal_with_assert_equals";
+ }
+
+ @Override
+ protected String getIntentionName() {
+ return IntentionPowerPackBundle.message("replace.assert.literal.with.assert.equals.intention.name", "assertNull", "null");
+ }
+}
diff --git a/plugins/copyright/src/META-INF/plugin.xml b/plugins/copyright/src/META-INF/plugin.xml
index ea667615982f..8d0c4b038d85 100644
--- a/plugins/copyright/src/META-INF/plugin.xml
+++ b/plugins/copyright/src/META-INF/plugin.xml
@@ -11,7 +11,7 @@
<depends optional="true" config-file="java.xml">com.intellij.modules.java</depends>
<extensions defaultExtensionNs="com.intellij">
- <projectConfigurable instance="com.maddyhome.idea.copyright.ui.CopyrightProjectConfigurable"/>
+ <projectConfigurable groupId="editor" dynamic="true" displayName="Copyright" instance="com.maddyhome.idea.copyright.ui.CopyrightProjectConfigurable"/>
<errorHandler implementation="com.intellij.diagnostic.ITNReporter"/>
<checkinHandlerFactory implementation="com.maddyhome.idea.copyright.actions.UpdateCopyrightCheckinHandlerFactory"/>
<applicationService serviceInterface="com.maddyhome.idea.copyright.util.FileTypeUtil"
diff --git a/plugins/coverage-common/src/META-INF/coverage-common-plugin.xml b/plugins/coverage-common/src/META-INF/coverage-common-plugin.xml
index dcc83cecb41c..028b043cf6d0 100644
--- a/plugins/coverage-common/src/META-INF/coverage-common-plugin.xml
+++ b/plugins/coverage-common/src/META-INF/coverage-common-plugin.xml
@@ -8,7 +8,7 @@
<extensions defaultExtensionNs="com.intellij">
<testActionProvider implementation="com.intellij.coverage.actions.TrackCoverageActionProvider"/>
<projectViewNodeDecorator implementation="com.intellij.coverage.CoverageProjectViewDirectoryNodeDecorator"/>
- <projectConfigurable instance="com.intellij.coverage.CoverageOptionsConfigurable" id="coverage" displayName="Coverage" />
+ <projectConfigurable groupId="build" instance="com.intellij.coverage.CoverageOptionsConfigurable" id="coverage" displayName="Coverage" />
<projectService serviceImplementation="com.intellij.coverage.CoverageOptionsProvider"/>
<projectService serviceImplementation="com.intellij.coverage.view.CoverageViewManager"/>
<executor implementation="com.intellij.coverage.CoverageExecutor" />
diff --git a/plugins/coverage/src/com/intellij/execution/configurations/coverage/JavaCoverageEnabledConfiguration.java b/plugins/coverage/src/com/intellij/execution/configurations/coverage/JavaCoverageEnabledConfiguration.java
index f8d3c14ace28..6a2ca1ff2f18 100644
--- a/plugins/coverage/src/com/intellij/execution/configurations/coverage/JavaCoverageEnabledConfiguration.java
+++ b/plugins/coverage/src/com/intellij/execution/configurations/coverage/JavaCoverageEnabledConfiguration.java
@@ -23,6 +23,7 @@ import com.intellij.coverage.JavaCoverageRunner;
import com.intellij.execution.configurations.RunConfigurationBase;
import com.intellij.execution.configurations.SimpleJavaParameters;
import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.openapi.util.DefaultJDOMExternalizer;
import com.intellij.openapi.util.InvalidDataException;
import com.intellij.openapi.util.WriteExternalException;
import com.intellij.ui.classFilter.ClassFilter;
@@ -116,6 +117,7 @@ public class JavaCoverageEnabledConfiguration extends CoverageEnabledConfigurati
myCoveragePatterns = coveragePatterns;
}
+ @Override
public void readExternal(Element element) throws InvalidDataException {
super.readExternal(element);
@@ -126,14 +128,13 @@ public class JavaCoverageEnabledConfiguration extends CoverageEnabledConfigurati
mySuiteToMergeWith = element.getAttributeValue(COVERAGE_MERGE_SUITE_ATT_NAME);
// coverage patters
- final List children = element.getChildren(COVERAGE_PATTERN_ELEMENT_NAME);
+ List<Element> children = element.getChildren(COVERAGE_PATTERN_ELEMENT_NAME);
if (children.size() > 0) {
myCoveragePatterns = new ClassFilter[children.size()];
for (int i = 0; i < children.size(); i++) {
- myCoveragePatterns[i] = new ClassFilter();
- @NonNls final Element e = (Element)children.get(i);
- myCoveragePatterns[i].readExternal(e);
- final String val = e.getAttributeValue("value");
+ Element e = children.get(i);
+ myCoveragePatterns[i] = createClassFilter(e);
+ String val = e.getAttributeValue("value");
if (val != null) {
myCoveragePatterns[i].setPattern(val);
}
@@ -141,6 +142,13 @@ public class JavaCoverageEnabledConfiguration extends CoverageEnabledConfigurati
}
}
+ public static ClassFilter createClassFilter(Element element) throws InvalidDataException {
+ ClassFilter filter = new ClassFilter();
+ DefaultJDOMExternalizer.readExternal(filter, element);
+ return filter;
+ }
+
+ @Override
public void writeExternal(Element element) throws WriteExternalException {
// just for backward compatibility with settings format before "Huge Coverage Refactoring"
// see [IDEA-56800] ProjectRunConfigurationManager component: "coverage" extension: "merge" attribute is misplaced
@@ -187,12 +195,13 @@ public class JavaCoverageEnabledConfiguration extends CoverageEnabledConfigurati
if (myCoveragePatterns != null) {
for (ClassFilter pattern : myCoveragePatterns) {
@NonNls final Element patternElement = new Element(COVERAGE_PATTERN_ELEMENT_NAME);
- pattern.writeExternal(patternElement);
+ DefaultJDOMExternalizer.writeExternal(pattern, patternElement);
element.addContent(patternElement);
}
}
}
+ @Override
@Nullable
public String getCoverageFilePath() {
if (myCoverageFilePath != null ) {
diff --git a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/cvsstatuses/CvsChangeProvider.java b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/cvsstatuses/CvsChangeProvider.java
index ee82d0874566..a2e055b7b283 100644
--- a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/cvsstatuses/CvsChangeProvider.java
+++ b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/cvsstatuses/CvsChangeProvider.java
@@ -169,7 +169,7 @@ public class CvsChangeProvider implements ChangeProvider {
for (VirtualFile file : children) {
progress.checkCanceled();
if (file.isDirectory()) {
- final boolean isIgnored = myFileIndex.isIgnored(file);
+ final boolean isIgnored = myFileIndex.isExcluded(file);
if (!isIgnored) {
processEntriesIn(file, scope, builder, true, progress);
}
diff --git a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/ui/experts/importToCvs/ImportTree.java b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/ui/experts/importToCvs/ImportTree.java
index 99f038430b9b..3877a78a0d35 100644
--- a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/ui/experts/importToCvs/ImportTree.java
+++ b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/ui/experts/importToCvs/ImportTree.java
@@ -151,11 +151,11 @@ public class ImportTree extends NodeRenderer {
return;
}
final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(myProject).getFileIndex();
- if (!fileIndex.isIgnored(selectedFile)) {
+ if (!fileIndex.isExcluded(selectedFile)) {
return;
}
final VirtualFile parent = selectedFile.getParent();
- if (parent != null && fileIndex.isIgnored(parent)) {
+ if (parent != null && fileIndex.isExcluded(parent)) {
return;
}
for (final VirtualFile excludedFile : myExcludedFiles) {
@@ -183,11 +183,11 @@ public class ImportTree extends NodeRenderer {
continue;
}
final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(myProject).getFileIndex();
- if (!fileIndex.isIgnored(selectedFile)) {
+ if (!fileIndex.isExcluded(selectedFile)) {
continue;
}
final VirtualFile parent = selectedFile.getParent();
- if (parent == null || fileIndex.isIgnored(parent) || myExcludedFiles.contains(parent)) {
+ if (parent == null || fileIndex.isExcluded(parent) || myExcludedFiles.contains(parent)) {
continue;
}
if (!myIncludedFiles.contains(selectedFile)) {
@@ -211,7 +211,7 @@ public class ImportTree extends NodeRenderer {
return true;
}
}
- if (myProject == null || !ProjectRootManager.getInstance(myProject).getFileIndex().isIgnored(file)) {
+ if (myProject == null || !ProjectRootManager.getInstance(myProject).getFileIndex().isExcluded(file)) {
return false;
}
for (VirtualFile includedFile : myIncludedFiles) {
@@ -242,7 +242,7 @@ public class ImportTree extends NodeRenderer {
if (FileTypeManager.getInstance().isFileIgnored(abstractFileObject.getName())) return true;
if (myProject != null && !includedFiles.contains(file)) {
final VirtualFile vFile = LocalFileSystem.getInstance().findFileByIoFile(file);
- if (vFile != null && ProjectRootManager.getInstance(myProject).getFileIndex().isIgnored(vFile)) {
+ if (vFile != null && ProjectRootManager.getInstance(myProject).getFileIndex().isExcluded(vFile)) {
return true;
}
}
diff --git a/plugins/devkit/resources/META-INF/plugin.xml b/plugins/devkit/resources/META-INF/plugin.xml
index d92839c2df6c..9bb838c8e02c 100644
--- a/plugins/devkit/resources/META-INF/plugin.xml
+++ b/plugins/devkit/resources/META-INF/plugin.xml
@@ -27,7 +27,6 @@
<junitPatcher implementation="org.jetbrains.idea.devkit.run.JUnitDevKitPatcher"/>
<antBuildGen implementation="org.jetbrains.idea.devkit.build.ant.ChunkBuildPluginExtension"/>
- <compiler.buildParticipantProvider implementation="org.jetbrains.idea.devkit.build.PluginBuildParticipantProvider"/>
<compiler.buildTargetScopeProvider implementation="org.jetbrains.idea.devkit.build.PluginModuleBuildScopeProvider"/>
<dom.fileDescription implementation="org.jetbrains.idea.devkit.dom.impl.PluginXmlDomFileDescription"/>
@@ -46,6 +45,7 @@
<dom.implementation interfaceClass="org.jetbrains.idea.devkit.dom.Extensions"
implementationClass="org.jetbrains.idea.devkit.dom.impl.ExtensionsImpl"/>
<useScopeEnlarger implementation="org.jetbrains.idea.devkit.DevKitUseScopeEnlarger"/>
+ <properties.implicitPropertyUsageProvider implementation="org.jetbrains.idea.devkit.references.RegistryImplicitPropertyUsageProvider"/>
<configurationType implementation="org.jetbrains.idea.devkit.run.PluginConfigurationType"/>
<moduleType id="PLUGIN_MODULE" implementationClass="org.jetbrains.idea.devkit.module.PluginModuleType" classpathProvider="true"/>
diff --git a/plugins/devkit/src/build/PluginBuildConfiguration.java b/plugins/devkit/src/build/PluginBuildConfiguration.java
index 3604b0f0d13a..1155402e3f39 100644
--- a/plugins/devkit/src/build/PluginBuildConfiguration.java
+++ b/plugins/devkit/src/build/PluginBuildConfiguration.java
@@ -54,13 +54,11 @@ public class PluginBuildConfiguration implements ModuleComponent, JDOMExternaliz
@NonNls private static final String MANIFEST_ATTR = "manifest";
@NonNls private static final String META_INF = "META-INF";
@NonNls private static final String PLUGIN_XML = "plugin.xml";
- private final PluginBuildParticipant myBuildParticipant;
public PluginBuildConfiguration(Module module) {
myModule = module;
myPluginXmlContainer = ConfigFileFactory.getInstance().createSingleFileContainer(myModule.getProject(), PluginDescriptorConstants.META_DATA);
Disposer.register(module, myPluginXmlContainer);
- myBuildParticipant = new PluginBuildParticipant(module, this);
}
@Nullable
@@ -203,8 +201,4 @@ public class PluginBuildConfiguration implements ModuleComponent, JDOMExternaliz
public void setUseUserManifest(final boolean useUserManifest) {
myUseUserManifest = useUserManifest;
}
-
- public PluginBuildParticipant getBuildParticipant() {
- return myBuildParticipant;
- }
}
diff --git a/plugins/devkit/src/build/PluginBuildParticipant.java b/plugins/devkit/src/build/PluginBuildParticipant.java
deleted file mode 100644
index 75f6c7cf3046..000000000000
--- a/plugins/devkit/src/build/PluginBuildParticipant.java
+++ /dev/null
@@ -1,213 +0,0 @@
-/*
- * Copyright 2000-2012 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jetbrains.idea.devkit.build;
-
-import com.intellij.openapi.compiler.CompileContext;
-import com.intellij.openapi.compiler.CompilerMessageCategory;
-import com.intellij.openapi.compiler.make.BuildParticipant;
-import com.intellij.openapi.deployment.DeploymentUtil;
-import com.intellij.openapi.module.Module;
-import com.intellij.openapi.projectRoots.Sdk;
-import com.intellij.openapi.roots.ModuleRootManager;
-import com.intellij.openapi.roots.OrderRootType;
-import com.intellij.openapi.roots.libraries.Library;
-import com.intellij.openapi.util.io.FileUtil;
-import com.intellij.openapi.vfs.JarFileSystem;
-import com.intellij.openapi.vfs.VfsUtil;
-import com.intellij.openapi.vfs.VfsUtilCore;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.packaging.artifacts.Artifact;
-import com.intellij.packaging.elements.ArtifactRootElement;
-import com.intellij.packaging.elements.CompositePackagingElement;
-import com.intellij.packaging.elements.PackagingElement;
-import com.intellij.packaging.elements.PackagingElementFactory;
-import com.intellij.packaging.impl.artifacts.ArtifactImpl;
-import com.intellij.packaging.impl.artifacts.PlainArtifactType;
-import com.intellij.psi.xml.XmlDocument;
-import com.intellij.psi.xml.XmlFile;
-import com.intellij.psi.xml.XmlTag;
-import com.intellij.util.descriptors.ConfigFile;
-import com.intellij.util.xml.DomElement;
-import com.intellij.util.xml.DomManager;
-import org.jetbrains.annotations.NonNls;
-import org.jetbrains.idea.devkit.DevKitBundle;
-import org.jetbrains.idea.devkit.dom.Dependency;
-import org.jetbrains.idea.devkit.dom.IdeaPlugin;
-import org.jetbrains.idea.devkit.module.PluginModuleType;
-import org.jetbrains.idea.devkit.projectRoots.IdeaJdk;
-import org.jetbrains.idea.devkit.util.DescriptorUtil;
-
-import java.util.HashSet;
-import java.util.List;
-
-/**
- * @author peter
-*/
-public class PluginBuildParticipant extends BuildParticipant {
- @NonNls private static final String CLASSES = "/classes";
- @NonNls private static final String LIB = "/lib/";
- @NonNls private static final String LIB_DIRECTORY = "lib";
- private final Module myModule;
- private final PluginBuildConfiguration myPluginBuildConfiguration;
-
- public PluginBuildParticipant(final Module module, final PluginBuildConfiguration pluginBuildConfiguration) {
- super();
- myModule = module;
- myPluginBuildConfiguration = pluginBuildConfiguration;
- }
-
- @Override
- public Artifact createArtifact(CompileContext context) {
- Sdk sdk = IdeaJdk.findIdeaJdk(ModuleRootManager.getInstance(myModule).getSdk());
- if (sdk != null && IdeaJdk.isFromIDEAProject(sdk.getHomePath())) {
- return null;
- }
-
- if (sdk == null) {
- context.addMessage(CompilerMessageCategory.ERROR, DevKitBundle.message("sdk.type.incorrect", myModule.getName()), null, -1, -1);
- return null;
- }
-
- final String outputPath = PluginBuildUtil.getPluginExPath(myModule);
- if (outputPath == null) {
- return null;
- }
-
- if (!checkDependencies(context)) {
- return null;
- }
-
-
- final PackagingElementFactory factory = PackagingElementFactory.getInstance();
- final ArtifactRootElement<?> root = factory.createArtifactRootElement();
-
- ConfigFile configFile = myPluginBuildConfiguration.getPluginXML();
- if (configFile != null) {
- DeploymentUtil.getInstance().checkConfigFile(configFile, context, myModule);
- factory.addFileCopy(root, "META-INF/", VfsUtil.urlToPath(configFile.getUrl()));
-
- final XmlFile xmlFile = configFile.getXmlFile();
- if (xmlFile != null) {
- final XmlDocument document = xmlFile.getDocument();
- if (document != null) {
- final DomElement domElement = DomManager.getDomManager(xmlFile.getProject()).getDomElement(document.getRootTag());
- if (domElement instanceof IdeaPlugin) {
- for(Dependency dependency: ((IdeaPlugin)domElement).getDependencies()) {
- final String file = dependency.getConfigFile().getStringValue();
- if (file != null) {
- final VirtualFile virtualFile = configFile.getVirtualFile();
- assert virtualFile != null;
- final VirtualFile parent = virtualFile.getParent();
- assert parent != null;
- final String url = parent.getUrl();
- factory.addFileCopy(root, "META-INF/", VfsUtil.urlToPath(url) + "/" + file);
- }
- }
- }
- }
- }
- }
-
- HashSet<Module> modules = new HashSet<Module>();
- PluginBuildUtil.getDependencies(myModule, modules);
-
- final CompositePackagingElement<?> classesDir = factory.getOrCreateDirectory(root, CLASSES);
- for (Module dep : modules) {
- classesDir.addOrFindChild(factory.createModuleOutput(dep));
- }
- classesDir.addOrFindChild(factory.createModuleOutput(myModule));
-
- HashSet<Library> libs = new HashSet<Library>();
- PluginBuildUtil.getLibraries(myModule, libs);
- for (Module dependentModule : modules) {
- PluginBuildUtil.getLibraries(dependentModule, libs);
- }
-
-
- // libraries
- final VirtualFile libDir = sdk.getHomeDirectory().findFileByRelativePath(LIB_DIRECTORY);
- for (Library library : libs) {
- boolean hasDirsOnly = true;
- VirtualFile[] files = library.getFiles(OrderRootType.CLASSES);
- for (VirtualFile file : files) {
- if (file.getFileSystem() instanceof JarFileSystem) {
- hasDirsOnly = false;
- file = ((JarFileSystem)file.getFileSystem()).getVirtualFileForJar(file);
- }
- if (libDir != null && file != null && VfsUtilCore.isAncestor(libDir, file, false)) {
- context.addMessage(CompilerMessageCategory.ERROR, DevKitBundle.message("dont.add.idea.libs.to.classpath", file.getName()), null,
- -1, -1);
- }
- }
-
- final List<? extends PackagingElement<?>> elements = factory.createLibraryElements(library);
- if (hasDirsOnly) {
- //todo split one lib into 2 separate libs if there are jars and dirs
- classesDir.addOrFindChildren(elements);
- }
- else {
- factory.getOrCreateDirectory(root, LIB).addOrFindChildren(elements);
- }
- }
-
- return new ArtifactImpl(getArtifactName(), PlainArtifactType.getInstance(), false, root, FileUtil.toSystemIndependentName(outputPath));
- }
-
- private String getArtifactName() {
- return myModule.getName() + ":plugin";
- }
-
- private boolean checkDependencies(CompileContext context) {
- final Module[] wrongSetDependencies = PluginBuildUtil.getWrongSetDependencies(myModule);
- if (wrongSetDependencies.length != 0) {
- boolean realProblems = false;
- final String pluginId = DescriptorUtil.getPluginId(myModule);
-
- for (Module dependency : wrongSetDependencies) {
- if (!PluginModuleType.isOfType(dependency)) {
- realProblems = true;
- context.addMessage(CompilerMessageCategory.ERROR,
- DevKitBundle.message("incorrect.dependency.non-plugin-module", dependency.getName(), myModule.getName()), null,
- -1, -1);
- }
- else {
- final XmlFile pluginXml = PluginModuleType.getPluginXml(dependency);
- boolean isDeclared = false;
- if (pluginXml != null) {
- final XmlTag rootTag = pluginXml.getDocument().getRootTag();
- final XmlTag[] dependencies = rootTag != null ? rootTag.findSubTags("depends") : XmlTag.EMPTY;
- for (XmlTag dep : dependencies) {
- if (dep.getValue().getTrimmedText().equals(pluginId)) {
- isDeclared = true;
- break;
- }
- }
- }
- if (!isDeclared) {
- // make this a warning instead?
- realProblems = true;
- context.addMessage(CompilerMessageCategory.ERROR,
- DevKitBundle.message("incorrect.dependency.not-declared", dependency.getName(), myModule.getName()), null, -1,
- -1);
- }
- }
- }
- if (realProblems) return false;
- }
- return true;
- }
-
-}
diff --git a/plugins/devkit/src/build/PluginBuildParticipantProvider.java b/plugins/devkit/src/build/PluginBuildParticipantProvider.java
deleted file mode 100644
index b8a35d377a96..000000000000
--- a/plugins/devkit/src/build/PluginBuildParticipantProvider.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright 2000-2009 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.jetbrains.idea.devkit.build;
-
-import com.intellij.openapi.compiler.make.BuildParticipantProvider;
-import com.intellij.openapi.module.Module;
-import com.intellij.openapi.module.ModuleType;
-import org.jetbrains.idea.devkit.module.PluginModuleType;
-
-import java.util.Collection;
-import java.util.Collections;
-
-/**
- * @author nik
- */
-public class PluginBuildParticipantProvider extends BuildParticipantProvider {
- public Collection<PluginBuildParticipant> getParticipants(final Module module) {
- if (ModuleType.get(module) != PluginModuleType.getInstance()) {
- return Collections.emptyList();
- }
-
- final PluginBuildConfiguration configuration = PluginBuildConfiguration.getInstance(module);
- return configuration != null ? Collections.singletonList(configuration.getBuildParticipant())
- : Collections.<PluginBuildParticipant>emptyList();
- }
-}
diff --git a/plugins/devkit/src/references/RegistryImplicitPropertyUsageProvider.java b/plugins/devkit/src/references/RegistryImplicitPropertyUsageProvider.java
new file mode 100644
index 000000000000..d40f100e4111
--- /dev/null
+++ b/plugins/devkit/src/references/RegistryImplicitPropertyUsageProvider.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jetbrains.idea.devkit.references;
+
+import com.intellij.codeInspection.unused.ImplicitPropertyUsageProvider;
+import com.intellij.lang.properties.psi.Property;
+import com.intellij.psi.PsiFile;
+import org.jetbrains.idea.devkit.util.PsiUtil;
+
+/**
+ * @author Konstantin Bulenkov
+ */
+public class RegistryImplicitPropertyUsageProvider extends ImplicitPropertyUsageProvider {
+ @Override
+ protected boolean isUsed(Property property) {
+ if (PsiUtil.isIdeaProject(property.getProject())) {
+ final PsiFile file = property.getContainingFile();
+ if (file != null && file.getName().equals("registry.properties")) {
+ final String name = property.getName();
+ return name.endsWith(".description") || name.endsWith(".restartRequired");
+ }
+ }
+ return false;
+ }
+}
diff --git a/plugins/devkit/src/testAssistant/TestDataGuessByExistingFilesUtil.java b/plugins/devkit/src/testAssistant/TestDataGuessByExistingFilesUtil.java
index e37fb720c25a..b5763cc663c7 100644
--- a/plugins/devkit/src/testAssistant/TestDataGuessByExistingFilesUtil.java
+++ b/plugins/devkit/src/testAssistant/TestDataGuessByExistingFilesUtil.java
@@ -34,6 +34,7 @@ import com.intellij.psi.codeStyle.NameUtil;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.testIntegration.TestFramework;
import com.intellij.util.PathUtil;
+import com.intellij.util.Processor;
import com.intellij.util.containers.ConcurrentHashMap;
import com.intellij.util.containers.HashSet;
import com.intellij.util.containers.LinkedMultiMap;
@@ -389,17 +390,21 @@ public class TestDataGuessByExistingFilesUtil {
return new TestDataDescriptor(descriptors);
}
- private static synchronized MultiMap<String, Trinity<Matcher, String, String>> getAllFileNames(List<Trinity<Matcher, String, String>> input,
+ private static MultiMap<String, Trinity<Matcher, String, String>> getAllFileNames(final List<Trinity<Matcher, String, String>> input,
final GotoFileModel model) {
- LinkedMultiMap<String, Trinity<Matcher, String, String>> map = new LinkedMultiMap<String, Trinity<Matcher, String, String>>();
- for (String name : model.getNames(false)) {
- ProgressManager.checkCanceled();
- for (Trinity<Matcher, String, String> trinity : input) {
- if (trinity.first.matches(name)) {
- map.putValue(name, trinity);
+ final LinkedMultiMap<String, Trinity<Matcher, String, String>> map = new LinkedMultiMap<String, Trinity<Matcher, String, String>>();
+ model.processNames(new Processor<String>() {
+ @Override
+ public boolean process(String name) {
+ ProgressManager.checkCanceled();
+ for (Trinity<Matcher, String, String> trinity : input) {
+ if (trinity.first.matches(name)) {
+ map.putValue(name, trinity);
+ }
}
+ return true;
}
- }
+ }, false);
return map;
}
diff --git a/plugins/eclipse/src/org/jetbrains/idea/eclipse/conversion/EPathUtil.java b/plugins/eclipse/src/org/jetbrains/idea/eclipse/conversion/EPathUtil.java
index c5a23e1b1d43..a29672091751 100644
--- a/plugins/eclipse/src/org/jetbrains/idea/eclipse/conversion/EPathUtil.java
+++ b/plugins/eclipse/src/org/jetbrains/idea/eclipse/conversion/EPathUtil.java
@@ -149,7 +149,7 @@ public class EPathUtil {
return collapse2eclipsePathRelative2Module(file, module);
} else { //should check all modules then
final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex();
- if (fileIndex.isIgnored(file) || fileIndex.isInLibraryClasses(file)) {
+ if (fileIndex.isExcluded(file) || fileIndex.isInLibraryClasses(file)) {
for (Module aModule : ModuleManager.getInstance(project).getModules()) {
final String path = collapse2eclipsePathRelative2Module(file, aModule);
if (path != null) {
diff --git a/plugins/eclipse/src/org/jetbrains/idea/eclipse/conversion/IdeaSpecificSettings.java b/plugins/eclipse/src/org/jetbrains/idea/eclipse/conversion/IdeaSpecificSettings.java
index ffd71fd6ef76..4541cf57f7a7 100644
--- a/plugins/eclipse/src/org/jetbrains/idea/eclipse/conversion/IdeaSpecificSettings.java
+++ b/plugins/eclipse/src/org/jetbrains/idea/eclipse/conversion/IdeaSpecificSettings.java
@@ -451,7 +451,7 @@ public class IdeaSpecificSettings extends AbstractIdeaSpecificSettings<Modifiabl
final Module module = ModuleUtilCore.findModuleForFile(file, project);
if (module != null) {
return appendRelatedToModule(element, classesUrl, rootName, file, module);
- } else if (ProjectRootManager.getInstance(project).getFileIndex().isIgnored(file)) {
+ } else if (ProjectRootManager.getInstance(project).getFileIndex().isExcluded(file)) {
for (Module aModule : ModuleManager.getInstance(project).getModules()) {
if (appendRelatedToModule(element, classesUrl, rootName, file, aModule)) return true;
}
diff --git a/plugins/git4idea/remote-servers-git/src/com/intellij/remoteServer/util/importProject/CloudGitChooseAccountStepBase.java b/plugins/git4idea/remote-servers-git/src/com/intellij/remoteServer/util/importProject/CloudGitChooseAccountStepBase.java
index 20fe160cb399..1f8f93accd89 100644
--- a/plugins/git4idea/remote-servers-git/src/com/intellij/remoteServer/util/importProject/CloudGitChooseAccountStepBase.java
+++ b/plugins/git4idea/remote-servers-git/src/com/intellij/remoteServer/util/importProject/CloudGitChooseAccountStepBase.java
@@ -16,6 +16,7 @@
package com.intellij.remoteServer.util.importProject;
import com.intellij.ide.util.projectWizard.ModuleWizardStep;
+import com.intellij.ide.util.projectWizard.WizardContext;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.options.ConfigurationException;
import com.intellij.remoteServer.ServerType;
@@ -25,11 +26,12 @@ import com.intellij.remoteServer.util.CloudDeploymentNameConfiguration;
import com.intellij.remoteServer.util.CloudGitDeploymentDetector;
import javax.swing.*;
+import java.util.Collections;
/**
* @author michael.golubev
*/
-public abstract class CloudGitChooseAccountStepBase extends ModuleWizardStep {
+public class CloudGitChooseAccountStepBase extends ModuleWizardStep {
private JPanel myAccountSelectionPanelPlaceHolder;
private JPanel myMainPanel;
@@ -38,14 +40,15 @@ public abstract class CloudGitChooseAccountStepBase extends ModuleWizardStep {
private CloudAccountSelectionEditor myEditor;
private final CloudGitDeploymentDetector myDeploymentDetector;
+ private final WizardContext myContext;
- public CloudGitChooseAccountStepBase(CloudGitDeploymentDetector deploymentDetector) {
+ public CloudGitChooseAccountStepBase(CloudGitDeploymentDetector deploymentDetector, WizardContext context) {
myDeploymentDetector = deploymentDetector;
+ myContext = context;
ServerType cloudType = deploymentDetector.getCloudType();
myTitleLabel.setText(CloudBundle.getText("choose.account.title", cloudType.getPresentableName()));
- myEditor = new CloudAccountSelectionEditor(cloudType);
+ myEditor = new CloudAccountSelectionEditor(Collections.<ServerType<?>>singletonList(cloudType));
myAccountSelectionPanelPlaceHolder.add(myEditor.getMainPanel());
- myEditor.initUI();
}
protected CloudGitDeploymentDetector getDeploymentDetector() {
@@ -63,6 +66,11 @@ public abstract class CloudGitChooseAccountStepBase extends ModuleWizardStep {
return super.validate();
}
+ @Override
+ public void updateDataModel() {
+ myEditor.setAccountOnContext(myContext);
+ }
+
public void createRunConfiguration(Module module, String applicationName) {
CloudDeploymentNameConfiguration deploymentConfiguration = myDeploymentDetector.createDeploymentConfiguration();
@@ -72,6 +80,6 @@ public abstract class CloudGitChooseAccountStepBase extends ModuleWizardStep {
deploymentConfiguration.setDeploymentName(applicationName);
}
- myEditor.createRunConfiguration(module, deploymentConfiguration);
+ CloudAccountSelectionEditor.createRunConfiguration(myContext, myDeploymentDetector.getCloudType(), module, deploymentConfiguration);
}
}
diff --git a/plugins/git4idea/remote-servers-git/src/com/intellij/remoteServer/util/importProject/CloudGitChooseAccountStepImpl.java b/plugins/git4idea/remote-servers-git/src/com/intellij/remoteServer/util/importProject/CloudGitChooseAccountStepImpl.java
index 74f4d22e32c3..1de4eff05368 100644
--- a/plugins/git4idea/remote-servers-git/src/com/intellij/remoteServer/util/importProject/CloudGitChooseAccountStepImpl.java
+++ b/plugins/git4idea/remote-servers-git/src/com/intellij/remoteServer/util/importProject/CloudGitChooseAccountStepImpl.java
@@ -55,7 +55,7 @@ public class CloudGitChooseAccountStepImpl extends CloudGitChooseAccountStepBase
CloudGitProjectStructureDetector structureDetector,
ProjectFromSourcesBuilder builder,
ProjectDescriptor projectDescriptor) {
- super(deploymentDetector);
+ super(deploymentDetector, builder.getContext());
myBuilder = builder;
myProjectDescriptor = projectDescriptor;
@@ -82,6 +82,7 @@ public class CloudGitChooseAccountStepImpl extends CloudGitChooseAccountStepBase
@Override
public void updateDataModel() {
+ super.updateDataModel();
final MultiMap<CloudGitProjectRoot, DetectedSourceRoot> project2sourceRoots = new MultiMap<CloudGitProjectRoot, DetectedSourceRoot>();
new RootIterator() {
diff --git a/plugins/git4idea/remote-servers-git/src/com/intellij/remoteServer/util/importProject/CloudGitRemoteDetector.java b/plugins/git4idea/remote-servers-git/src/com/intellij/remoteServer/util/importProject/CloudGitRemoteDetector.java
index f253a3de2894..704ced7f3d05 100644
--- a/plugins/git4idea/remote-servers-git/src/com/intellij/remoteServer/util/importProject/CloudGitRemoteDetector.java
+++ b/plugins/git4idea/remote-servers-git/src/com/intellij/remoteServer/util/importProject/CloudGitRemoteDetector.java
@@ -34,6 +34,7 @@ import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.MessageType;
+import com.intellij.openapi.util.Ref;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.remoteServer.ServerType;
@@ -258,20 +259,14 @@ public class CloudGitRemoteDetector extends AbstractProjectComponent implements
ImportModuleAction.createFromWizard(myProject, wizard);
}
else {
- final CloudGitChooseAccountStepBase chooseAccountStep
- = new CloudGitChooseAccountStepBase(myDeploymentDetector) {
-
- @Override
- public void updateDataModel() {
-
- }
- };
-
+ final Ref<CloudGitChooseAccountStepBase> chooseAccountStepRef = new Ref<CloudGitChooseAccountStepBase>();
if (!new AbstractProjectWizard(CloudBundle.getText("choose.account.wizzard.title", myCloudName), myProject, (String)null) {
final StepSequence myStepSequence;
{
+ CloudGitChooseAccountStepBase chooseAccountStep = new CloudGitChooseAccountStepBase(myDeploymentDetector, myWizardContext);
+ chooseAccountStepRef.set(chooseAccountStep);
myStepSequence = new StepSequence(chooseAccountStep);
addStep(chooseAccountStep);
init();
@@ -284,7 +279,7 @@ public class CloudGitRemoteDetector extends AbstractProjectComponent implements
}.showAndGet()) {
return;
}
- chooseAccountStep.createRunConfiguration(targetModule, myApplicationName);
+ chooseAccountStepRef.get().createRunConfiguration(targetModule, myApplicationName);
}
}
}
diff --git a/plugins/git4idea/src/git4idea/GitUtil.java b/plugins/git4idea/src/git4idea/GitUtil.java
index 4286aee1536b..5f56de5674e1 100644
--- a/plugins/git4idea/src/git4idea/GitUtil.java
+++ b/plugins/git4idea/src/git4idea/GitUtil.java
@@ -18,6 +18,8 @@ package git4idea;
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import com.google.common.collect.Collections2;
+import com.intellij.ide.file.BatchFileChangeListener;
+import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.progress.ProgressIndicator;
@@ -43,6 +45,7 @@ import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.Consumer;
import com.intellij.util.Function;
import com.intellij.util.containers.ContainerUtil;
+import com.intellij.util.io.storage.HeavyProcessLatch;
import com.intellij.util.ui.UIUtil;
import com.intellij.vcsUtil.VcsFileUtil;
import com.intellij.vcsUtil.VcsUtil;
@@ -1010,4 +1013,15 @@ public class GitUtil {
builder.setTitle(title);
builder.show();
}
+
+ public static void workingTreeChangeStarted(@NotNull Project project) {
+ HeavyProcessLatch.INSTANCE.processStarted();
+ ApplicationManager.getApplication().getMessageBus().syncPublisher(BatchFileChangeListener.TOPIC).batchChangeStarted(project);
+ }
+
+ public static void workingTreeChangeFinished(@NotNull Project project) {
+ HeavyProcessLatch.INSTANCE.processFinished();
+ ApplicationManager.getApplication().getMessageBus().syncPublisher(BatchFileChangeListener.TOPIC).batchChangeCompleted(project);
+ }
+
}
diff --git a/plugins/git4idea/src/git4idea/actions/GitMergeAction.java b/plugins/git4idea/src/git4idea/actions/GitMergeAction.java
index 1d46335cc1b1..e8bc37929a0d 100644
--- a/plugins/git4idea/src/git4idea/actions/GitMergeAction.java
+++ b/plugins/git4idea/src/git4idea/actions/GitMergeAction.java
@@ -81,27 +81,34 @@ abstract class GitMergeAction extends GitRepositoryAction {
final Git git = ServiceManager.getService(Git.class);
final GitLocalChangesWouldBeOverwrittenDetector localChangesDetector =
new GitLocalChangesWouldBeOverwrittenDetector(selectedRoot, MERGE);
- final GitUntrackedFilesOverwrittenByOperationDetector untrackedFilesDetector =
+ final GitUntrackedFilesOverwrittenByOperationDetector untrackedFilesDetector =
new GitUntrackedFilesOverwrittenByOperationDetector(selectedRoot);
- GitCommandResult result = git.runCommand(new Computable<GitLineHandler>() {
- @Override
- public GitLineHandler compute() {
- GitLineHandler handler = handlerProvider.compute();
- handler.addLineListener(localChangesDetector);
- handler.addLineListener(untrackedFilesDetector);
- return handler;
- }
- });
- affectedRoots.add(selectedRoot);
- GitRepository repository = repositoryManager.getRepositoryForRoot(selectedRoot);
- assert repository != null : "Repository can't be null for root " + selectedRoot;
- String revision = repository.getCurrentRevision();
- if (revision == null) {
- return;
+ GitUtil.workingTreeChangeStarted(project);
+ try {
+ GitCommandResult result = git.runCommand(new Computable<GitLineHandler>() {
+ @Override
+ public GitLineHandler compute() {
+ GitLineHandler handler = handlerProvider.compute();
+ handler.addLineListener(localChangesDetector);
+ handler.addLineListener(untrackedFilesDetector);
+ return handler;
+ }
+ });
+ affectedRoots.add(selectedRoot);
+
+ GitRepository repository = repositoryManager.getRepositoryForRoot(selectedRoot);
+ assert repository != null : "Repository can't be null for root " + selectedRoot;
+ String revision = repository.getCurrentRevision();
+ if (revision == null) {
+ return;
+ }
+ final GitRevisionNumber currentRev = new GitRevisionNumber(revision);
+ handleResult(result, project, localChangesDetector, untrackedFilesDetector, repository, currentRev, affectedRoots, beforeLabel);
+ }
+ finally {
+ GitUtil.workingTreeChangeFinished(project);
}
- final GitRevisionNumber currentRev = new GitRevisionNumber(revision);
- handleResult(result, project, localChangesDetector, untrackedFilesDetector, repository, currentRev, affectedRoots, beforeLabel);
}
}.queue();
diff --git a/plugins/git4idea/src/git4idea/actions/GitRebaseAbort.java b/plugins/git4idea/src/git4idea/actions/GitRebaseAbort.java
index 5b56884400ab..a3c4497e4dce 100644
--- a/plugins/git4idea/src/git4idea/actions/GitRebaseAbort.java
+++ b/plugins/git4idea/src/git4idea/actions/GitRebaseAbort.java
@@ -20,6 +20,7 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.vcs.VcsException;
import com.intellij.openapi.vfs.VirtualFile;
+import git4idea.GitUtil;
import git4idea.commands.GitCommand;
import git4idea.commands.GitHandlerUtil;
import git4idea.commands.GitSimpleHandler;
@@ -74,7 +75,13 @@ public class GitRebaseAbort extends GitRepositoryAction {
GitSimpleHandler h = new GitSimpleHandler(project, root, GitCommand.REBASE);
h.setStdoutSuppressed(false);
h.addParameters("--abort");
- GitHandlerUtil.doSynchronously(h, getActionName(), h.printableCommandLine());
+ GitUtil.workingTreeChangeStarted(project);
+ try {
+ GitHandlerUtil.doSynchronously(h, getActionName(), h.printableCommandLine());
+ }
+ finally {
+ GitUtil.workingTreeChangeFinished(project);
+ }
}
/**
diff --git a/plugins/git4idea/src/git4idea/actions/GitRebaseActionBase.java b/plugins/git4idea/src/git4idea/actions/GitRebaseActionBase.java
index c69bfb6c7547..912dd0ba350f 100644
--- a/plugins/git4idea/src/git4idea/actions/GitRebaseActionBase.java
+++ b/plugins/git4idea/src/git4idea/actions/GitRebaseActionBase.java
@@ -64,11 +64,17 @@ public abstract class GitRebaseActionBase extends GitRepositoryAction {
task.executeInBackground(false, new GitTaskResultHandlerAdapter() {
@Override
protected void run(GitTaskResult taskResult) {
- editor.close();
- GitRepositoryManager manager = GitUtil.getRepositoryManager(project);
- manager.updateRepository(root);
- root.refresh(false, true);
- notifyAboutErrorResult(taskResult, resultListener, exceptions, project);
+ GitUtil.workingTreeChangeStarted(project);
+ try {
+ editor.close();
+ GitRepositoryManager manager = GitUtil.getRepositoryManager(project);
+ manager.updateRepository(root);
+ root.refresh(false, true);
+ notifyAboutErrorResult(taskResult, resultListener, exceptions, project);
+ }
+ finally {
+ GitUtil.workingTreeChangeFinished(project);
+ }
}
});
}
diff --git a/plugins/git4idea/src/git4idea/actions/GitResetHead.java b/plugins/git4idea/src/git4idea/actions/GitResetHead.java
index d2278a2ed511..fd186b80e9e1 100644
--- a/plugins/git4idea/src/git4idea/actions/GitResetHead.java
+++ b/plugins/git4idea/src/git4idea/actions/GitResetHead.java
@@ -56,7 +56,13 @@ public class GitResetHead extends GitRepositoryAction {
}
GitLineHandler h = d.handler();
affectedRoots.add(d.getGitRoot());
- GitHandlerUtil.doSynchronously(h, GitBundle.getString("resetting.title"), h.printableCommandLine());
+ GitUtil.workingTreeChangeStarted(project);
+ try {
+ GitHandlerUtil.doSynchronously(h, GitBundle.getString("resetting.title"), h.printableCommandLine());
+ }
+ finally {
+ GitUtil.workingTreeChangeFinished(project);
+ }
GitRepositoryManager manager = GitUtil.getRepositoryManager(project);
manager.updateRepository(d.getGitRoot());
}
diff --git a/plugins/git4idea/src/git4idea/actions/GitStash.java b/plugins/git4idea/src/git4idea/actions/GitStash.java
index f23169708f38..b16c948b61c2 100644
--- a/plugins/git4idea/src/git4idea/actions/GitStash.java
+++ b/plugins/git4idea/src/git4idea/actions/GitStash.java
@@ -21,6 +21,7 @@ import com.intellij.openapi.vcs.VcsException;
import com.intellij.openapi.vcs.changes.ChangeListManager;
import com.intellij.openapi.vfs.VirtualFile;
import git4idea.GitPlatformFacade;
+import git4idea.GitUtil;
import git4idea.commands.GitHandlerUtil;
import git4idea.commands.GitLineHandler;
import git4idea.i18n.GitBundle;
@@ -53,7 +54,13 @@ public class GitStash extends GitRepositoryAction {
VirtualFile root = d.getGitRoot();
affectedRoots.add(root);
final GitLineHandler h = d.handler();
- GitHandlerUtil.doSynchronously(h, GitBundle.getString("stashing.title"), h.printableCommandLine());
+ GitUtil.workingTreeChangeStarted(project);
+ try {
+ GitHandlerUtil.doSynchronously(h, GitBundle.getString("stashing.title"), h.printableCommandLine());
+ }
+ finally {
+ GitUtil.workingTreeChangeFinished(project);
+ }
ServiceManager.getService(project, GitPlatformFacade.class).hardRefresh(root);
}
diff --git a/plugins/git4idea/src/git4idea/branch/GitCheckoutOperation.java b/plugins/git4idea/src/git4idea/branch/GitCheckoutOperation.java
index d49dc15827b7..2441bf7d46cf 100644
--- a/plugins/git4idea/src/git4idea/branch/GitCheckoutOperation.java
+++ b/plugins/git4idea/src/git4idea/branch/GitCheckoutOperation.java
@@ -64,40 +64,46 @@ class GitCheckoutOperation extends GitBranchOperation {
protected void execute() {
saveAllDocuments();
boolean fatalErrorHappened = false;
- while (hasMoreRepositories() && !fatalErrorHappened) {
- final GitRepository repository = next();
-
- VirtualFile root = repository.getRoot();
- GitLocalChangesWouldBeOverwrittenDetector localChangesDetector =
- new GitLocalChangesWouldBeOverwrittenDetector(root, GitLocalChangesWouldBeOverwrittenDetector.Operation.CHECKOUT);
- GitSimpleEventDetector unmergedFiles = new GitSimpleEventDetector(GitSimpleEventDetector.Event.UNMERGED_PREVENTING_CHECKOUT);
- GitUntrackedFilesOverwrittenByOperationDetector untrackedOverwrittenByCheckout =
- new GitUntrackedFilesOverwrittenByOperationDetector(root);
-
- GitCommandResult result = myGit.checkout(repository, myStartPointReference, myNewBranch, false,
- localChangesDetector, unmergedFiles, untrackedOverwrittenByCheckout);
- if (result.success()) {
- refresh(repository);
- markSuccessful(repository);
- }
- else if (unmergedFiles.hasHappened()) {
- fatalUnmergedFilesError();
- fatalErrorHappened = true;
- }
- else if (localChangesDetector.wasMessageDetected()) {
- boolean smartCheckoutSucceeded = smartCheckoutOrNotify(repository, localChangesDetector);
- if (!smartCheckoutSucceeded) {
+ GitUtil.workingTreeChangeStarted(myProject);
+ try {
+ while (hasMoreRepositories() && !fatalErrorHappened) {
+ final GitRepository repository = next();
+
+ VirtualFile root = repository.getRoot();
+ GitLocalChangesWouldBeOverwrittenDetector localChangesDetector =
+ new GitLocalChangesWouldBeOverwrittenDetector(root, GitLocalChangesWouldBeOverwrittenDetector.Operation.CHECKOUT);
+ GitSimpleEventDetector unmergedFiles = new GitSimpleEventDetector(GitSimpleEventDetector.Event.UNMERGED_PREVENTING_CHECKOUT);
+ GitUntrackedFilesOverwrittenByOperationDetector untrackedOverwrittenByCheckout =
+ new GitUntrackedFilesOverwrittenByOperationDetector(root);
+
+ GitCommandResult result = myGit.checkout(repository, myStartPointReference, myNewBranch, false,
+ localChangesDetector, unmergedFiles, untrackedOverwrittenByCheckout);
+ if (result.success()) {
+ refresh(repository);
+ markSuccessful(repository);
+ }
+ else if (unmergedFiles.hasHappened()) {
+ fatalUnmergedFilesError();
+ fatalErrorHappened = true;
+ }
+ else if (localChangesDetector.wasMessageDetected()) {
+ boolean smartCheckoutSucceeded = smartCheckoutOrNotify(repository, localChangesDetector);
+ if (!smartCheckoutSucceeded) {
+ fatalErrorHappened = true;
+ }
+ }
+ else if (untrackedOverwrittenByCheckout.wasMessageDetected()) {
+ fatalUntrackedFilesError(repository.getRoot(), untrackedOverwrittenByCheckout.getRelativeFilePaths());
+ fatalErrorHappened = true;
+ }
+ else {
+ fatalError(getCommonErrorTitle(), result.getErrorOutputAsJoinedString());
fatalErrorHappened = true;
}
}
- else if (untrackedOverwrittenByCheckout.wasMessageDetected()) {
- fatalUntrackedFilesError(repository.getRoot(), untrackedOverwrittenByCheckout.getRelativeFilePaths());
- fatalErrorHappened = true;
- }
- else {
- fatalError(getCommonErrorTitle(), result.getErrorOutputAsJoinedString());
- fatalErrorHappened = true;
- }
+ }
+ finally {
+ GitUtil.workingTreeChangeFinished(myProject);
}
if (!fatalErrorHappened) {
diff --git a/plugins/git4idea/src/git4idea/branch/GitMergeOperation.java b/plugins/git4idea/src/git4idea/branch/GitMergeOperation.java
index e90d1eb808ef..89a50cfd6054 100644
--- a/plugins/git4idea/src/git4idea/branch/GitMergeOperation.java
+++ b/plugins/git4idea/src/git4idea/branch/GitMergeOperation.java
@@ -72,76 +72,82 @@ class GitMergeOperation extends GitBranchOperation {
saveAllDocuments();
boolean fatalErrorHappened = false;
int alreadyUpToDateRepositories = 0;
- while (hasMoreRepositories() && !fatalErrorHappened) {
- final GitRepository repository = next();
- LOG.info("next repository: " + repository);
-
- VirtualFile root = repository.getRoot();
- GitLocalChangesWouldBeOverwrittenDetector localChangesDetector =
- new GitLocalChangesWouldBeOverwrittenDetector(root, GitLocalChangesWouldBeOverwrittenDetector.Operation.MERGE);
- GitSimpleEventDetector unmergedFiles = new GitSimpleEventDetector(GitSimpleEventDetector.Event.UNMERGED_PREVENTING_MERGE);
- GitUntrackedFilesOverwrittenByOperationDetector untrackedOverwrittenByMerge =
- new GitUntrackedFilesOverwrittenByOperationDetector(root);
- GitSimpleEventDetector mergeConflict = new GitSimpleEventDetector(GitSimpleEventDetector.Event.MERGE_CONFLICT);
- GitSimpleEventDetector alreadyUpToDateDetector = new GitSimpleEventDetector(GitSimpleEventDetector.Event.ALREADY_UP_TO_DATE);
-
- GitCommandResult result = myGit.merge(repository, myBranchToMerge, Collections.<String>emptyList(),
- localChangesDetector, unmergedFiles, untrackedOverwrittenByMerge, mergeConflict,
- alreadyUpToDateDetector);
- if (result.success()) {
- LOG.info("Merged successfully");
- refresh(repository);
- markSuccessful(repository);
- if (alreadyUpToDateDetector.hasHappened()) {
- alreadyUpToDateRepositories += 1;
+ GitUtil.workingTreeChangeStarted(myProject);
+ try {
+ while (hasMoreRepositories() && !fatalErrorHappened) {
+ final GitRepository repository = next();
+ LOG.info("next repository: " + repository);
+
+ VirtualFile root = repository.getRoot();
+ GitLocalChangesWouldBeOverwrittenDetector localChangesDetector =
+ new GitLocalChangesWouldBeOverwrittenDetector(root, GitLocalChangesWouldBeOverwrittenDetector.Operation.MERGE);
+ GitSimpleEventDetector unmergedFiles = new GitSimpleEventDetector(GitSimpleEventDetector.Event.UNMERGED_PREVENTING_MERGE);
+ GitUntrackedFilesOverwrittenByOperationDetector untrackedOverwrittenByMerge =
+ new GitUntrackedFilesOverwrittenByOperationDetector(root);
+ GitSimpleEventDetector mergeConflict = new GitSimpleEventDetector(GitSimpleEventDetector.Event.MERGE_CONFLICT);
+ GitSimpleEventDetector alreadyUpToDateDetector = new GitSimpleEventDetector(GitSimpleEventDetector.Event.ALREADY_UP_TO_DATE);
+
+ GitCommandResult result = myGit.merge(repository, myBranchToMerge, Collections.<String>emptyList(),
+ localChangesDetector, unmergedFiles, untrackedOverwrittenByMerge, mergeConflict,
+ alreadyUpToDateDetector);
+ if (result.success()) {
+ LOG.info("Merged successfully");
+ refresh(repository);
+ markSuccessful(repository);
+ if (alreadyUpToDateDetector.hasHappened()) {
+ alreadyUpToDateRepositories += 1;
+ }
}
- }
- else if (unmergedFiles.hasHappened()) {
- LOG.info("Unmerged files error!");
- fatalUnmergedFilesError();
- fatalErrorHappened = true;
- }
- else if (localChangesDetector.wasMessageDetected()) {
- LOG.info("Local changes would be overwritten by merge!");
- boolean smartMergeSucceeded = proposeSmartMergePerformAndNotify(repository, localChangesDetector);
- if (!smartMergeSucceeded) {
+ else if (unmergedFiles.hasHappened()) {
+ LOG.info("Unmerged files error!");
+ fatalUnmergedFilesError();
+ fatalErrorHappened = true;
+ }
+ else if (localChangesDetector.wasMessageDetected()) {
+ LOG.info("Local changes would be overwritten by merge!");
+ boolean smartMergeSucceeded = proposeSmartMergePerformAndNotify(repository, localChangesDetector);
+ if (!smartMergeSucceeded) {
+ fatalErrorHappened = true;
+ }
+ }
+ else if (mergeConflict.hasHappened()) {
+ LOG.info("Merge conflict");
+ myConflictedRepositories.put(repository, Boolean.FALSE);
+ refresh(repository);
+ markSuccessful(repository);
+ }
+ else if (untrackedOverwrittenByMerge.wasMessageDetected()) {
+ LOG.info("Untracked files would be overwritten by merge!");
+ fatalUntrackedFilesError(repository.getRoot(), untrackedOverwrittenByMerge.getRelativeFilePaths());
+ fatalErrorHappened = true;
+ }
+ else {
+ LOG.info("Unknown error. " + result);
+ fatalError(getCommonErrorTitle(), result.getErrorOutputAsJoinedString());
fatalErrorHappened = true;
}
}
- else if (mergeConflict.hasHappened()) {
- LOG.info("Merge conflict");
- myConflictedRepositories.put(repository, Boolean.FALSE);
- refresh(repository);
- markSuccessful(repository);
- }
- else if (untrackedOverwrittenByMerge.wasMessageDetected()) {
- LOG.info("Untracked files would be overwritten by merge!");
- fatalUntrackedFilesError(repository.getRoot(), untrackedOverwrittenByMerge.getRelativeFilePaths());
- fatalErrorHappened = true;
+
+ if (fatalErrorHappened) {
+ notifyAboutRemainingConflicts();
}
else {
- LOG.info("Unknown error. " + result);
- fatalError(getCommonErrorTitle(), result.getErrorOutputAsJoinedString());
- fatalErrorHappened = true;
+ boolean allConflictsResolved = resolveConflicts();
+ if (allConflictsResolved) {
+ if (alreadyUpToDateRepositories < getRepositories().size()) {
+ notifySuccess();
+ }
+ else {
+ notifySuccess("Already up-to-date");
+ }
+ }
}
- }
- if (fatalErrorHappened) {
- notifyAboutRemainingConflicts();
+ restoreLocalChanges();
}
- else {
- boolean allConflictsResolved = resolveConflicts();
- if (allConflictsResolved) {
- if (alreadyUpToDateRepositories < getRepositories().size()) {
- notifySuccess();
- }
- else {
- notifySuccess("Already up-to-date");
- }
- }
+ finally {
+ GitUtil.workingTreeChangeFinished(myProject);
}
-
- restoreLocalChanges();
}
private void notifyAboutRemainingConflicts() {
diff --git a/plugins/git4idea/src/git4idea/checkin/GitCheckinEnvironment.java b/plugins/git4idea/src/git4idea/checkin/GitCheckinEnvironment.java
index 2eb0219485b6..3bb008a2f95f 100644
--- a/plugins/git4idea/src/git4idea/checkin/GitCheckinEnvironment.java
+++ b/plugins/git4idea/src/git4idea/checkin/GitCheckinEnvironment.java
@@ -601,8 +601,8 @@ public class GitCheckinEnvironment implements CheckinEnvironment {
c.gridy = 0;
c.weightx = 1;
c.fill = GridBagConstraints.HORIZONTAL;
- final List<String> usersList = getUsersList(project);
- final Set<String> authors = new HashSet<String>(usersList);
+
+ Set<String> authors = new HashSet<String>(getUsersList(project));
ContainerUtil.addAll(authors, mySettings.getCommitAuthors());
List<String> list = new ArrayList<String>(authors);
Collections.sort(list);
diff --git a/plugins/git4idea/src/git4idea/checkout/GitCloneDialog.java b/plugins/git4idea/src/git4idea/checkout/GitCloneDialog.java
index 831f833e0db5..40865a0b3f13 100644
--- a/plugins/git4idea/src/git4idea/checkout/GitCloneDialog.java
+++ b/plugins/git4idea/src/git4idea/checkout/GitCloneDialog.java
@@ -21,37 +21,25 @@ import com.intellij.dvcs.ui.DvcsBundle;
import com.intellij.openapi.project.Project;
import git4idea.GitUtil;
import git4idea.GitVcs;
-import git4idea.commands.GitCommand;
-import git4idea.commands.GitLineHandlerPasswordRequestAware;
-import git4idea.commands.GitTask;
-import git4idea.commands.GitTaskResult;
+import git4idea.commands.*;
import git4idea.remote.GitRememberedInputs;
import org.jetbrains.annotations.NotNull;
import java.io.File;
-/**
- * @author Nadya Zabrodina
- */
public class GitCloneDialog extends CloneDvcsDialog {
public GitCloneDialog(@NotNull Project project) {
super(project, GitVcs.NAME, GitUtil.DOT_GIT);
}
- /*
- * We have a hack here: if http response asked for a password, then the url is at least valid and existent, and we consider
- * that the test passed.
- */
protected boolean test(@NotNull String url) {
- final GitLineHandlerPasswordRequestAware handler =
- new GitLineHandlerPasswordRequestAware(myProject, new File("."), GitCommand.LS_REMOTE);
+ final GitLineHandler handler = new GitLineHandler(myProject, new File("."), GitCommand.LS_REMOTE);
handler.setUrl(url);
handler.addParameters(url, "master");
GitTask task = new GitTask(myProject, handler, DvcsBundle.message("clone.testing", url));
GitTaskResult result = task.executeModal();
- boolean authFailed = handler.hadAuthRequest();
- return result.isOK() || authFailed;
+ return result.isOK();
}
@NotNull
diff --git a/plugins/git4idea/src/git4idea/cherrypick/GitCherryPicker.java b/plugins/git4idea/src/git4idea/cherrypick/GitCherryPicker.java
index bd8635db89be..033b1fd106fc 100644
--- a/plugins/git4idea/src/git4idea/cherrypick/GitCherryPicker.java
+++ b/plugins/git4idea/src/git4idea/cherrypick/GitCherryPicker.java
@@ -33,6 +33,7 @@ import com.intellij.util.Function;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.vcs.log.VcsFullCommitDetails;
import git4idea.GitPlatformFacade;
+import git4idea.GitUtil;
import git4idea.commands.Git;
import git4idea.commands.GitCommandResult;
import git4idea.commands.GitSimpleEventDetector;
@@ -80,15 +81,21 @@ public class GitCherryPicker {
public void cherryPick(@NotNull Map<GitRepository, List<VcsFullCommitDetails>> commitsInRoots) {
List<GitCommitWrapper> successfulCommits = new ArrayList<GitCommitWrapper>();
- for (Map.Entry<GitRepository, List<VcsFullCommitDetails>> entry : commitsInRoots.entrySet()) {
- GitRepository repository = entry.getKey();
- boolean result = cherryPick(repository, entry.getValue(), successfulCommits);
- repository.update();
- if (!result) {
- return;
+ GitUtil.workingTreeChangeStarted(myProject);
+ try {
+ for (Map.Entry<GitRepository, List<VcsFullCommitDetails>> entry : commitsInRoots.entrySet()) {
+ GitRepository repository = entry.getKey();
+ boolean result = cherryPick(repository, entry.getValue(), successfulCommits);
+ repository.update();
+ if (!result) {
+ return;
+ }
}
+ notifySuccess(successfulCommits);
+ }
+ finally {
+ GitUtil.workingTreeChangeFinished(myProject);
}
- notifySuccess(successfulCommits);
}
// return true to continue with other roots, false to break execution
diff --git a/plugins/git4idea/src/git4idea/commands/GitHttpGuiAuthenticator.java b/plugins/git4idea/src/git4idea/commands/GitHttpGuiAuthenticator.java
index 5b3a2422254f..e0312e5471fc 100644
--- a/plugins/git4idea/src/git4idea/commands/GitHttpGuiAuthenticator.java
+++ b/plugins/git4idea/src/git4idea/commands/GitHttpGuiAuthenticator.java
@@ -87,7 +87,7 @@ class GitHttpGuiAuthenticator implements GitHttpAuthenticator {
return "";
}
url = adjustUrl(url);
- Pair<GitHttpAuthDataProvider, AuthData> authData = findBestAuthData(url);
+ Pair<GitHttpAuthDataProvider, AuthData> authData = findBestAuthData(url, myModalityState);
if (authData != null && authData.second.getPassword() != null) {
String password = authData.second.getPassword();
myDataProvider = authData.first;
@@ -114,7 +114,7 @@ class GitHttpGuiAuthenticator implements GitHttpAuthenticator {
@NotNull
public String askUsername(@NotNull String url) {
url = adjustUrl(url);
- Pair<GitHttpAuthDataProvider, AuthData> authData = findBestAuthData(url);
+ Pair<GitHttpAuthDataProvider, AuthData> authData = findBestAuthData(url, myModalityState);
String login = null;
String password = null;
if (authData != null) {
@@ -223,10 +223,10 @@ class GitHttpGuiAuthenticator implements GitHttpAuthenticator {
// return the first that knows username + password; otherwise return the first that knows just the username
@Nullable
- private Pair<GitHttpAuthDataProvider, AuthData> findBestAuthData(@NotNull String url) {
+ private Pair<GitHttpAuthDataProvider, AuthData> findBestAuthData(@NotNull String url, @Nullable ModalityState modalityState) {
Pair<GitHttpAuthDataProvider, AuthData> candidate = null;
for (GitHttpAuthDataProvider provider : getProviders()) {
- AuthData data = provider.getAuthData(url);
+ AuthData data = provider.getAuthData(url, modalityState);
if (data != null) {
Pair<GitHttpAuthDataProvider, AuthData> pair = Pair.create(provider, data);
if (data.getPassword() != null) {
@@ -268,12 +268,12 @@ class GitHttpGuiAuthenticator implements GitHttpAuthenticator {
@Nullable
@Override
- public AuthData getAuthData(@NotNull String url) {
+ public AuthData getAuthData(@NotNull String url, @Nullable ModalityState modalityState) {
String userName = getUsername(url);
String key = makeKey(url, userName);
final PasswordSafe passwordSafe = PasswordSafe.getInstance();
try {
- String password = passwordSafe.getPassword(myProject, PASS_REQUESTER, key);
+ String password = passwordSafe.getPassword(myProject, PASS_REQUESTER, key, modalityState);
return new AuthData(StringUtil.notNullize(userName), password);
}
catch (PasswordSafeException e) {
diff --git a/plugins/git4idea/src/git4idea/commands/GitImpl.java b/plugins/git4idea/src/git4idea/commands/GitImpl.java
index 3e14a6414704..c873e71ff94b 100644
--- a/plugins/git4idea/src/git4idea/commands/GitImpl.java
+++ b/plugins/git4idea/src/git4idea/commands/GitImpl.java
@@ -138,7 +138,7 @@ public class GitImpl implements Git {
return run(new Computable<GitLineHandler>() {
@Override
public GitLineHandler compute() {
- GitLineHandlerPasswordRequestAware handler = new GitLineHandlerPasswordRequestAware(project, parentDirectory, GitCommand.CLONE);
+ GitLineHandler handler = new GitLineHandler(project, parentDirectory, GitCommand.CLONE);
handler.setStdoutSuppressed(false);
handler.setUrl(url);
handler.addParameters("--progress");
@@ -376,8 +376,7 @@ public class GitImpl implements Git {
return runCommand(new Computable<GitLineHandler>() {
@Override
public GitLineHandler compute() {
- final GitLineHandlerPasswordRequestAware h = new GitLineHandlerPasswordRequestAware(repository.getProject(), repository.getRoot(),
- GitCommand.PUSH);
+ final GitLineHandler h = new GitLineHandler(repository.getProject(), repository.getRoot(), GitCommand.PUSH);
h.setUrl(url);
h.setSilent(false);
h.setStdoutSuppressed(false);
@@ -454,8 +453,7 @@ public class GitImpl implements Git {
return runCommand(new Computable<GitLineHandler>() {
@Override
public GitLineHandler compute() {
- final GitLineHandlerPasswordRequestAware h = new GitLineHandlerPasswordRequestAware(repository.getProject(), repository.getRoot(),
- GitCommand.FETCH);
+ final GitLineHandler h = new GitLineHandler(repository.getProject(), repository.getRoot(), GitCommand.FETCH);
h.setUrl(url);
h.addParameters(remote);
h.addParameters(params);
@@ -520,13 +518,7 @@ public class GitImpl implements Git {
});
handler.runInCurrentThread(null);
-
authFailed = handler.hasHttpAuthFailed();
-
- if (handler instanceof GitLineHandlerPasswordRequestAware && ((GitLineHandlerPasswordRequestAware)handler).hadAuthRequest()) {
- errorOutput.add("Authentication failed");
- }
-
success = !startFailed.get() && errorOutput.isEmpty() && (handler.isIgnoredErrorCode(exitCode.get()) || exitCode.get() == 0);
}
while (authFailed && authAttempt++ < 2);
diff --git a/plugins/git4idea/src/git4idea/commands/GitLineHandlerPasswordRequestAware.java b/plugins/git4idea/src/git4idea/commands/GitLineHandlerPasswordRequestAware.java
deleted file mode 100644
index b117b2092946..000000000000
--- a/plugins/git4idea/src/git4idea/commands/GitLineHandlerPasswordRequestAware.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright 2000-2011 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 git4idea.commands;
-
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.util.Key;
-import com.intellij.openapi.vfs.VirtualFile;
-import org.jetbrains.annotations.NotNull;
-
-import java.io.File;
-
-/**
- * {@link GitLineHandler} that listens to Git output and kills itself if "username" or "password" is queried throughout the prompt.
- * We can't pass the data to the prompt anyway, so better to kill the process and show an error message, than to hang the task.
- *
- * @author Kirill Likhodedov
- */
-public class GitLineHandlerPasswordRequestAware extends GitLineHandler {
-
- private boolean myAuthRequest;
-
- public GitLineHandlerPasswordRequestAware(@NotNull Project project, @NotNull VirtualFile vcsRoot, @NotNull GitCommand command) {
- super(project, vcsRoot, command);
- }
-
- public GitLineHandlerPasswordRequestAware(@NotNull Project project, @NotNull File directory, @NotNull GitCommand clone) {
- super(project, directory, clone);
- }
-
- @Override
- protected void onTextAvailable(String text, Key outputType) {
- super.onTextAvailable(text, outputType);
- if (text.toLowerCase().startsWith("password") || text.toLowerCase().startsWith("username")) {
- myAuthRequest = true;
- destroyProcess();
- }
- }
-
- public boolean hadAuthRequest() {
- return myAuthRequest;
- }
-}
diff --git a/plugins/git4idea/src/git4idea/log/GitRefManager.java b/plugins/git4idea/src/git4idea/log/GitRefManager.java
index 5b60076f68e7..eb9e79c69767 100644
--- a/plugins/git4idea/src/git4idea/log/GitRefManager.java
+++ b/plugins/git4idea/src/git4idea/log/GitRefManager.java
@@ -69,23 +69,31 @@ public class GitRefManager implements VcsLogRefManager {
return typeComparison;
}
+
//noinspection UnnecessaryLocalVariable
VcsRefType type = type1; // common type
+
+ String name1 = ref1.getName();
+ String name2 = ref2.getName();
+ if (name1.equals(name2)) {
+ return 0;
+ }
+
if (type == LOCAL_BRANCH) {
- if (ref1.getName().equals(MASTER)) {
+ if (name1.equals(MASTER)) {
return -1;
}
- if (ref2.getName().equals(MASTER)) {
+ if (name2.equals(MASTER)) {
return 1;
}
- return ref1.getName().compareTo(ref2.getName());
+ return name1.compareTo(name2);
}
if (type == REMOTE_BRANCH) {
- if (ref1.getName().equals(ORIGIN_MASTER)) {
+ if (name1.equals(ORIGIN_MASTER)) {
return -1;
}
- if (ref2.getName().equals(ORIGIN_MASTER)) {
+ if (name2.equals(ORIGIN_MASTER)) {
return 1;
}
if (hasTrackingBranch(ref1) && !hasTrackingBranch(ref2)) {
@@ -94,10 +102,10 @@ public class GitRefManager implements VcsLogRefManager {
if (!hasTrackingBranch(ref1) && hasTrackingBranch(ref2)) {
return 1;
}
- return ref1.getName().compareTo(ref2.getName());
+ return name1.compareTo(name2);
}
- return ref1.getName().compareTo(ref2.getName());
+ return name1.compareTo(name2);
}
};
@@ -121,10 +129,8 @@ public class GitRefManager implements VcsLogRefManager {
@NotNull
@Override
- public List<VcsRef> sort(Collection<VcsRef> refs) {
- ArrayList<VcsRef> list = new ArrayList<VcsRef>(refs);
- Collections.sort(list, REF_COMPARATOR);
- return list;
+ public Comparator<VcsRef> getComparator() {
+ return REF_COMPARATOR;
}
@NotNull
@@ -314,7 +320,7 @@ public class GitRefManager implements VcsLogRefManager {
@NotNull
@Override
public List<VcsRef> getRefs() {
- return sort(myBranches);
+ return ContainerUtil.sorted(myBranches, getComparator());
}
@NotNull
diff --git a/plugins/git4idea/src/git4idea/rebase/GitRebaser.java b/plugins/git4idea/src/git4idea/rebase/GitRebaser.java
index a85a328fc114..aabf913fbf61 100644
--- a/plugins/git4idea/src/git4idea/rebase/GitRebaser.java
+++ b/plugins/git4idea/src/git4idea/rebase/GitRebaser.java
@@ -63,10 +63,6 @@ public class GitRebaser {
mySkippedCommits = new ArrayList<GitRebaseUtils.CommitInfo>();
}
- public void setProgressIndicator(@Nullable ProgressIndicator progressIndicator) {
- myProgressIndicator = progressIndicator;
- }
-
public GitUpdateResult rebase(@NotNull VirtualFile root,
@NotNull List<String> parameters,
@Nullable final Runnable onCancel,
@@ -89,28 +85,34 @@ public class GitRebaser {
rebaseTask.setProgressAnalyzer(new GitStandardProgressAnalyzer());
final AtomicReference<GitUpdateResult> updateResult = new AtomicReference<GitUpdateResult>();
final AtomicBoolean failure = new AtomicBoolean();
- rebaseTask.executeInBackground(true, new GitTaskResultHandlerAdapter() {
- @Override
- protected void onSuccess() {
- updateResult.set(GitUpdateResult.SUCCESS);
- }
+ try {
+ GitUtil.workingTreeChangeStarted(myProject);
+ rebaseTask.executeInBackground(true, new GitTaskResultHandlerAdapter() {
+ @Override
+ protected void onSuccess() {
+ updateResult.set(GitUpdateResult.SUCCESS);
+ }
- @Override
- protected void onCancel() {
- if (onCancel != null) {
- onCancel.run();
+ @Override
+ protected void onCancel() {
+ if (onCancel != null) {
+ onCancel.run();
+ }
+ updateResult.set(GitUpdateResult.CANCEL);
}
- updateResult.set(GitUpdateResult.CANCEL);
- }
- @Override
- protected void onFailure() {
- failure.set(true);
- }
- });
+ @Override
+ protected void onFailure() {
+ failure.set(true);
+ }
+ });
- if (failure.get()) {
- updateResult.set(handleRebaseFailure(root, rebaseHandler, rebaseConflictDetector, untrackedFilesDetector));
+ if (failure.get()) {
+ updateResult.set(handleRebaseFailure(rebaseHandler, root, rebaseConflictDetector, untrackedFilesDetector));
+ }
+ }
+ finally {
+ GitUtil.workingTreeChangeFinished(myProject);
}
return updateResult.get();
}
@@ -119,26 +121,6 @@ public class GitRebaser {
return new GitLineHandler(myProject, root, GitCommand.REBASE);
}
- public GitUpdateResult handleRebaseFailure(VirtualFile root, GitLineHandler pullHandler,
- GitRebaseProblemDetector rebaseConflictDetector,
- GitMessageWithFilesDetector untrackedWouldBeOverwrittenDetector) {
- if (rebaseConflictDetector.isMergeConflict()) {
- LOG.info("handleRebaseFailure merge conflict");
- final boolean allMerged = new MyConflictResolver(myProject, myGit, root, this).merge();
- return allMerged ? GitUpdateResult.SUCCESS_WITH_RESOLVED_CONFLICTS : GitUpdateResult.INCOMPLETE;
- } else if (untrackedWouldBeOverwrittenDetector.wasMessageDetected()) {
- LOG.info("handleRebaseFailure: untracked files would be overwritten by checkout");
- UntrackedFilesNotifier.notifyUntrackedFilesOverwrittenBy(myProject, root,
- untrackedWouldBeOverwrittenDetector.getRelativeFilePaths(), "rebase", null);
- return GitUpdateResult.ERROR;
- } else {
- LOG.info("handleRebaseFailure error " + pullHandler.errors());
- GitUIUtil.notifyImportantError(myProject, "Rebase error", GitUIUtil.stringifyErrors(pullHandler.errors()));
- return GitUpdateResult.ERROR;
- }
- }
-
-
public void abortRebase(@NotNull VirtualFile root) {
LOG.info("abortRebase " + root);
final GitLineHandler rh = new GitLineHandler(myProject, root, GitCommand.REBASE);
@@ -158,11 +140,17 @@ public class GitRebaser {
* @return true if rebase successfully finished.
*/
public boolean continueRebase(@NotNull Collection<VirtualFile> rebasingRoots) {
- boolean success = true;
- for (VirtualFile root : rebasingRoots) {
- success &= continueRebase(root);
+ GitUtil.workingTreeChangeStarted(myProject);
+ try {
+ boolean success = true;
+ for (VirtualFile root : rebasingRoots) {
+ success &= continueRebase(root);
+ }
+ return success;
+ }
+ finally {
+ GitUtil.workingTreeChangeFinished(myProject);
}
- return success;
}
// start operation may be "--continue" or "--skip" depending on the situation.
@@ -330,34 +318,6 @@ public class GitRebaser {
"You also may <b>abort rebase</b> to restore the original branch and stop rebasing.");
}
- private static class MyConflictResolver extends GitConflictResolver {
- private final GitRebaser myRebaser;
- private final VirtualFile myRoot;
-
- public MyConflictResolver(Project project, @NotNull Git git, VirtualFile root, GitRebaser rebaser) {
- super(project, git, ServiceManager.getService(GitPlatformFacade.class), Collections.singleton(root), makeParams());
- myRebaser = rebaser;
- myRoot = root;
- }
-
- private static Params makeParams() {
- Params params = new Params();
- params.setReverse(true);
- params.setMergeDescription("Merge conflicts detected. Resolve them before continuing rebase.");
- params.setErrorNotificationTitle("Can't continue rebase");
- params.setErrorNotificationAdditionalDescription("Then you may <b>continue rebase</b>. <br/> You also may <b>abort rebase</b> to restore the original branch and stop rebasing.");
- return params;
- }
-
- @Override protected boolean proceedIfNothingToMerge() throws VcsException {
- return myRebaser.continueRebase(myRoot);
- }
-
- @Override protected boolean proceedAfterAllMerged() throws VcsException {
- return myRebaser.continueRebase(myRoot);
- }
- }
-
public static class TrivialEditor extends GitInteractiveRebaseEditorHandler{
public TrivialEditor(@NotNull GitRebaseEditorService service,
@NotNull Project project,
diff --git a/plugins/git4idea/src/git4idea/remote/GitHttpAuthDataProvider.java b/plugins/git4idea/src/git4idea/remote/GitHttpAuthDataProvider.java
index 6c0860ccf20a..281d69b772c3 100644
--- a/plugins/git4idea/src/git4idea/remote/GitHttpAuthDataProvider.java
+++ b/plugins/git4idea/src/git4idea/remote/GitHttpAuthDataProvider.java
@@ -15,6 +15,7 @@
*/
package git4idea.remote;
+import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.util.AuthData;
import org.jetbrains.annotations.NotNull;
@@ -31,7 +32,7 @@ public interface GitHttpAuthDataProvider {
ExtensionPointName<GitHttpAuthDataProvider> EP_NAME = ExtensionPointName.create("Git4Idea.GitHttpAuthDataProvider");
@Nullable
- AuthData getAuthData(@NotNull String url);
+ AuthData getAuthData(@NotNull String url, @Nullable ModalityState modalityState);
void forgetPassword(@NotNull String url);
diff --git a/plugins/git4idea/src/git4idea/repo/GitRepositoryReader.java b/plugins/git4idea/src/git4idea/repo/GitRepositoryReader.java
index 5109d0600b69..576f326a8ea3 100644
--- a/plugins/git4idea/src/git4idea/repo/GitRepositoryReader.java
+++ b/plugins/git4idea/src/git4idea/repo/GitRepositoryReader.java
@@ -416,7 +416,7 @@ class GitRepositoryReader {
LOG.info(".git/HEAD has not standard format: [" + headContent + "]. We've parsed branch [" + matcher.group(1) + "]");
return new Head(true, matcher.group(1));
}
- throw new RepoStateException("Invalid format of the .git/HEAD file: \n" + headContent);
+ throw new RepoStateException("Invalid format of the .git/HEAD file: [" + headContent + "]");
}
/**
diff --git a/plugins/git4idea/src/git4idea/rollback/GitRollbackEnvironment.java b/plugins/git4idea/src/git4idea/rollback/GitRollbackEnvironment.java
index 00f1830e6255..e255598e2046 100644
--- a/plugins/git4idea/src/git4idea/rollback/GitRollbackEnvironment.java
+++ b/plugins/git4idea/src/git4idea/rollback/GitRollbackEnvironment.java
@@ -141,15 +141,21 @@ public class GitRollbackEnvironment implements RollbackEnvironment {
}
}
// revert files from HEAD
- for (Map.Entry<VirtualFile, List<FilePath>> entry : toRevert.entrySet()) {
- listener.accept(entry.getValue());
- try {
- revert(entry.getKey(), entry.getValue());
- }
- catch (VcsException e) {
- exceptions.add(e);
+ GitUtil.workingTreeChangeStarted(myProject);
+ try {
+ for (Map.Entry<VirtualFile, List<FilePath>> entry : toRevert.entrySet()) {
+ listener.accept(entry.getValue());
+ try {
+ revert(entry.getKey(), entry.getValue());
+ }
+ catch (VcsException e) {
+ exceptions.add(e);
+ }
}
}
+ finally {
+ GitUtil.workingTreeChangeFinished(myProject);
+ }
LocalFileSystem lfs = LocalFileSystem.getInstance();
HashSet<File> filesToRefresh = new HashSet<File>();
for (Change c : changes) {
diff --git a/plugins/git4idea/src/git4idea/ui/GitUnstashDialog.java b/plugins/git4idea/src/git4idea/ui/GitUnstashDialog.java
index 3c8d7100c50c..9b13bb6cdb65 100644
--- a/plugins/git4idea/src/git4idea/ui/GitUnstashDialog.java
+++ b/plugins/git4idea/src/git4idea/ui/GitUnstashDialog.java
@@ -413,25 +413,31 @@ public class GitUnstashDialog extends DialogWrapper {
GitUntrackedFilesOverwrittenByOperationDetector untrackedFilesDetector = new GitUntrackedFilesOverwrittenByOperationDetector(root);
h.addLineListener(untrackedFilesDetector);
- final Ref<GitCommandResult> result = Ref.create();
- ProgressManager.getInstance().run(new Task.Modal(h.project(), GitBundle.getString("unstash.unstashing"), false) {
- public void run(@NotNull final ProgressIndicator indicator) {
- h.addLineListener(new GitHandlerUtil.GitLineHandlerListenerProgress(indicator, h, "stash", false));
- Git git = ServiceManager.getService(Git.class);
- result.set(git.runCommand(new Computable.PredefinedValueComputable<GitLineHandler>(h)));
- }
- });
+ GitUtil.workingTreeChangeStarted(myProject);
+ try {
+ final Ref<GitCommandResult> result = Ref.create();
+ ProgressManager.getInstance().run(new Task.Modal(h.project(), GitBundle.getString("unstash.unstashing"), false) {
+ public void run(@NotNull final ProgressIndicator indicator) {
+ h.addLineListener(new GitHandlerUtil.GitLineHandlerListenerProgress(indicator, h, "stash", false));
+ Git git = ServiceManager.getService(Git.class);
+ result.set(git.runCommand(new Computable.PredefinedValueComputable<GitLineHandler>(h)));
+ }
+ });
- ServiceManager.getService(myProject, GitPlatformFacade.class).hardRefresh(root);
- GitCommandResult res = result.get();
- if (conflict.get()) {
- boolean conflictsResolved = new UnstashConflictResolver(myProject, root, getSelectedStash()).merge();
- LOG.info("loadRoot " + root + ", conflictsResolved: " + conflictsResolved);
- } else if (untrackedFilesDetector.wasMessageDetected()) {
- UntrackedFilesNotifier.notifyUntrackedFilesOverwrittenBy(myProject, root, untrackedFilesDetector.getRelativeFilePaths(),
- "unstash", null);
- } else if (!res.success()) {
- GitUIUtil.showOperationErrors(myProject, h.errors(), h.printableCommandLine());
+ ServiceManager.getService(myProject, GitPlatformFacade.class).hardRefresh(root);
+ GitCommandResult res = result.get();
+ if (conflict.get()) {
+ boolean conflictsResolved = new UnstashConflictResolver(myProject, root, getSelectedStash()).merge();
+ LOG.info("loadRoot " + root + ", conflictsResolved: " + conflictsResolved);
+ } else if (untrackedFilesDetector.wasMessageDetected()) {
+ UntrackedFilesNotifier.notifyUntrackedFilesOverwrittenBy(myProject, root, untrackedFilesDetector.getRelativeFilePaths(),
+ "unstash", null);
+ } else if (!res.success()) {
+ GitUIUtil.showOperationErrors(myProject, h.errors(), h.printableCommandLine());
+ }
+ }
+ finally {
+ GitUtil.workingTreeChangeFinished(myProject);
}
super.doOKAction();
}
diff --git a/plugins/git4idea/src/git4idea/update/GitUpdateProcess.java b/plugins/git4idea/src/git4idea/update/GitUpdateProcess.java
index bc13ab8f7c36..e78039ef9d71 100644
--- a/plugins/git4idea/src/git4idea/update/GitUpdateProcess.java
+++ b/plugins/git4idea/src/git4idea/update/GitUpdateProcess.java
@@ -132,7 +132,13 @@ public class GitUpdateProcess {
GitComplexProcess.Operation updateOperation = new GitComplexProcess.Operation() {
@Override public void run(ContinuationContext continuationContext) {
- myResult = updateImpl(updateMethod, continuationContext);
+ GitUtil.workingTreeChangeStarted(myProject);
+ try {
+ myResult = updateImpl(updateMethod, continuationContext);
+ }
+ finally {
+ GitUtil.workingTreeChangeFinished(myProject);
+ }
}
};
GitComplexProcess.execute(myProject, "update", updateOperation);
diff --git a/plugins/git4idea/test-stepdefs/git4idea/GitCucumberWorld.java b/plugins/git4idea/test-stepdefs/git4idea/GitCucumberWorld.java
index 9625505e779f..2db213ca1a30 100644
--- a/plugins/git4idea/test-stepdefs/git4idea/GitCucumberWorld.java
+++ b/plugins/git4idea/test-stepdefs/git4idea/GitCucumberWorld.java
@@ -65,7 +65,6 @@ import java.util.concurrent.atomic.AtomicReference;
import static com.intellij.openapi.vcs.Executor.cd;
import static com.intellij.openapi.vcs.Executor.mkdir;
-import static org.junit.Assume.assumeTrue;
/**
* <p>The container of test environment variables which should be visible from any step definition script.</p>
@@ -149,7 +148,7 @@ public class GitCucumberWorld {
AbstractVcs vcs = vcsManager.findVcsByName("Git");
Assert.assertEquals(1, vcsManager.getRootsUnderVcs(vcs).length);
- assumeSupportedGitVersion();
+ GitTestUtil.assumeSupportedGitVersion(myVcs);
LOG.info(getStartTestMarker());
}
@@ -157,10 +156,6 @@ public class GitCucumberWorld {
return "Starting " + myTestName;
}
- private static void assumeSupportedGitVersion() {
- assumeTrue(myVcs.getVersion().isSupported());
- }
-
// TODO should take actual feature name once we migrate to more recent cucumber lib
private String createTestName() {
return getClass().getName() + "-" + new Random().nextInt();
diff --git a/plugins/git4idea/tests/git4idea/log/GitLogRefSorterTest.java b/plugins/git4idea/tests/git4idea/log/GitLogRefSorterTest.java
deleted file mode 100644
index 7346852bab68..000000000000
--- a/plugins/git4idea/tests/git4idea/log/GitLogRefSorterTest.java
+++ /dev/null
@@ -1,311 +0,0 @@
-package git4idea.log;
-
-import com.intellij.mock.MockVirtualFile;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.util.Condition;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.testFramework.UsefulTestCase;
-import com.intellij.util.Function;
-import com.intellij.util.containers.ContainerUtil;
-import com.intellij.vcs.log.VcsRef;
-import com.intellij.vcs.log.VcsRefType;
-import com.intellij.vcs.log.impl.HashImpl;
-import com.intellij.vcs.log.impl.VcsRefImpl;
-import git4idea.GitLocalBranch;
-import git4idea.GitRemoteBranch;
-import git4idea.branch.GitBranchesCollection;
-import git4idea.repo.*;
-import git4idea.test.GitTestRepositoryManager;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.util.*;
-
-/**
- * @author Kirill Likhodedov
- */
-public class GitLogRefSorterTest extends UsefulTestCase {
-
- public static final MockVirtualFile MOCK_VIRTUAL_FILE = new MockVirtualFile("mockFile");
-
- public void testEmpty() {
- check(Collections.<VcsRef>emptyList(), Collections.<VcsRef>emptyList());
- }
-
- public void testSingle() {
- check(given("HEAD"),
- expect("HEAD"));
- }
-
- public void testHeadIsMoreImportantThanBranch() {
- check(given("master", "HEAD"),
- expect("HEAD", "master"));
- }
-
- public void testLocalBranchesAreComparedAsStrings() {
- check(given("release", "feature"),
- expect("feature", "release"));
- }
-
- public void testTagIsTheLessImportant() {
- check(given("tag/v1", "origin/master"),
- expect("origin/master", "tag/v1"));
- }
-
- public void testMasterIsMoreImportant() {
- check(given("feature", "master"),
- expect("master", "feature"));
- }
-
- public void testOriginMasterIsMoreImportant() {
- check(given("origin/master", "origin/aaa"),
- expect("origin/master", "origin/aaa"));
- }
-
- public void testRemoteBranchHavingTrackingBranchIsMoreImportant() {
- check(given("feature", "origin/aaa", "origin/feature"),
- expect("feature", "origin/feature", "origin/aaa"));
- }
-
- public void testSeveral1() {
- check(given("tag/v1", "feature", "HEAD", "master"),
- expect("HEAD", "master", "feature", "tag/v1"));
- }
-
- public void testSeveral2() {
- check(given("origin/master", "origin/great_feature", "tag/v1", "release", "HEAD", "master"),
- expect("HEAD", "master", "release", "origin/master", "origin/great_feature", "tag/v1"));
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
-
- }
-
- private static Collection<VcsRef> given(String... refs) {
- return convertToRefs(refs);
- }
-
- private static List<VcsRef> expect(String... refs) {
- return new ArrayList<VcsRef>(convertToRefs(refs));
- }
-
- private static List<VcsRef> convertToRefs(String[] refs) {
- return ContainerUtil.map(refs, new Function<String, VcsRef>() {
- @Override
- public VcsRef fun(String name) {
- return ref(name);
- }
- });
- }
-
- private static VcsRef ref(String name) {
- String randomHash = randomHash();
- if (isHead(name)) {
- return ref(randomHash, name, GitRefManager.HEAD);
- }
- if (isRemoteBranch(name)) {
- return ref(randomHash, name, GitRefManager.REMOTE_BRANCH);
- }
- if (isTag(name)) {
- return ref(randomHash, name, GitRefManager.TAG);
- }
- return ref(randomHash, name, GitRefManager.LOCAL_BRANCH);
- }
-
- private static String randomHash() {
- return String.valueOf(new Random().nextInt());
- }
-
- private static boolean isHead(String name) {
- return name.equals("HEAD");
- }
-
- private static boolean isTag(String name) {
- return name.startsWith("tag/");
- }
-
- private static boolean isRemoteBranch(String name) {
- return name.startsWith("origin/");
- }
-
- private static boolean isLocalBranch(String name) {
- return !isHead(name) && !isTag(name) && !isRemoteBranch(name);
- }
-
- private static VcsRef ref(String hash, String name, VcsRefType type) {
- return new VcsRefImpl(HashImpl.build(hash), name, type, MOCK_VIRTUAL_FILE);
- }
-
- private static void check(Collection<VcsRef> unsorted, List<VcsRef> expected) {
- // for the sake of simplicity we check only names of references
- List<VcsRef> actual = sort(unsorted);
- assertEquals("Collections size don't match", expected.size(), actual.size());
- for (int i = 0; i < actual.size(); i++) {
- assertEquals("Incorrect element at place " + i, expected.get(i).getName(), actual.get(i).getName());
- }
- }
-
- private static List<VcsRef> sort(final Collection<VcsRef> refs) {
- final GitTestRepositoryManager manager = new GitTestRepositoryManager();
- manager.add(new MockGitRepository() {
- @NotNull
- @Override
- public Collection<GitBranchTrackInfo> getBranchTrackInfos() {
- List<GitBranchTrackInfo> infos = new ArrayList<GitBranchTrackInfo>();
- List<VcsRef> remoteRefs = ContainerUtil.findAll(refs, new Condition<VcsRef>() {
- @Override
- public boolean value(VcsRef ref) {
- return isRemoteBranch(ref.getName());
- }
- });
- List<VcsRef> localRefs = ContainerUtil.findAll(refs, new Condition<VcsRef>() {
- @Override
- public boolean value(VcsRef ref) {
- return isLocalBranch(ref.getName());
- }
- });
-
- for (final VcsRef localRef : localRefs) {
- final VcsRef trackedRef = ContainerUtil.find(remoteRefs, new Condition<VcsRef>() {
- @Override
- public boolean value(VcsRef remoteRef) {
- return localRef.getName().equals(remoteRef.getName().substring("origin/".length()));
- }
- });
- if (trackedRef != null) {
- infos.add(new GitBranchTrackInfo(new GitLocalBranch(localRef.getName(), HashImpl.build(randomHash())),
- new GitRemoteBranch(trackedRef.getName(), HashImpl.build(randomHash())) {
- @NotNull
- @Override
- public String getNameForRemoteOperations() {
- return trackedRef.getName().substring("origin/".length());
- }
-
- @NotNull
- @Override
- public String getNameForLocalOperations() {
- return trackedRef.getName();
- }
-
- @NotNull
- @Override
- public GitRemote getRemote() {
- return GitRemote.DOT;
- }
-
- @Override
- public boolean isRemote() {
- return true;
- }
- }, true));
- }
- }
- return infos;
- }
- });
- return new GitRefManager(manager).sort(refs);
- }
-
- // TODO either use the real GitRepository, or move upwards and make more generic implementation
- private static class MockGitRepository implements GitRepository {
- @NotNull
- @Override
- public VirtualFile getGitDir() {
- throw new UnsupportedOperationException();
- }
-
- @NotNull
- @Override
- public GitUntrackedFilesHolder getUntrackedFilesHolder() {
- throw new UnsupportedOperationException();
- }
-
- @NotNull
- @Override
- public GitRepoInfo getInfo() {
- throw new UnsupportedOperationException();
- }
-
- @Nullable
- @Override
- public GitLocalBranch getCurrentBranch() {
- throw new UnsupportedOperationException();
- }
-
- @NotNull
- @Override
- public GitBranchesCollection getBranches() {
- throw new UnsupportedOperationException();
- }
-
- @NotNull
- @Override
- public Collection<GitRemote> getRemotes() {
- throw new UnsupportedOperationException();
- }
-
- @NotNull
- @Override
- public Collection<GitBranchTrackInfo> getBranchTrackInfos() {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public boolean isRebaseInProgress() {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public boolean isOnBranch() {
- throw new UnsupportedOperationException();
- }
-
- @NotNull
- @Override
- public VirtualFile getRoot() {
- return MOCK_VIRTUAL_FILE;
- }
-
- @NotNull
- @Override
- public String getPresentableUrl() {
- throw new UnsupportedOperationException();
- }
-
- @NotNull
- @Override
- public Project getProject() {
- throw new UnsupportedOperationException();
- }
-
- @NotNull
- @Override
- public State getState() {
- throw new UnsupportedOperationException();
- }
-
- @Nullable
- @Override
- public String getCurrentRevision() {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public boolean isFresh() {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void update() {
- throw new UnsupportedOperationException();
- }
-
- @NotNull
- @Override
- public String toLogString() {
- throw new UnsupportedOperationException();
- }
- }
-}
diff --git a/plugins/git4idea/tests/git4idea/log/GitRefManagerTest.java b/plugins/git4idea/tests/git4idea/log/GitRefManagerTest.java
new file mode 100644
index 000000000000..707e97265267
--- /dev/null
+++ b/plugins/git4idea/tests/git4idea/log/GitRefManagerTest.java
@@ -0,0 +1,308 @@
+package git4idea.log;
+
+import com.intellij.mock.MockVirtualFile;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.Condition;
+import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.testFramework.UsefulTestCase;
+import com.intellij.util.Function;
+import com.intellij.util.containers.ContainerUtil;
+import com.intellij.vcs.log.VcsRef;
+import com.intellij.vcs.log.VcsRefType;
+import com.intellij.vcs.log.impl.HashImpl;
+import com.intellij.vcs.log.impl.VcsRefImpl;
+import git4idea.GitLocalBranch;
+import git4idea.GitRemoteBranch;
+import git4idea.branch.GitBranchesCollection;
+import git4idea.repo.*;
+import git4idea.test.GitTestRepositoryManager;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.*;
+
+public class GitRefManagerTest extends UsefulTestCase {
+
+ public static final MockVirtualFile MOCK_VIRTUAL_FILE = new MockVirtualFile("mockFile");
+
+ public void testEmpty() {
+ check(Collections.<VcsRef>emptyList(), Collections.<VcsRef>emptyList());
+ }
+
+ public void testSingle() {
+ check(given("HEAD"),
+ expect("HEAD"));
+ }
+
+ public void testHeadIsMoreImportantThanBranch() {
+ check(given("master", "HEAD"),
+ expect("HEAD", "master"));
+ }
+
+ public void testLocalBranchesAreComparedAsStrings() {
+ check(given("release", "feature"),
+ expect("feature", "release"));
+ }
+
+ public void testTagIsTheLessImportant() {
+ check(given("tag/v1", "origin/master"),
+ expect("origin/master", "tag/v1"));
+ }
+
+ public void testMasterIsMoreImportant() {
+ check(given("feature", "master"),
+ expect("master", "feature"));
+ }
+
+ public void testOriginMasterIsMoreImportant() {
+ check(given("origin/master", "origin/aaa"),
+ expect("origin/master", "origin/aaa"));
+ }
+
+ public void testRemoteBranchHavingTrackingBranchIsMoreImportant() {
+ check(given("feature", "origin/aaa", "origin/feature"),
+ expect("feature", "origin/feature", "origin/aaa"));
+ }
+
+ public void testSeveral1() {
+ check(given("tag/v1", "feature", "HEAD", "master"),
+ expect("HEAD", "master", "feature", "tag/v1"));
+ }
+
+ public void testSeveral2() {
+ check(given("origin/master", "origin/great_feature", "tag/v1", "release", "HEAD", "master"),
+ expect("HEAD", "master", "release", "origin/master", "origin/great_feature", "tag/v1"));
+ }
+
+ // may happen e.g. in multi-repo case
+ public void testTwoMasters() {
+ check(given("master", "master"),
+ expect("master", "master"));
+ }
+
+ private static Collection<VcsRef> given(String... refs) {
+ return convertToRefs(refs);
+ }
+
+ private static List<VcsRef> expect(String... refs) {
+ return new ArrayList<VcsRef>(convertToRefs(refs));
+ }
+
+ private static List<VcsRef> convertToRefs(String[] refs) {
+ return ContainerUtil.map(refs, new Function<String, VcsRef>() {
+ @Override
+ public VcsRef fun(String name) {
+ return ref(name);
+ }
+ });
+ }
+
+ private static VcsRef ref(String name) {
+ String randomHash = randomHash();
+ if (isHead(name)) {
+ return ref(randomHash, name, GitRefManager.HEAD);
+ }
+ if (isRemoteBranch(name)) {
+ return ref(randomHash, name, GitRefManager.REMOTE_BRANCH);
+ }
+ if (isTag(name)) {
+ return ref(randomHash, name, GitRefManager.TAG);
+ }
+ return ref(randomHash, name, GitRefManager.LOCAL_BRANCH);
+ }
+
+ private static String randomHash() {
+ return String.valueOf(new Random().nextInt());
+ }
+
+ private static boolean isHead(String name) {
+ return name.equals("HEAD");
+ }
+
+ private static boolean isTag(String name) {
+ return name.startsWith("tag/");
+ }
+
+ private static boolean isRemoteBranch(String name) {
+ return name.startsWith("origin/");
+ }
+
+ private static boolean isLocalBranch(String name) {
+ return !isHead(name) && !isTag(name) && !isRemoteBranch(name);
+ }
+
+ private static VcsRef ref(String hash, String name, VcsRefType type) {
+ return new VcsRefImpl(HashImpl.build(hash), name, type, MOCK_VIRTUAL_FILE);
+ }
+
+ private static void check(Collection<VcsRef> unsorted, List<VcsRef> expected) {
+ // for the sake of simplicity we check only names of references
+ List<VcsRef> actual = sort(unsorted);
+ assertEquals("Collections size don't match", expected.size(), actual.size());
+ for (int i = 0; i < actual.size(); i++) {
+ assertEquals("Incorrect element at place " + i, expected.get(i).getName(), actual.get(i).getName());
+ }
+ }
+
+ private static List<VcsRef> sort(final Collection<VcsRef> refs) {
+ final GitTestRepositoryManager manager = new GitTestRepositoryManager();
+ manager.add(new MockGitRepository() {
+ @NotNull
+ @Override
+ public Collection<GitBranchTrackInfo> getBranchTrackInfos() {
+ List<GitBranchTrackInfo> infos = new ArrayList<GitBranchTrackInfo>();
+ List<VcsRef> remoteRefs = ContainerUtil.findAll(refs, new Condition<VcsRef>() {
+ @Override
+ public boolean value(VcsRef ref) {
+ return isRemoteBranch(ref.getName());
+ }
+ });
+ List<VcsRef> localRefs = ContainerUtil.findAll(refs, new Condition<VcsRef>() {
+ @Override
+ public boolean value(VcsRef ref) {
+ return isLocalBranch(ref.getName());
+ }
+ });
+
+ for (final VcsRef localRef : localRefs) {
+ final VcsRef trackedRef = ContainerUtil.find(remoteRefs, new Condition<VcsRef>() {
+ @Override
+ public boolean value(VcsRef remoteRef) {
+ return localRef.getName().equals(remoteRef.getName().substring("origin/".length()));
+ }
+ });
+ if (trackedRef != null) {
+ infos.add(new GitBranchTrackInfo(new GitLocalBranch(localRef.getName(), HashImpl.build(randomHash())),
+ new GitRemoteBranch(trackedRef.getName(), HashImpl.build(randomHash())) {
+ @NotNull
+ @Override
+ public String getNameForRemoteOperations() {
+ return trackedRef.getName().substring("origin/".length());
+ }
+
+ @NotNull
+ @Override
+ public String getNameForLocalOperations() {
+ return trackedRef.getName();
+ }
+
+ @NotNull
+ @Override
+ public GitRemote getRemote() {
+ return GitRemote.DOT;
+ }
+
+ @Override
+ public boolean isRemote() {
+ return true;
+ }
+ }, true));
+ }
+ }
+ return infos;
+ }
+ });
+ return ContainerUtil.sorted(refs, new GitRefManager(manager).getComparator());
+ }
+
+ // TODO either use the real GitRepository, or move upwards and make more generic implementation
+ private static class MockGitRepository implements GitRepository {
+ @NotNull
+ @Override
+ public VirtualFile getGitDir() {
+ throw new UnsupportedOperationException();
+ }
+
+ @NotNull
+ @Override
+ public GitUntrackedFilesHolder getUntrackedFilesHolder() {
+ throw new UnsupportedOperationException();
+ }
+
+ @NotNull
+ @Override
+ public GitRepoInfo getInfo() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Nullable
+ @Override
+ public GitLocalBranch getCurrentBranch() {
+ throw new UnsupportedOperationException();
+ }
+
+ @NotNull
+ @Override
+ public GitBranchesCollection getBranches() {
+ throw new UnsupportedOperationException();
+ }
+
+ @NotNull
+ @Override
+ public Collection<GitRemote> getRemotes() {
+ throw new UnsupportedOperationException();
+ }
+
+ @NotNull
+ @Override
+ public Collection<GitBranchTrackInfo> getBranchTrackInfos() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public boolean isRebaseInProgress() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public boolean isOnBranch() {
+ throw new UnsupportedOperationException();
+ }
+
+ @NotNull
+ @Override
+ public VirtualFile getRoot() {
+ return MOCK_VIRTUAL_FILE;
+ }
+
+ @NotNull
+ @Override
+ public String getPresentableUrl() {
+ throw new UnsupportedOperationException();
+ }
+
+ @NotNull
+ @Override
+ public Project getProject() {
+ throw new UnsupportedOperationException();
+ }
+
+ @NotNull
+ @Override
+ public State getState() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Nullable
+ @Override
+ public String getCurrentRevision() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public boolean isFresh() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void update() {
+ throw new UnsupportedOperationException();
+ }
+
+ @NotNull
+ @Override
+ public String toLogString() {
+ throw new UnsupportedOperationException();
+ }
+ }
+}
diff --git a/plugins/git4idea/tests/git4idea/test/GitPlatformTest.java b/plugins/git4idea/tests/git4idea/test/GitPlatformTest.java
index ecef2b2cdcf5..ef3f963c9c7e 100644
--- a/plugins/git4idea/tests/git4idea/test/GitPlatformTest.java
+++ b/plugins/git4idea/tests/git4idea/test/GitPlatformTest.java
@@ -29,6 +29,7 @@ import com.intellij.testFramework.UsefulTestCase;
import com.intellij.testFramework.fixtures.IdeaProjectTestFixture;
import com.intellij.testFramework.fixtures.IdeaTestFixtureFactory;
import com.intellij.testFramework.vcs.AbstractVcsTestCase;
+import com.intellij.util.ObjectUtils;
import git4idea.DialogManager;
import git4idea.GitPlatformFacade;
import git4idea.GitUtil;
@@ -57,6 +58,7 @@ public abstract class GitPlatformTest extends UsefulTestCase {
@NotNull protected GitVcsSettings myGitSettings;
@NotNull protected GitPlatformFacade myPlatformFacade;
@NotNull protected Git myGit;
+ @NotNull protected GitVcs myVcs;
@NotNull protected TestDialogManager myDialogManager;
@NotNull protected TestVcsNotifier myVcsNotifier;
@@ -97,7 +99,10 @@ public abstract class GitPlatformTest extends UsefulTestCase {
myGitRepositoryManager = GitUtil.getRepositoryManager(myProject);
myPlatformFacade = ServiceManager.getService(myProject, GitPlatformFacade.class);
myGit = ServiceManager.getService(myProject, Git.class);
+ myVcs = ObjectUtils.assertNotNull(GitVcs.getInstance(myProject));
+ myVcs.doActivate();
+ GitTestUtil.assumeSupportedGitVersion(myVcs);
initChangeListManager();
addSilently();
removeSilently();
diff --git a/plugins/git4idea/tests/git4idea/test/GitTestUtil.java b/plugins/git4idea/tests/git4idea/test/GitTestUtil.java
index a6a8f0cd79f5..842b1b1a2bae 100644
--- a/plugins/git4idea/tests/git4idea/test/GitTestUtil.java
+++ b/plugins/git4idea/tests/git4idea/test/GitTestUtil.java
@@ -31,6 +31,7 @@ import java.io.File;
import static com.intellij.openapi.vcs.Executor.*;
import static git4idea.test.GitExecutor.git;
import static junit.framework.Assert.assertNotNull;
+import static org.junit.Assume.assumeTrue;
public class GitTestUtil {
@@ -108,4 +109,8 @@ public class GitTestUtil {
public static void setDefaultBuiltInServerPort() {
System.setProperty(BuiltInServerManagerImpl.PROPERTY_RPC_PORT, "64463");
}
+
+ public static void assumeSupportedGitVersion(@NotNull GitVcs vcs) {
+ assumeTrue(vcs.getVersion().isSupported());
+ }
}
diff --git a/plugins/github/src/org/jetbrains/plugins/github/GithubRebaseAction.java b/plugins/github/src/org/jetbrains/plugins/github/GithubRebaseAction.java
index a733674f220e..714191d06b98 100644
--- a/plugins/github/src/org/jetbrains/plugins/github/GithubRebaseAction.java
+++ b/plugins/github/src/org/jetbrains/plugins/github/GithubRebaseAction.java
@@ -43,7 +43,6 @@ import org.jetbrains.annotations.Nullable;
import org.jetbrains.plugins.github.api.GithubApiUtil;
import org.jetbrains.plugins.github.api.GithubFullPath;
import org.jetbrains.plugins.github.api.GithubRepoDetailed;
-import org.jetbrains.plugins.github.exceptions.GithubOperationCanceledException;
import org.jetbrains.plugins.github.util.*;
import java.io.IOException;
@@ -196,7 +195,7 @@ public class GithubRebaseAction extends DumbAwareAction {
}
try {
- return GithubUtil.runTask(project, GithubAuthDataHolder.createFromSettings(), indicator,
+ return GithubUtil.runTask(project, GithubAuthDataHolder.createFromSettings(indicator.getModalityState()), indicator,
new ThrowableConvertor<GithubAuthData, GithubRepoDetailed, IOException>() {
@NotNull
@Override
@@ -227,6 +226,7 @@ public class GithubRebaseAction extends DumbAwareAction {
@NotNull final ProgressIndicator indicator) {
final Git git = ServiceManager.getService(project, Git.class);
final GitPlatformFacade facade = ServiceManager.getService(project, GitPlatformFacade.class);
+ GitUtil.workingTreeChangeStarted(project);
GitPreservingProcess process =
new GitPreservingProcess(project, facade, git, Collections.singletonList(gitRepository), "Rebasing", "upstream/master", indicator,
new Runnable() {
@@ -237,6 +237,7 @@ public class GithubRebaseAction extends DumbAwareAction {
}
);
process.execute();
+ GitUtil.workingTreeChangeFinished(project);
}
private static void doRebaseCurrentBranch(@NotNull final Project project,
diff --git a/plugins/github/src/org/jetbrains/plugins/github/GithubShareAction.java b/plugins/github/src/org/jetbrains/plugins/github/GithubShareAction.java
index 9431b91f3b2f..7c18b3bf7ffc 100644
--- a/plugins/github/src/org/jetbrains/plugins/github/GithubShareAction.java
+++ b/plugins/github/src/org/jetbrains/plugins/github/GithubShareAction.java
@@ -125,7 +125,7 @@ public class GithubShareAction extends DumbAwareAction {
externalRemoteDetected = !gitRepository.getRemotes().isEmpty();
}
- final GithubAuthDataHolder authHolder = GithubAuthDataHolder.createFromSettings();
+ final GithubAuthDataHolder authHolder = GithubAuthDataHolder.createFromSettings(null);
// get available GitHub repos with modal progress
final GithubInfo githubInfo = loadGithubInfoWithModal(authHolder, project);
diff --git a/plugins/github/src/org/jetbrains/plugins/github/extensions/GithubCheckoutProvider.java b/plugins/github/src/org/jetbrains/plugins/github/extensions/GithubCheckoutProvider.java
index 6b3f73f5f8be..115258d9bee2 100644
--- a/plugins/github/src/org/jetbrains/plugins/github/extensions/GithubCheckoutProvider.java
+++ b/plugins/github/src/org/jetbrains/plugins/github/extensions/GithubCheckoutProvider.java
@@ -61,7 +61,7 @@ public class GithubCheckoutProvider implements CheckoutProvider {
@NotNull
@Override
public List<GithubRepo> convert(ProgressIndicator indicator) throws IOException {
- return GithubUtil.runTask(project, GithubAuthDataHolder.createFromSettings(), indicator,
+ return GithubUtil.runTask(project, GithubAuthDataHolder.createFromSettings(indicator.getModalityState()), indicator,
new ThrowableConvertor<GithubAuthData, List<GithubRepo>, IOException>() {
@NotNull
@Override
diff --git a/plugins/github/src/org/jetbrains/plugins/github/extensions/GithubHttpAuthDataProvider.java b/plugins/github/src/org/jetbrains/plugins/github/extensions/GithubHttpAuthDataProvider.java
index 5a7daf94a9fd..47d3edcb3de5 100644
--- a/plugins/github/src/org/jetbrains/plugins/github/extensions/GithubHttpAuthDataProvider.java
+++ b/plugins/github/src/org/jetbrains/plugins/github/extensions/GithubHttpAuthDataProvider.java
@@ -15,6 +15,7 @@
*/
package org.jetbrains.plugins.github.extensions;
+import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.util.AuthData;
import git4idea.remote.GitHttpAuthDataProvider;
@@ -31,7 +32,7 @@ public class GithubHttpAuthDataProvider implements GitHttpAuthDataProvider {
@Nullable
@Override
- public AuthData getAuthData(@NotNull String url) {
+ public AuthData getAuthData(@NotNull String url, @Nullable ModalityState modalityState) {
if (!GithubUrlUtil.isGithubUrl(url)) {
return null;
}
@@ -47,7 +48,7 @@ public class GithubHttpAuthDataProvider implements GitHttpAuthDataProvider {
return null;
}
- GithubAuthData auth = settings.getAuthData();
+ GithubAuthData auth = settings.getAuthData(modalityState);
switch (auth.getAuthType()) {
case BASIC:
GithubAuthData.BasicAuth basicAuth = auth.getBasicAuth();
diff --git a/plugins/github/src/org/jetbrains/plugins/github/tasks/GithubRepositoryEditor.java b/plugins/github/src/org/jetbrains/plugins/github/tasks/GithubRepositoryEditor.java
index 5333d82e3baf..9cf3cdf4b4fe 100644
--- a/plugins/github/src/org/jetbrains/plugins/github/tasks/GithubRepositoryEditor.java
+++ b/plugins/github/src/org/jetbrains/plugins/github/tasks/GithubRepositoryEditor.java
@@ -125,7 +125,8 @@ public class GithubRepositoryEditor extends BaseRepositoryEditor<GithubRepositor
@Override
public String convert(ProgressIndicator indicator) throws IOException {
return GithubUtil
- .runTaskWithBasicAuthForHost(myProject, GithubAuthDataHolder.createFromSettings(), indicator, getHost(),
+ .runTaskWithBasicAuthForHost(myProject, GithubAuthDataHolder.createFromSettings(indicator.getModalityState()),
+ indicator, getHost(),
new ThrowableConvertor<GithubAuthData, String, IOException>() {
@NotNull
@Override
diff --git a/plugins/github/src/org/jetbrains/plugins/github/ui/GithubSettingsPanel.java b/plugins/github/src/org/jetbrains/plugins/github/ui/GithubSettingsPanel.java
index 7de0dae30d69..229170e29ead 100644
--- a/plugins/github/src/org/jetbrains/plugins/github/ui/GithubSettingsPanel.java
+++ b/plugins/github/src/org/jetbrains/plugins/github/ui/GithubSettingsPanel.java
@@ -130,7 +130,8 @@ public class GithubSettingsPanel {
@NotNull
@Override
public String convert(ProgressIndicator indicator) throws IOException {
- return GithubUtil.runTaskWithBasicAuthForHost(project, GithubAuthDataHolder.createFromSettings(), indicator, getHost(),
+ return GithubUtil.runTaskWithBasicAuthForHost(project, GithubAuthDataHolder.createFromSettings(indicator.getModalityState()),
+ indicator, getHost(),
new ThrowableConvertor<GithubAuthData, String, IOException>() {
@NotNull
@Override
@@ -262,7 +263,7 @@ public class GithubSettingsPanel {
@NotNull
public GithubAuthData getAuthData() {
if (!myCredentialsModified) {
- return mySettings.getAuthData();
+ return mySettings.getAuthData(null);
}
Object selected = myAuthTypeComboBox.getSelectedItem();
if (AUTH_PASSWORD.equals(selected)) return GithubAuthData.createBasicAuth(getHost(), getLogin(), getPassword());
@@ -290,7 +291,7 @@ public class GithubSettingsPanel {
public void apply() {
if (myCredentialsModified) {
- mySettings.setAuthData(getAuthData(), true);
+ mySettings.setAuthData(getAuthData(), true, null);
}
mySettings.setConnectionTimeout(getConnectionTimeout());
resetCredentialsModification();
diff --git a/plugins/github/src/org/jetbrains/plugins/github/util/GithubAuthData.java b/plugins/github/src/org/jetbrains/plugins/github/util/GithubAuthData.java
index f11044422154..d7981b261d7c 100644
--- a/plugins/github/src/org/jetbrains/plugins/github/util/GithubAuthData.java
+++ b/plugins/github/src/org/jetbrains/plugins/github/util/GithubAuthData.java
@@ -15,6 +15,7 @@
*/
package org.jetbrains.plugins.github.util;
+import com.intellij.openapi.application.ModalityState;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.plugins.github.api.GithubApiUtil;
@@ -52,8 +53,8 @@ public class GithubAuthData {
myUseProxy = useProxy;
}
- public static GithubAuthData createFromSettings() {
- return GithubSettings.getInstance().getAuthData();
+ public static GithubAuthData createFromSettings(@Nullable ModalityState state) {
+ return GithubSettings.getInstance().getAuthData(state);
}
public static GithubAuthData createAnonymous() {
diff --git a/plugins/github/src/org/jetbrains/plugins/github/util/GithubAuthDataHolder.java b/plugins/github/src/org/jetbrains/plugins/github/util/GithubAuthDataHolder.java
index 695dfe734c34..24303a34d240 100644
--- a/plugins/github/src/org/jetbrains/plugins/github/util/GithubAuthDataHolder.java
+++ b/plugins/github/src/org/jetbrains/plugins/github/util/GithubAuthDataHolder.java
@@ -15,8 +15,10 @@
*/
package org.jetbrains.plugins.github.util;
+import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.util.ThrowableComputable;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
public class GithubAuthDataHolder {
@@ -40,7 +42,7 @@ public class GithubAuthDataHolder {
myAuthData = task.compute();
}
- public static GithubAuthDataHolder createFromSettings() {
- return new GithubAuthDataHolder(GithubSettings.getInstance().getAuthData());
+ public static GithubAuthDataHolder createFromSettings(@Nullable ModalityState state) {
+ return new GithubAuthDataHolder(GithubSettings.getInstance().getAuthData(state));
}
}
diff --git a/plugins/github/src/org/jetbrains/plugins/github/util/GithubSettings.java b/plugins/github/src/org/jetbrains/plugins/github/util/GithubSettings.java
index 3523e412a95e..a2bdca59bbe4 100644
--- a/plugins/github/src/org/jetbrains/plugins/github/util/GithubSettings.java
+++ b/plugins/github/src/org/jetbrains/plugins/github/util/GithubSettings.java
@@ -19,6 +19,7 @@ import com.intellij.ide.passwordSafe.PasswordSafe;
import com.intellij.ide.passwordSafe.PasswordSafeException;
import com.intellij.ide.passwordSafe.config.PasswordSafeSettings;
import com.intellij.ide.passwordSafe.impl.PasswordSafeImpl;
+import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.components.*;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.text.StringUtil;
@@ -151,10 +152,10 @@ public class GithubSettings implements PersistentStateComponent<GithubSettings.S
}
@NotNull
- private String getPassword() {
+ private String getPassword(@Nullable ModalityState state) {
String password;
try {
- password = PasswordSafe.getInstance().getPassword(null, GithubSettings.class, GITHUB_SETTINGS_PASSWORD_KEY);
+ password = PasswordSafe.getInstance().getPassword(null, GithubSettings.class, GITHUB_SETTINGS_PASSWORD_KEY, state);
}
catch (PasswordSafeException e) {
LOG.info("Couldn't get password for key [" + GITHUB_SETTINGS_PASSWORD_KEY + "]", e);
@@ -164,10 +165,10 @@ public class GithubSettings implements PersistentStateComponent<GithubSettings.S
return StringUtil.notNullize(password);
}
- private void setPassword(@NotNull String password, boolean rememberPassword) {
+ private void setPassword(@NotNull String password, boolean rememberPassword, @Nullable ModalityState state) {
try {
if (rememberPassword) {
- PasswordSafe.getInstance().storePassword(null, GithubSettings.class, GITHUB_SETTINGS_PASSWORD_KEY, password);
+ PasswordSafe.getInstance().storePassword(null, GithubSettings.class, GITHUB_SETTINGS_PASSWORD_KEY, password, state);
}
else {
final PasswordSafeImpl passwordSafe = (PasswordSafeImpl)PasswordSafe.getInstance();
@@ -196,13 +197,13 @@ public class GithubSettings implements PersistentStateComponent<GithubSettings.S
}
@NotNull
- public GithubAuthData getAuthData() {
+ public GithubAuthData getAuthData(@Nullable ModalityState state) {
switch (getAuthType()) {
case BASIC:
//noinspection ConstantConditions
- return GithubAuthData.createBasicAuth(getHost(), getLogin(), getPassword());
+ return GithubAuthData.createBasicAuth(getHost(), getLogin(), getPassword(state));
case TOKEN:
- return GithubAuthData.createTokenAuth(getHost(), getPassword());
+ return GithubAuthData.createTokenAuth(getHost(), getPassword(state));
case ANONYMOUS:
return GithubAuthData.createAnonymous();
default:
@@ -210,7 +211,7 @@ public class GithubSettings implements PersistentStateComponent<GithubSettings.S
}
}
- public void setAuthData(@NotNull GithubAuthData auth, boolean rememberPassword) {
+ public void setAuthData(@NotNull GithubAuthData auth, boolean rememberPassword, @Nullable ModalityState state) {
setValidGitAuth(isValidGitAuth(auth));
setAuthType(auth.getAuthType());
@@ -220,16 +221,16 @@ public class GithubSettings implements PersistentStateComponent<GithubSettings.S
case BASIC:
assert auth.getBasicAuth() != null;
setLogin(auth.getBasicAuth().getLogin());
- setPassword(auth.getBasicAuth().getPassword(), rememberPassword);
+ setPassword(auth.getBasicAuth().getPassword(), rememberPassword, state);
break;
case TOKEN:
assert auth.getTokenAuth() != null;
setLogin(null);
- setPassword(auth.getTokenAuth().getToken(), rememberPassword);
+ setPassword(auth.getTokenAuth().getToken(), rememberPassword, state);
break;
case ANONYMOUS:
setLogin(null);
- setPassword("", rememberPassword);
+ setPassword("", rememberPassword, state);
break;
default:
throw new IllegalStateException("GithubSettings: setAuthData - wrong AuthType: " + auth.getAuthType());
diff --git a/plugins/github/src/org/jetbrains/plugins/github/util/GithubUtil.java b/plugins/github/src/org/jetbrains/plugins/github/util/GithubUtil.java
index edd12ab85ab6..e4af54f84639 100644
--- a/plugins/github/src/org/jetbrains/plugins/github/util/GithubUtil.java
+++ b/plugins/github/src/org/jetbrains/plugins/github/util/GithubUtil.java
@@ -161,7 +161,7 @@ public class GithubUtil {
if (ok[0]) {
authData[0] = dialog.getAuthData();
- GithubSettings.getInstance().setAuthData(authData[0], dialog.isSavePasswordSelected());
+ GithubSettings.getInstance().setAuthData(authData[0], dialog.isSavePasswordSelected(), indicator.getModalityState());
}
}
}, indicator.getModalityState());
@@ -195,7 +195,7 @@ public class GithubUtil {
final GithubSettings settings = GithubSettings.getInstance();
if (settings.getAuthType() != GithubAuthData.AuthType.TOKEN) {
- GithubSettings.getInstance().setAuthData(authData[0], dialog.isSavePasswordSelected());
+ GithubSettings.getInstance().setAuthData(authData[0], dialog.isSavePasswordSelected(), indicator.getModalityState());
}
}
}
@@ -247,7 +247,7 @@ public class GithubUtil {
@NotNull
public static GithubAuthDataHolder getValidAuthDataHolderFromConfig(@NotNull Project project, @NotNull ProgressIndicator indicator)
throws IOException {
- GithubAuthData auth = GithubAuthData.createFromSettings();
+ GithubAuthData auth = GithubAuthData.createFromSettings(indicator.getModalityState());
GithubAuthDataHolder authHolder = new GithubAuthDataHolder(auth);
try {
checkAuthData(project, authHolder, indicator);
diff --git a/plugins/github/test/org/jetbrains/plugins/github/GithubCreateGistTestBase.java b/plugins/github/test/org/jetbrains/plugins/github/GithubCreateGistTestBase.java
index b54bd8c62b4e..d313398548a5 100644
--- a/plugins/github/test/org/jetbrains/plugins/github/GithubCreateGistTestBase.java
+++ b/plugins/github/test/org/jetbrains/plugins/github/GithubCreateGistTestBase.java
@@ -54,12 +54,12 @@ public abstract class GithubCreateGistTestBase extends GithubTest {
@NotNull
protected GithubAuthDataHolder getAuthDataHolder() {
- return new GithubAuthDataHolder(myGitHubSettings.getAuthData());
+ return new GithubAuthDataHolder(myGitHubSettings.getAuthData(null));
}
protected void deleteGist() throws IOException {
if (GIST_ID != null) {
- GithubApiUtil.deleteGist(myGitHubSettings.getAuthData(), GIST_ID);
+ GithubApiUtil.deleteGist(myGitHubSettings.getAuthData(null), GIST_ID);
GIST = null;
GIST_ID = null;
}
@@ -82,7 +82,7 @@ public abstract class GithubCreateGistTestBase extends GithubTest {
if (GIST == null) {
try {
- GIST = GithubApiUtil.getGist(myGitHubSettings.getAuthData(), GIST_ID);
+ GIST = GithubApiUtil.getGist(myGitHubSettings.getAuthData(null), GIST_ID);
}
catch (IOException e) {
System.err.println(e.getMessage());
diff --git a/plugins/github/test/org/jetbrains/plugins/github/GithubRequestPagingTest.java b/plugins/github/test/org/jetbrains/plugins/github/GithubRequestPagingTest.java
index 4fec0d1c7a5c..97b34aa7b26c 100644
--- a/plugins/github/test/org/jetbrains/plugins/github/GithubRequestPagingTest.java
+++ b/plugins/github/test/org/jetbrains/plugins/github/GithubRequestPagingTest.java
@@ -36,7 +36,7 @@ public class GithubRequestPagingTest extends GithubTest {
public void testAvailableRepos() throws Throwable {
- List<GithubRepo> availableRepos = GithubApiUtil.getUserRepos(myGitHubSettings.getAuthData(), myLogin2);
+ List<GithubRepo> availableRepos = GithubApiUtil.getUserRepos(myGitHubSettings.getAuthData(null), myLogin2);
List<String> realData = new ArrayList<String>();
for (GithubRepo info : availableRepos) {
realData.add(info.getName());
diff --git a/plugins/github/test/org/jetbrains/plugins/github/GithubShareProjectTest.java b/plugins/github/test/org/jetbrains/plugins/github/GithubShareProjectTest.java
index c4063629cbbe..e6da326777c5 100644
--- a/plugins/github/test/org/jetbrains/plugins/github/GithubShareProjectTest.java
+++ b/plugins/github/test/org/jetbrains/plugins/github/GithubShareProjectTest.java
@@ -99,7 +99,7 @@ public class GithubShareProjectTest extends GithubShareProjectTestBase {
}
protected void checkGithubExists() throws IOException {
- GithubAuthData auth = myGitHubSettings.getAuthData();
+ GithubAuthData auth = myGitHubSettings.getAuthData(null);
GithubRepoDetailed githubInfo = GithubApiUtil.getDetailedRepoInfo(auth, myLogin1, PROJECT_NAME);
assertNotNull("GitHub repository does not exist", githubInfo);
}
diff --git a/plugins/github/test/org/jetbrains/plugins/github/GithubShareProjectTestBase.java b/plugins/github/test/org/jetbrains/plugins/github/GithubShareProjectTestBase.java
index abfb5ece3819..f146b37f4208 100644
--- a/plugins/github/test/org/jetbrains/plugins/github/GithubShareProjectTestBase.java
+++ b/plugins/github/test/org/jetbrains/plugins/github/GithubShareProjectTestBase.java
@@ -48,7 +48,7 @@ public abstract class GithubShareProjectTestBase extends GithubTest {
}
protected void deleteGithubRepo() throws IOException {
- GithubApiUtil.deleteGithubRepository(myGitHubSettings.getAuthData(), myLogin1, PROJECT_NAME);
+ GithubApiUtil.deleteGithubRepository(myGitHubSettings.getAuthData(null), myLogin1, PROJECT_NAME);
}
protected void registerDefaultShareDialogHandler() {
diff --git a/plugins/github/test/org/jetbrains/plugins/github/test/GithubTest.java b/plugins/github/test/org/jetbrains/plugins/github/test/GithubTest.java
index 3d3d8201e03a..b728913aeacb 100644
--- a/plugins/github/test/org/jetbrains/plugins/github/test/GithubTest.java
+++ b/plugins/github/test/org/jetbrains/plugins/github/test/GithubTest.java
@@ -172,7 +172,7 @@ public abstract class GithubTest extends GitPlatformTest {
myAuth = GithubAuthData.createBasicAuth(host, login1, password);
myGitHubSettings = GithubSettings.getInstance();
- myGitHubSettings.setAuthData(myAuth, false);
+ myGitHubSettings.setAuthData(myAuth, false, null);
myHttpAuthService = (GitHttpAuthTestService)ServiceManager.getService(GitHttpAuthService.class);
diff --git a/plugins/gradle/src/META-INF/plugin.xml b/plugins/gradle/src/META-INF/plugin.xml
index 67ca15f5d679..de6937c18c6c 100644
--- a/plugins/gradle/src/META-INF/plugin.xml
+++ b/plugins/gradle/src/META-INF/plugin.xml
@@ -83,7 +83,7 @@
<moduleBuilder builderClass="org.jetbrains.plugins.gradle.service.project.wizard.GradleModuleBuilder"/>
<internalFileTemplate name="Gradle Build Script"/>
<internalFileTemplate name="Gradle Build Script with wrapper"/>
- <projectConfigurable id="reference.settingsdialog.project.gradle"
+ <projectConfigurable groupId="build" id="reference.settingsdialog.project.gradle"
instance="org.jetbrains.plugins.gradle.service.settings.GradleConfigurable"
key="gradle.name" bundle="i18n.GradleBundle"/>
<library.presentationProvider implementation="org.jetbrains.plugins.gradle.config.GradleLibraryPresentationProvider" order="last"/>
diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/config/GradleScriptType.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/config/GradleScriptType.java
index e7795a0621d2..d17b9fdea764 100644
--- a/plugins/gradle/src/org/jetbrains/plugins/gradle/config/GradleScriptType.java
+++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/config/GradleScriptType.java
@@ -261,9 +261,14 @@ public class GradleScriptType extends GroovyRunnableScriptType {
final String scriptPath = configuration.getScriptPath();
if (scriptPath == null) {
- throw new CantRunException("Target script is undefined");
+ throw new CantRunException("Target script or gradle project path is undefined");
+ }
+
+ if(new File(scriptPath).isFile()) {
+ params.getProgramParametersList().add("--build-file");
+ } else {
+ params.getProgramParametersList().add("--project-dir");
}
- params.getProgramParametersList().add("--project-dir");
params.getProgramParametersList().add(FileUtil.toSystemDependentName(scriptPath));
params.getProgramParametersList().addParametersString(configuration.getProgramParameters());
params.getProgramParametersList().addParametersString(scriptParameters);
diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/execution/test/runner/TestMethodGradleConfigurationProducer.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/execution/test/runner/TestMethodGradleConfigurationProducer.java
index 5993480333e5..f4dec6283300 100644
--- a/plugins/gradle/src/org/jetbrains/plugins/gradle/execution/test/runner/TestMethodGradleConfigurationProducer.java
+++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/execution/test/runner/TestMethodGradleConfigurationProducer.java
@@ -107,7 +107,8 @@ public class TestMethodGradleConfigurationProducer extends RunConfigurationProdu
if (!configuration.getSettings().getTaskNames().containsAll(TASKS_TO_RUN)) return false;
final String scriptParameters = configuration.getSettings().getScriptParameters() + ' ';
- return scriptParameters.contains(String.format("--tests %s.%s ", containingClass.getQualifiedName(), psiMethod.getName()));
+ final String testFilter = creatTestFilter(containingClass, psiMethod);
+ return scriptParameters.contains(testFilter);
}
@Override
@@ -163,11 +164,16 @@ public class TestMethodGradleConfigurationProducer extends RunConfigurationProdu
StringBuilder buf = new StringBuilder();
for (PsiClass aClass : containingClasses) {
- buf.append(String.format("--tests %s.%s ", aClass.getQualifiedName(), psiMethod.getName()));
+ buf.append(creatTestFilter(aClass, psiMethod));
}
- configuration.getSettings().setScriptParameters(buf.toString());
+ configuration.getSettings().setScriptParameters(buf.toString().trim());
configuration.setName(psiMethod.getName());
return true;
}
+
+ private static String creatTestFilter(@NotNull PsiClass aClass, @NotNull PsiMethod psiMethod) {
+ String testFilterPattern = aClass.getQualifiedName() + '.' + psiMethod.getName();
+ return String.format("--tests \"%s\" ", StringUtil.replaceChar(testFilterPattern, '\"', '*'));
+ }
}
diff --git a/plugins/gradle/testSources/org/jetbrains/plugins/gradle/importing/GradleImportingTestCase.java b/plugins/gradle/testSources/org/jetbrains/plugins/gradle/importing/GradleImportingTestCase.java
index dd723557b37e..f59ccee38658 100644
--- a/plugins/gradle/testSources/org/jetbrains/plugins/gradle/importing/GradleImportingTestCase.java
+++ b/plugins/gradle/testSources/org/jetbrains/plugins/gradle/importing/GradleImportingTestCase.java
@@ -62,7 +62,6 @@ public abstract class GradleImportingTestCase extends ExternalSystemImportingTes
private static final int GRADLE_DAEMON_TTL_MS = 10000;
- public static final Pattern TEST_METHOD_NAME_PATTERN = Pattern.compile("(.*)\\[(\\d*: with Gradle-.*)\\]");
@Rule public TestName name = new TestName();
@NotNull
@@ -91,12 +90,7 @@ public abstract class GradleImportingTestCase extends ExternalSystemImportingTes
@Override
public String getName() {
- String methodName = name.getMethodName();
- Matcher m = TEST_METHOD_NAME_PATTERN.matcher(methodName);
- if (m.matches()) {
- methodName = m.group(1);
- }
- return methodName;
+ return name.getMethodName() == null ? super.getName() : FileUtil.sanitizeFileName(name.getMethodName());
}
@Parameterized.Parameters(name = "{index}: with Gradle-{0}")
diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/BaseInspection.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/BaseInspection.java
index be28ee0a95fd..5e6e8ff3a8d8 100644
--- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/BaseInspection.java
+++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/BaseInspection.java
@@ -16,9 +16,9 @@
package org.jetbrains.plugins.groovy.codeInspection;
import com.intellij.codeInspection.InspectionManager;
+import com.intellij.codeInspection.InspectionProfileEntry;
import com.intellij.codeInspection.ProblemDescriptor;
import com.intellij.codeInspection.ProblemsHolder;
-import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import org.jetbrains.annotations.NotNull;
@@ -26,8 +26,7 @@ import org.jetbrains.annotations.Nullable;
import org.jetbrains.plugins.groovy.lang.psi.GroovyFileBase;
public abstract class BaseInspection extends GroovySuppressableInspectionTool {
-
- private final String m_shortName = StringUtil.trimEnd(getClass().getSimpleName(), "Inspection");
+ private final String m_shortName = InspectionProfileEntry.getShortName(getClass().getSimpleName());
public static final String ASSIGNMENT_ISSUES = "Assignment issues";
public static final String CONFUSING_CODE_CONSTRUCTS = "Potentially confusing code constructs";
diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/synthetic/GrLightMethodBuilder.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/synthetic/GrLightMethodBuilder.java
index 6dcdb2a25ccc..309f7f43a1f1 100644
--- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/synthetic/GrLightMethodBuilder.java
+++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/synthetic/GrLightMethodBuilder.java
@@ -200,7 +200,11 @@ public class GrLightMethodBuilder extends LightElement implements GrMethod, Ori
@Override
public GrTypeElement getReturnTypeElementGroovy() {
- return null;
+ PsiType returnType = getReturnType();
+ if (returnType == null) {
+ return null;
+ }
+ return new GrLightTypeElement(returnType, getManager());
}
@Override
diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/synthetic/GrLightParameterListBuilder.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/synthetic/GrLightParameterListBuilder.java
index 409ab4df9d9c..425b4a898599 100644
--- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/synthetic/GrLightParameterListBuilder.java
+++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/synthetic/GrLightParameterListBuilder.java
@@ -64,9 +64,9 @@ public class GrLightParameterListBuilder extends LightElement implements GrParam
return myCachedParameters;
}
- public void copyParameters(@NotNull PsiMethod method, PsiSubstitutor substitutor) {
+ public void copyParameters(@NotNull PsiMethod method, PsiSubstitutor substitutor, PsiMethod scope) {
for (PsiParameter parameter : method.getParameterList().getParameters()) {
- GrLightParameter p = new GrLightParameter(StringUtil.notNullize(parameter.getName()), substitutor.substitute(parameter.getType()), this);
+ GrLightParameter p = new GrLightParameter(StringUtil.notNullize(parameter.getName()), substitutor.substitute(parameter.getType()), scope);
if (parameter instanceof GrParameter) {
p.setOptional(((GrParameter)parameter).isOptional());
diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/synthetic/GrMethodWrapper.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/synthetic/GrMethodWrapper.java
index 44da8f27928a..90605135e261 100644
--- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/synthetic/GrMethodWrapper.java
+++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/synthetic/GrMethodWrapper.java
@@ -43,7 +43,7 @@ public class GrMethodWrapper extends GrLightMethodBuilder implements PsiMirrorEl
getModifierList().copyModifiers(method);
- getParameterList().copyParameters(method, substitutor);
+ getParameterList().copyParameters(method, substitutor, this);
if (method instanceof OriginInfoAwareElement) {
setOriginInfo(((OriginInfoAwareElement)method).getOriginInfo());
diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/stubs/elements/GrStubFileElementType.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/stubs/elements/GrStubFileElementType.java
index cd516c6a02c6..8ccfe21915f8 100644
--- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/stubs/elements/GrStubFileElementType.java
+++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/stubs/elements/GrStubFileElementType.java
@@ -44,6 +44,7 @@ public class GrStubFileElementType extends IStubFileElementType<GrFileStub> {
@Override
public StubBuilder getBuilder() {
return new DefaultStubBuilder() {
+ @NotNull
@Override
protected StubElement createStubForFile(@NotNull final PsiFile file) {
if (file instanceof GroovyFile) {
diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/stubs/index/GrFullClassNameIndex.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/stubs/index/GrFullClassNameIndex.java
index 797ff3bc573d..b7b27df6e86d 100644
--- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/stubs/index/GrFullClassNameIndex.java
+++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/stubs/index/GrFullClassNameIndex.java
@@ -44,7 +44,7 @@ public class GrFullClassNameIndex extends IntStubIndexExtension<PsiClass> {
}
@Override
- public Collection<PsiClass> get(final Integer integer, final Project project, final GlobalSearchScope scope) {
+ public Collection<PsiClass> get(@NotNull final Integer integer, @NotNull final Project project, @NotNull final GlobalSearchScope scope) {
return StubIndex.getElements(getKey(), integer, project, new GrSourceFilterScope(scope), PsiClass.class);
}
}
diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/typeEnhancers/FromStringHintProcessor.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/typeEnhancers/FromStringHintProcessor.java
index 6ca36c5bb70f..1af99c7647dd 100644
--- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/typeEnhancers/FromStringHintProcessor.java
+++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/typeEnhancers/FromStringHintProcessor.java
@@ -15,10 +15,7 @@
*/
package org.jetbrains.plugins.groovy.lang.psi.typeEnhancers;
-import com.intellij.psi.JavaPsiFacade;
-import com.intellij.psi.PsiMethod;
-import com.intellij.psi.PsiSubstitutor;
-import com.intellij.psi.PsiType;
+import com.intellij.psi.*;
import com.intellij.util.Function;
import com.intellij.util.IncorrectOperationException;
import com.intellij.util.containers.ContainerUtil;
@@ -49,7 +46,9 @@ public class FromStringHintProcessor extends SignatureHintProcessor {
@Override
public PsiType fun(String param) {
try {
- PsiType original = JavaPsiFacade.getElementFactory(method.getProject()).createTypeFromText(param, method);
+ PsiTypeParameterList typeParameterList = method.getTypeParameterList();
+ PsiElement context = typeParameterList != null ? typeParameterList : method;
+ PsiType original = JavaPsiFacade.getElementFactory(method.getProject()).createTypeFromText(param, context);
return substitutor.substitute(original);
}
catch (IncorrectOperationException e) {
diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/providers/GroovyReferenceContributor.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/providers/GroovyReferenceContributor.java
deleted file mode 100644
index e25c490f87cd..000000000000
--- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/providers/GroovyReferenceContributor.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright 2000-2014 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jetbrains.plugins.groovy.lang.resolve.providers;
-
-import com.intellij.patterns.PlatformPatterns;
-import com.intellij.psi.PsiReferenceContributor;
-import com.intellij.psi.PsiReferenceRegistrar;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.plugins.groovy.lang.psi.api.auxiliary.modifiers.annotation.GrAnnotationNameValuePair;
-import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.literals.GrLiteral;
-import org.jetbrains.plugins.groovy.lang.psi.patterns.GroovyPatterns;
-import org.jetbrains.plugins.groovy.spock.SpockUnrollReferenceProvider;
-
-/**
- * @author Dmitry.Krasilschikov
- */
-public class GroovyReferenceContributor extends PsiReferenceContributor {
- @Override
- public void registerReferenceProviders(@NotNull final PsiReferenceRegistrar registrar) {
- registrar.registerReferenceProvider(PlatformPatterns.psiElement(GrLiteral.class), new PropertiesReferenceProvider());
-
- registrar.registerReferenceProvider(GroovyPatterns.stringLiteral().withParent(GrAnnotationNameValuePair.class),
- new SpockUnrollReferenceProvider());
- }
-}
diff --git a/plugins/groovy/src/META-INF/plugin.xml b/plugins/groovy/src/META-INF/plugin.xml
index f16d2c195482..8e3d7103e250 100644
--- a/plugins/groovy/src/META-INF/plugin.xml
+++ b/plugins/groovy/src/META-INF/plugin.xml
@@ -25,7 +25,6 @@
<depends optional="true" config-file="intellilang-groovy-support.xml">org.intellij.intelliLang</depends>
<depends optional="true">AntSupport</depends>
<depends optional="true" config-file="groovy-byte-code-viewer.xml">ByteCodeViewer</depends>
- <depends optional="true" config-file="structuralsearch.xml">Structural Search</depends>
<extensionPoints>
<extensionPoint name="methodComparator" interface="org.jetbrains.plugins.groovy.lang.resolve.GrMethodComparator"/>
@@ -42,7 +41,6 @@
<extensionPoint name="positionManagerDelegate"
interface="org.jetbrains.plugins.groovy.extensions.debugger.ScriptPositionManagerHelper"/>
- <extensionPoint name="compilerExtension" interface="org.jetbrains.plugins.groovy.compiler.GroovyCompilerExtension"/>
<extensionPoint name="scriptTypeDetector" interface="org.jetbrains.plugins.groovy.extensions.GroovyScriptTypeDetector"/>
<extensionPoint name="namedArgumentProvider" interface="org.jetbrains.plugins.groovy.extensions.GroovyNamedArgumentProvider"/>
@@ -275,7 +273,7 @@
<fileTypeFactory implementation="org.jetbrains.plugins.groovy.GroovyFileTypeLoader"/>
<fileTypeFactory implementation="org.jetbrains.plugins.groovy.dgm.DGMFileTypeFactory"/>
- <projectConfigurable instance="org.jetbrains.plugins.groovy.gant.GantConfigurable" id="reference.settingsdialog.project.gant"
+ <projectConfigurable groupId="build" instance="org.jetbrains.plugins.groovy.gant.GantConfigurable" id="reference.settingsdialog.project.gant"
displayName="Gant"/>
<library.presentationProvider implementation="org.jetbrains.plugins.groovy.config.GroovyLibraryPresentationProvider"/>
@@ -404,6 +402,8 @@
<refactoring.helper implementation="org.jetbrains.plugins.groovy.refactoring.GroovyImportOptimizerRefactoringHelper"/>
<codeInsight.lineMarkerProvider language="Groovy"
implementationClass="org.jetbrains.plugins.groovy.codeInsight.GroovyLineMarkerProvider"/>
+ <codeInsight.lineMarkerProvider language="Groovy"
+ implementationClass="com.intellij.codeInsight.ExternalAnnotationsLineMarkerProvider"/>
<codeInsight.gotoSuper language="Groovy"
implementationClass="org.jetbrains.plugins.groovy.codeInsight.navigation.actions.GroovyGotoSuperHandler"/>
<lookup.charFilter implementation="org.jetbrains.plugins.groovy.lang.completion.GroovyReferenceCharFilter"/>
@@ -445,13 +445,13 @@
<weigher key="proximity" implementationClass="org.jetbrains.plugins.groovy.lang.completion.weighers.GrReferenceListWeigher"
id="groovyReferenceListWeigher" order="before openedInEditor"/>
- <debuggerClassFilterProvider implementation="org.jetbrains.plugins.groovy.debugger.filters.GroovyDebuggerClassFilterProvider"/>
+ <debuggerClassFilterProvider implementation="org.jetbrains.plugins.groovy.debugger.GroovyDebuggerClassFilterProvider"/>
<useScopeEnlarger implementation="org.jetbrains.plugins.groovy.lang.psi.impl.search.GrPrivateFieldScopeEnlarger"/>
<debuggerEditorTextProvider language="Groovy" implementationClass="org.jetbrains.plugins.groovy.debugger.GroovyEditorTextProvider"/>
- <xdebugger.settings implementation="org.jetbrains.plugins.groovy.debugger.filters.GroovyDebuggerSettings"/>
+ <xdebugger.settings implementation="org.jetbrains.plugins.groovy.debugger.GroovyDebuggerSettings"/>
<langCodeStyleSettingsProvider implementation="org.jetbrains.plugins.groovy.codeStyle.GroovyLanguageCodeStyleSettingsProvider"/>
<codeStyleSettingsProvider implementation="org.jetbrains.plugins.groovy.codeStyle.GroovyCodeStyleSettingsProvider"/>
@@ -1515,6 +1515,8 @@
implementationClass="org.jetbrains.plugins.groovy.refactoring.memberPullUp.GrPullUpHelperFactory"/>
<classTypePointerFactory implementation="org.jetbrains.plugins.groovy.lang.psi.impl.smartPointers.GrClassReferenceTypePointerFactory"/>
<hierarchy.referenceProcessor implementation="org.jetbrains.plugins.groovy.hierarchy.call.GrCallReferenceProcessor"/>
+ <structuralsearch.profile implementation="com.intellij.structuralsearch.GroovyStructuralSearchProfile"/>
+ <equivalenceDescriptorProvider implementation="com.intellij.structuralsearch.GroovyEquivalenceDescriptorProvider"/>
</extensions>
<extensions defaultExtensionNs="com.intellij.debugger">
diff --git a/plugins/groovy/src/META-INF/structuralsearch.xml b/plugins/groovy/src/META-INF/structuralsearch.xml
deleted file mode 100644
index b3b6193771de..000000000000
--- a/plugins/groovy/src/META-INF/structuralsearch.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<idea-plugin url="http://www.jetbrains.com/idea">
- <extensions defaultExtensionNs="com.intellij">
- <structuralsearch.profile implementation="com.intellij.structuralsearch.GroovyStructuralSearchProfile"/>
- </extensions>
-</idea-plugin>
- \ No newline at end of file
diff --git a/plugins/groovy/src/org/intellij/plugins/intelliLang/inject/groovy/PatternEditorContextMembersProvider.java b/plugins/groovy/src/org/intellij/plugins/intelliLang/inject/groovy/PatternEditorContextMembersProvider.java
index e23254da8d1a..3fcf1c337b86 100644
--- a/plugins/groovy/src/org/intellij/plugins/intelliLang/inject/groovy/PatternEditorContextMembersProvider.java
+++ b/plugins/groovy/src/org/intellij/plugins/intelliLang/inject/groovy/PatternEditorContextMembersProvider.java
@@ -19,7 +19,7 @@ import com.intellij.openapi.fileTypes.StdFileTypes;
import com.intellij.openapi.progress.EmptyProgressIndicator;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Key;
-import com.intellij.openapi.util.ModificationTracker;
+import com.intellij.openapi.util.text.StringUtil;
import com.intellij.patterns.compiler.PatternClassBean;
import com.intellij.patterns.compiler.PatternCompilerFactory;
import com.intellij.psi.*;
@@ -30,14 +30,13 @@ import com.intellij.psi.scope.PsiScopeProcessor;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.psi.search.TextOccurenceProcessor;
import com.intellij.psi.search.UsageSearchContext;
-import com.intellij.psi.util.CachedValue;
-import com.intellij.psi.util.CachedValueProvider;
-import com.intellij.psi.util.CachedValuesManager;
-import com.intellij.psi.util.PsiTreeUtil;
+import com.intellij.psi.util.*;
import com.intellij.psi.xml.XmlTag;
import com.intellij.psi.xml.XmlText;
+import com.intellij.util.ArrayUtil;
import com.intellij.util.Processor;
import com.intellij.util.containers.ContainerUtil;
+import com.intellij.util.containers.SoftFactoryMap;
import com.intellij.util.text.StringSearcher;
import org.intellij.plugins.intelliLang.inject.InjectorUtils;
import org.intellij.plugins.intelliLang.inject.config.BaseInjection;
@@ -46,86 +45,74 @@ import org.jetbrains.annotations.Nullable;
import org.jetbrains.plugins.groovy.GroovyFileType;
import org.jetbrains.plugins.groovy.lang.resolve.NonCodeMembersContributor;
-import java.util.Collections;
import java.util.List;
+import java.util.Set;
/**
* @author Gregory.Shrago
*/
public class PatternEditorContextMembersProvider extends NonCodeMembersContributor {
- public static final Key<CachedValue<List<PsiElement>>> INJECTION_PARSED_CONTEXT = Key.create("INJECTION_PARSED_CONTEXT");
+ private static final Key<SoftFactoryMap<Class[], PsiFile>> PATTERN_INJECTION_CONTEXT = Key.create("PATTERN_INJECTION_CONTEXT");
+ private static final Key<CachedValue<Set<String>>> PATTERN_CLASSES = Key.create("PATTERN_CLASSES");
@Override
public void processDynamicElements(@NotNull PsiType qualifierType,
- @NotNull PsiScopeProcessor processor,
- @NotNull PsiElement place,
- @NotNull ResolveState state) {
+ @NotNull final PsiScopeProcessor scopeProcessor,
+ @NotNull final PsiElement place,
+ @NotNull final ResolveState state) {
final PsiFile file = place.getContainingFile().getOriginalFile();
- CachedValue<List<PsiElement>> value = file.getUserData(INJECTION_PARSED_CONTEXT);
- if (value == null) {
- final BaseInjection injection = file.getUserData(BaseInjection.INJECTION_KEY);
- final CachedValueProvider<List<PsiElement>> provider;
- if (injection == null) {
- provider = createDevProvider(file);
- }
- else {
- provider = createPatternProvider(injection, file);
+ final BaseInjection injection = file.getUserData(BaseInjection.INJECTION_KEY);
+ Processor<PsiElement> processor = new Processor<PsiElement>() {
+ @Override
+ public boolean process(PsiElement element) {
+ return element.processDeclarations(scopeProcessor, state, null, place);
}
- if (provider == null) return;
- file.putUserData(INJECTION_PARSED_CONTEXT,
- value = CachedValuesManager.getManager(file.getProject()).createCachedValue(provider, false));
+ };
+ if (injection == null) {
+ processDevContext(file, processor);
}
- final List<PsiElement> roots = value.getValue();
- for (PsiElement root : roots) {
- if (!root.processDeclarations(processor, state, null, place)) return;
+ else {
+ processPatternContext(injection, file, processor);
}
}
- private static CachedValueProvider<List<PsiElement>> createPatternProvider(final BaseInjection injection, final PsiFile file) {
- return new CachedValueProvider<List<PsiElement>>() {
- @Override
- public Result<List<PsiElement>> compute() {
- return new Result<List<PsiElement>>(Collections.<PsiElement>singletonList(
- getRootByClasses(InjectorUtils.getPatternClasses(injection.getSupportId()), file.getProject())),
- ModificationTracker.NEVER_CHANGED);
- }
- };
+ private static boolean processPatternContext(@NotNull BaseInjection injection,
+ @NotNull PsiFile file,
+ @NotNull Processor<PsiElement> processor) {
+ return processor.process(getRootByClasses(file, InjectorUtils.getPatternClasses(injection.getSupportId())));
}
- private static PsiFile getRootByClasses(Class[] classes, Project project) {
- final String text = PatternCompilerFactory.getFactory().getPatternCompiler(classes).dumpContextDeclarations();
- return PsiFileFactory.getInstance(project).createFileFromText("context.groovy", GroovyFileType.GROOVY_FILE_TYPE, text);
+ @NotNull
+ private static PsiFile getRootByClasses(@NotNull PsiFile file, @NotNull Class[] classes) {
+ final Project project = file.getProject();
+ SoftFactoryMap<Class[], PsiFile> map = project.getUserData(PATTERN_INJECTION_CONTEXT);
+ if (map == null) {
+ map = new SoftFactoryMap<Class[], PsiFile>() {
+
+ @Override
+ protected PsiFile create(Class[] key) {
+ String text = PatternCompilerFactory.getFactory().getPatternCompiler(key).dumpContextDeclarations();
+ return PsiFileFactory.getInstance(project).createFileFromText("context.groovy", GroovyFileType.GROOVY_FILE_TYPE, text);
+ }
+ };
+ project.putUserData(PATTERN_INJECTION_CONTEXT, map);
+ }
+ return map.get(classes);
}
- @Nullable
- private static CachedValueProvider<List<PsiElement>> createDevProvider(final PsiFile file) {
+ private static boolean processDevContext(final PsiFile file, Processor<PsiElement> processor) {
final XmlTag tag = getTagByInjectedFile(file);
final XmlTag parentTag = tag == null ? null : tag.getParentTag();
final String parentTagName = parentTag == null ? null : parentTag.getName();
final String name = tag == null ? null : tag.getName();
- if ("place".equals(name) && "injection".equals(parentTagName) && parentTag != null) {
- return new CachedValueProvider<List<PsiElement>>() {
- @Override
- public Result<List<PsiElement>> compute() {
- final XmlTag tag = getTagByInjectedFile(file);
- final XmlTag parentTag = tag == null ? null : tag.getParentTag();
- if (parentTag == null) return Result.create(Collections.<PsiElement>emptyList(), file);
- return new Result<List<PsiElement>>(getRootsByClassNames(file, parentTag.getAttributeValue("injector-id")), parentTag.getContainingFile());
- }
- };
+ if ("place".equals(name) && "injection".equals(parentTagName)) {
+ return processRootsByClassNames(file, parentTag.getAttributeValue("injector-id"), processor);
}
else if ("pattern".equals(name) && parentTag != null) {
- return new CachedValueProvider<List<PsiElement>>() {
- @Override
- public Result<List<PsiElement>> compute() {
- final XmlTag tag = getTagByInjectedFile(file);
- if (tag == null) return Result.create(Collections.<PsiElement>emptyList(), file);
- return new Result<List<PsiElement>>(getRootsByClassNames(file, tag.getAttributeValue("type")), tag.getContainingFile());
- }
- };
+ return processRootsByClassNames(file, tag.getAttributeValue("type"), processor);
}
- else return null;
+ return true;
}
@Nullable
@@ -135,22 +122,48 @@ public class PatternEditorContextMembersProvider extends NonCodeMembersContribut
return element instanceof XmlText ? ((XmlText)element).getParentTag() : null;
}
- private static List<PsiElement> getRootsByClassNames(PsiFile file, String type) {
- final List<PsiElement> roots = ContainerUtil.createLockFreeCopyOnWriteList();
+ private static boolean processRootsByClassNames(@NotNull PsiFile file, @Nullable String type, @NotNull Processor<PsiElement> processor) {
+ Project project = file.getProject();
+ Set<String> classNames = collectDevPatternClassNames(project);
+ if (!classNames.isEmpty()) {
+ JavaPsiFacade psiFacade = JavaPsiFacade.getInstance(project);
+ for (String className : classNames) {
+ PsiClass patternClass = psiFacade.findClass(className, GlobalSearchScope.allScope(project));
+ if (patternClass != null && !processor.process(patternClass)) return false;
+ }
+ }
+ Class[] classes = StringUtil.isEmpty(type) ? ArrayUtil.EMPTY_CLASS_ARRAY : PatternCompilerFactory.getFactory().getPatternClasses(type);
+ return classes.length == 0 || processor.process(getRootByClasses(file, classes));
+ }
+
+ private static Set<String> collectDevPatternClassNames(@NotNull final Project project) {
+ CachedValue<Set<String>> cachedValue = project.getUserData(PATTERN_CLASSES);
+ if (cachedValue == null) {
+ cachedValue = CachedValuesManager.getManager(project).createCachedValue(new CachedValueProvider<Set<String>>() {
+ @Nullable
+ @Override
+ public Result<Set<String>> compute() {
+ return Result.create(calcDevPatternClassNames(project), PsiModificationTracker.OUT_OF_CODE_BLOCK_MODIFICATION_COUNT);
+ }
+ }, false);
+ project.putUserData(PATTERN_CLASSES, cachedValue);
+ }
+ return cachedValue.getValue();
+ }
- final Project project = file.getProject();
- final JavaPsiFacade psiFacade = JavaPsiFacade.getInstance(project);
- final PsiClass beanClass = psiFacade.findClass(PatternClassBean.class.getName(), GlobalSearchScope.allScope(project));
+ private static Set<String> calcDevPatternClassNames(@NotNull final Project project) {
+ final List<String> roots = ContainerUtil.createLockFreeCopyOnWriteList();
+ JavaPsiFacade psiFacade = JavaPsiFacade.getInstance(project);
+ PsiClass beanClass = psiFacade.findClass(PatternClassBean.class.getName(), GlobalSearchScope.allScope(project));
if (beanClass != null) {
- final GlobalSearchScope scope =
- GlobalSearchScope.getScopeRestrictedByFileTypes(GlobalSearchScope.allScope(project), StdFileTypes.XML);
+ GlobalSearchScope scope = GlobalSearchScope.getScopeRestrictedByFileTypes(GlobalSearchScope.allScope(project), StdFileTypes.XML);
final TextOccurenceProcessor occurenceProcessor = new TextOccurenceProcessor() {
@Override
public boolean execute(@NotNull PsiElement element, int offsetInElement) {
- final XmlTag tag = PsiTreeUtil.getParentOfType(element, XmlTag.class);
- final String className = tag == null ? null : tag.getAttributeValue("className");
- if (className != null && tag.getLocalName().endsWith("patternClass")) {
- ContainerUtil.addIfNotNull(psiFacade.findClass(className, GlobalSearchScope.allScope(project)), roots);
+ XmlTag tag = PsiTreeUtil.getParentOfType(element, XmlTag.class);
+ String className = tag == null ? null : tag.getAttributeValue("className");
+ if (StringUtil.isNotEmpty(className) && tag.getLocalName().endsWith("patternClass")) {
+ roots.add(className);
}
return true;
}
@@ -159,17 +172,13 @@ public class PatternEditorContextMembersProvider extends NonCodeMembersContribut
CacheManager.SERVICE.getInstance(beanClass.getProject()).processFilesWithWord(new Processor<PsiFile>() {
@Override
public boolean process(PsiFile psiFile) {
- LowLevelSearchUtil
- .processElementsContainingWordInElement(occurenceProcessor, psiFile, searcher, true, new EmptyProgressIndicator());
+ LowLevelSearchUtil.processElementsContainingWordInElement(occurenceProcessor, psiFile, searcher, true,
+ new EmptyProgressIndicator());
return true;
}
}, searcher.getPattern(), UsageSearchContext.IN_FOREIGN_LANGUAGES, scope, searcher.isCaseSensitive());
}
- final Class[] classes = PatternCompilerFactory.getFactory().getPatternClasses(type);
- if (classes.length != 0) {
- roots.add(getRootByClasses(classes, project));
- }
- return roots;
+ return ContainerUtil.newHashSet(roots);
}
}
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/compiler/GroovyCompilerConfigurable.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/compiler/GroovyCompilerConfigurable.java
index f273be1b3d6e..2db660e1cf04 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/compiler/GroovyCompilerConfigurable.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/compiler/GroovyCompilerConfigurable.java
@@ -67,7 +67,7 @@ public class GroovyCompilerConfigurable implements SearchableConfigurable, Confi
final FileChooserDescriptor descriptor = new FileChooserDescriptor(true, true, false, false, false, true) {
@Override
public boolean isFileVisible(VirtualFile file, boolean showHiddenFiles) {
- return super.isFileVisible(file, showHiddenFiles) && !index.isIgnored(file);
+ return super.isFileVisible(file, showHiddenFiles) && !index.isExcluded(file);
}
};
descriptor.setRoots(ContainerUtil.concat(
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/compiler/GroovyCompilerExtension.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/compiler/GroovyCompilerExtension.java
deleted file mode 100644
index 8d84f9f5b531..000000000000
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/compiler/GroovyCompilerExtension.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright 2000-2009 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.jetbrains.plugins.groovy.compiler;
-
-import com.intellij.compiler.impl.javaCompiler.ModuleChunk;
-import com.intellij.util.PathsList;
-import com.intellij.openapi.extensions.ExtensionPointName;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.List;
-
-/**
- * @author peter
- */
-public abstract class GroovyCompilerExtension {
- public static final ExtensionPointName<GroovyCompilerExtension> EP_NAME = ExtensionPointName.create("org.intellij.groovy.compilerExtension");
-
- public abstract void enhanceCompilationClassPath(@NotNull ModuleChunk chunk, @NotNull PathsList classPath);
-
- @NotNull public abstract List<String> getCompilationUnitPatchers(@NotNull ModuleChunk chunk);
-
-}
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/compiler/generator/TopLevelDependencyValidityState.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/compiler/generator/TopLevelDependencyValidityState.java
deleted file mode 100644
index 4c673957c36a..000000000000
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/compiler/generator/TopLevelDependencyValidityState.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright 2000-2014 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jetbrains.plugins.groovy.compiler.generator;
-
-import com.intellij.openapi.compiler.ValidityState;
-import com.intellij.openapi.diagnostic.Logger;
-
-import java.io.*;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * User: Dmitry.Krasilschikov
- * Date: 20.08.2007
- */
-class TopLevelDependencyValidityState implements ValidityState {
- private final long myTimestamp;
- private final List<String> myMembers; //fields
-
- private static final Logger LOG = Logger.getInstance("org.jetbrains.plugins.groovy.compiler.generator.TopLevelDependencyValidityState");
-
- TopLevelDependencyValidityState(long timestamp, List<String> members) {
-// use signature of method and access modifiers
- this.myMembers = members;
- myTimestamp = timestamp;
- }
-
- @Override
- public boolean equalsTo(ValidityState validityState) {
- if (!(validityState instanceof TopLevelDependencyValidityState)) return false;
-
- return ((TopLevelDependencyValidityState) validityState).myTimestamp == this.myTimestamp
- && myMembers.equals(((TopLevelDependencyValidityState) validityState).myMembers);
- }
-
- @Override
- public void save(DataOutput out) throws IOException {
- out.writeLong(myTimestamp);
- out.writeChar('\n');
-
- for (String member : myMembers) {
- out.writeChar('\n');
- out.writeUTF(member);
- }
- }
-
- public static TopLevelDependencyValidityState load(DataInputStream is) throws IOException {
- long timestamp = -1;
-
- Reader reader = new InputStreamReader(is);
- StreamTokenizer tokenizer = new StreamTokenizer(reader);
-// tokenizer.whitespaceChars(' ', ' ');
-// tokenizer.whitespaceChars('\t', '\t');
-// tokenizer.whitespaceChars('\f', '\f');
-// tokenizer.whitespaceChars('\n', '\n');
-// tokenizer.whitespaceChars('\r', '\r');
-
- List<String> members = new ArrayList<String>();
- while (true) {
- int ttype = tokenizer.nextToken();
- switch (ttype) {
- case StreamTokenizer.TT_NUMBER: {
- try {
- timestamp = (long) tokenizer.nval;
- } catch (NumberFormatException e) {
- LOG.error(e);
- }
- break;
- }
- case StreamTokenizer.TT_WORD: {
- members.add(tokenizer.sval);
- break;
- }
- case StreamTokenizer.TT_EOL:
- break;
- case StreamTokenizer.TT_EOF:
- default:
- break;
- }
- if (ttype == StreamTokenizer.TT_EOF)
- break;
- }
- return new TopLevelDependencyValidityState(timestamp, members);
- }
-}
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovyDebuggerClassFilterProvider.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovyDebuggerClassFilterProvider.java
new file mode 100644
index 000000000000..7b734a4654b5
--- /dev/null
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovyDebuggerClassFilterProvider.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jetbrains.plugins.groovy.debugger;
+
+import com.intellij.ui.classFilter.ClassFilter;
+import com.intellij.ui.classFilter.DebuggerClassFilterProvider;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * @author ilyas
+ */
+public class GroovyDebuggerClassFilterProvider implements DebuggerClassFilterProvider {
+ private static final List<ClassFilter> FILTERS = Arrays.asList(new ClassFilter("org.codehaus.groovy.*"), new ClassFilter("groovy.*"));
+
+ @Override
+ public List<ClassFilter> getFilters() {
+ GroovyDebuggerSettings settings = GroovyDebuggerSettings.getInstance();
+ Boolean flag = settings.DEBUG_DISABLE_SPECIFIC_GROOVY_METHODS;
+ if (flag == null || flag.booleanValue()) {
+ return FILTERS;
+ }
+ return Collections.emptyList();
+ }
+
+}
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovyDebuggerSettings.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovyDebuggerSettings.java
new file mode 100644
index 000000000000..273fd4cb8531
--- /dev/null
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovyDebuggerSettings.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jetbrains.plugins.groovy.debugger;
+
+import com.intellij.openapi.components.State;
+import com.intellij.openapi.components.Storage;
+import com.intellij.openapi.components.StoragePathMacros;
+import com.intellij.openapi.options.Configurable;
+import com.intellij.openapi.util.registry.Registry;
+import com.intellij.util.xmlb.XmlSerializerUtil;
+import com.intellij.xdebugger.settings.XDebuggerSettings;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * @author ilyas
+ */
+@State(
+ name = "GroovyDebuggerSettings",
+ storages = {
+ @Storage(
+ file = StoragePathMacros.APP_CONFIG + "/groovy_debug.xml"
+ )}
+)
+public class GroovyDebuggerSettings extends XDebuggerSettings<GroovyDebuggerSettings> {
+ public Boolean DEBUG_DISABLE_SPECIFIC_GROOVY_METHODS = true;
+ public boolean ENABLE_GROOVY_HOTSWAP = Registry.is("enable.groovy.hotswap");
+
+ public GroovyDebuggerSettings() {
+ super("groovy_debugger");
+ }
+
+ @Override
+ @NotNull
+ public Configurable createConfigurable() {
+ return new GroovyDebuggerSettingsConfigurable(this);
+ }
+
+ @Nullable
+ @Override
+ public Configurable createConfigurable(@NotNull Category category) {
+ if (category == Category.STEPPING) {
+ return new GroovySteppingConfigurable();
+ }
+ return null;
+ }
+
+ @Override
+ public GroovyDebuggerSettings getState() {
+ return this;
+ }
+
+ @Override
+ public void loadState(final GroovyDebuggerSettings state) {
+ XmlSerializerUtil.copyBean(state, this);
+ }
+
+ public static GroovyDebuggerSettings getInstance() {
+ return getInstance(GroovyDebuggerSettings.class);
+ }
+} \ No newline at end of file
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovyDebuggerSettingsConfigurable.form b/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovyDebuggerSettingsConfigurable.form
new file mode 100644
index 000000000000..171170b00571
--- /dev/null
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovyDebuggerSettingsConfigurable.form
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="org.jetbrains.plugins.groovy.debugger.GroovyDebuggerSettingsConfigurable">
+ <grid id="27dc6" binding="myPanel" layout-manager="GridLayoutManager" row-count="3" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
+ <margin top="0" left="0" bottom="0" right="0"/>
+ <constraints>
+ <xy x="20" y="20" width="661" height="400"/>
+ </constraints>
+ <properties/>
+ <border type="none"/>
+ <children>
+ <vspacer id="30909">
+ <constraints>
+ <grid row="2" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
+ </constraints>
+ </vspacer>
+ <component id="908a2" class="com.intellij.ui.components.JBLabel">
+ <constraints>
+ <grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="3" use-parent-layout="false"/>
+ </constraints>
+ <properties>
+ <componentStyle value="SMALL"/>
+ <text value="May cause serialization issues in the debugged application"/>
+ </properties>
+ </component>
+ <grid id="bd4f0" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
+ <margin top="2" left="0" bottom="0" right="0"/>
+ <constraints>
+ <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
+ </constraints>
+ <properties/>
+ <border type="none"/>
+ <children>
+ <component id="ac312" class="javax.swing.JCheckBox" binding="myEnableHotSwap">
+ <constraints>
+ <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
+ </constraints>
+ <properties>
+ <text value="Enable &amp;hot-swap agent for Groovy code"/>
+ </properties>
+ </component>
+ </children>
+ </grid>
+ </children>
+ </grid>
+</form>
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovyDebuggerSettingsConfigurable.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovyDebuggerSettingsConfigurable.java
new file mode 100644
index 000000000000..8f143d9a5fd1
--- /dev/null
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovyDebuggerSettingsConfigurable.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jetbrains.plugins.groovy.debugger;
+
+import com.intellij.openapi.options.ConfigurationException;
+import com.intellij.openapi.options.SearchableConfigurable;
+import org.jetbrains.annotations.Nls;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.plugins.groovy.GroovyBundle;
+
+import javax.swing.*;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+/**
+ * @author ilyas
+ */
+public class GroovyDebuggerSettingsConfigurable implements SearchableConfigurable {
+ private JPanel myPanel;
+ private JCheckBox myEnableHotSwap;
+ private boolean isModified = false;
+ private final GroovyDebuggerSettings mySettings;
+
+ public GroovyDebuggerSettingsConfigurable(final GroovyDebuggerSettings settings) {
+ mySettings = settings;
+
+ myEnableHotSwap.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(final ActionEvent e) {
+ isModified = mySettings.ENABLE_GROOVY_HOTSWAP != myEnableHotSwap.isSelected();
+ }
+ });
+ }
+
+ @Override
+ @Nls
+ public String getDisplayName() {
+ return GroovyBundle.message("groovy.debug.caption");
+ }
+
+ @Override
+ @NotNull
+ public String getHelpTopic() {
+ return "reference.idesettings.debugger.groovy";
+ }
+
+ @Override
+ @NotNull
+ public String getId() {
+ return getHelpTopic();
+ }
+
+ @Override
+ public Runnable enableSearch(String option) {
+ return null;
+ }
+
+ @Override
+ public JComponent createComponent() {
+ return myPanel;
+ }
+
+ @Override
+ public boolean isModified() {
+ return isModified;
+ }
+
+ @Override
+ public void apply() throws ConfigurationException {
+ if (isModified) {
+ mySettings.ENABLE_GROOVY_HOTSWAP = myEnableHotSwap.isSelected();
+ }
+ isModified = false;
+ }
+
+ @Override
+ public void reset() {
+ myEnableHotSwap.setSelected(mySettings.ENABLE_GROOVY_HOTSWAP);
+ }
+
+ @Override
+ public void disposeUIResources() {
+ }
+}
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovyHotSwapper.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovyHotSwapper.java
index bd0398bf5dd1..95b93362c14d 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovyHotSwapper.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovyHotSwapper.java
@@ -41,7 +41,6 @@ import com.intellij.psi.util.PsiModificationTracker;
import com.intellij.util.PathUtil;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.plugins.groovy.GroovyFileType;
-import org.jetbrains.plugins.groovy.debugger.filters.GroovyDebuggerSettings;
import java.io.File;
import java.io.IOException;
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovySteppingConfigurable.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovySteppingConfigurable.java
new file mode 100644
index 000000000000..0e5d99552d47
--- /dev/null
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovySteppingConfigurable.java
@@ -0,0 +1,37 @@
+package org.jetbrains.plugins.groovy.debugger;
+
+import com.intellij.openapi.options.ConfigurableBase;
+import org.jetbrains.annotations.Nls;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+import org.jetbrains.plugins.groovy.GroovyBundle;
+
+class GroovySteppingConfigurable extends ConfigurableBase<GroovySteppingConfigurableUi, GroovyDebuggerSettings> {
+ @Override
+ protected GroovyDebuggerSettings getSettings() {
+ return GroovyDebuggerSettings.getInstance();
+ }
+
+ @Override
+ protected GroovySteppingConfigurableUi createUi() {
+ return new GroovySteppingConfigurableUi();
+ }
+
+ @NotNull
+ @Override
+ public String getId() {
+ return "debugger.stepping.groovy";
+ }
+
+ @Nls
+ @Override
+ public String getDisplayName() {
+ return GroovyBundle.message("groovy.debug.caption");
+ }
+
+ @Nullable
+ @Override
+ public String getHelpTopic() {
+ return "reference.idesettings.debugger.groovy";
+ }
+} \ No newline at end of file
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovySteppingConfigurableUi.form b/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovySteppingConfigurableUi.form
new file mode 100644
index 000000000000..ac93a675fc77
--- /dev/null
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovySteppingConfigurableUi.form
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="org.jetbrains.plugins.groovy.debugger.GroovySteppingConfigurableUi">
+ <grid id="27dc6" binding="rootPanel" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
+ <margin top="0" left="0" bottom="0" right="0"/>
+ <constraints>
+ <xy x="20" y="20" width="500" height="400"/>
+ </constraints>
+ <properties/>
+ <border type="none"/>
+ <children>
+ <component id="821e8" class="javax.swing.JCheckBox" binding="ignoreGroovyMethods">
+ <constraints>
+ <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
+ </constraints>
+ <properties>
+ <text resource-bundle="org/jetbrains/plugins/groovy/GroovyBundle" key="groovy.debug.disable.specific.methods"/>
+ </properties>
+ </component>
+ <vspacer id="209fe">
+ <constraints>
+ <grid row="1" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
+ </constraints>
+ </vspacer>
+ </children>
+ </grid>
+</form>
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovySteppingConfigurableUi.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovySteppingConfigurableUi.java
new file mode 100644
index 000000000000..d0e9e9e766cb
--- /dev/null
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovySteppingConfigurableUi.java
@@ -0,0 +1,33 @@
+package org.jetbrains.plugins.groovy.debugger;
+
+import com.intellij.openapi.options.ConfigurableUi;
+import org.jetbrains.annotations.NotNull;
+
+import javax.swing.*;
+
+class GroovySteppingConfigurableUi implements ConfigurableUi<GroovyDebuggerSettings> {
+ private JCheckBox ignoreGroovyMethods;
+ private JPanel rootPanel;
+
+ @Override
+ public void reset(@NotNull GroovyDebuggerSettings settings) {
+ Boolean flag = settings.DEBUG_DISABLE_SPECIFIC_GROOVY_METHODS;
+ ignoreGroovyMethods.setSelected(flag == null || flag.booleanValue());
+ }
+
+ @Override
+ public boolean isModified(@NotNull GroovyDebuggerSettings settings) {
+ return settings.DEBUG_DISABLE_SPECIFIC_GROOVY_METHODS.booleanValue() != ignoreGroovyMethods.isSelected();
+ }
+
+ @Override
+ public void apply(@NotNull GroovyDebuggerSettings settings) {
+ settings.DEBUG_DISABLE_SPECIFIC_GROOVY_METHODS = ignoreGroovyMethods.isSelected();
+ }
+
+ @NotNull
+ @Override
+ public JComponent getComponent() {
+ return rootPanel;
+ }
+} \ No newline at end of file
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/filters/GroovyDebuggerClassFilterProvider.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/filters/GroovyDebuggerClassFilterProvider.java
deleted file mode 100644
index 34830b9a8988..000000000000
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/filters/GroovyDebuggerClassFilterProvider.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright 2000-2014 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jetbrains.plugins.groovy.debugger.filters;
-
-import com.intellij.ui.classFilter.ClassFilter;
-import com.intellij.ui.classFilter.DebuggerClassFilterProvider;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * @author ilyas
- */
-public class GroovyDebuggerClassFilterProvider implements DebuggerClassFilterProvider {
- private static final List<ClassFilter> FILTERS = Arrays.asList(new ClassFilter("org.codehaus.groovy.*"), new ClassFilter("groovy.*"));
-
- @Override
- public List<ClassFilter> getFilters() {
- GroovyDebuggerSettings settings = GroovyDebuggerSettings.getInstance();
- Boolean flag = settings.DEBUG_DISABLE_SPECIFIC_GROOVY_METHODS;
- if (flag == null || flag.booleanValue()) {
- return FILTERS;
- }
- return Collections.emptyList();
- }
-
-}
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/filters/GroovyDebuggerSettings.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/filters/GroovyDebuggerSettings.java
deleted file mode 100644
index dbadd515c140..000000000000
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/filters/GroovyDebuggerSettings.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright 2000-2014 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jetbrains.plugins.groovy.debugger.filters;
-
-import com.intellij.openapi.components.State;
-import com.intellij.openapi.components.Storage;
-import com.intellij.openapi.components.StoragePathMacros;
-import com.intellij.openapi.options.Configurable;
-import com.intellij.openapi.util.registry.Registry;
-import com.intellij.util.xmlb.XmlSerializerUtil;
-import com.intellij.xdebugger.settings.XDebuggerSettings;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * @author ilyas
- */
-@State(
- name = "GroovyDebuggerSettings",
- storages = {
- @Storage(
- file = StoragePathMacros.APP_CONFIG + "/groovy_debug.xml"
- )}
-)
-public class GroovyDebuggerSettings extends XDebuggerSettings<GroovyDebuggerSettings> {
-
- public Boolean DEBUG_DISABLE_SPECIFIC_GROOVY_METHODS = true;
- public boolean ENABLE_GROOVY_HOTSWAP = Registry.is("enable.groovy.hotswap");
-
- public GroovyDebuggerSettings() {
- super("groovy_debugger");
- }
-
- @Override
- @NotNull
- public Configurable createConfigurable() {
- return new GroovyDebuggerSettingsConfigurable(this);
- }
-
- @Override
- public GroovyDebuggerSettings getState() {
- return this;
- }
-
- @Override
- public void loadState(final GroovyDebuggerSettings state) {
- XmlSerializerUtil.copyBean(state, this);
- }
-
- public static GroovyDebuggerSettings getInstance() {
- return getInstance(GroovyDebuggerSettings.class);
- }
-
-}
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/filters/GroovyDebuggerSettingsConfigurable.form b/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/filters/GroovyDebuggerSettingsConfigurable.form
deleted file mode 100644
index a91ac8c1dae7..000000000000
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/filters/GroovyDebuggerSettingsConfigurable.form
+++ /dev/null
@@ -1,53 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="org.jetbrains.plugins.groovy.debugger.filters.GroovyDebuggerSettingsConfigurable">
- <grid id="27dc6" binding="myPanel" layout-manager="GridLayoutManager" row-count="4" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
- <margin top="0" left="0" bottom="0" right="0"/>
- <constraints>
- <xy x="20" y="20" width="661" height="400"/>
- </constraints>
- <properties/>
- <border type="none"/>
- <children>
- <component id="84a2f" class="javax.swing.JCheckBox" binding="myIgnoreGroovyMethods">
- <constraints>
- <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
- </constraints>
- <properties>
- <text resource-bundle="org/jetbrains/plugins/groovy/GroovyBundle" key="groovy.debug.disable.specific.methods"/>
- </properties>
- </component>
- <vspacer id="30909">
- <constraints>
- <grid row="3" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
- </constraints>
- </vspacer>
- <component id="908a2" class="com.intellij.ui.components.JBLabel">
- <constraints>
- <grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="3" use-parent-layout="false"/>
- </constraints>
- <properties>
- <componentStyle value="SMALL"/>
- <text value="May cause serialization issues in the debugged application"/>
- </properties>
- </component>
- <grid id="bd4f0" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
- <margin top="2" left="0" bottom="0" right="0"/>
- <constraints>
- <grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
- </constraints>
- <properties/>
- <border type="none"/>
- <children>
- <component id="ac312" class="javax.swing.JCheckBox" binding="myEnableHotSwap">
- <constraints>
- <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
- </constraints>
- <properties>
- <text value="Enable &amp;hot-swap agent for Groovy code"/>
- </properties>
- </component>
- </children>
- </grid>
- </children>
- </grid>
-</form>
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/filters/GroovyDebuggerSettingsConfigurable.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/filters/GroovyDebuggerSettingsConfigurable.java
deleted file mode 100644
index 4638aca4bdc9..000000000000
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/filters/GroovyDebuggerSettingsConfigurable.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Copyright 2000-2014 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jetbrains.plugins.groovy.debugger.filters;
-
-import com.intellij.openapi.options.ConfigurationException;
-import com.intellij.openapi.options.SearchableConfigurable;
-import org.jetbrains.annotations.Nls;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.plugins.groovy.GroovyBundle;
-
-import javax.swing.*;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-
-/**
- * @author ilyas
- */
-public class GroovyDebuggerSettingsConfigurable implements SearchableConfigurable {
- private JCheckBox myIgnoreGroovyMethods;
- private JPanel myPanel;
- private JCheckBox myEnableHotSwap;
- private boolean isModified = false;
- private final GroovyDebuggerSettings mySettings;
-
- public GroovyDebuggerSettingsConfigurable(final GroovyDebuggerSettings settings) {
- mySettings = settings;
- final Boolean flag = settings.DEBUG_DISABLE_SPECIFIC_GROOVY_METHODS;
- myIgnoreGroovyMethods.setSelected(flag == null || flag.booleanValue());
- myIgnoreGroovyMethods.setSelected(mySettings.ENABLE_GROOVY_HOTSWAP);
-
- ActionListener listener = new ActionListener() {
- @Override
- public void actionPerformed(final ActionEvent e) {
- isModified = mySettings.DEBUG_DISABLE_SPECIFIC_GROOVY_METHODS.booleanValue() != myIgnoreGroovyMethods.isSelected() ||
- mySettings.ENABLE_GROOVY_HOTSWAP != myEnableHotSwap.isSelected();
- }
- };
- myIgnoreGroovyMethods.addActionListener(listener);
- myEnableHotSwap.addActionListener(listener);
- }
-
- @Override
- @Nls
- public String getDisplayName() {
- return GroovyBundle.message("groovy.debug.caption");
- }
-
- @Override
- public String getHelpTopic() {
- return "reference.idesettings.debugger.groovy";
- }
-
- @Override
- @NotNull
- public String getId() {
- return getHelpTopic();
- }
-
- @Override
- public Runnable enableSearch(String option) {
- return null;
- }
-
- @Override
- public JComponent createComponent() {
- return myPanel;
- }
-
- @Override
- public boolean isModified() {
- return isModified;
- }
-
- @Override
- public void apply() throws ConfigurationException {
- if (isModified) {
- mySettings.DEBUG_DISABLE_SPECIFIC_GROOVY_METHODS = myIgnoreGroovyMethods.isSelected();
- mySettings.ENABLE_GROOVY_HOTSWAP = myEnableHotSwap.isSelected();
- }
- isModified = false;
- }
-
- @Override
- public void reset() {
- final Boolean flag = mySettings.DEBUG_DISABLE_SPECIFIC_GROOVY_METHODS;
- myIgnoreGroovyMethods.setSelected(flag == null || flag.booleanValue());
- myEnableHotSwap.setSelected(mySettings.ENABLE_GROOVY_HOTSWAP);
- }
-
- @Override
- public void disposeUIResources() {
- }
-}
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/GrMethodMergingContributor.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/GrMethodMergingContributor.java
index e84361b0f57d..2c05dd7a3589 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/GrMethodMergingContributor.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/GrMethodMergingContributor.java
@@ -21,7 +21,6 @@ import com.intellij.codeInsight.lookup.LookupItem;
import com.intellij.psi.PsiMethod;
import com.intellij.psi.PsiParameter;
import com.intellij.psi.PsiType;
-import com.intellij.psi.ResolveResult;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.TypesUtil;
import org.jetbrains.plugins.groovy.lang.psi.util.GroovyCommonClassNames;
@@ -46,13 +45,9 @@ public class GrMethodMergingContributor extends CompletionContributor {
final LookupElement[] items = context.getItems();
if (items.length > 1) {
String commonName = null;
- LookupElement best = null;
final ArrayList<PsiMethod> allMethods = new ArrayList<PsiMethod>();
for (LookupElement item : items) {
- Object o = item.getObject();
- if (o instanceof ResolveResult) {
- o = ((ResolveResult)o).getElement();
- }
+ Object o = item.getPsiElement();
if (item.getUserData(LookupItem.FORCE_SHOW_SIGNATURE_ATTR) != null || !(o instanceof PsiMethod)) {
return AutoCompletionDecision.SHOW_LOOKUP;
}
@@ -76,17 +71,11 @@ public class GrMethodMergingContributor extends CompletionContributor {
return AutoCompletionDecision.SHOW_LOOKUP;
}
- if (best == null && method.getParameterList().getParametersCount() > 0) {
- best = item;
- }
commonName = name;
allMethods.add(method);
item.putUserData(JavaCompletionUtil.ALL_METHODS_ATTRIBUTE, allMethods);
}
- if (best == null) {
- best = items[0];
- }
- return AutoCompletionDecision.insertItem(best);
+ return AutoCompletionDecision.insertItem(JavaMethodMergingContributor.findBestOverload(items));
}
return super.handleAutoCompletionPossibility(context);
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/resolve/providers/GroovyReferenceContributor.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/resolve/providers/GroovyReferenceContributor.java
new file mode 100644
index 000000000000..626983ab635a
--- /dev/null
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/resolve/providers/GroovyReferenceContributor.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jetbrains.plugins.groovy.lang.resolve.providers;
+
+import com.intellij.patterns.PlatformPatterns;
+import com.intellij.psi.PsiReferenceContributor;
+import com.intellij.psi.PsiReferenceRegistrar;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.plugins.groovy.lang.psi.api.auxiliary.modifiers.annotation.GrAnnotationNameValuePair;
+import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.literals.GrLiteral;
+import org.jetbrains.plugins.groovy.lang.psi.patterns.GroovyPatterns;
+import org.jetbrains.plugins.groovy.spock.SpockUnrollReferenceProvider;
+
+/**
+ * @author Dmitry.Krasilschikov
+ */
+public class GroovyReferenceContributor extends PsiReferenceContributor {
+ @Override
+ public void registerReferenceProviders(@NotNull final PsiReferenceRegistrar registrar) {
+ registrar.registerReferenceProvider(PlatformPatterns.psiElement(GrLiteral.class), new PropertiesReferenceProvider());
+
+ registrar.registerReferenceProvider(GroovyPatterns.stringLiteral().withParent(GrAnnotationNameValuePair.class),
+ new SpockUnrollReferenceProvider());
+
+ }
+}
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/MvcModuleStructureUtil.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/MvcModuleStructureUtil.java
index e21a367eac62..2bfa261f420c 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/MvcModuleStructureUtil.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/MvcModuleStructureUtil.java
@@ -143,9 +143,15 @@ public class MvcModuleStructureUtil {
}
public static void removeSrcFolderFromRoots(final VirtualFile file,
- List<Consumer<ContentEntry>> actions,
- Map<VirtualFile, JpsModuleSourceRootType<?>> sourceRoots) {
- if (sourceRoots.containsKey(file)) {
+ @NotNull List<Consumer<ContentEntry>> actions,
+ @NotNull Map<VirtualFile, JpsModuleSourceRootType<?>> sourceRoots) {
+ removeSrcFolderFromRoots(file, actions, sourceRoots.keySet());
+ }
+
+ public static void removeSrcFolderFromRoots(final VirtualFile file,
+ @NotNull List<Consumer<ContentEntry>> actions,
+ @NotNull Collection<VirtualFile> sourceRoots) {
+ if (sourceRoots.contains(file)) {
actions.add(new Consumer<ContentEntry>() {
@Override
public void consume(ContentEntry contentEntry) {
@@ -163,7 +169,7 @@ public class MvcModuleStructureUtil {
@Nullable
public static Consumer<ModifiableRootModel> addJarDirectory(VirtualFile root, Module module, final String libName) {
final VirtualFile libDir = root.findFileByRelativePath("lib");
- if (libDir == null || !libDir.isDirectory() || ProjectRootManager.getInstance(module.getProject()).getFileIndex().isIgnored(libDir)) {
+ if (libDir == null || !libDir.isDirectory() || ProjectRootManager.getInstance(module.getProject()).getFileIndex().isExcluded(libDir)) {
return null;
}
@@ -350,16 +356,17 @@ public class MvcModuleStructureUtil {
private static void removeInvalidSourceRoots(List<Consumer<ModifiableRootModel>> actions, MvcProjectStructure structure) {
final Set<SourceFolder> toRemove = ContainerUtil.newTroveSet();
- final Set<ContentEntry> toRemoveContent = ContainerUtil.newTroveSet();
+ final Set<String> toRemoveContent = ContainerUtil.newTroveSet();
for (ContentEntry entry : ModuleRootManager.getInstance(structure.myModule).getContentEntries()) {
final VirtualFile file = entry.getFile();
if (file == null || !structure.isValidContentRoot(file)) {
- toRemoveContent.add(entry);
+ toRemoveContent.add(entry.getUrl());
}
-
- for (SourceFolder folder : entry.getSourceFolders()) {
- if (folder.getFile() == null) {
- toRemove.add(folder);
+ else {
+ for (SourceFolder folder : entry.getSourceFolders()) {
+ if (folder.getFile() == null) {
+ toRemove.add(folder);
+ }
}
}
}
@@ -368,14 +375,15 @@ public class MvcModuleStructureUtil {
actions.add(new Consumer<ModifiableRootModel>() {
@Override
public void consume(ModifiableRootModel model) {
- for (final ContentEntry entry : toRemoveContent) {
- model.removeContentEntry(entry);
- }
-
for (ContentEntry entry : model.getContentEntries()) {
- for (SourceFolder folder : entry.getSourceFolders()) {
- if (toRemove.remove(folder)) {
- entry.removeSourceFolder(folder);
+ if (toRemoveContent.remove(entry.getUrl())) {
+ model.removeContentEntry(entry);
+ }
+ else {
+ for (SourceFolder folder : entry.getSourceFolders()) {
+ if (toRemove.remove(folder)) {
+ entry.removeSourceFolder(folder);
+ }
}
}
}
diff --git a/plugins/groovy/structuralsearch-groovy/src/com/intellij/structuralsearch/GroovyEquivalenceDescriptorProvider.java b/plugins/groovy/structuralsearch-groovy/src/com/intellij/structuralsearch/GroovyEquivalenceDescriptorProvider.java
new file mode 100644
index 000000000000..3637b97c111d
--- /dev/null
+++ b/plugins/groovy/structuralsearch-groovy/src/com/intellij/structuralsearch/GroovyEquivalenceDescriptorProvider.java
@@ -0,0 +1,99 @@
+package com.intellij.structuralsearch;
+
+import com.intellij.dupLocator.equivalence.EquivalenceDescriptor;
+import com.intellij.dupLocator.equivalence.EquivalenceDescriptorBuilder;
+import com.intellij.dupLocator.equivalence.EquivalenceDescriptorProvider;
+import com.intellij.psi.PsiElement;
+import com.intellij.psi.tree.TokenSet;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.plugins.groovy.GroovyLanguage;
+import org.jetbrains.plugins.groovy.lang.lexer.TokenSets;
+import org.jetbrains.plugins.groovy.lang.psi.api.statements.GrVariable;
+import org.jetbrains.plugins.groovy.lang.psi.api.statements.GrVariableDeclaration;
+import org.jetbrains.plugins.groovy.lang.psi.api.statements.blocks.GrCodeBlock;
+import org.jetbrains.plugins.groovy.lang.psi.api.statements.clauses.GrForInClause;
+import org.jetbrains.plugins.groovy.lang.psi.api.statements.params.GrParameter;
+import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.GrReferenceList;
+import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.GrTypeDefinition;
+import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.GrTypeDefinitionBody;
+import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrMethod;
+import org.jetbrains.plugins.groovy.lang.psi.api.util.GrStatementOwner;
+
+/**
+ * @author Eugene.Kudelevsky
+ */
+public class GroovyEquivalenceDescriptorProvider extends EquivalenceDescriptorProvider {
+ private static final TokenSet IGNORED_TOKENS = TokenSet.orSet(TokenSets.WHITE_SPACES_OR_COMMENTS, TokenSets.SEPARATORS);
+
+ @Override
+ public boolean isMyContext(@NotNull PsiElement context) {
+ return context.getLanguage().isKindOf(GroovyLanguage.INSTANCE);
+ }
+
+ @Override
+ public EquivalenceDescriptor buildDescriptor(@NotNull PsiElement e) {
+ final EquivalenceDescriptorBuilder builder = new EquivalenceDescriptorBuilder();
+
+ if (e instanceof GrVariableDeclaration) {
+ return builder.elements(((GrVariableDeclaration)e).getVariables());
+ }
+ else if (e instanceof GrParameter) {
+ final GrParameter p = (GrParameter)e;
+ return builder
+ .element(p.getNameIdentifierGroovy())
+ .optionally(p.getTypeElementGroovy())
+ .optionallyInPattern(p.getInitializerGroovy());
+ }
+ else if (e instanceof GrVariable) {
+ final GrVariable v = (GrVariable)e;
+ return builder
+ .element(v.getNameIdentifierGroovy())
+ .optionally(v.getTypeElementGroovy())
+ .optionallyInPattern(v.getInitializerGroovy());
+ }
+ else if (e instanceof GrMethod) {
+ final GrMethod m = (GrMethod)e;
+ return builder
+ .element(m.getNameIdentifierGroovy())
+ .elements(m.getParameters())
+ .optionally(m.getReturnTypeElementGroovy())
+ .optionallyInPattern(m.getBlock());
+ }
+ else if (e instanceof GrTypeDefinitionBody) {
+ final GrTypeDefinitionBody b = (GrTypeDefinitionBody)e;
+ return builder
+ .inAnyOrder(b.getFields())
+ .inAnyOrder(b.getMethods())
+ .inAnyOrder(b.getInitializers())
+ .inAnyOrder(b.getInnerClasses());
+ }
+ else if (e instanceof GrTypeDefinition) {
+ GrTypeDefinition d = (GrTypeDefinition)e;
+ return builder.element(d.getNameIdentifierGroovy())
+ .optionallyInPattern(d.getExtendsClause())
+ .optionallyInPattern(d.getImplementsClause())
+ .optionallyInPattern(d.getBody());
+ }
+ else if (e instanceof GrForInClause) {
+ final GrForInClause f = (GrForInClause)e;
+ return builder
+ .element(f.getDeclaredVariable())
+ .element(f.getIteratedExpression());
+ }
+ else if (e instanceof GrReferenceList) {
+ return builder.inAnyOrder(((GrReferenceList)e).getReferenceElementsGroovy());
+ }
+ else if (e instanceof GrCodeBlock) {
+ return builder.codeBlock(((GrStatementOwner)e).getStatements());
+ }
+
+ // todo: support 'object method()' <-> 'object.method()'
+
+ return null;
+ }
+
+ @Override
+ public TokenSet getIgnoredTokens() {
+ return IGNORED_TOKENS;
+ }
+}
diff --git a/plugins/groovy/structuralsearch-groovy/structuralsearch-groovy.iml b/plugins/groovy/structuralsearch-groovy/structuralsearch-groovy.iml
index dbde3887908d..44183f613d0f 100644
--- a/plugins/groovy/structuralsearch-groovy/structuralsearch-groovy.iml
+++ b/plugins/groovy/structuralsearch-groovy/structuralsearch-groovy.iml
@@ -15,7 +15,7 @@
<orderEntry type="module" module-name="lang-impl" />
<orderEntry type="module" module-name="structuralsearch-tests" scope="TEST" />
<orderEntry type="module" module-name="testFramework-java" scope="TEST" />
- <orderEntry type="module" module-name="duplicates-analysis" scope="TEST" />
+ <orderEntry type="module" module-name="duplicates-analysis" />
</component>
</module>
diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/FastGroovyTestSuite.java b/plugins/groovy/test/org/jetbrains/plugins/groovy/FastGroovyTestSuite.java
index 42404baeec57..ec2d50c94355 100644
--- a/plugins/groovy/test/org/jetbrains/plugins/groovy/FastGroovyTestSuite.java
+++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/FastGroovyTestSuite.java
@@ -17,6 +17,7 @@ package org.jetbrains.plugins.groovy;
import com.intellij.TestAll;
import com.intellij.TestCaseLoader;
+import com.intellij.openapi.externalSystem.test.ExternalSystemTestCase;
import junit.framework.Test;
import junit.framework.TestSuite;
import org.jetbrains.plugins.groovy.compiler.GroovyCompilerTest;
@@ -45,7 +46,7 @@ public class FastGroovyTestSuite {
private static boolean isSlow(Class aClass) {
return aClass.equals(GroovyDebuggerTest.class) ||
aClass.equals(GroovyStressPerformanceTest.class) ||
- aClass.getName().startsWith(GroovyCompilerTest.class.getName());
+ aClass.getName().startsWith(GroovyCompilerTest.class.getName()) ||
+ ExternalSystemTestCase.class.isAssignableFrom(aClass);
}
-
}
diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/GrCommentTest.groovy b/plugins/groovy/test/org/jetbrains/plugins/groovy/GrCommentTest.groovy
index af16cc4ccb21..b6584bef6345 100644
--- a/plugins/groovy/test/org/jetbrains/plugins/groovy/GrCommentTest.groovy
+++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/GrCommentTest.groovy
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -15,11 +15,11 @@
*/
package org.jetbrains.plugins.groovy
-import com.intellij.codeInsight.actions.CodeInsightAction
import com.intellij.codeInsight.generation.actions.CommentByBlockCommentAction
import com.intellij.codeInsight.generation.actions.CommentByLineCommentAction
import com.intellij.ide.DataManager
import com.intellij.openapi.actionSystem.ActionManager
+import com.intellij.openapi.actionSystem.AnAction
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.actionSystem.DataContext
import org.jetbrains.annotations.NotNull
@@ -100,7 +100,7 @@ print 2
doTest(before, after, new CommentByBlockCommentAction())
}
- private void doTest(@NotNull String before, @NotNull String after, final CodeInsightAction action) {
+ private void doTest(@NotNull String before, @NotNull String after, final AnAction action) {
myFixture.configureByText(GroovyFileType.GROOVY_FILE_TYPE, before)
final DataContext dataContext = DataManager.instance.dataContextFromFocus.result
action.actionPerformed(new AnActionEvent(null, dataContext, "", action.templatePresentation, ActionManager.instance, 0));
diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/completion/GroovyCompletionTest.groovy b/plugins/groovy/test/org/jetbrains/plugins/groovy/completion/GroovyCompletionTest.groovy
index d6293f2e01d5..061f941ea1a0 100644
--- a/plugins/groovy/test/org/jetbrains/plugins/groovy/completion/GroovyCompletionTest.groovy
+++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/completion/GroovyCompletionTest.groovy
@@ -1923,4 +1923,10 @@ var.<caret>
''', '', CompletionType.BASIC, CompletionResult.contain, 1, 'A__foo', 'bar')
}
+ void testCharsetName() {
+ myFixture.addClass("package java.nio.charset; public class Charset { public static boolean isSupported(String s) {} }")
+ doVariantableTest('import java.nio.charset.*; Charset.isSupported("<caret>")', '', CompletionType.BASIC, CompletionResult.contain, 1, 'UTF-8')
+ }
+
+
} \ No newline at end of file
diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/findUsages/FindUsagesTest.groovy b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/findUsages/FindUsagesTest.groovy
index abc454f356e5..6ee91ef2581f 100644
--- a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/findUsages/FindUsagesTest.groovy
+++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/findUsages/FindUsagesTest.groovy
@@ -429,7 +429,7 @@ print a<caret>a
}
void testTraitField() {
- doTest(6, '''
+ doTest(4, '''
trait T {
public int fi<caret>eld = 4
@@ -439,16 +439,16 @@ trait T {
}
}
-class C extends T {
- def abc {
- print field
+class C implements T {
+ def abc() {
+ print field //unresolved
print T__field
}
}
new C().T__field
-new C().field
+new C().field //unresolved
''')
}
diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/resolve/TypeInference2_3Test.groovy b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/resolve/TypeInference2_3Test.groovy
index 7382469e50e4..e6882d70258b 100644
--- a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/resolve/TypeInference2_3Test.groovy
+++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/resolve/TypeInference2_3Test.groovy
@@ -15,6 +15,7 @@
*/
package org.jetbrains.plugins.groovy.lang.resolve
+import com.intellij.psi.PsiMethod
import com.intellij.testFramework.LightProjectDescriptor
import org.jetbrains.plugins.groovy.GroovyLightProjectDescriptor
@@ -205,4 +206,15 @@ class Thing {
}
+ void testClosureParamsUsingGenerics() {
+ doTest("""\
+ import groovy.transform.CompileStatic
+
+ @CompileStatic
+ class Idea {
+ public static void main(String[] args) {
+ ["bc", "a", ].sort { i<caret>t.size() }
+ }
+ }""", "java.lang.String")
+ }
}
diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/execution/HgCommandAuthenticator.java b/plugins/hg4idea/src/org/zmlx/hg4idea/execution/HgCommandAuthenticator.java
index 14f6c981777b..1d41cdc688f9 100644
--- a/plugins/hg4idea/src/org/zmlx/hg4idea/execution/HgCommandAuthenticator.java
+++ b/plugins/hg4idea/src/org/zmlx/hg4idea/execution/HgCommandAuthenticator.java
@@ -35,7 +35,7 @@ import org.zmlx.hg4idea.HgVcsMessages;
class HgCommandAuthenticator {
private static final Logger LOG = Logger.getInstance(HgCommandAuthenticator.class.getName());
-
+
private GetPasswordRunnable myGetPassword;
private final Project myProject;
private boolean myForceAuthorization;
@@ -71,7 +71,7 @@ class HgCommandAuthenticator {
}
public boolean promptForAuthentication(Project project, String proposedLogin, String uri, String path, @Nullable ModalityState state) {
- GetPasswordRunnable runnable = new GetPasswordRunnable(project, proposedLogin, uri, path, myForceAuthorization);
+ GetPasswordRunnable runnable = new GetPasswordRunnable(project, proposedLogin, uri, path, myForceAuthorization, state);
ApplicationManager.getApplication().invokeAndWait(runnable, state == null ? ModalityState.defaultModalityState() : state);
myGetPassword = runnable;
return runnable.isOk();
@@ -96,14 +96,21 @@ class HgCommandAuthenticator {
@Nullable private String myURL;
private boolean myRememberPassword;
private boolean myForceAuthorization;
-
- public GetPasswordRunnable(Project project, String proposedLogin, String uri, String path, boolean forceAuthorization) {
+ @Nullable private ModalityState myState;
+
+ public GetPasswordRunnable(Project project,
+ String proposedLogin,
+ String uri,
+ String path,
+ boolean forceAuthorization,
+ @Nullable ModalityState state) {
this.myProject = project;
this.myProposedLogin = proposedLogin;
this.myURL = uri + path;
this.myForceAuthorization = forceAuthorization;
+ myState = state;
}
-
+
public void run() {
// find if we've already been here
@@ -128,11 +135,9 @@ class HgCommandAuthenticator {
final String key = keyForUrlAndLogin(myURL, login);
try {
final PasswordSafeImpl passwordSafe = (PasswordSafeImpl)PasswordSafe.getInstance();
- password = passwordSafe.getMemoryProvider().getPassword(myProject, HgCommandAuthenticator.class, key);
- if (password == null) {
- password = passwordSafe.getPassword(myProject, HgCommandAuthenticator.class, key);
- }
- } catch (PasswordSafeException e) {
+ password = passwordSafe.getPassword(myProject, HgCommandAuthenticator.class, key, myState);
+ }
+ catch (PasswordSafeException e) {
LOG.info("Couldn't get password for key [" + key + "]", e);
}
}
diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/log/HgRefManager.java b/plugins/hg4idea/src/org/zmlx/hg4idea/log/HgRefManager.java
index 9fa266e560a1..8a5949140d23 100644
--- a/plugins/hg4idea/src/org/zmlx/hg4idea/log/HgRefManager.java
+++ b/plugins/hg4idea/src/org/zmlx/hg4idea/log/HgRefManager.java
@@ -90,17 +90,10 @@ public class HgRefManager implements VcsLogRefManager {
}
};
-/*
- public HgRefManager(@NotNull RepositoryManager<HgRepository> repositoryManager) {
- myRepositoryManager = repositoryManager;
- }*/
-
@NotNull
@Override
- public List<VcsRef> sort(Collection<VcsRef> refs) {
- ArrayList<VcsRef> list = new ArrayList<VcsRef>(refs);
- Collections.sort(list, REF_COMPARATOR);
- return list;
+ public Comparator<VcsRef> getComparator() {
+ return REF_COMPARATOR;
}
@NotNull
@@ -114,6 +107,11 @@ public class HgRefManager implements VcsLogRefManager {
});
}
+ @NotNull
+ private Collection<VcsRef> sort(@NotNull Collection<VcsRef> refs) {
+ return ContainerUtil.sorted(refs, getComparator());
+ }
+
private static class SimpleRefType implements VcsRefType {
private final boolean myIsBranch;
@NotNull private final Color myColor;
diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/provider/update/HgUpdateEnvironment.java b/plugins/hg4idea/src/org/zmlx/hg4idea/provider/update/HgUpdateEnvironment.java
index 4052b34a60d5..038c1c24121f 100644
--- a/plugins/hg4idea/src/org/zmlx/hg4idea/provider/update/HgUpdateEnvironment.java
+++ b/plugins/hg4idea/src/org/zmlx/hg4idea/provider/update/HgUpdateEnvironment.java
@@ -99,7 +99,7 @@ public class HgUpdateEnvironment implements UpdateEnvironment {
}
public String getHelpTopic() {
- return null;
+ return "reference.VersionControl.Mercurial.UpdateProject";
}
public JComponent createComponent() {
diff --git a/plugins/java-decompiler/lib/fernflower.jar b/plugins/java-decompiler/lib/fernflower.jar
index 85b1c40002b5..d8589afbb097 100644
--- a/plugins/java-decompiler/lib/fernflower.jar
+++ b/plugins/java-decompiler/lib/fernflower.jar
Binary files differ
diff --git a/plugins/java-decompiler/src/org/jetbrains/java/decompiler/IdeaDecompiler.java b/plugins/java-decompiler/src/org/jetbrains/java/decompiler/IdeaDecompiler.java
index bf0454fd6670..f57ea6a4087b 100644
--- a/plugins/java-decompiler/src/org/jetbrains/java/decompiler/IdeaDecompiler.java
+++ b/plugins/java-decompiler/src/org/jetbrains/java/decompiler/IdeaDecompiler.java
@@ -138,7 +138,9 @@ public class IdeaDecompiler extends ClassFileDecompilers.Light {
}
}, ClassReader.SKIP_CODE);
}
- catch (IOException ignore) { }
+ catch (Exception e) {
+ throw new RuntimeException("corrupted file: " + file.getUrl(), e);
+ }
if (isGroovy.get()) {
LOG.info("skipped Groovy class: " + file.getUrl());
return false;
diff --git a/plugins/java-decompiler/test/org/jetbrains/java/decompiler/IdeaDecompilerTest.java b/plugins/java-decompiler/test/org/jetbrains/java/decompiler/IdeaDecompilerTest.java
index 9367fc066f30..060b269789e3 100644
--- a/plugins/java-decompiler/test/org/jetbrains/java/decompiler/IdeaDecompilerTest.java
+++ b/plugins/java-decompiler/test/org/jetbrains/java/decompiler/IdeaDecompilerTest.java
@@ -40,10 +40,7 @@ public class IdeaDecompilerTest extends LightCodeInsightFixtureTestCase {
VirtualFile file = StandardFileSystems.jar().findFileByPath(path);
assertNotNull(path, file);
- CharSequence text = new IdeaDecompiler().getText(file);
- assertNotNull(text);
-
- String decompiled = text.toString();
+ String decompiled = new IdeaDecompiler().getText(file).toString();
assertTrue(decompiled, decompiled.contains("public final class String"));
assertTrue(decompiled, decompiled.contains("@deprecated"));
assertTrue(decompiled, decompiled.contains("private static class CaseInsensitiveComparator"));
@@ -57,6 +54,7 @@ public class IdeaDecompilerTest extends LightCodeInsightFixtureTestCase {
public void testParameters() { doTestDecompiler(); }
public void testConstants() { doTestDecompiler(); }
public void testAnonymous() { doTestDecompiler(); }
+ public void testCodeConstructs() { doTestDecompiler(); }
private void doTestDecompiler() {
String name = PluginPathManager.getPluginHomePath("java-decompiler") + "/testData/" + getName().substring(4);
@@ -103,7 +101,6 @@ public class IdeaDecompilerTest extends LightCodeInsightFixtureTestCase {
VfsUtilCore.visitChildrenRecursively(root, new VirtualFileVisitor() {
@Override
public boolean visitFile(@NotNull VirtualFile file) {
- if (file.getName().equals("Jps.class")) return true; // temp. fix
if (!file.isDirectory() && file.getFileType() == StdFileTypes.CLASS && !file.getName().contains("$")) {
PsiFile clsFile = getPsiManager().findFile(file);
assertNotNull(file.getPath(), clsFile);
diff --git a/plugins/java-decompiler/testData/CodeConstructs.class b/plugins/java-decompiler/testData/CodeConstructs.class
new file mode 100644
index 000000000000..bcac6685eb01
--- /dev/null
+++ b/plugins/java-decompiler/testData/CodeConstructs.class
Binary files differ
diff --git a/plugins/java-decompiler/testData/CodeConstructs.java b/plugins/java-decompiler/testData/CodeConstructs.java
new file mode 100644
index 000000000000..d0c2e35311c8
--- /dev/null
+++ b/plugins/java-decompiler/testData/CodeConstructs.java
@@ -0,0 +1,5 @@
+class CodeConstructs {
+ void expressions() {
+ new String().hashCode();
+ }
+} \ No newline at end of file
diff --git a/plugins/java-decompiler/testData/CodeConstructs.txt b/plugins/java-decompiler/testData/CodeConstructs.txt
new file mode 100644
index 000000000000..59bc71849dd6
--- /dev/null
+++ b/plugins/java-decompiler/testData/CodeConstructs.txt
@@ -0,0 +1,15 @@
+//
+// Source code recreated from a .class file by IntelliJ IDEA
+// (powered by Fernflower decompiler)
+//
+
+
+class CodeConstructs {
+
+ CodeConstructs() {
+ }
+
+ void expressions() {
+ (new String()).hashCode();
+ }
+}
diff --git a/plugins/java-i18n/src/com/intellij/codeInspection/duplicateStringLiteral/DuplicateStringLiteralInspection.java b/plugins/java-i18n/src/com/intellij/codeInspection/duplicateStringLiteral/DuplicateStringLiteralInspection.java
index ce785c3df593..4efa0639e645 100644
--- a/plugins/java-i18n/src/com/intellij/codeInspection/duplicateStringLiteral/DuplicateStringLiteralInspection.java
+++ b/plugins/java-i18n/src/com/intellij/codeInspection/duplicateStringLiteral/DuplicateStringLiteralInspection.java
@@ -20,6 +20,7 @@ import com.intellij.codeInsight.daemon.GroupNames;
import com.intellij.codeInspection.*;
import com.intellij.codeInspection.ex.BaseLocalInspectionTool;
import com.intellij.codeInspection.i18n.JavaI18nUtil;
+import com.intellij.lang.java.JavaLanguage;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.progress.ProgressIndicator;
@@ -133,13 +134,19 @@ public class DuplicateStringLiteralInspection extends BaseLocalInspectionTool {
}
if (resultFiles.isEmpty()) return;
}
+
if (resultFiles == null || resultFiles.isEmpty()) return;
final List<PsiExpression> foundExpr = new ArrayList<PsiExpression>();
+
for (PsiFile file : resultFiles) {
progress.checkCanceled();
- CharSequence text = file.getViewProvider().getContents();
+ FileViewProvider viewProvider = file.getViewProvider();
+ // important: skip non-java files with given word in literal (IDEA-126201)
+ if (viewProvider.getPsi(JavaLanguage.INSTANCE) == null) continue;
+ CharSequence text = viewProvider.getContents();
final char[] textArray = CharArrayUtil.fromSequenceWithoutCopying(text);
StringSearcher searcher = new StringSearcher(stringToFind, true, true);
+
for (int offset = LowLevelSearchUtil.searchWord(text, textArray, 0, text.length(), searcher, progress);
offset >= 0;
offset = LowLevelSearchUtil.searchWord(text, textArray, offset + searcher.getPattern().length(), text.length(), searcher, progress)
diff --git a/plugins/javaFX/src/META-INF/common-javaFX-plugin.xml b/plugins/javaFX/src/META-INF/common-javaFX-plugin.xml
index c03a5f4bff9c..1256121f509f 100644
--- a/plugins/javaFX/src/META-INF/common-javaFX-plugin.xml
+++ b/plugins/javaFX/src/META-INF/common-javaFX-plugin.xml
@@ -25,7 +25,7 @@
enabledByDefault="true" level="WARNING" displayName="JavaFX unused imports" groupName="JavaFX"/>
<applicationService serviceInterface="org.jetbrains.plugins.javaFX.JavaFxSettings" serviceImplementation="org.jetbrains.plugins.javaFX.JavaFxSettings"/>
- <applicationConfigurable instance="org.jetbrains.plugins.javaFX.JavaFxSettingsConfigurable"/>
+ <applicationConfigurable groupId="language" displayName="JavaFX" instance="org.jetbrains.plugins.javaFX.JavaFxSettingsConfigurable"/>
<fileBasedIndex implementation="org.jetbrains.plugins.javaFX.JavaFxControllerClassIndex"/>
<fileBasedIndex implementation="org.jetbrains.plugins.javaFX.JavaFxIdsIndex"/>
<fileBasedIndex implementation="org.jetbrains.plugins.javaFX.JavaFxCustomComponentsIndex"/>
diff --git a/plugins/junit/src/com/intellij/execution/junit2/configuration/JUnitConfigurable.java b/plugins/junit/src/com/intellij/execution/junit2/configuration/JUnitConfigurable.java
index d1ff8d5a9792..07e578bae6c8 100644
--- a/plugins/junit/src/com/intellij/execution/junit2/configuration/JUnitConfigurable.java
+++ b/plugins/junit/src/com/intellij/execution/junit2/configuration/JUnitConfigurable.java
@@ -394,7 +394,7 @@ public class JUnitConfigurable extends SettingsEditor<JUnitConfiguration> implem
@Override
public Visibility isDeclarationVisible(PsiElement declaration, PsiElement place) {
try {
- if (declaration instanceof PsiClass && classBrowser.getFilter().isAccepted(((PsiClass)declaration))) {
+ if (declaration instanceof PsiClass && (classBrowser.getFilter().isAccepted(((PsiClass)declaration)) || classBrowser.findClass(((PsiClass)declaration).getQualifiedName()) != null && place.getParent() != null)) {
return Visibility.VISIBLE;
}
}
diff --git a/plugins/junit/src/com/intellij/execution/junit2/configuration/JUnitConfigurationModel.java b/plugins/junit/src/com/intellij/execution/junit2/configuration/JUnitConfigurationModel.java
index 38a3ff9915e3..fe5a13181ab9 100644
--- a/plugins/junit/src/com/intellij/execution/junit2/configuration/JUnitConfigurationModel.java
+++ b/plugins/junit/src/com/intellij/execution/junit2/configuration/JUnitConfigurationModel.java
@@ -172,7 +172,7 @@ public class JUnitConfigurationModel {
final JUnitConfiguration.Data data = configuration.getPersistentData();
setTestType(data.TEST_OBJECT);
setJUnitTextValue(ALL_IN_PACKAGE, data.getPackageName());
- setJUnitTextValue(CLASS, data.getMainClassName());
+ setJUnitTextValue(CLASS, data.getMainClassName().replaceAll("\\$", "\\."));
setJUnitTextValue(METHOD, data.getMethodName());
setJUnitTextValue(PATTERN, data.getPatternPresentation());
setJUnitTextValue(DIR, data.getDirName());
diff --git a/plugins/maven/src/main/resources/META-INF/plugin.xml b/plugins/maven/src/main/resources/META-INF/plugin.xml
index 960cb1c5df24..0261f132277c 100644
--- a/plugins/maven/src/main/resources/META-INF/plugin.xml
+++ b/plugins/maven/src/main/resources/META-INF/plugin.xml
@@ -46,7 +46,7 @@
<applicationService serviceImplementation="org.jetbrains.idea.maven.indices.MavenIndicesManager"/>
<applicationService serviceImplementation="org.jetbrains.idea.maven.services.MavenRepositoryServicesManager"/>
- <projectConfigurable instance="org.jetbrains.idea.maven.utils.MavenSettings" id="MavenSettings" displayName="Maven" order="last">
+ <projectConfigurable groupId="build" instance="org.jetbrains.idea.maven.utils.MavenSettings" id="MavenSettings" displayName="Maven" order="last">
<configurable instance="org.jetbrains.idea.maven.project.MavenImportingConfigurable" id="reference.settings.project.maven.importing"
key="maven.tab.importing" bundle="ProjectBundle"/>
<configurable instance="org.jetbrains.idea.maven.project.MavenIgnoredFilesConfigurable"
diff --git a/plugins/properties/properties-psi-impl/src/com/intellij/codeInspection/unused/UnusedPropertyInspection.java b/plugins/properties/properties-psi-impl/src/com/intellij/codeInspection/unused/UnusedPropertyInspection.java
index 53e241ef24bd..603833887b38 100644
--- a/plugins/properties/properties-psi-impl/src/com/intellij/codeInspection/unused/UnusedPropertyInspection.java
+++ b/plugins/properties/properties-psi-impl/src/com/intellij/codeInspection/unused/UnusedPropertyInspection.java
@@ -20,9 +20,7 @@ import com.intellij.codeInspection.LocalQuickFix;
import com.intellij.codeInspection.ProblemHighlightType;
import com.intellij.codeInspection.ProblemsHolder;
import com.intellij.lang.ASTNode;
-import com.intellij.lang.properties.PropertiesBundle;
-import com.intellij.lang.properties.PropertiesQuickFixFactory;
-import com.intellij.lang.properties.PropertySuppressableInspectionBase;
+import com.intellij.lang.properties.*;
import com.intellij.lang.properties.findUsages.PropertySearcher;
import com.intellij.lang.properties.psi.Property;
import com.intellij.openapi.extensions.Extensions;
@@ -30,6 +28,7 @@ import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleUtilCore;
import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.progress.ProgressManager;
+import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiElementVisitor;
import com.intellij.psi.PsiFile;
@@ -39,6 +38,10 @@ import com.intellij.psi.search.searches.ReferencesSearch;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.containers.FilteringIterator;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.List;
+import java.util.Set;
/**
* @author cdr
@@ -56,18 +59,44 @@ public class UnusedPropertyInspection extends PropertySuppressableInspectionBase
return "UnusedProperty";
}
+ @Nullable
+ private static GlobalSearchScope getWidestUseScope(@Nullable String key, @NotNull Project project, @NotNull Module ownModule) {
+ if (key == null) return null;
+
+ Set<Module> modules = ContainerUtil.newLinkedHashSet();
+ for (IProperty property : PropertiesImplUtil.findPropertiesByKey(project, key)) {
+ Module module = ModuleUtilCore.findModuleForPsiElement(property.getPsiElement());
+ if (module == null) {
+ return GlobalSearchScope.allScope(project);
+ }
+ if (module != ownModule) {
+ modules.add(module);
+ }
+ }
+ if (modules.isEmpty()) return null;
+
+ List<Module> list = ContainerUtil.newArrayList(modules);
+ GlobalSearchScope result = GlobalSearchScope.moduleWithDependentsScope(list.get(0));
+ for (int i = 1; i < list.size(); i++) {
+ result = result.uniteWith(GlobalSearchScope.moduleWithDependentsScope(list.get(i)));
+ }
+ return result;
+ }
+
@NotNull
@Override
public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder,
final boolean isOnTheFly,
@NotNull final LocalInspectionToolSession session) {
final PsiFile file = session.getFile();
- Module module = ModuleUtilCore.findModuleForPsiElement(file);
+ final Module module = ModuleUtilCore.findModuleForPsiElement(file);
if (module == null) return super.buildVisitor(holder, isOnTheFly, session);
+
+ final GlobalSearchScope ownUseScope = GlobalSearchScope.moduleWithDependentsScope(module);
+
Object[] extensions = Extensions.getExtensions("com.intellij.referencesSearch");
final PropertySearcher searcher =
(PropertySearcher)ContainerUtil.find(extensions, new FilteringIterator.InstanceOf<PropertySearcher>(PropertySearcher.class));
- final GlobalSearchScope searchScope = GlobalSearchScope.moduleWithDependentsScope(module);
final PsiSearchHelper searchHelper = PsiSearchHelper.SERVICE.getInstance(file.getProject());
return new PsiElementVisitor() {
@Override
@@ -90,13 +119,10 @@ public class UnusedPropertyInspection extends PropertySuppressableInspectionBase
if (name == null) return;
}
- PsiSearchHelper.SearchCostResult cheapEnough = searchHelper.isCheapEnoughToSearch(name, searchScope, file, original);
- if (cheapEnough == PsiSearchHelper.SearchCostResult.TOO_MANY_OCCURRENCES) return;
+ if (mayHaveUsages(property, original, name, ownUseScope)) return;
- if (cheapEnough != PsiSearchHelper.SearchCostResult.ZERO_OCCURRENCES &&
- ReferencesSearch.search(property, searchScope, false).findFirst() != null) {
- return;
- }
+ final GlobalSearchScope widerScope = getWidestUseScope(property.getKey(), element.getProject(), module);
+ if (widerScope != null && mayHaveUsages(property, original, name, widerScope)) return;
final ASTNode propertyNode = property.getNode();
assert propertyNode != null;
@@ -108,6 +134,17 @@ public class UnusedPropertyInspection extends PropertySuppressableInspectionBase
LocalQuickFix fix = PropertiesQuickFixFactory.getInstance().createRemovePropertyLocalFix();
holder.registerProblem(key, description, ProblemHighlightType.LIKE_UNUSED_SYMBOL, fix);
}
+
+ private boolean mayHaveUsages(Property property, ProgressIndicator original, String name, GlobalSearchScope searchScope) {
+ PsiSearchHelper.SearchCostResult cheapEnough = searchHelper.isCheapEnoughToSearch(name, searchScope, file, original);
+ if (cheapEnough == PsiSearchHelper.SearchCostResult.TOO_MANY_OCCURRENCES) return true;
+
+ if (cheapEnough != PsiSearchHelper.SearchCostResult.ZERO_OCCURRENCES &&
+ ReferencesSearch.search(property, searchScope, false).findFirst() != null) {
+ return true;
+ }
+ return false;
+ }
};
}
}
diff --git a/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/PropertiesImplUtil.java b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/PropertiesImplUtil.java
index 5908219098b7..b29fc4f78141 100644
--- a/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/PropertiesImplUtil.java
+++ b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/PropertiesImplUtil.java
@@ -28,13 +28,14 @@ import com.intellij.psi.PsiDirectory;
import com.intellij.psi.PsiFile;
import com.intellij.psi.PsiManager;
import com.intellij.psi.search.GlobalSearchScope;
-import com.intellij.util.ArrayUtil;
-import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.indexing.FileBasedIndex;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
/**
* @author Konstantin Bulenkov
@@ -64,7 +65,7 @@ public class PropertiesImplUtil extends PropertiesUtil {
if (baseName.equals(getBaseName(psiFile))) {
final PropertiesFile propertiesFile = getPropertiesFile(psiFile);
if (propertiesFile != null) {
- if (defaultPropertiesFile == null || defaultPropertiesFile.getName().compareTo(propertiesFile.getName()) < 0) {
+ if (defaultPropertiesFile == null || defaultPropertiesFile.getName().compareTo(propertiesFile.getName()) > 0) {
defaultPropertiesFile = propertiesFile;
}
}
@@ -91,7 +92,7 @@ public class PropertiesImplUtil extends PropertiesUtil {
}
@NotNull
- public static List<IProperty> findPropertiesByKey(final Project project, final String key) {
+ public static List<IProperty> findPropertiesByKey(@NotNull final Project project, @NotNull final String key) {
final GlobalSearchScope scope = GlobalSearchScope.allScope(project);
final ArrayList<IProperty> properties =
new ArrayList<IProperty>(PropertyKeyIndex.getInstance().get(key, project, scope));
diff --git a/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/editor/ResourceBundleEditorViewElement.java b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/editor/ResourceBundleEditorViewElement.java
index 00c21d8d3811..58932d1fd4c5 100644
--- a/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/editor/ResourceBundleEditorViewElement.java
+++ b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/editor/ResourceBundleEditorViewElement.java
@@ -25,6 +25,6 @@ import org.jetbrains.annotations.NotNull;
*/
public interface ResourceBundleEditorViewElement {
- PsiElement[] getPsiElements(@NotNull Project project);
+ PsiElement[] getPsiElements();
}
diff --git a/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/editor/ResourceBundleFileStructureViewElement.java b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/editor/ResourceBundleFileStructureViewElement.java
index 25220d35311a..ee3e22b7079d 100644
--- a/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/editor/ResourceBundleFileStructureViewElement.java
+++ b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/editor/ResourceBundleFileStructureViewElement.java
@@ -25,7 +25,6 @@ import com.intellij.lang.properties.IProperty;
import com.intellij.lang.properties.ResourceBundle;
import com.intellij.lang.properties.psi.PropertiesFile;
import com.intellij.navigation.ItemPresentation;
-import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiElement;
import com.intellij.util.Function;
import com.intellij.util.containers.ContainerUtil;
@@ -88,7 +87,7 @@ public class ResourceBundleFileStructureViewElement implements StructureViewTree
}
@Override
- public PsiElement[] getPsiElements(@NotNull Project project) {
+ public PsiElement[] getPsiElements() {
final List<PropertiesFile> propertiesFiles = getValue().getPropertiesFiles();
return ContainerUtil.map2Array(propertiesFiles, new PsiElement[propertiesFiles.size()], new Function<PropertiesFile, PsiElement>() {
@Override
diff --git a/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/editor/ResourceBundlePropertyStructureViewElement.java b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/editor/ResourceBundlePropertyStructureViewElement.java
index 8b387e802597..ed660536d052 100644
--- a/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/editor/ResourceBundlePropertyStructureViewElement.java
+++ b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/editor/ResourceBundlePropertyStructureViewElement.java
@@ -29,7 +29,6 @@ import com.intellij.navigation.ItemPresentation;
import com.intellij.openapi.editor.colors.EditorColorsManager;
import com.intellij.openapi.editor.colors.TextAttributesKey;
import com.intellij.openapi.editor.markup.TextAttributes;
-import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiElement;
import com.intellij.util.PlatformIcons;
import org.jetbrains.annotations.NotNull;
@@ -61,7 +60,7 @@ public class ResourceBundlePropertyStructureViewElement implements StructureView
}
@Override
- public PsiElement[] getPsiElements(final @NotNull Project project) {
+ public PsiElement[] getPsiElements() {
return new PsiElement[] {getProperty().getPsiElement()};
}
diff --git a/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/structureView/PropertiesFileStructureViewElement.java b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/structureView/PropertiesFileStructureViewElement.java
index 432739c9df96..2e6c87b9d7a3 100644
--- a/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/structureView/PropertiesFileStructureViewElement.java
+++ b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/structureView/PropertiesFileStructureViewElement.java
@@ -22,7 +22,6 @@ import com.intellij.lang.properties.editor.ResourceBundleEditorViewElement;
import com.intellij.lang.properties.psi.Property;
import com.intellij.lang.properties.psi.impl.PropertiesFileImpl;
import com.intellij.navigation.ItemPresentation;
-import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiElement;
import org.jetbrains.annotations.NotNull;
@@ -52,7 +51,7 @@ public class PropertiesFileStructureViewElement extends PsiTreeElementBase<Prope
}
@Override
- public PsiElement[] getPsiElements(@NotNull Project project) {
+ public PsiElement[] getPsiElements() {
return new PsiElement[] {getValue()};
}
diff --git a/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/structureView/PropertiesPrefixGroup.java b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/structureView/PropertiesPrefixGroup.java
index 8aedbcbbd85d..61b3c0202619 100644
--- a/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/structureView/PropertiesPrefixGroup.java
+++ b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/structureView/PropertiesPrefixGroup.java
@@ -22,11 +22,9 @@ import com.intellij.lang.properties.IProperty;
import com.intellij.lang.properties.editor.ResourceBundleEditorViewElement;
import com.intellij.lang.properties.editor.ResourceBundlePropertyStructureViewElement;
import com.intellij.navigation.ItemPresentation;
-import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.PsiElement;
-import com.intellij.util.Function;
import com.intellij.util.NullableFunction;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NotNull;
@@ -137,7 +135,7 @@ public class PropertiesPrefixGroup implements Group, ResourceBundleEditorViewEle
}
@Override
- public PsiElement[] getPsiElements(final @NotNull Project project) {
+ public PsiElement[] getPsiElements() {
final List<PsiElement> elements = ContainerUtil.mapNotNull(getChildren(), new NullableFunction<TreeElement, PsiElement>() {
@Nullable
@Override
@@ -148,7 +146,7 @@ public class PropertiesPrefixGroup implements Group, ResourceBundleEditorViewEle
return property.getPsiElement();
}
else if (treeElement instanceof ResourceBundlePropertyStructureViewElement) {
- return ((ResourceBundlePropertyStructureViewElement)treeElement).getPsiElements(project)[0];
+ return ((ResourceBundlePropertyStructureViewElement)treeElement).getPsiElements()[0];
}
return null;
}
diff --git a/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/structureView/PropertiesStructureViewElement.java b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/structureView/PropertiesStructureViewElement.java
index 2af033735706..d73fd376782d 100644
--- a/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/structureView/PropertiesStructureViewElement.java
+++ b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/structureView/PropertiesStructureViewElement.java
@@ -19,7 +19,6 @@ import com.intellij.ide.structureView.StructureViewTreeElement;
import com.intellij.lang.properties.editor.ResourceBundleEditorViewElement;
import com.intellij.lang.properties.psi.Property;
import com.intellij.navigation.ItemPresentation;
-import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiElement;
import org.jetbrains.annotations.NotNull;
@@ -58,7 +57,7 @@ public class PropertiesStructureViewElement implements StructureViewTreeElement,
}
@Override
- public PsiElement[] getPsiElements(@NotNull Project project) {
+ public PsiElement[] getPsiElements() {
return new PsiElement[] {getValue()};
}
diff --git a/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleEditor.java b/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleEditor.java
index 0176aa38fc6e..e9eb9e9f72d2 100644
--- a/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleEditor.java
+++ b/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleEditor.java
@@ -123,30 +123,40 @@ public class ResourceBundleEditor extends UserDataHolderBase implements FileEdit
myStructureViewPanel.add(myStructureViewComponent, BorderLayout.CENTER);
myStructureViewComponent.getTree().getSelectionModel().addTreeSelectionListener(new TreeSelectionListener() {
- private String selectedPropertyName;
+ private IProperty selectedProperty;
private PropertiesFile selectedPropertiesFile;
@Override
public void valueChanged(TreeSelectionEvent e) {
// filter out temp unselect/select events
- if (getSelectedPropertyName() == null) return;
- if (!Comparing.strEqual(selectedPropertyName, getSelectedPropertyName()) ||
+ if (getSelectedProperty() == null) return;
+ if (!arePropertiesEquivalent(selectedProperty, getSelectedProperty()) ||
!Comparing.equal(selectedPropertiesFile, getSelectedPropertiesFile())) {
if (e.getOldLeadSelectionPath() != null) {
for (Map.Entry<PropertiesFile, Editor> entry : myEditors.entrySet()) {
if (entry.getValue() == mySelectedEditor) {
- writeEditorPropertyValue(mySelectedEditor, entry.getKey(), selectedPropertyName);
+ writeEditorPropertyValue(mySelectedEditor, entry.getKey(), selectedProperty.getName());
break;
}
}
}
- selectedPropertyName = getSelectedPropertyName();
+ selectedProperty = getSelectedProperty();
selectedPropertiesFile = getSelectedPropertiesFile();
selectionChanged();
}
}
+
+ private boolean arePropertiesEquivalent(@Nullable IProperty p1, @Nullable IProperty p2) {
+ if (p1 == p2) {
+ return true;
+ }
+ if (p1 == null || p2 == null) {
+ return false;
+ }
+ return p1.getPsiElement().isEquivalentTo(p2.getPsiElement());
+ }
});
installPropertiesChangeListeners();
@@ -233,7 +243,10 @@ public class ResourceBundleEditor extends UserDataHolderBase implements FileEdit
DefaultMutableTreeNode nodeToSelect = null;
while (!toCheck.isEmpty()) {
DefaultMutableTreeNode node = toCheck.pop();
- String value = getNodeValue(node);
+ final ResourceBundleEditorViewElement element = getSelectedElement(node);
+ String value = element instanceof ResourceBundlePropertyStructureViewElement
+ ? ((ResourceBundlePropertyStructureViewElement)element).getValue()
+ : null;
if (propertyName.equals(value)) {
nodeToSelect = node;
break;
@@ -279,13 +292,6 @@ public class ResourceBundleEditor extends UserDataHolderBase implements FileEdit
}
@Nullable
- private static String getNodeValue(@NotNull DefaultMutableTreeNode node) {
- final ResourceBundleEditorViewElement element = getSelectedElement(node);
- return element instanceof ResourceBundlePropertyStructureViewElement ? ((ResourceBundlePropertyStructureViewElement)element).getValue()
- : null;
- }
-
- @Nullable
private static ResourceBundleEditorViewElement getSelectedElement(@NotNull DefaultMutableTreeNode node) {
Object userObject = node.getUserObject();
if (!(userObject instanceof AbstractTreeNode)) return null;
@@ -296,8 +302,9 @@ public class ResourceBundleEditor extends UserDataHolderBase implements FileEdit
private void writeEditorPropertyValue(final Editor editor, final PropertiesFile propertiesFile, final @Nullable String propertyName) {
final String currentValue = editor.getDocument().getText();
final String currentSelectedProperty = propertyName == null ? getSelectedPropertyName() : propertyName;
-
- assert currentSelectedProperty != null;
+ if (currentSelectedProperty == null) {
+ return;
+ }
ApplicationManager.getApplication().runWriteAction(new Runnable() {
@Override
@@ -564,21 +571,41 @@ public class ResourceBundleEditor extends UserDataHolderBase implements FileEdit
}
@Nullable
- public String getSelectedPropertyName() {
+ private DefaultMutableTreeNode getSelectedNode() {
JTree tree = myStructureViewComponent.getTree();
if (tree == null) return null;
TreePath selected = tree.getSelectionModel().getSelectionPath();
if (selected == null) return null;
- return getNodeValue((DefaultMutableTreeNode)selected.getLastPathComponent());
+ return (DefaultMutableTreeNode)selected.getLastPathComponent();
+ }
+
+ @Nullable
+ private String getSelectedPropertyName() {
+ final IProperty selectedProperty = getSelectedProperty();
+ return selectedProperty == null ? null : selectedProperty.getName();
+ }
+
+ @Nullable
+ private IProperty getSelectedProperty() {
+ final DefaultMutableTreeNode selectedNode = getSelectedNode();
+ if (selectedNode == null) {
+ return null;
+ }
+ final ResourceBundleEditorViewElement element = getSelectedElement(selectedNode);
+ return element instanceof ResourceBundlePropertyStructureViewElement ? ((ResourceBundlePropertyStructureViewElement)element).getProperty()
+ : null;
}
@Nullable
public ResourceBundleEditorViewElement getSelectedElement() {
- JTree tree = myStructureViewComponent.getTree();
- if (tree == null) return null;
- TreePath selected = tree.getSelectionModel().getSelectionPath();
- if (selected == null) return null;
- return getSelectedElement((DefaultMutableTreeNode)selected.getLastPathComponent());
+ final DefaultMutableTreeNode selectedNode = getSelectedNode();
+ if (selectedNode == null) {
+ return null;
+ }
+ Object userObject = selectedNode.getUserObject();
+ if (!(userObject instanceof AbstractTreeNode)) return null;
+ Object value = ((AbstractTreeNode)userObject).getValue();
+ return value instanceof ResourceBundleEditorViewElement ? (ResourceBundleEditorViewElement) value : null;
}
@Override
diff --git a/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleStructureViewComponent.java b/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleStructureViewComponent.java
index ee8e47a446e4..0985f35a5e12 100644
--- a/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleStructureViewComponent.java
+++ b/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleStructureViewComponent.java
@@ -29,14 +29,11 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiNamedElement;
-import com.intellij.psi.util.PsiUtilBase;
import com.intellij.psi.util.PsiUtilCore;
import com.intellij.refactoring.safeDelete.SafeDeleteHandler;
import com.intellij.ui.PopupHandler;
import com.intellij.usages.UsageTarget;
import com.intellij.usages.UsageView;
-import com.intellij.util.Function;
-import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NotNull;
import java.awt.datatransfer.StringSelection;
@@ -79,13 +76,7 @@ class ResourceBundleStructureViewComponent extends PropertiesGroupingStructureVi
} else if (LangDataKeys.PSI_ELEMENT_ARRAY.is(dataId)) {
final ResourceBundleEditorViewElement selectedElement = ((ResourceBundleEditor)getFileEditor()).getSelectedElement();
if (selectedElement != null) {
- final Project project = CommonDataKeys.PROJECT.getData(this);
- if (project != null) {
- final PsiElement[] psiElements = selectedElement.getPsiElements(project);
- if (psiElements != null) {
- return psiElements;
- }
- }
+ return selectedElement.getPsiElements();
}
} else if (PlatformDataKeys.DELETE_ELEMENT_PROVIDER.is(dataId)) {
final PsiElement[] psiElements = LangDataKeys.PSI_ELEMENT_ARRAY.getData(this);
diff --git a/plugins/properties/testSrc/com/intellij/lang/properties/ResourceBundleRenameTest.java b/plugins/properties/testSrc/com/intellij/lang/properties/ResourceBundleRenameTest.java
deleted file mode 100644
index f8c435817ea4..000000000000
--- a/plugins/properties/testSrc/com/intellij/lang/properties/ResourceBundleRenameTest.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright 2000-2014 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.lang.properties;
-
-import com.intellij.lang.properties.refactoring.rename.ResourceBundleRenamerFactory;
-import com.intellij.openapi.extensions.Extensions;
-import com.intellij.psi.PsiFile;
-import com.intellij.refactoring.rename.RenameProcessor;
-import com.intellij.refactoring.rename.naming.AutomaticRenamerFactory;
-import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase;
-
-/**
- * @author Dmitry Batkovich
- */
-public class ResourceBundleRenameTest extends LightPlatformCodeInsightFixtureTestCase {
-
- public void testRenameResourceBundleEntryFile() {
- final PsiFile toRenameFile = myFixture.addFileToProject("old_p.properties", "");
- final PsiFile toCheck = myFixture.addFileToProject("old_p_en.properties", "");
-
- final RenameProcessor processor = new RenameProcessor(getProject(), toRenameFile, "new_p.properties", true, true);
- for (AutomaticRenamerFactory factory : Extensions.getExtensions(AutomaticRenamerFactory.EP_NAME)) {
- if (factory instanceof ResourceBundleRenamerFactory) {
- processor.addRenamerFactory(factory);
- }
- }
- processor.run();
-
- assertEquals("new_p_en.properties", toCheck.getName());
- }
-
- public void testRenamePropertyKey() {
- final PsiFile toCheckFile = myFixture.addFileToProject("p.properties", "key=value");
- myFixture.configureByText("p_en.properties", "ke<caret>y=en_value");
- myFixture.renameElementAtCaret("new_key");
- assertEquals(toCheckFile.getText(), "new_key=value");
- }
-}
diff --git a/plugins/properties/testSrc/com/intellij/lang/properties/ResourceBundleTest.java b/plugins/properties/testSrc/com/intellij/lang/properties/ResourceBundleTest.java
new file mode 100644
index 000000000000..00d4adadaef1
--- /dev/null
+++ b/plugins/properties/testSrc/com/intellij/lang/properties/ResourceBundleTest.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2000-2014 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.lang.properties;
+
+import com.intellij.lang.properties.psi.PropertiesFile;
+import com.intellij.lang.properties.refactoring.rename.ResourceBundleRenamerFactory;
+import com.intellij.openapi.extensions.Extensions;
+import com.intellij.psi.PsiFile;
+import com.intellij.refactoring.rename.RenameProcessor;
+import com.intellij.refactoring.rename.naming.AutomaticRenamerFactory;
+import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase;
+
+/**
+ * @author Dmitry Batkovich
+ */
+public class ResourceBundleTest extends LightPlatformCodeInsightFixtureTestCase {
+
+ public void testDefaultPropertyFile() {
+ final PsiFile rawDefault = myFixture.addFileToProject("p.properties", "");
+ myFixture.addFileToProject("p_en.properties", "");
+ final PropertiesFile defaultFile = PropertiesImplUtil.getPropertiesFile(rawDefault);
+ assertNotNull(defaultFile);
+ final PropertiesFile file = defaultFile.getResourceBundle().getDefaultPropertiesFile();
+ assertTrue(file.getContainingFile().isEquivalentTo(defaultFile.getContainingFile()));
+ }
+
+ public void testRenameResourceBundleEntryFile() {
+ final PsiFile toRenameFile = myFixture.addFileToProject("old_p.properties", "");
+ final PsiFile toCheck = myFixture.addFileToProject("old_p_en.properties", "");
+
+ final RenameProcessor processor = new RenameProcessor(getProject(), toRenameFile, "new_p.properties", true, true);
+ for (AutomaticRenamerFactory factory : Extensions.getExtensions(AutomaticRenamerFactory.EP_NAME)) {
+ if (factory instanceof ResourceBundleRenamerFactory) {
+ processor.addRenamerFactory(factory);
+ }
+ }
+ processor.run();
+
+ assertEquals("new_p_en.properties", toCheck.getName());
+ }
+
+ public void testRenamePropertyKey() {
+ final PsiFile toCheckFile = myFixture.addFileToProject("p.properties", "key=value");
+ myFixture.configureByText("p_en.properties", "ke<caret>y=en_value");
+ myFixture.renameElementAtCaret("new_key");
+ assertEquals(toCheckFile.getText(), "new_key=value");
+ }
+}
diff --git a/plugins/structuralsearch/build.xml b/plugins/structuralsearch/build.xml
deleted file mode 100644
index 942281dbfbb1..000000000000
--- a/plugins/structuralsearch/build.xml
+++ /dev/null
@@ -1,53 +0,0 @@
-<project name="StructuralSearchPlugin" default="jar_plugin" basedir=".">
- <property name="plugname" value="StructuralSearchPlugin"/>
- <property name="releasePlugname" value="SS"/>
- <property name="build.path" value="${project.path}/build_out"/>
- <property name="version" value="0.7.0.1"/>
- <property name="description" value="This is experimental yet useful plugin for searching source code
- in terms of java syntax (query code by example :-). It is intended to be used for:
- &amp;lt;LI&amp;gt;understanding new libraries, finding highlevel code patterns (singletons, serialization implementation,
- Struts actions, ejbs, servlets, filters, source metadata, etc), analyzing
- opportunities for aspect refactoring (finding exception handling, methods with
- specific signatures and structure, etc). For instance, for exploring source code of JDK 1.5 with Aurora
- one could use search to find added entities (classes, methods, etc), generic classes, methods and declarations or just
- parameterized symbols. Note, that the plugin could miss some generic stuff that is not supported by Aurora (e.g. anonymous typed vars).
- &amp;lt;LI&amp;gt; finding expressions, statements or group of statements regardsless of particular whitespace indentation.
- This could be useful e.g. after applying extract method refactoring to find the other occurences the such extracted code.
- &amp;lt;LI&amp;gt;Find code fragments (symbols, references, constants) like given pattern.
- &amp;lt;BR&amp;gt;Warning, the plugin is PSI dependent, works with 1156 and 706" />
- <target name="clean">
- <delete includeEmptyDirs="true" failonerror="false">
- <fileset dir="${build.path}" includes="**/*.class,**/*.html,META-INF/*.xml,META-INF/*.txt"/>
- </delete>
- <mkdir dir="${build.path}"/>
- </target>
- <target name="copy_files">
- <copy todir="${build.path}/META-INF" >
- <fileset dir="${project.path}/META-INF" includes="plugin.xml,version.txt"/>
- </copy>
- <copy todir="${build.path}/resources">
- <fileset dir="${project.path}/resources"/>
- </copy>
- <copy todir="${build.path}">
- <fileset dir="${project.path}/classes" includes="**/*.class">
- </fileset>
- </copy>
- </target>
-
- <target name="version" depends="copy_files">
- <replace dir="${build.path}" includes="**/*.xml **/*.html **/*.txt">
- <replacefilter token="@PLUGIN.VERSION@" value="${version}"/>
- <replacefilter token="@PLUGIN.DESCRIPTION@" value="${description}"/>
- </replace>
- </target>
- <target name="jar_plugin" depends="clean,copy_files,version" >
-
- <jar jarfile="${build.path}/${plugname}.jar" basedir="${build.path}"
- excludes="${plugname}.jar"
- />
-
- <copy todir="${idea.path}/debug/plugins">
- <fileset dir="${build.path}" includes="*.jar" />
- </copy>
- </target>
-</project>
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/StructuralReplaceHandler.java b/plugins/structuralsearch/source/com/intellij/structuralsearch/StructuralReplaceHandler.java
deleted file mode 100644
index 063f272cf4c4..000000000000
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/StructuralReplaceHandler.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.intellij.structuralsearch;
-
-import com.intellij.structuralsearch.plugin.replace.ReplaceOptions;
-import com.intellij.structuralsearch.plugin.replace.ReplacementInfo;
-
-/**
- * @author Eugene.Kudelevsky
- */
-public abstract class StructuralReplaceHandler {
- public abstract void replace(final ReplacementInfo info, ReplaceOptions options);
-
- public void prepare
- (ReplacementInfo info) {
- }
-}
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/StructuralSearchProfile.java b/plugins/structuralsearch/source/com/intellij/structuralsearch/StructuralSearchProfile.java
deleted file mode 100644
index ff7b379a161f..000000000000
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/StructuralSearchProfile.java
+++ /dev/null
@@ -1,281 +0,0 @@
-package com.intellij.structuralsearch;
-
-import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer;
-import com.intellij.codeInsight.template.TemplateContextType;
-import com.intellij.lang.Language;
-import com.intellij.openapi.editor.Document;
-import com.intellij.openapi.editor.Editor;
-import com.intellij.openapi.editor.EditorFactory;
-import com.intellij.openapi.editor.ex.EditorEx;
-import com.intellij.openapi.extensions.ExtensionPointName;
-import com.intellij.openapi.fileTypes.FileType;
-import com.intellij.openapi.fileTypes.LanguageFileType;
-import com.intellij.openapi.project.Project;
-import com.intellij.psi.*;
-import com.intellij.structuralsearch.impl.matcher.CompiledPattern;
-import com.intellij.structuralsearch.impl.matcher.GlobalMatchingVisitor;
-import com.intellij.structuralsearch.impl.matcher.PatternTreeContext;
-import com.intellij.structuralsearch.impl.matcher.compiler.GlobalCompilingVisitor;
-import com.intellij.structuralsearch.impl.matcher.filters.LexicalNodesFilter;
-import com.intellij.structuralsearch.plugin.replace.ReplaceOptions;
-import com.intellij.structuralsearch.plugin.replace.impl.ParameterInfo;
-import com.intellij.structuralsearch.plugin.replace.impl.ReplacementBuilder;
-import com.intellij.structuralsearch.plugin.replace.impl.ReplacementContext;
-import com.intellij.structuralsearch.plugin.replace.impl.Replacer;
-import com.intellij.structuralsearch.plugin.ui.Configuration;
-import com.intellij.structuralsearch.plugin.ui.SearchContext;
-import com.intellij.structuralsearch.plugin.ui.UIUtil;
-import com.intellij.util.ArrayUtil;
-import com.intellij.util.LocalTimeCounter;
-import com.intellij.util.containers.ContainerUtil;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-
-/**
- * @author Eugene.Kudelevsky
- */
-public abstract class StructuralSearchProfile {
- public static final ExtensionPointName<StructuralSearchProfile> EP_NAME =
- ExtensionPointName.create("com.intellij.structuralsearch.profile");
-
- public abstract void compile(PsiElement[] elements, @NotNull GlobalCompilingVisitor globalVisitor);
-
- @NotNull
- public abstract PsiElementVisitor createMatchingVisitor(@NotNull GlobalMatchingVisitor globalVisitor);
-
- @NotNull
- public abstract PsiElementVisitor getLexicalNodesFilter(@NotNull LexicalNodesFilter filter);
-
- @NotNull
- public abstract CompiledPattern createCompiledPattern();
-
- public static String getTypeName(FileType fileType) {
- return fileType.getName().toLowerCase();
- }
-
- public abstract boolean canProcess(@NotNull FileType fileType);
-
- public abstract boolean isMyLanguage(@NotNull Language language);
-
- public boolean isMyFile(PsiFile file, @NotNull Language language, Language... patternLanguages) {
- if (isMyLanguage(language) && ArrayUtil.find(patternLanguages, language) >= 0) {
- return true;
- }
- return false;
- }
-
- @NotNull
- public PsiElement[] createPatternTree(@NotNull String text,
- @NotNull PatternTreeContext context,
- @NotNull FileType fileType,
- @Nullable Language language,
- @Nullable String contextName,
- @Nullable String extension,
- @NotNull Project project,
- boolean physical) {
- final String ext = extension != null ? extension : fileType.getDefaultExtension();
- final String name = "__dummy." + ext;
- final PsiFileFactory factory = PsiFileFactory.getInstance(project);
-
- final PsiFile file = language == null
- ? factory.createFileFromText(name, fileType, text, LocalTimeCounter.currentTime(), physical, true)
- : factory.createFileFromText(name, language, text, physical, true);
-
- return file != null ? file.getChildren() : PsiElement.EMPTY_ARRAY;
- }
-
- @NotNull
- public PsiElement[] createPatternTree(@NotNull String text,
- @NotNull PatternTreeContext context,
- @NotNull FileType fileType,
- @NotNull Project project,
- boolean physical) {
- return createPatternTree(text, context, fileType, null, null, null, project, physical);
- }
-
- @NotNull
- public Editor createEditor(@NotNull SearchContext searchContext,
- @NotNull FileType fileType,
- Language dialect,
- String text,
- boolean useLastConfiguration) {
- PsiFile codeFragment = createCodeFragment(searchContext.getProject(), text, null);
- if (codeFragment == null) {
- codeFragment = createFileFragment(searchContext, fileType, dialect, text);
- }
-
- if (codeFragment != null) {
- final Document doc = PsiDocumentManager.getInstance(searchContext.getProject()).getDocument(codeFragment);
- assert doc != null : "code fragment element should be physical";
- DaemonCodeAnalyzer.getInstance(searchContext.getProject()).setHighlightingEnabled(codeFragment, false);
- return UIUtil.createEditor(doc, searchContext.getProject(), true, true, getTemplateContextType());
- }
-
- final EditorFactory factory = EditorFactory.getInstance();
- final Document document = factory.createDocument(text);
- final EditorEx editor = (EditorEx)factory.createEditor(document, searchContext.getProject());
- editor.getSettings().setFoldingOutlineShown(false);
- return editor;
- }
-
- private static PsiFile createFileFragment(SearchContext searchContext, FileType fileType, Language dialect, String text) {
- final String name = "__dummy." + fileType.getDefaultExtension();
- final PsiFileFactory factory = PsiFileFactory.getInstance(searchContext.getProject());
-
- return dialect == null ?
- factory.createFileFromText(name, fileType, text, LocalTimeCounter.currentTime(), true, true) :
- factory.createFileFromText(name, dialect, text, true, true);
- }
-
- @Nullable
- public PsiCodeFragment createCodeFragment(Project project, String text, @Nullable PsiElement context) {
- return null;
- }
-
- @Nullable
- public Class<? extends TemplateContextType> getTemplateContextTypeClass() {
- return null;
- }
-
- public final TemplateContextType getTemplateContextType() {
- final Class<? extends TemplateContextType> clazz = getTemplateContextTypeClass();
- return clazz != null ? ContainerUtil.findInstance(TemplateContextType.EP_NAME.getExtensions(), clazz) : null;
- }
-
- @Nullable
- public FileType detectFileType(@NotNull PsiElement context) {
- return null;
- }
-
- @Nullable
- public StructuralReplaceHandler getReplaceHandler(@NotNull ReplacementContext context) {
- return null;
- }
-
- public void checkSearchPattern(Project project, MatchOptions options) {
- }
-
- public void checkReplacementPattern(Project project, ReplaceOptions options) {
- String fileType = getTypeName(options.getMatchOptions().getFileType());
- throw new UnsupportedPatternException(SSRBundle.message("replacement.not.supported.for.filetype", fileType));
- }
-
- @NotNull
- public Language getLanguage(PsiElement element) {
- return element.getLanguage();
- }
-
- // only for nodes not filtered by lexical-nodes filter; they can be by default
- public boolean canBeVarDelimeter(@NotNull PsiElement element) {
- return false;
- }
-
- public String getText(PsiElement match, int start, int end) {
- final String matchText = match.getText();
- if (start==0 && end==-1) return matchText;
- return matchText.substring(start, end == -1 ? matchText.length() : end);
- }
-
- public Class getElementContextByPsi(PsiElement element) {
- return element.getClass();
- }
-
- public String getTypedVarString(PsiElement element) {
- if (element instanceof PsiNamedElement) {
- return ((PsiNamedElement)element).getName();
- }
- return element.getText();
- }
-
- public String getMeaningfulText(PsiElement element) {
- return getTypedVarString(element);
- }
-
- public PsiElement updateCurrentNode(PsiElement node) {
- return node;
- }
-
- public PsiElement extendMatchedByDownUp(PsiElement node) {
- return node;
- }
-
- public PsiElement extendMatchOnePsiFile(PsiElement file) {
- return file;
- }
-
- public LanguageFileType getDefaultFileType(@Nullable LanguageFileType fileType) {
- return fileType;
- }
-
- Configuration[] getPredefinedTemplates() {
- return Configuration.EMPTY_ARRAY;
- }
-
- public void provideAdditionalReplaceOptions(@NotNull PsiElement node, ReplaceOptions options, ReplacementBuilder builder) {}
-
- public int handleSubstitution(final ParameterInfo info,
- MatchResult match,
- StringBuilder result,
- int offset,
- HashMap<String, MatchResult> matchMap) {
- return defaultHandleSubstitution(info, match, result, offset);
- }
-
- public static int defaultHandleSubstitution(ParameterInfo info, MatchResult match, StringBuilder result, int offset) {
- if (info.getName().equals(match.getName())) {
- String replacementString = match.getMatchImage();
- boolean forceAddingNewLine = false;
- if (match.getAllSons().size() > 0 && !match.isScopeMatch()) {
- // compound matches
- StringBuilder buf = new StringBuilder();
-
- for (final MatchResult matchResult : match.getAllSons()) {
- final PsiElement currentElement = matchResult.getMatch();
-
- if (buf.length() > 0) {
- if (info.isParameterContext()) {
- buf.append(',');
- } else {
- buf.append(' ');
- }
- }
-
- buf.append(matchResult.getMatchImage());
- forceAddingNewLine = currentElement instanceof PsiComment;
- }
- replacementString = buf.toString();
- } else {
- if (info.isStatementContext()) {
- forceAddingNewLine = match.getMatch() instanceof PsiComment;
- }
- }
-
- offset = Replacer.insertSubstitution(result, offset, info, replacementString);
- if (forceAddingNewLine && info.isStatementContext()) {
- result.insert(info.getStartIndex() + offset + 1, '\n');
- offset ++;
- }
- }
- return offset;
- }
-
- public int processAdditionalOptions(ParameterInfo info, int offset, StringBuilder result, MatchResult r) {
- return offset;
- }
-
- public boolean isIdentifier(PsiElement element) {
- return false;
- }
-
- public Collection<String> getReservedWords() {
- return Collections.emptySet();
- }
-
- public boolean isDocCommentOwner(PsiElement match) {
- return false;
- }
-}
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/GlobalMatchingVisitor.java b/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/GlobalMatchingVisitor.java
deleted file mode 100644
index bfbe065e461c..000000000000
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/GlobalMatchingVisitor.java
+++ /dev/null
@@ -1,319 +0,0 @@
-package com.intellij.structuralsearch.impl.matcher;
-
-import com.intellij.dupLocator.AbstractMatchingVisitor;
-import com.intellij.dupLocator.iterators.NodeIterator;
-import com.intellij.dupLocator.util.NodeFilter;
-import com.intellij.lang.Language;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.psi.PsiElement;
-import com.intellij.psi.PsiElementVisitor;
-import com.intellij.structuralsearch.MatchResult;
-import com.intellij.structuralsearch.StructuralSearchProfile;
-import com.intellij.structuralsearch.StructuralSearchUtil;
-import com.intellij.structuralsearch.impl.matcher.filters.LexicalNodesFilter;
-import com.intellij.structuralsearch.impl.matcher.handlers.DelegatingHandler;
-import com.intellij.structuralsearch.impl.matcher.handlers.MatchingHandler;
-import com.intellij.structuralsearch.impl.matcher.handlers.SubstitutionHandler;
-import com.intellij.structuralsearch.plugin.ui.Configuration;
-import com.intellij.structuralsearch.plugin.util.SmartPsiPointer;
-import com.intellij.util.containers.HashMap;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * Visitor class to manage pattern matching
- */
-@SuppressWarnings({"RefusedBequest"})
-public class GlobalMatchingVisitor extends AbstractMatchingVisitor {
- private static final Logger LOG = Logger.getInstance("#com.intellij.structuralsearch.impl.matcher.GlobalMatchingVisitor");
-
- // the pattern element for visitor check
- private PsiElement myElement;
-
- // the result of matching in visitor
- private boolean myResult;
-
- // context of matching
- private MatchContext matchContext;
-
- private MatchingHandler myLastHandler;
-
- private Map<Language, PsiElementVisitor> myLanguage2MatchingVisitor = new HashMap<Language, PsiElementVisitor>(1);
-
- public PsiElement getElement() {
- return myElement;
- }
-
- public boolean getResult() {
- return myResult;
- }
-
- public void setElement(PsiElement element) {
- this.myElement = element;
- }
-
- public void setResult(boolean result) {
- this.myResult = result;
- }
-
- public MatchContext getMatchContext() {
- return matchContext;
- }
-
- @Override
- protected boolean doMatchInAnyOrder(NodeIterator elements, NodeIterator elements2) {
- return matchContext.getPattern().getHandler(elements.current()).matchInAnyOrder(
- elements,
- elements2,
- matchContext
- );
- }
-
- @NotNull
- @Override
- protected NodeFilter getNodeFilter() {
- return LexicalNodesFilter.getInstance();
- }
-
- public final boolean handleTypedElement(final PsiElement typedElement, final PsiElement match) {
- MatchingHandler handler = matchContext.getPattern().getHandler(typedElement);
- final MatchingHandler initialHandler = handler;
- if (handler instanceof DelegatingHandler) {
- handler = ((DelegatingHandler)handler).getDelegate();
- }
- assert handler instanceof SubstitutionHandler :
- handler != null ? handler.getClass() : "null" + ' ' + (initialHandler != null ? initialHandler.getClass() : "null");
-
- return ((SubstitutionHandler)handler).handle(match, matchContext);
- }
-
- /**
- * Identifies the match between given element of program tree and pattern element
- *
- * @param el1 the pattern for matching
- * @param el2 the tree element for matching
- * @return true if equal and false otherwise
- */
- public boolean match(final PsiElement el1, final PsiElement el2) {
- // null
- if (el1 == el2) return true;
- if (el2 == null || el1 == null) {
- // this a bug!
- return false;
- }
-
- // copy changed data to local stack
- PsiElement prevElement = myElement;
- myElement = el2;
-
- try {
- /*if (el1 instanceof XmlElement) {
- el1.accept(myXmlVisitor);
- }
- else {
- el1.accept(myJavaVisitor);
- }*/
- PsiElementVisitor visitor = getVisitorForElement(el1);
- if (visitor != null) {
- el1.accept(visitor);
- }
- }
- catch (ClassCastException ex) {
- myResult = false;
- }
- finally {
- myElement = prevElement;
- }
-
- return myResult;
- }
-
- @Nullable
- private PsiElementVisitor getVisitorForElement(PsiElement element) {
- Language language = element.getLanguage();
- PsiElementVisitor visitor = myLanguage2MatchingVisitor.get(language);
- if (visitor == null) {
- visitor = createMatchingVisitor(language);
- myLanguage2MatchingVisitor.put(language, visitor);
- }
- return visitor;
- }
-
- @Nullable
- private PsiElementVisitor createMatchingVisitor(Language language) {
- StructuralSearchProfile profile = StructuralSearchUtil.getProfileByLanguage(language);
- if (profile == null) {
- LOG.warn("there is no StructuralSearchProfile for language " + language.getID());
- return null;
- }
- else {
- return profile.createMatchingVisitor(this);
- }
- }
-
- /**
- * Matches tree segments starting with given elements to find equality
- *
- * @param nodes the pattern element for matching
- * @param nodes2 the tree element for matching
- * @return if they are equal and false otherwise
- */
- public boolean matchSequentially(NodeIterator nodes, NodeIterator nodes2) {
- if (!nodes.hasNext()) {
- return nodes.hasNext() == nodes2.hasNext();
- }
-
- myLastHandler = matchContext.getPattern().getHandler(nodes.current());
- return myLastHandler.matchSequentially(
- nodes,
- nodes2,
- matchContext
- );
- }
-
- public static boolean continueMatchingSequentially(final NodeIterator nodes, final NodeIterator nodes2, MatchContext matchContext) {
- if (!nodes.hasNext()) {
- return nodes.hasNext() == nodes2.hasNext();
- }
-
- return matchContext.getPattern().getHandler(nodes.current()).matchSequentially(
- nodes,
- nodes2,
- matchContext
- );
- }
-
- /**
- * Descents the tree in depth finding matches
- *
- * @param elements the element for which the sons are looked for match
- */
- public void matchContext(final NodeIterator elements) {
- final CompiledPattern pattern = matchContext.getPattern();
- final NodeIterator patternNodes = pattern.getNodes().clone();
- final MatchResultImpl saveResult = matchContext.hasResult() ? matchContext.getResult() : null;
- final List<PsiElement> saveMatchedNodes = matchContext.getMatchedNodes();
-
- try {
- matchContext.setResult(null);
- matchContext.setMatchedNodes(null);
-
- if (!patternNodes.hasNext()) return;
- final MatchingHandler firstMatchingHandler = pattern.getHandler(patternNodes.current());
-
- for (; elements.hasNext(); elements.advance()) {
- final PsiElement elementNode = elements.current();
-
- boolean matched = firstMatchingHandler.matchSequentially(patternNodes, elements, matchContext);
-
- if (matched) {
- MatchingHandler matchingHandler = matchContext.getPattern().getHandler(Configuration.CONTEXT_VAR_NAME);
- if (matchingHandler != null) {
- matched = ((SubstitutionHandler)matchingHandler).handle(elementNode, matchContext);
- }
- }
-
- final List<PsiElement> matchedNodes = matchContext.getMatchedNodes();
-
- if (matched) {
- dispatchMatched(matchedNodes, matchContext.getResult());
- }
-
- matchContext.setMatchedNodes(null);
- matchContext.setResult(null);
-
- patternNodes.reset();
- if (matchedNodes != null && matchedNodes.size() > 0 && matched) {
- elements.rewind();
- }
- }
- }
- finally {
- matchContext.setResult(saveResult);
- matchContext.setMatchedNodes(saveMatchedNodes);
- }
- }
-
- private void dispatchMatched(final List<PsiElement> matchedNodes, MatchResultImpl result) {
- if (!matchContext.getOptions().isResultIsContextMatch() && doDispatch(result, result)) return;
-
- // There is no substitutions so show the context
-
- processNoSubstitutionMatch(matchedNodes, result);
- matchContext.getSink().newMatch(result);
- }
-
- private boolean doDispatch(final MatchResultImpl result, MatchResultImpl context) {
- boolean ret = false;
-
- for (MatchResult _r : result.getAllSons()) {
- final MatchResultImpl r = (MatchResultImpl)_r;
-
- if ((r.isScopeMatch() && !r.isTarget()) || r.isMultipleMatch()) {
- ret |= doDispatch(r, context);
- }
- else if (r.isTarget()) {
- r.setContext(context);
- matchContext.getSink().newMatch(r);
- ret = true;
- }
- }
- return ret;
- }
-
- private static void processNoSubstitutionMatch(List<PsiElement> matchedNodes, MatchResultImpl result) {
- boolean complexMatch = matchedNodes.size() > 1;
- final PsiElement match = matchedNodes.get(0);
-
- if (!complexMatch) {
- result.setMatchRef(new SmartPsiPointer(match));
- result.setMatchImage(match.getText());
- }
- else {
- MatchResultImpl sonresult;
-
- for (final PsiElement matchStatement : matchedNodes) {
- result.getMatches().add(
- sonresult = new MatchResultImpl(
- MatchResult.LINE_MATCH,
- matchStatement.getText(),
- new SmartPsiPointer(matchStatement),
- true
- )
- );
-
- sonresult.setParent(result);
- }
-
- result.setMatchRef(
- new SmartPsiPointer(match)
- );
- result.setMatchImage(
- match.getText()
- );
- result.setName(MatchResult.MULTI_LINE_MATCH);
- }
- }
-
- public void setMatchContext(MatchContext matchContext) {
- this.matchContext = matchContext;
- }
-
- // Matches the sons of given elements to find equality
- // @param el1 the pattern element for matching
- // @param el2 the tree element for matching
- // @return if they are equal and false otherwise
-
- @Override
- protected boolean isLeftLooseMatching() {
- return matchContext.getOptions().isLooseMatching();
- }
-
- @Override
- protected boolean isRightLooseMatching() {
- return false;
- }
-}
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/StructuralReplaceAction.java b/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/StructuralReplaceAction.java
deleted file mode 100644
index 33e7ac5b4d4d..000000000000
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/StructuralReplaceAction.java
+++ /dev/null
@@ -1,55 +0,0 @@
-package com.intellij.structuralsearch.plugin;
-
-import com.intellij.openapi.actionSystem.*;
-import com.intellij.openapi.project.Project;
-import com.intellij.structuralsearch.SSRBundle;
-import com.intellij.structuralsearch.plugin.replace.ui.ReplaceDialog;
-import com.intellij.structuralsearch.plugin.ui.Configuration;
-import com.intellij.structuralsearch.plugin.ui.SearchContext;
-
-/**
- * Search and replace structural java code patterns action.
- */
-public class StructuralReplaceAction extends AnAction {
-
- public StructuralReplaceAction() {
- super(SSRBundle.message("structuralreplace.action"));
- }
-
- /** Handles IDEA action event
- * @param event the event of action
- */
- public void actionPerformed(AnActionEvent event) {
- triggerAction(null, SearchContext.buildFromDataContext(event.getDataContext()));
- }
-
- public static void triggerAction(Configuration config, SearchContext searchContext) {
- ReplaceDialog replaceDialog = new ReplaceDialog(searchContext);
-
- if (config!=null) {
- replaceDialog.setUseLastConfiguration(true);
- replaceDialog.setValuesFromConfig(config);
- }
-
- replaceDialog.show();
- }
-
- /** Updates the state of the action
- * @param event the action event
- */
- public void update(AnActionEvent event) {
- final Presentation presentation = event.getPresentation();
- final DataContext context = event.getDataContext();
- final Project project = CommonDataKeys.PROJECT.getData(context);
- final StructuralSearchPlugin plugin = (project == null)? null:StructuralSearchPlugin.getInstance( project );
-
- if (plugin== null || plugin.isSearchInProgress() || plugin.isReplaceInProgress() || plugin.isDialogVisible()) {
- presentation.setEnabled( false );
- } else {
- presentation.setEnabled( true );
- }
-
- super.update(event);
- }
-}
-
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/StructuralSearchAction.java b/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/StructuralSearchAction.java
deleted file mode 100644
index 116f885b4679..000000000000
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/StructuralSearchAction.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package com.intellij.structuralsearch.plugin;
-
-import com.intellij.openapi.actionSystem.*;
-import com.intellij.openapi.project.Project;
-import com.intellij.structuralsearch.SSRBundle;
-import com.intellij.structuralsearch.plugin.ui.Configuration;
-import com.intellij.structuralsearch.plugin.ui.SearchContext;
-import com.intellij.structuralsearch.plugin.ui.SearchDialog;
-
-public class StructuralSearchAction extends AnAction {
-
- public StructuralSearchAction() {
- super(SSRBundle.message("structuralsearch.action"));
- }
-
- /** Handles IDEA action event
- * @param event the event of action
- */
- public void actionPerformed(AnActionEvent event) {
- triggerAction(null, SearchContext.buildFromDataContext(event.getDataContext()));
- }
-
- public static void triggerAction(Configuration config, SearchContext searchContext) {
- //StructuralSearchPlugin.getInstance(searchContext.getProject());
- final SearchDialog searchDialog = new SearchDialog(searchContext);
-
- if (config!=null) {
- searchDialog.setUseLastConfiguration(true);
- searchDialog.setValuesFromConfig(config);
- }
-
- searchDialog.show();
- }
-
- /** Updates the state of the action
- * @param event the action event
- */
- public void update(AnActionEvent event) {
- final Presentation presentation = event.getPresentation();
- final DataContext context = event.getDataContext();
- final Project project = CommonDataKeys.PROJECT.getData(context);
- final StructuralSearchPlugin plugin = project==null ? null:StructuralSearchPlugin.getInstance( project );
-
- if (plugin == null || plugin.isSearchInProgress() || plugin.isDialogVisible()) {
- presentation.setEnabled( false );
- } else {
- presentation.setEnabled( true );
- }
-
- super.update(event);
- }
-
-}
-
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/StructuralSearchPlugin.java b/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/StructuralSearchPlugin.java
deleted file mode 100644
index 23de5efb9cde..000000000000
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/StructuralSearchPlugin.java
+++ /dev/null
@@ -1,110 +0,0 @@
-package com.intellij.structuralsearch.plugin;
-
-import com.intellij.openapi.components.ProjectComponent;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.util.JDOMExternalizable;
-import com.intellij.structuralsearch.plugin.ui.ConfigurationManager;
-import com.intellij.structuralsearch.plugin.ui.ExistingTemplatesComponent;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Structural search plugin main class.
- */
-public final class StructuralSearchPlugin implements ProjectComponent, JDOMExternalizable {
- private boolean searchInProgress;
- private boolean replaceInProgress;
- private boolean myDialogVisible;
- private final ConfigurationManager myConfigurationManager = new ConfigurationManager();
- private ExistingTemplatesComponent myExistingTemplatesComponent;
-
- public boolean isSearchInProgress() {
- return searchInProgress;
- }
-
- public void setSearchInProgress(boolean searchInProgress) {
- this.searchInProgress = searchInProgress;
- }
-
- public boolean isReplaceInProgress() {
- return replaceInProgress;
- }
-
- public void setReplaceInProgress(boolean replaceInProgress) {
- this.replaceInProgress = replaceInProgress;
- }
-
- public boolean isDialogVisible() {
- return myDialogVisible;
- }
-
- public void setDialogVisible(boolean dialogVisible) {
- myDialogVisible = dialogVisible;
- }
-
- /**
- * Method is called after plugin is already created and configured. Plugin can start to communicate with
- * other plugins only in this method.
- */
- public void initComponent() {
- }
-
- /**
- * This method is called on plugin disposal.
- */
- public void disposeComponent() {
- }
-
- /**
- * Returns the name of component
- *
- * @return String representing component name. Use PluginName.ComponentName notation
- * to avoid conflicts.
- */
- @NotNull
- public String getComponentName() {
- return "StructuralSearchPlugin";
- }
-
- // Simple logging facility
-
- // Logs given string to IDEA logger
-
- private static class LoggerHolder {
- private static final Logger logger = Logger.getInstance("Structural search");
- }
-
- public static void debug(String str) {
- LoggerHolder.logger.info(str);
- }
-
- public void readExternal(org.jdom.Element element) {
- myConfigurationManager.loadConfigurations(element);
- }
-
- public void writeExternal(org.jdom.Element element) {
- myConfigurationManager.saveConfigurations(element);
- }
-
- public void projectOpened() {
- }
-
- public void projectClosed() {
- }
-
- public static StructuralSearchPlugin getInstance(Project project) {
- return project.getComponent(StructuralSearchPlugin.class);
- }
-
- public ConfigurationManager getConfigurationManager() {
- return myConfigurationManager;
- }
-
- public ExistingTemplatesComponent getExistingTemplatesComponent() {
- return myExistingTemplatesComponent;
- }
-
- public void setExistingTemplatesComponent(ExistingTemplatesComponent existingTemplatesComponent) {
- myExistingTemplatesComponent = existingTemplatesComponent;
- }
-}
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/ReplaceOptions.java b/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/ReplaceOptions.java
deleted file mode 100644
index d18d51acd93c..000000000000
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/ReplaceOptions.java
+++ /dev/null
@@ -1,177 +0,0 @@
-package com.intellij.structuralsearch.plugin.replace;
-
-import com.intellij.openapi.util.JDOMExternalizable;
-import com.intellij.openapi.util.Key;
-import com.intellij.openapi.util.UserDataHolder;
-import com.intellij.structuralsearch.MatchOptions;
-import com.intellij.structuralsearch.ReplacementVariableDefinition;
-import gnu.trove.THashMap;
-import org.jdom.Attribute;
-import org.jdom.DataConversionException;
-import org.jdom.Element;
-import org.jetbrains.annotations.NonNls;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.*;
-
-/**
- * @author Maxim.Mossienko
- * Date: Mar 5, 2004
- * Time: 7:51:38 PM
- */
-public class ReplaceOptions implements JDOMExternalizable, Cloneable, UserDataHolder {
- private Map<String, ReplacementVariableDefinition> variableDefs;
- private String replacement = "";
- private boolean toShortenFQN;
- private boolean myToReformatAccordingToStyle;
- private MatchOptions matchOptions = new MatchOptions();
-
- @NonNls private static final String REFORMAT_ATTR_NAME = "reformatAccordingToStyle";
- @NonNls private static final String REPLACEMENT_ATTR_NAME = "replacement";
- @NonNls private static final String SHORTEN_FQN_ATTR_NAME = "shortenFQN";
-
- private THashMap myUserMap = null;
- @NonNls private static final String VARIABLE_DEFINITION_TAG_NAME = "variableDefinition";
-
- public String getReplacement() {
- return replacement;
- }
-
- public void setReplacement(String replacement) {
- this.replacement = replacement;
- }
-
- public boolean isToShortenFQN() {
- return toShortenFQN;
- }
-
- public void setToShortenFQN(boolean shortedFQN) {
- this.toShortenFQN = shortedFQN;
- }
-
- public boolean isToReformatAccordingToStyle() {
- return myToReformatAccordingToStyle;
- }
-
- public MatchOptions getMatchOptions() {
- return matchOptions;
- }
-
- public void setMatchOptions(MatchOptions matchOptions) {
- this.matchOptions = matchOptions;
- }
-
- public void setToReformatAccordingToStyle(boolean reformatAccordingToStyle) {
- myToReformatAccordingToStyle = reformatAccordingToStyle;
- }
-
- public void readExternal(Element element) {
- matchOptions.readExternal(element);
-
- Attribute attribute = element.getAttribute(REFORMAT_ATTR_NAME);
- try {
- myToReformatAccordingToStyle = attribute.getBooleanValue();
- } catch(DataConversionException ex) {
- }
-
- attribute = element.getAttribute(SHORTEN_FQN_ATTR_NAME);
- try {
- toShortenFQN = attribute.getBooleanValue();
- } catch(DataConversionException ex) {}
-
- replacement = element.getAttributeValue(REPLACEMENT_ATTR_NAME);
-
- List<Element> elements = element.getChildren(VARIABLE_DEFINITION_TAG_NAME);
-
- if (elements!=null && elements.size() > 0) {
- for (final Element element1 : elements) {
- final ReplacementVariableDefinition variableDefinition = new ReplacementVariableDefinition();
- variableDefinition.readExternal(element1);
- addVariableDefinition(variableDefinition);
- }
- }
- }
-
- public void writeExternal(Element element) {
- matchOptions.writeExternal(element);
-
- element.setAttribute(REFORMAT_ATTR_NAME,String.valueOf(myToReformatAccordingToStyle));
- element.setAttribute(SHORTEN_FQN_ATTR_NAME,String.valueOf(toShortenFQN));
- element.setAttribute(REPLACEMENT_ATTR_NAME,replacement);
-
- if (variableDefs!=null) {
- for (final ReplacementVariableDefinition variableDefinition : variableDefs.values()) {
- final Element infoElement = new Element(VARIABLE_DEFINITION_TAG_NAME);
- element.addContent(infoElement);
- variableDefinition.writeExternal(infoElement);
- }
- }
- }
-
- public boolean equals(Object o) {
- if (this == o) return true;
- if (!(o instanceof ReplaceOptions)) return false;
-
- final ReplaceOptions replaceOptions = (ReplaceOptions)o;
-
- if (myToReformatAccordingToStyle != replaceOptions.myToReformatAccordingToStyle) return false;
- if (toShortenFQN != replaceOptions.toShortenFQN) return false;
- if (matchOptions != null ? !matchOptions.equals(replaceOptions.matchOptions) : replaceOptions.matchOptions != null) return false;
- if (replacement != null ? !replacement.equals(replaceOptions.replacement) : replaceOptions.replacement != null) return false;
- if (variableDefs != null ? !variableDefs.equals(replaceOptions.variableDefs) : replaceOptions.variableDefs != null) {
- return false;
- }
-
- return true;
- }
-
- public int hashCode() {
- int result;
- result = (replacement != null ? replacement.hashCode() : 0);
- result = 29 * result + (toShortenFQN ? 1 : 0);
- result = 29 * result + (myToReformatAccordingToStyle ? 1 : 0);
- result = 29 * result + (matchOptions != null ? matchOptions.hashCode() : 0);
- result = 29 * result + (variableDefs != null ? variableDefs.hashCode() : 0);
- return result;
- }
-
- public ReplaceOptions clone() {
- try {
- ReplaceOptions replaceOptions = (ReplaceOptions) super.clone();
- replaceOptions.matchOptions = matchOptions.clone();
- return replaceOptions;
- } catch (CloneNotSupportedException e) {
- e.printStackTrace();
- return null;
- }
- }
-
- public <T> T getUserData(@NotNull Key<T> key) {
- if (myUserMap==null) return null;
- return (T)myUserMap.get(key);
- }
-
- public <T> void putUserData(@NotNull Key<T> key, T value) {
- if (myUserMap==null) myUserMap = new THashMap(1);
- myUserMap.put(key,value);
- }
-
- public ReplacementVariableDefinition getVariableDefinition(String name) {
- return variableDefs != null ? variableDefs.get(name): null;
- }
-
- public void addVariableDefinition(ReplacementVariableDefinition definition) {
- if (variableDefs==null) {
- variableDefs = new LinkedHashMap<String, ReplacementVariableDefinition>();
- }
- variableDefs.put( definition.getName(), definition );
- }
-
- public Collection<ReplacementVariableDefinition> getReplacementVariableDefinitions() {
- return variableDefs != null ? variableDefs.values() : Collections.<ReplacementVariableDefinition>emptyList();
- }
-
- public void clearVariableDefinitions() {
- variableDefs = null;
- }
-}
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/impl/ParameterInfo.java b/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/impl/ParameterInfo.java
deleted file mode 100644
index 43ce859b17dd..000000000000
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/impl/ParameterInfo.java
+++ /dev/null
@@ -1,123 +0,0 @@
-package com.intellij.structuralsearch.plugin.replace.impl;
-
-import com.intellij.psi.PsiElement;
-
-public final class ParameterInfo {
- private String name;
- private int startIndex;
- private boolean parameterContext;
- private boolean methodParameterContext;
- private boolean statementContext;
- private boolean variableInitialContext;
- private int afterDelimiterPos;
- private boolean hasCommaBefore;
- private int beforeDelimiterPos;
- private boolean hasCommaAfter;
- private boolean scopeParameterization;
- private boolean replacementVariable;
- private PsiElement myElement;
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public int getStartIndex() {
- return startIndex;
- }
-
- public void setStartIndex(int startIndex) {
- this.startIndex = startIndex;
- }
-
- public boolean isParameterContext() {
- return parameterContext;
- }
-
- public void setParameterContext(boolean parameterContext) {
- this.parameterContext = parameterContext;
- }
-
- public boolean isMethodParameterContext() {
- return methodParameterContext;
- }
-
- public void setMethodParameterContext(boolean methodParameterContext) {
- this.methodParameterContext = methodParameterContext;
- }
-
- public boolean isStatementContext() {
- return statementContext;
- }
-
- public void setStatementContext(boolean statementContext) {
- this.statementContext = statementContext;
- }
-
- public boolean isVariableInitialContext() {
- return variableInitialContext;
- }
-
- public void setVariableInitialContext(boolean variableInitialContext) {
- this.variableInitialContext = variableInitialContext;
- }
-
- public int getAfterDelimiterPos() {
- return afterDelimiterPos;
- }
-
- public void setAfterDelimiterPos(int afterDelimiterPos) {
- this.afterDelimiterPos = afterDelimiterPos;
- }
-
- public boolean isHasCommaBefore() {
- return hasCommaBefore;
- }
-
- public void setHasCommaBefore(boolean hasCommaBefore) {
- this.hasCommaBefore = hasCommaBefore;
- }
-
- public int getBeforeDelimiterPos() {
- return beforeDelimiterPos;
- }
-
- public void setBeforeDelimiterPos(int beforeDelimiterPos) {
- this.beforeDelimiterPos = beforeDelimiterPos;
- }
-
- public boolean isHasCommaAfter() {
- return hasCommaAfter;
- }
-
- public void setHasCommaAfter(boolean hasCommaAfter) {
- this.hasCommaAfter = hasCommaAfter;
- }
-
- public boolean isScopeParameterization() {
- return scopeParameterization;
- }
-
- public void setScopeParameterization(boolean scopeParameterization) {
- this.scopeParameterization = scopeParameterization;
- }
-
- public boolean isReplacementVariable() {
- return replacementVariable;
- }
-
- public void setReplacementVariable(boolean replacementVariable) {
- this.replacementVariable = replacementVariable;
- }
-
- public PsiElement getElement() {
- return myElement;
- }
-
- public void setElement(PsiElement element) {
- myElement = element;
- }
-}
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/impl/ReplacementBuilder.java b/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/impl/ReplacementBuilder.java
deleted file mode 100644
index 81933d9c9a91..000000000000
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/impl/ReplacementBuilder.java
+++ /dev/null
@@ -1,217 +0,0 @@
-package com.intellij.structuralsearch.plugin.replace.impl;
-
-import com.intellij.codeInsight.template.Template;
-import com.intellij.codeInsight.template.TemplateManager;
-import com.intellij.openapi.fileTypes.FileType;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.psi.*;
-import com.intellij.structuralsearch.MalformedPatternException;
-import com.intellij.structuralsearch.MatchResult;
-import com.intellij.structuralsearch.StructuralSearchProfile;
-import com.intellij.structuralsearch.StructuralSearchUtil;
-import com.intellij.structuralsearch.impl.matcher.MatchResultImpl;
-import com.intellij.structuralsearch.impl.matcher.MatcherImplUtil;
-import com.intellij.structuralsearch.impl.matcher.PatternTreeContext;
-import com.intellij.structuralsearch.impl.matcher.predicates.ScriptSupport;
-import com.intellij.structuralsearch.plugin.replace.ReplaceOptions;
-import com.intellij.util.IncorrectOperationException;
-
-import java.util.*;
-
-/**
- * @author maxim
- * Date: 24.02.2004
- * Time: 15:34:57
- */
-public final class ReplacementBuilder {
- private String replacement;
- private List<ParameterInfo> parameterizations;
- private HashMap<String,MatchResult> matchMap;
- private final Map<String, ScriptSupport> replacementVarsMap;
- private final ReplaceOptions options;
- //private Map<TextRange,ParameterInfo> scopedParameterizations;
-
- ReplacementBuilder(final Project project,final ReplaceOptions options) {
- replacementVarsMap = new HashMap<String, ScriptSupport>();
- this.options = options;
- String _replacement = options.getReplacement();
- FileType fileType = options.getMatchOptions().getFileType();
-
- final Template template = TemplateManager.getInstance(project).createTemplate("","",_replacement);
-
- final int segmentsCount = template.getSegmentsCount();
- replacement = template.getTemplateText();
-
- for(int i=0;i<segmentsCount;++i) {
- final int offset = template.getSegmentOffset(i);
- final String name = template.getSegmentName(i);
-
- final ParameterInfo info = new ParameterInfo();
- info.setStartIndex(offset);
- info.setName(name);
- info.setReplacementVariable(options.getVariableDefinition(name) != null);
-
- // find delimiter
- int pos;
- for(pos = offset-1; pos >=0 && pos < replacement.length() && Character.isWhitespace(replacement.charAt(pos));) {
- --pos;
- }
-
- if (pos >= 0) {
- if (replacement.charAt(pos) == ',') {
- info.setHasCommaBefore(true);
- }
- info.setBeforeDelimiterPos(pos);
- }
-
- for(pos = offset; pos < replacement.length() && Character.isWhitespace(replacement.charAt(pos));) {
- ++pos;
- }
-
- if (pos < replacement.length()) {
- final char ch = replacement.charAt(pos);
-
- if (ch == ';') {
- info.setStatementContext(true);
- }
- else if (ch == ',' || ch == ')') {
- info.setParameterContext(true);
- info.setHasCommaAfter(ch == ',');
- }
- info.setAfterDelimiterPos(pos);
- }
-
- if (parameterizations==null) {
- parameterizations = new ArrayList<ParameterInfo>();
- }
-
- parameterizations.add(info);
- }
-
- final StructuralSearchProfile profile = parameterizations != null ? StructuralSearchUtil.getProfileByFileType(fileType) : null;
- if (profile != null) {
- try {
- final PsiElement[] elements = MatcherImplUtil.createTreeFromText(
- _replacement,
- PatternTreeContext.Block,
- fileType,
- options.getMatchOptions().getDialect(),
- options.getMatchOptions().getPatternContext(),
- project,
- false
- );
- if (elements.length > 0) {
- final PsiElement patternNode = elements[0].getParent();
- profile.provideAdditionalReplaceOptions(patternNode, options, this);
- }
- } catch (IncorrectOperationException e) {
- throw new MalformedPatternException();
- }
- }
- }
-
- private static void fill(MatchResult r,Map<String,MatchResult> m) {
- if (r.getName()!=null) {
- if (m.get(r.getName()) == null) {
- m.put(r.getName(), r);
- }
- }
-
- if (!r.isScopeMatch() || !r.isMultipleMatch()) {
- for (final MatchResult matchResult : r.getAllSons()) {
- fill(matchResult, m);
- }
- } else if (r.hasSons()) {
- final List<MatchResult> allSons = r.getAllSons();
- if (allSons.size() > 0) {
- fill(allSons.get(0),m);
- }
- }
- }
-
- String process(MatchResult match, ReplacementInfoImpl replacementInfo, FileType type) {
- if (parameterizations==null) {
- return replacement;
- }
-
- final StringBuilder result = new StringBuilder(replacement);
- matchMap = new HashMap<String,MatchResult>();
- fill(match, matchMap);
-
- int offset = 0;
-
- final StructuralSearchProfile profile = StructuralSearchUtil.getProfileByFileType(type);
-
- for (final ParameterInfo info : parameterizations) {
- MatchResult r = matchMap.get(info.getName());
- if (info.isReplacementVariable()) {
- offset = Replacer.insertSubstitution(result, offset, info, generateReplacement(info, match));
- }
- else if (r != null) {
- offset = profile != null ? profile.handleSubstitution(info, r, result, offset, matchMap) : StructuralSearchProfile.defaultHandleSubstitution(info, r, result, offset);
- }
- else {
- if (info.isHasCommaBefore()) {
- result.delete(info.getBeforeDelimiterPos() + offset, info.getBeforeDelimiterPos() + 1 + offset);
- --offset;
- }
- else if (info.isHasCommaAfter()) {
- result.delete(info.getAfterDelimiterPos() + offset, info.getAfterDelimiterPos() + 1 + offset);
- --offset;
- }
- else if (info.isVariableInitialContext()) {
- //if (info.afterDelimiterPos > 0) {
- result.delete(info.getBeforeDelimiterPos() + offset, info.getAfterDelimiterPos() + offset - 1);
- offset -= (info.getAfterDelimiterPos() - info.getBeforeDelimiterPos() - 1);
- //}
- } else if (profile != null) {
- offset = profile.processAdditionalOptions(info, offset, result, r);
- }
- offset = Replacer.insertSubstitution(result, offset, info, "");
- }
- }
-
- replacementInfo.variableMap = (HashMap<String, MatchResult>)matchMap.clone();
- matchMap.clear();
- return result.toString();
- }
-
- private String generateReplacement(ParameterInfo info, MatchResult match) {
- ScriptSupport scriptSupport = replacementVarsMap.get(info.getName());
-
- if (scriptSupport == null) {
- String constraint = options.getVariableDefinition(info.getName()).getScriptCodeConstraint();
- scriptSupport = new ScriptSupport(StringUtil.stripQuotesAroundValue(constraint), info.getName());
- replacementVarsMap.put(info.getName(), scriptSupport);
- }
- return scriptSupport.evaluate((MatchResultImpl)match, null);
- }
-
- public ParameterInfo findParameterization(String name) {
- if (parameterizations==null) return null;
-
- for (final ParameterInfo info : parameterizations) {
-
- if (info.getName().equals(name)) {
- return info;
- }
- }
-
- return null;
- }
-
- public void clear() {
- replacement = null;
-
- if (parameterizations!=null) {
- parameterizations.clear();
- parameterizations = null;
- }
- }
-
- public void addParametrization(ParameterInfo e) {
- assert parameterizations != null;
- parameterizations.add(e);
- }
-}
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/impl/Replacer.java b/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/impl/Replacer.java
deleted file mode 100644
index 9980e95c77d7..000000000000
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/impl/Replacer.java
+++ /dev/null
@@ -1,424 +0,0 @@
-package com.intellij.structuralsearch.plugin.replace.impl;
-
-import com.intellij.codeInsight.template.Template;
-import com.intellij.codeInsight.template.TemplateManager;
-import com.intellij.lang.Language;
-import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.command.CommandProcessor;
-import com.intellij.openapi.fileEditor.FileDocumentManager;
-import com.intellij.openapi.fileTypes.FileType;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.psi.*;
-import com.intellij.psi.codeStyle.CodeStyleManager;
-import com.intellij.psi.search.LocalSearchScope;
-import com.intellij.structuralsearch.*;
-import com.intellij.structuralsearch.impl.matcher.MatcherImplUtil;
-import com.intellij.structuralsearch.impl.matcher.PatternTreeContext;
-import com.intellij.structuralsearch.impl.matcher.predicates.ScriptSupport;
-import com.intellij.structuralsearch.plugin.replace.ReplaceOptions;
-import com.intellij.structuralsearch.plugin.replace.ReplacementInfo;
-import com.intellij.structuralsearch.plugin.util.CollectingMatchResultSink;
-import com.intellij.util.IncorrectOperationException;
-import org.jetbrains.annotations.Nullable;
-
-import java.util.*;
-
-/**
- * @author Maxim.Mossienko
- * Date: Mar 4, 2004
- * Time: 9:19:34 PM
- */
-public class Replacer {
- private final Project project;
- private ReplacementBuilder replacementBuilder;
- private ReplaceOptions options;
- private ReplacementContext context;
- private StructuralReplaceHandler replaceHandler;
-
- public Replacer(Project project, ReplaceOptions options) {
- this.project = project;
- this.options = options;
- }
-
- public static String stripTypedVariableDecoration(final String type) {
- return type.substring(1,type.length()-1);
- }
-
- public static int insertSubstitution(StringBuilder result, int offset, final ParameterInfo info, String image) {
- if (image.length() > 0) result.insert(offset+ info.getStartIndex(),image);
- offset += image.length();
- return offset;
- }
-
- public String testReplace(String in, String what, String by, ReplaceOptions options) throws IncorrectOperationException {
- return testReplace(in, what, by, options,false);
- }
-
- public String testReplace(String in, String what, String by, ReplaceOptions options, boolean filePattern) {
- FileType type = options.getMatchOptions().getFileType();
- return testReplace(in, what, by, options, filePattern, false, type, null);
- }
-
- public String testReplace(String in, String what, String by, ReplaceOptions options, boolean filePattern, boolean createPhysicalFile,
- FileType sourceFileType, Language sourceDialect) {
- this.options = options;
- this.options.getMatchOptions().setSearchPattern(what);
- this.options.setReplacement(by);
- replacementBuilder=null;
- context = null;
- replaceHandler = null;
-
- this.options.getMatchOptions().clearVariableConstraints();
- MatcherImplUtil.transform(this.options.getMatchOptions());
-
- checkSupportedReplacementPattern(project, options);
-
- Matcher matcher = new Matcher(project);
- try {
- PsiElement firstElement, lastElement, parent;
-
- if (options.getMatchOptions().getScope() == null) {
- PsiElement[] elements = MatcherImplUtil.createTreeFromText(
- in,
- filePattern ? PatternTreeContext.File : PatternTreeContext.Block,
- sourceFileType, sourceDialect, null,
- project,
- createPhysicalFile
- );
-
- firstElement = elements[0];
- lastElement = elements[elements.length-1];
- parent = firstElement.getParent();
-
- this.options.getMatchOptions().setScope(
- new LocalSearchScope(parent)
- );
- } else {
- parent = ((LocalSearchScope)options.getMatchOptions().getScope()).getScope()[0];
- firstElement = parent.getFirstChild();
- lastElement = parent.getLastChild();
- }
-
- this.options.getMatchOptions().setResultIsContextMatch(true);
- CollectingMatchResultSink sink = new CollectingMatchResultSink();
- matcher.testFindMatches(sink, this.options.getMatchOptions());
-
- final List<ReplacementInfo> resultPtrList = new ArrayList<ReplacementInfo>();
-
- for (final MatchResult result : sink.getMatches()) {
- resultPtrList.add(buildReplacement(result));
- }
-
- sink.getMatches().clear();
-
- int startOffset = firstElement.getTextRange().getStartOffset();
- int endOffset = filePattern ?0: parent.getTextLength() - (lastElement.getTextRange().getEndOffset());
-
- // get nodes from text may contain
- PsiElement prevSibling = firstElement.getPrevSibling();
- if (prevSibling instanceof PsiWhiteSpace) {
- startOffset -= prevSibling.getTextLength() - 1;
- }
-
- PsiElement nextSibling = lastElement.getNextSibling();
- if (nextSibling instanceof PsiWhiteSpace) {
- endOffset -= nextSibling.getTextLength() - 1;
- }
-
- replaceAll(resultPtrList);
-
- String result = parent.getText();
- result = result.substring(startOffset);
- result = result.substring(0,result.length() - endOffset);
-
- return result;
- }
- catch (Exception e) {
- throw new IncorrectOperationException(e);
- }
- finally {
- options.getMatchOptions().setScope(null);
- }
- }
-
- public void replaceAll(final List<ReplacementInfo> resultPtrList) {
- PsiElement lastAffectedElement = null;
- PsiElement currentAffectedElement;
-
- for (ReplacementInfo info : resultPtrList) {
- PsiElement element = info.getMatch(0);
- initContextAndHandler(element);
- if (replaceHandler != null) {
- replaceHandler.prepare(info);
- }
- }
-
- for (final ReplacementInfo aResultPtrList : resultPtrList) {
- currentAffectedElement = doReplace(aResultPtrList);
-
- if (currentAffectedElement != lastAffectedElement) {
- if (lastAffectedElement != null) reformatAndShortenRefs(lastAffectedElement);
- lastAffectedElement = currentAffectedElement;
- }
- }
-
- reformatAndShortenRefs(lastAffectedElement);
- }
-
- public void replace(ReplacementInfo info) {
- PsiElement element = info.getMatch(0);
- initContextAndHandler(element);
-
- if (replaceHandler != null) {
- replaceHandler.prepare(info);
- }
- reformatAndShortenRefs(doReplace(info));
- }
-
- @Nullable
- private PsiElement doReplace(final ReplacementInfo info) {
- final ReplacementInfoImpl replacementInfo = (ReplacementInfoImpl)info;
- final PsiElement element = replacementInfo.matchesPtrList.get(0).getElement();
-
- if (element==null || !element.isWritable() || !element.isValid()) return null;
-
- final PsiElement elementParent = element.getParent();
-
- //noinspection HardCodedStringLiteral
- CommandProcessor.getInstance().executeCommand(
- project,
- new Runnable() {
- public void run() {
- ApplicationManager.getApplication().runWriteAction(
- new Runnable() {
- public void run() {
- doReplace(element, replacementInfo);
- }
- }
- );
- PsiDocumentManager.getInstance(project).commitAllDocuments();
- }
- },
- "ssreplace",
- "test"
- );
-
- if (!elementParent.isValid() || !elementParent.isWritable()) {
- return null;
- }
-
- return elementParent;
- }
-
- private void reformatAndShortenRefs(final PsiElement elementParent) {
- if (elementParent == null) return;
- final Runnable action = new Runnable() {
- public void run() {
- CodeStyleManager codeStyleManager = CodeStyleManager.getInstance(PsiManager.getInstance(project).getProject());
- final PsiFile containingFile = elementParent.getContainingFile();
-
- if (containingFile != null && options.isToReformatAccordingToStyle()) {
- if (containingFile.getVirtualFile() != null) {
- PsiDocumentManager.getInstance(project)
- .commitDocument(FileDocumentManager.getInstance().getDocument(containingFile.getVirtualFile()));
- }
-
- final int parentOffset = elementParent.getTextRange().getStartOffset();
-
- codeStyleManager.reformatRange(containingFile, parentOffset, parentOffset + elementParent.getTextLength(), true);
- }
- }
- };
-
- CommandProcessor.getInstance().executeCommand(
- project,
- new Runnable() {
- public void run() {
- ApplicationManager.getApplication().runWriteAction(action);
- }
- },
- "reformat and shorten refs after ssr",
- "test"
- );
- }
-
- private void doReplace(final PsiElement elementToReplace,
- final ReplacementInfoImpl info) {
- CodeStyleManager.getInstance(project).performActionWithFormatterDisabled(new Runnable() {
- public void run() {
- initContextAndHandler(elementToReplace);
-
- context.replacementInfo = info;
-
- if (replaceHandler != null) {
- replaceHandler.replace(info, options);
- }
- }
- }
- );
- }
-
- private void initContextAndHandler(PsiElement psiContext) {
- if (context == null) {
- context = new ReplacementContext(options, project);
- }
- if (replaceHandler == null) {
- StructuralSearchProfile profile = StructuralSearchUtil.getProfileByPsiElement(psiContext);
- if (profile != null) {
- replaceHandler = profile.getReplaceHandler(this.context);
- }
- }
- }
-
- public static void handleComments(final PsiElement el, final PsiElement replacement, ReplacementContext context) throws IncorrectOperationException {
- ReplacementInfoImpl replacementInfo = context.replacementInfo;
- if (replacementInfo.elementToVariableNameMap == null) {
- replacementInfo.elementToVariableNameMap = new HashMap<PsiElement, String>(1);
- Map<String, MatchResult> variableMap = replacementInfo.variableMap;
- if (variableMap != null) {
- for(String name:variableMap.keySet()) {
- fill(name,replacementInfo.variableMap.get(name),replacementInfo.elementToVariableNameMap);
- }
- }
- }
-
- PsiElement lastChild = el.getLastChild();
- if (lastChild instanceof PsiComment &&
- replacementInfo.elementToVariableNameMap.get(lastChild) == null &&
- !(replacement.getLastChild() instanceof PsiComment)
- ) {
- PsiElement firstElementAfterStatementEnd = lastChild;
- for(PsiElement curElement=firstElementAfterStatementEnd.getPrevSibling();curElement!=null;curElement = curElement.getPrevSibling()) {
- if (!(curElement instanceof PsiWhiteSpace) && !(curElement instanceof PsiComment)) break;
- firstElementAfterStatementEnd = curElement;
- }
- replacement.addRangeAfter(firstElementAfterStatementEnd,lastChild,replacement.getLastChild());
- }
-
- final PsiElement firstChild = el.getFirstChild();
- if (firstChild instanceof PsiComment &&
- !(firstChild instanceof PsiDocCommentBase) &&
- replacementInfo.elementToVariableNameMap.get(firstChild) == null
- ) {
- PsiElement lastElementBeforeStatementStart = firstChild;
-
- for(PsiElement curElement=lastElementBeforeStatementStart.getNextSibling();curElement!=null;curElement = curElement.getNextSibling()) {
- if (!(curElement instanceof PsiWhiteSpace) && !(curElement instanceof PsiComment)) break;
- lastElementBeforeStatementStart = curElement;
- }
- replacement.addRangeBefore(firstChild,lastElementBeforeStatementStart,replacement.getFirstChild());
- }
- }
-
- private static void fill(final String name, final MatchResult matchResult, final Map<PsiElement, String> elementToVariableNameMap) {
- boolean b = matchResult.isMultipleMatch() || matchResult.isScopeMatch();
- if(matchResult.hasSons() && b) {
- for(MatchResult r:matchResult.getAllSons()) {
- fill(name, r, elementToVariableNameMap);
- }
- } else if (!b && matchResult.getMatchRef() != null) {
- elementToVariableNameMap.put(matchResult.getMatch(),name);
- }
- }
-
- public static void checkSupportedReplacementPattern(Project project, ReplaceOptions options) throws UnsupportedPatternException {
- try {
- String search = options.getMatchOptions().getSearchPattern();
- String replacement = options.getReplacement();
- FileType fileType = options.getMatchOptions().getFileType();
- Template template = TemplateManager.getInstance(project).createTemplate("","",search);
- Template template2 = TemplateManager.getInstance(project).createTemplate("","",replacement);
-
- int segmentCount = template2.getSegmentsCount();
- for(int i=0;i<segmentCount;++i) {
- final String replacementSegmentName = template2.getSegmentName(i);
- final int segmentCount2 = template.getSegmentsCount();
- int j;
-
- for(j=0;j<segmentCount2;++j) {
- final String searchSegmentName = template.getSegmentName(j);
-
- if (replacementSegmentName.equals(searchSegmentName)) break;
-
- // Reference to
- if (replacementSegmentName.startsWith(searchSegmentName) &&
- replacementSegmentName.charAt(searchSegmentName.length())=='_'
- ) {
- try {
- Integer.parseInt(replacementSegmentName.substring(searchSegmentName.length()+1));
- break;
- } catch(NumberFormatException ex) {}
- }
- }
-
- if (j==segmentCount2) {
- ReplacementVariableDefinition definition = options.getVariableDefinition(replacementSegmentName);
-
- if (definition == null || definition.getScriptCodeConstraint().length() <= 2 /*empty quotes*/) {
- throw new UnsupportedPatternException(
- SSRBundle.message("replacement.variable.is.not.defined.message", replacementSegmentName)
- );
- } else {
- String message = ScriptSupport.checkValidScript(StringUtil.stripQuotesAroundValue(definition.getScriptCodeConstraint()));
- if (message != null) {
- throw new UnsupportedPatternException(
- SSRBundle.message("replacement.variable.is.not.valid", replacementSegmentName, message)
- );
- }
- }
- }
- }
-
- StructuralSearchProfile profile = StructuralSearchUtil.getProfileByFileType(fileType);
-
- profile.checkReplacementPattern(project, options);
-
- } catch(IncorrectOperationException ex) {
- throw new UnsupportedPatternException(SSRBundle.message("incorrect.pattern.message"));
- }
- }
-
- public ReplacementInfo buildReplacement(MatchResult result) {
- List<SmartPsiElementPointer> l = new ArrayList<SmartPsiElementPointer>();
- SmartPointerManager manager = SmartPointerManager.getInstance(project);
-
- if (MatchResult.MULTI_LINE_MATCH.equals(result.getName())) {
- for(Iterator<MatchResult> i=result.getAllSons().iterator();i.hasNext();) {
- final MatchResult r = i.next();
-
- if (MatchResult.LINE_MATCH.equals(r.getName())) {
- PsiElement element = r.getMatchRef().getElement();
-
- if (element instanceof PsiDocCommentBase) { // doc comment is not collapsed when created in block
- if (i.hasNext()) {
- MatchResult matchResult = i.next();
-
- if (MatchResult.LINE_MATCH.equals(matchResult.getName()) &&
- StructuralSearchUtil.isDocCommentOwner(matchResult.getMatch())) {
- element = matchResult.getMatch();
- } else {
- l.add( manager.createSmartPsiElementPointer(element) );
- element = matchResult.getMatch();
- }
- }
- }
- l.add( manager.createSmartPsiElementPointer(element) );
- }
- }
- } else {
- l.add( manager.createSmartPsiElementPointer(result.getMatchRef().getElement()));
- }
-
- ReplacementInfoImpl replacementInfo = new ReplacementInfoImpl();
-
- replacementInfo.matchesPtrList = l;
- if (replacementBuilder==null) {
- replacementBuilder = new ReplacementBuilder(project,options);
- }
- replacementInfo.result = replacementBuilder.process(result, replacementInfo, options.getMatchOptions().getFileType());
- replacementInfo.matchResult = result;
-
- return replacementInfo;
- }
-}
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/ui/ReplaceCommand.java b/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/ui/ReplaceCommand.java
deleted file mode 100644
index 32b99d76456d..000000000000
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/ui/ReplaceCommand.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package com.intellij.structuralsearch.plugin.replace.ui;
-
-import com.intellij.structuralsearch.plugin.ui.SearchCommand;
-import com.intellij.structuralsearch.plugin.StructuralSearchPlugin;
-import com.intellij.structuralsearch.plugin.replace.ReplaceOptions;
-import com.intellij.structuralsearch.MatchResult;
-import com.intellij.openapi.project.Project;
-import com.intellij.usages.Usage;
-
-/**
- * Created by IntelliJ IDEA.
- * User: Maxim.Mossienko
- * Date: Mar 31, 2004
- * Time: 3:54:03 PM
- * To change this template use File | Settings | File Templates.
- */
-public class ReplaceCommand extends SearchCommand {
- private final ReplaceOptions options;
-
- public ReplaceCommand(Project project, ReplaceUsageViewContext context) {
- super( project, context );
- options = ((ReplaceConfiguration)context.getConfiguration()).getOptions();
-
- }
-
- protected void findStarted() {
- super.findStarted();
-
- StructuralSearchPlugin.getInstance(project).setReplaceInProgress(true);
- }
-
- protected void findEnded() {
- StructuralSearchPlugin.getInstance(project).setReplaceInProgress( false );
-
- super.findEnded();
- }
-
- protected void foundUsage(MatchResult result, Usage usage) {
- super.foundUsage(result, usage);
-
- final ReplaceUsageViewContext replaceUsageViewContext = ((ReplaceUsageViewContext)context);
- replaceUsageViewContext.addReplaceUsage(usage,replaceUsageViewContext.getReplacer().buildReplacement(result));
- }
-
- public ReplaceOptions getOptions() {
- return options;
- }
-}
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/ui/ReplaceDialog.java b/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/ui/ReplaceDialog.java
deleted file mode 100644
index 2ae0b18469fb..000000000000
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/ui/ReplaceDialog.java
+++ /dev/null
@@ -1,206 +0,0 @@
-package com.intellij.structuralsearch.plugin.replace.ui;
-
-import com.intellij.codeInsight.template.impl.Variable;
-import com.intellij.openapi.editor.Editor;
-import com.intellij.openapi.editor.EditorFactory;
-import com.intellij.openapi.ui.Splitter;
-import com.intellij.structuralsearch.MalformedPatternException;
-import com.intellij.structuralsearch.ReplacementVariableDefinition;
-import com.intellij.structuralsearch.SSRBundle;
-import com.intellij.structuralsearch.UnsupportedPatternException;
-import com.intellij.structuralsearch.plugin.replace.ReplaceOptions;
-import com.intellij.structuralsearch.plugin.replace.impl.Replacer;
-import com.intellij.structuralsearch.plugin.ui.*;
-import com.intellij.util.containers.hash.LinkedHashMap;
-
-import javax.swing.*;
-import java.awt.*;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-// Class to show the user the request for search
-
-@SuppressWarnings({"RefusedBequest"})
-public class ReplaceDialog extends SearchDialog {
- private Editor replaceCriteriaEdit;
- private JCheckBox shortenFQN;
- private JCheckBox formatAccordingToStyle;
-
- private String mySavedEditorText;
-
- protected String getDefaultTitle() {
- return SSRBundle.message("structural.replace.title");
- }
-
- protected boolean isChanged(Configuration configuration) {
- if (super.isChanged(configuration)) return true;
-
- String replacement;
-
- if (configuration instanceof ReplaceConfiguration) {
- replacement = ((ReplaceConfiguration)configuration).getOptions().getReplacement();
- }
- else {
- replacement = configuration.getMatchOptions().getSearchPattern();
- }
-
- if (replacement == null) return false;
-
- return !replaceCriteriaEdit.getDocument().getText().equals(replacement);
- }
-
- protected JComponent createEditorContent() {
- JPanel result = new JPanel(new BorderLayout());
- Splitter p;
-
- result.add(BorderLayout.CENTER, p = new Splitter(true, 0.5f));
- p.setFirstComponent(super.createEditorContent());
-
- replaceCriteriaEdit = createEditor(searchContext, mySavedEditorText != null ? mySavedEditorText : "");
- JPanel replace = new JPanel(new BorderLayout());
- replace.add(BorderLayout.NORTH, new JLabel(SSRBundle.message("replacement.template.label")));
- replace.add(BorderLayout.CENTER, replaceCriteriaEdit.getComponent());
- replaceCriteriaEdit.getComponent().setMinimumSize(new Dimension(150, 100));
-
- p.setSecondComponent(replace);
-
- return result;
- }
-
- protected int getRowsCount() {
- return super.getRowsCount() + 1;
- }
-
- protected String getDimensionServiceKey() {
- return "#com.intellij.structuralsearch.plugin.replace.ui.ReplaceDialog";
- }
-
- protected void buildOptions(JPanel searchOptions) {
- super.buildOptions(searchOptions);
- searchOptions
- .add(UIUtil.createOptionLine(shortenFQN = new JCheckBox(SSRBundle.message("shorten.fully.qualified.names.checkbox"), true)));
-
- searchOptions
- .add(UIUtil.createOptionLine(formatAccordingToStyle = new JCheckBox(SSRBundle.message("format.according.to.style.checkbox"), true)));
-
- }
-
- protected UsageViewContext createUsageViewContext(Configuration configuration) {
- return new ReplaceUsageViewContext(searchContext, configuration);
- }
-
- public ReplaceDialog(SearchContext searchContext) {
- super(searchContext);
- }
-
- public ReplaceDialog(SearchContext searchContext, boolean showScope, boolean runFindActionOnClose) {
- super(searchContext, showScope, runFindActionOnClose);
- }
-
-
- public Configuration createConfiguration() {
- ReplaceConfiguration configuration = new ReplaceConfiguration();
- configuration.setName(USER_DEFINED);
- return configuration;
- }
-
- protected void disposeEditorContent() {
- mySavedEditorText = replaceCriteriaEdit.getDocument().getText();
- EditorFactory.getInstance().releaseEditor(replaceCriteriaEdit);
- super.disposeEditorContent();
- }
-
- public void setValuesFromConfig(Configuration configuration) {
- //replaceCriteriaEdit.putUserData(SubstitutionShortInfoHandler.CURRENT_CONFIGURATION_KEY, configuration);
-
- if (configuration instanceof ReplaceConfiguration) {
- final ReplaceConfiguration config = (ReplaceConfiguration)configuration;
- final ReplaceOptions options = config.getOptions();
- super.setValuesFromConfig(config);
-
- UIUtil.setContent(replaceCriteriaEdit, config.getOptions().getReplacement(), 0, replaceCriteriaEdit.getDocument().getTextLength(),
- searchContext.getProject());
-
- shortenFQN.setSelected(options.isToShortenFQN());
- formatAccordingToStyle.setSelected(options.isToReformatAccordingToStyle());
-
- ReplaceOptions newReplaceOptions = ((ReplaceConfiguration)model.getConfig()).getOptions();
- newReplaceOptions.clearVariableDefinitions();
-
- for (ReplacementVariableDefinition def : options.getReplacementVariableDefinitions()) {
- newReplaceOptions.addVariableDefinition((ReplacementVariableDefinition)def.clone());
- }
- }
- else {
- super.setValuesFromConfig(configuration);
-
- UIUtil.setContent(replaceCriteriaEdit, configuration.getMatchOptions().getSearchPattern(), 0,
- replaceCriteriaEdit.getDocument().getTextLength(), searchContext.getProject());
- }
- }
-
- protected void setValuesToConfig(Configuration config) {
- super.setValuesToConfig(config);
-
- final ReplaceConfiguration replaceConfiguration = (ReplaceConfiguration)config;
- final ReplaceOptions options = replaceConfiguration.getOptions();
-
- options.setMatchOptions(replaceConfiguration.getMatchOptions());
- options.setReplacement(replaceCriteriaEdit.getDocument().getText());
- options.setToShortenFQN(shortenFQN.isSelected());
- options.setToReformatAccordingToStyle(formatAccordingToStyle.isSelected());
- }
-
- protected boolean isRecursiveSearchEnabled() {
- return false;
- }
-
- protected java.util.List<Variable> getVariablesFromListeners() {
- ArrayList<Variable> vars = getVarsFrom(replaceCriteriaEdit);
- List<Variable> searchVars = super.getVariablesFromListeners();
- Map<String, Variable> varsMap = new LinkedHashMap<String, Variable>(searchVars.size());
-
- for(Variable var:searchVars) varsMap.put(var.getName(), var);
- for(Variable var:vars) {
- if (!varsMap.containsKey(var.getName())) {
- String newVarName = var.getName() + ReplaceConfiguration.REPLACEMENT_VARIABLE_SUFFIX;
- varsMap.put(newVarName, new Variable(newVarName, null, null, false, false));
- }
- }
- return new ArrayList<Variable>(varsMap.values());
- }
-
- protected boolean isValid() {
- if (!super.isValid()) return false;
-
- try {
- Replacer.checkSupportedReplacementPattern(searchContext.getProject(), ((ReplaceConfiguration)model.getConfig()).getOptions());
- }
- catch (UnsupportedPatternException ex) {
- reportMessage("unsupported.replacement.pattern.message", replaceCriteriaEdit, ex.getMessage());
- return false;
- }
- catch (MalformedPatternException ex) {
- reportMessage("malformed.replacement.pattern.message", replaceCriteriaEdit, ex.getMessage());
- return false;
- }
-
- return true;
- }
-
- public void show() {
- replaceCriteriaEdit.putUserData(SubstitutionShortInfoHandler.CURRENT_CONFIGURATION_KEY, model.getConfig());
-
- super.show();
- }
-
- protected boolean isReplaceDialog() {
- return true;
- }
-
- protected void addOrReplaceSelection(final String selection) {
- super.addOrReplaceSelection(selection);
- addOrReplaceSelectionForEditor(selection, replaceCriteriaEdit);
- }
-}
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/SearchCommand.java b/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/SearchCommand.java
deleted file mode 100644
index 7c51fa85af3b..000000000000
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/SearchCommand.java
+++ /dev/null
@@ -1,145 +0,0 @@
-package com.intellij.structuralsearch.plugin.ui;
-
-import com.intellij.notification.NotificationGroup;
-import com.intellij.openapi.application.ModalityState;
-import com.intellij.openapi.progress.ProgressIndicator;
-import com.intellij.openapi.progress.ProgressManager;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.ui.MessageType;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.openapi.wm.ToolWindowId;
-import com.intellij.psi.PsiElement;
-import com.intellij.psi.PsiFile;
-import com.intellij.psi.PsiNameIdentifierOwner;
-import com.intellij.structuralsearch.*;
-import com.intellij.structuralsearch.impl.matcher.MatchResultImpl;
-import com.intellij.structuralsearch.plugin.StructuralSearchPlugin;
-import com.intellij.structuralsearch.plugin.ui.actions.DoSearchAction;
-import com.intellij.usageView.UsageInfo;
-import com.intellij.usages.Usage;
-import com.intellij.usages.UsageInfo2UsageAdapter;
-import com.intellij.util.Alarm;
-import com.intellij.util.ObjectUtils;
-import com.intellij.util.Processor;
-
-/**
- * Created by IntelliJ IDEA.
- * User: Maxim.Mossienko
- * Date: Mar 15, 2004
- * Time: 4:49:07 PM
- * To change this template use File | Settings | File Templates.
- */
-public class SearchCommand {
- protected UsageViewContext context;
- private MatchingProcess process;
- protected Project project;
-
- public SearchCommand(Project _project, UsageViewContext _context) {
- project = _project;
- context = _context;
- }
-
- public void findUsages(final Processor<Usage> processor) {
- final ProgressIndicator progress = ProgressManager.getInstance().getProgressIndicator();
-
- try {
- DoSearchAction.execute(
- project,
- new MatchResultSink() {
- int count;
-
- public void setMatchingProcess(MatchingProcess _process) {
- process = _process;
- findStarted();
- }
-
- public void processFile(PsiFile element) {
- final VirtualFile virtualFile = element.getVirtualFile();
- if (virtualFile != null)
- progress.setText(SSRBundle.message("looking.in.progress.message", virtualFile.getPresentableName()));
- }
-
- public void matchingFinished() {
- findEnded();
- progress.setText(SSRBundle.message("found.progress.message", count));
- }
-
- public ProgressIndicator getProgressIndicator() {
- return progress;
- }
-
- public void newMatch(MatchResult result) {
- UsageInfo info;
-
- if (MatchResult.MULTI_LINE_MATCH.equals(result.getName())) {
- int start = -1;
- int end = -1;
- PsiElement parent = result.getMatchRef().getElement().getParent();
-
- for (final MatchResult matchResult : ((MatchResultImpl)result).getMatches()) {
- PsiElement el = matchResult.getMatchRef().getElement();
- final int elementStart = el.getTextRange().getStartOffset();
-
- if (start == -1 || start > elementStart) {
- start = elementStart;
- }
- final int newend = elementStart + el.getTextLength();
-
- if (newend > end) {
- end = newend;
- }
- }
-
- final int parentStart = parent.getTextRange().getStartOffset();
- int startOffset = start - parentStart;
- info = new UsageInfo(parent, startOffset, end - parentStart);
- }
- else {
- PsiElement element = result.getMatch();
- if (element instanceof PsiNameIdentifierOwner) {
- element = ObjectUtils.notNull(((PsiNameIdentifierOwner)element).getNameIdentifier(), element);
- }
- info = new UsageInfo(element, result.getStart(), result.getEnd() == -1 ? element.getTextLength() : result.getEnd());
- }
-
- Usage usage = new UsageInfo2UsageAdapter(info);
- processor.process(usage);
- foundUsage(result, usage);
- ++count;
- }
- },
- context.getConfiguration()
- );
- }
- catch (final StructuralSearchException e) {
- final Alarm alarm = new Alarm();
- alarm.addRequest(
- new Runnable() {
- @Override
- public void run() {
- NotificationGroup.toolWindowGroup("Structural Search", ToolWindowId.FIND, true)
- .createNotification(SSRBundle.message("problem", e.getMessage()), MessageType.ERROR).notify(project);
- }
- },
- 100, ModalityState.NON_MODAL
- );
- }
- }
-
- public void stopAsyncSearch() {
- if (process!=null) process.stop();
- }
-
- protected void findStarted() {
- StructuralSearchPlugin.getInstance(project).setSearchInProgress(true);
- }
-
- protected void findEnded() {
- if (!project.isDisposed()) {
- StructuralSearchPlugin.getInstance(project).setSearchInProgress(false);
- }
- }
-
- protected void foundUsage(MatchResult result, Usage usage) {
- }
-}
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/SearchDialog.java b/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/SearchDialog.java
deleted file mode 100644
index 5255472d4ce6..000000000000
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/SearchDialog.java
+++ /dev/null
@@ -1,1000 +0,0 @@
-package com.intellij.structuralsearch.plugin.ui;
-
-import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer;
-import com.intellij.codeInsight.template.impl.Variable;
-import com.intellij.find.FindBundle;
-import com.intellij.find.FindProgressIndicator;
-import com.intellij.find.FindSettings;
-import com.intellij.ide.IdeBundle;
-import com.intellij.ide.util.scopeChooser.ScopeChooserCombo;
-import com.intellij.lang.Language;
-import com.intellij.lang.LanguageUtil;
-import com.intellij.openapi.application.Result;
-import com.intellij.openapi.application.WriteAction;
-import com.intellij.openapi.command.WriteCommandAction;
-import com.intellij.openapi.editor.Document;
-import com.intellij.openapi.editor.Editor;
-import com.intellij.openapi.editor.EditorFactory;
-import com.intellij.openapi.editor.SelectionModel;
-import com.intellij.openapi.editor.event.DocumentEvent;
-import com.intellij.openapi.editor.event.DocumentListener;
-import com.intellij.openapi.fileEditor.FileEditorManager;
-import com.intellij.openapi.fileTypes.FileType;
-import com.intellij.openapi.fileTypes.LanguageFileType;
-import com.intellij.openapi.fileTypes.impl.FileTypeRenderer;
-import com.intellij.openapi.progress.ProgressIndicator;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.ui.ComboBox;
-import com.intellij.openapi.ui.DialogWrapper;
-import com.intellij.openapi.util.Disposer;
-import com.intellij.openapi.util.Factory;
-import com.intellij.openapi.util.TextRange;
-import com.intellij.openapi.wm.ToolWindow;
-import com.intellij.openapi.wm.ToolWindowId;
-import com.intellij.openapi.wm.ToolWindowManager;
-import com.intellij.psi.PsiDocumentManager;
-import com.intellij.psi.PsiElement;
-import com.intellij.psi.PsiFile;
-import com.intellij.psi.codeStyle.CodeStyleManager;
-import com.intellij.psi.search.GlobalSearchScope;
-import com.intellij.psi.search.SearchScope;
-import com.intellij.structuralsearch.*;
-import com.intellij.structuralsearch.impl.matcher.MatcherImpl;
-import com.intellij.structuralsearch.plugin.StructuralSearchPlugin;
-import com.intellij.ui.ComboboxSpeedSearch;
-import com.intellij.ui.IdeBorderFactory;
-import com.intellij.ui.ListCellRendererWrapper;
-import com.intellij.ui.TitledSeparator;
-import com.intellij.usages.*;
-import com.intellij.util.Alarm;
-import com.intellij.util.Processor;
-import org.jetbrains.annotations.NonNls;
-import org.jetbrains.annotations.NotNull;
-
-import javax.swing.*;
-import java.awt.*;
-import java.awt.event.ActionEvent;
-import java.awt.event.ItemEvent;
-import java.awt.event.ItemListener;
-import java.util.*;
-import java.util.List;
-
-/**
- * Class to show the user the request for search
- */
-@SuppressWarnings({"RefusedBequest", "AssignmentToStaticFieldFromInstanceMethod"})
-public class SearchDialog extends DialogWrapper implements ConfigurationCreator {
- protected SearchContext searchContext;
-
- // text for search
- protected Editor searchCriteriaEdit;
-
- // options of search scope
- private ScopeChooserCombo myScopeChooserCombo;
-
- private JCheckBox recursiveMatching;
- private JCheckBox caseSensitiveMatch;
-
- private JComboBox fileTypes;
- private JComboBox contexts;
- private JComboBox dialects;
- private JLabel status;
- private JLabel statusText;
-
- protected SearchModel model;
- private JCheckBox openInNewTab;
- private final Alarm myAlarm = new Alarm(Alarm.ThreadToUse.SHARED_THREAD);
-
- public static final String USER_DEFINED = SSRBundle.message("new.template.defaultname");
- protected final ExistingTemplatesComponent existingTemplatesComponent;
-
- private boolean useLastConfiguration;
-
- private static boolean ourOpenInNewTab;
-
- @NonNls private FileType ourFtSearchVariant = StructuralSearchUtil.getDefaultFileType();
- private static Language ourDialect = null;
- private static String ourContext = null;
-
- private final boolean myShowScopePanel;
- private final boolean myRunFindActionOnClose;
- private boolean myDoingOkAction;
-
- private String mySavedEditorText;
- private JPanel myContentPanel;
- private JComponent myEditorPanel;
-
- public SearchDialog(SearchContext searchContext) {
- this(searchContext, true, true);
- }
-
- public SearchDialog(SearchContext searchContext, boolean showScope, boolean runFindActionOnClose) {
- super(searchContext.getProject(), true);
-
- if (showScope) setModal(false);
- myShowScopePanel = showScope;
- myRunFindActionOnClose = runFindActionOnClose;
- this.searchContext = (SearchContext)searchContext.clone();
- setTitle(getDefaultTitle());
-
- if (runFindActionOnClose) {
- setOKButtonText(FindBundle.message("find.dialog.find.button"));
- }
-
- existingTemplatesComponent = ExistingTemplatesComponent.getInstance(this.searchContext.getProject());
- model = new SearchModel(createConfiguration());
-
- init();
- }
-
- protected UsageViewContext createUsageViewContext(Configuration configuration) {
- return new UsageViewContext(searchContext, configuration);
- }
-
- public void setUseLastConfiguration(boolean useLastConfiguration) {
- this.useLastConfiguration = useLastConfiguration;
- }
-
- protected boolean isChanged(Configuration configuration) {
- return configuration.getMatchOptions().getSearchPattern() != null &&
- !searchCriteriaEdit.getDocument().getText().equals(configuration.getMatchOptions().getSearchPattern());
- }
-
- public void setSearchPattern(final Configuration config) {
- model.setShadowConfig(config);
- setValuesFromConfig(config);
- initiateValidation();
- }
-
- protected Editor createEditor(final SearchContext searchContext, String text) {
- Editor editor = null;
-
- if (fileTypes != null) {
- final FileType fileType = (FileType)fileTypes.getSelectedItem();
- final Language dialect = (Language)dialects.getSelectedItem();
-
- final StructuralSearchProfile profile = StructuralSearchUtil.getProfileByFileType(fileType);
- if (profile != null) {
- editor = profile.createEditor(searchContext, fileType, dialect, text, useLastConfiguration);
- }
- }
-
- if (editor == null) {
- final EditorFactory factory = EditorFactory.getInstance();
- final Document document = factory.createDocument("");
- editor = factory.createEditor(document, searchContext.getProject());
- editor.getSettings().setFoldingOutlineShown(false);
- }
-
- editor.getDocument().addDocumentListener(new DocumentListener() {
- @Override
- public void beforeDocumentChange(final DocumentEvent event) {
- }
-
- @Override
- public void documentChanged(final DocumentEvent event) {
- initiateValidation();
- }
- });
-
- return editor;
- }
-
- private void initiateValidation() {
- myAlarm.cancelAllRequests();
- myAlarm.addRequest(new Runnable() {
-
- @Override
- public void run() {
- try {
- new WriteAction(){
- @Override
- protected void run(Result result) throws Throwable {
- if (!isValid()) {
- getOKAction().setEnabled(false);
- }
- else {
- getOKAction().setEnabled(true);
- reportMessage(null, null);
- }
- }
- }.execute();
- }
- catch (Exception e) {
- e.printStackTrace();
- }
- }
- }, 500);
- }
-
- protected void buildOptions(JPanel searchOptions) {
- recursiveMatching = new JCheckBox(SSRBundle.message("recursive.matching.checkbox"), true);
- if (isRecursiveSearchEnabled()) {
- searchOptions.add(UIUtil.createOptionLine(recursiveMatching));
- }
-
- caseSensitiveMatch = new JCheckBox(FindBundle.message("find.options.case.sensitive"), true);
- searchOptions.add(UIUtil.createOptionLine(caseSensitiveMatch));
-
- final List<FileType> types = new ArrayList<FileType>();
-
- for (FileType fileType : StructuralSearchUtil.getSuitableFileTypes()) {
- if (StructuralSearchUtil.getProfileByFileType(fileType) != null) {
- types.add(fileType);
- }
- }
- Collections.sort(types, new Comparator<FileType>() {
- @Override
- public int compare(FileType o1, FileType o2) {
- return o1.getName().compareToIgnoreCase(o2.getName());
- }
- });
-
- final DefaultComboBoxModel comboBoxModel = new DefaultComboBoxModel(types.toArray(new FileType[types.size()]));
- comboBoxModel.setSelectedItem(ourFtSearchVariant);
- fileTypes = new ComboBox(comboBoxModel);
- fileTypes.setRenderer(new FileTypeRenderer());
- new ComboboxSpeedSearch(fileTypes) {
- @Override
- protected String getElementText(Object element) {
- return ((FileType)element).getName();
- }
- };
- fileTypes.addItemListener(new ItemListener() {
- @Override
- public void itemStateChanged(ItemEvent e) {
- updateDialectsAndContexts();
- updateEditor();
- }
- });
-
- contexts = new JComboBox(new DefaultComboBoxModel());
- contexts.setPreferredSize(new Dimension(60, -1));
-
- dialects = new JComboBox(new DefaultComboBoxModel());
- dialects.setRenderer(new ListCellRendererWrapper() {
- @Override
- public void customize(JList list, Object value, int index, boolean selected, boolean hasFocus) {
- if (value == null) {
- setText("None");
- }
- else if (value instanceof Language) {
- setText(((Language)value).getDisplayName());
- }
- }
- });
- dialects.addItemListener(new ItemListener() {
- @Override
- public void itemStateChanged(ItemEvent e) {
- updateEditor();
- }
- });
- new ComboboxSpeedSearch(dialects);
- dialects.setPreferredSize(new Dimension(120, -1));
-
- final JLabel jLabel = new JLabel(SSRBundle.message("search.dialog.file.type.label"));
- final JLabel jLabel2 = new JLabel(SSRBundle.message("search.dialog.context.label"));
- final JLabel jLabel3 = new JLabel(SSRBundle.message("search.dialog.file.dialect.label"));
- searchOptions.add(
- UIUtil.createOptionLine(
- new JComponent[]{
- jLabel,
- fileTypes,
- (JComponent)Box.createHorizontalStrut(8),
- jLabel2,
- contexts,
- (JComponent)Box.createHorizontalStrut(8),
- jLabel3,
- dialects,
- }
- )
- );
-
- jLabel.setLabelFor(fileTypes);
- jLabel2.setLabelFor(contexts);
- jLabel3.setLabelFor(dialects);
-
- detectFileTypeAndDialect();
-
- fileTypes.setSelectedItem(ourFtSearchVariant);
- fileTypes.addItemListener(new ItemListener() {
- @Override
- public void itemStateChanged(ItemEvent e) {
- if (e.getStateChange() == ItemEvent.SELECTED) initiateValidation();
- }
- });
-
- dialects.setSelectedItem(ourDialect);
- contexts.setSelectedItem(ourContext);
-
- updateDialectsAndContexts();
- }
-
- private void updateEditor() {
- if (myContentPanel != null) {
- if (myEditorPanel != null) {
- myContentPanel.remove(myEditorPanel);
- }
- disposeEditorContent();
- myEditorPanel = createEditorContent();
- myContentPanel.add(myEditorPanel, BorderLayout.CENTER);
- myContentPanel.revalidate();
- }
- }
-
- private void updateDialectsAndContexts() {
- final FileType fileType = (FileType)fileTypes.getSelectedItem();
- if (fileType instanceof LanguageFileType) {
- Language language = ((LanguageFileType)fileType).getLanguage();
- Language[] languageDialects = LanguageUtil.getLanguageDialects(language);
- Arrays.sort(languageDialects, new Comparator<Language>() {
- @Override
- public int compare(Language o1, Language o2) {
- return o1.getDisplayName().compareTo(o2.getDisplayName());
- }
- });
- Language[] variants = new Language[languageDialects.length + 1];
- variants[0] = null;
- System.arraycopy(languageDialects, 0, variants, 1, languageDialects.length);
- dialects.setModel(new DefaultComboBoxModel(variants));
- dialects.setEnabled(variants.length > 1);
- }
-
- final StructuralSearchProfile profile = StructuralSearchUtil.getProfileByFileType(fileType);
-
- if (profile instanceof StructuralSearchProfileBase) {
- final String[] contextNames = ((StructuralSearchProfileBase)profile).getContextNames();
- if (contextNames.length > 0) {
- contexts.setModel(new DefaultComboBoxModel(contextNames));
- contexts.setSelectedItem(contextNames[0]);
- contexts.setEnabled(true);
- return;
- }
- }
- contexts.setSelectedItem(null);
- contexts.setEnabled(false);
- }
-
- private void detectFileTypeAndDialect() {
- final PsiFile file = searchContext.getFile();
- if (file != null) {
- PsiElement context = null;
-
- if (searchContext.getEditor() != null) {
- context = file.findElementAt(searchContext.getEditor().getCaretModel().getOffset());
- if (context != null) {
- context = context.getParent();
- }
- }
- if (context == null) {
- context = file;
- }
-
- FileType detectedFileType = null;
-
- StructuralSearchProfile profile = StructuralSearchUtil.getProfileByPsiElement(context);
- if (profile != null) {
- FileType fileType = profile.detectFileType(context);
- if (fileType != null) {
- detectedFileType = fileType;
- }
- }
-
- if (detectedFileType == null) {
- for (FileType fileType : StructuralSearchUtil.getSuitableFileTypes()) {
- if (fileType instanceof LanguageFileType && ((LanguageFileType)fileType).getLanguage().equals(context.getLanguage())) {
- detectedFileType = fileType;
- break;
- }
- }
- }
-
- ourFtSearchVariant = detectedFileType != null ?
- detectedFileType :
- StructuralSearchUtil.getDefaultFileType();
-
- // todo: detect dialect
-
- /*if (file.getLanguage() == StdLanguages.HTML ||
- (file.getFileType() == StdFileTypes.JSP &&
- contextLanguage == StdLanguages.HTML
- )
- ) {
- ourFileType = "html";
- }
- else if (file.getLanguage() == StdLanguages.XHTML ||
- (file.getFileType() == StdFileTypes.JSPX &&
- contextLanguage == StdLanguages.HTML
- )) {
- ourFileType = "xml";
- }
- else {
- ourFileType = DEFAULT_TYPE_NAME;
- }*/
- }
- }
-
- protected boolean isRecursiveSearchEnabled() {
- return true;
- }
-
- public void setValuesFromConfig(Configuration configuration) {
- //searchCriteriaEdit.putUserData(SubstitutionShortInfoHandler.CURRENT_CONFIGURATION_KEY, configuration);
-
- setDialogTitle(configuration);
- final MatchOptions matchOptions = configuration.getMatchOptions();
-
- UIUtil.setContent(
- searchCriteriaEdit,
- matchOptions.getSearchPattern(),
- 0,
- searchCriteriaEdit.getDocument().getTextLength(),
- searchContext.getProject()
- );
-
- model.getConfig().getMatchOptions().setSearchPattern(
- matchOptions.getSearchPattern()
- );
-
- recursiveMatching.setSelected(
- isRecursiveSearchEnabled() && matchOptions.isRecursiveSearch()
- );
-
- caseSensitiveMatch.setSelected(
- matchOptions.isCaseSensitiveMatch()
- );
-
- model.getConfig().getMatchOptions().clearVariableConstraints();
- if (matchOptions.hasVariableConstraints()) {
- for (Iterator<String> i = matchOptions.getVariableConstraintNames(); i.hasNext(); ) {
- final MatchVariableConstraint constraint = (MatchVariableConstraint)matchOptions.getVariableConstraint(i.next()).clone();
- model.getConfig().getMatchOptions().addVariableConstraint(constraint);
- }
- }
-
- MatchOptions options = configuration.getMatchOptions();
- StructuralSearchProfile profile = StructuralSearchUtil.getProfileByFileType(options.getFileType());
- assert profile != null;
- fileTypes.setSelectedItem(options.getFileType());
- dialects.setSelectedItem(options.getDialect());
- if (options.getPatternContext() != null) {
- contexts.setSelectedItem(options.getPatternContext());
- }
- }
-
- private void setDialogTitle(final Configuration configuration) {
- setTitle(getDefaultTitle() + " - " + configuration.getName());
- }
-
- @Override
- public Configuration createConfiguration() {
- SearchConfiguration configuration = new SearchConfiguration();
- configuration.setName(USER_DEFINED);
- return configuration;
- }
-
- protected void addOrReplaceSelection(final String selection) {
- addOrReplaceSelectionForEditor(selection, searchCriteriaEdit);
- }
-
- protected final void addOrReplaceSelectionForEditor(final String selection, Editor editor) {
- final Project project = searchContext.getProject();
- UIUtil.setContent(editor, selection, 0, -1, project);
- final Document document = editor.getDocument();
- editor.getSelectionModel().setSelection(0, document.getTextLength());
- final PsiDocumentManager documentManager = PsiDocumentManager.getInstance(project);
- documentManager.commitDocument(document);
- final PsiFile file = documentManager.getPsiFile(document);
- if (file == null) return;
-
- new WriteCommandAction(project, file) {
- @Override protected void run(@NotNull Result result) throws Throwable {
- CodeStyleManager.getInstance(project).adjustLineIndent(file, new TextRange(0, document.getTextLength()));
- }
- }.execute();
- }
-
- protected void runAction(final Configuration config, final SearchContext searchContext) {
- createUsageView(searchContext, config);
- }
-
- protected void createUsageView(final SearchContext searchContext, final Configuration config) {
- UsageViewManager manager = UsageViewManager.getInstance(searchContext.getProject());
-
- final UsageViewContext context = createUsageViewContext(config);
- final UsageViewPresentation presentation = new UsageViewPresentation();
- presentation.setOpenInNewTab(openInNewTab.isSelected());
- presentation.setScopeText(config.getMatchOptions().getScope().getDisplayName());
- context.configure(presentation);
-
- final FindUsagesProcessPresentation processPresentation = new FindUsagesProcessPresentation(presentation);
- processPresentation.setShowNotFoundMessage(true);
- processPresentation.setShowPanelIfOnlyOneUsage(true);
-
- processPresentation.setProgressIndicatorFactory(
- new Factory<ProgressIndicator>() {
- @Override
- public ProgressIndicator create() {
- return new FindProgressIndicator(searchContext.getProject(), presentation.getScopeText()) {
- @Override
- public void cancel() {
- context.getCommand().stopAsyncSearch();
- super.cancel();
- }
- };
- }
- }
- );
-
- PsiDocumentManager.getInstance(getProject()).commitAllDocuments();
-
- manager.searchAndShowUsages(
- new UsageTarget[]{
- context.getTarget()
- },
- new Factory<UsageSearcher>() {
- @Override
- public UsageSearcher create() {
- return new UsageSearcher() {
- @Override
- public void generate(@NotNull final Processor<Usage> processor) {
- context.getCommand().findUsages(processor);
- }
- };
- }
- },
- processPresentation,
- presentation,
- new UsageViewManager.UsageViewStateListener() {
- @Override
- public void usageViewCreated(@NotNull UsageView usageView) {
- context.setUsageView(usageView);
- context.configureActions();
- }
-
- @Override
- public void findingUsagesFinished(final UsageView usageView) {
- }
- }
- );
- }
-
- protected String getDefaultTitle() {
- return SSRBundle.message("structural.search.title");
- }
-
- protected JComponent createEditorContent() {
- JPanel result = new JPanel(new BorderLayout());
-
- result.add(BorderLayout.NORTH, new JLabel(SSRBundle.message("search.template")));
- searchCriteriaEdit = createEditor(searchContext, mySavedEditorText != null ? mySavedEditorText : "");
- result.add(BorderLayout.CENTER, searchCriteriaEdit.getComponent());
- result.setMinimumSize(new Dimension(150, 100));
-
- return result;
- }
-
- protected int getRowsCount() {
- return 4;
- }
-
- @Override
- protected JComponent createCenterPanel() {
- myContentPanel = new JPanel(new BorderLayout());
- myEditorPanel = createEditorContent();
- myContentPanel.add(BorderLayout.CENTER, myEditorPanel);
- myContentPanel.add(BorderLayout.SOUTH, Box.createVerticalStrut(8));
- JComponent centerPanel = new JPanel(new BorderLayout());
- {
- JPanel panel = new JPanel(new BorderLayout());
- panel.add(BorderLayout.CENTER, myContentPanel);
- panel.add(BorderLayout.SOUTH, createTemplateManagementButtons());
- centerPanel.add(BorderLayout.CENTER, panel);
- }
-
- JPanel optionsContent = new JPanel(new BorderLayout());
- centerPanel.add(BorderLayout.SOUTH, optionsContent);
-
- JPanel searchOptions = new JPanel();
- searchOptions.setLayout(new GridLayout(getRowsCount(), 1, 0, 0));
- searchOptions.setBorder(IdeBorderFactory.createTitledBorder(SSRBundle.message("ssdialog.options.group.border"),
- true));
-
- myScopeChooserCombo = new ScopeChooserCombo(
- searchContext.getProject(),
- true,
- false,
- FindSettings.getInstance().getDefaultScopeName()
- );
- Disposer.register(myDisposable, myScopeChooserCombo);
- JPanel allOptions = new JPanel(new BorderLayout());
- if (myShowScopePanel) {
- JPanel scopePanel = new JPanel(new GridBagLayout());
-
- TitledSeparator separator = new TitledSeparator(SSRBundle.message("search.dialog.scope.label"), myScopeChooserCombo.getComboBox());
- scopePanel.add(separator, new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
- new Insets(5, 0, 0, 0), 0, 0));
-
- scopePanel.add(myScopeChooserCombo, new GridBagConstraints(0, 1, 1, 1, 1, 1, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
- new Insets(0, 10, 0, 0), 0, 0));
-
- allOptions.add(
- scopePanel,
- BorderLayout.SOUTH
- );
-
- myScopeChooserCombo.getComboBox().addItemListener(new ItemListener() {
- @Override
- public void itemStateChanged(ItemEvent e) {
- initiateValidation();
- }
- });
- }
-
- buildOptions(searchOptions);
-
- allOptions.add(searchOptions, BorderLayout.CENTER);
- optionsContent.add(allOptions, BorderLayout.CENTER);
-
- if (myRunFindActionOnClose) {
- JPanel panel = new JPanel(new BorderLayout());
- panel.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 0));
- openInNewTab = new JCheckBox(FindBundle.message("find.open.in.new.tab.checkbox"));
- openInNewTab.setSelected(ourOpenInNewTab);
- ToolWindow findWindow = ToolWindowManager.getInstance(searchContext.getProject()).getToolWindow(ToolWindowId.FIND);
- openInNewTab.setEnabled(findWindow != null && findWindow.isAvailable());
- panel.add(openInNewTab, BorderLayout.EAST);
-
- optionsContent.add(BorderLayout.SOUTH, panel);
- }
-
- updateEditor();
- return centerPanel;
- }
-
-
- @Override
- protected JComponent createSouthPanel() {
- final JPanel statusPanel = new JPanel(new BorderLayout(5, 0));
- statusPanel.add(super.createSouthPanel(), BorderLayout.NORTH);
- statusPanel.add(statusText = new JLabel(SSRBundle.message("status.message")), BorderLayout.WEST);
- statusPanel.add(status = new JLabel(), BorderLayout.CENTER);
- return statusPanel;
- }
-
- private JPanel createTemplateManagementButtons() {
- JPanel panel = new JPanel(null);
- panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
- panel.add(Box.createHorizontalGlue());
-
- panel.add(
- createJButtonForAction(new AbstractAction() {
- {
- putValue(NAME, SSRBundle.message("save.template.text.button"));
- }
-
- @Override
- public void actionPerformed(ActionEvent e) {
- String name = showSaveTemplateAsDialog();
-
- if (name != null) {
- final Project project = searchContext.getProject();
- final ConfigurationManager configurationManager = StructuralSearchPlugin.getInstance(project).getConfigurationManager();
- final Collection<Configuration> configurations = configurationManager.getConfigurations();
-
- if (configurations != null) {
- name = ConfigurationManager.findAppropriateName(configurations, name, project);
- if (name == null) return;
- }
-
- model.getConfig().setName(name);
- setValuesToConfig(model.getConfig());
- setDialogTitle(model.getConfig());
-
- if (model.getShadowConfig() == null ||
- model.getShadowConfig().isPredefined()) {
- existingTemplatesComponent.addConfigurationToUserTemplates(model.getConfig());
- }
- else { // ???
- setValuesToConfig(model.getShadowConfig());
- model.getShadowConfig().setName(name);
- }
- }
- }
- })
- );
-
- panel.add(
- Box.createHorizontalStrut(8)
- );
-
- panel.add(
- createJButtonForAction(
- new AbstractAction() {
- {
- putValue(NAME, SSRBundle.message("edit.variables.button"));
- }
-
- @Override
- public void actionPerformed(ActionEvent e) {
- EditVarConstraintsDialog.setProject(searchContext.getProject());
- new EditVarConstraintsDialog(
- searchContext.getProject(),
- model, getVariablesFromListeners(),
- isReplaceDialog(),
- (FileType)fileTypes.getSelectedItem()
- ).show();
- initiateValidation();
- EditVarConstraintsDialog.setProject(null);
- }
- }
- )
- );
-
- panel.add(
- Box.createHorizontalStrut(8)
- );
-
- panel.add(
- createJButtonForAction(
- new AbstractAction() {
- {
- putValue(NAME, SSRBundle.message("history.button"));
- }
-
- @Override
- public void actionPerformed(ActionEvent e) {
- SelectTemplateDialog dialog = new SelectTemplateDialog(searchContext.getProject(), true, isReplaceDialog());
- dialog.show();
-
- if (!dialog.isOK()) {
- return;
- }
- Configuration[] configurations = dialog.getSelectedConfigurations();
- if (configurations.length == 1) {
- setSearchPattern(configurations[0]);
- }
- }
- }
- )
- );
-
- panel.add(
- Box.createHorizontalStrut(8)
- );
-
- panel.add(
- createJButtonForAction(
- new AbstractAction() {
- {
- putValue(NAME, SSRBundle.message("copy.existing.template.button"));
- }
-
- @Override
- public void actionPerformed(ActionEvent e) {
- SelectTemplateDialog dialog = new SelectTemplateDialog(searchContext.getProject(), false, isReplaceDialog());
- dialog.show();
-
- if (!dialog.isOK()) {
- return;
- }
- Configuration[] configurations = dialog.getSelectedConfigurations();
- if (configurations.length == 1) {
- setSearchPattern(configurations[0]);
- }
- }
- }
- )
- );
-
- return panel;
- }
-
- protected List<Variable> getVariablesFromListeners() {
- return getVarsFrom(searchCriteriaEdit);
- }
-
- protected static ArrayList<Variable> getVarsFrom(Editor searchCriteriaEdit) {
- SubstitutionShortInfoHandler handler = searchCriteriaEdit.getUserData(UIUtil.LISTENER_KEY);
- return new ArrayList<Variable>(handler.getVariables());
- }
-
- public final Project getProject() {
- return searchContext.getProject();
- }
-
- public String showSaveTemplateAsDialog() {
- return ConfigurationManager.showSaveTemplateAsDialog(
- model.getShadowConfig() != null ? model.getShadowConfig().getName() : SSRBundle.message("user.defined.category"),
- searchContext.getProject()
- );
- }
-
- protected boolean isReplaceDialog() {
- return false;
- }
-
- @Override
- public void show() {
- StructuralSearchPlugin.getInstance(getProject()).setDialogVisible(true);
- Configuration.setActiveCreator(this);
- searchCriteriaEdit.putUserData(
- SubstitutionShortInfoHandler.CURRENT_CONFIGURATION_KEY,
- model.getConfig()
- );
-
- if (!useLastConfiguration) {
- final Editor editor = FileEditorManager.getInstance(searchContext.getProject()).getSelectedTextEditor();
- boolean setSomeText = false;
-
- if (editor != null) {
- final SelectionModel selectionModel = editor.getSelectionModel();
-
- if (selectionModel.hasSelection()) {
- addOrReplaceSelection(selectionModel.getSelectedText());
- existingTemplatesComponent.getPatternTree().setSelectionPath(null);
- existingTemplatesComponent.getHistoryList().setSelectedIndex(-1);
- setSomeText = true;
- }
- }
-
- if (!setSomeText) {
- int selection = existingTemplatesComponent.getHistoryList().getSelectedIndex();
- if (selection != -1) {
- setValuesFromConfig(
- (Configuration)existingTemplatesComponent.getHistoryList().getSelectedValue()
- );
- }
- }
- }
-
- initiateValidation();
-
- super.show();
- }
-
- @Override
- public JComponent getPreferredFocusedComponent() {
- return searchCriteriaEdit.getContentComponent();
- }
-
- // Performs ok action
- @Override
- protected void doOKAction() {
- SearchScope selectedScope = getSelectedScope();
- if (selectedScope == null) return;
-
- myDoingOkAction = true;
- boolean result = isValid();
- myDoingOkAction = false;
- if (!result) return;
-
- myAlarm.cancelAllRequests();
- super.doOKAction();
- if (!myRunFindActionOnClose) return;
-
- FindSettings.getInstance().setDefaultScopeName(selectedScope.getDisplayName());
- ourOpenInNewTab = openInNewTab.isSelected();
-
- try {
- if (model.getShadowConfig() != null) {
- if (model.getShadowConfig().isPredefined()) {
- model.getConfig().setName(
- model.getShadowConfig().getName()
- );
- } //else {
- // // user template, save it
- // setValuesToConfig(model.getShadowConfig());
- //}
- }
- existingTemplatesComponent.addConfigurationToHistory(model.getConfig());
-
- runAction(model.getConfig(), searchContext);
- }
- catch (MalformedPatternException ex) {
- reportMessage("this.pattern.is.malformed.message", searchCriteriaEdit, ex.getMessage());
- }
- }
-
- public Configuration getConfiguration() {
- return model.getConfig();
- }
-
- private SearchScope getSelectedScope() {
- return myScopeChooserCombo.getSelectedScope();
- }
-
- protected boolean isValid() {
- setValuesToConfig(model.getConfig());
- boolean result = true;
-
- try {
- MatcherImpl.validate(searchContext.getProject(), model.getConfig().getMatchOptions());
- }
- catch (MalformedPatternException ex) {
- if (myRunFindActionOnClose) {
- reportMessage(
- "this.pattern.is.malformed.message",
- searchCriteriaEdit,
- ex.getMessage() != null ? ex.getMessage() : ""
- );
- result = false;
- }
- }
- catch (UnsupportedPatternException ex) {
- reportMessage("this.pattern.is.unsupported.message", searchCriteriaEdit, ex.getMessage());
- result = false;
- }
-
- //getOKAction().setEnabled(result);
- return result;
- }
-
- protected void reportMessage(@NonNls String messageId, Editor editor, Object... params) {
- final String message = messageId != null ? SSRBundle.message(messageId, params) : "";
- status.setText(message);
- status.setToolTipText(message);
- status.revalidate();
- statusText.setLabelFor(editor != null ? editor.getContentComponent() : null);
- }
-
- protected void setValuesToConfig(Configuration config) {
-
- MatchOptions options = config.getMatchOptions();
-
- boolean searchWithinHierarchy = IdeBundle.message("scope.class.hierarchy").equals(myScopeChooserCombo.getSelectedScopeName());
- // We need to reset search within hierarchy scope during online validation since the scope works with user participation
- options.setScope(
- searchWithinHierarchy && !myDoingOkAction ? GlobalSearchScope.projectScope(getProject()) : myScopeChooserCombo.getSelectedScope());
- options.setLooseMatching(true);
- options.setRecursiveSearch(isRecursiveSearchEnabled() && recursiveMatching.isSelected());
-
- ourFtSearchVariant = (FileType)fileTypes.getSelectedItem();
- ourDialect = (Language)dialects.getSelectedItem();
- ourContext = (String)contexts.getSelectedItem();
- FileType fileType = ourFtSearchVariant;
- options.setFileType(fileType);
- options.setDialect(ourDialect);
- options.setPatternContext(ourContext);
-
- options.setSearchPattern(searchCriteriaEdit.getDocument().getText());
- options.setCaseSensitiveMatch(caseSensitiveMatch.isSelected());
- }
-
- @Override
- protected String getDimensionServiceKey() {
- return "#com.intellij.structuralsearch.plugin.ui.SearchDialog";
- }
-
- @Override
- public void dispose() {
- Configuration.setActiveCreator(null);
- disposeEditorContent();
-
- myAlarm.cancelAllRequests();
-
- super.dispose();
- StructuralSearchPlugin.getInstance(getProject()).setDialogVisible(false);
- }
-
- protected void disposeEditorContent() {
- mySavedEditorText = searchCriteriaEdit.getDocument().getText();
-
- // this will remove from myExcludedSet
- final PsiFile file = PsiDocumentManager.getInstance(searchContext.getProject()).getPsiFile(searchCriteriaEdit.getDocument());
- if (file != null) {
- DaemonCodeAnalyzer.getInstance(searchContext.getProject()).setHighlightingEnabled(file, true);
- }
-
- EditorFactory.getInstance().releaseEditor(searchCriteriaEdit);
- }
-
- @Override
- protected String getHelpId() {
- return "find.structuredSearch";
- }
-
- public SearchContext getSearchContext() {
- return searchContext;
- }
-}
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/UsageViewContext.java b/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/UsageViewContext.java
deleted file mode 100644
index a55a16d4c379..000000000000
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/UsageViewContext.java
+++ /dev/null
@@ -1,183 +0,0 @@
-package com.intellij.structuralsearch.plugin.ui;
-
-import com.intellij.navigation.ItemPresentation;
-import com.intellij.openapi.actionSystem.ActionManager;
-import com.intellij.openapi.actionSystem.KeyboardShortcut;
-import com.intellij.openapi.editor.Editor;
-import com.intellij.openapi.fileEditor.FileEditor;
-import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.psi.PsiFile;
-import com.intellij.structuralsearch.SSRBundle;
-import com.intellij.structuralsearch.plugin.replace.ui.ReplaceCommand;
-import com.intellij.usages.*;
-import org.jetbrains.annotations.NotNull;
-
-import javax.swing.*;
-import java.util.Set;
-
-/**
- * Created by IntelliJ IDEA.
- * User: Maxim.Mossienko
- * Date: Mar 9, 2005
- * Time: 2:47:49 PM
- * To change this template use File | Settings | File Templates.
- */
-public class UsageViewContext {
- protected final SearchContext mySearchContext;
- private UsageView myUsageView;
- protected final Configuration myConfiguration;
- private Set<Usage> myExcludedSet;
- private SearchCommand myCommand;
-
- protected UsageViewContext(SearchContext _searchContext,Configuration _configuration) {
- myConfiguration = _configuration;
- mySearchContext = _searchContext;
- }
-
- public boolean isExcluded(Usage usage) {
- if (myExcludedSet == null) myExcludedSet = myUsageView.getExcludedUsages();
- return myExcludedSet.contains(usage);
- }
-
- public UsageView getUsageView() {
- return myUsageView;
- }
-
- public void setUsageView(final UsageView usageView) {
- myUsageView = usageView;
- }
-
- public Configuration getConfiguration() {
- return myConfiguration;
- }
-
- public SearchCommand getCommand() {
- if (myCommand == null) myCommand = createCommand();
- return myCommand;
- }
-
- protected SearchCommand createCommand() {
- return new SearchCommand(mySearchContext.getProject(), this);
- }
-
- protected String _getPresentableText() {
- return myConfiguration.getMatchOptions().getSearchPattern();
- }
-
- public UsageTarget getTarget() {
- return new MyUsageTarget(_getPresentableText());
- }
-
- public void configure(@NotNull UsageViewPresentation presentation) {
- String s = _getPresentableText();
- if (s.length() > 15) s = s.substring(0,15) + "...";
- final String usagesString = SSRBundle.message("occurrences.of", s);
- presentation.setUsagesString(usagesString);
- presentation.setTabText(StringUtil.capitalize(usagesString));
- presentation.setUsagesWord(SSRBundle.message("occurrence"));
- presentation.setCodeUsagesString(SSRBundle.message("found.occurrences"));
- }
-
- protected void configureActions() {}
-
- private class MyUsageTarget implements ConfigurableUsageTarget,ItemPresentation {
- private final String myPresentableText;
-
- MyUsageTarget(String str) {
- myPresentableText = str;
- }
-
- @Override
- public String getPresentableText() {
- return myPresentableText;
- }
-
- @Override
- public String getLocationString() {
- //noinspection HardCodedStringLiteral
- return "Do Not Know Where";
- }
-
- @Override
- public Icon getIcon(boolean open) {
- return null;
- }
-
- @Override
- public void findUsages() {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void findUsagesInEditor(@NotNull FileEditor editor) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void highlightUsages(@NotNull PsiFile file, @NotNull Editor editor, boolean clearHighlights) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public boolean isValid() {
- return true;
- }
-
- @Override
- public boolean isReadOnly() {
- return true;
- }
-
- @Override
- public VirtualFile[] getFiles() {
- return null;
- }
-
- @Override
- public void update() {
- }
-
- @Override
- public String getName() {
- //noinspection HardCodedStringLiteral
- return "my name";
- }
-
- @Override
- public ItemPresentation getPresentation() {
- return this;
- }
-
- @Override
- public void navigate(boolean requestFocus) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public boolean canNavigate() {
- return false;
- }
-
- @Override
- public boolean canNavigateToSource() {
- return false;
- }
-
- @Override
- public void showSettings() {
- UIUtil.invokeAction(myConfiguration, mySearchContext);
- }
-
- @Override
- public KeyboardShortcut getShortcut() {
- return ActionManager.getInstance().getKeyboardShortcut(getCommand() instanceof ReplaceCommand ? "StructuralSearchPlugin.StructuralReplaceAction":"StructuralSearchPlugin.StructuralSearchAction");
- }
-
- @NotNull
- @Override
- public String getLongDescriptiveName() {
- return _getPresentableText();
- }
- }
-}
diff --git a/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/actions/DoSearchAction.java b/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/actions/DoSearchAction.java
deleted file mode 100644
index ed0da3a3f391..000000000000
--- a/plugins/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/actions/DoSearchAction.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package com.intellij.structuralsearch.plugin.ui.actions;
-
-import com.intellij.structuralsearch.plugin.ui.Configuration;
-import com.intellij.structuralsearch.*;
-import com.intellij.openapi.project.Project;
-
-/**
- * Does the search action
- */
-public class DoSearchAction {
- public static void execute(final Project project, MatchResultSink sink,
- final Configuration configuration) {
- final MatchOptions options = configuration.getMatchOptions();
-
- final Matcher matcher = new Matcher(project);
- try {
- matcher.findMatches(sink, options);
- }
- finally {
- sink.matchingFinished();
- }
- }
-
-}
diff --git a/plugins/structuralsearch/source/messages/SSRBundle.properties b/plugins/structuralsearch/source/messages/SSRBundle.properties
deleted file mode 100644
index 488c96e84435..000000000000
--- a/plugins/structuralsearch/source/messages/SSRBundle.properties
+++ /dev/null
@@ -1,240 +0,0 @@
-search.produced.too.many.results.message=Search produced too many results, stopping the search process
-
-structuralreplace.action=StructuralReplaceAction
-structuralsearch.action=StructuralSearchAction
-
-#replacement dialog preview
-structural.replace.preview.dialog.title=Structural Replace Preview
-replace.preview.oktext=&Replace
-replacement.code=Replacement code
-
-# Search Dialog specific titles/options
-structural.search.title=Structural Search
-search.template=Search template:
-template.name.button=Template name
-
-save.template.description.button=Save Template
-save.template.text.button=S&ave template...
-ssdialog.options.group.border=Options
-new.template.defaultname=user defined
-
-recursive.matching.checkbox=&Recursive matching
-
-edit.variables.button=E&dit variables...
-history.button=&History...
-copy.existing.template.button=Co&py existing template...
-
-open.in.new.tab.checkbox=Open in new &tab
-
-search.dialog.scope.label=&Scope
-search.dialog.file.type.label=File t&ype:
-search.dialog.context.label=C&ontext:
-search.dialog.file.dialect.label=D&ialect:
-
-#search usage view specific
-looking.in.progress.message=Looking in {0}
-found.progress.message=Found {0} occurrences
-occurrences.of=occurrences of {0}
-occurrence=occurrence
-found.occurrences=Found occurrence
-
-# search dialog messages
-this.pattern.is.malformed.message=This pattern is malformed\n {0}
-this.pattern.is.unsupported.message=This pattern is unsupported
-incorrect.pattern.message=Incorrect pattern
-
-used.templates.history.dialog.title=Used Templates History
-existing.templates.dialog.title=Existing Templates
-selecttemplate.template.preview=Template preview:
-selecttemplate.template.label.please.select.template=<html><body><center>Please select template in the tree on the left.</center></body></html>
-
-# Replace Dialog specific titles/options
-structural.replace.title=Structural Replace
-shorten.fully.qualified.names.checkbox=Sh&orten fully qualified names
-format.according.to.style.checkbox=Fo&rmat according to style
-replacement.template.label=Replacement template:
-
-# Replace validation messages
-unsupported.replacement.pattern.message=Unsupported Replacement Pattern {0}
-malformed.replacement.pattern.message=Malformed Replacement Pattern {0}
-
-#replacement usage view specific
-preview.replacement.button=&Preview Replacement
-do.replace.all.button=Replace &All
-replace.selected.button=&Replace Selected
-replaceusageview.text={0} by {1}
-
-# predefined configuration categories
-expressions.category=expressions
-user.defined.category=user defined
-xml_html.category=xml/html
-generics.category=generics
-misc.category=miscellaneous
-metadata.category=comments, javadoc and metadata
-class.category=class-based
-operators.category=operators
-j2ee.category=j2ee
-interesting.category=interesting
-used.templates=Used templates:
-
-# predefined configuration names
-
-predefined.configuration.method.calls=method calls
-predefined.configuration.struts.1.1.actions=Struts 1.1 actions
-predefined.configuration.ejb.interface=ejb interface
-predefined.configuration.servlets=servlets
-predefined.configuration.unboxing.in.method.calls=unboxing in method calls
-predefined.configuration.boxing.in.method.calls=boxing in method calls
-predefined.configuration.unboxing.in.declarations=unboxing in declarations
-predefined.configuration.boxing.in.declarations=boxing in declarations
-predefined.configuration.filters=filters
-predefined.configuration.session.ejb=session ejb
-predefined.configuration.fields.variables.read=fields/variables read
-predefined.configuration.symbol=symbol
-predefined.configuration.inner.classes=inner classes
-predefined.configuration.]junit.test.cases=junit test cases
-predefined.configuration.ifs=if's
-predefined.configuration.anonymous.classes=anonymous classes
-predefined.configuration.javadoc.tags=javadoc tags
-predefined.configuration.all.methods.of.the.class.within.hierarchy=all methods of the class (within hierarchy)
-predefined.configuration.similar.methods.structure=similar methods structure
-predefined.configuration.class.implements.two.interfaces=class implementing two interfaces
-predefined.configuration.bean.info.classes=Bean info classes
-predefined.configuration.all.expressions.of.some.type=all expressions of some type
-predefined.configuration.variables.of.generic.types=variables of generic types
-predefined.configuration.comments=comments
-predefined.configuration.fields_variables.with.given.name.pattern.updated=fields/variables with given name pattern updated
-predefined.configuration.trys=try's
-predefined.configuration.block.dcls=block dcls
-predefined.configuration.methods.of.the.class=methods of the class
-predefined.configuration.instanceof=instanceof
-predefined.configuration.implementors.of.interface.within.hierarchy=implementors of interface (within hierarchy)
-predefined.configuration.generic.casts=generic casts
-predefined.configuration.field.selections=field selections
-predefined.configuration.fields.of.the.class=fields of the class
-predefined.configuration.array.access=array access
-predefined.configuration.usage.of.derived.type.in.cast=usage of derived type in cast
-predefined.configuration.annotated.methods=annotated methods
-predefined.configuration.not.annotated.methods=not annotated methods
-predefined.configuration.annotation.declarations=annotation declarations
-predefined.configuration.annotated.class=annotated class
-predefined.configuration.entity.ejb=entity ejb
-predefined.configuration.generic.methods=generic methods
-predefined.configuration.cloneable.implementations=Cloneable implementations
-predefined.configuration.xdoclet.metadata=XDoclet metadata
-predefined.configuration.type.var.substitutions.in.intanceof.with.generic.types=type var substitutions in intanceof with generic types
-predefined.configuration.singletons=singletons
-predefined.configuration.switches=switches
-predefined.configuration.foreaches=foreach loops
-predefined.configuration.interfaces=interfaces
-predefined.configuration.string.literals=string literals
-predefined.configuration.all.inner.classes.within.hierarchy=all inner classes (within hierarchy)
-predefined.configuration.direct.subclasses=direct subclasses
-predefined.configuration.javadoc.annotated.methods=javadoc annotated methods
-predefined.configuration.javadoc.annotated.fields=javadoc annotated fields
-predefined.configuration.assignments=assignments
-predefined.configuration.casts=casts
-predefined.configuration.serializable.classes.and.their.serialization.implementation=Serializable classes and their serialization implementation
-predefined.configuration.annotated.fields=annotated fields
-predefined.configuration.generic.classes=generic classes
-predefined.configuration.javadoc.annotated.class=javadoc annotated class
-predefined.configuration.constructors.of.the.class=constructors of the class
-predefined.configuration.typed.symbol=typed symbol
-predefined.configuration.all.fields.of.the.class=all fields of the class
-predefined.configuration.instance.fields.of.the.class=instance fields of the class
-predefined.configuration.packagelocal.fields.of.the.class=package local fields of the class
-predefined.configuration.classes=classes
-predefined.configuration.new.expressions=new expressions
-predefined.configuration.lambdas=lambdas
-
-# edit variable constraint dialog options
-invalid.regular.expression=Invalid regular expression
-invalid.occurence.count=Invalid occurrence count
-editvarcontraints.this.variable.is.target.of.the.search=This variable is target of the search
-editvarcontraints.unlimited=Unlimited
-editvarcontraints.maximum.count=Maximum count\:
-editvarcontraints.minimum.count=Minimum count\:
-editvarcontraints.apply.constraint.within.type.hierarchy=Apply constraint within type hierarchy
-editvarcontraints.invert.condition=Invert condition
-editvarcontraints.text.regular.expression.for.formal.argument.type.of.the.method=Text/regexp for formal argument type of the method\:
-editvarcontraints.text.regular.expression.for.java.expression.type=Text/regexp for java expression type\:
-editvarcontraints.value.is.written=Value is written
-editvarcontraints.value.is.read=Value is read
-editvarcontraints.whole.words.only=Whole words only
-editvarcontraints.text.regular.expression=Text/regexp\:
-editvarcontraints.edit.variables=Edit Variables
-
-# tooltip message fragment on ss variables
-no.constraints.specified.tooltip.message=no constraints specified
-script.option.text=Script text\:
-occurs.tooltip.message=occurs: {0}
-min.occurs.tooltip.message=min occurs: {0}, max occurs: {1}
-target.tooltip.message=target
-text.tooltip.message={0} like: {1}{2}
-exprtype.tooltip.message={0} like: {1}{2}
-not.tooltip.message=not
-within.hierarchy.tooltip.message=\ within hierarchy
-script.tooltip.message=script: {0}
-replacement.variable.is.not.defined.message=Replacement variable {0} is not defined.
-replacement.variable.is.not.valid=Replacement variable {0} has script code problem {1}
-replacement.template.is.not.expression.error.message=The search template is a well formed expression, but the replacement template is not an expression.
-replacement.template.expression.not.supported=Replacement of expression is not supported for {0}
-replacement.not.supported.for.filetype=Replacement is not supported for {0} file type
-search.template.is.not.expression.error.message=The search template is not an expression, but the replacement template is a well formed expression.
-create.template.action.name=Create Template
-remove.template.action.name=Remove Template
-
-modify.editor.content.command.name=modify editor content
-var.constraints.variables.border=Variables
-var.constraints.occurrences.count.border=Occurrences count
-var.constraints.script.constraints.border=Script constraints
-var.constraints.expression.constraints.border=Expression constraints
-var.constraints.text.constraints.border=Text constraints
-different.strategies.for.top.level.nodes.error.message=Different strategies for top level nodes
-option.is.not.recognized.error.message={0} condition is not recognized
-reg.exp.should.be.delimited.with.spaces.error.message=Reg exp should be delimited with spaces
-reg.exp.in.expr.type.should.be.delimited.with.spaces.error.message=Reg exp in expr type should be delimited with spaces
-reg.exp.in.formal.arg.type.should.be.delimited.with.spaces.error.message=Reg exp in formal arg type should be delimited with spaces
-no.reg.exp.specified.error.message=Missing regular expression
-script.should.be.delimited.with.spaces.error.message=Script should be delimited with spaces
-
-error.two.different.type.constraints=Two different type constraints
-error.incorrect.regexp.constraint=Incorrect reg exp constraint:{0} for {1}
-error.expected.character=Character expected after single quote
-error.overflow=Value overflow
-error.expected.brace1="Digit, '}' or ',' expected"
-error.expected.brace2="Digit or '}' expected"
-error.expected.condition=Condition expected after ''{0}''
-error.expected.condition.or.bracket=Condition or ']' expected
-invalid.modifier.type=Invalid modifier type {0}
-
-SSRInspection.replace.with=Replace with ''{0}''
-SSRInspection.family.name=Replace Structurally
-SSRInspection.display.name=Structural Search Inspection
-SSRInspection.add.search.template.button=Add Search template...
-SSRInspection.add.replace.template.button=Add Replace template...
-SSRInspection.selected.templates=Selected templates:
-status.message=Status:
-overwrite.message=Confirm overwrite configuration with the same name
-overwrite.title=Confirm Overwrite Saved Configuration
-ssr.will.not.find.anything=It does not match anything in selected scope
-predefined.configuration.class.static.blocks=static blocks in class
-predefined.configuration.class.instance.initialization.blocks=instance initialization blocks
-predefined.configuration.class.any.initialization.blocks=any class initialization block
-predefined.configuration.logging.without.if=logging without if
-predefined.configuration.class.with.parameterless.constructors=classes with parameterless constructors
-predefined.configuration.static.fields.without.final=static fields that are not final
-invalid.groovy.script=Invalid Groovy Script
-groovy.script.error=Groovy Script execution error: {0}
-template.problem=Structural Search Inspection problem in template ''{0}''
-problem=Structural Search problem: {0}
-complete.match.variable.name=Complete Match
-predefined.configuration.sample.method.invokation.with.constant.argument=sample method invocation with constant parameter
-predefined.configuration.interfaces.having.no.descendants=interface that is not implemented or extended
-action.StructuralSearchPlugin.StructuralSearchAction.text=Search S_tructurally...
-action.StructuralSearchPlugin.StructuralSearchAction.description=Structural Search
-action.StructuralSearchPlugin.StructuralReplaceAction.text=Repla_ce Structurally...
-action.StructuralSearchPlugin.StructuralReplaceAction.description=Structural Replace
-predefined.configuration.enums=enums
-regular.expression.help.label=Regular Expressions Help
-edit.groovy.script.constraint.title=Edit Groovy Script Constraint
diff --git a/plugins/structuralsearch/structuralsearch-java/src/META-INF/java.xml b/plugins/structuralsearch/structuralsearch-java/src/META-INF/java.xml
deleted file mode 100644
index 56c3329f4867..000000000000
--- a/plugins/structuralsearch/structuralsearch-java/src/META-INF/java.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<idea-plugin url="http://www.jetbrains.com/idea">
- <extensions defaultExtensionNs="com.intellij">
- <structuralsearch.profile implementation="com.intellij.structuralsearch.JavaStructuralSearchProfile"/>
- <structuralsearch.matchPredicateProvider implementation="com.intellij.structuralsearch.impl.matcher.JavaMatchPredicateProvider"/>
- </extensions>
-</idea-plugin>
diff --git a/plugins/structuralsearch/structuralsearch-java/src/META-INF/plugin.xml b/plugins/structuralsearch/structuralsearch-java/src/META-INF/plugin.xml
deleted file mode 100644
index c95376c06f13..000000000000
--- a/plugins/structuralsearch/structuralsearch-java/src/META-INF/plugin.xml
+++ /dev/null
@@ -1,48 +0,0 @@
-<idea-plugin>
- <name>Structural Search</name>
- <description>Searching / replacing source code in terms of syntax (query / replace code by example :-).
- </description>
- <version>9.0</version>
- <vendor>JetBrains</vendor>
- <depends>com.intellij.modules.lang</depends>
- <depends optional="true" config-file="java.xml">com.intellij.java-i18n</depends>
-
- <extensionPoints>
- <extensionPoint qualifiedName="com.intellij.structuralsearch.profile"
- interface="com.intellij.structuralsearch.StructuralSearchProfile"/>
- <extensionPoint qualifiedName="com.intellij.tokenindex.tokenizer" beanClass="com.intellij.lang.LanguageExtensionPoint"/>
- <extensionPoint qualifiedName="com.intellij.structuralsearch.matchPredicateProvider"
- interface="com.intellij.structuralsearch.impl.matcher.MatchPredicateProvider"/>
- </extensionPoints>
-
- <extensions defaultExtensionNs="com.intellij">
- <errorHandler implementation="com.intellij.diagnostic.ITNReporter"/>
- <localInspection shortName="SSBasedInspection" bundle="messages.SSRBundle" key="SSRInspection.display.name" groupName="General"
- enabledByDefault="false" level="WARNING"
- implementationClass="com.intellij.structuralsearch.inspection.highlightTemplate.SSBasedInspection"/>
- <postStartupActivity
- implementation="com.intellij.structuralsearch.inspection.highlightTemplate.SSBasedInspectionCompiledPatternsCache"/>
- <!--<fileBasedIndex implementation="com.intellij.tokenindex.TokenIndex"/>-->
- <structuralsearch.profile implementation="com.intellij.structuralsearch.XmlStructuralSearchProfile"/>
- </extensions>
-
- <resource-bundle>messages.SSRBundle</resource-bundle>
- <project-components>
- <component>
- <implementation-class>com.intellij.structuralsearch.plugin.StructuralSearchPlugin</implementation-class>
- <option name="workspace" value="true"/>
- </component>
- </project-components>
-
- <actions>
- <group id="StructuralSearchActions">
- <action id="StructuralSearchPlugin.StructuralSearchAction" class="com.intellij.structuralsearch.plugin.StructuralSearchAction">
- <add-to-group group-id="FindMenuGroup" anchor="after" relative-to-action="ReplaceInPath"/>
- </action>
-
- <action id="StructuralSearchPlugin.StructuralReplaceAction" class="com.intellij.structuralsearch.plugin.StructuralReplaceAction">
- <add-to-group group-id="FindMenuGroup" anchor="after" relative-to-action="StructuralSearchPlugin.StructuralSearchAction"/>
- </action>
- </group>
- </actions>
-</idea-plugin>
diff --git a/plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/JavaReplaceHandler.java b/plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/JavaReplaceHandler.java
deleted file mode 100644
index 36b8fff26afb..000000000000
--- a/plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/JavaReplaceHandler.java
+++ /dev/null
@@ -1,500 +0,0 @@
-package com.intellij.structuralsearch;
-
-import com.intellij.openapi.fileTypes.StdFileTypes;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.psi.*;
-import com.intellij.psi.codeStyle.JavaCodeStyleManager;
-import com.intellij.psi.javadoc.PsiDocComment;
-import com.intellij.psi.xml.XmlText;
-import com.intellij.structuralsearch.impl.matcher.JavaMatchingVisitor;
-import com.intellij.structuralsearch.impl.matcher.MatcherImplUtil;
-import com.intellij.structuralsearch.impl.matcher.PatternTreeContext;
-import com.intellij.structuralsearch.plugin.replace.ReplaceOptions;
-import com.intellij.structuralsearch.plugin.replace.ReplacementInfo;
-import com.intellij.structuralsearch.plugin.replace.impl.ReplacementContext;
-import com.intellij.structuralsearch.plugin.replace.impl.Replacer;
-import com.intellij.structuralsearch.plugin.replace.impl.ReplacerUtil;
-import com.intellij.util.IncorrectOperationException;
-import org.jetbrains.annotations.Nullable;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author Eugene.Kudelevsky
- */
-public class JavaReplaceHandler extends StructuralReplaceHandler {
- private final ReplacementContext myContext;
- private PsiCodeBlock codeBlock;
-
- public JavaReplaceHandler(ReplacementContext context) {
- this.myContext = context;
- }
-
- private PsiCodeBlock getCodeBlock() throws IncorrectOperationException {
- if (codeBlock == null) {
- PsiCodeBlock search;
- search = (PsiCodeBlock)MatcherImplUtil.createTreeFromText(
- myContext.getOptions().getMatchOptions().getSearchPattern(),
- PatternTreeContext.Block,
- myContext.getOptions().getMatchOptions().getFileType(),
- myContext.getProject()
- )[0].getParent();
-
- codeBlock = search;
- }
- return codeBlock;
- }
-
- private static PsiElement findRealSubstitutionElement(PsiElement el) {
- if (el instanceof PsiIdentifier) {
- // matches are tokens, identifiers, etc
- el = el.getParent();
- }
-
- if (el instanceof PsiReferenceExpression &&
- el.getParent() instanceof PsiMethodCallExpression
- ) {
- // method
- el = el.getParent();
- }
-
- if (el instanceof PsiDeclarationStatement && ((PsiDeclarationStatement)el).getDeclaredElements()[0] instanceof PsiClass) {
- el = ((PsiDeclarationStatement)el).getDeclaredElements()[0];
- }
- return el;
- }
-
- private static boolean isListContext(PsiElement el) {
- boolean listContext = false;
- final PsiElement parent = el.getParent();
-
- if (parent instanceof PsiParameterList ||
- parent instanceof PsiExpressionList ||
- parent instanceof PsiCodeBlock ||
- parent instanceof PsiClass ||
- parent instanceof XmlText ||
- (parent instanceof PsiIfStatement &&
- (((PsiIfStatement)parent).getThenBranch() == el ||
- ((PsiIfStatement)parent).getElseBranch() == el
- )
- ) ||
- (parent instanceof PsiLoopStatement &&
- ((PsiLoopStatement)parent).getBody() == el
- )
- ) {
- listContext = true;
- }
-
- return listContext;
- }
-
- @Nullable
- private PsiNamedElement getSymbolReplacementTarget(final PsiElement el)
- throws IncorrectOperationException {
- if (myContext.getOptions().getMatchOptions().getFileType() != StdFileTypes.JAVA) return null; //?
- final PsiStatement[] searchStatements = getCodeBlock().getStatements();
- if (searchStatements.length > 0 &&
- searchStatements[0] instanceof PsiExpressionStatement) {
- final PsiExpression expression = ((PsiExpressionStatement)searchStatements[0]).getExpression();
-
- if (expression instanceof PsiReferenceExpression &&
- ((PsiReferenceExpression)expression).getQualifierExpression() == null
- ) {
- // looks like symbol replacements, namely replace AAA by BBB, so lets do the best
- if (el instanceof PsiNamedElement) {
- return (PsiNamedElement)el;
- }
- }
- }
-
- return null;
- }
-
- private static PsiElement getMatchExpr(PsiElement replacement, PsiElement elementToReplace) {
- if (replacement instanceof PsiExpressionStatement &&
- !(replacement.getLastChild() instanceof PsiJavaToken) &&
- !(replacement.getLastChild() instanceof PsiComment)
- ) {
- // replacement is expression (and pattern should be so)
- // assert ...
- replacement = ((PsiExpressionStatement)replacement).getExpression();
- }
- else if (replacement instanceof PsiDeclarationStatement &&
- ((PsiDeclarationStatement)replacement).getDeclaredElements().length == 1
- ) {
- return ((PsiDeclarationStatement)replacement).getDeclaredElements()[0];
- }
- else if (replacement instanceof PsiBlockStatement &&
- elementToReplace instanceof PsiCodeBlock
- ) {
- return ((PsiBlockStatement)replacement).getCodeBlock();
- }
-
- return replacement;
- }
-
- private boolean isSymbolReplacement(final PsiElement el) throws IncorrectOperationException {
- return getSymbolReplacementTarget(el) != null;
- }
-
- @SuppressWarnings({"unchecked", "ConstantConditions"})
- private void handleModifierList(final PsiElement el, final PsiElement replacement) throws IncorrectOperationException {
- // We want to copy all comments, including doc comments and modifier lists
- // that are present in matched nodes but not present in search/replace
-
- Map<String, String> newNameToSearchPatternNameMap = myContext.getNewName2PatternNameMap();
-
- ModifierListOwnerCollector collector = new ModifierListOwnerCollector();
- el.accept(collector);
- Map<String, PsiNamedElement> originalNamedElements = (Map<String, PsiNamedElement>)collector.namedElements.clone();
- collector.namedElements.clear();
-
- replacement.accept(collector);
- Map<String, PsiNamedElement> replacedNamedElements = (Map<String, PsiNamedElement>)collector.namedElements.clone();
- collector.namedElements.clear();
-
- if (originalNamedElements.size() == 0 && replacedNamedElements.size() == 0) {
- Replacer.handleComments(el, replacement, myContext);
- return;
- }
-
- final PsiStatement[] statements = getCodeBlock().getStatements();
- if (statements.length > 0) {
- statements[0].getParent().accept(collector);
- }
-
- Map<String, PsiNamedElement> searchedNamedElements = (Map<String, PsiNamedElement>)collector.namedElements.clone();
- collector.namedElements.clear();
-
- for (String name : originalNamedElements.keySet()) {
- PsiNamedElement originalNamedElement = originalNamedElements.get(name);
- PsiNamedElement replacementNamedElement = replacedNamedElements.get(name);
- String key = newNameToSearchPatternNameMap.get(name);
- if (key == null) key = name;
- PsiNamedElement searchNamedElement = searchedNamedElements.get(key);
-
- if (replacementNamedElement == null && originalNamedElements.size() == 1 && replacedNamedElements.size() == 1) {
- replacementNamedElement = replacedNamedElements.entrySet().iterator().next().getValue();
- }
-
- PsiElement comment = null;
-
- if (originalNamedElement instanceof PsiDocCommentOwner) {
- comment = ((PsiDocCommentOwner)originalNamedElement).getDocComment();
- if (comment == null) {
- PsiElement prevElement = originalNamedElement.getPrevSibling();
- if (prevElement instanceof PsiWhiteSpace) {
- prevElement = prevElement.getPrevSibling();
- }
- if (prevElement instanceof PsiComment) {
- comment = prevElement;
- }
- }
- }
-
- if (replacementNamedElement != null && searchNamedElement != null) {
- Replacer.handleComments(originalNamedElement, replacementNamedElement, myContext);
- }
-
- if (comment != null && replacementNamedElement instanceof PsiDocCommentOwner &&
- !(replacementNamedElement.getFirstChild() instanceof PsiDocComment)
- ) {
- final PsiElement nextSibling = comment.getNextSibling();
- PsiElement prevSibling = comment.getPrevSibling();
- replacementNamedElement.addRangeBefore(
- prevSibling instanceof PsiWhiteSpace ? prevSibling : comment,
- nextSibling instanceof PsiWhiteSpace ? nextSibling : comment,
- replacementNamedElement.getFirstChild()
- );
- }
-
- if (originalNamedElement instanceof PsiModifierListOwner &&
- replacementNamedElement instanceof PsiModifierListOwner
- ) {
- PsiModifierList modifierList = ((PsiModifierListOwner)originalNamedElements.get(name)).getModifierList();
-
- if (searchNamedElement instanceof PsiModifierListOwner) {
- PsiModifierList modifierListOfSearchedElement = ((PsiModifierListOwner)searchNamedElement).getModifierList();
- final PsiModifierListOwner modifierListOwner = ((PsiModifierListOwner)replacementNamedElement);
- PsiModifierList modifierListOfReplacement = modifierListOwner.getModifierList();
-
- if (modifierListOfSearchedElement.getTextLength() == 0 &&
- modifierListOfReplacement.getTextLength() == 0 &&
- modifierList.getTextLength() > 0
- ) {
- PsiElement space = modifierList.getNextSibling();
- if (!(space instanceof PsiWhiteSpace)) {
- space = createWhiteSpace(space);
- }
-
- modifierListOfReplacement.replace(modifierList);
- // copy space after modifier list
- if (space instanceof PsiWhiteSpace) {
- modifierListOwner.addRangeAfter(space, space, modifierListOwner.getModifierList());
- }
- } else if (modifierListOfSearchedElement.getTextLength() == 0 && modifierList.getTextLength() > 0) {
- modifierListOfReplacement.addRange(modifierList.getFirstChild(), modifierList.getLastChild());
- }
- }
- }
- }
- }
-
- private PsiElement handleSymbolReplacemenent(PsiElement replacement, final PsiElement el) throws IncorrectOperationException {
- PsiNamedElement nameElement = getSymbolReplacementTarget(el);
- if (nameElement != null) {
- PsiElement oldReplacement = replacement;
- replacement = el.copy();
- ((PsiNamedElement)replacement).setName(oldReplacement.getText());
- }
-
- return replacement;
- }
-
- public void replace(final ReplacementInfo info, ReplaceOptions options) {
- PsiElement elementToReplace = info.getMatch(0);
- PsiElement elementParent = elementToReplace.getParent();
- String replacementToMake = info.getReplacement();
- Project project = myContext.getProject();
- PsiElement el = findRealSubstitutionElement(elementToReplace);
- boolean listContext = isListContext(el);
-
- if (el instanceof PsiAnnotation && !StringUtil.startsWithChar(replacementToMake, '@')) {
- replacementToMake = "@" + replacementToMake;
- }
-
- PsiElement[] statements = ReplacerUtil
- .createTreeForReplacement(replacementToMake, el instanceof PsiMember && !isSymbolReplacement(el) ?
- PatternTreeContext.Class :
- PatternTreeContext.Block, myContext);
-
- if (listContext) {
- if (statements.length > 1) {
- elementParent.addRangeBefore(statements[0], statements[statements.length - 1], elementToReplace);
- }
- else if (statements.length == 1) {
- PsiElement replacement = getMatchExpr(statements[0], elementToReplace);
-
- handleModifierList(el, replacement);
- replacement = handleSymbolReplacemenent(replacement, el);
-
- if (replacement instanceof PsiTryStatement) {
- final List<PsiCatchSection> unmatchedCatchSections = el.getUserData(JavaMatchingVisitor.UNMATCHED_CATCH_SECTION_CONTENT_VAR_KEY);
- final PsiCatchSection[] catches = ((PsiTryStatement)replacement).getCatchSections();
-
- if (unmatchedCatchSections != null) {
- for (int i = unmatchedCatchSections.size() - 1; i >= 0; --i) {
- final PsiParameter parameter = unmatchedCatchSections.get(i).getParameter();
- final PsiElementFactory elementFactory = JavaPsiFacade.getInstance(project).getElementFactory();
- final PsiCatchSection catchSection = elementFactory.createCatchSection(parameter.getType(), parameter.getName(), null);
-
- catchSection.getCatchBlock().replace(
- unmatchedCatchSections.get(i).getCatchBlock()
- );
- replacement.addAfter(
- catchSection, catches[catches.length - 1]
- );
- replacement.addBefore(createWhiteSpace(replacement), replacement.getLastChild());
- }
- }
- }
-
- try {
- final PsiElement inserted = elementParent.addBefore(replacement, elementToReplace);
-
- if (replacement instanceof PsiComment &&
- (elementParent instanceof PsiIfStatement ||
- elementParent instanceof PsiLoopStatement
- )
- ) {
- elementParent.addAfter(createSemicolon(replacement), inserted);
- }
- }
- catch (IncorrectOperationException e) {
- elementToReplace.replace(replacement);
- }
- }
- }
- else if (statements.length > 0) {
- PsiElement replacement = ReplacerUtil.copySpacesAndCommentsBefore(elementToReplace, statements, replacementToMake, elementParent);
-
- replacement = getMatchExpr(replacement, elementToReplace);
-
- if (replacement instanceof PsiStatement &&
- !(replacement.getLastChild() instanceof PsiJavaToken) &&
- !(replacement.getLastChild() instanceof PsiComment)
- ) {
- // assert w/o ;
- final PsiElement prevLastChildInParent = replacement.getLastChild().getPrevSibling();
-
- if (prevLastChildInParent != null) {
- elementParent.addRangeBefore(replacement.getFirstChild(), prevLastChildInParent, el);
- }
- else {
- elementParent.addBefore(replacement.getFirstChild(), el);
- }
-
- el.getNode().getTreeParent().removeChild(el.getNode());
- }
- else {
- // preserve comments
- handleModifierList(el, replacement);
-
- if (replacement instanceof PsiClass) {
- // modifier list
- final PsiStatement[] searchStatements = getCodeBlock().getStatements();
- if (searchStatements.length > 0 &&
- searchStatements[0] instanceof PsiDeclarationStatement &&
- ((PsiDeclarationStatement)searchStatements[0]).getDeclaredElements()[0] instanceof PsiClass
- ) {
- final PsiClass replaceClazz = (PsiClass)replacement;
- final PsiClass queryClazz = (PsiClass)((PsiDeclarationStatement)searchStatements[0]).getDeclaredElements()[0];
- final PsiClass clazz = (PsiClass)el;
-
- if (replaceClazz.getExtendsList().getTextLength() == 0 &&
- queryClazz.getExtendsList().getTextLength() == 0 &&
- clazz.getExtendsList().getTextLength() != 0
- ) {
- replaceClazz.addBefore(clazz.getExtendsList().getPrevSibling(), replaceClazz.getExtendsList()); // whitespace
- replaceClazz.getExtendsList().addRange(
- clazz.getExtendsList().getFirstChild(), clazz.getExtendsList().getLastChild()
- );
- }
-
- if (replaceClazz.getImplementsList().getTextLength() == 0 &&
- queryClazz.getImplementsList().getTextLength() == 0 &&
- clazz.getImplementsList().getTextLength() != 0
- ) {
- replaceClazz.addBefore(clazz.getImplementsList().getPrevSibling(), replaceClazz.getImplementsList()); // whitespace
- replaceClazz.getImplementsList().addRange(
- clazz.getImplementsList().getFirstChild(),
- clazz.getImplementsList().getLastChild()
- );
- }
-
- if (replaceClazz.getTypeParameterList().getTextLength() == 0 &&
- queryClazz.getTypeParameterList().getTextLength() == 0 &&
- clazz.getTypeParameterList().getTextLength() != 0
- ) {
- // skip < and >
- replaceClazz.getTypeParameterList().replace(
- clazz.getTypeParameterList()
- );
- }
- }
- }
-
- replacement = handleSymbolReplacemenent(replacement, el);
-
- el.replace(replacement);
- }
- }
- else {
- final PsiElement nextSibling = el.getNextSibling();
- el.delete();
- if (nextSibling instanceof PsiWhiteSpace && nextSibling.isValid()) {
- nextSibling.delete();
- }
- }
-
- if (listContext) {
- final int matchSize = info.getMatchesCount();
-
- for (int i = 0; i < matchSize; ++i) {
- PsiElement matchElement = info.getMatch(i);
- PsiElement element = findRealSubstitutionElement(matchElement);
-
- if (element == null) continue;
- PsiElement firstToDelete = element;
- PsiElement lastToDelete = element;
- PsiElement prevSibling = element.getPrevSibling();
- PsiElement nextSibling = element.getNextSibling();
-
- if (prevSibling instanceof PsiWhiteSpace) {
- firstToDelete = prevSibling;
- prevSibling = prevSibling != null ? prevSibling.getPrevSibling() : null;
- }
- else if (prevSibling == null && nextSibling instanceof PsiWhiteSpace) {
- lastToDelete = nextSibling;
- }
-
- if (nextSibling instanceof XmlText && i + 1 < matchSize) {
- final PsiElement next = info.getMatch(i + 1);
- if (next != null && next == nextSibling.getNextSibling()) {
- lastToDelete = nextSibling;
- }
- }
-
- if (element instanceof PsiExpression) {
- final PsiElement parent = element.getParent().getParent();
- if ((parent instanceof PsiCall ||
- parent instanceof PsiAnonymousClass
- ) &&
- prevSibling instanceof PsiJavaToken &&
- ((PsiJavaToken)prevSibling).getTokenType() == JavaTokenType.COMMA
- ) {
- firstToDelete = prevSibling;
- }
- }
- else if (element instanceof PsiParameter &&
- prevSibling instanceof PsiJavaToken &&
- ((PsiJavaToken)prevSibling).getTokenType() == JavaTokenType.COMMA
- ) {
- firstToDelete = prevSibling;
- }
-
- element.getParent().deleteChildRange(firstToDelete, lastToDelete);
- }
- }
-
- if (options.isToShortenFQN() && elementParent.isValid()) {
- JavaCodeStyleManager.getInstance(project).shortenClassReferences(elementParent, 0, elementParent.getTextLength());
- }
- }
-
- @Nullable
- private static PsiElement createSemicolon(final PsiElement space) throws IncorrectOperationException {
- final PsiStatement text = JavaPsiFacade.getInstance(space.getProject()).getElementFactory().createStatementFromText(";", null);
- return text.getFirstChild();
- }
-
- private static PsiElement createWhiteSpace(final PsiElement space) throws IncorrectOperationException {
- return PsiParserFacade.SERVICE.getInstance(space.getProject()).createWhiteSpaceFromText(" ");
- }
-
- private static class ModifierListOwnerCollector extends JavaRecursiveElementWalkingVisitor {
- HashMap<String, PsiNamedElement> namedElements = new HashMap<String, PsiNamedElement>(1);
-
- @Override
- public void visitClass(PsiClass aClass) {
- if (aClass instanceof PsiAnonymousClass) return;
- handleNamedElement(aClass);
- }
-
- private void handleNamedElement(final PsiNamedElement named) {
- String name = named.getName();
-
- assert name != null;
-
- if (StructuralSearchUtil.isTypedVariable(name)) {
- name = name.substring(1, name.length() - 1);
- }
-
- if (!namedElements.containsKey(name)) namedElements.put(name, named);
- named.acceptChildren(this);
- }
-
- @Override
- public void visitVariable(PsiVariable var) {
- handleNamedElement(var);
- }
-
- @Override
- public void visitMethod(PsiMethod method) {
- handleNamedElement(method);
- }
- }
-}
diff --git a/plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/JavaStructuralSearchProfile.java b/plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/JavaStructuralSearchProfile.java
deleted file mode 100644
index c738b55b85ae..000000000000
--- a/plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/JavaStructuralSearchProfile.java
+++ /dev/null
@@ -1,675 +0,0 @@
-package com.intellij.structuralsearch;
-
-import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer;
-import com.intellij.codeInsight.template.JavaCodeContextType;
-import com.intellij.codeInsight.template.TemplateContextType;
-import com.intellij.codeInsight.template.TemplateManager;
-import com.intellij.dupLocator.iterators.NodeIterator;
-import com.intellij.lang.Language;
-import com.intellij.lang.StdLanguages;
-import com.intellij.openapi.editor.Document;
-import com.intellij.openapi.editor.Editor;
-import com.intellij.openapi.fileEditor.FileEditorManager;
-import com.intellij.openapi.fileTypes.FileType;
-import com.intellij.openapi.fileTypes.LanguageFileType;
-import com.intellij.openapi.fileTypes.StdFileTypes;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.psi.*;
-import com.intellij.psi.util.PsiTreeUtil;
-import com.intellij.psi.util.PsiUtilCore;
-import com.intellij.structuralsearch.impl.matcher.*;
-import com.intellij.structuralsearch.impl.matcher.compiler.GlobalCompilingVisitor;
-import com.intellij.structuralsearch.impl.matcher.compiler.JavaCompilingVisitor;
-import com.intellij.structuralsearch.impl.matcher.compiler.PatternCompiler;
-import com.intellij.structuralsearch.impl.matcher.filters.JavaLexicalNodesFilter;
-import com.intellij.structuralsearch.impl.matcher.filters.LexicalNodesFilter;
-import com.intellij.structuralsearch.plugin.replace.ReplaceOptions;
-import com.intellij.structuralsearch.plugin.replace.impl.ParameterInfo;
-import com.intellij.structuralsearch.plugin.replace.impl.ReplacementBuilder;
-import com.intellij.structuralsearch.plugin.replace.impl.ReplacementContext;
-import com.intellij.structuralsearch.plugin.replace.impl.Replacer;
-import com.intellij.structuralsearch.plugin.ui.Configuration;
-import com.intellij.structuralsearch.plugin.ui.SearchContext;
-import com.intellij.structuralsearch.plugin.ui.UIUtil;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.util.*;
-
-/**
- * @author Eugene.Kudelevsky
- */
-public class JavaStructuralSearchProfile extends StructuralSearchProfile {
- private JavaLexicalNodesFilter myJavaLexicalNodesFilter;
-
- public String getText(PsiElement match, int start,int end) {
- if (match instanceof PsiIdentifier) {
- PsiElement parent = match.getParent();
- if (parent instanceof PsiJavaCodeReferenceElement && !(parent instanceof PsiExpression)) {
- match = parent; // care about generic
- }
- }
- final String matchText = match.getText();
- if (start==0 && end==-1) return matchText;
- return matchText.substring(start,end == -1? matchText.length():end);
- }
-
- public Class getElementContextByPsi(PsiElement element) {
- if (element instanceof PsiIdentifier) {
- element = element.getParent();
- }
-
- if (element instanceof PsiMember) {
- return PsiMember.class;
- } else {
- return PsiExpression.class;
- }
- }
-
- public String getTypedVarString(final PsiElement element) {
- String text;
-
- if (element instanceof PsiNamedElement) {
- text = ((PsiNamedElement)element).getName();
- }
- else if (element instanceof PsiAnnotation) {
- PsiJavaCodeReferenceElement referenceElement = ((PsiAnnotation)element).getNameReferenceElement();
- text = referenceElement == null ? null : referenceElement.getQualifiedName();
- }
- else if (element instanceof PsiNameValuePair) {
- text = ((PsiNameValuePair)element).getName();
- }
- else {
- text = element.getText();
- if (StringUtil.startsWithChar(text, '@')) {
- text = text.substring(1);
- }
- if (StringUtil.endsWithChar(text, ';')) text = text.substring(0, text.length() - 1);
- else if (element instanceof PsiExpressionStatement) {
- int i = text.indexOf(';');
- if (i != -1) text = text.substring(0, i);
- }
- }
-
- if (text==null) text = element.getText();
-
- return text;
- }
-
- @Override
- public String getMeaningfulText(PsiElement element) {
- if (element instanceof PsiReferenceExpression &&
- ((PsiReferenceExpression)element).getQualifierExpression() != null) {
- final PsiElement resolve = ((PsiReferenceExpression)element).resolve();
- if (resolve instanceof PsiClass) return element.getText();
-
- final PsiElement referencedElement = ((PsiReferenceExpression)element).getReferenceNameElement();
- String text = referencedElement != null ? referencedElement.getText() : "";
-
- if (resolve == null && text.length() > 0 && Character.isUpperCase(text.charAt(0))) {
- return element.getText();
- }
- return text;
- }
- return super.getMeaningfulText(element);
- }
-
- @Override
- public PsiElement updateCurrentNode(PsiElement targetNode) {
- if (targetNode instanceof PsiCodeBlock && ((PsiCodeBlock)targetNode).getStatements().length == 1) {
- PsiElement targetNodeParent = targetNode.getParent();
- if (targetNodeParent instanceof PsiBlockStatement) {
- targetNodeParent = targetNodeParent.getParent();
- }
-
- if (targetNodeParent instanceof PsiIfStatement || targetNodeParent instanceof PsiLoopStatement) {
- targetNode = targetNodeParent;
- }
- }
- return targetNode;
- }
-
- @Override
- public PsiElement extendMatchedByDownUp(PsiElement targetNode) {
- if (targetNode instanceof PsiIdentifier) {
- targetNode = targetNode.getParent();
- final PsiElement parent = targetNode.getParent();
- if (parent instanceof PsiTypeElement || parent instanceof PsiStatement) targetNode = parent;
- }
- return targetNode;
- }
-
- @Override
- public PsiElement extendMatchOnePsiFile(PsiElement file) {
- if (file instanceof PsiIdentifier) {
- // Searching in previous results
- file = file.getParent();
- }
- return file;
- }
-
- public void compile(PsiElement[] elements, @NotNull GlobalCompilingVisitor globalVisitor) {
- elements[0].getParent().accept(new JavaCompilingVisitor(globalVisitor));
- }
-
- @NotNull
- public PsiElementVisitor createMatchingVisitor(@NotNull GlobalMatchingVisitor globalVisitor) {
- return new JavaMatchingVisitor(globalVisitor);
- }
-
- @NotNull
- @Override
- public PsiElementVisitor getLexicalNodesFilter(@NotNull LexicalNodesFilter filter) {
- if (myJavaLexicalNodesFilter == null) {
- myJavaLexicalNodesFilter = new JavaLexicalNodesFilter(filter);
- }
- return myJavaLexicalNodesFilter;
- }
-
- @NotNull
- public CompiledPattern createCompiledPattern() {
- return new JavaCompiledPattern();
- }
-
- @Override
- public boolean canProcess(@NotNull FileType fileType) {
- return fileType == StdFileTypes.JAVA;
- }
-
- public boolean isMyLanguage(@NotNull Language language) {
- return language == StdLanguages.JAVA;
- }
-
- @Override
- public StructuralReplaceHandler getReplaceHandler(@NotNull ReplacementContext context) {
- return new JavaReplaceHandler(context);
- }
-
- @NotNull
- @Override
- public PsiElement[] createPatternTree(@NotNull String text,
- @NotNull PatternTreeContext context,
- @NotNull FileType fileType,
- @Nullable Language language,
- String contextName, @Nullable String extension,
- @NotNull Project project,
- boolean physical) {
- if (physical) {
- throw new UnsupportedOperationException(getClass() + " cannot create physical PSI");
- }
- PsiElementFactory elementFactory = JavaPsiFacade.getInstance(project).getElementFactory();
- if (context == PatternTreeContext.Block) {
- PsiElement element = elementFactory.createStatementFromText("{\n" + text + "\n}", null);
- final PsiElement[] children = ((PsiBlockStatement)element).getCodeBlock().getChildren();
- final int extraChildCount = 4;
-
- if (children.length > extraChildCount) {
- PsiElement[] result = new PsiElement[children.length - extraChildCount];
- final int extraChildStart = 2;
- System.arraycopy(children, extraChildStart, result, 0, children.length - extraChildCount);
- return result;
- }
- else {
- return PsiElement.EMPTY_ARRAY;
- }
- }
- else if (context == PatternTreeContext.Class) {
- PsiElement element = elementFactory.createStatementFromText("class A {\n" + text + "\n}", null);
- PsiClass clazz = (PsiClass)((PsiDeclarationStatement)element).getDeclaredElements()[0];
- PsiElement startChild = clazz.getLBrace();
- if (startChild != null) startChild = startChild.getNextSibling();
-
- PsiElement endChild = clazz.getRBrace();
- if (endChild != null) endChild = endChild.getPrevSibling();
- if (startChild == endChild) return PsiElement.EMPTY_ARRAY; // nothing produced
-
- final List<PsiElement> result = new ArrayList<PsiElement>(3);
- assert startChild != null;
- for (PsiElement el = startChild.getNextSibling(); el != endChild && el != null; el = el.getNextSibling()) {
- if (el instanceof PsiErrorElement) continue;
- result.add(el);
- }
-
- return PsiUtilCore.toPsiElementArray(result);
- }
- else {
- return PsiFileFactory.getInstance(project).createFileFromText("__dummy.java", text).getChildren();
- }
- }
-
- @NotNull
- @Override
- public Editor createEditor(@NotNull SearchContext searchContext,
- @NotNull FileType fileType,
- Language dialect,
- String text,
- boolean useLastConfiguration) {
- // provides autocompletion
-
- PsiElement element = searchContext.getFile();
-
- if (element != null && !useLastConfiguration) {
- final Editor selectedEditor = FileEditorManager.getInstance(searchContext.getProject()).getSelectedTextEditor();
-
- if (selectedEditor != null) {
- int caretPosition = selectedEditor.getCaretModel().getOffset();
- PsiElement positionedElement = searchContext.getFile().findElementAt(caretPosition);
-
- if (positionedElement == null) {
- positionedElement = searchContext.getFile().findElementAt(caretPosition + 1);
- }
-
- if (positionedElement != null) {
- element = PsiTreeUtil.getParentOfType(
- positionedElement,
- PsiClass.class, PsiCodeBlock.class
- );
- }
- }
- }
-
- final PsiManager psimanager = PsiManager.getInstance(searchContext.getProject());
- final Project project = psimanager.getProject();
- final PsiCodeFragment file = createCodeFragment(project, text, element);
- final Document doc = PsiDocumentManager.getInstance(searchContext.getProject()).getDocument(file);
- DaemonCodeAnalyzer.getInstance(searchContext.getProject()).setHighlightingEnabled(file, false);
- return UIUtil.createEditor(doc, searchContext.getProject(), true, true, getTemplateContextType());
- }
-
- @Override
- public Class<? extends TemplateContextType> getTemplateContextTypeClass() {
- return JavaCodeContextType.class;
- }
-
- public PsiCodeFragment createCodeFragment(Project project, String text, PsiElement context) {
- final JavaCodeFragmentFactory factory = JavaCodeFragmentFactory.getInstance(project);
- return factory.createCodeBlockCodeFragment(text, context, true);
- }
-
- @Override
- public void checkSearchPattern(Project project, MatchOptions options) {
- class ValidatingVisitor extends JavaRecursiveElementWalkingVisitor {
- private PsiElement myCurrent;
-
- @Override public void visitAnnotation(PsiAnnotation annotation) {
- final PsiJavaCodeReferenceElement nameReferenceElement = annotation.getNameReferenceElement();
-
- if (nameReferenceElement == null ||
- !nameReferenceElement.getText().equals(MatchOptions.MODIFIER_ANNOTATION_NAME)) {
- return;
- }
-
- for(PsiNameValuePair pair:annotation.getParameterList().getAttributes()) {
- final PsiAnnotationMemberValue value = pair.getValue();
-
- if (value instanceof PsiArrayInitializerMemberValue) {
- for(PsiAnnotationMemberValue v:((PsiArrayInitializerMemberValue)value).getInitializers()) {
- final String name = StringUtil.stripQuotesAroundValue(v.getText());
- checkModifier(name);
- }
-
- } else if (value != null) {
- final String name = StringUtil.stripQuotesAroundValue(value.getText());
- checkModifier(name);
- }
- }
- }
-
- private void checkModifier(final String name) {
- if (!MatchOptions.INSTANCE_MODIFIER_NAME.equals(name) &&
- !PsiModifier.PACKAGE_LOCAL.equals(name) &&
- Arrays.binarySearch(JavaMatchingVisitor.MODIFIERS, name) < 0
- ) {
- throw new MalformedPatternException(SSRBundle.message("invalid.modifier.type",name));
- }
- }
-
- @Override
- public void visitErrorElement(PsiErrorElement element) {
- super.visitErrorElement(element);
- //final PsiElement parent = element.getParent();
- //if (parent != myCurrent || !"';' expected".equals(element.getErrorDescription())) {
- // throw new MalformedPatternException(element.getErrorDescription());
- //}
- }
-
- public void setCurrent(PsiElement current) {
- myCurrent = current;
- }
- }
- ValidatingVisitor visitor = new ValidatingVisitor();
- final CompiledPattern compiledPattern = PatternCompiler.compilePattern(project, options);
- final int nodeCount = compiledPattern.getNodeCount();
- final NodeIterator nodes = compiledPattern.getNodes();
- while (nodes.hasNext()) {
- final PsiElement current = nodes.current();
- visitor.setCurrent(nodeCount == 1 && current instanceof PsiExpressionStatement ? current : null);
- current.accept(visitor);
- nodes.advance();
- }
- nodes.reset();
- }
-
- @Override
- public void checkReplacementPattern(Project project, ReplaceOptions options) {
- MatchOptions matchOptions = options.getMatchOptions();
- FileType fileType = matchOptions.getFileType();
- PsiElement[] statements = MatcherImplUtil.createTreeFromText(
- matchOptions.getSearchPattern(),
- PatternTreeContext.Block,
- fileType,
- project
- );
- final boolean searchIsExpression = statements.length == 1 && statements[0].getLastChild() instanceof PsiErrorElement;
-
- PsiElement[] statements2 = MatcherImplUtil.createTreeFromText(
- options.getReplacement(),
- PatternTreeContext.Block,
- fileType,
- project
- );
- final boolean replaceIsExpression = statements2.length == 1 && statements2[0].getLastChild() instanceof PsiErrorElement;
-
- if (searchIsExpression != replaceIsExpression) {
- throw new UnsupportedPatternException(
- searchIsExpression ? SSRBundle.message("replacement.template.is.not.expression.error.message") :
- SSRBundle.message("search.template.is.not.expression.error.message")
- );
- }
- }
-
- @Override
- public LanguageFileType getDefaultFileType(LanguageFileType currentDefaultFileType) {
- return StdFileTypes.JAVA;
- }
-
- @Override
- Configuration[] getPredefinedTemplates() {
- return JavaPredefinedConfigurations.createPredefinedTemplates();
- }
-
- @Override
- public void provideAdditionalReplaceOptions(@NotNull PsiElement node, final ReplaceOptions options, final ReplacementBuilder builder) {
- final String templateText = TemplateManager.getInstance(node.getProject()).createTemplate("", "", options.getReplacement()).getTemplateText();
- node.accept(new JavaRecursiveElementWalkingVisitor() {
- @Override
- public void visitReferenceExpression(PsiReferenceExpression expression) {
- visitElement(expression);
- }
-
- @Override
- public void visitVariable(PsiVariable field) {
- super.visitVariable(field);
-
- final PsiExpression initializer = field.getInitializer();
-
- if (initializer != null) {
- final String initText = initializer.getText();
-
- if (StructuralSearchUtil.isTypedVariable(initText)) {
- final ParameterInfo initInfo = builder.findParameterization(Replacer.stripTypedVariableDecoration(initText));
-
- if (initInfo != null) {
- initInfo.setVariableInitialContext(true);
- }
- }
- }
- }
-
- @Override
- public void visitClass(PsiClass aClass) {
- super.visitClass(aClass);
-
- MatchVariableConstraint constraint =
- options.getMatchOptions().getVariableConstraint(CompiledPattern.ALL_CLASS_UNMATCHED_CONTENT_VAR_ARTIFICIAL_NAME);
- if (constraint != null) {
- ParameterInfo e = new ParameterInfo();
- e.setName(CompiledPattern.ALL_CLASS_UNMATCHED_CONTENT_VAR_ARTIFICIAL_NAME);
- e.setStartIndex(templateText.lastIndexOf('}'));
- builder.addParametrization(e);
- }
- }
-
- @Override
- public void visitMethod(PsiMethod method) {
- super.visitMethod(method);
-
- String name = method.getName();
- if (StructuralSearchUtil.isTypedVariable(name)) {
- name = Replacer.stripTypedVariableDecoration(name);
-
- ParameterInfo methodInfo = builder.findParameterization(name);
- methodInfo.setScopeParameterization(true);
- //if (scopedParameterizations != null) scopedParameterizations.put(method.getTextRange(), methodInfo);
- }
- }
-
- @Override
- public void visitParameter(PsiParameter parameter) {
- super.visitParameter(parameter);
-
- String name = parameter.getName();
- String type = parameter.getType().getCanonicalText();
-
- if (StructuralSearchUtil.isTypedVariable(name)) {
- name = Replacer.stripTypedVariableDecoration(name);
-
- if (StructuralSearchUtil.isTypedVariable(type)) {
- type = Replacer.stripTypedVariableDecoration(type);
- }
- ParameterInfo nameInfo = builder.findParameterization(name);
- ParameterInfo typeInfo = builder.findParameterization(type);
-
- if (nameInfo != null && typeInfo != null && !(parameter.getParent() instanceof PsiCatchSection)) {
- nameInfo.setParameterContext(false);
- typeInfo.setParameterContext(false);
- typeInfo.setMethodParameterContext(true);
- nameInfo.setMethodParameterContext(true);
- typeInfo.setElement(parameter.getTypeElement());
- }
- }
- }
- });
- }
-
- @Override
- public int handleSubstitution(final ParameterInfo info,
- MatchResult match,
- StringBuilder result,
- int offset,
- HashMap<String, MatchResult> matchMap) {
- if (info.getName().equals(match.getName())) {
- String replacementString = match.getMatchImage();
- boolean forceAddingNewLine = false;
-
- if (info.isMethodParameterContext()) {
- StringBuilder buf = new StringBuilder();
- handleMethodParameter(buf, info, matchMap);
- replacementString = buf.toString();
- }
- else if (match.getAllSons().size() > 0 && !match.isScopeMatch()) {
- // compound matches
- StringBuilder buf = new StringBuilder();
- MatchResult r = null;
-
- for (final MatchResult matchResult : match.getAllSons()) {
- MatchResult previous = r;
- r = matchResult;
-
- final PsiElement currentElement = r.getMatch();
-
- if (buf.length() > 0) {
- final PsiElement parent = currentElement.getParent();
- if (info.isStatementContext()) {
- final PsiElement previousElement = previous.getMatchRef().getElement();
-
- if (!(previousElement instanceof PsiComment) &&
- ( buf.charAt(buf.length() - 1) != '}' ||
- previousElement instanceof PsiDeclarationStatement
- )
- ) {
- buf.append(';');
- }
-
- final PsiElement prevSibling = currentElement.getPrevSibling();
-
- if (prevSibling instanceof PsiWhiteSpace &&
- prevSibling.getPrevSibling() == previous.getMatch()
- ) {
- // consequent statements matched so preserve whitespacing
- buf.append(prevSibling.getText());
- }
- else {
- buf.append('\n');
- }
- }
- else if (info.isParameterContext()) {
- buf.append(',');
- }
- else if (parent instanceof PsiClass) {
- final PsiElement prevSibling = PsiTreeUtil.skipSiblingsBackward(currentElement, PsiWhiteSpace.class);
- if (prevSibling instanceof PsiJavaToken && JavaTokenType.COMMA.equals(((PsiJavaToken)prevSibling).getTokenType())) {
- buf.append(',');
- }
- else {
- buf.append('\n');
- }
- }
- else if (parent instanceof PsiReferenceList) {
- buf.append(',');
- }
- else {
- buf.append(' ');
- }
- }
-
- buf.append(r.getMatchImage());
- removeExtraSemicolonForSingleVarInstanceInMultipleMatch(info, r, buf);
- forceAddingNewLine = currentElement instanceof PsiComment;
- }
-
- replacementString = buf.toString();
- } else {
- StringBuilder buf = new StringBuilder();
- if (info.isStatementContext()) {
- forceAddingNewLine = match.getMatch() instanceof PsiComment;
- }
- buf.append(replacementString);
- removeExtraSemicolonForSingleVarInstanceInMultipleMatch(info, match, buf);
- replacementString = buf.toString();
- }
-
- offset = Replacer.insertSubstitution(result, offset, info, replacementString);
- offset = removeExtraSemicolon(info, offset, result, match);
- if (forceAddingNewLine && info.isStatementContext()) {
- result.insert(info.getStartIndex() + offset + 1, '\n');
- offset ++;
- }
- }
- return offset;
- }
-
- @Override
- public int processAdditionalOptions(ParameterInfo info, int offset, StringBuilder result, MatchResult r) {
- if (info.isStatementContext()) {
- return removeExtraSemicolon(info, offset, result, r);
- }
- return offset;
- }
-
- @Override
- public boolean isIdentifier(PsiElement element) {
- return element instanceof PsiIdentifier;
- }
-
- @Override
- public Collection<String> getReservedWords() {
- return Collections.singleton(PsiModifier.PACKAGE_LOCAL);
- }
-
- @Override
- public boolean isDocCommentOwner(PsiElement match) {
- return match instanceof PsiMember;
- }
-
- private static void handleMethodParameter(StringBuilder buf, ParameterInfo info, HashMap<String, MatchResult> matchMap) {
- if(info.getElement() ==null) {
- // no specific handling for name of method parameter since it is handled with type
- return;
- }
-
- String name = ((PsiParameter)info.getElement().getParent()).getName();
- name = StructuralSearchUtil.isTypedVariable(name) ? Replacer.stripTypedVariableDecoration(name):name;
-
- final MatchResult matchResult = matchMap.get(name);
- if (matchResult == null) return;
-
- if (matchResult.isMultipleMatch()) {
- for (MatchResult result : matchResult.getAllSons()) {
- if (buf.length() > 0) {
- buf.append(',');
- }
-
- appendParameter(buf, result);
- }
- } else {
- appendParameter(buf, matchResult);
- }
- }
-
- private static void appendParameter(final StringBuilder buf, final MatchResult _matchResult) {
- for(Iterator<MatchResult> j = _matchResult.getAllSons().iterator();j.hasNext();) {
- buf.append(j.next().getMatchImage()).append(' ').append(j.next().getMatchImage());
- }
- }
-
- private static void removeExtraSemicolonForSingleVarInstanceInMultipleMatch(final ParameterInfo info, MatchResult r, StringBuilder buf) {
- if (info.isStatementContext()) {
- final PsiElement element = r.getMatchRef().getElement();
-
- // remove extra ;
- if (buf.charAt(buf.length()-1)==';' &&
- r.getMatchImage().charAt(r.getMatchImage().length()-1)==';' &&
- ( element instanceof PsiReturnStatement ||
- element instanceof PsiDeclarationStatement ||
- element instanceof PsiExpressionStatement ||
- element instanceof PsiAssertStatement ||
- element instanceof PsiBreakStatement ||
- element instanceof PsiContinueStatement ||
- element instanceof PsiMember ||
- element instanceof PsiIfStatement && !(((PsiIfStatement)element).getThenBranch() instanceof PsiBlockStatement) ||
- element instanceof PsiLoopStatement && !(((PsiLoopStatement)element).getBody() instanceof PsiBlockStatement)
- )
- ) {
- // contains extra ;
- buf.deleteCharAt(buf.length()-1);
- }
- }
- }
-
- private static int removeExtraSemicolon(ParameterInfo info, int offset, StringBuilder result, MatchResult match) {
- if (info.isStatementContext()) {
- int index = offset+ info.getStartIndex();
- if (result.charAt(index)==';' &&
- ( match == null ||
- ( result.charAt(index-1)=='}' &&
- !(match.getMatch() instanceof PsiDeclarationStatement) && // array init in dcl
- !(match.getMatch() instanceof PsiNewExpression) // array initializer
- ) ||
- ( !match.isMultipleMatch() && // ; in comment
- match.getMatch() instanceof PsiComment
- ) ||
- ( match.isMultipleMatch() && // ; in comment
- match.getAllSons().get( match.getAllSons().size() - 1 ).getMatch() instanceof PsiComment
- )
- )
- ) {
- result.deleteCharAt(index);
- --offset;
- }
- }
-
- return offset;
- }
-}
diff --git a/plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/JavaMatchingVisitor.java b/plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/JavaMatchingVisitor.java
deleted file mode 100644
index 38e77c796281..000000000000
--- a/plugins/structuralsearch/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/JavaMatchingVisitor.java
+++ /dev/null
@@ -1,1640 +0,0 @@
-package com.intellij.structuralsearch.impl.matcher;
-
-import com.intellij.openapi.util.Key;
-import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.psi.*;
-import com.intellij.psi.javadoc.PsiDocComment;
-import com.intellij.psi.javadoc.PsiDocTag;
-import com.intellij.psi.javadoc.PsiDocTagValue;
-import com.intellij.psi.tree.IElementType;
-import com.intellij.psi.util.PsiTreeUtil;
-import com.intellij.psi.util.PsiUtil;
-import com.intellij.structuralsearch.MatchOptions;
-import com.intellij.structuralsearch.MatchResult;
-import com.intellij.structuralsearch.impl.matcher.filters.LexicalNodesFilter;
-import com.intellij.structuralsearch.impl.matcher.handlers.MatchPredicate;
-import com.intellij.structuralsearch.impl.matcher.handlers.MatchingHandler;
-import com.intellij.structuralsearch.impl.matcher.handlers.SubstitutionHandler;
-import com.intellij.dupLocator.iterators.ArrayBackedNodeIterator;
-import com.intellij.structuralsearch.impl.matcher.iterators.DocValuesIterator;
-import com.intellij.structuralsearch.impl.matcher.iterators.HierarchyNodeIterator;
-import com.intellij.dupLocator.iterators.NodeIterator;
-import com.intellij.structuralsearch.impl.matcher.predicates.NotPredicate;
-import com.intellij.structuralsearch.impl.matcher.predicates.RegExpPredicate;
-import com.intellij.util.containers.ContainerUtil;
-
-import java.util.*;
-
-/**
- * @author Eugene.Kudelevsky
- */
-public class JavaMatchingVisitor extends JavaElementVisitor {
- public static final String[] MODIFIERS = {
- PsiModifier.PUBLIC, PsiModifier.PROTECTED, PsiModifier.PRIVATE, PsiModifier.STATIC, PsiModifier.ABSTRACT, PsiModifier.FINAL,
- PsiModifier.NATIVE, PsiModifier.SYNCHRONIZED, PsiModifier.STRICTFP, PsiModifier.TRANSIENT, PsiModifier.VOLATILE, PsiModifier.DEFAULT
- };
- public static final Key<List<PsiCatchSection>> UNMATCHED_CATCH_SECTION_CONTENT_VAR_KEY = Key.create("UnmatchedCatchSection");
- private final GlobalMatchingVisitor myMatchingVisitor;
- private PsiClass myClazz;
-
- static {
- Arrays.sort(MODIFIERS);
- }
-
- public JavaMatchingVisitor(GlobalMatchingVisitor matchingVisitor) {
- this.myMatchingVisitor = matchingVisitor;
- }
-
- @Override
- public void visitComment(PsiComment comment) {
- PsiElement comment2 = null;
-
- if (!(myMatchingVisitor.getElement() instanceof PsiComment)) {
- if (myMatchingVisitor.getElement() instanceof PsiMember) {
- final PsiElement[] children = myMatchingVisitor.getElement().getChildren();
- if (children[0] instanceof PsiComment) {
- comment2 = children[0];
- }
- }
- }
- else {
- comment2 = myMatchingVisitor.getElement();
- }
-
- if (comment2 == null) {
- myMatchingVisitor.setResult(false);
- return;
- }
-
- final Object userData = comment.getUserData(CompiledPattern.HANDLER_KEY);
-
- if (userData instanceof String) {
- String str = (String)userData;
- int end = comment2.getTextLength();
-
- if (((PsiComment)comment2).getTokenType() == JavaTokenType.C_STYLE_COMMENT) {
- end -= 2;
- }
- myMatchingVisitor.setResult(((SubstitutionHandler)myMatchingVisitor.getMatchContext().getPattern().getHandler(str)).handle(
- comment2,
- 2,
- end,
- myMatchingVisitor.getMatchContext()
- ));
- }
- else if (userData instanceof MatchingHandler) {
- myMatchingVisitor.setResult(((MatchingHandler)userData).match(comment, comment2, myMatchingVisitor.getMatchContext()));
- }
- else {
- myMatchingVisitor.setResult(comment.getText().equals(comment2.getText()));
- }
- }
-
- @Override
- public void visitDocTagValue(final PsiDocTagValue value) {
- final PsiDocTagValue value2 = (PsiDocTagValue)myMatchingVisitor.getElement();
- final boolean isTypedVar = myMatchingVisitor.getMatchContext().getPattern().isTypedVar(value);
-
- if (isTypedVar) {
- myMatchingVisitor.setResult(myMatchingVisitor.handleTypedElement(value, value2));
- }
- else {
- myMatchingVisitor.setResult(value.textMatches(value2));
- }
- }
-
- private static boolean isNotInstanceModifier(final PsiModifierList list2) {
- return list2.hasModifierProperty(PsiModifier.STATIC) ||
- list2.hasModifierProperty(PsiModifier.ABSTRACT);
- }
-
- @Override
- public final void visitModifierList(final PsiModifierList list) {
- final PsiModifierList list2 = (PsiModifierList)myMatchingVisitor.getElement();
-
- for (@PsiModifier.ModifierConstant String modifier : MODIFIERS) {
- if (list.hasModifierProperty(modifier) && !list2.hasModifierProperty(modifier)) {
- myMatchingVisitor.setResult(false);
- return;
- }
- }
-
- final PsiAnnotation[] annotations = list.getAnnotations();
- if (annotations.length > 0) {
- HashSet<PsiAnnotation> set = new HashSet<PsiAnnotation>(Arrays.asList(annotations));
-
- for (PsiAnnotation annotation : annotations) {
- final PsiJavaCodeReferenceElement nameReferenceElement = annotation.getNameReferenceElement();
-
- if (nameReferenceElement != null && MatchOptions.MODIFIER_ANNOTATION_NAME.equals(nameReferenceElement.getText())) {
- final PsiAnnotationParameterList parameterList = annotation.getParameterList();
- final PsiNameValuePair[] attributes = parameterList.getAttributes();
-
- for (PsiNameValuePair pair : attributes) {
- final PsiAnnotationMemberValue value = pair.getValue();
- if (value == null) continue;
-
- if (value instanceof PsiArrayInitializerMemberValue) {
- boolean matchedOne = false;
-
- for (PsiAnnotationMemberValue v : ((PsiArrayInitializerMemberValue)value).getInitializers()) {
- @PsiModifier.ModifierConstant String name = StringUtil.stripQuotesAroundValue(v.getText());
- if (MatchOptions.INSTANCE_MODIFIER_NAME.equals(name)) {
- if (isNotInstanceModifier(list2)) {
- myMatchingVisitor.setResult(false);
- return;
- }
- else {
- matchedOne = true;
- }
- }
- else if (list2.hasModifierProperty(name)) {
- matchedOne = true;
- break;
- }
- }
-
- if (!matchedOne) {
- myMatchingVisitor.setResult(false);
- return;
- }
- }
- else {
- @PsiModifier.ModifierConstant String name = StringUtil.stripQuotesAroundValue(value.getText());
- if (MatchOptions.INSTANCE_MODIFIER_NAME.equals(name)) {
- if (isNotInstanceModifier(list2)) {
- myMatchingVisitor.setResult(false);
- return;
- }
- }
- else if (!list2.hasModifierProperty(name)) {
- myMatchingVisitor.setResult(false);
- return;
- }
- }
- }
-
- set.remove(annotation);
- }
- }
-
- myMatchingVisitor.setResult(set.isEmpty() || myMatchingVisitor
- .matchInAnyOrder(set.toArray(new PsiAnnotation[set.size()]), list2.getAnnotations()));
- }
- else {
- myMatchingVisitor.setResult(true);
- }
- }
-
- @Override
- public void visitDocTag(final PsiDocTag tag) {
- final PsiDocTag tag2 = (PsiDocTag)myMatchingVisitor.getElement();
- final boolean isTypedVar = myMatchingVisitor.getMatchContext().getPattern().isTypedVar(tag.getNameElement());
-
- myMatchingVisitor.setResult(isTypedVar || tag.getName().equals(tag2.getName()));
-
- PsiElement psiDocTagValue = tag.getValueElement();
- boolean isTypedValue = false;
-
- if (myMatchingVisitor.getResult() && psiDocTagValue != null) {
- final PsiElement[] children = psiDocTagValue.getChildren();
- if (children.length == 1) {
- psiDocTagValue = children[0];
- }
- isTypedValue = myMatchingVisitor.getMatchContext().getPattern().isTypedVar(psiDocTagValue);
-
- if (isTypedValue) {
- if (tag2.getValueElement() != null) {
- myMatchingVisitor.setResult(myMatchingVisitor.handleTypedElement(psiDocTagValue, tag2.getValueElement()));
- }
- else {
- myMatchingVisitor.setResult(allowsAbsenceOfMatch(psiDocTagValue));
- }
- }
- }
-
- if (myMatchingVisitor.getResult() && !isTypedValue) {
- myMatchingVisitor.setResult(myMatchingVisitor.matchInAnyOrder(
- new DocValuesIterator(tag.getFirstChild()),
- new DocValuesIterator(tag2.getFirstChild())
- ));
- }
-
- if (myMatchingVisitor.getResult() && isTypedVar) {
- myMatchingVisitor.setResult(myMatchingVisitor.handleTypedElement(tag.getNameElement(), tag2.getNameElement()));
- }
- }
-
- private boolean allowsAbsenceOfMatch(final PsiElement element) {
- MatchingHandler handler = myMatchingVisitor.getMatchContext().getPattern().getHandler(element);
-
- if (handler instanceof SubstitutionHandler &&
- ((SubstitutionHandler)handler).getMinOccurs() == 0) {
- return true;
- }
- return false;
- }
-
- @Override
- public void visitDocComment(final PsiDocComment comment) {
- PsiDocComment comment2;
-
- if (myMatchingVisitor.getElement() instanceof PsiDocCommentOwner) {
- comment2 = ((PsiDocCommentOwner)myMatchingVisitor.getElement()).getDocComment();
-
- if (comment2 == null) {
- // doc comment are not collapsed for inner classes!
- myMatchingVisitor.setResult(false);
- return;
- }
- }
- else {
- comment2 = (PsiDocComment)myMatchingVisitor.getElement();
-
- if (myMatchingVisitor.getElement().getParent() instanceof PsiDocCommentOwner) {
- myMatchingVisitor.setResult(false);
- return; // we should matched the doc before
- }
- }
-
- if (comment.getTags().length > 0) {
- myMatchingVisitor.setResult(myMatchingVisitor.matchInAnyOrder(comment.getTags(), comment2.getTags()));
- }
- else {
- visitComment(comment);
- }
- }
-
- @Override
- public void visitElement(PsiElement el) {
- myMatchingVisitor.setResult(el.textMatches(myMatchingVisitor.getElement()));
- }
-
- @Override
- public void visitArrayInitializerExpression(PsiArrayInitializerExpression expression) {
- final PsiArrayInitializerExpression expr2 = (PsiArrayInitializerExpression)myMatchingVisitor.getElement();
-
- myMatchingVisitor.setResult(myMatchingVisitor.matchSequentially(
- new ArrayBackedNodeIterator(expression.getInitializers()),
- new ArrayBackedNodeIterator(expr2.getInitializers())
- ));
- }
-
- @Override
- public void visitClassInitializer(PsiClassInitializer initializer) {
- PsiClassInitializer initializer2 = (PsiClassInitializer)myMatchingVisitor.getElement();
- myMatchingVisitor.setResult(myMatchingVisitor.match(initializer.getModifierList(), initializer2.getModifierList()) &&
- myMatchingVisitor.match(initializer.getBody(), initializer2.getBody()));
- }
-
- @Override
- public void visitCodeBlock(PsiCodeBlock block) {
- myMatchingVisitor.setResult(myMatchingVisitor.matchSons(block, myMatchingVisitor.getElement()));
- }
-
- @Override
- public void visitJavaToken(final PsiJavaToken token) {
- PsiElement element = myMatchingVisitor.getElement();
- boolean result;
-
- if (!(element instanceof PsiJavaToken)) {
- result = token.textMatches(element);
- } else {
- final PsiJavaToken anotherToken = (PsiJavaToken)element;
-
- result = token.getTokenType() == anotherToken.getTokenType() && token.textMatches(anotherToken);
- }
-
- myMatchingVisitor.setResult(result);
- }
-
- @Override
- public void visitAnnotation(PsiAnnotation annotation) {
- final PsiAnnotation psiAnnotation = (PsiAnnotation)myMatchingVisitor.getElement();
-
- myMatchingVisitor.setResult(myMatchingVisitor.match(annotation.getNameReferenceElement(), psiAnnotation.getNameReferenceElement()) &&
- myMatchingVisitor
- .matchInAnyOrder(annotation.getParameterList().getAttributes(),
- psiAnnotation.getParameterList().getAttributes()));
- }
-
- @Override
- public void visitNameValuePair(PsiNameValuePair pair) {
- final PsiIdentifier nameIdentifier = pair.getNameIdentifier();
- if (nameIdentifier == null) {
- myMatchingVisitor.setResult(true);
- return;
- }
-
- final PsiNameValuePair elementNameValuePair = (PsiNameValuePair)myMatchingVisitor.getElement();
- PsiIdentifier matchedNameValuePair = elementNameValuePair.getNameIdentifier();
-
- PsiAnnotationMemberValue annotationInitializer = pair.getValue();
- boolean isTypedInitializer = annotationInitializer != null &&
- myMatchingVisitor.getMatchContext().getPattern().isTypedVar(annotationInitializer) &&
- annotationInitializer instanceof PsiReferenceExpression;
-
- myMatchingVisitor.setResult(myMatchingVisitor.match(annotationInitializer, elementNameValuePair.getValue()) ||
- (isTypedInitializer &&
- elementNameValuePair.getValue() == null &&
- allowsAbsenceOfMatch(annotationInitializer)
- ));
- if (myMatchingVisitor.getResult()) {
- final MatchingHandler handler = myMatchingVisitor.getMatchContext().getPattern().getHandler(nameIdentifier);
-
- if (handler instanceof SubstitutionHandler) {
- myMatchingVisitor
- .setResult(((SubstitutionHandler)handler).handle(matchedNameValuePair,
- myMatchingVisitor.getMatchContext()));
- }
- else {
- myMatchingVisitor
- .setResult(myMatchingVisitor.match(nameIdentifier, matchedNameValuePair));
- }
- }
- }
-
- private boolean checkHierarchy(PsiMember element, PsiMember patternElement) {
- final MatchingHandler handler = myMatchingVisitor.getMatchContext().getPattern().getHandler(patternElement);
- if (handler instanceof SubstitutionHandler) {
- final SubstitutionHandler handler2 = (SubstitutionHandler)handler;
-
- if (!handler2.isSubtype()) {
- if (handler2.isStrictSubtype()) {
- // check if element is declared not in current class (in ancestors)
- return element.getContainingClass() != myClazz;
- }
- }
- else {
- return true;
- }
- }
-
- // check if element is declared in current class (not in ancestors)
- return element.getContainingClass() == myClazz;
- }
-
- @Override
- public void visitField(PsiField psiField) {
- if (!checkHierarchy((PsiField)myMatchingVisitor.getElement(), psiField)) {
- myMatchingVisitor.setResult(false);
- return;
- }
- super.visitField(psiField);
- }
-
- @Override
- public void visitAnonymousClass(final PsiAnonymousClass clazz) {
- final PsiAnonymousClass clazz2 = (PsiAnonymousClass)myMatchingVisitor.getElement();
- final boolean isTypedVar = myMatchingVisitor.getMatchContext().getPattern().isTypedVar(clazz.getFirstChild());
-
- myMatchingVisitor.setResult((myMatchingVisitor.match(clazz.getBaseClassReference(), clazz2.getBaseClassReference()) || isTypedVar) &&
- myMatchingVisitor.matchSons(clazz.getArgumentList(), clazz2.getArgumentList()) &&
- compareClasses(clazz, clazz2));
-
- if (myMatchingVisitor.getResult() && isTypedVar) {
- myMatchingVisitor.setResult(myMatchingVisitor.handleTypedElement(clazz.getFirstChild(), clazz2.getFirstChild()));
- }
- }
-
- @Override
- public void visitLambdaExpression(PsiLambdaExpression expression) {
- final PsiLambdaExpression expression2 = (PsiLambdaExpression)myMatchingVisitor.getElement();
- boolean result = true;
- final PsiParameterList parameterList1 = expression.getParameterList();
- if (parameterList1.getParametersCount() != 0) {
- result = myMatchingVisitor.matchSons(parameterList1, expression2.getParameterList());
- }
- final PsiElement body1 = getElementToMatch(expression.getBody());
- if (body1 != null) {
- result = myMatchingVisitor.matchSequentially(body1, getElementToMatch(expression2.getBody()));
- }
- myMatchingVisitor.setResult(result);
- }
-
- private static PsiElement getElementToMatch(PsiElement element) {
- if (element instanceof PsiCodeBlock) {
- element = PsiTreeUtil.getChildOfAnyType(element, PsiStatement.class, PsiComment.class);
- }
- if (element instanceof PsiExpressionStatement) {
- element = ((PsiExpressionStatement)element).getExpression();
- }
- if (element instanceof PsiReturnStatement) {
- element = ((PsiReturnStatement)element).getReturnValue();
- }
- return element;
- }
-
- protected boolean matchInAnyOrder(final PsiReferenceList elements, final PsiReferenceList elements2, GlobalMatchingVisitor visitor) {
- if ((elements == null && visitor.isLeftLooseMatching()) ||
- elements == elements2 // null
- ) {
- return true;
- }
-
- return visitor.matchInAnyOrder(
- elements.getReferenceElements(),
- (elements2 != null) ? elements2.getReferenceElements() : PsiElement.EMPTY_ARRAY
- );
- }
-
- private boolean compareClasses(final PsiClass clazz, final PsiClass clazz2) {
- final PsiClass saveClazz = this.myClazz;
- final MatchContext.MatchedElementsListener oldListener = myMatchingVisitor.getMatchContext().getMatchedElementsListener();
-
- this.myClazz = clazz2;
-
- final CompiledPattern pattern = myMatchingVisitor.getMatchContext().getPattern();
- assert pattern instanceof JavaCompiledPattern;
- final JavaCompiledPattern javaPattern = (JavaCompiledPattern)pattern;
-
- final String unmatchedHandlerName = clazz.getUserData(JavaCompiledPattern.ALL_CLASS_CONTENT_VAR_NAME_KEY);
- final MatchingHandler allRemainingClassContentElementHandler = unmatchedHandlerName != null ? pattern.getHandler(unmatchedHandlerName) : null;
- MatchContext.MatchedElementsListener newListener = null;
-
- assert javaPattern instanceof JavaCompiledPattern;
- if (allRemainingClassContentElementHandler != null) {
- myMatchingVisitor.getMatchContext().setMatchedElementsListener(
- newListener = new MatchContext.MatchedElementsListener() {
- private Set<PsiElement> myMatchedElements;
-
- public void matchedElements(Collection<PsiElement> matchedElements) {
- if (matchedElements == null) return;
- if (myMatchedElements == null) {
- myMatchedElements = new HashSet<PsiElement>(matchedElements);
- }
- else {
- myMatchedElements.addAll(matchedElements);
- }
- }
-
- public void commitUnmatched() {
- final SubstitutionHandler handler = (SubstitutionHandler)allRemainingClassContentElementHandler;
-
- for (PsiElement el = clazz2.getFirstChild(); el != null; el = el.getNextSibling()) {
- if (el instanceof PsiMember && (myMatchedElements == null || !myMatchedElements.contains(el))) {
- handler.handle(el, myMatchingVisitor.getMatchContext());
- }
- }
- }
- }
- );
- }
-
- boolean result = false;
- try {
- final boolean templateIsInterface = clazz.isInterface();
- if (templateIsInterface != clazz2.isInterface()) return false;
- if (templateIsInterface && clazz.isAnnotationType() && !clazz2.isAnnotationType()) return false;
- final boolean templateIsEnum = clazz.isEnum();
- if (templateIsEnum && !clazz2.isEnum()) return false;
-
- if (!matchInAnyOrder(clazz.getExtendsList(), clazz2.getExtendsList(), myMatchingVisitor)) {
- return false;
- }
-
- // check if implements is in extended classes implements
- final PsiReferenceList implementsList = clazz.getImplementsList();
- if (implementsList != null) {
- if (!matchInAnyOrder(implementsList, clazz2.getImplementsList(), myMatchingVisitor)) {
- final PsiReferenceList anotherExtendsList = clazz2.getExtendsList();
- final PsiJavaCodeReferenceElement[] referenceElements = implementsList.getReferenceElements();
-
- boolean accepted = false;
-
- if (referenceElements.length > 0 && anotherExtendsList != null) {
- final HierarchyNodeIterator iterator = new HierarchyNodeIterator(clazz2, true, true, false);
-
- accepted = myMatchingVisitor.matchInAnyOrder(new ArrayBackedNodeIterator(referenceElements), iterator);
- }
-
- if (!accepted) return false;
- }
- }
-
- final PsiField[] fields = clazz.getFields();
-
- if (fields.length > 0) {
- final PsiField[] fields2 = javaPattern.isRequestsSuperFields() ?
- clazz2.getAllFields() :
- clazz2.getFields();
-
- if (!myMatchingVisitor.matchInAnyOrder(fields, fields2)) {
- return false;
- }
- }
-
- final PsiMethod[] methods = clazz.getMethods();
-
- if (methods.length > 0) {
- final PsiMethod[] methods2 = javaPattern.isRequestsSuperMethods() ?
- clazz2.getAllMethods() :
- clazz2.getMethods();
-
- if (!myMatchingVisitor.matchInAnyOrder(methods, methods2)) {
- return false;
- }
- }
-
- final PsiClass[] nestedClasses = clazz.getInnerClasses();
-
- if (nestedClasses.length > 0) {
- final PsiClass[] nestedClasses2 = javaPattern.isRequestsSuperInners() ?
- clazz2.getAllInnerClasses() :
- clazz2.getInnerClasses();
-
- if (!myMatchingVisitor.matchInAnyOrder(nestedClasses, nestedClasses2)) {
- return false;
- }
- }
-
- final PsiClassInitializer[] initializers = clazz.getInitializers();
- if (initializers.length > 0) {
- final PsiClassInitializer[] initializers2 = clazz2.getInitializers();
-
- if (!myMatchingVisitor.matchInAnyOrder(initializers, initializers2)) {
- return false;
- }
- }
-
- result = true;
- return result;
- }
- finally {
- if (result && newListener != null) newListener.commitUnmatched();
- this.myClazz = saveClazz;
- myMatchingVisitor.getMatchContext().setMatchedElementsListener(oldListener);
- }
- }
-
- private boolean compareBody(final PsiElement el1, final PsiElement el2) {
- PsiElement compareElement1 = el1;
- PsiElement compareElement2 = el2;
-
- if (myMatchingVisitor.getMatchContext().getOptions().isLooseMatching()) {
- if (el1 instanceof PsiBlockStatement) {
- compareElement1 = ((PsiBlockStatement)el1).getCodeBlock().getFirstChild();
- }
-
- if (el2 instanceof PsiBlockStatement) {
- compareElement2 = ((PsiBlockStatement)el2).getCodeBlock().getFirstChild();
- }
- }
-
- return myMatchingVisitor.matchSequentially(compareElement1, compareElement2);
- }
-
- @Override
- public void visitArrayAccessExpression(final PsiArrayAccessExpression slice) {
- final PsiArrayAccessExpression slice2 = (PsiArrayAccessExpression)myMatchingVisitor.getElement();
-
- myMatchingVisitor.setResult(myMatchingVisitor.match(slice.getArrayExpression(), slice2.getArrayExpression()) &&
- myMatchingVisitor.match(slice.getIndexExpression(), slice2.getIndexExpression()));
- }
-
- @Override
- public void visitMethodReferenceExpression(PsiMethodReferenceExpression expression) {
- final PsiElement element = myMatchingVisitor.getElement();
- if (!(element instanceof PsiMethodReferenceExpression)) {
- myMatchingVisitor.setResult(false);
- return;
- }
- super.visitMethodReferenceExpression(expression);
- }
-
- @Override
- public void visitReferenceExpression(final PsiReferenceExpression reference) {
- final PsiExpression qualifier = reference.getQualifierExpression();
-
- final PsiElement nameElement = reference.getReferenceNameElement();
- final MatchContext context = myMatchingVisitor.getMatchContext();
- MatchingHandler _handler = nameElement != null ? context.getPattern().getHandlerSimple(nameElement) : null;
- if (!(_handler instanceof SubstitutionHandler)) _handler = context.getPattern().getHandlerSimple(reference);
-
- final PsiElement element = myMatchingVisitor.getElement();
- PsiElement other = element instanceof PsiExpression && context.getOptions().isLooseMatching() ?
- PsiUtil.skipParenthesizedExprDown((PsiExpression)element) :
- element;
- if (_handler instanceof SubstitutionHandler &&
- !(context.getPattern().getHandlerSimple(qualifier) instanceof SubstitutionHandler) &&
- !(qualifier instanceof PsiThisExpression)
- ) {
- if (other instanceof PsiReferenceExpression) {
- final PsiReferenceExpression psiReferenceExpression = (PsiReferenceExpression)other;
-
- final PsiExpression qualifier2 = psiReferenceExpression.getQualifierExpression();
- if (qualifier2 == null || (context.getOptions().isLooseMatching() && qualifier2 instanceof PsiThisExpression)) {
- other = psiReferenceExpression.getReferenceNameElement();
- }
- }
-
- final SubstitutionHandler handler = (SubstitutionHandler)_handler;
- if (handler.isSubtype() || handler.isStrictSubtype()) {
- myMatchingVisitor.setResult(checkMatchWithingHierarchy(other, handler, reference));
- }
- else {
- myMatchingVisitor.setResult(handler.handle(other, context));
- }
-
- return;
- }
-
- if (!(other instanceof PsiReferenceExpression)) {
- myMatchingVisitor.setResult(false);
- return;
- }
-
- final PsiReferenceExpression reference2 = (PsiReferenceExpression)other;
-
- // just variable
- final PsiExpression reference2Qualifier = reference2.getQualifierExpression();
- if (qualifier == null && reference2Qualifier == null) {
- myMatchingVisitor.setResult(reference.getReferenceNameElement().textMatches(reference2.getReferenceNameElement()));
- return;
- }
-
- // handle field selection
- if (!(other.getParent() instanceof PsiMethodCallExpression) && qualifier != null) {
- final PsiElement referenceElement = reference.getReferenceNameElement();
- final PsiElement referenceElement2 = reference2.getReferenceNameElement();
-
- if (context.getPattern().isTypedVar(referenceElement)) {
- myMatchingVisitor.setResult(myMatchingVisitor.handleTypedElement(referenceElement, referenceElement2));
- }
- else {
- myMatchingVisitor.setResult(
- (referenceElement2 != null && referenceElement != null && referenceElement.textMatches(referenceElement2)) ||
- referenceElement == referenceElement2);
- }
-
- if (!myMatchingVisitor.getResult()) {
- return;
- }
- if (reference2Qualifier != null) {
- myMatchingVisitor.setResult(myMatchingVisitor.match(qualifier, reference2Qualifier));
- }
- else {
- final PsiElement referencedElement = MatchUtils.getReferencedElement(other);
- if (referencedElement instanceof PsiField) {
- final PsiField field = (PsiField)referencedElement;
- if (qualifier instanceof PsiThisExpression) {
- myMatchingVisitor.setResult(!field.hasModifierProperty(PsiModifier.STATIC));
- return;
- }
- }
- final MatchingHandler handler = context.getPattern().getHandler(qualifier);
- matchImplicitQualifier(handler, referencedElement, context);
- }
-
- return;
- }
-
- myMatchingVisitor.setResult(false);
- }
-
- private static int countCStyleArrayDeclarationDims(final PsiElement type2) {
- if (type2 != null) {
- final PsiElement parentElement = type2.getParent();
-
- if (parentElement instanceof PsiVariable) {
- final PsiIdentifier psiIdentifier = ((PsiVariable)parentElement).getNameIdentifier();
- if (psiIdentifier == null) return 0;
-
- int count = 0;
- for (PsiElement sibling = psiIdentifier.getNextSibling(); sibling != null; sibling = sibling.getNextSibling()) {
- if (sibling instanceof PsiJavaToken) {
- final IElementType tokenType = ((PsiJavaToken)sibling).getTokenType();
- if (tokenType == JavaTokenType.LBRACKET) ++count;
- else if (tokenType != JavaTokenType.RBRACKET) break;
- }
- }
-
- return count;
- }
- }
- return 0;
- }
-
- private void copyResults(final MatchResultImpl ourResult) {
- if (ourResult.hasSons()) {
- for (MatchResult son : ourResult.getAllSons()) {
- myMatchingVisitor.getMatchContext().getResult().addSon((MatchResultImpl)son);
- }
- }
- }
-
- private boolean matchType(final PsiElement _type, final PsiElement _type2) {
- PsiElement el = _type;
- PsiElement el2 = _type2;
- PsiType type1 = null;
- PsiType type2 = null;
-
- // check for generics
- if (_type instanceof PsiTypeElement &&
- ((PsiTypeElement)_type).getInnermostComponentReferenceElement() != null
- ) {
- el = ((PsiTypeElement)_type).getInnermostComponentReferenceElement();
- type1 = ((PsiTypeElement)_type).getType();
- }
-
- if (_type2 instanceof PsiTypeElement &&
- ((PsiTypeElement)_type2).getInnermostComponentReferenceElement() != null
- ) {
- el2 = ((PsiTypeElement)_type2).getInnermostComponentReferenceElement();
- type2 = ((PsiTypeElement)_type2).getType();
- }
-
- PsiElement[] typeparams = null;
- if (el2 instanceof PsiJavaCodeReferenceElement) {
- typeparams = ((PsiJavaCodeReferenceElement)el2).getParameterList().getTypeParameterElements();
- if (typeparams.length > 0) {
- el2 = ((PsiJavaCodeReferenceElement)el2).getReferenceNameElement();
- }
- }
- else if (el2 instanceof PsiTypeParameter) {
- el2 = ((PsiTypeParameter)el2).getNameIdentifier();
- }
- else if (el2 instanceof PsiClass && ((PsiClass)el2).hasTypeParameters()
- ) {
- typeparams = ((PsiClass)el2).getTypeParameters();
- el2 = ((PsiClass)el2).getNameIdentifier();
- }
- else if (el2 instanceof PsiMethod && ((PsiMethod)el2).hasTypeParameters()
- ) {
- typeparams = ((PsiMethod)_type2).getTypeParameters();
- el2 = ((PsiMethod)_type2).getNameIdentifier();
- }
-
- PsiReferenceParameterList list = null;
- if (el instanceof PsiJavaCodeReferenceElement) {
- list = ((PsiJavaCodeReferenceElement)el).getParameterList();
- }
-
- if (list != null && list.getTypeParameterElements().length > 0) {
- boolean result = typeparams != null &&
- myMatchingVisitor.matchInAnyOrder(
- list.getTypeParameterElements(),
- typeparams
- );
-
- if (!result) return false;
- el = ((PsiJavaCodeReferenceElement)el).getReferenceNameElement();
- }
- else {
- if (_type2 instanceof PsiTypeElement) {
- type2 = ((PsiTypeElement)_type2).getType();
-
- if (typeparams == null || typeparams.length == 0) {
- final PsiJavaCodeReferenceElement innermostComponentReferenceElement =
- ((PsiTypeElement)_type2).getInnermostComponentReferenceElement();
- if (innermostComponentReferenceElement != null) el2 = innermostComponentReferenceElement;
- }
- else {
- el2 = _type2;
- }
- }
- }
-
- final int array2Dims = (type2 != null ? type2.getArrayDimensions() : 0) + countCStyleArrayDeclarationDims(_type2);
- final int arrayDims = (type1 != null ? type1.getArrayDimensions() : 0) + countCStyleArrayDeclarationDims(_type);
-
- if (myMatchingVisitor.getMatchContext().getPattern().isTypedVar(el)) {
- final SubstitutionHandler handler = (SubstitutionHandler)myMatchingVisitor.getMatchContext().getPattern().getHandler(el);
-
- RegExpPredicate regExpPredicate = null;
-
- if (arrayDims != 0) {
- if (arrayDims != array2Dims) {
- return false;
- }
- }
- else if (array2Dims != 0) {
- regExpPredicate = MatchingHandler.getSimpleRegExpPredicate(handler);
-
- if (regExpPredicate != null) {
- regExpPredicate.setNodeTextGenerator(new RegExpPredicate.NodeTextGenerator() {
- public String getText(PsiElement element) {
- StringBuilder builder = new StringBuilder(RegExpPredicate.getMeaningfulText(element));
- for (int i = 0; i < array2Dims; ++i) builder.append("[]");
- return builder.toString();
- }
- });
- }
- }
-
- try {
- if (handler.isSubtype() || handler.isStrictSubtype()) {
- return checkMatchWithingHierarchy(el2, handler, el);
- }
- else {
- return handler.handle(el2, myMatchingVisitor.getMatchContext());
- }
- }
- finally {
- if (regExpPredicate != null) regExpPredicate.setNodeTextGenerator(null);
- }
- }
-
- if (array2Dims != arrayDims) {
- return false;
- }
-
- if (el instanceof PsiIdentifier) {
- final PsiElement parent = el.getParent();
- if (parent instanceof PsiJavaCodeReferenceElement) {
- el = parent;
- }
- }
- if (el2 instanceof PsiIdentifier) {
- final PsiElement parent = el2.getParent();
- if (parent instanceof PsiJavaCodeReferenceElement) {
- el2 = parent;
- }
- }
- final String text = stripTypeParameters(el.getText());
- if (text.indexOf('.') == -1 || !(el2 instanceof PsiJavaReference)) {
- return MatchUtils.compareWithNoDifferenceToPackage(text, stripTypeParameters(el2.getText()));
- }
- else {
- PsiElement element2 = ((PsiJavaReference)el2).resolve();
-
- if (element2 != null) {
- return text.equals(((PsiClass)element2).getQualifiedName());
- }
- else {
- return MatchUtils.compareWithNoDifferenceToPackage(text, el2.getText());
- }
- }
- }
-
- private static String stripTypeParameters(String string) {
- final int index = string.indexOf('<');
- if (index == -1) {
- return string;
- }
- return string.substring(0, index);
- }
-
- private boolean checkMatchWithingHierarchy(PsiElement el2, SubstitutionHandler handler, PsiElement context) {
- boolean includeInterfaces = true;
- boolean includeClasses = true;
- final PsiElement contextParent = context.getParent();
-
- if (contextParent instanceof PsiReferenceList) {
- final PsiElement grandParentContext = contextParent.getParent();
-
- if (grandParentContext instanceof PsiClass) {
- final PsiClass psiClass = (PsiClass)grandParentContext;
-
- if (contextParent == psiClass.getExtendsList()) {
- includeInterfaces = psiClass.isInterface();
- }
- else if (contextParent == psiClass.getImplementsList()) {
- includeClasses = false;
- }
- }
- }
-
- // is type2 is (strict) subtype of type
- final NodeIterator node = new HierarchyNodeIterator(el2, includeClasses, includeInterfaces);
-
- if (handler.isStrictSubtype()) {
- node.advance();
- }
-
- final boolean notPredicate = handler.getPredicate() instanceof NotPredicate;
- while (node.hasNext() && !handler.validate(node.current(), 0, -1, myMatchingVisitor.getMatchContext())) {
- if (notPredicate) return false;
- node.advance();
- }
-
- if (node.hasNext()) {
- handler.addResult(el2, 0, -1, myMatchingVisitor.getMatchContext());
- return true;
- }
- else {
- return false;
- }
- }
-
- @Override
- public void visitConditionalExpression(final PsiConditionalExpression cond) {
- final PsiConditionalExpression cond2 = (PsiConditionalExpression)myMatchingVisitor.getElement();
-
- myMatchingVisitor.setResult(myMatchingVisitor.match(cond.getCondition(), cond2.getCondition()) &&
- myMatchingVisitor.matchSons(cond, cond2));
- }
-
- @Override
- public void visitPolyadicExpression(PsiPolyadicExpression expression) {
- PsiPolyadicExpression expr2 = (PsiPolyadicExpression)myMatchingVisitor.getElement();
-
- boolean result = expression.getOperationTokenType().equals(expr2.getOperationTokenType());
- if (result) {
- PsiExpression[] operands1 = expression.getOperands();
- PsiExpression[] operands2 = expr2.getOperands();
- if (operands1.length != operands2.length) {
- result = false;
- }
- else {
- for (int i = 0; i < operands1.length; i++) {
- PsiExpression e1 = operands1[i];
- PsiExpression e2 = operands2[i];
- if (!myMatchingVisitor.match(e1, e2)) {
- result = false;
- break;
- }
- }
- }
- }
-
- myMatchingVisitor.setResult(result);
- }
-
- @Override
- public void visitVariable(final PsiVariable var) {
- myMatchingVisitor.getMatchContext().pushResult();
- final PsiIdentifier nameIdentifier = var.getNameIdentifier();
-
- boolean isTypedVar = myMatchingVisitor.getMatchContext().getPattern().isTypedVar(nameIdentifier);
- boolean isTypedInitializer = var.getInitializer() != null &&
- myMatchingVisitor.getMatchContext().getPattern().isTypedVar(var.getInitializer()) &&
- var.getInitializer() instanceof PsiReferenceExpression;
- final PsiVariable var2 = (PsiVariable)myMatchingVisitor.getElement();
-
- try {
- myMatchingVisitor.setResult((var.getName().equals(var2.getName()) || isTypedVar) &&
- ((var.getParent() instanceof PsiClass && ((PsiClass)var.getParent()).isInterface()) ||
- myMatchingVisitor.match(var.getModifierList(), var2.getModifierList())));
- if (myMatchingVisitor.getResult()) {
- final PsiTypeElement typeElement1 = var.getTypeElement();
- if (typeElement1 != null) {
- PsiTypeElement typeElement2 = var2.getTypeElement();
- if (typeElement2 == null) {
- typeElement2 = JavaPsiFacade.getElementFactory(var2.getProject()).createTypeElement(var2.getType());
- }
- myMatchingVisitor.setResult(myMatchingVisitor.match(typeElement1, typeElement2));
- }
- }
-
- if (myMatchingVisitor.getResult()) {
- // Check initializer
- final PsiExpression var2Initializer = var2.getInitializer();
-
- myMatchingVisitor.setResult(myMatchingVisitor.match(var.getInitializer(), var2Initializer) ||
- (isTypedInitializer &&
- var2Initializer == null &&
- allowsAbsenceOfMatch(var.getInitializer())
- ));
- }
-
- if (myMatchingVisitor.getResult() && var instanceof PsiParameter && var.getParent() instanceof PsiCatchSection) {
- myMatchingVisitor.setResult(myMatchingVisitor.match(
- ((PsiCatchSection)var.getParent()).getCatchBlock(),
- ((PsiCatchSection)var2.getParent()).getCatchBlock()
- ));
- }
-
- if (myMatchingVisitor.getResult() && isTypedVar) {
- myMatchingVisitor.setResult(myMatchingVisitor.handleTypedElement(nameIdentifier, var2.getNameIdentifier()));
- }
- }
- finally {
- saveOrDropResult(nameIdentifier, isTypedVar, var2.getNameIdentifier());
- }
- }
-
- private void matchArrayDims(final PsiNewExpression new1, final PsiNewExpression new2) {
- final PsiExpression[] arrayDims = new1.getArrayDimensions();
- final PsiExpression[] arrayDims2 = new2.getArrayDimensions();
-
- if (arrayDims.length == arrayDims2.length && arrayDims.length != 0) {
- for (int i = 0; i < arrayDims.length; ++i) {
- myMatchingVisitor.setResult(myMatchingVisitor.match(arrayDims[i], arrayDims2[i]));
- if (!myMatchingVisitor.getResult()) return;
- }
- }
- else {
- myMatchingVisitor.setResult((arrayDims == arrayDims2) && myMatchingVisitor.matchSons(new1.getArgumentList(), new2.getArgumentList()));
- }
- }
-
- private void saveOrDropResult(final PsiIdentifier methodNameNode, final boolean typedVar, final PsiIdentifier methodNameNode2) {
- MatchResultImpl ourResult = myMatchingVisitor.getMatchContext().hasResult() ? myMatchingVisitor.getMatchContext().getResult() : null;
- myMatchingVisitor.getMatchContext().popResult();
-
- if (myMatchingVisitor.getResult()) {
- if (typedVar) {
- final SubstitutionHandler handler =
- (SubstitutionHandler)myMatchingVisitor.getMatchContext().getPattern().getHandler(methodNameNode);
- if (ourResult != null) ourResult.setScopeMatch(true);
- handler.setNestedResult(ourResult);
- myMatchingVisitor.setResult(handler.handle(methodNameNode2, myMatchingVisitor.getMatchContext()));
-
- if (handler.getNestedResult() != null) { // some constraint prevent from adding
- handler.setNestedResult(null);
- copyResults(ourResult);
- }
- }
- else if (ourResult != null) {
- copyResults(ourResult);
- }
- }
- }
-
- private void matchImplicitQualifier(MatchingHandler matchingHandler, PsiElement target, MatchContext context) {
- if (!(matchingHandler instanceof SubstitutionHandler)) {
- myMatchingVisitor.setResult(false);
- return;
- }
- final SubstitutionHandler substitutionHandler = (SubstitutionHandler)matchingHandler;
- final MatchPredicate predicate = substitutionHandler.getPredicate();
- if (substitutionHandler.getMinOccurs() != 0) {
- myMatchingVisitor.setResult(false);
- return;
- }
- if (predicate == null) {
- myMatchingVisitor.setResult(true);
- return;
- }
- if (target == null) {
- myMatchingVisitor.setResult(false);
- return;
- }
- if (target instanceof PsiModifierListOwner && ((PsiModifierListOwner)target).hasModifierProperty(PsiModifier.STATIC)) {
- myMatchingVisitor.setResult(predicate.match(null, PsiTreeUtil.getParentOfType(target, PsiClass.class), context));
- } else {
- final PsiElementFactory factory = JavaPsiFacade.getElementFactory(target.getProject());
- final PsiExpression implicitReference = factory.createExpressionFromText("this", target);
- myMatchingVisitor.setResult(predicate.match(null, implicitReference, context));
- }
- }
-
- @Override
- public void visitMethodCallExpression(final PsiMethodCallExpression mcall) {
- final PsiElement element = myMatchingVisitor.getElement();
- if (!(element instanceof PsiMethodCallExpression)) {
- myMatchingVisitor.setResult(false);
- return;
- }
- final PsiMethodCallExpression mcall2 = (PsiMethodCallExpression)element;
- final PsiReferenceExpression mcallRef1 = mcall.getMethodExpression();
- final PsiReferenceExpression mcallRef2 = mcall2.getMethodExpression();
-
- final String mcallname1 = mcallRef1.getReferenceName();
- final String mcallname2 = mcallRef2.getReferenceName();
- final boolean isTypedVar = myMatchingVisitor.getMatchContext().getPattern().isTypedVar(mcallRef1.getReferenceNameElement());
-
- if (mcallname1 != null && !mcallname1.equals(mcallname2) && !isTypedVar) {
- myMatchingVisitor.setResult(false);
- return;
- }
-
- final PsiExpression qualifier = mcallRef1.getQualifierExpression();
- final PsiExpression elementQualifier = mcallRef2.getQualifierExpression();
- if (qualifier != null) {
-
- if (elementQualifier != null) {
- myMatchingVisitor.setResult(myMatchingVisitor.match(qualifier, elementQualifier));
- if (!myMatchingVisitor.getResult()) return;
- }
- else {
- final PsiMethod method = mcall2.resolveMethod();
- if (method != null) {
- if (qualifier instanceof PsiThisExpression) {
- myMatchingVisitor.setResult(!method.hasModifierProperty(PsiModifier.STATIC));
- return;
- }
- }
- final MatchingHandler handler = myMatchingVisitor.getMatchContext().getPattern().getHandler(qualifier);
- matchImplicitQualifier(handler, method, myMatchingVisitor.getMatchContext());
- if (!myMatchingVisitor.getResult()) {
- return;
- }
- }
- }
- else if (elementQualifier != null) {
- myMatchingVisitor.setResult(false);
- return;
- }
-
- myMatchingVisitor.setResult(myMatchingVisitor.matchSons(mcall.getArgumentList(), mcall2.getArgumentList()));
-
- if (myMatchingVisitor.getResult() && isTypedVar) {
- boolean res = myMatchingVisitor.getResult();
- res &= myMatchingVisitor.handleTypedElement(mcallRef1.getReferenceNameElement(), mcallRef2.getReferenceNameElement());
- myMatchingVisitor.setResult(res);
- }
- }
-
- @Override
- public void visitExpressionStatement(final PsiExpressionStatement expr) {
- final PsiExpressionStatement expr2 = (PsiExpressionStatement)myMatchingVisitor.getElement();
-
- myMatchingVisitor.setResult(myMatchingVisitor.match(expr.getExpression(), expr2.getExpression()));
- }
-
- @Override
- public void visitLiteralExpression(final PsiLiteralExpression const1) {
- final PsiLiteralExpression const2 = (PsiLiteralExpression)myMatchingVisitor.getElement();
-
- MatchingHandler handler = (MatchingHandler)const1.getUserData(CompiledPattern.HANDLER_KEY);
-
- if (handler instanceof SubstitutionHandler) {
- int offset = 0;
- int length = const2.getTextLength();
- final String text = const2.getText();
-
- if (length > 2 && text.charAt(0) == '"' && text.charAt(length - 1) == '"') {
- length--;
- offset++;
- }
- myMatchingVisitor.setResult(((SubstitutionHandler)handler).handle(const2, offset, length, myMatchingVisitor.getMatchContext()));
- }
- else if (handler != null) {
- myMatchingVisitor.setResult(handler.match(const1, const2, myMatchingVisitor.getMatchContext()));
- }
- else {
- myMatchingVisitor.setResult(const1.textMatches(const2));
- }
- }
-
- @Override
- public void visitAssignmentExpression(final PsiAssignmentExpression assign) {
- final PsiAssignmentExpression assign2 = (PsiAssignmentExpression)myMatchingVisitor.getElement();
-
- myMatchingVisitor.setResult(assign.getOperationTokenType().equals(assign2.getOperationTokenType()) &&
- myMatchingVisitor.match(assign.getLExpression(), assign2.getLExpression()) &&
- myMatchingVisitor.match(assign.getRExpression(), assign2.getRExpression()));
- }
-
- @Override
- public void visitIfStatement(final PsiIfStatement if1) {
- final PsiIfStatement if2 = (PsiIfStatement)myMatchingVisitor.getElement();
-
- myMatchingVisitor.setResult(myMatchingVisitor.match(if1.getCondition(), if2.getCondition()) &&
- compareBody(if1.getThenBranch(), if2.getThenBranch()) &&
- compareBody(if1.getElseBranch(), if2.getElseBranch()));
- }
-
- @Override
- public void visitSwitchStatement(final PsiSwitchStatement switch1) {
- final PsiSwitchStatement switch2 = (PsiSwitchStatement)myMatchingVisitor.getElement();
-
- myMatchingVisitor.setResult(myMatchingVisitor.match(switch1.getExpression(), switch2.getExpression()) &&
- myMatchingVisitor.matchSons(switch1.getBody(), switch2.getBody()));
- }
-
- @Override
- public void visitForStatement(final PsiForStatement for1) {
- final PsiForStatement for2 = (PsiForStatement)myMatchingVisitor.getElement();
-
- final PsiStatement initialization = for1.getInitialization();
- MatchingHandler handler = myMatchingVisitor.getMatchContext().getPattern().getHandler(initialization);
-
- myMatchingVisitor.setResult(handler.match(initialization, for2.getInitialization(), myMatchingVisitor.getMatchContext()) &&
- myMatchingVisitor.match(for1.getCondition(), for2.getCondition()) &&
- myMatchingVisitor.match(for1.getUpdate(), for2.getUpdate()) &&
- compareBody(for1.getBody(), for2.getBody()));
- }
-
- @Override
- public void visitForeachStatement(PsiForeachStatement for1) {
- final PsiForeachStatement for2 = (PsiForeachStatement)myMatchingVisitor.getElement();
-
- myMatchingVisitor.setResult(myMatchingVisitor.match(for1.getIterationParameter(), for2.getIterationParameter()) &&
- myMatchingVisitor.match(for1.getIteratedValue(), for2.getIteratedValue()) &&
- compareBody(for1.getBody(), for2.getBody()));
- }
-
- @Override
- public void visitWhileStatement(final PsiWhileStatement while1) {
- final PsiWhileStatement while2 = (PsiWhileStatement)myMatchingVisitor.getElement();
-
- myMatchingVisitor.setResult(myMatchingVisitor.match(while1.getCondition(), while2.getCondition()) &&
- compareBody(while1.getBody(), while2.getBody()));
- }
-
- @Override
- public void visitBlockStatement(final PsiBlockStatement block) {
- if (myMatchingVisitor.getElement() instanceof PsiCodeBlock &&
- !(myMatchingVisitor.getElement().getParent() instanceof PsiBlockStatement)
- ) {
- myMatchingVisitor.setResult(myMatchingVisitor.matchSons(block.getCodeBlock(), myMatchingVisitor.getElement()));
- }
- else {
- final PsiBlockStatement block2 = (PsiBlockStatement)myMatchingVisitor.getElement();
- myMatchingVisitor.setResult(myMatchingVisitor.matchSons(block, block2));
- }
- }
-
- @Override
- public void visitDeclarationStatement(final PsiDeclarationStatement dcl) {
- final PsiDeclarationStatement declaration = (PsiDeclarationStatement)myMatchingVisitor.getElement();
- myMatchingVisitor.setResult(myMatchingVisitor.matchInAnyOrder(dcl.getDeclaredElements(), declaration.getDeclaredElements()));
- }
-
- @Override
- public void visitDoWhileStatement(final PsiDoWhileStatement while1) {
- final PsiDoWhileStatement while2 = (PsiDoWhileStatement)myMatchingVisitor.getElement();
-
- myMatchingVisitor.setResult(myMatchingVisitor.match(while1.getCondition(), while2.getCondition()) &&
- compareBody(while1.getBody(), while2.getBody()));
- }
-
- @Override
- public void visitReturnStatement(final PsiReturnStatement return1) {
- final PsiReturnStatement return2 = (PsiReturnStatement)myMatchingVisitor.getElement();
-
- myMatchingVisitor.setResult(myMatchingVisitor.match(return1.getReturnValue(), return2.getReturnValue()));
- }
-
- @Override
- public void visitPostfixExpression(final PsiPostfixExpression postfix) {
- final PsiPostfixExpression postfix2 = (PsiPostfixExpression)myMatchingVisitor.getElement();
-
- myMatchingVisitor.setResult(postfix.getOperationTokenType().equals(postfix2.getOperationTokenType())
- && myMatchingVisitor.match(postfix.getOperand(), postfix2.getOperand()));
- }
-
- @Override
- public void visitPrefixExpression(final PsiPrefixExpression prefix) {
- final PsiPrefixExpression prefix2 = (PsiPrefixExpression)myMatchingVisitor.getElement();
-
- myMatchingVisitor.setResult(prefix.getOperationTokenType().equals(prefix2.getOperationTokenType())
- && myMatchingVisitor.match(prefix.getOperand(), prefix2.getOperand()));
- }
-
- @Override
- public void visitAssertStatement(final PsiAssertStatement assert1) {
- final PsiAssertStatement assert2 = (PsiAssertStatement)myMatchingVisitor.getElement();
-
- myMatchingVisitor.setResult(myMatchingVisitor.match(assert1.getAssertCondition(), assert2.getAssertCondition()) &&
- myMatchingVisitor.match(assert1.getAssertDescription(), assert2.getAssertDescription()));
- }
-
- @Override
- public void visitBreakStatement(final PsiBreakStatement break1) {
- final PsiBreakStatement break2 = (PsiBreakStatement)myMatchingVisitor.getElement();
-
- myMatchingVisitor.setResult(myMatchingVisitor.match(break1.getLabelIdentifier(), break2.getLabelIdentifier()));
- }
-
- @Override
- public void visitContinueStatement(final PsiContinueStatement continue1) {
- final PsiContinueStatement continue2 = (PsiContinueStatement)myMatchingVisitor.getElement();
-
- myMatchingVisitor.setResult(myMatchingVisitor.match(continue1.getLabelIdentifier(), continue2.getLabelIdentifier()));
- }
-
- @Override
- public void visitSuperExpression(final PsiSuperExpression super1) {
- myMatchingVisitor.setResult(true);
- }
-
- @Override
- public void visitThisExpression(final PsiThisExpression this1) {
- myMatchingVisitor.setResult(myMatchingVisitor.getElement() instanceof PsiThisExpression);
- }
-
- @Override
- public void visitSynchronizedStatement(final PsiSynchronizedStatement synchronized1) {
- final PsiSynchronizedStatement synchronized2 = (PsiSynchronizedStatement)myMatchingVisitor.getElement();
-
- myMatchingVisitor.setResult(myMatchingVisitor.match(synchronized1.getLockExpression(), synchronized2.getLockExpression()) &&
- myMatchingVisitor.matchSons(synchronized1.getBody(), synchronized2.getBody()));
- }
-
- @Override
- public void visitThrowStatement(final PsiThrowStatement throw1) {
- final PsiThrowStatement throw2 = (PsiThrowStatement)myMatchingVisitor.getElement();
-
- myMatchingVisitor.setResult(myMatchingVisitor.match(throw1.getException(), throw2.getException()));
- }
-
- @Override
- public void visitParenthesizedExpression(PsiParenthesizedExpression expr) {
- if (myMatchingVisitor.getElement() instanceof PsiParenthesizedExpression) {
- myMatchingVisitor.setResult(myMatchingVisitor.matchSons(expr, myMatchingVisitor.getElement()));
- }
- else {
- myMatchingVisitor.setResult(false);
- }
- }
-
- @Override
- public void visitCatchSection(final PsiCatchSection section) {
- final PsiCatchSection section2 = (PsiCatchSection)myMatchingVisitor.getElement();
- final PsiParameter parameter = section.getParameter();
- if (parameter != null) {
- myMatchingVisitor.setResult(myMatchingVisitor.match(parameter, section2.getParameter()));
- }
- else {
- myMatchingVisitor.setResult(myMatchingVisitor.match(section.getCatchBlock(), section2.getCatchBlock()));
- }
- }
-
- @Override
- public void visitTryStatement(final PsiTryStatement try1) {
- final PsiTryStatement try2 = (PsiTryStatement)myMatchingVisitor.getElement();
-
- myMatchingVisitor.setResult(myMatchingVisitor.matchSons(try1.getTryBlock(), try2.getTryBlock()));
-
- if (!myMatchingVisitor.getResult()) return;
-
- final PsiResourceList resourceList1 = try1.getResourceList();
- final PsiCatchSection[] catches1 = try1.getCatchSections();
- final PsiCodeBlock finally1 = try1.getFinallyBlock();
-
- final PsiResourceList resourceList2 = try2.getResourceList();
- final PsiCatchSection[] catches2 = try2.getCatchSections();
- final PsiCodeBlock finally2 = try2.getFinallyBlock();
-
- final boolean looseMatching = myMatchingVisitor.getMatchContext().getOptions().isLooseMatching();
- if (!looseMatching &&
- ((catches1.length == 0 && catches2.length != 0) ||
- (finally1 == null && finally2 != null) ||
- (resourceList1 == null && resourceList2 != null))
- ) {
- myMatchingVisitor.setResult(false);
- }
- else {
- if (resourceList1 != null) {
- if (resourceList2 == null) {
- myMatchingVisitor.setResult(false);
- return;
- }
- final List<PsiResourceVariable> resourceVariables1 = resourceList1.getResourceVariables();
- final List<PsiResourceVariable> resourceVariables2 = resourceList2.getResourceVariables();
- myMatchingVisitor.setResult(myMatchingVisitor.matchInAnyOrder(
- resourceVariables1.toArray(new PsiResourceVariable[resourceVariables1.size()]),
- resourceVariables2.toArray(new PsiResourceVariable[resourceVariables2.size()])));
- if (!myMatchingVisitor.getResult()) return;
- }
-
- final List<PsiCatchSection> unmatchedCatchSections = new ArrayList<PsiCatchSection>();
-
- ContainerUtil.addAll(unmatchedCatchSections, catches2);
-
- for (int i = 0, j; i < catches1.length; ++i) {
- MatchingHandler handler = myMatchingVisitor.getMatchContext().getPattern().getHandler(catches1[i]);
- final PsiElement pinnedNode = handler.getPinnedNode(null);
-
- if (pinnedNode != null) {
- myMatchingVisitor.setResult(handler.match(catches1[i], pinnedNode, myMatchingVisitor.getMatchContext()));
- if (!myMatchingVisitor.getResult()) return;
- }
- else {
- for (j = 0; j < unmatchedCatchSections.size(); ++j) {
- if (handler.match(catches1[i], unmatchedCatchSections.get(j), myMatchingVisitor.getMatchContext())) {
- unmatchedCatchSections.remove(j);
- break;
- }
- }
-
- if (j == catches2.length) {
- myMatchingVisitor.setResult(false);
- return;
- }
- }
- }
-
- if (finally1 != null) {
- myMatchingVisitor.setResult(myMatchingVisitor.matchSons(finally1, finally2));
- }
-
- if (myMatchingVisitor.getResult() && unmatchedCatchSections.size() > 0 && !looseMatching) {
- try2.putUserData(UNMATCHED_CATCH_SECTION_CONTENT_VAR_KEY, unmatchedCatchSections);
- }
- }
- }
-
- @Override
- public void visitSwitchLabelStatement(final PsiSwitchLabelStatement case1) {
- final PsiSwitchLabelStatement case2 = (PsiSwitchLabelStatement)myMatchingVisitor.getElement();
-
- myMatchingVisitor.setResult(case1.isDefaultCase() == case2.isDefaultCase() &&
- myMatchingVisitor.match(case1.getCaseValue(), case2.getCaseValue()));
- }
-
- @Override
- public void visitInstanceOfExpression(final PsiInstanceOfExpression instanceOf) {
- final PsiInstanceOfExpression instanceOf2 = (PsiInstanceOfExpression)myMatchingVisitor.getElement();
- myMatchingVisitor.setResult(myMatchingVisitor.match(instanceOf.getOperand(), instanceOf2.getOperand()) &&
- matchType(instanceOf.getCheckType(), instanceOf2.getCheckType()));
- }
-
- @Override
- public void visitNewExpression(final PsiNewExpression new1) {
- if (myMatchingVisitor.getElement() instanceof PsiArrayInitializerExpression &&
- myMatchingVisitor.getElement().getParent() instanceof PsiVariable &&
- new1.getArrayDimensions().length == 0 &&
- new1.getArrayInitializer() != null
- ) {
- myMatchingVisitor.setResult(
- myMatchingVisitor.match(new1.getClassReference(), ((PsiVariable)myMatchingVisitor.getElement().getParent()).getTypeElement()));
- myMatchingVisitor.matchSons(new1.getArrayInitializer(), myMatchingVisitor.getElement());
- return;
- }
-
- if (!(myMatchingVisitor.getElement() instanceof PsiNewExpression)) {
- myMatchingVisitor.setResult(false);
- return;
- }
- final PsiNewExpression new2 = (PsiNewExpression)myMatchingVisitor.getElement();
-
- if (new1.getClassReference() != null) {
- if (new2.getClassReference() != null) {
- myMatchingVisitor.setResult(myMatchingVisitor.match(new1.getClassReference(), new2.getClassReference()) &&
- myMatchingVisitor.matchSons(new1.getArrayInitializer(), new2.getArrayInitializer()));
-
- if (myMatchingVisitor.getResult()) {
- // matching dims
- matchArrayDims(new1, new2);
- }
- return;
- }
- else {
- // match array of primitive by new 'T();
- final PsiKeyword newKeyword = PsiTreeUtil.getChildOfType(new2, PsiKeyword.class);
- final PsiElement element = PsiTreeUtil.getNextSiblingOfType(newKeyword, PsiWhiteSpace.class);
-
- if (element != null && element.getNextSibling() instanceof PsiKeyword) {
- ((LexicalNodesFilter)LexicalNodesFilter.getInstance()).setCareKeyWords(true);
-
- myMatchingVisitor.setResult(myMatchingVisitor.match(new1.getClassReference(), element.getNextSibling()) &&
- myMatchingVisitor.matchSons(new1.getArrayInitializer(), new2.getArrayInitializer()));
-
- ((LexicalNodesFilter)LexicalNodesFilter.getInstance()).setCareKeyWords(false);
- if (myMatchingVisitor.getResult()) {
- // matching dims
- matchArrayDims(new1, new2);
- }
-
- return;
- }
- }
- }
-
- if (new1.getClassReference() == new2.getClassReference()) {
- // probably anonymous class or array of primitive type
- ((LexicalNodesFilter)LexicalNodesFilter.getInstance()).setCareKeyWords(true);
- myMatchingVisitor.setResult(myMatchingVisitor.matchSons(new1, new2));
- ((LexicalNodesFilter)LexicalNodesFilter.getInstance()).setCareKeyWords(false);
- }
- else if (new1.getAnonymousClass() == null &&
- new1.getClassReference() != null &&
- new2.getAnonymousClass() != null) {
- // allow matching anonymous class without pattern
- myMatchingVisitor.setResult(myMatchingVisitor.match(new1.getClassReference(), new2.getAnonymousClass().getBaseClassReference()) &&
- myMatchingVisitor.matchSons(new1.getArgumentList(), new2.getArgumentList()));
- }
- else {
- myMatchingVisitor.setResult(false);
- }
- }
-
- @Override
- public void visitKeyword(PsiKeyword keyword) {
- myMatchingVisitor.setResult(keyword.textMatches(myMatchingVisitor.getElement()));
- }
-
- @Override
- public void visitTypeCastExpression(final PsiTypeCastExpression cast) {
- final PsiTypeCastExpression cast2 = (PsiTypeCastExpression)myMatchingVisitor.getElement();
-
- myMatchingVisitor.setResult(myMatchingVisitor.match(cast.getCastType(), cast2.getCastType()) &&
- myMatchingVisitor.match(cast.getOperand(), cast2.getOperand()));
- }
-
- @Override
- public void visitClassObjectAccessExpression(final PsiClassObjectAccessExpression expr) {
- final PsiClassObjectAccessExpression expr2 = (PsiClassObjectAccessExpression)myMatchingVisitor.getElement();
-
- myMatchingVisitor.setResult(myMatchingVisitor.match(expr.getOperand(), expr2.getOperand()));
- }
-
- @Override
- public void visitReferenceElement(final PsiJavaCodeReferenceElement ref) {
- myMatchingVisitor.setResult(matchType(ref, myMatchingVisitor.getElement()));
- }
-
- @Override
- public void visitTypeElement(final PsiTypeElement typeElement) {
- myMatchingVisitor.setResult(matchType(typeElement, myMatchingVisitor.getElement()));
- }
-
- @Override
- public void visitTypeParameter(PsiTypeParameter psiTypeParameter) {
- final PsiTypeParameter parameter = (PsiTypeParameter)myMatchingVisitor.getElement();
- final PsiElement[] children = psiTypeParameter.getChildren();
- final PsiElement[] children2 = parameter.getChildren();
-
- final MatchingHandler handler = myMatchingVisitor.getMatchContext().getPattern().getHandler(children[0]);
-
- if (handler instanceof SubstitutionHandler) {
- myMatchingVisitor.setResult(((SubstitutionHandler)handler).handle(children2[0], myMatchingVisitor.getMatchContext()));
- }
- else {
- myMatchingVisitor.setResult(children[0].textMatches(children2[0]));
- }
-
- if (myMatchingVisitor.getResult() && children.length > 2) {
- // constraint present
- if (children2.length == 2) {
- myMatchingVisitor.setResult(false);
- return;
- }
-
- if (!children[2].getFirstChild().textMatches(children2[2].getFirstChild())) {
- // constraint type (extends)
- myMatchingVisitor.setResult(false);
- return;
- }
- myMatchingVisitor.setResult(myMatchingVisitor.matchInAnyOrder(children[2].getChildren(), children2[2].getChildren()));
- }
- }
-
- @Override
- public void visitClass(PsiClass clazz) {
- if (clazz.hasTypeParameters()) {
- myMatchingVisitor
- .setResult(
- myMatchingVisitor.match(clazz.getTypeParameterList(), ((PsiClass)myMatchingVisitor.getElement()).getTypeParameterList()));
-
- if (!myMatchingVisitor.getResult()) return;
- }
-
- PsiClass clazz2;
-
- if (myMatchingVisitor.getElement() instanceof PsiDeclarationStatement &&
- myMatchingVisitor.getElement().getFirstChild() instanceof PsiClass
- ) {
- clazz2 = (PsiClass)myMatchingVisitor.getElement().getFirstChild();
- }
- else {
- clazz2 = (PsiClass)myMatchingVisitor.getElement();
- }
-
- final boolean isTypedVar = myMatchingVisitor.getMatchContext().getPattern().isTypedVar(clazz.getNameIdentifier());
-
- if (clazz.getModifierList().getTextLength() > 0) {
- if (!myMatchingVisitor.match(clazz.getModifierList(), clazz2.getModifierList())) {
- myMatchingVisitor.setResult(false);
- return;
- }
- }
-
- myMatchingVisitor.setResult((clazz.getName().equals(clazz2.getName()) || isTypedVar) &&
- compareClasses(clazz, clazz2));
-
- if (myMatchingVisitor.getResult() && isTypedVar) {
- PsiElement id = clazz2.getNameIdentifier();
- if (id == null) id = clazz2;
- myMatchingVisitor.setResult(myMatchingVisitor.handleTypedElement(clazz.getNameIdentifier(), id));
- }
- }
-
- @Override
- public void visitTypeParameterList(PsiTypeParameterList psiTypeParameterList) {
- myMatchingVisitor.setResult(myMatchingVisitor.matchSequentially(
- psiTypeParameterList.getFirstChild(),
- myMatchingVisitor.getElement().getFirstChild()
- ));
- }
-
- @Override
- public void visitMethod(PsiMethod method) {
- final PsiIdentifier methodNameNode = method.getNameIdentifier();
- final boolean isTypedVar = myMatchingVisitor.getMatchContext().getPattern().isTypedVar(methodNameNode);
- final PsiMethod method2 = (PsiMethod)myMatchingVisitor.getElement();
-
- myMatchingVisitor.getMatchContext().pushResult();
-
- try {
- if (method.hasTypeParameters()) {
- myMatchingVisitor.setResult(
- myMatchingVisitor.match(method.getTypeParameterList(), ((PsiMethod)myMatchingVisitor.getElement()).getTypeParameterList()));
-
- if (!myMatchingVisitor.getResult()) return;
- }
-
- if (!checkHierarchy(method2, method)) {
- myMatchingVisitor.setResult(false);
- return;
- }
-
- myMatchingVisitor.setResult((method.getName().equals(method2.getName()) || isTypedVar) &&
- myMatchingVisitor.match(method.getModifierList(), method2.getModifierList()) &&
- myMatchingVisitor.matchSons(method.getParameterList(), method2.getParameterList()) &&
- myMatchingVisitor.match(method.getReturnTypeElement(), method2.getReturnTypeElement()) &&
- matchInAnyOrder(method.getThrowsList(), method2.getThrowsList(), myMatchingVisitor) &&
- myMatchingVisitor.matchSonsOptionally(method.getBody(), method2.getBody()));
- }
- finally {
- final PsiIdentifier methodNameNode2 = method2.getNameIdentifier();
-
- saveOrDropResult(methodNameNode, isTypedVar, methodNameNode2);
- }
- }
-}
diff --git a/plugins/structuralsearch/testSource/com/intellij/structuralsearch/SSBasedInspectionTest.java b/plugins/structuralsearch/testSource/com/intellij/structuralsearch/SSBasedInspectionTest.java
deleted file mode 100644
index 7971c1009fbd..000000000000
--- a/plugins/structuralsearch/testSource/com/intellij/structuralsearch/SSBasedInspectionTest.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package com.intellij.structuralsearch;
-
-import com.intellij.codeInspection.ex.LocalInspectionToolWrapper;
-import com.intellij.openapi.application.PluginPathManager;
-import com.intellij.structuralsearch.inspection.highlightTemplate.SSBasedInspection;
-import com.intellij.structuralsearch.plugin.ui.Configuration;
-import com.intellij.structuralsearch.plugin.ui.SearchConfiguration;
-import com.intellij.testFramework.InspectionTestCase;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class SSBasedInspectionTest extends InspectionTestCase {
- private LocalInspectionToolWrapper myWrapper;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- SSBasedInspection inspection = new SSBasedInspection();
- List<Configuration> configurations = new ArrayList<Configuration>();
- SearchConfiguration configuration = new SearchConfiguration();
- MatchOptions options = new MatchOptions();
- options.setSearchPattern("int i;");
- configuration.setMatchOptions(options);
- configurations.add(configuration);
- configuration = new SearchConfiguration();
- options = new MatchOptions();
- options.setSearchPattern("f();");
- configuration.setMatchOptions(options);
- configurations.add(configuration);
- inspection.setConfigurations(configurations, myProject);
- inspection.projectOpened(getProject());
- myWrapper = new LocalInspectionToolWrapper(inspection);
- }
-
- public void testSimple() throws Exception {
- doTest();
- }
-
- private void doTest() throws Exception {
- doTest("ssBased/" + getTestName(true), myWrapper,"java 1.5");
- }
-
- protected String getTestDataPath() {
- return PluginPathManager.getPluginHomePath("structuralsearch") + "/testData";
- }
-}
diff --git a/plugins/structuralsearch/testSource/com/intellij/structuralsearch/SSRCodeInsightTest.java b/plugins/structuralsearch/testSource/com/intellij/structuralsearch/SSRCodeInsightTest.java
deleted file mode 100644
index 5031f821c581..000000000000
--- a/plugins/structuralsearch/testSource/com/intellij/structuralsearch/SSRCodeInsightTest.java
+++ /dev/null
@@ -1,75 +0,0 @@
-package com.intellij.structuralsearch;
-
-import com.intellij.openapi.application.PluginPathManager;
-import com.intellij.structuralsearch.inspection.highlightTemplate.SSBasedInspection;
-import com.intellij.structuralsearch.plugin.ui.Configuration;
-import com.intellij.structuralsearch.plugin.ui.SearchConfiguration;
-import com.intellij.testFramework.IdeaTestCase;
-import com.intellij.testFramework.UsefulTestCase;
-import com.intellij.testFramework.fixtures.*;
-import com.intellij.testFramework.fixtures.impl.LightTempDirTestFixtureImpl;
-
-import java.util.Collections;
-
-public class SSRCodeInsightTest extends UsefulTestCase {
- protected CodeInsightTestFixture myFixture;
- private SSBasedInspection myInspection;
-
- public SSRCodeInsightTest() {
- IdeaTestCase.initPlatformPrefix();
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- IdeaTestFixtureFactory factory = IdeaTestFixtureFactory.getFixtureFactory();
- TestFixtureBuilder<IdeaProjectTestFixture> fixtureBuilder = factory.createLightFixtureBuilder(new DefaultLightProjectDescriptor());
- final IdeaProjectTestFixture fixture = fixtureBuilder.getFixture();
- myFixture = IdeaTestFixtureFactory.getFixtureFactory().createCodeInsightFixture(fixture,
- new LightTempDirTestFixtureImpl(true));
- myInspection = new SSBasedInspection();
- myFixture.enableInspections(myInspection);
- myFixture.setUp();
- myFixture.setTestDataPath(getTestDataPath());
- }
-
- @Override
- protected void tearDown() throws Exception {
- myFixture.tearDown();
- myFixture = null;
- myInspection = null;
- super.tearDown();
- }
-
- public void testExpressionStatement() {
- doTest("File.createTempFile($p1$, $p2$)", "Forbid File.createTempFile");
- }
-
- public void testTwoStatementPattern() {
- doTest("$field$ = $something$;\n" +
- "if ($field$ == null) {\n" +
- " throw new $Exception$($msg$);\n" +
- "}",
- "silly null check");
- }
-
- private void doTest(final String searchPattern, final String patternName) {
- final SearchConfiguration configuration = new SearchConfiguration();
- //display name
- configuration.setName(patternName);
-
- //search pattern
- final MatchOptions options = new MatchOptions();
- options.setSearchPattern(searchPattern);
- configuration.setMatchOptions(options);
-
- myInspection.setConfigurations(Collections.<Configuration>singletonList(configuration), myFixture.getProject());
- myInspection.projectOpened(myFixture.getProject());
-
- myFixture.testHighlighting(true, false, false, getTestName(false) + ".java");
- }
-
- protected String getTestDataPath() {
- return PluginPathManager.getPluginHomePath("structuralsearch") + "/testData/ssBased";
- }
-}
diff --git a/plugins/structuralsearch/testSource/com/intellij/structuralsearch/StructuralReplaceTest.java b/plugins/structuralsearch/testSource/com/intellij/structuralsearch/StructuralReplaceTest.java
deleted file mode 100644
index d5848b611867..000000000000
--- a/plugins/structuralsearch/testSource/com/intellij/structuralsearch/StructuralReplaceTest.java
+++ /dev/null
@@ -1,2133 +0,0 @@
-package com.intellij.structuralsearch;
-
-import com.intellij.openapi.application.PluginPathManager;
-import com.intellij.psi.CommonClassNames;
-import com.intellij.testFramework.PlatformTestUtil;
-import com.intellij.util.ThrowableRunnable;
-import org.jetbrains.annotations.NotNull;
-
-import java.io.IOException;
-
-/**
- * @by Maxim.Mossienko
- */
-@SuppressWarnings({"ALL"})
-public class StructuralReplaceTest extends StructuralReplaceTestCase {
- public void testReplaceInLiterals() {
- String s1 = "String ID_SPEED = \"Speed\";";
- String s2 = "String 'name = \"'string\";";
- String s2_2 = "String 'name = \"'string:[regex( .* )]\";";
- String s3 = "VSegAttribute $name$ = new VSegAttribute(\"$string$\");";
- String expectedResult = "VSegAttribute ID_SPEED = new VSegAttribute(\"Speed\");";
-
- String actualResult = replacer.testReplace(s1,s2,s3,options);
- assertEquals(
- "Matching/replacing literals",
- expectedResult,
- actualResult
- );
-
- actualResult = replacer.testReplace(s1,s2_2,s3,options);
- assertEquals(
- "Matching/replacing literals",
- expectedResult,
- actualResult
- );
-
- String s4 = "params.put(\"BACKGROUND\", \"#7B528D\");";
- String s5 = "params.put(\"$FieldName$\", \"#$exp$\");";
- String s6 = "String $FieldName$ = \"$FieldName$\";\n" +
- "params.put($FieldName$, \"$exp$\");";
- String expectedResult2 = "String BACKGROUND = \"BACKGROUND\";\n" +
- "params.put(BACKGROUND, \"7B528D\");";
-
- actualResult = replacer.testReplace(s4,s5,s6,options);
-
- assertEquals(
- "string literal replacement 2",
- expectedResult2,
- actualResult
- );
-
- String s7 = "IconLoader.getIcon(\"/ant/property.png\");\n" +
- "IconLoader.getIcon(\"/ant/another/property.png\");\n";
- String s8 = "IconLoader.getIcon(\"/'module/'name:[regex( \\w+ )].png\");";
- String s9 = "Icons.$module$.$name$;";
- String expectedResult3 = "Icons.ant.property;\n" +
- "IconLoader.getIcon(\"/ant/another/property.png\");\n";
-
- actualResult = replacer.testReplace(s7,s8,s9,options);
-
- assertEquals(
- "string literal replacement 3",
- expectedResult3,
- actualResult
- );
-
- String s10 = "configureByFile(path + \"1.html\");\n" +
- " checkResultByFile(path + \"1_after.html\");\n" +
- " checkResultByFile(path + \"1_after2.html\");\n" +
- " checkResultByFile(path + \"1_after3.html\");";
- String s11 = "\"'a.html\"";
- String s12 = "\"$a$.\"+ext";
- String expectedResult4 = "configureByFile(path + \"1.\"+ext);\n" +
- " checkResultByFile(path + \"1_after.\"+ext);\n" +
- " checkResultByFile(path + \"1_after2.\"+ext);\n" +
- " checkResultByFile(path + \"1_after3.\"+ext);";
-
- actualResult = replacer.testReplace(s10,s11,s12,options);
- assertEquals(
- "string literal replacement 4",
- expectedResult4,
- actualResult
- );
- }
-
- public void testReplace2() {
- String s1 = "package com.www.xxx.yyy;\n" +
- "\n" +
- "import javax.swing.*;\n" +
- "\n" +
- "public class Test {\n" +
- " public static void main(String[] args) {\n" +
- " if (1==1)\n" +
- " JOptionPane.showMessageDialog(null, \"MESSAGE\");\n" +
- " }\n" +
- "}";
- String s2 = "JOptionPane.'showDialog(null, 'msg);";
- String s3 = "//FIXME provide a parent frame\n" +
- "JOptionPane.$showDialog$(null, $msg$);";
-
- String expectedResult = "package com.www.xxx.yyy;\n" +
- "\n" +
- "import javax.swing.*;\n" +
- "\n" +
- "public class Test {\n" +
- " public static void main(String[] args) {\n" +
- " if (1==1)\n" +
- " //FIXME provide a parent frame\n" +
- "JOptionPane.showMessageDialog(null, \"MESSAGE\");\n" +
- " }\n" +
- "}";
-
- actualResult = replacer.testReplace(s1,s2,s3,options);
- assertEquals(
- "adding comment to statement inside the if body",
- expectedResult,
- actualResult
- );
-
- String s4 = "myButton.setText(\"Ok\");";
- String s5 = "'Instance.'MethodCall:[regex( setText )]('Parameter*:[regex( \"Ok\" )]);";
- String s6 = "$Instance$.$MethodCall$(\"OK\");";
-
- String expectedResult2 = "myButton.setText(\"OK\");";
-
- actualResult = replacer.testReplace(s4,s5,s6,options);
- assertEquals(
- "adding comment to statement inside the if body",
- expectedResult2,
- actualResult
- );
- }
-
- public void testReplace() {
- String str = "// searching for several constructions\n" +
- " lastTest = \"several constructions match\";\n" +
- " matches = testMatcher.findMatches(s5,s4, options);\n" +
- " if (matches==null || matches.size()!=3) return false;\n" +
- "\n" +
- " // searching for several constructions\n" +
- " lastTest = \"several constructions 2\";\n" +
- " matches = testMatcher.findMatches(s5,s6, options);\n" +
- " if (matches.size()!=0) return false;\n" +
- "\n" +
- " //options.setLooseMatching(true);\n" +
- " // searching for several constructions\n" +
- " lastTest = \"several constructions 3\";\n" +
- " matches = testMatcher.findMatches(s7,s8, options);\n" +
- " if (matches.size()!=2) return false;";
-
- String str2=" lastTest = 'Descr;\n" +
- " matches = testMatcher.findMatches('In,'Pattern, options);\n" +
- " if (matches.size()!='Number) return false;";
- String str3 = "assertEquals($Descr$,testMatcher.findMatches($In$,$Pattern$, options).size(),$Number$);";
- String expectedResult1 = "// searching for several constructions\n" +
- " lastTest = \"several constructions match\";\n" +
- " matches = testMatcher.findMatches(s5, s4, options);\n" +
- " if (matches == null || matches.size() != 3) return false;\n" +
- "\n" +
- " // searching for several constructions\n" +
- " assertEquals(\"several constructions 2\", testMatcher.findMatches(s5, s6, options).size(), 0);\n" +
- "\n" +
- " //options.setLooseMatching(true);\n" +
- " // searching for several constructions\n" +
- " assertEquals(\"several constructions 3\", testMatcher.findMatches(s7, s8, options).size(), 2);";
-
- String str4 = "";
-
- options.setToReformatAccordingToStyle(true);
- actualResult = replacer.testReplace(str,str2,str3,options);
- options.setToReformatAccordingToStyle(false);
- assertEquals("Basic replacement with formatter",expectedResult1,actualResult);
-
- actualResult = replacer.testReplace(str,str2,str4,options);
- String expectedResult2 = "// searching for several constructions\n" +
- " lastTest = \"several constructions match\";\n" +
- " matches = testMatcher.findMatches(s5,s4, options);\n" +
- " if (matches==null || matches.size()!=3) return false;\n" +
- "\n" +
- " // searching for several constructions\n" +
- "\n" +
- " //options.setLooseMatching(true);\n" +
- " // searching for several constructions";
-
- assertEquals("Empty replacement",expectedResult2,actualResult);
-
- String str5 = "testMatcher.findMatches('In,'Pattern, options).size()";
- String str6 = "findMatchesCount($In$,$Pattern$)";
- String expectedResult3="// searching for several constructions\n" +
- " lastTest = \"several constructions match\";\n" +
- " matches = testMatcher.findMatches(s5, s4, options);\n" +
- " if (matches == null || matches.size() != 3) return false;\n" +
- "\n" +
- " // searching for several constructions\n" +
- " assertEquals(\"several constructions 2\", findMatchesCount(s5,s6), 0);\n" +
- "\n" +
- " //options.setLooseMatching(true);\n" +
- " // searching for several constructions\n" +
- " assertEquals(\"several constructions 3\", findMatchesCount(s7,s8), 2);";
- actualResult = replacer.testReplace(expectedResult1,str5,str6,options);
-
- assertEquals( "Expression replacement", expectedResult3,actualResult );
-
- String str7 = "try { a.doSomething(); b.doSomething(); } catch(IOException ex) { ex.printStackTrace(); throw new RuntimeException(ex); }";
- String str8 = "try { 'Statements+; } catch('_ '_) { 'HandlerStatements+; }";
- String str9 = "$Statements$;";
- String expectedResult4 = "a.doSomething(); b.doSomething();";
-
- actualResult = replacer.testReplace(str7,str8,str9,options);
- assertEquals( "Multi line match in replacement", expectedResult4,actualResult );
-
- String str10 = " parentNode.insert(compositeNode, i);\n" +
- " if (asyncMode) {\n" +
- " myTreeModel.nodesWereInserted(parentNode,new int[] {i} );\n" +
- " }";
- String str11 = " 'parentNode.insert('newNode, 'i);\n" +
- " if (asyncMode) {\n" +
- " myTreeModel.nodesWereInserted('parentNode,new int[] {'i} );\n" +
- " }";
- String str12 = "addChild($parentNode$,$newNode$, $i$);";
- String expectedResult5 = " addChild(parentNode,compositeNode, i);";
-
- actualResult = replacer.testReplace(str10,str11,str12,options);
- assertEquals( "Array initializer replacement", expectedResult5,actualResult);
-
- String str13 = " aaa(5,6,3,4,1,2);";
- String str14 = "aaa('t{2,2},3,4,'q{2,2});";
- String str15 = "aaa($q$,3,4,$t$);";
- String expectedResult6 = " aaa(1,2,3,4,5,6);";
-
- actualResult = replacer.testReplace(str13,str14,str15,options);
- assertEquals("Parameter multiple match",expectedResult6,actualResult);
-
- String str16 = " int c = a();";
- String str17 = "'t:a ('q*,'p*)";
- String str18 = "$t$($q$,1,$p$)";
- String expectedResult7 = " int c = a(1);";
-
- actualResult = replacer.testReplace(str16,str17,str18,options);
- assertEquals("Replacement of init in definition + empty substitution",expectedResult7,actualResult);
-
- String str19 = " aaa(bbb);";
- String str20 = "'t('_);";
- String str21 = "$t$(ccc);";
- String expectedResult8 = " aaa(ccc);";
-
- actualResult = replacer.testReplace(str19,str20,str21,options);
- assertEquals("One substition replacement",expectedResult8,actualResult);
-
- String str22 = " instance.setAAA(anotherInstance.getBBB());";
- String str23 = " 'i.'m:set(.+) ('a.'m2:get(.+) ());";
- String str24 = " $a$.set$m2_1$( $i$.get$m_1$() );";
- String expectedResult9 = " anotherInstance.setBBB( instance.getAAA() );";
-
- actualResult = replacer.testReplace(str22,str23,str24,options);
- assertEquals("Reg exp substitution replacement",expectedResult9,actualResult);
-
- String str25 = " LaterInvocator.invokeLater(new Runnable() {\n" +
- " public void run() {\n" +
- " LOG.info(\"refreshFilesAsync, modalityState=\" + ModalityState.current());\n" +
- " myHandler.getFiles().refreshFilesAsync(new Runnable() {\n" +
- " public void run() {\n" +
- " semaphore.up();\n" +
- " }\n" +
- " });\n" +
- " }\n" +
- " });";
- String str26 = " LaterInvocator.invokeLater('Params{1,10});";
- String str27 = " com.intellij.openapi.application.ApplicationManager.getApplication().invokeLater($Params$);";
- String expectedResult10 = " com.intellij.openapi.application.ApplicationManager.getApplication().invokeLater(new Runnable() {\n" +
- " public void run() {\n" +
- " LOG.info(\"refreshFilesAsync, modalityState=\" + ModalityState.current());\n" +
- " myHandler.getFiles().refreshFilesAsync(new Runnable() {\n" +
- " public void run() {\n" +
- " semaphore.up();\n" +
- " }\n" +
- " });\n" +
- " }\n" +
- " });";
-
- actualResult = replacer.testReplace(str25,str26,str27,options);
- assertEquals("Anonymous in parameter",expectedResult10,actualResult);
-
- String str28 = "UTElementNode elementNode = new UTElementNode(myProject, processedElement, psiFile,\n" +
- " processedElement.getTextOffset(), true,\n" +
- " !myUsageViewDescriptor.toMarkInvalidOrReadonlyUsages(), null);";
- String str29 = "new UTElementNode('param, 'directory, 'null, '0, 'true, !'descr.toMarkInvalidOrReadonlyUsages(),\n" +
- " 'referencesWord)";
- String str30 = "new UTElementNode($param$, $directory$, $null$, $0$, $true$, true,\n" +
- " $referencesWord$)";
-
- String expectedResult11 = "UTElementNode elementNode = new UTElementNode(myProject, processedElement, psiFile, processedElement.getTextOffset(), true, true,\n" +
- " null);";
- actualResult = replacer.testReplace(str28,str29,str30,options);
- assertEquals("Replace in def initializer",expectedResult11,actualResult);
-
- String s31 = "a = b; b = c; a=a; c=c;";
- String s32 = "'a = 'a;";
- String s33 = "1 = 1;";
- String expectedResult12 = "a = b; b = c; 1 = 1; 1 = 1;";
-
- actualResult = replacer.testReplace(s31,s32,s33,options);
- assertEquals(
- "replace silly assignments",
- expectedResult12,
- actualResult
- );
-
- String s34 = "ParamChecker.isTrue(1==1, \"!!!\");";
- String s35 = "ParamChecker.isTrue('expr, 'msg)";
- String s36 = "assert $expr$ : $msg$";
-
- String expectedResult13 = "assert 1==1 : \"!!!\";";
- actualResult = replacer.testReplace(s34,s35,s36,options);
- assertEquals(
- "replace with assert",
- expectedResult13,
- actualResult
- );
-
- String s37 = "try { \n" +
- " ParamChecker.isTrue(1==1, \"!!!\");\n \n" +
- " // comment we want to leave\n \n" +
- " ParamChecker.isTrue(2==2, \"!!!\");\n" +
- "} catch(Exception ex) {}";
- String s38 = "try {\n" +
- " 'Statement{0,100};\n" +
- "} catch(Exception ex) {}";
- String s39 = "$Statement$;";
-
- String expectedResult14 = "ParamChecker.isTrue(1==1, \"!!!\");\n \n" +
- " // comment we want to leave\n \n" +
- " ParamChecker.isTrue(2==2, \"!!!\");";
- actualResult = replacer.testReplace(s37,s38,s39,options);
- assertEquals(
- "remove try with comments inside",
- expectedResult14,
- actualResult
- );
-
- String s40 = "ParamChecker.instanceOf(queryKey, GroupBySqlTypePolicy.GroupKey.class);";
- String s41 = "ParamChecker.instanceOf('obj, 'class.class);";
- String s42 = "assert $obj$ instanceof $class$ : \"$obj$ is an instance of \" + $obj$.getClass() + \"; expected \" + $class$.class;";
- String expectedResult15 = "assert queryKey instanceof GroupBySqlTypePolicy.GroupKey : \"queryKey is an instance of \" + queryKey.getClass() + \"; expected \" + GroupBySqlTypePolicy.GroupKey.class;";
-
- actualResult = replacer.testReplace(s40,s41,s42,options);
- assertEquals(
- "Matching/replacing .class literals",
- expectedResult15,
- actualResult
- );
-
- String s43 = "class Wpd {\n" +
- " static final String TAG_BEAN_VALUE = \"\";\n" +
- "}\n" +
- "XmlTag beanTag = rootTag.findSubTag(Wpd.TAG_BEAN_VALUE);";
- String s44 = "'Instance?.findSubTag( 'Parameter:[exprtype( *String ) ])";
- String s45 = "jetbrains.fabrique.util.XmlApiUtil.findSubTag($Instance$, $Parameter$)";
- String expectedResult16 = "class Wpd {\n" +
- " static final String TAG_BEAN_VALUE = \"\";\n" +
- "}\n" +
- "XmlTag beanTag = jetbrains.fabrique.util.XmlApiUtil.findSubTag(rootTag, Wpd.TAG_BEAN_VALUE);";
-
- actualResult = replacer.testReplace(s43,s44,s45,options);
- assertEquals(
- "Matching/replacing static fields",
- expectedResult16,
- actualResult
- );
-
- String s46 = "Rectangle2D rec = new Rectangle2D.Double(\n" +
- " drec.getX(),\n" +
- " drec.getY(),\n" +
- " drec.getWidth(),\n" +
- " drec.getWidth());";
- String s47 = "$Instance$.$MethodCall$()";
- String s48 = "OtherClass.round($Instance$.$MethodCall$(),5)";
- String expectedResult17 = "Rectangle2D rec = new Rectangle2D.Double(\n" +
- " OtherClass.round(drec.getX(),5),\n" +
- " OtherClass.round(drec.getY(),5),\n" +
- " OtherClass.round(drec.getWidth(),5),\n" +
- " OtherClass.round(drec.getWidth(),5));";
- actualResult = replacer.testReplace(s46,s47,s48,options);
-
- assertEquals(
- "Replace in constructor",
- expectedResult17,
- actualResult
- );
-
- String s49 = "class A {}\n" +
- "class B extends A {}\n" +
- "A a = new B();";
- String s50 = "A 'b = new 'B:*A ();";
- String s51 = "A $b$ = new $B$(\"$b$\");";
- String expectedResult18 = "class A {}\n" +
- "class B extends A {}\n" +
- "A a = new B(\"a\");";
-
- actualResult = replacer.testReplace(s49,s50,s51,options);
-
- assertEquals(
- "Class navigation",
- expectedResult18,
- actualResult
- );
-
- String s52 = "try {\n" +
- " aaa();\n" +
- "} finally {\n" +
- " System.out.println();" +
- "}\n" +
- "try {\n" +
- " aaa2();\n" +
- "} catch(Exception ex) {\n" +
- " aaa3();\n" +
- "}\n" +
- "finally {\n" +
- " System.out.println();\n" +
- "}\n" +
- "try {\n" +
- " aaa4();\n" +
- "} catch(Exception ex) {\n" +
- " aaa5();\n" +
- "}\n";
- String s53 = "try { 'a; } finally {\n" +
- " 'b;" +
- "}";
- String s54 = "$a$;";
- String expectedResult19 = "aaa();\n" +
- "try {\n" +
- " aaa2();\n" +
- "} catch(Exception ex) {\n" +
- " aaa3();\n" +
- "}\n" +
- "finally {\n" +
- " System.out.println();\n" +
- "}\n" +
- "try {\n" +
- " aaa4();\n" +
- "} catch(Exception ex) {\n" +
- " aaa5();\n" +
- "}\n";
-
- actualResult = replacer.testReplace(s52,s53,s54,options);
-
- assertEquals(
- "Try/ catch/ finally is replace with try/finally",
- expectedResult19,
- actualResult
- );
-
- String s55 = "for(Iterator<String> iterator = stringlist.iterator(); iterator.hasNext();) {\n" +
- " String str = iterator.next();\n" +
- " System.out.println( str );\n" +
- "}";
- String s56 = "for (Iterator<$Type$> $variable$ = $container$.iterator(); $variable$.hasNext();) {\n" +
- " $Type$ $var$ = $variable$.next();\n" +
- " $Statements$;\n" +
- "}";
- String s57 = "for($Type$ $var$:$container$) {\n" +
- " $Statements$;\n" +
- "}";
- String expectedResult20 = "for(String str :stringlist) {\n" +
- " System.out.println( str );\n" +
- "}";
-
- actualResult = replacer.testReplace(s55,s56,s57,options);
-
- assertEquals(
- "for with foreach",
- expectedResult20,
- actualResult
- );
-
- String s58 = "class A {\n" +
- " static Set<String> b_MAP = new HashSet<String>();\n" +
- " int c;\n" +
- "}";
- String s59 = "'a:[ regex( (.*)_MAP ) ]";
- String s60 = "$a_1$_SET";
- String expectedResult21 = "class A {\n" +
- " static Set<String> b_SET = new HashSet<String>();\n" +
- " int c;\n" +
- "}";
-
- actualResult = replacer.testReplace(s58,s59,s60,options);
-
- assertEquals(
- "replace symbol in definition",
- expectedResult21,
- actualResult
- );
-
- String s64 = "int x = 42;\n" +
- "int y = 42; // Stuff";
- String s65 = "'Type 'Variable = 'Value; // 'Comment";
- String s66 = "/**\n" +
- " *$Comment$\n" +
- " */\n" +
- "$Type$ $Variable$ = $Value$;";
- String expectedResult23 = "int x = 42;\n" +
- "/**\n" +
- " * Stuff\n" +
- " */\n" +
- "int y = 42;";
-
- actualResult = replacer.testReplace(s64,s65,s66,options);
-
- assertEquals(
- "Replacement of the comment with javadoc",
- expectedResult23,
- actualResult
- );
-
- String s61 = "try { 1=1; } catch(Exception e) { 1=1; } catch(Throwable t) { 2=2; }";
- String s62 = "try { 'a; } catch(Exception e) { 'b; }";
- String s63 = "try { $a$; } catch(Exception1 e) { $b$; } catch(Exception2 e) { $b$; }";
- String expectedResult22 = "try { 1=1; } catch(Exception1 e) { 1=1; } catch(Exception2 e) { 1=1; } catch (Throwable t) { 2=2; }";
-
- actualResult = replacer.testReplace(s61,s62,s63,options);
-
- assertEquals(
- "try replacement by another try will leave the unmatched catch",
- expectedResult22,
- actualResult
- );
-
- }
-
- public void testReplaceExpr() {
- String s1 = "new SimpleDateFormat(\"yyyyMMddHHmmss\")";
- String s2 = "'expr";
- String s3 = "new AtomicReference<DateFormat>($expr$)";
- String expectedResult = "new AtomicReference<DateFormat>(new SimpleDateFormat(\"yyyyMMddHHmmss\"))";
-
- actualResult = replacer.testReplace(s1, s2, s3, options);
-
- assertEquals("Replacement of top-level expression only", expectedResult, actualResult);
-
- String s4 = "get(\"smth\")";
- String s5 = "'expr";
- String s6 = "new Integer($expr$)";
- String expectedResult1 = "new Integer(get(\"smth\"))";
-
- actualResult = replacer.testReplace(s4, s5, s6, options);
- assertEquals("Replacement of top-level expression only", expectedResult1, actualResult);
- }
-
- public void testReplaceParameter() {
- String s1 = "class A { void b(int c, int d, int e) {} }";
- String s2 = "int d";
- String s3 = "int d2";
- String expectedResult = "class A { void b(int c, int d2, int e) {} }";
-
- actualResult = replacer.testReplace(s1,s2,s3,options);
-
- assertEquals(
- "replace method parameter",
- expectedResult,
- actualResult
- );
- }
-
- public void testReplaceWithComments() {
- String s1 = "map.put(key, value); // line 1";
- String s2 = "map.put(key, value); // line 1";
- String s3 = "map.put(key, value); // line 1";
- String expectedResult = "map.put(key, value); // line 1";
-
- actualResult = replacer.testReplace(s1,s2,s3,options);
-
- assertEquals(
- "replace self with comment after",
- expectedResult,
- actualResult
- );
-
- String s4 = "if (true) System.out.println(\"1111\"); else System.out.println(\"2222\");\n" +
- "while(true) System.out.println(\"1111\");";
- String s5 = "System.out.println('Test);";
- String s6 = "/* System.out.println($Test$); */";
- actualResult = replacer.testReplace(s4,s5,s6,options);
- String expectedResult2 = "if (true) /* System.out.println(\"1111\"); */; else /* System.out.println(\"2222\"); */;\n" +
- "while(true) /* System.out.println(\"1111\"); */;";
-
- assertEquals(
- "replace with comment",
- expectedResult2,
- actualResult
- );
- }
-
- public void testSeveralStatements() {
- String s1 = "{\n" +
- " System.out.println(1);\n" +
- " System.out.println(2);\n" +
- " System.out.println(3);\n" +
- " }\n" +
- "{\n" +
- " System.out.println(1);\n" +
- " System.out.println(2);\n" +
- " System.out.println(3);\n" +
- " }\n" +
- "{\n" +
- " System.out.println(1);\n" +
- " System.out.println(2);\n" +
- " System.out.println(3);\n" +
- " }";
- String s2 =
- " System.out.println(1);\n" +
- " System.out.println(2);\n" +
- " System.out.println(3);\n";
- String s3 = " System.out.println(3);\n" +
- " System.out.println(2);\n" +
- " System.out.println(1);\n";
- String expectedResult1 = " {\n" +
- " System.out.println(3);\n" +
- " System.out.println(2);\n" +
- " System.out.println(1);\n" +
- " }\n" +
- " {\n" +
- " System.out.println(3);\n" +
- " System.out.println(2);\n" +
- " System.out.println(1);\n" +
- " }\n" +
- " {\n" +
- " System.out.println(3);\n" +
- " System.out.println(2);\n" +
- " System.out.println(1);\n" +
- " }";
- options.setToReformatAccordingToStyle(true);
- actualResult = replacer.testReplace(s1,s2,s3,options);
- options.setToReformatAccordingToStyle(false);
- assertEquals(
- "three statements replacement",
- expectedResult1,
- actualResult
- );
-
- String s4 = "ProgressManager.getInstance().startNonCancelableAction();\n" +
- " try {\n" +
- " read(id, READ_PARENT);\n" +
- " return myViewport.parent;\n" +
- " }\n" +
- " finally {\n" +
- " ProgressManager.getInstance().finishNonCancelableAction();\n" +
- " }";
- String s5 = "ProgressManager.getInstance().startNonCancelableAction();\n" +
- " try {\n" +
- " '_statement{2,2};\n" +
- " }\n" +
- " finally {\n" +
- " ProgressManager.getInstance().finishNonCancelableAction();\n" +
- " }";
- String s6 = "$statement$;";
- String expectedResult2 = "read(id, READ_PARENT);\n" +
- " return myViewport.parent;";
- actualResult = replacer.testReplace(s4,s5,s6,options);
- assertEquals(
- "extra ;",
- expectedResult2,
- actualResult
- );
-
- String s7 = "public class A {\n" +
- " void f() {\n" +
- " new Runnable() {\n" +
- " public void run() {\n" +
- " l();\n" +
- " }\n" +
- "\n" +
- " private void l() {\n" +
- " int i = 9;\n" +
- " int j = 9;\n" +
- " }\n" +
- " };\n" +
- " new Runnable() {\n" +
- " public void run() {\n" +
- " l();\n" +
- " }\n" +
- "\n" +
- " private void l() {\n" +
- " l();\n" +
- " l();\n" +
- " }\n" +
- " };\n" +
- " }\n" +
- "\n" +
- "}";
- String s8 = "new Runnable() {\n" +
- " public void run() {\n" +
- " 'l ();\n" +
- " }\n" +
- " private void 'l () {\n" +
- " 'st{2,2};\n" +
- " }\n" +
- "};";
- String s9 = "new My() {\n" +
- " public void f() {\n" +
- " $st$;\n" +
- " }\n" +
- "};";
-
- String expectedResult3 = "public class A {\n" +
- " void f() {\n" +
- " new My() {\n" +
- " public void f() {\n" +
- " int i = 9;\n" +
- " int j = 9;\n" +
- " }\n" +
- " };\n" +
- " new My() {\n" +
- " public void f() {\n" +
- " l();\n" +
- " l();\n" +
- " }\n" +
- " };\n" +
- " }\n" +
- "\n" +
- "}";
- boolean formatAccordingToStyle = options.isToReformatAccordingToStyle();
- options.setToReformatAccordingToStyle(true);
- actualResult = replacer.testReplace(s7,s8,s9,options);
- assertEquals(
- "extra ; 2",
- expectedResult3,
- actualResult
- );
-
- String s10 = "public class A {\n" +
- " void f() {\n" +
- " new Runnable() {\n" +
- " public void run() {\n" +
- " l();\n" +
- " l();\n" +
- " }\n" +
- " public void run2() {\n" +
- " l();\n" +
- " l();\n" +
- " }\n" +
- "\n" +
- " };\n" +
- " new Runnable() {\n" +
- " public void run() {\n" +
- " l();\n" +
- " l();\n" +
- " }\n" +
- " public void run2() {\n" +
- " l();\n" +
- " l();\n" +
- " }\n" +
- "\n" +
- " };\n" +
- "new Runnable() {\n" +
- " public void run() {\n" +
- " l();\n" +
- " l();\n" +
- " }\n" +
- " public void run2() {\n" +
- " l2();\n" +
- " l2();\n" +
- " }\n" +
- "\n" +
- " };\n" +
- " }\n" +
- "\n" +
- " private void l() {\n" +
- " int i = 9;\n" +
- " int j = 9;\n" +
- " }\n" +
- "}\n" +
- "\n" +
- "abstract class My {\n" +
- " abstract void f();\n" +
- "}";
- String s11 = "new Runnable() {\n" +
- " public void run() {\n" +
- " 'l{2,2};\n" +
- " }\n" +
- " public void run2() {\n" +
- " 'l{2,2};\n" +
- " }\n" +
- "\n" +
- " };";
- String s12 = "new My() {\n" +
- " public void f() {\n" +
- " $l$;\n" +
- " }\n" +
- " };";
- String expectedResult4 = "public class A {\n" +
- " void f() {\n" +
- " new My() {\n" +
- " public void f() {\n" +
- " l();\n" +
- " l();\n" +
- " }\n" +
- " };\n" +
- " new My() {\n" +
- " public void f() {\n" +
- " l();\n" +
- " l();\n" +
- " }\n" +
- " };\n" +
- " new Runnable() {\n" +
- " public void run() {\n" +
- " l();\n" +
- " l();\n" +
- " }\n" +
- "\n" +
- " public void run2() {\n" +
- " l2();\n" +
- " l2();\n" +
- " }\n" +
- "\n" +
- " };\n" +
- " }\n" +
- "\n" +
- " private void l() {\n" +
- " int i = 9;\n" +
- " int j = 9;\n" +
- " }\n" +
- "}\n" +
- "\n" +
- "abstract class My {\n" +
- " abstract void f();\n" +
- "}";
-
- actualResult = replacer.testReplace(s10,s11,s12,options);
- assertEquals(
- "same multiple occurences 2 times",
- expectedResult4,
- actualResult
- );
-
- options.setToReformatAccordingToStyle(formatAccordingToStyle);
-
- String s13 = " PsiLock.LOCK.acquire();\n" +
- " try {\n" +
- " return value;\n" +
- " }\n" +
- " finally {\n" +
- " PsiLock.LOCK.release();\n" +
- " }";
- String s13_2 = " PsiLock.LOCK.acquire();\n" +
- " try {\n" +
- " if (true) { return value; }\n" +
- " }\n" +
- " finally {\n" +
- " PsiLock.LOCK.release();\n" +
- " }";
- String s13_3 = " PsiLock.LOCK.acquire();\n" +
- " try {\n" +
- " if (true) { return value; }\n\n" +
- " if (true) { return value; }\n" +
- " }\n" +
- " finally {\n" +
- " PsiLock.LOCK.release();\n" +
- " }";
- String s14 = " PsiLock.LOCK.acquire();\n" +
- " try {\n" +
- " 'T{1,1000};\n" +
- " }\n" +
- " finally {\n" +
- " PsiLock.LOCK.release();\n" +
- " }";
- String s15 = "synchronized(PsiLock.LOCK) {\n" +
- " $T$;\n" +
- "}";
-
- String expectedResult5 = " synchronized (PsiLock.LOCK) {\n" +
- " return value;\n" +
- " }";
- options.setToReformatAccordingToStyle(true);
- actualResult = replacer.testReplace(s13,s14,s15,options);
- options.setToReformatAccordingToStyle(false);
-
- assertEquals(
- "extra ; over return",
- expectedResult5,
- actualResult
- );
-
- String expectedResult6 = " synchronized (PsiLock.LOCK) {\n" +
- " if (true) {\n" +
- " return value;\n" +
- " }\n" +
- " }";
- options.setToReformatAccordingToStyle(true);
- actualResult = replacer.testReplace(s13_2,s14,s15,options);
- options.setToReformatAccordingToStyle(false);
-
- assertEquals(
- "extra ; over if",
- expectedResult6,
- actualResult
- );
-
- String expectedResult7 = " synchronized (PsiLock.LOCK) {\n" +
- " if (true) {\n" +
- " return value;\n" +
- " }\n" +
- "\n" +
- " if (true) {\n" +
- " return value;\n" +
- " }\n" +
- " }";
- options.setToReformatAccordingToStyle(true);
- actualResult = replacer.testReplace(s13_3,s14,s15,options);
- options.setToReformatAccordingToStyle(false);
- assertEquals(
- "newlines in matches of several lines",
- expectedResult7,
- actualResult
- );
-
- String s16 = "public class SSTest {\n" +
- " Object lock;\n" +
- " public Object getProducts (String[] productNames) {\n" +
- " synchronized (lock) {\n" +
- " Object o = new Object ();\n" +
- " assert o != null;\n" +
- " return o;\n" +
- " }\n" +
- " }\n" +
- "}";
- String s16_2 = "public class SSTest {\n" +
- " Object lock;\n" +
- " public void getProducts (String[] productNames) {\n" +
- " synchronized (lock) {\n" +
- " boolean[] v = {true};\n" +
- " }\n" +
- " }\n" +
- "}";
-
- String s17 = "synchronized(lock) {\n" +
- " 'Statement*;\n" +
- "}";
-
- String s18 = "$Statement$;";
- String expectedResult8 = "public class SSTest {\n" +
- " Object lock;\n" +
- " public Object getProducts (String[] productNames) {\n" +
- " Object o = new Object ();\n" +
- " assert o != null;\n" +
- " return o;\n" +
- " }\n" +
- "}";
- String expectedResult8_2 = "public class SSTest {\n" +
- " Object lock;\n" +
- " public void getProducts (String[] productNames) {\n" +
- " boolean[] v = {true};\n" +
- " }\n" +
- "}";
-
- actualResult = replacer.testReplace(s16,s17,s18,options);
- assertEquals(
- "extra ;",
- expectedResult8,
- actualResult
- );
-
- actualResult = replacer.testReplace(s16_2,s17,s18,options);
- assertEquals(
- "missed ;",
- expectedResult8_2,
- actualResult
- );
- }
-
- public void testClassReplacement() {
- boolean formatAccordingToStyle = options.isToReformatAccordingToStyle();
- options.setToReformatAccordingToStyle(true);
-
- String s1 = "class A { public void b() {} }";
- String s2 = "class 'a { 'Other* }";
- String s3 = "class $a$New { Logger LOG; $Other$ }";
- String expectedResult = " class ANew {\n" +
- " Logger LOG;\n\n" +
- " public void b() {\n" +
- " }\n" +
- " }";
- String actualResult;
- actualResult = replacer.testReplace(s1,s2,s3,options);
- assertEquals(
- "Basic class replacement",
- expectedResult,
- actualResult
- );
-
- String s4 = "class A { class C {} public void b() {} int f; }";
- String s5 = "class 'a { 'Other* }";
- String s6 = "class $a$ { Logger LOG; $Other$ }";
- String expectedResult2 = " class A {\n" +
- " Logger LOG;\n\n" +
- " class C {\n" +
- " }\n\n" +
- " public void b() {\n" +
- " }\n\n" +
- " int f;\n" +
- " }";
-
- actualResult = replacer.testReplace(s4,s5,s6,options);
- assertEquals(
- "Order of members in class replacement",
- expectedResult2,
- actualResult
- );
-
- String s7 = "class A extends B { int c; void b() {} { a = 1; } }";
- String s8 = "class 'A extends B { 'Other* }";
- String s9 = "class $A$ extends B2 { $Other$ }";
- String expectedResult3 = " class A extends B2 {\n" +
- " int c;\n\n" +
- " void b() {\n" +
- " }\n\n" +
- " {\n" +
- " a = 1;\n" +
- " }\n" +
- " }";
-
- actualResult = replacer.testReplace(s7,s8,s9,options);
- assertEquals("Unsupported pattern exception",actualResult,expectedResult3);
- options.setToReformatAccordingToStyle(formatAccordingToStyle);
-
- String s10 = "/** @example */\n" +
- "class A {\n" +
- " class C {}\n" +
- " public void b() {}\n" +
- " int f;\n" +
- "}";
- String s11 = "class 'a { 'Other* }";
- String s12 = "public class $a$ {\n" +
- " $Other$\n" +
- "}";
- String expectedResult4 = "/** @example */\n" +
- " public class A {\n" +
- " class C {\n" +
- " }\n\n" +
- " public void b() {\n" +
- " }\n\n" +
- " int f;\n" +
- " }";
-
- options.setToReformatAccordingToStyle(true);
- actualResult = replacer.testReplace(s10,s11,s12,options);
- options.setToReformatAccordingToStyle(false);
- assertEquals("Make class public",expectedResult4,actualResult);
-
- String s13 = "class CustomThread extends Thread {\n" +
- "public CustomThread(InputStream in, OutputStream out, boolean closeOutOnExit) {\n" +
- " super(CustomThreadGroup.getThreadGroup(), \"CustomThread\");\n" +
- " setDaemon(true);\n" +
- " if (in instanceof BufferedInputStream) {\n" +
- " bis = (BufferedInputStream)in;\n" +
- " } else {\n" +
- " bis = new BufferedInputStream(in);\n" +
- " }\n" +
- " this.out = out;\n" +
- " this.closeOutOnExit = closeOutOnExit;\n" +
- "}\n" +
- "}";
- String s14 = "class 'Class extends Thread {\n" +
- " 'Class('ParameterType* 'ParameterName*) {\n" +
- "\t super (CustomThreadGroup.getThreadGroup(), 'superarg* );\n" +
- " 'Statement*;\n" +
- " }\n" +
- "}";
- String s15 = "class $Class$ extends CustomThread {\n" +
- " $Class$($ParameterType$ $ParameterName$) {\n" +
- "\t super($superarg$);\n" +
- " $Statement$;\n" +
- " }\n" +
- "}";
-
- String expectedResult5 = " class CustomThread extends CustomThread {\n" +
- " CustomThread(InputStream in, OutputStream out, boolean closeOutOnExit) {\n" +
- " super(\"CustomThread\");\n" +
- " setDaemon(true);\n" +
- " if (in instanceof BufferedInputStream) {\n" +
- " bis = (BufferedInputStream) in;\n" +
- " } else {\n" +
- " bis = new BufferedInputStream(in);\n" +
- " }\n" +
- " this.out = out;\n" +
- " this.closeOutOnExit = closeOutOnExit;\n" +
- " }\n" +
- " }";
- options.setToReformatAccordingToStyle(true);
- actualResult = replacer.testReplace(s13,s14,s15,options);
- options.setToReformatAccordingToStyle(false);
- assertEquals("Constructor replacement",expectedResult5,actualResult);
-
- String s16 = "public class A {}\n" +
- "final class B {}";
- String s17 = "class 'A { 'Other* }";
- String s17_2 = "class 'A { private Log log = LogFactory.createLog(); 'Other* }";
- String s18 = "class $A$ { private Log log = LogFactory.createLog(); $Other$ }";
- String s18_2 = "class $A$ { $Other$ }";
-
- actualResult = replacer.testReplace(s16,s17,s18,options);
- String expectedResult6 = "public class A { private Log log = LogFactory.createLog(); }\n" +
- "final class B { private Log log = LogFactory.createLog(); }";
- assertEquals("Modifier list for class",expectedResult6,actualResult);
-
- actualResult = replacer.testReplace(actualResult,s17_2,s18_2,options);
- String expectedResult7 = "public class A { }\n" +
- "final class B { }";
- assertEquals("Removing field",expectedResult7,actualResult);
-
- String s19 = "public class A extends Object implements Cloneable {}\n";
- String s20 = "class 'A { 'Other* }";
- String s21 = "class $A$ { private Log log = LogFactory.createLog(); $Other$ }";
-
- actualResult = replacer.testReplace(s19,s20,s21,options);
- String expectedResult8 = "public class A extends Object implements Cloneable { private Log log = LogFactory.createLog(); }\n";
- assertEquals("Extends / implements list for class",expectedResult8,actualResult);
-
- String s22 = "public class A<T> { int Afield; }\n";
- String s23 = "class 'A { 'Other* }";
- String s24 = "class $A$ { private Log log = LogFactory.createLog(); $Other$ }";
-
- actualResult = replacer.testReplace(s22,s23,s24,options);
- String expectedResult9 = "public class A<T> { private Log log = LogFactory.createLog(); int Afield; }\n";
- assertEquals("Type parameters for the class",expectedResult9,actualResult);
-
- String s25 = "class A {\n" +
- " // comment before\n" +
- " protected short a; // comment after\n" +
- "}";
- String s26 = "short a;";
- String s27 = "Object a;";
- String expectedResult10 = "class A {\n" +
- " // comment before\n" +
- " protected Object a; // comment after\n" +
- "}";
-
- actualResult = replacer.testReplace(s25,s26,s27,options);
-
- assertEquals(
- "Replacing dcl with saving access modifiers",
- expectedResult10,
- actualResult
- );
-
- String s28 = "aaa";
- String s29 = "class 'Class {\n" +
- " 'Class('ParameterType 'ParameterName) {\n" +
- " 'Class('ParameterName);\n" +
- " }\n" +
- "}";
- String s30 = "class $Class$ {\n" +
- " $Class$($ParameterType$ $ParameterName$) {\n" +
- " this($ParameterName$);\n" +
- " }\n" +
- "}";
- String expectedResult11 = "aaa";
-
- actualResult = replacer.testReplace(s28,s29,s30,options);
-
- assertEquals(
- "Complex class replacement",
- expectedResult11,
- actualResult
- );
-
- String s31 = "class A {\n" +
- " int a; // comment\n" +
- " char b;\n" +
- " int c; // comment2\n" +
- "}";
-
- String s32 = "'Type 'Variable = 'Value?; //'Comment";
- String s33 = "/**$Comment$*/\n" +
- "$Type$ $Variable$ = $Value$;";
-
- String expectedResult12 = " class A {\n" +
- " /**\n" +
- " * comment\n" +
- " */\n" +
- " int a;\n" +
- " char b;\n" +
- " /**\n" +
- " * comment2\n" +
- " */\n" +
- " int c;\n" +
- " }";
- options.setToReformatAccordingToStyle(true);
- actualResult = replacer.testReplace(s31,s32,s33,options);
- options.setToReformatAccordingToStyle(false);
-
- assertEquals(
- "Replacing comments with javadoc for fields",
- expectedResult12,
- actualResult
- );
-
- String s34 = "/**\n" +
- " * This interface stores XXX\n" +
- " * <p/>\n" +
- " */\n" +
- "public interface X {\n" +
- " public static final String HEADER = Headers.HEADER;\n" +
- "\n" +
- "}";
-
- String s35 = "public interface 'MessageInterface {\n" +
- " public static final String 'X = 'VALUE;\n" +
- " 'blah*" +
- "}";
- String s36 = "public interface $MessageInterface$ {\n" +
- " public static final String HEADER = $VALUE$;\n" +
- " $blah$\n" +
- "}";
-
- String expectedResult13 = "/**\n" +
- " * This interface stores XXX\n" +
- " * <p/>\n" +
- " */\n" +
- "public interface X {\n" +
- " public static final String HEADER = Headers.HEADER;\n" +
- " \n" +
- "}";
-
- actualResult = replacer.testReplace(s34,s35,s36,options, true);
-
- assertEquals(
- "Replacing interface with interface, saving comments properly",
- expectedResult13,
- actualResult
- );
- }
-
- public void testClassReplacement3() {
- if (true) return;
- final String actualResult;
- String s37 = "class A { int a = 1; void B() {} int C(char ch) { int z = 1; } int b = 2; }";
-
- String s38 = "class 'A { 'T* 'M*('PT* 'PN*) { 'S*; } 'O* }";
- String s39 = "class $A$ { $T$ $M$($PT$ $PN$) { System.out.println(\"$M$\"); $S$; } $O$ }";
-
- String expectedResult14 = "class A { int a = 1; void B( ) { System.out.println(\"B\"); } int C(char ch) { System.out.println(\"C\"); int z = 1; } int b = 2;}";
- String expectedResult14_2 = "class A { int a = 1; void B( ) { System.out.println(\"B\"); } int C(char ch) { System.out.println(\"C\"); int z = 1; } int b = 2;}";
-
- actualResult = replacer.testReplace(s37,s38,s39,options, true);
-
- assertEquals(
- "Multiple methods replacement",
- expectedResult14,
- actualResult
- );
- }
-
- public void testClassReplacement4() {
- final String actualResult;
- String s1 = "class A {\n" +
- " int a = 1;\n" +
- " int b;\n" +
- " private int c = 2;\n" +
- "}";
-
- String s2 = "@Modifier(\"PackageLocal\") 'Type 'Instance = 'Init?;";
- String s3 = "public $Type$ $Instance$ = $Init$;";
-
- String expectedResult = "class A {\n" +
- " public int a = 1;\n" +
- " public int b ;\n" +
- " private int c = 2;\n" +
- "}";
-
- actualResult = replacer.testReplace(s1,s2,s3,options, true);
-
- assertEquals(
- "Multiple fields replacement",
- expectedResult,
- actualResult
- );
- }
-
- public void testClassReplacement5() {
- final String actualResult;
- String s1 = "public class X {\n" +
- " /**\n" +
- " * zzz\n" +
- " */\n" +
- " void f() {\n" +
- "\n" +
- " }\n" +
- "}";
-
- String s2 = "class 'c {\n" +
- " /**\n" +
- " * zzz\n" +
- " */\n" +
- " void f(){}\n" +
- "}";
- String s3 = "class $c$ {\n" +
- " /**\n" +
- " * ppp\n" +
- " */\n" +
- " void f(){}\n" +
- "}";
-
- String expectedResult = "public class X {\n" +
- " /**\n" +
- " * ppp\n" +
- " */\n" +
- " void f(){}\n" +
- "}";
-
- actualResult = replacer.testReplace(s1,s2,s3,options, true);
-
- assertEquals(
- "Not preserving comment if it is present",
- expectedResult,
- actualResult
- );
- }
-
- public void testClassReplacement6() {
- String actualResult;
- String s1 = "public class X {\n" +
- " /**\n" +
- " * zzz\n" +
- " */\n" +
- " private void f(int i) {\n" +
- " //s\n" +
- " }\n" +
- "}";
- String s1_2 = "public class X {\n" +
- " /**\n" +
- " * zzz\n" +
- " */\n" +
- " private void f(int i) {\n" +
- " int a = 1;\n" +
- " //s\n" +
- " }\n" +
- "}";
-
- String s2 = "class 'c {\n" +
- " /**\n" +
- " * zzz\n" +
- " */\n" +
- " void f('t 'p){'s+;}\n" +
- "}";
- String s3 = "class $c$ {\n" +
- " /**\n" +
- " * ppp\n" +
- " */\n" +
- " void f($t$ $p$){$s$;}\n" +
- "}";
-
- String expectedResult = "public class X {\n" +
- " /**\n" +
- " * ppp\n" +
- " */\n" +
- " private void f(int i ){//s\n" +
- "}\n" +
- "}";
-
- actualResult = replacer.testReplace(s1,s2,s3,options);
-
- assertEquals(
- "Correct class replacement",
- expectedResult,
- actualResult
- );
-
- String expectedResult2 = "public class X {\n" +
- " /**\n" +
- " * ppp\n" +
- " */\n" +
- " private void f(int i ){int a = 1;\n" +
- " //s\n" +
- "}\n" +
- "}";
-
- actualResult = replacer.testReplace(s1_2,s2,s3,options);
-
- assertEquals(
- "Correct class replacement, 2",
- expectedResult2,
- actualResult
- );
- }
-
- public void testClassReplacement7() {
- String s1 = "/**\n" +
- "* Created by IntelliJ IDEA.\n" +
- "* User: cdr\n" +
- "* Date: Nov 15, 2005\n" +
- "* Time: 4:23:29 PM\n" +
- "* To change this template use File | Settings | File Templates.\n" +
- "*/\n" +
- "public class CC {\n" +
- " /** My Comment */ int a = 3; // aaa\n" +
- " // bbb\n" +
- " long c = 2;\n" +
- " void f() {\n" +
- " }\n" +
- "}";
- String s2 = "/**\n" +
- "* Created by IntelliJ IDEA.\n" +
- "* User: 'USER\n" +
- "* Date: 'DATE\n" +
- "* Time: 'TIME\n" +
- "* To change this template use File | Settings | File Templates.\n" +
- "*/\n" +
- "class 'c {\n" +
- " 'other*\n" +
- "}";
- String s3 = "/**\n" +
- "* by: $USER$\n" +
- "*/\n" +
- "class $c$ {\n" +
- " $other$\n" +
- "}";
- String expectedResult = "/**\n" +
- "* by: cdr\n" +
- "*/\n" +
- "public class CC {\n" +
- " /** My Comment */ int a = 3; // aaa\n" +
- "// bbb\n" +
- " long c = 2;\n" +
- "void f() {\n" +
- " }\n" +
- "}";
-
- actualResult = replacer.testReplace(s1,s2,s3,options,true);
-
- assertEquals(
- "Class with comment replacement",
- expectedResult,
- actualResult
- );
- }
-
- public void testClassReplacement8() {
- String s1 = "public class CC {\n" +
- " /** AAA*/ int b = 1; // comment\n" +
- "}";
- String s2 = "int b = 1;";
- String s3 = "long c = 2;";
- String expectedResult = "public class CC {\n" +
- " /** AAA*/ long c = 2; // comment\n" +
- "}";
-
- actualResult = replacer.testReplace(s1,s2,s3,options,true);
-
- assertEquals(
- "Class field replacement with simple pattern",
- expectedResult,
- actualResult
- );
- }
-
- @NotNull
- @Override
- protected String getTestDataPath() {
- return PluginPathManager.getPluginHomePath("structuralsearch") + "/testData/";
- }
-
- public void testClassReplacement9() throws IOException {
- String s1 = loadFile("before1.java");
- String s2 = "class 'A extends 'TestCaseCass:[regex( .*TestCase ) ] {\n" +
- " 'OtherStatement*;\n" +
- " public void 'testMethod*:[regex( test.* )] () {\n" +
- " }\n" +
- " 'OtherStatement2*;\n" +
- "}";
- String s3 = "class $A$ extends $TestCaseCass$ {\n" +
- " $OtherStatement$;\n" +
- " $OtherStatement2$;\n" +
- "}";
- String expectedResult = loadFile("after1.java");
-
- options.setToReformatAccordingToStyle(true);
- actualResult = replacer.testReplace(s1,s2,s3,options,true);
-
- assertEquals(
- "Class replacement 9",
- expectedResult,
- actualResult
- );
- }
-
- public void testReplaceReturnWithArrayInitializer() {
- String searchIn = "return ( new String[]{CoreVars.CMUAudioPort + \"\"} );";
- String searchFor = "return ( 'A );";
- String replaceBy = "return $A$;";
- String expectedResult = "return new String[]{CoreVars.CMUAudioPort + \"\"};";
-
- actualResult = replacer.testReplace(searchIn,searchFor,replaceBy,options);
-
- assertEquals(
- "ReplaceReturnWithArrayInitializer",
- expectedResult,
- actualResult
- );
- }
-
- public void _testClassReplacement10() throws IOException {
- String s1 = loadFile("before2.java");
- String s2 = "class '_Class {\n" +
- " '_ReturnType+ '_MethodName+('_ParameterType* '_Parameter*){\n" +
- " '_content*;\n" +
- " }\n" +
- " '_remainingclass*" +
- "}";
- String s3 = "class $Class$ {\n" +
- " $remainingclass$\n" +
- " @Override $ReturnType$ $MethodName$($ParameterType$ $Parameter$){\n" +
- " $content$;\n" +
- " }\n" +
- "}";
- String expectedResult = loadFile("after2.java");
-
- options.setToReformatAccordingToStyle(true);
- actualResult = replacer.testReplace(s1,s2,s3,options,true);
-
- assertEquals(
- "Class replacement 10",
- expectedResult,
- actualResult
- );
- }
-
- public void testCatchReplacement() throws Exception {
- String s1 = "try {\n" +
- " aaa();\n" +
- "} catch(Exception ex) {\n" +
- " LOG.assertTrue(false);\n" +
- "}";
- String s2 = "{ LOG.assertTrue(false); }";
- String s3 = "{ if (false) LOG.assertTrue(false); }";
- String expectedResult = "try {\n" +
- " aaa();\n" +
- "} catch (Exception ex) {\n" +
- " if (false) LOG.assertTrue(false);\n" +
- "}";
- options.setToReformatAccordingToStyle(true);
- actualResult = replacer.testReplace(s1,s2,s3,options);
- options.setToReformatAccordingToStyle(false);
-
- assertEquals(
- "Catch replacement by block",
- expectedResult,
- actualResult
- );
- }
-
- public void testSavingAccessModifiersDuringClassReplacement() {
- String actualResult;
-
- String s43 = "public @Deprecated class Foo implements Comparable<Foo> {\n int x;\n void m(){}\n }";
- String s44 = "class 'Class implements 'Interface { 'Content* }";
- String s45 = "@MyAnnotation\n" +
- "class $Class$ implements $Interface$ {$Content$}";
- String expectedResult16 = "@MyAnnotation public @Deprecated\n" +
- "class Foo implements Comparable<Foo> {int x;\n" +
- "void m(){}}";
-
- actualResult = replacer.testReplace(s43,s44,s45,options, true);
- assertEquals(
- "Preserving var modifiers and generic information in type during replacement",
- expectedResult16,
- actualResult
- );
- }
-
- public void testDontRequireSpecialVarsForUnmatchedContent() {
- String actualResult;
-
- String s43 = "public @Deprecated class Foo implements Comparable<Foo> {\n int x;\n void m(){}\n }";
- String s44 = "class 'Class implements 'Interface {}";
- String s45 = "@MyAnnotation\n" +
- "class $Class$ implements $Interface$ {}";
- String expectedResult16 = "@MyAnnotation public @Deprecated\n" +
- "class Foo implements Comparable<Foo> {int x;\nvoid m(){}}";
-
- actualResult = replacer.testReplace(s43,s44,s45,options, true);
- assertEquals(
- "Preserving class modifiers and generic information in type during replacement",
- expectedResult16,
- actualResult
- );
- }
-
- public void _testClassReplacement2() {
- final String actualResult;
- String s40 = "class A {\n" +
- " /* special comment*/\n" +
- " private List<String> a = new ArrayList();\n" +
- " static {\n" +
- " int a = 1;" +
- " }\n" +
- "}";
- String s41 = "class 'Class {\n" +
- " 'Stuff2*\n" +
- " 'FieldType 'FieldName = 'Init?;\n" +
- " static {\n" +
- " 'Stmt*;\n" +
- " }\n" +
- " 'Stuff*\n" +
- "}";
- String s42 = "class $Class$ {\n" +
- " $Stuff2$\n" +
- " $FieldType$ $FieldName$ = build$FieldName$Map();\n" +
- " private static $FieldType$ build$FieldName$Map() {\n" +
- " $FieldType$ $FieldName$ = $Init$;\n" +
- " $Stmt$;\n" +
- " return $FieldName$;\n" +
- " }\n" +
- " $Stuff$\n" +
- "}";
- String expectedResult15 = "class A {\n" +
- " \n" +
- " /* special comment*/\n" +
- " private List<String> a = buildaMap();\n" +
- " private static List<String> buildaMap() {\n" +
- " List<String> a = new ArrayList();\n" +
- " int a = 1;\n" +
- " return a;\n" +
- " }\n" +
- " \n" +
- "}";
-
- actualResult = replacer.testReplace(s40,s41,s42,options, true);
-
- assertEquals(
- "Preserving var modifiers and generic information in type during replacement",
- expectedResult15,
- actualResult
- );
-
- String s46 = "class Foo { int xxx; void foo() { assert false; } void yyy() {}}";
- String s47 = "class 'Class { void 'foo:[regex( foo )](); }";
- String s48 = "class $Class$ { void $foo$(int a); }";
- String expectedResult17 = "class Foo { int xxx; void foo(int a) { assert false; } void yyy() {}}";
-
- String actualResult2 = replacer.testReplace(s46,s47,s48,options, true);
- assertEquals(
- "Preserving method bodies",
- expectedResult17,
- actualResult2
- );
- }
-
- public void testReplaceExceptions() {
- String s1 = "a=a;";
- String s2 = "'a";
- String s3 = "$b$";
-
- try {
- replacer.testReplace(s1,s2,s3,options);
- assertTrue("Undefined replace variable is not checked",false);
- } catch(UnsupportedPatternException ex) {
-
- }
-
- String s4 = "a=a;";
- String s5 = "a=a;";
- String s6 = "a=a";
-
- try {
- replacer.testReplace(s4,s5,s6,options);
- assertTrue("Undefined no ; in replace",false);
- } catch(UnsupportedPatternException ex) {
- }
-
- try {
- replacer.testReplace(s4,s6,s5,options);
- assertTrue("Undefined no ; in search",false);
- } catch(UnsupportedPatternException ex) {
- }
- }
-
- public void testActualParameterReplacementInConstructorInvokation() {
- String s1 = "filterActions[0] = new Action(TEXT,\n" +
- " LifeUtil.getIcon(\"search\")) {\n" +
- " void test() {\n" +
- " int a = 1;\n" +
- " }\n" +
- "};";
- String s2 = "LifeUtil.getIcon(\"search\")";
- String s3 = "StdIcons.SEARCH_LIFE";
- String expectedResult = "filterActions[0] = new Action(TEXT,\n" +
- " StdIcons.SEARCH_LIFE) {\n" +
- " void test() {\n" +
- " int a = 1;\n" +
- " }\n" +
- "};";
- options.setToReformatAccordingToStyle(true);
- options.setToShortenFQN(true);
-
- String actualResult = replacer.testReplace(s1, s2, s3, options);
- assertEquals("Replace in anonymous class parameter", expectedResult, actualResult);
- options.setToShortenFQN(false);
- options.setToReformatAccordingToStyle(false);
- }
-
- public void testRemove() {
- String s1 = "class A {\n" +
- " /* */\n" +
- " void a() {\n" +
- " }\n" +
- " /*\n" +
- " */\n" +
- " int b = 1;\n" +
- " /*\n" +
- " *\n" +
- " */\n" +
- " class C {}\n" +
- " {\n" +
- " /* aaa */\n" +
- " int a;\n" +
- " /* */\n" +
- " a = 1;\n" +
- " }\n" +
- "}";
- String s2 = "/* 'a:[regex( .* )] */";
- String s2_2 = "/* */";
- String s3 = "";
- String expectedResult = "class A {\n" +
- " void a() {\n" +
- " }\n" +
- "\n" +
- " int b = 1;\n" +
- "\n" +
- " class C {\n" +
- " }\n" +
- "\n" +
- " {\n" +
- " int a;\n" +
- " a = 1;\n" +
- " }\n" +
- "}";
- options.setToReformatAccordingToStyle(true);
- actualResult = replacer.testReplace(s1,s2,s3,options);
- options.setToReformatAccordingToStyle(false);
-
- assertEquals(
- "Removing comments",
- expectedResult,
- actualResult
- );
-
- String expectedResult2 = "class A {\n" +
- " void a() {\n" +
- " }\n" +
- " /*\n" +
- " */\n" +
- " int b = 1;\n" +
- " /*\n" +
- " *\n" +
- " */\n" +
- " class C {}\n" +
- " {\n" +
- " /* aaa */\n" +
- " int a;\n" +
- " a = 1;\n" +
- " }\n" +
- "}";
-
- actualResult = replacer.testReplace(s1,s2_2,s3,options);
-
- assertEquals(
- "Removing comments",
- expectedResult2,
- actualResult
- );
- }
-
- public void testTryCatchInLoop() throws Exception {
- String code = "for (int i = 0; i < MIMEHelper.MIME_MAP.length; i++)\n" +
- "{\n" +
- " String s = aFileNameWithOutExtention + MIMEHelper.MIME_MAP[i][0][0];\n" +
- " try\n" +
- " {\n" +
- " if (ENABLE_Z107_READING)\n" +
- " { in = aFileNameWithOutExtention.getClass().getResourceAsStream(s); }\n" +
- " else\n" +
- " { data = ResourceHelper.readResource(s); }\n" +
- " mime = MIMEHelper.MIME_MAP[i][1][0];\n" +
- " break;\n" +
- " }\n" +
- " catch (final Exception e)\n" +
- " { continue; }\n" +
- "}";
- String toFind = "try { 'TryStatement*; } catch(Exception 'ExceptionDcl) { 'CatchStatement*; }";
- String replacement = "try { $TryStatement$; }\n" + "catch(Throwable $ExceptionDcl$) { $CatchStatement$; }";
- String expectedResult = "for (int i = 0; i < MIMEHelper.MIME_MAP.length; i++)\n" +
- "{\n" +
- " String s = aFileNameWithOutExtention + MIMEHelper.MIME_MAP[i][0][0];\n" +
- " try { if (ENABLE_Z107_READING)\n" +
- " { in = aFileNameWithOutExtention.getClass().getResourceAsStream(s); }\n" +
- " else\n" +
- " { data = ResourceHelper.readResource(s); }\n" +
- " mime = MIMEHelper.MIME_MAP[i][1][0];\n" +
- " break; }\n" +
- "catch(final Throwable e) { continue; }\n" +
- "}";
-
- actualResult = replacer.testReplace(code,toFind,replacement,options);
-
- assertEquals(
- "Replacing try/catch in loop",
- expectedResult,
- actualResult
- );
- }
-
- public void testReformatAndShortenClassRefPerformance() throws IOException {
- final String testName = getTestName(false);
- final String ext = "java";
- final String message = "Reformat And Shorten Class Ref Performance";
-
- options.setToReformatAccordingToStyle(true);
- options.setToShortenFQN(true);
-
- PlatformTestUtil.startPerformanceTest("SSR should work fast", 3500, new ThrowableRunnable() {
- public void run() {
- doTest(testName, ext, message);
- }
- }
- ).cpuBound().assertTiming();
-
- options.setToReformatAccordingToStyle(false);
- options.setToShortenFQN(false);
- }
-
- private void doTest(final String testName, final String ext, final String message) {
- try {
- String source = loadFile(testName + "_source." + ext);
- String pattern = loadFile(testName + "_pattern." + ext);
- String replacement = loadFile(testName + "_replacement." + ext);
- String expected = loadFile(testName + "_result." + ext);
-
- actualResult = replacer.testReplace(source,pattern,replacement,options);
-
- assertEquals(
- message,
- expected,
- actualResult
- );
- }
- catch (IOException e) {
- throw new RuntimeException(e);
- }
- }
-
- public void testLeastSurprise() {
- String s1 = "@Nullable (a=String.class) @String class Test {\n" +
- " void aaa(String t) {\n" +
- " String a = String.valueOf(' ');" +
- " String2 a2 = String2.valueOf(' ');" +
- " }\n" +
- "}";
- String s2 = "'String:String";
- String s2_2 = "String";
- String s2_3 = "'String:java\\.lang\\.String";
- String s2_4 = "java.lang.String";
- String replacement = CommonClassNames.JAVA_UTIL_LIST;
- String expected = "@Nullable (a=java.util.List.class) @java.util.List class Test {\n" +
- " void aaa(java.util.List t) {\n" +
- " java.util.List a = java.util.List.valueOf(' ');" +
- " String2 a2 = String2.valueOf(' ');" +
- " }\n" +
- "}";
-
- actualResult = replacer.testReplace(s1,s2,replacement,options);
-
- assertEquals(
- expected,
- actualResult
- );
-
- actualResult = replacer.testReplace(s1,s2_2,replacement,options);
-
- assertEquals(
- expected,
- actualResult
- );
-
- actualResult = replacer.testReplace(s1,s2_3,replacement,options);
-
- assertEquals(
- expected,
- actualResult
- );
-
- actualResult = replacer.testReplace(s1,s2_4,replacement,options);
-
- assertEquals(
- expected,
- actualResult
- );
- }
-
- public void testLeastSurprise2() {
- String s1 = "class B { int s(int a) { a = 1; a = 2; c(a); } }";
- String s2 = "a";
- String replacement = "a2";
- String expected = "class B { int s(int a2) { a2 = 1; a2 = 2; c(a2); } }";
-
- actualResult = replacer.testReplace(s1,s2,replacement,options);
-
- assertEquals(
- expected,
- actualResult
- );
- }
-
- public void testReplaceTry() {
- String s1 = "try {\n" +
- " em.persist(p);\n" +
- " } catch (PersistenceException e) {\n" +
- " // good\n" +
- " }";
- String s2 = "try { 'TryStatement; } catch('ExceptionType 'ExceptionDcl) { /* 'CommentContent */ }";
- String replacement = "try { $TryStatement$; } catch($ExceptionType$ $ExceptionDcl$) { _logger.warning(\"$CommentContent$\", $ExceptionDcl$); }";
- String expected = "try { em.persist(p); } catch(PersistenceException e) { _logger.warning(\" good\", e); }";
-
- actualResult = replacer.testReplace(s1,s2,replacement,options);
-
- assertEquals(
- expected,
- actualResult
- );
- }
-
- public void testReplaceExtraSemicolon() {
- String s1 = "try {\n" +
- " String[] a = {\"a\"};\n" +
- " System.out.println(\"blah\");\n" +
- "} finally {\n" +
- "}\n";
- String s2 = "try {\n" + " 'statement*;\n" + "} finally {\n" + " \n" + "}";
- String replacement = "$statement$;";
- String expected = "String[] a = {\"a\"};\n" +
- " System.out.println(\"blah\");\n";
-
- actualResult = replacer.testReplace(s1,s2,replacement,options);
-
- assertEquals(
- expected,
- actualResult
- );
-
- String s1_2 = "try {\n" +
- " if (args == null) return ;\n" +
- " while(true) return ;\n" +
- " System.out.println(\"blah2\");\n" +
- "} finally {\n" +
- "}";
- String expected_2 = "if (args == null) return ;\n" +
- " while(true) return ;\n" +
- " System.out.println(\"blah2\");";
-
- actualResult = replacer.testReplace(s1_2,s2,replacement,options);
-
- assertEquals(
- expected_2,
- actualResult
- );
-
- String s1_3 = "{\n" +
- " try {\n" +
- " System.out.println(\"blah1\");\n" +
- "\n" +
- " System.out.println(\"blah2\");\n" +
- " } finally {\n" +
- " }\n" +
- "}";
- String expected_3 = "{\n" +
- " System.out.println(\"blah1\");\n" +
- "\n" +
- " System.out.println(\"blah2\");\n" +
- "}";
- actualResult = replacer.testReplace(s1_3,s2,replacement,options);
-
- assertEquals(
- expected_3,
- actualResult
- );
-
- String s1_4 = "{\n" +
- " try {\n" +
- " System.out.println(\"blah1\");\n" +
- " // indented comment\n" +
- " System.out.println(\"blah2\");\n" +
- " } finally {\n" +
- " }\n" +
- "}";
- String expected_4 = "{\n" +
- " System.out.println(\"blah1\");\n" +
- " // indented comment\n" +
- " System.out.println(\"blah2\");\n" +
- "}";
- actualResult = replacer.testReplace(s1_4,s2,replacement,options);
-
- assertEquals(
- expected_4,
- actualResult
- );
- }
-
- public void _testReplaceFinalModifier() throws Exception {
- String s1 = "class Foo {\n" +
- " void foo(final int i,final int i2, final int i3) {\n" +
- " final int x = 5;\n" +
- " }\n" +
- "}";
- String s2 = "final '_type 'var = '_init?";
- String s3 = "$type$ $var$ = $init$";
-
- String expected = "2 = 1;\nint b = a;\nb2 = 3;";
-
- actualResult = replacer.testReplace(s1,s2,s3,options);
-
- assertEquals(
- expected,
- actualResult
- );
- }
-
- public void testRemovingRedundancy() throws Exception {
- String s1 = "int a = 1;\n" +
- "a = 2;\n" +
- "int b = a;\n" +
- "b2 = 3;";
- String s2 = "int 'a = 'i;\n" +
- "'st*;\n" +
- "'a = 'c;";
- String s3 = "$st$;\n" +
- "$c$ = $i$;";
-
- String expected = "2 = 1;\nint b = a;\nb2 = 3;";
-
- actualResult = replacer.testReplace(s1,s2,s3,options);
-
- assertEquals(
- expected,
- actualResult
- );
-
- String s2_2 = "int 'a = 'i;\n" +
- "'st*;\n" +
- "int 'c = 'a;";
- String s3_2 = "$st$;\n" +
- "int $c$ = $i$;";
- String expected_2 = "a = 2;\nint b = 1;\nb2 = 3;";
-
- actualResult = replacer.testReplace(s1,s2_2,s3_2,options);
-
- assertEquals(
- expected_2,
- actualResult
- );
- }
-
- public void testReplaceWithEmptyString() {
- String source = "public class Peepers {\n public long serialVersionUID = 1L; \n}";
- String search = "long serialVersionUID = $value$;";
- String replace = "";
- String expectedResult = "public class Peepers { \n}";
-
- String actualResult = replacer.testReplace(source, search, replace, options, true);
-
- assertEquals(
- expectedResult,
- actualResult
- );
- }
-
- public void testReplaceMultipleFieldsInSingleDeclaration() {
- String source = "abstract class MyClass implements java.util.List {\n private String a, b;\n}";
- String search = "class 'Name implements java.util.List {\n 'ClassContent*\n}";
- String replace = "class $Name$ {\n $ClassContent$\n}";
- String expectedResult = "abstract class MyClass {\n private String a,b;\n}";
-
- String actualResult = replacer.testReplace(source, search, replace, options, true);
-
- assertEquals(
- expectedResult,
- actualResult
- );
- }
-
- public void testReplaceInImplementsList() {
- String source = "import java.io.Externalizable;\n" +
- "import java.io.Serializable;\n" +
- "abstract class MyClass implements Serializable, java.util.List, Externalizable {}";
- String search = "class 'TestCase implements java.util.List, 'others* {\n 'MyClassContent\n}";
- String replace = "class $TestCase$ implements $others$ {\n $MyClassContent$\n}";
- String expectedResult = "import java.io.Externalizable;\n" +
- "import java.io.Serializable;\n" +
- "abstract class MyClass implements Externalizable,Serializable {\n \n}";
-
- String actualResult = replacer.testReplace(source, search, replace, options, true);
- assertEquals(
- expectedResult,
- actualResult
- );
- }
-
- public void testReplaceFieldWithEndOfLineComment() {
- String source = "class MyClass {\n" +
- " private String b;// comment\n" +
- " public void foo() {\n" +
- " }\n" +
- "}";
- String search = "class 'Class {\n 'Content*\n}";
- String replace = "class $Class$ {\n" +
- " void x() {}\n" +
- " $Content$\n" +
- " void bar() {}\n" +
- "}";
- String expectedResult = "class MyClass {\n" +
- " void x() {}\n" +
- " private String b;// comment\n" +
- "public void foo() {\n" +
- " }\n" +
- " void bar() {}\n" +
- "}";
-
- String actualResult = replacer.testReplace(source, search, replace, options, true);
- assertEquals(
- expectedResult,
- actualResult
- );
- }
-} \ No newline at end of file
diff --git a/plugins/structuralsearch/testSource/com/intellij/structuralsearch/StructuralSearchTest.java b/plugins/structuralsearch/testSource/com/intellij/structuralsearch/StructuralSearchTest.java
deleted file mode 100644
index a3fecba980df..000000000000
--- a/plugins/structuralsearch/testSource/com/intellij/structuralsearch/StructuralSearchTest.java
+++ /dev/null
@@ -1,2938 +0,0 @@
-package com.intellij.structuralsearch;
-
-import com.intellij.idea.Bombed;
-import com.intellij.openapi.application.PluginPathManager;
-import com.intellij.openapi.fileTypes.StdFileTypes;
-import com.intellij.psi.*;
-import com.intellij.structuralsearch.impl.matcher.MatcherImplUtil;
-import org.jetbrains.annotations.NotNull;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.List;
-
-/**
- * @author Maxim.Mossienko
- */
-@SuppressWarnings({"HardCodedStringLiteral"})
-public class StructuralSearchTest extends StructuralSearchTestCase {
- private static final String s1 =
- "debug(\"In action performed:\"+event);"+
- "project = (Project)event.getDataContext().getData(DataConstants.PROJECT);" +
- "CodeEditorManager.getInstance(project).commitAllToPsiFile();" +
- "file = (PsiFile) event.getDataContext().getData(\"psi.File\"); " +
- "((dialog==null)?" +
- " (dialog = new SearchDialog()):" +
- " dialog" +
- ").show();";
-
- private static final String s2 = "((dialog==null)? (dialog = new SearchDialog()): dialog).show();";
- private static final String s3 = "dialog = new SearchDialog()";
-
- private static final String s4 =
- " do { " +
- " pattern = pattern.getNextSibling(); " +
- " } " +
- " while (pattern!=null && filterLexicalNodes(pattern));";
-
- private static final String s5 =
- "{ System.out.println();" +
- " while(false) { " +
- " do { " +
- " pattern = pattern.getNextSibling(); " +
- " } " +
- " while (pattern!=null && filterLexicalNodes(pattern)); " +
- " } " +
- " do { " +
- " pattern = pattern.getNextSibling(); " +
- " } while (pattern!=null && filterLexicalNodes(pattern));" +
- " { { " +
- " do { " +
- " pattern = pattern.getNextSibling(); " +
- " } while (pattern!=null && filterLexicalNodes(pattern));" +
- " } }" +
- "}";
-
- private static final String s6 =
- " do { " +
- " pattern.getNextSibling(); " +
- " } " +
- " while (pattern!=null && filterLexicalNodes(pattern));";
-
- private static final String s7 =
- " if (true) throw new UnsupportedPatternException(statement.toString());" +
- " if (true) { " +
- " throw new UnsupportedPatternException(statement.toString());" +
- " } ";
-
- private static final String s8 =
- " if (true) { " +
- " throw new UnsupportedPatternException(statement.toString());" +
- " } ";
-
- private static final String s9 = " if (true) throw new UnsupportedPatternException(statement.toString());";
-
- private static final String s10 = "listener.add(new Runnable() { public void run() {} });";
- private static final String s11 = " new XXX()";
-
- private static final String s12 =
- "new Runnable() {" +
- " public void run() {" +
- " matchContext.getSink().matchingFinished();" +
- " } " +
- " }";
-
- private static final String s13 = "new Runnable() {}";
- private static final String s14_1 = "if (true) { aaa(var); }";
- private static final String s14_2 = "if (true) { aaa(var); bbb(var2); }\n if(1==1) { system.out.println('o'); }";
- private static final String s15 = "'T;";
- private static final String s16 = "if('_T) { '_T2; }";
- private static final String s17 =
- "token.getText().equals(token2.getText());" +
- "token.getText().equals(token2.getText2());" +
- "token.a.equals(token2.b);" +
- "token.a.equals(token2.a);";
- private static final String s18_1 = "'_T1.'_T2.equals('_T3.'_T2);";
- private static final String s18_2 = "'_T1.'_T2().equals('_T3.'_T2());";
- private static final String s18_3 = "'_T1.'_T2";
- private static final String s19 = "Aaa a = (Aaa)b; Aaa c = (Bbb)d;";
- private static final String s20 = "'_T1 'T2 = ('_T1)'_T3;";
- private static final String s20_2 = "'_T1 '_T2 = ('_T1)'_T3;";
- private static final String s21_1 = "'_T1:Aa* 'T2 = ('_T1)'_T3;";
- private static final String s21_2 = "'_T1:A* 'T2 = ( '_T1:A+ )'_T3;";
- private static final String s21_3 = "'_T1:Aa* 'T2 = ( '_T1:Aa* )'_T3;";
-
- private static final String s22 = "Aaa a = (Aaa)b; Bbb c = (Bbb)d;";
-
- private static final String s23 = "a[i] = 1; b[a[i]] = f(); if (a[i]==1) return b[c[i]];";
- private static final String s24_1 = "'T['_T2:.*i.* ] = '_T3;";
- private static final String s24_2 = "'T['_T2:.*i.* ]";
- private static final String s25 = "class MatcherImpl { void doMatch(int a) {} }\n" +
- "class Matcher { abstract void doMatch(int a);}\n " +
- "class Matcher2Impl { void doMatch(int a, int b) {} } ";
- private static final String s26 = "class 'T:.*Impl { '_T2 '_T3('_T4 '_T5) {\n\n} } ";
- private static final String s27 = "class A {} interface B {}";
- private static final String s28 = "interface 'T {}";
-
- private static final String s29 = "class A { void B(int C) {} } class D { void E(double e) {} }";
- private static final String s30 = "class '_ { void '_('_:int '_); } ";
-
- private static final String s31 = "class A extends B { } class D extends B { } class C extends C {}";
- private static final String s32 = "class '_ extends B { } ";
-
- private static final String s33 = "class A implements B,C { } class D implements B,D { } class C2 implements C,B {}";
- private static final String s34 = "class '_ implements B,C { } ";
-
- private static final String s35 = "class A { int b; double c; void d() {} int e() {} } " +
- "class A2 { int b; void d() {} }";
- private static final String s36 = "class '_ { double '_; int '_; int '_() {} void '_() {} } ";
-
- private static final String s37 = "class A { void d() throws B,C,D {} } class A2 { void d() throws B,C {} }";
- private static final String s38 = "class 'T { '_ '_() throws D,C {} } ";
-
- private static final String s39 = "class A extends B { } class A2 { }";
- private static final String s40 = "class 'T { } ";
-
- private static final String s41 = "class A extends B { int a = 1; } class B { int[] c= new int[2]; } " +
- "class D { double e; } class E { int d; } ";
- private static final String s42_1 = "class '_ { '_T '_T2 = '_T3; } ";
- private static final String s42_2 = "class '_ { '_T '_T2; } ";
-
- private static final String s43 = "interface A extends B { int B = 1; } " +
- "interface D { public final static double e = 1; } " +
- "interface E { final static ind d = 2; } " +
- "interface F { } ";
- private static final String s44 = "interface '_ { '_T 'T2 = '_T3; } ";
- private static final String s45 = "class A extends B { private static final int B = 1; } " +
- "class C extends D { int B = 1; }" +
- "class E { }";
-
- private static final String s46 = "class '_ { final static private '_T 'T2 = '_T3; } ";
- private static final String s46_2 = "class '_ { '_T 'T2 = '_T3; } ";
-
- private static final String s47 = "class C { java.lang.String t; } class B { BufferedString t2;} class A { String p;} ";
- private static final String s48 = "class '_ { String '_; }";
-
- private static final String s49 = "class C { void a() throws java.lang.RuntimeException {} } class B { BufferedString t2;}";
- private static final String s50 = "class '_ { '_ '_() throws RuntimeException; }";
-
- private static final String s51 = "class C extends B { } class B extends A { } class E {}";
- private static final String s52 = "class '_ extends '_ { }";
-
- private static final String s53 = "class C { " +
- " String a = System.getProperty(\"abcd\"); " +
- " static { String s = System.getProperty(a); }" +
- " static void b() { String s = System.getProperty(a); }" +
- " }";
- private static final String s54 = "System.getProperty('T)";
-
- private static final String s55 = " a = b.class; ";
- private static final String s56 = "'T.class";
-
- private static final String s57 = "{ /** @author Maxim */ class C { " +
- "} " +
- "class D {" +
- "/** @serializable */ private int value; " +
- "/** @since 1.4 */ void a() {} "+
- "}" +
- "class F { " +
- "/** @since 1.4 */ void a() {} "+
- "/** @serializable */ private int value2; " +
- "}" +
- "class G { /** @param a*/ void a() {} } }";
- private static final String s57_2 = "/** @author Maxim */ class C { " +
- "} " +
- "class D {" +
- "/** @serializable */ private int value; " +
- "/** @since 1.4 */ void a() {} "+
- "}" +
- "class F { " +
- "/** @since 1.4 */ void a() {} "+
- "/** @serializable */ private int value2; " +
- "}" +
- "class G { /** @param a*/ void a() {} }";
- private static final String s58 = "/** @'T '_T2 */ class '_ { }";
- private static final String s58_2 = "class '_ { /** @serializable '_ */ '_ '_; }";
- private static final String s58_3 = "class '_ { /** @'T 1.4 */ '_ '_() {} }";
- private static final String s58_4 = "/** @'T '_T2 */";
- private static final String s58_5 = "/** @'T '_T2? */";
-
- private static final String s59 = "interface A { void B(); }";
- private static final String s60 = "interface '_ { void '_(); }";
-
- private static final String s61 = "{ a=b; c=d; return; } { e=f; } {}";
- private static final String s62_1 = "{ 'T*; }";
- private static final String s62_2 = "{ 'T+; }";
- private static final String s62_3 = "{ 'T?; }";
-
- private static final String s62_4 = "{ '_*; }";
- private static final String s62_5 = "{ '_+; }";
- private static final String s62_6 = "{ '_?; }";
-
- private static final String s63 = " class A { A() {} } class B { public void run() {} }";
- private static final String s63_2 = " class A { A() {} " +
- "class B { public void run() {} } " +
- "class D { public void run() {} } " +
- "} " +
- "class C {}";
- private static final String s64 = " class 'T { public void '_T2:run () {} }";
- private static final String s64_2 = "class '_ { class 'T { public void '_T2:run () {} } }";
-
- private static final String s65 = " if (A instanceof B) {} else if (B instanceof C) {}";
- private static final String s66 = " '_T instanceof '_T2:B";
-
- private static final String s67 = " buf.append((VirtualFile)a);";
- private static final String s68 = " (VirtualFile)'T";
-
- private static final String s69 = " System.getProperties(); System.out.println(); java.lang.System.out.println(); some.other.System.out.println();";
- private static final String s70 = " System.out ";
- private static final String s70_2 = " java.lang.System.out ";
-
- private static final String s71 = " class A { " +
- "class D { D() { c(); } }" +
- "void a() { c(); new MouseListenener() { void b() { c(); } } }" +
- " }";
- private static final String s72 = " c(); ";
-
- private static final String s73 = " class A { int A; static int B=5; public abstract void a(int c); void q() { ind d=7; } }";
- private static final String s74 = " '_Type 'Var = '_Init?; ";
- private static final String s75 = "{ /** @class aClass\n @author the author */ class A {}\n" +
- " /** */ class B {}\n" +
- " /** @class aClass */ class C {} }";
- private static final String s76 = " /** @'_tag+ '_value+ */";
- private static final String s76_2 = " /** @'_tag* '_value* */";
- private static final String s76_3 = " /** @'_tag? '_value? */ class 't {}";
-
- private static final String s77 = " new ActionListener() {} ";
- private static final String s78 = " class 'T:.*aaa {} ";
-
- private static final String s79 = " class A { static { int c; } void a() { int b; b=1; }} ";
- private static final String s80 = " { '_T 'T3 = '_T2?; '_*; } ";
-
- private static final String s81 = "class Pair<First,Second> {" +
- " <C,F> void a(B<C> b, D<F> e) throws C {" +
- " P<Q> r = (S<T>)null;"+
- " Q q = null; "+
- " if (r instanceof S<T>) {}"+
- " } " +
- "} class Q { void b() {} } ";
-
- private static final String s81_2 = "class Double<T> {} class T {} class Single<First extends A & B> {}";
-
- private static final String s82 = "class '_<'T+> {}";
- private static final String s82_2 = "'_Expr instanceof '_Type<'_Parameter+>";
- private static final String s82_3 = "( '_Type<'_Parameter+> ) '_Expr";
- private static final String s82_4 = "'_Type<'_Parameter+> 'a = '_Init?;";
- private static final String s82_5 = "class '_ { <'_+> '_Type 'Method('_* '_*); }";
- private static final String s82_6 = "class '_<'_+ extends 'res+> {}";
- private static final String s82_7 = "'Type";
-
- private static final String s83 = "/**\n" +
- " * @hibernate.class\n" +
- " * table=\"CATS\"\n" +
- " */\n" +
- "public class Cat {\n" +
- " private Long id; // identifier\n" +
- " private Date birthdate;\n" +
- " /**\n" +
- " * @hibernate.id\n" +
- " * generator-class=\"native\"\n" +
- " * column=\"CAT_ID\"\n" +
- " */\n" +
- " public Long getId() {\n" +
- " return id;\n" +
- " }\n" +
- " private void setId(Long id) {\n" +
- " this.id=id;\n" +
- " }\n" +
- "\n" +
- " /**\n" +
- " * @hibernate.property\n" +
- " * column=\"BIRTH_DATE\"\n" +
- " */\n" +
- " public Date getBirthdate() {\n" +
- " return birthdate;\n" +
- " }\n" +
- " void setBirthdate(Date date) {\n" +
- " birthdate = date;\n" +
- " }\n" +
- " /**\n" +
- " * @hibernate.property\n" +
- " * column=\"SEX\"\n" +
- " * not-null=\"true\"\n" +
- " * update=\"false\"\n" +
- " */\n" +
- " public char getSex() {\n" +
- " return sex;\n" +
- " }\n" +
- " void setSex(char sex) {\n" +
- " this.sex=sex;\n" +
- " }\n" +
- "}";
-
- private static final String s84 = " /**\n" +
- " * @hibernate.property\n" +
- " * 'Property+\n" +
- " */\n";
-
- private static final String s84_2 = " /**\n" +
- " * @hibernate.property\n" +
- " * update=\"fa.se\"\n" +
- " */\n";
-
- private static final String s85 = "{ int a; a=1; a=1; return a; }";
- private static final String s86 = "'T; 'T;";
-
- private static final String s87 = " getSomething(\"1\"); a.call(); ";
- private static final String s88 = " '_Instance.'Call('_*); ";
- private static final String s88_2 = " 'Call('_*); ";
- private static final String s88_3 = " '_Instance?.'Call('_*); ";
- private static final String s89 = "{ a = 1; b = 2; c=3; }";
- private static final String s90 = "{ '_T*; '_T2*; }";
- private static final String s90_2 = " { '_T*; '_T2*; '_T3+; } ";
- private static final String s90_3 = " { '_T+; '_T2+; '_T3+; '_T4+; } ";
- private static final String s90_4 = " { '_T{1,3}; '_T2{2}; } ";
- private static final String s90_5 = " { '_T{1}?; '_T2*?; '_T3+?; } ";
- private static final String s90_6 = " { '_T{1}?; '_T2{1,2}?; '_T3+?; '_T4+?; } ";
-
- private static final String s91 = "class a {\n" +
- " void b() {\n" +
- " int c;\n" +
- "\n" +
- " c = 1;\n" +
- " b();\n" +
- " a a1;\n" +
- " }\n" +
- "}";
- private static final String s92 = "'T:a";
- private static final String s92_2 = "'T:b";
- private static final String s92_3 = "'T:c";
-
- private static final String s93 = " class A {" +
- "private int field;" +
- "public void b() {}" +
- "}";
- private static final String s94 = " class '_ {" +
- "private void b() {}" +
- "}";
- private static final String s94_2 = " class '_ {" +
- "public void b() {}" +
- "}";
- private static final String s94_3 = " class '_ {" +
- "protected int field;" +
- "}";
- private static final String s94_4 = " class '_ {" +
- "private int field;" +
- "}";
-
- private static final String s95 = " class Clazz {" +
- "private int field;" +
- "private int field2;" +
- "private int fiel-d2;" +
- "}";
-
- private static final String s96 = " class '_ {" +
- "private int 'T+:field.* ;" +
- "}";
-
- public void testSearchExpressions() {
- assertFalse("subexpr match",findMatchesCount(s2,s3)==0);
- assertEquals("search for new ",findMatchesCount(s10,s11),0);
- assertEquals("search for anonymous classes",findMatchesCount(s12,s13),1);
- // expr in definition initializer
- assertEquals(
- "expr in def initializer",
- 3,
- findMatchesCount(s53,s54)
- );
-
- // a.class expression search
- assertEquals(
- "a.class pattern",
- findMatchesCount(s55,s56),
- 1
- );
-
- String complexCode = "interface I { void b(); } interface I2 extends I {} class I3 extends I {} " +
- "class A implements I2 { void b() {} } class B implements I3 { void b() {}} " +
- "I2 a; I3 b; a.b(); b.b(); b.b(); A c; B d; c.b(); d.b(); d.b(); ";
-
- String exprTypePattern1 = "'t:[exprtype( I2 )].b();";
- String exprTypePattern2 = "'t:[!exprtype( I2 )].b();";
-
- String exprTypePattern3 = "'t:[exprtype( *I2 )].b();";
- String exprTypePattern4 = "'t:[!exprtype( *I2 )].b();";
-
- assertEquals(
- "expr type condition",
- findMatchesCount(complexCode,exprTypePattern1),
- 1
- );
-
- assertEquals(
- "expr type condition 2",
- 5,
- findMatchesCount(complexCode,exprTypePattern2)
- );
-
- assertEquals(
- "expr type condition 3",
- findMatchesCount(complexCode,exprTypePattern3),
- 2
- );
-
- assertEquals(
- "expr type condition 4",
- findMatchesCount(complexCode,exprTypePattern4),
- 4
- );
-
- String complexCode2 = "enum X { XXX, YYY }\n class C { static void ordinal() {} void test() { C c; c.ordinal(); c.ordinal(); X.XXX.ordinal(); } }";
- assertEquals(
- "expr type condition with enums",
- findMatchesCount(complexCode2, "'t:[exprtype( *java\\.lang\\.Enum )].ordinal()"),
- 1
- );
-
- assertEquals(
- "no smart detection of search target",
- findMatchesCount("processInheritors(1,2,3,4); processInheritors(1,2,3); processInheritors(1,2,3,4,5,6);","'instance?.processInheritors('_param1{1,6});"),
- 3
- );
-
- String arrays = "int[] a = new int[20];\n" +
- "byte[] b = new byte[30]";
- String arrayPattern = "new int[$a$]";
- assertEquals(
- "Improper array search",
- 1,
- findMatchesCount(arrays,arrayPattern)
- );
-
- String someCode = "a *= 2; a+=2;";
- String otherCode = "a *= 2;";
-
- assertEquals(
- "Improper *= 2 search",
- 1,
- findMatchesCount(someCode,otherCode)
- );
-
- String s1 = "Thread t = new Thread(\"my thread\",\"my another thread\") {\n" +
- " public void run() {\n" +
- " // do stuff\n" +
- " }\n" +
- "}";
- String s2 = "new Thread('args*) { '_Other* }";
-
- assertEquals(
- "Find inner class parameters",
- 2,
- findMatchesCount(s1,s2)
- );
-
- String s3 = "Thread t = new Thread(\"my thread\") {\n" +
- " public void run() {\n" +
- " // do stuff\n" +
- " }\n" +
- "};";
- String s4 = "new Thread($args$)";
-
- assertEquals(
- "Find inner class by new",
- 1,
- findMatchesCount(s3,s4)
- );
-
- String s5 = "class A {\n" +
- "public static <T> T[] copy(T[] array, Class<T> aClass) {\n" +
- " int i = (int)0;\n" +
- " int b = (int)0;\n" +
- " return (T[])array.clone();\n" +
- " }\n" +
- "}";
- String s6 = "($T$[])$expr$";
-
- assertEquals(
- "Find cast to array",
- 1,
- findMatchesCount(s5,s6)
- );
-
- String s7 = "import java.math.BigDecimal;\n" +
- "\n" +
- "public class Prorator {\n" +
- " public void prorate(BigDecimal[] array) {\n" +
- " // do nothing\n" +
- " }\n" +
- " public void prorate2(java.math.BigDecimal[] array) {\n" +
- " // do nothing\n" +
- " }\n" +
- " public void prorate(BigDecimal bd) {\n" +
- " // do nothing\n" +
- " }\n" +
- "\n" +
- " public static void main(String[] args) {\n" +
- " BigDecimal[] something = new BigDecimal[2];\n" +
- " java.math.BigDecimal[] something2 = new BigDecimal[2];\n" +
- " something[0] = new BigDecimal(1.0);\n" +
- " something[1] = new BigDecimal(1.0);\n" +
- "\n" +
- " Prorator prorator = new Prorator();\n" +
- "\n" +
- "// ---------------------------------------------------\n" +
- "// the line below should've been found, in my opinion.\n" +
- "// --------------------------------------------------\n" +
- " prorator.prorate(something);\n" +
- " prorator.prorate(something2);\n" +
-
- " prorator.prorate(something[0]);\n" +
- " prorator.prorate(something[1]);\n" +
- " prorator.prorate(something[0]);\n" +
- " }\n" +
- "}";
- String s8 = "'_Instance.'_MethodCall:[regex( prorate )]('_Param:[exprtype( BigDecimal\\[\\] )]) ";
-
- assertEquals(
- "Find method call with array for parameter expr type",
- 2,
- findMatchesCount(s7,s8,true)
- );
-
- String s13 = "try { } catch(Exception e) { e.printStackTrace(); }";
- String s14 = "'_Instance.'_MethodCall('_Parameter*)";
-
- assertEquals(
- "Find statement in catch",
- 1,
- findMatchesCount(s13,s14)
- );
-
- String s9 = "int a[] = new int[] { 1,2,3,4};\n" +
- "int b[] = { 2,3,4,5 };\n" +
- "Object[] c = new Object[] { \"\", null};";
- String s10 = "new '_ []{ '_* }";
- String s10_2 = "new int []{ '_* }";
-
- assertEquals(
- "Find array instatiation",
- 3,
- findMatchesCount(s9,s10)
- );
-
- assertEquals(
- "Find array instatiation, 2",
- 2,
- findMatchesCount(s9,s10_2)
- );
- }
-
- public void testLiteral() {
- String s = "class A {\n" +
- " static String a = 1;\n" +
- " static String s = \"aaa\";\n" +
- " static String s2;\n" +
- "}";
- String s2 = "static String '_FieldName = '_Init?:[!regex( \".*\" )];";
- String s2_2 = "static String '_FieldName = '_Init:[!regex( \".*\" )];";
-
- assertEquals(
- "Literal",
- 2,
- findMatchesCount(s,s2)
- );
-
- assertEquals(
- "Literal, 2",
- 1,
- findMatchesCount(s,s2_2)
- );
- }
-
- public void testCovariantArraySearch() {
- String s1 = "String[] argv;";
- String s2 = "String argv;";
- String s3 = "'T[] argv;";
- String s3_2 = "'T:*Object [] argv;";
-
- assertEquals(
- "Find array types",
- 0,
- findMatchesCount(s1,s2)
- );
-
- assertEquals(
- "Find array types, 2",
- 0,
- findMatchesCount(s2,s1)
- );
-
- assertEquals(
- "Find array types, 3",
- 0,
- findMatchesCount(s2,s3)
- );
-
- assertEquals(
- "Find array types, 3",
- 1,
- findMatchesCount(s1,s3_2)
- );
-
- String s11 = "class A {\n" +
- " void main(String[] argv);" +
- " void main(String argv[]);" +
- " void main(String argv);" +
- "}";
- String s12 = "'_t:[regex( *Object\\[\\] ) ] '_t2";
- String s12_2 = "'_t:[regex( *Object ) ] '_t2 []";
- String s12_3 = "'_t:[regex( *Object ) ] '_t2";
-
- assertEquals(
- "Find array covariant types",
- 2,
- findMatchesCount(s11,s12)
- );
-
- assertEquals(
- "Find array covariant types, 2",
- 2,
- findMatchesCount(s11,s12_2)
- );
-
- assertEquals(
- "Find array covariant types, 3",
- 1,
- findMatchesCount(s11,s12_3)
- );
-
- String source = "class A { String ss[][]; }";
- String target = "String[][] $s$;";
- assertEquals(
- "should find multi dimensional c-style array declarations",
- 1,
- findMatchesCount(source, target)
- );
- }
-
- // @todo support back references (\1 in another reg exp or as fild member)
- //private static final String s1002 = " setSSS( instance.getSSS() ); " +
- // " setSSS( instance.SSS ); ";
- //private static final String s1003 = " 't:set(.+) ( '_.get't_1() ); ";
- //private static final String s1003_2 = " 't:set(.+) ( '_.'t_1 ); ";
-
- public void testSearchStatements() {
- assertEquals("statement search",findMatchesCount(s1,s2),1);
- assertEquals("several constructions match",findMatchesCount(s5,s4),3);
- assertFalse("several constructions 2",(findMatchesCount(s5,s6))!=0);
-
- assertEquals("several constructions 3",findMatchesCount(s7,s8),2);
- assertEquals("several constructions 4",findMatchesCount(s7,s9),2);
-
- final String s1000 = "{ lastTest = \"search for parameterized pattern\";\n" +
- " matches = testMatcher.findMatches(s14_1,s15, options);\n" +
- " if (matches.size()!=2 ) return false;\n" +
- "lastTest = \"search for parameterized pattern\";\n" +
- " matches = testMatcher.findMatches(s14_1,s15, options);\n" +
- " if (matches.size()!=2 ) return false; }";
- final String s1001 = "lastTest = '_Descr; " +
- " matches = testMatcher.findMatches('_In,'_Pattern, options);\n" +
- " if (matches.size()!='_Number ) return false;";
-
- assertEquals("several operators 5",findMatchesCount(s1000,s1001),2);
-
- assertEquals(
- "two the same statements search",
- findMatchesCount(s85,s86),
- 1
- );
-
- assertEquals(
- "search for simple call",
- findMatchesCount(s87,s88),
- 1
- );
-
- assertEquals(
- "search for simple call 2",
- findMatchesCount(s87,s88_2),
- 1
- );
-
- assertEquals(
- "search for simple call 3",
- findMatchesCount(s87,s88_3),
- 2
- );
-
- String s10015 = "DocumentListener[] listeners = getCachedListeners();";
- String s10016 = "'_Type 'Var = '_Call();";
-
- assertEquals(
- "search for definition with init",
- 1,
- findMatchesCount(s10015,s10016)
- );
-
- String s10017 = "a = b; b = c; a=a; c=c;";
- String s10018 = "'_a = '_a;";
-
- assertEquals(
- "search silly assignments",
- 2,
- findMatchesCount(s10017,s10018)
- );
-
- String s10019 = "a.b(); a.b(null); a.b(null, 1);";
- String s10020 = "a.b(null);";
-
- assertEquals(
- "search parameter",
- 1,
- findMatchesCount(s10019,s10020)
- );
-
- String s1008 = "int a, b, c, d; int a,b,c; int c,d; int e;";
- String s1009 = "int '_a{3,4};";
-
- assertEquals(
- "search many declarations",
- 2,
- findMatchesCount(s1008,s1009)
- );
-
- String s1 = "super(1,1); call(1,1); call(2,2);";
- String s2 = "super('_t*);";
-
- assertEquals(
- "search super",
- 1,
- findMatchesCount(s1,s2)
- );
-
- String s10021 = "short a = 1;\n" +
- "short b = 2;\n" +
- "short c = a.b();";
- String s10022 = "short '_a = '_b.b();";
-
- assertEquals(
- "search def init bug",
- 1,
- findMatchesCount(s10021,s10022)
- );
-
- String s10023 = "abstract class A { public abstract short getType(); }\n" +
- "A a;\n" +
- "switch(a.getType()) {\n" +
- " default:\n" +
- " return 0;\n" +
- "}\n" +
- "switch(a.getType()) {\n" +
- " case 1:\n" +
- " { return 0; }\n" +
- "}";
- String s10024 = "switch('_a:[exprtype( short )]) { '_statement*; }";
- assertEquals(
- "finding switch",
- 2,
- findMatchesCount(s10023,s10024)
- );
-
- String s10025 = "A[] a;\n" +
- "A b[];\n" +
- "A c;";
- String s10026 = "A[] 'a;";
- String s10026_2 = "A 'a[];";
-
- assertEquals(
- "array types in dcl",
- 2,
- findMatchesCount(s10025,s10026)
- );
-
- assertEquals(
- "array types in dcl 2",
- 2,
- findMatchesCount(s10025,s10026_2)
- );
-
- String s10027 = "try { a(); } catch(Exception ex) {}\n" +
- "try { a(); } finally {}\n" +
- "try { a(); } catch(Exception ex) {} finally {} \n";
- String s10028 = "try { a(); } finally {}\n";
- assertEquals(
- "finally matching",
- 2,
- findMatchesCount(s10027,s10028)
- );
-
- String s10029 = "for(String a:b) { System.out.println(a); }";
- String s10030 = "for(String a:b) { '_a; }";
- assertEquals(
- "for each matching",
- 1,
- findMatchesCount(s10029,s10030)
- );
-
- String s10031 = "try { a(); } catch(Exception ex) {} catch(Error error) { 1=1; }\n" +
- "try { a(); } catch(Exception ex) {}";
- String s10032 = "try { a(); } catch('_Type+ 'Arg+) { 'Statements*; }\n";
- assertEquals(
- "finally matching",
- 2,
- findMatchesCount(s10031,s10032)
- );
-
- String s10033 = "return x;\n" +
- "return !x;\n" +
- "return (x);\n" +
- "return (x);\n" +
- "return !(x);";
- String s10034 = "return ('a);";
- assertEquals("Find statement with parenthesized expr",2,findMatchesCount(s10033,s10034));
- }
-
- public void testSearchClass() {
- // no modifier list in interface vars
- assertEquals(
- "no modifier for interface vars",
- findMatchesCount(s43,s44),
- 3
- );
-
- // different order of access modifiers
- assertEquals(
- "different order of access modifiers",
- findMatchesCount(s45,s46),
- 1
- );
-
- // no access modifiers
- assertEquals(
- "no access modifier",
- findMatchesCount(s45,s46_2),
- 2
- );
-
- // type could differ with package
- assertEquals(
- "type differs with package",
- findMatchesCount(s47,s48),
- 2
- );
-
- // reference element could differ in package
- assertEquals(
- "reference could differ in package",
- findMatchesCount(s49,s50),
- 1
- );
-
- String s51 = "class C extends java.awt.List {} class A extends java.util.List {} class B extends java.awt.List {} ";
- String s52 = "class 'B extends '_C:java\\.awt\\.List {}";
-
- assertEquals(
- "reference could differ in package 2",
- findMatchesCount(s51,s52),
- 2
- );
-
- assertEquals(
- "method access modifier",
- findMatchesCount(s93,s94),
- 0
- );
-
- assertEquals(
- "method access modifier 2",
- findMatchesCount(s93,s94_2),
- 1
- );
-
- assertEquals(
- "field access modifier",
- findMatchesCount(s93,s94_3),
- 0
- );
-
- assertEquals(
- "field access modifier 2",
- findMatchesCount(s93,s94_4),
- 1
- );
-
- final String s127 = "class a { void b() { new c() {}; } }";
- final String s128 = "class 't {}";
- assertEquals(
- "class finds anonymous class",
- findMatchesCount(s127,s128),
- 2
- );
-
- final String s129 = "class a { public void run() {} }\n" +
- "class a2 { public void run() { run(); } }\n" +
- "class a3 { public void run() { run(); } }\n" +
- "class a4 { public void run(); }";
-
- final String s130 = "class 'a { public void run() {} }";
- final String s130_2 = "class 'a { public void run() { '_statement; } }";
- final String s130_3 = "class 'a { public void run(); }";
-
- assertEquals(
- "empty method finds empty method only",
- findMatchesCount(s129,s130),
- 1
- );
-
- assertEquals(
- "nonempty method finds nonempty method",
- findMatchesCount(s129,s130_2),
- 2
- );
-
- assertEquals(
- "nonempty method finds nonempty method",
- findMatchesCount(s129,s130_3),
- 4
- );
-
- final String s133 = "class S {\n" +
- "void cc() {\n" +
- " new Runnable() {\n" +
- " public void run() {\n" +
- " f();\n" +
- " }\n" +
- " private void f() {\n" +
- " //To change body of created methods use File | Settings | File Templates.\n" +
- " }\n" +
- " };\n" +
- " new Runnable() {\n" +
- " public void run() {\n" +
- " f();\n" +
- " }\n" +
- " private void g() {\n" +
- " //To change body of created methods use File | Settings | File Templates.\n" +
- " }\n" +
- " };\n" +
- " new Runnable() {\n" +
- " public void run() {\n" +
- " f();\n" +
- " }\n" +
- " };\n" +
- " }\n" +
- " private void f() {\n" +
- " //To change body of created methods use File | Settings | File Templates.\n" +
- " }\n" +
- "} ";
- final String s134 = "new Runnable() {\n" +
- " public void run() {\n" +
- " '_f ();\n" +
- " }\n" +
- " private void '_f ();\n" +
- " }";
- assertEquals(
- "complex expr matching",
- 1,
- findMatchesCount(s133,s134)
- );
-
- final String s135 = "abstract class My {\n" +
- " abstract void f();\n" +
- "}\n" +
- "abstract class My2 {\n" +
- " abstract void f();\n" +
- " void fg() {}\n" +
- "}";
- final String s136 = "class 'm {\n" +
- " void f();\n" +
- " '_type '_method{0,0} ('_paramtype* '_paramname* );\n" +
- "}";
- assertEquals(
- "reject method with 0 max occurence",
- findMatchesCount(s135,s136),
- 1
- );
-
- final String s137 = "abstract class My {\n" +
- " int a;\n" +
- "}\n" +
- "abstract class My2 {\n" +
- " Project b;\n" +
- "}" +
- "abstract class My3 {\n" +
- " Class clazz;"+
- " Project b = null;\n" +
- "}" +
- "abstract class My {\n" +
- " int a = 1;\n" +
- "}\n";
- final String s138 = "class 'm {\n" +
- " Project '_f{0,0} = '_t?;\n" +
- "}";
- assertEquals(
- "reject field with 0 max occurence",
- findMatchesCount(s137,s138),
- 2
- );
-
- final String s139 = "class My { boolean equals(Object o); int hashCode(); }";
- final String s139_2 = "class My { boolean equals(Object o); }";
- final String s140 = "class 'A { boolean equals(Object '_o ); int '_hashCode{0,0}:hashCode (); }";
-
- assertEquals(
- "reject method with constraint",
- findMatchesCount(s139,s140),
- 0
- );
-
- assertEquals(
- "reject field with 0 max occurence",
- findMatchesCount(s139_2,s140),
- 1
- );
-
- final String s141 = "class A { static { a = 10 } }\n" +
- "class B { { a = 10; } }\n" +
- "class C { { a = 10; } }";
- final String s142 = "class '_ { static { a = 10; } } ";
- assertEquals(
- "static block search",
- findMatchesCount(s141,s142),
- 1
- );
- }
-
- public void testParameterlessContructorSearch() {
- final String s143 = "class A { A() {} };\n" +
- "class B { B(int a) {} };\n" +
- "class C { C() {} C(int a) {} };\n" +
- "class D {}\n" +
- "class E {}";
- final String s144 = "class '_a { '_d{0,0}:[ script( \"__context__.constructor\" ) ]('_b+ '_c+); }";
- assertEquals(
- "parameterless contructor search",
- 3,
- findMatchesCount(s143,s144)
- );
- }
-
- public void testCheckScriptValidation() {
- final String s1 = "";
- final String s2 = "'_b:[script( \"^^^\" )]";
-
- try {
- final int count = findMatchesCount(s1, s2);
- assertFalse("Validation does not work", true);
- } catch (MalformedPatternException ex) {}
- }
-
- //public void testRelationBetweenVars() {
- // final String s1 = "public class Foo {\n" +
- // " public static final Logger log = Logger.getInstance(Foo.class);\n" +
- // " public static final Logger log2 = Logger.getInstance(Foo2.class);\n" +
- // " public static final Logger log3 = Logger.getInstance(Foo2.class);\n" +
- // "}";
- // final String s2 = "class '_a { static Logger 'log+ = Logger.getInstance('_b:[script( \"_a != _b\" )].class); }";
- // assertEquals(
- // "relation between vars in script",
- // 2,
- // findMatchesCount(s1,s2)
- // );
- //}
-
- public void testExprTypeWithObject() {
- String s1 = "import java.util.*;\n" +
- "class A {\n" +
- " void b() {\n" +
- " Map map = new HashMap();" +
- " class AppPreferences {}\n" +
- " String key = \"key\";\n" +
- " AppPreferences value = new AppPreferences();\n" +
- " map.put(key, value );\n" +
- " map.put(value, value );\n" +
- " map.put(\"key\", value );\n" +
- " map.put(\"key\", new AppPreferences());\n" +
- " }\n" +
- "}";
- String s2 = "'_map:[exprtype( *java\\.util\\.Map )].put('_key:[ exprtype( *Object ) ], '_value:[ exprtype( *AppPreferences ) ]);";
-
- assertEquals(
- "expr type with object",
- 4,
- findMatchesCount(s1,s2,true)
- );
- }
-
- public void testInterfaceImplementationsSearch() {
- String in = "class A implements Cloneable {\n" +
- " \n" +
- " }\n" +
- " \n" +
- " class B implements Serializable {\n" +
- " \n" +
- " }\n" +
- " \n" +
- " class C implements Cloneable,Serializable {\n" +
- " \n" +
- " }\n" +
- " class C2 implements Serializable,Cloneable {\n" +
- " \n" +
- " }\n" +
- " \n" +
- " class E extends B implements Cloneable {\n" +
- " \n" +
- " }\n" +
- " \n" +
- " class F extends A implements Serializable {\n" +
- " \n" +
- " }\n" +
- " \n" +
- " class D extends C {\n" +
- " \n" +
- " }";
- String what = "class 'A implements '_B:*Serializable , '_C:*Cloneable {}";
- assertEquals(
- "search interface within hierarchy",
- 5,
- findMatchesCount(in, what)
- );
- }
-
- public void testSearchBacktracking() {
- assertEquals(
- "backtracking greedy regexp",
- findMatchesCount(s89,s90),
- 1
- );
-
- assertEquals(
- "backtracking greedy regexp 2",
- findMatchesCount(s89,s90_2),
- 1
- );
-
- assertEquals(
- "backtracking greedy regexp 3",
- findMatchesCount(s89,s90_3),
- 0
- );
-
- assertEquals(
- "counted regexp (with back tracking)",
- findMatchesCount(s89,s90_4),
- 1
- );
-
- assertEquals(
- "nongreedy regexp (counted, with back tracking)",
- findMatchesCount(s89,s90_5),
- 1
- );
-
- assertEquals(
- "nongreedy regexp (counted, with back tracking) 2",
- findMatchesCount(s89,s90_6),
- 0
- );
-
- String s1000 = "class A {\n" +
- " void _() {}\n" +
- " void a(String in, String pattern) {}\n" +
- " }";
- String s1001 = "class '_Class { \n" +
- " '_ReturnType+ 'MethodName+ ('_ParameterType* '_Parameter* );\n" +
- "}";
- assertEquals(
- "handling of no match",
- findMatchesCount(s1000,s1001),
- 2
- );
- }
-
- public void testSearchSymbol() {
- final String s131 = "a.b(); c.d = 1; ";
- final String s132 = "'T:b|d";
-
- assertEquals(
- "symbol match",
- 2,
- findMatchesCount(s131,s132)
- );
-
- final String s129 = "A a = new A();";
- final String s130 = "'Sym:A";
-
- options.setCaseSensitiveMatch(true);
- assertEquals(
- "case sensitive match",
- findMatchesCount(s129,s130),
- 2
- );
-
- options.setDistinct(true);
- assertEquals(
- "case sensitive disitinct match",
- findMatchesCount(s129,s130),
- 1
- );
-
- options.setDistinct(false);
-
- final String s133 = "class C { int a; int A() { a = 1; }} void c(int a) { a = 2; }";
- final String s133_2 = "class C { int a() {} int A() { a(1); }}";
- final String s134 = "a";
-
- List<MatchResult> results = findMatches(s133, s134, true, StdFileTypes.JAVA);
- assertEquals(
- "find sym finds declaration",
- 4, results.size()
- );
-
- assertEquals(
- "find sym finds declaration",
- 2, findMatchesCount(s133_2, s134, true)
- );
- }
-
- public void testSearchGenerics() {
- assertEquals(
- "parameterized class match",
- findMatchesCount(s81,s82),
- 2
- );
-
- assertEquals(
- "parameterized instanceof match",
- findMatchesCount(s81,s82_2),
- 1
- );
-
- assertEquals(
- "parameterized cast match",
- findMatchesCount(s81,s82_3),
- 1
- );
-
- assertEquals(
- "parameterized definition match",
- findMatchesCount(s81,s82_4),
- 3
- );
-
- assertEquals(
- "parameterized method match",
- findMatchesCount(s81,s82_5),
- 1
- );
-
- assertEquals(
- "parameterized constraint match",
- findMatchesCount(s81_2,s82_6),
- 2
- );
-
- assertEquals(
- "symbol matches parameterization",
- findMatchesCount(s81,s82_7),
- 29
- );
-
- assertEquals(
- "symbol matches parameterization 2",
- findMatchesCount(s81_2,s82_7),
- 7
- );
-
- String s81_3 = " class A {\n" +
- " public static <T> Collection<T> unmodifiableCollection(int c) {\n" +
- " return new d<T>(c);\n" +
- " }\n" +
- " static class d<E> implements Collection<E>, Serializable {\n" +
- " public <T> T[] toArray(T[] a) {return c.toArray(a);}\n" +
- " }\n" +
- "}";
- assertEquals(
- "typed symbol symbol",
- findMatchesCount(s81_3,s82_5),
- 2
- );
-
- String s81_4="class A<B> { \n" +
- " static <C> void c(D<E> f) throws R<S> {\n" +
- " if ( f instanceof G<H>) {\n" +
- " ((I<G<K>>)l).a();\n" +
- " throw new P<Q>();" +
- " }\n" +
- " }\n" +
- "} " +
- "class C {\n" +
- " void d(E f) throws Q {\n" +
- " if (g instanceof H) { a.c(); b.d(new A() {}); throw new Exception(((I)k)); }"+
- " }\n" +
- "}";
- String s82_8 = "'T<'_Subst+>";
- assertEquals(
- "typed symbol",
- findMatchesCount(s81_4,s82_8),
- 6
- );
-
- String s81_5 = "class A { HashMap<String, Integer> variable = new HashMap<String, Integer>(\"aaa\");}";
- String s82_9 = "'_Type<'_GType, '_GType2> '_instance = new '_Type<'_GType, '_GType2>('_Param);";
- assertEquals(
- "generic vars in new",
- findMatchesCount(s81_5,s82_9),
- 1
- );
- String source1 = "class Comparator<T> { private Comparator<String> c; private Comparator d; }";
- String target1 = "java.util.Comparator 'a;";
- assertEquals(
- "qualified type should not match 1",
- 0,
- findMatchesCount(source1, target1)
- );
-
- String target2 = "java.util.Comparator<String> 'a;";
- assertEquals(
- "qualified type should not match 2",
- 0,
- findMatchesCount(source1, target2)
- );
-
- // @todo typed vars constrains (super),
- // @todo generic method invocation
-
- //String s83 = "class A {} List<A> a; List b;";
- //String s84 = "'a:List 'c;";
- //String s84_2 = "'a:List\\<'_\\> 'c;";
- //String s84_3 = "'a:List(?>\\<'_\\>) 'c;";
- //
- //assertEquals(
- // "finding list",
- // findMatchesCount(s83,s84),
- // 2
- //);
- //
- //assertEquals(
- // "finding list 2",
- // findMatchesCount(s83,s84_2),
- // 1
- //);
- //
- //assertEquals(
- // "finding list 3",
- // findMatchesCount(s83,s84_3),
- // 1
- //);
- }
-
- public void testSearchSubstitutions() {
- // searching for parameterized pattern
- assertEquals("search for parameterized pattern",findMatchesCount(s14_1,s15),2);
-
- assertEquals("search for parameterized pattern 2",findMatchesCount(s14_2,s15),5);
-
- options.setRecursiveSearch(false);
-
- assertEquals("search for parameterized pattern-non-recursive",findMatchesCount(s14_1,s15),1);
-
- assertEquals("search for parameterized pattern 2-non-recursive",findMatchesCount(s14_2,s15),2);
-
- // typed vars with arrays
- assertEquals("typed pattern with array 2-non-recursive",findMatchesCount(s23,s24_2),4);
-
- options.setRecursiveSearch(true);
-
- // searching for parameterized pattern
- assertEquals("search for parameterized pattern 3",findMatchesCount(s14_2,s16),1);
-
- // searching for parameterized pattern in complex expr (with field selection)
- assertEquals("search for parameterized pattern in field selection",findMatchesCount(s17,s18_1),1);
-
- // searching for parameterized pattern in complex expr (with method call)
- assertEquals("search for parameterized pattern with method call",findMatchesCount(s17,s18_2),1);
-
- // searching for parameterized pattern in complex expr (with method call)
- assertEquals("search for parameterized pattern with method call ep.2",findMatchesCount(s17,s18_3),4);
-
- // searching for parameterized pattern in definition with initializer
- assertEquals("search for same var constraint",findMatchesCount(s19,s20),1);
-
- // searching for semi anonymous parameterized pattern in definition with initializer
- assertEquals("search for same var constraint for semi anonymous typed vars",findMatchesCount(s19,s20_2),1);
-
- // support for type var constraint
- assertEquals("search for typed var constraint",findMatchesCount(s22,s21_1),1);
-
- // noncompatible same typed var constraints
- try {
- findMatchesCount(s22,s21_2);
- assertFalse("search for noncompatible typed var constraint",false);
- } catch(MalformedPatternException e) {
- }
-
- // compatible same typed var constraints
- assertEquals("search for same typed var constraint",findMatchesCount(s22,s21_3),1);
-
- // typed var with instanceof
- assertEquals("typed instanceof",findMatchesCount(s65,s66),1);
-
- // typed vars with arrays
- assertEquals("typed pattern with array",findMatchesCount(s23,s24_1),2);
-
- // typed vars with arrays
- assertEquals("typed pattern with array 2",findMatchesCount(s23,s24_2),6);
-
- // typed vars in class name, method name, its return type, parameter type and name
- assertEquals("typed pattern in class name, method name, return type, parameter type and name",findMatchesCount(s25,s26),1);
-
- assertEquals(
- "finding interface",
- findMatchesCount(s27,s28),
- 1
- );
-
- // finding anonymous type vars
- assertEquals(
- "anonymous typed vars",
- findMatchesCount(s29,s30),
- 1
- );
-
- // finding descedants
- assertEquals(
- "finding class descendants",
- findMatchesCount(s31,s32),
- 2
- );
-
- // finding interface implementation
- assertEquals(
- "interface implementation",
- findMatchesCount(s33,s34),
- 2
- );
-
- // different order of fields and methods
- assertEquals(
- "different order of fields and methods",
- findMatchesCount(s35,s36),
- 1
- );
-
- // different order of exceptions in throws
- assertEquals(
- "differend order in throws",
- findMatchesCount(s37,s38),
- 1
- );
-
- // class pattern without extends matches pattern with extends
- assertEquals(
- "match of class without extends to class with it",
- findMatchesCount(s39,s40),
- 2
- );
-
- // class pattern without extends matches pattern with extends
- assertEquals(
- "match of class without extends to class with it, ep. 2",
- findMatchesCount(s41,s42_1),
- 2
- );
-
- // class pattern without extends matches pattern with extends
- assertEquals(
- "match of class without extends to class with it, ep 3",
- findMatchesCount(s41,s42_2),
- 2
- );
-
- // typed reference element
- assertEquals(
- "typed reference element",
- findMatchesCount(s51,s52),
- 2
- );
-
- // empty name of type var
- assertEquals(
- "empty name for typed var",
- findMatchesCount(s59,s60),
- 1
- );
-
- // comparing method with constructor
- assertEquals(
- "comparing method with constructor",
- findMatchesCount(s63,s64),
- 1
- );
-
- // comparing method with constructor
- assertEquals(
- "finding nested class",
- findMatchesCount(s63_2,s64),
- 2
- );
-
- // comparing method with constructor
- assertEquals(
- "finded nested class by special pattern",
- findMatchesCount(s63_2,s64_2),
- 1
- );
-
- assertEquals(
- "* regexp for typed var",
- findMatchesCount(s61,s62_1),
- 5
- );
-
- assertEquals(
- "+ regexp for typed var",
- findMatchesCount(s61,s62_2),
- 4
- );
-
- assertEquals(
- "? regexp for typed var",
- findMatchesCount(s61,s62_3),
- 2
- );
-
- assertEquals(
- "cast in method parameters",
- findMatchesCount(s67,s68),
- 1
- );
-
- assertEquals(
- "searching for static field in static call",
- 2,
- findMatchesCount(s69,s70)
- );
-
- assertEquals(
- "searching for static field in static call, 2",
- 2,
- findMatchesCount(s69,s70_2)
- );
-
- assertEquals(
- "* regexp for anonymous typed var",
- findMatchesCount(s61,s62_4),
- 3
- );
-
- assertEquals(
- "+ regexp for anonymous typed var",
- findMatchesCount(s61,s62_5),
- 2
- );
-
- assertEquals(
- "? regexp for anonymous typed var",
- findMatchesCount(s61,s62_6),
- 2
- );
-
- assertEquals(
- "statement inside anonymous class",
- findMatchesCount(s71,s72),
- 3
- );
-
- assertEquals(
- "clever regexp match",
- findMatchesCount(s91,s92),
- 2
- );
-
- assertEquals(
- "clever regexp match 2",
- findMatchesCount(s91,s92_2),
- 2
- );
-
- assertEquals(
- "clever regexp match 3",
- findMatchesCount(s91,s92_3),
- 2
- );
- }
-
- public void testSearchJavaDoc() {
- // javadoc comment in class
- assertEquals(
- "java doc comment in class",
- 1,
- findMatchesCount(s57,s58)
- );
-
- assertEquals(
- "java doc comment in class in file",
- 1,
- findMatchesCount(s57_2,s58,true)
- );
-
- // javadoc comment for field
- assertEquals(
- "javadoc comment for field",
- 2,
- findMatchesCount(s57, s58_2)
- );
-
- // javadoc comment for method
- assertEquals(
- "javadoc comment for method",
- 3,
- findMatchesCount(s57, s58_3)
- );
-
- // just javadoc comment search
- assertEquals(
- "just javadoc comment search",
- 4,
- findMatchesCount(s57,s58_4)
- );
-
- assertEquals(
- "XDoclet metadata",
- 2,
- findMatchesCount(s83,s84)
- );
-
- assertEquals(
- "XDoclet metadata 2",
- 1,
- findMatchesCount(s83,s84_2)
- );
-
- assertEquals(
- "optional tag value match",
- 6,
- findMatchesCount(s57, s58_5)
- );
-
- assertEquals(
- "multiple tags match +",
- 2,
- findMatchesCount(s75,s76)
- );
-
- assertEquals(
- "multiple tags match *",
- 3,
- findMatchesCount(s75, s76_2)
- );
-
- assertEquals(
- "multiple tags match ?",
- 3,
- findMatchesCount(s75, s76_3)
- );
-
- }
-
- public void testNamedPatterns() {
- String s133 = "class String1 implements java.io.Serializable { " +
- "private static final long serialVersionUID = -6849794470754667710L;" +
- "private static final ObjectStreamField[] serialPersistentFields = new ObjectStreamField[0];" +
- "}" +
- "class StringBuilder1 implements java.io.Serializable {" +
- " private void writeObject(java.io.ObjectOutputStream s)\n" +
- " throws java.io.IOException {\n" +
- " s.defaultWriteObject();\n" +
- " }" +
- "private void readObject(java.io.ObjectInputStream s)\n" +
- " throws java.io.IOException, ClassNotFoundException {\n" +
- " s.defaultReadObject();\n" +
- " }" +
- " static final long serialVersionUID = 4383685877147921099L;" +
- "}";
- String s134 = "class '_ implements '_:*Serializable {\n" +
- " static final long 'VersionField?:serialVersionUID = '_?;\n" +
- " private static final ObjectStreamField[] '_?:serialPersistentFields = '_?; \n" +
- " private void '_SerializationWriteHandler?:writeObject (ObjectOutputStream s) throws IOException;\n" +
- " private void '_SerializationReadHandler?:readObject (ObjectInputStream s) throws IOException, ClassNotFoundException;\n" +
- " Object '_SpecialSerializationReadHandler?:readResolve () throws ObjectStreamException;" +
- " Object '_SpecialSerializationWriteHandler?:writeReplace () throws ObjectStreamException;" +
- "}";
-
- assertEquals(
- "serialization match",
- findMatchesCount(s133,s134),
- 2
- );
-
- String s135 = "class SimpleStudentEventActionImpl extends Action { " +
- " public ActionForward execute(ActionMapping mapping,\n" +
- " ActionForm _form,\n" +
- " HttpServletRequest _request,\n" +
- " HttpServletResponse _response)" +
- " throws Exception {}" +
- "} " +
- "public class DoEnrollStudent extends SimpleStudentEventActionImpl { }" +
- "public class DoCancelStudent extends SimpleStudentEventActionImpl { }";
- String s136 = "public class 'StrutsActionClass extends '_*:Action {" +
- " public ActionForward '_AnActionMethod:*execute (ActionMapping '_,\n" +
- " ActionForm '_,\n" +
- " HttpServletRequest '_,\n" +
- " HttpServletResponse '_);" +
- "}";
-
- assertEquals(
- "Struts actions",
- findMatchesCount(s135,s136),
- 2
- );
-
- final String s123 = "class NodeFilter {} public class MethodFilter extends NodeFilter {\n" +
- " private MethodFilter() {}\n" +
- "\n" +
- " public static NodeFilter getInstance() {\n" +
- " if (instance==null) instance = new MethodFilter();\n" +
- " return instance;\n" +
- " }\n" +
- " private static NodeFilter instance;\n" +
- "}";
- final String s124 = "class 'Class {\n" +
- " private 'Class('_* '_*) {\n" +
- " '_*;\n" +
- " }\n" +
- " private static '_Class2:* '_Instance;\n" +
- " static '_Class2:* '_GetInstance() {\n" +
- " '_*;\n" +
- " return '_Instance;\n" +
- " }\n" +
- "}";
-
- assertEquals(
- "singleton search",
- findMatchesCount(s123,s124),
- 1
- );
-
- String s1111 = "if (true) { a=1; b=1; } else { a=1; }\n" +
- "if(true) { a=1; } else { a=1; b=1; }\n" +
- "if(true) { a=1; b=2; } else { a = 1; b=2; }";
- String s1112 = "if (true) { '_a{1,2}; } else { '_a; }";
-
- assertEquals(
- "same multiple name pattern",
- findMatchesCount(s1111,s1112),
- 1
- );
- }
-
- public void testHierarchy() {
- final String s105 = "class B {} class A extends B { }";
- final String s106 = "class '_ extends '_:[ref('T)] {}";
- assertEquals(
- "extends match",
- findMatchesCount(s105,s106),
- 1
- );
-
- final String s107 = "interface IA {} interface IB extends IA { } interface IC extends IB {} interface ID extends IC {}" +
- "class A implements IA {} class B extends A { } class C extends B implements IC {} class D extends C {}";
- final String s108 = "class '_ extends 'Type:+A {}";
- final String s108_2 = "class '_ implements 'Type:+IA {}";
-
- assertEquals(
- "extends navigation match",
- findMatchesCount(s107,s108),
- 2
- );
-
- assertEquals(
- "implements navigation match",
- 3,
- findMatchesCount(s107,s108_2)
- );
-
- final String s109 = "interface I {} interface I2 extends I {} class A implements I2 {} class B extends A { } class C extends B {} class D { void e() { C c; B b; A a;} }";
- final String s110 = "'_:*A '_;";
- final String s110_2 = "'_:*I '_;";
- final String s110_3 = "'_:*[regex( I ) && ref('T)] '_;";
- final String s110_4 = "'_:*[regex( I ) && ref2('T)] '_;";
- assertEquals(
- "extends navigation match in definition",
- findMatchesCount(s109,s110),
- 3
- );
-
- assertEquals(
- "implements navigation match in definition 2",
- findMatchesCount(s109,s110_2),
- 3
- );
-
- assertEquals(
- "implements navigation match in definition 2 with nested conditions",
- findMatchesCount(s109,s110_3),
- 1
- );
-
- try {
- findMatchesCount(s109,s110_4);
- assertFalse("implements navigation match in definition 2 with nested conditions - incorrect cond",false);
- } catch(UnsupportedPatternException ex) {}
-
- final String s111 = "interface E {} class A implements E {} class B extends A { int f = 0; } class C extends B {} class D { void e() { C c; B b; A a;} }";
- final String s112 = "'_";
- assertEquals(
- "symbol match",
- findMatchesCount(s111,s112),
- 17
- );
-
- final String s113 = "class B {int c; void d() {} } int a; B b; a = 1; b.d(); ++a; int c=a; System.out.println(a); " +
- "b.c = 1; System.out.println(b.c); b.c++;";
- final String s114 = "'_:[read]";
- final String s114_2 = "'_:[write]";
- assertEquals(
- "read symbol match",
- findMatchesCount(s113,s114),
- 11
- );
-
- assertEquals(
- "write symbol match",
- findMatchesCount(s113,s114_2),
- 5
- );
-
- final String s115 = "class B {} public class C {}";
- final String s116 = "public class '_ {}";
- assertEquals(
- "public modifier for class",
- findMatchesCount(s115,s116),
- 1
- );
-
- final String s117 = "class A { int b; void c() { int e; b=1; this.b=1; e=5; " +
- "System.out.println(e); " +
- "System.out.println(b); System.out.println(this.b);} }";
- final String s118 = "this.'Field";
- final String s118_2 = "this.'Field:[read]";
- final String s118_3 = "this.'Field:[write]";
-
- assertEquals(
- "fields of class",
- 4,
- findMatchesCount(s117,s118)
- );
-
- assertEquals(
- "fields of class read",
- findMatchesCount(s117,s118_2),
- 2
- );
-
- assertEquals(
- "fields of class written",
- findMatchesCount(s117,s118_3),
- 2
- );
-
- final String s119 = "try { a.b(); } catch(IOException e) { c(); } catch(Exception ex) { d(); }";
- final String s120 = "try { '_; } catch('_ '_) { '_; }";
- final String s120_2 = "try { '_; } catch(Throwable '_) { '_; }";
- assertEquals(
- "catches loose matching",
- findMatchesCount(s119,s120),
- 1
- );
-
- assertEquals(
- "catches loose matching 2",
- findMatchesCount(s119,s120_2),
- 0
- );
-
- final String s121 = "class A { private int a; class Inner {} } " +
- "class B extends A { private int a; class Inner2 {} }";
- final String s122 = "class '_ { int '_:* ; }";
- final String s122_2 = "class '_ { int '_:+hashCode (); }";
- final String s122_3 = "class '_ { class '_:* {} }";
- assertEquals(
- "hierarchical matching",
- findMatchesCount(s121,s122),
- 2
- );
-
- assertEquals(
- "hierarchical matching 2",
- findMatchesCount(s121,s122_2),
- 4
- );
-
- assertEquals(
- "hierarchical matching 3",
- findMatchesCount(s121,s122_3),
- 2
- );
- }
-
- public void testSearchInCommentsAndLiterals() {
- String s1 = "{" +
- "// This is some comment\n" +
- "/* This is another\n comment*/\n" +
- "// Some garbage\n"+
- "/** And now third comment*/\n" +
- "/** Some garbage*/ }";
- String s2 = "// 'Comment:[regex( .*(?:comment).* )]";
- String s3 = "/** 'Comment:[regex( .*(?:comment).* )] */";
- String s2_2 = "/* 'Comment:[regex( .*(?:comment).* )] */";
-
- assertEquals(
- "Comment matching",
- findMatchesCount(s1,s2),
- 3
- );
-
- assertEquals(
- "Comment matching, 2",
- 3,
- findMatchesCount(s1,s2_2)
- );
-
- assertEquals(
- "Java doc matching",
- findMatchesCount(s1,s3),
- 1
- );
-
- String s4 = "\"'test\", \"another test\", \"garbage\"";
- String s5 = "\"'test:[regex( .*test.* )]\"";
- String s6 = "\"''test\"";
-
- assertEquals(
- "Literal content",
- findMatchesCount(s4,s5),
- 2
- );
-
- assertEquals(
- "Literal content with escaping",
- findMatchesCount(s4,s6),
- 1
- );
-
- String s7 = "\"aaa\"";
- String s8 = "\"'test:[regex( aaa )]\"";
-
- assertEquals(
- "Simple literal content",
- findMatchesCount(s7,s8),
- 1
- );
-
- String s9 = "\" aaa \" \" bbb \" \" ccc ccc aaa\"";
- String s10 = "\"'test:[regexw( aaa|ccc )]\"";
- String s11 = "\"'test:[regexw( bbb )]\"";
-
- assertEquals(
- "Whole word literal content with alternations",
- findMatchesCount(s9,s10),
- 2
- );
-
- assertEquals(
- "Whole word literal content",
- findMatchesCount(s9,s11),
- 1
- );
-
- String s12 = "assert agentInfo != null : \"agentInfo is null\";\n" +
- "assert addresses != null : \"addresses is null\";";
- String s13 = "assert $exp$ != null : \"$exp$ is null\";";
-
- assertEquals(
- "reference to substitution in comment",
- findMatchesCount(s12,s13),
- 2
- );
-
- String s14 = "\"(some text with special chars)\"," +
- "\" some\"," +
- "\"(some)\"";
- String s15 = "\"('a:[regexw( some )])\"";
-
- assertEquals(
- "meta char in literal",
- 2,
- findMatchesCount(s14,s15)
- );
-
- String s16 = "/**\n" +
- "* Created by IntelliJ IDEA.\n" +
- "* User: cdr\n" +
- "* Date: Nov 15, 2005\n" +
- "* Time: 4:23:29 PM\n" +
- "* To change this template use File | Settings | File Templates.\n" +
- "*/\n" +
- "public class Y {\n" +
- "}";
- String s17 = "/**\n" +
- "* Created by IntelliJ IDEA.\n" +
- "* User: '_USER\n" +
- "* Date: '_DATE\n" +
- "* Time: '_TIME\n" +
- "* To change this template use File | Settings | File Templates.\n" +
- "*/\n" +
- "class 'c {\n" +
- "}";
- assertEquals(
- "complete comment match",
- 1,
- findMatchesCount(s16,s17,true)
- );
-
- String s18 = "public class A {\n" +
- " private void f(int i) {\n" +
- " int g=0; //sss\n" +
- " }\n" +
- "}";
- String s19 = "class $c$ {\n" +
- " $type$ $f$($t$ $p$){\n" +
- " $s$; // sss\n" +
- " }\n" +
- "}";
- assertEquals(
- "statement match with comment",
- 1,
- findMatchesCount(s18,s19)
- );
- }
-
- public void testOther() {
- assertEquals(
- "optional init match in definition",
- findMatchesCount(s73,s74),
- 4
- );
-
- assertEquals(
- "null match",
- findMatchesCount(s77,s78),
- 0
- );
-
- assertEquals(
- "body of method by block search",
- findMatchesCount(s79,s80),
- 2
- );
-
-
- assertEquals(
- "first matches, next not",
- findMatchesCount(s95,s96),
- 2
- );
-
- final String s97 = "class A { int c; void b() { C d; } } class C { C() { A a; a.b(); a.c=1; } }";
- final String s98 = "'_.'_:[ref('T)] ()";
- final String s98_2 = "'_.'_:[ref('T)]";
- final String s98_3 = "'_:[ref('T)].'_ ();";
- final String s98_4 = "'_:[ref('T)] '_;";
-
- assertEquals(
- "method predicate match",
- findMatchesCount(s97,s98),
- 1
- );
-
- assertEquals(
- "field predicate match",
- findMatchesCount(s97,s98_2),
- 1
- );
-
- assertEquals(
- "dcl predicate match",
- findMatchesCount(s97,s98_3),
- 1
- );
-
- final String s99 = " char s = '\\u1111'; char s1 = '\\n'; ";
- final String s100 = " char 'var = '\\u1111'; ";
- final String s100_2 = " char 'var = '\\n'; ";
- assertEquals(
- "char constants in pattern",
- findMatchesCount(s99,s100),
- 1
- );
-
- assertEquals(
- "char constants in pattern 2",
- findMatchesCount(s99,s100_2),
- 1
- );
-
- assertEquals(
- "class predicate match (from definition)",
- findMatchesCount(s97,s98_4),
- 3
- );
-
- final String s125 = "a=1;";
- final String s126 = "'t:[regex(a)]";
-
- try {
- findMatchesCount(s125,s126);
- assertFalse("spaces around reg exp check",false);
- } catch(MalformedPatternException ex) {}
-
- options.setDistinct(true);
-
- final String s101 = "class A { void b() { String d; String e; String[] f; f.length=1; f.length=1; } }";
- final String s102 = "'_:[ref('T)] '_;";
-
- assertEquals(
- "distinct match",
- findMatchesCount(s101,s102),
- 1
- );
-
- options.setDistinct(false);
-
- final String s103 = " a=1; ";
- final String s104 = "'T:{ ;";
- try {
- findMatchesCount(s103,s104);
- assertFalse("incorrect reg exp",false);
- } catch(MalformedPatternException ex) {
- }
-
- final String s106 = "$_ReturnType$ $MethodName$($_ParameterType$ $_Parameter$);";
- final String s105 = " aaa; ";
-
- try {
- findMatchesCount(s105,s106);
- assertFalse("incorrect reg exp 2",false);
- } catch(UnsupportedPatternException ex) {
- }
-
- String s107 = "class A {\n" +
- " /* */\n" +
- " void a() {\n" +
- " }" +
- " /* */\n" +
- " int b = 1;\n" +
- " /*" +
- " *" +
- " */\n" +
- " class C {}" +
- "}";
- String s108 = " /*" +
- " *" +
- " */";
-
- assertEquals("finding comments without typed var", 1, findMatchesCount(s107,s108));
-
- String s109 = "class A { void b(); int b(int c); char d(char e); }\n" +
- "A a; a.b(1); a.b(2); a.b(); a.d('e'); a.d('f'); a.d('g');";
- String s110 = "'_a.'_b:[exprtype( int ) ]('_c*);";
- assertEquals("caring about method return type", 2, findMatchesCount(s109,s110));
-
- String s111 = "class A { void getManager() { getManager(); } };\n" +
- "class B { void getManager() { getManager(); getManager(); } };";
- String s112 = "'Instance?:[exprtype( B )].getManager()";
- assertEquals("caring about missing qualifier type", 2, findMatchesCount(s111,s112));
-
- String s112a = "'Instance?:[regex( B )].getManager()";
- assertEquals("static query should not match instance method", 0, findMatchesCount(s111, s112a));
-
- String s112b = "B.getManager()";
- assertEquals("static query should not match instance method 2", 0, findMatchesCount(s111, s112b));
-
- String s113 = "class A { static void a() { a(); }}\n" +
- "class B { static void a() { a(); a(); }}\n";
- String s114 = "'_Q?:[regex( B )].a()";
- assertEquals("should care about implicit class qualifier", 2, findMatchesCount(s113, s114));
-
- String s114a = "B.a()";
- assertEquals("should match simple implicit class qualifier query", 2, findMatchesCount(s113, s114a));
-
- String s114b = "'_Q?:[exprtype( B )].a()";
- assertEquals("instance query should not match static method", 0, findMatchesCount(s113, s114b));
-
- String s115 = "class A { int a; int f() { return a; }}\n" +
- "class B { int a; int g() { return a + a; }}\n";
- String s116 = "'_Instance?:[exprtype( B )].a";
- assertEquals("should care about implicit instance qualifier", 2, findMatchesCount(s115, s116));
-
- String s116a = "A.a";
- assertEquals("should not match instance method", 0, findMatchesCount(s115, s116a));
-
- String s117 = "class A { static int a; static int f() { return a; }}\n" +
- "class B { static int a; static int g() { return a + a; }}\n";
- String s118 = "'_Q?:[regex( B )].a";
- assertEquals("should care about implicit class qualifier for field", 2, findMatchesCount(s117, s118));
-
- // b) hierarchy navigation support
- // c) or search support
-
- // e) xml search (down-up, nested query), navigation from xml representation <-> java code
- // f) impl data conversion (jdk 1.5 style) <-> other from (replace support)
-
- // Directions:
- // @todo different navigation on sub/supertyping relation (fixed depth), methods implementing interface,
- // g. like predicates
- // i. performance
- // more context for top level classes, difference with interface, etc
-
- // global issues:
- // @todo matches out of context
- // @todo proper regexp support
-
- // @todo define strict equality of the matches
- // @todo search for field selection retrieves packages also
- }
-
- public void testFQNInPatternAndVariableConstraints() {
- String s1 = "import java.awt.List;\n" +
- "class A { List l; }";
- String s1_2 = "import java.util.List;\n" +
- "class A { List l; }";
- String s2 = "class '_ { 'Type:java\\.util\\.List '_Field; }";
-
- assertEquals("No matches for qualified class",findMatchesCount(s1,s2,true),0);
- assertEquals("Matches for qualified class",findMatchesCount(s1_2,s2,true),1);
-
- String s3 = "import java.util.ArrayList;\n" +
- "class A { ArrayList l; }";
- String s4 = "class '_ { 'Type:*java\\.util\\.Collection '_Field; }";
- assertEquals("Matches for qualified class in hierarchy",findMatchesCount(s3,s4,true),1);
-
- String s5 = "import java.util.List;\n" +
- "class A { { List l = new List(); l.add(\"1\"); } }";
- String s5_2 = "import java.awt.List;\n" +
- "class A { { List l = new List(); l.add(\"1\"); } }";
- String s6 = "'a:[exprtype( java\\.util\\.List )]";
- String s6_2 = "'a:[exprtype( *java\\.util\\.Collection )]";
- String s6_3 = "java.util.List '_a = '_b?;";
-
- assertEquals("Matches for qualified expr type",findMatchesCount(s5,s6,true), 2);
- assertEquals("No matches for qualified expr type",findMatchesCount(s5_2,s6,true),0);
- assertEquals("Matches for qualified expr type in hierarchy",findMatchesCount(s5,s6_2,true), 2);
-
- assertEquals("Matches for qualified var type in pattern",findMatchesCount(s5,s6_3,true),1);
- assertEquals("No matches for qualified var type in pattern",findMatchesCount(s5_2,s6_3,true),0);
-
- String s7 = "import java.util.List;\n" +
- "class A extends List { }";
- String s7_2 = "import java.awt.List;\n" +
- "class A extends List {}";
-
- String s8 = "class 'a extends java.util.List {}";
-
- assertEquals("Matches for qualified type in pattern",findMatchesCount(s7,s8,true),1);
- assertEquals("No matches for qualified type in pattern",findMatchesCount(s7_2,s8,true),0);
-
- String s9 = "String.intern(\"1\");\n" +
- "java.util.Collections.sort(null);" +
- "java.util.Collections.sort(null);";
- String s10 = "java.lang.String.'_method ( '_params* )";
- assertEquals("FQN in class name",1,findMatchesCount(s9,s10,false));
- }
-
- public void testAnnotations() throws Exception {
- String s1 = "@MyBean(\"\")\n" +
- "@MyBean2(\"\")\n" +
- "public class TestBean {}\n" +
- "@MyBean2(\"\")\n" +
- "@MyBean(\"\")\n" +
- "public class TestBean2 {}\n" +
- "public class TestBean3 {}\n";
- String s2 = "@MyBean(\"\")\n" +
- "@MyBean2(\"\")\n" +
- "public class $a$ {}\n";
-
- assertEquals("Simple find annotated class",2,findMatchesCount(s1,s2,false));
-
- String s3 = "@VisualBean(\"????????? ?????????? ? ??\")\n" +
- "public class TestBean\n" +
- "{\n" +
- " @VisualBeanField(\n" +
- " name = \"??? ????????????\",\n" +
- " initialValue = \"?????????????\"\n" +
- " )\n" +
- " public String user;\n" +
- "\n" +
- " @VisualBeanField(\n" +
- " name = \"??????\",\n" +
- " initialValue = \"\",\n" +
- " fieldType = FieldTypeEnum.PASSWORD_FIELD\n" +
- " )\n" +
- " public String password;\n" +
- "\n" +
- " @VisualBeanField(\n" +
- " initialValue = \"User\",\n" +
- " name = \"????? ???????\",\n" +
- " name = \"Second name\",\n" +
- " fieldType = FieldTypeEnum.COMBOBOX_FIELD,\n" +
- " comboValues = {\n" +
- " @ComboFieldValue(\"Administrator\"),\n" +
- " @ComboFieldValue(\"User\"),\n" +
- " @ComboFieldValue(\"Guest\")}\n" +
- " ) \n" +
- " public String accessRights;\n" +
- " \n" +
- " public String otherField;\n" +
- "}";
- String s4 = "class '_a {\n" +
- " @'_Annotation+ ( 'AnnotationMember*:name = '_AnnotationValue* )\n" +
- " String '_field* ;\n" +
- "}";
- String s4_2 = "class '_a {\n" +
- " @'_Annotation+ ()\n" +
- " String 'field* ;\n" +
- "}";
-
- assertEquals("Find annotation members of annotated field class",4,findMatchesCount(s3,s4,false));
- assertEquals("Find annotation fields",3,findMatchesCount(s3,s4_2,false));
-
- String s5 = "class A {" +
- " @NotNull private static Collection<PsiElement> resolveElements(final PsiReference reference, final Project project) {}\n" +
- " @NotNull private static Collection resolveElements2(final PsiReference reference, final Project project) {}\n" +
- "}";
- String s6 = "class '_c {@NotNull '_rt 'method* ('_pt* '_p*){ '_inst*; } }";
- String s6_2 = "class '_c {@'_:NotNull '_rt 'method* ('_pt* '_p*){ '_inst*; } }";
-
- assertEquals("Find annotated methods",2,findMatchesCount(s5,s6));
- assertEquals("Find annotated methods, 2",2,findMatchesCount(s5,s6_2));
-
- String s7 = "class A { void message(@NonNls String msg); }\n" +
- "class B { void message2(String msg); }\n" +
- "class C { void message2(String msg); }";
- String s8 = "class '_A { void 'b( @'_Ann{0,0}:NonNls String '_); }";
- assertEquals("Find not annotated methods",2,findMatchesCount(s7,s8));
-
- String s9 = "class A {\n" +
- " Object[] method1() {}\n" +
- " Object method1_2() {}\n" +
- " Object method1_3() {}\n" +
- " Object method1_4() {}\n" +
- " @MyAnnotation Object[] method2(int a) {}\n" +
- " @NonNls Object[] method3() {}\n" +
- "}";
- String s10 = "class '_A { @'_Ann{0,0}:NonNls '_Type:Object\\[\\] 'b+( '_pt* '_p* ); }";
- String s10_2 = "class '_A { @'_Ann{0,0}:NonNls '_Type [] 'b+( '_pt* '_p* ); }";
- String s10_3 = "class '_A { @'_Ann{0,0}:NonNls '_Type:Object [] 'b+( '_pt* '_p* ); }";
- assertEquals("Find not annotated methods, 2",2,findMatchesCount(s9,s10));
- assertEquals("Find not annotated methods, 2",2,findMatchesCount(s9,s10_2));
- assertEquals("Find not annotated methods, 2",2,findMatchesCount(s9,s10_3));
-
- String s11 = "class A {\n" +
- "@Foo(value=baz) int a;\n" +
- "@Foo(value=baz2) int a2;\n" +
- "@Foo(value=baz2) int a3;\n" +
- "@Foo(value2=baz3) int a3;\n" +
- "@Foo(value2=baz3) int a3;\n" +
- "@Foo(value2=baz3) int a3;\n" +
- "@Foo(value2=baz4) int a3;\n" +
- "}";
- String s12 = "@Foo(value=baz) int 'a;)";
- String s12_2 = "@Foo(value='baz:baz2 ) int 'a;)";
- String s12_3 = "@Foo('value:value2 = baz3 ) int 'a;)";
- String s12_4 = "@Foo('value:value2 = 'baz3:baz3 ) int 'a;)";
- String s12_5 = "@Foo('value:value2 = 'baz3:baz ) int 'a;)";
- String s12_6 = "@Foo('value:value2 = 'baz3 ) int 'a;)";
-
- assertEquals("Find anno parameter value",1,findMatchesCount(s11,s12));
- assertEquals("Find anno parameter value",2,findMatchesCount(s11,s12_2));
- assertEquals("Find anno parameter value",3,findMatchesCount(s11,s12_3));
- assertEquals("Find anno parameter value",3,findMatchesCount(s11,s12_4));
- assertEquals("Find anno parameter value",0,findMatchesCount(s11,s12_5));
- assertEquals("Find anno parameter value",4,findMatchesCount(s11,s12_6));
- }
-
- public void testBoxingAndUnboxing() {
- String s1 = " class A { void b(Integer i); void b2(int i); void c(int d); void c2(Integer d); }\n" +
- "A a;\n" +
- "a.b2(1)\n;" +
- "a.b2(1)\n;" +
- "a.b(1)\n;" +
- "a.b( new Integer(0) )\n;" +
- "a.b( new Integer(0) )\n;" +
- "a.c(new Integer(2));\n" +
- "a.c(new Integer(3));\n" +
- "a.c2(new Integer(3));\n" +
- "a.c(3);";
- String s2 = "a.'b('_Params:[formal( Integer ) && exprtype( int ) ])";
- String s2_2 = "a.c('_Params:[formal( int ) && exprtype( Integer ) ])";
-
- assertEquals("Find boxing in method call",1,findMatchesCount(s1,s2,false));
- assertEquals("Find unboxing in method call",2,findMatchesCount(s1,s2_2,false));
- }
-
- public void testCommentsInDclSearch() {
- String s1 = "class A {\n" +
- " int a; // comment\n" +
- " char b;\n" +
- " int c; // comment2\n" +
- "}";
- String s1_2 = "class A {\n" +
- " // comment\n" +
- " int a;\n" +
- " char b;\n" +
- " // comment2\n" +
- " int c;\n" +
- "}";
-
- String s2 = "'_Type '_Variable = '_Value?; //'Comment";
- String s2_2 = "//'Comment\n" +
- "'_Type '_Variable = '_Value?;";
-
- assertEquals("Find field by dcl with comment",2,findMatchesCount(s1,s2));
- assertEquals("Find field by dcl with comment 2",2,findMatchesCount(s1_2,s2_2));
- }
-
- public void testSearchingEmptyModifiers() {
-
- String s1 = "class A {\n" +
- " int a;\n" +
- " private char b;\n" +
- " private char b2;\n" +
- " public int c;\n" +
- " public int c2;\n" +
- "}";
- String s2 = "@Modifier(\"packageLocal\") '_Type '_Variable = '_Value?;";
- String s2_2 = "@Modifier({\"packageLocal\",\"private\"}) '_Type '_Variable = '_Value?;";
- String s2_3 = "@Modifier({\"PackageLocal\",\"private\"}) '_Type '_Variable = '_Value?;";
-
- assertEquals("Finding package local dcls",1,findMatchesCount(s1,s2));
- assertEquals("Finding package local dcls",3,findMatchesCount(s1,s2_2));
-
- try {
- findMatchesCount(s1,s2_3);
- assertTrue("Finding package local dcls",false);
- } catch(MalformedPatternException ex) {
-
- }
-
- String s3 = "class A {\n" +
- " int a;\n" +
- " static char b;\n" +
- " static char b2;\n" +
- "}";
- String s4 = "@Modifier(\"Instance\") '_Type '_Variable = '_Value?;";
- String s4_2 = "@Modifier({\"static\",\"Instance\"}) '_Type '_Variable = '_Value?;";
- assertEquals("Finding instance fields",1,findMatchesCount(s3,s4));
- assertEquals("Finding all fields",3,findMatchesCount(s3,s4_2));
-
- String s5 = "class A {}\n" +
- "abstract class B {}\n" +
- "final class C {}\n" +
- "class D {}";
- String s6 = "@Modifier(\"Instance\") class 'Type {}";
- String s6_2 = "@Modifier({\"abstract\",\"final\",\"Instance\"}) class 'Type {}";
- assertEquals("Finding instance classes",3,findMatchesCount(s5,s6));
- assertEquals("Finding all classes",4,findMatchesCount(s5,s6_2));
- }
-
- public void testSearchTransientFieldsWithModifier() {
- String source =
- "public class TestClass {\n" +
- " transient private String field1;\n" +
- " transient String field2;\n" +
- " String field3;\n" +
- "}";
-
- String template = "transient @Modifier(\"packageLocal\") '_Type '_Variable = '_Value?;";
-
- assertEquals("Finding package-local transient fields", 1, findMatchesCount(source, template));
- }
-
- public void test() {
- String s1 = "if (LOG.isDebugEnabled()) {\n" +
- " int a = 1;\n" +
- " int a = 1;\n" +
- "}";
- String s2 = "if ('_Log.isDebugEnabled()) {\n" +
- " '_ThenStatement;\n" +
- " '_ThenStatement;\n" +
- "}";
- assertEquals("Comparing declarations",1,findMatchesCount(s1,s2));
- }
-
- public void testFindStaticMethodsWithinHierarchy() {
- String s1 = "class A {}\n" +
- "class B extends A { static void foo(); }\n" +
- "class B2 extends A { static void foo(int a); }\n" +
- "class B3 extends A { static void foo(int a, int b); }\n" +
- "class C { static void foo(); }\n" +
- "B.foo();\n" +
- "B2.foo(1);\n" +
- "B3.foo(2,3);\n" +
- "C.foo();";
- String s2 = "'_Instance:[regex( *A )].'_Method:[regex( foo )] ( '_Params* )";
- assertEquals("Find static methods within expr type hierarchy", 3, findMatchesCount(s1,s2));
- }
-
- public void testFindClassesWithinHierarchy() {
- String s1 = "class A implements I {}\n" +
- "interface I {}\n" +
- "class B extends A implements I { }\n" +
- "class B2 implements I { }\n" +
- "class B3 extends A { }\n" +
- "class C extends B2 { static void foo(); }\n";
- String s2 = "class '_ extends '_Extends:[!regex( *A )] implements '_Implements:[regex( I )] {}";
- String s2_2 = "class '_ extends '_Extends:[!regex( *A )]{}";
- assertEquals("Find class within type hierarchy with not", 1, findMatchesCount(s1,s2));
- assertEquals("Find class within type hierarchy with not, 2", 1, findMatchesCount(s1,s2_2));
- }
-
- public void testFindTryWithoutProperFinally() {
- String s1 = "try {\n" +
- " conn = 1;\n" +
- "} finally {\n" +
- " conn.close();\n" +
- "}\n" +
- "try {\n" +
- " conn = 1;\n" +
- "} finally {\n" +
- " int a = 1;\n" +
- "}\n" +
- "try {\n" +
- " conn = 1;\n" +
- "} finally {\n" +
- " int a = 1;\n" +
- "}";
- String s2 = "try { '_StatementBefore*; '_Dcl:[regex( conn = 1 )]; '_StatementAfter*; } finally { '_Finally*:[!regex( .*conn.* ) ]; }";
- assertEquals("FindTryWithoutProperFinally", 2, findMatchesCount(s1,s2));
- }
-
- public void testBug() {
- String s1 = "public class DiallingNumber extends DataGroup\n" + "{\n" + " protected static byte [] CLEAR = { };\n" + "\n" +
- " private static DataItemTemplate template;\n" + "\n" + "\tprotected DataTemplate createDefaultTemplate()\n" + "\t{\n" +
- " return null;\n" + " }\n" + "}";
- String s2 = "class '_Class {\n" + " static '_FieldType '_FieldName:.*template.* = '_FieldInitial?;\n" +
- " '_RetType createDefaultTemplate() { '_Statements*; }\n" + "\t'_Content*\n" + "}";
- assertEquals("Bug in class matching", 1, findMatchesCount(s1,s2));
- }
-
- //public void testFindFieldUsageByQName() {
- // String s1 = "{ class A { int b; { b = 1; } } class B extends A { { this.b = 2} } { B i; i.b = 3; } }";
- // String s2 = "A.b";
- // assertEquals( 3, findMatchesCount(s1,s2));
- //}
- //
- //public void testFindMethodUsageByQName() {
- // String s1 = "{ class A { void b(int a) {} { b(1); } } class B extends A { { this.b(2); } } { B i; i.b(3); } }";
- // String s2 = "A.b";
- // assertEquals( 3, findMatchesCount(s1,s2));
- //}
-
- public void _testStaticInstanceInitializers() {
- String s1 = "public class DiallingNumber {\n static { int a = 1; } static { int b = 1; } { int c = 2; }}";
- String s2 = "class '_Class {\n" + " static { 't*; } }";
- String s2_2 = "class '_Class {\n" + " { 't*; } }";
- String s2_3 = "class '_Class {\n" + " @Modifier(\"Instance\") { 't*; } }";
- assertEquals("Static / instance initializers", 2, findMatchesCount(s1,s2));
- assertEquals("Static / instance initializers", 1, findMatchesCount(s1,s2_3));
- assertEquals("Static / instance initializers", 3, findMatchesCount(s1,s2_2));
- }
-
- @NotNull
- @Override
- protected String getTestDataPath() {
- return PluginPathManager.getPluginHomePath("structuralsearch") + "/testData/java/";
- }
-
- public void testDoNotFindReturn() throws IOException {
- String s1 = loadFile(getTestName(false) + ".java");
- String s2 = "ApplicationManager.getApplication().runReadAction(new Runnable() {\n" +
- " public void run() {\n" +
- " 't*:[ !regex( .*return.* ) ];\n" +
- " }});";
- assertEquals(0, findMatchesCount(s1,s2));
- }
-
- public void testDownUpMatch() {
- String s1 = "class A {\n" +
- " int bbb(int c, int ddd, int eee) {\n" +
- " int a = 1;\n" +
- " try { int b = 1; } catch(Type t) { a = 2; } catch(Type2 t2) { a = 3; }\n" +
- " }\n" +
- "}";
- String s2 = "try { '_st*; } catch('_Type 't+) { '_st2*; }";
-
- final List<PsiVariable> vars = new ArrayList<PsiVariable>();
- final PsiFile file = PsiFileFactory.getInstance(getProject()).createFileFromText("_.java", s1);
-
- file.acceptChildren(new JavaRecursiveElementWalkingVisitor() {
- @Override public void visitVariable(final PsiVariable variable) {
- super.visitVariable(variable);
- vars.add(variable);
- }
- });
-
- assertEquals(7, vars.size());
- List<MatchResult> results = new ArrayList<MatchResult>();
-
- Matcher testMatcher = new Matcher(getProject());
- MatchOptions options = new MatchOptions();
- options.setSearchPattern(s2);
- MatcherImplUtil.transform(options);
- options.setFileType(StdFileTypes.JAVA);
-
- for(PsiVariable var:vars) {
- final MatchResult matchResult = testMatcher.isMatchedByDownUp(var, options);
- if (matchResult != null) results.add(matchResult);
- assertTrue(
- (var instanceof PsiParameter && var.getParent() instanceof PsiCatchSection && matchResult != null) ||
- matchResult == null
- );
- }
-
- assertEquals(2, results.size());
- MatchResult result = results.get(0);
- assertEquals("t", result.getMatchImage());
-
- result = results.get(1);
- assertEquals("t2", result.getMatchImage());
-
- results.clear();
- String s2_2 = "try { '_st*; } catch('Type:Type2 '_t) { '_st2*; }";
-
- options.clearVariableConstraints();
- options.setSearchPattern(s2_2);
- MatcherImplUtil.transform(options);
-
- for(PsiVariable var:vars) {
- final PsiTypeElement typeElement = var.getTypeElement();
- final MatchResult matchResult = testMatcher.isMatchedByDownUp(typeElement, options);
- if (matchResult != null) results.add(matchResult);
- assertTrue(
- (var instanceof PsiParameter && var.getParent() instanceof PsiCatchSection && matchResult != null) ||
- matchResult == null
- );
- }
-
- assertEquals(1, results.size());
-
- result = results.get(0);
- assertEquals("Type2", result.getMatchImage());
- }
-
- @Bombed(day = 28, description = "support it", month = Calendar.JULY, user = "maxim.mossienko")
- public void _testContainsPredicate() {
- String s1 = "{{\n" +
- " int a;\n" +
- " a = 1;\n" +
- "}\n" +
- "{\n" +
- " int b = 1;\n" +
- " b = 1;\n" +
- "}\n" +
- "{\n" +
- " int c = 2;\n" +
- " c = 2;\n" +
- "}}";
- String s2 = "{\n" +
- " '_a*:[contains( \"'type $a$ = $b$;\" )];\n" +
- "}";
-
- String s2_2 = "{\n" +
- " '_a*:[!contains( \"$type$ $a$ = $b$;\" )];\n" +
- "}";
-
- assertEquals(2, findMatchesCount(s1, s2));
- assertEquals(1, findMatchesCount(s1, s2_2));
- }
-
- public void testWithinPredicate() {
- String s1 = "if (true) {\n" +
- " int a = 1;\n" +
- "}\n" +
- "if (true) {\n" +
- " int b = 1;\n" +
- "}\n" +
- "while(true) {\n" +
- " int c = 2;\n" +
- "}";
- String s2 = "'_type 'a:[within( \"if ('_a) { '_st*; }\" )] = '_b;";
- String s2_2 = "'_type 'a:[!within( \"if ('_a) { '_st*; }\" )] = '_b;";
-
- assertEquals(2,findMatchesCount(s1, s2));
- assertEquals(1,findMatchesCount(s1, s2_2));
-
- // TODO: xxx
- //String s3 = "if (true) {\n" +
- // " if (true) return;\n" +
- // " int a = 1;\n" +
- // "}\n else if (true) {\n" +
- // " return;\n" +
- // "}";
- //assertEquals(2,findMatchesCount(s3, s2));
- //assertEquals(1,findMatchesCount(s3, s2_2));
- }
-
- public void testWithinPredicate2() {
- String s3 = "class C {\n" +
- " void aaa() {\n" +
- " LOG.debug(true);\n" +
- " LOG.debug(true);\n" +
- " LOG.debug(true);\n" +
- " LOG.debug(true);\n" +
- " LOG.debug(true);\n" +
- " if (true) {\n" +
- " LOG.debug(true);\n" +
- " }\n" +
- " if (true) LOG.debug(true);\n" +
- " if (true) { int 1 = 1; } else { LOG.debug(true); }\n" +
- " }" +
- "}";
- String s4 = "LOG.debug('_params*:[!within( \"if('_a) { 'st*; }\" )]);";
-
- assertEquals(6,findMatchesCount(s3, s4));
- }
-
- public void testMultiStatementPatternWithTypedVariable() throws Exception {
- String s = "Integer i;\ni.valueOf();";
- String s_2 = "Integer i;\nint a = 1;\ni.valueOf();";
- String s2 = "Integer '_i;\n'_i.valueOf();";
- String s2_2 = "Integer '_i;\n'_st; '_i.valueOf();";
- String s2_3 = "Integer '_i;\n'_st*; '_i.valueOf();";
-
- assertEquals(1, findMatchesCount(s,s2));
- assertEquals(1, findMatchesCount(s_2,s2_2));
- assertEquals(1, findMatchesCount(s_2,s2_3));
- assertEquals(1, findMatchesCount(s,s2_3));
- }
-
- public void testFindAnnotationDeclarations() throws Exception {
- String s = "interface Foo {} interface Bar {} @interface X {}";
- String s2 = "@interface 'x {}";
-
- assertEquals(1, findMatchesCount(s,s2));
- }
-
- public void testFindEnums() throws Exception {
- String s = "class Foo {} class Bar {} enum X {}";
- String s2 = "enum 'x {}";
-
- assertEquals(1, findMatchesCount(s,s2));
- }
-
- public void testFindDeclaration() throws Exception {
- String s = "public class F {\n" +
- " static Category cat = Category.getInstance(F.class.getName());\n" +
- " Category cat2 = Category.getInstance(F.class.getName());\n" +
- " Category cat3 = Category.getInstance(F.class.getName());\n" +
- "}";
- String s2 = "static $Category$ $cat$ = $Category$.getInstance($Arg$);";
-
- assertEquals(1, findMatchesCount(s,s2));
- }
-
- public void testFindMethodCallWithTwoOrThreeParameters() {
- String source = "{ String.format(\"\"); String.format(\"\", 1); String.format(\"\", 1, 2); String.format(\"\", 1, 2, 3); }";
- String pattern = "'_Instance.'_MethodCall('_Parameter{2,3})";
-
- assertEquals(2, findMatchesCount(source, pattern));
- }
-
- public void testFindMethodWithCountedExceptionsInThrows() {
- String source = "class A {" +
- " void a() {}" +
- " void b() throws E1 {}" +
- " void c() throws E1, E2{}" +
- " void d() throws E1, E2, E3 {}" +
- "}";
-
- String pattern1 = "class '_A {" +
- " '_type+ 'method+ () throws '_E{0,0}" +
- "}";
- assertEquals(1, findMatchesCount(source, pattern1));
-
- String pattern2 = "class '_A {" +
- " '_type+ 'method+ () throws '_E{1,2}" +
- "}";
- assertEquals(2, findMatchesCount(source, pattern2));
-
- String pattern3 = "class '_A {" +
- " '_type+ 'method+ () throws '_E{2,2}" +
- "}";
- assertEquals(1, findMatchesCount(source, pattern3));
-
- String pattern4 = "class '_A {" +
- " '_type+ 'method+ () throws '_E{0,0}:[ regex( E2 )]" +
- "}";
- assertEquals(2, findMatchesCount(source, pattern4));
- }
-
- public void testFindMethodsCalledWithinClass() {
- String source = "class A {" +
- " void a() {}" +
- " static void b() {}" +
- " void c() {" +
- " a();" +
- " b();" +
- " }" +
- "}" +
- "class B extends A {" +
- " void d() {" +
- " a();" +
- " b();" +
- " }" +
- "}";
- String pattern1 = "this.a()";
- assertEquals(2, findMatchesCount(source, pattern1));
- }
-
- public void testFindReferenceWithParentheses() {
- String source = "class A {" +
- " String value;" +
- " A(String v) {" +
- " value = (value);" +
- " System.out.println(((2)));" +
- " System.out.println(2);" +
- " }" +
- "}";
-
- String pattern1 = "'_value='_value";
- assertEquals(1, findMatchesCount(source, pattern1));
-
- String pattern2 = "System.out.println('_v);" +
- "System.out.println('_v);";
- assertEquals(1, findMatchesCount(source, pattern2));
- }
-
- public void testFindSelfAssignment() {
- String source = "class A {" +
- " protected String s;" +
- " A(String t) {" +
- " this.s = s;" +
- " t = t;" +
- " s = this.s;" +
- " }" +
- //"}" +
- //"class B {" +
- //" B(String t) {" +
- //" super.s = s;" + // would be nice if found also
- //" }" +
- "}";
-
- String pattern = "'_var='_var";
- assertEquals(3, findMatchesCount(source, pattern));
- }
-
- public void testFindLambdas() {
- String source = "public interface IntFunction<R> {" +
- " R apply(int value);" +
- "}" +
- "public interface Function<T, R> {" +
- " R apply(T t);" +
- "}" +
- "class A {" +
- " void m() {" +
- " Runnable q = () -> { /*comment*/ };" +
- " Runnable r = () -> { System.out.println(); };" +
- " IntFunction<String> f = a -> \"hello\";" +
- " Function<String, String> g = a -> \"world\";" +
- " }" +
- "}";
-
- String pattern1 = "() ->";
- assertEquals("should find lamdas", 4, findMatchesCount(source, pattern1));
-
- String pattern2 = "(int '_a) -> {}";
- assertEquals("should find lambdas with specific parameter type", 1, findMatchesCount(source, pattern2));
-
- String pattern3 = "('_a{0,0})->{}";
- assertEquals("should find lambdas without any parameters", 2, findMatchesCount(source, pattern3));
-
- String pattern4 = "()->System.out.println()";
- assertEquals("should find lambdas with matching body", 1, findMatchesCount(source, pattern4));
-
- String pattern5 = "()->{/*comment*/}";
- assertEquals("should find lambdas with comment body", 1, findMatchesCount(source, pattern5));
- }
-
- public void testFindDefaultMethods() {
- String source = "interface XYZ {" +
- " default void m() {" +
- " System.out.println();" +
- " }" +
- " void f();" +
- " void g();" +
- "}" +
- "interface ABC {" +
- " void m();" +
- "}";
-
- String pattern1 = "interface '_Class { default '_ReturnType+ 'MethodName+('_ParameterType* '_Parameter*);}";
- assertEquals("should find default method", 1, findMatchesCount(source, pattern1));
-
- String pattern2 = "interface 'Class { default '_ReturnType+ '_MethodName{0,0}('_ParameterType* '_Parameter*);}";
- assertEquals("should find interface without default methods", 1, findMatchesCount(source, pattern2));
- }
-
- public void testFindMethodReferences() {
- String source = "class A {" +
- " Runnable r = System.out::println;" +
- " Runnable s = this::hashCode;" +
- " Runnable t = this::new;" +
- " static {" +
- " System.out.println();" +
- " }" +
- "}";
-
- String pattern1 = "System . out :: println";
- assertEquals("should find method reference", 1, findMatchesCount(source, pattern1));
-
- String pattern2 = "this::'_a";
- assertEquals("should find method reference 2", 2, findMatchesCount(source, pattern2));
-
- String pattern3 = "'_a::'_b";
- assertEquals("should find all method references", 3, findMatchesCount(source, pattern3));
- }
-}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/ConflictedSvnChange.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/ConflictedSvnChange.java
index 27b1b36800fe..e8361b0eb874 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/ConflictedSvnChange.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/ConflictedSvnChange.java
@@ -19,16 +19,15 @@ import com.intellij.openapi.vcs.FilePath;
import com.intellij.openapi.vcs.FileStatus;
import com.intellij.openapi.vcs.changes.Change;
import com.intellij.openapi.vcs.changes.ContentRevision;
-import org.tmatesoft.svn.core.internal.wc.SVNTreeConflictUtil;
-import org.tmatesoft.svn.core.wc.SVNTreeConflictDescription;
+import org.jetbrains.idea.svn.conflict.TreeConflictDescription;
import javax.swing.*;
public class ConflictedSvnChange extends Change {
private final ConflictState myConflictState;
// also used if not move/rename
- private SVNTreeConflictDescription myBeforeDescription;
- private SVNTreeConflictDescription myAfterDescription;
+ private TreeConflictDescription myBeforeDescription;
+ private TreeConflictDescription myAfterDescription;
// +-
private final FilePath myTreeConflictMarkHolder;
private boolean myIsPhantom;
@@ -66,19 +65,19 @@ public class ConflictedSvnChange extends Change {
return myIsPhantom;
}
- public SVNTreeConflictDescription getBeforeDescription() {
+ public TreeConflictDescription getBeforeDescription() {
return myBeforeDescription;
}
- public void setBeforeDescription(SVNTreeConflictDescription beforeDescription) {
+ public void setBeforeDescription(TreeConflictDescription beforeDescription) {
myBeforeDescription = beforeDescription;
}
- public SVNTreeConflictDescription getAfterDescription() {
+ public TreeConflictDescription getAfterDescription() {
return myAfterDescription;
}
- public void setAfterDescription(SVNTreeConflictDescription afterDescription) {
+ public void setAfterDescription(TreeConflictDescription afterDescription) {
myAfterDescription = afterDescription;
}
@@ -97,14 +96,14 @@ public class ConflictedSvnChange extends Change {
if (myAfterDescription != null) {
sb.append("before: ");
}
- sb.append(SVNTreeConflictUtil.getHumanReadableConflictDescription(myBeforeDescription));
+ sb.append(myBeforeDescription.toPresentableString());
}
if (myAfterDescription != null) {
sb.append('\n');
if (myBeforeDescription != null) {
sb.append("after: ");
}
- sb.append(SVNTreeConflictUtil.getHumanReadableConflictDescription(myAfterDescription));
+ sb.append(myAfterDescription.toPresentableString());
}
return sb.toString();
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/DepthCombo.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/DepthCombo.java
index b55b50bb323a..4eea25ac14ca 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/DepthCombo.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/DepthCombo.java
@@ -15,50 +15,32 @@
*/
package org.jetbrains.idea.svn;
-import org.tmatesoft.svn.core.SVNDepth;
+import com.intellij.ui.ListCellRendererWrapper;
+import org.jetbrains.idea.svn.api.Depth;
import javax.swing.*;
public class DepthCombo extends JComboBox {
public DepthCombo(final boolean forUpdate) {
super(forUpdate ? ourForUpdate : ourForCheckout);
- setSelectedIndex(forUpdate ? 0 : 3);
+ setRenderer(new DepthRenderer());
+ setSelectedItem(forUpdate ? Depth.UNKNOWN : Depth.INFINITY);
setEditable(false);
setToolTipText(SvnBundle.message("label.depth.description"));
}
- public SVNDepth getDepth() {
- return ((SVNDepthWithName) super.getSelectedItem()).getDepth();
+ public Depth getDepth() {
+ return (Depth)super.getSelectedItem();
}
- private final static SVNDepthWithName [] ourForUpdate = {new SVNDepthWithName(SVNDepth.UNKNOWN, "working copy"),
- new SVNDepthWithName(SVNDepth.EMPTY), new SVNDepthWithName(SVNDepth.FILES), new SVNDepthWithName(SVNDepth.IMMEDIATES),
- new SVNDepthWithName(SVNDepth.INFINITY)};
- private final static SVNDepthWithName [] ourForCheckout = {
- new SVNDepthWithName(SVNDepth.EMPTY), new SVNDepthWithName(SVNDepth.FILES), new SVNDepthWithName(SVNDepth.IMMEDIATES),
- new SVNDepthWithName(SVNDepth.INFINITY)};
+ private final static Depth[] ourForUpdate = {Depth.UNKNOWN, Depth.EMPTY, Depth.FILES, Depth.IMMEDIATES, Depth.INFINITY};
+ private final static Depth[] ourForCheckout = {Depth.EMPTY, Depth.FILES, Depth.IMMEDIATES, Depth.INFINITY};
- private static class SVNDepthWithName {
- private final SVNDepth myDepth;
- private final String myName;
-
- private SVNDepthWithName(SVNDepth depth) {
- myDepth = depth;
- myName = myDepth.toString();
- }
-
- private SVNDepthWithName(SVNDepth depth, String name) {
- myDepth = depth;
- myName = name;
- }
+ private static class DepthRenderer extends ListCellRendererWrapper<Depth> {
@Override
- public String toString() {
- return myName;
- }
-
- public SVNDepth getDepth() {
- return myDepth;
+ public void customize(JList list, Depth value, int index, boolean selected, boolean hasFocus) {
+ setText(Depth.UNKNOWN.equals(value) ? "working copy" : value.getName());
}
}
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/ForNestedRootChecker.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/ForNestedRootChecker.java
index 333cf9e52c01..e87c55dc447d 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/ForNestedRootChecker.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/ForNestedRootChecker.java
@@ -21,10 +21,10 @@ import com.intellij.openapi.vfs.VfsUtilCore;
import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
-import org.tmatesoft.svn.core.SVNErrorCode;
+import org.jetbrains.idea.svn.commandLine.SvnBindException;
+import org.jetbrains.idea.svn.info.Info;
import org.tmatesoft.svn.core.SVNException;
import org.tmatesoft.svn.core.SVNURL;
-import org.tmatesoft.svn.core.wc.SVNInfo;
import org.tmatesoft.svn.core.wc.SVNRevision;
import java.io.File;
@@ -108,8 +108,8 @@ public class ForNestedRootChecker {
@NotNull private final SvnVcs myVcs;
@NotNull private final VirtualFile myFile;
@NotNull private final File myIoFile;
- @Nullable private SVNInfo myInfo;
- @Nullable private SVNException myError;
+ @Nullable private Info myInfo;
+ @Nullable private SvnBindException myError;
private VcsFileResolver(@NotNull SvnVcs vcs, @NotNull VirtualFile file) {
myVcs = vcs;
@@ -128,7 +128,7 @@ public class ForNestedRootChecker {
try {
myInfo = myVcs.getFactory(myIoFile, false).createInfoClient().doInfo(myIoFile, SVNRevision.UNDEFINED);
}
- catch (SVNException e) {
+ catch (SvnBindException e) {
myError = e;
}
}
@@ -138,9 +138,7 @@ public class ForNestedRootChecker {
Node result = null;
if (myError != null) {
- SVNErrorCode errorCode = myError.getErrorMessage().getErrorCode();
-
- if (!SvnUtil.isUnversionedOrNotFound(errorCode)) {
+ if (!SvnUtil.isUnversionedOrNotFound(myError)) {
// error code does not indicate that myFile is unversioned or path is invalid => create result, but indicate error
result = new Node(myFile, getFakeUrl(), getFakeUrl(), myError);
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/NestedCopiesBuilder.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/NestedCopiesBuilder.java
index 7934761fce12..d0eafb77bc4b 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/NestedCopiesBuilder.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/NestedCopiesBuilder.java
@@ -20,10 +20,10 @@ import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.vcs.FilePath;
import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.idea.svn.status.Status;
+import org.jetbrains.idea.svn.status.StatusType;
import org.tmatesoft.svn.core.SVNException;
import org.tmatesoft.svn.core.SVNURL;
-import org.tmatesoft.svn.core.wc.SVNStatus;
-import org.tmatesoft.svn.core.wc.SVNStatusType;
import java.io.File;
import java.util.HashSet;
@@ -42,9 +42,9 @@ public class NestedCopiesBuilder implements StatusReceiver {
mySet = new HashSet<NestedCopyInfo>();
}
- public void process(final FilePath path, final SVNStatus status) throws SVNException {
+ public void process(final FilePath path, final Status status) throws SVNException {
VirtualFile file = path.getVirtualFile();
- if (file != null && SvnVcs.svnStatusIs(status, SVNStatusType.STATUS_EXTERNAL)) {
+ if (file != null && status.is(StatusType.STATUS_EXTERNAL)) {
// We do not determine here url, repository url - because url, repository url in status will determine location in the
// repository where folder is located and not where svn:externals property points. We want the later parameters - they'll
// determined while creating RootUrlInfos later. Format will be also determined later.
@@ -55,7 +55,7 @@ public class NestedCopiesBuilder implements StatusReceiver {
}
if (file == null || status.getURL() == null) return;
- if (!SvnVcs.svnStatusIsUnversioned(status) && status.isSwitched()) {
+ if (!status.is(StatusType.STATUS_UNVERSIONED) && status.isSwitched()) {
// this one called when there is switched directory under nested working copy
// TODO: some other cases?
final NestedCopyInfo
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/Node.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/Node.java
index 83290a3e05c0..3d1d77e210d1 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/Node.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/Node.java
@@ -19,7 +19,7 @@ import com.intellij.openapi.vfs.VfsUtilCore;
import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
-import org.tmatesoft.svn.core.SVNException;
+import org.jetbrains.idea.svn.commandLine.SvnBindException;
import org.tmatesoft.svn.core.SVNURL;
import java.io.File;
@@ -31,13 +31,13 @@ public class Node {
@NotNull private final VirtualFile myFile;
@NotNull private final SVNURL myUrl;
@NotNull private final SVNURL myRepositoryUrl;
- @Nullable private final SVNException myError;
+ @Nullable private final SvnBindException myError;
public Node(@NotNull VirtualFile file, @NotNull SVNURL url, @NotNull SVNURL repositoryUrl) {
this(file, url, repositoryUrl, null);
}
- public Node(@NotNull VirtualFile file, @NotNull SVNURL url, @NotNull SVNURL repositoryUrl, @Nullable SVNException error) {
+ public Node(@NotNull VirtualFile file, @NotNull SVNURL url, @NotNull SVNURL repositoryUrl, @Nullable SvnBindException error) {
myFile = file;
myUrl = url;
myRepositoryUrl = repositoryUrl;
@@ -65,7 +65,7 @@ public class Node {
}
@Nullable
- public SVNException getError() {
+ public SvnBindException getError() {
return myError;
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/RepeatSvnActionThroughBusy.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/RepeatSvnActionThroughBusy.java
index b669f2bfb38b..e078c572d65d 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/RepeatSvnActionThroughBusy.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/RepeatSvnActionThroughBusy.java
@@ -15,6 +15,7 @@
*/
package org.jetbrains.idea.svn;
+import com.intellij.openapi.vcs.VcsException;
import com.intellij.util.Processor;
import org.tmatesoft.sqljet.core.SqlJetErrorCode;
import org.tmatesoft.sqljet.core.SqlJetException;
@@ -52,20 +53,23 @@ public abstract class RepeatSvnActionThroughBusy {
protected int myCnt = REPEAT;
protected long myTimeout = 50;
- protected abstract void executeImpl() throws SVNException;
+
+ protected abstract void executeImpl() throws VcsException;
+
protected Object myT;
- public <T> T compute() throws SVNException {
+ public <T> T compute() throws VcsException {
execute();
return (T) myT;
}
- public void execute() throws SVNException {
+ public void execute() throws VcsException {
while (true) {
try {
executeImpl();
break;
- } catch (SVNException e) {
+ }
+ catch (VcsException e) {
if (ourBusyExceptionProcessor.process(e)) {
if (myCnt > 0) {
try {
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/RootsToWorkingCopies.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/RootsToWorkingCopies.java
index 5ca7f9eaa39b..06138b345b74 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/RootsToWorkingCopies.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/RootsToWorkingCopies.java
@@ -29,14 +29,9 @@ import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.Alarm;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
-import org.tmatesoft.svn.core.SVNException;
+import org.jetbrains.idea.svn.info.Info;
import org.tmatesoft.svn.core.SVNURL;
import org.tmatesoft.svn.core.internal.util.SVNURLUtil;
-import org.tmatesoft.svn.core.internal.wc.admin.SVNEntry;
-import org.tmatesoft.svn.core.internal.wc.admin.SVNWCAccess;
-import org.tmatesoft.svn.core.wc.SVNInfo;
-import org.tmatesoft.svn.core.wc.SVNRevision;
-import org.tmatesoft.svn.core.wc.SVNWCUtil;
import java.io.File;
import java.util.HashMap;
@@ -127,7 +122,7 @@ public class RootsToWorkingCopies implements VcsListener {
WorkingCopy workingCopy = null;
if (workingCopyRoot != null) {
- final SVNInfo svnInfo = myVcs.getInfo(workingCopyRoot);
+ final Info svnInfo = myVcs.getInfo(workingCopyRoot);
if (svnInfo != null && svnInfo.getURL() != null) {
workingCopy = new WorkingCopy(workingCopyRoot, svnInfo.getURL(), true);
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/StatusReceiver.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/StatusReceiver.java
index 8524c83366e6..ac165c48f5c3 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/StatusReceiver.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/StatusReceiver.java
@@ -17,14 +17,14 @@ package org.jetbrains.idea.svn;
import com.intellij.openapi.vcs.FilePath;
import com.intellij.openapi.vfs.VirtualFile;
+import org.jetbrains.idea.svn.status.Status;
import org.tmatesoft.svn.core.SVNException;
import org.tmatesoft.svn.core.SVNURL;
-import org.tmatesoft.svn.core.wc.SVNStatus;
import java.util.EventListener;
public interface StatusReceiver extends EventListener {
- void process(final FilePath path, final SVNStatus status) throws SVNException;
+ void process(final FilePath path, final Status status) throws SVNException;
void processIgnored(final VirtualFile vFile);
void processUnversioned(final VirtualFile vFile);
void processCopyRoot(VirtualFile file, SVNURL url, WorkingCopyFormat format, SVNURL rootURL);
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/StatusWalkerPartner.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/StatusWalkerPartner.java
index 09d7d87ec1dc..367ae1bc4619 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/StatusWalkerPartner.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/StatusWalkerPartner.java
@@ -25,11 +25,11 @@ import com.intellij.openapi.vcs.changes.ChangeListManager;
import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import org.jetbrains.idea.svn.api.ProgressEvent;
+import org.jetbrains.idea.svn.api.ProgressTracker;
import org.tmatesoft.svn.core.SVNCancelException;
import org.tmatesoft.svn.core.SVNException;
-import org.tmatesoft.svn.core.wc.ISVNEventHandler;
import org.tmatesoft.svn.core.wc.ISVNStatusFileProvider;
-import org.tmatesoft.svn.core.wc.SVNEvent;
public class StatusWalkerPartner {
private final SvnVcs myVcs;
@@ -50,9 +50,9 @@ public class StatusWalkerPartner {
}
@NotNull
- public ISVNEventHandler getEventHandler() {
- return new ISVNEventHandler() {
- public void handleEvent(SVNEvent event, double progress) throws SVNException {
+ public ProgressTracker getEventHandler() {
+ return new ProgressTracker() {
+ public void consume(ProgressEvent event) throws SVNException {
//
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnBundle.properties b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnBundle.properties
index 38418b16ef53..df545b0373a1 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnBundle.properties
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnBundle.properties
@@ -322,9 +322,9 @@ progress.title.commit=Commit
progress.text.committing.changes.below=Creating commit packets...
status.text.committed.revision=Committed revision {0}.
checkin.operation.name=Comm_it
-checkin.different.formats.involved=Selected changes for {0,choice,0#repository|1#repositories} {1}\nbelong to both before- 1.7 format and 1.7 format \
-Subversion working copies.\nCommit will split into several commits.\n\n\
-You can convert all working copies into 1.7 format in Changes | Subversion Working Copies Information.\nDo you wish to continue with commit?
+checkin.different.formats.involved=Selected changes for {0,choice,0#repository|1#repositories} {1}\nbelong to Subversion working copies of \
+different formats.\nCommit will split into several commits.\n\n\
+You can convert all working copies to the same format in Changes | Subversion Working Copies Information.\nDo you wish to continue with commit?
progress.text.collecting.commitables=Collecting commitables at ''{0}''
progress.text2.fetching.external.location=Fetching external location to ''{0}''
progress.text2.checked.out=Checked out {1} files, checking out {0}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnChangeProvider.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnChangeProvider.java
index 3b0195e6079d..073826f6b035 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnChangeProvider.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnChangeProvider.java
@@ -34,14 +34,15 @@ import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.EventDispatcher;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.idea.svn.actions.CleanupWorker;
+import org.jetbrains.idea.svn.api.Depth;
+import org.jetbrains.idea.svn.commandLine.SvnBindException;
import org.jetbrains.idea.svn.commandLine.SvnExceptionWrapper;
-import org.tmatesoft.svn.core.SVNDepth;
+import org.jetbrains.idea.svn.status.Status;
+import org.jetbrains.idea.svn.status.StatusType;
import org.tmatesoft.svn.core.SVNException;
import org.tmatesoft.svn.core.SVNURL;
import org.tmatesoft.svn.core.internal.util.SVNPathUtil;
import org.tmatesoft.svn.core.wc.ISVNStatusFileProvider;
-import org.tmatesoft.svn.core.wc.SVNStatus;
-import org.tmatesoft.svn.core.wc.SVNStatusType;
import java.io.File;
import java.util.*;
@@ -86,12 +87,12 @@ public class SvnChangeProvider implements ChangeProvider {
final SvnRecursiveStatusWalker walker = new SvnRecursiveStatusWalker(myVcs, statusReceiver.getMulticaster(), partner);
for (FilePath path : zipper.getRecursiveDirs()) {
- walker.go(path, SVNDepth.INFINITY);
+ walker.go(path, Depth.INFINITY);
}
partner.setFileProvider(fileProvider);
for (SvnScopeZipper.MyDirNonRecursive item : nonRecursiveMap.values()) {
- walker.go(item.getDir(), SVNDepth.IMMEDIATES);
+ walker.go(item.getDir(), Depth.IMMEDIATES);
}
processCopiedAndDeleted(context, dirtyScope);
@@ -111,6 +112,10 @@ public class SvnChangeProvider implements ChangeProvider {
}
}
+ /**
+ * TODO: Currently could not find exact case when "file status is not correctly refreshed after external commit" that is covered by this
+ * TODO: code. So for now, checks for formats greater than 1.7 are not added here.
+ */
private static void putAdministrative17UnderVfsListener(Set<NestedCopyInfo> pointInfos) {
if (! SvnVcs.ourListenToWcDb) return;
final LocalFileSystem lfs = LocalFileSystem.getInstance();
@@ -169,11 +174,12 @@ public class SvnChangeProvider implements ChangeProvider {
}
}
- public void getChanges(final FilePath path, final boolean recursive, final ChangelistBuilder builder) throws SVNException {
+ public void getChanges(final FilePath path, final boolean recursive, final ChangelistBuilder builder)
+ throws SVNException, SvnBindException {
final SvnChangeProviderContext context = new SvnChangeProviderContext(myVcs, builder, null);
final StatusWalkerPartner partner = new StatusWalkerPartner(myVcs, ProgressManager.getInstance().getProgressIndicator());
final SvnRecursiveStatusWalker walker = new SvnRecursiveStatusWalker(myVcs, context, partner);
- walker.go(path, recursive ? SVNDepth.INFINITY : SVNDepth.IMMEDIATES);
+ walker.go(path, recursive ? Depth.INFINITY : Depth.IMMEDIATES);
processCopiedAndDeleted(context, null);
}
@@ -181,7 +187,7 @@ public class SvnChangeProvider implements ChangeProvider {
ChangelistBuilder builder,
SvnChangeProviderContext context, final VcsDirtyScope dirtyScope) throws SVNException {
boolean foundRename = false;
- final SVNStatus copiedStatus = copiedFile.getStatus();
+ final Status copiedStatus = copiedFile.getStatus();
final String copyFromURL = copiedFile.getCopyFromURL();
final FilePath copiedToPath = copiedFile.getFilePath();
@@ -199,7 +205,7 @@ public class SvnChangeProvider implements ChangeProvider {
for (Iterator<SvnChangedFile> iterator = context.getDeletedFiles().iterator(); iterator.hasNext();) {
SvnChangedFile deletedFile = iterator.next();
- final SVNStatus deletedStatus = deletedFile.getStatus();
+ final Status deletedStatus = deletedFile.getStatus();
if ((deletedStatus != null) && (deletedStatus.getURL() != null) && Comparing.equal(copyFromURL, deletedStatus.getURL().toString())) {
final String clName = SvnUtil.getChangelistName(copiedFile.getStatus());
final Change newChange = context.createMovedChange(createBeforeRevision(deletedFile, true),
@@ -208,7 +214,7 @@ public class SvnChangeProvider implements ChangeProvider {
applyMovedChange(copiedFile.getFilePath(), builder, dirtyScope, deletedToDelete, deletedFile, clName, newChange);
for(Iterator<SvnChangedFile> iterChild = context.getDeletedFiles().iterator(); iterChild.hasNext();) {
SvnChangedFile deletedChild = iterChild.next();
- final SVNStatus childStatus = deletedChild.getStatus();
+ final Status childStatus = deletedChild.getStatus();
if (childStatus == null) {
continue;
}
@@ -243,15 +249,15 @@ public class SvnChangeProvider implements ChangeProvider {
// by building a relative url
if (!foundRename && copiedStatus.getURL() != null) {
File wcPath = guessWorkingCopyPath(copiedStatus.getFile(), copiedStatus.getURL(), copyFromURL);
- SVNStatus status;
+ Status status;
try {
status = myVcs.getFactory(wcPath).createStatusClient().doStatus(wcPath, false);
}
- catch(SVNException ex) {
+ catch(SvnBindException ex) {
LOG.info(ex);
status = null;
}
- if (status != null && SvnVcs.svnStatusIs(status, SVNStatusType.STATUS_DELETED)) {
+ if (status != null && status.is(StatusType.STATUS_DELETED)) {
final FilePath filePath = myFactory.createFilePathOnDeleted(wcPath, false);
final SvnContentRevision beforeRevision = SvnContentRevision.createBaseRevision(myVcs, filePath, status.getRevision());
final ContentRevision afterRevision = CurrentContentRevision.create(copiedFile.getFilePath());
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnChangeProviderContext.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnChangeProviderContext.java
index f7e5857569ff..716abbe1b20b 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnChangeProviderContext.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnChangeProviderContext.java
@@ -26,13 +26,13 @@ import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.actions.AbstractShowPropertiesDiffAction;
+import org.jetbrains.idea.svn.info.Info;
+import org.jetbrains.idea.svn.lock.Lock;
+import org.jetbrains.idea.svn.status.Status;
+import org.jetbrains.idea.svn.status.StatusType;
import org.tmatesoft.svn.core.SVNException;
-import org.tmatesoft.svn.core.SVNLock;
import org.tmatesoft.svn.core.SVNURL;
-import org.tmatesoft.svn.core.wc.SVNInfo;
import org.tmatesoft.svn.core.wc.SVNRevision;
-import org.tmatesoft.svn.core.wc.SVNStatus;
-import org.tmatesoft.svn.core.wc.SVNStatusType;
import java.io.File;
import java.util.*;
@@ -44,7 +44,7 @@ class SvnChangeProviderContext implements StatusReceiver {
private List<SvnChangedFile> myCopiedFiles = null;
private final List<SvnChangedFile> myDeletedFiles = new ArrayList<SvnChangedFile>();
// for files moved in a subtree, which were the targets of merge (for instance).
- private final Map<String, SVNStatus> myTreeConflicted;
+ private final Map<String, Status> myTreeConflicted;
private Map<FilePath, String> myCopyFromURLs = null;
private final SvnVcs myVcs;
private final SvnBranchConfigurationManager myBranchConfigurationManager;
@@ -55,11 +55,11 @@ class SvnChangeProviderContext implements StatusReceiver {
myVcs = vcs;
myChangelistBuilder = changelistBuilder;
myProgress = progress;
- myTreeConflicted = new HashMap<String, SVNStatus>();
+ myTreeConflicted = new HashMap<String, Status>();
myBranchConfigurationManager = SvnBranchConfigurationManager.getInstance(myVcs.getProject());
}
- public void process(FilePath path, SVNStatus status) throws SVNException {
+ public void process(FilePath path, Status status) throws SVNException {
processStatusFirstPass(path, status);
}
@@ -83,12 +83,12 @@ class SvnChangeProviderContext implements StatusReceiver {
return myChangelistBuilder;
}
- public void reportTreeConflict(final SVNStatus status) {
+ public void reportTreeConflict(final Status status) {
myTreeConflicted.put(status.getFile().getAbsolutePath(), status);
}
@Nullable
- public SVNStatus getTreeConflictStatus(final File file) {
+ public Status getTreeConflictStatus(final File file) {
return myTreeConflicted.get(file.getAbsolutePath());
}
@@ -140,7 +140,7 @@ class SvnChangeProviderContext implements StatusReceiver {
return null;
}
- public void addCopiedFile(final FilePath filePath, final SVNStatus status, final String copyFromURL) {
+ public void addCopiedFile(final FilePath filePath, final Status status, final String copyFromURL) {
if (myCopiedFiles == null) {
myCopiedFiles = new ArrayList<SvnChangedFile>();
}
@@ -160,19 +160,19 @@ class SvnChangeProviderContext implements StatusReceiver {
//
- void processStatusFirstPass(final FilePath filePath, final SVNStatus status) throws SVNException {
+ void processStatusFirstPass(final FilePath filePath, final Status status) throws SVNException {
if (status == null) {
// external to wc
return;
}
if (status.getRemoteLock() != null) {
- final SVNLock lock = status.getRemoteLock();
+ final Lock lock = status.getRemoteLock();
myChangelistBuilder.processLogicallyLockedFolder(filePath.getVirtualFile(),
new LogicalLock(false, lock.getOwner(), lock.getComment(), lock.getCreationDate(),
lock.getExpirationDate()));
}
if (status.getLocalLock() != null) {
- final SVNLock lock = status.getLocalLock();
+ final Lock lock = status.getLocalLock();
myChangelistBuilder.processLogicallyLockedFolder(filePath.getVirtualFile(),
new LogicalLock(true, lock.getOwner(), lock.getComment(), lock.getCreationDate(),
lock.getExpirationDate()));
@@ -180,11 +180,11 @@ class SvnChangeProviderContext implements StatusReceiver {
if (filePath.isDirectory() && status.isLocked()) {
myChangelistBuilder.processLockedFolder(filePath.getVirtualFile());
}
- if ((SvnVcs.svnStatusIs(status, SVNStatusType.STATUS_ADDED) || SVNStatusType.STATUS_MODIFIED.equals(status.getNodeStatus())) &&
+ if ((status.is(StatusType.STATUS_ADDED) || StatusType.STATUS_MODIFIED.equals(status.getNodeStatus())) &&
status.getCopyFromURL() != null) {
addCopiedFile(filePath, status, status.getCopyFromURL());
}
- else if (SvnVcs.svnStatusIs(status, SVNStatusType.STATUS_DELETED)) {
+ else if (status.is(StatusType.STATUS_DELETED)) {
myDeletedFiles.add(new SvnChangedFile(filePath, status));
}
else {
@@ -198,7 +198,7 @@ class SvnChangeProviderContext implements StatusReceiver {
}
}
- void processStatus(final FilePath filePath, final SVNStatus status) throws SVNException {
+ void processStatus(final FilePath filePath, final Status status) throws SVNException {
WorkingCopyFormat format = myVcs.getWorkingCopyFormat(filePath.getIOFile());
if (!WorkingCopyFormat.UNKNOWN.equals(format) && format.less(WorkingCopyFormat.ONE_DOT_SEVEN)) {
loadEntriesFile(filePath);
@@ -207,38 +207,36 @@ class SvnChangeProviderContext implements StatusReceiver {
if (status != null) {
FileStatus fStatus = SvnStatusConvertor.convertStatus(status);
- final SVNStatusType statusType = status.getContentsStatus();
- final SVNStatusType propStatus = status.getPropertiesStatus();
- if (SvnVcs.svnStatusIsUnversioned(status) || SvnVcs.svnStatusIs(status, SVNStatusType.UNKNOWN)) {
+ final StatusType statusType = status.getContentsStatus();
+ final StatusType propStatus = status.getPropertiesStatus();
+ if (status.is(StatusType.STATUS_UNVERSIONED, StatusType.UNKNOWN)) {
final VirtualFile file = filePath.getVirtualFile();
if (file != null) {
myChangelistBuilder.processUnversionedFile(file);
}
}
- else if (SvnVcs.svnStatusIs(status, SVNStatusType.STATUS_ADDED)) {
+ else if (status.is(StatusType.STATUS_ADDED)) {
myChangelistBuilder.processChangeInList(createChange(null, CurrentContentRevision.create(filePath), fStatus, status),
SvnUtil.getChangelistName(status), SvnVcs.getKey());
}
- else if (SvnVcs.svnStatusIs(status, SVNStatusType.STATUS_CONFLICTED) ||
- SvnVcs.svnStatusIs(status, SVNStatusType.STATUS_MODIFIED) ||
- SvnVcs.svnStatusIs(status, SVNStatusType.STATUS_REPLACED) ||
- propStatus == SVNStatusType.STATUS_MODIFIED ||
- propStatus == SVNStatusType.STATUS_CONFLICTED) {
+ else if (status.is(StatusType.STATUS_CONFLICTED, StatusType.STATUS_MODIFIED, StatusType.STATUS_REPLACED) ||
+ propStatus == StatusType.STATUS_MODIFIED ||
+ propStatus == StatusType.STATUS_CONFLICTED) {
myChangelistBuilder.processChangeInList(
createChange(SvnContentRevision.createBaseRevision(myVcs, filePath, status), CurrentContentRevision.create(filePath), fStatus,
status), SvnUtil.getChangelistName(status), SvnVcs.getKey()
);
checkSwitched(filePath, myChangelistBuilder, status, fStatus);
}
- else if (SvnVcs.svnStatusIs(status, SVNStatusType.STATUS_DELETED)) {
+ else if (status.is(StatusType.STATUS_DELETED)) {
myChangelistBuilder.processChangeInList(
createChange(SvnContentRevision.createBaseRevision(myVcs, filePath, status), null, fStatus, status),
SvnUtil.getChangelistName(status), SvnVcs.getKey());
}
- else if (SvnVcs.svnStatusIs(status, SVNStatusType.STATUS_MISSING)) {
+ else if (status.is(StatusType.STATUS_MISSING)) {
myChangelistBuilder.processLocallyDeletedFile(createLocallyDeletedChange(filePath, status));
}
- else if (SvnVcs.svnStatusIs(status, SVNStatusType.STATUS_IGNORED)) {
+ else if (status.is(StatusType.STATUS_IGNORED)) {
if (!myVcs.isWcRoot(filePath)) {
myChangelistBuilder.processIgnoredFile(filePath.getVirtualFile());
}
@@ -246,7 +244,7 @@ class SvnChangeProviderContext implements StatusReceiver {
else if (status.isCopied()) {
//
}
- else if ((fStatus == FileStatus.NOT_CHANGED || fStatus == FileStatus.SWITCHED) && statusType != SVNStatusType.STATUS_NONE) {
+ else if ((fStatus == FileStatus.NOT_CHANGED || fStatus == FileStatus.SWITCHED) && statusType != StatusType.STATUS_NONE) {
VirtualFile file = filePath.getVirtualFile();
if (file != null && FileDocumentManager.getInstance().isFileModified(file)) {
myChangelistBuilder.processChangeInList(
@@ -266,10 +264,10 @@ class SvnChangeProviderContext implements StatusReceiver {
public void addModifiedNotSavedChange(final VirtualFile file) throws SVNException {
final FilePath filePath = new FilePathImpl(file);
- final SVNInfo svnInfo = myVcs.getInfo(file);
+ final Info svnInfo = myVcs.getInfo(file);
if (svnInfo != null) {
- final SVNStatus svnStatus = new SVNStatus();
+ final Status svnStatus = new Status();
svnStatus.setRevision(svnInfo.getRevision());
myChangelistBuilder.processChangeInList(
createChange(SvnContentRevision.createBaseRevision(myVcs, filePath, svnInfo.getRevision()), CurrentContentRevision.create(filePath),
@@ -278,7 +276,7 @@ class SvnChangeProviderContext implements StatusReceiver {
}
}
- private void checkSwitched(final FilePath filePath, final ChangelistBuilder builder, final SVNStatus status,
+ private void checkSwitched(final FilePath filePath, final ChangelistBuilder builder, final Status status,
final FileStatus convertedStatus) {
if (status.isSwitched() || (convertedStatus == FileStatus.SWITCHED)) {
final VirtualFile virtualFile = filePath.getVirtualFile();
@@ -322,8 +320,8 @@ class SvnChangeProviderContext implements StatusReceiver {
// seems here we can only have a tree conflict; which can be marked on either path (?)
// .. ok try to merge states
- Change createMovedChange(final ContentRevision before, final ContentRevision after, final SVNStatus copiedStatus,
- final SVNStatus deletedStatus) throws SVNException {
+ Change createMovedChange(final ContentRevision before, final ContentRevision after, final Status copiedStatus,
+ final Status deletedStatus) throws SVNException {
// todo no convertion needed for the contents status?
final ConflictedSvnChange conflictedSvnChange =
new ConflictedSvnChange(before, after, ConflictState.mergeState(getState(copiedStatus), getState(deletedStatus)),
@@ -340,13 +338,13 @@ class SvnChangeProviderContext implements StatusReceiver {
private Change createChange(final ContentRevision before,
final ContentRevision after,
final FileStatus fStatus,
- final SVNStatus svnStatus)
+ final Status svnStatus)
throws SVNException {
final ConflictedSvnChange conflictedSvnChange = new ConflictedSvnChange(before, after, correctContentsStatus(fStatus, svnStatus),
getState(svnStatus),
after == null ? before.getFile() : after.getFile());
if (svnStatus != null) {
- if (SVNStatusType.STATUS_DELETED.equals(svnStatus.getNodeStatus()) && !svnStatus.getRevision().isValid()) {
+ if (StatusType.STATUS_DELETED.equals(svnStatus.getNodeStatus()) && !svnStatus.getRevision().isValid()) {
conflictedSvnChange.setIsPhantom(true);
}
conflictedSvnChange.setBeforeDescription(svnStatus.getTreeConflict());
@@ -354,31 +352,31 @@ class SvnChangeProviderContext implements StatusReceiver {
return patchWithPropertyChange(conflictedSvnChange, svnStatus, null);
}
- private FileStatus correctContentsStatus(final FileStatus fs, final SVNStatus svnStatus) throws SVNException {
+ private FileStatus correctContentsStatus(final FileStatus fs, final Status svnStatus) throws SVNException {
//if (svnStatus.isSwitched()) return FileStatus.SWITCHED;
return fs;
//return SvnStatusConvertor.convertContentsStatus(svnStatus);
}
- private LocallyDeletedChange createLocallyDeletedChange(@NotNull FilePath filePath, final SVNStatus status) {
+ private LocallyDeletedChange createLocallyDeletedChange(@NotNull FilePath filePath, final Status status) {
return new SvnLocallyDeletedChange(filePath, getState(status));
}
- private Change patchWithPropertyChange(final Change change, final SVNStatus svnStatus, final SVNStatus deletedStatus)
+ private Change patchWithPropertyChange(final Change change, final Status svnStatus, final Status deletedStatus)
throws SVNException {
if (svnStatus == null) return change;
- final SVNStatusType propertiesStatus = svnStatus.getPropertiesStatus();
- if (SVNStatusType.STATUS_CONFLICTED.equals(propertiesStatus) || SVNStatusType.CHANGED.equals(propertiesStatus) ||
- SVNStatusType.STATUS_ADDED.equals(propertiesStatus) || SVNStatusType.STATUS_DELETED.equals(propertiesStatus) ||
- SVNStatusType.STATUS_MODIFIED.equals(propertiesStatus) || SVNStatusType.STATUS_REPLACED.equals(propertiesStatus) ||
- SVNStatusType.MERGED.equals(propertiesStatus)) {
+ final StatusType propertiesStatus = svnStatus.getPropertiesStatus();
+ if (StatusType.STATUS_CONFLICTED.equals(propertiesStatus) || StatusType.CHANGED.equals(propertiesStatus) ||
+ StatusType.STATUS_ADDED.equals(propertiesStatus) || StatusType.STATUS_DELETED.equals(propertiesStatus) ||
+ StatusType.STATUS_MODIFIED.equals(propertiesStatus) || StatusType.STATUS_REPLACED.equals(propertiesStatus) ||
+ StatusType.MERGED.equals(propertiesStatus)) {
final FilePath path = ChangesUtil.getFilePath(change);
final File ioFile = path.getIOFile();
final File beforeFile = deletedStatus != null ? deletedStatus.getFile() : ioFile;
- final String beforeList = SVNStatusType.STATUS_ADDED.equals(propertiesStatus) && deletedStatus == null ? null :
+ final String beforeList = StatusType.STATUS_ADDED.equals(propertiesStatus) && deletedStatus == null ? null :
AbstractShowPropertiesDiffAction.getPropertyList(myVcs, beforeFile, SVNRevision.BASE);
- final String afterList = SVNStatusType.STATUS_DELETED.equals(propertiesStatus) ? null :
+ final String afterList = StatusType.STATUS_DELETED.equals(propertiesStatus) ? null :
AbstractShowPropertiesDiffAction.getPropertyList(myVcs, ioFile, SVNRevision.WORKING);
// TODO: There are cases when status output is like (on newly added file with some properties that is locally deleted)
@@ -398,16 +396,16 @@ class SvnChangeProviderContext implements StatusReceiver {
return change;
}
- private ConflictState getState(@Nullable final SVNStatus svnStatus) {
+ private ConflictState getState(@Nullable final Status svnStatus) {
if (svnStatus == null) {
return ConflictState.none;
}
- final SVNStatusType propertiesStatus = svnStatus.getPropertiesStatus();
+ final StatusType propertiesStatus = svnStatus.getPropertiesStatus();
final boolean treeConflict = svnStatus.getTreeConflict() != null;
- final boolean textConflict = SVNStatusType.STATUS_CONFLICTED == svnStatus.getContentsStatus();
- final boolean propertyConflict = SVNStatusType.STATUS_CONFLICTED == propertiesStatus;
+ final boolean textConflict = StatusType.STATUS_CONFLICTED == svnStatus.getContentsStatus();
+ final boolean propertyConflict = StatusType.STATUS_CONFLICTED == propertiesStatus;
if (treeConflict) {
reportTreeConflict(svnStatus);
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnChangedFile.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnChangedFile.java
index 2bd5ee497102..8d4fab4ec40a 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnChangedFile.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnChangedFile.java
@@ -16,19 +16,19 @@
package org.jetbrains.idea.svn;
import com.intellij.openapi.vcs.FilePath;
-import org.tmatesoft.svn.core.wc.SVNStatus;
+import org.jetbrains.idea.svn.status.Status;
class SvnChangedFile {
private final FilePath myFilePath;
- private final SVNStatus myStatus;
+ private final Status myStatus;
private String myCopyFromURL;
- public SvnChangedFile(final FilePath filePath, final SVNStatus status) {
+ public SvnChangedFile(final FilePath filePath, final Status status) {
myFilePath = filePath;
myStatus = status;
}
- public SvnChangedFile(final FilePath filePath, final SVNStatus status, final String copyFromURL) {
+ public SvnChangedFile(final FilePath filePath, final Status status, final String copyFromURL) {
myFilePath = filePath;
myStatus = status;
myCopyFromURL = copyFromURL;
@@ -38,7 +38,7 @@ class SvnChangedFile {
return myFilePath;
}
- public SVNStatus getStatus() {
+ public Status getStatus() {
return myStatus;
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnChangelistListener.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnChangelistListener.java
index 00fa3a1cf9aa..a66146e259a6 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnChangelistListener.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnChangelistListener.java
@@ -28,9 +28,8 @@ import com.intellij.openapi.vcs.changes.ChangeListListener;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.commandLine.SvnBindException;
+import org.jetbrains.idea.svn.status.Status;
import org.tmatesoft.svn.core.SVNErrorCode;
-import org.tmatesoft.svn.core.SVNException;
-import org.tmatesoft.svn.core.wc.SVNStatus;
import java.io.File;
import java.util.ArrayList;
@@ -136,12 +135,11 @@ public class SvnChangelistListener implements ChangeListListener {
@Nullable
public static String getCurrentMapping(final SvnVcs vcs, final File file) {
try {
- final SVNStatus status = vcs.getFactory(file).createStatusClient().doStatus(file, false);
+ final Status status = vcs.getFactory(file).createStatusClient().doStatus(file, false);
return status == null ? null : status.getChangelistName();
}
- catch (SVNException e) {
- final SVNErrorCode errorCode = e.getErrorMessage().getErrorCode();
- if (SVNErrorCode.WC_NOT_DIRECTORY.equals(errorCode) || SVNErrorCode.WC_NOT_FILE.equals(errorCode)) {
+ catch (SvnBindException e) {
+ if (e.contains(SVNErrorCode.WC_NOT_DIRECTORY) || e.contains(SVNErrorCode.WC_NOT_FILE)) {
LOG.debug("Logging only, exception is valid (caught) here", e);
} else {
LOG.info("Logging only, exception is valid (caught) here", e);
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnConfiguration.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnConfiguration.java
index 790cdae37629..6f5013c4a929 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnConfiguration.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnConfiguration.java
@@ -26,13 +26,14 @@ import com.intellij.openapi.util.Ref;
import com.intellij.openapi.vcs.changes.VcsAnnotationRefresher;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.idea.svn.api.Depth;
import org.jetbrains.idea.svn.auth.SvnAuthenticationManager;
import org.jetbrains.idea.svn.auth.SvnAuthenticationProvider;
import org.jetbrains.idea.svn.auth.SvnInteractiveAuthenticationProvider;
import org.jetbrains.idea.svn.config.SvnServerFileKeys;
+import org.jetbrains.idea.svn.diff.DiffOptions;
import org.jetbrains.idea.svn.update.MergeRootInfo;
import org.jetbrains.idea.svn.update.UpdateRootInfo;
-import org.tmatesoft.svn.core.SVNDepth;
import org.tmatesoft.svn.core.SVNErrorMessage;
import org.tmatesoft.svn.core.SVNURL;
import org.tmatesoft.svn.core.auth.ISVNAuthenticationProvider;
@@ -41,7 +42,6 @@ import org.tmatesoft.svn.core.internal.wc.ISVNAuthenticationStorage;
import org.tmatesoft.svn.core.internal.wc.SVNConfigFile;
import org.tmatesoft.svn.core.internal.wc.SVNFileUtil;
import org.tmatesoft.svn.core.wc.ISVNOptions;
-import org.tmatesoft.svn.core.wc.SVNDiffOptions;
import org.tmatesoft.svn.core.wc.SVNWCUtil;
import java.io.File;
@@ -76,9 +76,6 @@ public class SvnConfiguration implements PersistentStateComponent<SvnConfigurati
private SvnAuthenticationManager myInteractiveManager;
public static final AuthStorage RUNTIME_AUTH_CACHE = new AuthStorage();
- // TODO: update depth is not stored in configuration as SVNDepth has wrong type for DefaultJDOMExternalizer
- // TODO: check if it should be stored
- public SVNDepth UPDATE_DEPTH = SVNDepth.UNKNOWN;
private final Map<File, MergeRootInfo> myMergeRootInfos = new HashMap<File, MergeRootInfo>();
private final Map<File, UpdateRootInfo> myUpdateRootInfos = new HashMap<File, UpdateRootInfo>();
@@ -109,8 +106,9 @@ public class SvnConfiguration implements PersistentStateComponent<SvnConfigurati
}
}
- public SVNDiffOptions getMergeOptions() {
- return new SVNDiffOptions(isIgnoreSpacesInMerge(), isIgnoreSpacesInMerge(), isIgnoreSpacesInMerge());
+ @NotNull
+ public DiffOptions getMergeOptions() {
+ return new DiffOptions(isIgnoreSpacesInMerge(), isIgnoreSpacesInMerge(), isIgnoreSpacesInMerge());
}
private void initServers() {
@@ -180,12 +178,12 @@ public class SvnConfiguration implements PersistentStateComponent<SvnConfigurati
myState.sslProtocols = sslProtocols;
}
- public SVNDepth getUpdateDepth() {
- return UPDATE_DEPTH;
+ public Depth getUpdateDepth() {
+ return myState.UPDATE_DEPTH;
}
- public void setUpdateDepth(SVNDepth updateDepth) {
- this.UPDATE_DEPTH = updateDepth;
+ public void setUpdateDepth(Depth updateDepth) {
+ myState.UPDATE_DEPTH = updateDepth;
}
public UseAcceleration getUseAcceleration() {
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnConfigurationState.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnConfigurationState.java
index 8d155399c101..5d5585accf1a 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnConfigurationState.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnConfigurationState.java
@@ -17,6 +17,7 @@ package org.jetbrains.idea.svn;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.util.xmlb.annotations.*;
+import org.jetbrains.idea.svn.api.Depth;
/**
* @author Konstantin Kolosovsky.
@@ -70,6 +71,7 @@ public class SvnConfigurationState {
public boolean SHOW_MERGE_SOURCES_IN_ANNOTATE = true;
public boolean FORCE_UPDATE;
public boolean IGNORE_EXTERNALS;
+ public Depth UPDATE_DEPTH = Depth.UNKNOWN;
@Tag("configuration")
public static class ConfigurationDirectory {
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnContentRevision.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnContentRevision.java
index 6e9693bdd6eb..d2dbe84f5505 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnContentRevision.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnContentRevision.java
@@ -29,8 +29,8 @@ import com.intellij.openapi.vcs.impl.CurrentRevisionProvider;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import org.jetbrains.idea.svn.status.Status;
import org.tmatesoft.svn.core.wc.SVNRevision;
-import org.tmatesoft.svn.core.wc.SVNStatus;
import org.tmatesoft.svn.core.wc2.SvnTarget;
import java.io.File;
@@ -56,7 +56,7 @@ public class SvnContentRevision implements ContentRevision, MarkerVcsContentRevi
myFile = file;
}
- public static SvnContentRevision createBaseRevision(@NotNull SvnVcs vcs, @NotNull final FilePath file, final SVNStatus status) {
+ public static SvnContentRevision createBaseRevision(@NotNull SvnVcs vcs, @NotNull final FilePath file, final Status status) {
SVNRevision revision = status.getRevision().isValid() ? status.getRevision() : status.getCommittedRevision();
return createBaseRevision(vcs, file, revision);
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnDiffProvider.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnDiffProvider.java
index 8aade42edc1c..49ea87d44f6e 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnDiffProvider.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnDiffProvider.java
@@ -32,7 +32,12 @@ import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import org.jetbrains.idea.svn.commandLine.SvnBindException;
import org.jetbrains.idea.svn.history.LatestExistentSearcher;
+import org.jetbrains.idea.svn.info.InfoConsumer;
+import org.jetbrains.idea.svn.info.Info;
+import org.jetbrains.idea.svn.status.Status;
+import org.jetbrains.idea.svn.status.StatusType;
import org.tmatesoft.svn.core.SVNException;
import org.tmatesoft.svn.core.SVNPropertyValue;
import org.tmatesoft.svn.core.SVNURL;
@@ -55,13 +60,13 @@ public class SvnDiffProvider extends DiffProviderEx implements DiffProvider, Dif
}
public VcsRevisionNumber getCurrentRevision(VirtualFile file) {
- final SVNInfo svnInfo = myVcs.getInfo(new File(file.getPresentableUrl()));
+ final Info svnInfo = myVcs.getInfo(new File(file.getPresentableUrl()));
return getRevision(svnInfo);
}
@Nullable
- private static VcsRevisionNumber getRevision(@Nullable SVNInfo info) {
+ private static VcsRevisionNumber getRevision(@Nullable Info info) {
VcsRevisionNumber result = null;
if (info != null) {
@@ -106,11 +111,11 @@ public class SvnDiffProvider extends DiffProviderEx implements DiffProvider, Dif
}
@NotNull
- private static ISVNInfoHandler createInfoHandler(@NotNull final Map<VirtualFile, VcsRevisionNumber> revisionMap,
+ private static InfoConsumer createInfoHandler(@NotNull final Map<VirtualFile, VcsRevisionNumber> revisionMap,
@NotNull final Map<String, VirtualFile> fileMap) {
- return new ISVNInfoHandler() {
+ return new InfoConsumer() {
@Override
- public void handleInfo(SVNInfo info) throws SVNException {
+ public void consume(Info info) throws SVNException {
if (info != null) {
VirtualFile file = fileMap.get(info.getFile().getAbsolutePath());
@@ -132,7 +137,7 @@ public class SvnDiffProvider extends DiffProviderEx implements DiffProvider, Dif
}
private VcsRevisionDescription getCurrentRevisionDescription(File path) {
- final SVNInfo svnInfo = myVcs.getInfo(path);
+ final Info svnInfo = myVcs.getInfo(path);
if (svnInfo == null) {
return null;
}
@@ -187,20 +192,20 @@ public class SvnDiffProvider extends DiffProviderEx implements DiffProvider, Dif
}
// not clear why we need it, with remote check..
- SVNStatus svnStatus = getFileStatus(new File(selectedFile.getPresentableUrl()), false);
+ Status svnStatus = getFileStatus(new File(selectedFile.getPresentableUrl()), false);
if (svnStatus != null && svnRevision.equals(svnStatus.getRevision())) {
return SvnContentRevision.createBaseRevision(myVcs, filePath, svnRevision);
}
return SvnContentRevision.createRemote(myVcs, filePath, svnRevision);
}
- private SVNStatus getFileStatus(File file, boolean remote) {
- SVNStatus result = null;
+ private Status getFileStatus(File file, boolean remote) {
+ Status result = null;
try {
- result = myVcs.getFactory(file).createStatusClient().doStatus(file, remote, false);
+ result = myVcs.getFactory(file).createStatusClient().doStatus(file, remote);
}
- catch (SVNException e) {
+ catch (SvnBindException e) {
LOG.debug(e);
}
@@ -217,10 +222,10 @@ public class SvnDiffProvider extends DiffProviderEx implements DiffProvider, Dif
}
private ItemLatestState getLastRevision(final File file) {
- final SVNStatus svnStatus = getFileStatus(file, true);
+ final Status svnStatus = getFileStatus(file, true);
if (svnStatus == null || itemExists(svnStatus) && SVNRevision.UNDEFINED.equals(svnStatus.getRemoteRevision())) {
// IDEADEV-21785 (no idea why this can happen)
- final SVNInfo info = myVcs.getInfo(file, SVNRevision.HEAD);
+ final Info info = myVcs.getInfo(file, SVNRevision.HEAD);
if (info == null || info.getURL() == null) {
LOG.info("No SVN status returned for " + file.getPath());
return defaultResult();
@@ -232,8 +237,8 @@ public class SvnDiffProvider extends DiffProviderEx implements DiffProvider, Dif
WorkingCopyFormat format = myVcs.getWorkingCopyFormat(file);
long revision = -1;
- // skipped for 1.8
- if (!WorkingCopyFormat.ONE_DOT_EIGHT.equals(format)) {
+ // skipped for >= 1.8
+ if (format.less(WorkingCopyFormat.ONE_DOT_EIGHT)) {
// get really latest revision
// TODO: Algorithm seems not to be correct in all cases - for instance, when some subtree was deleted and replaced by other
// TODO: with same names. pegRevision should be used somehow but this complicates the algorithm
@@ -254,8 +259,8 @@ public class SvnDiffProvider extends DiffProviderEx implements DiffProvider, Dif
return createResult(svnStatus.getRevision(), exists, false);
}
- private boolean itemExists(SVNStatus svnStatus) {
- return ! SVNStatusType.STATUS_DELETED.equals(svnStatus.getRemoteContentsStatus()) &&
- ! SVNStatusType.STATUS_DELETED.equals(svnStatus.getRemoteNodeStatus());
+ private boolean itemExists(Status svnStatus) {
+ return ! StatusType.STATUS_DELETED.equals(svnStatus.getRemoteContentsStatus()) &&
+ ! StatusType.STATUS_DELETED.equals(svnStatus.getRemoteNodeStatus());
}
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnFileSystemListener.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnFileSystemListener.java
index 5c5419d10ade..02185ec7f9a0 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnFileSystemListener.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnFileSystemListener.java
@@ -45,13 +45,16 @@ import com.intellij.util.containers.MultiMap;
import com.intellij.vcsUtil.ActionWithTempFile;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import org.jetbrains.idea.svn.api.Depth;
+import org.jetbrains.idea.svn.api.NodeKind;
import org.jetbrains.idea.svn.commandLine.SvnBindException;
-import org.tmatesoft.svn.core.*;
+import org.jetbrains.idea.svn.info.Info;
+import org.jetbrains.idea.svn.status.Status;
+import org.jetbrains.idea.svn.status.StatusType;
+import org.tmatesoft.svn.core.SVNErrorCode;
+import org.tmatesoft.svn.core.SVNException;
import org.tmatesoft.svn.core.internal.wc.SVNFileUtil;
-import org.tmatesoft.svn.core.wc.SVNInfo;
import org.tmatesoft.svn.core.wc.SVNMoveClient;
-import org.tmatesoft.svn.core.wc.SVNStatus;
-import org.tmatesoft.svn.core.wc.SVNStatusType;
import java.io.File;
import java.io.IOException;
@@ -153,8 +156,8 @@ public class SvnFileSystemListener extends CommandAdapter implements LocalFileOp
return null;
}
- final SVNStatus fileStatus = getFileStatus(vcs, srcFile);
- if (fileStatus != null && SvnVcs.svnStatusIs(fileStatus, SVNStatusType.STATUS_ADDED)) {
+ final Status fileStatus = getFileStatus(vcs, srcFile);
+ if (fileStatus != null && fileStatus.is(StatusType.STATUS_ADDED)) {
myAddedFiles.putValue(vcs.getProject(), new AddedFileInfo(toDir, copyName, null, false));
return null;
}
@@ -189,9 +192,9 @@ public class SvnFileSystemListener extends CommandAdapter implements LocalFileOp
@Nullable
public String getRepositoryUUID(final Project project, final VirtualFile dir) {
try {
- final SVNInfo info1 = new RepeatSvnActionThroughBusy() {
+ final Info info1 = new RepeatSvnActionThroughBusy() {
@Override
- protected void executeImpl() throws SVNException {
+ protected void executeImpl() {
myT = myVcs.getInfo(new File(dir.getPath()));
}
}.compute();
@@ -207,7 +210,8 @@ public class SvnFileSystemListener extends CommandAdapter implements LocalFileOp
} else {
return info1.getRepositoryUUID();
}
- } catch (SVNException e) {
+ }
+ catch (VcsException e) {
// go to return default
}
return null;
@@ -264,18 +268,18 @@ public class SvnFileSystemListener extends CommandAdapter implements LocalFileOp
final String list = isUndo ? null : SvnChangelistListener.getCurrentMapping(vcs, src);
WorkingCopyFormat format = vcs.getWorkingCopyFormat(src);
- final boolean is17OrLater = WorkingCopyFormat.ONE_DOT_EIGHT.equals(format) || WorkingCopyFormat.ONE_DOT_SEVEN.equals(format);
+ final boolean is17OrLater = format.isOrGreater(WorkingCopyFormat.ONE_DOT_SEVEN);
if (is17OrLater) {
- SVNStatus srcStatus = getFileStatus(vcs, src);
+ Status srcStatus = getFileStatus(vcs, src);
final File toDir = dst.getParentFile();
- SVNStatus dstStatus = getFileStatus(vcs, toDir);
- final boolean srcUnversioned = srcStatus == null || SvnVcs.svnStatusIsUnversioned(srcStatus);
- if (srcUnversioned && (dstStatus == null || SvnVcs.svnStatusIsUnversioned(dstStatus))) {
+ Status dstStatus = getFileStatus(vcs, toDir);
+ final boolean srcUnversioned = srcStatus == null || srcStatus.is(StatusType.STATUS_UNVERSIONED);
+ if (srcUnversioned && (dstStatus == null || dstStatus.is(StatusType.STATUS_UNVERSIONED))) {
return false;
}
if (srcUnversioned) {
- SVNStatus dstWasStatus = getFileStatus(vcs, dst);
- if (dstWasStatus == null || SvnVcs.svnStatusIsUnversioned(dstWasStatus)) {
+ Status dstWasStatus = getFileStatus(vcs, dst);
+ if (dstWasStatus == null || dstWasStatus.is(StatusType.STATUS_UNVERSIONED)) {
return false;
}
}
@@ -289,10 +293,6 @@ public class SvnFileSystemListener extends CommandAdapter implements LocalFileOp
}
dst.setLastModified(srcTime);
}
- catch (SVNException e) {
- addToMoveExceptions(vcs.getProject(), e);
- return false;
- }
catch(VcsException e) {
addToMoveExceptions(vcs.getProject(), e);
return false;
@@ -300,12 +300,12 @@ public class SvnFileSystemListener extends CommandAdapter implements LocalFileOp
return true;
}
- private final static Set<SVNStatusType> ourStatusesForUndoMove = new HashSet<SVNStatusType>();
+ private final static Set<StatusType> ourStatusesForUndoMove = new HashSet<StatusType>();
static {
- ourStatusesForUndoMove.add(SVNStatusType.STATUS_ADDED);
+ ourStatusesForUndoMove.add(StatusType.STATUS_ADDED);
}
- private boolean for17move(final SvnVcs vcs, final File src, final File dst, boolean undo, SVNStatus srcStatus) throws SVNException {
+ private boolean for17move(final SvnVcs vcs, final File src, final File dst, boolean undo, Status srcStatus) throws VcsException {
if (srcStatus != null && srcStatus.getCopyFromURL() == null) {
undo = false;
}
@@ -313,7 +313,7 @@ public class SvnFileSystemListener extends CommandAdapter implements LocalFileOp
myUndoingMove = true;
createRevertAction(vcs, dst, true).execute();
copyUnversionedMembersOfDirectory(src, dst);
- if (srcStatus == null || SvnVcs.svnStatusIsUnversioned(srcStatus)) {
+ if (srcStatus == null || srcStatus.is(StatusType.STATUS_UNVERSIONED)) {
FileUtil.delete(src);
} else {
createRevertAction(vcs, src, true).execute();
@@ -322,13 +322,13 @@ public class SvnFileSystemListener extends CommandAdapter implements LocalFileOp
} else {
if (doUsualMove(vcs, src)) return true;
// check destination directory
- final SVNStatus dstParentStatus = getFileStatus(vcs, dst.getParentFile());
- if (dstParentStatus == null || SvnVcs.svnStatusIsUnversioned(dstParentStatus)) {
+ final Status dstParentStatus = getFileStatus(vcs, dst.getParentFile());
+ if (dstParentStatus == null || dstParentStatus.is(StatusType.STATUS_UNVERSIONED)) {
try {
copyFileOrDir(src, dst);
}
catch (IOException e) {
- throw new SVNException(SVNErrorMessage.create(SVNErrorCode.IO_ERROR, e), e);
+ throw new SvnBindException(e);
}
createDeleteAction(vcs, src, true).execute();
return false;
@@ -338,23 +338,18 @@ public class SvnFileSystemListener extends CommandAdapter implements LocalFileOp
return false;
}
- public static void moveFileWithSvn(final SvnVcs vcs, final File src, final File dst) throws SVNException {
+ public static void moveFileWithSvn(final SvnVcs vcs, final File src, final File dst) throws VcsException {
new RepeatSvnActionThroughBusy() {
@Override
- protected void executeImpl() throws SVNException {
- try {
- vcs.getFactory(src).createCopyMoveClient().copy(src, dst, false, true);
- }
- catch (VcsException e) {
- wrapAndThrow(e);
- }
+ protected void executeImpl() throws VcsException {
+ vcs.getFactory(src).createCopyMoveClient().copy(src, dst, false, true);
}
}.execute();
}
- private void copyUnversionedMembersOfDirectory(final File src, final File dst) throws SVNException {
+ private void copyUnversionedMembersOfDirectory(final File src, final File dst) throws SvnBindException {
if (src.isDirectory()) {
- final SVNException[] exc = new SVNException[1];
+ final SvnBindException[] exc = new SvnBindException[1];
FileUtil.processFilesRecursively(src, new Processor<File>() {
@Override
public boolean process(File file) {
@@ -365,7 +360,7 @@ public class SvnFileSystemListener extends CommandAdapter implements LocalFileOp
copyFileOrDir(src, dst);
}
catch (IOException e) {
- exc[0] = new SVNException(SVNErrorMessage.create(SVNErrorCode.IO_ERROR, e), e);
+ exc[0] = new SvnBindException(e);
return false;
}
}
@@ -388,25 +383,25 @@ public class SvnFileSystemListener extends CommandAdapter implements LocalFileOp
private boolean doUsualMove(SvnVcs vcs, File src) {
// if src is not under version control, do usual move.
- SVNStatus srcStatus = getFileStatus(vcs, src);
- if (srcStatus == null || SvnVcs.svnStatusIsUnversioned(srcStatus) ||
- SvnVcs.svnStatusIs(srcStatus, SVNStatusType.STATUS_OBSTRUCTED) ||
- SvnVcs.svnStatusIs(srcStatus, SVNStatusType.STATUS_MISSING) ||
- SvnVcs.svnStatusIs(srcStatus, SVNStatusType.STATUS_EXTERNAL)) {
- return true;
- }
- return false;
+ Status srcStatus = getFileStatus(vcs, src);
+ return srcStatus == null ||
+ srcStatus.is(StatusType.STATUS_UNVERSIONED, StatusType.STATUS_OBSTRUCTED, StatusType.STATUS_MISSING, StatusType.STATUS_EXTERNAL);
}
- private boolean for16move(SvnVcs vcs, final File src, final File dst, boolean undo) throws SVNException {
+ private boolean for16move(SvnVcs vcs, final File src, final File dst, boolean undo) throws VcsException {
final SVNMoveClient mover = vcs.getSvnKitManager().createMoveClient();
if (undo) {
myUndoingMove = true;
restoreFromUndoStorage(dst);
new RepeatSvnActionThroughBusy() {
@Override
- protected void executeImpl() throws SVNException {
- mover.undoMove(src, dst);
+ protected void executeImpl() throws VcsException {
+ try {
+ mover.undoMove(src, dst);
+ }
+ catch (SVNException e) {
+ throw new SvnBindException(e);
+ }
}
}.execute();
}
@@ -415,8 +410,13 @@ public class SvnFileSystemListener extends CommandAdapter implements LocalFileOp
if (doUsualMove(vcs, src)) return true;
new RepeatSvnActionThroughBusy() {
@Override
- protected void executeImpl() throws SVNException {
- mover.doMove(src, dst);
+ protected void executeImpl() throws VcsException {
+ try {
+ mover.doMove(src, dst);
+ }
+ catch (SVNException e) {
+ throw new SvnBindException(e);
+ }
}
}.execute();
}
@@ -488,16 +488,14 @@ public class SvnFileSystemListener extends CommandAdapter implements LocalFileOp
return false;
}
- SVNStatus status = getFileStatus(vcs, ioFile);
+ Status status = getFileStatus(vcs, ioFile);
if (status == null ||
- SvnVcs.svnStatusIsUnversioned(status) ||
- SvnVcs.svnStatusIs(status, SVNStatusType.STATUS_OBSTRUCTED) ||
- SvnVcs.svnStatusIs(status, SVNStatusType.STATUS_MISSING) ||
- SvnVcs.svnStatusIs(status, SVNStatusType.STATUS_EXTERNAL) ||
- SvnVcs.svnStatusIs(status, SVNStatusType.STATUS_IGNORED)) {
+ status.is(StatusType.STATUS_UNVERSIONED, StatusType.STATUS_OBSTRUCTED, StatusType.STATUS_MISSING, StatusType.STATUS_EXTERNAL,
+ StatusType.STATUS_IGNORED)) {
return false;
- } else if (SvnVcs.svnStatusIs(status, SVNStatusType.STATUS_DELETED)) {
+ }
+ else if (status.is(StatusType.STATUS_DELETED)) {
if (isUndo(vcs)) {
moveToUndoStorage(file);
}
@@ -509,11 +507,11 @@ public class SvnFileSystemListener extends CommandAdapter implements LocalFileOp
myDeletedFiles.putValue(vcs.getProject(), ioFile);
return true;
}
- if (SvnVcs.svnStatusIs(status, SVNStatusType.STATUS_ADDED)) {
+ if (status.is(StatusType.STATUS_ADDED)) {
try {
createRevertAction(vcs, ioFile, false).execute();
}
- catch (SVNException e) {
+ catch (VcsException e) {
// ignore
}
}
@@ -531,13 +529,8 @@ public class SvnFileSystemListener extends CommandAdapter implements LocalFileOp
private RepeatSvnActionThroughBusy createRevertAction(@NotNull final SvnVcs vcs, @NotNull final File file, final boolean recursive) {
return new RepeatSvnActionThroughBusy() {
@Override
- protected void executeImpl() throws SVNException {
- try {
- vcs.getFactory(file).createRevertClient().revert(new File[]{file}, SVNDepth.fromRecurse(recursive), null);
- }
- catch (VcsException e) {
- wrapAndThrow(e);
- }
+ protected void executeImpl() throws VcsException {
+ vcs.getFactory(file).createRevertClient().revert(new File[]{file}, Depth.allOrFiles(recursive), null);
}
};
}
@@ -546,22 +539,12 @@ public class SvnFileSystemListener extends CommandAdapter implements LocalFileOp
private RepeatSvnActionThroughBusy createDeleteAction(@NotNull final SvnVcs vcs, @NotNull final File file, final boolean force) {
return new RepeatSvnActionThroughBusy() {
@Override
- protected void executeImpl() throws SVNException {
- try {
- vcs.getFactory(file).createDeleteClient().delete(file, force, false, null);
- }
- catch (VcsException e) {
- wrapAndThrow(e);
- }
+ protected void executeImpl() throws VcsException {
+ vcs.getFactory(file).createDeleteClient().delete(file, force, false, null);
}
};
}
- private static void wrapAndThrow(VcsException e) throws SVNException {
- // TODO: probably we should wrap into new exception only if e.getCause is not SVNException
- throw new SVNException(SVNErrorMessage.create(SVNErrorCode.FS_GENERAL, e), e);
- }
-
private boolean isAboveSourceOfCopyOrMove(final Project p, File ioFile) {
for (MovedFileInfo file : myMovedFiles) {
if (FileUtil.isAncestor(ioFile, file.mySrc, false)) return true;
@@ -617,20 +600,20 @@ public class SvnFileSystemListener extends CommandAdapter implements LocalFileOp
return false;
}
final File targetFile = new File(ioDir, name);
- SVNStatus status = getFileStatus(vcs, targetFile);
+ Status status = getFileStatus(vcs, targetFile);
- if (status == null || status.getContentsStatus() == SVNStatusType.STATUS_NONE ||
- status.getContentsStatus() == SVNStatusType.STATUS_UNVERSIONED) {
+ if (status == null || status.getContentsStatus() == StatusType.STATUS_NONE ||
+ status.getContentsStatus() == StatusType.STATUS_UNVERSIONED) {
myAddedFiles.putValue(vcs.getProject(), new AddedFileInfo(dir, name, null, recursive));
return false;
}
- else if (SvnVcs.svnStatusIs(status, SVNStatusType.STATUS_MISSING)) {
+ else if (status.is(StatusType.STATUS_MISSING)) {
return false;
}
- else if (SvnVcs.svnStatusIs(status, SVNStatusType.STATUS_DELETED)) {
- SVNNodeKind kind = status.getKind();
+ else if (status.is(StatusType.STATUS_DELETED)) {
+ NodeKind kind = status.getKind();
// kind differs.
- if (directory && kind != SVNNodeKind.DIR || !directory && kind != SVNNodeKind.FILE) {
+ if (directory && !kind.isDirectory() || !directory && !kind.isFile()) {
return false;
}
try {
@@ -641,7 +624,7 @@ public class SvnFileSystemListener extends CommandAdapter implements LocalFileOp
myAddedFiles.putValue(vcs.getProject(), new AddedFileInfo(dir, name, null, recursive));
return false;
}
- catch (SVNException e) {
+ catch (VcsException e) {
SVNFileUtil.deleteAll(targetFile, true);
return false;
}
@@ -794,23 +777,13 @@ public class SvnFileSystemListener extends CommandAdapter implements LocalFileOp
try {
new ActionWithTempFile(ioFile) {
protected void executeInternal() throws VcsException {
- try {
- // not recursive
- new RepeatSvnActionThroughBusy() {
- @Override
- protected void executeImpl() throws SVNException {
- try {
- vcs.getFactory(copyFrom).createCopyMoveClient().copy(copyFrom, ioFile, true, false);
- }
- catch (VcsException e) {
- wrapAndThrow(e);
- }
- }
- }.execute();
- }
- catch (SVNException e) {
- throw new VcsException(e);
- }
+ // not recursive
+ new RepeatSvnActionThroughBusy() {
+ @Override
+ protected void executeImpl() throws VcsException {
+ vcs.getFactory(copyFrom).createCopyMoveClient().copy(copyFrom, ioFile, true, false);
+ }
+ }.execute();
}
}.execute();
}
@@ -821,20 +794,15 @@ public class SvnFileSystemListener extends CommandAdapter implements LocalFileOp
else {
new RepeatSvnActionThroughBusy() {
@Override
- protected void executeImpl() throws SVNException {
- try {
- vcs.getFactory(ioFile).createAddClient().add(ioFile, null, false, false, true, null);
- }
- catch (VcsException e) {
- wrapAndThrow(e);
- }
+ protected void executeImpl() throws VcsException {
+ vcs.getFactory(ioFile).createAddClient().add(ioFile, null, false, false, true, null);
}
}.execute();
}
VcsDirtyScopeManager.getInstance(project).fileDirty(file);
}
- catch (SVNException e) {
- exceptions.add(new VcsException(e));
+ catch (VcsException e) {
+ exceptions.add(e);
}
}
}
@@ -880,8 +848,8 @@ public class SvnFileSystemListener extends CommandAdapter implements LocalFileOp
addedFile = myLfs.refreshAndFindFileByIoFile(ioFile);
}
if (addedFile != null) {
- final SVNStatus fileStatus = getFileStatus(vcs, ioFile);
- if (fileStatus == null || ! SvnVcs.svnStatusIs(fileStatus, SVNStatusType.STATUS_IGNORED)) {
+ final Status fileStatus = getFileStatus(vcs, ioFile);
+ if (fileStatus == null || !fileStatus.is(StatusType.STATUS_IGNORED)) {
boolean isIgnored = changeListManager.isIgnoredFile(addedFile);
if (!isIgnored) {
addedVFiles.add(addedFile);
@@ -935,8 +903,8 @@ public class SvnFileSystemListener extends CommandAdapter implements LocalFileOp
FileUtil.delete(file.getIOFile());
}
}
- } catch (SVNException e) {
- exceptions.add(new VcsException(e));
+ } catch (VcsException e) {
+ exceptions.add(e);
}
if (! exceptions.isEmpty()) {
vcsHelper.showErrors(exceptions, SvnBundle.message("delete.files.errors.title"));
@@ -962,8 +930,8 @@ public class SvnFileSystemListener extends CommandAdapter implements LocalFileOp
VcsDirtyScopeManager.getInstance(project).fileDirty(file);
}
}
- catch (SVNException e) {
- exceptions.add(new VcsException(e));
+ catch (VcsException e) {
+ exceptions.add(e);
}
}
}
@@ -988,7 +956,7 @@ public class SvnFileSystemListener extends CommandAdapter implements LocalFileOp
final String singleFilePrompt;
if (deletedFiles.size() == 1 && deletedFiles.get(0).getFirst().isDirectory()) {
- singleFilePrompt = WorkingCopyFormat.ONE_DOT_SEVEN.equals(deletedFiles.get(0).getSecond()) ?
+ singleFilePrompt = deletedFiles.get(0).getSecond().isOrGreater(WorkingCopyFormat.ONE_DOT_SEVEN) ?
SvnBundle.getString("confirmation.text.delete.dir.17") :
SvnBundle.getString("confirmation.text.delete.dir");
}
@@ -1004,17 +972,17 @@ public class SvnFileSystemListener extends CommandAdapter implements LocalFileOp
}
private void fillDeletedFiles(Project project, List<Pair<FilePath, WorkingCopyFormat>> deletedFiles, Collection<FilePath> deleteAnyway)
- throws SVNException {
+ throws VcsException {
final SvnVcs vcs = SvnVcs.getInstance(project);
final Collection<File> files = myDeletedFiles.remove(project);
for (final File file : files) {
- final SVNStatus status = new RepeatSvnActionThroughBusy() {
+ final Status status = new RepeatSvnActionThroughBusy() {
@Override
- protected void executeImpl() throws SVNException {
+ protected void executeImpl() throws VcsException {
myT = vcs.getFactory(file).createStatusClient().doStatus(file, false);
}
}.compute();
- boolean isAdded = SVNStatusType.STATUS_ADDED.equals(status.getNodeStatus());
+ boolean isAdded = StatusType.STATUS_ADDED.equals(status.getNodeStatus());
final FilePath filePath = VcsContextFactory.SERVICE.getInstance().createFilePathOn(file);
if (isAdded) {
deleteAnyway.add(filePath);
@@ -1059,16 +1027,16 @@ public class SvnFileSystemListener extends CommandAdapter implements LocalFileOp
}
@Nullable
- private static SVNStatus getFileStatus(@NotNull final SvnVcs vcs, @NotNull final File file) {
+ private static Status getFileStatus(@NotNull final SvnVcs vcs, @NotNull final File file) {
try {
return new RepeatSvnActionThroughBusy() {
@Override
- protected void executeImpl() throws SVNException {
+ protected void executeImpl() throws VcsException {
myT = vcs.getFactory(file).createStatusClient().doStatus(file, false);
}
}.compute();
}
- catch (SVNException e) {
+ catch (VcsException e) {
return null;
}
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnFileUrlMappingImpl.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnFileUrlMappingImpl.java
index f55f877fc965..11838314acbd 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnFileUrlMappingImpl.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnFileUrlMappingImpl.java
@@ -33,10 +33,10 @@ import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.messages.MessageBus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import org.jetbrains.idea.svn.info.Info;
import org.tmatesoft.svn.core.SVNException;
import org.tmatesoft.svn.core.SVNURL;
import org.tmatesoft.svn.core.internal.util.SVNPathUtil;
-import org.tmatesoft.svn.core.wc.SVNInfo;
import java.io.File;
import java.util.List;
@@ -388,7 +388,7 @@ public class SvnFileUrlMappingImpl implements SvnFileUrlMapping, PersistentState
if (copyRoot == null || vcsRoot == null) continue;
final SvnVcs vcs = SvnVcs.getInstance(myProject);
- final SVNInfo svnInfo = vcs.getInfo(copyRoot);
+ final Info svnInfo = vcs.getInfo(copyRoot);
if ((svnInfo == null) || (svnInfo.getRepositoryRootURL() == null)) continue;
Node node = new Node(copyRoot, svnInfo.getURL(), svnInfo.getRepositoryRootURL());
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnProgressCanceller.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnProgressCanceller.java
index 5163dfa0ffea..dbad319b413a 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnProgressCanceller.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnProgressCanceller.java
@@ -17,15 +17,15 @@ package org.jetbrains.idea.svn;
import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.progress.ProgressManager;
+import org.jetbrains.idea.svn.api.ProgressEvent;
+import org.jetbrains.idea.svn.api.ProgressTracker;
import org.tmatesoft.svn.core.SVNCancelException;
import org.tmatesoft.svn.core.SVNException;
-import org.tmatesoft.svn.core.wc.ISVNEventHandler;
-import org.tmatesoft.svn.core.wc.SVNEvent;
/**
* @author yole
*/
-public class SvnProgressCanceller implements ISVNEventHandler {
+public class SvnProgressCanceller implements ProgressTracker {
public void checkCancelled() throws SVNCancelException {
final ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator();
if (indicator != null && indicator.isCanceled()) {
@@ -33,6 +33,6 @@ public class SvnProgressCanceller implements ISVNEventHandler {
}
}
- public void handleEvent(final SVNEvent event, final double progress) throws SVNException {
+ public void consume(final ProgressEvent event) throws SVNException {
}
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnRecursiveStatusWalker.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnRecursiveStatusWalker.java
index 45b28e34b3d0..1b1cd00589d0 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnRecursiveStatusWalker.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnRecursiveStatusWalker.java
@@ -31,16 +31,16 @@ import com.intellij.util.Processor;
import com.intellij.vcsUtil.VcsUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import org.jetbrains.idea.svn.api.Depth;
+import org.jetbrains.idea.svn.commandLine.SvnBindException;
+import org.jetbrains.idea.svn.status.Status;
import org.jetbrains.idea.svn.status.StatusClient;
-import org.tmatesoft.svn.core.SVNDepth;
+import org.jetbrains.idea.svn.status.StatusConsumer;
+import org.jetbrains.idea.svn.status.StatusType;
import org.tmatesoft.svn.core.SVNErrorCode;
import org.tmatesoft.svn.core.SVNException;
-import org.tmatesoft.svn.core.SVNNodeKind;
import org.tmatesoft.svn.core.internal.wc.SVNFileUtil;
-import org.tmatesoft.svn.core.wc.ISVNStatusHandler;
import org.tmatesoft.svn.core.wc.SVNRevision;
-import org.tmatesoft.svn.core.wc.SVNStatus;
-import org.tmatesoft.svn.core.wc.SVNStatusType;
import java.io.File;
import java.util.LinkedList;
@@ -63,7 +63,7 @@ public class SvnRecursiveStatusWalker {
myHandler = new MyHandler();
}
- public void go(final FilePath rootPath, final SVNDepth depth) throws SVNException {
+ public void go(final FilePath rootPath, final Depth depth) throws SvnBindException {
final MyItem root = createItem(rootPath, depth, false);
myQueue.add(root);
@@ -81,23 +81,26 @@ public class SvnRecursiveStatusWalker {
client.doStatus(ioFile, SVNRevision.WORKING, item.getDepth(), false, false, true, true, myHandler, null);
myHandler.checkIfCopyRootWasReported(null, ioFile);
}
- catch (SVNException e) {
+ catch (SvnBindException e) {
handleStatusException(item, path, e);
}
} else {
try {
- final SVNStatus status = item.getClient().doStatus(ioFile, false, false);
+ final Status status = item.getClient().doStatus(ioFile, false);
myReceiver.process(path, status);
- } catch (SVNException e) {
+ }
+ catch (SvnBindException e) {
handleStatusException(item, path, e);
}
+ catch (SVNException e) {
+ handleStatusException(item, path, new SvnBindException(e));
+ }
}
}
}
- private void handleStatusException(MyItem item, FilePath path, SVNException e) throws SVNException {
- final SVNErrorCode errorCode = e.getErrorMessage().getErrorCode();
- if (SVNErrorCode.WC_NOT_DIRECTORY.equals(errorCode) || SVNErrorCode.WC_NOT_FILE.equals(errorCode)) {
+ private void handleStatusException(MyItem item, FilePath path, SvnBindException e) throws SvnBindException {
+ if (e.contains(SVNErrorCode.WC_NOT_DIRECTORY) || e.contains(SVNErrorCode.WC_NOT_FILE)) {
final VirtualFile virtualFile = path.getVirtualFile();
if (virtualFile != null) {
if (! myPartner.isExcluded(virtualFile)) {
@@ -116,11 +119,11 @@ public class SvnRecursiveStatusWalker {
private static class MyItem {
@NotNull private final FilePath myPath;
- @NotNull private final SVNDepth myDepth;
+ @NotNull private final Depth myDepth;
@NotNull private final StatusClient myStatusClient;
private final boolean myIsInnerCopyRoot;
- private MyItem(@NotNull FilePath path, @NotNull SVNDepth depth, boolean isInnerCopyRoot, @NotNull StatusClient statusClient) {
+ private MyItem(@NotNull FilePath path, @NotNull Depth depth, boolean isInnerCopyRoot, @NotNull StatusClient statusClient) {
myPath = path;
myDepth = depth;
myStatusClient = statusClient;
@@ -133,7 +136,7 @@ public class SvnRecursiveStatusWalker {
}
@NotNull
- public SVNDepth getDepth() {
+ public Depth getDepth() {
return myDepth;
}
@@ -147,13 +150,13 @@ public class SvnRecursiveStatusWalker {
}
}
- private void processRecursively(final VirtualFile vFile, final SVNDepth prevDepth) {
- if (SVNDepth.EMPTY.equals(prevDepth)) return;
+ private void processRecursively(final VirtualFile vFile, final Depth prevDepth) {
+ if (Depth.EMPTY.equals(prevDepth)) return;
if (myPartner.isIgnoredIdeaLevel(vFile)) {
myReceiver.processIgnored(vFile);
return;
}
- final SVNDepth newDepth = SVNDepth.INFINITY.equals(prevDepth) ? SVNDepth.INFINITY : SVNDepth.EMPTY;
+ final Depth newDepth = Depth.INFINITY.equals(prevDepth) ? Depth.INFINITY : Depth.EMPTY;
final File ioFile = new File(vFile.getPath());
final Processor<File> processor;
@@ -180,7 +183,7 @@ public class SvnRecursiveStatusWalker {
return true;
}
};
- if (SVNDepth.EMPTY.equals(newDepth)) {
+ if (Depth.EMPTY.equals(newDepth)) {
directoryFilter = Processor.TRUE;
processor = new Processor<File>() {
@Override
@@ -205,14 +208,14 @@ public class SvnRecursiveStatusWalker {
}
@NotNull
- private MyItem createItem(@NotNull FilePath path, @NotNull SVNDepth depth, boolean isInnerCopyRoot) {
+ private MyItem createItem(@NotNull FilePath path, @NotNull Depth depth, boolean isInnerCopyRoot) {
StatusClient statusClient =
myVcs.getFactory(path.getIOFile()).createStatusClient(myPartner.getFileProvider(), myPartner.getEventHandler());
return new MyItem(path, depth, isInnerCopyRoot, statusClient);
}
- private class MyHandler implements ISVNStatusHandler {
+ private class MyHandler implements StatusConsumer {
private MyItem myCurrentItem;
private boolean myMetCurrentItem;
@@ -221,37 +224,36 @@ public class SvnRecursiveStatusWalker {
myMetCurrentItem = false;
}
- public void checkIfCopyRootWasReported(@Nullable final SVNStatus ioFileStatus, final File ioFile) {
+ public void checkIfCopyRootWasReported(@Nullable final Status ioFileStatus, final File ioFile) {
File itemFile = myCurrentItem.getPath().getIOFile();
if (! myMetCurrentItem && FileUtil.filesEqual(ioFile, itemFile)) {
myMetCurrentItem = true;
- SVNStatus statusInner;
+ Status statusInner;
try {
- statusInner = ioFileStatus != null ? ioFileStatus :
- myCurrentItem.getClient().doStatus(itemFile, false);
+ statusInner = ioFileStatus != null ? ioFileStatus : myCurrentItem.getClient().doStatus(itemFile, false);
}
- catch (SVNException e) {
+ catch (SvnBindException e) {
LOG.info(e);
statusInner = null;
}
if (statusInner == null) return;
- final SVNStatusType status = statusInner.getNodeStatus();
+ final StatusType status = statusInner.getNodeStatus();
final VirtualFile vf = myCurrentItem.getPath().getVirtualFile();
- if (SVNStatusType.STATUS_IGNORED.equals(status)) {
+ if (StatusType.STATUS_IGNORED.equals(status)) {
if (vf != null) {
myReceiver.processIgnored(vf);
}
return;
}
- if (SVNStatusType.STATUS_UNVERSIONED.equals(status) || SVNStatusType.UNKNOWN.equals(status)) {
+ if (StatusType.STATUS_UNVERSIONED.equals(status) || StatusType.UNKNOWN.equals(status)) {
if (vf != null) {
myReceiver.processUnversioned(vf);
processRecursively(vf, myCurrentItem.getDepth());
}
return;
}
- if (SVNStatusType.OBSTRUCTED.equals(status) || SVNStatusType.STATUS_NONE.equals(status)) {
+ if (StatusType.OBSTRUCTED.equals(status) || StatusType.STATUS_NONE.equals(status)) {
return;
}
if (vf != null) {
@@ -264,7 +266,8 @@ public class SvnRecursiveStatusWalker {
}
}
- public void handleStatus(final SVNStatus status) throws SVNException {
+ @Override
+ public void consume(final Status status) throws SVNException {
myPartner.checkCanceled();
final File ioFile = status.getFile();
checkIfCopyRootWasReported(status, ioFile);
@@ -282,20 +285,20 @@ public class SvnRecursiveStatusWalker {
}
if (myProject.isDisposed()) throw new ProcessCanceledException();
- if ((vFile != null) && (SvnVcs.svnStatusIsUnversioned(status))) {
+ if ((vFile != null) && (status.is(StatusType.STATUS_UNVERSIONED))) {
if (vFile.isDirectory()) {
if (FileUtil.filesEqual(myCurrentItem.getPath().getIOFile(), ioFile)) {
//myReceiver.processUnversioned(vFile);
//processRecursively(vFile, myCurrentItem.getDepth());
} else {
- final MyItem childItem = createItem(new FilePathImpl(vFile), SVNDepth.INFINITY, true);
+ final MyItem childItem = createItem(new FilePathImpl(vFile), Depth.INFINITY, true);
myQueue.add(childItem);
}
} else {
myReceiver.processUnversioned(vFile);
}
} else {
- final FilePath path = VcsUtil.getFilePath(ioFile, status.getKind().equals(SVNNodeKind.DIR));
+ final FilePath path = VcsUtil.getFilePath(ioFile, status.getKind().isDirectory());
myReceiver.process(path, status);
}
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnRootsDetector.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnRootsDetector.java
index fd77d80fc565..78a02d28f2c0 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnRootsDetector.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnRootsDetector.java
@@ -29,9 +29,9 @@ import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.containers.Convertor;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import org.jetbrains.idea.svn.status.Status;
import org.tmatesoft.svn.core.SVNURL;
import org.tmatesoft.svn.core.internal.util.SVNURLUtil;
-import org.tmatesoft.svn.core.wc.SVNStatus;
import java.io.File;
import java.util.ArrayList;
@@ -165,7 +165,7 @@ public class SvnRootsDetector {
// TODO: No checked exceptions are thrown - remove catch/LOG.error/rethrow to fix real cause if any
try {
final File infoFile = VfsUtilCore.virtualToIoFile(info.getFile());
- final SVNStatus svnStatus = SvnUtil.getStatus(myVcs, infoFile);
+ final Status svnStatus = SvnUtil.getStatus(myVcs, infoFile);
if (svnStatus != null && svnStatus.getURL() != null) {
info.setUrl(svnStatus.getURL());
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnStatusConvertor.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnStatusConvertor.java
index 84c316691c1e..ced496e9fa2b 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnStatusConvertor.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnStatusConvertor.java
@@ -19,15 +19,15 @@ import com.intellij.openapi.vcs.FileStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.status.PortableStatus;
-import org.tmatesoft.svn.core.wc.SVNStatus;
-import org.tmatesoft.svn.core.wc.SVNStatusType;
+import org.jetbrains.idea.svn.status.Status;
+import org.jetbrains.idea.svn.status.StatusType;
public class SvnStatusConvertor {
private SvnStatusConvertor() {
}
@NotNull
- public static FileStatus convertStatus(@Nullable SVNStatusType itemStatus, @Nullable SVNStatusType propertiesStatus) {
+ public static FileStatus convertStatus(@Nullable StatusType itemStatus, @Nullable StatusType propertiesStatus) {
PortableStatus status = new PortableStatus();
status.setContentsStatus(itemStatus);
@@ -37,47 +37,47 @@ public class SvnStatusConvertor {
}
@NotNull
- public static FileStatus convertStatus(@Nullable final SVNStatus status) {
+ public static FileStatus convertStatus(@Nullable final Status status) {
if (status == null) {
return FileStatus.UNKNOWN;
}
- if (SvnVcs.svnStatusIsUnversioned(status)) {
+ if (status.is(StatusType.STATUS_UNVERSIONED)) {
return FileStatus.UNKNOWN;
}
- else if (SvnVcs.svnStatusIs(status, SVNStatusType.STATUS_MISSING)) {
+ else if (status.is(StatusType.STATUS_MISSING)) {
return FileStatus.DELETED_FROM_FS;
}
- else if (SvnVcs.svnStatusIs(status, SVNStatusType.STATUS_EXTERNAL)) {
+ else if (status.is(StatusType.STATUS_EXTERNAL)) {
return SvnFileStatus.EXTERNAL;
}
- else if (SvnVcs.svnStatusIs(status, SVNStatusType.STATUS_OBSTRUCTED)) {
+ else if (status.is(StatusType.STATUS_OBSTRUCTED)) {
return SvnFileStatus.OBSTRUCTED;
}
- else if (SvnVcs.svnStatusIs(status, SVNStatusType.STATUS_IGNORED)) {
+ else if (status.is(StatusType.STATUS_IGNORED)) {
return FileStatus.IGNORED;
}
- else if (SvnVcs.svnStatusIs(status, SVNStatusType.STATUS_ADDED)) {
+ else if (status.is(StatusType.STATUS_ADDED)) {
return FileStatus.ADDED;
}
- else if (SvnVcs.svnStatusIs(status, SVNStatusType.STATUS_DELETED)) {
+ else if (status.is(StatusType.STATUS_DELETED)) {
return FileStatus.DELETED;
}
- else if (SvnVcs.svnStatusIs(status, SVNStatusType.STATUS_REPLACED)) {
+ else if (status.is(StatusType.STATUS_REPLACED)) {
return SvnFileStatus.REPLACED;
}
- else if (status.getContentsStatus() == SVNStatusType.STATUS_CONFLICTED ||
- status.getPropertiesStatus() == SVNStatusType.STATUS_CONFLICTED) {
- if (status.getContentsStatus() == SVNStatusType.STATUS_CONFLICTED &&
- status.getPropertiesStatus() == SVNStatusType.STATUS_CONFLICTED) {
+ else if (status.getContentsStatus() == StatusType.STATUS_CONFLICTED ||
+ status.getPropertiesStatus() == StatusType.STATUS_CONFLICTED) {
+ if (status.getContentsStatus() == StatusType.STATUS_CONFLICTED &&
+ status.getPropertiesStatus() == StatusType.STATUS_CONFLICTED) {
return FileStatus.MERGED_WITH_BOTH_CONFLICTS;
}
- else if (status.getContentsStatus() == SVNStatusType.STATUS_CONFLICTED) {
+ else if (status.getContentsStatus() == StatusType.STATUS_CONFLICTED) {
return FileStatus.MERGED_WITH_CONFLICTS;
}
return FileStatus.MERGED_WITH_PROPERTY_CONFLICTS;
}
- else if (status.getContentsStatus() == SVNStatusType.STATUS_MODIFIED ||
- status.getPropertiesStatus() == SVNStatusType.STATUS_MODIFIED) {
+ else if (status.getContentsStatus() == StatusType.STATUS_MODIFIED ||
+ status.getPropertiesStatus() == StatusType.STATUS_MODIFIED) {
return FileStatus.MODIFIED;
}
else if (status.isSwitched()) {
@@ -90,38 +90,38 @@ public class SvnStatusConvertor {
}
@NotNull
- public static FileStatus convertPropertyStatus(final SVNStatusType status) {
+ public static FileStatus convertPropertyStatus(final StatusType status) {
if (status == null) {
return FileStatus.UNKNOWN;
}
- if (SVNStatusType.STATUS_UNVERSIONED.equals(status)) {
+ if (StatusType.STATUS_UNVERSIONED.equals(status)) {
return FileStatus.UNKNOWN;
}
- else if (SVNStatusType.STATUS_MISSING.equals(status)) {
+ else if (StatusType.STATUS_MISSING.equals(status)) {
return FileStatus.DELETED_FROM_FS;
}
- else if (SVNStatusType.STATUS_EXTERNAL.equals(status)) {
+ else if (StatusType.STATUS_EXTERNAL.equals(status)) {
return SvnFileStatus.EXTERNAL;
}
- else if (SVNStatusType.STATUS_OBSTRUCTED.equals(status)) {
+ else if (StatusType.STATUS_OBSTRUCTED.equals(status)) {
return SvnFileStatus.OBSTRUCTED;
}
- else if (SVNStatusType.STATUS_IGNORED.equals(status)) {
+ else if (StatusType.STATUS_IGNORED.equals(status)) {
return FileStatus.IGNORED;
}
- else if (SVNStatusType.STATUS_ADDED.equals(status)) {
+ else if (StatusType.STATUS_ADDED.equals(status)) {
return FileStatus.ADDED;
}
- else if (SVNStatusType.STATUS_DELETED.equals(status)) {
+ else if (StatusType.STATUS_DELETED.equals(status)) {
return FileStatus.DELETED;
}
- else if (SVNStatusType.STATUS_REPLACED.equals(status)) {
+ else if (StatusType.STATUS_REPLACED.equals(status)) {
return SvnFileStatus.REPLACED;
}
- else if (status == SVNStatusType.STATUS_CONFLICTED) {
+ else if (status == StatusType.STATUS_CONFLICTED) {
return FileStatus.MERGED_WITH_PROPERTY_CONFLICTS;
}
- else if (status == SVNStatusType.STATUS_MODIFIED) {
+ else if (status == StatusType.STATUS_MODIFIED) {
return FileStatus.MODIFIED;
}
return FileStatus.NOT_CHANGED;
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnUtil.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnUtil.java
index bd2882562404..43407f4b2064 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnUtil.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnUtil.java
@@ -45,9 +45,17 @@ import com.intellij.util.containers.MultiMap;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import org.jetbrains.idea.svn.api.Depth;
+import org.jetbrains.idea.svn.api.EventAction;
+import org.jetbrains.idea.svn.api.ProgressEvent;
+import org.jetbrains.idea.svn.api.ProgressTracker;
import org.jetbrains.idea.svn.branchConfig.SvnBranchConfigurationNew;
+import org.jetbrains.idea.svn.browse.DirectoryEntry;
+import org.jetbrains.idea.svn.browse.DirectoryEntryConsumer;
import org.jetbrains.idea.svn.commandLine.SvnBindException;
import org.jetbrains.idea.svn.dialogs.LockDialog;
+import org.jetbrains.idea.svn.info.Info;
+import org.jetbrains.idea.svn.status.Status;
import org.tmatesoft.sqljet.core.SqlJetException;
import org.tmatesoft.sqljet.core.table.SqlJetDb;
import org.tmatesoft.svn.core.*;
@@ -99,7 +107,7 @@ public class SvnUtil {
}
public static boolean isSvnVersioned(final @NotNull SvnVcs vcs, File parent) {
- final SVNInfo info = vcs.getInfo(parent);
+ final Info info = vcs.getInfo(parent);
return info != null;
}
@@ -157,7 +165,7 @@ public class SvnUtil {
@Nullable
public static String getExactLocation(final SvnVcs vcs, File path) {
- SVNInfo info = vcs.getInfo(path);
+ Info info = vcs.getInfo(path);
return info != null && info.getURL() != null ? info.getURL().toString() : null;
}
@@ -182,9 +190,9 @@ public class SvnUtil {
final VcsException[] exception = new VcsException[1];
final Collection<String> failedLocks = new ArrayList<String>();
final int[] count = new int[]{ioFiles.length};
- final ISVNEventHandler eventHandler = new ISVNEventHandler() {
- public void handleEvent(SVNEvent event, double progress) {
- if (event.getAction() == SVNEventAction.LOCK_FAILED) {
+ final ProgressTracker eventHandler = new ProgressTracker() {
+ public void consume(ProgressEvent event) {
+ if (event.getAction() == EventAction.LOCK_FAILED) {
failedLocks.add(event.getErrorMessage() != null ?
event.getErrorMessage().getFullMessage() :
event.getFile().getAbsolutePath());
@@ -247,9 +255,9 @@ public class SvnUtil {
final VcsException[] exception = new VcsException[1];
final Collection<String> failedUnlocks = new ArrayList<String>();
final int[] count = new int[]{ioFiles.length};
- final ISVNEventHandler eventHandler = new ISVNEventHandler() {
- public void handleEvent(SVNEvent event, double progress) {
- if (event.getAction() == SVNEventAction.UNLOCK_FAILED) {
+ final ProgressTracker eventHandler = new ProgressTracker() {
+ public void consume(ProgressEvent event) {
+ if (event.getAction() == EventAction.UNLOCK_FAILED) {
failedUnlocks.add(event.getErrorMessage() != null ?
event.getErrorMessage().getFullMessage() :
event.getFile().getAbsolutePath());
@@ -398,40 +406,41 @@ public class SvnUtil {
@Nullable
public static String getRepositoryUUID(final SvnVcs vcs, final File file) {
- final SVNInfo info = vcs.getInfo(file);
+ final Info info = vcs.getInfo(file);
return info != null ? info.getRepositoryUUID() : null;
}
@Nullable
public static String getRepositoryUUID(final SvnVcs vcs, final SVNURL url) {
try {
- final SVNInfo info = vcs.getInfo(url, SVNRevision.UNDEFINED);
+ final Info info = vcs.getInfo(url, SVNRevision.UNDEFINED);
return (info == null) ? null : info.getRepositoryUUID();
- } catch (SVNException e) {
+ }
+ catch (SvnBindException e) {
return null;
}
}
@Nullable
public static SVNURL getRepositoryRoot(final SvnVcs vcs, final File file) {
- final SVNInfo info = vcs.getInfo(file);
+ final Info info = vcs.getInfo(file);
return info != null ? info.getRepositoryRootURL() : null;
}
@Nullable
public static SVNURL getRepositoryRoot(final SvnVcs vcs, final String url) {
try {
- return getRepositoryRoot(vcs, SVNURL.parseURIEncoded(url));
+ return getRepositoryRoot(vcs, createUrl(url));
}
- catch (SVNException e) {
+ catch (SvnBindException e) {
return null;
}
}
@Nullable
- public static SVNURL getRepositoryRoot(final SvnVcs vcs, final SVNURL url) throws SVNException {
- SVNInfo info = vcs.getInfo(url, SVNRevision.HEAD);
+ public static SVNURL getRepositoryRoot(final SvnVcs vcs, final SVNURL url) throws SvnBindException {
+ Info info = vcs.getInfo(url, SVNRevision.HEAD);
return (info == null) ? null : info.getRepositoryRootURL();
}
@@ -496,17 +505,6 @@ public class SvnUtil {
}
@Nullable
- public static String getPathForProgress(final SVNEvent event) {
- if (event.getFile() != null) {
- return event.getFile().getName();
- }
- if (event.getURL() != null) {
- return event.getURL().toString();
- }
- return null;
- }
-
- @Nullable
public static VirtualFile correctRoot(final Project project, final VirtualFile file) {
if (file.getPath().length() == 0) {
// project root
@@ -533,19 +531,19 @@ public class SvnUtil {
}
@Nullable
- public static SVNStatus getStatus(@NotNull final SvnVcs vcs, @NotNull final File file) {
+ public static Status getStatus(@NotNull final SvnVcs vcs, @NotNull final File file) {
try {
return vcs.getFactory(file).createStatusClient().doStatus(file, false);
}
- catch (SVNException e) {
+ catch (SvnBindException e) {
return null;
}
}
- public static SVNDepth getDepth(final SvnVcs vcs, final File file) {
- SVNInfo info = vcs.getInfo(file);
+ public static Depth getDepth(final SvnVcs vcs, final File file) {
+ Info info = vcs.getInfo(file);
- return info != null && info.getDepth() != null ? info.getDepth() : SVNDepth.UNKNOWN;
+ return info != null && info.getDepth() != null ? info.getDepth() : Depth.UNKNOWN;
}
public static boolean seemsLikeVersionedDir(final VirtualFile file) {
@@ -579,7 +577,7 @@ public class SvnUtil {
@Nullable
public static SVNURL getUrl(final SvnVcs vcs, final File file) {
// todo for moved items?
- final SVNInfo info = vcs.getInfo(file);
+ final Info info = vcs.getInfo(file);
return info == null ? null : info.getURL();
}
@@ -587,15 +585,17 @@ public class SvnUtil {
public static boolean remoteFolderIsEmpty(final SvnVcs vcs, final String url) throws VcsException {
SvnTarget target = SvnTarget.fromURL(createUrl(url));
final Ref<Boolean> result = new Ref<Boolean>(true);
- ISVNDirEntryHandler handler = new ISVNDirEntryHandler() {
- public void handleDirEntry(final SVNDirEntry dirEntry) throws SVNException {
- if (dirEntry != null) {
+ DirectoryEntryConsumer handler = new DirectoryEntryConsumer() {
+
+ @Override
+ public void consume(final DirectoryEntry entry) throws SVNException {
+ if (entry != null) {
result.set(false);
}
}
};
- vcs.getFactory(target).createBrowseClient().list(target, null, SVNDepth.IMMEDIATES, handler);
+ vcs.getFactory(target).createBrowseClient().list(target, null, Depth.IMMEDIATES, handler);
return result.get();
}
@@ -637,9 +637,7 @@ public class SvnUtil {
WorkingCopyFormat format = getFormat(current);
- return WorkingCopyFormat.ONE_DOT_EIGHT.equals(format) || WorkingCopyFormat.ONE_DOT_SEVEN.equals(format)
- ? current
- : getWorkingCopyRoot(file);
+ return format.isOrGreater(WorkingCopyFormat.ONE_DOT_SEVEN) ? current : getWorkingCopyRoot(file);
}
private static File getParentWithDb(File file) {
@@ -695,14 +693,19 @@ public class SvnUtil {
}
@NotNull
- public static SVNRevision getHeadRevision(@NotNull SvnVcs vcs, @NotNull SVNURL url) throws SVNException {
- SVNInfo info = vcs.getInfo(url, SVNRevision.HEAD);
+ public static SVNURL removePathTail(@NotNull SVNURL url) throws SvnBindException {
+ return createUrl(SVNPathUtil.removeTail(url.toDecodedString()));
+ }
+
+ @NotNull
+ public static SVNRevision getHeadRevision(@NotNull SvnVcs vcs, @NotNull SVNURL url) throws SvnBindException {
+ Info info = vcs.getInfo(url, SVNRevision.HEAD);
if (info == null) {
- throw new SVNException(SVNErrorMessage.create(SVNErrorCode.UNKNOWN, "Could not get info for " + url));
+ throw new SvnBindException("Could not get info for " + url);
}
if (info.getRevision() == null) {
- throw new SVNException(SVNErrorMessage.create(SVNErrorCode.UNKNOWN, "Could not get revision for " + url));
+ throw new SvnBindException("Could not get revision for " + url);
}
return info.getRevision();
@@ -771,18 +774,18 @@ public class SvnUtil {
}
@Nullable
- public static String getChangelistName(@NotNull final SVNStatus status) {
+ public static String getChangelistName(@NotNull final Status status) {
// no explicit check on working copy format supports change lists as they are supported from svn 1.5
// and anyway status.getChangelistName() should just return null if change lists are not supported.
- return SVNNodeKind.FILE.equals(status.getKind()) ? status.getChangelistName() : null;
+ return status.getKind().isFile() ? status.getChangelistName() : null;
}
- public static boolean isUnversionedOrNotFound(@NotNull SVNErrorCode code) {
- return SVNErrorCode.WC_PATH_NOT_FOUND.equals(code) ||
- SVNErrorCode.UNVERSIONED_RESOURCE.equals(code) ||
- SVNErrorCode.WC_NOT_WORKING_COPY.equals(code) ||
+ public static boolean isUnversionedOrNotFound(@NotNull SvnBindException e) {
+ return e.contains(SVNErrorCode.WC_PATH_NOT_FOUND) ||
+ e.contains(SVNErrorCode.UNVERSIONED_RESOURCE) ||
+ e.contains(SVNErrorCode.WC_NOT_WORKING_COPY) ||
// thrown when getting info from repository for non-existent item - like HEAD revision for deleted file
- SVNErrorCode.ILLEGAL_TARGET.equals(code);
+ e.contains(SVNErrorCode.ILLEGAL_TARGET);
}
// TODO: Create custom Target class and implement append there
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnVcs.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnVcs.java
index ee4233fca1b2..5010ac580750 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnVcs.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnVcs.java
@@ -65,10 +65,12 @@ import org.jetbrains.idea.svn.actions.SvnMergeProvider;
import org.jetbrains.idea.svn.annotate.SvnAnnotationProvider;
import org.jetbrains.idea.svn.api.ClientFactory;
import org.jetbrains.idea.svn.api.CmdClientFactory;
+import org.jetbrains.idea.svn.api.Depth;
import org.jetbrains.idea.svn.api.SvnKitClientFactory;
import org.jetbrains.idea.svn.auth.SvnAuthenticationNotifier;
import org.jetbrains.idea.svn.checkin.SvnCheckinEnvironment;
import org.jetbrains.idea.svn.checkout.SvnCheckoutProvider;
+import org.jetbrains.idea.svn.commandLine.SvnBindException;
import org.jetbrains.idea.svn.commandLine.SvnExecutableChecker;
import org.jetbrains.idea.svn.dialogs.SvnBranchPointsCalculator;
import org.jetbrains.idea.svn.dialogs.WCInfo;
@@ -76,14 +78,19 @@ import org.jetbrains.idea.svn.history.LoadedRevisionsCache;
import org.jetbrains.idea.svn.history.SvnChangeList;
import org.jetbrains.idea.svn.history.SvnCommittedChangesProvider;
import org.jetbrains.idea.svn.history.SvnHistoryProvider;
+import org.jetbrains.idea.svn.info.Info;
+import org.jetbrains.idea.svn.info.InfoConsumer;
import org.jetbrains.idea.svn.properties.PropertyClient;
import org.jetbrains.idea.svn.rollback.SvnRollbackEnvironment;
+import org.jetbrains.idea.svn.status.Status;
+import org.jetbrains.idea.svn.status.StatusType;
import org.jetbrains.idea.svn.svnkit.SvnKitManager;
import org.jetbrains.idea.svn.update.SvnIntegrateEnvironment;
import org.jetbrains.idea.svn.update.SvnUpdateEnvironment;
import org.tmatesoft.svn.core.*;
import org.tmatesoft.svn.core.internal.wc.SVNAdminUtil;
-import org.tmatesoft.svn.core.wc.*;
+import org.tmatesoft.svn.core.wc.SVNPropertyData;
+import org.tmatesoft.svn.core.wc.SVNRevision;
import org.tmatesoft.svn.core.wc2.SvnTarget;
import java.io.File;
@@ -213,6 +220,10 @@ public class SvnVcs extends AbstractVcs<CommittedChangeList> {
myWorkingCopiesContent.activate();
}
+ /**
+ * TODO: This seems to be related to some issues when upgrading from 1.6 to 1.7. So it is not currently required for 1.8 and later
+ * TODO: formats. And should be removed when 1.6 working copies are no longer supported by IDEA.
+ */
private void cleanup17copies() {
final Runnable callCleanupWorker = new Runnable() {
public void run() {
@@ -251,7 +262,7 @@ public class SvnVcs extends AbstractVcs<CommittedChangeList> {
public boolean checkCommandLineVersion() {
boolean isValid = true;
- if (!isProject16() && (myConfiguration.isCommandLine() || isProject18())) {
+ if (!isProject16() && (myConfiguration.isCommandLine() || isProject18OrGreater())) {
isValid = myChecker.checkExecutableAndNotifyIfNeeded();
}
@@ -588,30 +599,19 @@ public class SvnVcs extends AbstractVcs<CommittedChangeList> {
public boolean fileExistsInVcs(FilePath path) {
File file = path.getIOFile();
try {
- SVNStatus status = getFactory(file).createStatusClient().doStatus(file, false);
+ Status status = getFactory(file).createStatusClient().doStatus(file, false);
if (status != null) {
- if (svnStatusIs(status, SVNStatusType.STATUS_ADDED)) {
- return status.isCopied();
- }
- return !(svnStatusIsUnversioned(status) ||
- svnStatusIs(status, SVNStatusType.STATUS_IGNORED) ||
- svnStatusIs(status, SVNStatusType.STATUS_OBSTRUCTED));
+ return status.is(StatusType.STATUS_ADDED)
+ ? status.isCopied()
+ : !status.is(StatusType.STATUS_UNVERSIONED, StatusType.STATUS_IGNORED, StatusType.STATUS_OBSTRUCTED);
}
}
- catch (SVNException e) {
+ catch (SvnBindException e) {
LOG.info(e);
}
return false;
}
- public static boolean svnStatusIsUnversioned(final SVNStatus status) {
- return svnStatusIs(status, SVNStatusType.STATUS_UNVERSIONED);
- }
-
- public static boolean svnStatusIs(final SVNStatus status, @NotNull final SVNStatusType value) {
- return value.equals(status.getNodeStatus()) || value.equals(status.getContentsStatus());
- }
-
@Override
public boolean fileIsUnderVcs(FilePath path) {
final ChangeListManager clManager = ChangeListManager.getInstance(myProject);
@@ -623,33 +623,33 @@ public class SvnVcs extends AbstractVcs<CommittedChangeList> {
}
@Nullable
- public SVNInfo getInfo(@NotNull SVNURL url,
+ public Info getInfo(@NotNull SVNURL url,
SVNRevision pegRevision,
- SVNRevision revision) throws SVNException {
+ SVNRevision revision) throws SvnBindException {
return getFactory().createInfoClient().doInfo(url, pegRevision, revision);
}
@Nullable
- public SVNInfo getInfo(@NotNull SVNURL url, SVNRevision revision) throws SVNException {
+ public Info getInfo(@NotNull SVNURL url, SVNRevision revision) throws SvnBindException {
return getInfo(url, SVNRevision.UNDEFINED, revision);
}
@Nullable
- public SVNInfo getInfo(@NotNull final VirtualFile file) {
+ public Info getInfo(@NotNull final VirtualFile file) {
return getInfo(new File(file.getPath()));
}
@Nullable
- public SVNInfo getInfo(@NotNull String path) {
+ public Info getInfo(@NotNull String path) {
return getInfo(new File(path));
}
@Nullable
- public SVNInfo getInfo(@NotNull File ioFile) {
+ public Info getInfo(@NotNull File ioFile) {
return getInfo(ioFile, SVNRevision.UNDEFINED);
}
- public void collectInfo(@NotNull Collection<File> files, @Nullable ISVNInfoHandler handler) {
+ public void collectInfo(@NotNull Collection<File> files, @Nullable InfoConsumer handler) {
File first = ContainerUtil.getFirstItem(files);
if (first != null) {
@@ -663,41 +663,42 @@ public class SvnVcs extends AbstractVcs<CommittedChangeList> {
// TODO: Generally this should be moved in SvnKit info client implementation.
// TODO: Currently left here to have exception logic as in handleInfoException to be applied for each file separately.
for (File file : files) {
- SVNInfo info = getInfo(file);
+ Info info = getInfo(file);
if (handler != null) {
- handler.handleInfo(info);
+ handler.consume(info);
}
}
}
}
catch (SVNException e) {
+ handleInfoException(new SvnBindException(e));
+ }
+ catch (SvnBindException e) {
handleInfoException(e);
}
}
}
@Nullable
- public SVNInfo getInfo(@NotNull File ioFile, @NotNull SVNRevision revision) {
- SVNInfo result = null;
+ public Info getInfo(@NotNull File ioFile, @NotNull SVNRevision revision) {
+ Info result = null;
try {
result = getFactory(ioFile).createInfoClient().doInfo(ioFile, revision);
}
- catch (SVNException e) {
+ catch (SvnBindException e) {
handleInfoException(e);
}
return result;
}
- private void handleInfoException(SVNException e) {
- final SVNErrorCode errorCode = e.getErrorMessage().getErrorCode();
-
+ private void handleInfoException(@NotNull SvnBindException e) {
if (!myLogExceptions ||
- SvnUtil.isUnversionedOrNotFound(errorCode) ||
+ SvnUtil.isUnversionedOrNotFound(e) ||
// do not log working copy format vs client version inconsistencies as errors
- SVNErrorCode.WC_UNSUPPORTED_FORMAT.equals(errorCode) ||
- SVNErrorCode.WC_UPGRADE_REQUIRED.equals(errorCode)) {
+ e.contains(SVNErrorCode.WC_UNSUPPORTED_FORMAT) ||
+ e.contains(SVNErrorCode.WC_UPGRADE_REQUIRED)) {
LOG.debug(e);
}
else {
@@ -797,7 +798,7 @@ public class SvnVcs extends AbstractVcs<CommittedChangeList> {
List<WCInfo> result = new ArrayList<WCInfo>(getAllWcInfos());
for (RootUrlInfo info : getSvnFileUrlMapping().getErrorRoots()) {
- result.add(new WCInfo(info, SvnUtil.isWorkingCopyRoot(info.getIoFile()), SVNDepth.UNKNOWN));
+ result.add(new WCInfo(info, SvnUtil.isWorkingCopyRoot(info.getIoFile()), Depth.UNKNOWN));
}
return result;
@@ -948,14 +949,15 @@ public class SvnVcs extends AbstractVcs<CommittedChangeList> {
return svnKitManager;
}
- public boolean isProject18() {
- return WorkingCopyFormat.ONE_DOT_EIGHT.equals(getProjectRootFormat());
+ public boolean isProject18OrGreater() {
+ return getProjectRootFormat().isOrGreater(WorkingCopyFormat.ONE_DOT_EIGHT);
}
public boolean isProject16() {
return WorkingCopyFormat.ONE_DOT_SIX.equals(getProjectRootFormat());
}
+ @NotNull
private WorkingCopyFormat getProjectRootFormat() {
return !getProject().isDefault() ? getWorkingCopyFormat(new File(getProject().getBaseDir().getPath())) : WorkingCopyFormat.UNKNOWN;
}
@@ -993,11 +995,11 @@ public class SvnVcs extends AbstractVcs<CommittedChangeList> {
@NotNull
private ClientFactory getFactory(@NotNull WorkingCopyFormat format, boolean useProjectRootForUnknown) {
- boolean is18 = WorkingCopyFormat.ONE_DOT_EIGHT.equals(format);
+ boolean is18OrGreater = format.isOrGreater(WorkingCopyFormat.ONE_DOT_EIGHT);
boolean is16 = WorkingCopyFormat.ONE_DOT_SIX.equals(format);
boolean isUnknown = WorkingCopyFormat.UNKNOWN.equals(format);
- return is18
+ return is18OrGreater
? cmdClientFactory
: (is16 ? svnKitClientFactory : (useProjectRootForUnknown && isUnknown ? getFactory() : getFactoryFromSettings()));
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/AbstractShowPropertiesDiffAction.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/AbstractShowPropertiesDiffAction.java
index 223c69ab1c6f..97e6a618ba7c 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/AbstractShowPropertiesDiffAction.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/AbstractShowPropertiesDiffAction.java
@@ -40,8 +40,8 @@ import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.SvnBundle;
import org.jetbrains.idea.svn.SvnRevisionNumber;
import org.jetbrains.idea.svn.SvnVcs;
+import org.jetbrains.idea.svn.api.Depth;
import org.jetbrains.idea.svn.history.SvnRepositoryContentRevision;
-import org.jetbrains.idea.svn.properties.PropertyClient;
import org.tmatesoft.svn.core.*;
import org.tmatesoft.svn.core.wc.ISVNPropertyHandler;
import org.tmatesoft.svn.core.wc.SVNPropertyData;
@@ -276,7 +276,7 @@ public abstract class AbstractShowPropertiesDiffAction extends AnAction implemen
final List<SVNPropertyData> lines = new ArrayList<SVNPropertyData>();
final ISVNPropertyHandler propertyHandler = createHandler(revision, lines);
- vcs.getFactory(target).createPropertyClient().list(target, revision, SVNDepth.EMPTY, propertyHandler);
+ vcs.getFactory(target).createPropertyClient().list(target, revision, Depth.EMPTY, propertyHandler);
return toSortedStringPresentation(lines);
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/CleanupWorker.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/CleanupWorker.java
index 7623f083eb86..dc6fb8c0d55b 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/CleanupWorker.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/CleanupWorker.java
@@ -30,10 +30,10 @@ import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.idea.svn.SvnBundle;
import org.jetbrains.idea.svn.SvnVcs;
+import org.jetbrains.idea.svn.api.ProgressEvent;
+import org.jetbrains.idea.svn.api.ProgressTracker;
import org.tmatesoft.svn.core.SVNCancelException;
import org.tmatesoft.svn.core.SVNException;
-import org.tmatesoft.svn.core.wc.ISVNEventHandler;
-import org.tmatesoft.svn.core.wc.SVNEvent;
import java.io.File;
import java.util.LinkedList;
@@ -69,9 +69,9 @@ public class CleanupWorker {
final File path = new File(root.getPath());
indicator.setText(SvnBundle.message("action.Subversion.cleanup.progress.text", path));
- ISVNEventHandler handler = new ISVNEventHandler() {
+ ProgressTracker handler = new ProgressTracker() {
@Override
- public void handleEvent(SVNEvent event, double progress) throws SVNException {
+ public void consume(ProgressEvent event) throws SVNException {
}
@Override
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/CreateBranchOrTagAction.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/CreateBranchOrTagAction.java
index 7655751ded40..c6f633416a15 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/CreateBranchOrTagAction.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/CreateBranchOrTagAction.java
@@ -37,6 +37,7 @@ import org.jetbrains.idea.svn.SvnStatusUtil;
import org.jetbrains.idea.svn.SvnVcs;
import org.jetbrains.idea.svn.checkin.CommitEventHandler;
import org.jetbrains.idea.svn.checkin.IdeaCommitHandler;
+import org.jetbrains.idea.svn.commandLine.SvnBindException;
import org.jetbrains.idea.svn.dialogs.CreateBranchOrTagDialog;
import org.jetbrains.idea.svn.update.AutoSvnUpdater;
import org.jetbrains.idea.svn.update.SingleRootSwitcher;
@@ -86,17 +87,17 @@ public class CreateBranchOrTagAction extends BasicAction {
srcUrl = SVNURL.parseURIEncoded(dialog.getCopyFromUrl());
dstSvnUrl = SVNURL.parseURIEncoded(dstURL);
parentUrl = dstSvnUrl.removePathTail();
-
- if (!dirExists(activeVcs, parentUrl)) {
- int rc = Messages.showYesNoDialog(project, "The repository path '" + parentUrl + "' does not exist. Would you like to create it?",
- "Branch or Tag", Messages.getQuestionIcon());
- if (rc == Messages.NO) {
- return;
- }
- }
}
catch (SVNException e) {
- throw new VcsException(e);
+ throw new SvnBindException(e);
+ }
+
+ if (!dirExists(activeVcs, parentUrl)) {
+ int rc = Messages.showYesNoDialog(project, "The repository path '" + parentUrl + "' does not exist. Would you like to create it?",
+ "Branch or Tag", Messages.getQuestionIcon());
+ if (rc == Messages.NO) {
+ return;
+ }
}
Runnable copyCommand = new Runnable() {
@@ -145,8 +146,8 @@ public class CreateBranchOrTagAction extends BasicAction {
}
}
- private static boolean dirExists(@NotNull final SvnVcs vcs, @NotNull final SVNURL url) throws SVNException {
- final Ref<SVNException> excRef = new Ref<SVNException>();
+ private static boolean dirExists(@NotNull final SvnVcs vcs, @NotNull final SVNURL url) throws SvnBindException {
+ final Ref<SvnBindException> excRef = new Ref<SvnBindException>();
final Ref<Boolean> resultRef = new Ref<Boolean>(Boolean.TRUE);
final Runnable taskImpl = new Runnable() {
@@ -154,8 +155,8 @@ public class CreateBranchOrTagAction extends BasicAction {
try {
vcs.getInfo(url, SVNRevision.HEAD);
}
- catch (SVNException e) {
- if (e.getErrorMessage().getErrorCode().equals(SVNErrorCode.RA_ILLEGAL_URL)) {
+ catch (SvnBindException e) {
+ if (e.contains(SVNErrorCode.RA_ILLEGAL_URL)) {
resultRef.set(Boolean.FALSE);
}
else {
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/CreateExternalAction.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/CreateExternalAction.java
index b65332a44604..31206eec045c 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/CreateExternalAction.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/CreateExternalAction.java
@@ -18,7 +18,6 @@ package org.jetbrains.idea.svn.actions;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.CommonDataKeys;
import com.intellij.openapi.actionSystem.DataContext;
-import com.intellij.openapi.actionSystem.PlatformDataKeys;
import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.progress.ProgressManager;
import com.intellij.openapi.progress.Task;
@@ -38,11 +37,13 @@ import org.jetbrains.idea.svn.SvnBundle;
import org.jetbrains.idea.svn.SvnPropertyKeys;
import org.jetbrains.idea.svn.SvnVcs;
import org.jetbrains.idea.svn.api.ClientFactory;
+import org.jetbrains.idea.svn.api.Depth;
+import org.jetbrains.idea.svn.api.ProgressEvent;
+import org.jetbrains.idea.svn.api.ProgressTracker;
import org.jetbrains.idea.svn.commandLine.CommandUtil;
import org.jetbrains.idea.svn.dialogs.SelectCreateExternalTargetDialog;
import org.jetbrains.idea.svn.update.UpdateClient;
import org.tmatesoft.svn.core.SVNCancelException;
-import org.tmatesoft.svn.core.SVNDepth;
import org.tmatesoft.svn.core.SVNException;
import org.tmatesoft.svn.core.SVNPropertyValue;
import org.tmatesoft.svn.core.internal.wc.SVNExternal;
@@ -100,9 +101,9 @@ public class CreateExternalAction extends DumbAwareAction {
if (checkout) {
// +-
final UpdateClient client = vcs.getFactory(ioFile).createUpdateClient();
- client.setEventHandler(new ISVNEventHandler() {
+ client.setEventHandler(new ProgressTracker() {
@Override
- public void handleEvent(SVNEvent event, double progress) throws SVNException {
+ public void consume(ProgressEvent event) throws SVNException {
}
@Override
@@ -111,7 +112,7 @@ public class CreateExternalAction extends DumbAwareAction {
if (pi != null && pi.isCanceled()) throw new SVNCancelException();
}
});
- client.doUpdate(ioFile, SVNRevision.HEAD, SVNDepth.UNKNOWN, false, false);
+ client.doUpdate(ioFile, SVNRevision.HEAD, Depth.UNKNOWN, false, false);
vf.refresh(true, true, new Runnable() {
@Override
public void run() {
@@ -148,7 +149,7 @@ public class CreateExternalAction extends DumbAwareAction {
} else {
newValue = createExternalDefinitionString(url, target);
}
- factory.createPropertyClient().setProperty(ioFile, SvnPropertyKeys.SVN_EXTERNALS, SVNPropertyValue.create(newValue), SVNDepth.EMPTY,
+ factory.createPropertyClient().setProperty(ioFile, SvnPropertyKeys.SVN_EXTERNALS, SVNPropertyValue.create(newValue), Depth.EMPTY,
false);
return false;
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/MarkLocallyDeletedTreeConflictResolvedAction.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/MarkLocallyDeletedTreeConflictResolvedAction.java
index 10793269c041..2e400adfd8fa 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/MarkLocallyDeletedTreeConflictResolvedAction.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/MarkLocallyDeletedTreeConflictResolvedAction.java
@@ -36,7 +36,7 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.idea.svn.SvnBundle;
import org.jetbrains.idea.svn.SvnLocallyDeletedChange;
import org.jetbrains.idea.svn.SvnVcs;
-import org.tmatesoft.svn.core.SVNDepth;
+import org.jetbrains.idea.svn.api.Depth;
import java.util.Collections;
import java.util.List;
@@ -93,7 +93,7 @@ public class MarkLocallyDeletedTreeConflictResolvedAction extends AnAction {
SvnVcs vcs = SvnVcs.getInstance(project);
try {
- vcs.getFactory(path.getIOFile()).createConflictClient().resolve(path.getIOFile(), SVNDepth.EMPTY, false, false, true);
+ vcs.getFactory(path.getIOFile()).createConflictClient().resolve(path.getIOFile(), Depth.EMPTY, false, false, true);
}
catch (VcsException e) {
exception.set(e);
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/MarkResolvedAction.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/MarkResolvedAction.java
index d20b5f14d6b5..6d51d9d90dd8 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/MarkResolvedAction.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/MarkResolvedAction.java
@@ -33,12 +33,15 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.idea.svn.SvnBundle;
import org.jetbrains.idea.svn.SvnStatusUtil;
import org.jetbrains.idea.svn.SvnVcs;
+import org.jetbrains.idea.svn.api.Depth;
+import org.jetbrains.idea.svn.commandLine.SvnBindException;
import org.jetbrains.idea.svn.conflict.ConflictClient;
import org.jetbrains.idea.svn.dialogs.SelectFilesDialog;
+import org.jetbrains.idea.svn.status.Status;
import org.jetbrains.idea.svn.status.StatusClient;
-import org.tmatesoft.svn.core.SVNDepth;
-import org.tmatesoft.svn.core.SVNException;
-import org.tmatesoft.svn.core.wc.*;
+import org.jetbrains.idea.svn.status.StatusConsumer;
+import org.jetbrains.idea.svn.status.StatusType;
+import org.tmatesoft.svn.core.wc.SVNRevision;
import java.io.File;
import java.util.Collection;
@@ -98,7 +101,7 @@ public class MarkResolvedAction extends BasicAction {
ConflictClient client = vcs.getFactory(ioFile).createConflictClient();
// TODO: Probably false should be passed to "resolveTree", but previous logic used true implicitly
- client.resolve(ioFile, SVNDepth.EMPTY, true, true, true);
+ client.resolve(ioFile, Depth.EMPTY, true, true, true);
}
}
finally {
@@ -124,16 +127,17 @@ public class MarkResolvedAction extends BasicAction {
File path = new File(file.getPath());
StatusClient client = vcs.getFactory(path).createStatusClient();
- client.doStatus(path, true, false, false, false, new ISVNStatusHandler() {
- public void handleStatus(SVNStatus status) {
- if (status.getContentsStatus() == SVNStatusType.STATUS_CONFLICTED ||
- status.getPropertiesStatus() == SVNStatusType.STATUS_CONFLICTED) {
+ client.doStatus(path, SVNRevision.UNDEFINED, Depth.INFINITY, false, false, false, false, new StatusConsumer() {
+ @Override
+ public void consume(Status status) {
+ if (status.getContentsStatus() == StatusType.STATUS_CONFLICTED ||
+ status.getPropertiesStatus() == StatusType.STATUS_CONFLICTED) {
target.add(status.getFile().getAbsolutePath());
}
}
- });
+ }, null);
}
- catch (SVNException e) {
+ catch (SvnBindException e) {
LOG.warn(e);
}
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/MarkTreeConflictResolvedAction.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/MarkTreeConflictResolvedAction.java
index 73d9c28eb48d..10330ded734c 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/MarkTreeConflictResolvedAction.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/MarkTreeConflictResolvedAction.java
@@ -37,7 +37,7 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.idea.svn.ConflictedSvnChange;
import org.jetbrains.idea.svn.SvnBundle;
import org.jetbrains.idea.svn.SvnVcs;
-import org.tmatesoft.svn.core.SVNDepth;
+import org.jetbrains.idea.svn.api.Depth;
import java.util.ArrayList;
import java.util.Collection;
@@ -114,7 +114,7 @@ public class MarkTreeConflictResolvedAction extends AnAction implements DumbAwar
SvnVcs vcs = SvnVcs.getInstance(checker.getProject());
try {
- vcs.getFactory(path.getIOFile()).createConflictClient().resolve(path.getIOFile(), SVNDepth.EMPTY, false, false, true);
+ vcs.getFactory(path.getIOFile()).createConflictClient().resolve(path.getIOFile(), Depth.EMPTY, false, false, true);
}
catch (VcsException e) {
exception.set(e);
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/RelocateAction.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/RelocateAction.java
index 87615a08588c..af601f3cd126 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/RelocateAction.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/RelocateAction.java
@@ -28,7 +28,7 @@ import com.intellij.util.WaitForProgressToShow;
import org.jetbrains.idea.svn.SvnStatusUtil;
import org.jetbrains.idea.svn.SvnVcs;
import org.jetbrains.idea.svn.dialogs.RelocateDialog;
-import org.tmatesoft.svn.core.wc.SVNInfo;
+import org.jetbrains.idea.svn.info.Info;
import java.io.File;
@@ -49,7 +49,7 @@ public class RelocateAction extends BasicAction {
}
protected void perform(final Project project, final SvnVcs activeVcs, final VirtualFile file, DataContext context) throws VcsException {
- SVNInfo info = activeVcs.getInfo(file);
+ Info info = activeVcs.getInfo(file);
assert info != null;
RelocateDialog dlg = new RelocateDialog(project, info.getURL());
dlg.show();
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/SetPropertyAction.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/SetPropertyAction.java
index 3f740bad1bef..cdc738cf2d40 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/SetPropertyAction.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/SetPropertyAction.java
@@ -27,9 +27,9 @@ import com.intellij.openapi.vcs.changes.VcsDirtyScopeManager;
import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.idea.svn.SvnBundle;
import org.jetbrains.idea.svn.SvnVcs;
+import org.jetbrains.idea.svn.api.Depth;
import org.jetbrains.idea.svn.dialogs.SetPropertyDialog;
import org.jetbrains.idea.svn.properties.PropertyClient;
-import org.tmatesoft.svn.core.SVNDepth;
import org.tmatesoft.svn.core.SVNPropertyValue;
import java.io.File;
@@ -79,7 +79,7 @@ public class SetPropertyAction extends BasicAction {
// TODO: most likely SVNDepth.getInfinityOrEmptyDepth should be used instead of SVNDepth.fromRecursive - to have either "infinity"
// TODO: or "empty" depth, and not "infinity" or "files" depth. But previous logic used SVNDepth.fromRecursive implicitly
- client.setProperty(ioFile, name, SVNPropertyValue.create(value), SVNDepth.fromRecurse(recursive), false);
+ client.setProperty(ioFile, name, SVNPropertyValue.create(value), Depth.allOrFiles(recursive), false);
}
for(int i = 0; i < file.length; i++) {
if (recursive && file[i].isDirectory()) {
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/ShareProjectAction.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/ShareProjectAction.java
index 7f648dce75b9..012a870676a0 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/ShareProjectAction.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/ShareProjectAction.java
@@ -35,9 +35,9 @@ import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.idea.svn.*;
import org.jetbrains.idea.svn.api.ClientFactory;
+import org.jetbrains.idea.svn.api.Depth;
import org.jetbrains.idea.svn.checkout.SvnCheckoutProvider;
import org.jetbrains.idea.svn.dialogs.ShareDialog;
-import org.tmatesoft.svn.core.SVNDepth;
import org.tmatesoft.svn.core.SVNException;
import org.tmatesoft.svn.core.SVNURL;
import org.tmatesoft.svn.core.wc.SVNRevision;
@@ -167,7 +167,7 @@ public class ShareProjectAction extends BasicAction {
final ClientFactory factory = SvnCheckoutProvider.getFactory(activeVcs, format);
factory.createCheckoutClient()
- .checkout(SvnTarget.fromURL(checkoutUrl), path, revision, SVNDepth.INFINITY, false, false, format, null);
+ .checkout(SvnTarget.fromURL(checkoutUrl), path, revision, Depth.INFINITY, false, false, format, null);
addRecursively(activeVcs, factory, file);
} catch (SVNException e) {
error[0] = e;
@@ -254,9 +254,9 @@ public class ShareProjectAction extends BasicAction {
indicator.checkCanceled();
indicator.setText(SvnBundle.message("share.or.import.add.progress.text", virtualFile.getPath()));
}
- factory.createAddClient().add(ioFile, SVNDepth.EMPTY, false, false, true, null);
+ factory.createAddClient().add(ioFile, Depth.EMPTY, false, false, true, null);
}
- }, SVNDepth.INFINITY);
+ }, Depth.INFINITY);
operation.execute(file);
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/SvnExcludingIgnoredOperation.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/SvnExcludingIgnoredOperation.java
index 49fdc0279dd5..c206cd3451d8 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/SvnExcludingIgnoredOperation.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/SvnExcludingIgnoredOperation.java
@@ -26,14 +26,14 @@ import com.intellij.openapi.vfs.VfsUtilCore;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.VirtualFileVisitor;
import org.jetbrains.annotations.NotNull;
-import org.tmatesoft.svn.core.SVNDepth;
+import org.jetbrains.idea.svn.api.Depth;
public class SvnExcludingIgnoredOperation {
private final Operation myImportAction;
- private final SVNDepth myDepth;
+ private final Depth myDepth;
private final Filter myFilter;
- public SvnExcludingIgnoredOperation(final Project project, final Operation importAction, final SVNDepth depth) {
+ public SvnExcludingIgnoredOperation(final Project project, final Operation importAction, final Depth depth) {
myImportAction = importAction;
myDepth = depth;
@@ -48,17 +48,18 @@ public class SvnExcludingIgnoredOperation {
public Filter(final Project project) {
myProject = project;
- if (! project.isDefault()) {
+ if (!project.isDefault()) {
myIndex = PeriodicalTasksCloser.getInstance().safeGetService(project, FileIndexFacade.class);
myClManager = ChangeListManager.getInstance(project);
- } else {
+ }
+ else {
myIndex = null;
myClManager = null;
}
}
public boolean accept(final VirtualFile file) {
- if (! myProject.isDefault()) {
+ if (!myProject.isDefault()) {
if (isExcluded(file)) {
return false;
}
@@ -80,7 +81,7 @@ public class SvnExcludingIgnoredOperation {
}
private boolean operation(final VirtualFile file) throws VcsException {
- if (! myFilter.accept(file)) return false;
+ if (!myFilter.accept(file)) return false;
myImportAction.doOperation(file);
return true;
@@ -101,21 +102,21 @@ public class SvnExcludingIgnoredOperation {
}
public void execute(final VirtualFile file) throws VcsException {
- if (SVNDepth.INFINITY.equals(myDepth)) {
+ if (Depth.INFINITY.equals(myDepth)) {
executeDown(file);
return;
}
- if (! operation(file)) {
+ if (!operation(file)) {
return;
}
- if (SVNDepth.EMPTY.equals(myDepth)) {
+ if (Depth.EMPTY.equals(myDepth)) {
return;
}
for (VirtualFile child : file.getChildren()) {
- if (SVNDepth.FILES.equals(myDepth) && child.isDirectory()) {
+ if (Depth.FILES.equals(myDepth) && child.isDirectory()) {
continue;
}
operation(child);
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/SvnMergeProvider.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/SvnMergeProvider.java
index a4d71ceb9241..912bd970f7b0 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/SvnMergeProvider.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/SvnMergeProvider.java
@@ -29,8 +29,9 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.idea.svn.SvnRevisionNumber;
import org.jetbrains.idea.svn.SvnUtil;
import org.jetbrains.idea.svn.SvnVcs;
+import org.jetbrains.idea.svn.api.Depth;
+import org.jetbrains.idea.svn.info.Info;
import org.jetbrains.idea.svn.properties.PropertyClient;
-import org.tmatesoft.svn.core.SVNDepth;
import org.tmatesoft.svn.core.SVNProperty;
import org.tmatesoft.svn.core.SVNPropertyValue;
import org.tmatesoft.svn.core.wc.*;
@@ -64,7 +65,7 @@ public class SvnMergeProvider implements MergeProvider {
File workingFile = null;
boolean mergeCase = false;
SvnVcs vcs = SvnVcs.getInstance(myProject);
- SVNInfo info = vcs.getInfo(file);
+ Info info = vcs.getInfo(file);
if (info != null) {
oldFile = info.getConflictOldFile();
@@ -142,7 +143,7 @@ public class SvnMergeProvider implements MergeProvider {
File path = new File(file.getPath());
try {
// TODO: Probably false should be passed to "resolveTree", but previous logic used true implicitly
- vcs.getFactory(path).createConflictClient().resolve(path, SVNDepth.EMPTY, false, true, true);
+ vcs.getFactory(path).createConflictClient().resolve(path, Depth.EMPTY, false, true, true);
}
catch (VcsException e) {
LOG.warn(e);
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/add/AddClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/add/AddClient.java
index 718a56dea9af..872e290db0c0 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/add/AddClient.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/add/AddClient.java
@@ -3,9 +3,9 @@ package org.jetbrains.idea.svn.add;
import com.intellij.openapi.vcs.VcsException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import org.jetbrains.idea.svn.api.Depth;
+import org.jetbrains.idea.svn.api.ProgressTracker;
import org.jetbrains.idea.svn.api.SvnClient;
-import org.tmatesoft.svn.core.SVNDepth;
-import org.tmatesoft.svn.core.wc.ISVNEventHandler;
import java.io.File;
@@ -15,9 +15,9 @@ import java.io.File;
public interface AddClient extends SvnClient {
void add(@NotNull File file,
- @Nullable SVNDepth depth,
+ @Nullable Depth depth,
boolean makeParents,
boolean includeIgnored,
boolean force,
- @Nullable ISVNEventHandler handler) throws VcsException;
+ @Nullable ProgressTracker handler) throws VcsException;
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/add/CmdAddClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/add/CmdAddClient.java
index 4811e3286d70..6894800427c2 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/add/CmdAddClient.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/add/CmdAddClient.java
@@ -4,15 +4,12 @@ import com.intellij.openapi.vcs.VcsException;
import com.intellij.util.containers.Convertor;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
-import org.jetbrains.idea.svn.api.BaseSvnClient;
-import org.jetbrains.idea.svn.api.FileStatusResultParser;
+import org.jetbrains.idea.svn.api.*;
import org.jetbrains.idea.svn.commandLine.CommandExecutor;
import org.jetbrains.idea.svn.commandLine.CommandUtil;
import org.jetbrains.idea.svn.commandLine.SvnCommandName;
-import org.tmatesoft.svn.core.SVNDepth;
-import org.tmatesoft.svn.core.wc.ISVNEventHandler;
-import org.tmatesoft.svn.core.wc.SVNEvent;
-import org.tmatesoft.svn.core.wc.SVNStatusType;
+import org.jetbrains.idea.svn.api.Depth;
+import org.jetbrains.idea.svn.status.StatusType;
import org.tmatesoft.svn.core.wc2.SvnTarget;
import java.io.File;
@@ -33,11 +30,11 @@ public class CmdAddClient extends BaseSvnClient implements AddClient {
@Override
public void add(@NotNull File file,
- @Nullable SVNDepth depth,
+ @Nullable Depth depth,
boolean makeParents,
boolean includeIgnored,
boolean force,
- @Nullable ISVNEventHandler handler) throws VcsException {
+ @Nullable ProgressTracker handler) throws VcsException {
List<String> parameters = prepareParameters(file, depth, makeParents, includeIgnored, force);
// TODO: handler should be called in parallel with command execution, but this will be in other thread
@@ -48,7 +45,7 @@ public class CmdAddClient extends BaseSvnClient implements AddClient {
parser.parse(command.getOutput());
}
- private static List<String> prepareParameters(File file, SVNDepth depth, boolean makeParents, boolean includeIgnored, boolean force) {
+ private static List<String> prepareParameters(File file, Depth depth, boolean makeParents, boolean includeIgnored, boolean force) {
List<String> parameters = new ArrayList<String>();
CommandUtil.put(parameters, file);
@@ -60,14 +57,13 @@ public class CmdAddClient extends BaseSvnClient implements AddClient {
return parameters;
}
- private static class AddStatusConvertor implements Convertor<Matcher, SVNEvent> {
+ private static class AddStatusConvertor implements Convertor<Matcher, ProgressEvent> {
@Override
- public SVNEvent convert(Matcher o) {
- SVNStatusType contentStatus = CommandUtil.getStatusType(o.group(1));
+ public ProgressEvent convert(Matcher o) {
+ StatusType contentStatus = CommandUtil.getStatusType(o.group(1));
String path = o.group(3);
- return new SVNEvent(new File(path), null, null, 0, contentStatus, null, null, null, null, null, null, null,
- null, null, null);
+ return new ProgressEvent(new File(path), 0, contentStatus, null, null, null, null);
}
}
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/add/SvnKitAddClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/add/SvnKitAddClient.java
index 66e122d80232..7b05f0bd17d3 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/add/SvnKitAddClient.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/add/SvnKitAddClient.java
@@ -4,9 +4,9 @@ import com.intellij.openapi.vcs.VcsException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.api.BaseSvnClient;
-import org.tmatesoft.svn.core.SVNDepth;
+import org.jetbrains.idea.svn.api.Depth;
+import org.jetbrains.idea.svn.api.ProgressTracker;
import org.tmatesoft.svn.core.SVNException;
-import org.tmatesoft.svn.core.wc.ISVNEventHandler;
import org.tmatesoft.svn.core.wc.SVNWCClient;
import java.io.File;
@@ -22,19 +22,19 @@ public class SvnKitAddClient extends BaseSvnClient implements AddClient {
*/
@Override
public void add(@NotNull File file,
- @Nullable SVNDepth depth,
+ @Nullable Depth depth,
boolean makeParents,
boolean includeIgnored,
boolean force,
- @Nullable ISVNEventHandler handler) throws VcsException {
+ @Nullable ProgressTracker handler) throws VcsException {
try {
SVNWCClient client = myVcs.getSvnKitManager().createWCClient();
- client.setEventHandler(handler);
+ client.setEventHandler(toEventHandler(handler));
client.doAdd(file, force,
false, // directory should already be created
makeParents, // not used but will be passed as makeParents value
- SVNDepth.recurseFromDepth(depth));
+ Depth.isRecursive(depth));
}
catch (SVNException e) {
throw new VcsException(e);
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/annotate/AnnotateClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/annotate/AnnotateClient.java
index df30cfd89ae2..90be057af431 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/annotate/AnnotateClient.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/annotate/AnnotateClient.java
@@ -4,8 +4,7 @@ import com.intellij.openapi.vcs.VcsException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.api.SvnClient;
-import org.tmatesoft.svn.core.wc.ISVNAnnotateHandler;
-import org.tmatesoft.svn.core.wc.SVNDiffOptions;
+import org.jetbrains.idea.svn.diff.DiffOptions;
import org.tmatesoft.svn.core.wc.SVNRevision;
import org.tmatesoft.svn.core.wc2.SvnTarget;
@@ -19,6 +18,6 @@ public interface AnnotateClient extends SvnClient {
@NotNull SVNRevision endRevision,
@Nullable SVNRevision pegRevision,
boolean includeMergedRevisions,
- @Nullable SVNDiffOptions diffOptions,
- @Nullable ISVNAnnotateHandler handler) throws VcsException;
+ @Nullable DiffOptions diffOptions,
+ @Nullable AnnotationConsumer handler) throws VcsException;
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/annotate/AnnotationConsumer.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/annotate/AnnotationConsumer.java
new file mode 100644
index 000000000000..8d33be224b99
--- /dev/null
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/annotate/AnnotationConsumer.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jetbrains.idea.svn.annotate;
+
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+import org.jetbrains.idea.svn.checkin.CommitInfo;
+import org.tmatesoft.svn.core.SVNException;
+
+/**
+ * @author Konstantin Kolosovsky.
+ */
+public interface AnnotationConsumer {
+
+ void consume(int lineNumber, @NotNull CommitInfo info, @Nullable CommitInfo mergeInfo) throws SVNException;
+}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/annotate/BaseSvnFileAnnotation.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/annotate/BaseSvnFileAnnotation.java
index f4fa9f950a32..00a529e11b4d 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/annotate/BaseSvnFileAnnotation.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/annotate/BaseSvnFileAnnotation.java
@@ -19,6 +19,7 @@ import com.intellij.openapi.vcs.VcsKey;
import com.intellij.openapi.vcs.annotate.*;
import com.intellij.openapi.vcs.history.VcsFileRevision;
import com.intellij.openapi.vcs.history.VcsRevisionNumber;
+import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.text.DateFormatUtil;
import com.intellij.xml.util.XmlStringUtil;
import org.jetbrains.annotations.NotNull;
@@ -27,6 +28,7 @@ import org.jetbrains.idea.svn.SvnBundle;
import org.jetbrains.idea.svn.SvnConfiguration;
import org.jetbrains.idea.svn.SvnRevisionNumber;
import org.jetbrains.idea.svn.SvnVcs;
+import org.jetbrains.idea.svn.checkin.CommitInfo;
import org.jetbrains.idea.svn.history.SvnFileRevision;
import org.tmatesoft.svn.core.wc.SVNRevision;
@@ -46,27 +48,19 @@ public abstract class BaseSvnFileAnnotation extends FileAnnotation {
protected final SvnVcs myVcs;
private final Map<Long, SvnFileRevision> myRevisionMap = new HashMap<Long, SvnFileRevision>();
- private final LineAnnotationAspect DATE_ASPECT = new SvnAnnotationAspect(SvnAnnotationAspect.DATE, true) {
- public String getValue(int lineNumber) {
- if (myInfos.size() <= lineNumber || lineNumber < 0) {
- return "";
- }
- else {
- final LineInfo lineInfo = myInfos.get(lineNumber);
- return (lineInfo == null) ? "" : DateFormatUtil.formatPrettyDate(lineInfo.getDate());
- }
+ private final LineAnnotationAspect DATE_ASPECT = new SvnAnnotationAspect(LineAnnotationAspect.DATE, true) {
+
+ @Override
+ public String getValue(@NotNull CommitInfo info) {
+ return DateFormatUtil.formatPrettyDate(info.getDate());
}
};
- private final LineAnnotationAspect REVISION_ASPECT = new SvnAnnotationAspect(SvnAnnotationAspect.REVISION, false) {
- public String getValue(int lineNumber) {
- if (myInfos.size() <= lineNumber || lineNumber < 0) {
- return "";
- }
- else {
- final long revision = getRevision(lineNumber);
- return (revision == -1) ? "" : String.valueOf(revision);
- }
+ private final LineAnnotationAspect REVISION_ASPECT = new SvnAnnotationAspect(LineAnnotationAspect.REVISION, false) {
+
+ @Override
+ public String getValue(@NotNull CommitInfo info) {
+ return String.valueOf(info.getRevision());
}
};
@@ -84,31 +78,25 @@ public abstract class BaseSvnFileAnnotation extends FileAnnotation {
@Override
public String getTooltipText(int lineNumber) {
- if (myInfos.size() <= lineNumber || lineNumber < 0) {
- return "";
- }
- final LineInfo info = myInfos.get(lineNumber);
+ // TODO: Check what is the difference in returning "" or null
+ if (!myInfos.isValid(lineNumber)) return "";
+
+ CommitInfo info = myInfos.get(lineNumber);
if (info == null) return null;
- SvnFileRevision svnRevision = myRevisionMap.get(info.getRevision());
- if (svnRevision != null) {
- final String tooltip = "Revision " + info.getRevision() + ": " + svnRevision.getCommitMessage();
- return XmlStringUtil.escapeString(tooltip);
- }
- return "";
+
+ SvnFileRevision revision = myRevisionMap.get(info.getRevision());
+ return revision != null ? XmlStringUtil.escapeString("Revision " + info.getRevision() + ": " + revision.getCommitMessage()) : "";
}
};
- private final LineAnnotationAspect AUTHOR_ASPECT = new SvnAnnotationAspect(SvnAnnotationAspect.AUTHOR, true) {
- public String getValue(int lineNumber) {
- if (myInfos.size() <= lineNumber || lineNumber < 0) {
- return "";
- }
- else {
- final LineInfo lineInfo = myInfos.get(lineNumber);
- return (lineInfo == null) ? "" : lineInfo.getAuthor();
- }
+ private final LineAnnotationAspect AUTHOR_ASPECT = new SvnAnnotationAspect(LineAnnotationAspect.AUTHOR, true) {
+
+ @Override
+ public String getValue(@NotNull CommitInfo info) {
+ return info.getAuthor();
}
};
+
private final SvnConfiguration myConfiguration;
private boolean myShowMergeSources;
// null if full annotation
@@ -118,10 +106,6 @@ public abstract class BaseSvnFileAnnotation extends FileAnnotation {
myRevisionMap.put(revision, svnRevision);
}
- public void clearRevisions() {
- myRevisionMap.clear();
- }
-
public SvnFileRevision getRevision(final long revision) {
return myRevisionMap.get(revision);
}
@@ -134,30 +118,6 @@ public abstract class BaseSvnFileAnnotation extends FileAnnotation {
return myFirstRevisionNumber;
}
- static class LineInfo {
- private final Date myDate;
- private final long myRevision;
- private final String myAuthor;
-
- public LineInfo(final Date date, final long revision, final String author) {
- myDate = date;
- myRevision = revision;
- myAuthor = author;
- }
-
- public Date getDate() {
- return myDate;
- }
-
- public long getRevision() {
- return myRevision;
- }
-
- public String getAuthor() {
- return myAuthor;
- }
- }
-
public BaseSvnFileAnnotation(final SvnVcs vcs, final String contents, final VcsRevisionNumber baseRevision) {
super(vcs.getProject());
myVcs = vcs;
@@ -174,18 +134,14 @@ public abstract class BaseSvnFileAnnotation extends FileAnnotation {
}
public String getToolTip(final int lineNumber) {
- if (myInfos.size() <= lineNumber || lineNumber < 0) {
- return "";
- }
- final LineInfo info = myInfos.get(lineNumber);
+ final CommitInfo info = myInfos.getOrNull(lineNumber);
if (info == null) return "";
- SvnFileRevision svnRevision = myRevisionMap.get(info.getRevision());
- if (svnRevision != null) {
- if (myInfos.getAnnotationSource(lineNumber).showMerged()) {
- return "Merge source revision " + info.getRevision() + ": " + svnRevision.getCommitMessage();
- } else {
- return "Revision " + info.getRevision() + ": " + svnRevision.getCommitMessage();
- }
+
+ SvnFileRevision revision = myRevisionMap.get(info.getRevision());
+ if (revision != null) {
+ String prefix = myInfos.getAnnotationSource(lineNumber).showMerged() ? "Merge source revision" : "Revision";
+
+ return prefix + " " + info.getRevision() + ": " + revision.getCommitMessage();
}
return "";
}
@@ -194,53 +150,35 @@ public abstract class BaseSvnFileAnnotation extends FileAnnotation {
return myContents;
}
- public void setLineInfo(final int lineNumber, final Date date, final long revision, final String author,
- @Nullable final Date mergeDate, final long mergeRevision, @Nullable final String mergeAuthor) {
- myInfos.appendNumberedLineInfo(lineNumber, date, revision, author, mergeDate, mergeRevision, mergeAuthor);
- }
-
- public void appendLineInfo(final Date date, final long revision, final String author,
- @Nullable final Date mergeDate, final long mergeRevision, @Nullable final String mergeAuthor) {
- myInfos.appendNumberedLineInfo(date, revision, author, mergeDate, mergeRevision, mergeAuthor);
+ public void setLineInfo(int lineNumber, @NotNull CommitInfo info, @Nullable CommitInfo mergeInfo) {
+ myInfos.appendNumberedLineInfo(lineNumber, info, mergeInfo);
}
@Nullable
public VcsRevisionNumber originalRevision(final int lineNumber) {
- if (myInfos.size() <= lineNumber || lineNumber < 0) {
- return null;
- }
- final SvnFileRevision revision = myRevisionMap.get(myInfos.originalRevision(lineNumber));
- return revision == null ? null : revision.getRevisionNumber();
+ SvnFileRevision revision = myInfos.isValid(lineNumber) ? myRevisionMap.get(myInfos.originalRevision(lineNumber)) : null;
+
+ return revision != null ? revision.getRevisionNumber() : null;
}
public VcsRevisionNumber getLineRevisionNumber(final int lineNumber) {
- if (myInfos.size() <= lineNumber || lineNumber < 0) {
- return null;
- }
- final LineInfo info = myInfos.get(lineNumber);
- if (info == null) return null;
- final long revision = info.getRevision();
- if (revision >= 0) {
- return new SvnRevisionNumber(SVNRevision.create(revision));
- }
- return null;
+ CommitInfo info = myInfos.getOrNull(lineNumber);
+
+ return info != null && info.getRevision() >= 0 ? new SvnRevisionNumber(SVNRevision.create(info.getRevision())) : null;
}
@Override
public Date getLineDate(int lineNumber) {
- if (myInfos.size() <= lineNumber || lineNumber < 0) {
- return null;
- }
- final LineInfo info = myInfos.get(lineNumber);
- if (info == null) return null;
- return info.getDate();
+ CommitInfo info = myInfos.getOrNull(lineNumber);
+
+ return info != null ? info.getDate() : null;
}
public List<VcsFileRevision> getRevisions() {
final List<VcsFileRevision> result = new ArrayList<VcsFileRevision>(myRevisionMap.values());
Collections.sort(result, new Comparator<VcsFileRevision>() {
public int compare(final VcsFileRevision o1, final VcsFileRevision o2) {
- return -1 * o1.getRevisionNumber().compareTo(o2.getRevisionNumber());
+ return o2.getRevisionNumber().compareTo(o1.getRevisionNumber());
}
});
return result;
@@ -250,10 +188,6 @@ public abstract class BaseSvnFileAnnotation extends FileAnnotation {
return ! myRevisionMap.isEmpty();
}
- public int getNumLines() {
- return myInfos.size();
- }
-
@Nullable
public AnnotationSourceSwitcher getAnnotationSourceSwitcher() {
if (! myShowMergeSources) return null;
@@ -285,7 +219,7 @@ public abstract class BaseSvnFileAnnotation extends FileAnnotation {
@Override
public int getLineCount() {
- return getNumLines();
+ return myInfos.size();
}
@Override
@@ -294,44 +228,52 @@ public abstract class BaseSvnFileAnnotation extends FileAnnotation {
}
private abstract class SvnAnnotationAspect extends LineAnnotationAspectAdapter {
+
public SvnAnnotationAspect(String id, boolean showByDefault) {
super(id, showByDefault);
}
protected long getRevision(final int lineNum) {
- final LineInfo lineInfo = myInfos.get(lineNum);
+ final CommitInfo lineInfo = myInfos.get(lineNum);
return (lineInfo == null) ? -1 : lineInfo.getRevision();
}
@Override
protected void showAffectedPaths(int lineNum) {
- if (lineNum >= 0 && lineNum < myInfos.size()) {
+ if (myInfos.isValid(lineNum)) {
final long revision = getRevision(lineNum);
if (revision >= 0) {
showAllAffectedPaths(new SvnRevisionNumber(SVNRevision.create(revision)));
}
}
}
+
+ @Override
+ public String getValue(int lineNumber) {
+ CommitInfo info = myInfos.getOrNull(lineNumber);
+
+ return info == null ? "" : getValue(info);
+ }
+
+ public String getValue(@NotNull CommitInfo info) {
+ return "";
+ }
}
protected abstract void showAllAffectedPaths(SvnRevisionNumber number);
private static class MyPartiallyCreatedInfos {
private boolean myShowMergeSource;
- private final Map<Integer, LineInfo> myMappedLineInfo;
- private final Map<Integer, LineInfo> myMergeSourceInfos;
+ private final Map<Integer, CommitInfo> myMappedLineInfo;
+ private final Map<Integer, CommitInfo> myMergeSourceInfos;
private int myMaxIdx;
private MyPartiallyCreatedInfos() {
- myMergeSourceInfos = new HashMap<Integer, LineInfo>();
- myMappedLineInfo = new HashMap<Integer, LineInfo>();
+ myMergeSourceInfos = ContainerUtil.newHashMap();
+ myMappedLineInfo = ContainerUtil.newHashMap();
myMaxIdx = 0;
}
- boolean isShowMergeSource() {
- return myShowMergeSource;
- }
-
void setShowMergeSource(boolean showMergeSource) {
myShowMergeSource = showMergeSource;
}
@@ -340,25 +282,18 @@ public abstract class BaseSvnFileAnnotation extends FileAnnotation {
return myMaxIdx + 1;
}
- void appendNumberedLineInfo(final Date date, final long revision, final String author,
- @Nullable final Date mergeDate, final long mergeRevision, @Nullable final String mergeAuthor) {
- appendNumberedLineInfo(myMaxIdx + 1, date, revision, author, mergeDate, mergeRevision, mergeAuthor);
- }
-
- void appendNumberedLineInfo(final int lineNumber, final Date date, final long revision, final String author,
- @Nullable final Date mergeDate, final long mergeRevision, @Nullable final String mergeAuthor) {
- if (date == null) return;
+ void appendNumberedLineInfo(final int lineNumber, @NotNull CommitInfo info, @Nullable CommitInfo mergeInfo) {
if (myMappedLineInfo.get(lineNumber) != null) return;
myMaxIdx = (myMaxIdx < lineNumber) ? lineNumber : myMaxIdx;
- myMappedLineInfo.put(lineNumber, new LineInfo(date, revision, author));
- if (mergeDate != null) {
- myMergeSourceInfos.put(lineNumber, new LineInfo(mergeDate, mergeRevision, mergeAuthor));
+ myMappedLineInfo.put(lineNumber, info);
+ if (mergeInfo != null) {
+ myMergeSourceInfos.put(lineNumber, mergeInfo);
}
}
- LineInfo get(final int idx) {
+ CommitInfo get(final int idx) {
if (myShowMergeSource) {
- final LineInfo lineInfo = myMergeSourceInfos.get(idx);
+ final CommitInfo lineInfo = myMergeSourceInfos.get(idx);
if (lineInfo != null) {
return lineInfo;
}
@@ -366,14 +301,23 @@ public abstract class BaseSvnFileAnnotation extends FileAnnotation {
return myMappedLineInfo.get(idx);
}
+ @Nullable
+ CommitInfo getOrNull(int lineNumber) {
+ return isValid(lineNumber) ? get(lineNumber) : null;
+ }
+
+ private boolean isValid(int lineNumber) {
+ return lineNumber >= 0 && lineNumber < size();
+ }
+
AnnotationSource getAnnotationSource(final int line) {
return myShowMergeSource ? AnnotationSource.getInstance(myMergeSourceInfos.containsKey(line)) : AnnotationSource.LOCAL;
}
public long originalRevision(final int line) {
- if (line >= size()) return -1;
- final LineInfo lineInfo = myMappedLineInfo.get(line);
- return lineInfo == null ? -1 : lineInfo.getRevision();
+ CommitInfo info = line < size() ? myMappedLineInfo.get(line) : null;
+
+ return info == null ? -1 : info.getRevision();
}
public boolean mergeSourceAvailable(int lineNumber) {
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/annotate/CmdAnnotateClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/annotate/CmdAnnotateClient.java
index 5cb18a35fc5c..b48f14a41779 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/annotate/CmdAnnotateClient.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/annotate/CmdAnnotateClient.java
@@ -4,12 +4,12 @@ import com.intellij.openapi.vcs.VcsException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.api.BaseSvnClient;
+import org.jetbrains.idea.svn.checkin.CommitInfo;
import org.jetbrains.idea.svn.commandLine.CommandExecutor;
import org.jetbrains.idea.svn.commandLine.CommandUtil;
import org.jetbrains.idea.svn.commandLine.SvnCommandName;
+import org.jetbrains.idea.svn.diff.DiffOptions;
import org.tmatesoft.svn.core.SVNException;
-import org.tmatesoft.svn.core.wc.ISVNAnnotateHandler;
-import org.tmatesoft.svn.core.wc.SVNDiffOptions;
import org.tmatesoft.svn.core.wc.SVNRevision;
import org.tmatesoft.svn.core.wc2.SvnTarget;
@@ -18,7 +18,6 @@ import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.ArrayList;
-import java.util.Date;
import java.util.List;
/**
@@ -32,8 +31,8 @@ public class CmdAnnotateClient extends BaseSvnClient implements AnnotateClient {
@NotNull SVNRevision endRevision,
@Nullable SVNRevision pegRevision,
boolean includeMergedRevisions,
- @Nullable SVNDiffOptions diffOptions,
- @Nullable final ISVNAnnotateHandler handler) throws VcsException {
+ @Nullable DiffOptions diffOptions,
+ @Nullable final AnnotationConsumer handler) throws VcsException {
List<String> parameters = new ArrayList<String>();
CommandUtil.put(parameters, target.getPathOrUrlString(), pegRevision);
parameters.add("--revision");
@@ -47,7 +46,7 @@ public class CmdAnnotateClient extends BaseSvnClient implements AnnotateClient {
parseOutput(command.getOutput(), handler);
}
- public void parseOutput(@NotNull String output, @Nullable ISVNAnnotateHandler handler) throws VcsException {
+ public void parseOutput(@NotNull String output, @Nullable AnnotationConsumer handler) throws VcsException {
try {
BlameInfo info = CommandUtil.parse(output, BlameInfo.class);
@@ -65,12 +64,11 @@ public class CmdAnnotateClient extends BaseSvnClient implements AnnotateClient {
}
}
- private static void invokeHandler(ISVNAnnotateHandler handler, LineEntry entry) throws SVNException {
- // line numbers in our api start from 0 - not from 1 like in svn output
- // "line" value is not used in handlers - so null is passed
- handler
- .handleLine(entry.date(), entry.revision(), entry.author(), null, entry.mergedDate(), entry.mergedRevision(), entry.mergedAuthor(),
- entry.mergedPath(), entry.lineNumber - 1);
+ private static void invokeHandler(@NotNull AnnotationConsumer handler, @NotNull LineEntry entry) throws SVNException {
+ if (entry.commit != null) {
+ // line numbers in our api start from 0 - not from 1 like in svn output
+ handler.consume(entry.lineNumber - 1, entry.commit.build(), entry.mergedCommit());
+ }
}
@XmlRootElement(name = "blame")
@@ -91,70 +89,15 @@ public class CmdAnnotateClient extends BaseSvnClient implements AnnotateClient {
@XmlAttribute(name = "line-number")
public int lineNumber;
- @XmlElement(name = "commit")
- public CommitEntry commit;
+ public CommitInfo.Builder commit;
@XmlElement(name = "merged")
public MergedEntry merged;
- public long revision() {
- return revision(commit);
- }
-
- @Nullable
- public String author() {
- return author(commit);
- }
-
- @Nullable
- public Date date() {
- return date(commit);
- }
-
- @Nullable
- public String mergedPath() {
- return merged != null ? merged.path : null;
- }
-
- public long mergedRevision() {
- return merged != null ? revision(merged.commit) : 0;
- }
-
- @Nullable
- public String mergedAuthor() {
- return merged != null ? author(merged.commit) : null;
- }
-
- @Nullable
- public Date mergedDate() {
- return merged != null ? date(merged.commit) : null;
- }
-
- private static long revision(@Nullable CommitEntry commit) {
- return commit != null ? commit.revision : 0;
- }
-
@Nullable
- private static String author(@Nullable CommitEntry commit) {
- return commit != null ? commit.author : null;
+ public CommitInfo mergedCommit() {
+ return merged != null && merged.commit != null ? merged.commit.build() : null;
}
-
- @Nullable
- private static Date date(@Nullable CommitEntry commit) {
- return commit != null ? commit.date : null;
- }
- }
-
- public static class CommitEntry {
-
- @XmlAttribute(name = "revision")
- public long revision;
-
- @XmlElement(name = "author")
- public String author;
-
- @XmlElement(name = "date")
- public Date date;
}
public static class MergedEntry {
@@ -162,7 +105,6 @@ public class CmdAnnotateClient extends BaseSvnClient implements AnnotateClient {
@XmlAttribute(name = "path")
public String path;
- @XmlElement(name = "commit")
- public CommitEntry commit;
+ public CommitInfo.Builder commit;
}
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/annotate/SvnAnnotationProvider.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/annotate/SvnAnnotationProvider.java
index c51f4dbcdaa3..a615fd4e3afa 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/annotate/SvnAnnotationProvider.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/annotate/SvnAnnotationProvider.java
@@ -35,11 +35,15 @@ import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.*;
-import org.jetbrains.idea.svn.history.HistoryClient;
-import org.jetbrains.idea.svn.history.SvnChangeList;
-import org.jetbrains.idea.svn.history.SvnFileRevision;
-import org.tmatesoft.svn.core.*;
-import org.tmatesoft.svn.core.wc.*;
+import org.jetbrains.idea.svn.checkin.CommitInfo;
+import org.jetbrains.idea.svn.diff.DiffOptions;
+import org.jetbrains.idea.svn.history.*;
+import org.jetbrains.idea.svn.info.Info;
+import org.tmatesoft.svn.core.SVNErrorCode;
+import org.tmatesoft.svn.core.SVNErrorMessage;
+import org.tmatesoft.svn.core.SVNException;
+import org.tmatesoft.svn.core.SVNURL;
+import org.tmatesoft.svn.core.wc.SVNRevision;
import org.tmatesoft.svn.core.wc2.SvnTarget;
import java.io.File;
@@ -86,7 +90,7 @@ public class SvnAnnotationProvider implements AnnotationProvider, VcsCacheableAn
public void run() {
final ProgressIndicator progress = ProgressManager.getInstance().getProgressIndicator();
final File ioFile = new File(file.getPath()).getAbsoluteFile();
- SVNInfo info = null;
+ Info info = null;
try {
final String contents;
@@ -116,7 +120,7 @@ public class SvnAnnotationProvider implements AnnotationProvider, VcsCacheableAn
}
// ignore mime type=true : IDEA-19562
- final ISVNAnnotateHandler annotateHandler = createAnnotationHandler(progress, result);
+ final AnnotationConsumer annotateHandler = createAnnotationHandler(progress, result);
final boolean calculateMergeinfo = SvnConfiguration.getInstance(myVcs.getProject()).isShowMergeSourcesInAnnotate() &&
SvnUtil.checkRepositoryVersion15(myVcs, url);
@@ -166,7 +170,7 @@ public class SvnAnnotationProvider implements AnnotationProvider, VcsCacheableAn
}
private void handleSvnException(File ioFile,
- SVNInfo info,
+ Info info,
SVNException e,
VirtualFile file,
VcsFileRevision revision,
@@ -221,7 +225,7 @@ public class SvnAnnotationProvider implements AnnotationProvider, VcsCacheableAn
private SvnRemoteFileAnnotation annotateNonExisting(Pair<SvnChangeList, FilePath> pair,
VcsFileRevision revision,
- SVNInfo info,
+ Info info,
Charset charset, final VirtualFile current) throws VcsException, SVNException, IOException {
final File wasFile = pair.getSecond().getIOFile();
final File root = getCommonAncestor(wasFile, info.getFile());
@@ -231,7 +235,7 @@ public class SvnAnnotationProvider implements AnnotationProvider, VcsCacheableAn
final String relativePath = FileUtil.getRelativePath(root.getPath(), wasFile.getPath(), File.separatorChar);
if (relativePath == null) throw new VcsException("Can not find relative path for " + wasFile.getPath() + "@" + revision.getRevisionNumber().asString());
- SVNInfo wcRootInfo = myVcs.getInfo(root);
+ Info wcRootInfo = myVcs.getInfo(root);
if (wcRootInfo == null || wcRootInfo.getURL() == null) {
throw new VcsException("Can not find relative path for " + wasFile.getPath() + "@" + revision.getRevisionNumber().asString());
}
@@ -244,9 +248,8 @@ public class SvnAnnotationProvider implements AnnotationProvider, VcsCacheableAn
final SVNRevision svnRevision = ((SvnRevisionNumber)revision.getRevisionNumber()).getRevision();
byte[] data = SvnUtil.getFileContents(myVcs, SvnTarget.fromURL(wasUrl), svnRevision, svnRevision);
final String contents = LoadTextUtil.getTextByBinaryPresentation(data, charset == null ? CharsetToolkit.UTF8_CHARSET : charset).toString();
- final SvnRemoteFileAnnotation result = new SvnRemoteFileAnnotation(myVcs, contents, revision.getRevisionNumber(), pair.getFirst(),
- pair.getSecond().getPath(), current);
- final ISVNAnnotateHandler annotateHandler = createAnnotationHandler(ProgressManager.getInstance().getProgressIndicator(), result);
+ final SvnRemoteFileAnnotation result = new SvnRemoteFileAnnotation(myVcs, contents, revision.getRevisionNumber(), current);
+ final AnnotationConsumer annotateHandler = createAnnotationHandler(ProgressManager.getInstance().getProgressIndicator(), result);
final boolean calculateMergeinfo = SvnConfiguration.getInstance(myVcs.getProject()).isShowMergeSourcesInAnnotate() &&
SvnUtil.checkRepositoryVersion15(myVcs, wasUrl.toString());
@@ -256,45 +259,18 @@ public class SvnAnnotationProvider implements AnnotationProvider, VcsCacheableAn
return result;
}
- private ISVNAnnotateHandler createAnnotationHandler(final ProgressIndicator progress, final BaseSvnFileAnnotation result) {
- return new ISVNAnnotateHandler() {
- public void handleLine(Date date, long revision, String author, String line) {
- if (progress != null) {
- progress.checkCanceled();
- }
- result.appendLineInfo(date, revision, author, null, -1, null);
- }
-
- public void handleLine(final Date date,
- final long revision,
- final String author,
- final String line,
- final Date mergedDate,
- final long mergedRevision,
- final String mergedAuthor,
- final String mergedPath,
- final int lineNumber) throws SVNException {
- if (progress != null) {
- progress.checkCanceled();
- }
- if (revision == -1) return;
- if ((mergedDate != null) && (revision > mergedRevision)) {
- // !!! merged date = date of merge, i.e. date -> date of original change etc.
- result.setLineInfo(lineNumber, date, revision, author, mergedDate, mergedRevision, mergedAuthor);
- } else {
- result.setLineInfo(lineNumber, date, revision, author, null, -1, null);
- }
- }
+ @NotNull
+ private static AnnotationConsumer createAnnotationHandler(@Nullable final ProgressIndicator progress,
+ @NotNull final BaseSvnFileAnnotation result) {
+ return new AnnotationConsumer() {
- public boolean handleRevision(final Date date, final long revision, final String author, final File contents)
- throws SVNException {
+ @Override
+ public void consume(int lineNumber, @NotNull CommitInfo info, @Nullable CommitInfo mergeInfo) throws SVNException {
if (progress != null) {
progress.checkCanceled();
}
- return false;
- }
- public void handleEOF() {
+ result.setLineInfo(lineNumber, info, mergeInfo != null && info.getRevision() > mergeInfo.getRevision() ? mergeInfo : null);
}
};
}
@@ -307,7 +283,7 @@ public class SvnAnnotationProvider implements AnnotationProvider, VcsCacheableAn
if (annotationSourceSwitcher != null) {
annotationSourceSwitcher.switchTo(AnnotationSource.LOCAL);
}
- final int size = svnFileAnnotation.getNumLines();
+ final int size = svnFileAnnotation.getLineCount();
final VcsUsualLineAnnotationData lineAnnotationData = new VcsUsualLineAnnotationData(size);
for (int i = 0; i < size; i++) {
@@ -356,17 +332,15 @@ public class SvnAnnotationProvider implements AnnotationProvider, VcsCacheableAn
for (int i = 0; i < basicAnnotation.getNumLines(); i++) {
final VcsRevisionNumber revision = basicAnnotation.getRevision(i);
final VcsRevisionNumber mergedData = data == null ? null : data.getRevision(i);
- final VcsFileRevision fileRevision = historyAsMap.get(revision);
+ final SvnFileRevision fileRevision = (SvnFileRevision)historyAsMap.get(revision);
if (fileRevision == null) return null;
+
if (mergedData == null) {
- annotation.setLineInfo(i, fileRevision.getRevisionDate(), ((SvnRevisionNumber) revision).getRevision().getNumber(),
- fileRevision.getAuthor(), null, -1, null);
+ annotation.setLineInfo(i, fileRevision.getCommitInfo(), null);
} else {
- final VcsFileRevision mergedRevision = cachedOtherRevisions.get(mergedData);
+ final SvnFileRevision mergedRevision = (SvnFileRevision)cachedOtherRevisions.get(mergedData);
if (mergedRevision == null) return null;
- annotation.setLineInfo(i, fileRevision.getRevisionDate(), ((SvnRevisionNumber) revision).getRevision().getNumber(),
- fileRevision.getAuthor(), mergedRevision.getRevisionDate(),
- ((SvnRevisionNumber) mergedRevision.getRevisionNumber()).getRevision().getNumber(), mergedRevision.getAuthor());
+ annotation.setLineInfo(i, fileRevision.getCommitInfo(), mergedRevision.getCommitInfo());
}
}
if (vcsAnnotation.getFirstRevision() != null) {
@@ -453,8 +427,9 @@ public class SvnAnnotationProvider implements AnnotationProvider, VcsCacheableAn
private void doLog(final boolean includeMerged, final SVNRevision truncateTo, final int max) throws VcsException {
myClient.doLog(SvnTarget.fromFile(myIoFile), myEndRevision, truncateTo == null ? SVNRevision.create(1L) : truncateTo,
false, false, includeMerged, max, null,
- new ISVNLogEntryHandler() {
- public void handleLogEntry(SVNLogEntry logEntry) {
+ new LogEntryConsumer() {
+ @Override
+ public void consume(LogEntry logEntry) {
if (SVNRevision.UNDEFINED.getNumber() == logEntry.getRevision()) {
return;
}
@@ -477,7 +452,8 @@ public class SvnAnnotationProvider implements AnnotationProvider, VcsCacheableAn
return true;
}
- private static SVNDiffOptions getLogClientOptions(@NotNull SvnVcs vcs) {
- return SvnConfiguration.getInstance(vcs.getProject()).isIgnoreSpacesInAnnotate() ? new SVNDiffOptions(true, true, true) : null;
+ @Nullable
+ private static DiffOptions getLogClientOptions(@NotNull SvnVcs vcs) {
+ return SvnConfiguration.getInstance(vcs.getProject()).isIgnoreSpacesInAnnotate() ? new DiffOptions(true, true, true) : null;
}
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/annotate/SvnKitAnnotateClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/annotate/SvnKitAnnotateClient.java
index 191bd9079237..c2423de0b70d 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/annotate/SvnKitAnnotateClient.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/annotate/SvnKitAnnotateClient.java
@@ -4,13 +4,17 @@ import com.intellij.openapi.vcs.VcsException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.api.BaseSvnClient;
+import org.jetbrains.idea.svn.checkin.CommitInfo;
+import org.jetbrains.idea.svn.diff.DiffOptions;
import org.tmatesoft.svn.core.SVNException;
import org.tmatesoft.svn.core.wc.ISVNAnnotateHandler;
-import org.tmatesoft.svn.core.wc.SVNDiffOptions;
import org.tmatesoft.svn.core.wc.SVNLogClient;
import org.tmatesoft.svn.core.wc.SVNRevision;
import org.tmatesoft.svn.core.wc2.SvnTarget;
+import java.io.File;
+import java.util.Date;
+
/**
* @author Konstantin Kolosovsky.
*/
@@ -22,21 +26,68 @@ public class SvnKitAnnotateClient extends BaseSvnClient implements AnnotateClien
@NotNull SVNRevision endRevision,
@Nullable SVNRevision pegRevision,
boolean includeMergedRevisions,
- @Nullable SVNDiffOptions diffOptions,
- @Nullable ISVNAnnotateHandler handler) throws VcsException {
+ @Nullable DiffOptions diffOptions,
+ @Nullable AnnotationConsumer handler) throws VcsException {
try {
SVNLogClient client = myVcs.getSvnKitManager().createLogClient();
- client.setDiffOptions(diffOptions);
+ client.setDiffOptions(toDiffOptions(diffOptions));
if (target.isFile()) {
- client.doAnnotate(target.getFile(), pegRevision, startRevision, endRevision, true, includeMergedRevisions, handler, null);
+ client
+ .doAnnotate(target.getFile(), pegRevision, startRevision, endRevision, true, includeMergedRevisions, toAnnotateHandler(handler),
+ null);
}
else {
- client.doAnnotate(target.getURL(), pegRevision, startRevision, endRevision, true, includeMergedRevisions, handler, null);
+ client
+ .doAnnotate(target.getURL(), pegRevision, startRevision, endRevision, true, includeMergedRevisions, toAnnotateHandler(handler),
+ null);
}
}
catch (SVNException e) {
throw new VcsException(e);
}
}
+
+ @Nullable
+ private static ISVNAnnotateHandler toAnnotateHandler(@Nullable final AnnotationConsumer handler) {
+ ISVNAnnotateHandler result = null;
+
+ if (handler != null) {
+ result = new ISVNAnnotateHandler() {
+ @Override
+ public void handleLine(Date date, long revision, String author, String line) throws SVNException {
+ // deprecated - not called
+ }
+
+ @Override
+ public void handleLine(Date date,
+ long revision,
+ String author,
+ String line,
+ Date mergedDate,
+ long mergedRevision,
+ String mergedAuthor,
+ String mergedPath,
+ int lineNumber) throws SVNException {
+ if (revision > 0) {
+ CommitInfo info = new CommitInfo.Builder(revision, date, author).build();
+ CommitInfo mergeInfo = mergedDate != null ? new CommitInfo.Builder(mergedRevision, mergedDate, mergedAuthor).build() : null;
+
+ handler.consume(lineNumber, info, mergeInfo);
+ }
+ }
+
+ @Override
+ public boolean handleRevision(Date date, long revision, String author, File contents) throws SVNException {
+ return false;
+ }
+
+ @Override
+ public void handleEOF() throws SVNException {
+ }
+ };
+ }
+
+ return result;
+ }
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/annotate/SvnRemoteFileAnnotation.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/annotate/SvnRemoteFileAnnotation.java
index f00bc7b97aaa..3f0924650c5f 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/annotate/SvnRemoteFileAnnotation.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/annotate/SvnRemoteFileAnnotation.java
@@ -29,15 +29,10 @@ import org.jetbrains.idea.svn.history.SvnChangeList;
* Time: 12:10 PM
*/
public class SvnRemoteFileAnnotation extends BaseSvnFileAnnotation {
- private final SvnChangeList mySvnChangeList;
- private final String myPathToSelect;
private final VirtualFile myCurrentFile;
- public SvnRemoteFileAnnotation(SvnVcs vcs, String contents, VcsRevisionNumber baseRevision, SvnChangeList svnChangeList,
- final String pathToSelect, final VirtualFile currentFile) {
+ public SvnRemoteFileAnnotation(SvnVcs vcs, String contents, VcsRevisionNumber baseRevision, final VirtualFile currentFile) {
super(vcs, contents, baseRevision);
- mySvnChangeList = svnChangeList;
- myPathToSelect = pathToSelect;
myCurrentFile = currentFile;
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/api/BaseNodeDescription.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/api/BaseNodeDescription.java
new file mode 100644
index 000000000000..03e2e07a339c
--- /dev/null
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/api/BaseNodeDescription.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jetbrains.idea.svn.api;
+
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * @author Konstantin Kolosovsky.
+ */
+public abstract class BaseNodeDescription {
+
+ @NotNull protected final NodeKind myKind;
+
+ protected BaseNodeDescription(@NotNull NodeKind kind) {
+ myKind = kind;
+ }
+
+ public boolean isFile() {
+ return myKind.isFile();
+ }
+
+ public boolean isDirectory() {
+ return myKind.isDirectory();
+ }
+
+ public boolean isNone() {
+ return myKind.isNone();
+ }
+}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/api/BaseSvnClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/api/BaseSvnClient.java
index bb8c613c8135..0d58355543ba 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/api/BaseSvnClient.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/api/BaseSvnClient.java
@@ -8,10 +8,11 @@ import org.jetbrains.idea.svn.SvnVcs;
import org.jetbrains.idea.svn.WorkingCopyFormat;
import org.jetbrains.idea.svn.auth.IdeaSvnkitBasedAuthenticationCallback;
import org.jetbrains.idea.svn.commandLine.*;
+import org.jetbrains.idea.svn.diff.DiffOptions;
+import org.tmatesoft.svn.core.SVNCancelException;
+import org.tmatesoft.svn.core.SVNDepth;
import org.tmatesoft.svn.core.SVNException;
-import org.tmatesoft.svn.core.wc.ISVNEventHandler;
-import org.tmatesoft.svn.core.wc.SVNEvent;
-import org.tmatesoft.svn.core.wc.SVNEventAction;
+import org.tmatesoft.svn.core.wc.*;
import org.tmatesoft.svn.core.wc2.SvnTarget;
import java.io.File;
@@ -109,10 +110,10 @@ public abstract class BaseSvnClient implements SvnClient {
return runtime.runWithAuthenticationAttempt(command);
}
- protected static void callHandler(@Nullable ISVNEventHandler handler, @NotNull SVNEvent event) throws VcsException {
+ protected static void callHandler(@Nullable ProgressTracker handler, @NotNull ProgressEvent event) throws VcsException {
if (handler != null) {
try {
- handler.handleEvent(event, 0);
+ handler.consume(event);
}
catch (SVNException e) {
throw new SvnBindException(e);
@@ -121,7 +122,44 @@ public abstract class BaseSvnClient implements SvnClient {
}
@NotNull
- protected static SVNEvent createEvent(@NotNull File path, @Nullable SVNEventAction action) {
- return new SVNEvent(path, null, null, 0, null, null, null, null, action, null, null, null, null, null, null);
+ protected static ProgressEvent createEvent(@NotNull File path, @Nullable EventAction action) {
+ return new ProgressEvent(path, 0, null, null, action, null, null);
+ }
+
+ @Nullable
+ protected static ISVNEventHandler toEventHandler(@Nullable final ProgressTracker handler) {
+ ISVNEventHandler result = null;
+
+ if (handler != null) {
+ result = new ISVNEventHandler() {
+ @Override
+ public void handleEvent(SVNEvent event, double progress) throws SVNException {
+ handler.consume(ProgressEvent.create(event));
+ }
+
+ @Override
+ public void checkCancelled() throws SVNCancelException {
+ handler.checkCancelled();
+ }
+ };
+ }
+
+ return result;
+ }
+
+ @Nullable
+ protected static SVNDiffOptions toDiffOptions(@Nullable DiffOptions options) {
+ return options != null ? new SVNDiffOptions(options.isIgnoreAllWhitespace(), options.isIgnoreAmountOfWhitespace(),
+ options.isIgnoreEOLStyle()) : null;
+ }
+
+ @Nullable
+ protected static SVNDepth toDepth(@Nullable Depth depth) {
+ return depth != null ? SVNDepth.fromString(depth.getName()) : null;
+ }
+
+ @NotNull
+ protected static SVNRevision notNullize(@Nullable SVNRevision revision) {
+ return revision != null ? revision : SVNRevision.UNDEFINED;
}
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/api/ClientFactory.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/api/ClientFactory.java
index 99e00a373d7d..ba3e56de8e63 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/api/ClientFactory.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/api/ClientFactory.java
@@ -27,7 +27,6 @@ import org.jetbrains.idea.svn.revert.RevertClient;
import org.jetbrains.idea.svn.update.RelocateClient;
import org.jetbrains.idea.svn.update.UpdateClient;
import org.jetbrains.idea.svn.upgrade.UpgradeClient;
-import org.tmatesoft.svn.core.wc.ISVNEventHandler;
import org.tmatesoft.svn.core.wc.ISVNStatusFileProvider;
/**
@@ -102,7 +101,7 @@ public abstract class ClientFactory {
}
@NotNull
- public StatusClient createStatusClient(@Nullable ISVNStatusFileProvider provider, @NotNull ISVNEventHandler handler) {
+ public StatusClient createStatusClient(@Nullable ISVNStatusFileProvider provider, @NotNull ProgressTracker handler) {
return createStatusClient();
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/api/Depth.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/api/Depth.java
new file mode 100644
index 000000000000..9ccc96e81f67
--- /dev/null
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/api/Depth.java
@@ -0,0 +1,93 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jetbrains.idea.svn.api;
+
+import com.intellij.util.containers.ContainerUtil;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+import org.tmatesoft.svn.core.SVNDepth;
+
+import java.util.Map;
+
+/**
+ * @author Konstantin Kolosovsky.
+ */
+public enum Depth {
+
+ UNKNOWN("unknown"),
+ INFINITY("infinity"),
+ IMMEDIATES("immediates"),
+ FILES("files"),
+ EMPTY("empty");
+
+ @NotNull private static final Map<String, Depth> ourAllDepths = ContainerUtil.newHashMap();
+
+ static {
+ for (Depth action : Depth.values()) {
+ register(action);
+ }
+ }
+
+ @NotNull private final String myName;
+
+ Depth(@NotNull String name) {
+ myName = name;
+ }
+
+ @NotNull
+ public String getName() {
+ return myName;
+ }
+
+ @Override
+ public String toString() {
+ return myName;
+ }
+
+ private static void register(@NotNull Depth depth) {
+ ourAllDepths.put(depth.myName, depth);
+ }
+
+ @NotNull
+ public static Depth from(@NotNull String depthName) {
+ Depth result = ourAllDepths.get(depthName);
+
+ if (result == null) {
+ throw new IllegalArgumentException("Unknown depth " + depthName);
+ }
+
+ return result;
+ }
+
+ @NotNull
+ public static Depth from(@Nullable SVNDepth depth) {
+ return depth != null ? from(depth.getName()) : UNKNOWN;
+ }
+
+ @NotNull
+ public static Depth allOrFiles(boolean recursive) {
+ return recursive ? INFINITY : FILES;
+ }
+
+ @NotNull
+ public static Depth allOrEmpty(boolean recursive) {
+ return recursive ? INFINITY : EMPTY;
+ }
+
+ public static boolean isRecursive(@Nullable Depth depth) {
+ return depth == null || depth == INFINITY || depth == UNKNOWN;
+ }
+}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/api/EventAction.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/api/EventAction.java
new file mode 100644
index 000000000000..3a1d3fc80ef1
--- /dev/null
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/api/EventAction.java
@@ -0,0 +1,91 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jetbrains.idea.svn.api;
+
+import com.intellij.util.ObjectUtils;
+import com.intellij.util.containers.ContainerUtil;
+import org.jetbrains.annotations.NotNull;
+import org.tmatesoft.svn.core.wc.SVNEventAction;
+
+import java.util.Map;
+
+/**
+ * @author Konstantin Kolosovsky.
+ */
+public enum EventAction {
+
+ // currently used to represent some not used event action from SVNKit
+ UNKNOWN("unknown"),
+
+ ADD("add"),
+ DELETE("delete"),
+ RESTORE("restore"),
+ REVERT("revert"),
+ FAILED_REVERT("failed_revert"),
+ SKIP("skip"),
+
+ UPDATE_DELETE("update_delete"),
+ UPDATE_ADD("update_add"),
+ UPDATE_UPDATE("update_update"),
+ UPDATE_NONE("update_none"),
+ UPDATE_COMPLETED("update_completed"),
+ UPDATE_EXTERNAL("update_external"),
+ UPDATE_SKIP_OBSTRUCTION("update_skip_obstruction"),
+ UPDATE_STARTED("update_started"),
+
+ COMMIT_MODIFIED("commit_modified"),
+ COMMIT_ADDED("commit_added"),
+ COMMIT_DELETED("commit_deleted"),
+ COMMIT_REPLACED("commit_replaced"),
+ COMMIT_DELTA_SENT("commit_delta_sent"),
+ FAILED_OUT_OF_DATE("failed_out_of_date"),
+
+ LOCKED("locked"),
+ UNLOCKED("unlocked"),
+ LOCK_FAILED("lock_failed"),
+ UNLOCK_FAILED("unlock_failed"),
+
+ UPGRADED_PATH("upgraded_path"),
+
+ TREE_CONFLICT("tree_conflict");
+
+ @NotNull private static final Map<String, EventAction> ourAllActions = ContainerUtil.newHashMap();
+
+ static {
+ for (EventAction action : EventAction.values()) {
+ register(action);
+ }
+ }
+
+ private String myKey;
+
+ EventAction(String key) {
+ myKey = key;
+ }
+
+ public String toString() {
+ return myKey;
+ }
+
+ private static void register(@NotNull EventAction action) {
+ ourAllActions.put(action.myKey, action);
+ }
+
+ @NotNull
+ public static EventAction from(@NotNull SVNEventAction action) {
+ return ObjectUtils.notNull(ourAllActions.get(action.toString()), UNKNOWN);
+ }
+}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/api/FileStatusResultParser.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/api/FileStatusResultParser.java
index fc202c265a6a..7bc0b32a2e04 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/api/FileStatusResultParser.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/api/FileStatusResultParser.java
@@ -6,8 +6,6 @@ import com.intellij.util.containers.Convertor;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.tmatesoft.svn.core.SVNException;
-import org.tmatesoft.svn.core.wc.ISVNEventHandler;
-import org.tmatesoft.svn.core.wc.SVNEvent;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -17,20 +15,18 @@ import java.util.regex.Pattern;
*/
public class FileStatusResultParser {
- private static final double DEFAULT_PROGRESS = 0.0;
-
@NotNull
private Pattern myLinePattern;
@Nullable
- private ISVNEventHandler handler;
+ private ProgressTracker handler;
@NotNull
- private Convertor<Matcher, SVNEvent> myConvertor;
+ private Convertor<Matcher, ProgressEvent> myConvertor;
public FileStatusResultParser(@NotNull Pattern linePattern,
- @Nullable ISVNEventHandler handler,
- @NotNull Convertor<Matcher, SVNEvent> convertor) {
+ @Nullable ProgressTracker handler,
+ @NotNull Convertor<Matcher, ProgressEvent> convertor) {
myLinePattern = linePattern;
this.handler = handler;
myConvertor = convertor;
@@ -59,7 +55,7 @@ public class FileStatusResultParser {
public void process(@NotNull Matcher matcher) throws VcsException {
if (handler != null) {
try {
- handler.handleEvent(myConvertor.convert(matcher), DEFAULT_PROGRESS);
+ handler.consume(myConvertor.convert(matcher));
} catch (SVNException e) {
throw new VcsException(e);
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/api/InfoCommandRepositoryProvider.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/api/InfoCommandRepositoryProvider.java
index c2be897dc3a1..bfcf37de3a0d 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/api/InfoCommandRepositoryProvider.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/api/InfoCommandRepositoryProvider.java
@@ -18,8 +18,7 @@ package org.jetbrains.idea.svn.api;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.SvnVcs;
-import org.tmatesoft.svn.core.wc.SVNInfo;
-import org.tmatesoft.svn.core.wc.SVNRevision;
+import org.jetbrains.idea.svn.info.Info;
import org.tmatesoft.svn.core.wc2.SvnTarget;
/**
@@ -42,7 +41,7 @@ public class InfoCommandRepositoryProvider extends BaseRepositoryProvider {
result = new Repository(myTarget.getURL());
}
else {
- SVNInfo info = myVcs.getInfo(myTarget.getFile());
+ Info info = myVcs.getInfo(myTarget.getFile());
result = info != null ? new Repository(info.getRepositoryRootURL()) : null;
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/api/NodeKind.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/api/NodeKind.java
new file mode 100644
index 000000000000..e4820b844c23
--- /dev/null
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/api/NodeKind.java
@@ -0,0 +1,94 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jetbrains.idea.svn.api;
+
+import com.intellij.util.containers.ContainerUtil;
+import org.jetbrains.annotations.NotNull;
+import org.tmatesoft.svn.core.SVNNodeKind;
+
+import javax.xml.bind.annotation.XmlEnum;
+import javax.xml.bind.annotation.XmlEnumValue;
+import java.util.Map;
+
+/**
+ * @author Konstantin Kolosovsky.
+ */
+@XmlEnum
+public enum NodeKind {
+
+ // see comments in LogEntryPath.Builder for cases when "" kind could appear
+ @XmlEnumValue("") UNKNOWN("unknown"),
+ @XmlEnumValue("file") FILE("file"),
+ @XmlEnumValue("dir") DIR("dir"),
+ // used in ConflictVersion when node is missing
+ @XmlEnumValue("none") NONE("none");
+
+ @NotNull private static final Map<String, NodeKind> ourAllNodeKinds = ContainerUtil.newHashMap();
+
+ static {
+ for (NodeKind kind : NodeKind.values()) {
+ register(kind);
+ }
+ }
+
+ @NotNull private final String myKey;
+
+ NodeKind(@NotNull String key) {
+ myKey = key;
+ }
+
+ public boolean isFile() {
+ return FILE.equals(this);
+ }
+
+ public boolean isDirectory() {
+ return DIR.equals(this);
+ }
+
+ public boolean isNone() {
+ return NONE.equals(this);
+ }
+
+ @Override
+ public String toString() {
+ return myKey;
+ }
+
+ private static void register(@NotNull NodeKind kind) {
+ ourAllNodeKinds.put(kind.myKey, kind);
+ }
+
+ @NotNull
+ public static NodeKind from(@NotNull String nodeKindName) {
+ NodeKind result = ourAllNodeKinds.get(nodeKindName);
+
+ if (result == null) {
+ throw new IllegalArgumentException("Unknown node kind " + nodeKindName);
+ }
+
+ return result;
+ }
+
+ @NotNull
+ public static NodeKind from(@NotNull SVNNodeKind nodeKind) {
+ return from(nodeKind.toString());
+ }
+
+ @NotNull
+ public static NodeKind from(boolean isDirectory) {
+ return isDirectory ? DIR : FILE;
+ }
+}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/api/ProgressEvent.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/api/ProgressEvent.java
new file mode 100644
index 000000000000..12bd2e1a91f4
--- /dev/null
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/api/ProgressEvent.java
@@ -0,0 +1,118 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jetbrains.idea.svn.api;
+
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+import org.jetbrains.idea.svn.status.StatusType;
+import org.tmatesoft.svn.core.SVNErrorMessage;
+import org.tmatesoft.svn.core.SVNURL;
+import org.tmatesoft.svn.core.wc.SVNEvent;
+
+import java.io.File;
+
+/**
+ * @author Konstantin Kolosovsky.
+ */
+public class ProgressEvent {
+
+ private final File myFile;
+
+ private final long myRevision;
+ private final SVNURL myURL;
+
+ @NotNull private final StatusType myContentsStatus;
+ @NotNull private final StatusType myPropertiesStatus;
+ private final SVNErrorMessage myErrorMessage;
+ private final EventAction myAction;
+
+ @Nullable
+ public static ProgressEvent create(@Nullable SVNEvent event) {
+ ProgressEvent result = null;
+
+ if (event != null) {
+ if (event.getFile() == null && event.getURL() == null) {
+ result = new ProgressEvent(event.getErrorMessage());
+ }
+ else {
+ result =
+ new ProgressEvent(event.getFile(), event.getRevision(), StatusType.from(event.getContentsStatus()), StatusType.from(event.getPropertiesStatus()),
+ EventAction.from(event.getAction()), event.getErrorMessage(), event.getURL());
+ }
+ }
+
+ return result;
+ }
+
+ public ProgressEvent(SVNErrorMessage errorMessage) {
+ this(null, 0, null, null, EventAction.SKIP, errorMessage, null);
+ }
+
+ public ProgressEvent(File file,
+ long revision,
+ @Nullable StatusType contentStatus,
+ @Nullable StatusType propertiesStatus,
+ EventAction action,
+ SVNErrorMessage error,
+ SVNURL url) {
+ myFile = file != null ? file.getAbsoluteFile() : null;
+ myRevision = revision;
+ myContentsStatus = contentStatus == null ? StatusType.INAPPLICABLE : contentStatus;
+ myPropertiesStatus = propertiesStatus == null ? StatusType.INAPPLICABLE : propertiesStatus;
+ myAction = action;
+ myErrorMessage = error;
+ myURL = url;
+ }
+
+ public File getFile() {
+ return myFile;
+ }
+
+ public EventAction getAction() {
+ return myAction;
+ }
+
+ @NotNull
+ public StatusType getContentsStatus() {
+ return myContentsStatus;
+ }
+
+ public SVNErrorMessage getErrorMessage() {
+ return myErrorMessage;
+ }
+
+ @NotNull
+ public StatusType getPropertiesStatus() {
+ return myPropertiesStatus;
+ }
+
+ public long getRevision() {
+ return myRevision;
+ }
+
+ public SVNURL getURL() {
+ return myURL;
+ }
+
+ @Nullable
+ public String getPath() {
+ return myFile != null ? myFile.getName() : myURL != null ? myURL.toString() : null;
+ }
+
+ public String toString() {
+ return getAction() + " " + getFile() + " " + getURL();
+ }
+} \ No newline at end of file
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/api/ProgressTracker.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/api/ProgressTracker.java
new file mode 100644
index 000000000000..303b66a00c62
--- /dev/null
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/api/ProgressTracker.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jetbrains.idea.svn.api;
+
+import com.intellij.util.ThrowableConsumer;
+import org.tmatesoft.svn.core.SVNCancelException;
+import org.tmatesoft.svn.core.SVNException;
+
+/**
+ * @author Konstantin Kolosovsky.
+ */
+public interface ProgressTracker extends ThrowableConsumer<ProgressEvent, SVNException> {
+
+ void checkCancelled() throws SVNCancelException;
+}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/api/SvnKitClientFactory.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/api/SvnKitClientFactory.java
index 1b834c16585b..f46f5f06ebdb 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/api/SvnKitClientFactory.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/api/SvnKitClientFactory.java
@@ -29,7 +29,6 @@ import org.jetbrains.idea.svn.update.SvnKitRelocateClient;
import org.jetbrains.idea.svn.update.SvnKitUpdateClient;
import org.jetbrains.idea.svn.update.UpdateClient;
import org.jetbrains.idea.svn.upgrade.SvnKitUpgradeClient;
-import org.tmatesoft.svn.core.wc.ISVNEventHandler;
import org.tmatesoft.svn.core.wc.ISVNStatusFileProvider;
/**
@@ -72,7 +71,7 @@ public class SvnKitClientFactory extends ClientFactory {
@NotNull
@Override
- public StatusClient createStatusClient(@Nullable ISVNStatusFileProvider provider, @NotNull ISVNEventHandler handler) {
+ public StatusClient createStatusClient(@Nullable ISVNStatusFileProvider provider, @NotNull ProgressTracker handler) {
return prepare(new SvnKitStatusClient(provider, handler));
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/branchConfig/BranchesLoader.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/branchConfig/BranchesLoader.java
index 698ed90418c7..10f4574c7f39 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/branchConfig/BranchesLoader.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/branchConfig/BranchesLoader.java
@@ -20,6 +20,9 @@ import com.intellij.openapi.vcs.VcsException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.idea.svn.SvnConfiguration;
import org.jetbrains.idea.svn.SvnVcs;
+import org.jetbrains.idea.svn.api.Depth;
+import org.jetbrains.idea.svn.browse.DirectoryEntry;
+import org.jetbrains.idea.svn.browse.DirectoryEntryConsumer;
import org.jetbrains.idea.svn.integrate.SvnBranchItem;
import org.tmatesoft.svn.core.*;
import org.tmatesoft.svn.core.wc.SVNLogClient;
@@ -42,13 +45,14 @@ public class BranchesLoader {
SVNURL branchesUrl = SVNURL.parseURIEncoded(url);
List<SvnBranchItem> result = new LinkedList<SvnBranchItem>();
SvnTarget target = SvnTarget.fromURL(branchesUrl);
- ISVNDirEntryHandler handler = createHandler(branchesUrl, result);
if (!passive) {
// TODO: Implement ability to specify interactive/non-interactive auth mode for clients
- vcs.getFactory(target).createBrowseClient().list(target, SVNRevision.HEAD, SVNDepth.IMMEDIATES, handler);
+ DirectoryEntryConsumer handler = createConsumer(branchesUrl, result);
+ vcs.getFactory(target).createBrowseClient().list(target, SVNRevision.HEAD, Depth.IMMEDIATES, handler);
}
else {
+ ISVNDirEntryHandler handler = createHandler(branchesUrl, result);
SVNLogClient client = vcs.getSvnKitManager().createLogClient(configuration.getPassiveAuthenticationManager(project));
client
.doList(target.getURL(), target.getPegRevision(), SVNRevision.HEAD, false, SVNDepth.IMMEDIATES, SVNDirEntry.DIRENT_ALL, handler);
@@ -69,4 +73,18 @@ public class BranchesLoader {
}
};
}
+
+ @NotNull
+ private static DirectoryEntryConsumer createConsumer(@NotNull final SVNURL branchesUrl, @NotNull final List<SvnBranchItem> result) {
+ return new DirectoryEntryConsumer() {
+
+ @Override
+ public void consume(final DirectoryEntry entry) throws SVNException {
+ // TODO: Remove equality check with branchesUrl when SVNLogClient will not be used directly, but rather through BrowseClient.
+ if (!branchesUrl.equals(entry.getUrl()) && entry.getDate() != null) {
+ result.add(new SvnBranchItem(entry.getUrl().toDecodedString(), entry.getDate(), entry.getRevision()));
+ }
+ }
+ };
+ }
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/branchConfig/DefaultConfigLoader.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/branchConfig/DefaultConfigLoader.java
index 315954e7b520..d52798e6bfc3 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/branchConfig/DefaultConfigLoader.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/branchConfig/DefaultConfigLoader.java
@@ -24,10 +24,13 @@ import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.SvnVcs;
+import org.jetbrains.idea.svn.api.Depth;
+import org.jetbrains.idea.svn.browse.DirectoryEntry;
+import org.jetbrains.idea.svn.browse.DirectoryEntryConsumer;
+import org.jetbrains.idea.svn.info.Info;
import org.jetbrains.idea.svn.integrate.SvnBranchItem;
import org.tmatesoft.svn.core.*;
import org.tmatesoft.svn.core.internal.util.SVNPathUtil;
-import org.tmatesoft.svn.core.wc.SVNInfo;
import org.tmatesoft.svn.core.wc.SVNRevision;
import org.tmatesoft.svn.core.wc2.SvnTarget;
@@ -52,7 +55,7 @@ public class DefaultConfigLoader {
final SvnVcs vcs = SvnVcs.getInstance(project);
File rootFile = new File(vcsRoot.getPath());
- final SVNInfo info = vcs.getInfo(rootFile);
+ final Info info = vcs.getInfo(rootFile);
if (info == null || info.getURL() == null) {
LOG.info("Directory is not a working copy: " + vcsRoot.getPresentableUrl());
return null;
@@ -67,7 +70,7 @@ public class DefaultConfigLoader {
SVNURL rootPath = baseUrl.removePathTail();
SvnTarget target = SvnTarget.fromURL(rootPath);
- vcs.getFactory(target).createBrowseClient().list(target, SVNRevision.HEAD, SVNDepth.IMMEDIATES, createHandler(result, rootPath));
+ vcs.getFactory(target).createBrowseClient().list(target, SVNRevision.HEAD, Depth.IMMEDIATES, createHandler(result, rootPath));
break;
}
if (SVNPathUtil.removeTail(baseUrl.getPath()).length() == 0) {
@@ -88,13 +91,15 @@ public class DefaultConfigLoader {
}
@NotNull
- private static ISVNDirEntryHandler createHandler(final SvnBranchConfigurationNew result, final SVNURL rootPath) {
- return new ISVNDirEntryHandler() {
- public void handleDirEntry(final SVNDirEntry dirEntry) throws SVNException {
- if (SVNNodeKind.DIR.equals(dirEntry.getKind())) {
- SVNURL childUrl = rootPath.appendPath(dirEntry.getName(), false);
+ private static DirectoryEntryConsumer createHandler(final SvnBranchConfigurationNew result, final SVNURL rootPath) {
+ return new DirectoryEntryConsumer() {
- if (StringUtil.endsWithIgnoreCase(dirEntry.getName(), DEFAULT_TRUNK_NAME)) {
+ @Override
+ public void consume(final DirectoryEntry entry) throws SVNException {
+ if (entry.isDirectory()) {
+ SVNURL childUrl = rootPath.appendPath(entry.getName(), false);
+
+ if (StringUtil.endsWithIgnoreCase(entry.getName(), DEFAULT_TRUNK_NAME)) {
result.setTrunkUrl(childUrl.toString());
}
else {
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/branchConfig/SvnBranchConfigurationNew.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/branchConfig/SvnBranchConfigurationNew.java
index b3554ce89c74..4102210a657a 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/branchConfig/SvnBranchConfigurationNew.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/branchConfig/SvnBranchConfigurationNew.java
@@ -23,12 +23,12 @@ import com.intellij.util.containers.Convertor;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.SvnUtil;
import org.jetbrains.idea.svn.SvnVcs;
+import org.jetbrains.idea.svn.info.Info;
import org.jetbrains.idea.svn.integrate.SvnBranchItem;
import org.tmatesoft.svn.core.SVNException;
import org.tmatesoft.svn.core.SVNURL;
import org.tmatesoft.svn.core.internal.util.SVNPathUtil;
import org.tmatesoft.svn.core.internal.util.SVNURLUtil;
-import org.tmatesoft.svn.core.wc.SVNInfo;
import java.io.File;
import java.util.*;
@@ -221,7 +221,7 @@ public class SvnBranchConfigurationNew {
private BranchRootSearcher(final SvnVcs vcs, final VirtualFile root) throws SVNException {
myRoot = root;
myBranchesUnder = new HashMap<String, String>();
- final SVNInfo info = vcs.getInfo(myRoot.getPath());
+ final Info info = vcs.getInfo(myRoot.getPath());
myRootUrl = info != null ? info.getURL() : null;
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/browse/BrowseClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/browse/BrowseClient.java
index 92e64bb5230e..f5c46cb32842 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/browse/BrowseClient.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/browse/BrowseClient.java
@@ -18,9 +18,8 @@ package org.jetbrains.idea.svn.browse;
import com.intellij.openapi.vcs.VcsException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import org.jetbrains.idea.svn.api.Depth;
import org.jetbrains.idea.svn.api.SvnClient;
-import org.tmatesoft.svn.core.ISVNDirEntryHandler;
-import org.tmatesoft.svn.core.SVNDepth;
import org.tmatesoft.svn.core.wc.SVNRevision;
import org.tmatesoft.svn.core.wc2.SvnTarget;
@@ -29,7 +28,7 @@ import org.tmatesoft.svn.core.wc2.SvnTarget;
*/
public interface BrowseClient extends SvnClient {
- void list(@NotNull SvnTarget target, @Nullable SVNRevision revision, @Nullable SVNDepth depth, @Nullable ISVNDirEntryHandler handler)
+ void list(@NotNull SvnTarget target, @Nullable SVNRevision revision, @Nullable Depth depth, @Nullable DirectoryEntryConsumer handler)
throws VcsException;
long createDirectory(@NotNull SvnTarget target, @NotNull String message, boolean makeParents) throws VcsException;
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/browse/CmdBrowseClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/browse/CmdBrowseClient.java
index 20d60a9e50bf..bceb516caef3 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/browse/CmdBrowseClient.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/browse/CmdBrowseClient.java
@@ -21,12 +21,17 @@ import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.api.BaseSvnClient;
+import org.jetbrains.idea.svn.api.Depth;
+import org.jetbrains.idea.svn.api.NodeKind;
import org.jetbrains.idea.svn.checkin.CmdCheckinClient;
+import org.jetbrains.idea.svn.checkin.CommitInfo;
import org.jetbrains.idea.svn.commandLine.CommandExecutor;
import org.jetbrains.idea.svn.commandLine.CommandUtil;
import org.jetbrains.idea.svn.commandLine.SvnBindException;
import org.jetbrains.idea.svn.commandLine.SvnCommandName;
-import org.tmatesoft.svn.core.*;
+import org.jetbrains.idea.svn.lock.Lock;
+import org.tmatesoft.svn.core.SVNException;
+import org.tmatesoft.svn.core.SVNURL;
import org.tmatesoft.svn.core.wc.SVNRevision;
import org.tmatesoft.svn.core.wc2.SvnTarget;
@@ -35,7 +40,6 @@ import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.ArrayList;
-import java.util.Date;
import java.util.List;
/**
@@ -46,8 +50,8 @@ public class CmdBrowseClient extends BaseSvnClient implements BrowseClient {
@Override
public void list(@NotNull SvnTarget target,
@Nullable SVNRevision revision,
- @Nullable SVNDepth depth,
- @Nullable ISVNDirEntryHandler handler) throws VcsException {
+ @Nullable Depth depth,
+ @Nullable DirectoryEntryConsumer handler) throws VcsException {
assertUrl(target);
List<String> parameters = new ArrayList<String>();
@@ -85,15 +89,15 @@ public class CmdBrowseClient extends BaseSvnClient implements BrowseClient {
return listener.getCommittedRevision();
}
- private static void parseOutput(@NotNull SVNURL url, @NotNull CommandExecutor command, @Nullable ISVNDirEntryHandler handler)
- throws VcsException, SVNException {
+ private static void parseOutput(@NotNull SVNURL url, @NotNull CommandExecutor command, @Nullable DirectoryEntryConsumer handler)
+ throws VcsException, SVNException {
try {
TargetLists lists = CommandUtil.parse(command.getOutput(), TargetLists.class);
if (handler != null && lists != null) {
for (TargetList list : lists.lists) {
for (Entry entry : list.entries) {
- handler.handleDirEntry(entry.toDirEntry(url));
+ handler.consume(entry.toDirectoryEntry(url));
}
}
}
@@ -122,8 +126,8 @@ public class CmdBrowseClient extends BaseSvnClient implements BrowseClient {
public static class Entry {
- @XmlAttribute(name = "kind")
- public String kind;
+ @XmlAttribute(name = "kind", required = true)
+ public NodeKind kind;
@XmlElement(name = "name")
public String name;
@@ -131,68 +135,15 @@ public class CmdBrowseClient extends BaseSvnClient implements BrowseClient {
@XmlElement(name = "size")
public long size;
- @XmlElement(name = "commit")
- public Commit commit;
+ public CommitInfo.Builder commit;
- @XmlElement(name = "lock")
- public Lock lock;
+ public Lock.Builder lock;
- public long revision() {
- return commit != null ? commit.revision : 0;
- }
-
- public String author() {
- return commit != null ? commit.author : "";
- }
-
- public Date date() {
- return commit != null ? commit.date : null;
- }
-
- public SVNDirEntry toDirEntry(@NotNull SVNURL url) throws SVNException {
+ @NotNull
+ public DirectoryEntry toDirectoryEntry(@NotNull SVNURL url) throws SVNException {
// TODO: repository is not used for now
- SVNDirEntry entry =
- new SVNDirEntry(url.appendPath(name, false), null, PathUtil.getFileName(name), SVNNodeKind.parseKind(kind), size, false, revision(),
- date(), author());
-
- entry.setRelativePath(name);
- entry.setLock(lock != null ? lock.toLock(entry.getRelativePath()) : null);
-
- return entry;
- }
- }
-
- public static class Commit {
-
- @XmlAttribute(name = "revision")
- public long revision;
-
- @XmlElement(name = "author")
- public String author;
-
- @XmlElement(name = "date")
- public Date date;
- }
-
- public static class Lock {
-
- @XmlElement(name = "token")
- public String token;
-
- @XmlElement(name = "owner")
- public String owner;
-
- @XmlElement(name = "comment")
- public String comment;
-
- @XmlElement(name = "created")
- public Date created;
-
- @XmlElement(name = "expires")
- public Date expires;
-
- public SVNLock toLock(@NotNull String path) {
- return new SVNLock(path, token, owner, comment, created, expires);
+ return new DirectoryEntry(url.appendPath(name, false), null, PathUtil.getFileName(name), kind,
+ commit != null ? commit.build() : null, name);
}
}
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/browse/DirectoryEntry.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/browse/DirectoryEntry.java
new file mode 100644
index 000000000000..e29e6e468bd1
--- /dev/null
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/browse/DirectoryEntry.java
@@ -0,0 +1,100 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jetbrains.idea.svn.browse;
+
+import com.intellij.util.ObjectUtils;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+import org.jetbrains.idea.svn.api.BaseNodeDescription;
+import org.jetbrains.idea.svn.api.NodeKind;
+import org.jetbrains.idea.svn.checkin.CommitInfo;
+import org.tmatesoft.svn.core.SVNDirEntry;
+import org.tmatesoft.svn.core.SVNURL;
+
+import java.util.Date;
+
+/**
+ * @author Konstantin Kolosovsky.
+ */
+public class DirectoryEntry extends BaseNodeDescription implements Comparable<DirectoryEntry> {
+
+ private final String myName;
+ @NotNull private final CommitInfo myCommitInfo;
+ private final String myPath;
+ private final SVNURL myUrl;
+ private final SVNURL myRepositoryRoot;
+
+ @NotNull
+ public static DirectoryEntry create(@NotNull SVNDirEntry entry) {
+ return new DirectoryEntry(entry.getURL(), entry.getRepositoryRoot(), entry.getName(), NodeKind.from(entry.getKind()),
+ new CommitInfo.Builder(entry.getRevision(), entry.getDate(), entry.getAuthor()).build(),
+ entry.getRelativePath());
+ }
+
+ public DirectoryEntry(SVNURL url,
+ SVNURL repositoryRoot,
+ String name,
+ @NotNull NodeKind kind,
+ @Nullable CommitInfo commitInfo,
+ String path) {
+ super(kind);
+ myUrl = url;
+ myRepositoryRoot = repositoryRoot;
+ myName = name;
+ myCommitInfo = ObjectUtils.notNull(commitInfo, CommitInfo.EMPTY);
+ myPath = path;
+ }
+
+ public SVNURL getUrl() {
+ return myUrl;
+ }
+
+ public SVNURL getRepositoryRoot() {
+ return myRepositoryRoot;
+ }
+
+ public String getName() {
+ return myName;
+ }
+
+ @NotNull
+ public NodeKind getKind() {
+ return myKind;
+ }
+
+ public Date getDate() {
+ return myCommitInfo.getDate();
+ }
+
+ public long getRevision() {
+ return myCommitInfo.getRevision();
+ }
+
+ public String getAuthor() {
+ return myCommitInfo.getAuthor();
+ }
+
+ public String getRelativePath() {
+ return myPath == null ? myName : myPath;
+ }
+
+ @Override
+ public int compareTo(@NotNull DirectoryEntry o) {
+ int result = getKind().compareTo(o.getKind());
+
+ return result != 0 ? result : myUrl.toString().compareTo(o.getUrl().toString());
+ }
+}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/browse/DirectoryEntryConsumer.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/browse/DirectoryEntryConsumer.java
new file mode 100644
index 000000000000..f404413a6996
--- /dev/null
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/browse/DirectoryEntryConsumer.java
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jetbrains.idea.svn.browse;
+
+import com.intellij.util.ThrowableConsumer;
+import org.tmatesoft.svn.core.SVNException;
+
+/**
+ * @author Konstantin Kolosovsky.
+ */
+public interface DirectoryEntryConsumer extends ThrowableConsumer<DirectoryEntry, SVNException> {
+}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/browse/SvnKitBrowseClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/browse/SvnKitBrowseClient.java
index 42ac680a6ab8..cdbb1ff1e67b 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/browse/SvnKitBrowseClient.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/browse/SvnKitBrowseClient.java
@@ -20,6 +20,7 @@ import com.intellij.openapi.vcs.VcsException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.api.BaseSvnClient;
+import org.jetbrains.idea.svn.api.Depth;
import org.jetbrains.idea.svn.commandLine.SvnBindException;
import org.tmatesoft.svn.core.*;
import org.tmatesoft.svn.core.wc.SVNLogClient;
@@ -33,8 +34,8 @@ public class SvnKitBrowseClient extends BaseSvnClient implements BrowseClient {
@Override
public void list(@NotNull SvnTarget target,
@Nullable SVNRevision revision,
- @Nullable SVNDepth depth,
- @Nullable ISVNDirEntryHandler handler) throws VcsException {
+ @Nullable Depth depth,
+ @Nullable DirectoryEntryConsumer handler) throws VcsException {
assertUrl(target);
SVNLogClient client = myVcs.getSvnKitManager().createLogClient();
@@ -42,10 +43,10 @@ public class SvnKitBrowseClient extends BaseSvnClient implements BrowseClient {
try {
if (target.isFile()) {
- client.doList(target.getFile(), target.getPegRevision(), revision, true, depth, SVNDirEntry.DIRENT_ALL, wrappedHandler);
+ client.doList(target.getFile(), target.getPegRevision(), notNullize(revision), true, toDepth(depth), SVNDirEntry.DIRENT_ALL, wrappedHandler);
}
else {
- client.doList(target.getURL(), target.getPegRevision(), revision, true, depth, SVNDirEntry.DIRENT_ALL, wrappedHandler);
+ client.doList(target.getURL(), target.getPegRevision(), notNullize(revision), true, toDepth(depth), SVNDirEntry.DIRENT_ALL, wrappedHandler);
}
}
catch (SVNException e) {
@@ -69,26 +70,26 @@ public class SvnKitBrowseClient extends BaseSvnClient implements BrowseClient {
}
@Nullable
- private static ISVNDirEntryHandler wrapHandler(@Nullable ISVNDirEntryHandler handler) {
+ private static ISVNDirEntryHandler wrapHandler(@Nullable DirectoryEntryConsumer handler) {
return handler == null ? null : new SkipEmptyNameDirectoriesHandler(handler);
}
public static class SkipEmptyNameDirectoriesHandler implements ISVNDirEntryHandler {
- @NotNull private final ISVNDirEntryHandler handler;
+ @NotNull private final DirectoryEntryConsumer handler;
- public SkipEmptyNameDirectoriesHandler(@NotNull ISVNDirEntryHandler handler) {
+ public SkipEmptyNameDirectoriesHandler(@NotNull DirectoryEntryConsumer handler) {
this.handler = handler;
}
@Override
public void handleDirEntry(SVNDirEntry dirEntry) throws SVNException {
if (!isEmptyNameDirectory(dirEntry)) {
- handler.handleDirEntry(dirEntry);
+ handler.consume(DirectoryEntry.create(dirEntry));
}
}
- private static boolean isEmptyNameDirectory(SVNDirEntry dirEntry) {
+ private static boolean isEmptyNameDirectory(@NotNull SVNDirEntry dirEntry) {
return SVNNodeKind.DIR.equals(dirEntry.getKind()) && StringUtil.isEmpty(dirEntry.getName());
}
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/change/CmdChangeListClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/change/CmdChangeListClient.java
index 2791ce87af12..dc9feddf61d7 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/change/CmdChangeListClient.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/change/CmdChangeListClient.java
@@ -4,9 +4,9 @@ import com.intellij.openapi.vcs.VcsException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.api.BaseSvnClient;
+import org.jetbrains.idea.svn.api.Depth;
import org.jetbrains.idea.svn.commandLine.CommandUtil;
import org.jetbrains.idea.svn.commandLine.SvnCommandName;
-import org.tmatesoft.svn.core.SVNDepth;
import org.tmatesoft.svn.core.wc2.SvnTarget;
import java.io.File;
@@ -25,7 +25,7 @@ public class CmdChangeListClient extends BaseSvnClient implements ChangeListClie
parameters.add(changeList);
CommandUtil.put(parameters, path);
- CommandUtil.put(parameters, SVNDepth.EMPTY);
+ CommandUtil.put(parameters, Depth.EMPTY);
if (changeListsToOperate != null) {
CommandUtil.putChangeLists(parameters, Arrays.asList(changeListsToOperate));
}
@@ -41,7 +41,7 @@ public class CmdChangeListClient extends BaseSvnClient implements ChangeListClie
parameters.add("--remove");
CommandUtil.put(parameters, path);
- CommandUtil.put(parameters, SVNDepth.EMPTY);
+ CommandUtil.put(parameters, Depth.EMPTY);
// for now parsing of the output is not required as command is executed only for one file
// and will be either successful or exception will be thrown
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/CheckinClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/CheckinClient.java
index 628c22219e11..cc8e2ef0e352 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/CheckinClient.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/CheckinClient.java
@@ -18,7 +18,6 @@ package org.jetbrains.idea.svn.checkin;
import com.intellij.openapi.vcs.VcsException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.idea.svn.api.SvnClient;
-import org.tmatesoft.svn.core.SVNCommitInfo;
import java.io.File;
import java.util.Collection;
@@ -29,5 +28,5 @@ import java.util.Collection;
public interface CheckinClient extends SvnClient {
@NotNull
- SVNCommitInfo[] commit(@NotNull Collection<File> paths, @NotNull String comment) throws VcsException;
+ CommitInfo[] commit(@NotNull Collection<File> paths, @NotNull String comment) throws VcsException;
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/CmdCheckinClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/CmdCheckinClient.java
index ce95c6420204..ced5e62b0f33 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/CmdCheckinClient.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/CmdCheckinClient.java
@@ -29,13 +29,14 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.SvnUtil;
import org.jetbrains.idea.svn.api.BaseSvnClient;
-import org.jetbrains.idea.svn.commandLine.*;
+import org.jetbrains.idea.svn.api.Depth;
+import org.jetbrains.idea.svn.commandLine.CommandUtil;
+import org.jetbrains.idea.svn.commandLine.LineCommandAdapter;
+import org.jetbrains.idea.svn.commandLine.SvnBindException;
+import org.jetbrains.idea.svn.commandLine.SvnCommandName;
+import org.jetbrains.idea.svn.status.Status;
import org.jetbrains.idea.svn.status.StatusClient;
-import org.tmatesoft.svn.core.SVNCommitInfo;
-import org.tmatesoft.svn.core.SVNDepth;
-import org.tmatesoft.svn.core.SVNException;
-import org.tmatesoft.svn.core.wc.SVNStatus;
-import org.tmatesoft.svn.core.wc.SVNStatusType;
+import org.jetbrains.idea.svn.status.StatusType;
import org.tmatesoft.svn.core.wc2.SvnTarget;
import java.io.File;
@@ -57,26 +58,21 @@ public class CmdCheckinClient extends BaseSvnClient implements CheckinClient {
@NotNull
@Override
- public SVNCommitInfo[] commit(@NotNull Collection<File> paths, @NotNull String message) throws VcsException {
+ public CommitInfo[] commit(@NotNull Collection<File> paths, @NotNull String message) throws VcsException {
// if directory renames were used, IDEA reports all files under them as moved, but for svn we can not pass some of them
// to commit command - since not all paths are registered as changes -> so we need to filter these cases, but only if
// there at least some child-parent relationships in passed paths
- try {
- paths = filterCommittables(paths);
- }
- catch (SVNException e) {
- throw new SvnBindException(e);
- }
+ paths = filterCommittables(paths);
return commit(ArrayUtil.toObjectArray(paths, File.class), message);
}
@NotNull
- public SVNCommitInfo[] commit(@NotNull File[] paths, @NotNull String message) throws VcsException {
- if (paths.length == 0) return new SVNCommitInfo[]{SVNCommitInfo.NULL};
+ public CommitInfo[] commit(@NotNull File[] paths, @NotNull String message) throws VcsException {
+ if (paths.length == 0) return new CommitInfo[]{CommitInfo.EMPTY};
final List<String> parameters = new ArrayList<String>();
- CommandUtil.put(parameters, SVNDepth.EMPTY);
+ CommandUtil.put(parameters, Depth.EMPTY);
CommandUtil.put(parameters, false, "--no-unlock");
CommandUtil.put(parameters, false, "--keep-changelists");
CommandUtil.putChangeLists(parameters, null);
@@ -95,7 +91,7 @@ public class CmdCheckinClient extends BaseSvnClient implements CheckinClient {
long revision = validateRevisionNumber(listener.getCommittedRevision());
- return new SVNCommitInfo[]{new SVNCommitInfo(revision, null, null, null)};
+ return new CommitInfo[]{new CommitInfo.Builder().setRevision(revision).build()};
}
private static long validateRevisionNumber(long revision) throws VcsException {
@@ -106,7 +102,7 @@ public class CmdCheckinClient extends BaseSvnClient implements CheckinClient {
return revision;
}
- private Collection<File> filterCommittables(@NotNull Collection<File> committables) throws SVNException {
+ private Collection<File> filterCommittables(@NotNull Collection<File> committables) throws SvnBindException {
final Set<String> childrenOfSomebody = ContainerUtil.newHashSet();
new AbstractFilterChildren<File>() {
@Override
@@ -135,13 +131,13 @@ public class CmdCheckinClient extends BaseSvnClient implements CheckinClient {
}
else {
try {
- final SVNStatus status = statusClient.doStatus(file, false);
- if (status != null && !SVNStatusType.STATUS_NONE.equals(status.getContentsStatus()) &&
- !SVNStatusType.STATUS_UNVERSIONED.equals(status.getContentsStatus())) {
+ final Status status = statusClient.doStatus(file, false);
+ if (status != null && !StatusType.STATUS_NONE.equals(status.getContentsStatus()) &&
+ !StatusType.STATUS_UNVERSIONED.equals(status.getContentsStatus())) {
result.add(file);
}
}
- catch (SVNException e) {
+ catch (SvnBindException e) {
// not versioned
LOG.info(e);
throw e;
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/CmdImportClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/CmdImportClient.java
index 74eeadbb2fa1..a06c2800714a 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/CmdImportClient.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/CmdImportClient.java
@@ -4,9 +4,9 @@ import com.intellij.openapi.vcs.VcsException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.api.BaseSvnClient;
+import org.jetbrains.idea.svn.api.Depth;
import org.jetbrains.idea.svn.commandLine.CommandUtil;
import org.jetbrains.idea.svn.commandLine.SvnCommandName;
-import org.tmatesoft.svn.core.SVNDepth;
import org.tmatesoft.svn.core.SVNURL;
import org.tmatesoft.svn.core.wc.ISVNCommitHandler;
import org.tmatesoft.svn.core.wc2.SvnTarget;
@@ -23,7 +23,7 @@ public class CmdImportClient extends BaseSvnClient implements ImportClient {
@Override
public long doImport(@NotNull File path,
@NotNull SVNURL url,
- @Nullable SVNDepth depth,
+ @Nullable Depth depth,
@NotNull String message,
boolean noIgnore,
@Nullable CommitEventHandler handler,
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/CommitEventHandler.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/CommitEventHandler.java
index 87be3fae7dd5..54a92197d2c7 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/CommitEventHandler.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/CommitEventHandler.java
@@ -15,7 +15,7 @@
*/
package org.jetbrains.idea.svn.checkin;
-import org.tmatesoft.svn.core.wc.ISVNEventHandler;
+import org.jetbrains.idea.svn.api.ProgressTracker;
import java.io.File;
@@ -26,7 +26,7 @@ import java.io.File;
* Date: 2/26/13
* Time: 10:12 AM
*/
-public interface CommitEventHandler extends ISVNEventHandler {
+public interface CommitEventHandler extends ProgressTracker {
void commitEvent(final CommitEventType type, final File target);
void committedRevision(final long revNum);
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/CommitInfo.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/CommitInfo.java
new file mode 100644
index 000000000000..a09d3c0295db
--- /dev/null
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/CommitInfo.java
@@ -0,0 +1,127 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jetbrains.idea.svn.checkin;
+
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+import org.tmatesoft.svn.core.SVNErrorMessage;
+
+import javax.xml.bind.annotation.*;
+import java.util.Date;
+
+/**
+ * @author Konstantin Kolosovsky.
+ */
+public class CommitInfo {
+
+ public static final CommitInfo EMPTY = new CommitInfo.Builder().setRevision(-1).build();
+
+ private final long myRevision;
+ private final Date myDate;
+ private final String myAuthor;
+ @Nullable private final SVNErrorMessage myErrorMessage;
+
+ private CommitInfo(@NotNull CommitInfo.Builder builder) {
+ myRevision = builder.revision;
+ myAuthor = builder.author;
+ myDate = builder.date;
+ myErrorMessage = builder.error;
+ }
+
+ public long getRevision() {
+ return myRevision;
+ }
+
+ public String getAuthor() {
+ return myAuthor;
+ }
+
+ public Date getDate() {
+ return myDate;
+ }
+
+ @Nullable
+ public SVNErrorMessage getErrorMessage() {
+ return myErrorMessage;
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "commit")
+ @XmlRootElement(name = "commit")
+ public static class Builder {
+
+ @XmlAttribute(name = "revision")
+ private long revision;
+
+ @XmlElement(name = "author")
+ private String author;
+
+ @XmlElement(name = "date")
+ private Date date;
+
+ @Nullable private SVNErrorMessage error;
+
+ public Builder() {
+ }
+
+ public Builder(long revision, Date date, String author) {
+ this.revision = revision;
+ this.date = date;
+ this.author = author;
+ }
+
+ public long getRevision() {
+ return revision;
+ }
+
+ public String getAuthor() {
+ return author;
+ }
+
+ public Date getDate() {
+ return date;
+ }
+
+ @NotNull
+ public Builder setRevision(long revision) {
+ this.revision = revision;
+ return this;
+ }
+
+ @NotNull
+ public Builder setAuthor(String author) {
+ this.author = author;
+ return this;
+ }
+
+ @NotNull
+ public Builder setDate(Date date) {
+ this.date = date;
+ return this;
+ }
+
+ @NotNull
+ public Builder setError(@Nullable SVNErrorMessage error) {
+ this.error = error;
+ return this;
+ }
+
+ @NotNull
+ public CommitInfo build() {
+ return new CommitInfo(this);
+ }
+ }
+}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/IdeaCommitHandler.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/IdeaCommitHandler.java
index 3b78ac667efa..2dc46692cf59 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/IdeaCommitHandler.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/IdeaCommitHandler.java
@@ -27,11 +27,10 @@ import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.SvnBundle;
-import org.jetbrains.idea.svn.SvnUtil;
+import org.jetbrains.idea.svn.api.EventAction;
+import org.jetbrains.idea.svn.api.ProgressEvent;
+import org.jetbrains.idea.svn.api.ProgressTracker;
import org.tmatesoft.svn.core.SVNCancelException;
-import org.tmatesoft.svn.core.wc.ISVNEventHandler;
-import org.tmatesoft.svn.core.wc.SVNEvent;
-import org.tmatesoft.svn.core.wc.SVNEventAction;
import java.io.File;
import java.util.List;
@@ -42,7 +41,7 @@ import java.util.List;
* Date: 2/26/13
* Time: 11:13 AM
*/
-public class IdeaCommitHandler implements CommitEventHandler, ISVNEventHandler {
+public class IdeaCommitHandler implements CommitEventHandler, ProgressTracker {
private static final Logger LOG = Logger.getInstance(IdeaCommitHandler.class);
@@ -81,8 +80,8 @@ public class IdeaCommitHandler implements CommitEventHandler, ISVNEventHandler {
myProgress.setText2(SvnBundle.message("status.text.comitted.revision", revNum));
}
- public void handleEvent(SVNEvent event, double p) {
- final String path = SvnUtil.getPathForProgress(event);
+ public void consume(ProgressEvent event) {
+ final String path = event.getPath();
if (path != null) {
CommitEventType eventType = convert(event.getAction());
@@ -120,7 +119,7 @@ public class IdeaCommitHandler implements CommitEventHandler, ISVNEventHandler {
}
}
- private void trackDeletedFile(@NotNull SVNEvent event) {
+ private void trackDeletedFile(@NotNull ProgressEvent event) {
@NonNls final String filePath = "file://" + event.getFile().getAbsolutePath().replace(File.separatorChar, '/');
VirtualFile virtualFile = ApplicationManager.getApplication().runReadAction(new Computable<VirtualFile>() {
@Nullable
@@ -135,22 +134,22 @@ public class IdeaCommitHandler implements CommitEventHandler, ISVNEventHandler {
}
@NotNull
- private static CommitEventType convert(@NotNull SVNEventAction action) {
+ private static CommitEventType convert(@NotNull EventAction action) {
CommitEventType result = CommitEventType.unknown;
- if (SVNEventAction.COMMIT_ADDED.equals(action)) {
+ if (EventAction.COMMIT_ADDED.equals(action)) {
result = CommitEventType.adding;
- } else if (SVNEventAction.COMMIT_DELETED.equals(action)) {
+ } else if (EventAction.COMMIT_DELETED.equals(action)) {
result = CommitEventType.deleting;
- } else if (SVNEventAction.COMMIT_MODIFIED.equals(action)) {
+ } else if (EventAction.COMMIT_MODIFIED.equals(action)) {
result = CommitEventType.sending;
- } else if (SVNEventAction.COMMIT_REPLACED.equals(action)) {
+ } else if (EventAction.COMMIT_REPLACED.equals(action)) {
result = CommitEventType.replacing;
- } else if (SVNEventAction.COMMIT_DELTA_SENT.equals(action)) {
+ } else if (EventAction.COMMIT_DELTA_SENT.equals(action)) {
result = CommitEventType.transmittingDeltas;
- } else if (SVNEventAction.SKIP.equals(action)) {
+ } else if (EventAction.SKIP.equals(action)) {
result = CommitEventType.skipped;
- } else if (SVNEventAction.FAILED_OUT_OF_DATE.equals(action)) {
+ } else if (EventAction.FAILED_OUT_OF_DATE.equals(action)) {
result = CommitEventType.failedOutOfDate;
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/ImportClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/ImportClient.java
index d3c273ee1449..9338c5db47c6 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/ImportClient.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/ImportClient.java
@@ -3,8 +3,8 @@ package org.jetbrains.idea.svn.checkin;
import com.intellij.openapi.vcs.VcsException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import org.jetbrains.idea.svn.api.Depth;
import org.jetbrains.idea.svn.api.SvnClient;
-import org.tmatesoft.svn.core.SVNDepth;
import org.tmatesoft.svn.core.SVNURL;
import org.tmatesoft.svn.core.wc.ISVNCommitHandler;
@@ -17,7 +17,7 @@ public interface ImportClient extends SvnClient {
long doImport(@NotNull File path,
@NotNull SVNURL url,
- @Nullable SVNDepth depth,
+ @Nullable Depth depth,
@NotNull String message,
boolean noIgnore,
@Nullable CommitEventHandler handler,
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/SvnCheckinEnvironment.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/SvnCheckinEnvironment.java
index 6fb1b95b7afe..c9a843501253 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/SvnCheckinEnvironment.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/SvnCheckinEnvironment.java
@@ -45,14 +45,14 @@ import com.intellij.util.containers.MultiMap;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.*;
-import org.tmatesoft.svn.core.SVNCommitInfo;
-import org.tmatesoft.svn.core.SVNDepth;
+import org.jetbrains.idea.svn.api.Depth;
+import org.jetbrains.idea.svn.api.ProgressEvent;
+import org.jetbrains.idea.svn.api.ProgressTracker;
+import org.jetbrains.idea.svn.commandLine.SvnBindException;
+import org.jetbrains.idea.svn.status.Status;
+import org.jetbrains.idea.svn.status.StatusType;
import org.tmatesoft.svn.core.SVNException;
import org.tmatesoft.svn.core.SVNURL;
-import org.tmatesoft.svn.core.wc.ISVNEventHandler;
-import org.tmatesoft.svn.core.wc.SVNEvent;
-import org.tmatesoft.svn.core.wc.SVNStatus;
-import org.tmatesoft.svn.core.wc.SVNStatusType;
import javax.swing.*;
import java.awt.*;
@@ -130,18 +130,18 @@ public class SvnCheckinEnvironment implements CheckinEnvironment {
return;
}
- SVNCommitInfo[] results = mySvnVcs.getFactory(format).createCheckinClient().commit(committables, comment);
+ CommitInfo[] results = mySvnVcs.getFactory(format).createCheckinClient().commit(committables, comment);
final StringBuilder committedRevisions = new StringBuilder();
- for (SVNCommitInfo result : results) {
+ for (CommitInfo result : results) {
if (result.getErrorMessage() != null) {
exception.add(new VcsException(result.getErrorMessage().getFullMessage()));
}
- else if (result != SVNCommitInfo.NULL && result.getNewRevision() > 0) {
+ else if (result != CommitInfo.EMPTY && result.getRevision() > 0) {
if (committedRevisions.length() > 0) {
committedRevisions.append(", ");
}
- committedRevisions.append(result.getNewRevision());
+ committedRevisions.append(result.getRevision());
}
}
if (committedRevisions.length() > 0) {
@@ -199,11 +199,9 @@ public class SvnCheckinEnvironment implements CheckinEnvironment {
}
private void addParents(File file, final Adder adder) {
- SVNStatus status = getStatus(file);
+ Status status = getStatus(file);
- if (status != null &&
- (SvnVcs.svnStatusIs(status, SVNStatusType.STATUS_ADDED) ||
- SvnVcs.svnStatusIs(status, SVNStatusType.STATUS_REPLACED))) {
+ if (status != null && status.is(StatusType.STATUS_ADDED, StatusType.STATUS_REPLACED)) {
// file should be added
adder.add(file);
file = file.getParentFile();
@@ -214,13 +212,13 @@ public class SvnCheckinEnvironment implements CheckinEnvironment {
}
@Nullable
- private SVNStatus getStatus(@NotNull File file) {
- SVNStatus result = null;
+ private Status getStatus(@NotNull File file) {
+ Status result = null;
try {
result = mySvnVcs.getFactory(file).createStatusClient().doStatus(file, false);
}
- catch (SVNException e) {
+ catch (SvnBindException e) {
LOG.info(e);
}
@@ -287,9 +285,9 @@ public class SvnCheckinEnvironment implements CheckinEnvironment {
public static List<VcsException> scheduleUnversionedFilesForAddition(@NotNull SvnVcs vcs, List<VirtualFile> files, final boolean recursive) {
Collections.sort(files, FilePathComparator.getInstance());
- ISVNEventHandler eventHandler = new SvnProgressCanceller() {
+ ProgressTracker eventHandler = new SvnProgressCanceller() {
@Override
- public void handleEvent(SVNEvent event, double progress) throws SVNException {
+ public void consume(ProgressEvent event) throws SVNException {
// TODO: indicator is null here when invoking "Add" action
ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator();
File file = event.getFile();
@@ -301,7 +299,7 @@ public class SvnCheckinEnvironment implements CheckinEnvironment {
};
List<VcsException> exceptions = new ArrayList<VcsException>();
- SVNDepth depth = recursive ? SVNDepth.INFINITY : SVNDepth.EMPTY;
+ Depth depth = Depth.allOrEmpty(recursive);
for (VirtualFile file : files) {
try {
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/SvnCheckinHandlerFactory.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/SvnCheckinHandlerFactory.java
index 8af993b9aefc..29e5fe9d7f72 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/SvnCheckinHandlerFactory.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/SvnCheckinHandlerFactory.java
@@ -32,15 +32,15 @@ import com.intellij.openapi.vcs.checkin.CheckinHandler;
import com.intellij.openapi.vcs.checkin.VcsCheckinHandlerFactory;
import com.intellij.openapi.vcs.ui.RefreshableOnComponent;
import com.intellij.openapi.vcs.update.ActionInfo;
-import com.intellij.openapi.vfs.VfsUtil;
+import com.intellij.openapi.vfs.VfsUtilCore;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.PairConsumer;
+import com.intellij.util.containers.MultiMap;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.*;
import org.jetbrains.idea.svn.update.AutoSvnUpdater;
-import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
@@ -74,22 +74,20 @@ public class SvnCheckinHandlerFactory extends VcsCheckinHandlerFactory {
public ReturnResult beforeCheckin(@Nullable CommitExecutor executor, PairConsumer<Object, Object> additionalDataConsumer) {
if (executor instanceof LocalCommitExecutor) return ReturnResult.COMMIT;
final SvnVcs vcs = SvnVcs.getInstance(project);
- final Map<String, Integer> copiesInfo = splitIntoCopies(vcs, myChanges);
+ final MultiMap<String, WorkingCopyFormat> copiesInfo = splitIntoCopies(vcs, myChanges);
final List<String> repoUrls = new ArrayList<String>();
- for (Map.Entry<String, Integer> entry : copiesInfo.entrySet()) {
- if (entry.getValue() == 3) {
+ for (Map.Entry<String, Collection<WorkingCopyFormat>> entry : copiesInfo.entrySet()) {
+ if (entry.getValue().size() > 1) {
repoUrls.add(entry.getKey());
}
}
if (! repoUrls.isEmpty()) {
- final String join = StringUtil.join(repoUrls.toArray(new String[repoUrls.size()]), ",\n");
+ final String join = StringUtil.join(repoUrls, ",\n");
final int isOk = Messages.showOkCancelDialog(project,
SvnBundle.message("checkin.different.formats.involved", repoUrls.size() > 1 ? 1 : 0, join),
"Subversion: Commit Will Split", Messages.getWarningIcon());
- if (Messages.OK == isOk) {
- return ReturnResult.COMMIT;
- }
- return ReturnResult.CANCEL;
+
+ return Messages.OK == isOk ? ReturnResult.COMMIT : ReturnResult.CANCEL;
}
return ReturnResult.COMMIT;
}
@@ -104,17 +102,17 @@ public class SvnCheckinHandlerFactory extends VcsCheckinHandlerFactory {
if (SvnConfiguration.getInstance(project).isAutoUpdateAfterCommit()) {
final VirtualFile[] roots = ProjectLevelVcsManager.getInstance(project).getRootsUnderVcs(SvnVcs.getInstance(project));
final List<FilePath> paths = new ArrayList<FilePath>();
- for (int i = 0; i < roots.length; i++) {
- VirtualFile root = roots[i];
+ for (VirtualFile root : roots) {
boolean take = false;
for (VirtualFile commitRoot : commitRoots) {
- if (VfsUtil.isAncestor(root, commitRoot, false)) {
+ if (VfsUtilCore.isAncestor(root, commitRoot, false)) {
take = true;
break;
}
}
- if (! take) continue;
- paths.add(new FilePathImpl(root));
+ if (take) {
+ paths.add(new FilePathImpl(root));
+ }
}
if (paths.isEmpty()) return;
ApplicationManager.getApplication().invokeLater(new Runnable() {
@@ -128,25 +126,19 @@ public class SvnCheckinHandlerFactory extends VcsCheckinHandlerFactory {
};
}
- private static Map<String, Integer> splitIntoCopies(SvnVcs vcs, final Collection<Change> changes) {
- final SvnFileUrlMapping mapping = vcs.getSvnFileUrlMapping();
+ @NotNull
+ private static MultiMap<String, WorkingCopyFormat> splitIntoCopies(@NotNull SvnVcs vcs, @NotNull Collection<Change> changes) {
+ MultiMap<String, WorkingCopyFormat> result = MultiMap.createSet();
+ SvnFileUrlMapping mapping = vcs.getSvnFileUrlMapping();
- final Map<String, Integer> copiesInfo = new java.util.HashMap<String, Integer>();
for (Change change : changes) {
- final File ioFile = ChangesUtil.getFilePath(change).getIOFile();
- final RootUrlInfo path = mapping.getWcRootForFilePath(ioFile);
- if (path == null) continue;
- final Integer integer = copiesInfo.get(path.getRepositoryUrl());
- int result = integer == null ? 0 : integer;
- if (result != 3) {
- if (WorkingCopyFormat.ONE_DOT_SEVEN.equals(path.getFormat())) {
- result |= 2;
- } else {
- result |= 1;
- }
- copiesInfo.put(path.getRepositoryUrl(), result);
+ RootUrlInfo path = mapping.getWcRootForFilePath(ChangesUtil.getFilePath(change).getIOFile());
+
+ if (path != null) {
+ result.putValue(path.getRepositoryUrl(), path.getFormat());
}
}
- return copiesInfo;
+
+ return result;
}
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/SvnKitCheckinClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/SvnKitCheckinClient.java
index a81aecd94ba2..c3f203a9e02f 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/SvnKitCheckinClient.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/SvnKitCheckinClient.java
@@ -20,6 +20,8 @@ import com.intellij.openapi.progress.ProgressManager;
import com.intellij.openapi.vcs.VcsException;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.ArrayUtil;
+import com.intellij.util.Function;
+import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.idea.svn.api.BaseSvnClient;
import org.jetbrains.idea.svn.commandLine.SvnBindException;
@@ -41,7 +43,7 @@ public class SvnKitCheckinClient extends BaseSvnClient implements CheckinClient
@NotNull
@Override
- public SVNCommitInfo[] commit(@NotNull Collection<File> paths, @NotNull String comment) throws VcsException {
+ public CommitInfo[] commit(@NotNull Collection<File> paths, @NotNull String comment) throws VcsException {
File[] pathsToCommit = ArrayUtil.toObjectArray(paths, File.class);
boolean keepLocks = myVcs.getSvnConfiguration().isKeepLocks();
SVNCommitPacket[] commitPackets = null;
@@ -49,7 +51,7 @@ public class SvnKitCheckinClient extends BaseSvnClient implements CheckinClient
SVNCommitClient committer = myVcs.getSvnKitManager().createCommitClient();
IdeaCommitHandler handler = new IdeaCommitHandler(ProgressManager.getInstance().getProgressIndicator(), true, true);
- committer.setEventHandler(handler);
+ committer.setEventHandler(toEventHandler(handler));
try {
commitPackets = committer.doCollectCommitItems(pathsToCommit, keepLocks, true, SVNDepth.EMPTY, true, null);
results = committer.doCommit(commitPackets, keepLocks, comment);
@@ -76,6 +78,17 @@ public class SvnKitCheckinClient extends BaseSvnClient implements CheckinClient
f.putUserData(VirtualFile.REQUESTOR_MARKER, this);
}
- return results;
+ return convert(results);
+ }
+
+ @NotNull
+ private static CommitInfo[] convert(@NotNull SVNCommitInfo[] infos) {
+ return ContainerUtil.map(infos, new Function<SVNCommitInfo, CommitInfo>() {
+ @Override
+ public CommitInfo fun(SVNCommitInfo info) {
+ return new CommitInfo.Builder(info.getNewRevision(), info.getDate(), info.getAuthor())
+ .setError(info.getErrorMessage()).build();
+ }
+ }, new CommitInfo[0]);
}
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/SvnKitImportClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/SvnKitImportClient.java
index 23edc8f22253..d64f8c3f95a9 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/SvnKitImportClient.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/SvnKitImportClient.java
@@ -4,9 +4,9 @@ import com.intellij.openapi.vcs.VcsException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.api.BaseSvnClient;
+import org.jetbrains.idea.svn.api.Depth;
import org.jetbrains.idea.svn.commandLine.SvnBindException;
import org.tmatesoft.svn.core.SVNCommitInfo;
-import org.tmatesoft.svn.core.SVNDepth;
import org.tmatesoft.svn.core.SVNException;
import org.tmatesoft.svn.core.SVNURL;
import org.tmatesoft.svn.core.wc.ISVNCommitHandler;
@@ -22,18 +22,18 @@ public class SvnKitImportClient extends BaseSvnClient implements ImportClient {
@Override
public long doImport(@NotNull File path,
@NotNull SVNURL url,
- @Nullable SVNDepth depth,
+ @Nullable Depth depth,
@NotNull String message,
boolean noIgnore,
@Nullable CommitEventHandler handler,
@Nullable ISVNCommitHandler commitHandler) throws VcsException {
SVNCommitClient client = myVcs.getSvnKitManager().createCommitClient();
- client.setEventHandler(handler);
+ client.setEventHandler(toEventHandler(handler));
client.setCommitHandler(commitHandler);
try {
- SVNCommitInfo info = client.doImport(path, url, message, null, !noIgnore, false, depth);
+ SVNCommitInfo info = client.doImport(path, url, message, null, !noIgnore, false, toDepth(depth));
return info.getNewRevision();
}
catch (SVNException e) {
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/checkout/CheckoutClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/checkout/CheckoutClient.java
index b31d0da1dc48..d338ca12e55d 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/checkout/CheckoutClient.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/checkout/CheckoutClient.java
@@ -4,9 +4,9 @@ import com.intellij.openapi.vcs.VcsException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.WorkingCopyFormat;
+import org.jetbrains.idea.svn.api.Depth;
+import org.jetbrains.idea.svn.api.ProgressTracker;
import org.jetbrains.idea.svn.api.SvnClient;
-import org.tmatesoft.svn.core.SVNDepth;
-import org.tmatesoft.svn.core.wc.ISVNEventHandler;
import org.tmatesoft.svn.core.wc.SVNRevision;
import org.tmatesoft.svn.core.wc2.SvnTarget;
@@ -21,11 +21,11 @@ public interface CheckoutClient extends SvnClient {
void checkout(@NotNull SvnTarget source,
@NotNull File destination,
@Nullable SVNRevision revision,
- @Nullable SVNDepth depth,
+ @Nullable Depth depth,
boolean ignoreExternals,
boolean force,
@NotNull WorkingCopyFormat format,
- @Nullable ISVNEventHandler handler) throws VcsException;
+ @Nullable ProgressTracker handler) throws VcsException;
List<WorkingCopyFormat> getSupportedFormats() throws VcsException;
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/checkout/CheckoutEventHandler.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/checkout/CheckoutEventHandler.java
index 88f2a6940c10..868c38b8b364 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/checkout/CheckoutEventHandler.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/checkout/CheckoutEventHandler.java
@@ -22,16 +22,15 @@ import com.intellij.openapi.wm.StatusBar;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.SvnBundle;
-import org.jetbrains.idea.svn.SvnUtil;
import org.jetbrains.idea.svn.SvnVcs;
+import org.jetbrains.idea.svn.api.EventAction;
+import org.jetbrains.idea.svn.api.ProgressEvent;
+import org.jetbrains.idea.svn.api.ProgressTracker;
import org.tmatesoft.svn.core.SVNCancelException;
import org.tmatesoft.svn.core.SVNErrorCode;
import org.tmatesoft.svn.core.SVNErrorMessage;
-import org.tmatesoft.svn.core.wc.ISVNEventHandler;
-import org.tmatesoft.svn.core.wc.SVNEvent;
-import org.tmatesoft.svn.core.wc.SVNEventAction;
-public class CheckoutEventHandler implements ISVNEventHandler {
+public class CheckoutEventHandler implements ProgressTracker {
@Nullable private final ProgressIndicator myIndicator;
private int myExternalsCount;
@NotNull private final SvnVcs myVCS;
@@ -46,20 +45,19 @@ public class CheckoutEventHandler implements ISVNEventHandler {
myCnt = 0;
}
- public void handleEvent(SVNEvent event, double progress) {
- final String path = SvnUtil.getPathForProgress(event);
- if (path == null) {
+ public void consume(ProgressEvent event) {
+ if (event.getPath() == null) {
return;
}
- if (event.getAction() == SVNEventAction.UPDATE_EXTERNAL) {
+ if (event.getAction() == EventAction.UPDATE_EXTERNAL) {
myExternalsCount++;
progress(SvnBundle.message("progress.text2.fetching.external.location", event.getFile().getAbsolutePath()));
}
- else if (event.getAction() == SVNEventAction.UPDATE_ADD) {
+ else if (event.getAction() == EventAction.UPDATE_ADD) {
progress2(SvnBundle.message(myIsExport ? "progress.text2.exported" : "progress.text2.checked.out", event.getFile().getName(), myCnt));
++ myCnt;
}
- else if (event.getAction() == SVNEventAction.UPDATE_COMPLETED) {
+ else if (event.getAction() == EventAction.UPDATE_COMPLETED) {
myExternalsCount--;
progress2(
(SvnBundle.message(myIsExport ? "progress.text2.exported.revision" : "progress.text2.checked.out.revision", event.getRevision())));
@@ -70,10 +68,10 @@ public class CheckoutEventHandler implements ISVNEventHandler {
StatusBar.Info.set(SvnBundle.message(myIsExport ? "progress.text2.exported.revision" : "status.text.checked.out.revision", event.getRevision()), project);
}
}
- } else if (event.getAction() == SVNEventAction.COMMIT_ADDED) {
- progress2((SvnBundle.message("progress.text2.adding", path)));
- } else if (event.getAction() == SVNEventAction.COMMIT_DELTA_SENT) {
- progress2((SvnBundle.message("progress.text2.transmitting.delta", path)));
+ } else if (event.getAction() == EventAction.COMMIT_ADDED) {
+ progress2((SvnBundle.message("progress.text2.adding", event.getPath())));
+ } else if (event.getAction() == EventAction.COMMIT_DELTA_SENT) {
+ progress2((SvnBundle.message("progress.text2.transmitting.delta", event.getPath())));
}
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/checkout/CmdCheckoutClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/checkout/CmdCheckoutClient.java
index b292e43b9c1b..7ea00c69d5d6 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/checkout/CmdCheckoutClient.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/checkout/CmdCheckoutClient.java
@@ -6,11 +6,11 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.WorkingCopyFormat;
import org.jetbrains.idea.svn.api.BaseSvnClient;
+import org.jetbrains.idea.svn.api.Depth;
+import org.jetbrains.idea.svn.api.ProgressTracker;
import org.jetbrains.idea.svn.commandLine.BaseUpdateCommandListener;
import org.jetbrains.idea.svn.commandLine.CommandUtil;
import org.jetbrains.idea.svn.commandLine.SvnCommandName;
-import org.tmatesoft.svn.core.SVNDepth;
-import org.tmatesoft.svn.core.wc.ISVNEventHandler;
import org.tmatesoft.svn.core.wc.SVNRevision;
import org.tmatesoft.svn.core.wc2.SvnTarget;
@@ -26,11 +26,11 @@ public class CmdCheckoutClient extends BaseSvnClient implements CheckoutClient {
public void checkout(@NotNull SvnTarget source,
@NotNull File destination,
@Nullable SVNRevision revision,
- @Nullable SVNDepth depth,
+ @Nullable Depth depth,
boolean ignoreExternals,
boolean force,
@NotNull WorkingCopyFormat format,
- @Nullable ISVNEventHandler handler) throws VcsException {
+ @Nullable ProgressTracker handler) throws VcsException {
validateFormat(format, getSupportedFormats());
List<String> parameters = new ArrayList<String>();
@@ -57,7 +57,7 @@ public class CmdCheckoutClient extends BaseSvnClient implements CheckoutClient {
private void run(@NotNull SvnTarget source,
@NotNull File destination,
- @Nullable ISVNEventHandler handler,
+ @Nullable ProgressTracker handler,
@NotNull List<String> parameters) throws VcsException {
BaseUpdateCommandListener listener = new BaseUpdateCommandListener(destination, handler);
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/checkout/CmdExportClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/checkout/CmdExportClient.java
index 1e4011378fb7..a35c7a475d02 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/checkout/CmdExportClient.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/checkout/CmdExportClient.java
@@ -5,11 +5,11 @@ import com.intellij.openapi.vcs.VcsException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.api.BaseSvnClient;
+import org.jetbrains.idea.svn.api.Depth;
+import org.jetbrains.idea.svn.api.ProgressTracker;
import org.jetbrains.idea.svn.commandLine.BaseUpdateCommandListener;
import org.jetbrains.idea.svn.commandLine.CommandUtil;
import org.jetbrains.idea.svn.commandLine.SvnCommandName;
-import org.tmatesoft.svn.core.SVNDepth;
-import org.tmatesoft.svn.core.wc.ISVNEventHandler;
import org.tmatesoft.svn.core.wc.SVNRevision;
import org.tmatesoft.svn.core.wc2.SvnTarget;
@@ -26,11 +26,11 @@ public class CmdExportClient extends BaseSvnClient implements ExportClient {
public void export(@NotNull SvnTarget from,
@NotNull File to,
@Nullable SVNRevision revision,
- @Nullable SVNDepth depth,
+ @Nullable Depth depth,
@Nullable String nativeLineEnd,
boolean force,
boolean ignoreExternals,
- @Nullable ISVNEventHandler handler) throws VcsException {
+ @Nullable ProgressTracker handler) throws VcsException {
List<String> parameters = new ArrayList<String>();
CommandUtil.put(parameters, from);
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/checkout/ExportClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/checkout/ExportClient.java
index 6ddd6debe763..4033ead72bcc 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/checkout/ExportClient.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/checkout/ExportClient.java
@@ -3,9 +3,9 @@ package org.jetbrains.idea.svn.checkout;
import com.intellij.openapi.vcs.VcsException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import org.jetbrains.idea.svn.api.Depth;
+import org.jetbrains.idea.svn.api.ProgressTracker;
import org.jetbrains.idea.svn.api.SvnClient;
-import org.tmatesoft.svn.core.SVNDepth;
-import org.tmatesoft.svn.core.wc.ISVNEventHandler;
import org.tmatesoft.svn.core.wc.SVNRevision;
import org.tmatesoft.svn.core.wc2.SvnTarget;
@@ -19,9 +19,9 @@ public interface ExportClient extends SvnClient {
void export(@NotNull SvnTarget from,
@NotNull File to,
@Nullable SVNRevision revision,
- @Nullable SVNDepth depth,
+ @Nullable Depth depth,
@Nullable String nativeLineEnd,
boolean force,
boolean ignoreExternals,
- @Nullable ISVNEventHandler handler) throws VcsException;
+ @Nullable ProgressTracker handler) throws VcsException;
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/checkout/SvnCheckoutProvider.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/checkout/SvnCheckoutProvider.java
index 634d528c17f1..c7422ef2a220 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/checkout/SvnCheckoutProvider.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/checkout/SvnCheckoutProvider.java
@@ -44,12 +44,13 @@ import org.jetbrains.idea.svn.*;
import org.jetbrains.idea.svn.actions.ExclusiveBackgroundVcsAction;
import org.jetbrains.idea.svn.actions.SvnExcludingIgnoredOperation;
import org.jetbrains.idea.svn.api.ClientFactory;
-import org.jetbrains.idea.svn.checkin.IdeaCommitHandler;
+import org.jetbrains.idea.svn.api.Depth;
+import org.jetbrains.idea.svn.api.ProgressTracker;
import org.jetbrains.idea.svn.checkin.CommitEventHandler;
+import org.jetbrains.idea.svn.checkin.IdeaCommitHandler;
import org.jetbrains.idea.svn.dialogs.CheckoutDialog;
import org.jetbrains.idea.svn.dialogs.UpgradeFormatDialog;
import org.tmatesoft.svn.core.SVNCancelException;
-import org.tmatesoft.svn.core.SVNDepth;
import org.tmatesoft.svn.core.SVNException;
import org.tmatesoft.svn.core.SVNURL;
import org.tmatesoft.svn.core.wc.*;
@@ -68,8 +69,8 @@ public class SvnCheckoutProvider implements CheckoutProvider {
dialog.show();
}
- public static void doCheckout(final Project project, final File target, final String url, final SVNRevision revision,
- final SVNDepth depth, final boolean ignoreExternals, @Nullable final Listener listener) {
+ public static void doCheckout(@NotNull Project project, @NotNull File target, final String url, final SVNRevision revision,
+ final Depth depth, final boolean ignoreExternals, @Nullable final Listener listener) {
if (! target.exists()) {
target.mkdirs();
}
@@ -95,7 +96,7 @@ public class SvnCheckoutProvider implements CheckoutProvider {
final File target,
final String url,
final SVNRevision revision,
- final SVNDepth depth,
+ final Depth depth,
final boolean ignoreExternals,
final Listener listener, final WorkingCopyFormat selectedFormat) {
final Ref<Boolean> checkoutSuccessful = new Ref<Boolean>();
@@ -108,7 +109,7 @@ public class SvnCheckoutProvider implements CheckoutProvider {
SvnWorkingCopyFormatHolder.setPresetFormat(format);
SvnVcs vcs = SvnVcs.getInstance(project);
- ISVNEventHandler handler = new CheckoutEventHandler(vcs, false, ProgressManager.getInstance().getProgressIndicator());
+ ProgressTracker handler = new CheckoutEventHandler(vcs, false, ProgressManager.getInstance().getProgressIndicator());
ProgressManager.progress(SvnBundle.message("progress.text.checking.out", target.getAbsolutePath()));
try {
getFactory(vcs, format).createCheckoutClient()
@@ -186,11 +187,11 @@ public class SvnCheckoutProvider implements CheckoutProvider {
@CalledInAwt
@NotNull
- public static WorkingCopyFormat promptForWCopyFormat(final File target, final Project project) {
+ public static WorkingCopyFormat promptForWCopyFormat(@NotNull File target, @NotNull Project project) {
return new CheckoutFormatFromUserProvider(project, target).prompt();
}
- public static void doExport(final Project project, final File target, final SVNURL url, final SVNDepth depth,
+ public static void doExport(final Project project, final File target, final SVNURL url, final Depth depth,
final boolean ignoreExternals, final boolean force, final String eolStyle) {
try {
final VcsException[] exception = new VcsException[1];
@@ -199,7 +200,7 @@ public class SvnCheckoutProvider implements CheckoutProvider {
ProgressManager.getInstance().runProcessWithProgressSynchronously(new Runnable() {
public void run() {
ProgressIndicator progressIndicator = ProgressManager.getInstance().getProgressIndicator();
- ISVNEventHandler handler = new CheckoutEventHandler(vcs, true, progressIndicator);
+ ProgressTracker handler = new CheckoutEventHandler(vcs, true, progressIndicator);
try {
progressIndicator.setText(SvnBundle.message("progress.text.export", target.getAbsolutePath()));
@@ -221,7 +222,7 @@ public class SvnCheckoutProvider implements CheckoutProvider {
}
}
- public static void doImport(final Project project, final File target, final SVNURL url, final SVNDepth depth,
+ public static void doImport(final Project project, final File target, final SVNURL url, final Depth depth,
final boolean includeIgnored, final String message) {
final Ref<String> errorMessage = new Ref<String>();
final SvnVcs vcs = SvnVcs.getInstance(project);
@@ -312,14 +313,15 @@ public class SvnCheckoutProvider implements CheckoutProvider {
public WorkingCopyFormat prompt() {
assert !ApplicationManager.getApplication().isUnitTestMode();
- final WorkingCopyFormat result = displayUpgradeDialog(WorkingCopyFormat.ONE_DOT_SEVEN);
+ final WorkingCopyFormat result = displayUpgradeDialog();
ApplicationManager.getApplication().getMessageBus().syncPublisher(SvnVcs.WC_CONVERTED).run();
return result;
}
- private WorkingCopyFormat displayUpgradeDialog(@NotNull WorkingCopyFormat defaultSelection) {
+ @NotNull
+ private WorkingCopyFormat displayUpgradeDialog() {
final UpgradeFormatDialog dialog = new UpgradeFormatDialog(myProject, myPath, false);
final ModalityState dialogState = ModalityState.any();
@@ -354,6 +356,7 @@ public class SvnCheckoutProvider implements CheckoutProvider {
return dialog.isOK() ? dialog.getUpgradeMode() : WorkingCopyFormat.UNKNOWN;
}
+ @NotNull
private List<WorkingCopyFormat> loadSupportedFormats() {
List<WorkingCopyFormat> result = ContainerUtil.newArrayList();
@@ -368,6 +371,7 @@ public class SvnCheckoutProvider implements CheckoutProvider {
return result;
}
+ @NotNull
private static List<WorkingCopyFormat> getOtherFactoryFormats(@NotNull ClientFactory otherFactory) {
List<WorkingCopyFormat> result;
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/checkout/SvnKitCheckoutClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/checkout/SvnKitCheckoutClient.java
index 9abd2da1b35c..d8f0ea5be3d2 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/checkout/SvnKitCheckoutClient.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/checkout/SvnKitCheckoutClient.java
@@ -5,11 +5,11 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.WorkingCopyFormat;
import org.jetbrains.idea.svn.api.BaseSvnClient;
+import org.jetbrains.idea.svn.api.Depth;
+import org.jetbrains.idea.svn.api.ProgressTracker;
import org.jetbrains.idea.svn.commandLine.SvnBindException;
-import org.tmatesoft.svn.core.SVNDepth;
import org.tmatesoft.svn.core.SVNException;
import org.tmatesoft.svn.core.internal.wc2.SvnWcGeneration;
-import org.tmatesoft.svn.core.wc.ISVNEventHandler;
import org.tmatesoft.svn.core.wc.SVNRevision;
import org.tmatesoft.svn.core.wc.SVNUpdateClient;
import org.tmatesoft.svn.core.wc2.SvnTarget;
@@ -39,11 +39,11 @@ public class SvnKitCheckoutClient extends BaseSvnClient implements CheckoutClien
public void checkout(@NotNull SvnTarget source,
@NotNull File destination,
@Nullable SVNRevision revision,
- @Nullable SVNDepth depth,
+ @Nullable Depth depth,
boolean ignoreExternals,
boolean force,
@NotNull WorkingCopyFormat format,
- @Nullable ISVNEventHandler handler) throws VcsException {
+ @Nullable ProgressTracker handler) throws VcsException {
assertUrl(source);
validateFormat(format, getSupportedFormats());
@@ -54,10 +54,10 @@ public class SvnKitCheckoutClient extends BaseSvnClient implements CheckoutClien
}
client.setIgnoreExternals(ignoreExternals);
- client.setEventHandler(handler);
+ client.setEventHandler(toEventHandler(handler));
try {
- client.doCheckout(source.getURL(), destination, source.getPegRevision(), revision, depth, force);
+ client.doCheckout(source.getURL(), destination, source.getPegRevision(), revision, toDepth(depth), force);
}
catch (SVNException e) {
throw new SvnBindException(e);
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/checkout/SvnKitExportClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/checkout/SvnKitExportClient.java
index df7b496f9811..66eac246f3b7 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/checkout/SvnKitExportClient.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/checkout/SvnKitExportClient.java
@@ -4,10 +4,10 @@ import com.intellij.openapi.vcs.VcsException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.api.BaseSvnClient;
+import org.jetbrains.idea.svn.api.Depth;
+import org.jetbrains.idea.svn.api.ProgressTracker;
import org.jetbrains.idea.svn.commandLine.SvnBindException;
-import org.tmatesoft.svn.core.SVNDepth;
import org.tmatesoft.svn.core.SVNException;
-import org.tmatesoft.svn.core.wc.ISVNEventHandler;
import org.tmatesoft.svn.core.wc.SVNRevision;
import org.tmatesoft.svn.core.wc.SVNUpdateClient;
import org.tmatesoft.svn.core.wc2.SvnTarget;
@@ -23,22 +23,22 @@ public class SvnKitExportClient extends BaseSvnClient implements ExportClient {
public void export(@NotNull SvnTarget from,
@NotNull File to,
@Nullable SVNRevision revision,
- @Nullable SVNDepth depth,
+ @Nullable Depth depth,
@Nullable String nativeLineEnd,
boolean force,
boolean ignoreExternals,
- @Nullable ISVNEventHandler handler) throws VcsException {
+ @Nullable ProgressTracker handler) throws VcsException {
SVNUpdateClient client = myVcs.getSvnKitManager().createUpdateClient();
- client.setEventHandler(handler);
+ client.setEventHandler(toEventHandler(handler));
client.setIgnoreExternals(ignoreExternals);
try {
if (from.isFile()) {
- client.doExport(from.getFile(), to, from.getPegRevision(), revision, nativeLineEnd, force, depth);
+ client.doExport(from.getFile(), to, from.getPegRevision(), revision, nativeLineEnd, force, toDepth(depth));
}
else {
- client.doExport(from.getURL(), to, from.getPegRevision(), revision, nativeLineEnd, force, depth);
+ client.doExport(from.getURL(), to, from.getPegRevision(), revision, nativeLineEnd, force, toDepth(depth));
}
}
catch (SVNException e) {
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/cleanup/CleanupClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/cleanup/CleanupClient.java
index 3d1b9ee88b7c..6bf861062894 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/cleanup/CleanupClient.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/cleanup/CleanupClient.java
@@ -3,8 +3,8 @@ package org.jetbrains.idea.svn.cleanup;
import com.intellij.openapi.vcs.VcsException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import org.jetbrains.idea.svn.api.ProgressTracker;
import org.jetbrains.idea.svn.api.SvnClient;
-import org.tmatesoft.svn.core.wc.ISVNEventHandler;
import java.io.File;
@@ -13,5 +13,5 @@ import java.io.File;
*/
public interface CleanupClient extends SvnClient {
- void cleanup(@NotNull File path, @Nullable ISVNEventHandler handler) throws VcsException;
+ void cleanup(@NotNull File path, @Nullable ProgressTracker handler) throws VcsException;
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/cleanup/CmdCleanupClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/cleanup/CmdCleanupClient.java
index 6ee1763d4120..478144579045 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/cleanup/CmdCleanupClient.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/cleanup/CmdCleanupClient.java
@@ -4,9 +4,9 @@ import com.intellij.openapi.vcs.VcsException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.api.BaseSvnClient;
+import org.jetbrains.idea.svn.api.ProgressTracker;
import org.jetbrains.idea.svn.commandLine.CommandUtil;
import org.jetbrains.idea.svn.commandLine.SvnCommandName;
-import org.tmatesoft.svn.core.wc.ISVNEventHandler;
import org.tmatesoft.svn.core.wc2.SvnTarget;
import java.io.File;
@@ -19,7 +19,7 @@ import java.util.List;
public class CmdCleanupClient extends BaseSvnClient implements CleanupClient {
@Override
- public void cleanup(@NotNull File path, @Nullable ISVNEventHandler handler) throws VcsException {
+ public void cleanup(@NotNull File path, @Nullable ProgressTracker handler) throws VcsException {
// TODO: Implement event handler support - currently in SVNKit implementation handler is used to support cancelling
List<String> parameters = new ArrayList<String>();
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/cleanup/SvnKitCleanupClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/cleanup/SvnKitCleanupClient.java
index b19a505ef63a..00ae19a5d8d6 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/cleanup/SvnKitCleanupClient.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/cleanup/SvnKitCleanupClient.java
@@ -4,9 +4,9 @@ import com.intellij.openapi.vcs.VcsException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.api.BaseSvnClient;
+import org.jetbrains.idea.svn.api.ProgressTracker;
import org.jetbrains.idea.svn.commandLine.SvnBindException;
import org.tmatesoft.svn.core.SVNException;
-import org.tmatesoft.svn.core.wc.ISVNEventHandler;
import org.tmatesoft.svn.core.wc.SVNWCClient;
import java.io.File;
@@ -17,10 +17,10 @@ import java.io.File;
public class SvnKitCleanupClient extends BaseSvnClient implements CleanupClient {
@Override
- public void cleanup(@NotNull File path, @Nullable ISVNEventHandler handler) throws VcsException {
+ public void cleanup(@NotNull File path, @Nullable ProgressTracker handler) throws VcsException {
SVNWCClient client = myVcs.getSvnKitManager().createWCClient();
- client.setEventHandler(handler);
+ client.setEventHandler(toEventHandler(handler));
try {
client.doCleanup(path);
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/BaseUpdateCommandListener.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/BaseUpdateCommandListener.java
index eb80bad0c70f..a8ef20b21765 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/BaseUpdateCommandListener.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/BaseUpdateCommandListener.java
@@ -2,12 +2,11 @@ package org.jetbrains.idea.svn.commandLine;
import com.intellij.execution.process.ProcessOutputTypes;
import com.intellij.openapi.util.Key;
-import com.intellij.openapi.vcs.VcsException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import org.jetbrains.idea.svn.api.ProgressEvent;
+import org.jetbrains.idea.svn.api.ProgressTracker;
import org.tmatesoft.svn.core.SVNException;
-import org.tmatesoft.svn.core.wc.ISVNEventHandler;
-import org.tmatesoft.svn.core.wc.SVNEvent;
import java.io.File;
import java.util.concurrent.atomic.AtomicReference;
@@ -21,12 +20,12 @@ public class BaseUpdateCommandListener extends LineCommandAdapter {
private final UpdateOutputLineConverter converter;
@Nullable
- private final ISVNEventHandler handler;
+ private final ProgressTracker handler;
@NotNull
private final AtomicReference<SVNException> exception;
- public BaseUpdateCommandListener(@NotNull File base, @Nullable ISVNEventHandler handler) {
+ public BaseUpdateCommandListener(@NotNull File base, @Nullable ProgressTracker handler) {
this.handler = handler;
this.converter = new UpdateOutputLineConverter(base);
exception = new AtomicReference<SVNException>();
@@ -35,7 +34,7 @@ public class BaseUpdateCommandListener extends LineCommandAdapter {
@Override
public void onLineAvailable(String line, Key outputType) {
if (ProcessOutputTypes.STDOUT.equals(outputType)) {
- final SVNEvent event = converter.convert(line);
+ final ProgressEvent event = converter.convert(line);
if (event != null) {
beforeHandler(event);
try {
@@ -49,28 +48,20 @@ public class BaseUpdateCommandListener extends LineCommandAdapter {
}
}
- private void callHandler(SVNEvent event) throws SVNException {
+ private void callHandler(ProgressEvent event) throws SVNException {
if (handler != null) {
- handler.handleEvent(event, 0.5);
+ handler.consume(event);
}
}
- public void throwIfException() throws SVNException {
+ public void throwWrappedIfException() throws SvnBindException {
SVNException e = exception.get();
if (e != null) {
- throw e;
+ throw new SvnBindException(e);
}
}
- public void throwWrappedIfException() throws VcsException {
- SVNException e = exception.get();
-
- if (e != null) {
- throw new VcsException(e);
- }
- }
-
- protected void beforeHandler(@NotNull SVNEvent event) {
+ protected void beforeHandler(@NotNull ProgressEvent event) {
}
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/Command.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/Command.java
index 66216d39a3c0..50215fba76c8 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/Command.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/Command.java
@@ -5,7 +5,7 @@ import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
-import org.tmatesoft.svn.core.ISVNCanceller;
+import org.jetbrains.idea.svn.api.ProgressTracker;
import org.tmatesoft.svn.core.SVNURL;
import org.tmatesoft.svn.core.wc.SVNRevision;
import org.tmatesoft.svn.core.wc2.SvnTarget;
@@ -31,7 +31,7 @@ public class Command {
@Nullable private volatile SVNURL myRepositoryUrl;
@NotNull private SvnTarget myTarget;
- @Nullable private ISVNCanceller myCanceller;
+ @Nullable private ProgressTracker myCanceller;
public Command(@NotNull SvnCommandName name) {
myName = name;
@@ -52,11 +52,11 @@ public class Command {
}
@Nullable
- public ISVNCanceller getCanceller() {
+ public ProgressTracker getCanceller() {
return myCanceller;
}
- public void setCanceller(@Nullable ISVNCanceller canceller) {
+ public void setCanceller(@Nullable ProgressTracker canceller) {
myCanceller = canceller;
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/CommandUtil.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/CommandUtil.java
index 84794b7249a8..eee798737846 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/CommandUtil.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/CommandUtil.java
@@ -4,10 +4,10 @@ import com.intellij.openapi.application.PathManager;
import com.intellij.openapi.util.text.StringUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
-import org.tmatesoft.svn.core.SVNDepth;
-import org.tmatesoft.svn.core.wc.SVNDiffOptions;
+import org.jetbrains.idea.svn.api.Depth;
+import org.jetbrains.idea.svn.diff.DiffOptions;
+import org.jetbrains.idea.svn.status.StatusType;
import org.tmatesoft.svn.core.wc.SVNRevision;
-import org.tmatesoft.svn.core.wc.SVNStatusType;
import org.tmatesoft.svn.core.wc2.SvnTarget;
import javax.xml.bind.JAXBContext;
@@ -90,12 +90,12 @@ public class CommandUtil {
}
}
- public static void put(@NotNull List<String> parameters, @Nullable SVNDepth depth) {
+ public static void put(@NotNull List<String> parameters, @Nullable Depth depth) {
put(parameters, depth, false);
}
- public static void put(@NotNull List<String> parameters, @Nullable SVNDepth depth, boolean sticky) {
- if (depth != null && !SVNDepth.UNKNOWN.equals(depth)) {
+ public static void put(@NotNull List<String> parameters, @Nullable Depth depth, boolean sticky) {
+ if (depth != null && !Depth.UNKNOWN.equals(depth)) {
parameters.add("--depth");
parameters.add(depth.getName());
@@ -113,7 +113,7 @@ public class CommandUtil {
}
}
- public static void put(@NotNull List<String> parameters, @Nullable SVNDiffOptions diffOptions) {
+ public static void put(@NotNull List<String> parameters, @Nullable DiffOptions diffOptions) {
if (diffOptions != null) {
StringBuilder builder = new StringBuilder();
@@ -172,29 +172,29 @@ public class CommandUtil {
}
@NotNull
- public static SVNStatusType getStatusType(@Nullable String type) {
+ public static StatusType getStatusType(@Nullable String type) {
return getStatusType(getStatusChar(type));
}
@NotNull
- public static SVNStatusType getStatusType(char first) {
- final SVNStatusType contentsStatus;
+ public static StatusType getStatusType(char first) {
+ final StatusType contentsStatus;
if ('A' == first) {
- contentsStatus = SVNStatusType.STATUS_ADDED;
+ contentsStatus = StatusType.STATUS_ADDED;
} else if ('D' == first) {
- contentsStatus = SVNStatusType.STATUS_DELETED;
+ contentsStatus = StatusType.STATUS_DELETED;
} else if ('U' == first) {
- contentsStatus = SVNStatusType.CHANGED;
+ contentsStatus = StatusType.CHANGED;
} else if ('C' == first) {
- contentsStatus = SVNStatusType.CONFLICTED;
+ contentsStatus = StatusType.CONFLICTED;
} else if ('G' == first) {
- contentsStatus = SVNStatusType.MERGED;
+ contentsStatus = StatusType.MERGED;
} else if ('R' == first) {
- contentsStatus = SVNStatusType.STATUS_REPLACED;
+ contentsStatus = StatusType.STATUS_REPLACED;
} else if ('E' == first) {
- contentsStatus = SVNStatusType.STATUS_OBSTRUCTED;
+ contentsStatus = StatusType.STATUS_OBSTRUCTED;
} else {
- contentsStatus = SVNStatusType.STATUS_NORMAL;
+ contentsStatus = StatusType.STATUS_NORMAL;
}
return contentsStatus;
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/SvnBindException.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/SvnBindException.java
index 80c1f4078f85..6694083b4d81 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/SvnBindException.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/SvnBindException.java
@@ -42,9 +42,16 @@ public class SvnBindException extends VcsException {
public static final int ERROR_BASE = 120000;
public static final int CATEGORY_SIZE = 5000;
+ public static final String ERROR_MESSAGE_FORMAT = "svn: E%d: %s";
+
@NotNull private final MultiMap<Integer, String> errors = MultiMap.create();
@NotNull private final MultiMap<Integer, String> warnings = MultiMap.create();
+ public SvnBindException(@NotNull SVNErrorCode code, @NotNull String message) {
+ super(String.format(ERROR_MESSAGE_FORMAT, code.getCode(), message));
+ errors.putValue(code.getCode(), getMessage());
+ }
+
public SvnBindException(String message) {
super(message);
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/SvnExceptionWrapper.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/SvnExceptionWrapper.java
index cd451e149d09..d7b849655ce7 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/SvnExceptionWrapper.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/SvnExceptionWrapper.java
@@ -40,4 +40,8 @@ public class SvnExceptionWrapper extends RuntimeException {
public SvnExceptionWrapper(SVNException cause) {
super(cause);
}
+
+ public SvnExceptionWrapper(SvnBindException cause) {
+ super(cause);
+ }
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/UpdateOutputLineConverter.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/UpdateOutputLineConverter.java
index a5a1ab80b75b..602a6e8c460e 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/UpdateOutputLineConverter.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/UpdateOutputLineConverter.java
@@ -18,12 +18,11 @@ package org.jetbrains.idea.svn.commandLine;
import com.intellij.openapi.util.text.StringUtil;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.SvnUtil;
+import org.jetbrains.idea.svn.api.EventAction;
+import org.jetbrains.idea.svn.api.ProgressEvent;
+import org.jetbrains.idea.svn.status.StatusType;
import org.tmatesoft.svn.core.SVNErrorCode;
import org.tmatesoft.svn.core.SVNErrorMessage;
-import org.tmatesoft.svn.core.SVNNodeKind;
-import org.tmatesoft.svn.core.wc.SVNEvent;
-import org.tmatesoft.svn.core.wc.SVNEventAction;
-import org.tmatesoft.svn.core.wc.SVNStatusType;
import java.io.File;
import java.util.Arrays;
@@ -80,7 +79,7 @@ public class UpdateOutputLineConverter {
myCurrentFile = base;
}
- public SVNEvent convert(final String line) {
+ public ProgressEvent convert(final String line) {
// TODO: Add direct processing of "Summary of conflicts" lines at the end of "svn update" output (if there are conflicts).
// TODO: Now it works ok because parseNormalLine could not determine necessary statuses from that and further lines
if (StringUtil.isEmptyOrSpaces(line)) return null;
@@ -89,23 +88,19 @@ public class UpdateOutputLineConverter {
return null;
} else if (line.startsWith(UPDATING)) {
myCurrentFile = parseForPath(line);
- return new SVNEvent(myCurrentFile, myCurrentFile == null ? null : (myCurrentFile.isDirectory() ? SVNNodeKind.DIR : SVNNodeKind.FILE),
- null, -1, null, null, null, null, SVNEventAction.UPDATE_NONE, SVNEventAction.UPDATE_NONE, null, null, null, null, null);
+ return new ProgressEvent(myCurrentFile, -1, null, null, EventAction.UPDATE_NONE, null, null);
} else if (line.startsWith(RESTORED)) {
myCurrentFile = parseForPath(line);
- return new SVNEvent(myCurrentFile, myCurrentFile == null ? null : (myCurrentFile.isDirectory() ? SVNNodeKind.DIR : SVNNodeKind.FILE),
- null, -1, null, null, null, null, SVNEventAction.RESTORE, SVNEventAction.RESTORE, null, null, null, null, null);
+ return new ProgressEvent(myCurrentFile, -1, null, null, EventAction.RESTORE, null, null);
} else if (line.startsWith(SKIPPED)) {
// called, for instance, when folder is not working copy
myCurrentFile = parseForPath(line);
final String comment = parseComment(line);
- return new SVNEvent(myCurrentFile, myCurrentFile == null ? null : (myCurrentFile.isDirectory() ? SVNNodeKind.DIR : SVNNodeKind.FILE),
- null, -1, null, null, null, null, SVNEventAction.SKIP, SVNEventAction.SKIP,
- comment == null ? null : SVNErrorMessage.create(SVNErrorCode.WC_OBSTRUCTED_UPDATE, comment), null, null, null, null);
+ return new ProgressEvent(myCurrentFile, -1, null, null, EventAction.SKIP,
+ comment == null ? null : SVNErrorMessage.create(SVNErrorCode.WC_OBSTRUCTED_UPDATE, comment), null);
} else if (line.startsWith(FETCHING_EXTERNAL)) {
myCurrentFile = parseForPath(line);
- return new SVNEvent(myCurrentFile, myCurrentFile == null ? null : (myCurrentFile.isDirectory() ? SVNNodeKind.DIR : SVNNodeKind.FILE),
- null, -1, null, null, null, null, SVNEventAction.UPDATE_EXTERNAL, SVNEventAction.UPDATE_EXTERNAL, null, null, null, null, null);
+ return new ProgressEvent(myCurrentFile, -1, null, null, EventAction.UPDATE_EXTERNAL, null, null);
}
for (int i = 0; i < ourCompletePatterns.length; i++) {
@@ -114,10 +109,7 @@ public class UpdateOutputLineConverter {
if (revision != -1) {
// TODO: seems that myCurrentFile will not always be correct - complete update message could be right after complete externals update
// TODO: check this and use Stack instead
- return new SVNEvent(myCurrentFile,
- myCurrentFile == null ? null : (myCurrentFile.isDirectory() ? SVNNodeKind.DIR : SVNNodeKind.FILE),
- null, revision, null, null, null, null, SVNEventAction.UPDATE_COMPLETED, SVNEventAction.UPDATE_COMPLETED, null,
- null, null, null, null);
+ return new ProgressEvent(myCurrentFile, revision, null, null, EventAction.UPDATE_COMPLETED, null, null);
}
}
@@ -127,13 +119,13 @@ public class UpdateOutputLineConverter {
private final static Set<Character> ourActions = new HashSet<Character>(Arrays.asList(new Character[] {'A', 'D', 'U', 'C', 'G', 'E', 'R'}));
@Nullable
- private SVNEvent parseNormalString(final String line) {
+ private ProgressEvent parseNormalString(final String line) {
if (line.length() < 5) return null;
final char first = line.charAt(0);
if (' ' != first && ! ourActions.contains(first)) return null;
- final SVNStatusType contentsStatus = CommandUtil.getStatusType(first);
+ final StatusType contentsStatus = CommandUtil.getStatusType(first);
final char second = line.charAt(1);
- final SVNStatusType propertiesStatus = CommandUtil.getStatusType(second);
+ final StatusType propertiesStatus = CommandUtil.getStatusType(second);
final char lock = line.charAt(2); // dont know what to do with stolen lock info
if (' ' != lock && 'B' != lock) return null;
final char treeConflict = line.charAt(3);
@@ -143,29 +135,26 @@ public class UpdateOutputLineConverter {
final String path = line.substring(4).trim();
if (StringUtil.isEmptyOrSpaces(path)) return null;
final File file = createFile(path);
- if (SVNStatusType.STATUS_OBSTRUCTED.equals(contentsStatus)) {
+ if (StatusType.STATUS_OBSTRUCTED.equals(contentsStatus)) {
// obstructed
- return new SVNEvent(file, file.isDirectory() ? SVNNodeKind.DIR : SVNNodeKind.FILE,
- null, -1, contentsStatus, propertiesStatus, null, null, SVNEventAction.UPDATE_SKIP_OBSTRUCTION, SVNEventAction.UPDATE_ADD,
- null, null, null, null, null);
+ return new ProgressEvent(file, -1, contentsStatus, propertiesStatus, EventAction.UPDATE_SKIP_OBSTRUCTION, null, null);
}
- SVNEventAction action;
- SVNEventAction expectedAction;
- if (SVNStatusType.STATUS_ADDED.equals(contentsStatus)) {
- expectedAction = SVNEventAction.UPDATE_ADD;
- } else if (SVNStatusType.STATUS_DELETED.equals(contentsStatus)) {
- expectedAction = SVNEventAction.UPDATE_DELETE;
+ EventAction action;
+ EventAction expectedAction;
+ if (StatusType.STATUS_ADDED.equals(contentsStatus)) {
+ expectedAction = EventAction.UPDATE_ADD;
+ } else if (StatusType.STATUS_DELETED.equals(contentsStatus)) {
+ expectedAction = EventAction.UPDATE_DELETE;
} else {
- expectedAction = SVNEventAction.UPDATE_UPDATE;
+ expectedAction = EventAction.UPDATE_UPDATE;
}
action = expectedAction;
if (haveTreeConflict) {
- action = SVNEventAction.TREE_CONFLICT;
+ action = EventAction.TREE_CONFLICT;
}
- return new SVNEvent(file, file.isDirectory() ? SVNNodeKind.DIR : SVNNodeKind.FILE, null, -1, contentsStatus, propertiesStatus, null,
- null, action, expectedAction, null, null, null, null, null);
+ return new ProgressEvent(file, -1, contentsStatus, propertiesStatus, action, null, null);
}
private File createFile(String path) {
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/config/SvnConfigureProxiesDialog.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/config/SvnConfigureProxiesDialog.java
index c966737f9603..a70a4f28d0fd 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/config/SvnConfigureProxiesDialog.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/config/SvnConfigureProxiesDialog.java
@@ -25,7 +25,6 @@ import com.intellij.openapi.util.Ref;
import com.intellij.ui.components.JBTabbedPane;
import org.jetbrains.idea.svn.*;
import org.jetbrains.idea.svn.commandLine.SvnBindException;
-import org.tmatesoft.svn.core.SVNException;
import org.tmatesoft.svn.core.wc.SVNRevision;
import javax.swing.*;
@@ -43,7 +42,7 @@ public class SvnConfigureProxiesDialog extends DialogWrapper implements Validati
super(project, true);
valid = true;
myProject = project;
-
+
setTitle(SvnBundle.message("dialog.title.edit.http.proxies.settings"));
final Ref<SvnServerFileManager> systemManager = new Ref<SvnServerFileManager>();
@@ -56,7 +55,7 @@ public class SvnConfigureProxiesDialog extends DialogWrapper implements Validati
myUserTab = new SvnConfigureProxiesComponent(userManager.get(), myValidator, this);
init();
-
+
mySystemTab.reset();
myUserTab.reset();
myValidator.run();
@@ -140,9 +139,6 @@ public class SvnConfigureProxiesDialog extends DialogWrapper implements Validati
try {
SvnVcs.getInstance(myProject).getInfo(SvnUtil.createUrl(url), SVNRevision.HEAD);
}
- catch (SVNException exc) {
- excRef.set(exc);
- }
catch (SvnBindException e) {
excRef.set(e);
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/conflict/CmdConflictClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/conflict/CmdConflictClient.java
index 39a222dbeaf3..a07425dd1133 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/conflict/CmdConflictClient.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/conflict/CmdConflictClient.java
@@ -4,9 +4,9 @@ import com.intellij.openapi.vcs.VcsException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.api.BaseSvnClient;
+import org.jetbrains.idea.svn.api.Depth;
import org.jetbrains.idea.svn.commandLine.CommandUtil;
import org.jetbrains.idea.svn.commandLine.SvnCommandName;
-import org.tmatesoft.svn.core.SVNDepth;
import org.tmatesoft.svn.core.wc2.SvnTarget;
import java.io.File;
@@ -22,7 +22,7 @@ public class CmdConflictClient extends BaseSvnClient implements ConflictClient {
// TODO: Or rewrite logic to have one "Resolve conflicts" action instead of separate actions for each conflict type.
@Override
public void resolve(@NotNull File path,
- @Nullable SVNDepth depth,
+ @Nullable Depth depth,
boolean resolveProperty,
boolean resolveContent,
boolean resolveTree) throws VcsException {
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/conflict/ConflictAction.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/conflict/ConflictAction.java
new file mode 100644
index 000000000000..f4111ce2d981
--- /dev/null
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/conflict/ConflictAction.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jetbrains.idea.svn.conflict;
+
+import com.intellij.util.containers.ContainerUtil;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.Map;
+
+/**
+ * @author Konstantin Kolosovsky.
+ */
+public enum ConflictAction {
+
+ EDIT("edit", "edited"),
+ ADD("add", "added"),
+ DELETE("delete", "deleted"),
+ REPLACE("replace", "replaced");
+
+ @NotNull private static final Map<String, ConflictAction> ourAllActions = ContainerUtil.newHashMap();
+
+ static {
+ for (ConflictAction action : ConflictAction.values()) {
+ register(action);
+ }
+ }
+
+ @NotNull private final String myKey;
+ @NotNull private final String[] myOtherKeys;
+
+ ConflictAction(@NotNull String key, @NotNull String... otherKeys) {
+ myKey = key;
+ myOtherKeys = otherKeys;
+ }
+
+ @Override
+ public String toString() {
+ return myKey;
+ }
+
+ private static void register(@NotNull ConflictAction action) {
+ ourAllActions.put(action.myKey, action);
+
+ for (String otherKey : action.myOtherKeys) {
+ ourAllActions.put(otherKey, action);
+ }
+ }
+
+ @NotNull
+ public static ConflictAction from(@NotNull String actionName) {
+ ConflictAction result = ourAllActions.get(actionName);
+
+ if (result == null) {
+ throw new IllegalArgumentException("Unknown conflict action " + actionName);
+ }
+
+ return result;
+ }
+}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/conflict/ConflictClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/conflict/ConflictClient.java
index 64e50b874d93..7d862067cea2 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/conflict/ConflictClient.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/conflict/ConflictClient.java
@@ -3,8 +3,8 @@ package org.jetbrains.idea.svn.conflict;
import com.intellij.openapi.vcs.VcsException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import org.jetbrains.idea.svn.api.Depth;
import org.jetbrains.idea.svn.api.SvnClient;
-import org.tmatesoft.svn.core.SVNDepth;
import java.io.File;
@@ -13,6 +13,6 @@ import java.io.File;
*/
public interface ConflictClient extends SvnClient {
- void resolve(@NotNull File path, @Nullable SVNDepth depth, boolean resolveProperty, boolean resolveContent, boolean resolveTree)
+ void resolve(@NotNull File path, @Nullable Depth depth, boolean resolveProperty, boolean resolveContent, boolean resolveTree)
throws VcsException;
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/conflict/ConflictOperation.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/conflict/ConflictOperation.java
new file mode 100644
index 000000000000..d0936a538945
--- /dev/null
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/conflict/ConflictOperation.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jetbrains.idea.svn.conflict;
+
+import org.jetbrains.annotations.NonNls;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * @author Konstantin Kolosovsky.
+ */
+public enum ConflictOperation {
+ NONE,
+ UPDATE,
+ SWITCH,
+ MERGE;
+
+ @NotNull
+ public static ConflictOperation from(@NotNull @NonNls String operationName) {
+ return valueOf(ConflictOperation.class, operationName.toUpperCase());
+ }
+
+ @Override
+ @NonNls
+ public String toString() {
+ return super.toString().toLowerCase();
+ }
+}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/conflict/ConflictReason.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/conflict/ConflictReason.java
new file mode 100644
index 000000000000..71eaf6d96b1a
--- /dev/null
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/conflict/ConflictReason.java
@@ -0,0 +1,89 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jetbrains.idea.svn.conflict;
+
+import com.intellij.util.containers.ContainerUtil;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.Map;
+
+/**
+ * @author Konstantin Kolosovsky.
+ */
+public enum ConflictReason {
+
+ EDITED("edit", "edited"),
+ OBSTRUCTED("obstruction", "obstruct", "obstructed"),
+ DELETED("delete", "deleted"),
+ MISSING("missing", "miss"),
+ UNVERSIONED("unversioned", "unversion"),
+
+ /**
+ * @since 1.6
+ */
+ ADDED("add", "added"),
+
+ /**
+ * @since 1.7
+ */
+ REPLACED("replace", "replaced"),
+
+ /**
+ * @since 1.8
+ */
+ MOVED_AWAY("moved-away"),
+ MOVED_HERE("moved-here");
+
+ @NotNull private static final Map<String, ConflictReason> ourAllReasons = ContainerUtil.newHashMap();
+
+ static {
+ for (ConflictReason reason : ConflictReason.values()) {
+ register(reason);
+ }
+ }
+
+ @NotNull private final String myKey;
+ @NotNull private final String[] myOtherKeys;
+
+ ConflictReason(@NotNull String key, @NotNull String... otherKeys) {
+ myKey = key;
+ myOtherKeys = otherKeys;
+ }
+
+ @Override
+ public String toString() {
+ return myKey;
+ }
+
+ private static void register(@NotNull ConflictReason reason) {
+ ourAllReasons.put(reason.myKey, reason);
+
+ for (String key : reason.myOtherKeys) {
+ ourAllReasons.put(key, reason);
+ }
+ }
+
+ @NotNull
+ public static ConflictReason from(@NotNull String reasonName) {
+ ConflictReason result = ourAllReasons.get(reasonName);
+
+ if (result == null) {
+ throw new IllegalArgumentException("Unknown conflict reason " + reasonName);
+ }
+
+ return result;
+ }
+}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/conflict/ConflictVersion.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/conflict/ConflictVersion.java
new file mode 100644
index 000000000000..cee4cf56ac93
--- /dev/null
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/conflict/ConflictVersion.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jetbrains.idea.svn.conflict;
+
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+import org.jetbrains.idea.svn.api.BaseNodeDescription;
+import org.jetbrains.idea.svn.api.NodeKind;
+import org.tmatesoft.svn.core.SVNURL;
+import org.tmatesoft.svn.core.internal.wc.SVNConflictVersion;
+
+/**
+ * @author Konstantin Kolosovsky.
+ */
+public class ConflictVersion extends BaseNodeDescription {
+
+ private final SVNURL myRepositoryRoot;
+ private final String myPath;
+ private final long myPegRevision;
+
+ @Nullable
+ public static ConflictVersion create(@Nullable SVNConflictVersion conflictVersion) {
+ ConflictVersion result = null;
+
+ if (conflictVersion != null) {
+ result = new ConflictVersion(conflictVersion.getRepositoryRoot(), conflictVersion.getPath(), conflictVersion.getPegRevision(),
+ NodeKind.from(conflictVersion.getKind()));
+ }
+
+ return result;
+ }
+
+ public ConflictVersion(SVNURL repositoryRoot, String path, long pegRevision, @NotNull NodeKind kind) {
+ super(kind);
+ myRepositoryRoot = repositoryRoot;
+ myPath = path;
+ myPegRevision = pegRevision;
+ }
+
+ public SVNURL getRepositoryRoot() {
+ return myRepositoryRoot;
+ }
+
+ public String getPath() {
+ return myPath;
+ }
+
+ public long getPegRevision() {
+ return myPegRevision;
+ }
+
+ @NotNull
+ public NodeKind getKind() {
+ return myKind;
+ }
+
+ @NotNull
+ public String toPresentableString() {
+ StringBuilder urlBuilder = new StringBuilder();
+
+ urlBuilder.append(myRepositoryRoot != null ? myRepositoryRoot : "");
+ urlBuilder.append("/");
+ urlBuilder.append(myPath != null ? myPath : "...");
+
+ return "(" + getKind() + ") " + urlBuilder + "@" + getPegRevision();
+ }
+
+ @NotNull
+ public static String toPresentableString(@Nullable ConflictVersion version) {
+ return version == null ? "" : version.toPresentableString();
+ }
+}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/conflict/SvnKitConflictClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/conflict/SvnKitConflictClient.java
index b60ea38bd422..80fab5aede64 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/conflict/SvnKitConflictClient.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/conflict/SvnKitConflictClient.java
@@ -4,7 +4,7 @@ import com.intellij.openapi.vcs.VcsException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.api.BaseSvnClient;
-import org.tmatesoft.svn.core.SVNDepth;
+import org.jetbrains.idea.svn.api.Depth;
import org.tmatesoft.svn.core.SVNException;
import org.tmatesoft.svn.core.wc.SVNConflictChoice;
@@ -16,13 +16,13 @@ import java.io.File;
public class SvnKitConflictClient extends BaseSvnClient implements ConflictClient {
@Override
public void resolve(@NotNull File path,
- @Nullable SVNDepth depth,
+ @Nullable Depth depth,
boolean resolveProperty,
boolean resolveContent,
boolean resolveTree) throws VcsException {
try {
myVcs.getSvnKitManager().createWCClient()
- .doResolve(path, depth, resolveContent, resolveProperty, resolveTree, SVNConflictChoice.MERGED);
+ .doResolve(path, toDepth(depth), resolveContent, resolveProperty, resolveTree, SVNConflictChoice.MERGED);
}
catch (SVNException e) {
throw new VcsException(e);
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/conflict/TreeConflictDescription.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/conflict/TreeConflictDescription.java
new file mode 100644
index 000000000000..541b6ae667bc
--- /dev/null
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/conflict/TreeConflictDescription.java
@@ -0,0 +1,119 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jetbrains.idea.svn.conflict;
+
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+import org.jetbrains.idea.svn.api.BaseNodeDescription;
+import org.jetbrains.idea.svn.api.NodeKind;
+import org.tmatesoft.svn.core.wc.SVNTreeConflictDescription;
+
+import java.io.File;
+
+/**
+ * @author Konstantin Kolosovsky.
+ */
+public class TreeConflictDescription extends BaseNodeDescription {
+
+ private final File myPath;
+ private final ConflictAction myConflictAction;
+ private final ConflictReason myConflictReason;
+
+ private final ConflictOperation myOperation;
+ private final ConflictVersion mySourceLeftVersion;
+ private final ConflictVersion mySourceRightVersion;
+
+ @Nullable
+ public static TreeConflictDescription create(@Nullable SVNTreeConflictDescription conflict) {
+ TreeConflictDescription result = null;
+
+ if (conflict != null) {
+ result =
+ new TreeConflictDescription(conflict.getPath(), NodeKind.from(conflict.getNodeKind()),
+ ConflictAction.from(conflict.getConflictAction().getName()),
+ ConflictReason.from(conflict.getConflictReason().getName()),
+ ConflictOperation.from(conflict.getOperation().getName()),
+ ConflictVersion.create(conflict.getSourceLeftVersion()),
+ ConflictVersion.create(conflict.getSourceRightVersion()));
+ }
+
+ return result;
+ }
+
+ public TreeConflictDescription(File path,
+ @NotNull NodeKind nodeKind,
+ ConflictAction conflictAction,
+ ConflictReason conflictReason,
+ ConflictOperation operation,
+ ConflictVersion sourceLeftVersion,
+ ConflictVersion sourceRightVersion) {
+ super(nodeKind);
+ myPath = path;
+ myConflictAction = conflictAction;
+ myConflictReason = conflictReason;
+
+ myOperation = operation;
+ mySourceLeftVersion = sourceLeftVersion;
+ mySourceRightVersion = sourceRightVersion;
+ }
+
+ // TODO: is*Conflict() methods are not really necessary in any logic - remove them
+ public boolean isTextConflict() {
+ return false;
+ }
+
+ public boolean isPropertyConflict() {
+ return false;
+ }
+
+ public boolean isTreeConflict() {
+ return true;
+ }
+
+ public File getPath() {
+ return myPath;
+ }
+
+ public ConflictAction getConflictAction() {
+ return myConflictAction;
+ }
+
+ public ConflictReason getConflictReason() {
+ return myConflictReason;
+ }
+
+ @NotNull
+ public NodeKind getNodeKind() {
+ return myKind;
+ }
+
+ public ConflictOperation getOperation() {
+ return myOperation;
+ }
+
+ public ConflictVersion getSourceLeftVersion() {
+ return mySourceLeftVersion;
+ }
+
+ public ConflictVersion getSourceRightVersion() {
+ return mySourceRightVersion;
+ }
+
+ @NotNull
+ public String toPresentableString() {
+ return "local " + getConflictReason() + ", incoming " + getConflictAction() + " upon " + getOperation();
+ }
+}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/copy/CmdCopyMoveClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/copy/CmdCopyMoveClient.java
index e73e9fb4013f..6a42a0fcf07e 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/copy/CmdCopyMoveClient.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/copy/CmdCopyMoveClient.java
@@ -6,12 +6,12 @@ import com.intellij.openapi.vcs.VcsException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.api.BaseSvnClient;
+import org.jetbrains.idea.svn.api.ProgressTracker;
import org.jetbrains.idea.svn.checkin.CmdCheckinClient;
import org.jetbrains.idea.svn.checkin.CommitEventHandler;
import org.jetbrains.idea.svn.commandLine.BaseUpdateCommandListener;
import org.jetbrains.idea.svn.commandLine.CommandUtil;
import org.jetbrains.idea.svn.commandLine.SvnCommandName;
-import org.tmatesoft.svn.core.wc.ISVNEventHandler;
import org.tmatesoft.svn.core.wc.SVNRevision;
import org.tmatesoft.svn.core.wc2.SvnTarget;
@@ -78,7 +78,7 @@ public class CmdCopyMoveClient extends BaseSvnClient implements CopyMoveClient {
@NotNull File destination,
@Nullable SVNRevision revision,
boolean makeParents,
- @Nullable ISVNEventHandler handler) throws VcsException {
+ @Nullable ProgressTracker handler) throws VcsException {
List<String> parameters = new ArrayList<String>();
CommandUtil.put(parameters, source);
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/copy/CopyMoveClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/copy/CopyMoveClient.java
index dd4395f612b6..b4b9ed961e5f 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/copy/CopyMoveClient.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/copy/CopyMoveClient.java
@@ -3,9 +3,9 @@ package org.jetbrains.idea.svn.copy;
import com.intellij.openapi.vcs.VcsException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import org.jetbrains.idea.svn.api.ProgressTracker;
import org.jetbrains.idea.svn.api.SvnClient;
import org.jetbrains.idea.svn.checkin.CommitEventHandler;
-import org.tmatesoft.svn.core.wc.ISVNEventHandler;
import org.tmatesoft.svn.core.wc.SVNRevision;
import org.tmatesoft.svn.core.wc2.SvnTarget;
@@ -41,5 +41,5 @@ public interface CopyMoveClient extends SvnClient {
@NotNull File destination,
@Nullable SVNRevision revision,
boolean makeParents,
- @Nullable ISVNEventHandler handler) throws VcsException;
+ @Nullable ProgressTracker handler) throws VcsException;
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/copy/SvnKitCopyMoveClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/copy/SvnKitCopyMoveClient.java
index 1a46e7ce26b4..7f6f64c9ff17 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/copy/SvnKitCopyMoveClient.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/copy/SvnKitCopyMoveClient.java
@@ -4,11 +4,11 @@ import com.intellij.openapi.vcs.VcsException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.api.BaseSvnClient;
+import org.jetbrains.idea.svn.api.ProgressTracker;
import org.jetbrains.idea.svn.checkin.CommitEventHandler;
import org.jetbrains.idea.svn.commandLine.SvnBindException;
import org.tmatesoft.svn.core.SVNCommitInfo;
import org.tmatesoft.svn.core.SVNException;
-import org.tmatesoft.svn.core.wc.ISVNEventHandler;
import org.tmatesoft.svn.core.wc.SVNCopyClient;
import org.tmatesoft.svn.core.wc.SVNCopySource;
import org.tmatesoft.svn.core.wc.SVNRevision;
@@ -50,7 +50,7 @@ public class SvnKitCopyMoveClient extends BaseSvnClient implements CopyMoveClien
final SVNCopySource copySource = createCopySource(source, revision);
SVNCopyClient client = myVcs.getSvnKitManager().createCopyClient();
- client.setEventHandler(handler);
+ client.setEventHandler(toEventHandler(handler));
SVNCommitInfo info;
try {
@@ -69,9 +69,9 @@ public class SvnKitCopyMoveClient extends BaseSvnClient implements CopyMoveClien
@NotNull File destination,
@Nullable SVNRevision revision,
boolean makeParents,
- @Nullable ISVNEventHandler handler) throws VcsException {
+ @Nullable ProgressTracker handler) throws VcsException {
SVNCopyClient client = myVcs.getSvnKitManager().createCopyClient();
- client.setEventHandler(handler);
+ client.setEventHandler(toEventHandler(handler));
try {
client.doCopy(new SVNCopySource[]{createCopySource(source, revision)}, destination, false, makeParents, true);
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/delete/CmdDeleteClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/delete/CmdDeleteClient.java
index dfd6d72cc0f9..9d1d0c082c5b 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/delete/CmdDeleteClient.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/delete/CmdDeleteClient.java
@@ -5,12 +5,12 @@ import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.api.BaseSvnClient;
+import org.jetbrains.idea.svn.api.ProgressTracker;
import org.jetbrains.idea.svn.checkin.CmdCheckinClient;
import org.jetbrains.idea.svn.commandLine.BaseUpdateCommandListener;
import org.jetbrains.idea.svn.commandLine.CommandUtil;
import org.jetbrains.idea.svn.commandLine.SvnCommandName;
import org.tmatesoft.svn.core.SVNURL;
-import org.tmatesoft.svn.core.wc.ISVNEventHandler;
import org.tmatesoft.svn.core.wc2.SvnTarget;
import java.io.File;
@@ -23,7 +23,7 @@ import java.util.List;
public class CmdDeleteClient extends BaseSvnClient implements DeleteClient {
@Override
- public void delete(@NotNull File path, boolean force, boolean dryRun, @Nullable ISVNEventHandler handler) throws VcsException {
+ public void delete(@NotNull File path, boolean force, boolean dryRun, @Nullable ProgressTracker handler) throws VcsException {
// TODO: no actual support for dryRun in 'svn delete', SvnKit performs certain validation on file status and svn:externals property
// TODO: probably add some widespread checks for dryRun delete - but most likely this should be placed upper - in merge logic
if (!dryRun) {
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/delete/DeleteClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/delete/DeleteClient.java
index ec6f01481d44..a60935436bf8 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/delete/DeleteClient.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/delete/DeleteClient.java
@@ -3,9 +3,9 @@ package org.jetbrains.idea.svn.delete;
import com.intellij.openapi.vcs.VcsException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import org.jetbrains.idea.svn.api.ProgressTracker;
import org.jetbrains.idea.svn.api.SvnClient;
import org.tmatesoft.svn.core.SVNURL;
-import org.tmatesoft.svn.core.wc.ISVNEventHandler;
import java.io.File;
@@ -14,7 +14,7 @@ import java.io.File;
*/
public interface DeleteClient extends SvnClient {
- void delete(@NotNull File path, boolean force, boolean dryRun, @Nullable ISVNEventHandler handler) throws VcsException;
+ void delete(@NotNull File path, boolean force, boolean dryRun, @Nullable ProgressTracker handler) throws VcsException;
long delete(@NotNull SVNURL url, @NotNull String message) throws VcsException;
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/delete/SvnKitDeleteClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/delete/SvnKitDeleteClient.java
index 7e67b1770009..c2cdb42e17dd 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/delete/SvnKitDeleteClient.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/delete/SvnKitDeleteClient.java
@@ -4,11 +4,11 @@ import com.intellij.openapi.vcs.VcsException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.api.BaseSvnClient;
+import org.jetbrains.idea.svn.api.ProgressTracker;
import org.jetbrains.idea.svn.commandLine.SvnBindException;
import org.tmatesoft.svn.core.SVNCommitInfo;
import org.tmatesoft.svn.core.SVNException;
import org.tmatesoft.svn.core.SVNURL;
-import org.tmatesoft.svn.core.wc.ISVNEventHandler;
import org.tmatesoft.svn.core.wc.SVNWCClient;
import java.io.File;
@@ -19,9 +19,9 @@ import java.io.File;
public class SvnKitDeleteClient extends BaseSvnClient implements DeleteClient {
@Override
- public void delete(@NotNull File path, boolean force, boolean dryRun, @Nullable ISVNEventHandler handler) throws VcsException {
+ public void delete(@NotNull File path, boolean force, boolean dryRun, @Nullable ProgressTracker handler) throws VcsException {
SVNWCClient client = myVcs.getSvnKitManager().createWCClient();
- client.setEventHandler(handler);
+ client.setEventHandler(toEventHandler(handler));
try {
client.doDelete(path, force, dryRun);
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/BranchMerger.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/BranchMerger.java
index 463ed6ec01ba..4dfcf57b8049 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/BranchMerger.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/BranchMerger.java
@@ -21,13 +21,14 @@ import com.intellij.util.Consumer;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.idea.svn.SvnUtil;
import org.jetbrains.idea.svn.SvnVcs;
+import org.jetbrains.idea.svn.api.Depth;
+import org.jetbrains.idea.svn.commandLine.SvnBindException;
+import org.jetbrains.idea.svn.diff.DiffOptions;
import org.jetbrains.idea.svn.integrate.IMerger;
import org.jetbrains.idea.svn.integrate.MergeClient;
import org.jetbrains.idea.svn.update.UpdateEventHandler;
-import org.tmatesoft.svn.core.SVNDepth;
import org.tmatesoft.svn.core.SVNException;
import org.tmatesoft.svn.core.SVNURL;
-import org.tmatesoft.svn.core.wc.SVNDiffOptions;
import org.tmatesoft.svn.core.wc.SVNRevision;
import org.tmatesoft.svn.core.wc2.SvnTarget;
@@ -81,12 +82,13 @@ public class BranchMerger implements IMerger {
client.merge(SvnTarget.fromURL(mySourceUrl), destination, false, createDiffOptions(), myHandler);
} else {
client.merge(SvnTarget.fromURL(mySourceUrl, SVNRevision.create(mySourceCopyRevision)),
- SvnTarget.fromURL(mySourceUrl, mySourceLatestRevision), destination, SVNDepth.INFINITY, true, false, false, true,
+ SvnTarget.fromURL(mySourceUrl, mySourceLatestRevision), destination, Depth.INFINITY, true, false, false, true,
createDiffOptions(), myHandler);
}
}
- private SVNDiffOptions createDiffOptions() {
+ @NotNull
+ private DiffOptions createDiffOptions() {
return myVcs.getSvnConfiguration().getMergeOptions();
}
@@ -110,7 +112,7 @@ public class BranchMerger implements IMerger {
try {
result = SvnUtil.getHeadRevision(myVcs, mySourceUrl);
}
- catch (SVNException e) {
+ catch (SvnBindException e) {
LOG.info(e);
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/CopiesPanel.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/CopiesPanel.java
index 37dd5a5230f4..9ca5b89d517a 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/CopiesPanel.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/CopiesPanel.java
@@ -47,10 +47,10 @@ import org.jetbrains.idea.svn.*;
import org.jetbrains.idea.svn.actions.CleanupWorker;
import org.jetbrains.idea.svn.actions.SelectBranchPopup;
import org.jetbrains.idea.svn.api.ClientFactory;
+import org.jetbrains.idea.svn.api.Depth;
import org.jetbrains.idea.svn.branchConfig.SvnBranchConfigurationNew;
import org.jetbrains.idea.svn.checkout.SvnCheckoutProvider;
import org.jetbrains.idea.svn.integrate.QuickMergeInteractionImpl;
-import org.tmatesoft.svn.core.SVNDepth;
import org.tmatesoft.svn.core.internal.util.SVNPathUtil;
import org.tmatesoft.svn.core.wc.SVNRevision;
@@ -228,7 +228,7 @@ public class CopiesPanel {
if (result == Messages.OK) {
// update of view will be triggered by roots changed event
SvnCheckoutProvider.checkout(myVcs.getProject(), new File(wcInfo.getPath()), wcInfo.getRootUrl(), SVNRevision.HEAD,
- SVNDepth.INFINITY, false, null, wcInfo.getFormat());
+ Depth.INFINITY, false, null, wcInfo.getFormat());
}
} else if (CHANGE_FORMAT.equals(e.getDescription())) {
changeFormat(wcInfo, upgradeFormats);
@@ -296,7 +296,7 @@ public class CopiesPanel {
sb.append("<tr valign=\"top\"><td>Format:</td><td colspan=\"2\">").append(info.getFormat().getName()).append("</td></tr>");
}
- if (!SVNDepth.INFINITY.equals(info.getStickyDepth()) && !info.hasError()) {
+ if (!Depth.INFINITY.equals(info.getStickyDepth()) && !info.hasError()) {
// can fix
sb.append("<tr valign=\"top\"><td>Depth:</td><td>").append(info.getStickyDepth().getName()).append("</td><td><a href=\"").
append(FIX_DEPTH).append("\">Fix</a></td></tr>");
@@ -312,7 +312,7 @@ public class CopiesPanel {
sb.append("<tr valign=\"top\"><td colspan=\"3\"><i>").append("Working copy root</i></td></tr>");
}
if (!info.hasError()) {
- if (WorkingCopyFormat.ONE_DOT_SEVEN.equals(info.getFormat()) || WorkingCopyFormat.ONE_DOT_EIGHT.equals(info.getFormat())) {
+ if (info.getFormat().isOrGreater(WorkingCopyFormat.ONE_DOT_SEVEN)) {
sb.append("<tr valign=\"top\"><td colspan=\"3\"><a href=\"").append(CLEANUP).append("\">Cleanup</a></td></tr>");
}
sb.append("<tr valign=\"top\"><td colspan=\"3\"><a href=\"").append(CONFIGURE_BRANCHES).append("\">Configure Branches</a></td></tr>");
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/CreateBranchOrTagDialog.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/CreateBranchOrTagDialog.java
index 9c5d19420399..a09de54fdbc4 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/CreateBranchOrTagDialog.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/CreateBranchOrTagDialog.java
@@ -37,10 +37,10 @@ import org.jetbrains.idea.svn.SvnBranchConfigurationManager;
import org.jetbrains.idea.svn.SvnBundle;
import org.jetbrains.idea.svn.SvnVcs;
import org.jetbrains.idea.svn.branchConfig.SvnBranchConfigurationNew;
+import org.jetbrains.idea.svn.info.Info;
import org.jetbrains.idea.svn.update.SvnRevisionPanel;
import org.tmatesoft.svn.core.internal.util.SVNEncodingUtil;
import org.tmatesoft.svn.core.internal.util.SVNPathUtil;
-import org.tmatesoft.svn.core.wc.SVNInfo;
import org.tmatesoft.svn.core.wc.SVNRevision;
import javax.swing.*;
@@ -264,7 +264,7 @@ public class CreateBranchOrTagDialog extends DialogWrapper {
super.init();
SvnVcs vcs = SvnVcs.getInstance(myProject);
String revStr = "";
- SVNInfo info = vcs.getInfo(mySrcFile);
+ Info info = vcs.getInfo(mySrcFile);
if (info != null) {
mySrcURL = info.getURL() == null ? null : info.getURL().toString();
revStr = String.valueOf(info.getRevision());
@@ -349,7 +349,7 @@ public class CreateBranchOrTagDialog extends DialogWrapper {
return true;
}
else if (myWorkingCopyRadioButton.isSelected()) {
- SVNInfo info = SvnVcs.getInstance(myProject).getInfo(mySrcFile);
+ Info info = SvnVcs.getInstance(myProject).getInfo(mySrcFile);
String srcUrl = info != null && info.getURL() != null ? info.getURL().toString() : null;
if (srcUrl == null) {
myErrorLabel.setText(SvnBundle.message("create.branch.no.working.copy.error", myWorkingCopyField.getText()));
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/LoadRecentBranchRevisions.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/LoadRecentBranchRevisions.java
index 5748aa59280e..b71082390a55 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/LoadRecentBranchRevisions.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/LoadRecentBranchRevisions.java
@@ -27,12 +27,8 @@ import com.intellij.util.continuation.TaskDescriptor;
import com.intellij.util.continuation.Where;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.idea.svn.SvnBundle;
-import org.jetbrains.idea.svn.history.SvnChangeList;
-import org.jetbrains.idea.svn.history.SvnCommittedChangesProvider;
-import org.jetbrains.idea.svn.history.SvnRepositoryLocation;
-import org.jetbrains.idea.svn.history.TreeStructureNode;
+import org.jetbrains.idea.svn.history.*;
import org.jetbrains.idea.svn.mergeinfo.OneShotMergeInfoHelper;
-import org.tmatesoft.svn.core.SVNLogEntry;
import org.tmatesoft.svn.core.internal.util.SVNPathUtil;
import java.util.ArrayList;
@@ -94,12 +90,12 @@ public class LoadRecentBranchRevisions extends TaskDescriptor {
ProgressManager.progress2(
SvnBundle.message("progress.text2.collecting.history", myMergeContext.getSourceUrl() + (myFirst > 0 ? ("@" + myFirst) : "")));
- final List<Pair<SvnChangeList, TreeStructureNode<SVNLogEntry>>> list = new ArrayList<Pair<SvnChangeList, TreeStructureNode<SVNLogEntry>>>();
+ final List<Pair<SvnChangeList, LogHierarchyNode>> list = new ArrayList<Pair<SvnChangeList, LogHierarchyNode>>();
try {
committedChangesProvider.getCommittedChangesWithMergedRevisons(settings, new SvnRepositoryLocation(myMergeContext.getSourceUrl()),
myBunchSize + (myFirst > 0 ? 2 : 1),
- new PairConsumer<SvnChangeList, TreeStructureNode<SVNLogEntry>>() {
- public void consume(SvnChangeList svnList, TreeStructureNode<SVNLogEntry> tree) {
+ new PairConsumer<SvnChangeList, LogHierarchyNode>() {
+ public void consume(SvnChangeList svnList, LogHierarchyNode tree) {
indicator.setText2(SvnBundle.message("progress.text2.processing.revision", svnList.getNumber()));
list.add(Pair.create(svnList, tree));
}
@@ -109,7 +105,7 @@ public class LoadRecentBranchRevisions extends TaskDescriptor {
return;
}
myCommittedChangeLists = new ArrayList<CommittedChangeList>();
- for (Pair<SvnChangeList, TreeStructureNode<SVNLogEntry>> pair : list) {
+ for (Pair<SvnChangeList, LogHierarchyNode> pair : list) {
// do not take first since it's equal
if (myFirst > 0 && myFirst == pair.getFirst().getNumber()) continue;
// TODO: Currently path filtering with QuickMerge.checkListForPaths is not applied as it removes some necessary revisions
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/PropertiesComponent.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/PropertiesComponent.java
index 81116e669870..860c524ed591 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/PropertiesComponent.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/PropertiesComponent.java
@@ -36,6 +36,7 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.SvnPropertyKeys;
import org.jetbrains.idea.svn.SvnVcs;
+import org.jetbrains.idea.svn.api.Depth;
import org.tmatesoft.svn.core.*;
import org.tmatesoft.svn.core.wc.ISVNPropertyHandler;
import org.tmatesoft.svn.core.wc.SVNPropertyData;
@@ -166,7 +167,7 @@ public class PropertiesComponent extends JPanel {
public void handleProperty(long revision, SVNPropertyData property) throws SVNException {
}
};
- vcs.getFactory(file).createPropertyClient().list(SvnTarget.fromFile(file, SVNRevision.UNDEFINED), SVNRevision.WORKING, SVNDepth.EMPTY,
+ vcs.getFactory(file).createPropertyClient().list(SvnTarget.fromFile(file, SVNRevision.UNDEFINED), SVNRevision.WORKING, Depth.EMPTY,
handler);
}
catch (VcsException e) {
@@ -272,7 +273,7 @@ public class PropertiesComponent extends JPanel {
try {
myVcs.getFactory(myFile).createPropertyClient()
.setProperty(myFile, property, value != null ? SVNPropertyValue.create(value) : null,
- SVNDepth.getInfinityOrEmptyDepth(recursive), force);
+ Depth.allOrEmpty(recursive), force);
}
catch (VcsException error) {
VcsBalloonProblemNotifier
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/RepositoryBrowserComponent.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/RepositoryBrowserComponent.java
index 78acfe32cf53..0fd1f06bf7cb 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/RepositoryBrowserComponent.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/RepositoryBrowserComponent.java
@@ -18,7 +18,6 @@ package org.jetbrains.idea.svn.dialogs;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.actionSystem.CommonDataKeys;
import com.intellij.openapi.actionSystem.DataProvider;
-import com.intellij.openapi.actionSystem.PlatformDataKeys;
import com.intellij.openapi.fileEditor.OpenFileDescriptor;
import com.intellij.openapi.fileTypes.FileTypeManager;
import com.intellij.openapi.project.Project;
@@ -37,11 +36,10 @@ import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.SvnVcs;
+import org.jetbrains.idea.svn.browse.DirectoryEntry;
import org.jetbrains.idea.svn.dialogs.browserCache.Expander;
import org.jetbrains.idea.svn.history.SvnFileRevision;
-import org.tmatesoft.svn.core.SVNDirEntry;
import org.tmatesoft.svn.core.SVNException;
-import org.tmatesoft.svn.core.SVNNodeKind;
import org.tmatesoft.svn.core.SVNURL;
import org.tmatesoft.svn.core.wc.SVNRevision;
@@ -152,7 +150,7 @@ public class RepositoryBrowserComponent extends JPanel implements Disposable, Da
}
@Nullable
- public SVNDirEntry getSelectedEntry() {
+ public DirectoryEntry getSelectedEntry() {
TreePath selection = myRepositoryTree.getSelectionPath();
if (selection == null) {
return null;
@@ -241,8 +239,8 @@ public class RepositoryBrowserComponent extends JPanel implements Disposable, Da
final RepositoryTreeNode node = getSelectedNode();
if (node == null) return null;
- SVNDirEntry entry = node.getSVNDirEntry();
- if (entry == null || entry.getKind() != SVNNodeKind.FILE) {
+ DirectoryEntry entry = node.getSVNDirEntry();
+ if (entry == null || !entry.isFile()) {
return null;
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/RepositoryBrowserDialog.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/RepositoryBrowserDialog.java
index 5fe19963cf93..191acf387b86 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/RepositoryBrowserDialog.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/RepositoryBrowserDialog.java
@@ -53,6 +53,7 @@ import org.jetbrains.idea.svn.SvnBundle;
import org.jetbrains.idea.svn.SvnUtil;
import org.jetbrains.idea.svn.SvnVcs;
import org.jetbrains.idea.svn.actions.BrowseRepositoryAction;
+import org.jetbrains.idea.svn.browse.DirectoryEntry;
import org.jetbrains.idea.svn.checkout.SvnCheckoutProvider;
import org.jetbrains.idea.svn.commandLine.SvnBindException;
import org.jetbrains.idea.svn.dialogs.browser.*;
@@ -60,7 +61,9 @@ import org.jetbrains.idea.svn.dialogs.browserCache.Expander;
import org.jetbrains.idea.svn.dialogs.browserCache.KeepingExpandedExpander;
import org.jetbrains.idea.svn.dialogs.browserCache.SyntheticWorker;
import org.jetbrains.idea.svn.history.SvnRepositoryLocation;
-import org.tmatesoft.svn.core.*;
+import org.tmatesoft.svn.core.SVNErrorCode;
+import org.tmatesoft.svn.core.SVNException;
+import org.tmatesoft.svn.core.SVNURL;
import org.tmatesoft.svn.core.internal.util.SVNPathUtil;
import org.tmatesoft.svn.core.wc.SVNRevision;
import org.tmatesoft.svn.core.wc2.SvnTarget;
@@ -345,8 +348,8 @@ public class RepositoryBrowserDialog extends DialogWrapper {
if (node == null) {
return;
}
- boolean isDirectory = node.getUserObject() instanceof SVNURL ||
- (node.getSVNDirEntry() != null && node.getSVNDirEntry().getKind() == SVNNodeKind.DIR);
+ boolean isDirectory =
+ node.getUserObject() instanceof SVNURL || (node.getSVNDirEntry() != null && node.getSVNDirEntry().isDirectory());
String url = node.getURL().toDecodedString();
AbstractVcsHelper.getInstance(myProject)
@@ -500,14 +503,8 @@ public class RepositoryBrowserDialog extends DialogWrapper {
}
public void update(AnActionEvent e) {
- RepositoryTreeNode node = myBrowserComponent.getSelectedNode();
//e.getPresentation().setText(SvnBundle.message("repository.browser.new.folder.action"), true);
- if (node != null) {
- SVNDirEntry entry = node.getSVNDirEntry();
- e.getPresentation().setEnabled(entry == null || entry.getKind() == SVNNodeKind.DIR);
- } else {
- e.getPresentation().setEnabled(false);
- }
+ setEnabled(e, myBrowserComponent.getSelectedNode());
}
public void actionPerformed(AnActionEvent e) {
@@ -537,14 +534,8 @@ public class RepositoryBrowserDialog extends DialogWrapper {
protected class DiffAction extends AnAction {
public void update(AnActionEvent e) {
- RepositoryTreeNode node = getRepositoryBrowser().getSelectedNode();
e.getPresentation().setText("Compare With...", true);
- if (node != null) {
- SVNDirEntry entry = node.getSVNDirEntry();
- e.getPresentation().setEnabled(entry == null || entry.getKind() == SVNNodeKind.DIR);
- } else {
- e.getPresentation().setEnabled(false);
- }
+ setEnabled(e, getRepositoryBrowser().getSelectedNode());
}
public void actionPerformed(AnActionEvent e) {
@@ -854,14 +845,8 @@ public class RepositoryBrowserDialog extends DialogWrapper {
public void update(AnActionEvent e) {
e.getPresentation().setVisible(showImportAction());
e.getPresentation().setText(SvnBundle.message("repository.browser.import.action"));
- RepositoryTreeNode node = getRepositoryBrowser().getSelectedNode();
- final boolean running = ProjectLevelVcsManager.getInstance(myProject).isBackgroundVcsOperationRunning();
- if (node != null) {
- SVNDirEntry entry = node.getSVNDirEntry();
- e.getPresentation().setEnabled((entry == null || entry.getKind() == SVNNodeKind.DIR) && (! running));
- } else {
- e.getPresentation().setEnabled(false);
- }
+ setEnabled(e, getRepositoryBrowser().getSelectedNode(),
+ ProjectLevelVcsManager.getInstance(myProject).isBackgroundVcsOperationRunning());
}
public void actionPerformed(AnActionEvent e) {
@@ -897,13 +882,7 @@ public class RepositoryBrowserDialog extends DialogWrapper {
protected class CheckoutAction extends AnAction {
public void update(AnActionEvent e) {
e.getPresentation().setText("_Checkout...", true);
- RepositoryTreeNode node = getRepositoryBrowser().getSelectedNode();
- if (node != null) {
- SVNDirEntry entry = node.getSVNDirEntry();
- e.getPresentation().setEnabled(entry == null || entry.getKind() == SVNNodeKind.DIR);
- } else {
- e.getPresentation().setEnabled(false);
- }
+ setEnabled(e, getRepositoryBrowser().getSelectedNode());
}
public void actionPerformed(AnActionEvent e) {
final RepositoryTreeNode selectedNode = getSelectedNode();
@@ -914,6 +893,14 @@ public class RepositoryBrowserDialog extends DialogWrapper {
}
}
+ private static void setEnabled(@NotNull AnActionEvent e, @Nullable RepositoryTreeNode node) {
+ setEnabled(e, node, false);
+ }
+
+ private static void setEnabled(@NotNull AnActionEvent e, @Nullable RepositoryTreeNode node, boolean isRunning) {
+ e.getPresentation().setEnabled(node != null && (node.getSVNDirEntry() == null || node.getSVNDirEntry().isDirectory()) && !isRunning);
+ }
+
protected class BrowseChangesAction extends AnAction {
public BrowseChangesAction() {
super(SvnBundle.message("repository.browser.browse.changes.action"),
@@ -1051,14 +1038,14 @@ public class RepositoryBrowserDialog extends DialogWrapper {
SVNURL url = selectedNode.getURL();
String relativePath = "";
- final SVNDirEntry dirEntry = selectedNode.getSVNDirEntry();
- if (dirEntry != null) {
- if (dirEntry.getRepositoryRoot() != null) {
- if (! dirEntry.getRepositoryRoot().equals(url)) {
- relativePath = SVNPathUtil.getRelativePath(dirEntry.getRepositoryRoot().toString(), url.toDecodedString());
+ final DirectoryEntry entry = selectedNode.getSVNDirEntry();
+ if (entry != null) {
+ if (entry.getRepositoryRoot() != null) {
+ if (! entry.getRepositoryRoot().equals(url)) {
+ relativePath = SVNPathUtil.getRelativePath(entry.getRepositoryRoot().toString(), url.toDecodedString());
}
} else {
- relativePath = dirEntry.getRelativePath();
+ relativePath = entry.getRelativePath();
}
} else {
relativePath = url.getPath();
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/RepositoryTreeNode.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/RepositoryTreeNode.java
index d3ef02da19c6..f21ca1735ff4 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/RepositoryTreeNode.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/RepositoryTreeNode.java
@@ -21,11 +21,9 @@ import com.intellij.util.NotNullFunction;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.SvnVcs;
+import org.jetbrains.idea.svn.browse.DirectoryEntry;
import org.jetbrains.idea.svn.dialogs.browserCache.Expander;
import org.jetbrains.idea.svn.dialogs.browserCache.NodeLoadState;
-import org.tmatesoft.svn.core.SVNDirEntry;
-import org.tmatesoft.svn.core.SVNErrorMessage;
-import org.tmatesoft.svn.core.SVNNodeKind;
import org.tmatesoft.svn.core.SVNURL;
import org.tmatesoft.svn.core.internal.util.SVNPathUtil;
@@ -89,7 +87,7 @@ public class RepositoryTreeNode implements TreeNode, Disposable {
}
public boolean isLeaf() {
- return myUserObject instanceof SVNDirEntry ? ((SVNDirEntry) myUserObject).getKind() == SVNNodeKind.FILE : false;
+ return myUserObject instanceof DirectoryEntry && ((DirectoryEntry)myUserObject).isFile();
}
public TreeNode getParent() {
@@ -146,9 +144,9 @@ public class RepositoryTreeNode implements TreeNode, Disposable {
}
@Nullable
- public SVNDirEntry getSVNDirEntry() {
- if (myUserObject instanceof SVNDirEntry) {
- return (SVNDirEntry) myUserObject;
+ public DirectoryEntry getSVNDirEntry() {
+ if (myUserObject instanceof DirectoryEntry) {
+ return (DirectoryEntry) myUserObject;
}
return null;
}
@@ -161,7 +159,7 @@ public class RepositoryTreeNode implements TreeNode, Disposable {
}
public boolean isRepositoryRoot() {
- return ! (myUserObject instanceof SVNDirEntry);
+ return ! (myUserObject instanceof DirectoryEntry);
}
@NotNull
@@ -194,13 +192,13 @@ public class RepositoryTreeNode implements TreeNode, Disposable {
return myModel.isDisposed();
}
- public void setChildren(final List<SVNDirEntry> children, final NodeLoadState state) {
+ public void setChildren(final List<DirectoryEntry> children, final NodeLoadState state) {
final List<TreeNode> nodes = new ArrayList<TreeNode>();
- for (final SVNDirEntry entry : children) {
- if (!myModel.isShowFiles() && entry.getKind() != SVNNodeKind.DIR) {
+ for (final DirectoryEntry entry : children) {
+ if (!myModel.isShowFiles() && !entry.isDirectory()) {
continue;
}
- nodes.add(new RepositoryTreeNode(myModel, this, entry.getURL(), entry, state));
+ nodes.add(new RepositoryTreeNode(myModel, this, entry.getUrl(), entry, state));
}
myChildrenLoadState = state;
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SelectLocationDialog.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SelectLocationDialog.java
index 10bfc0971cc9..a6ca6ad54f11 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SelectLocationDialog.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SelectLocationDialog.java
@@ -28,8 +28,8 @@ import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.SvnBundle;
import org.jetbrains.idea.svn.SvnUtil;
import org.jetbrains.idea.svn.SvnVcs;
+import org.jetbrains.idea.svn.commandLine.SvnBindException;
import org.jetbrains.idea.svn.dialogs.browser.UrlOpeningExpander;
-import org.tmatesoft.svn.core.SVNException;
import org.tmatesoft.svn.core.SVNURL;
import org.tmatesoft.svn.core.internal.util.SVNEncodingUtil;
import org.tmatesoft.svn.core.internal.util.SVNPathUtil;
@@ -79,7 +79,7 @@ public class SelectLocationDialog extends DialogWrapper {
boolean showFiles,
String errorMessage) {
try {
- SVNURL svnUrl = SVNURL.parseURIEncoded(url);
+ SVNURL svnUrl = SvnUtil.createUrl(url);
final SVNURL repositoryUrl = initRoot(project, svnUrl);
if (repositoryUrl == null) {
Messages.showErrorDialog(project, "Can not detect repository root for URL: " + url,
@@ -91,7 +91,7 @@ public class SelectLocationDialog extends DialogWrapper {
dialog.show();
return dialog;
}
- catch (SVNException e) {
+ catch (SvnBindException e) {
Messages.showErrorDialog(project, errorMessage != null ? errorMessage : e.getMessage(),
SvnBundle.message("dialog.title.select.repository.location"));
return null;
@@ -124,15 +124,15 @@ public class SelectLocationDialog extends DialogWrapper {
}
@Nullable
- private static SVNURL initRoot(final Project project, final SVNURL url) throws SVNException {
+ private static SVNURL initRoot(final Project project, final SVNURL url) throws SvnBindException {
final Ref<SVNURL> result = new Ref<SVNURL>();
- final Ref<SVNException> excRef = new Ref<SVNException>();
+ final Ref<SvnBindException> excRef = new Ref<SvnBindException>();
ProgressManager.getInstance().runProcessWithProgressSynchronously(new Runnable() {
public void run() {
try {
result.set(SvnUtil.getRepositoryRoot(SvnVcs.getInstance(project), url));
- } catch (SVNException e) {
+ } catch (SvnBindException e) {
excRef.set(e);
}
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SetPropertyDialog.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SetPropertyDialog.java
index 421f0a0ce138..28375d28b7ba 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SetPropertyDialog.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SetPropertyDialog.java
@@ -27,8 +27,8 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.idea.svn.SvnBundle;
import org.jetbrains.idea.svn.SvnPropertyKeys;
import org.jetbrains.idea.svn.SvnVcs;
+import org.jetbrains.idea.svn.api.Depth;
import org.jetbrains.idea.svn.properties.PropertyClient;
-import org.tmatesoft.svn.core.SVNDepth;
import org.tmatesoft.svn.core.SVNPropertyValue;
import org.tmatesoft.svn.core.SVNURL;
import org.tmatesoft.svn.core.wc.ISVNPropertyHandler;
@@ -221,7 +221,7 @@ public class SetPropertyDialog extends DialogWrapper {
};
PropertyClient client = myVCS.getFactory(file).createPropertyClient();
- client.list(SvnTarget.fromFile(file, SVNRevision.WORKING), SVNRevision.WORKING, SVNDepth.EMPTY, handler);
+ client.list(SvnTarget.fromFile(file, SVNRevision.WORKING), SVNRevision.WORKING, Depth.EMPTY, handler);
}
catch (VcsException e) {
LOG.info(e);
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SvnFormatWorker.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SvnFormatWorker.java
index 8e99055ef94d..bfdadef54cc8 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SvnFormatWorker.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SvnFormatWorker.java
@@ -33,11 +33,11 @@ import org.jetbrains.idea.svn.SvnUtil;
import org.jetbrains.idea.svn.SvnVcs;
import org.jetbrains.idea.svn.WorkingCopyFormat;
import org.jetbrains.idea.svn.api.ClientFactory;
+import org.jetbrains.idea.svn.api.EventAction;
+import org.jetbrains.idea.svn.api.ProgressEvent;
+import org.jetbrains.idea.svn.api.ProgressTracker;
import org.tmatesoft.svn.core.SVNCancelException;
import org.tmatesoft.svn.core.SVNException;
-import org.tmatesoft.svn.core.wc.ISVNEventHandler;
-import org.tmatesoft.svn.core.wc.SVNEvent;
-import org.tmatesoft.svn.core.wc.SVNEventAction;
import java.io.File;
import java.util.ArrayList;
@@ -111,7 +111,7 @@ public class SvnFormatWorker extends Task.Backgroundable {
String cleanupMessage = SvnBundle.message("action.Subversion.cleanup.progress.text", path.getAbsolutePath());
String upgradeMessage =
SvnBundle.message("action.change.wcopy.format.task.progress.text", path.getAbsolutePath(), wcInfo.getFormat(), myNewFormat);
- ISVNEventHandler handler = createUpgradeHandler(indicator, cleanupMessage, upgradeMessage);
+ ProgressTracker handler = createUpgradeHandler(indicator, cleanupMessage, upgradeMessage);
getFactory(path, myNewFormat).createUpgradeClient().upgrade(path, myNewFormat, handler);
} catch (Throwable e) {
@@ -155,22 +155,22 @@ public class SvnFormatWorker extends Task.Backgroundable {
return result;
}
- private static ISVNEventHandler createUpgradeHandler(@NotNull final ProgressIndicator indicator,
+ private static ProgressTracker createUpgradeHandler(@NotNull final ProgressIndicator indicator,
@NotNull final String cleanupMessage,
@NotNull final String upgradeMessage) {
- return new ISVNEventHandler() {
+ return new ProgressTracker() {
@Override
- public void handleEvent(SVNEvent event, double progress) throws SVNException {
+ public void consume(ProgressEvent event) throws SVNException {
if (event.getFile() != null) {
- if (SVNEventAction.UPGRADED_PATH.equals(event.getAction())) {
+ if (EventAction.UPGRADED_PATH.equals(event.getAction())) {
indicator.setText2("Upgraded path " + VcsUtil.getPathForProgressPresentation(event.getFile()));
}
// fake event indicating cleanup start
- if (SVNEventAction.UPDATE_STARTED.equals(event.getAction())) {
+ if (EventAction.UPDATE_STARTED.equals(event.getAction())) {
indicator.setText(cleanupMessage);
}
// fake event indicating upgrade start
- if (SVNEventAction.UPDATE_COMPLETED.equals(event.getAction())) {
+ if (EventAction.UPDATE_COMPLETED.equals(event.getAction())) {
indicator.setText(upgradeMessage);
}
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SvnRepositoryTreeCellRenderer.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SvnRepositoryTreeCellRenderer.java
index 1215be72c18a..6ecd89f82fd7 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SvnRepositoryTreeCellRenderer.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SvnRepositoryTreeCellRenderer.java
@@ -21,9 +21,8 @@ import com.intellij.ui.ColoredTreeCellRenderer;
import com.intellij.ui.SimpleTextAttributes;
import com.intellij.util.PlatformIcons;
import com.intellij.util.text.DateFormatUtil;
-import org.tmatesoft.svn.core.SVNDirEntry;
+import org.jetbrains.idea.svn.browse.DirectoryEntry;
import org.tmatesoft.svn.core.SVNErrorMessage;
-import org.tmatesoft.svn.core.SVNNodeKind;
import javax.swing.*;
import javax.swing.tree.DefaultMutableTreeNode;
@@ -44,7 +43,7 @@ public class SvnRepositoryTreeCellRenderer extends ColoredTreeCellRenderer {
String name = node.getSVNDirEntry().getName();
append(name, node.isCached() ? SimpleTextAttributes.GRAY_ITALIC_ATTRIBUTES : SimpleTextAttributes.REGULAR_ATTRIBUTES);
if (myIsShowDetails) {
- SVNDirEntry entry = node.getSVNDirEntry();
+ DirectoryEntry entry = node.getSVNDirEntry();
append(" " + entry.getRevision(), SimpleTextAttributes.GRAY_ATTRIBUTES);
if (entry.getAuthor() != null) {
append(" " + entry.getAuthor(), SimpleTextAttributes.GRAYED_BOLD_ATTRIBUTES);
@@ -53,11 +52,9 @@ public class SvnRepositoryTreeCellRenderer extends ColoredTreeCellRenderer {
append(" " + DateFormatUtil.formatPrettyDateTime(entry.getDate()), SimpleTextAttributes.GRAY_ATTRIBUTES);
}
}
- if (node.getSVNDirEntry().getKind() == SVNNodeKind.FILE) {
- setIcon(FileTypeManager.getInstance().getFileTypeByFileName(name).getIcon());
- } else {
- setIcon(PlatformIcons.DIRECTORY_CLOSED_ICON);
- }
+ setIcon(node.getSVNDirEntry().isFile()
+ ? FileTypeManager.getInstance().getFileTypeByFileName(name).getIcon()
+ : PlatformIcons.DIRECTORY_CLOSED_ICON);
}
} else if (value instanceof DefaultMutableTreeNode) {
DefaultMutableTreeNode node = (DefaultMutableTreeNode) value;
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/WCInfo.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/WCInfo.java
index a75fa4a847db..8fc57db64cdc 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/WCInfo.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/WCInfo.java
@@ -20,22 +20,22 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.idea.svn.NestedCopyType;
import org.jetbrains.idea.svn.RootUrlInfo;
import org.jetbrains.idea.svn.WorkingCopyFormat;
-import org.tmatesoft.svn.core.SVNDepth;
-import org.tmatesoft.svn.core.SVNException;
+import org.jetbrains.idea.svn.api.Depth;
+import org.jetbrains.idea.svn.commandLine.SvnBindException;
import org.tmatesoft.svn.core.SVNURL;
public class WCInfo implements WCPaths {
private final boolean myIsWcRoot;
- private final SVNDepth myStickyDepth;
+ private final Depth myStickyDepth;
@NotNull private final RootUrlInfo myRootInfo;
- public WCInfo(@NotNull RootUrlInfo rootInfo, boolean isWcRoot, SVNDepth stickyDepth) {
+ public WCInfo(@NotNull RootUrlInfo rootInfo, boolean isWcRoot, Depth stickyDepth) {
myRootInfo = rootInfo;
myIsWcRoot = isWcRoot;
myStickyDepth = stickyDepth;
}
- public SVNDepth getStickyDepth() {
+ public Depth getStickyDepth() {
return myStickyDepth;
}
@@ -70,7 +70,7 @@ public class WCInfo implements WCPaths {
public String getErrorMessage() {
@SuppressWarnings("ThrowableResultOfMethodCallIgnored")
- SVNException error = getRootInfo().getNode().getError();
+ SvnBindException error = getRootInfo().getNode().getError();
return error != null ? error.getMessage() : "";
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/CheckoutOptionsDialog.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/CheckoutOptionsDialog.java
index b5c3782d3cdc..e42fdd5d1585 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/CheckoutOptionsDialog.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/CheckoutOptionsDialog.java
@@ -30,9 +30,9 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.DepthCombo;
import org.jetbrains.idea.svn.SvnBundle;
+import org.jetbrains.idea.svn.api.Depth;
import org.jetbrains.idea.svn.revision.SvnSelectRevisionPanel;
import org.jetbrains.idea.svn.update.SvnRevisionPanel;
-import org.tmatesoft.svn.core.SVNDepth;
import org.tmatesoft.svn.core.SVNURL;
import org.tmatesoft.svn.core.wc.SVNRevision;
@@ -147,7 +147,7 @@ public class CheckoutOptionsDialog extends DialogWrapper {
return (objects == null) || (objects.length != 1) ? null : (File) objects[0];
}
- public SVNDepth getDepth() {
+ public Depth getDepth() {
return myDepthCombo.getDepth();
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/ExportOptionsDialog.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/ExportOptionsDialog.java
index 38aff96752bb..7f6de72703f2 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/ExportOptionsDialog.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/ExportOptionsDialog.java
@@ -26,7 +26,7 @@ import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.DepthCombo;
import org.jetbrains.idea.svn.SvnBundle;
-import org.tmatesoft.svn.core.SVNDepth;
+import org.jetbrains.idea.svn.api.Depth;
import org.tmatesoft.svn.core.SVNURL;
import javax.swing.*;
@@ -64,7 +64,7 @@ public class ExportOptionsDialog extends DialogWrapper implements ActionListener
return new File(myPathField.getText());
}
- public SVNDepth getDepth() {
+ public Depth getDepth() {
return myDepth.getDepth();
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/ImportOptionsDialog.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/ImportOptionsDialog.java
index aba7cf7a09d3..0694247fd542 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/ImportOptionsDialog.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/ImportOptionsDialog.java
@@ -29,7 +29,7 @@ import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.DepthCombo;
import org.jetbrains.idea.svn.SvnBundle;
-import org.tmatesoft.svn.core.SVNDepth;
+import org.jetbrains.idea.svn.api.Depth;
import org.tmatesoft.svn.core.SVNURL;
import javax.swing.*;
@@ -68,7 +68,7 @@ public class ImportOptionsDialog extends DialogWrapper implements ActionListener
return new File(myPathField.getText());
}
- public SVNDepth getDepth() {
+ public Depth getDepth() {
return myDepth.getDepth();
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browserCache/CacheLoader.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browserCache/CacheLoader.java
index 07d2d607de91..d80efb97a123 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browserCache/CacheLoader.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browserCache/CacheLoader.java
@@ -16,9 +16,8 @@
package org.jetbrains.idea.svn.dialogs.browserCache;
import com.intellij.openapi.components.ServiceManager;
+import org.jetbrains.idea.svn.browse.DirectoryEntry;
import org.jetbrains.idea.svn.dialogs.RepositoryTreeNode;
-import org.tmatesoft.svn.core.SVNDirEntry;
-import org.tmatesoft.svn.core.SVNErrorMessage;
import javax.swing.*;
import java.util.List;
@@ -40,7 +39,7 @@ public class CacheLoader extends Loader {
public void run() {
final String nodeUrl = node.getURL().toString();
- final List<SVNDirEntry> cached = myCache.getChildren(nodeUrl);
+ final List<DirectoryEntry> cached = myCache.getChildren(nodeUrl);
if (cached != null) {
refreshNode(node, cached, expander);
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browserCache/Loader.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browserCache/Loader.java
index 774b07187b98..ab2b6ddb67f3 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browserCache/Loader.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browserCache/Loader.java
@@ -15,9 +15,8 @@
*/
package org.jetbrains.idea.svn.dialogs.browserCache;
+import org.jetbrains.idea.svn.browse.DirectoryEntry;
import org.jetbrains.idea.svn.dialogs.RepositoryTreeNode;
-import org.tmatesoft.svn.core.SVNDirEntry;
-import org.tmatesoft.svn.core.SVNErrorMessage;
import java.util.List;
@@ -47,7 +46,7 @@ public abstract class Loader {
existingNode.setErrorNode(text, getNodeLoadState());
}
- protected void refreshNode(final RepositoryTreeNode node, final List<SVNDirEntry> data, final Expander expander) {
+ protected void refreshNode(final RepositoryTreeNode node, final List<DirectoryEntry> data, final Expander expander) {
if (node.isDisposed()) {
return;
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browserCache/RepositoryLoader.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browserCache/RepositoryLoader.java
index 4c9fc92751e5..319699cfc1b8 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browserCache/RepositoryLoader.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browserCache/RepositoryLoader.java
@@ -23,7 +23,10 @@ import com.intellij.openapi.util.Pair;
import com.intellij.openapi.vcs.VcsException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.idea.svn.SvnVcs;
+import org.jetbrains.idea.svn.api.Depth;
import org.jetbrains.idea.svn.auth.SvnAuthenticationProvider;
+import org.jetbrains.idea.svn.browse.DirectoryEntry;
+import org.jetbrains.idea.svn.browse.DirectoryEntryConsumer;
import org.jetbrains.idea.svn.dialogs.RepositoryTreeNode;
import org.tmatesoft.svn.core.*;
import org.tmatesoft.svn.core.wc.SVNRevision;
@@ -56,7 +59,7 @@ class RepositoryLoader extends Loader {
}
}
- private void setResults(final Pair<RepositoryTreeNode, Expander> data, final List<SVNDirEntry> children) {
+ private void setResults(final Pair<RepositoryTreeNode, Expander> data, final List<DirectoryEntry> children) {
myCache.put(data.first.getURL().toString(), children);
refreshNode(data.first, children, data.second);
}
@@ -114,19 +117,21 @@ class RepositoryLoader extends Loader {
}
public void run() {
- final Collection<SVNDirEntry> entries = new TreeSet<SVNDirEntry>();
+ final Collection<DirectoryEntry> entries = new TreeSet<DirectoryEntry>();
final RepositoryTreeNode node = myData.first;
final SvnVcs vcs = node.getVcs();
SvnAuthenticationProvider.forceInteractive();
- ISVNDirEntryHandler handler = new ISVNDirEntryHandler() {
- public void handleDirEntry(final SVNDirEntry dirEntry) throws SVNException {
- entries.add(dirEntry);
+ DirectoryEntryConsumer handler = new DirectoryEntryConsumer() {
+
+ @Override
+ public void consume(final DirectoryEntry entry) throws SVNException {
+ entries.add(entry);
}
};
try {
SvnTarget target = SvnTarget.fromURL(node.getURL());
- vcs.getFactoryFromSettings().createBrowseClient().list(target, SVNRevision.HEAD, SVNDepth.IMMEDIATES, handler);
+ vcs.getFactoryFromSettings().createBrowseClient().list(target, SVNRevision.HEAD, Depth.IMMEDIATES, handler);
}
catch (final VcsException e) {
SwingUtilities.invokeLater(new Runnable() {
@@ -142,7 +147,7 @@ class RepositoryLoader extends Loader {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
- setResults(myData, new ArrayList<SVNDirEntry>(entries));
+ setResults(myData, new ArrayList<DirectoryEntry>(entries));
startNext();
}
});
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browserCache/SvnRepositoryCache.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browserCache/SvnRepositoryCache.java
index b615abbce8ea..d038dc127b90 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browserCache/SvnRepositoryCache.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browserCache/SvnRepositoryCache.java
@@ -18,15 +18,14 @@ package org.jetbrains.idea.svn.dialogs.browserCache;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.util.containers.SoftHashMap;
import org.jetbrains.annotations.Nullable;
-import org.tmatesoft.svn.core.SVNDirEntry;
-import org.tmatesoft.svn.core.SVNErrorMessage;
+import org.jetbrains.idea.svn.browse.DirectoryEntry;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
public class SvnRepositoryCache {
- private final Map<String, List<SVNDirEntry>> myMap;
+ private final Map<String, List<DirectoryEntry>> myMap;
private final Map<String, String> myErrorsMap;
public static SvnRepositoryCache getInstance() {
@@ -34,12 +33,12 @@ public class SvnRepositoryCache {
}
private SvnRepositoryCache() {
- myMap = new SoftHashMap<String, List<SVNDirEntry>>();
+ myMap = new SoftHashMap<String, List<DirectoryEntry>>();
myErrorsMap = new SoftHashMap<String, String>();
}
@Nullable
- public List<SVNDirEntry> getChildren(final String parent) {
+ public List<DirectoryEntry> getChildren(final String parent) {
return myMap.get(parent);
}
@@ -53,7 +52,7 @@ public class SvnRepositoryCache {
myErrorsMap.put(parent, error);
}
- public void put(final String parent, List<SVNDirEntry> children) {
+ public void put(final String parent, List<DirectoryEntry> children) {
myErrorsMap.remove(parent);
myMap.put(parent, children);
}
@@ -64,8 +63,8 @@ public class SvnRepositoryCache {
}
public void clear(final String repositoryRootUrl) {
- for (Iterator<Map.Entry<String, List<SVNDirEntry>>> iterator = myMap.entrySet().iterator(); iterator.hasNext();) {
- final Map.Entry<String, List<SVNDirEntry>> entry = iterator.next();
+ for (Iterator<Map.Entry<String, List<DirectoryEntry>>> iterator = myMap.entrySet().iterator(); iterator.hasNext();) {
+ final Map.Entry<String, List<DirectoryEntry>> entry = iterator.next();
if (entry.getKey().startsWith(repositoryRootUrl)) {
iterator.remove();
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browserCache/SyntheticWorker.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browserCache/SyntheticWorker.java
index 5ee07d8db8fe..5d7c3c3c55c7 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browserCache/SyntheticWorker.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browserCache/SyntheticWorker.java
@@ -17,12 +17,12 @@ package org.jetbrains.idea.svn.dialogs.browserCache;
import com.intellij.util.NotNullFunction;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.idea.svn.api.NodeKind;
+import org.jetbrains.idea.svn.browse.DirectoryEntry;
+import org.jetbrains.idea.svn.checkin.CommitInfo;
import org.jetbrains.idea.svn.dialogs.RepositoryTreeNode;
-import org.tmatesoft.svn.core.SVNDirEntry;
import org.tmatesoft.svn.core.SVNException;
-import org.tmatesoft.svn.core.SVNNodeKind;
import org.tmatesoft.svn.core.SVNURL;
-import org.tmatesoft.svn.core.wc.SVNRevision;
import java.util.*;
@@ -44,13 +44,13 @@ public class SyntheticWorker {
return;
}
- final List<SVNDirEntry> children = myCache.getChildren(parentUrl);
+ final List<DirectoryEntry> children = myCache.getChildren(parentUrl);
if (children == null) {
return;
}
- for (Iterator<SVNDirEntry> iterator = children.iterator(); iterator.hasNext();) {
- final SVNDirEntry entry = iterator.next();
- if (myUrl.equals(entry.getURL())) {
+ for (Iterator<DirectoryEntry> iterator = children.iterator(); iterator.hasNext(); ) {
+ final DirectoryEntry entry = iterator.next();
+ if (myUrl.equals(entry.getUrl())) {
iterator.remove();
}
}
@@ -60,21 +60,14 @@ public class SyntheticWorker {
public void addSyntheticChildToSelf(final SVNURL newUrl, final SVNURL repositoryUrl, final String name, final boolean isDir) {
final String currentUrlAsString = myUrl.toString();
- final List<SVNDirEntry> children = myCache.getChildren(currentUrlAsString);
+ final List<DirectoryEntry> children = myCache.getChildren(currentUrlAsString);
if (children == null) {
return;
}
children.add(createSyntheticEntry(newUrl, repositoryUrl, name, isDir));
- Collections.sort(children, new Comparator<SVNDirEntry>() {
- public int compare(final SVNDirEntry o1, final SVNDirEntry o2) {
- final boolean dirStatus = SVNNodeKind.DIR.equals(o1.getKind()) ^ SVNNodeKind.DIR.equals(o1.getKind());
- if (dirStatus) {
- return SVNNodeKind.DIR.equals(o1.getKind()) ? -1 : 1;
- }
- return o1.toString().compareTo(o2.toString());
- }
- });
+ // TODO: Seems that just Set instead of List could be used in cache - so no sort() after add() will be required
+ Collections.sort(children);
myCache.put(currentUrlAsString, children);
}
@@ -91,8 +84,8 @@ public class SyntheticWorker {
node.doOnSubtree(new Remover());
}
- public static SVNDirEntry createSyntheticEntry(final SVNURL newUrl, final SVNURL repositoryUrl, final String name, final boolean isDir) {
- return new SVNDirEntry(newUrl, repositoryUrl, name, isDir ? SVNNodeKind.DIR : SVNNodeKind.FILE, 0, false, SVNRevision.UNDEFINED.getNumber(), null, null);
+ public static DirectoryEntry createSyntheticEntry(final SVNURL newUrl, final SVNURL repositoryUrl, final String name, final boolean isDir) {
+ return new DirectoryEntry(newUrl, repositoryUrl, name, NodeKind.from(isDir), CommitInfo.EMPTY, null);
}
private static class Remover implements NotNullFunction<RepositoryTreeNode, Object> {
@@ -116,15 +109,15 @@ public class SyntheticWorker {
@NotNull
public Object fun(final RepositoryTreeNode repositoryTreeNode) {
- final List<SVNDirEntry> children = myCache.getChildren(repositoryTreeNode.getURL().toString());
+ final List<DirectoryEntry> children = myCache.getChildren(repositoryTreeNode.getURL().toString());
if (children == null) {
return Boolean.FALSE;
}
- final List<SVNDirEntry> newChildren = new ArrayList<SVNDirEntry>(children.size());
+ final List<DirectoryEntry> newChildren = new ArrayList<DirectoryEntry>(children.size());
try {
- for (SVNDirEntry child : children) {
- newChildren.add(createSyntheticEntry(convertUrl(child.getURL()), child.getRepositoryRoot(), child.getName(), SVNNodeKind.DIR.equals(child.getKind())));
+ for (DirectoryEntry child : children) {
+ newChildren.add(createSyntheticEntry(convertUrl(child.getUrl()), child.getRepositoryRoot(), child.getName(), child.isDirectory()));
}
myCache.put(convertUrl(repositoryTreeNode.getURL()).toString(), newChildren);
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/diff/CmdDiffClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/diff/CmdDiffClient.java
index 10890d18cd6d..497134727ee4 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/diff/CmdDiffClient.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/diff/CmdDiffClient.java
@@ -30,21 +30,18 @@ import org.jetbrains.idea.svn.SvnStatusConvertor;
import org.jetbrains.idea.svn.SvnUtil;
import org.jetbrains.idea.svn.WorkingCopyFormat;
import org.jetbrains.idea.svn.api.BaseSvnClient;
+import org.jetbrains.idea.svn.api.NodeKind;
import org.jetbrains.idea.svn.commandLine.CommandExecutor;
import org.jetbrains.idea.svn.commandLine.CommandUtil;
import org.jetbrains.idea.svn.commandLine.SvnBindException;
import org.jetbrains.idea.svn.commandLine.SvnCommandName;
import org.jetbrains.idea.svn.history.SvnRepositoryContentRevision;
import org.jetbrains.idea.svn.status.SvnStatusHandler;
-import org.tmatesoft.svn.core.SVNNodeKind;
import org.tmatesoft.svn.core.wc.SVNRevision;
import org.tmatesoft.svn.core.wc2.SvnTarget;
import javax.xml.bind.JAXBException;
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlValue;
+import javax.xml.bind.annotation.*;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
@@ -64,7 +61,7 @@ public class CmdDiffClient extends BaseSvnClient implements DiffClient {
assertDirectory(target1);
WorkingCopyFormat format = WorkingCopyFormat.from(myFactory.createVersionClient().getVersion());
- if (!format.isOrGreater(WorkingCopyFormat.ONE_DOT_EIGHT)) {
+ if (format.less(WorkingCopyFormat.ONE_DOT_EIGHT)) {
throw new SvnBindException("Could not compare local file and remote url with executable for svn " + format);
}
}
@@ -104,8 +101,8 @@ public class CmdDiffClient extends BaseSvnClient implements DiffClient {
DiffInfo diffInfo = CommandUtil.parse(executor.getOutput(), DiffInfo.class);
List<Change> result = ContainerUtil.newArrayList();
- if (diffInfo != null && diffInfo.paths != null) {
- for (DiffPath path : diffInfo.paths.diffPaths) {
+ if (diffInfo != null) {
+ for (DiffPath path : diffInfo.diffPaths) {
result.add(createChange(target1, target2, path));
}
}
@@ -194,20 +191,15 @@ public class CmdDiffClient extends BaseSvnClient implements DiffClient {
@XmlRootElement(name = "diff")
public static class DiffInfo {
- @XmlElement(name = "paths")
- public DiffPaths paths;
- }
-
- public static class DiffPaths {
-
+ @XmlElementWrapper(name = "paths")
@XmlElement(name = "path")
public List<DiffPath> diffPaths = new ArrayList<DiffPath>();
}
public static class DiffPath {
- @XmlAttribute(name = "kind")
- public String kind;
+ @XmlAttribute(name = "kind", required = true)
+ public NodeKind kind;
@XmlAttribute(name = "props")
public String propertiesStatus;
@@ -219,7 +211,7 @@ public class CmdDiffClient extends BaseSvnClient implements DiffClient {
public String path;
public boolean isDirectory() {
- return SVNNodeKind.DIR.equals(SVNNodeKind.parseKind(kind));
+ return kind.isDirectory();
}
}
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/diff/DiffOptions.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/diff/DiffOptions.java
new file mode 100644
index 000000000000..1e44a8389505
--- /dev/null
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/diff/DiffOptions.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jetbrains.idea.svn.diff;
+
+/**
+ * @author Konstantin Kolosovsky.
+ */
+public class DiffOptions {
+
+ private final boolean myIgnoreAllWhitespace;
+ private final boolean myIgnoreAmountOfWhitespace;
+ private final boolean myIgnoreEOLStyle;
+
+ public DiffOptions(boolean ignoreAllWhitespace, boolean ignoreAmountOfWhiteSpace, boolean ignoreEOLStyle) {
+ myIgnoreAllWhitespace = ignoreAllWhitespace;
+ myIgnoreAmountOfWhitespace = ignoreAmountOfWhiteSpace;
+ myIgnoreEOLStyle = ignoreEOLStyle;
+ }
+
+ public boolean isIgnoreAllWhitespace() {
+ return myIgnoreAllWhitespace;
+ }
+
+ public boolean isIgnoreAmountOfWhitespace() {
+ return myIgnoreAmountOfWhitespace;
+ }
+
+ public boolean isIgnoreEOLStyle() {
+ return myIgnoreEOLStyle;
+ }
+}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/diff/DirectoryWithBranchComparer.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/diff/DirectoryWithBranchComparer.java
index 4d3a09a39e26..0f0e6a714037 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/diff/DirectoryWithBranchComparer.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/diff/DirectoryWithBranchComparer.java
@@ -65,7 +65,7 @@ public class DirectoryWithBranchComparer extends ElementWithBranchComparer {
// svn 1.7 command line "--summarize" option for "diff" command does not support comparing working copy directories with repository
// directories - that is why command line is only used explicitly for svn 1.8
- return WorkingCopyFormat.ONE_DOT_EIGHT.equals(format) ? myVcs.getCommandLineFactory() : myVcs.getSvnKitFactory();
+ return format.isOrGreater(WorkingCopyFormat.ONE_DOT_EIGHT) ? myVcs.getCommandLineFactory() : myVcs.getSvnKitFactory();
}
@Override
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/diff/SvnKitDiffClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/diff/SvnKitDiffClient.java
index 850fb1b2a295..0a1b14837b7e 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/diff/SvnKitDiffClient.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/diff/SvnKitDiffClient.java
@@ -19,10 +19,11 @@ import com.intellij.openapi.vcs.VcsException;
import com.intellij.openapi.vcs.changes.Change;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NotNull;
-import org.jetbrains.idea.svn.SvnProgressCanceller;
import org.jetbrains.idea.svn.WorkingCopyFormat;
import org.jetbrains.idea.svn.api.BaseSvnClient;
import org.jetbrains.idea.svn.commandLine.SvnBindException;
+import org.jetbrains.idea.svn.info.Info;
+import org.jetbrains.idea.svn.svnkit.SvnKitProgressCanceller;
import org.tmatesoft.svn.core.*;
import org.tmatesoft.svn.core.internal.wc.SVNCancellableEditor;
import org.tmatesoft.svn.core.internal.wc.SVNErrorManager;
@@ -38,7 +39,6 @@ import org.tmatesoft.svn.core.io.ISVNReporterBaton;
import org.tmatesoft.svn.core.io.SVNRepository;
import org.tmatesoft.svn.core.wc.ISVNEventHandler;
import org.tmatesoft.svn.core.wc.SVNEvent;
-import org.tmatesoft.svn.core.wc.SVNInfo;
import org.tmatesoft.svn.core.wc.SVNRevision;
import org.tmatesoft.svn.core.wc2.SvnTarget;
import org.tmatesoft.svn.util.SVNDebugLog;
@@ -114,7 +114,7 @@ public class SvnKitDiffClient extends BaseSvnClient implements DiffClient {
private Collection<Change> runUrlDiff() throws SVNException {
SVNRepository sourceRepository = myVcs.getSvnKitManager().createRepository(myTarget1.getURL());
- sourceRepository.setCanceller(new SvnProgressCanceller());
+ sourceRepository.setCanceller(new SvnKitProgressCanceller());
SvnDiffEditor diffEditor;
final long rev;
SVNRepository targetRepository = null;
@@ -123,7 +123,7 @@ public class SvnKitDiffClient extends BaseSvnClient implements DiffClient {
// generate Map of path->Change
targetRepository = myVcs.getSvnKitManager().createRepository(myTarget2.getURL());
diffEditor = new SvnDiffEditor(sourceRepository, targetRepository, -1, false);
- final ISVNEditor cancellableEditor = SVNCancellableEditor.newInstance(diffEditor, new SvnProgressCanceller(), null);
+ final ISVNEditor cancellableEditor = SVNCancellableEditor.newInstance(diffEditor, new SvnKitProgressCanceller(), null);
sourceRepository.diff(myTarget2.getURL(), rev, rev, null, true, true, false, new ISVNReporterBaton() {
public void report(ISVNReporter reporter) throws SVNException {
reporter.setPath("", null, rev, false);
@@ -142,7 +142,7 @@ public class SvnKitDiffClient extends BaseSvnClient implements DiffClient {
}
private Collection<Change> run17Diff() throws SVNException {
- final SVNInfo info1 = myVcs.getInfo(myTarget1.getFile(), SVNRevision.HEAD);
+ final Info info1 = myVcs.getInfo(myTarget1.getFile(), SVNRevision.HEAD);
if (info1 == null) {
SVNErrorMessage err =
@@ -172,7 +172,7 @@ public class SvnKitDiffClient extends BaseSvnClient implements DiffClient {
repository2 = myVcs.getSvnKitManager().createRepository(myTarget2.getURL());
SvnDiffEditor diffEditor = new SvnDiffEditor(myTarget1.getFile(), repository2, rev, true);
repository.diff(myTarget2.getURL(), rev, rev, null, true, SVNDepth.INFINITY, false, reporter17,
- SVNCancellableEditor.newInstance(diffEditor, new SvnProgressCanceller(), null));
+ SVNCancellableEditor.newInstance(diffEditor, new SvnKitProgressCanceller(), null));
return diffEditor.getChangesMap().values();
}
@@ -219,7 +219,7 @@ public class SvnKitDiffClient extends BaseSvnClient implements DiffClient {
SvnDiffEditor diffEditor =
new SvnDiffEditor(target == null ? myTarget1.getFile() : myTarget1.getFile().getParentFile(), repository2, rev, true);
repository.diff(myTarget2.getURL(), rev, rev, target, true, true, false, reporter,
- SVNCancellableEditor.newInstance(diffEditor, new SvnProgressCanceller(), null));
+ SVNCancellableEditor.newInstance(diffEditor, new SvnKitProgressCanceller(), null));
return diffEditor.getChangesMap().values();
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/CmdHistoryClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/CmdHistoryClient.java
index 3494b9ac9d28..ca934d4a40e4 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/CmdHistoryClient.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/CmdHistoryClient.java
@@ -9,19 +9,15 @@ import org.jetbrains.idea.svn.commandLine.CommandExecutor;
import org.jetbrains.idea.svn.commandLine.CommandUtil;
import org.jetbrains.idea.svn.commandLine.SvnBindException;
import org.jetbrains.idea.svn.commandLine.SvnCommandName;
-import org.tmatesoft.svn.core.*;
+import org.tmatesoft.svn.core.SVNException;
import org.tmatesoft.svn.core.wc.SVNRevision;
import org.tmatesoft.svn.core.wc2.SvnTarget;
import javax.xml.bind.JAXBException;
-import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlValue;
import java.util.ArrayList;
-import java.util.Date;
import java.util.List;
-import java.util.Map;
/**
* @author Konstantin Kolosovsky.
@@ -37,7 +33,7 @@ public class CmdHistoryClient extends BaseSvnClient implements HistoryClient {
boolean includeMergedRevisions,
long limit,
@Nullable String[] revisionProperties,
- @Nullable ISVNLogEntryHandler handler) throws VcsException {
+ @Nullable LogEntryConsumer handler) throws VcsException {
// TODO: add revision properties parameter if necessary
List<String> parameters =
@@ -54,13 +50,13 @@ public class CmdHistoryClient extends BaseSvnClient implements HistoryClient {
}
}
- private static void parseOutput(@NotNull CommandExecutor command, @Nullable ISVNLogEntryHandler handler)
+ private static void parseOutput(@NotNull CommandExecutor command, @Nullable LogEntryConsumer handler)
throws VcsException, SVNException {
try {
LogInfo log = CommandUtil.parse(command.getOutput(), LogInfo.class);
if (handler != null && log != null) {
- for (LogEntry entry : log.entries) {
+ for (LogEntry.Builder entry : log.entries) {
iterateRecursively(entry, handler);
}
}
@@ -70,16 +66,16 @@ public class CmdHistoryClient extends BaseSvnClient implements HistoryClient {
}
}
- private static void iterateRecursively(@NotNull LogEntry entry, @NotNull ISVNLogEntryHandler handler) throws SVNException {
- handler.handleLogEntry(entry.toLogEntry());
+ private static void iterateRecursively(@NotNull LogEntry.Builder entry, @NotNull LogEntryConsumer handler) throws SVNException {
+ handler.consume(entry.build());
- for (LogEntry childEntry : entry.childEntries) {
+ for (LogEntry.Builder childEntry : entry.getChildEntries()) {
iterateRecursively(childEntry, handler);
}
if (entry.hasChildren()) {
// empty log entry passed to handler to fully correspond to SVNKit behavior.
- handler.handleLogEntry(SVNLogEntry.EMPTY_ENTRY);
+ handler.consume(LogEntry.EMPTY);
}
}
@@ -109,81 +105,6 @@ public class CmdHistoryClient extends BaseSvnClient implements HistoryClient {
public static class LogInfo {
@XmlElement(name = "logentry")
- public List<LogEntry> entries = new ArrayList<LogEntry>();
- }
-
- public static class LogEntry {
-
- @XmlAttribute(name = "revision")
- public long revision;
-
- @XmlElement(name = "author")
- public String author;
-
- @XmlElement(name = "date")
- public Date date;
-
- @XmlElement(name = "msg")
- public String message;
-
- @XmlElement(name = "paths")
- public ChangedPaths changedPaths;
-
- @XmlElement(name = "logentry")
- public List<LogEntry> childEntries = new ArrayList<LogEntry>();
-
- public boolean hasChildren() {
- return !childEntries.isEmpty();
- }
-
- public SVNLogEntry toLogEntry() {
- SVNLogEntry entry = new SVNLogEntry(toChangedPathsMap(), revision, author, date, message);
-
- entry.setHasChildren(hasChildren());
-
- return entry;
- }
-
- public Map<String, SVNLogEntryPath> toChangedPathsMap() {
- return changedPaths != null ? changedPaths.toMap() : ContainerUtil.<String, SVNLogEntryPath>newHashMap();
- }
- }
-
- public static class ChangedPaths {
-
- @XmlElement(name = "path")
- public List<ChangedPath> changedPaths = new ArrayList<ChangedPath>();
-
- public Map<String, SVNLogEntryPath> toMap() {
- Map<String, SVNLogEntryPath> changes = ContainerUtil.newHashMap();
-
- for (ChangedPath path : changedPaths) {
- changes.put(path.path, path.toLogEntryPath());
- }
-
- return changes;
- }
- }
-
- public static class ChangedPath {
-
- @XmlAttribute(name = "kind")
- public String kind;
-
- @XmlAttribute(name = "action")
- public String action;
-
- @XmlAttribute(name = "copyfrom-path")
- public String copyFromPath;
-
- @XmlAttribute(name = "copyfrom-rev")
- public long copyFromRevision;
-
- @XmlValue
- public String path;
-
- public SVNLogEntryPath toLogEntryPath() {
- return new SVNLogEntryPath(path, CommandUtil.getStatusChar(action), copyFromPath, copyFromRevision);
- }
+ public List<LogEntry.Builder> entries = ContainerUtil.newArrayList();
}
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/FirstInBranch.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/FirstInBranch.java
index f871ee09855a..a075251e7675 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/FirstInBranch.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/FirstInBranch.java
@@ -125,7 +125,7 @@ public class FirstInBranch implements Runnable {
}
}
- private static class MyLogEntryHandler implements ISVNLogEntryHandler {
+ private static class MyLogEntryHandler implements LogEntryConsumer {
@NotNull private final SvnPathThroughHistoryCorrection myTrunkCorrector;
@NotNull private final SvnPathThroughHistoryCorrection myBranchCorrector;
@@ -137,17 +137,18 @@ public class FirstInBranch implements Runnable {
myBranchCorrector = new SvnPathThroughHistoryCorrection(branchUrl);
}
- public void handleLogEntry(SVNLogEntry logEntry) throws SVNException {
+ @Override
+ public void consume(LogEntry logEntry) throws SVNException {
final Map map = logEntry.getChangedPaths();
checkEntries(logEntry, map);
- myTrunkCorrector.handleLogEntry(logEntry);
- myBranchCorrector.handleLogEntry(logEntry);
+ myTrunkCorrector.consume(logEntry);
+ myBranchCorrector.consume(logEntry);
checkEntries(logEntry, map);
}
- private void checkEntries(SVNLogEntry logEntry, Map map) throws SVNCancelException {
+ private void checkEntries(LogEntry logEntry, Map map) throws SVNCancelException {
for (Object o : map.values()) {
- final SVNLogEntryPath path = (SVNLogEntryPath) o;
+ final LogEntryPath path = (LogEntryPath) o;
final String localPath = path.getPath();
final String copyPath = path.getCopyPath();
@@ -159,7 +160,7 @@ public class FirstInBranch implements Runnable {
}
}
- private boolean checkForCopyCase(SVNLogEntry logEntry, SVNLogEntryPath path, String localPath, String copyPath,
+ private boolean checkForCopyCase(LogEntry logEntry, LogEntryPath path, String localPath, String copyPath,
final String trunkUrl, final String branchUrl) {
if (equalOrParent(localPath, branchUrl) && equalOrParent(copyPath, trunkUrl)) {
myCopyDataConsumer.consume(new CopyData(path.getCopyRevision(), logEntry.getRevision(), true));
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/HistoryClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/HistoryClient.java
index d719e755e661..c85eb9e65968 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/HistoryClient.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/HistoryClient.java
@@ -4,7 +4,6 @@ import com.intellij.openapi.vcs.VcsException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.api.SvnClient;
-import org.tmatesoft.svn.core.ISVNLogEntryHandler;
import org.tmatesoft.svn.core.wc.SVNRevision;
import org.tmatesoft.svn.core.wc2.SvnTarget;
@@ -21,5 +20,5 @@ public interface HistoryClient extends SvnClient {
boolean includeMergedRevisions,
long limit,
@Nullable String[] revisionProperties,
- @Nullable ISVNLogEntryHandler handler) throws VcsException;
+ @Nullable LogEntryConsumer handler) throws VcsException;
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/LatestExistentSearcher.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/LatestExistentSearcher.java
index dc1def418e99..030db0db6ef3 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/LatestExistentSearcher.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/LatestExistentSearcher.java
@@ -25,9 +25,10 @@ import org.jetbrains.idea.svn.RootUrlInfo;
import org.jetbrains.idea.svn.SvnFileUrlMapping;
import org.jetbrains.idea.svn.SvnUtil;
import org.jetbrains.idea.svn.SvnVcs;
+import org.jetbrains.idea.svn.commandLine.SvnBindException;
+import org.jetbrains.idea.svn.info.Info;
import org.tmatesoft.svn.core.*;
import org.tmatesoft.svn.core.internal.util.SVNURLUtil;
-import org.tmatesoft.svn.core.wc.SVNInfo;
import org.tmatesoft.svn.core.wc.SVNRevision;
import org.tmatesoft.svn.core.wc2.SvnTarget;
@@ -84,9 +85,6 @@ public class LatestExistentSearcher {
myVcs.getFactory(target).createHistoryClient().doLog(target, startRevision, SVNRevision.HEAD, false, true, false, 0, null,
createHandler(latest));
}
- catch (SVNException e) {
- LOG.info(e);
- }
catch (VcsException e) {
LOG.info(e);
}
@@ -95,12 +93,13 @@ public class LatestExistentSearcher {
}
@NotNull
- private ISVNLogEntryHandler createHandler(@NotNull final Ref<Long> latest) {
- return new ISVNLogEntryHandler() {
- public void handleLogEntry(final SVNLogEntry logEntry) throws SVNException {
+ private LogEntryConsumer createHandler(@NotNull final Ref<Long> latest) {
+ return new LogEntryConsumer() {
+ @Override
+ public void consume(final LogEntry logEntry) throws SVNException {
final Map changedPaths = logEntry.getChangedPaths();
for (Object o : changedPaths.values()) {
- final SVNLogEntryPath path = (SVNLogEntryPath)o;
+ final LogEntryPath path = (LogEntryPath)o;
if ((path.getType() == 'D') && (myRelativeUrl.equals(path.getPath()))) {
latest.set(logEntry.getRevision());
throw new SVNException(SVNErrorMessage.UNKNOWN_ERROR_MESSAGE);
@@ -125,7 +124,7 @@ public class LatestExistentSearcher {
}
}
}
- catch (SVNException e) {
+ catch (SvnBindException e) {
LOG.info(e);
}
@@ -138,7 +137,7 @@ public class LatestExistentSearcher {
final RootUrlInfo rootUrlInfo = mapping.getWcRootForUrl(myUrl.toString());
if (rootUrlInfo == null) return true;
final VirtualFile vf = rootUrlInfo.getVirtualFile();
- final SVNInfo info = myVcs.getInfo(vf);
+ final Info info = myVcs.getInfo(vf);
if ((info == null) || (info.getRevision() == null)) {
return false;
}
@@ -149,24 +148,24 @@ public class LatestExistentSearcher {
}
@Nullable
- private SVNURL getExistingParent(SVNURL url) throws SVNException {
+ private SVNURL getExistingParent(SVNURL url) throws SvnBindException {
while (url != null && !url.equals(myRepositoryUrl) && !existsInRevision(url, myEndNumber)) {
- url = url.removePathTail();
+ url = SvnUtil.removePathTail(url);
}
return url;
}
- private boolean existsInRevision(@NotNull SVNURL url, long revisionNumber) throws SVNException {
+ private boolean existsInRevision(@NotNull SVNURL url, long revisionNumber) throws SvnBindException {
SVNRevision revision = SVNRevision.create(revisionNumber);
- SVNInfo info = null;
+ Info info = null;
try {
info = myVcs.getInfo(url, revision, revision);
}
- catch (SVNException e) {
+ catch (SvnBindException e) {
// throw error if not "does not exist" error code
- if (!SVNErrorCode.RA_ILLEGAL_URL.equals(e.getErrorMessage().getErrorCode())) {
+ if (!e.contains(SVNErrorCode.RA_ILLEGAL_URL)) {
throw e;
}
}
@@ -174,7 +173,7 @@ public class LatestExistentSearcher {
return info != null;
}
- private long getLatestRevision() throws SVNException {
+ private long getLatestRevision() throws SvnBindException {
return SvnUtil.getHeadRevision(myVcs, myRepositoryUrl).getNumber();
}
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/LogEntry.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/LogEntry.java
new file mode 100644
index 000000000000..1b3d12656d2b
--- /dev/null
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/LogEntry.java
@@ -0,0 +1,187 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jetbrains.idea.svn.history;
+
+import com.intellij.util.containers.ContainerUtil;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+import org.tmatesoft.svn.core.SVNLogEntry;
+import org.tmatesoft.svn.core.SVNLogEntryPath;
+
+import javax.xml.bind.annotation.*;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author Konstantin Kolosovsky.
+ */
+public class LogEntry {
+
+ public static final LogEntry EMPTY = new LogEntry.Builder().setRevision(-1).setHasChildren(false).build();
+
+ private final long myRevision;
+ private final Date myDate;
+ private final String myMessage;
+ private final String myAuthor;
+ @NotNull private final Map<String, LogEntryPath> myChangedPaths;
+ private boolean myHasChildren;
+
+ @Nullable
+ public static LogEntry create(@Nullable SVNLogEntry entry) {
+ LogEntry result = null;
+
+ if (entry != null) {
+ LogEntry.Builder builder = new LogEntry.Builder();
+
+ if (entry.getChangedPaths() != null) {
+ for (SVNLogEntryPath path : entry.getChangedPaths().values()) {
+ builder.addPath(LogEntryPath.create(path));
+ }
+ }
+
+ result = builder.setRevision(entry.getRevision()).setAuthor(entry.getAuthor()).setDate(entry.getDate()).setMessage(entry.getMessage())
+ .setHasChildren(entry.hasChildren()).build();
+ }
+
+ return result;
+ }
+
+ public LogEntry(@NotNull LogEntry.Builder builder) {
+ myRevision = builder.revision;
+ myChangedPaths = toImmutable(builder.changedPaths);
+ myAuthor = builder.author;
+ myDate = builder.date;
+ myMessage = builder.message;
+ myHasChildren = builder.hasChildren();
+ }
+
+ @NotNull
+ private static Map<String, LogEntryPath> toImmutable(@NotNull List<LogEntryPath.Builder> paths) {
+ ContainerUtil.ImmutableMapBuilder<String, LogEntryPath> builder = ContainerUtil.immutableMapBuilder();
+
+ for (LogEntryPath.Builder path : paths) {
+ builder.put(path.getPath(), path.build());
+ }
+
+ return builder.build();
+ }
+
+ @NotNull
+ public Map<String, LogEntryPath> getChangedPaths() {
+ return myChangedPaths;
+ }
+
+ public String getAuthor() {
+ return myAuthor;
+ }
+
+ public Date getDate() {
+ return myDate;
+ }
+
+ public String getMessage() {
+ return myMessage;
+ }
+
+ public long getRevision() {
+ return myRevision;
+ }
+
+ public boolean hasChildren() {
+ return myHasChildren;
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ // type explicitly specified not to conflict with LogEntryPath.Builder
+ @XmlType(name = "logentry")
+ public static class Builder {
+
+ @XmlAttribute(name = "revision")
+ private long revision;
+
+ @XmlElement(name = "author")
+ private String author;
+
+ @XmlElement(name = "date")
+ private Date date;
+
+ @XmlElement(name = "msg")
+ private String message;
+
+ @XmlElementWrapper(name = "paths")
+ @XmlElement(name = "path")
+ private List<LogEntryPath.Builder> changedPaths = ContainerUtil.newArrayList();
+
+ @XmlElement(name = "logentry")
+ private List<LogEntry.Builder> childEntries = ContainerUtil.newArrayList();
+
+ @NotNull
+ public List<LogEntry.Builder> getChildEntries() {
+ return childEntries;
+ }
+
+ public boolean hasChildren() {
+ return !childEntries.isEmpty();
+ }
+
+ @NotNull
+ public Builder setRevision(long revision) {
+ this.revision = revision;
+ return this;
+ }
+
+ @NotNull
+ public Builder setAuthor(String author) {
+ this.author = author;
+ return this;
+ }
+
+ @NotNull
+ public Builder setDate(Date date) {
+ this.date = date;
+ return this;
+ }
+
+ @NotNull
+ public Builder setMessage(String message) {
+ this.message = message;
+ return this;
+ }
+
+ @NotNull
+ public Builder setHasChildren(boolean hasChildren) {
+ // probably LogEntry interface will be changed and child entries will be specified explicitly later, but for now just use such "fake"
+ // implementation for setting "hasChildren" value
+ childEntries.clear();
+ if (hasChildren) {
+ childEntries.add(this);
+ }
+ return this;
+ }
+
+ @NotNull
+ public Builder addPath(@NotNull LogEntryPath.Builder path) {
+ changedPaths.add(path);
+ return this;
+ }
+
+ @NotNull
+ public LogEntry build() {
+ return new LogEntry(this);
+ }
+ }
+}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/LogEntryConsumer.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/LogEntryConsumer.java
new file mode 100644
index 000000000000..b3269b1afb41
--- /dev/null
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/LogEntryConsumer.java
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jetbrains.idea.svn.history;
+
+import com.intellij.util.ThrowableConsumer;
+import org.tmatesoft.svn.core.SVNException;
+
+/**
+ * @author Konstantin Kolosovsky.
+ */
+public interface LogEntryConsumer extends ThrowableConsumer<LogEntry, SVNException> {
+}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/LogEntryPath.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/LogEntryPath.java
new file mode 100644
index 000000000000..41215f71f76e
--- /dev/null
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/LogEntryPath.java
@@ -0,0 +1,132 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jetbrains.idea.svn.history;
+
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.idea.svn.api.BaseNodeDescription;
+import org.jetbrains.idea.svn.api.NodeKind;
+import org.jetbrains.idea.svn.commandLine.CommandUtil;
+import org.tmatesoft.svn.core.SVNLogEntryPath;
+
+import javax.xml.bind.annotation.*;
+
+/**
+ * @author Konstantin Kolosovsky.
+ */
+public class LogEntryPath extends BaseNodeDescription {
+
+ private final String myPath;
+ private final char myType;
+ private final String myCopyPath;
+ private final long myCopyRevision;
+
+ @NotNull
+ public static LogEntryPath.Builder create(@NotNull SVNLogEntryPath path) {
+ return new LogEntryPath.Builder().setPath(path.getPath()).setType(path.getType()).setCopyFromPath(
+ path.getCopyPath()).setCopyFromRevision(path.getCopyRevision()).setKind(NodeKind.from(path.getKind()));
+ }
+
+ public LogEntryPath(@NotNull LogEntryPath.Builder builder) {
+ super(builder.kind);
+ myPath = builder.path;
+ myType = CommandUtil.getStatusChar(builder.action);
+ myCopyPath = builder.copyFromPath;
+ myCopyRevision = builder.copyFromRevision;
+ }
+
+ public String getCopyPath() {
+ return myCopyPath;
+ }
+
+ public long getCopyRevision() {
+ return myCopyRevision;
+ }
+
+ public String getPath() {
+ return myPath;
+ }
+
+ public char getType() {
+ return myType;
+ }
+
+ @NotNull
+ public NodeKind getKind() {
+ return myKind;
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ // type explicitly specified not to conflict with LogEntry.Builder
+ @XmlType(name = "logentrypath")
+ public static class Builder {
+
+ // empty string could be here if repository was < 1.6 when committing (see comments in schema for svn client xml output , in
+ // svn source code repository) - this will result in kind = NodeKind.UNKNOWN
+ @XmlAttribute(name = "kind", required = true)
+ private NodeKind kind;
+
+ @XmlAttribute(name = "action")
+ private String action;
+
+ @XmlAttribute(name = "copyfrom-path")
+ private String copyFromPath;
+
+ @XmlAttribute(name = "copyfrom-rev")
+ private long copyFromRevision;
+
+ @XmlValue
+ private String path;
+
+ public String getPath() {
+ return path;
+ }
+
+ @NotNull
+ public Builder setKind(@NotNull NodeKind kind) {
+ this.kind = kind;
+ return this;
+ }
+
+ @NotNull
+ public Builder setType(char type) {
+ this.action = String.valueOf(type);
+ return this;
+ }
+
+ @NotNull
+ public Builder setCopyFromPath(String copyFromPath) {
+ this.copyFromPath = copyFromPath;
+ return this;
+ }
+
+ @NotNull
+ public Builder setCopyFromRevision(long copyFromRevision) {
+ this.copyFromRevision = copyFromRevision;
+ return this;
+ }
+
+ @NotNull
+ public Builder setPath(String path) {
+ this.path = path;
+ return this;
+ }
+
+ @NotNull
+ public LogEntryPath build() {
+ return new LogEntryPath(this);
+ }
+ }
+}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/LogHierarchyNode.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/LogHierarchyNode.java
new file mode 100644
index 000000000000..d9ce35a100e4
--- /dev/null
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/LogHierarchyNode.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2000-2010 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jetbrains.idea.svn.history;
+
+import java.util.LinkedList;
+import java.util.List;
+
+public class LogHierarchyNode {
+ private final LogEntry myMe;
+ private final List<LogHierarchyNode> myChildren;
+
+ public LogHierarchyNode(final LogEntry me) {
+ myChildren = new LinkedList<LogHierarchyNode>();
+ myMe = me;
+ }
+
+ public void add(final LogEntry child) {
+ myChildren.add(new LogHierarchyNode(child));
+ }
+
+ public List<LogHierarchyNode> getChildren() {
+ return myChildren;
+ }
+
+ public LogEntry getMe() {
+ return myMe;
+ }
+}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/MergeSourceHierarchyBuilder.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/MergeSourceHierarchyBuilder.java
index f0a77198925d..87896a739bca 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/MergeSourceHierarchyBuilder.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/MergeSourceHierarchyBuilder.java
@@ -20,24 +20,23 @@ import com.intellij.util.Consumer;
import com.intellij.util.ThrowableConsumer;
import org.jetbrains.annotations.NotNull;
import org.tmatesoft.svn.core.SVNException;
-import org.tmatesoft.svn.core.SVNLogEntry;
import java.util.List;
/**
* @author Konstantin Kolosovsky.
*/
-public class MergeSourceHierarchyBuilder implements ThrowableConsumer<Pair<SVNLogEntry, Integer>, SVNException> {
+public class MergeSourceHierarchyBuilder implements ThrowableConsumer<Pair<LogEntry, Integer>, SVNException> {
- private TreeStructureNode<SVNLogEntry> myCurrentHierarchy;
- @NotNull private final Consumer<TreeStructureNode<SVNLogEntry>> myConsumer;
+ private LogHierarchyNode myCurrentHierarchy;
+ @NotNull private final Consumer<LogHierarchyNode> myConsumer;
- public MergeSourceHierarchyBuilder(@NotNull Consumer<TreeStructureNode<SVNLogEntry>> consumer) {
+ public MergeSourceHierarchyBuilder(@NotNull Consumer<LogHierarchyNode> consumer) {
myConsumer = consumer;
}
- public void consume(Pair<SVNLogEntry, Integer> svnLogEntryIntegerPair) throws SVNException {
- final SVNLogEntry logEntry = svnLogEntryIntegerPair.getFirst();
+ public void consume(Pair<LogEntry, Integer> svnLogEntryIntegerPair) throws SVNException {
+ final LogEntry logEntry = svnLogEntryIntegerPair.getFirst();
final Integer mergeLevel = svnLogEntryIntegerPair.getSecond();
if (mergeLevel < 0) {
@@ -45,11 +44,11 @@ public class MergeSourceHierarchyBuilder implements ThrowableConsumer<Pair<SVNLo
myConsumer.consume(myCurrentHierarchy);
}
if (logEntry.hasChildren()) {
- myCurrentHierarchy = new TreeStructureNode<SVNLogEntry>(logEntry);
+ myCurrentHierarchy = new LogHierarchyNode(logEntry);
} else {
// just pass
myCurrentHierarchy = null;
- myConsumer.consume(new TreeStructureNode<SVNLogEntry>(logEntry));
+ myConsumer.consume(new LogHierarchyNode(logEntry));
}
} else {
addToLevel(myCurrentHierarchy, logEntry, mergeLevel);
@@ -62,12 +61,12 @@ public class MergeSourceHierarchyBuilder implements ThrowableConsumer<Pair<SVNLo
}
}
- private static void addToLevel(final TreeStructureNode<SVNLogEntry> tree, final SVNLogEntry entry, final int left) {
+ private static void addToLevel(final LogHierarchyNode tree, final LogEntry entry, final int left) {
assert tree != null;
if (left == 0) {
tree.add(entry);
} else {
- final List<TreeStructureNode<SVNLogEntry>> children = tree.getChildren();
+ final List<LogHierarchyNode> children = tree.getChildren();
assert ! children.isEmpty();
addToLevel(children.get(children.size() - 1), entry, left - 1);
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SingleCommittedListProvider.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SingleCommittedListProvider.java
index 6ac6adc3b5cd..d9b37e003961 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SingleCommittedListProvider.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SingleCommittedListProvider.java
@@ -125,8 +125,9 @@ public class SingleCommittedListProvider {
SvnTarget target = SvnTarget.fromURL(url);
myVcs.getFactory(target).createHistoryClient().doLog(target, SVNRevision.HEAD, revisionBefore, false, true, false, 0, null,
- new ISVNLogEntryHandler() {
- public void handleLogEntry(SVNLogEntry logEntry) {
+ new LogEntryConsumer() {
+ @Override
+ public void consume(LogEntry logEntry) {
checkDisposed();
// date could be null for lists where there are paths that user has no rights to observe
if (logEntry.getDate() != null) {
@@ -144,7 +145,7 @@ public class SingleCommittedListProvider {
}
@NotNull
- private SvnChangeList createChangeList(@NotNull SVNLogEntry logEntry) {
+ private SvnChangeList createChangeList(@NotNull LogEntry logEntry) {
return new SvnChangeList(myVcs, svnRootLocation, logEntry, repositoryUrl.toDecodedString());
}
@@ -155,8 +156,9 @@ public class SingleCommittedListProvider {
}
private boolean searchForUrl(@NotNull SVNURL url) throws VcsException {
- ISVNLogEntryHandler handler = new ISVNLogEntryHandler() {
- public void handleLogEntry(SVNLogEntry logEntry) {
+ LogEntryConsumer handler = new LogEntryConsumer() {
+ @Override
+ public void consume(LogEntry logEntry) {
checkDisposed();
// date could be null for lists where there are paths that user has no rights to observe
if (logEntry.getDate() != null) {
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnChangeList.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnChangeList.java
index f894bb3f423e..01f9a213907c 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnChangeList.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnChangeList.java
@@ -40,10 +40,13 @@ import com.intellij.vcsUtil.VcsUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.*;
+import org.jetbrains.idea.svn.api.Depth;
+import org.jetbrains.idea.svn.browse.DirectoryEntry;
+import org.jetbrains.idea.svn.browse.DirectoryEntryConsumer;
import org.jetbrains.idea.svn.commandLine.SvnBindException;
+import org.jetbrains.idea.svn.info.Info;
import org.tmatesoft.svn.core.*;
import org.tmatesoft.svn.core.internal.util.SVNPathUtil;
-import org.tmatesoft.svn.core.wc.SVNInfo;
import org.tmatesoft.svn.core.wc.SVNRevision;
import org.tmatesoft.svn.core.wc2.SvnTarget;
@@ -102,7 +105,7 @@ public class SvnChangeList implements CommittedChangeList {
myKnownAsDirectories = new HashSet<String>(0);
}
- public SvnChangeList(SvnVcs vcs, @NotNull final SvnRepositoryLocation location, final SVNLogEntry logEntry, String repositoryRoot) {
+ public SvnChangeList(SvnVcs vcs, @NotNull final SvnRepositoryLocation location, final LogEntry logEntry, String repositoryRoot) {
myVcs = vcs;
myLocation = location;
myRevision = logEntry.getRevision();
@@ -114,10 +117,10 @@ public class SvnChangeList implements CommittedChangeList {
myCommonPathSearcher = new CommonPathSearcher();
myKnownAsDirectories = new HashSet<String>(0);
- for(SVNLogEntryPath entry : logEntry.getChangedPaths().values()) {
+ for(LogEntryPath entry : logEntry.getChangedPaths().values()) {
final String path = entry.getPath();
- if (SVNNodeKind.DIR.equals(entry.getKind())) {
+ if (entry.isDirectory()) {
myKnownAsDirectories.add(path);
}
@@ -394,8 +397,8 @@ public class SvnChangeList implements CommittedChangeList {
// TODO: Logic with detecting "isDirectory" status is not clear enough. Why we can't just collect this info from logEntry and
// TODO: if loading from disk - use cached values? Not to invoke separate call here.
SVNRevision beforeRevision = SVNRevision.create(getRevision(idxData.second.booleanValue()));
- SVNInfo info = myVcs.getInfo(SvnUtil.createUrl(revision.getFullPath()), beforeRevision, beforeRevision);
- boolean isDirectory = info != null && SVNNodeKind.DIR.equals(info.getKind());
+ Info info = myVcs.getInfo(SvnUtil.createUrl(revision.getFullPath()), beforeRevision, beforeRevision);
+ boolean isDirectory = info != null && info.isDirectory();
Change replacingChange = new Change(createRevision((SvnRepositoryContentRevision)sourceChange.getBeforeRevision(), isDirectory),
createRevision((SvnRepositoryContentRevision)sourceChange.getAfterRevision(), isDirectory));
replacingChange.setIsReplaced(sourceChange.isIsReplaced());
@@ -478,12 +481,14 @@ public class SvnChangeList implements CommittedChangeList {
SVNRevision revisionNumber = SVNRevision.create(getRevision(isBefore));
SvnTarget target = SvnTarget.fromURL(fullPath, revisionNumber);
- myVcs.getFactory(target).createBrowseClient().list(target, revisionNumber, SVNDepth.INFINITY, new ISVNDirEntryHandler() {
- public void handleDirEntry(final SVNDirEntry dirEntry) throws SVNException {
- final String childPath = path + '/' + dirEntry.getRelativePath();
+ myVcs.getFactory(target).createBrowseClient().list(target, revisionNumber, Depth.INFINITY, new DirectoryEntryConsumer() {
+
+ @Override
+ public void consume(final DirectoryEntry entry) throws SVNException {
+ final String childPath = path + '/' + entry.getRelativePath();
if (!duplicates.contains(Pair.create(isBefore, childPath))) {
- final ContentRevision contentRevision = createRevision(childPath, isBefore, SVNNodeKind.DIR.equals(dirEntry.getKind()));
+ final ContentRevision contentRevision = createRevision(childPath, isBefore, entry.isDirectory());
result.add(new Change(isBefore ? contentRevision : null, isBefore ? null : contentRevision));
}
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnCommittedChangesProvider.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnCommittedChangesProvider.java
index 556ef1e9ebbe..83642894711e 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnCommittedChangesProvider.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnCommittedChangesProvider.java
@@ -49,12 +49,13 @@ import org.jetbrains.idea.svn.SvnBundle;
import org.jetbrains.idea.svn.SvnUtil;
import org.jetbrains.idea.svn.SvnVcs;
import org.jetbrains.idea.svn.actions.ConfigureBranchesAction;
+import org.jetbrains.idea.svn.api.Depth;
import org.jetbrains.idea.svn.commandLine.SvnBindException;
+import org.jetbrains.idea.svn.status.Status;
+import org.jetbrains.idea.svn.status.StatusConsumer;
+import org.jetbrains.idea.svn.status.StatusType;
import org.tmatesoft.svn.core.*;
-import org.tmatesoft.svn.core.wc.ISVNStatusHandler;
import org.tmatesoft.svn.core.wc.SVNRevision;
-import org.tmatesoft.svn.core.wc.SVNStatus;
-import org.tmatesoft.svn.core.wc.SVNStatusType;
import org.tmatesoft.svn.core.wc2.SvnTarget;
import java.io.DataInput;
@@ -139,8 +140,8 @@ public class SvnCommittedChangesProvider implements CachingCommittedChangesProvi
final String repositoryRoot = getRepositoryRoot(svnLocation);
final ChangeBrowserSettings.Filter filter = settings.createFilter();
- getCommittedChangesImpl(settings, svnLocation, maxCount, new Consumer<SVNLogEntry>() {
- public void consume(final SVNLogEntry svnLogEntry) {
+ getCommittedChangesImpl(settings, svnLocation, maxCount, new Consumer<LogEntry>() {
+ public void consume(final LogEntry svnLogEntry) {
final SvnChangeList cl = new SvnChangeList(myVcs, svnLocation, svnLogEntry, repositoryRoot);
if (filter.accepts(cl)) {
consumer.consume(cl);
@@ -158,8 +159,8 @@ public class SvnCommittedChangesProvider implements CachingCommittedChangesProvi
final ArrayList<SvnChangeList> result = new ArrayList<SvnChangeList>();
final String repositoryRoot = getRepositoryRoot(svnLocation);
- getCommittedChangesImpl(settings, svnLocation, maxCount, new Consumer<SVNLogEntry>() {
- public void consume(final SVNLogEntry svnLogEntry) {
+ getCommittedChangesImpl(settings, svnLocation, maxCount, new Consumer<LogEntry>() {
+ public void consume(final LogEntry svnLogEntry) {
result.add(new SvnChangeList(myVcs, svnLocation, svnLogEntry, repositoryRoot));
}
}, false, true);
@@ -169,24 +170,24 @@ public class SvnCommittedChangesProvider implements CachingCommittedChangesProvi
public void getCommittedChangesWithMergedRevisons(final ChangeBrowserSettings settings,
final RepositoryLocation location, final int maxCount,
- final PairConsumer<SvnChangeList, TreeStructureNode<SVNLogEntry>> finalConsumer)
+ final PairConsumer<SvnChangeList, LogHierarchyNode> finalConsumer)
throws VcsException {
final SvnRepositoryLocation svnLocation = (SvnRepositoryLocation) location;
final String repositoryRoot = getRepositoryRoot(svnLocation);
- final MergeSourceHierarchyBuilder builder = new MergeSourceHierarchyBuilder(new Consumer<TreeStructureNode<SVNLogEntry>>() {
- public void consume(TreeStructureNode<SVNLogEntry> node) {
+ final MergeSourceHierarchyBuilder builder = new MergeSourceHierarchyBuilder(new Consumer<LogHierarchyNode>() {
+ public void consume(LogHierarchyNode node) {
finalConsumer.consume(new SvnChangeList(myVcs, svnLocation, node.getMe(), repositoryRoot), node);
}
});
- final SvnMergeSourceTracker mergeSourceTracker = new SvnMergeSourceTracker(new ThrowableConsumer<Pair<SVNLogEntry, Integer>, SVNException>() {
- public void consume(Pair<SVNLogEntry, Integer> svnLogEntryIntegerPair) throws SVNException {
+ final SvnMergeSourceTracker mergeSourceTracker = new SvnMergeSourceTracker(new ThrowableConsumer<Pair<LogEntry, Integer>, SVNException>() {
+ public void consume(Pair<LogEntry, Integer> svnLogEntryIntegerPair) throws SVNException {
builder.consume(svnLogEntryIntegerPair);
}
});
- getCommittedChangesImpl(settings, svnLocation, maxCount, new Consumer<SVNLogEntry>() {
- public void consume(final SVNLogEntry svnLogEntry) {
+ getCommittedChangesImpl(settings, svnLocation, maxCount, new Consumer<LogEntry>() {
+ public void consume(final LogEntry svnLogEntry) {
try {
mergeSourceTracker.consume(svnLogEntry);
}
@@ -204,13 +205,7 @@ public class SvnCommittedChangesProvider implements CachingCommittedChangesProvi
// TODO: Additionally SvnRepositoryLocation could possibly be refactored to always contain FilePath (or similar local item)
// TODO: So here we could get repository url without performing remote svn command
- SVNURL rootUrl;
- try {
- rootUrl = SvnUtil.getRepositoryRoot(myVcs, svnLocation.toSvnUrl());
- }
- catch (SVNException e) {
- throw new SvnBindException(e);
- }
+ SVNURL rootUrl = SvnUtil.getRepositoryRoot(myVcs, svnLocation.toSvnUrl());
if (rootUrl == null) {
throw new SvnBindException("Could not resolve repository root url for " + svnLocation);
@@ -220,7 +215,7 @@ public class SvnCommittedChangesProvider implements CachingCommittedChangesProvi
}
private void getCommittedChangesImpl(ChangeBrowserSettings settings, final SvnRepositoryLocation location,
- final int maxCount, final Consumer<SVNLogEntry> resultConsumer, final boolean includeMergedRevisions,
+ final int maxCount, final Consumer<LogEntry> resultConsumer, final boolean includeMergedRevisions,
final boolean filterOutByDate) throws VcsException {
setCollectingChangesProgress(location);
@@ -258,11 +253,12 @@ public class SvnCommittedChangesProvider implements CachingCommittedChangesProvi
}
@NotNull
- private ISVNLogEntryHandler createLogHandler(final Consumer<SVNLogEntry> resultConsumer,
+ private LogEntryConsumer createLogHandler(final Consumer<LogEntry> resultConsumer,
final boolean filterOutByDate,
final String author) {
- return new ISVNLogEntryHandler() {
- public void handleLogEntry(SVNLogEntry logEntry) {
+ return new LogEntryConsumer() {
+ @Override
+ public void consume(LogEntry logEntry) {
if (myProject.isDisposed()) throw new ProcessCanceledException();
ProgressManager.progress2(SvnBundle.message("progress.text2.processing.revision", logEntry.getRevision()));
@@ -381,31 +377,26 @@ public class SvnCommittedChangesProvider implements CachingCommittedChangesProvi
final Set<FilePath> result = ContainerUtil.newHashSet();
File rootFile = root.getIOFile();
- try {
- myVcs.getFactory(rootFile).createStatusClient()
- .doStatus(rootFile, SVNRevision.UNDEFINED, SVNDepth.INFINITY, true, false, false, false, new ISVNStatusHandler() {
- @Override
- public void handleStatus(SVNStatus status) throws SVNException {
- File file = status.getFile();
- boolean changedOnServer = isNotNone(status.getRemoteContentsStatus()) ||
- isNotNone(status.getRemoteNodeStatus()) ||
- isNotNone(status.getRemotePropertiesStatus());
-
- if (file != null && changedOnServer) {
- result.add(VcsUtil.getFilePath(file, file.isDirectory()));
- }
+ myVcs.getFactory(rootFile).createStatusClient()
+ .doStatus(rootFile, SVNRevision.UNDEFINED, Depth.INFINITY, true, false, false, false, new StatusConsumer() {
+ @Override
+ public void consume(Status status) throws SVNException {
+ File file = status.getFile();
+ boolean changedOnServer = isNotNone(status.getRemoteContentsStatus()) ||
+ isNotNone(status.getRemoteNodeStatus()) ||
+ isNotNone(status.getRemotePropertiesStatus());
+
+ if (file != null && changedOnServer) {
+ result.add(VcsUtil.getFilePath(file, file.isDirectory()));
}
- }, null);
- }
- catch (SVNException e) {
- throw new SvnBindException(e);
- }
+ }
+ }, null);
return result;
}
- private static boolean isNotNone(@Nullable SVNStatusType status) {
- return status != null && !SVNStatusType.STATUS_NONE.equals(status);
+ private static boolean isNotNone(@Nullable StatusType status) {
+ return status != null && !StatusType.STATUS_NONE.equals(status);
}
public boolean refreshCacheByNumber() {
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnCopyPathTracker.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnCopyPathTracker.java
index 70e982aeff8e..413e05bdd781 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnCopyPathTracker.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnCopyPathTracker.java
@@ -22,8 +22,6 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.SvnFileUrlMapping;
import org.jetbrains.idea.svn.SvnVcs;
-import org.tmatesoft.svn.core.SVNLogEntry;
-import org.tmatesoft.svn.core.SVNLogEntryPath;
import org.tmatesoft.svn.core.internal.util.SVNPathUtil;
import java.io.File;
@@ -45,12 +43,12 @@ public class SvnCopyPathTracker {
myCurrentPath = relativeUrl;
}
- public void accept(@NotNull final SVNLogEntry entry) {
+ public void accept(@NotNull final LogEntry entry) {
final Map changedPaths = entry.getChangedPaths();
if (changedPaths == null) return;
for (Object o : changedPaths.values()) {
- final SVNLogEntryPath entryPath = (SVNLogEntryPath) o;
+ final LogEntryPath entryPath = (LogEntryPath) o;
if (entryPath != null && 'A' == entryPath.getType() && entryPath.getCopyPath() != null) {
if (myCurrentPath.equals(entryPath.getPath())) {
myHadChanged = true;
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnFileRevision.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnFileRevision.java
index 046e16c148a4..007df92a403b 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnFileRevision.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnFileRevision.java
@@ -26,12 +26,13 @@ import com.intellij.openapi.vcs.actions.VcsContextFactory;
import com.intellij.openapi.vcs.history.VcsFileRevision;
import com.intellij.openapi.vcs.history.VcsRevisionNumber;
import com.intellij.openapi.vcs.impl.ContentRevisionCache;
+import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.SvnBundle;
import org.jetbrains.idea.svn.SvnRevisionNumber;
import org.jetbrains.idea.svn.SvnUtil;
import org.jetbrains.idea.svn.SvnVcs;
-import org.tmatesoft.svn.core.SVNLogEntry;
+import org.jetbrains.idea.svn.checkin.CommitInfo;
import org.tmatesoft.svn.core.wc.SVNRevision;
import org.tmatesoft.svn.core.wc2.SvnTarget;
@@ -47,7 +48,7 @@ public class SvnFileRevision implements VcsFileRevision {
private final Date myDate;
private String myCommitMessage;
private final String myAuthor;
- private final VcsRevisionNumber myRevisionNumber;
+ private final SvnRevisionNumber myRevisionNumber;
private final SvnVcs myVCS;
private final String myURL;
private final SVNRevision myPegRevision;
@@ -79,7 +80,7 @@ public class SvnFileRevision implements VcsFileRevision {
public SvnFileRevision(SvnVcs vcs,
SVNRevision pegRevision,
- SVNLogEntry logEntry,
+ LogEntry logEntry,
String url,
String copyFromPath, Charset charset) {
myCharset = charset;
@@ -96,6 +97,11 @@ public class SvnFileRevision implements VcsFileRevision {
myMergeSources = new ArrayList<SvnFileRevision>();
}
+ @NotNull
+ public CommitInfo getCommitInfo() {
+ return new CommitInfo.Builder(myRevisionNumber.getRevision().getNumber(), myDate, myAuthor).build();
+ }
+
public String getURL() {
return myURL;
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnHistoryProvider.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnHistoryProvider.java
index 92b619a7465f..9e9dd7e1befc 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnHistoryProvider.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnHistoryProvider.java
@@ -40,10 +40,11 @@ import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.*;
+import org.jetbrains.idea.svn.commandLine.SvnBindException;
+import org.jetbrains.idea.svn.info.Info;
import org.tmatesoft.svn.core.*;
import org.tmatesoft.svn.core.internal.util.SVNPathUtil;
import org.tmatesoft.svn.core.internal.wc.SVNErrorManager;
-import org.tmatesoft.svn.core.wc.SVNInfo;
import org.tmatesoft.svn.core.wc.SVNRevision;
import org.tmatesoft.svn.core.wc2.SvnTarget;
import org.tmatesoft.svn.util.SVNLogType;
@@ -284,7 +285,7 @@ public class SvnHistoryProvider
}
private static class LocalLoader extends LogLoader {
- private SVNInfo myInfo;
+ private Info myInfo;
private LocalLoader(SvnVcs vcs, FilePath file, SVNRevision from, SVNRevision to, int limit, SVNRevision peg, boolean showMergeSources) {
super(vcs, file, from, to, limit, peg, showMergeSources);
@@ -419,7 +420,7 @@ public class SvnHistoryProvider
private void loadBackwards(SVNURL svnurl) throws SVNException, VcsException {
// this method is called when svnurl does not exist in latest repository revision - thus concrete old revision is used for "info"
// command to get repository url
- SVNInfo info = myVcs.getInfo(svnurl, myPeg, myPeg);
+ Info info = myVcs.getInfo(svnurl, myPeg, myPeg);
final SVNURL rootURL = info != null ? info.getRepositoryRootURL() : null;
final String root = rootURL != null ? rootURL.toString() : "";
String relativeUrl = myUrl;
@@ -444,11 +445,11 @@ public class SvnHistoryProvider
}
private boolean existsNow(SVNURL svnurl) {
- final SVNInfo info;
+ final Info info;
try {
info = myVcs.getInfo(svnurl, SVNRevision.HEAD, SVNRevision.HEAD);
}
- catch (SVNException e) {
+ catch (SvnBindException e) {
return false;
}
return info != null && info.getURL() != null && info.getRevision().isValid();
@@ -470,7 +471,7 @@ public class SvnHistoryProvider
return false;
}
- private static class MyLogEntryHandler implements ISVNLogEntryHandler {
+ private static class MyLogEntryHandler implements LogEntryConsumer {
private final ProgressIndicator myIndicator;
protected final SvnVcs myVcs;
protected final SvnPathThroughHistoryCorrection myLastPathCorrector;
@@ -503,10 +504,10 @@ public class SvnHistoryProvider
myPegRevision = pegRevision;
myUrl = url;
myRepositoryRoot = repoRootURL;
- myTracker = new SvnMergeSourceTracker(new ThrowableConsumer<Pair<SVNLogEntry, Integer>, SVNException>() {
+ myTracker = new SvnMergeSourceTracker(new ThrowableConsumer<Pair<LogEntry, Integer>, SVNException>() {
@Override
- public void consume(final Pair<SVNLogEntry, Integer> svnLogEntryIntegerPair) throws SVNException {
- final SVNLogEntry logEntry = svnLogEntryIntegerPair.getFirst();
+ public void consume(final Pair<LogEntry, Integer> svnLogEntryIntegerPair) throws SVNException {
+ final LogEntry logEntry = svnLogEntryIntegerPair.getFirst();
if (myIndicator != null) {
if (myIndicator.isCanceled()) {
@@ -514,12 +515,12 @@ public class SvnHistoryProvider
}
myIndicator.setText2(SvnBundle.message("progress.text2.revision.processed", logEntry.getRevision()));
}
- SVNLogEntryPath entryPath = null;
+ LogEntryPath entryPath = null;
String copyPath = null;
final int mergeLevel = svnLogEntryIntegerPair.getSecond();
if (! myLastPathCorrector.isRoot()) {
- myLastPathCorrector.handleLogEntry(logEntry);
+ myLastPathCorrector.consume(logEntry);
entryPath = myLastPathCorrector.getDirectlyMentioned();
copyPath = null;
if (entryPath != null) {
@@ -528,7 +529,7 @@ public class SvnHistoryProvider
// if there are no path with exact match, check whether parent or child paths had changed
// "entry path" is allowed to be null now; if it is null, last path would be taken for revision construction
- // Separate SVNLogEntry is issued for each "merge source" revision. These "merge source" revisions are treated as child
+ // Separate LogEntry is issued for each "merge source" revision. These "merge source" revisions are treated as child
// revisions of some other revision - this way we construct merge hierarchy.
// mergeLevel >= 0 indicates that we are currently processing some "merge source" revision. This "merge source" revision
// contains changes from some other branch - so checkForChildChanges() and checkForParentChanges() return "false".
@@ -556,11 +557,11 @@ public class SvnHistoryProvider
});
}
- private boolean checkForParentChanges(SVNLogEntry logEntry) {
+ private boolean checkForParentChanges(LogEntry logEntry) {
final String lastPathBefore = myLastPathCorrector.getBefore();
String path = SVNPathUtil.removeTail(lastPathBefore);
while (path.length() > 0) {
- final SVNLogEntryPath entryPath = logEntry.getChangedPaths().get(path);
+ final LogEntryPath entryPath = logEntry.getChangedPaths().get(path);
// A & D are checked since we are not interested in parent folders property changes, only in structure changes
// TODO: seems that R (replaced) should also be checked here
if (entryPath != null && (entryPath.getType() == 'A' || entryPath.getType() == 'D')) {
@@ -576,7 +577,7 @@ public class SvnHistoryProvider
// TODO: this makes sense only for directories, but should always return true if something under the directory was changed in revision
// TODO: as svn will provide child changes in history for directory
- private boolean checkForChildChanges(SVNLogEntry logEntry) {
+ private boolean checkForChildChanges(LogEntry logEntry) {
final String lastPathBefore = myLastPathCorrector.getBefore();
for (String key : logEntry.getChangedPaths().keySet()) {
if (SVNPathUtil.isAncestor(lastPathBefore, key)) {
@@ -587,7 +588,7 @@ public class SvnHistoryProvider
}
@Override
- public void handleLogEntry(SVNLogEntry logEntry) throws SVNException {
+ public void consume(LogEntry logEntry) throws SVNException {
myTracker.consume(logEntry);
}
@@ -605,7 +606,7 @@ public class SvnHistoryProvider
}
}
- protected SvnFileRevision createRevision(final SVNLogEntry logEntry, final String copyPath, SVNLogEntryPath entryPath) throws SVNException {
+ protected SvnFileRevision createRevision(final LogEntry logEntry, final String copyPath, LogEntryPath entryPath) throws SVNException {
Date date = logEntry.getDate();
String author = logEntry.getAuthor();
String message = logEntry.getMessage();
@@ -628,7 +629,7 @@ public class SvnHistoryProvider
}
@Override
- protected SvnFileRevision createRevision(final SVNLogEntry logEntry, final String copyPath, SVNLogEntryPath entryPath)
+ protected SvnFileRevision createRevision(final LogEntry logEntry, final String copyPath, LogEntryPath entryPath)
throws SVNException {
final SVNURL url = entryPath == null ? myRepositoryRoot.appendPath(myLastPathCorrector.getBefore(), false) :
myRepositoryRoot.appendPath(entryPath.getPath(), true);
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnHistorySession.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnHistorySession.java
index 171b39cad623..f2f91bceec14 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnHistorySession.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnHistorySession.java
@@ -20,7 +20,7 @@ import com.intellij.openapi.vcs.history.*;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.SvnRevisionNumber;
import org.jetbrains.idea.svn.SvnVcs;
-import org.tmatesoft.svn.core.wc.SVNInfo;
+import org.jetbrains.idea.svn.info.Info;
import org.tmatesoft.svn.core.wc.SVNRevision;
import java.io.File;
@@ -69,7 +69,7 @@ public class SvnHistorySession extends VcsAbstractHistorySession {
}
public static VcsRevisionNumber getCurrentCommittedRevision(final SvnVcs vcs, final File file) {
- SVNInfo info = vcs.getInfo(file);
+ Info info = vcs.getInfo(file);
return info != null ? new SvnRevisionNumber(info.getCommittedRevision()) : null;
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnKitHistoryClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnKitHistoryClient.java
index ca387bc9ca41..0aca8300e420 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnKitHistoryClient.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnKitHistoryClient.java
@@ -8,6 +8,7 @@ import org.jetbrains.idea.svn.api.BaseSvnClient;
import org.jetbrains.idea.svn.commandLine.SvnBindException;
import org.tmatesoft.svn.core.ISVNLogEntryHandler;
import org.tmatesoft.svn.core.SVNException;
+import org.tmatesoft.svn.core.SVNLogEntry;
import org.tmatesoft.svn.core.wc.SVNLogClient;
import org.tmatesoft.svn.core.wc.SVNRevision;
import org.tmatesoft.svn.core.wc2.SvnTarget;
@@ -28,22 +29,38 @@ public class SvnKitHistoryClient extends BaseSvnClient implements HistoryClient
boolean includeMergedRevisions,
long limit,
@Nullable String[] revisionProperties,
- @Nullable ISVNLogEntryHandler handler) throws VcsException {
+ @Nullable LogEntryConsumer handler) throws VcsException {
try {
// TODO: a bug noticed when testing: we should pass "limit + 1" to get "limit" rows
SVNLogClient client = myVcs.getSvnKitManager().createLogClient();
if (target.isFile()) {
client.doLog(new File[]{target.getFile()}, startRevision, endRevision, target.getPegRevision(), stopOnCopy, discoverChangedPaths,
- includeMergedRevisions, limit, revisionProperties, handler);
+ includeMergedRevisions, limit, revisionProperties, toHandler(handler));
}
else {
client.doLog(target.getURL(), ArrayUtil.EMPTY_STRING_ARRAY, target.getPegRevision(), startRevision, endRevision, stopOnCopy,
- discoverChangedPaths, includeMergedRevisions, limit, revisionProperties, handler);
+ discoverChangedPaths, includeMergedRevisions, limit, revisionProperties, toHandler(handler));
}
}
catch (SVNException e) {
throw new SvnBindException(e);
}
}
+
+ @Nullable
+ private static ISVNLogEntryHandler toHandler(@Nullable final LogEntryConsumer handler) {
+ ISVNLogEntryHandler result = null;
+
+ if (handler != null) {
+ result = new ISVNLogEntryHandler() {
+ @Override
+ public void handleLogEntry(SVNLogEntry logEntry) throws SVNException {
+ handler.consume(LogEntry.create(logEntry));
+ }
+ };
+ }
+
+ return result;
+ }
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnLogUtil.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnLogUtil.java
index 7f4f25f023a9..878f38e6a748 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnLogUtil.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnLogUtil.java
@@ -24,8 +24,6 @@ import com.intellij.openapi.vcs.versionBrowser.CommittedChangeList;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.idea.svn.SvnBundle;
import org.jetbrains.idea.svn.SvnVcs;
-import org.tmatesoft.svn.core.ISVNLogEntryHandler;
-import org.tmatesoft.svn.core.SVNLogEntry;
import org.tmatesoft.svn.core.SVNURL;
import org.tmatesoft.svn.core.wc.SVNRevision;
import org.tmatesoft.svn.core.wc2.SvnTarget;
@@ -50,7 +48,7 @@ public class SvnLogUtil implements SvnLogLoader {
final int maxCount, final boolean includingYoungest, final boolean includeOldest)
throws VcsException {
final List<CommittedChangeList> result = new ArrayList<CommittedChangeList>();
- ISVNLogEntryHandler handler = createLogHandler(fromIncluding, toIncluding, includingYoungest, includeOldest, result);
+ LogEntryConsumer handler = createLogHandler(fromIncluding, toIncluding, includingYoungest, includeOldest, result);
SvnTarget target = SvnTarget.fromURL(myLocation.toSvnUrl());
myVcs.getFactory(target).createHistoryClient().doLog(target, fromIncluding, toIncluding, true, true, false, maxCount, null, handler);
@@ -59,12 +57,13 @@ public class SvnLogUtil implements SvnLogLoader {
}
@NotNull
- private ISVNLogEntryHandler createLogHandler(final SVNRevision fromIncluding,
+ private LogEntryConsumer createLogHandler(final SVNRevision fromIncluding,
final SVNRevision toIncluding,
final boolean includingYoungest,
final boolean includeOldest, final List<CommittedChangeList> result) {
- return new ISVNLogEntryHandler() {
- public void handleLogEntry(SVNLogEntry logEntry) {
+ return new LogEntryConsumer() {
+ @Override
+ public void consume(LogEntry logEntry) {
if (myProject.isDisposed()) throw new ProcessCanceledException();
final ProgressIndicator progress = ProgressManager.getInstance().getProgressIndicator();
if (progress != null) {
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnMergeSourceDetails.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnMergeSourceDetails.java
index f3ed60277dd5..be0722b6fc0c 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnMergeSourceDetails.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnMergeSourceDetails.java
@@ -21,6 +21,7 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.openapi.ui.MasterDetailsComponent;
import com.intellij.openapi.ui.NamedConfigurable;
+import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.vcs.changes.committed.CommittedChangeListRenderer;
import com.intellij.openapi.vcs.changes.ui.ChangeListViewerDialog;
@@ -73,6 +74,8 @@ public class SvnMergeSourceDetails extends MasterDetailsComponent {
final ContentManager contentManager = toolWindow.getContentManager();
final MyDialog dialog = new MyDialog(project, revision, file);
+ // TODO: Temporary memory leak fix - rewrite this part not to create dialog if only createCenterPanel(), but not show() is invoked
+ Disposer.register(project, dialog.getDisposable());
Content content = ContentFactory.SERVICE.getInstance().createContent(dialog.createCenterPanel(),
SvnBundle.message("merge.source.details.title", (file == null) ? revision.getURL() : file.getName(), revision.getRevisionNumber().asString()), true);
@@ -213,7 +216,10 @@ public class SvnMergeSourceDetails extends MasterDetailsComponent {
if (list == null) {
myPanel = new JPanel();
} else {
- myPanel = new ChangeListViewerDialog(myProject, list).createCenterPanel();
+ ChangeListViewerDialog dialog = new ChangeListViewerDialog(myProject, list);
+ // TODO: Temporary memory leak fix - rewrite this part not to create dialog if only createCenterPanel(), but not show() is invoked
+ Disposer.register(myProject, dialog.getDisposable());
+ myPanel = dialog.createCenterPanel();
}
}
return myPanel;
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnMergeSourceTracker.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnMergeSourceTracker.java
index 53f151876ec9..023d8489d795 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnMergeSourceTracker.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnMergeSourceTracker.java
@@ -18,24 +18,23 @@ package org.jetbrains.idea.svn.history;
import com.intellij.openapi.util.Pair;
import com.intellij.util.ThrowableConsumer;
import org.tmatesoft.svn.core.SVNException;
-import org.tmatesoft.svn.core.SVNLogEntry;
public class SvnMergeSourceTracker {
private int myMergeLevel;
// -1 - not merge source; 0 - direct merge source
- private ThrowableConsumer<Pair<SVNLogEntry, Integer>, SVNException> myConsumer;
+ private ThrowableConsumer<Pair<LogEntry, Integer>, SVNException> myConsumer;
- public SvnMergeSourceTracker(final ThrowableConsumer<Pair<SVNLogEntry, Integer>, SVNException> consumer) {
+ public SvnMergeSourceTracker(final ThrowableConsumer<Pair<LogEntry, Integer>, SVNException> consumer) {
myConsumer = consumer;
myMergeLevel = -1;
}
- public void consume(final SVNLogEntry logEntry) throws SVNException {
+ public void consume(final LogEntry logEntry) throws SVNException {
if (logEntry.getRevision() < 0) {
-- myMergeLevel;
return;
}
- myConsumer.consume(new Pair<SVNLogEntry, Integer>(logEntry, myMergeLevel));
+ myConsumer.consume(new Pair<LogEntry, Integer>(logEntry, myMergeLevel));
if (logEntry.hasChildren()) {
++ myMergeLevel;
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnPathThroughHistoryCorrection.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnPathThroughHistoryCorrection.java
index 8ecb8a3b1e90..bf6c08e74759 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnPathThroughHistoryCorrection.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnPathThroughHistoryCorrection.java
@@ -17,10 +17,7 @@ package org.jetbrains.idea.svn.history;
import com.intellij.openapi.util.text.StringUtil;
import org.jetbrains.idea.svn.SvnUtil;
-import org.tmatesoft.svn.core.ISVNLogEntryHandler;
import org.tmatesoft.svn.core.SVNException;
-import org.tmatesoft.svn.core.SVNLogEntry;
-import org.tmatesoft.svn.core.SVNLogEntryPath;
import org.tmatesoft.svn.core.internal.util.SVNPathUtil;
import java.util.Map;
@@ -33,10 +30,10 @@ import java.util.Map;
*
* We consider here, that history is traversed "from now to past"
*/
-public class SvnPathThroughHistoryCorrection implements ISVNLogEntryHandler {
+public class SvnPathThroughHistoryCorrection implements LogEntryConsumer {
private String myBefore;
private String myPath;
- private SVNLogEntryPath myDirectlyMentioned;
+ private LogEntryPath myDirectlyMentioned;
private boolean myRoot;
public SvnPathThroughHistoryCorrection(String path) {
@@ -46,14 +43,14 @@ public class SvnPathThroughHistoryCorrection implements ISVNLogEntryHandler {
}
@Override
- public void handleLogEntry(SVNLogEntry logEntry) throws SVNException {
+ public void consume(LogEntry logEntry) throws SVNException {
if (myRoot) {
return;
}
myBefore = myPath;
myDirectlyMentioned = null;
- final Map<String,SVNLogEntryPath> paths = logEntry.getChangedPaths();
- final SVNLogEntryPath entryPath = paths.get(myPath);
+ final Map<String,LogEntryPath> paths = logEntry.getChangedPaths();
+ final LogEntryPath entryPath = paths.get(myPath);
if (entryPath != null) {
myDirectlyMentioned = entryPath;
// exact match
@@ -62,7 +59,7 @@ public class SvnPathThroughHistoryCorrection implements ISVNLogEntryHandler {
return;
}
}
- for (SVNLogEntryPath path : paths.values()) {
+ for (LogEntryPath path : paths.values()) {
// "the origin path *from where* the item, ..."
// TODO: this could incorrectly handle case when parent folder was replaced - see IDEA-103042
// TODO: or several parent folder renames occur IDEA-96825
@@ -89,7 +86,7 @@ public class SvnPathThroughHistoryCorrection implements ISVNLogEntryHandler {
return myBefore;
}
- public SVNLogEntryPath getDirectlyMentioned() {
+ public LogEntryPath getDirectlyMentioned() {
return myDirectlyMentioned;
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnRevisionsNavigationMediator.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnRevisionsNavigationMediator.java
index 7a11aee32c48..ca69ba7a58ec 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnRevisionsNavigationMediator.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnRevisionsNavigationMediator.java
@@ -28,8 +28,8 @@ import com.intellij.openapi.vcs.changes.committed.CommittedChangesNavigation;
import com.intellij.openapi.vcs.versionBrowser.CommittedChangeList;
import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.idea.svn.SvnVcs;
-import org.tmatesoft.svn.core.SVNException;
-import org.tmatesoft.svn.core.wc.SVNInfo;
+import org.jetbrains.idea.svn.commandLine.SvnBindException;
+import org.jetbrains.idea.svn.info.Info;
import org.tmatesoft.svn.core.wc.SVNRevision;
import java.util.*;
@@ -56,7 +56,7 @@ public class SvnRevisionsNavigationMediator implements CommittedChangesNavigatio
myChunks = new LinkedList<List<Fragment>>();
final VcsException[] exception = new VcsException[1];
- final Ref<SVNInfo> infoRef = new Ref<SVNInfo>();
+ final Ref<Info> infoRef = new Ref<Info>();
Runnable process = new Runnable() {
@Override
@@ -64,17 +64,14 @@ public class SvnRevisionsNavigationMediator implements CommittedChangesNavigatio
try {
infoRef.set(vcs.getInfo(location.toSvnUrl(), SVNRevision.HEAD));
}
- catch (VcsException e) {
+ catch (SvnBindException e) {
exception[0] = e;
}
- catch (SVNException e) {
- exception[0] = new VcsException(e);
- }
}
};
underProgress(exception, process);
- SVNInfo info = infoRef.get();
+ Info info = infoRef.get();
if (info == null || info.getRevision() == null || info.getRepositoryRootURL() == null) {
throw new VcsException("Could not get head info for " + location);
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/TreeStructureNode.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/TreeStructureNode.java
deleted file mode 100644
index 370f54f9ef22..000000000000
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/TreeStructureNode.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright 2000-2010 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jetbrains.idea.svn.history;
-
-import java.util.LinkedList;
-import java.util.List;
-
-public class TreeStructureNode<T> {
- private final T myMe;
- private final List<TreeStructureNode<T>> myChildren;
-
- public TreeStructureNode(final T me) {
- myChildren = new LinkedList<TreeStructureNode<T>>();
- myMe = me;
- }
-
- public void add(final T child) {
- myChildren.add(new TreeStructureNode<T>(child));
- }
-
- public List<TreeStructureNode<T>> getChildren() {
- return myChildren;
- }
-
- public T getMe() {
- return myMe;
- }
-}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/ignore/SvnPropertyService.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/ignore/SvnPropertyService.java
index 2bd8627de196..8a9dbf760922 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/ignore/SvnPropertyService.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/ignore/SvnPropertyService.java
@@ -23,7 +23,7 @@ import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.idea.svn.SvnPropertyKeys;
import org.jetbrains.idea.svn.SvnVcs;
-import org.tmatesoft.svn.core.SVNDepth;
+import org.jetbrains.idea.svn.api.Depth;
import org.tmatesoft.svn.core.SVNPropertyValue;
import org.tmatesoft.svn.core.wc.SVNPropertyData;
import org.tmatesoft.svn.core.wc.SVNRevision;
@@ -187,7 +187,7 @@ public class SvnPropertyService {
String newValue = getNewPropertyValue(data, propertyValue);
newValue = (newValue.trim().isEmpty()) ? null : newValue;
myVcs.getFactory(folderDir).createPropertyClient()
- .setProperty(folderDir, SvnPropertyKeys.SVN_IGNORE, SVNPropertyValue.create(newValue), SVNDepth.EMPTY, false);
+ .setProperty(folderDir, SvnPropertyKeys.SVN_IGNORE, SVNPropertyValue.create(newValue), Depth.EMPTY, false);
if (myUseCommonExtension) {
dirtyScopeManager.dirDirtyRecursively(folder);
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/info/CmdInfoClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/info/CmdInfoClient.java
index 475dd1a4f77d..91eb7ce42e3e 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/info/CmdInfoClient.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/info/CmdInfoClient.java
@@ -20,17 +20,16 @@ import com.intellij.execution.process.ProcessOutputTypes;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.openapi.vcs.VcsException;
import com.intellij.openapi.vfs.CharsetToolkit;
import com.intellij.util.Consumer;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.api.BaseSvnClient;
+import org.jetbrains.idea.svn.api.Depth;
import org.jetbrains.idea.svn.commandLine.*;
-import org.tmatesoft.svn.core.*;
-import org.tmatesoft.svn.core.wc.ISVNInfoHandler;
-import org.tmatesoft.svn.core.wc.SVNInfo;
+import org.tmatesoft.svn.core.SVNException;
+import org.tmatesoft.svn.core.SVNURL;
import org.tmatesoft.svn.core.wc.SVNRevision;
import org.tmatesoft.svn.core.wc2.SvnTarget;
import org.xml.sax.SAXException;
@@ -41,7 +40,6 @@ import javax.xml.parsers.SAXParserFactory;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
-import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
@@ -55,48 +53,7 @@ public class CmdInfoClient extends BaseSvnClient implements InfoClient {
private static final Logger LOG = Logger.getInstance(CmdInfoClient.class);
- @Override
- public void doInfo(File path, SVNRevision revision, boolean recursive, ISVNInfoHandler handler) throws SVNException {
- doInfo(path, SVNRevision.UNDEFINED, revision, recursive ? SVNDepth.INFINITY : SVNDepth.EMPTY, null, handler);
- }
-
- @Override
- public void doInfo(File path, SVNRevision pegRevision, SVNRevision revision, boolean recursive, ISVNInfoHandler handler)
- throws SVNException {
- doInfo(path, pegRevision, revision, recursive ? SVNDepth.INFINITY : SVNDepth.EMPTY, null, handler);
- }
-
- @Override
- public void doInfo(File path,
- SVNRevision pegRevision,
- SVNRevision revision,
- SVNDepth depth,
- Collection changeLists,
- final ISVNInfoHandler handler) throws SVNException {
- File base = path.isDirectory() ? path : path.getParentFile();
- base = CommandUtil.correctUpToExistingParent(base);
- if (base == null) {
- // very unrealistic
- throw new SVNException(SVNErrorMessage.create(SVNErrorCode.IO_ERROR, "Can not find existing parent file"));
- }
- issueCommand(path, pegRevision, revision, depth, changeLists, handler, base);
- }
-
- private void issueCommand(File path, SVNRevision pegRevision,
- SVNRevision revision,
- SVNDepth depth,
- Collection changeLists,
- final ISVNInfoHandler handler, File base) throws SVNException {
- List<String> parameters = new ArrayList<String>();
-
- fillParameters(path.getAbsolutePath(), pegRevision, revision, depth, parameters);
- // TODO: Fix this check - update corresponding parameters in InfoClient
- CommandUtil.putChangeLists(parameters, changeLists);
-
- parseResult(handler, base, execute(parameters, path));
- }
-
- private String execute(@NotNull List<String> parameters, @NotNull File path) throws SVNException {
+ private String execute(@NotNull List<String> parameters, @NotNull File path) throws SvnBindException {
// workaround: separately capture command output - used in exception handling logic to overcome svn 1.8 issue (see below)
final ProcessOutput output = new ProcessOutput();
LineCommandListener listener = new LineCommandAdapter() {
@@ -113,51 +70,46 @@ public class CmdInfoClient extends BaseSvnClient implements InfoClient {
return command.getOutput();
}
- catch (VcsException e) {
- final String text = e.getMessage();
- final boolean notEmpty = !StringUtil.isEmptyOrSpaces(text);
- if (notEmpty && text.contains("W155010")) {
+ catch (SvnBindException e) {
+ final String text = StringUtil.notNullize(e.getMessage());
+ if (text.contains("W155010")) {
// if "svn info" is executed for several files at once, then this warning could be printed only for some files, but info for other
// files should be parsed from output
return output.getStdout();
}
// not a working copy exception
// "E155007: '' is not a working copy"
- if (notEmpty && text.contains("is not a working copy")) {
- if (StringUtil.isNotEmpty(output.getStdout())) {
- // TODO: Seems not reproducible in 1.8.4
- // workaround: as in subversion 1.8 "svn info" on a working copy root outputs such error for parent folder,
- // if there are files with conflicts.
- // but the requested info is still in the output except root closing tag
- return output.getStdout() + "</info>";
- } else {
- throw new SVNException(SVNErrorMessage.create(SVNErrorCode.WC_NOT_WORKING_COPY, e), e);
- }
- // svn: E200009: Could not display info for all targets because some targets don't exist
- } else if (notEmpty && text.contains("some targets don't exist")) {
- throw new SVNException(SVNErrorMessage.create(SVNErrorCode.ILLEGAL_TARGET, e), e);
- } else if (notEmpty && text.contains(String.valueOf(SVNErrorCode.WC_UPGRADE_REQUIRED.getCode()))) {
- throw new SVNException(SVNErrorMessage.create(SVNErrorCode.WC_UPGRADE_REQUIRED, e), e);
- } else if (notEmpty &&
- (text.contains("upgrade your Subversion client") ||
- text.contains(String.valueOf(SVNErrorCode.WC_UNSUPPORTED_FORMAT.getCode())))) {
- throw new SVNException(SVNErrorMessage.create(SVNErrorCode.WC_UNSUPPORTED_FORMAT, e), e);
+ if (text.contains("is not a working copy") && StringUtil.isNotEmpty(output.getStdout())) {
+ // TODO: Seems not reproducible in 1.8.4
+ // workaround: as in subversion 1.8 "svn info" on a working copy root outputs such error for parent folder,
+ // if there are files with conflicts.
+ // but the requested info is still in the output except root closing tag
+ return output.getStdout() + "</info>";
}
- throw new SVNException(SVNErrorMessage.create(SVNErrorCode.IO_ERROR, e), e);
+ throw e;
}
}
- private static void parseResult(@NotNull final ISVNInfoHandler handler, @Nullable File base, @Nullable String result) throws SVNException {
+ @Nullable
+ private static Info parseResult(@Nullable File base, @Nullable String result) throws SvnBindException {
+ CollectInfoHandler handler = new CollectInfoHandler();
+
+ parseResult(handler, base, result);
+
+ return handler.getInfo();
+ }
+
+ private static void parseResult(@NotNull final InfoConsumer handler, @Nullable File base, @Nullable String result)
+ throws SvnBindException {
if (StringUtil.isEmptyOrSpaces(result)) {
return;
}
- final SvnInfoHandler[] infoHandler = new SvnInfoHandler[1];
- infoHandler[0] = new SvnInfoHandler(base, new Consumer<SVNInfo>() {
+ final SvnInfoHandler infoHandler = new SvnInfoHandler(base, new Consumer<Info>() {
@Override
- public void consume(SVNInfo info) {
+ public void consume(Info info) {
try {
- handler.handleInfo(info);
+ handler.consume(info);
}
catch (SVNException e) {
throw new SvnExceptionWrapper(e);
@@ -165,87 +117,68 @@ public class CmdInfoClient extends BaseSvnClient implements InfoClient {
}
});
+ parseResult(result, infoHandler);
+ }
+
+ private static void parseResult(@NotNull String result, @NotNull SvnInfoHandler handler) throws SvnBindException {
try {
SAXParser parser = SAXParserFactory.newInstance().newSAXParser();
- parser.parse(new ByteArrayInputStream(result.trim().getBytes(CharsetToolkit.UTF8_CHARSET)), infoHandler[0]);
+ parser.parse(new ByteArrayInputStream(result.trim().getBytes(CharsetToolkit.UTF8_CHARSET)), handler);
}
catch (SvnExceptionWrapper e) {
LOG.info("info output " + result);
- throw (SVNException) e.getCause();
+ throw new SvnBindException(e.getCause());
} catch (IOException e) {
LOG.info("info output " + result);
- throw new SVNException(SVNErrorMessage.create(SVNErrorCode.IO_ERROR, e), e);
+ throw new SvnBindException(e);
}
catch (ParserConfigurationException e) {
LOG.info("info output " + result);
- throw new SVNException(SVNErrorMessage.create(SVNErrorCode.IO_ERROR, e), e);
+ throw new SvnBindException(e);
}
catch (SAXException e) {
LOG.info("info output " + result);
- throw new SVNException(SVNErrorMessage.create(SVNErrorCode.IO_ERROR, e), e);
+ throw new SvnBindException(e);
}
}
- private static void fillParameters(String path, SVNRevision pegRevision, SVNRevision revision, SVNDepth depth, List<String> parameters) {
+ @NotNull
+ private static List<String> buildParameters(@NotNull String path,
+ @Nullable SVNRevision pegRevision,
+ @Nullable SVNRevision revision,
+ @Nullable Depth depth) {
+ List<String> parameters = ContainerUtil.newArrayList();
+
CommandUtil.put(parameters, depth);
CommandUtil.put(parameters, revision);
CommandUtil.put(parameters, path, pegRevision);
parameters.add("--xml");
- }
- @Override
- public void doInfo(SVNURL url, SVNRevision pegRevision, SVNRevision revision, boolean recursive, ISVNInfoHandler handler)
- throws SVNException {
- doInfo(url, pegRevision, revision, recursive ? SVNDepth.INFINITY : SVNDepth.EMPTY, handler);
+ return parameters;
}
@Override
- public void doInfo(SVNURL url, SVNRevision pegRevision, SVNRevision revision, SVNDepth depth, ISVNInfoHandler handler)
- throws SVNException {
- String path = url.toDecodedString();
- List<String> parameters = new ArrayList<String>();
-
- fillParameters(path, pegRevision, revision, depth, parameters);
- CommandExecutor command;
- try {
- command = execute(myVcs, SvnTarget.fromURL(url), SvnCommandName.info, parameters, null);
- }
- catch (SvnBindException e) {
- SVNErrorCode code = e.contains(SVNErrorCode.RA_ILLEGAL_URL) ? SVNErrorCode.RA_ILLEGAL_URL : SVNErrorCode.IO_ERROR;
-
- throw new SVNException(SVNErrorMessage.create(code, e), e);
+ public Info doInfo(File path, SVNRevision revision) throws SvnBindException {
+ File base = path.isDirectory() ? path : path.getParentFile();
+ base = CommandUtil.correctUpToExistingParent(base);
+ if (base == null) {
+ // very unrealistic
+ throw new SvnBindException("Can not find existing parent file");
}
- parseResult(handler, null, command.getOutput());
+ return parseResult(base, execute(buildParameters(path.getAbsolutePath(), SVNRevision.UNDEFINED, revision, Depth.EMPTY), path));
}
@Override
- public SVNInfo doInfo(File path, SVNRevision revision) throws SVNException {
- final SVNInfo[] infoArr = new SVNInfo[1];
- doInfo(path, SVNRevision.UNDEFINED, revision, SVNDepth.EMPTY, null, new ISVNInfoHandler() {
- @Override
- public void handleInfo(SVNInfo info) throws SVNException {
- infoArr[0] = info;
- }
- });
- return infoArr[0];
- }
+ public Info doInfo(SVNURL url, SVNRevision pegRevision, SVNRevision revision) throws SvnBindException {
+ CommandExecutor command = execute(myVcs, SvnTarget.fromURL(url), SvnCommandName.info, buildParameters(url.toDecodedString(), pegRevision, revision, Depth.EMPTY), null);
- @Override
- public SVNInfo doInfo(SVNURL url, SVNRevision pegRevision, SVNRevision revision) throws SVNException {
- final SVNInfo[] infoArr = new SVNInfo[1];
- doInfo(url, pegRevision, revision, SVNDepth.EMPTY, new ISVNInfoHandler() {
- @Override
- public void handleInfo(SVNInfo info) throws SVNException {
- infoArr[0] = info;
- }
- });
- return infoArr[0];
+ return parseResult(null, command.getOutput());
}
@Override
- public void doInfo(@NotNull Collection<File> paths, @Nullable ISVNInfoHandler handler) throws SVNException {
+ public void doInfo(@NotNull Collection<File> paths, @Nullable InfoConsumer handler) throws SvnBindException {
File base = ContainerUtil.getFirstItem(paths);
if (base != null) {
@@ -265,4 +198,19 @@ public class CmdInfoClient extends BaseSvnClient implements InfoClient {
}
}
}
+
+ private static class CollectInfoHandler implements InfoConsumer {
+
+ @Nullable private Info myInfo;
+
+ @Override
+ public void consume(Info info) throws SVNException {
+ myInfo = info;
+ }
+
+ @Nullable
+ public Info getInfo() {
+ return myInfo;
+ }
+ }
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/info/IdeaSVNInfo.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/info/IdeaSVNInfo.java
deleted file mode 100644
index 0e2905e73016..000000000000
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/info/IdeaSVNInfo.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright 2000-2012 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jetbrains.idea.svn.info;
-
-import org.jetbrains.annotations.Nullable;
-import org.tmatesoft.svn.core.SVNDepth;
-import org.tmatesoft.svn.core.SVNLock;
-import org.tmatesoft.svn.core.SVNNodeKind;
-import org.tmatesoft.svn.core.SVNURL;
-import org.tmatesoft.svn.core.wc.SVNInfo;
-import org.tmatesoft.svn.core.wc.SVNRevision;
-import org.tmatesoft.svn.core.wc.SVNTreeConflictDescription;
-
-import java.io.File;
-import java.util.Date;
-
-/**
- * Created by IntelliJ IDEA.
- * User: Irina.Chernushina
- * Date: 1/23/12
- * Time: 1:02 PM
- */
-public class IdeaSVNInfo extends SVNInfo {
- private final Date myCorrectCommittedDate;
- private final Date myCorrectTextDate;
-
- public IdeaSVNInfo(@Nullable File file,
- SVNURL url,
- SVNURL rootURL,
- long revision,
- SVNNodeKind kind,
- String uuid,
- long committedRevision,
- Date committedDate,
- String author,
- String schedule,
- SVNURL copyFromURL,
- long copyFromRevision,
- Date textTime,
- String propTime,
- String checksum,
- String conflictOld,
- String conflictNew,
- String conflictWorking,
- String propRejectFile,
- SVNLock lock,
- SVNDepth depth,
- String changelistName,
- long wcSize,
- SVNTreeConflictDescription treeConflict) {
- super(file, url, rootURL, revision, kind, uuid, committedRevision, null, author, schedule, copyFromURL, copyFromRevision,
- null, propTime, checksum, conflictOld, conflictNew, conflictWorking, propRejectFile, lock, depth, changelistName, wcSize,
- treeConflict);
- myCorrectCommittedDate = committedDate;
- myCorrectTextDate = textTime;
- }
-
- /**
- * Gets the item's last commit date. This is the value of the item's
- * {@link org.tmatesoft.svn.core.SVNProperty#COMMITTED_DATE}
- * property.
- *
- * @return the item's last commit date
- */
- @Override
- public Date getCommittedDate() {
- return myCorrectCommittedDate;
- }
-
- /**
- * Gets the value of the item's {@link org.tmatesoft.svn.core.SVNProperty#TEXT_TIME}
- * property. It corresponds to the last commit time.
- *
- * @return the value of the item's text-time property
- */
- @Override
- public Date getTextTime() {
- return myCorrectTextDate;
- }
-
- public IdeaSVNInfo(String path,
- SVNURL url,
- SVNRevision revision,
- SVNNodeKind kind,
- String uuid,
- SVNURL reposRootURL,
- long comittedRevision, Date date, String author, SVNLock lock, SVNDepth depth, long size) {
- super(path, url, revision, kind, uuid, reposRootURL, comittedRevision, date, author, lock, depth, size);
- myCorrectCommittedDate = date;
- myCorrectTextDate = null;
- }
-}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/info/Info.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/info/Info.java
new file mode 100644
index 000000000000..96dbdbbcbc99
--- /dev/null
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/info/Info.java
@@ -0,0 +1,267 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jetbrains.idea.svn.info;
+
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+import org.jetbrains.idea.svn.api.BaseNodeDescription;
+import org.jetbrains.idea.svn.api.Depth;
+import org.jetbrains.idea.svn.api.NodeKind;
+import org.jetbrains.idea.svn.conflict.TreeConflictDescription;
+import org.jetbrains.idea.svn.lock.Lock;
+import org.tmatesoft.svn.core.SVNURL;
+import org.tmatesoft.svn.core.internal.util.SVNDate;
+import org.tmatesoft.svn.core.wc.SVNInfo;
+import org.tmatesoft.svn.core.wc.SVNRevision;
+
+import java.io.File;
+import java.util.Date;
+
+/**
+ * @author Konstantin Kolosovsky.
+ */
+public class Info extends BaseNodeDescription {
+
+ private final File myFile;
+ private final String myPath;
+ private final SVNURL myURL;
+ private final SVNRevision myRevision;
+ private final SVNURL myRepositoryRootURL;
+ private final String myRepositoryUUID;
+ private final SVNRevision myCommittedRevision;
+ private final Date myCommittedDate;
+ private final String myAuthor;
+ @Nullable private final Lock myLock;
+ private final boolean myIsRemote;
+ private final String mySchedule;
+ private final SVNURL myCopyFromURL;
+ private final SVNRevision myCopyFromRevision;
+ private final File myConflictOldFile;
+ private final File myConflictNewFile;
+ private final File myConflictWrkFile;
+ private final File myPropConflictFile;
+ private final Depth myDepth;
+ @Nullable private final TreeConflictDescription myTreeConflict;
+
+ @NotNull
+ public static Info create(@NotNull SVNInfo info) {
+ Info result;
+
+ if (info.isRemote()) {
+ result = new Info(info.getPath(), info.getURL(), info.getRevision(), NodeKind.from(info.getKind()), info.getRepositoryUUID(),
+ info.getRepositoryRootURL(), info.getCommittedRevision().getNumber(), info.getCommittedDate(), info.getAuthor(),
+ Lock.create(info.getLock()), Depth.from(info.getDepth()));
+ }
+ else {
+ result =
+ new Info(info.getFile(), info.getURL(), info.getRepositoryRootURL(), info.getRevision().getNumber(), NodeKind.from(info.getKind()),
+ info.getRepositoryUUID(), info.getCommittedRevision().getNumber(), toString(info.getCommittedDate()), info.getAuthor(),
+ info.getSchedule(), info.getCopyFromURL(), info.getCopyFromRevision().getNumber(), getPath(info.getConflictOldFile()),
+ getPath(info.getConflictNewFile()), getPath(info.getConflictWrkFile()), getPath(info.getPropConflictFile()),
+ Lock.create(info.getLock()), Depth.from(info.getDepth()), TreeConflictDescription.create(info.getTreeConflict()));
+ }
+
+ return result;
+ }
+
+ public Info(File file,
+ SVNURL url,
+ SVNURL rootURL,
+ long revision,
+ @NotNull NodeKind kind,
+ String uuid,
+ long committedRevision,
+ String committedDate,
+ String author,
+ String schedule,
+ SVNURL copyFromURL,
+ long copyFromRevision,
+ String conflictOld,
+ String conflictNew,
+ String conflictWorking,
+ String propRejectFile,
+ @Nullable Lock lock,
+ Depth depth,
+ @Nullable TreeConflictDescription treeConflict) {
+ super(kind);
+ myFile = file;
+ myURL = url;
+ myRevision = SVNRevision.create(revision);
+ myRepositoryUUID = uuid;
+ myRepositoryRootURL = rootURL;
+
+ myCommittedRevision = SVNRevision.create(committedRevision);
+ myCommittedDate = committedDate != null ? SVNDate.parseDate(committedDate) : null;
+ myAuthor = author;
+
+ mySchedule = schedule;
+
+ myCopyFromURL = copyFromURL;
+ myCopyFromRevision = SVNRevision.create(copyFromRevision);
+
+ myLock = lock;
+ myTreeConflict = treeConflict;
+
+ myConflictOldFile = resolveConflictFile(file, conflictOld);
+ myConflictNewFile = resolveConflictFile(file, conflictNew);
+ myConflictWrkFile = resolveConflictFile(file, conflictWorking);
+ myPropConflictFile = resolveConflictFile(file, propRejectFile);
+
+ myIsRemote = false;
+ myDepth = depth;
+
+ myPath = null;
+ }
+
+ public Info(String path,
+ SVNURL url,
+ SVNRevision revision,
+ @NotNull NodeKind kind,
+ String uuid,
+ SVNURL reposRootURL,
+ long committedRevision,
+ Date date,
+ String author,
+ @Nullable Lock lock,
+ Depth depth) {
+ super(kind);
+ myIsRemote = true;
+ myURL = url;
+ myRevision = revision;
+ myRepositoryRootURL = reposRootURL;
+ myRepositoryUUID = uuid;
+
+ myCommittedDate = date;
+ myCommittedRevision = SVNRevision.create(committedRevision);
+ myAuthor = author;
+
+ myLock = lock;
+ myPath = path;
+ myDepth = depth;
+
+ myFile = null;
+ mySchedule = null;
+ myCopyFromURL = null;
+ myCopyFromRevision = null;
+ myConflictOldFile = null;
+ myConflictNewFile = null;
+ myConflictWrkFile = null;
+ myPropConflictFile = null;
+ myTreeConflict = null;
+ }
+
+ public String getAuthor() {
+ return myAuthor;
+ }
+
+ public Date getCommittedDate() {
+ return myCommittedDate;
+ }
+
+ public SVNRevision getCommittedRevision() {
+ return myCommittedRevision;
+ }
+
+ public File getConflictNewFile() {
+ return myConflictNewFile;
+ }
+
+ public File getConflictOldFile() {
+ return myConflictOldFile;
+ }
+
+ public File getConflictWrkFile() {
+ return myConflictWrkFile;
+ }
+
+ @Nullable
+ public TreeConflictDescription getTreeConflict() {
+ return myTreeConflict;
+ }
+
+ public SVNRevision getCopyFromRevision() {
+ return myCopyFromRevision;
+ }
+
+ public SVNURL getCopyFromURL() {
+ return myCopyFromURL;
+ }
+
+ public File getFile() {
+ return myFile;
+ }
+
+ public boolean isRemote() {
+ return myIsRemote;
+ }
+
+ @NotNull
+ public NodeKind getKind() {
+ return myKind;
+ }
+
+ @Nullable
+ public Lock getLock() {
+ return myLock;
+ }
+
+ public String getPath() {
+ return myPath;
+ }
+
+ public File getPropConflictFile() {
+ return myPropConflictFile;
+ }
+
+ public SVNURL getRepositoryRootURL() {
+ return myRepositoryRootURL;
+ }
+
+ public String getRepositoryUUID() {
+ return myRepositoryUUID;
+ }
+
+ public SVNRevision getRevision() {
+ return myRevision;
+ }
+
+ public String getSchedule() {
+ return mySchedule;
+ }
+
+ public SVNURL getURL() {
+ return myURL;
+ }
+
+ public Depth getDepth() {
+ return myDepth;
+ }
+
+ @Nullable
+ private static File resolveConflictFile(@Nullable File file, @Nullable String path) {
+ return file != null && path != null ? new File(file.getParentFile(), path) : null;
+ }
+
+ @Nullable
+ private static String getPath(@Nullable File file) {
+ return file != null ? file.getPath() : null;
+ }
+
+ @Nullable
+ private static String toString(@Nullable Date date) {
+ return date != null ? date.toString() : null;
+ }
+}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/info/InfoClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/info/InfoClient.java
index f6582e603eda..56f87a040b17 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/info/InfoClient.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/info/InfoClient.java
@@ -18,11 +18,8 @@ package org.jetbrains.idea.svn.info;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.api.SvnClient;
-import org.tmatesoft.svn.core.SVNDepth;
-import org.tmatesoft.svn.core.SVNException;
+import org.jetbrains.idea.svn.commandLine.SvnBindException;
import org.tmatesoft.svn.core.SVNURL;
-import org.tmatesoft.svn.core.wc.ISVNInfoHandler;
-import org.tmatesoft.svn.core.wc.SVNInfo;
import org.tmatesoft.svn.core.wc.SVNRevision;
import java.io.File;
@@ -36,15 +33,9 @@ import java.util.Collection;
*/
public interface InfoClient extends SvnClient {
- void doInfo(File path, SVNRevision revision, boolean recursive, ISVNInfoHandler handler) throws SVNException;
- void doInfo(File path, SVNRevision pegRevision, SVNRevision revision, boolean recursive, ISVNInfoHandler handler) throws SVNException;
- void doInfo(File path, SVNRevision pegRevision, SVNRevision revision, SVNDepth depth,
- Collection changeLists, ISVNInfoHandler handler) throws SVNException;
- void doInfo(SVNURL url, SVNRevision pegRevision, SVNRevision revision, boolean recursive, ISVNInfoHandler handler) throws SVNException;
- void doInfo(SVNURL url, SVNRevision pegRevision, SVNRevision revision, SVNDepth depth,
- ISVNInfoHandler handler) throws SVNException;
- SVNInfo doInfo(File path, SVNRevision revision) throws SVNException;
- SVNInfo doInfo(SVNURL url, SVNRevision pegRevision, SVNRevision revision) throws SVNException;
+ Info doInfo(File path, SVNRevision revision) throws SvnBindException;
- void doInfo(@NotNull Collection<File> paths, @Nullable ISVNInfoHandler handler) throws SVNException;
+ Info doInfo(SVNURL url, SVNRevision pegRevision, SVNRevision revision) throws SvnBindException;
+
+ void doInfo(@NotNull Collection<File> paths, @Nullable InfoConsumer handler) throws SvnBindException;
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/info/InfoConsumer.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/info/InfoConsumer.java
new file mode 100644
index 000000000000..317b2b6a5156
--- /dev/null
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/info/InfoConsumer.java
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jetbrains.idea.svn.info;
+
+import com.intellij.util.ThrowableConsumer;
+import org.jetbrains.idea.svn.info.Info;
+import org.tmatesoft.svn.core.SVNException;
+
+/**
+ * @author Konstantin Kolosovsky.
+ */
+public interface InfoConsumer extends ThrowableConsumer<Info, SVNException> {
+}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/info/SVNLockWrapper.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/info/SVNLockWrapper.java
deleted file mode 100644
index f5752074da77..000000000000
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/info/SVNLockWrapper.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Copyright 2000-2012 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jetbrains.idea.svn.info;
-
-import org.tmatesoft.svn.core.SVNLock;
-
-import java.util.Date;
-
-/**
- * Created with IntelliJ IDEA.
- * User: Irina.Chernushina
- * Date: 2/21/12
- * Time: 2:33 PM
- */
-public class SVNLockWrapper {
- private String myPath;
- private String myID;
- private String myOwner;
- private String myComment;
- private Date myCreationDate;
- private Date myExpirationDate;
-
- public SVNLockWrapper(String path, String ID, String owner, String comment, Date creationDate, Date expirationDate) {
- myPath = path;
- myID = ID;
- myOwner = owner;
- myComment = comment;
- myCreationDate = creationDate;
- myExpirationDate = expirationDate;
- }
-
- public SVNLockWrapper() {
- }
-
- public SVNLock create() {
- return new SVNLock(myPath, myID, myOwner, myComment, myCreationDate, myExpirationDate);
- }
-
- public String getPath() {
- return myPath;
- }
-
- public void setPath(String path) {
- myPath = path;
- }
-
- public String getID() {
- return myID;
- }
-
- public void setID(String ID) {
- myID = ID;
- }
-
- public String getOwner() {
- return myOwner;
- }
-
- public void setOwner(String owner) {
- myOwner = owner;
- }
-
- public String getComment() {
- return myComment;
- }
-
- public void setComment(String comment) {
- myComment = comment;
- }
-
- public Date getCreationDate() {
- return myCreationDate;
- }
-
- public void setCreationDate(Date creationDate) {
- myCreationDate = creationDate;
- }
-
- public Date getExpirationDate() {
- return myExpirationDate;
- }
-
- public void setExpirationDate(Date expirationDate) {
- myExpirationDate = expirationDate;
- }
-}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/info/SvnInfoHandler.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/info/SvnInfoHandler.java
index e2e5fa910e38..969225eb69e3 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/info/SvnInfoHandler.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/info/SvnInfoHandler.java
@@ -21,12 +21,11 @@ import com.intellij.util.Consumer;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.SvnUtil;
-import org.tmatesoft.svn.core.SVNDepth;
+import org.jetbrains.idea.svn.api.NodeKind;
+import org.jetbrains.idea.svn.lock.Lock;
import org.tmatesoft.svn.core.SVNException;
-import org.tmatesoft.svn.core.SVNNodeKind;
import org.tmatesoft.svn.core.SVNURL;
import org.tmatesoft.svn.core.internal.util.SVNDate;
-import org.tmatesoft.svn.core.wc.SVNInfo;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
@@ -42,14 +41,14 @@ import java.util.*;
*/
public class SvnInfoHandler extends DefaultHandler {
@Nullable private final File myBase;
- private final Consumer<SVNInfo> myInfoConsumer;
- private Map<File, SVNInfo> myResultsMap;
+ private final Consumer<org.jetbrains.idea.svn.info.Info> myInfoConsumer;
+ private Map<File, org.jetbrains.idea.svn.info.Info> myResultsMap;
private SvnInfoStructure myPending;
private final Map<String, Getter<ElementHandlerBase>> myElementsMap;
private final List<ElementHandlerBase> myParseStack;
private final StringBuilder mySb;
- public SvnInfoHandler(@Nullable File base, final Consumer<SVNInfo> infoConsumer) {
+ public SvnInfoHandler(@Nullable File base, final Consumer<org.jetbrains.idea.svn.info.Info> infoConsumer) {
myBase = base;
myInfoConsumer = infoConsumer;
myPending = createPending();
@@ -57,12 +56,12 @@ public class SvnInfoHandler extends DefaultHandler {
fillElements();
myParseStack = new ArrayList<ElementHandlerBase>();
myParseStack.add(new Fake());
- myResultsMap = new HashMap<File, SVNInfo>();
+ myResultsMap = new HashMap<File, org.jetbrains.idea.svn.info.Info>();
mySb = new StringBuilder();
}
private void switchPending() throws SAXException {
- final SVNInfo info;
+ final org.jetbrains.idea.svn.info.Info info;
try {
info = myPending.convert();
}
@@ -78,7 +77,7 @@ public class SvnInfoHandler extends DefaultHandler {
private SvnInfoStructure createPending() {
SvnInfoStructure pending = new SvnInfoStructure();
- pending.myDepth = SVNDepth.INFINITY;
+ pending.myDepth = org.jetbrains.idea.svn.api.Depth.INFINITY;
return pending;
}
@@ -280,7 +279,7 @@ public class SvnInfoHandler extends DefaultHandler {
myElementsMap.put("lock", new Getter<ElementHandlerBase>() {
@Override
public ElementHandlerBase get() {
- return new Lock();
+ return new LockElement();
}
});
myElementsMap.put("token", new Getter<ElementHandlerBase>() {
@@ -345,7 +344,7 @@ public class SvnInfoHandler extends DefaultHandler {
});
}
- public Map<File, SVNInfo> getResultsMap() {
+ public Map<File, org.jetbrains.idea.svn.info.Info> getResultsMap() {
return myResultsMap;
}
@@ -514,8 +513,7 @@ public class SvnInfoHandler extends DefaultHandler {
@Override
public void characters(String s, SvnInfoStructure structure) throws SAXException {
- final SVNDate date = SVNDate.parseDate(s);
- structure.myCommittedDate = date;
+ structure.myCommittedDate = s;
}
}
@@ -600,8 +598,7 @@ public class SvnInfoHandler extends DefaultHandler {
@Override
public void characters(String s, SvnInfoStructure structure) throws SAXException {
- final SVNDate date = SVNDate.parseDate(s);
- structure.myTextTime = date;
+ structure.myTextTime = s;
}
}
@@ -616,7 +613,7 @@ public class SvnInfoHandler extends DefaultHandler {
@Override
public void characters(String s, SvnInfoStructure structure) throws SAXException {
- structure.myDepth = SVNDepth.fromString(s);
+ structure.myDepth = org.jetbrains.idea.svn.api.Depth.from(s);
}
}
@@ -796,14 +793,14 @@ public class SvnInfoHandler extends DefaultHandler {
}
}
- private static class Lock extends ElementHandlerBase {
- private Lock() {
+ private static class LockElement extends ElementHandlerBase {
+ private LockElement() {
super(new String[]{"token", "owner", "comment", "created"}, new String[]{});
}
@Override
protected void updateInfo(Attributes attributes, SvnInfoStructure structure) throws SAXException {
- structure.myLockWrapper = new SVNLockWrapper();
+ structure.myLockBuilder = new Lock.Builder();
}
@Override
@@ -822,7 +819,7 @@ public class SvnInfoHandler extends DefaultHandler {
@Override
public void characters(String s, SvnInfoStructure structure) throws SAXException {
- structure.myLockWrapper.setID(s);
+ structure.myLockBuilder.setToken(s);
}
}
@@ -837,7 +834,7 @@ public class SvnInfoHandler extends DefaultHandler {
@Override
public void characters(String s, SvnInfoStructure structure) throws SAXException {
- structure.myLockWrapper.setOwner(s);
+ structure.myLockBuilder.setOwner(s);
}
}
@@ -852,7 +849,7 @@ public class SvnInfoHandler extends DefaultHandler {
@Override
public void characters(String s, SvnInfoStructure structure) throws SAXException {
- structure.myLockWrapper.setComment(s);
+ structure.myLockBuilder.setComment(s);
}
}
@@ -867,7 +864,7 @@ public class SvnInfoHandler extends DefaultHandler {
@Override
public void characters(String s, SvnInfoStructure structure) throws SAXException {
- structure.myLockWrapper.setCreationDate(SVNDate.parseDate(s));
+ structure.myLockBuilder.setCreationDate(SVNDate.parseDate(s));
}
}
@@ -883,7 +880,7 @@ public class SvnInfoHandler extends DefaultHandler {
protected void updateInfo(Attributes attributes, SvnInfoStructure structure) throws SAXException {
final String kind = attributes.getValue("kind");
assertSAX(! StringUtil.isEmptyOrSpaces(kind));
- structure.myKind = SVNNodeKind.parseKind(kind);
+ structure.myKind = NodeKind.from(kind);
if (myBase != null) {
final String path = attributes.getValue("path");
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/info/SvnInfoStructure.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/info/SvnInfoStructure.java
index 6e1b1db1efa2..42929885f364 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/info/SvnInfoStructure.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/info/SvnInfoStructure.java
@@ -15,17 +15,18 @@
*/
package org.jetbrains.idea.svn.info;
-import com.intellij.util.containers.ContainerUtil;
-import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import org.jetbrains.idea.svn.api.Depth;
+import org.jetbrains.idea.svn.api.NodeKind;
+import org.jetbrains.idea.svn.conflict.ConflictAction;
+import org.jetbrains.idea.svn.conflict.ConflictOperation;
+import org.jetbrains.idea.svn.conflict.ConflictReason;
+import org.jetbrains.idea.svn.lock.Lock;
import org.tmatesoft.svn.core.*;
-import org.tmatesoft.svn.core.internal.wc.SVNConflictVersion;
-import org.tmatesoft.svn.core.wc.*;
import org.xml.sax.SAXException;
import java.io.File;
import java.util.Date;
-import java.util.Map;
/**
* Created with IntelliJ IDEA.
@@ -35,46 +36,28 @@ import java.util.Map;
*/
public class SvnInfoStructure {
- private static final Map<String, SVNConflictAction> ourConflictActions = ContainerUtil.newHashMap();
- private static final Map<String, SVNConflictReason> ourConflictReasons = ContainerUtil.newHashMap();
-
- static {
- ourConflictActions.put("add", SVNConflictAction.ADD);
- ourConflictActions.put("edit", SVNConflictAction.EDIT);
- ourConflictActions.put("delete", SVNConflictAction.DELETE);
- ourConflictActions.put("replace", SVNConflictAction.REPLACE);
-
- ourConflictReasons.put("edit", SVNConflictReason.EDITED);
- ourConflictReasons.put("obstruct", SVNConflictReason.OBSTRUCTED);
- ourConflictReasons.put("delete", SVNConflictReason.DELETED);
- ourConflictReasons.put("miss", SVNConflictReason.MISSING);
- ourConflictReasons.put("unversion", SVNConflictReason.UNVERSIONED);
- ourConflictReasons.put("add", SVNConflictReason.ADDED);
- ourConflictReasons.put("replace", SVNConflictReason.REPLACED);
- }
-
@Nullable public File myFile;
public String relativeUrl;
public SVNURL myUrl;
public SVNURL myRootURL;
public long myRevision;
- public SVNNodeKind myKind;
+ public NodeKind myKind;
public String myUuid;
public long myCommittedRevision;
- public Date myCommittedDate;
+ public String myCommittedDate;
public String myAuthor;
public String mySchedule;
public SVNURL myCopyFromURL;
public long myCopyFromRevision;
- public Date myTextTime;
+ public String myTextTime;
public String myPropTime;
public String myChecksum;
public String myConflictOld;
public String myConflictNew;
public String myConflictWorking;
public String myPropRejectFile;
- public SVNLockWrapper myLockWrapper;
- public SVNDepth myDepth;
+ public Lock.Builder myLockBuilder;
+ public Depth myDepth;
public String myChangelistName;
public long myWcSize;
public Date myCorrectCommittedDate;
@@ -82,65 +65,37 @@ public class SvnInfoStructure {
public TreeConflictDescription myTreeConflict;
- public SVNInfo convert() throws SAXException, SVNException {
- return new IdeaSVNInfo(myFile, myUrl, myRootURL, myRevision, myKind, myUuid, myCommittedRevision, myCommittedDate, myAuthor, mySchedule,
- myCopyFromURL, myCopyFromRevision, myTextTime, myPropTime, myChecksum, myConflictOld, myConflictNew, myConflictWorking,
- myPropRejectFile, getLock(), myDepth, myChangelistName, myWcSize, createTreeConflict());
+ public Info convert() throws SAXException, SVNException {
+ return new Info(myFile, myUrl, myRootURL, myRevision, myKind, myUuid, myCommittedRevision, myCommittedDate, myAuthor, mySchedule,
+ myCopyFromURL, myCopyFromRevision, myConflictOld, myConflictNew, myConflictWorking,
+ myPropRejectFile, getLock(), myDepth, createTreeConflict());
}
- private SVNLock getLock() {
- SVNLock lock = null;
-
- if (myLockWrapper != null) {
- myLockWrapper.setPath(relativeUrl);
- lock = myLockWrapper.create();
- }
-
- return lock;
+ @Nullable
+ private Lock getLock() {
+ return myLockBuilder != null ? myLockBuilder.build() : null;
}
- private SVNTreeConflictDescription createTreeConflict() throws SAXException, SVNException {
+ private org.jetbrains.idea.svn.conflict.TreeConflictDescription createTreeConflict() throws SAXException, SVNException {
if (myTreeConflict == null) {
return null;
}
else {
assert myFile != null;
- final SVNConflictAction action = parseConflictAction(myTreeConflict.myAction);
- final SVNConflictReason reason = parseConflictReason(myTreeConflict.myReason);
- SVNOperation operation = SVNOperation.fromString(myTreeConflict.myOperation);
- operation = operation == null ? SVNOperation.NONE : operation;
- return new SVNTreeConflictDescription(myFile, myKind, action, reason, operation,
- createVersion(myTreeConflict.mySourceLeft),
- createVersion(myTreeConflict.mySourceRight));
+ return new org.jetbrains.idea.svn.conflict.TreeConflictDescription(myFile, myKind, ConflictAction.from(myTreeConflict.myAction),
+ ConflictReason.from(myTreeConflict.myReason),
+ ConflictOperation.from(myTreeConflict.myOperation),
+ createVersion(myTreeConflict.mySourceLeft),
+ createVersion(myTreeConflict.mySourceRight));
}
}
- private SVNConflictAction parseConflictAction(@NotNull String actionName) {
- SVNConflictAction action = SVNConflictAction.fromString(actionName);
- action = action != null ? action : ourConflictActions.get(actionName);
-
- if (action == null) {
- throw new IllegalArgumentException("Unknown conflict action " + actionName);
- }
-
- return action;
- }
-
- private SVNConflictReason parseConflictReason(@NotNull String reasonName) throws SAXException {
- SVNConflictReason reason = SVNConflictReason.fromString(reasonName);
- reason = reason != null ? reason : ourConflictReasons.get(reasonName);
-
- if (reason == null) {
- throw new SAXException("Can not parse conflict reason: " + reasonName);
- }
-
- return reason;
- }
-
- private SVNConflictVersion createVersion(final ConflictVersion version) throws SVNException, SAXException {
- return version == null ? null : new SVNConflictVersion(SVNURL.parseURIEncoded(version.myRepoUrl), version.myPathInRepo,
- parseRevision(version.myRevision), SVNNodeKind.parseKind(version.myKind));
+ private org.jetbrains.idea.svn.conflict.ConflictVersion createVersion(final ConflictVersion version) throws SVNException, SAXException {
+ return version == null
+ ? null
+ : new org.jetbrains.idea.svn.conflict.ConflictVersion(SVNURL.parseURIEncoded(version.myRepoUrl), version.myPathInRepo,
+ parseRevision(version.myRevision), NodeKind.from(version.myKind));
}
private long parseRevision(final String revision) throws SAXException {
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/info/SvnKitInfoClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/info/SvnKitInfoClient.java
index 7f50e85cd2d7..3db2c647791a 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/info/SvnKitInfoClient.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/info/SvnKitInfoClient.java
@@ -18,12 +18,9 @@ package org.jetbrains.idea.svn.info;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.api.BaseSvnClient;
-import org.jetbrains.idea.svn.info.InfoClient;
-import org.tmatesoft.svn.core.SVNDepth;
+import org.jetbrains.idea.svn.commandLine.SvnBindException;
import org.tmatesoft.svn.core.SVNException;
import org.tmatesoft.svn.core.SVNURL;
-import org.tmatesoft.svn.core.wc.ISVNInfoHandler;
-import org.tmatesoft.svn.core.wc.SVNInfo;
import org.tmatesoft.svn.core.wc.SVNRevision;
import org.tmatesoft.svn.core.wc.SVNWCClient;
@@ -43,50 +40,27 @@ public class SvnKitInfoClient extends BaseSvnClient implements InfoClient {
}
@Override
- public void doInfo(File path, SVNRevision revision, boolean recursive, ISVNInfoHandler handler) throws SVNException {
- getClient().doInfo(path, revision, recursive, handler);
+ public Info doInfo(File path, SVNRevision revision) throws SvnBindException {
+ try {
+ return Info.create(getClient().doInfo(path, revision));
+ }
+ catch (SVNException e) {
+ throw new SvnBindException(e);
+ }
}
@Override
- public void doInfo(File path, SVNRevision pegRevision, SVNRevision revision, boolean recursive, ISVNInfoHandler handler)
- throws SVNException {
- getClient().doInfo(path, pegRevision, revision, recursive, handler);
+ public Info doInfo(SVNURL url, SVNRevision pegRevision, SVNRevision revision) throws SvnBindException {
+ try {
+ return Info.create(getClient().doInfo(url, pegRevision, revision));
+ }
+ catch (SVNException e) {
+ throw new SvnBindException(e);
+ }
}
@Override
- public void doInfo(File path,
- SVNRevision pegRevision,
- SVNRevision revision,
- SVNDepth depth,
- Collection changeLists,
- ISVNInfoHandler handler) throws SVNException {
- getClient().doInfo(path, pegRevision, revision, depth, changeLists, handler);
- }
-
- @Override
- public void doInfo(SVNURL url, SVNRevision pegRevision, SVNRevision revision, boolean recursive, ISVNInfoHandler handler)
- throws SVNException {
- getClient().doInfo(url, pegRevision, revision, recursive, handler);
- }
-
- @Override
- public void doInfo(SVNURL url, SVNRevision pegRevision, SVNRevision revision, SVNDepth depth, ISVNInfoHandler handler)
- throws SVNException {
- getClient().doInfo(url, pegRevision, revision, depth, handler);
- }
-
- @Override
- public SVNInfo doInfo(File path, SVNRevision revision) throws SVNException {
- return getClient().doInfo(path, revision);
- }
-
- @Override
- public SVNInfo doInfo(SVNURL url, SVNRevision pegRevision, SVNRevision revision) throws SVNException {
- return getClient().doInfo(url, pegRevision, revision);
- }
-
- @Override
- public void doInfo(@NotNull Collection<File> paths, @Nullable ISVNInfoHandler handler) throws SVNException {
+ public void doInfo(@NotNull Collection<File> paths, @Nullable InfoConsumer handler) throws SvnBindException {
throw new UnsupportedOperationException();
}
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/CmdMergeClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/CmdMergeClient.java
index 63eb66d9b002..2f9d8ae5aac5 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/CmdMergeClient.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/CmdMergeClient.java
@@ -4,10 +4,10 @@ import com.intellij.openapi.vcs.VcsException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.api.BaseSvnClient;
+import org.jetbrains.idea.svn.api.Depth;
+import org.jetbrains.idea.svn.api.ProgressTracker;
import org.jetbrains.idea.svn.commandLine.*;
-import org.tmatesoft.svn.core.SVNDepth;
-import org.tmatesoft.svn.core.wc.ISVNEventHandler;
-import org.tmatesoft.svn.core.wc.SVNDiffOptions;
+import org.jetbrains.idea.svn.diff.DiffOptions;
import org.tmatesoft.svn.core.wc.SVNRevisionRange;
import org.tmatesoft.svn.core.wc2.SvnTarget;
@@ -23,8 +23,8 @@ public class CmdMergeClient extends BaseSvnClient implements MergeClient {
public void merge(@NotNull SvnTarget source,
@NotNull File destination,
boolean dryRun,
- @Nullable SVNDiffOptions diffOptions,
- @Nullable final ISVNEventHandler handler) throws VcsException {
+ @Nullable DiffOptions diffOptions,
+ @Nullable final ProgressTracker handler) throws VcsException {
assertUrl(source);
List<String> parameters = new ArrayList<String>();
@@ -38,12 +38,12 @@ public class CmdMergeClient extends BaseSvnClient implements MergeClient {
public void merge(@NotNull SvnTarget source,
@NotNull SVNRevisionRange range,
@NotNull File destination,
- @Nullable SVNDepth depth,
+ @Nullable Depth depth,
boolean dryRun,
boolean recordOnly,
boolean force,
- @Nullable SVNDiffOptions diffOptions,
- @Nullable ISVNEventHandler handler) throws VcsException {
+ @Nullable DiffOptions diffOptions,
+ @Nullable ProgressTracker handler) throws VcsException {
assertUrl(source);
List<String> parameters = new ArrayList<String>();
@@ -60,13 +60,13 @@ public class CmdMergeClient extends BaseSvnClient implements MergeClient {
public void merge(@NotNull SvnTarget source1,
@NotNull SvnTarget source2,
@NotNull File destination,
- @Nullable SVNDepth depth,
+ @Nullable Depth depth,
boolean useAncestry,
boolean dryRun,
boolean recordOnly,
boolean force,
- @Nullable SVNDiffOptions diffOptions,
- @Nullable ISVNEventHandler handler) throws VcsException {
+ @Nullable DiffOptions diffOptions,
+ @Nullable ProgressTracker handler) throws VcsException {
assertUrl(source1);
assertUrl(source2);
@@ -82,12 +82,12 @@ public class CmdMergeClient extends BaseSvnClient implements MergeClient {
private static void fillParameters(@NotNull List<String> parameters,
@NotNull File destination,
- @Nullable SVNDepth depth,
+ @Nullable Depth depth,
boolean dryRun,
boolean recordOnly,
boolean force,
boolean reintegrate,
- @Nullable SVNDiffOptions diffOptions) {
+ @Nullable DiffOptions diffOptions) {
CommandUtil.put(parameters, destination);
CommandUtil.put(parameters, diffOptions);
CommandUtil.put(parameters, dryRun, "--dry-run");
@@ -102,7 +102,7 @@ public class CmdMergeClient extends BaseSvnClient implements MergeClient {
CommandUtil.put(parameters, reintegrate, "--reintegrate");
}
- private void run(File destination, ISVNEventHandler handler, List<String> parameters) throws VcsException {
+ private void run(File destination, ProgressTracker handler, List<String> parameters) throws VcsException {
BaseUpdateCommandListener listener = new BaseUpdateCommandListener(CommandUtil.correctUpToExistingParent(destination), handler);
execute(myVcs, SvnTarget.fromFile(destination), SvnCommandName.merge, parameters, listener);
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/GroupMerger.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/GroupMerger.java
index cb62668cbb25..73346ad4af66 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/GroupMerger.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/GroupMerger.java
@@ -27,8 +27,8 @@ import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.SvnBundle;
import org.jetbrains.idea.svn.SvnConfiguration;
import org.jetbrains.idea.svn.SvnVcs;
+import org.jetbrains.idea.svn.api.Depth;
import org.jetbrains.idea.svn.update.UpdateEventHandler;
-import org.tmatesoft.svn.core.SVNDepth;
import org.tmatesoft.svn.core.SVNException;
import org.tmatesoft.svn.core.SVNURL;
import org.tmatesoft.svn.core.wc.SVNRevision;
@@ -131,7 +131,7 @@ public class GroupMerger implements IMerger {
SvnTarget source = SvnTarget.fromURL(myCurrentBranchUrl);
MergeClient client = myVcs.getFactory(myTarget).createMergeClient();
- client.merge(source, createRange(), myTarget, SVNDepth.INFINITY, mySvnConfig.isMergeDryRun(), myDryRun, true,
+ client.merge(source, createRange(), myTarget, Depth.INFINITY, mySvnConfig.isMergeDryRun(), myDryRun, true,
mySvnConfig.getMergeOptions(), myHandler);
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/IntegrateEventHandler.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/IntegrateEventHandler.java
index 75533d8801c3..d043c95f1f1d 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/IntegrateEventHandler.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/IntegrateEventHandler.java
@@ -19,22 +19,22 @@ import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.vcs.update.FileGroup;
import org.jetbrains.idea.svn.SvnBundle;
import org.jetbrains.idea.svn.SvnVcs;
+import org.jetbrains.idea.svn.api.EventAction;
+import org.jetbrains.idea.svn.api.ProgressEvent;
+import org.jetbrains.idea.svn.status.StatusType;
import org.jetbrains.idea.svn.update.UpdateEventHandler;
-import org.tmatesoft.svn.core.wc.SVNEvent;
-import org.tmatesoft.svn.core.wc.SVNEventAction;
-import org.tmatesoft.svn.core.wc.SVNStatusType;
public class IntegrateEventHandler extends UpdateEventHandler {
public IntegrateEventHandler(final SvnVcs vcs, final ProgressIndicator progressIndicator) {
super(vcs, progressIndicator, null);
}
- protected boolean handleInDescendants(final SVNEvent event) {
- if ((event.getAction() == SVNEventAction.UPDATE_UPDATE) && (event.getContentsStatus() == SVNStatusType.UNCHANGED) &&
- (event.getPropertiesStatus() == SVNStatusType.UNKNOWN)) {
+ protected boolean handleInDescendants(final ProgressEvent event) {
+ if ((event.getAction() == EventAction.UPDATE_UPDATE) && (event.getContentsStatus() == StatusType.UNCHANGED) &&
+ (event.getPropertiesStatus() == StatusType.UNKNOWN)) {
myText2 = SvnBundle.message("progres.text2.updated", event.getFile().getName());
return true;
- } else if (event.getAction() == SVNEventAction.DELETE) {
+ } else if (event.getAction() == EventAction.DELETE) {
addFileToGroup(FileGroup.REMOVED_FROM_REPOSITORY_ID, event);
myText2 = SvnBundle.message("progress.text2.deleted", event.getFile().getName());
return true;
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/IntegratedSelectedOptionsDialog.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/IntegratedSelectedOptionsDialog.java
index 3029f156a69c..3b2184c22484 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/IntegratedSelectedOptionsDialog.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/IntegratedSelectedOptionsDialog.java
@@ -32,8 +32,8 @@ import com.intellij.util.PlatformIcons;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.*;
+import org.jetbrains.idea.svn.info.Info;
import org.tmatesoft.svn.core.SVNURL;
-import org.tmatesoft.svn.core.wc.SVNInfo;
import javax.swing.*;
import javax.swing.event.ListSelectionEvent;
@@ -248,7 +248,7 @@ public class IntegratedSelectedOptionsDialog extends DialogWrapper {
@Nullable
private static SVNURL realTargetUrl(final SvnVcs vcs, final WorkingCopyInfo info, final String targetBranchUrl) {
- final SVNInfo svnInfo = vcs.getInfo(info.getLocalPath());
+ final Info svnInfo = vcs.getInfo(info.getLocalPath());
final SVNURL svnurl = svnInfo != null ? svnInfo.getURL() : null;
return (svnurl != null) && (svnurl.toString().startsWith(targetBranchUrl)) ? svnurl : null;
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/MergeCalculatorTask.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/MergeCalculatorTask.java
index 782bd789e00e..6e9f165798a0 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/MergeCalculatorTask.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/MergeCalculatorTask.java
@@ -33,16 +33,11 @@ import org.jetbrains.idea.svn.actions.ChangeListsMergerFactory;
import org.jetbrains.idea.svn.dialogs.MergeContext;
import org.jetbrains.idea.svn.dialogs.QuickMergeContentsVariants;
import org.jetbrains.idea.svn.dialogs.SvnBranchPointsCalculator;
-import org.jetbrains.idea.svn.history.SvnChangeList;
-import org.jetbrains.idea.svn.history.SvnCommittedChangesProvider;
-import org.jetbrains.idea.svn.history.SvnRepositoryLocation;
-import org.jetbrains.idea.svn.history.TreeStructureNode;
+import org.jetbrains.idea.svn.history.*;
import org.jetbrains.idea.svn.mergeinfo.MergeChecker;
import org.jetbrains.idea.svn.mergeinfo.OneShotMergeInfoHelper;
import org.jetbrains.idea.svn.mergeinfo.SvnMergeInfoCache;
import org.jetbrains.idea.svn.update.UpdateEventHandler;
-import org.tmatesoft.svn.core.SVNLogEntry;
-import org.tmatesoft.svn.core.SVNLogEntryPath;
import org.tmatesoft.svn.core.SVNURL;
import org.tmatesoft.svn.core.internal.util.SVNPathUtil;
@@ -121,13 +116,13 @@ public class MergeCalculatorTask extends BaseMergeTask implements
String relativeBranch = SVNPathUtil.getRelativePath(myMergeContext.getWcInfo().getRepositoryRoot(), myMergeContext.getSourceUrl());
relativeBranch = (relativeBranch.startsWith("/") ? relativeBranch : "/" + relativeBranch);
- final LinkedList<Pair<SvnChangeList, TreeStructureNode<SVNLogEntry>>> list =
- new LinkedList<Pair<SvnChangeList, TreeStructureNode<SVNLogEntry>>>();
+ final LinkedList<Pair<SvnChangeList, LogHierarchyNode>> list =
+ new LinkedList<Pair<SvnChangeList, LogHierarchyNode>>();
try {
committedChangesProvider.getCommittedChangesWithMergedRevisons(settings, new SvnRepositoryLocation(myMergeContext.getSourceUrl()), 0,
- new PairConsumer<SvnChangeList, TreeStructureNode<SVNLogEntry>>() {
+ new PairConsumer<SvnChangeList, LogHierarchyNode>() {
public void consume(SvnChangeList svnList,
- TreeStructureNode<SVNLogEntry> tree) {
+ LogHierarchyNode tree) {
indicator.checkCanceled();
if (sourceLatest >= svnList.getNumber()) return;
list.add(
@@ -144,7 +139,7 @@ public class MergeCalculatorTask extends BaseMergeTask implements
indicator.setText("Checking merge information...");
// to do not go into file system while asking something on the net
- for (Pair<SvnChangeList, TreeStructureNode<SVNLogEntry>> pair : list) {
+ for (Pair<SvnChangeList, LogHierarchyNode> pair : list) {
final SvnChangeList svnList = pair.getFirst();
final SvnMergeInfoCache.MergeCheckResult checkResult = myMergeChecker.checkList(svnList);
indicator.setText2("Processing revision " + svnList.getNumber());
@@ -204,7 +199,7 @@ public class MergeCalculatorTask extends BaseMergeTask implements
// true if errors found
static boolean checkListForPaths(String relativeLocal,
- String relativeBranch, Pair<SvnChangeList, TreeStructureNode<SVNLogEntry>> pair) {
+ String relativeBranch, Pair<SvnChangeList, LogHierarchyNode> pair) {
// TODO: Such filtering logic is not clear enough so far (and probably not correct for all cases - for instance when we perform merge
// TODO: from branch1 to branch2 and have revision which contain merge changes from branch3 to branch1.
// TODO: In this case paths of child log entries will not contain neither urls from branch1 nor from branch2 - and checkEntry() method
@@ -212,9 +207,9 @@ public class MergeCalculatorTask extends BaseMergeTask implements
// TODO: Why do we check entries recursively - we have a revision - set of changes in the "merge from" branch? Why do we need to check
// TODO: where they came from - we want avoid some circular merges or what? Does subversion itself perform such checks or not?
- final List<TreeStructureNode<SVNLogEntry>> children = pair.getSecond().getChildren();
+ final List<LogHierarchyNode> children = pair.getSecond().getChildren();
boolean localChange = false;
- for (TreeStructureNode<SVNLogEntry> child : children) {
+ for (LogHierarchyNode child : children) {
if (checkForSubtree(child, relativeLocal, relativeBranch)) {
localChange = true;
break;
@@ -228,13 +223,13 @@ public class MergeCalculatorTask extends BaseMergeTask implements
}
// true if errors found
- private static boolean checkForSubtree(final TreeStructureNode<SVNLogEntry> tree,
+ private static boolean checkForSubtree(final LogHierarchyNode tree,
String relativeBranch, final String localURL) {
- final LinkedList<TreeStructureNode<SVNLogEntry>> queue = new LinkedList<TreeStructureNode<SVNLogEntry>>();
+ final LinkedList<LogHierarchyNode> queue = new LinkedList<LogHierarchyNode>();
queue.addLast(tree);
while (!queue.isEmpty()) {
- final TreeStructureNode<SVNLogEntry> element = queue.removeFirst();
+ final LogHierarchyNode element = queue.removeFirst();
ProgressManager.checkCanceled();
if (checkForEntry(element.getMe(), localURL, relativeBranch)) return true;
@@ -248,11 +243,11 @@ public class MergeCalculatorTask extends BaseMergeTask implements
// or if no changed paths in current branch, checks if at least one path in "merge from" branch
// NOTE: this fails for "merge-source" log entries from other branches - when all changed paths are from some
// third branch - this logic treats such log entry as local.
- private static boolean checkForEntry(final SVNLogEntry entry, final String localURL, String relativeBranch) {
+ private static boolean checkForEntry(final LogEntry entry, final String localURL, String relativeBranch) {
boolean atLeastOneUnderBranch = false;
final Map map = entry.getChangedPaths();
for (Object o : map.values()) {
- final SVNLogEntryPath path = (SVNLogEntryPath)o;
+ final LogEntryPath path = (LogEntryPath)o;
if (SVNPathUtil.isAncestor(localURL, path.getPath())) {
return true;
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/MergeClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/MergeClient.java
index 94e4c9cece38..d32ea2951cd0 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/MergeClient.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/MergeClient.java
@@ -3,10 +3,10 @@ package org.jetbrains.idea.svn.integrate;
import com.intellij.openapi.vcs.VcsException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import org.jetbrains.idea.svn.api.Depth;
+import org.jetbrains.idea.svn.api.ProgressTracker;
import org.jetbrains.idea.svn.api.SvnClient;
-import org.tmatesoft.svn.core.SVNDepth;
-import org.tmatesoft.svn.core.wc.ISVNEventHandler;
-import org.tmatesoft.svn.core.wc.SVNDiffOptions;
+import org.jetbrains.idea.svn.diff.DiffOptions;
import org.tmatesoft.svn.core.wc.SVNRevisionRange;
import org.tmatesoft.svn.core.wc2.SvnTarget;
@@ -20,27 +20,27 @@ public interface MergeClient extends SvnClient {
void merge(@NotNull SvnTarget source,
@NotNull File destination,
boolean dryRun,
- @Nullable SVNDiffOptions diffOptions,
- @Nullable ISVNEventHandler handler) throws VcsException;
+ @Nullable DiffOptions diffOptions,
+ @Nullable ProgressTracker handler) throws VcsException;
void merge(@NotNull SvnTarget source,
@NotNull SVNRevisionRange range,
@NotNull File destination,
- @Nullable SVNDepth depth,
+ @Nullable Depth depth,
boolean dryRun,
boolean recordOnly,
boolean force,
- @Nullable SVNDiffOptions diffOptions,
- @Nullable ISVNEventHandler handler) throws VcsException;
+ @Nullable DiffOptions diffOptions,
+ @Nullable ProgressTracker handler) throws VcsException;
void merge(@NotNull SvnTarget source1,
@NotNull SvnTarget source2,
@NotNull File destination,
- @Nullable SVNDepth depth,
+ @Nullable Depth depth,
boolean useAncestry,
boolean dryRun,
boolean recordOnly,
boolean force,
- @Nullable SVNDiffOptions diffOptions,
- @Nullable ISVNEventHandler handler) throws VcsException;
+ @Nullable DiffOptions diffOptions,
+ @Nullable ProgressTracker handler) throws VcsException;
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/Merger.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/Merger.java
index 8f534b90bb27..07e0c5bbb737 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/Merger.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/Merger.java
@@ -28,8 +28,9 @@ import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.SvnBundle;
import org.jetbrains.idea.svn.SvnConfiguration;
import org.jetbrains.idea.svn.SvnVcs;
+import org.jetbrains.idea.svn.api.Depth;
+import org.jetbrains.idea.svn.api.ProgressTracker;
import org.jetbrains.idea.svn.update.UpdateEventHandler;
-import org.tmatesoft.svn.core.SVNDepth;
import org.tmatesoft.svn.core.SVNException;
import org.tmatesoft.svn.core.SVNURL;
import org.tmatesoft.svn.core.wc.*;
@@ -44,7 +45,7 @@ import java.util.List;
public class Merger implements IMerger {
protected final List<CommittedChangeList> myChangeLists;
protected final File myTarget;
- @Nullable private final ISVNEventHandler myHandler;
+ @Nullable private final ProgressTracker myHandler;
protected int myCount;
private final ProgressIndicator myProgressIndicator;
protected CommittedChangeList myLatestProcessed;
@@ -128,7 +129,7 @@ public class Merger implements IMerger {
SvnTarget source = SvnTarget.fromURL(myCurrentBranchUrl);
MergeClient client = myVcs.getFactory(myTarget).createMergeClient();
- client.merge(source, createRange(), myTarget, SVNDepth.INFINITY, mySvnConfig.isMergeDryRun(), isRecordOnly(), true,
+ client.merge(source, createRange(), myTarget, Depth.INFINITY, mySvnConfig.isMergeDryRun(), isRecordOnly(), true,
mySvnConfig.getMergeOptions(), myHandler);
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/PointMerger.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/PointMerger.java
index 1a58a3c80b68..aabf015f97ee 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/PointMerger.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/PointMerger.java
@@ -22,11 +22,11 @@ import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.SvnRevisionNumber;
import org.jetbrains.idea.svn.SvnUtil;
import org.jetbrains.idea.svn.SvnVcs;
+import org.jetbrains.idea.svn.api.Depth;
import org.jetbrains.idea.svn.copy.CopyMoveClient;
import org.jetbrains.idea.svn.delete.DeleteClient;
import org.jetbrains.idea.svn.history.SvnRepositoryContentRevision;
import org.jetbrains.idea.svn.update.UpdateEventHandler;
-import org.tmatesoft.svn.core.SVNDepth;
import org.tmatesoft.svn.core.SVNException;
import org.tmatesoft.svn.core.SVNURL;
import org.tmatesoft.svn.core.internal.util.SVNPathUtil;
@@ -87,7 +87,7 @@ public class PointMerger extends Merger {
SvnTarget source1 = SvnTarget.fromURL(SVNURL.parseURIEncoded(beforeUrl), ((SvnRevisionNumber)before.getRevisionNumber()).getRevision());
SvnTarget source2 = SvnTarget.fromURL(SVNURL.parseURIEncoded(afterUrl), ((SvnRevisionNumber) after.getRevisionNumber()).getRevision());
- client.merge(source1, source2, afterPath, SVNDepth.FILES, true, mySvnConfig.isMergeDryRun(), false, false, mySvnConfig.getMergeOptions(),
+ client.merge(source1, source2, afterPath, Depth.FILES, true, mySvnConfig.isMergeDryRun(), false, false, mySvnConfig.getMergeOptions(),
myHandler);
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/SvnIntegrateChangesTask.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/SvnIntegrateChangesTask.java
index b4e544ba1e3d..5dd6f24b10ba 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/SvnIntegrateChangesTask.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/SvnIntegrateChangesTask.java
@@ -36,11 +36,11 @@ import org.jetbrains.idea.svn.SvnBundle;
import org.jetbrains.idea.svn.SvnChangeProvider;
import org.jetbrains.idea.svn.SvnUtil;
import org.jetbrains.idea.svn.SvnVcs;
+import org.jetbrains.idea.svn.status.Status;
+import org.jetbrains.idea.svn.status.StatusType;
import org.jetbrains.idea.svn.update.UpdateEventHandler;
import org.tmatesoft.svn.core.SVNException;
import org.tmatesoft.svn.core.SVNURL;
-import org.tmatesoft.svn.core.wc.SVNStatus;
-import org.tmatesoft.svn.core.wc.SVNStatusType;
import java.io.File;
import java.util.ArrayList;
@@ -267,8 +267,8 @@ public class SvnIntegrateChangesTask extends Task.Backgroundable {
private void initMergeTarget() {
final File mergeInfoHolder = myMerger.getMergeInfoHolder();
if (mergeInfoHolder != null) {
- final SVNStatus svnStatus = SvnUtil.getStatus(myVcs, mergeInfoHolder);
- if ((svnStatus != null) && (SVNStatusType.STATUS_MODIFIED.equals(svnStatus.getPropertiesStatus()))) {
+ final Status svnStatus = SvnUtil.getStatus(myVcs, mergeInfoHolder);
+ if ((svnStatus != null) && (StatusType.STATUS_MODIFIED.equals(svnStatus.getPropertiesStatus()))) {
myMergeTarget = FilePathImpl.create(mergeInfoHolder, mergeInfoHolder.isDirectory());
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/SvnKitMergeClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/SvnKitMergeClient.java
index e3635ff8827b..51cbc7c10409 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/SvnKitMergeClient.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/SvnKitMergeClient.java
@@ -4,11 +4,11 @@ import com.intellij.openapi.vcs.VcsException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.api.BaseSvnClient;
-import org.tmatesoft.svn.core.SVNDepth;
+import org.jetbrains.idea.svn.api.Depth;
+import org.jetbrains.idea.svn.api.ProgressTracker;
+import org.jetbrains.idea.svn.diff.DiffOptions;
import org.tmatesoft.svn.core.SVNException;
-import org.tmatesoft.svn.core.wc.ISVNEventHandler;
import org.tmatesoft.svn.core.wc.SVNDiffClient;
-import org.tmatesoft.svn.core.wc.SVNDiffOptions;
import org.tmatesoft.svn.core.wc.SVNRevisionRange;
import org.tmatesoft.svn.core.wc2.SvnTarget;
@@ -23,8 +23,8 @@ public class SvnKitMergeClient extends BaseSvnClient implements MergeClient {
public void merge(@NotNull SvnTarget source,
@NotNull File destination,
boolean dryRun,
- @Nullable SVNDiffOptions diffOptions,
- @Nullable ISVNEventHandler handler) throws VcsException {
+ @Nullable DiffOptions diffOptions,
+ @Nullable ProgressTracker handler) throws VcsException {
assertUrl(source);
try {
@@ -39,17 +39,17 @@ public class SvnKitMergeClient extends BaseSvnClient implements MergeClient {
public void merge(@NotNull SvnTarget source,
@NotNull SVNRevisionRange range,
@NotNull File destination,
- @Nullable SVNDepth depth,
+ @Nullable Depth depth,
boolean dryRun,
boolean recordOnly,
boolean force,
- @Nullable SVNDiffOptions diffOptions,
- @Nullable ISVNEventHandler handler) throws VcsException {
+ @Nullable DiffOptions diffOptions,
+ @Nullable ProgressTracker handler) throws VcsException {
assertUrl(source);
try {
createClient(diffOptions, handler).doMerge(source.getURL(), source.getPegRevision(), Collections.singletonList(range), destination,
- depth, true, force, dryRun, recordOnly);
+ toDepth(depth), true, force, dryRun, recordOnly);
}
catch (SVNException e) {
throw new VcsException(e);
@@ -60,19 +60,19 @@ public class SvnKitMergeClient extends BaseSvnClient implements MergeClient {
public void merge(@NotNull SvnTarget source1,
@NotNull SvnTarget source2,
@NotNull File destination,
- @Nullable SVNDepth depth,
+ @Nullable Depth depth,
boolean useAncestry,
boolean dryRun,
boolean recordOnly,
boolean force,
- @Nullable SVNDiffOptions diffOptions,
- @Nullable ISVNEventHandler handler) throws VcsException {
+ @Nullable DiffOptions diffOptions,
+ @Nullable ProgressTracker handler) throws VcsException {
assertUrl(source1);
assertUrl(source2);
try {
createClient(diffOptions, handler).doMerge(source1.getURL(), source1.getPegRevision(), source2.getURL(), source2.getPegRevision(),
- destination, depth, useAncestry, force, dryRun, recordOnly);
+ destination, toDepth(depth), useAncestry, force, dryRun, recordOnly);
}
catch (SVNException e) {
throw new VcsException(e);
@@ -80,11 +80,11 @@ public class SvnKitMergeClient extends BaseSvnClient implements MergeClient {
}
@NotNull
- private SVNDiffClient createClient(@Nullable SVNDiffOptions diffOptions, @Nullable ISVNEventHandler handler) {
+ private SVNDiffClient createClient(@Nullable DiffOptions diffOptions, @Nullable ProgressTracker handler) {
SVNDiffClient client = myVcs.getSvnKitManager().createDiffClient();
- client.setMergeOptions(diffOptions);
- client.setEventHandler(handler);
+ client.setMergeOptions(toDiffOptions(diffOptions));
+ client.setEventHandler(toEventHandler(handler));
return client;
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/lock/CmdLockClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/lock/CmdLockClient.java
index abc4b5b794c2..551431dd7f16 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/lock/CmdLockClient.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/lock/CmdLockClient.java
@@ -5,15 +5,14 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.SvnUtil;
import org.jetbrains.idea.svn.api.BaseSvnClient;
+import org.jetbrains.idea.svn.api.EventAction;
+import org.jetbrains.idea.svn.api.ProgressEvent;
+import org.jetbrains.idea.svn.api.ProgressTracker;
import org.jetbrains.idea.svn.commandLine.CommandExecutor;
import org.jetbrains.idea.svn.commandLine.CommandUtil;
import org.jetbrains.idea.svn.commandLine.SvnCommandName;
import org.tmatesoft.svn.core.SVNErrorMessage;
import org.tmatesoft.svn.core.SVNException;
-import org.tmatesoft.svn.core.SVNNodeKind;
-import org.tmatesoft.svn.core.wc.ISVNEventHandler;
-import org.tmatesoft.svn.core.wc.SVNEvent;
-import org.tmatesoft.svn.core.wc.SVNEventAction;
import org.tmatesoft.svn.core.wc2.SvnTarget;
import java.io.File;
@@ -26,22 +25,22 @@ import java.util.List;
public class CmdLockClient extends BaseSvnClient implements LockClient {
@Override
- public void lock(@NotNull File file, boolean force, @NotNull String message, @Nullable ISVNEventHandler handler) throws VcsException {
+ public void lock(@NotNull File file, boolean force, @NotNull String message, @Nullable ProgressTracker handler) throws VcsException {
List<String> parameters = prepareParameters(file, force);
parameters.add("--message");
parameters.add(message);
CommandExecutor command = execute(myVcs, SvnTarget.fromFile(file), SvnCommandName.lock, parameters, null);
- handleCommandCompletion(command, file, SVNEventAction.LOCKED, SVNEventAction.LOCK_FAILED, handler);
+ handleCommandCompletion(command, file, EventAction.LOCKED, EventAction.LOCK_FAILED, handler);
}
@Override
- public void unlock(@NotNull File file, boolean force, @Nullable ISVNEventHandler handler) throws VcsException {
+ public void unlock(@NotNull File file, boolean force, @Nullable ProgressTracker handler) throws VcsException {
List<String> parameters = prepareParameters(file, force);
CommandExecutor command = execute(myVcs, SvnTarget.fromFile(file), SvnCommandName.unlock, parameters, null);
- handleCommandCompletion(command, file, SVNEventAction.UNLOCKED, SVNEventAction.UNLOCK_FAILED, handler);
+ handleCommandCompletion(command, file, EventAction.UNLOCKED, EventAction.UNLOCK_FAILED, handler);
}
private static List<String> prepareParameters(@NotNull File file, boolean force) {
@@ -55,9 +54,9 @@ public class CmdLockClient extends BaseSvnClient implements LockClient {
private static void handleCommandCompletion(@NotNull CommandExecutor command,
@NotNull File file,
- @NotNull SVNEventAction success,
- @NotNull SVNEventAction failure,
- @Nullable ISVNEventHandler handler) throws VcsException {
+ @NotNull EventAction success,
+ @NotNull EventAction failure,
+ @Nullable ProgressTracker handler) throws VcsException {
// just warning appears in output when can not lock/unlock file for some reason (like, that file is already locked)
SVNErrorMessage error = SvnUtil.parseWarning(command.getErrorOutput());
@@ -70,17 +69,16 @@ public class CmdLockClient extends BaseSvnClient implements LockClient {
}
private static void invokeHandler(@NotNull File file,
- @NotNull SVNEventAction action,
- @Nullable ISVNEventHandler handler,
+ @NotNull EventAction action,
+ @Nullable ProgressTracker handler,
@Nullable SVNErrorMessage error)
throws SVNException {
if (handler != null) {
- handler.handleEvent(createEvent(file, action, error), 1);
+ handler.consume(createEvent(file, action, error));
}
}
- private static SVNEvent createEvent(@NotNull File file, @NotNull SVNEventAction action, @Nullable SVNErrorMessage error) {
- return new SVNEvent(file, file.isDirectory() ? SVNNodeKind.DIR : SVNNodeKind.FILE, null, -1, null, null, null, null, action, action,
- error, null, null, null, null);
+ private static ProgressEvent createEvent(@NotNull File file, @NotNull EventAction action, @Nullable SVNErrorMessage error) {
+ return new ProgressEvent(file, -1, null, null, action, error, null);
}
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/lock/Lock.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/lock/Lock.java
new file mode 100644
index 000000000000..60598a91aeda
--- /dev/null
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/lock/Lock.java
@@ -0,0 +1,128 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jetbrains.idea.svn.lock;
+
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+import org.tmatesoft.svn.core.SVNLock;
+
+import javax.xml.bind.annotation.*;
+import java.util.Date;
+
+/**
+ * TODO: Probably unify with LogicalLock class
+ *
+ * @author Konstantin Kolosovsky.
+ */
+public class Lock {
+
+ private final String myOwner;
+ private final String myComment;
+ private final Date myCreationDate;
+ @Nullable private final Date myExpirationDate;
+
+ @Nullable
+ public static Lock create(@Nullable SVNLock lock) {
+ Lock result = null;
+
+ if (lock != null) {
+ result = new Lock.Builder().setOwner(lock.getOwner()).setComment(lock.getComment()).setCreationDate(lock.getCreationDate())
+ .setExpirationDate(lock.getExpirationDate()).build();
+ }
+
+ return result;
+ }
+
+ public Lock(@NotNull Lock.Builder builder) {
+ myOwner = builder.owner;
+ myComment = builder.comment;
+ myCreationDate = builder.created;
+ myExpirationDate = builder.expires;
+ }
+
+ public String getComment() {
+ return myComment;
+ }
+
+ public Date getCreationDate() {
+ return myCreationDate;
+ }
+
+ @Nullable
+ public Date getExpirationDate() {
+ return myExpirationDate;
+ }
+
+ public String getOwner() {
+ return myOwner;
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "lock")
+ @XmlRootElement(name = "lock")
+ public static class Builder {
+
+ @XmlElement(name = "token")
+ private String token;
+
+ @XmlElement(name = "owner")
+ private String owner;
+
+ @XmlElement(name = "comment")
+ private String comment;
+
+ @XmlElement(name = "created")
+ private Date created;
+
+ @XmlElement(name = "expires")
+ @Nullable private Date expires;
+
+ @NotNull
+ public Builder setToken(String token) {
+ this.token = token;
+ return this;
+ }
+
+ @NotNull
+ public Builder setOwner(String owner) {
+ this.owner = owner;
+ return this;
+ }
+
+ @NotNull
+ public Builder setComment(String comment) {
+ this.comment = comment;
+ return this;
+ }
+
+ @NotNull
+ public Builder setCreationDate(Date creationDate) {
+ this.created = creationDate;
+ return this;
+ }
+
+ @NotNull
+ public Builder setExpirationDate(@Nullable Date expirationDate) {
+ this.expires = expirationDate;
+ return this;
+ }
+
+ @NotNull
+ public Lock build() {
+ return new Lock(this);
+ }
+ }
+}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/lock/LockClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/lock/LockClient.java
index f36891f294b3..4a64a4e88de3 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/lock/LockClient.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/lock/LockClient.java
@@ -3,8 +3,8 @@ package org.jetbrains.idea.svn.lock;
import com.intellij.openapi.vcs.VcsException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import org.jetbrains.idea.svn.api.ProgressTracker;
import org.jetbrains.idea.svn.api.SvnClient;
-import org.tmatesoft.svn.core.wc.ISVNEventHandler;
import java.io.File;
@@ -16,9 +16,9 @@ public interface LockClient extends SvnClient {
void lock(@NotNull File file,
boolean force,
@NotNull String message,
- @Nullable ISVNEventHandler handler) throws VcsException;
+ @Nullable ProgressTracker handler) throws VcsException;
void unlock(@NotNull File file,
boolean force,
- @Nullable ISVNEventHandler handler) throws VcsException;
+ @Nullable ProgressTracker handler) throws VcsException;
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/lock/SvnKitLockClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/lock/SvnKitLockClient.java
index d11aec262b09..2db2650aab04 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/lock/SvnKitLockClient.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/lock/SvnKitLockClient.java
@@ -4,9 +4,9 @@ import com.intellij.openapi.vcs.VcsException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.api.BaseSvnClient;
+import org.jetbrains.idea.svn.api.ProgressTracker;
import org.jetbrains.idea.svn.commandLine.SvnBindException;
import org.tmatesoft.svn.core.SVNException;
-import org.tmatesoft.svn.core.wc.ISVNEventHandler;
import org.tmatesoft.svn.core.wc.SVNWCClient;
import java.io.File;
@@ -17,7 +17,7 @@ import java.io.File;
public class SvnKitLockClient extends BaseSvnClient implements LockClient {
@Override
- public void lock(@NotNull File file, boolean force, @NotNull String message, @Nullable ISVNEventHandler handler) throws VcsException {
+ public void lock(@NotNull File file, boolean force, @NotNull String message, @Nullable ProgressTracker handler) throws VcsException {
try {
getClient(handler).doLock(new File[]{file}, force, message);
}
@@ -27,7 +27,7 @@ public class SvnKitLockClient extends BaseSvnClient implements LockClient {
}
@Override
- public void unlock(@NotNull File file, boolean force, @Nullable ISVNEventHandler handler) throws VcsException {
+ public void unlock(@NotNull File file, boolean force, @Nullable ProgressTracker handler) throws VcsException {
try {
getClient(handler).doUnlock(new File[]{file}, force);
}
@@ -37,10 +37,10 @@ public class SvnKitLockClient extends BaseSvnClient implements LockClient {
}
@NotNull
- private SVNWCClient getClient(@Nullable ISVNEventHandler handler) {
+ private SVNWCClient getClient(@Nullable ProgressTracker handler) {
SVNWCClient client = myVcs.getSvnKitManager().createWCClient();
- client.setEventHandler(handler);
+ client.setEventHandler(toEventHandler(handler));
return client;
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/mergeinfo/BranchInfo.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/mergeinfo/BranchInfo.java
index ead9b7ddc587..62638291b485 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/mergeinfo/BranchInfo.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/mergeinfo/BranchInfo.java
@@ -21,10 +21,10 @@ import com.intellij.openapi.vcs.VcsException;
import com.intellij.util.containers.MultiMap;
import org.jetbrains.idea.svn.SvnVcs;
import org.jetbrains.idea.svn.history.SvnChangeList;
+import org.jetbrains.idea.svn.info.Info;
import org.tmatesoft.svn.core.*;
import org.tmatesoft.svn.core.internal.util.SVNMergeInfoUtil;
import org.tmatesoft.svn.core.internal.util.SVNPathUtil;
-import org.tmatesoft.svn.core.wc.SVNInfo;
import org.tmatesoft.svn.core.wc.SVNPropertyData;
import org.tmatesoft.svn.core.wc.SVNRevision;
import org.tmatesoft.svn.core.wc2.SvnTarget;
@@ -123,7 +123,7 @@ public class BranchInfo {
}
private SvnMergeInfoCache.MergeCheckResult checkAlive(final SvnChangeList list, final String branchPath) {
- final SVNInfo info = getInfo(new File(branchPath));
+ final Info info = getInfo(new File(branchPath));
if (info == null || info.getURL() == null || (! SVNPathUtil.isAncestor(myBranchUrl, info.getURL().toString()))) {
return SvnMergeInfoCache.MergeCheckResult.NOT_MERGED;
}
@@ -179,7 +179,7 @@ public class BranchInfo {
// no paths in local copy
return SvnMergeInfoCache.MergeCheckResult.NOT_EXISTS;
}
- final SVNInfo svnInfo = getInfo(new File(branchRootPath));
+ final Info svnInfo = getInfo(new File(branchRootPath));
if (svnInfo == null || svnInfo.getRevision() == null || svnInfo.getURL() == null) {
return SvnMergeInfoCache.MergeCheckResult.NOT_MERGED;
}
@@ -238,7 +238,7 @@ public class BranchInfo {
return processMergeinfoProperty(keyString, revisionAsked, mergeinfoProperty.getValue(), trunkUrl, false);
}
- private SVNInfo getInfo(final File pathFile) {
+ private Info getInfo(final File pathFile) {
return myVcs.getInfo(pathFile);
}
@@ -255,7 +255,7 @@ public class BranchInfo {
}
}
- final SVNInfo svnInfo = getInfo(pathFile);
+ final Info svnInfo = getInfo(pathFile);
if (svnInfo == null || svnInfo.getRevision() == null || svnInfo.getURL() == null) {
LOG.info("Svninfo for " + pathFile + " is null or not full.");
return SvnMergeInfoCache.MergeCheckResult.NOT_MERGED;
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/mergeinfo/OneRecursiveShotMergeInfoWorker.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/mergeinfo/OneRecursiveShotMergeInfoWorker.java
index bd2c41537091..0ea95c99c4d4 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/mergeinfo/OneRecursiveShotMergeInfoWorker.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/mergeinfo/OneRecursiveShotMergeInfoWorker.java
@@ -21,6 +21,7 @@ import com.intellij.openapi.vcs.AreaMap;
import com.intellij.openapi.vcs.VcsException;
import com.intellij.util.PairProcessor;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.idea.svn.api.Depth;
import org.jetbrains.idea.svn.dialogs.MergeContext;
import org.tmatesoft.svn.core.*;
import org.tmatesoft.svn.core.internal.util.SVNMergeInfoUtil;
@@ -61,7 +62,7 @@ public class OneRecursiveShotMergeInfoWorker implements MergeInfoWorker {
}
public void prepare() throws VcsException {
- final SVNDepth depth = myMergeContext.getVcs().getSvnConfiguration().isCheckNestedForQuickMerge() ? SVNDepth.INFINITY : SVNDepth.EMPTY;
+ final Depth depth = Depth.allOrEmpty(myMergeContext.getVcs().getSvnConfiguration().isCheckNestedForQuickMerge());
ISVNPropertyHandler handler = new ISVNPropertyHandler() {
public void handleProperty(File path, SVNPropertyData property) throws SVNException {
final String key = keyFromFile(path);
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/properties/CmdPropertyClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/properties/CmdPropertyClient.java
index 60ab43c3baba..e855abe1ec2e 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/properties/CmdPropertyClient.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/properties/CmdPropertyClient.java
@@ -5,12 +5,13 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.SvnUtil;
import org.jetbrains.idea.svn.api.BaseSvnClient;
+import org.jetbrains.idea.svn.api.Depth;
import org.jetbrains.idea.svn.commandLine.CommandExecutor;
import org.jetbrains.idea.svn.commandLine.CommandUtil;
import org.jetbrains.idea.svn.commandLine.SvnCommandName;
+import org.jetbrains.idea.svn.info.Info;
import org.tmatesoft.svn.core.*;
import org.tmatesoft.svn.core.wc.ISVNPropertyHandler;
-import org.tmatesoft.svn.core.wc.SVNInfo;
import org.tmatesoft.svn.core.wc.SVNPropertyData;
import org.tmatesoft.svn.core.wc.SVNRevision;
import org.tmatesoft.svn.core.wc2.SvnTarget;
@@ -63,7 +64,7 @@ public class CmdPropertyClient extends BaseSvnClient implements PropertyClient {
public void getProperty(@NotNull SvnTarget target,
@NotNull String property,
@Nullable SVNRevision revision,
- @Nullable SVNDepth depth,
+ @Nullable Depth depth,
@Nullable ISVNPropertyHandler handler) throws VcsException {
List<String> parameters = new ArrayList<String>();
@@ -77,7 +78,7 @@ public class CmdPropertyClient extends BaseSvnClient implements PropertyClient {
@Override
public void list(@NotNull SvnTarget target,
@Nullable SVNRevision revision,
- @Nullable SVNDepth depth,
+ @Nullable Depth depth,
@Nullable ISVNPropertyHandler handler) throws VcsException {
List<String> parameters = new ArrayList<String>();
fillListParameters(target, revision, depth, parameters, true);
@@ -90,7 +91,7 @@ public class CmdPropertyClient extends BaseSvnClient implements PropertyClient {
public void setProperty(@NotNull File file,
@NotNull String property,
@Nullable SVNPropertyValue value,
- @Nullable SVNDepth depth,
+ @Nullable Depth depth,
boolean force) throws VcsException {
runSetProperty(SvnTarget.fromFile(file), property, null, depth, value, force);
}
@@ -101,7 +102,7 @@ public class CmdPropertyClient extends BaseSvnClient implements PropertyClient {
currentProperties.putAll(properties);
for (String propertyName : currentProperties.nameSet()) {
- setProperty(file, propertyName, currentProperties.getSVNPropertyValue(propertyName), SVNDepth.EMPTY, true);
+ setProperty(file, propertyName, currentProperties.getSVNPropertyValue(propertyName), Depth.EMPTY, true);
}
}
@@ -109,7 +110,7 @@ public class CmdPropertyClient extends BaseSvnClient implements PropertyClient {
private SVNProperties collectPropertiesToDelete(@NotNull File file) throws VcsException {
final SVNProperties result = new SVNProperties();
- list(SvnTarget.fromFile(file), null, SVNDepth.EMPTY, new ISVNPropertyHandler() {
+ list(SvnTarget.fromFile(file), null, Depth.EMPTY, new ISVNPropertyHandler() {
@Override
public void handleProperty(File path, SVNPropertyData property) throws SVNException {
// null indicates property will be deleted
@@ -140,7 +141,7 @@ public class CmdPropertyClient extends BaseSvnClient implements PropertyClient {
private void runSetProperty(@NotNull SvnTarget target,
@NotNull String property,
@Nullable SVNRevision revision,
- @Nullable SVNDepth depth,
+ @Nullable Depth depth,
@Nullable SVNPropertyValue value,
boolean force) throws VcsException {
List<String> parameters = new ArrayList<String>();
@@ -169,7 +170,7 @@ public class CmdPropertyClient extends BaseSvnClient implements PropertyClient {
private void fillListParameters(@NotNull SvnTarget target,
@Nullable SVNRevision revision,
- @Nullable SVNDepth depth,
+ @Nullable Depth depth,
@NotNull List<String> parameters,
boolean verbose) {
CommandUtil.put(parameters, target);
@@ -266,7 +267,7 @@ public class CmdPropertyClient extends BaseSvnClient implements PropertyClient {
// base should be resolved manually - could not set revision to BASE to get revision property
if (SVNRevision.BASE.equals(revision)) {
- SVNInfo info = myVcs.getInfo(path, SVNRevision.BASE);
+ Info info = myVcs.getInfo(path, SVNRevision.BASE);
result = info != null ? info.getRevision().getNumber() : -1;
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/properties/PropertyClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/properties/PropertyClient.java
index b44f7ea12e75..1b61d59c0e20 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/properties/PropertyClient.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/properties/PropertyClient.java
@@ -5,8 +5,8 @@ import com.intellij.openapi.vfs.CharsetToolkit;
import com.intellij.util.LineSeparator;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import org.jetbrains.idea.svn.api.Depth;
import org.jetbrains.idea.svn.api.SvnClient;
-import org.tmatesoft.svn.core.SVNDepth;
import org.tmatesoft.svn.core.SVNProperties;
import org.tmatesoft.svn.core.SVNPropertyValue;
import org.tmatesoft.svn.core.internal.wc.DefaultSVNOptions;
@@ -38,18 +38,18 @@ public interface PropertyClient extends SvnClient {
void getProperty(@NotNull SvnTarget target, @NotNull String property,
@Nullable SVNRevision revision,
- @Nullable SVNDepth depth,
+ @Nullable Depth depth,
@Nullable ISVNPropertyHandler handler) throws VcsException;
void list(@NotNull SvnTarget target,
@Nullable SVNRevision revision,
- @Nullable SVNDepth depth,
+ @Nullable Depth depth,
@Nullable ISVNPropertyHandler handler) throws VcsException;
void setProperty(@NotNull File file,
@NotNull String property,
@Nullable SVNPropertyValue value,
- @Nullable SVNDepth depth,
+ @Nullable Depth depth,
boolean force) throws VcsException;
void setProperties(@NotNull File file, @NotNull SVNProperties properties) throws VcsException;
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/properties/SvnKitPropertyClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/properties/SvnKitPropertyClient.java
index 64343927be11..4ad3f10afccc 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/properties/SvnKitPropertyClient.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/properties/SvnKitPropertyClient.java
@@ -4,6 +4,7 @@ import com.intellij.openapi.vcs.VcsException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.api.BaseSvnClient;
+import org.jetbrains.idea.svn.api.Depth;
import org.jetbrains.idea.svn.commandLine.SvnBindException;
import org.tmatesoft.svn.core.*;
import org.tmatesoft.svn.core.wc.*;
@@ -50,7 +51,7 @@ public class SvnKitPropertyClient extends BaseSvnClient implements PropertyClien
public void getProperty(@NotNull SvnTarget target,
@NotNull String property,
@Nullable SVNRevision revision,
- @Nullable SVNDepth depth,
+ @Nullable Depth depth,
@Nullable ISVNPropertyHandler handler) throws VcsException {
runGetProperty(target, property, revision, depth, handler);
}
@@ -58,7 +59,7 @@ public class SvnKitPropertyClient extends BaseSvnClient implements PropertyClien
@Override
public void list(@NotNull SvnTarget target,
@Nullable SVNRevision revision,
- @Nullable SVNDepth depth,
+ @Nullable Depth depth,
@Nullable ISVNPropertyHandler handler) throws VcsException {
runGetProperty(target, null, revision, depth, handler);
}
@@ -67,10 +68,10 @@ public class SvnKitPropertyClient extends BaseSvnClient implements PropertyClien
public void setProperty(@NotNull File file,
@NotNull String property,
@Nullable SVNPropertyValue value,
- @Nullable SVNDepth depth,
+ @Nullable Depth depth,
boolean force) throws VcsException {
try {
- createClient().doSetProperty(file, property, value, force, depth, null, null);
+ createClient().doSetProperty(file, property, value, force, toDepth(depth), null, null);
}
catch (SVNException e) {
throw new SvnBindException(e);
@@ -114,15 +115,15 @@ public class SvnKitPropertyClient extends BaseSvnClient implements PropertyClien
private void runGetProperty(@NotNull SvnTarget target,
@Nullable String property,
@Nullable SVNRevision revision,
- @Nullable SVNDepth depth,
+ @Nullable Depth depth,
@Nullable ISVNPropertyHandler handler) throws VcsException {
SVNWCClient client = createClient();
try {
if (target.isURL()) {
- client.doGetProperty(target.getURL(), property, target.getPegRevision(), revision, depth, handler);
+ client.doGetProperty(target.getURL(), property, target.getPegRevision(), revision, toDepth(depth), handler);
} else {
- client.doGetProperty(target.getFile(), property, target.getPegRevision(), revision, depth, handler, null);
+ client.doGetProperty(target.getFile(), property, target.getPegRevision(), revision, toDepth(depth), handler, null);
}
} catch (SVNException e) {
throw new VcsException(e);
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/revert/CmdRevertClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/revert/CmdRevertClient.java
index aef5ae942687..a57e24b525d7 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/revert/CmdRevertClient.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/revert/CmdRevertClient.java
@@ -4,15 +4,11 @@ import com.intellij.openapi.vcs.VcsException;
import com.intellij.util.containers.Convertor;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
-import org.jetbrains.idea.svn.api.BaseSvnClient;
-import org.jetbrains.idea.svn.api.FileStatusResultParser;
+import org.jetbrains.idea.svn.api.*;
import org.jetbrains.idea.svn.commandLine.CommandExecutor;
import org.jetbrains.idea.svn.commandLine.CommandUtil;
import org.jetbrains.idea.svn.commandLine.SvnCommandName;
-import org.tmatesoft.svn.core.SVNDepth;
-import org.tmatesoft.svn.core.wc.ISVNEventHandler;
-import org.tmatesoft.svn.core.wc.SVNEvent;
-import org.tmatesoft.svn.core.wc.SVNEventAction;
+import org.jetbrains.idea.svn.api.Depth;
import org.tmatesoft.svn.core.wc2.SvnTarget;
import java.io.File;
@@ -32,7 +28,7 @@ public class CmdRevertClient extends BaseSvnClient implements RevertClient {
private static final Pattern CHANGED_PATH = Pattern.compile(STATUS + PATH + OPTIONAL_COMMENT);
@Override
- public void revert(@NotNull File[] paths, @Nullable SVNDepth depth, @Nullable ISVNEventHandler handler) throws VcsException {
+ public void revert(@NotNull File[] paths, @Nullable Depth depth, @Nullable ProgressTracker handler) throws VcsException {
if (paths.length > 0) {
List<String> parameters = prepareParameters(paths, depth);
@@ -46,7 +42,7 @@ public class CmdRevertClient extends BaseSvnClient implements RevertClient {
}
}
- private static List<String> prepareParameters(File[] paths, SVNDepth depth) {
+ private static List<String> prepareParameters(File[] paths, Depth depth) {
ArrayList<String> parameters = new ArrayList<String>();
CommandUtil.put(parameters, paths);
@@ -55,9 +51,9 @@ public class CmdRevertClient extends BaseSvnClient implements RevertClient {
return parameters;
}
- private static class RevertStatusConvertor implements Convertor<Matcher, SVNEvent> {
+ private static class RevertStatusConvertor implements Convertor<Matcher, ProgressEvent> {
- public SVNEvent convert(@NotNull Matcher matcher) {
+ public ProgressEvent convert(@NotNull Matcher matcher) {
String statusMessage = matcher.group(1);
String path = matcher.group(2);
@@ -65,17 +61,17 @@ public class CmdRevertClient extends BaseSvnClient implements RevertClient {
}
@Nullable
- public static SVNEventAction createAction(@NotNull String code) {
- SVNEventAction result = null;
+ public static EventAction createAction(@NotNull String code) {
+ EventAction result = null;
if ("Reverted".equals(code)) {
- result = SVNEventAction.REVERT;
+ result = EventAction.REVERT;
}
else if ("Failed to revert".equals(code)) {
- result = SVNEventAction.FAILED_REVERT;
+ result = EventAction.FAILED_REVERT;
}
else if ("Skipped".equals(code)) {
- result = SVNEventAction.SKIP;
+ result = EventAction.SKIP;
}
return result;
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/revert/RevertClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/revert/RevertClient.java
index 053de373bc0a..5f0d26bb09aa 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/revert/RevertClient.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/revert/RevertClient.java
@@ -3,9 +3,9 @@ package org.jetbrains.idea.svn.revert;
import com.intellij.openapi.vcs.VcsException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import org.jetbrains.idea.svn.api.Depth;
+import org.jetbrains.idea.svn.api.ProgressTracker;
import org.jetbrains.idea.svn.api.SvnClient;
-import org.tmatesoft.svn.core.SVNDepth;
-import org.tmatesoft.svn.core.wc.ISVNEventHandler;
import java.io.File;
@@ -14,5 +14,5 @@ import java.io.File;
*/
public interface RevertClient extends SvnClient {
- void revert(@NotNull File[] paths, @Nullable SVNDepth depth, @Nullable ISVNEventHandler handler) throws VcsException;
+ void revert(@NotNull File[] paths, @Nullable Depth depth, @Nullable ProgressTracker handler) throws VcsException;
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/revert/SvnKitRevertClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/revert/SvnKitRevertClient.java
index ea88ebcc7c32..06593f472106 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/revert/SvnKitRevertClient.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/revert/SvnKitRevertClient.java
@@ -4,9 +4,9 @@ import com.intellij.openapi.vcs.VcsException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.api.BaseSvnClient;
-import org.tmatesoft.svn.core.SVNDepth;
+import org.jetbrains.idea.svn.api.Depth;
+import org.jetbrains.idea.svn.api.ProgressTracker;
import org.tmatesoft.svn.core.SVNException;
-import org.tmatesoft.svn.core.wc.ISVNEventHandler;
import org.tmatesoft.svn.core.wc.SVNWCClient;
import java.io.File;
@@ -17,12 +17,12 @@ import java.io.File;
public class SvnKitRevertClient extends BaseSvnClient implements RevertClient {
@Override
- public void revert(@NotNull File[] paths, @Nullable SVNDepth depth, @Nullable ISVNEventHandler handler) throws VcsException {
+ public void revert(@NotNull File[] paths, @Nullable Depth depth, @Nullable ProgressTracker handler) throws VcsException {
SVNWCClient client = myVcs.getSvnKitManager().createWCClient();
- client.setEventHandler(handler);
+ client.setEventHandler(toEventHandler(handler));
try {
- client.doRevert(paths, depth, null);
+ client.doRevert(paths, toDepth(depth), null);
}
catch (SVNException e) {
throw new VcsException(e);
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/rollback/SvnRollbackEnvironment.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/rollback/SvnRollbackEnvironment.java
index 01c86eb1054b..237d05bd5f7a 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/rollback/SvnRollbackEnvironment.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/rollback/SvnRollbackEnvironment.java
@@ -28,6 +28,12 @@ import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.*;
+import org.jetbrains.idea.svn.api.Depth;
+import org.jetbrains.idea.svn.api.EventAction;
+import org.jetbrains.idea.svn.api.ProgressEvent;
+import org.jetbrains.idea.svn.api.ProgressTracker;
+import org.jetbrains.idea.svn.commandLine.SvnBindException;
+import org.jetbrains.idea.svn.info.Info;
import org.tmatesoft.svn.core.*;
import org.tmatesoft.svn.core.wc.*;
import org.tmatesoft.svn.core.wc2.SvnTarget;
@@ -75,15 +81,15 @@ public class SvnRollbackEnvironment extends DefaultRollbackEnvironment {
checker.gather(changes);
exceptions.addAll(checker.getExceptions());
- ISVNEventHandler revertHandler = new ISVNEventHandler() {
- public void handleEvent(SVNEvent event, double progress) {
- if (event.getAction() == SVNEventAction.REVERT) {
+ ProgressTracker revertHandler = new ProgressTracker() {
+ public void consume(ProgressEvent event) {
+ if (event.getAction() == EventAction.REVERT) {
final File file = event.getFile();
if (file != null) {
listener.accept(file);
}
}
- if (event.getAction() == SVNEventAction.FAILED_REVERT) {
+ if (event.getAction() == EventAction.FAILED_REVERT) {
exceptions.add(new VcsException("Revert failed"));
}
}
@@ -150,7 +156,7 @@ public class SvnRollbackEnvironment extends DefaultRollbackEnvironment {
final File source = entry.getKey();
final ThroughRenameInfo info = entry.getValue();
if (info.isVersioned()) {
- mySvnVcs.getFactory(source).createPropertyClient().list(SvnTarget.fromFile(source), SVNRevision.WORKING, SVNDepth.EMPTY, handler);
+ mySvnVcs.getFactory(source).createPropertyClient().list(SvnTarget.fromFile(source), SVNRevision.WORKING, Depth.EMPTY, handler);
}
if (source.isDirectory()) {
if (! FileUtil.filesEqual(info.getTo(), info.getFirstTo())) {
@@ -225,8 +231,8 @@ public class SvnRollbackEnvironment extends DefaultRollbackEnvironment {
catch (IOException e) {
exceptions.add(new VcsException(e));
}
- catch (SVNException e) {
- exceptions.add(new VcsException(e));
+ catch (VcsException e) {
+ exceptions.add(e);
}
}
}
@@ -248,10 +254,10 @@ public class SvnRollbackEnvironment extends DefaultRollbackEnvironment {
private static class Reverter {
@NotNull private final SvnVcs myVcs;
- private ISVNEventHandler myHandler;
+ private ProgressTracker myHandler;
private final List<VcsException> myExceptions;
- private Reverter(@NotNull SvnVcs vcs, ISVNEventHandler handler, List<VcsException> exceptions) {
+ private Reverter(@NotNull SvnVcs vcs, ProgressTracker handler, List<VcsException> exceptions) {
myVcs = vcs;
myHandler = handler;
myExceptions = exceptions;
@@ -261,7 +267,7 @@ public class SvnRollbackEnvironment extends DefaultRollbackEnvironment {
if (files.length == 0) return;
try {
// Files passed here are split into groups by root and working copy format - thus we could determine factory based on first file
- myVcs.getFactory(files[0]).createRevertClient().revert(files, recursive ? SVNDepth.INFINITY : SVNDepth.EMPTY, myHandler);
+ myVcs.getFactory(files[0]).createRevertClient().revert(files, Depth.allOrEmpty(recursive), myHandler);
}
catch (VcsException e) {
processRevertError(e);
@@ -298,9 +304,9 @@ public class SvnRollbackEnvironment extends DefaultRollbackEnvironment {
}
private void revertFileOrDir(File file) throws SVNException, VcsException {
- SVNInfo info = mySvnVcs.getInfo(file);
+ Info info = mySvnVcs.getInfo(file);
if (info != null) {
- if (info.getKind() == SVNNodeKind.FILE) {
+ if (info.isFile()) {
doRevert(file, false);
} else {
if (SVNProperty.SCHEDULE_ADD.equals(info.getSchedule())) {
@@ -321,17 +327,17 @@ public class SvnRollbackEnvironment extends DefaultRollbackEnvironment {
}
private void doRevert(@NotNull File path, boolean recursive) throws VcsException {
- mySvnVcs.getFactory(path).createRevertClient().revert(new File[]{path}, SVNDepth.fromRecurse(recursive), null);
+ mySvnVcs.getFactory(path).createRevertClient().revert(new File[]{path}, Depth.allOrFiles(recursive), null);
}
- private boolean is17OrGreaterCopy(final File file, final SVNInfo info) throws VcsException {
+ private boolean is17OrGreaterCopy(final File file, final Info info) throws VcsException {
final RootsToWorkingCopies copies = mySvnVcs.getRootsToWorkingCopies();
WorkingCopy copy = copies.getMatchingCopy(info.getURL());
if (copy == null) {
WorkingCopyFormat format = mySvnVcs.getWorkingCopyFormat(file);
- return !WorkingCopyFormat.UNKNOWN.equals(format) && format.isOrGreater(WorkingCopyFormat.ONE_DOT_SEVEN);
+ return format.isOrGreater(WorkingCopyFormat.ONE_DOT_SEVEN);
} else {
return copy.is17Copy();
}
@@ -614,6 +620,9 @@ public class SvnRollbackEnvironment extends DefaultRollbackEnvironment {
catch (SVNException e) {
myExceptions.add(new VcsException(e));
}
+ catch (SvnBindException e) {
+ myExceptions.add(e);
+ }
}
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/status/CmdStatusClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/status/CmdStatusClient.java
index 235f5d1ecddc..4030c83005ea 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/status/CmdStatusClient.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/status/CmdStatusClient.java
@@ -18,18 +18,18 @@ package org.jetbrains.idea.svn.status;
import com.intellij.openapi.util.Getter;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.openapi.vcs.VcsException;
import com.intellij.openapi.vfs.CharsetToolkit;
import com.intellij.util.containers.Convertor;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.SvnUtil;
import org.jetbrains.idea.svn.api.BaseSvnClient;
-import org.jetbrains.idea.svn.commandLine.CommandExecutor;
-import org.jetbrains.idea.svn.commandLine.CommandUtil;
-import org.jetbrains.idea.svn.commandLine.SvnCommandName;
-import org.jetbrains.idea.svn.commandLine.SvnExceptionWrapper;
-import org.tmatesoft.svn.core.*;
+import org.jetbrains.idea.svn.api.Depth;
+import org.jetbrains.idea.svn.commandLine.*;
+import org.jetbrains.idea.svn.info.Info;
+import org.tmatesoft.svn.core.SVNErrorCode;
+import org.tmatesoft.svn.core.SVNException;
+import org.tmatesoft.svn.core.SVNURL;
import org.tmatesoft.svn.core.internal.util.SVNPathUtil;
import org.tmatesoft.svn.core.wc.*;
import org.tmatesoft.svn.core.wc2.SvnTarget;
@@ -52,75 +52,38 @@ import java.util.*;
public class CmdStatusClient extends BaseSvnClient implements StatusClient {
@Override
- public long doStatus(File path, boolean recursive, boolean remote, boolean reportAll, boolean includeIgnored, ISVNStatusHandler handler)
- throws SVNException {
- return doStatus(path, recursive, remote, reportAll, includeIgnored, false, handler);
- }
-
- @Override
- public long doStatus(File path,
- boolean recursive,
- boolean remote,
- boolean reportAll,
- boolean includeIgnored,
- boolean collectParentExternals,
- ISVNStatusHandler handler) throws SVNException {
- return doStatus(path, SVNRevision.UNDEFINED, recursive, remote, reportAll, includeIgnored, collectParentExternals, handler);
- }
-
- @Override
- public long doStatus(File path,
- SVNRevision revision,
- boolean recursive,
- boolean remote,
- boolean reportAll,
- boolean includeIgnored,
- boolean collectParentExternals,
- ISVNStatusHandler handler) throws SVNException {
- return doStatus(path, revision, recursive ? SVNDepth.INFINITY : SVNDepth.EMPTY, remote, reportAll, includeIgnored,
- collectParentExternals, handler, null);
- }
-
- @Override
public long doStatus(final File path,
final SVNRevision revision,
- final SVNDepth depth,
+ final Depth depth,
boolean remote,
boolean reportAll,
boolean includeIgnored,
boolean collectParentExternals,
- final ISVNStatusHandler handler,
- final Collection changeLists) throws SVNException {
+ final StatusConsumer handler,
+ final Collection changeLists) throws SvnBindException {
File base = path.isDirectory() ? path : path.getParentFile();
base = CommandUtil.correctUpToExistingParent(base);
- final SVNInfo infoBase = myFactory.createInfoClient().doInfo(base, revision);
+ final Info infoBase = myFactory.createInfoClient().doInfo(base, revision);
List<String> parameters = new ArrayList<String>();
putParameters(parameters, path, depth, remote, reportAll, includeIgnored, changeLists);
- CommandExecutor command;
- try {
- command = execute(myVcs, SvnTarget.fromFile(path), SvnCommandName.st, parameters, null);
- }
- catch (VcsException e) {
- throw new SVNException(SVNErrorMessage.create(SVNErrorCode.IO_ERROR, e), e);
- }
+ CommandExecutor command = execute(myVcs, SvnTarget.fromFile(path), SvnCommandName.st, parameters, null);
parseResult(path, revision, handler, base, infoBase, command);
return 0;
}
private void parseResult(final File path,
SVNRevision revision,
- ISVNStatusHandler handler,
+ StatusConsumer handler,
File base,
- SVNInfo infoBase,
- CommandExecutor command) throws SVNException {
+ Info infoBase,
+ CommandExecutor command) throws SvnBindException {
String result = command.getOutput();
if (StringUtil.isEmptyOrSpaces(result)) {
- throw new SVNException(SVNErrorMessage.create(SVNErrorCode.FS_GENERAL, "Status request returned nothing for command: " +
- command.getCommandText()));
+ throw new SvnBindException("Status request returned nothing for command: " + command.getCommandText());
}
try {
@@ -130,8 +93,7 @@ public class CmdStatusClient extends BaseSvnClient implements StatusClient {
parser.parse(new ByteArrayInputStream(result.trim().getBytes(CharsetToolkit.UTF8_CHARSET)), svnHandl[0]);
if (!svnHandl[0].isAnythingReported()) {
if (!SvnUtil.isSvnVersioned(myVcs, path)) {
- throw new SVNException(
- SVNErrorMessage.create(SVNErrorCode.WC_NOT_DIRECTORY, "Command - " + command.getCommandText() + ". Result - " + result));
+ throw new SvnBindException(SVNErrorCode.WC_NOT_DIRECTORY, "Command - " + command.getCommandText() + ". Result - " + result);
} else {
// return status indicating "NORMAL" state
// typical output would be like
@@ -142,38 +104,42 @@ public class CmdStatusClient extends BaseSvnClient implements StatusClient {
PortableStatus status = new PortableStatus();
status.setPath(path.getAbsolutePath());
- status.setContentsStatus(SVNStatusType.STATUS_NORMAL);
- status.setInfoGetter(new Getter<SVNInfo>() {
+ status.setContentsStatus(StatusType.STATUS_NORMAL);
+ status.setInfoGetter(new Getter<Info>() {
@Override
- public SVNInfo get() {
+ public Info get() {
return createInfoGetter(null).convert(path);
}
});
- handler.handleStatus(status);
+ try {
+ handler.consume(status);
+ }
+ catch (SVNException e) {
+ throw new SvnBindException(e);
+ }
}
}
}
catch (SvnExceptionWrapper e) {
- throw (SVNException) e.getCause();
+ throw new SvnBindException(e.getCause());
} catch (IOException e) {
- throw new SVNException(SVNErrorMessage.create(SVNErrorCode.IO_ERROR, e), e);
+ throw new SvnBindException(e);
}
catch (ParserConfigurationException e) {
- throw new SVNException(SVNErrorMessage.create(SVNErrorCode.IO_ERROR, e), e);
+ throw new SvnBindException(e);
}
catch (SAXException e) {
// status parsing errors are logged separately as sometimes there are parsing errors connected to terminal output handling.
// these errors primarily occur when status output is rather large.
// and status output could be large, for instance, when working copy is locked (seems that each file is listed in status output).
command.logCommand();
-
- throw new SVNException(SVNErrorMessage.create(SVNErrorCode.IO_ERROR, e), e);
+ throw new SvnBindException(e);
}
}
private static void putParameters(@NotNull List<String> parameters,
@NotNull File path,
- @Nullable SVNDepth depth,
+ @Nullable Depth depth,
boolean remote,
boolean reportAll,
boolean includeIgnored,
@@ -189,33 +155,33 @@ public class CmdStatusClient extends BaseSvnClient implements StatusClient {
}
public SvnStatusHandler createStatusHandler(final SVNRevision revision,
- final ISVNStatusHandler handler,
+ final StatusConsumer handler,
final File base,
- final SVNInfo infoBase, final SvnStatusHandler[] svnHandl) {
+ final Info infoBase, final SvnStatusHandler[] svnHandl) {
final SvnStatusHandler.ExternalDataCallback callback = createStatusCallback(handler, base, infoBase, svnHandl);
return new SvnStatusHandler(callback, base, createInfoGetter(revision));
}
- private Convertor<File, SVNInfo> createInfoGetter(final SVNRevision revision) {
- return new Convertor<File, SVNInfo>() {
+ private Convertor<File, Info> createInfoGetter(final SVNRevision revision) {
+ return new Convertor<File, Info>() {
@Override
- public SVNInfo convert(File o) {
+ public Info convert(File o) {
try {
return myFactory.createInfoClient().doInfo(o, revision);
}
- catch (SVNException e) {
+ catch (SvnBindException e) {
throw new SvnExceptionWrapper(e);
}
}
};
}
- public static SvnStatusHandler.ExternalDataCallback createStatusCallback(final ISVNStatusHandler handler,
+ public static SvnStatusHandler.ExternalDataCallback createStatusCallback(final StatusConsumer handler,
final File base,
- final SVNInfo infoBase,
+ final Info infoBase,
final SvnStatusHandler[] svnHandl) {
- final Map<File, SVNInfo> externalsMap = new HashMap<File, SVNInfo>();
+ final Map<File, Info> externalsMap = new HashMap<File, Info>();
final String[] changelistName = new String[1];
return new SvnStatusHandler.ExternalDataCallback() {
@@ -225,7 +191,7 @@ public class CmdStatusClient extends BaseSvnClient implements StatusClient {
pending.setChangelistName(changelistName[0]);
try {
//if (infoBase != null) {
- SVNInfo baseInfo = infoBase;
+ Info baseInfo = infoBase;
File baseFile = base;
final File pendingFile = new File(pending.getPath());
if (! externalsMap.isEmpty()) {
@@ -250,10 +216,10 @@ public class CmdStatusClient extends BaseSvnClient implements StatusClient {
}
pending.setURL(SVNURL.parseURIEncoded(append));
}
- if (SVNStatusType.STATUS_EXTERNAL.equals(pending.getNodeStatus())) {
+ if (StatusType.STATUS_EXTERNAL.equals(pending.getNodeStatus())) {
externalsMap.put(pending.getFile(), pending.getInfo());
}
- handler.handleStatus(pending);
+ handler.consume(pending);
}
catch (SVNException e) {
throw new SvnExceptionWrapper(e);
@@ -268,16 +234,11 @@ public class CmdStatusClient extends BaseSvnClient implements StatusClient {
}
@Override
- public SVNStatus doStatus(File path, boolean remote) throws SVNException {
- return doStatus(path, remote, false);
- }
-
- @Override
- public SVNStatus doStatus(File path, boolean remote, boolean collectParentExternals) throws SVNException {
- final SVNStatus[] svnStatus = new SVNStatus[1];
- doStatus(path, SVNRevision.UNDEFINED, SVNDepth.EMPTY, remote, false, false, collectParentExternals, new ISVNStatusHandler() {
+ public Status doStatus(File path, boolean remote) throws SvnBindException {
+ final Status[] svnStatus = new Status[1];
+ doStatus(path, SVNRevision.UNDEFINED, Depth.EMPTY, remote, false, false, false, new StatusConsumer() {
@Override
- public void handleStatus(SVNStatus status) throws SVNException {
+ public void consume(Status status) throws SVNException {
svnStatus[0] = status;
}
}, null);
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/status/PortableStatus.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/status/PortableStatus.java
index e78c0cd57316..4ed2d78f29ab 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/status/PortableStatus.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/status/PortableStatus.java
@@ -15,10 +15,13 @@
*/
package org.jetbrains.idea.svn.status;
-import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.Getter;
-import org.tmatesoft.svn.core.SVNLock;
-import org.tmatesoft.svn.core.SVNNodeKind;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+import org.jetbrains.idea.svn.api.NodeKind;
+import org.jetbrains.idea.svn.conflict.TreeConflictDescription;
+import org.jetbrains.idea.svn.info.Info;
+import org.jetbrains.idea.svn.lock.Lock;
import org.tmatesoft.svn.core.SVNURL;
import org.tmatesoft.svn.core.wc.*;
@@ -27,18 +30,18 @@ import java.util.Date;
import java.util.Map;
/**
+ * TODO: Merge PortableStatus and Status to single class.
+ *
* Created by IntelliJ IDEA.
* User: Irina.Chernushina
* Date: 1/24/12
* Time: 12:29 PM
*/
-public class PortableStatus extends SVNStatus {
-
- private static final Logger LOG = Logger.getInstance(PortableStatus.class);
+public class PortableStatus extends Status {
private boolean myConflicted;
- private Getter<SVNInfo> myInfoGetter;
- private SVNInfo myInfo;
+ private Getter<Info> myInfoGetter;
+ private Info myInfo;
private String myPath;
private boolean myFileExists;
@@ -81,42 +84,42 @@ public class PortableStatus extends SVNStatus {
*/
public PortableStatus(SVNURL url,
File file,
- SVNNodeKind kind,
+ @NotNull NodeKind kind,
SVNRevision revision,
SVNRevision committedRevision,
Date committedDate,
String author,
- SVNStatusType contentsStatus,
- SVNStatusType propertiesStatus,
- SVNStatusType remoteContentsStatus,
- SVNStatusType remotePropertiesStatus,
+ StatusType contentsStatus,
+ StatusType propertiesStatus,
+ StatusType remoteContentsStatus,
+ StatusType remotePropertiesStatus,
boolean isLocked,
boolean isCopied,
boolean isSwitched,
boolean isFileExternal,
- SVNLock remoteLock,
- SVNLock localLock,
+ @Nullable Lock remoteLock,
+ @Nullable Lock localLock,
Map entryProperties,
String changelistName,
int wcFormatVersion,
boolean isConflicted,
- Getter<SVNInfo> infoGetter) {
- super(url, file, kind, revision, committedRevision, committedDate, author, contentsStatus, propertiesStatus, remoteContentsStatus,
- remotePropertiesStatus, isLocked, isCopied, isSwitched, isFileExternal, null, null, null, null, null, null, remoteLock,
- localLock, entryProperties, changelistName, wcFormatVersion, null);
+ Getter<Info> infoGetter) {
+ super(url, file, kind, revision, committedRevision, contentsStatus, propertiesStatus, remoteContentsStatus,
+ remotePropertiesStatus, isLocked, isCopied, isSwitched, null, remoteLock,
+ localLock, changelistName, null);
myConflicted = isConflicted;
- myInfoGetter = infoGetter == null ? new Getter<SVNInfo>() {
+ myInfoGetter = infoGetter == null ? new Getter<Info>() {
@Override
- public SVNInfo get() {
+ public Info get() {
return null;
}
} : infoGetter;
}
public PortableStatus() {
- myInfoGetter = new Getter<SVNInfo>() {
+ myInfoGetter = new Getter<Info>() {
@Override
- public SVNInfo get() {
+ public Info get() {
return null;
}
};
@@ -124,22 +127,12 @@ public class PortableStatus extends SVNStatus {
}
@Override
- public int getWorkingCopyFormat() {
- LOG.error("Do not use working copy format detection through status");
- return 0;
- }
-
- @Override
public void setIsConflicted(boolean isConflicted) {
myConflicted = isConflicted;
super.setIsConflicted(isConflicted);
}
- public void setConflicted(boolean conflicted) {
- myConflicted = conflicted;
- }
-
- public void setInfoGetter(Getter<SVNInfo> infoGetter) {
+ public void setInfoGetter(Getter<Info> infoGetter) {
myInfoGetter = infoGetter;
}
@@ -148,10 +141,10 @@ public class PortableStatus extends SVNStatus {
return myConflicted;
}
- private SVNInfo initInfo() {
+ private Info initInfo() {
if (myInfo == null) {
- final SVNStatusType contentsStatus = getContentsStatus();
- if (contentsStatus == null || SVNStatusType.UNKNOWN.equals(contentsStatus)) {
+ final StatusType contentsStatus = getContentsStatus();
+ if (contentsStatus == null || StatusType.UNKNOWN.equals(contentsStatus)) {
return null;
}
myInfo = myInfoGetter.get();
@@ -159,14 +152,15 @@ public class PortableStatus extends SVNStatus {
return myInfo;
}
- public SVNInfo getInfo() {
+ public Info getInfo() {
return initInfo();
}
@Override
- public SVNNodeKind getKind() {
+ @NotNull
+ public NodeKind getKind() {
if (myFileExists) return super.getKind();
- final SVNInfo info = initInfo();
+ final Info info = initInfo();
if (info != null) {
return info.getKind();
}
@@ -174,68 +168,6 @@ public class PortableStatus extends SVNStatus {
}
/**
- * Gets the temporary file that contains all latest changes from the
- * repository which led to a conflict with local changes. This file is at
- * the HEAD revision.
- *
- * @return an autogenerated temporary file just as it is in the latest
- * revision in the repository
- */
- @Override
- public File getConflictNewFile() {
- if (! isConflicted()) return null;
- final SVNInfo info = initInfo();
- return info == null ? null : info.getConflictNewFile();
- }
-
- /**
- * Gets the temporary BASE revision file of that working file that is
- * currently in conflict with changes received from the repository. This
- * file does not contain the latest user's modifications, only 'pristine'
- * contents.
- *
- * @return an autogenerated temporary file just as the conflicting file was
- * before any modifications to it
- */
- @Override
- public File getConflictOldFile() {
- if (! isConflicted()) return null;
- final SVNInfo info = initInfo();
- return info == null ? null : info.getConflictOldFile();
- }
-
- /**
- * Gets the temporary <i>'.mine'</i> file with all current local changes to
- * the original file. That is if the file item is in conflict with changes
- * that came during an update this temporary file is created to get the
- * snapshot of the user's file with only the user's local modifications and
- * nothing more.
- *
- * @return an autogenerated temporary file with only the user's
- * modifications
- */
- @Override
- public File getConflictWrkFile() {
- if (! isConflicted()) return null;
- final SVNInfo info = initInfo();
- return info == null ? null : info.getConflictWrkFile();
- }
-
- /**
- * Gets the <i>'.prej'</i> file containing details on properties conflicts.
- * If the item's properties are in conflict with those that came during an
- * update this file will contain a conflict description.
- *
- * @return the properties conflicts file
- */
- @Override
- public File getPropRejectFile() {
- if (! isConflicted()) return null;
- final SVNInfo info = initInfo();
- return info == null ? null : info.getPropConflictFile();
- }
-
- /**
* Gets the URL (repository location) of the ancestor from which the item
* was copied. That is when the item is added with history.
*
@@ -244,7 +176,7 @@ public class PortableStatus extends SVNStatus {
@Override
public String getCopyFromURL() {
if (! isCopied()) return null;
- final SVNInfo info = initInfo();
+ final Info info = initInfo();
if (info == null) return null;
SVNURL url = initInfo().getCopyFromURL();
return url == null ? null : url.toString();
@@ -255,7 +187,7 @@ public class PortableStatus extends SVNStatus {
SVNURL url = super.getURL();
if (url == null) {
- SVNInfo info = initInfo();
+ Info info = initInfo();
url = info != null ? info.getURL() : url;
}
@@ -267,7 +199,7 @@ public class PortableStatus extends SVNStatus {
SVNURL url = super.getRepositoryRootURL();
if (url == null) {
- SVNInfo info = initInfo();
+ Info info = initInfo();
url = info != null ? info.getRepositoryRootURL() : url;
}
@@ -279,7 +211,7 @@ public class PortableStatus extends SVNStatus {
File file = super.getFile();
if (file == null) {
- SVNInfo info = initInfo();
+ Info info = initInfo();
file = info != null ? info.getFile() : file;
}
@@ -291,28 +223,15 @@ public class PortableStatus extends SVNStatus {
final SVNRevision revision = super.getRevision();
if (revision != null && revision.isValid()) return revision;
- final SVNStatusType status = getContentsStatus();
- if (SVNStatusType.STATUS_NONE.equals(status) || SVNStatusType.STATUS_UNVERSIONED.equals(status) ||
- SVNStatusType.STATUS_ADDED.equals(status)) return revision;
+ final StatusType status = getContentsStatus();
+ if (StatusType.STATUS_NONE.equals(status) || StatusType.STATUS_UNVERSIONED.equals(status) ||
+ StatusType.STATUS_ADDED.equals(status)) return revision;
- final SVNInfo info = initInfo();
+ final Info info = initInfo();
return info == null ? revision : info.getRevision();
}
/**
- * Gets the revision of the item's ancestor from which the item was copied
- * (the item is added with history).
- *
- * @return the ancestor's revision
- */
- @Override
- public SVNRevision getCopyFromRevision() {
- if (! isCopied()) return null;
- final SVNInfo info = initInfo();
- return info == null ? null : info.getCopyFromRevision();
- }
-
- /**
* Returns a tree conflict description.
*
* @return tree conflict description; <code>null</code> if no conflict
@@ -320,9 +239,10 @@ public class PortableStatus extends SVNStatus {
* @since 1.3
*/
@Override
- public SVNTreeConflictDescription getTreeConflict() {
+ @Nullable
+ public TreeConflictDescription getTreeConflict() {
if (! isConflicted()) return null;
- final SVNInfo info = initInfo();
+ final Info info = initInfo();
return info == null ? null : info.getTreeConflict();
}
@@ -334,7 +254,7 @@ public class PortableStatus extends SVNStatus {
return myPath;
}
- public void setKind(boolean exists, SVNNodeKind kind) {
+ public void setKind(boolean exists, @NotNull NodeKind kind) {
myFileExists = exists;
setKind(kind);
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/status/Status.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/status/Status.java
new file mode 100644
index 000000000000..7fc81510076f
--- /dev/null
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/status/Status.java
@@ -0,0 +1,313 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jetbrains.idea.svn.status;
+
+import com.intellij.openapi.util.Condition;
+import com.intellij.util.containers.ContainerUtil;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+import org.jetbrains.idea.svn.api.NodeKind;
+import org.jetbrains.idea.svn.conflict.TreeConflictDescription;
+import org.jetbrains.idea.svn.lock.Lock;
+import org.tmatesoft.svn.core.SVNURL;
+import org.tmatesoft.svn.core.wc.SVNRevision;
+import org.tmatesoft.svn.core.wc.SVNStatus;
+
+import java.io.File;
+
+/**
+ * TODO: Could also inherit BaseNodeDescription when myKind becomes final.
+ *
+ * @author Konstantin Kolosovsky.
+ */
+public class Status {
+ private SVNURL myURL;
+ private File myFile;
+ private @NotNull NodeKind myKind;
+ private SVNRevision myRevision;
+ private SVNRevision myCommittedRevision;
+ private StatusType myContentsStatus;
+ private StatusType myPropertiesStatus;
+ private StatusType myRemoteContentsStatus;
+ private StatusType myRemoteNodeStatus;
+ private StatusType myRemotePropertiesStatus;
+ private boolean myIsLocked;
+ private boolean myIsCopied;
+ private boolean myIsSwitched;
+ private String myCopyFromURL;
+ @Nullable private Lock myRemoteLock;
+ @Nullable private Lock myLocalLock;
+ private SVNRevision myRemoteRevision;
+ private String myChangelistName;
+ @Nullable private TreeConflictDescription myTreeConflict;
+ private boolean myIsConflicted;
+
+ private StatusType myNodeStatus;
+ private SVNURL myRepositoryRootURL;
+
+ @Nullable
+ public static Status create(@Nullable SVNStatus status) {
+ Status result = null;
+
+ if (status != null) {
+ result =
+ new Status(status.getURL(), status.getFile(), NodeKind.from(status.getKind()), status.getRevision(), status.getCommittedRevision(),
+ StatusType.from(status.getContentsStatus()), StatusType.from(status.getPropertiesStatus()),
+ StatusType.from(status.getRemoteContentsStatus()), StatusType.from(status.getRemotePropertiesStatus()),
+ status.isLocked(), status.isCopied(), status.isSwitched(), status.getCopyFromURL(), Lock.create(status.getRemoteLock()),
+ Lock.create(status.getLocalLock()), status.getChangelistName(),
+ TreeConflictDescription.create(status.getTreeConflict()));
+ result.setIsConflicted(status.isConflicted());
+ result.setNodeStatus(StatusType.from(status.getNodeStatus()));
+ result.setRemoteNodeStatus(StatusType.from(status.getRemoteNodeStatus()));
+ result.setRemoteRevision(status.getRemoteRevision());
+ result.setRepositoryRootURL(status.getRepositoryRootURL());
+ }
+
+ return result;
+ }
+
+ public Status(SVNURL url,
+ File file,
+ @NotNull NodeKind kind,
+ SVNRevision revision,
+ SVNRevision committedRevision,
+ StatusType contentsStatus,
+ StatusType propertiesStatus,
+ StatusType remoteContentsStatus,
+ StatusType remotePropertiesStatus,
+ boolean isLocked,
+ boolean isCopied,
+ boolean isSwitched,
+ String copyFromURL,
+ @Nullable Lock remoteLock,
+ @Nullable Lock localLock,
+ String changelistName,
+ @Nullable TreeConflictDescription treeConflict) {
+ myURL = url;
+ myFile = file;
+ myKind = kind;
+ myRevision = revision == null ? SVNRevision.UNDEFINED : revision;
+ myCommittedRevision = committedRevision == null ? SVNRevision.UNDEFINED : committedRevision;
+ myContentsStatus = contentsStatus == null ? StatusType.STATUS_NONE : contentsStatus;
+ myPropertiesStatus = propertiesStatus == null ? StatusType.STATUS_NONE : propertiesStatus;
+ myRemoteContentsStatus = remoteContentsStatus == null ? StatusType.STATUS_NONE : remoteContentsStatus;
+ myRemotePropertiesStatus = remotePropertiesStatus == null ? StatusType.STATUS_NONE : remotePropertiesStatus;
+ myRemoteNodeStatus = StatusType.STATUS_NONE;
+ myIsLocked = isLocked;
+ myIsCopied = isCopied;
+ myIsSwitched = isSwitched;
+ myCopyFromURL = copyFromURL;
+ myRemoteLock = remoteLock;
+ myLocalLock = localLock;
+ myChangelistName = changelistName;
+ myTreeConflict = treeConflict;
+ myRemoteRevision = SVNRevision.UNDEFINED;
+ }
+
+ public Status() {
+ setRevision(SVNRevision.UNDEFINED);
+ myRemoteRevision = SVNRevision.UNDEFINED;
+ }
+
+ public SVNURL getURL() {
+ return myURL;
+ }
+
+ public File getFile() {
+ return myFile;
+ }
+
+ @NotNull
+ public NodeKind getKind() {
+ return myKind;
+ }
+
+ public SVNRevision getRevision() {
+ return myRevision;
+ }
+
+ public SVNRevision getCommittedRevision() {
+ return myCommittedRevision;
+ }
+
+ public StatusType getContentsStatus() {
+ return myContentsStatus;
+ }
+
+ public StatusType getPropertiesStatus() {
+ return myPropertiesStatus;
+ }
+
+ public StatusType getRemoteContentsStatus() {
+ return myRemoteContentsStatus;
+ }
+
+ public StatusType getRemotePropertiesStatus() {
+ return myRemotePropertiesStatus;
+ }
+
+ public boolean is(@NotNull StatusType type) {
+ return type.equals(getNodeStatus()) || type.equals(getContentsStatus());
+ }
+
+ public boolean is(@NotNull StatusType... types) {
+ return ContainerUtil.or(types, new Condition<StatusType>() {
+ @Override
+ public boolean value(StatusType type) {
+ return is(type);
+ }
+ });
+ }
+
+ public boolean isLocked() {
+ return myIsLocked;
+ }
+
+ public boolean isCopied() {
+ return myIsCopied;
+ }
+
+ public boolean isSwitched() {
+ return myIsSwitched;
+ }
+
+ public String getCopyFromURL() {
+ return myCopyFromURL;
+ }
+
+ @Nullable
+ public Lock getRemoteLock() {
+ return myRemoteLock;
+ }
+
+ @Nullable
+ public Lock getLocalLock() {
+ return myLocalLock;
+ }
+
+ public SVNRevision getRemoteRevision() {
+ return myRemoteRevision;
+ }
+
+ public String getChangelistName() {
+ return myChangelistName;
+ }
+
+ @Nullable
+ public TreeConflictDescription getTreeConflict() {
+ return myTreeConflict;
+ }
+
+ public boolean isConflicted() {
+ return myIsConflicted;
+ }
+
+ public StatusType getRemoteNodeStatus() {
+ return myRemoteNodeStatus;
+ }
+
+ public StatusType getNodeStatus() {
+ if (myNodeStatus == null) {
+ return myContentsStatus;
+ }
+ return myNodeStatus;
+ }
+
+ public SVNURL getRepositoryRootURL() {
+ return myRepositoryRootURL;
+ }
+
+ public void setURL(SVNURL uRL) {
+ myURL = uRL;
+ }
+
+ public void setFile(File file) {
+ myFile = file;
+ }
+
+ public void setKind(@NotNull NodeKind kind) {
+ myKind = kind;
+ }
+
+ public void setRevision(SVNRevision revision) {
+ myRevision = revision;
+ }
+
+ public void setCommittedRevision(SVNRevision committedRevision) {
+ myCommittedRevision = committedRevision;
+ }
+
+ public void setContentsStatus(StatusType statusType) {
+ myContentsStatus = statusType;
+ }
+
+ public void setPropertiesStatus(StatusType propertiesStatus) {
+ myPropertiesStatus = propertiesStatus;
+ }
+
+ public void setRemoteContentsStatus(StatusType remoteContentsStatus) {
+ myRemoteContentsStatus = remoteContentsStatus;
+ }
+
+ public void setRemotePropertiesStatus(StatusType remotePropertiesStatus) {
+ myRemotePropertiesStatus = remotePropertiesStatus;
+ }
+
+ public void setIsLocked(boolean isLocked) {
+ myIsLocked = isLocked;
+ }
+
+ public void setIsCopied(boolean isCopied) {
+ myIsCopied = isCopied;
+ }
+
+ public void setIsSwitched(boolean isSwitched) {
+ myIsSwitched = isSwitched;
+ }
+
+ public void setRemoteLock(@Nullable Lock remoteLock) {
+ myRemoteLock = remoteLock;
+ }
+
+ public void setLocalLock(@Nullable Lock localLock) {
+ myLocalLock = localLock;
+ }
+
+ public void setChangelistName(String changelistName) {
+ myChangelistName = changelistName;
+ }
+
+ public void setIsConflicted(boolean isConflicted) {
+ myIsConflicted = isConflicted;
+ }
+
+ public void setRemoteNodeStatus(StatusType remoteNodeStatus) {
+ myRemoteNodeStatus = remoteNodeStatus;
+ }
+
+ public void setNodeStatus(StatusType nodeStatus) {
+ myNodeStatus = nodeStatus;
+ }
+
+ public void setRepositoryRootURL(SVNURL repositoryRootURL) {
+ myRepositoryRootURL = repositoryRootURL;
+ }
+
+ public void setRemoteRevision(SVNRevision remoteRevision) {
+ myRemoteRevision = remoteRevision;
+ }
+}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/status/StatusClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/status/StatusClient.java
index 4b43e6c51211..9bbf74b62084 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/status/StatusClient.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/status/StatusClient.java
@@ -15,12 +15,11 @@
*/
package org.jetbrains.idea.svn.status;
+import org.jetbrains.annotations.Nullable;
+import org.jetbrains.idea.svn.api.Depth;
import org.jetbrains.idea.svn.api.SvnClient;
-import org.tmatesoft.svn.core.SVNDepth;
-import org.tmatesoft.svn.core.SVNException;
-import org.tmatesoft.svn.core.wc.ISVNStatusHandler;
+import org.jetbrains.idea.svn.commandLine.SvnBindException;
import org.tmatesoft.svn.core.wc.SVNRevision;
-import org.tmatesoft.svn.core.wc.SVNStatus;
import java.io.File;
import java.util.Collection;
@@ -32,13 +31,20 @@ import java.util.Collection;
* Time: 9:46 AM
*/
public interface StatusClient extends SvnClient {
- long doStatus(File path, boolean recursive, boolean remote, boolean reportAll,
- boolean includeIgnored, ISVNStatusHandler handler) throws SVNException;
- long doStatus(File path, boolean recursive, boolean remote, boolean reportAll, boolean includeIgnored, boolean collectParentExternals, ISVNStatusHandler handler) throws SVNException;
- long doStatus(File path, SVNRevision revision, boolean recursive, boolean remote, boolean reportAll, boolean includeIgnored, boolean collectParentExternals, ISVNStatusHandler handler) throws SVNException;
- long doStatus(File path, SVNRevision revision, SVNDepth depth, boolean remote, boolean reportAll,
- boolean includeIgnored, boolean collectParentExternals, ISVNStatusHandler handler,
- Collection changeLists) throws SVNException;
- SVNStatus doStatus( File path, boolean remote) throws SVNException;
- SVNStatus doStatus(File path, boolean remote, boolean collectParentExternals) throws SVNException;
+
+ /**
+ * TODO: Return value is never used by other code
+ */
+ long doStatus(File path,
+ SVNRevision revision,
+ Depth depth,
+ boolean remote,
+ boolean reportAll,
+ boolean includeIgnored,
+ boolean collectParentExternals,
+ StatusConsumer handler,
+ Collection changeLists) throws SvnBindException;
+
+ @Nullable
+ Status doStatus(File path, boolean remote) throws SvnBindException;
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/status/StatusConsumer.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/status/StatusConsumer.java
new file mode 100644
index 000000000000..ca82bdc85f13
--- /dev/null
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/status/StatusConsumer.java
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jetbrains.idea.svn.status;
+
+import com.intellij.util.ThrowableConsumer;
+import org.tmatesoft.svn.core.SVNException;
+
+/**
+ * @author Konstantin Kolosovsky.
+ */
+public interface StatusConsumer extends ThrowableConsumer<Status, SVNException> {
+}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/status/StatusType.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/status/StatusType.java
new file mode 100644
index 000000000000..ff1c3a8a342c
--- /dev/null
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/status/StatusType.java
@@ -0,0 +1,110 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jetbrains.idea.svn.status;
+
+import com.intellij.util.ObjectUtils;
+import com.intellij.util.containers.ContainerUtil;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+import org.tmatesoft.svn.core.wc.SVNStatusType;
+
+import java.util.Map;
+
+/**
+ * @author Konstantin Kolosovsky.
+ */
+public enum StatusType {
+
+ // currently used to represent some not used status types from SVNKit
+ UNUSED("unused"),
+
+ INAPPLICABLE("inapplicable"),
+ UNKNOWN("unknown"),
+ UNCHANGED("unchanged"),
+ MISSING("missing"),
+ OBSTRUCTED("obstructed"),
+ CHANGED("changed"),
+ MERGED("merged"),
+ CONFLICTED("conflicted"),
+
+ STATUS_NONE("none"),
+ STATUS_NORMAL("normal", ' '),
+ STATUS_MODIFIED("modified", 'M'),
+ STATUS_ADDED("added", 'A'),
+ STATUS_DELETED("deleted", 'D'),
+ STATUS_UNVERSIONED("unversioned", '?'),
+ STATUS_MISSING("missing", '!'),
+ STATUS_REPLACED("replaced", 'R'),
+ STATUS_CONFLICTED("conflicted", 'C'),
+ STATUS_OBSTRUCTED("obstructed", '~'),
+ STATUS_IGNORED("ignored", 'I'),
+ // directory is incomplete - checkout or update was interrupted
+ STATUS_INCOMPLETE("incomplete", '!'),
+ STATUS_EXTERNAL("external", 'X');
+
+ private static final String STATUS_PREFIX = "STATUS_";
+
+ @NotNull private static final Map<String, StatusType> ourOtherStatusTypes = ContainerUtil.newHashMap();
+ @NotNull private static final Map<String, StatusType> ourStatusTypesForStatusOperation = ContainerUtil.newHashMap();
+
+ static {
+ for (StatusType action : StatusType.values()) {
+ register(action);
+ }
+ }
+
+ private String myName;
+ private char myCode;
+
+ StatusType(String name) {
+ this(name, ' ');
+ }
+
+ StatusType(String name, char code) {
+ myName = name;
+ myCode = code;
+ }
+
+ public char getCode() {
+ return myCode;
+ }
+
+ public String toString() {
+ return myName;
+ }
+
+ private static void register(@NotNull StatusType action) {
+ (action.name().startsWith(STATUS_PREFIX) ? ourStatusTypesForStatusOperation : ourOtherStatusTypes).put(action.myName, action);
+ }
+
+ @NotNull
+ public static StatusType from(@NotNull SVNStatusType type) {
+ StatusType result = ourOtherStatusTypes.get(type.toString());
+
+ // CONFLICTED, OBSTRUCTED, MISSING status types have corresponding STATUS_* analogs with same names - so additional check added when
+ // converting from SVNKit values
+ if (type != SVNStatusType.CONFLICTED && type != SVNStatusType.OBSTRUCTED && type != SVNStatusType.MISSING) {
+ result = ObjectUtils.chooseNotNull(ourStatusTypesForStatusOperation.get(type.toString()), result);
+ }
+
+ return ObjectUtils.notNull(result, UNUSED);
+ }
+
+ @Nullable
+ public static StatusType forStatusOperation(@NotNull String statusName) {
+ return ourStatusTypesForStatusOperation.get(statusName);
+ }
+}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/status/SvnKitStatusClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/status/SvnKitStatusClient.java
index 4fc337ba1c0a..3f33435c678d 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/status/SvnKitStatusClient.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/status/SvnKitStatusClient.java
@@ -18,8 +18,9 @@ package org.jetbrains.idea.svn.status;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.api.BaseSvnClient;
-import org.jetbrains.idea.svn.status.StatusClient;
-import org.tmatesoft.svn.core.SVNDepth;
+import org.jetbrains.idea.svn.api.Depth;
+import org.jetbrains.idea.svn.api.ProgressTracker;
+import org.jetbrains.idea.svn.commandLine.SvnBindException;
import org.tmatesoft.svn.core.SVNException;
import org.tmatesoft.svn.core.wc.*;
@@ -36,68 +37,50 @@ public class SvnKitStatusClient extends BaseSvnClient implements StatusClient {
private SVNStatusClient myStatusClient;
@Nullable private final ISVNStatusFileProvider myProvider;
- @Nullable private final ISVNEventHandler myHandler;
+ @Nullable private final ProgressTracker myHandler;
public SvnKitStatusClient() {
this(null, null);
}
- public SvnKitStatusClient(@Nullable ISVNStatusFileProvider provider, @Nullable ISVNEventHandler handler) {
+ public SvnKitStatusClient(@Nullable ISVNStatusFileProvider provider, @Nullable ProgressTracker handler) {
myProvider = provider;
myHandler = handler;
}
@Override
- public long doStatus(File path, boolean recursive, boolean remote, boolean reportAll, boolean includeIgnored, ISVNStatusHandler handler)
- throws SVNException {
- return getStatusClient().doStatus(path, recursive, remote, reportAll, includeIgnored, handler);
- }
-
- @Override
- public long doStatus(File path,
- boolean recursive,
- boolean remote,
- boolean reportAll,
- boolean includeIgnored,
- boolean collectParentExternals,
- ISVNStatusHandler handler) throws SVNException {
- return getStatusClient().doStatus(path, recursive, remote, reportAll, includeIgnored, collectParentExternals, handler);
- }
-
- @Override
public long doStatus(File path,
SVNRevision revision,
- boolean recursive,
+ Depth depth,
boolean remote,
boolean reportAll,
boolean includeIgnored,
boolean collectParentExternals,
- ISVNStatusHandler handler) throws SVNException {
- return getStatusClient().doStatus(path, revision, recursive, remote, reportAll, includeIgnored, collectParentExternals, handler);
- }
-
- @Override
- public long doStatus(File path,
- SVNRevision revision,
- SVNDepth depth,
- boolean remote,
- boolean reportAll,
- boolean includeIgnored,
- boolean collectParentExternals,
- ISVNStatusHandler handler,
- Collection changeLists) throws SVNException {
- return getStatusClient()
- .doStatus(path, revision, depth, remote, reportAll, includeIgnored, collectParentExternals, handler, changeLists);
- }
-
- @Override
- public SVNStatus doStatus(File path, boolean remote) throws SVNException {
- return getStatusClient().doStatus(path, remote);
+ final StatusConsumer handler,
+ Collection changeLists) throws SvnBindException {
+ try {
+ return getStatusClient()
+ .doStatus(path, revision, toDepth(depth), remote, reportAll, includeIgnored, collectParentExternals, new ISVNStatusHandler() {
+ @Override
+ public void handleStatus(SVNStatus status) throws SVNException {
+ handler.consume(Status.create(status));
+ }
+ }, changeLists);
+ }
+ catch (SVNException e) {
+ throw new SvnBindException(e);
+ }
}
@Override
- public SVNStatus doStatus(File path, boolean remote, boolean collectParentExternals) throws SVNException {
- return getStatusClient().doStatus(path, remote, collectParentExternals);
+ @Nullable
+ public Status doStatus(File path, boolean remote) throws SvnBindException {
+ try {
+ return Status.create(getStatusClient().doStatus(path, remote));
+ }
+ catch (SVNException e) {
+ throw new SvnBindException(e);
+ }
}
@NotNull
@@ -111,7 +94,7 @@ public class SvnKitStatusClient extends BaseSvnClient implements StatusClient {
if (myStatusClient == null) {
myStatusClient = myVcs.getSvnKitManager().createStatusClient();
myStatusClient.setFilesProvider(myProvider);
- myStatusClient.setEventHandler(myHandler);
+ myStatusClient.setEventHandler(toEventHandler(myHandler));
}
return myStatusClient;
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/status/SvnStatusHandler.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/status/SvnStatusHandler.java
index 642914a558ce..e0f97585f527 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/status/SvnStatusHandler.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/status/SvnStatusHandler.java
@@ -18,18 +18,16 @@ package org.jetbrains.idea.svn.status;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.Getter;
import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.containers.Convertor;
import com.intellij.util.containers.MultiMap;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.SvnUtil;
-import org.jetbrains.idea.svn.info.SVNLockWrapper;
-import org.tmatesoft.svn.core.SVNNodeKind;
+import org.jetbrains.idea.svn.api.NodeKind;
+import org.jetbrains.idea.svn.info.Info;
+import org.jetbrains.idea.svn.lock.Lock;
import org.tmatesoft.svn.core.internal.util.SVNDate;
-import org.tmatesoft.svn.core.wc.SVNInfo;
import org.tmatesoft.svn.core.wc.SVNRevision;
-import org.tmatesoft.svn.core.wc.SVNStatusType;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
@@ -47,29 +45,9 @@ public class SvnStatusHandler extends DefaultHandler {
private static final Logger LOG = Logger.getInstance(SvnStatusHandler.class);
- public static final Map<String, SVNStatusType> ourStatusTypes = ContainerUtil.newHashMap();
-
- static {
- // TODO: Check STATUS_MERGED as it is marked deprecated
- put(SVNStatusType.STATUS_ADDED, SVNStatusType.STATUS_CONFLICTED, SVNStatusType.STATUS_DELETED, SVNStatusType.STATUS_EXTERNAL,
- SVNStatusType.STATUS_IGNORED, SVNStatusType.STATUS_INCOMPLETE, SVNStatusType.STATUS_MERGED, SVNStatusType.STATUS_MISSING,
- SVNStatusType.STATUS_MODIFIED, SVNStatusType.STATUS_NONE, SVNStatusType.STATUS_NORMAL, SVNStatusType.STATUS_OBSTRUCTED,
- SVNStatusType.STATUS_REPLACED, SVNStatusType.STATUS_UNVERSIONED);
- }
-
- private static void put(@NotNull SVNStatusType... statusTypes) {
- for (SVNStatusType statusType : statusTypes) {
- put(statusType);
- }
- }
-
- private static void put(@NotNull SVNStatusType statusType) {
- ourStatusTypes.put(statusType.toString(), statusType);
- }
-
@Nullable
- public static SVNStatusType getStatus(@NotNull String code) {
- SVNStatusType result = ourStatusTypes.get(code);
+ public static StatusType getStatus(@NotNull String code) {
+ StatusType result = StatusType.forStatusOperation(code);
if (result == null) {
LOG.info("Unknown status type " + code);
@@ -83,7 +61,7 @@ public class SvnStatusHandler extends DefaultHandler {
private MultiMap<String, PortableStatus> myCurrentListChanges;
private PortableStatus myPending;
private boolean myInRemoteStatus;
- private SVNLockWrapper myLockWrapper;
+ private Lock.Builder myLockBuilder;
private final List<ElementHandlerBase> myParseStack;
private final Map<String, Getter<ElementHandlerBase>> myElementsMap;
@@ -92,7 +70,7 @@ public class SvnStatusHandler extends DefaultHandler {
private final StringBuilder mySb;
private boolean myAnythingReported;
- public SvnStatusHandler(final ExternalDataCallback dataCallback, File base, final Convertor<File, SVNInfo> infoGetter) {
+ public SvnStatusHandler(final ExternalDataCallback dataCallback, File base, final Convertor<File, Info> infoGetter) {
myBase = base;
myParseStack = new ArrayList<ElementHandlerBase>();
myParseStack.add(new Fake());
@@ -104,17 +82,17 @@ public class SvnStatusHandler extends DefaultHandler {
myDataCallback = new DataCallback() {
@Override
public void startLock() {
- myLockWrapper = new SVNLockWrapper();
+ myLockBuilder = new Lock.Builder();
}
@Override
public void endLock() {
if (myInRemoteStatus) {
- myPending.setRemoteLock(myLockWrapper.create());
+ myPending.setRemoteLock(myLockBuilder.build());
} else {
- myPending.setLocalLock(myLockWrapper.create());
+ myPending.setLocalLock(myLockBuilder.build());
}
- myLockWrapper = null;
+ myLockBuilder = null;
}
@Override
@@ -143,17 +121,17 @@ public class SvnStatusHandler extends DefaultHandler {
myDataCallback = new DataCallback() {
@Override
public void startLock() {
- myLockWrapper = new SVNLockWrapper();
+ myLockBuilder = new Lock.Builder();
}
@Override
public void endLock() {
if (myInRemoteStatus) {
- myPending.setRemoteLock(myLockWrapper.create());
+ myPending.setRemoteLock(myLockBuilder.build());
} else {
- myPending.setLocalLock(myLockWrapper.create());
+ myPending.setLocalLock(myLockBuilder.build());
}
- myLockWrapper = null;
+ myLockBuilder = null;
}
@Override
@@ -191,12 +169,12 @@ public class SvnStatusHandler extends DefaultHandler {
return myAnythingReported;
}
- private void newPending(final Convertor<File, SVNInfo> infoGetter) {
+ private void newPending(final Convertor<File, Info> infoGetter) {
final PortableStatus status = new PortableStatus();
myPending = status;
- status.setInfoGetter(new Getter<SVNInfo>() {
+ status.setInfoGetter(new Getter<Info>() {
@Override
- public SVNInfo get() {
+ public Info get() {
return infoGetter.convert(status.getFile());
}
});
@@ -224,7 +202,7 @@ public class SvnStatusHandler extends DefaultHandler {
myElementsMap.put("lock", new Getter<ElementHandlerBase>() {
@Override
public ElementHandlerBase get() {
- return new Lock();
+ return new LockElement();
}
});
@@ -319,7 +297,7 @@ public class SvnStatusHandler extends DefaultHandler {
assertSAX(! myParseStack.isEmpty());
ElementHandlerBase current = myParseStack.get(myParseStack.size() - 1);
if (mySb.length() > 0) {
- current.characters(mySb.toString().trim(), myPending, myLockWrapper);
+ current.characters(mySb.toString().trim(), myPending, myLockBuilder);
mySb.setLength(0);
}
@@ -329,7 +307,7 @@ public class SvnStatusHandler extends DefaultHandler {
assertSAX(myElementsMap.containsKey(qName));
final ElementHandlerBase newChild = myElementsMap.get(qName).get();
newChild.preAttributesEffect(myDataCallback);
- newChild.updateStatus(attributes, myPending, myLockWrapper);
+ newChild.updateStatus(attributes, myPending, myLockBuilder);
newChild.preEffect(myDataCallback);
myParseStack.add(newChild);
return;
@@ -365,13 +343,13 @@ public class SvnStatusHandler extends DefaultHandler {
}
}
- private static SVNStatusType parseContentsStatus(Attributes attributes) throws SAXException {
+ private static StatusType parseContentsStatus(Attributes attributes) throws SAXException {
final String item = attributes.getValue("item");
assertSAX(item != null);
return getStatus(item);
}
- private static SVNStatusType parsePropertiesStatus(Attributes attributes) throws SAXException {
+ private static StatusType parsePropertiesStatus(Attributes attributes) throws SAXException {
final String props = attributes.getValue("props");
assertSAX(props != null);
return getStatus(props);
@@ -383,7 +361,7 @@ public class SvnStatusHandler extends DefaultHandler {
}
@Override
- protected void updateStatus(Attributes attributes, PortableStatus status, SVNLockWrapper lock) throws SAXException {
+ protected void updateStatus(Attributes attributes, PortableStatus status, Lock.Builder lock) throws SAXException {
}
@Override
@@ -395,7 +373,7 @@ public class SvnStatusHandler extends DefaultHandler {
}
@Override
- public void characters(String s, PortableStatus pending, SVNLockWrapper lock) {
+ public void characters(String s, PortableStatus pending, Lock.Builder lock) {
}
}
@@ -405,7 +383,7 @@ public class SvnStatusHandler extends DefaultHandler {
}
@Override
- protected void updateStatus(Attributes attributes, PortableStatus status, SVNLockWrapper lock) throws SAXException {
+ protected void updateStatus(Attributes attributes, PortableStatus status, Lock.Builder lock) throws SAXException {
}
@Override
@@ -417,8 +395,7 @@ public class SvnStatusHandler extends DefaultHandler {
}
@Override
- public void characters(String s, PortableStatus pending, SVNLockWrapper lock) {
- pending.setCommittedDate(SVNDate.parseDate(s));
+ public void characters(String s, PortableStatus pending, Lock.Builder lock) {
}
}
@@ -428,7 +405,7 @@ public class SvnStatusHandler extends DefaultHandler {
}
@Override
- protected void updateStatus(Attributes attributes, PortableStatus status, SVNLockWrapper lock) throws SAXException {
+ protected void updateStatus(Attributes attributes, PortableStatus status, Lock.Builder lock) throws SAXException {
}
@Override
@@ -440,8 +417,7 @@ public class SvnStatusHandler extends DefaultHandler {
}
@Override
- public void characters(String s, PortableStatus pending, SVNLockWrapper lock) {
- pending.setAuthor(s);
+ public void characters(String s, PortableStatus pending, Lock.Builder lock) {
}
}
@@ -456,7 +432,7 @@ public class SvnStatusHandler extends DefaultHandler {
}
@Override
- protected void updateStatus(Attributes attributes, PortableStatus status, SVNLockWrapper lock) throws SAXException {
+ protected void updateStatus(Attributes attributes, PortableStatus status, Lock.Builder lock) throws SAXException {
final String revision = attributes.getValue("revision");
if (!StringUtil.isEmpty(revision)) {
status.setCommittedRevision(SVNRevision.create(Long.valueOf(revision)));
@@ -472,7 +448,7 @@ public class SvnStatusHandler extends DefaultHandler {
}
@Override
- public void characters(String s, PortableStatus pending, SVNLockWrapper lock) {
+ public void characters(String s, PortableStatus pending, Lock.Builder lock) {
}
}
@@ -508,7 +484,7 @@ public class SvnStatusHandler extends DefaultHandler {
}
@Override
- protected void updateStatus(Attributes attributes, PortableStatus status, SVNLockWrapper lock) throws SAXException {
+ protected void updateStatus(Attributes attributes, PortableStatus status, Lock.Builder lock) throws SAXException {
}
@Override
@@ -520,7 +496,7 @@ public class SvnStatusHandler extends DefaultHandler {
}
@Override
- public void characters(String s, PortableStatus pending, SVNLockWrapper lock) {
+ public void characters(String s, PortableStatus pending, Lock.Builder lock) {
final SVNDate date = SVNDate.parseDate(s);
lock.setCreationDate(date);
}
@@ -532,7 +508,7 @@ public class SvnStatusHandler extends DefaultHandler {
}
@Override
- protected void updateStatus(Attributes attributes, PortableStatus status, SVNLockWrapper lock) throws SAXException {
+ protected void updateStatus(Attributes attributes, PortableStatus status, Lock.Builder lock) throws SAXException {
}
@Override
@@ -544,7 +520,7 @@ public class SvnStatusHandler extends DefaultHandler {
}
@Override
- public void characters(String s, PortableStatus pending, SVNLockWrapper lock) {
+ public void characters(String s, PortableStatus pending, Lock.Builder lock) {
lock.setComment(s);
}
}
@@ -555,7 +531,7 @@ public class SvnStatusHandler extends DefaultHandler {
}
@Override
- protected void updateStatus(Attributes attributes, PortableStatus status, SVNLockWrapper lock) throws SAXException {
+ protected void updateStatus(Attributes attributes, PortableStatus status, Lock.Builder lock) throws SAXException {
}
@Override
@@ -567,7 +543,7 @@ public class SvnStatusHandler extends DefaultHandler {
}
@Override
- public void characters(String s, PortableStatus pending, SVNLockWrapper lock) {
+ public void characters(String s, PortableStatus pending, Lock.Builder lock) {
lock.setOwner(s);
}
}
@@ -578,7 +554,7 @@ public class SvnStatusHandler extends DefaultHandler {
}
@Override
- protected void updateStatus(Attributes attributes, PortableStatus status, SVNLockWrapper lock) throws SAXException {
+ protected void updateStatus(Attributes attributes, PortableStatus status, Lock.Builder lock) throws SAXException {
}
@Override
@@ -590,19 +566,18 @@ public class SvnStatusHandler extends DefaultHandler {
}
@Override
- public void characters(String s, PortableStatus pending, SVNLockWrapper lock) {
- lock.setID(s);
+ public void characters(String s, PortableStatus pending, Lock.Builder lock) {
+ lock.setToken(s);
}
}
- private static class Lock extends ElementHandlerBase {
- private Lock() {
+ private static class LockElement extends ElementHandlerBase {
+ private LockElement() {
super(new String[]{"token", "owner", "comment", "created"}, new String[]{});
}
@Override
- protected void updateStatus(Attributes attributes, PortableStatus status, SVNLockWrapper lock) throws SAXException {
- lock.setPath(status.getPath());
+ protected void updateStatus(Attributes attributes, PortableStatus status, Lock.Builder lock) throws SAXException {
}
@Override
@@ -620,7 +595,7 @@ public class SvnStatusHandler extends DefaultHandler {
}
@Override
- public void characters(String s, PortableStatus pending, SVNLockWrapper lock) {
+ public void characters(String s, PortableStatus pending, Lock.Builder lock) {
}
}
@@ -630,11 +605,11 @@ public class SvnStatusHandler extends DefaultHandler {
}
@Override
- protected void updateStatus(Attributes attributes, PortableStatus status, SVNLockWrapper lock) throws SAXException {
- final SVNStatusType propertiesStatus = parsePropertiesStatus(attributes);
+ protected void updateStatus(Attributes attributes, PortableStatus status, Lock.Builder lock) throws SAXException {
+ final StatusType propertiesStatus = parsePropertiesStatus(attributes);
status.setRemotePropertiesStatus(propertiesStatus);
- final SVNStatusType contentsStatus = parseContentsStatus(attributes);
+ final StatusType contentsStatus = parseContentsStatus(attributes);
status.setRemoteContentsStatus(contentsStatus);
}
@@ -653,7 +628,7 @@ public class SvnStatusHandler extends DefaultHandler {
}
@Override
- public void characters(String s, PortableStatus pending, SVNLockWrapper lock) {
+ public void characters(String s, PortableStatus pending, Lock.Builder lock) {
}
}
@@ -675,13 +650,13 @@ public class SvnStatusHandler extends DefaultHandler {
revision="120">*/
@Override
- protected void updateStatus(Attributes attributes, PortableStatus status, SVNLockWrapper lock) throws SAXException {
- final SVNStatusType propertiesStatus = parsePropertiesStatus(attributes);
+ protected void updateStatus(Attributes attributes, PortableStatus status, Lock.Builder lock) throws SAXException {
+ final StatusType propertiesStatus = parsePropertiesStatus(attributes);
status.setPropertiesStatus(propertiesStatus);
- final SVNStatusType contentsStatus = parseContentsStatus(attributes);
+ final StatusType contentsStatus = parseContentsStatus(attributes);
status.setContentsStatus(contentsStatus);
- if (SVNStatusType.STATUS_CONFLICTED.equals(propertiesStatus) || SVNStatusType.STATUS_CONFLICTED.equals(contentsStatus)) {
+ if (StatusType.STATUS_CONFLICTED.equals(propertiesStatus) || StatusType.STATUS_CONFLICTED.equals(contentsStatus)) {
status.setIsConflicted(true);
}
@@ -724,7 +699,7 @@ public class SvnStatusHandler extends DefaultHandler {
}
@Override
- public void characters(String s, PortableStatus pending, SVNLockWrapper lock) {
+ public void characters(String s, PortableStatus pending, Lock.Builder lock) {
}
}
@@ -737,14 +712,14 @@ public class SvnStatusHandler extends DefaultHandler {
}
@Override
- protected void updateStatus(Attributes attributes, PortableStatus status, SVNLockWrapper lock) throws SAXException {
+ protected void updateStatus(Attributes attributes, PortableStatus status, Lock.Builder lock) throws SAXException {
final String path = attributes.getValue("path");
assertSAX(path != null);
final File file = SvnUtil.resolvePath(myBase, path);
status.setFile(file);
final boolean exists = file.exists();
if (exists) {
- status.setKind(exists, file.isDirectory() ? SVNNodeKind.DIR : SVNNodeKind.FILE);
+ status.setKind(exists, NodeKind.from(file.isDirectory()));
} else {
// this is a hack. This is done so because of strange svn native client output:
/*
@@ -779,15 +754,15 @@ c:\TestProjects\sortedProjects\Subversion\local\withExt82420\mod4>dir
and no "mod4" under
*/
- final SVNStatusType ns = status.getNodeStatus();
- if (myBase.getName().equals(path) && ! SVNStatusType.MISSING.equals(ns) &&
- ! SVNStatusType.STATUS_DELETED.equals(ns) ) {
- status.setKind(true, SVNNodeKind.DIR);
+ final StatusType ns = status.getNodeStatus();
+ if (myBase.getName().equals(path) && ! StatusType.MISSING.equals(ns) &&
+ ! StatusType.STATUS_DELETED.equals(ns) ) {
+ status.setKind(true, NodeKind.DIR);
status.setFile(myBase);
status.setPath("");
return;
}
- status.setKind(exists, SVNNodeKind.UNKNOWN);
+ status.setKind(exists, NodeKind.UNKNOWN);
}
status.setPath(path);
}
@@ -802,7 +777,7 @@ and no "mod4" under
}
@Override
- public void characters(String s, PortableStatus pending, SVNLockWrapper lock) {
+ public void characters(String s, PortableStatus pending, Lock.Builder lock) {
}
}
@@ -814,7 +789,7 @@ and no "mod4" under
}
@Override
- protected void updateStatus(Attributes attributes, PortableStatus status, SVNLockWrapper lock) throws SAXException {
+ protected void updateStatus(Attributes attributes, PortableStatus status, Lock.Builder lock) throws SAXException {
final String name = attributes.getValue("name");
assertSAX(! StringUtil.isEmptyOrSpaces(name));
myName = name;
@@ -830,7 +805,7 @@ and no "mod4" under
}
@Override
- public void characters(String s, PortableStatus pending, SVNLockWrapper lock) {
+ public void characters(String s, PortableStatus pending, Lock.Builder lock) {
}
}
@@ -840,7 +815,7 @@ and no "mod4" under
}
@Override
- protected void updateStatus(Attributes attributes, PortableStatus status, SVNLockWrapper lock) {
+ protected void updateStatus(Attributes attributes, PortableStatus status, Lock.Builder lock) {
}
@Override
@@ -852,7 +827,7 @@ and no "mod4" under
}
@Override
- public void characters(String s, PortableStatus pending, SVNLockWrapper lock) {
+ public void characters(String s, PortableStatus pending, Lock.Builder lock) {
}
}
@@ -862,7 +837,7 @@ and no "mod4" under
}
@Override
- protected void updateStatus(Attributes attributes, PortableStatus status, SVNLockWrapper lock) throws SAXException {
+ protected void updateStatus(Attributes attributes, PortableStatus status, Lock.Builder lock) throws SAXException {
}
@Override
@@ -874,7 +849,7 @@ and no "mod4" under
}
@Override
- public void characters(String s, PortableStatus pending, SVNLockWrapper lock) {
+ public void characters(String s, PortableStatus pending, Lock.Builder lock) {
}
}
@@ -884,7 +859,7 @@ and no "mod4" under
}
@Override
- protected void updateStatus(Attributes attributes, PortableStatus status, SVNLockWrapper lock) {
+ protected void updateStatus(Attributes attributes, PortableStatus status, Lock.Builder lock) {
}
@Override
@@ -896,7 +871,7 @@ and no "mod4" under
}
@Override
- public void characters(String s, PortableStatus pending, SVNLockWrapper lock) {
+ public void characters(String s, PortableStatus pending, Lock.Builder lock) {
}
}
@@ -909,7 +884,7 @@ and no "mod4" under
myAwaitedChildrenMultiple = new HashSet<String>(Arrays.asList(awaitedChildrenMultiple));
}
- protected abstract void updateStatus(Attributes attributes, PortableStatus status, SVNLockWrapper lock) throws SAXException;
+ protected abstract void updateStatus(Attributes attributes, PortableStatus status, Lock.Builder lock) throws SAXException;
public abstract void postEffect(final DataCallback callback);
public abstract void preEffect(final DataCallback callback);
@@ -920,7 +895,7 @@ and no "mod4" under
return myAwaitedChildren.remove(qName);
}
- public abstract void characters(String s, PortableStatus pending, SVNLockWrapper lock);
+ public abstract void characters(String s, PortableStatus pending, Lock.Builder lock);
public void preAttributesEffect(DataCallback callback) {}
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/svnkit/SvnKitProgressCanceller.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/svnkit/SvnKitProgressCanceller.java
new file mode 100644
index 000000000000..6bb370674ba2
--- /dev/null
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/svnkit/SvnKitProgressCanceller.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jetbrains.idea.svn.svnkit;
+
+import com.intellij.openapi.progress.ProgressIndicator;
+import com.intellij.openapi.progress.ProgressManager;
+import org.tmatesoft.svn.core.ISVNCanceller;
+import org.tmatesoft.svn.core.SVNCancelException;
+
+/**
+ * @author Konstantin Kolosovsky.
+ */
+public class SvnKitProgressCanceller implements ISVNCanceller {
+
+ public void checkCancelled() throws SVNCancelException {
+ final ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator();
+ if (indicator != null && indicator.isCanceled()) {
+ throw new SVNCancelException();
+ }
+ }
+}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/treeConflict/MergeFromTheirsResolver.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/treeConflict/MergeFromTheirsResolver.java
index 762f4449b897..b655cdca170c 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/treeConflict/MergeFromTheirsResolver.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/treeConflict/MergeFromTheirsResolver.java
@@ -52,12 +52,11 @@ import com.intellij.util.continuation.TaskDescriptor;
import com.intellij.util.continuation.Where;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.idea.svn.*;
+import org.jetbrains.idea.svn.api.Depth;
+import org.jetbrains.idea.svn.conflict.TreeConflictDescription;
import org.jetbrains.idea.svn.history.SvnChangeList;
import org.jetbrains.idea.svn.history.SvnRepositoryLocation;
-import org.tmatesoft.svn.core.SVNDepth;
-import org.tmatesoft.svn.core.SVNNodeKind;
import org.tmatesoft.svn.core.wc.SVNRevision;
-import org.tmatesoft.svn.core.wc.SVNTreeConflictDescription;
import java.io.File;
import java.io.IOException;
@@ -71,7 +70,7 @@ import java.util.*;
*/
public class MergeFromTheirsResolver {
private final SvnVcs myVcs;
- private final SVNTreeConflictDescription myDescription;
+ private final TreeConflictDescription myDescription;
private final Change myChange;
private final FilePath myOldFilePath;
private final FilePath myNewFilePath;
@@ -86,7 +85,7 @@ public class MergeFromTheirsResolver {
private List<TextFilePatch> myTextPatches;
private VirtualFile myBaseForPatch;
- public MergeFromTheirsResolver(SvnVcs vcs, SVNTreeConflictDescription description, Change change, SvnRevisionNumber revision) {
+ public MergeFromTheirsResolver(SvnVcs vcs, TreeConflictDescription description, Change change, SvnRevisionNumber revision) {
myVcs = vcs;
myDescription = description;
myChange = change;
@@ -126,11 +125,7 @@ public class MergeFromTheirsResolver {
});
final List<TaskDescriptor> tasks = new SmartList<TaskDescriptor>();
- if (SVNNodeKind.DIR.equals(myDescription.getNodeKind())) {
- tasks.add(new PreloadChangesContentsForDir());
- } else {
- tasks.add(new PreloadChangesContentsForFile());
- }
+ tasks.add(myDescription.isDirectory() ? new PreloadChangesContentsForDir() : new PreloadChangesContentsForFile());
tasks.add(new ConvertTextPaths());
tasks.add(new PatchCreator());
tasks.add(new SelectPatchesInApplyPatchDialog());
@@ -290,7 +285,7 @@ public class MergeFromTheirsResolver {
// TODO: is used. Command line also does not support automatic directory creation.
// TODO: Need to check additionally if there are cases when directory does not exist and add corresponding code.
myVcs.getFactory(myOldFilePath.getIOFile()).createAddClient()
- .add(myOldFilePath.getIOFile(), SVNDepth.EMPTY, true, false, true, null);
+ .add(myOldFilePath.getIOFile(), Depth.EMPTY, true, false, true, null);
}
catch (VcsException e) {
context.handleException(e, true);
@@ -564,7 +559,7 @@ public class MergeFromTheirsResolver {
}
}
- private List<CommittedChangeList> loadSvnChangeListsForPatch(SVNTreeConflictDescription description) throws VcsException {
+ private List<CommittedChangeList> loadSvnChangeListsForPatch(TreeConflictDescription description) throws VcsException {
long max = description.getSourceRightVersion().getPegRevision();
long min = description.getSourceLeftVersion().getPegRevision();
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/treeConflict/SvnTreeConflictResolver.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/treeConflict/SvnTreeConflictResolver.java
index c637ce243981..584666c7e86a 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/treeConflict/SvnTreeConflictResolver.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/treeConflict/SvnTreeConflictResolver.java
@@ -27,8 +27,13 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.SvnRevisionNumber;
import org.jetbrains.idea.svn.SvnVcs;
+import org.jetbrains.idea.svn.api.Depth;
+import org.jetbrains.idea.svn.commandLine.SvnBindException;
+import org.jetbrains.idea.svn.conflict.TreeConflictDescription;
+import org.jetbrains.idea.svn.status.Status;
import org.jetbrains.idea.svn.status.StatusClient;
-import org.tmatesoft.svn.core.SVNDepth;
+import org.jetbrains.idea.svn.status.StatusConsumer;
+import org.jetbrains.idea.svn.status.StatusType;
import org.tmatesoft.svn.core.SVNException;
import org.tmatesoft.svn.core.wc.*;
@@ -57,7 +62,7 @@ public class SvnTreeConflictResolver {
myDirtyScopeManager = VcsDirtyScopeManager.getInstance(myVcs.getProject());
}
- public void resolveSelectTheirsFull(SVNTreeConflictDescription d) throws VcsException {
+ public void resolveSelectTheirsFull(TreeConflictDescription d) throws VcsException {
final LocalHistory localHistory = LocalHistory.getInstance();
localHistory.putSystemLabel(myVcs.getProject(), "Before accepting theirs for " + TreeConflictRefreshablePanel.filePath(myPath));
try {
@@ -84,74 +89,64 @@ public class SvnTreeConflictResolver {
private void revertAdditional() throws VcsException {
if (myRevertPath == null) return;
final File ioFile = myRevertPath.getIOFile();
- try {
- final SVNStatus status = myVcs.getFactory(ioFile).createStatusClient().doStatus(ioFile, false);
- myVcs.getFactory(ioFile).createRevertClient().revert(new File[]{ioFile}, SVNDepth.INFINITY, null);
- if (SVNStatusType.STATUS_ADDED.equals(status.getNodeStatus())) {
- FileUtil.delete(ioFile);
- }
- }
- catch (SVNException e) {
- throw new VcsException(e);
+ final Status status = myVcs.getFactory(ioFile).createStatusClient().doStatus(ioFile, false);
+ myVcs.getFactory(ioFile).createRevertClient().revert(new File[]{ioFile}, Depth.INFINITY, null);
+ if (StatusType.STATUS_ADDED.equals(status.getNodeStatus())) {
+ FileUtil.delete(ioFile);
}
pathDirty(myRevertPath);
}
- public void resolveSelectMineFull(SVNTreeConflictDescription d) throws VcsException {
+ public void resolveSelectMineFull(TreeConflictDescription d) throws VcsException {
final File ioFile = myPath.getIOFile();
- myVcs.getFactory(ioFile).createConflictClient().resolve(ioFile, SVNDepth.INFINITY, true, true, true);
+ myVcs.getFactory(ioFile).createConflictClient().resolve(ioFile, Depth.INFINITY, true, true, true);
pathDirty(myPath);
}
private void updatetoTheirsFull() throws VcsException {
- try {
- final File ioFile = myPath.getIOFile();
- SVNStatus status = myVcs.getFactory(ioFile).createStatusClient().doStatus(ioFile, false);
- if (myCommittedRevision == null) {
- myCommittedRevision = new SvnRevisionNumber(status.getCommittedRevision());
- }
- if (status == null || SVNStatusType.STATUS_UNVERSIONED.equals(status.getNodeStatus())) {
- myVcs.getFactory(ioFile).createRevertClient().revert(new File[]{ioFile}, SVNDepth.INFINITY, null);
- updateIoFile(ioFile, SVNRevision.HEAD);
- return;
- } else if (SVNStatusType.STATUS_ADDED.equals(status.getNodeStatus())) {
- myVcs.getFactory(ioFile).createRevertClient().revert(new File[]{ioFile}, SVNDepth.INFINITY, null);
- updateIoFile(ioFile, SVNRevision.HEAD);
- FileUtil.delete(ioFile);
- return;
- } else {
- final Set<File> usedToBeAdded = new HashSet<File>();
- if (myPath.isDirectory()) {
- StatusClient statusClient = myVcs.getFactory(ioFile).createStatusClient();
- statusClient.doStatus(ioFile, SVNRevision.UNDEFINED, SVNDepth.INFINITY, false, false, false, false,
- new ISVNStatusHandler() {
- @Override
- public void handleStatus(SVNStatus status) throws SVNException {
- if (status != null && SVNStatusType.STATUS_ADDED.equals(status.getNodeStatus())) {
- usedToBeAdded.add(status.getFile());
- }
+ final File ioFile = myPath.getIOFile();
+ Status status = myVcs.getFactory(ioFile).createStatusClient().doStatus(ioFile, false);
+ if (myCommittedRevision == null) {
+ myCommittedRevision = new SvnRevisionNumber(status.getCommittedRevision());
+ }
+ if (status == null || StatusType.STATUS_UNVERSIONED.equals(status.getNodeStatus())) {
+ myVcs.getFactory(ioFile).createRevertClient().revert(new File[]{ioFile}, Depth.INFINITY, null);
+ updateIoFile(ioFile, SVNRevision.HEAD);
+ return;
+ } else if (StatusType.STATUS_ADDED.equals(status.getNodeStatus())) {
+ myVcs.getFactory(ioFile).createRevertClient().revert(new File[]{ioFile}, Depth.INFINITY, null);
+ updateIoFile(ioFile, SVNRevision.HEAD);
+ FileUtil.delete(ioFile);
+ return;
+ } else {
+ final Set<File> usedToBeAdded = new HashSet<File>();
+ if (myPath.isDirectory()) {
+ StatusClient statusClient = myVcs.getFactory(ioFile).createStatusClient();
+ statusClient.doStatus(ioFile, SVNRevision.UNDEFINED, Depth.INFINITY, false, false, false, false,
+ new StatusConsumer() {
+ @Override
+ public void consume(Status status) throws SVNException {
+ if (status != null && StatusType.STATUS_ADDED.equals(status.getNodeStatus())) {
+ usedToBeAdded.add(status.getFile());
}
- }, null);
- }
- myVcs.getFactory(ioFile).createRevertClient().revert(new File[]{ioFile}, SVNDepth.INFINITY, null);
- for (File wasAdded : usedToBeAdded) {
- FileUtil.delete(wasAdded);
- }
- updateIoFile(ioFile, SVNRevision.HEAD);
+ }
+ }, null);
}
- }
- catch (SVNException e1) {
- throw new VcsException(e1);
+ myVcs.getFactory(ioFile).createRevertClient().revert(new File[]{ioFile}, Depth.INFINITY, null);
+ for (File wasAdded : usedToBeAdded) {
+ FileUtil.delete(wasAdded);
+ }
+ updateIoFile(ioFile, SVNRevision.HEAD);
}
}
- private void updateIoFile(@NotNull File ioFile, @NotNull final SVNRevision revision) throws SVNException {
+ private void updateIoFile(@NotNull File ioFile, @NotNull final SVNRevision revision) throws SvnBindException {
if (! ioFile.exists()) {
File parent = ioFile.getParentFile();
- myVcs.getFactory(parent).createUpdateClient().doUpdate(parent, revision, SVNDepth.INFINITY, true, false);
+ myVcs.getFactory(parent).createUpdateClient().doUpdate(parent, revision, Depth.INFINITY, true, false);
} else {
- myVcs.getFactory(ioFile).createUpdateClient().doUpdate(ioFile, revision, SVNDepth.INFINITY, false, false);
+ myVcs.getFactory(ioFile).createUpdateClient().doUpdate(ioFile, revision, Depth.INFINITY, false, false);
}
}
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/treeConflict/TreeConflictRefreshablePanel.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/treeConflict/TreeConflictRefreshablePanel.java
index da0b1e7f590b..9a68d63527ae 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/treeConflict/TreeConflictRefreshablePanel.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/treeConflict/TreeConflictRefreshablePanel.java
@@ -43,16 +43,14 @@ import gnu.trove.TLongArrayList;
import org.jetbrains.idea.svn.ConflictedSvnChange;
import org.jetbrains.idea.svn.SvnRevisionNumber;
import org.jetbrains.idea.svn.SvnVcs;
+import org.jetbrains.idea.svn.conflict.ConflictAction;
+import org.jetbrains.idea.svn.conflict.ConflictReason;
+import org.jetbrains.idea.svn.conflict.ConflictVersion;
+import org.jetbrains.idea.svn.conflict.TreeConflictDescription;
import org.jetbrains.idea.svn.history.SvnHistoryProvider;
import org.jetbrains.idea.svn.history.SvnHistorySession;
import org.tmatesoft.svn.core.SVNException;
-import org.tmatesoft.svn.core.SVNNodeKind;
-import org.tmatesoft.svn.core.internal.wc.SVNConflictVersion;
-import org.tmatesoft.svn.core.internal.wc.SVNTreeConflictUtil;
-import org.tmatesoft.svn.core.wc.SVNConflictAction;
-import org.tmatesoft.svn.core.wc.SVNConflictReason;
import org.tmatesoft.svn.core.wc.SVNRevision;
-import org.tmatesoft.svn.core.wc.SVNTreeConflictDescription;
import javax.swing.*;
import java.awt.*;
@@ -96,7 +94,7 @@ public class TreeConflictRefreshablePanel extends AbstractRefreshablePanel {
return true;
}
- private static boolean descriptionsEqual(SVNTreeConflictDescription d1, SVNTreeConflictDescription d2) {
+ private static boolean descriptionsEqual(TreeConflictDescription d1, TreeConflictDescription d2) {
if (d1.isPropertyConflict() != d2.isPropertyConflict()) return false;
if (d1.isTextConflict() != d2.isTextConflict()) return false;
if (d1.isTreeConflict() != d2.isTreeConflict()) return false;
@@ -111,7 +109,7 @@ public class TreeConflictRefreshablePanel extends AbstractRefreshablePanel {
return true;
}
- private static boolean compareConflictVersion(SVNConflictVersion v1, SVNConflictVersion v2) {
+ private static boolean compareConflictVersion(ConflictVersion v1, ConflictVersion v2) {
if (v1 == null && v2 == null) return true;
if (v1 == null || v2 == null) return false;
if (! v1.getKind().equals(v2.getKind())) return false;
@@ -131,7 +129,7 @@ public class TreeConflictRefreshablePanel extends AbstractRefreshablePanel {
processDescription(myChange.getAfterDescription()));
}
- private BeforeAfter<ConflictSidePresentation> processDescription(SVNTreeConflictDescription description) throws VcsException {
+ private BeforeAfter<ConflictSidePresentation> processDescription(TreeConflictDescription description) throws VcsException {
if (description == null) return null;
if (myChange.getBeforeRevision() != null) {
myCommittedRevision = (SvnRevisionNumber)SvnHistorySession.getCurrentCommittedRevision(myVcs,
@@ -180,12 +178,12 @@ public class TreeConflictRefreshablePanel extends AbstractRefreshablePanel {
return new BeforeAfter<ConflictSidePresentation>(leftSide, rightSide);
}
- private static boolean isDifferentURLs(SVNTreeConflictDescription description) {
+ private static boolean isDifferentURLs(TreeConflictDescription description) {
return description.getSourceLeftVersion() != null && description.getSourceRightVersion() != null &&
! Comparing.equal(description.getSourceLeftVersion().getPath(), description.getSourceRightVersion().getPath());
}
- private ConflictSidePresentation createSide(SVNConflictVersion version, final SVNRevision untilThisOther, final boolean isLeft) throws VcsException {
+ private ConflictSidePresentation createSide(ConflictVersion version, final SVNRevision untilThisOther, final boolean isLeft) throws VcsException {
if (version == null) return EmptyConflictSide.getInstance();
if (myChange.getBeforeRevision() != null && myCommittedRevision != null) {
SvnRevisionNumber number = myCommittedRevision;
@@ -226,12 +224,12 @@ public class TreeConflictRefreshablePanel extends AbstractRefreshablePanel {
return wrapper;
}
- private void appendDescription(SVNTreeConflictDescription description,
+ private void appendDescription(TreeConflictDescription description,
JPanel main,
GridBagConstraints gb,
BeforeAfter<ConflictSidePresentation> ba, boolean directory) {
if (description == null) return;
- JLabel descriptionLbl = new JLabel(SVNTreeConflictUtil.getHumanReadableConflictDescription(description));
+ JLabel descriptionLbl = new JLabel(description.toPresentableString());
descriptionLbl.setForeground(Color.red);
main.add(descriptionLbl, gb);
++ gb.gridy;
@@ -243,7 +241,7 @@ public class TreeConflictRefreshablePanel extends AbstractRefreshablePanel {
addSide(main, gb, ba.getAfter(), description.getSourceRightVersion(), "Right", directory);
}
- private void addResolveButtons(SVNTreeConflictDescription description, JPanel main, GridBagConstraints gb) {
+ private void addResolveButtons(TreeConflictDescription description, JPanel main, GridBagConstraints gb) {
final FlowLayout flowLayout = new FlowLayout(FlowLayout.LEFT, 5, 5);
JPanel wrapper = new JPanel(flowLayout);
final JButton both = new JButton("Both");
@@ -266,7 +264,7 @@ public class TreeConflictRefreshablePanel extends AbstractRefreshablePanel {
++ gb.gridy;
}
- private ActionListener createRight(final SVNTreeConflictDescription description) {
+ private ActionListener createRight(final TreeConflictDescription description) {
return new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
@@ -276,11 +274,11 @@ public class TreeConflictRefreshablePanel extends AbstractRefreshablePanel {
FileDocumentManager.getInstance().saveAllDocuments();
final Paths paths = getPaths(description);
ProgressManager.getInstance().run(
- new VcsBackgroundTask<SVNTreeConflictDescription>(myVcs.getProject(), "Accepting theirs for: " + filePath(paths.myMainPath),
+ new VcsBackgroundTask<TreeConflictDescription>(myVcs.getProject(), "Accepting theirs for: " + filePath(paths.myMainPath),
BackgroundFromStartOption.getInstance(), Collections.singletonList(description),
true) {
@Override
- protected void process(SVNTreeConflictDescription d) throws VcsException {
+ protected void process(TreeConflictDescription d) throws VcsException {
new SvnTreeConflictResolver(myVcs, paths.myMainPath, myCommittedRevision, paths.myAdditionalPath).resolveSelectTheirsFull(d);
}
@@ -296,11 +294,11 @@ public class TreeConflictRefreshablePanel extends AbstractRefreshablePanel {
};
}
- private Paths getPaths(final SVNTreeConflictDescription description) {
- FilePath mainPath = new FilePathImpl(description.getPath(), SVNNodeKind.DIR.equals(description.getNodeKind()));
+ private Paths getPaths(final TreeConflictDescription description) {
+ FilePath mainPath;
FilePath additionalPath = null;
if (myChange.isMoved() || myChange.isRenamed()) {
- if (SVNConflictAction.ADD.equals(description.getConflictAction())) {
+ if (ConflictAction.ADD.equals(description.getConflictAction())) {
mainPath = myChange.getAfterRevision().getFile();
additionalPath = myChange.getBeforeRevision().getFile();
} else {
@@ -323,7 +321,7 @@ public class TreeConflictRefreshablePanel extends AbstractRefreshablePanel {
}
}
- private ActionListener createLeft(final SVNTreeConflictDescription description) {
+ private ActionListener createLeft(final TreeConflictDescription description) {
return new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
@@ -333,11 +331,11 @@ public class TreeConflictRefreshablePanel extends AbstractRefreshablePanel {
FileDocumentManager.getInstance().saveAllDocuments();
final Paths paths = getPaths(description);
ProgressManager.getInstance().run(
- new VcsBackgroundTask<SVNTreeConflictDescription>(myVcs.getProject(), "Accepting yours for: " + filePath(paths.myMainPath),
+ new VcsBackgroundTask<TreeConflictDescription>(myVcs.getProject(), "Accepting yours for: " + filePath(paths.myMainPath),
BackgroundFromStartOption.getInstance(), Collections.singletonList(description),
true) {
@Override
- protected void process(SVNTreeConflictDescription d) throws VcsException {
+ protected void process(TreeConflictDescription d) throws VcsException {
new SvnTreeConflictResolver(myVcs, paths.myMainPath, myCommittedRevision, paths.myAdditionalPath).resolveSelectMineFull(d);
}
@@ -353,22 +351,22 @@ public class TreeConflictRefreshablePanel extends AbstractRefreshablePanel {
};
}
- private ActionListener createMerge(final SVNTreeConflictDescription description) {
+ private ActionListener createMerge(final TreeConflictDescription description) {
if (isDifferentURLs(description)) {
return null;
}
// my edit, theirs move or delete
- if (SVNConflictAction.EDIT.equals(description.getConflictAction()) && description.getSourceLeftVersion() != null &&
- SVNConflictReason.DELETED.equals(description.getConflictReason()) && (myChange.isMoved() || myChange.isRenamed()) &&
+ if (ConflictAction.EDIT.equals(description.getConflictAction()) && description.getSourceLeftVersion() != null &&
+ ConflictReason.DELETED.equals(description.getConflictReason()) && (myChange.isMoved() || myChange.isRenamed()) &&
myCommittedRevision != null) {
- if (myPath.isDirectory() == SVNNodeKind.DIR.equals(description.getSourceRightVersion().getKind())) {
+ if (myPath.isDirectory() == description.getSourceRightVersion().isDirectory()) {
return createMergeTheirsForFile(description);
}
}
return null;
}
- private ActionListener createMergeTheirsForFile(final SVNTreeConflictDescription description) {
+ private ActionListener createMergeTheirsForFile(final TreeConflictDescription description) {
return new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
@@ -381,7 +379,7 @@ public class TreeConflictRefreshablePanel extends AbstractRefreshablePanel {
return newFilePath.getName() + " (" + newFilePath.getParentPath().getPath() + ")";
}
- private static ActionListener createBoth(SVNTreeConflictDescription description) {
+ private static ActionListener createBoth(TreeConflictDescription description) {
return null;
}
@@ -397,10 +395,10 @@ public class TreeConflictRefreshablePanel extends AbstractRefreshablePanel {
private void addSide(JPanel main,
GridBagConstraints gb,
ConflictSidePresentation before,
- SVNConflictVersion leftVersion, final String name, boolean directory) {
+ ConflictVersion leftVersion, final String name, boolean directory) {
final String leftPresentation = leftVersion == null ? name + ": (" + (directory ? "directory" : "file") +
(myChange.getBeforeRevision() == null ? ") added" : ") unversioned") :
- name + ": " + FileUtil.toSystemIndependentName(SVNTreeConflictUtil.getHumanReadableConflictVersion(leftVersion));
+ name + ": " + FileUtil.toSystemIndependentName(ConflictVersion.toPresentableString(leftVersion));
gb.insets.top = 10;
main.add(new JLabel(leftPresentation), gb);
++ gb.gridy;
@@ -454,9 +452,9 @@ public class TreeConflictRefreshablePanel extends AbstractRefreshablePanel {
private abstract static class AbstractConflictSide<T> implements ConflictSidePresentation, Convertor<T, VcsRevisionNumber> {
protected final Project myProject;
- protected final SVNConflictVersion myVersion;
+ protected final ConflictVersion myVersion;
- private AbstractConflictSide(Project project, SVNConflictVersion version) {
+ private AbstractConflictSide(Project project, ConflictVersion version) {
myProject = project;
myVersion = version;
}
@@ -472,13 +470,13 @@ public class TreeConflictRefreshablePanel extends AbstractRefreshablePanel {
private FileHistoryPanelImpl myFileHistoryPanel;
private TLongArrayList myListToReportLoaded;
- private HistoryConflictSide(SvnVcs vcs, SVNConflictVersion version, final SVNRevision peg) throws VcsException {
+ private HistoryConflictSide(SvnVcs vcs, ConflictVersion version, final SVNRevision peg) throws VcsException {
super(vcs.getProject(), version);
myVcs = vcs;
myPeg = peg;
try {
myPath = FilePathImpl.createNonLocal(
- version.getRepositoryRoot().appendPath(FileUtil.toSystemIndependentName(version.getPath()), true).toString(), SVNNodeKind.DIR.equals(version.getKind()));
+ version.getRepositoryRoot().appendPath(FileUtil.toSystemIndependentName(version.getPath()), true).toString(), version.isDirectory());
}
catch (SVNException e) {
throw new VcsException(e);
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/update/AbstractSvnUpdatePanel.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/update/AbstractSvnUpdatePanel.java
index 0cea23ea3988..c57d043b33d2 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/update/AbstractSvnUpdatePanel.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/update/AbstractSvnUpdatePanel.java
@@ -23,8 +23,8 @@ import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.DepthCombo;
import org.jetbrains.idea.svn.SvnConfiguration;
import org.jetbrains.idea.svn.SvnVcs;
+import org.jetbrains.idea.svn.info.Info;
import org.tmatesoft.svn.core.SVNURL;
-import org.tmatesoft.svn.core.wc.SVNInfo;
import javax.swing.*;
import java.awt.*;
@@ -106,7 +106,7 @@ public abstract class AbstractSvnUpdatePanel {
@Nullable
private SVNURL getUrlFor(@NotNull final FilePath root) {
- final SVNInfo info = myVCS.getInfo(root.getIOFile());
+ final Info info = myVCS.getInfo(root.getIOFile());
return info != null ? info.getURL() : null;
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/update/AbstractUpdateIntegrateCrawler.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/update/AbstractUpdateIntegrateCrawler.java
index 47b15802287b..991c2fe1e7b2 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/update/AbstractUpdateIntegrateCrawler.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/update/AbstractUpdateIntegrateCrawler.java
@@ -22,9 +22,7 @@ import com.intellij.openapi.vcs.update.UpdatedFiles;
import org.jetbrains.idea.svn.SvnBundle;
import org.jetbrains.idea.svn.SvnVcs;
import org.jetbrains.idea.svn.SvnWCRootCrawler;
-import org.tmatesoft.svn.core.SVNErrorCode;
-import org.tmatesoft.svn.core.SVNErrorMessage;
-import org.tmatesoft.svn.core.SVNException;
+import org.jetbrains.idea.svn.commandLine.SvnBindException;
import java.io.File;
import java.util.Collection;
@@ -58,13 +56,9 @@ public abstract class AbstractUpdateIntegrateCrawler implements SvnWCRootCrawler
long rev = doUpdate(root);
if (rev < 0 && !isMerge()) {
- throw new SVNException(SVNErrorMessage.create(SVNErrorCode.UNKNOWN, SvnBundle.message("exception.text.root.was.not.properly.updated", root)));
+ throw new SvnBindException(SvnBundle.message("exception.text.root.was.not.properly.updated", root));
}
}
- catch (SVNException e) {
- LOG.info(e);
- myExceptions.add(new VcsException(e));
- }
catch (VcsException e) {
LOG.info(e);
myExceptions.add(e);
@@ -73,7 +67,7 @@ public abstract class AbstractUpdateIntegrateCrawler implements SvnWCRootCrawler
protected abstract void showProgressMessage(ProgressIndicator progress, File root);
- protected abstract long doUpdate(File root) throws SVNException, VcsException;
+ protected abstract long doUpdate(File root) throws VcsException;
protected abstract boolean isMerge();
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/update/AutoSvnUpdater.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/update/AutoSvnUpdater.java
index 925d13c7242f..4bb3dbea9a18 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/update/AutoSvnUpdater.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/update/AutoSvnUpdater.java
@@ -29,7 +29,7 @@ import com.intellij.openapi.wm.WindowManager;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.idea.svn.SvnConfiguration;
import org.jetbrains.idea.svn.SvnVcs;
-import org.tmatesoft.svn.core.SVNDepth;
+import org.jetbrains.idea.svn.api.Depth;
import org.tmatesoft.svn.core.wc.SVNRevision;
import javax.swing.*;
@@ -66,7 +66,7 @@ public class AutoSvnUpdater extends AbstractCommonUpdateAction {
final SvnConfiguration configuration17 = SvnConfiguration.getInstance(myProject);
configuration17.setForceUpdate(false);
configuration17.setUpdateLockOnDemand(false);
- configuration17.setUpdateDepth(SVNDepth.INFINITY);
+ configuration17.setUpdateDepth(Depth.INFINITY);
final SvnVcs vcs = SvnVcs.getInstance(myProject);
for (FilePath root : myRoots) {
configureUpdateRootInfo(root, configuration17.getUpdateRootInfo(root.getIOFile(), vcs));
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/update/CmdUpdateClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/update/CmdUpdateClient.java
index 051be8945b3e..61b0592af085 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/update/CmdUpdateClient.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/update/CmdUpdateClient.java
@@ -16,16 +16,17 @@
package org.jetbrains.idea.svn.update;
import com.intellij.openapi.util.io.FileUtil;
-import com.intellij.openapi.vcs.VcsException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import org.jetbrains.idea.svn.api.Depth;
+import org.jetbrains.idea.svn.api.EventAction;
+import org.jetbrains.idea.svn.api.ProgressEvent;
import org.jetbrains.idea.svn.commandLine.BaseUpdateCommandListener;
import org.jetbrains.idea.svn.commandLine.CommandUtil;
+import org.jetbrains.idea.svn.commandLine.SvnBindException;
import org.jetbrains.idea.svn.commandLine.SvnCommandName;
+import org.jetbrains.idea.svn.info.Info;
import org.tmatesoft.svn.core.*;
-import org.tmatesoft.svn.core.wc.SVNEvent;
-import org.tmatesoft.svn.core.wc.SVNEventAction;
-import org.tmatesoft.svn.core.wc.SVNInfo;
import org.tmatesoft.svn.core.wc.SVNRevision;
import org.tmatesoft.svn.core.wc2.SvnTarget;
@@ -47,46 +48,24 @@ public class CmdUpdateClient extends SvnKitUpdateClient {
private static final Pattern ourExceptionPattern = Pattern.compile("svn: E(\\d{6}): .+");
private static final String ourAuthenticationRealm = "Authentication realm:";
- @Override
- public long[] doUpdate(final File[] paths, final SVNRevision revision, final SVNDepth depth, final boolean allowUnversionedObstructions,
- final boolean depthIsSticky, final boolean makeParents) throws SVNException {
- // since one revision is passed -> I assume same repository here
- checkWorkingCopy(paths[0]);
-
- final List<String> parameters = new ArrayList<String>();
-
- fillParameters(parameters, revision, depth, depthIsSticky, allowUnversionedObstructions);
- CommandUtil.put(parameters, makeParents, "--parents");
- CommandUtil.put(parameters, myIgnoreExternals, "--ignore-externals");
- CommandUtil.put(parameters, paths);
-
- return run(paths, parameters, SvnCommandName.up);
- }
-
- private void checkWorkingCopy(@NotNull File path) throws SVNException {
- final SVNInfo info = myFactory.createInfoClient().doInfo(path, SVNRevision.UNDEFINED);
+ private void checkWorkingCopy(@NotNull File path) throws SvnBindException {
+ final Info info = myFactory.createInfoClient().doInfo(path, SVNRevision.UNDEFINED);
if (info == null || info.getURL() == null) {
- throw new SVNException(SVNErrorMessage.create(SVNErrorCode.WC_NOT_WORKING_COPY, path.getPath()));
+ throw new SvnBindException(SVNErrorCode.WC_NOT_WORKING_COPY, path.getPath());
}
}
- private long[] run(@NotNull File[] paths, @NotNull List<String> parameters, @NotNull SvnCommandName command) throws SVNException {
- File base = paths[0];
- base = base.isDirectory() ? base : base.getParentFile();
+ private long[] run(@NotNull File path, @NotNull List<String> parameters, @NotNull SvnCommandName command) throws SvnBindException {
+ File base = path.isDirectory() ? path : path.getParentFile();
final AtomicReference<long[]> updatedToRevision = new AtomicReference<long[]>();
updatedToRevision.set(new long[0]);
- final BaseUpdateCommandListener listener = createCommandListener(paths, updatedToRevision, base);
- try {
- execute(myVcs, SvnTarget.fromFile(base), command, parameters, listener);
- }
- catch (VcsException e) {
- throw new SVNException(SVNErrorMessage.create(SVNErrorCode.IO_ERROR, e));
- }
+ final BaseUpdateCommandListener listener = createCommandListener(new File[]{path}, updatedToRevision, base);
+ execute(myVcs, SvnTarget.fromFile(base), command, parameters, listener);
- listener.throwIfException();
+ listener.throwWrappedIfException();
return updatedToRevision.get();
}
@@ -98,8 +77,8 @@ public class CmdUpdateClient extends SvnKitUpdateClient {
final long[] myRevisions = new long[paths.length];
@Override
- protected void beforeHandler(@NotNull SVNEvent event) {
- if (SVNEventAction.UPDATE_COMPLETED.equals(event.getAction())) {
+ protected void beforeHandler(@NotNull ProgressEvent event) {
+ if (EventAction.UPDATE_COMPLETED.equals(event.getAction())) {
final long eventRevision = event.getRevision();
for (int i = 0; i < paths.length; i++) {
final File path = paths[i];
@@ -121,7 +100,7 @@ public class CmdUpdateClient extends SvnKitUpdateClient {
private static void fillParameters(@NotNull List<String> parameters,
@Nullable SVNRevision revision,
- @Nullable SVNDepth depth,
+ @Nullable Depth depth,
boolean depthIsSticky,
boolean allowUnversionedObstructions) {
@@ -155,9 +134,17 @@ public class CmdUpdateClient extends SvnKitUpdateClient {
}
@Override
- public long doUpdate(File path, SVNRevision revision, SVNDepth depth, boolean allowUnversionedObstructions, boolean depthIsSticky)
- throws SVNException {
- final long[] longs = doUpdate(new File[]{path}, revision, depth, allowUnversionedObstructions, depthIsSticky, false);
+ public long doUpdate(File path, SVNRevision revision, Depth depth, boolean allowUnversionedObstructions, boolean depthIsSticky)
+ throws SvnBindException {
+ checkWorkingCopy(path);
+
+ final List<String> parameters = new ArrayList<String>();
+
+ fillParameters(parameters, revision, depth, depthIsSticky, allowUnversionedObstructions);
+ CommandUtil.put(parameters, myIgnoreExternals, "--ignore-externals");
+ CommandUtil.put(parameters, path);
+
+ final long[] longs = run(path, parameters, SvnCommandName.up);
return longs[0];
}
@@ -166,9 +153,9 @@ public class CmdUpdateClient extends SvnKitUpdateClient {
SVNURL url,
SVNRevision pegRevision,
SVNRevision revision,
- SVNDepth depth,
+ Depth depth,
boolean allowUnversionedObstructions,
- boolean depthIsSticky) throws SVNException {
+ boolean depthIsSticky) throws SvnBindException {
checkWorkingCopy(path);
List<String> parameters = new ArrayList<String>();
@@ -178,7 +165,7 @@ public class CmdUpdateClient extends SvnKitUpdateClient {
fillParameters(parameters, revision, depth, depthIsSticky, allowUnversionedObstructions);
parameters.add("--ignore-ancestry");
- long[] revisions = run(new File[]{path}, parameters, SvnCommandName.switchCopy);
+ long[] revisions = run(path, parameters, SvnCommandName.switchCopy);
return revisions != null && revisions.length > 0 ? revisions[0] : -1;
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/update/MergeRootInfo.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/update/MergeRootInfo.java
index 872ee8f81573..6bc2af02415c 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/update/MergeRootInfo.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/update/MergeRootInfo.java
@@ -16,9 +16,9 @@
package org.jetbrains.idea.svn.update;
import org.jetbrains.idea.svn.SvnVcs;
+import org.jetbrains.idea.svn.info.Info;
import org.tmatesoft.svn.core.SVNException;
import org.tmatesoft.svn.core.SVNURL;
-import org.tmatesoft.svn.core.wc.SVNInfo;
import org.tmatesoft.svn.core.wc.SVNRevision;
import java.io.File;
@@ -33,7 +33,7 @@ public class MergeRootInfo {
myRevision1 = SVNRevision.HEAD;
myRevision2 = SVNRevision.HEAD;
- SVNInfo info = vcs.getInfo(file);
+ Info info = vcs.getInfo(file);
myUrl1 = info != null && info.getURL() != null ? info.getURL().toString() : "";
myUrl2 = myUrl1;
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/update/SvnKitUpdateClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/update/SvnKitUpdateClient.java
index be9923d1b07b..eaf6578b1587 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/update/SvnKitUpdateClient.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/update/SvnKitUpdateClient.java
@@ -18,10 +18,11 @@ package org.jetbrains.idea.svn.update;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.api.BaseSvnClient;
-import org.tmatesoft.svn.core.SVNDepth;
+import org.jetbrains.idea.svn.api.Depth;
+import org.jetbrains.idea.svn.api.ProgressTracker;
+import org.jetbrains.idea.svn.commandLine.SvnBindException;
import org.tmatesoft.svn.core.SVNException;
import org.tmatesoft.svn.core.SVNURL;
-import org.tmatesoft.svn.core.wc.ISVNEventHandler;
import org.tmatesoft.svn.core.wc.SVNRevision;
import org.tmatesoft.svn.core.wc.SVNUpdateClient;
@@ -35,24 +36,19 @@ import java.io.File;
*/
public class SvnKitUpdateClient extends BaseSvnClient implements UpdateClient {
- @Nullable protected ISVNEventHandler myDispatcher;
+ @Nullable protected ProgressTracker myDispatcher;
protected boolean myIgnoreExternals;
protected boolean myLocksOnDemand;
@Override
- public long[] doUpdate(File[] paths,
- SVNRevision revision,
- SVNDepth depth,
- boolean allowUnversionedObstructions,
- boolean depthIsSticky,
- boolean makeParents) throws SVNException {
- return getClient().doUpdate(paths, revision, depth, allowUnversionedObstructions, depthIsSticky, makeParents);
- }
-
- @Override
- public long doUpdate(File path, SVNRevision revision, SVNDepth depth, boolean allowUnversionedObstructions, boolean depthIsSticky)
- throws SVNException {
- return getClient().doUpdate(path, revision, depth, allowUnversionedObstructions, depthIsSticky);
+ public long doUpdate(File path, SVNRevision revision, Depth depth, boolean allowUnversionedObstructions, boolean depthIsSticky)
+ throws SvnBindException {
+ try {
+ return getClient().doUpdate(path, revision, toDepth(depth), allowUnversionedObstructions, depthIsSticky);
+ }
+ catch (SVNException e) {
+ throw new SvnBindException(e);
+ }
}
@Override
@@ -60,9 +56,14 @@ public class SvnKitUpdateClient extends BaseSvnClient implements UpdateClient {
SVNURL url,
SVNRevision pegRevision,
SVNRevision revision,
- SVNDepth depth,
- boolean allowUnversionedObstructions, boolean depthIsSticky) throws SVNException {
- return getClient().doSwitch(path, url, pegRevision, revision, depth, allowUnversionedObstructions, depthIsSticky);
+ Depth depth,
+ boolean allowUnversionedObstructions, boolean depthIsSticky) throws SvnBindException {
+ try {
+ return getClient().doSwitch(path, url, pegRevision, revision, toDepth(depth), allowUnversionedObstructions, depthIsSticky);
+ }
+ catch (SVNException e) {
+ throw new SvnBindException(e);
+ }
}
@Override
@@ -71,7 +72,7 @@ public class SvnKitUpdateClient extends BaseSvnClient implements UpdateClient {
}
@Override
- public void setEventHandler(ISVNEventHandler dispatcher) {
+ public void setEventHandler(ProgressTracker dispatcher) {
myDispatcher = dispatcher;
}
@@ -84,7 +85,7 @@ public class SvnKitUpdateClient extends BaseSvnClient implements UpdateClient {
private SVNUpdateClient getClient() {
SVNUpdateClient client = myVcs.getSvnKitManager().createUpdateClient();
- client.setEventHandler(myDispatcher);
+ client.setEventHandler(toEventHandler(myDispatcher));
client.setIgnoreExternals(myIgnoreExternals);
client.setUpdateLocksOnDemand(myLocksOnDemand);
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/update/SvnUpdateEnvironment.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/update/SvnUpdateEnvironment.java
index e4d25c385375..554b2c29bc48 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/update/SvnUpdateEnvironment.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/update/SvnUpdateEnvironment.java
@@ -24,9 +24,9 @@ import com.intellij.openapi.vcs.update.UpdatedFiles;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.*;
-import org.tmatesoft.svn.core.SVNException;
+import org.jetbrains.idea.svn.commandLine.SvnBindException;
+import org.jetbrains.idea.svn.info.Info;
import org.tmatesoft.svn.core.SVNURL;
-import org.tmatesoft.svn.core.wc.SVNInfo;
import org.tmatesoft.svn.core.wc.SVNRevision;
import java.io.File;
@@ -70,7 +70,7 @@ public class SvnUpdateEnvironment extends AbstractSvnUpdateIntegrateEnvironment
progress.setText(SvnBundle.message("progress.text.updating", root.getAbsolutePath()));
}
- protected long doUpdate(final File root) throws SVNException {
+ protected long doUpdate(final File root) throws SvnBindException {
final long rev;
final SvnConfiguration configuration = SvnConfiguration.getInstance(myVcs.getProject());
@@ -113,7 +113,7 @@ public class SvnUpdateEnvironment extends AbstractSvnUpdateIntegrateEnvironment
@Nullable
private static SVNURL getSourceUrl(final SvnVcs vcs, final File root) {
- final SVNInfo svnInfo = vcs.getInfo(root);
+ final Info svnInfo = vcs.getInfo(root);
return svnInfo != null ? svnInfo.getURL() : null;
}
@@ -140,7 +140,7 @@ public class SvnUpdateEnvironment extends AbstractSvnUpdateIntegrateEnvironment
}
}
}
- catch (SVNException e) {
+ catch (SvnBindException e) {
Messages.showErrorDialog(myVcs.getProject(), e.getMessage(), SvnBundle.message("switch.target.problem.title"));
return false;
}*/
@@ -148,7 +148,7 @@ public class SvnUpdateEnvironment extends AbstractSvnUpdateIntegrateEnvironment
return true;
}
- private SVNRevision correctRevision(@NotNull UpdateRootInfo value) throws SVNException {
+ private SVNRevision correctRevision(@NotNull UpdateRootInfo value) throws SvnBindException {
if (SVNRevision.HEAD.equals(value.getRevision())) {
// find acual revision to update to (a bug if just say head in switch)
value.setRevision(SvnUtil.getHeadRevision(myVcs, value.getUrl()));
@@ -157,9 +157,9 @@ public class SvnUpdateEnvironment extends AbstractSvnUpdateIntegrateEnvironment
}
// false - do not do update
- private boolean checkAncestry(final File sourceFile, final SVNURL targetUrl, final SVNRevision targetRevision) throws SVNException {
- final SVNInfo sourceSvnInfo = myVcs.getInfo(sourceFile);
- final SVNInfo targetSvnInfo = myVcs.getInfo(targetUrl, targetRevision);
+ private boolean checkAncestry(final File sourceFile, final SVNURL targetUrl, final SVNRevision targetRevision) throws SvnBindException {
+ final Info sourceSvnInfo = myVcs.getInfo(sourceFile);
+ final Info targetSvnInfo = myVcs.getInfo(targetUrl, targetRevision);
if (sourceSvnInfo == null || targetSvnInfo == null) {
// cannot check
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/update/UpdateClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/update/UpdateClient.java
index b68829e28940..7155400df04e 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/update/UpdateClient.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/update/UpdateClient.java
@@ -15,11 +15,11 @@
*/
package org.jetbrains.idea.svn.update;
+import org.jetbrains.idea.svn.api.Depth;
+import org.jetbrains.idea.svn.api.ProgressTracker;
import org.jetbrains.idea.svn.api.SvnClient;
-import org.tmatesoft.svn.core.SVNDepth;
-import org.tmatesoft.svn.core.SVNException;
+import org.jetbrains.idea.svn.commandLine.SvnBindException;
import org.tmatesoft.svn.core.SVNURL;
-import org.tmatesoft.svn.core.wc.ISVNEventHandler;
import org.tmatesoft.svn.core.wc.SVNRevision;
import java.io.File;
@@ -32,14 +32,19 @@ import java.io.File;
*/
public interface UpdateClient extends SvnClient {
- long[] doUpdate(File[] paths, SVNRevision revision, SVNDepth depth, boolean allowUnversionedObstructions, boolean depthIsSticky, boolean makeParents) throws SVNException;
-
- long doUpdate(File path, SVNRevision revision, SVNDepth depth, boolean allowUnversionedObstructions, boolean depthIsSticky) throws SVNException;
+ long doUpdate(File path, SVNRevision revision, Depth depth, boolean allowUnversionedObstructions, boolean depthIsSticky)
+ throws SvnBindException;
void setUpdateLocksOnDemand(boolean locksOnDemand);
- long doSwitch(File path, SVNURL url, SVNRevision pegRevision, SVNRevision revision, SVNDepth depth, boolean allowUnversionedObstructions, boolean depthIsSticky) throws SVNException;
+ long doSwitch(File path,
+ SVNURL url,
+ SVNRevision pegRevision,
+ SVNRevision revision,
+ Depth depth,
+ boolean allowUnversionedObstructions,
+ boolean depthIsSticky) throws SvnBindException;
- void setEventHandler(ISVNEventHandler dispatcher);
+ void setEventHandler(ProgressTracker dispatcher);
void setIgnoreExternals(boolean ignoreExternals);
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/update/UpdateEventHandler.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/update/UpdateEventHandler.java
index cea4edbcc7cd..fc552dbd1655 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/update/UpdateEventHandler.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/update/UpdateEventHandler.java
@@ -25,6 +25,10 @@ import org.jetbrains.idea.svn.SvnBundle;
import org.jetbrains.idea.svn.SvnFileUrlMapping;
import org.jetbrains.idea.svn.SvnRevisionNumber;
import org.jetbrains.idea.svn.SvnVcs;
+import org.jetbrains.idea.svn.api.EventAction;
+import org.jetbrains.idea.svn.api.ProgressEvent;
+import org.jetbrains.idea.svn.api.ProgressTracker;
+import org.jetbrains.idea.svn.status.StatusType;
import org.tmatesoft.svn.core.SVNCancelException;
import org.tmatesoft.svn.core.SVNURL;
import org.tmatesoft.svn.core.internal.wc.SVNErrorManager;
@@ -38,7 +42,7 @@ import java.util.Map;
/**
* @author lesya
*/
-public class UpdateEventHandler implements ISVNEventHandler {
+public class UpdateEventHandler implements ProgressTracker {
private ProgressIndicator myProgressIndicator;
private UpdatedFiles myUpdatedFiles;
private int myExternalsCount;
@@ -66,7 +70,7 @@ public class UpdateEventHandler implements ISVNEventHandler {
myUpdatedFiles = updatedFiles;
}
- public void handleEvent(final SVNEvent event, double progress) {
+ public void consume(final ProgressEvent event) {
if (event == null || event.getFile() == null) {
return;
}
@@ -81,7 +85,7 @@ public class UpdateEventHandler implements ISVNEventHandler {
return;
}
- if (event.getAction() == SVNEventAction.TREE_CONFLICT) {
+ if (event.getAction() == EventAction.TREE_CONFLICT) {
myText2 = SvnBundle.message("progress.text2.treeconflicted", displayPath);
updateProgressIndicator();
myUpdatedFiles.registerGroup(createFileGroup(VcsBundle.message("update.group.name.merged.with.tree.conflicts"),
@@ -89,10 +93,10 @@ public class UpdateEventHandler implements ISVNEventHandler {
addFileToGroup(FileGroup.MERGED_WITH_TREE_CONFLICT, event);
}
- if (event.getAction() == SVNEventAction.UPDATE_ADD ||
- event.getAction() == SVNEventAction.ADD) {
+ if (event.getAction() == EventAction.UPDATE_ADD ||
+ event.getAction() == EventAction.ADD) {
myText2 = SvnBundle.message("progress.text2.added", displayPath);
- if (event.getContentsStatus() == SVNStatusType.CONFLICTED || event.getPropertiesStatus() == SVNStatusType.CONFLICTED) {
+ if (event.getContentsStatus() == StatusType.CONFLICTED || event.getPropertiesStatus() == StatusType.CONFLICTED) {
addFileToGroup(FileGroup.MERGED_WITH_CONFLICT_ID, event);
myText2 = SvnBundle.message("progress.text2.conflicted", displayPath);
} else if (myUpdatedFiles.getGroupById(FileGroup.REMOVED_FROM_REPOSITORY_ID).getFiles().contains(path)) {
@@ -106,38 +110,38 @@ public class UpdateEventHandler implements ISVNEventHandler {
addFileToGroup(FileGroup.CREATED_ID, event);
}
}
- else if (event.getAction() == SVNEventAction.UPDATE_NONE) {
+ else if (event.getAction() == EventAction.UPDATE_NONE) {
// skip it
return;
}
- else if (event.getAction() == SVNEventAction.UPDATE_DELETE) {
+ else if (event.getAction() == EventAction.UPDATE_DELETE) {
myText2 = SvnBundle.message("progress.text2.deleted", displayPath);
addFileToGroup(FileGroup.REMOVED_FROM_REPOSITORY_ID, event);
}
- else if (event.getAction() == SVNEventAction.UPDATE_UPDATE) {
+ else if (event.getAction() == EventAction.UPDATE_UPDATE) {
possiblySwitched(event);
- if (event.getContentsStatus() == SVNStatusType.CONFLICTED || event.getPropertiesStatus() == SVNStatusType.CONFLICTED) {
- if (event.getContentsStatus() == SVNStatusType.CONFLICTED) {
+ if (event.getContentsStatus() == StatusType.CONFLICTED || event.getPropertiesStatus() == StatusType.CONFLICTED) {
+ if (event.getContentsStatus() == StatusType.CONFLICTED) {
addFileToGroup(FileGroup.MERGED_WITH_CONFLICT_ID, event);
}
- if (event.getPropertiesStatus() == SVNStatusType.CONFLICTED) {
+ if (event.getPropertiesStatus() == StatusType.CONFLICTED) {
addFileToGroup(FileGroup.MERGED_WITH_PROPERTY_CONFLICT_ID, event);
}
myText2 = SvnBundle.message("progress.text2.conflicted", displayPath);
}
- else if (event.getContentsStatus() == SVNStatusType.MERGED || event.getPropertiesStatus() == SVNStatusType.MERGED) {
+ else if (event.getContentsStatus() == StatusType.MERGED || event.getPropertiesStatus() == StatusType.MERGED) {
myText2 = SvnBundle.message("progres.text2.merged", displayPath);
addFileToGroup(FileGroup.MERGED_ID, event);
}
- else if (event.getContentsStatus() == SVNStatusType.CHANGED || event.getPropertiesStatus() == SVNStatusType.CHANGED) {
+ else if (event.getContentsStatus() == StatusType.CHANGED || event.getPropertiesStatus() == StatusType.CHANGED) {
myText2 = SvnBundle.message("progres.text2.updated", displayPath);
addFileToGroup(FileGroup.UPDATED_ID, event);
}
- else if (event.getContentsStatus() == SVNStatusType.UNCHANGED &&
- (event.getPropertiesStatus() == SVNStatusType.UNCHANGED || event.getPropertiesStatus() == SVNStatusType.UNKNOWN)) {
+ else if (event.getContentsStatus() == StatusType.UNCHANGED &&
+ (event.getPropertiesStatus() == StatusType.UNCHANGED || event.getPropertiesStatus() == StatusType.UNKNOWN)) {
myText2 = SvnBundle.message("progres.text2.updated", displayPath);
- } else if (SVNStatusType.INAPPLICABLE.equals(event.getContentsStatus()) &&
- (event.getPropertiesStatus() == SVNStatusType.UNCHANGED || event.getPropertiesStatus() == SVNStatusType.UNKNOWN)) {
+ } else if (StatusType.INAPPLICABLE.equals(event.getContentsStatus()) &&
+ (event.getPropertiesStatus() == StatusType.UNCHANGED || event.getPropertiesStatus() == StatusType.UNKNOWN)) {
myText2 = SvnBundle.message("progres.text2.updated", displayPath);
}
else {
@@ -145,7 +149,7 @@ public class UpdateEventHandler implements ISVNEventHandler {
addFileToGroup(FileGroup.UNKNOWN_ID, event);
}
}
- else if (event.getAction() == SVNEventAction.UPDATE_EXTERNAL) {
+ else if (event.getAction() == EventAction.UPDATE_EXTERNAL) {
if (mySequentialUpdatesContext != null) {
mySequentialUpdatesContext.registerExternalRootBeingUpdated(event.getFile());
}
@@ -158,11 +162,11 @@ public class UpdateEventHandler implements ISVNEventHandler {
addFileToGroup(AbstractSvnUpdateIntegrateEnvironment.EXTERNAL_ID, event);
myText = SvnBundle.message("progress.text.updating.external.location", event.getFile().getAbsolutePath());
}
- else if (event.getAction() == SVNEventAction.RESTORE) {
+ else if (event.getAction() == EventAction.RESTORE) {
myText2 = SvnBundle.message("progress.text2.restored.file", displayPath);
addFileToGroup(FileGroup.RESTORED_ID, event);
}
- else if (event.getAction() == SVNEventAction.UPDATE_COMPLETED && event.getRevision() >= 0) {
+ else if (event.getAction() == EventAction.UPDATE_COMPLETED && event.getRevision() >= 0) {
possiblySwitched(event);
myExternalsCount--;
myText2 = SvnBundle.message("progres.text2.updated.to.revision", event.getRevision());
@@ -171,7 +175,7 @@ public class UpdateEventHandler implements ISVNEventHandler {
StatusBar.Info.set(SvnBundle.message("status.text.updated.to.revision", event.getRevision()), myVCS.getProject());
}
}
- else if (event.getAction() == SVNEventAction.SKIP) {
+ else if (event.getAction() == EventAction.SKIP) {
myText2 = SvnBundle.message("progress.text2.skipped.file", displayPath);
addFileToGroup(FileGroup.SKIPPED_ID, event);
}
@@ -179,7 +183,7 @@ public class UpdateEventHandler implements ISVNEventHandler {
updateProgressIndicator();
}
- private void possiblySwitched(SVNEvent event) {
+ private void possiblySwitched(ProgressEvent event) {
final File file = event.getFile();
if (file == null) return;
final SVNURL wasUrl = myUrlToCheckForSwitch.get(file);
@@ -189,7 +193,7 @@ public class UpdateEventHandler implements ISVNEventHandler {
}
}
- private boolean itemSwitched(final SVNEvent event) {
+ private boolean itemSwitched(final ProgressEvent event) {
final File file = event.getFile();
final SvnFileUrlMapping urlMapping = myVCS.getSvnFileUrlMapping();
final SVNURL currentUrl = urlMapping.getUrlForFile(file);
@@ -207,11 +211,11 @@ public class UpdateEventHandler implements ISVNEventHandler {
}
}
- protected boolean handleInDescendants(final SVNEvent event) {
+ protected boolean handleInDescendants(final ProgressEvent event) {
return false;
}
- protected void addFileToGroup(final String id, final SVNEvent event) {
+ protected void addFileToGroup(final String id, final ProgressEvent event) {
final FileGroup fileGroup = myUpdatedFiles.getGroupById(id);
final String path = event.getFile().getAbsolutePath();
fileGroup.add(path, SvnVcs.getKey(), new SvnRevisionNumber(SVNRevision.create(event.getRevision())));
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/update/UpdateRootInfo.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/update/UpdateRootInfo.java
index b2a318b39da8..c858f78890f4 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/update/UpdateRootInfo.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/update/UpdateRootInfo.java
@@ -16,9 +16,9 @@
package org.jetbrains.idea.svn.update;
import org.jetbrains.idea.svn.SvnVcs;
+import org.jetbrains.idea.svn.info.Info;
import org.tmatesoft.svn.core.SVNException;
import org.tmatesoft.svn.core.SVNURL;
-import org.tmatesoft.svn.core.wc.SVNInfo;
import org.tmatesoft.svn.core.wc.SVNRevision;
import java.io.File;
@@ -31,7 +31,7 @@ public class UpdateRootInfo {
public UpdateRootInfo(File file, SvnVcs vcs) {
myRevision = SVNRevision.HEAD;
- SVNInfo info = vcs.getInfo(file);
+ Info info = vcs.getInfo(file);
myUrl = info != null && info.getURL() != null ? info.getURL().toString() : "";
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/upgrade/CmdUpgradeClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/upgrade/CmdUpgradeClient.java
index 3a4e6eb6ce92..f27615423904 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/upgrade/CmdUpgradeClient.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/upgrade/CmdUpgradeClient.java
@@ -7,14 +7,10 @@ import com.intellij.util.containers.Convertor;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.WorkingCopyFormat;
-import org.jetbrains.idea.svn.api.BaseSvnClient;
-import org.jetbrains.idea.svn.api.FileStatusResultParser;
+import org.jetbrains.idea.svn.api.*;
import org.jetbrains.idea.svn.commandLine.CommandUtil;
import org.jetbrains.idea.svn.commandLine.LineCommandAdapter;
import org.jetbrains.idea.svn.commandLine.SvnCommandName;
-import org.tmatesoft.svn.core.wc.ISVNEventHandler;
-import org.tmatesoft.svn.core.wc.SVNEvent;
-import org.tmatesoft.svn.core.wc.SVNEventAction;
import org.tmatesoft.svn.core.wc2.SvnTarget;
import java.io.File;
@@ -34,11 +30,11 @@ public class CmdUpgradeClient extends BaseSvnClient implements UpgradeClient {
private static final Pattern CHANGED_PATH = Pattern.compile(STATUS + PATH);
@Override
- public void upgrade(@NotNull File path, @NotNull WorkingCopyFormat format, @Nullable ISVNEventHandler handler) throws VcsException {
+ public void upgrade(@NotNull File path, @NotNull WorkingCopyFormat format, @Nullable ProgressTracker handler) throws VcsException {
validateFormat(format, getSupportedFormats());
// fake event indicating upgrade start
- callHandler(handler, createEvent(path, SVNEventAction.UPDATE_COMPLETED));
+ callHandler(handler, createEvent(path, EventAction.UPDATE_COMPLETED));
List<String> parameters = new ArrayList<String>();
@@ -64,9 +60,9 @@ public class CmdUpgradeClient extends BaseSvnClient implements UpgradeClient {
return result;
}
- private static class UpgradeStatusConvertor implements Convertor<Matcher, SVNEvent> {
+ private static class UpgradeStatusConvertor implements Convertor<Matcher, ProgressEvent> {
- public SVNEvent convert(@NotNull Matcher matcher) {
+ public ProgressEvent convert(@NotNull Matcher matcher) {
String statusMessage = matcher.group(1);
String path = matcher.group(2);
@@ -74,11 +70,11 @@ public class CmdUpgradeClient extends BaseSvnClient implements UpgradeClient {
}
@Nullable
- public static SVNEventAction createAction(@NotNull String code) {
- SVNEventAction result = null;
+ public static EventAction createAction(@NotNull String code) {
+ EventAction result = null;
if ("Upgraded".equals(code)) {
- result = SVNEventAction.UPGRADED_PATH;
+ result = EventAction.UPGRADED_PATH;
}
return result;
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/upgrade/SvnKitUpgradeClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/upgrade/SvnKitUpgradeClient.java
index 66b5f71b4911..f583ad2c8eda 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/upgrade/SvnKitUpgradeClient.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/upgrade/SvnKitUpgradeClient.java
@@ -5,11 +5,11 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.WorkingCopyFormat;
import org.jetbrains.idea.svn.api.BaseSvnClient;
+import org.jetbrains.idea.svn.api.EventAction;
+import org.jetbrains.idea.svn.api.ProgressTracker;
import org.jetbrains.idea.svn.checkout.SvnKitCheckoutClient;
import org.jetbrains.idea.svn.commandLine.SvnBindException;
import org.tmatesoft.svn.core.SVNException;
-import org.tmatesoft.svn.core.wc.ISVNEventHandler;
-import org.tmatesoft.svn.core.wc.SVNEventAction;
import org.tmatesoft.svn.core.wc.SVNWCClient;
import java.io.File;
@@ -21,12 +21,12 @@ import java.util.List;
public class SvnKitUpgradeClient extends BaseSvnClient implements UpgradeClient {
@Override
- public void upgrade(@NotNull File path, @NotNull WorkingCopyFormat format, @Nullable ISVNEventHandler handler) throws VcsException {
+ public void upgrade(@NotNull File path, @NotNull WorkingCopyFormat format, @Nullable ProgressTracker handler) throws VcsException {
validateFormat(format, getSupportedFormats());
SVNWCClient client = myVcs.getSvnKitManager().createWCClient();
- client.setEventHandler(handler);
+ client.setEventHandler(toEventHandler(handler));
try {
cleanupIfNecessary(path, format, client, handler);
upgrade(path, format, client, handler);
@@ -44,11 +44,11 @@ public class SvnKitUpgradeClient extends BaseSvnClient implements UpgradeClient
private static void cleanupIfNecessary(@NotNull File path,
@NotNull WorkingCopyFormat format,
@NotNull SVNWCClient client,
- @Nullable ISVNEventHandler handler) throws SVNException, VcsException {
+ @Nullable ProgressTracker handler) throws SVNException, VcsException {
// cleanup is executed only for SVNKit as it could handle both 1.6 and 1.7 formats
if (WorkingCopyFormat.ONE_DOT_SEVEN.equals(format)) {
// fake event indicating cleanup start
- callHandler(handler, createEvent(path, SVNEventAction.UPDATE_STARTED));
+ callHandler(handler, createEvent(path, EventAction.UPDATE_STARTED));
client.doCleanup(path);
}
}
@@ -56,9 +56,9 @@ public class SvnKitUpgradeClient extends BaseSvnClient implements UpgradeClient
private static void upgrade(@NotNull File path,
@NotNull WorkingCopyFormat format,
@NotNull SVNWCClient client,
- @Nullable ISVNEventHandler handler) throws SVNException, VcsException {
+ @Nullable ProgressTracker handler) throws SVNException, VcsException {
// fake event indicating upgrade start
- callHandler(handler, createEvent(path, SVNEventAction.UPDATE_COMPLETED));
+ callHandler(handler, createEvent(path, EventAction.UPDATE_COMPLETED));
client.doSetWCFormat(path, format.getFormat());
}
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/upgrade/UpgradeClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/upgrade/UpgradeClient.java
index 2d22acf08c45..22d916f158fd 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/upgrade/UpgradeClient.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/upgrade/UpgradeClient.java
@@ -4,8 +4,8 @@ import com.intellij.openapi.vcs.VcsException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.WorkingCopyFormat;
+import org.jetbrains.idea.svn.api.ProgressTracker;
import org.jetbrains.idea.svn.api.SvnClient;
-import org.tmatesoft.svn.core.wc.ISVNEventHandler;
import java.io.File;
import java.util.List;
@@ -15,7 +15,7 @@ import java.util.List;
*/
public interface UpgradeClient extends SvnClient {
- void upgrade(@NotNull File path, @NotNull WorkingCopyFormat format, @Nullable ISVNEventHandler handler) throws VcsException;
+ void upgrade(@NotNull File path, @NotNull WorkingCopyFormat format, @Nullable ProgressTracker handler) throws VcsException;
List<WorkingCopyFormat> getSupportedFormats() throws VcsException;
}
diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/ConflictCreator.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/ConflictCreator.java
index 635484fd2112..cca76e17f234 100644
--- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/ConflictCreator.java
+++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/ConflictCreator.java
@@ -26,8 +26,8 @@ import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.Processor;
import com.intellij.util.containers.Convertor;
import junit.framework.Assert;
-import org.tmatesoft.svn.core.wc.SVNInfo;
-import org.tmatesoft.svn.core.wc.SVNStatusType;
+import org.jetbrains.idea.svn.info.Info;
+import org.jetbrains.idea.svn.status.StatusType;
import java.io.File;
import java.io.IOException;
@@ -100,7 +100,7 @@ public class ConflictCreator {
String subPath = "";
for (String part : parts) {
final String path = subPath + part;
- SVNInfo info = vcs.getInfo(new File(myTheirsDir.getPath(), path));
+ Info info = vcs.getInfo(new File(myTheirsDir.getPath(), path));
if (info == null || info.getURL() == null) {
myClientRunner.add(myTheirsDir, path);
}
@@ -161,15 +161,15 @@ public class ConflictCreator {
final File target = new File(root.getPath(), fileData.myRelativePath);
// we dont apply properties changes fow now
- if (SVNStatusType.STATUS_MISSING.equals(fileData.myNodeStatus)) {
+ if (StatusType.STATUS_MISSING.equals(fileData.myNodeStatus)) {
// delete existing only from fs
FileUtil.delete(target);
return;
- } else if (SVNStatusType.STATUS_UNVERSIONED.equals(fileData.myNodeStatus)) {
+ } else if (StatusType.STATUS_UNVERSIONED.equals(fileData.myNodeStatus)) {
// create new unversioned
createFile(root, fileData, target);
return;
- } else if (SVNStatusType.STATUS_ADDED.equals(fileData.myNodeStatus)) {
+ } else if (StatusType.STATUS_ADDED.equals(fileData.myNodeStatus)) {
if (fileData.myCopyFrom != null) {
myClientRunner.copy(root, fileData.myCopyFrom, fileData.myRelativePath);
return;
@@ -177,11 +177,11 @@ public class ConflictCreator {
createFile(root, fileData, target);
myClientRunner.add(root, fileData.myRelativePath);
return;
- } else if (SVNStatusType.STATUS_DELETED.equals(fileData.myNodeStatus)) {
+ } else if (StatusType.STATUS_DELETED.equals(fileData.myNodeStatus)) {
myClientRunner.delete(root, fileData.myRelativePath);
return;
- } else if (SVNStatusType.STATUS_NORMAL.equals(fileData.myNodeStatus)) {
- if (SVNStatusType.STATUS_MODIFIED.equals(fileData.myContentsStatus)) {
+ } else if (StatusType.STATUS_NORMAL.equals(fileData.myNodeStatus)) {
+ if (StatusType.STATUS_MODIFIED.equals(fileData.myContentsStatus)) {
createFile(root, fileData, target);
return;
}
diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnCachingRevisionsTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnCachingRevisionsTest.java
index ee9e2cd46496..d3a9bc552224 100644
--- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnCachingRevisionsTest.java
+++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnCachingRevisionsTest.java
@@ -8,7 +8,6 @@ import com.intellij.openapi.vcs.changes.committed.ChangesBunch;
import com.intellij.openapi.vcs.versionBrowser.CommittedChangeList;
import com.intellij.testFramework.fixtures.CodeInsightFixtureTestCase;
import org.jetbrains.idea.svn.history.*;
-import org.tmatesoft.svn.core.SVNLogEntry;
import org.tmatesoft.svn.core.SVNURL;
import org.tmatesoft.svn.core.wc.SVNRevision;
@@ -36,8 +35,10 @@ public class SvnCachingRevisionsTest extends CodeInsightFixtureTestCase {
}
private SvnChangeList createList(final long revision) {
- return new SvnChangeList(null, myLocation,
- new SVNLogEntry(Collections.emptyMap(), revision, AUTHOR, new Date(System.currentTimeMillis()), ""), ROOT.toDecodedString());
+ LogEntry entry =
+ new LogEntry.Builder().setRevision(revision).setAuthor(AUTHOR).setDate(new Date(System.currentTimeMillis())).setMessage("").build();
+
+ return new SvnChangeList(null, myLocation, entry, ROOT.toDecodedString());
}
private class MockSvnLogLoader implements SvnLogLoader {
diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnMergeInfoTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnMergeInfoTest.java
index 1ed14dce6704..b6d83ad9ed2d 100644
--- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnMergeInfoTest.java
+++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnMergeInfoTest.java
@@ -24,20 +24,20 @@ import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.ArrayUtil;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.idea.svn.api.Depth;
import org.jetbrains.idea.svn.dialogs.MergeContext;
import org.jetbrains.idea.svn.dialogs.WCInfo;
import org.jetbrains.idea.svn.history.SvnChangeList;
import org.jetbrains.idea.svn.history.SvnRepositoryLocation;
+import org.jetbrains.idea.svn.info.Info;
import org.jetbrains.idea.svn.mergeinfo.BranchInfo;
import org.jetbrains.idea.svn.mergeinfo.OneShotMergeInfoHelper;
import org.jetbrains.idea.svn.mergeinfo.SvnMergeInfoCache;
import org.junit.Assert;
import org.junit.Test;
-import org.tmatesoft.svn.core.SVNDepth;
import org.tmatesoft.svn.core.SVNException;
import org.tmatesoft.svn.core.SVNURL;
import org.tmatesoft.svn.core.internal.util.SVNPathUtil;
-import org.tmatesoft.svn.core.wc.SVNInfo;
import org.tmatesoft.svn.core.wc.SVNPropertyData;
import org.tmatesoft.svn.core.wc.SVNRevision;
import org.tmatesoft.svn.core.wc.SVNWCClient;
@@ -86,7 +86,7 @@ public class SvnMergeInfoTest extends Svn17TestCase {
VirtualFile vcsRoot = LocalFileSystem.getInstance().findFileByIoFile(myBranchVcsRoot);
Node node = new Node(vcsRoot, SVNURL.parseURIEncoded(myBranchUrl), SVNURL.parseURIEncoded(myRepoUrl));
RootUrlInfo root = new RootUrlInfo(node, WorkingCopyFormat.ONE_DOT_SIX, vcsRoot, null);
- myWCInfo = new WCInfo(root, true, SVNDepth.INFINITY);
+ myWCInfo = new WCInfo(root, true, Depth.INFINITY);
myMergeContext = new MergeContext(SvnVcs.getInstance(myProject), myTrunkUrl, myWCInfo, SVNPathUtil.tail(myTrunkUrl), vcsRoot);
myOneShotMergeInfoHelper = new OneShotMergeInfoHelper(myMergeContext);
@@ -255,7 +255,7 @@ public class SvnMergeInfoTest extends Svn17TestCase {
assertMergeInfo(myBranchVcsRoot, "/trunk:3");
- final SVNInfo f1info = myVcs.getInfo(new File(myBranchVcsRoot, "folder/f1.txt"));
+ final Info f1info = myVcs.getInfo(new File(myBranchVcsRoot, "folder/f1.txt"));
assert f1info.getRevision().getNumber() == 2;
final List<SvnChangeList> changeListList = getTrunkChangeLists();
diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnNativeClientAuthTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnNativeClientAuthTest.java
index 99f7b0cda790..a0dfa979ea74 100644
--- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnNativeClientAuthTest.java
+++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnNativeClientAuthTest.java
@@ -30,6 +30,7 @@ import com.intellij.util.Processor;
import com.intellij.util.containers.Convertor;
import junit.framework.Assert;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.idea.svn.api.Depth;
import org.jetbrains.idea.svn.auth.SvnAuthenticationManager;
import org.jetbrains.idea.svn.auth.SvnAuthenticationNotifier;
import org.jetbrains.idea.svn.checkout.SvnCheckoutProvider;
@@ -544,7 +545,7 @@ public class SvnNativeClientAuthTest extends Svn17TestCase {
root.deleteOnExit();
Assert.assertTrue(root.exists());
SvnCheckoutProvider
- .checkout(myProject, root, url, SVNRevision.HEAD, SVNDepth.INFINITY, false, new CheckoutProvider.Listener() {
+ .checkout(myProject, root, url, SVNRevision.HEAD, Depth.INFINITY, false, new CheckoutProvider.Listener() {
@Override
public void directoryCheckedOut(File directory, VcsKey vcs) {
}
diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnParseCommandLineParseTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnParseCommandLineParseTest.java
index ec78b9fd5f55..6e0ee960b64a 100644
--- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnParseCommandLineParseTest.java
+++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnParseCommandLineParseTest.java
@@ -24,19 +24,15 @@ import com.intellij.util.containers.Convertor;
import com.intellij.util.containers.MultiMap;
import junit.framework.Assert;
import junit.framework.TestCase;
-import org.jetbrains.idea.svn.status.CmdStatusClient;
+import org.jetbrains.idea.svn.api.Depth;
+import org.jetbrains.idea.svn.api.NodeKind;
+import org.jetbrains.idea.svn.status.Status;
+import org.jetbrains.idea.svn.info.Info;
+import org.jetbrains.idea.svn.status.*;
import org.jetbrains.idea.svn.info.SvnInfoHandler;
-import org.jetbrains.idea.svn.status.SvnStatusHandler;
-import org.jetbrains.idea.svn.info.IdeaSVNInfo;
-import org.jetbrains.idea.svn.status.PortableStatus;
-import org.tmatesoft.svn.core.SVNDepth;
import org.tmatesoft.svn.core.SVNException;
-import org.tmatesoft.svn.core.SVNNodeKind;
import org.tmatesoft.svn.core.SVNURL;
-import org.tmatesoft.svn.core.wc.ISVNStatusHandler;
-import org.tmatesoft.svn.core.wc.SVNInfo;
import org.tmatesoft.svn.core.wc.SVNRevision;
-import org.tmatesoft.svn.core.wc.SVNStatus;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
@@ -84,10 +80,10 @@ public class SvnParseCommandLineParseTest extends TestCase {
"</entry>\n" +
"</info>";
- final SVNInfo[] info = new SVNInfo[1];
- final SvnInfoHandler handler = new SvnInfoHandler(new File("C:/base/"), new Consumer<SVNInfo>() {
+ final Info[] info = new Info[1];
+ final SvnInfoHandler handler = new SvnInfoHandler(new File("C:/base/"), new Consumer<Info>() {
@Override
- public void consume(SVNInfo info1) {
+ public void consume(Info info1) {
info[0] = info1;
}
});
@@ -574,9 +570,9 @@ public class SvnParseCommandLineParseTest extends TestCase {
@Override
public void switchChangeList(String newList) {
}
- }, new File(basePath), new Convertor<File, SVNInfo>() {
+ }, new File(basePath), new Convertor<File, Info>() {
@Override
- public SVNInfo convert(File o) {
+ public Info convert(File o) {
try {
o.getCanonicalFile();
}
@@ -616,9 +612,9 @@ public class SvnParseCommandLineParseTest extends TestCase {
return StringUtil.replace(s, "C:/", LINUX_ROOT);
}
- private IdeaSVNInfo createStubInfo(final String basePath, final String baseUrl) throws SVNException {
- return new IdeaSVNInfo(basePath, SVNURL.parseURIEncoded(baseUrl), SVNRevision.HEAD, SVNNodeKind.FILE, "",
- SVNURL.parseURIEncoded("http://a.b.c"), 1, new Date(), "me", null, SVNDepth.EMPTY, 1);
+ private Info createStubInfo(final String basePath, final String baseUrl) throws SVNException {
+ return new Info(basePath, SVNURL.parseURIEncoded(baseUrl), SVNRevision.HEAD, NodeKind.FILE, "",
+ SVNURL.parseURIEncoded("http://a.b.c"), 1, new Date(), "me", null, Depth.EMPTY);
}
public void testStatusInExternalMove() throws Exception {
@@ -671,9 +667,9 @@ public class SvnParseCommandLineParseTest extends TestCase {
final String basePath = "C:\\TestProjects\\sortedProjects\\Subversion\\local2\\sep12main\\main";
final SvnStatusHandler[] handler = new SvnStatusHandler[1];
final File baseFile = new File(basePath);
- final SvnStatusHandler.ExternalDataCallback callback = CmdStatusClient.createStatusCallback(new ISVNStatusHandler() {
+ final SvnStatusHandler.ExternalDataCallback callback = CmdStatusClient.createStatusCallback(new StatusConsumer() {
@Override
- public void handleStatus(SVNStatus status) throws SVNException {
+ public void consume(Status status) throws SVNException {
System.out.println(status.getURL());
if (new File(
"C:\\TestProjects\\sortedProjects\\Subversion\\local2\\sep12main\\main\\slave\\src\\com\\slave\\MacMessagesParser.java")
@@ -686,9 +682,9 @@ public class SvnParseCommandLineParseTest extends TestCase {
}
}
}, baseFile, createStubInfo(basePath, "http://mainurl/"), handler);
- handler[0] = new SvnStatusHandler(callback, baseFile, new Convertor<File, SVNInfo>() {
+ handler[0] = new SvnStatusHandler(callback, baseFile, new Convertor<File, Info>() {
@Override
- public SVNInfo convert(File o) {
+ public Info convert(File o) {
try {
if (new File("C:\\TestProjects\\sortedProjects\\Subversion\\local2\\sep12main\\main\\slave").equals(o)) {
return createStubInfo(o.getPath(), "http://external");
@@ -756,9 +752,9 @@ public class SvnParseCommandLineParseTest extends TestCase {
@Override
public void switchChangeList(String newList) {
}
- }, new File(basePath), new Convertor<File, SVNInfo>() {
+ }, new File(basePath), new Convertor<File, Info>() {
@Override
- public SVNInfo convert(File o) {
+ public Info convert(File o) {
try {
o.getCanonicalFile();
}
@@ -846,9 +842,9 @@ public class SvnParseCommandLineParseTest extends TestCase {
public void switchChangeList(String newList) {
clName[0] = newList;
}
- }, new File(basePath), new Convertor<File, SVNInfo>() {
+ }, new File(basePath), new Convertor<File, Info>() {
@Override
- public SVNInfo convert(File o) {
+ public Info convert(File o) {
try {
o.getCanonicalFile();
}
diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnProtocolsTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnProtocolsTest.java
index 358f3722d7b5..af17c9aa2190 100644
--- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnProtocolsTest.java
+++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnProtocolsTest.java
@@ -35,6 +35,7 @@ import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.Processor;
import com.intellij.util.containers.Convertor;
import junit.framework.Assert;
+import org.jetbrains.idea.svn.api.Depth;
import org.jetbrains.idea.svn.auth.SvnAuthenticationManager;
import org.jetbrains.idea.svn.checkout.SvnCheckoutProvider;
import org.junit.Before;
@@ -222,7 +223,7 @@ public class SvnProtocolsTest extends Svn17TestCase {
root.deleteOnExit();
Assert.assertTrue(root.exists());
SvnCheckoutProvider
- .checkout(myProject, root, url, SVNRevision.HEAD, SVNDepth.INFINITY, false, new CheckoutProvider.Listener() {
+ .checkout(myProject, root, url, SVNRevision.HEAD, Depth.INFINITY, false, new CheckoutProvider.Listener() {
@Override
public void directoryCheckedOut(File directory, VcsKey vcs) {
}
diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnResolveTreeAcceptVariantsTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnResolveTreeAcceptVariantsTest.java
index 071da76aee78..03d3875b37b2 100644
--- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnResolveTreeAcceptVariantsTest.java
+++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnResolveTreeAcceptVariantsTest.java
@@ -26,12 +26,12 @@ import com.intellij.openapi.vfs.VfsUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.Processor;
import junit.framework.Assert;
+import org.jetbrains.idea.svn.info.Info;
+import org.jetbrains.idea.svn.status.Status;
+import org.jetbrains.idea.svn.status.StatusType;
import org.jetbrains.idea.svn.treeConflict.SvnTreeConflictResolver;
import org.junit.Before;
import org.junit.Test;
-import org.tmatesoft.svn.core.wc.SVNInfo;
-import org.tmatesoft.svn.core.wc.SVNStatus;
-import org.tmatesoft.svn.core.wc.SVNStatusType;
import java.io.File;
import java.io.IOException;
@@ -162,43 +162,43 @@ public class SvnResolveTreeAcceptVariantsTest extends Svn17TestCase {
}
private void checkStatusesAfterMineFullResolve(TreeConflictData.Data data, File conflictIoFile) {
- SVNStatus conflStatus = SvnUtil.getStatus(myVcs, conflictIoFile);
+ Status conflStatus = SvnUtil.getStatus(myVcs, conflictIoFile);
Assert.assertTrue(createTestFailedComment(data, conflictIoFile.getPath()) + " tree conflict resolved",
conflStatus.getTreeConflict() == null);
Collection<TreeConflictData.FileData> leftFiles = data.getLeftFiles();
for (TreeConflictData.FileData file : leftFiles) {
File exFile = new File(myWorkingCopyDir.getPath(), file.myRelativePath);
- final SVNStatus status = SvnUtil.getStatus(myVcs, exFile);
+ final Status status = SvnUtil.getStatus(myVcs, exFile);
boolean theirsExists = new File(myTheirs.getPath(), file.myRelativePath).exists();
- if (SVNStatusType.STATUS_UNVERSIONED.equals(file.myNodeStatus)) {
+ if (StatusType.STATUS_UNVERSIONED.equals(file.myNodeStatus)) {
Assert.assertTrue(createTestFailedComment(data, exFile.getPath()) + " (file exists)", exFile.exists());
if (theirsExists) {
// should be deleted
- Assert.assertTrue(createTestFailedComment(data, exFile.getPath()) + " (unversioned)", status == null || SVNStatusType.STATUS_DELETED.equals(status.getNodeStatus()));
+ Assert.assertTrue(createTestFailedComment(data, exFile.getPath()) + " (unversioned)", status == null || StatusType.STATUS_DELETED.equals(status.getNodeStatus()));
} else {
// unversioned
- Assert.assertTrue(createTestFailedComment(data, exFile.getPath()) + " (unversioned)", status == null || SVNStatusType.STATUS_UNVERSIONED.equals(status.getNodeStatus()));
+ Assert.assertTrue(createTestFailedComment(data, exFile.getPath()) + " (unversioned)", status == null || StatusType.STATUS_UNVERSIONED.equals(status.getNodeStatus()));
}
- } else if (SVNStatusType.STATUS_DELETED.equals(file.myNodeStatus)) {
+ } else if (StatusType.STATUS_DELETED.equals(file.myNodeStatus)) {
Assert.assertTrue(createTestFailedComment(data, exFile.getPath()) + " (deleted status)", status != null && file.myNodeStatus.equals(status.getNodeStatus()));
- } else if (SVNStatusType.STATUS_ADDED.equals(file.myNodeStatus)) {
+ } else if (StatusType.STATUS_ADDED.equals(file.myNodeStatus)) {
Assert.assertTrue(createTestFailedComment(data, exFile.getPath()) + " (file exists)", exFile.exists());
if (theirsExists) {
- Assert.assertTrue(createTestFailedComment(data, exFile.getPath()) + " (added status)", status != null && SVNStatusType.STATUS_REPLACED.equals(status.getNodeStatus()));
+ Assert.assertTrue(createTestFailedComment(data, exFile.getPath()) + " (added status)", status != null && StatusType.STATUS_REPLACED.equals(status.getNodeStatus()));
} else {
- Assert.assertTrue(createTestFailedComment(data, exFile.getPath()) + " (added status)", status != null && SVNStatusType.STATUS_ADDED.equals(status.getNodeStatus()));
+ Assert.assertTrue(createTestFailedComment(data, exFile.getPath()) + " (added status)", status != null && StatusType.STATUS_ADDED.equals(status.getNodeStatus()));
}
} else {
- if (SVNStatusType.STATUS_ADDED.equals(status.getNodeStatus())) {
+ if (StatusType.STATUS_ADDED.equals(status.getNodeStatus())) {
// in theirs -> deleted
Assert.assertFalse(createTestFailedComment(data, file.myRelativePath) + " check deleted in theirs", theirsExists);
} else {
if (theirsExists) {
- Assert.assertTrue(createTestFailedComment(data, exFile.getPath()) + " (normal node status)", status != null && SVNStatusType.STATUS_REPLACED.equals(status.getNodeStatus()));
+ Assert.assertTrue(createTestFailedComment(data, exFile.getPath()) + " (normal node status)", status != null && StatusType.STATUS_REPLACED.equals(status.getNodeStatus()));
} else {
Assert.assertTrue(createTestFailedComment(data, exFile.getPath()) + " (normal node status)", status != null &&
- (SVNStatusType.STATUS_NORMAL.equals(status.getNodeStatus()) || SVNStatusType.STATUS_MODIFIED.equals(status.getNodeStatus())));
+ (StatusType.STATUS_NORMAL.equals(status.getNodeStatus()) || StatusType.STATUS_MODIFIED.equals(status.getNodeStatus())));
}
}
Assert.assertTrue(createTestFailedComment(data, exFile.getPath()) + " (modified text status)", status != null && file.myContentsStatus.equals(status.getContentsStatus()));
@@ -271,8 +271,8 @@ public class SvnResolveTreeAcceptVariantsTest extends Svn17TestCase {
exists);
}
final File theirsFile = new File(file.getPath());
- SVNInfo theirsInfo = myVcs.getInfo(theirsFile);
- SVNInfo thisInfo = myVcs.getInfo(workingFile);
+ Info theirsInfo = myVcs.getInfo(theirsFile);
+ Info thisInfo = myVcs.getInfo(workingFile);
if (theirsInfo != null) {
Assert.assertEquals("Check failed for test: " + getTestName(data) + " and file: " + relative + " in: " + myWorkingCopyDir.getPath() +
", theirs: " + theirsInfo.getRevision().getNumber() + ", mine: " + thisInfo.getRevision().getNumber(),
diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnTreeConflictDataTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnTreeConflictDataTest.java
index a38d851fbe8e..00172495348c 100644
--- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnTreeConflictDataTest.java
+++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnTreeConflictDataTest.java
@@ -23,18 +23,15 @@ import com.intellij.openapi.vcs.changes.VcsDirtyScopeManager;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VirtualFile;
import junit.framework.Assert;
+import org.jetbrains.idea.svn.conflict.ConflictAction;
+import org.jetbrains.idea.svn.conflict.ConflictOperation;
+import org.jetbrains.idea.svn.conflict.ConflictVersion;
+import org.jetbrains.idea.svn.conflict.TreeConflictDescription;
import org.junit.Before;
import org.junit.Test;
-import org.tmatesoft.svn.core.SVNNodeKind;
-import org.tmatesoft.svn.core.internal.wc.SVNConflictVersion;
-import org.tmatesoft.svn.core.wc.SVNConflictAction;
-import org.tmatesoft.svn.core.wc.SVNOperation;
-import org.tmatesoft.svn.core.wc.SVNTreeConflictDescription;
import java.io.File;
-import static com.intellij.util.TimeoutUtil.sleep;
-
/**
* @author Irina.Chernushina
* @since 2.05.2012
@@ -71,20 +68,20 @@ public class SvnTreeConflictDataTest extends Svn17TestCase {
Assert.assertNotNull(vf);
final Change change = changeListManager.getChange(vf);
Assert.assertTrue(change instanceof ConflictedSvnChange);
- SVNTreeConflictDescription beforeDescription = ((ConflictedSvnChange)change).getBeforeDescription();
+ TreeConflictDescription beforeDescription = ((ConflictedSvnChange)change).getBeforeDescription();
Assert.assertNotNull(beforeDescription);
- final SVNTreeConflictDescription afterDescription = ((ConflictedSvnChange)change).getAfterDescription();
+ final TreeConflictDescription afterDescription = ((ConflictedSvnChange)change).getAfterDescription();
Assert.assertNull(afterDescription);
- Assert.assertEquals(SVNOperation.UPDATE, beforeDescription.getOperation());
- Assert.assertEquals(SVNConflictAction.ADD, beforeDescription.getConflictAction());
+ Assert.assertEquals(ConflictOperation.UPDATE, beforeDescription.getOperation());
+ Assert.assertEquals(ConflictAction.ADD, beforeDescription.getConflictAction());
Assert.assertTrue(beforeDescription.isTreeConflict());
Assert.assertNull(beforeDescription.getSourceLeftVersion());
- final SVNConflictVersion version = beforeDescription.getSourceRightVersion();
+ final ConflictVersion version = beforeDescription.getSourceRightVersion();
Assert.assertNotNull(version);
- Assert.assertEquals(SVNNodeKind.FILE, version.getKind());
+ Assert.assertTrue(version.isFile());
}
@Test
@@ -99,22 +96,22 @@ public class SvnTreeConflictDataTest extends Svn17TestCase {
Assert.assertNotNull(vf);
final Change change = changeListManager.getChange(vf);
Assert.assertTrue(change instanceof ConflictedSvnChange);
- SVNTreeConflictDescription beforeDescription = ((ConflictedSvnChange)change).getBeforeDescription();
+ TreeConflictDescription beforeDescription = ((ConflictedSvnChange)change).getBeforeDescription();
Assert.assertNotNull(beforeDescription);
- final SVNTreeConflictDescription afterDescription = ((ConflictedSvnChange)change).getAfterDescription();
+ final TreeConflictDescription afterDescription = ((ConflictedSvnChange)change).getAfterDescription();
Assert.assertNull(afterDescription);
- Assert.assertEquals(SVNOperation.UPDATE, beforeDescription.getOperation());
- Assert.assertEquals(SVNConflictAction.DELETE, beforeDescription.getConflictAction());
+ Assert.assertEquals(ConflictOperation.UPDATE, beforeDescription.getOperation());
+ Assert.assertEquals(ConflictAction.DELETE, beforeDescription.getConflictAction());
Assert.assertTrue(beforeDescription.isTreeConflict());
- SVNConflictVersion leftVersion = beforeDescription.getSourceLeftVersion();
+ ConflictVersion leftVersion = beforeDescription.getSourceLeftVersion();
Assert.assertNotNull(leftVersion);
- Assert.assertEquals(SVNNodeKind.FILE, leftVersion.getKind());
+ Assert.assertTrue(leftVersion.isFile());
- final SVNConflictVersion version = beforeDescription.getSourceRightVersion();
+ final ConflictVersion version = beforeDescription.getSourceRightVersion();
Assert.assertNotNull(version);
- Assert.assertEquals(SVNNodeKind.NONE, version.getKind());
+ Assert.assertTrue(version.isNone());
}
private String createConflict(final TreeConflictData.Data data) throws Exception {
@@ -138,22 +135,22 @@ public class SvnTreeConflictDataTest extends Svn17TestCase {
Assert.assertNotNull(vf);
final Change change = changeListManager.getChange(vf);
Assert.assertTrue(change instanceof ConflictedSvnChange);
- SVNTreeConflictDescription beforeDescription = ((ConflictedSvnChange)change).getBeforeDescription();
+ TreeConflictDescription beforeDescription = ((ConflictedSvnChange)change).getBeforeDescription();
Assert.assertNotNull(beforeDescription);
- final SVNTreeConflictDescription afterDescription = ((ConflictedSvnChange)change).getAfterDescription();
+ final TreeConflictDescription afterDescription = ((ConflictedSvnChange)change).getAfterDescription();
Assert.assertNull(afterDescription);
- Assert.assertEquals(SVNOperation.UPDATE, beforeDescription.getOperation());
- Assert.assertEquals(SVNConflictAction.EDIT, beforeDescription.getConflictAction());
+ Assert.assertEquals(ConflictOperation.UPDATE, beforeDescription.getOperation());
+ Assert.assertEquals(ConflictAction.EDIT, beforeDescription.getConflictAction());
Assert.assertTrue(beforeDescription.isTreeConflict());
- SVNConflictVersion leftVersion = beforeDescription.getSourceLeftVersion();
+ ConflictVersion leftVersion = beforeDescription.getSourceLeftVersion();
Assert.assertNotNull(leftVersion);
- Assert.assertEquals(SVNNodeKind.FILE, leftVersion.getKind());
+ Assert.assertTrue(leftVersion.isFile());
- final SVNConflictVersion version = beforeDescription.getSourceRightVersion();
+ final ConflictVersion version = beforeDescription.getSourceRightVersion();
Assert.assertNotNull(version);
- Assert.assertEquals(SVNNodeKind.FILE, version.getKind());
+ Assert.assertTrue(version.isFile());
}
@Test
@@ -168,22 +165,22 @@ public class SvnTreeConflictDataTest extends Svn17TestCase {
Assert.assertNotNull(vf);
final Change change = changeListManager.getChange(vf);
Assert.assertTrue(change instanceof ConflictedSvnChange);
- SVNTreeConflictDescription beforeDescription = ((ConflictedSvnChange)change).getBeforeDescription();
+ TreeConflictDescription beforeDescription = ((ConflictedSvnChange)change).getBeforeDescription();
Assert.assertNotNull(beforeDescription);
- final SVNTreeConflictDescription afterDescription = ((ConflictedSvnChange)change).getAfterDescription();
+ final TreeConflictDescription afterDescription = ((ConflictedSvnChange)change).getAfterDescription();
Assert.assertNull(afterDescription);
- Assert.assertEquals(SVNOperation.UPDATE, beforeDescription.getOperation());
- Assert.assertEquals(SVNConflictAction.DELETE, beforeDescription.getConflictAction());
+ Assert.assertEquals(ConflictOperation.UPDATE, beforeDescription.getOperation());
+ Assert.assertEquals(ConflictAction.DELETE, beforeDescription.getConflictAction());
Assert.assertTrue(beforeDescription.isTreeConflict());
- SVNConflictVersion leftVersion = beforeDescription.getSourceLeftVersion();
+ ConflictVersion leftVersion = beforeDescription.getSourceLeftVersion();
Assert.assertNotNull(leftVersion);
- Assert.assertEquals(SVNNodeKind.FILE, leftVersion.getKind());
+ Assert.assertTrue(leftVersion.isFile());
- final SVNConflictVersion version = beforeDescription.getSourceRightVersion();
+ final ConflictVersion version = beforeDescription.getSourceRightVersion();
Assert.assertNotNull(version);
- Assert.assertEquals(SVNNodeKind.NONE, version.getKind());
+ Assert.assertTrue(version.isNone());
}
@Test
@@ -198,21 +195,22 @@ public class SvnTreeConflictDataTest extends Svn17TestCase {
Assert.assertNotNull(vf);
final Change change = changeListManager.getChange(vf);
Assert.assertTrue(change instanceof ConflictedSvnChange);
- SVNTreeConflictDescription beforeDescription = ((ConflictedSvnChange)change).getBeforeDescription();
+ TreeConflictDescription beforeDescription = ((ConflictedSvnChange)change).getBeforeDescription();
Assert.assertNotNull(beforeDescription);
- final SVNTreeConflictDescription afterDescription = ((ConflictedSvnChange)change).getAfterDescription();
+ final TreeConflictDescription afterDescription = ((ConflictedSvnChange)change).getAfterDescription();
Assert.assertNull(afterDescription);
- Assert.assertEquals(SVNOperation.UPDATE, beforeDescription.getOperation());
- Assert.assertEquals(SVNConflictAction.ADD, beforeDescription.getConflictAction());
+ Assert.assertEquals(ConflictOperation.UPDATE, beforeDescription.getOperation());
+ Assert.assertEquals(ConflictAction.ADD, beforeDescription.getConflictAction());
Assert.assertTrue(beforeDescription.isTreeConflict());
- SVNConflictVersion leftVersion = beforeDescription.getSourceLeftVersion();
+ ConflictVersion leftVersion = beforeDescription.getSourceLeftVersion();
Assert.assertNull(leftVersion);
- final SVNConflictVersion version = beforeDescription.getSourceRightVersion();
+ final ConflictVersion version = beforeDescription.getSourceRightVersion();
Assert.assertNotNull(version);
- Assert.assertEquals(SVNNodeKind.FILE, version.getKind());
+ Assert.assertTrue(version.isFile());
+
}
@Test
@@ -229,22 +227,23 @@ public class SvnTreeConflictDataTest extends Svn17TestCase {
Assert.assertNotNull(vf);
final Change change = changeListManager.getChange(vf);
Assert.assertTrue(change instanceof ConflictedSvnChange);
- SVNTreeConflictDescription beforeDescription = ((ConflictedSvnChange)change).getBeforeDescription();
+ TreeConflictDescription beforeDescription = ((ConflictedSvnChange)change).getBeforeDescription();
Assert.assertNotNull(beforeDescription);
- final SVNTreeConflictDescription afterDescription = ((ConflictedSvnChange)change).getAfterDescription();
+ final TreeConflictDescription afterDescription = ((ConflictedSvnChange)change).getAfterDescription();
Assert.assertNull(afterDescription);
- Assert.assertEquals(SVNOperation.UPDATE, beforeDescription.getOperation());
- Assert.assertEquals(SVNConflictAction.EDIT, beforeDescription.getConflictAction());
+ Assert.assertEquals(ConflictOperation.UPDATE, beforeDescription.getOperation());
+ Assert.assertEquals(ConflictAction.EDIT, beforeDescription.getConflictAction());
Assert.assertTrue(beforeDescription.isTreeConflict());
- SVNConflictVersion leftVersion = beforeDescription.getSourceLeftVersion();
+ ConflictVersion leftVersion = beforeDescription.getSourceLeftVersion();
Assert.assertNotNull(leftVersion);
- Assert.assertEquals(SVNNodeKind.FILE, leftVersion.getKind());
+ Assert.assertTrue(leftVersion.isFile());
- final SVNConflictVersion version = beforeDescription.getSourceRightVersion();
+ final ConflictVersion version = beforeDescription.getSourceRightVersion();
Assert.assertNotNull(version);
- Assert.assertEquals(SVNNodeKind.FILE, version.getKind());
+ Assert.assertTrue(version.isFile());
+
}
@Test
@@ -261,22 +260,23 @@ public class SvnTreeConflictDataTest extends Svn17TestCase {
Assert.assertNotNull(vf);
final Change change = changeListManager.getChange(vf);
Assert.assertTrue(change instanceof ConflictedSvnChange);
- SVNTreeConflictDescription beforeDescription = ((ConflictedSvnChange)change).getBeforeDescription();
+ TreeConflictDescription beforeDescription = ((ConflictedSvnChange)change).getBeforeDescription();
Assert.assertNotNull(beforeDescription);
- final SVNTreeConflictDescription afterDescription = ((ConflictedSvnChange)change).getAfterDescription();
+ final TreeConflictDescription afterDescription = ((ConflictedSvnChange)change).getAfterDescription();
Assert.assertNull(afterDescription);
- Assert.assertEquals(SVNOperation.UPDATE, beforeDescription.getOperation());
- Assert.assertEquals(SVNConflictAction.ADD, beforeDescription.getConflictAction());
+ Assert.assertEquals(ConflictOperation.UPDATE, beforeDescription.getOperation());
+ Assert.assertEquals(ConflictAction.ADD, beforeDescription.getConflictAction());
Assert.assertTrue(beforeDescription.isTreeConflict());
- SVNConflictVersion leftVersion = beforeDescription.getSourceLeftVersion();
+ ConflictVersion leftVersion = beforeDescription.getSourceLeftVersion();
Assert.assertNull(leftVersion);
- //Assert.assertEquals(SVNNodeKind.FILE, leftVersion.getKind());
+ //Assert.assertEquals(NodeKind.FILE, leftVersion.getKind());
- final SVNConflictVersion version = beforeDescription.getSourceRightVersion();
+ final ConflictVersion version = beforeDescription.getSourceRightVersion();
Assert.assertNotNull(version);
- Assert.assertEquals(SVNNodeKind.FILE, version.getKind());
+ Assert.assertTrue(version.isFile());
+
}
//---------------------------------- dirs --------------------------------------------------------
@@ -292,21 +292,21 @@ public class SvnTreeConflictDataTest extends Svn17TestCase {
Assert.assertNotNull(vf);
final Change change = changeListManager.getChange(vf);
Assert.assertTrue(change instanceof ConflictedSvnChange);
- SVNTreeConflictDescription beforeDescription = ((ConflictedSvnChange)change).getBeforeDescription();
+ TreeConflictDescription beforeDescription = ((ConflictedSvnChange)change).getBeforeDescription();
Assert.assertNotNull(beforeDescription);
- final SVNTreeConflictDescription afterDescription = ((ConflictedSvnChange)change).getAfterDescription();
+ final TreeConflictDescription afterDescription = ((ConflictedSvnChange)change).getAfterDescription();
Assert.assertNull(afterDescription);
- Assert.assertEquals(SVNOperation.UPDATE, beforeDescription.getOperation());
- Assert.assertEquals(SVNConflictAction.ADD, beforeDescription.getConflictAction());
+ Assert.assertEquals(ConflictOperation.UPDATE, beforeDescription.getOperation());
+ Assert.assertEquals(ConflictAction.ADD, beforeDescription.getConflictAction());
Assert.assertTrue(beforeDescription.isTreeConflict());
- SVNConflictVersion leftVersion = beforeDescription.getSourceLeftVersion();
+ ConflictVersion leftVersion = beforeDescription.getSourceLeftVersion();
Assert.assertNull(leftVersion);
- final SVNConflictVersion version = beforeDescription.getSourceRightVersion();
+ final ConflictVersion version = beforeDescription.getSourceRightVersion();
Assert.assertNotNull(version);
- Assert.assertEquals(SVNNodeKind.DIR, version.getKind());
+ Assert.assertTrue(version.isDirectory());
}
// not a conflict in Subversion 1.7.7. "mine" file becomes added
@@ -322,22 +322,22 @@ public class SvnTreeConflictDataTest extends Svn17TestCase {
Assert.assertNotNull(vf);
final Change change = changeListManager.getChange(vf);
Assert.assertTrue(change instanceof ConflictedSvnChange);
- SVNTreeConflictDescription beforeDescription = ((ConflictedSvnChange)change).getBeforeDescription();
+ TreeConflictDescription beforeDescription = ((ConflictedSvnChange)change).getBeforeDescription();
Assert.assertNotNull(beforeDescription);
- final SVNTreeConflictDescription afterDescription = ((ConflictedSvnChange)change).getAfterDescription();
+ final TreeConflictDescription afterDescription = ((ConflictedSvnChange)change).getAfterDescription();
Assert.assertNull(afterDescription);
- Assert.assertEquals(SVNOperation.UPDATE, beforeDescription.getOperation());
- Assert.assertEquals(SVNConflictAction.DELETE, beforeDescription.getConflictAction());
+ Assert.assertEquals(ConflictOperation.UPDATE, beforeDescription.getOperation());
+ Assert.assertEquals(ConflictAction.DELETE, beforeDescription.getConflictAction());
Assert.assertTrue(beforeDescription.isTreeConflict());
- SVNConflictVersion leftVersion = beforeDescription.getSourceLeftVersion();
+ ConflictVersion leftVersion = beforeDescription.getSourceLeftVersion();
Assert.assertNotNull(leftVersion);
- Assert.assertEquals(SVNNodeKind.DIR, leftVersion.getKind());
+ Assert.assertEquals(NodeKind.DIR, leftVersion.getKind());
- final SVNConflictVersion version = beforeDescription.getSourceRightVersion();
+ final ConflictVersion version = beforeDescription.getSourceRightVersion();
Assert.assertNotNull(version);
- Assert.assertEquals(SVNNodeKind.NONE, version.getKind());
+ Assert.assertEquals(NodeKind.NONE, version.getKind());
}*/
@Test
@@ -350,22 +350,22 @@ public class SvnTreeConflictDataTest extends Svn17TestCase {
final Change change = changeListManager.getChange(new FilePathImpl(new File(myWorkingCopyDir.getPath(), conflictFile), true));
Assert.assertTrue(change instanceof ConflictedSvnChange);
- SVNTreeConflictDescription beforeDescription = ((ConflictedSvnChange)change).getBeforeDescription();
+ TreeConflictDescription beforeDescription = ((ConflictedSvnChange)change).getBeforeDescription();
Assert.assertNotNull(beforeDescription);
- final SVNTreeConflictDescription afterDescription = ((ConflictedSvnChange)change).getAfterDescription();
+ final TreeConflictDescription afterDescription = ((ConflictedSvnChange)change).getAfterDescription();
Assert.assertNull(afterDescription);
- Assert.assertEquals(SVNOperation.UPDATE, beforeDescription.getOperation());
- Assert.assertEquals(SVNConflictAction.EDIT, beforeDescription.getConflictAction());
+ Assert.assertEquals(ConflictOperation.UPDATE, beforeDescription.getOperation());
+ Assert.assertEquals(ConflictAction.EDIT, beforeDescription.getConflictAction());
Assert.assertTrue(beforeDescription.isTreeConflict());
- SVNConflictVersion leftVersion = beforeDescription.getSourceLeftVersion();
+ ConflictVersion leftVersion = beforeDescription.getSourceLeftVersion();
Assert.assertNotNull(leftVersion);
- Assert.assertEquals(SVNNodeKind.DIR, leftVersion.getKind());
+ Assert.assertTrue(leftVersion.isDirectory());
- final SVNConflictVersion version = beforeDescription.getSourceRightVersion();
+ final ConflictVersion version = beforeDescription.getSourceRightVersion();
Assert.assertNotNull(version);
- Assert.assertEquals(SVNNodeKind.DIR, version.getKind());
+ Assert.assertTrue(version.isDirectory());
}
@Test
@@ -380,22 +380,22 @@ public class SvnTreeConflictDataTest extends Svn17TestCase {
Assert.assertNotNull(vf);
final Change change = changeListManager.getChange(vf);
Assert.assertTrue(change instanceof ConflictedSvnChange);
- SVNTreeConflictDescription beforeDescription = ((ConflictedSvnChange)change).getBeforeDescription();
+ TreeConflictDescription beforeDescription = ((ConflictedSvnChange)change).getBeforeDescription();
Assert.assertNotNull(beforeDescription);
- final SVNTreeConflictDescription afterDescription = ((ConflictedSvnChange)change).getAfterDescription();
+ final TreeConflictDescription afterDescription = ((ConflictedSvnChange)change).getAfterDescription();
Assert.assertNull(afterDescription);
- Assert.assertEquals(SVNOperation.UPDATE, beforeDescription.getOperation());
- Assert.assertEquals(SVNConflictAction.DELETE, beforeDescription.getConflictAction());
+ Assert.assertEquals(ConflictOperation.UPDATE, beforeDescription.getOperation());
+ Assert.assertEquals(ConflictAction.DELETE, beforeDescription.getConflictAction());
Assert.assertTrue(beforeDescription.isTreeConflict());
- SVNConflictVersion leftVersion = beforeDescription.getSourceLeftVersion();
+ ConflictVersion leftVersion = beforeDescription.getSourceLeftVersion();
Assert.assertNotNull(leftVersion);
- Assert.assertEquals(SVNNodeKind.DIR, leftVersion.getKind());
+ Assert.assertTrue(leftVersion.isDirectory());
- final SVNConflictVersion version = beforeDescription.getSourceRightVersion();
+ final ConflictVersion version = beforeDescription.getSourceRightVersion();
Assert.assertNotNull(version);
- Assert.assertEquals(SVNNodeKind.NONE, version.getKind());
+ Assert.assertTrue(version.isNone());
}
@Test
@@ -410,21 +410,21 @@ public class SvnTreeConflictDataTest extends Svn17TestCase {
Assert.assertNotNull(vf);
final Change change = changeListManager.getChange(vf);
Assert.assertTrue(change instanceof ConflictedSvnChange);
- SVNTreeConflictDescription beforeDescription = ((ConflictedSvnChange)change).getBeforeDescription();
+ TreeConflictDescription beforeDescription = ((ConflictedSvnChange)change).getBeforeDescription();
Assert.assertNotNull(beforeDescription);
- final SVNTreeConflictDescription afterDescription = ((ConflictedSvnChange)change).getAfterDescription();
+ final TreeConflictDescription afterDescription = ((ConflictedSvnChange)change).getAfterDescription();
Assert.assertNull(afterDescription);
- Assert.assertEquals(SVNOperation.UPDATE, beforeDescription.getOperation());
- Assert.assertEquals(SVNConflictAction.ADD, beforeDescription.getConflictAction());
+ Assert.assertEquals(ConflictOperation.UPDATE, beforeDescription.getOperation());
+ Assert.assertEquals(ConflictAction.ADD, beforeDescription.getConflictAction());
Assert.assertTrue(beforeDescription.isTreeConflict());
- SVNConflictVersion leftVersion = beforeDescription.getSourceLeftVersion();
+ ConflictVersion leftVersion = beforeDescription.getSourceLeftVersion();
Assert.assertNull(leftVersion);
- final SVNConflictVersion version = beforeDescription.getSourceRightVersion();
+ final ConflictVersion version = beforeDescription.getSourceRightVersion();
Assert.assertNotNull(version);
- Assert.assertEquals(SVNNodeKind.DIR, version.getKind());
+ Assert.assertTrue(version.isDirectory());
}
@Test
@@ -437,22 +437,22 @@ public class SvnTreeConflictDataTest extends Svn17TestCase {
final Change change = changeListManager.getChange(new FilePathImpl(new File(myWorkingCopyDir.getPath(), conflictFile), true));
Assert.assertTrue(change instanceof ConflictedSvnChange);
- SVNTreeConflictDescription beforeDescription = ((ConflictedSvnChange)change).getBeforeDescription();
+ TreeConflictDescription beforeDescription = ((ConflictedSvnChange)change).getBeforeDescription();
Assert.assertNotNull(beforeDescription);
- final SVNTreeConflictDescription afterDescription = ((ConflictedSvnChange)change).getAfterDescription();
+ final TreeConflictDescription afterDescription = ((ConflictedSvnChange)change).getAfterDescription();
Assert.assertNull(afterDescription);
- Assert.assertEquals(SVNOperation.UPDATE, beforeDescription.getOperation());
- Assert.assertEquals(SVNConflictAction.EDIT, beforeDescription.getConflictAction());
+ Assert.assertEquals(ConflictOperation.UPDATE, beforeDescription.getOperation());
+ Assert.assertEquals(ConflictAction.EDIT, beforeDescription.getConflictAction());
Assert.assertTrue(beforeDescription.isTreeConflict());
- SVNConflictVersion leftVersion = beforeDescription.getSourceLeftVersion();
+ ConflictVersion leftVersion = beforeDescription.getSourceLeftVersion();
Assert.assertNotNull(leftVersion);
- Assert.assertEquals(SVNNodeKind.DIR, leftVersion.getKind());
+ Assert.assertTrue(leftVersion.isDirectory());
- final SVNConflictVersion version = beforeDescription.getSourceRightVersion();
+ final ConflictVersion version = beforeDescription.getSourceRightVersion();
Assert.assertNotNull(version);
- Assert.assertEquals(SVNNodeKind.DIR, version.getKind());
+ Assert.assertTrue(version.isDirectory());
}
@Test
@@ -465,22 +465,22 @@ public class SvnTreeConflictDataTest extends Svn17TestCase {
final Change change = changeListManager.getChange(new FilePathImpl(new File(myWorkingCopyDir.getPath(), conflictFile), true));
Assert.assertTrue(change instanceof ConflictedSvnChange);
- SVNTreeConflictDescription beforeDescription = ((ConflictedSvnChange)change).getBeforeDescription();
+ TreeConflictDescription beforeDescription = ((ConflictedSvnChange)change).getBeforeDescription();
Assert.assertNotNull(beforeDescription);
- final SVNTreeConflictDescription afterDescription = ((ConflictedSvnChange)change).getAfterDescription();
+ final TreeConflictDescription afterDescription = ((ConflictedSvnChange)change).getAfterDescription();
Assert.assertNull(afterDescription);
- Assert.assertEquals(SVNOperation.UPDATE, beforeDescription.getOperation());
- Assert.assertEquals(SVNConflictAction.ADD, beforeDescription.getConflictAction());
+ Assert.assertEquals(ConflictOperation.UPDATE, beforeDescription.getOperation());
+ Assert.assertEquals(ConflictAction.ADD, beforeDescription.getConflictAction());
Assert.assertTrue(beforeDescription.isTreeConflict());
- SVNConflictVersion leftVersion = beforeDescription.getSourceLeftVersion();
+ ConflictVersion leftVersion = beforeDescription.getSourceLeftVersion();
Assert.assertNull(leftVersion);
- //Assert.assertEquals(SVNNodeKind.DIR, leftVersion.getKind());
+ //Assert.assertEquals(NodeKind.DIR, leftVersion.getKind());
- final SVNConflictVersion version = beforeDescription.getSourceRightVersion();
+ final ConflictVersion version = beforeDescription.getSourceRightVersion();
Assert.assertNotNull(version);
- Assert.assertEquals(SVNNodeKind.DIR, version.getKind());
+ Assert.assertTrue(version.isDirectory());
}
//---------------------------------
@Test
@@ -498,21 +498,21 @@ public class SvnTreeConflictDataTest extends Svn17TestCase {
Assert.assertNotNull(vf);
final Change change = changeListManager.getChange(vf);
Assert.assertTrue(change instanceof ConflictedSvnChange);
- SVNTreeConflictDescription beforeDescription = ((ConflictedSvnChange)change).getBeforeDescription();
+ TreeConflictDescription beforeDescription = ((ConflictedSvnChange)change).getBeforeDescription();
Assert.assertNotNull(beforeDescription);
- final SVNTreeConflictDescription afterDescription = ((ConflictedSvnChange)change).getAfterDescription();
+ final TreeConflictDescription afterDescription = ((ConflictedSvnChange)change).getAfterDescription();
Assert.assertNull(afterDescription);
- Assert.assertEquals(SVNOperation.UPDATE, beforeDescription.getOperation());
- Assert.assertEquals(SVNConflictAction.ADD, beforeDescription.getConflictAction());
+ Assert.assertEquals(ConflictOperation.UPDATE, beforeDescription.getOperation());
+ Assert.assertEquals(ConflictAction.ADD, beforeDescription.getConflictAction());
Assert.assertTrue(beforeDescription.isTreeConflict());
- SVNConflictVersion leftVersion = beforeDescription.getSourceLeftVersion();
+ ConflictVersion leftVersion = beforeDescription.getSourceLeftVersion();
Assert.assertNull(leftVersion);
- final SVNConflictVersion version = beforeDescription.getSourceRightVersion();
+ final ConflictVersion version = beforeDescription.getSourceRightVersion();
Assert.assertNotNull(version);
- Assert.assertEquals(SVNNodeKind.DIR, version.getKind());
+ Assert.assertTrue(version.isDirectory());
}
@Test
@@ -530,21 +530,21 @@ public class SvnTreeConflictDataTest extends Svn17TestCase {
Assert.assertNotNull(vf);
final Change change = changeListManager.getChange(vf);
Assert.assertTrue(change instanceof ConflictedSvnChange);
- SVNTreeConflictDescription beforeDescription = ((ConflictedSvnChange)change).getBeforeDescription();
+ TreeConflictDescription beforeDescription = ((ConflictedSvnChange)change).getBeforeDescription();
Assert.assertNotNull(beforeDescription);
- final SVNTreeConflictDescription afterDescription = ((ConflictedSvnChange)change).getAfterDescription();
+ final TreeConflictDescription afterDescription = ((ConflictedSvnChange)change).getAfterDescription();
Assert.assertNull(afterDescription);
- Assert.assertEquals(SVNOperation.UPDATE, beforeDescription.getOperation());
- Assert.assertEquals(SVNConflictAction.ADD, beforeDescription.getConflictAction());
+ Assert.assertEquals(ConflictOperation.UPDATE, beforeDescription.getOperation());
+ Assert.assertEquals(ConflictAction.ADD, beforeDescription.getConflictAction());
Assert.assertTrue(beforeDescription.isTreeConflict());
- SVNConflictVersion leftVersion = beforeDescription.getSourceLeftVersion();
+ ConflictVersion leftVersion = beforeDescription.getSourceLeftVersion();
Assert.assertNull(leftVersion);
- final SVNConflictVersion version = beforeDescription.getSourceRightVersion();
+ final ConflictVersion version = beforeDescription.getSourceRightVersion();
Assert.assertNotNull(version);
- Assert.assertEquals(SVNNodeKind.DIR, version.getKind());
+ Assert.assertTrue(version.isDirectory());
}
@Test
@@ -562,21 +562,21 @@ public class SvnTreeConflictDataTest extends Svn17TestCase {
Assert.assertNotNull(vf);
final Change change = changeListManager.getChange(vf);
Assert.assertTrue(change instanceof ConflictedSvnChange);
- SVNTreeConflictDescription beforeDescription = ((ConflictedSvnChange)change).getBeforeDescription();
+ TreeConflictDescription beforeDescription = ((ConflictedSvnChange)change).getBeforeDescription();
Assert.assertNotNull(beforeDescription);
- final SVNTreeConflictDescription afterDescription = ((ConflictedSvnChange)change).getAfterDescription();
+ final TreeConflictDescription afterDescription = ((ConflictedSvnChange)change).getAfterDescription();
Assert.assertNull(afterDescription);
- Assert.assertEquals(SVNOperation.UPDATE, beforeDescription.getOperation());
- Assert.assertEquals(SVNConflictAction.ADD, beforeDescription.getConflictAction());
+ Assert.assertEquals(ConflictOperation.UPDATE, beforeDescription.getOperation());
+ Assert.assertEquals(ConflictAction.ADD, beforeDescription.getConflictAction());
Assert.assertTrue(beforeDescription.isTreeConflict());
- SVNConflictVersion leftVersion = beforeDescription.getSourceLeftVersion();
+ ConflictVersion leftVersion = beforeDescription.getSourceLeftVersion();
Assert.assertNull(leftVersion);
- final SVNConflictVersion version = beforeDescription.getSourceRightVersion();
+ final ConflictVersion version = beforeDescription.getSourceRightVersion();
Assert.assertNotNull(version);
- Assert.assertEquals(SVNNodeKind.DIR, version.getKind());
+ Assert.assertTrue(version.isDirectory());
}
@Test
@@ -594,21 +594,21 @@ public class SvnTreeConflictDataTest extends Svn17TestCase {
Assert.assertNotNull(vf);
final Change change = changeListManager.getChange(vf);
Assert.assertTrue(change instanceof ConflictedSvnChange);
- SVNTreeConflictDescription beforeDescription = ((ConflictedSvnChange)change).getBeforeDescription();
+ TreeConflictDescription beforeDescription = ((ConflictedSvnChange)change).getBeforeDescription();
Assert.assertNotNull(beforeDescription);
- final SVNTreeConflictDescription afterDescription = ((ConflictedSvnChange)change).getAfterDescription();
+ final TreeConflictDescription afterDescription = ((ConflictedSvnChange)change).getAfterDescription();
Assert.assertNull(afterDescription);
- Assert.assertEquals(SVNOperation.UPDATE, beforeDescription.getOperation());
- Assert.assertEquals(SVNConflictAction.ADD, beforeDescription.getConflictAction());
+ Assert.assertEquals(ConflictOperation.UPDATE, beforeDescription.getOperation());
+ Assert.assertEquals(ConflictAction.ADD, beforeDescription.getConflictAction());
Assert.assertTrue(beforeDescription.isTreeConflict());
- SVNConflictVersion leftVersion = beforeDescription.getSourceLeftVersion();
+ ConflictVersion leftVersion = beforeDescription.getSourceLeftVersion();
Assert.assertNull(leftVersion);
- final SVNConflictVersion version = beforeDescription.getSourceRightVersion();
+ final ConflictVersion version = beforeDescription.getSourceRightVersion();
Assert.assertNotNull(version);
- Assert.assertEquals(SVNNodeKind.DIR, version.getKind());
+ Assert.assertTrue(version.isDirectory());
}
@Test
@@ -626,21 +626,21 @@ public class SvnTreeConflictDataTest extends Svn17TestCase {
Assert.assertNotNull(vf);
final Change change = changeListManager.getChange(vf);
Assert.assertTrue(change instanceof ConflictedSvnChange);
- SVNTreeConflictDescription beforeDescription = ((ConflictedSvnChange)change).getBeforeDescription();
+ TreeConflictDescription beforeDescription = ((ConflictedSvnChange)change).getBeforeDescription();
Assert.assertNotNull(beforeDescription);
- final SVNTreeConflictDescription afterDescription = ((ConflictedSvnChange)change).getAfterDescription();
+ final TreeConflictDescription afterDescription = ((ConflictedSvnChange)change).getAfterDescription();
Assert.assertNull(afterDescription);
- Assert.assertEquals(SVNOperation.UPDATE, beforeDescription.getOperation());
- Assert.assertEquals(SVNConflictAction.ADD, beforeDescription.getConflictAction());
+ Assert.assertEquals(ConflictOperation.UPDATE, beforeDescription.getOperation());
+ Assert.assertEquals(ConflictAction.ADD, beforeDescription.getConflictAction());
Assert.assertTrue(beforeDescription.isTreeConflict());
- SVNConflictVersion leftVersion = beforeDescription.getSourceLeftVersion();
+ ConflictVersion leftVersion = beforeDescription.getSourceLeftVersion();
Assert.assertNull(leftVersion);
- final SVNConflictVersion version = beforeDescription.getSourceRightVersion();
+ final ConflictVersion version = beforeDescription.getSourceRightVersion();
Assert.assertNotNull(version);
- Assert.assertEquals(SVNNodeKind.DIR, version.getKind());
+ Assert.assertTrue(version.isDirectory());
}
//******************************************
// dir -> file (mine, theirs)
@@ -659,21 +659,21 @@ public class SvnTreeConflictDataTest extends Svn17TestCase {
Assert.assertNotNull(vf);
final Change change = changeListManager.getChange(vf);
Assert.assertTrue(change instanceof ConflictedSvnChange);
- SVNTreeConflictDescription beforeDescription = ((ConflictedSvnChange)change).getBeforeDescription();
+ TreeConflictDescription beforeDescription = ((ConflictedSvnChange)change).getBeforeDescription();
Assert.assertNotNull(beforeDescription);
- final SVNTreeConflictDescription afterDescription = ((ConflictedSvnChange)change).getAfterDescription();
+ final TreeConflictDescription afterDescription = ((ConflictedSvnChange)change).getAfterDescription();
Assert.assertNull(afterDescription);
- Assert.assertEquals(SVNOperation.UPDATE, beforeDescription.getOperation());
- Assert.assertEquals(SVNConflictAction.ADD, beforeDescription.getConflictAction());
+ Assert.assertEquals(ConflictOperation.UPDATE, beforeDescription.getOperation());
+ Assert.assertEquals(ConflictAction.ADD, beforeDescription.getConflictAction());
Assert.assertTrue(beforeDescription.isTreeConflict());
- SVNConflictVersion leftVersion = beforeDescription.getSourceLeftVersion();
+ ConflictVersion leftVersion = beforeDescription.getSourceLeftVersion();
Assert.assertNull(leftVersion);
- final SVNConflictVersion version = beforeDescription.getSourceRightVersion();
+ final ConflictVersion version = beforeDescription.getSourceRightVersion();
Assert.assertNotNull(version);
- Assert.assertEquals(SVNNodeKind.FILE, version.getKind());
+ Assert.assertTrue(version.isFile());
}
@Test
@@ -691,21 +691,21 @@ public class SvnTreeConflictDataTest extends Svn17TestCase {
Assert.assertNotNull(vf);
final Change change = changeListManager.getChange(vf);
Assert.assertTrue(change instanceof ConflictedSvnChange);
- SVNTreeConflictDescription beforeDescription = ((ConflictedSvnChange)change).getBeforeDescription();
+ TreeConflictDescription beforeDescription = ((ConflictedSvnChange)change).getBeforeDescription();
Assert.assertNotNull(beforeDescription);
- final SVNTreeConflictDescription afterDescription = ((ConflictedSvnChange)change).getAfterDescription();
+ final TreeConflictDescription afterDescription = ((ConflictedSvnChange)change).getAfterDescription();
Assert.assertNull(afterDescription);
- Assert.assertEquals(SVNOperation.UPDATE, beforeDescription.getOperation());
- Assert.assertEquals(SVNConflictAction.ADD, beforeDescription.getConflictAction());
+ Assert.assertEquals(ConflictOperation.UPDATE, beforeDescription.getOperation());
+ Assert.assertEquals(ConflictAction.ADD, beforeDescription.getConflictAction());
Assert.assertTrue(beforeDescription.isTreeConflict());
- SVNConflictVersion leftVersion = beforeDescription.getSourceLeftVersion();
+ ConflictVersion leftVersion = beforeDescription.getSourceLeftVersion();
Assert.assertNull(leftVersion);
- final SVNConflictVersion version = beforeDescription.getSourceRightVersion();
+ final ConflictVersion version = beforeDescription.getSourceRightVersion();
Assert.assertNotNull(version);
- Assert.assertEquals(SVNNodeKind.FILE, version.getKind());
+ Assert.assertTrue(version.isFile());
}
@Test
@@ -723,21 +723,21 @@ public class SvnTreeConflictDataTest extends Svn17TestCase {
Assert.assertNotNull(vf);
final Change change = changeListManager.getChange(vf);
Assert.assertTrue(change instanceof ConflictedSvnChange);
- SVNTreeConflictDescription beforeDescription = ((ConflictedSvnChange)change).getBeforeDescription();
+ TreeConflictDescription beforeDescription = ((ConflictedSvnChange)change).getBeforeDescription();
Assert.assertNotNull(beforeDescription);
- final SVNTreeConflictDescription afterDescription = ((ConflictedSvnChange)change).getAfterDescription();
+ final TreeConflictDescription afterDescription = ((ConflictedSvnChange)change).getAfterDescription();
Assert.assertNull(afterDescription);
- Assert.assertEquals(SVNOperation.UPDATE, beforeDescription.getOperation());
- Assert.assertEquals(SVNConflictAction.ADD, beforeDescription.getConflictAction());
+ Assert.assertEquals(ConflictOperation.UPDATE, beforeDescription.getOperation());
+ Assert.assertEquals(ConflictAction.ADD, beforeDescription.getConflictAction());
Assert.assertTrue(beforeDescription.isTreeConflict());
- SVNConflictVersion leftVersion = beforeDescription.getSourceLeftVersion();
+ ConflictVersion leftVersion = beforeDescription.getSourceLeftVersion();
Assert.assertNull(leftVersion);
- final SVNConflictVersion version = beforeDescription.getSourceRightVersion();
+ final ConflictVersion version = beforeDescription.getSourceRightVersion();
Assert.assertNotNull(version);
- Assert.assertEquals(SVNNodeKind.FILE, version.getKind());
+ Assert.assertTrue(version.isFile());
}
@Test
@@ -755,21 +755,21 @@ public class SvnTreeConflictDataTest extends Svn17TestCase {
Assert.assertNotNull(vf);
final Change change = changeListManager.getChange(vf);
Assert.assertTrue(change instanceof ConflictedSvnChange);
- SVNTreeConflictDescription beforeDescription = ((ConflictedSvnChange)change).getBeforeDescription();
+ TreeConflictDescription beforeDescription = ((ConflictedSvnChange)change).getBeforeDescription();
Assert.assertNotNull(beforeDescription);
- final SVNTreeConflictDescription afterDescription = ((ConflictedSvnChange)change).getAfterDescription();
+ final TreeConflictDescription afterDescription = ((ConflictedSvnChange)change).getAfterDescription();
Assert.assertNull(afterDescription);
- Assert.assertEquals(SVNOperation.UPDATE, beforeDescription.getOperation());
- Assert.assertEquals(SVNConflictAction.ADD, beforeDescription.getConflictAction());
+ Assert.assertEquals(ConflictOperation.UPDATE, beforeDescription.getOperation());
+ Assert.assertEquals(ConflictAction.ADD, beforeDescription.getConflictAction());
Assert.assertTrue(beforeDescription.isTreeConflict());
- SVNConflictVersion leftVersion = beforeDescription.getSourceLeftVersion();
+ ConflictVersion leftVersion = beforeDescription.getSourceLeftVersion();
Assert.assertNull(leftVersion);
- final SVNConflictVersion version = beforeDescription.getSourceRightVersion();
+ final ConflictVersion version = beforeDescription.getSourceRightVersion();
Assert.assertNotNull(version);
- Assert.assertEquals(SVNNodeKind.FILE, version.getKind());
+ Assert.assertTrue(version.isFile());
}
@Test
@@ -787,21 +787,21 @@ public class SvnTreeConflictDataTest extends Svn17TestCase {
Assert.assertNotNull(vf);
final Change change = changeListManager.getChange(vf);
Assert.assertTrue(change instanceof ConflictedSvnChange);
- SVNTreeConflictDescription beforeDescription = ((ConflictedSvnChange)change).getBeforeDescription();
+ TreeConflictDescription beforeDescription = ((ConflictedSvnChange)change).getBeforeDescription();
Assert.assertNotNull(beforeDescription);
- final SVNTreeConflictDescription afterDescription = ((ConflictedSvnChange)change).getAfterDescription();
+ final TreeConflictDescription afterDescription = ((ConflictedSvnChange)change).getAfterDescription();
Assert.assertNull(afterDescription);
- Assert.assertEquals(SVNOperation.UPDATE, beforeDescription.getOperation());
- Assert.assertEquals(SVNConflictAction.ADD, beforeDescription.getConflictAction());
+ Assert.assertEquals(ConflictOperation.UPDATE, beforeDescription.getOperation());
+ Assert.assertEquals(ConflictAction.ADD, beforeDescription.getConflictAction());
Assert.assertTrue(beforeDescription.isTreeConflict());
- SVNConflictVersion leftVersion = beforeDescription.getSourceLeftVersion();
+ ConflictVersion leftVersion = beforeDescription.getSourceLeftVersion();
Assert.assertNull(leftVersion);
- final SVNConflictVersion version = beforeDescription.getSourceRightVersion();
+ final ConflictVersion version = beforeDescription.getSourceRightVersion();
Assert.assertNotNull(version);
- Assert.assertEquals(SVNNodeKind.FILE, version.getKind());
+ Assert.assertTrue(version.isFile());
}
private void createSubTree() throws Exception {
diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/TreeConflictData.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/TreeConflictData.java
index 2114e0e0b82b..178253bf58bf 100644
--- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/TreeConflictData.java
+++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/TreeConflictData.java
@@ -15,7 +15,7 @@
*/
package org.jetbrains.idea.svn;
-import org.tmatesoft.svn.core.wc.SVNStatusType;
+import org.jetbrains.idea.svn.status.StatusType;
import java.util.ArrayList;
import java.util.Arrays;
@@ -51,8 +51,8 @@ public interface TreeConflictData {
"@@ -0,0 +1,1 @@\n" +
"+added text\n" +
"\\ No newline at end of file\n",
- "added.txt", new FileData[]{new FileData("added.txt", "unversioned text", SVNStatusType.STATUS_UNVERSIONED,
- SVNStatusType.STATUS_UNVERSIONED, SVNStatusType.STATUS_UNVERSIONED,
+ "added.txt", new FileData[]{new FileData("added.txt", "unversioned text", StatusType.STATUS_UNVERSIONED,
+ StatusType.STATUS_UNVERSIONED, StatusType.STATUS_UNVERSIONED,
false)});
Data MINE_EDIT_THEIRS_DELETE = new Data("Index: root/source/s1.txt\n" +
@@ -62,8 +62,8 @@ public interface TreeConflictData {
"@@ -1,1 +0,0 @@\n" +
"-123\n" +
"\\ No newline at end of file\n", "root/source/s1.txt",
- new FileData[] {new FileData("root/source/s1.txt", "1*2*3", SVNStatusType.STATUS_NORMAL,
- SVNStatusType.STATUS_MODIFIED, SVNStatusType.STATUS_NORMAL, false)});
+ new FileData[] {new FileData("root/source/s1.txt", "1*2*3", StatusType.STATUS_NORMAL,
+ StatusType.STATUS_MODIFIED, StatusType.STATUS_NORMAL, false)});
Data MINE_DELETE_THEIRS_EDIT = new Data("Index: root/source/s1.txt\n" +
"===================================================================\n" +
"--- root/source/s1.txt\t(revision 358)\n" +
@@ -73,24 +73,24 @@ public interface TreeConflictData {
"\\ No newline at end of file\n" +
"+1*2*3\n" +
"\\ No newline at end of file\n", "root/source/s1.txt",
- new FileData[] {new FileData("root/source/s1.txt", null, SVNStatusType.STATUS_DELETED,
- SVNStatusType.STATUS_DELETED, SVNStatusType.STATUS_DELETED, false)});
+ new FileData[] {new FileData("root/source/s1.txt", null, StatusType.STATUS_DELETED,
+ StatusType.STATUS_DELETED, StatusType.STATUS_DELETED, false)});
Data MINE_EDIT_THEIRS_MOVE = new Data("Index: root/source/s1.txt\n" +
"===================================================================\n" +
"--- root/source/s1.txt\t(revision 358)\n" +
"+++ root/source/s1renamed.txt\t(revision )\n" +
"@@ -1,0 +1,0 @@\n", "root/source/s1.txt",
- new FileData[] {new FileData("root/source/s1.txt", "1*2*3", SVNStatusType.STATUS_NORMAL,
- SVNStatusType.STATUS_MODIFIED, SVNStatusType.STATUS_NORMAL, false)});
+ new FileData[] {new FileData("root/source/s1.txt", "1*2*3", StatusType.STATUS_NORMAL,
+ StatusType.STATUS_MODIFIED, StatusType.STATUS_NORMAL, false)});
Data MINE_UNV_THEIRS_MOVE = new Data("Index: root/source/s1.txt\n" +
"===================================================================\n" +
"--- root/source/s1.txt\t(revision 358)\n" +
"+++ root/source/s1renamed.txt\t(revision )\n" +
"@@ -1,0 +1,0 @@\n", "root/source/s1renamed.txt",
- new FileData[] {new FileData("root/source/s1renamed.txt", "1*2*3", SVNStatusType.STATUS_UNVERSIONED,
- SVNStatusType.STATUS_UNVERSIONED, SVNStatusType.STATUS_UNVERSIONED,
+ new FileData[] {new FileData("root/source/s1renamed.txt", "1*2*3", StatusType.STATUS_UNVERSIONED,
+ StatusType.STATUS_UNVERSIONED, StatusType.STATUS_UNVERSIONED,
false)});
Data MINE_MOVE_THEIRS_EDIT = new Data("Index: root/source/s1.txt\n" +
"===================================================================\n" +
@@ -102,10 +102,10 @@ public interface TreeConflictData {
"+1*2*3\n" +
// conflict would be marked by svn on s1.txt, but here we put s1moved.txt, for change list manager to find the change
"\\ No newline at end of file\n", "root/source/s1moved.txt",
- new FileData[] {new FileData("root/source/s1moved.txt", null, SVNStatusType.STATUS_ADDED,
- SVNStatusType.STATUS_ADDED, SVNStatusType.STATUS_ADDED, false, "root/source/s1.txt"),
- new FileData("root/source/s1.txt", null, SVNStatusType.STATUS_DELETED,
- SVNStatusType.STATUS_DELETED, SVNStatusType.STATUS_DELETED, false)});
+ new FileData[] {new FileData("root/source/s1moved.txt", null, StatusType.STATUS_ADDED,
+ StatusType.STATUS_ADDED, StatusType.STATUS_ADDED, false, "root/source/s1.txt"),
+ new FileData("root/source/s1.txt", null, StatusType.STATUS_DELETED,
+ StatusType.STATUS_DELETED, StatusType.STATUS_DELETED, false)});
Data MINE_MOVE_THEIRS_ADD = new Data("Index: root/source/s1moved.txt\n" +
"===================================================================\n" +
"--- root/source/s1moved.txt\t(revision )\n" +
@@ -114,10 +114,10 @@ public interface TreeConflictData {
"+added text\n" +
"\\ No newline at end of file\n",
"root/source/s1moved.txt",
- new FileData[] {new FileData("root/source/s1moved.txt", null, SVNStatusType.STATUS_ADDED,
- SVNStatusType.STATUS_ADDED, SVNStatusType.STATUS_ADDED, false, "root/source/s1.txt"),
- new FileData("root/source/s1.txt", null, SVNStatusType.STATUS_DELETED,
- SVNStatusType.STATUS_DELETED, SVNStatusType.STATUS_DELETED, false)}) {
+ new FileData[] {new FileData("root/source/s1moved.txt", null, StatusType.STATUS_ADDED,
+ StatusType.STATUS_ADDED, StatusType.STATUS_ADDED, false, "root/source/s1.txt"),
+ new FileData("root/source/s1.txt", null, StatusType.STATUS_DELETED,
+ StatusType.STATUS_DELETED, StatusType.STATUS_DELETED, false)}) {
@Override
protected void afterInit() {
setExcludeFromToTheirsCheck("root\\source\\s1.txt");
@@ -133,11 +133,11 @@ public interface TreeConflictData {
"@@ -0,0 +1,1 @@\n" +
"+added text\n" +
"\\ No newline at end of file\n",
- "addedDir", new FileData[]{new FileData("addedDir", null, SVNStatusType.STATUS_UNVERSIONED,
- SVNStatusType.STATUS_UNVERSIONED, SVNStatusType.STATUS_UNVERSIONED,
+ "addedDir", new FileData[]{new FileData("addedDir", null, StatusType.STATUS_UNVERSIONED,
+ StatusType.STATUS_UNVERSIONED, StatusType.STATUS_UNVERSIONED,
true),
- new FileData("addedDir/unv.txt", "unversioned", SVNStatusType.STATUS_UNVERSIONED,
- SVNStatusType.STATUS_UNVERSIONED, SVNStatusType.STATUS_UNVERSIONED,
+ new FileData("addedDir/unv.txt", "unversioned", StatusType.STATUS_UNVERSIONED,
+ StatusType.STATUS_UNVERSIONED, StatusType.STATUS_UNVERSIONED,
false)});
Data MINE_EDIT_THEIRS_DELETE = new Data("Index: root/source/s1.txt\n" +
@@ -154,8 +154,8 @@ public interface TreeConflictData {
"@@ -1,1 +0,0 @@\n" +
"-abc\n" +
"\\ No newline at end of file\n", "root/source",
- new FileData[] {new FileData("root/source/s1.txt", "1*2*3", SVNStatusType.STATUS_NORMAL,
- SVNStatusType.STATUS_MODIFIED, SVNStatusType.STATUS_NORMAL, false)});
+ new FileData[] {new FileData("root/source/s1.txt", "1*2*3", StatusType.STATUS_NORMAL,
+ StatusType.STATUS_MODIFIED, StatusType.STATUS_NORMAL, false)});
Data MINE_DELETE_THEIRS_EDIT = new Data("Index: root/source/s1.txt\n" +
"===================================================================\n" +
"--- root/source/s1.txt\t(revision 358)\n" +
@@ -165,8 +165,8 @@ public interface TreeConflictData {
"\\ No newline at end of file\n" +
"+1*2*3\n" +
"\\ No newline at end of file\n", "root/source",
- new FileData[] {new FileData("root/source", null, SVNStatusType.STATUS_DELETED,
- SVNStatusType.STATUS_DELETED, SVNStatusType.STATUS_DELETED, true)});
+ new FileData[] {new FileData("root/source", null, StatusType.STATUS_DELETED,
+ StatusType.STATUS_DELETED, StatusType.STATUS_DELETED, true)});
Data MINE_EDIT_THEIRS_MOVE = new Data(
"Index: root/source/s1.txt\n" +
@@ -180,8 +180,8 @@ public interface TreeConflictData {
"+++ root/source1/s2.txt\t(revision )\n" +
"@@ -1,0 +1,0 @@\n",
"root/source",
- new FileData[] {new FileData("root/source/s1.txt", "1*2*3", SVNStatusType.STATUS_NORMAL,
- SVNStatusType.STATUS_MODIFIED, SVNStatusType.STATUS_NORMAL, false)});
+ new FileData[] {new FileData("root/source/s1.txt", "1*2*3", StatusType.STATUS_NORMAL,
+ StatusType.STATUS_MODIFIED, StatusType.STATUS_NORMAL, false)});
Data MINE_UNV_THEIRS_MOVE = new Data(
"Index: root/source/s1.txt\n" +
@@ -194,11 +194,11 @@ public interface TreeConflictData {
"--- root/source/s2.txt\t(revision 358)\n" +
"+++ root/source1/s2.txt\t(revision )\n" +
"@@ -1,0 +1,0 @@\n", "root/source1",
- new FileData[] {new FileData("root/source1", null, SVNStatusType.STATUS_UNVERSIONED,
- SVNStatusType.STATUS_UNVERSIONED, SVNStatusType.STATUS_UNVERSIONED,
+ new FileData[] {new FileData("root/source1", null, StatusType.STATUS_UNVERSIONED,
+ StatusType.STATUS_UNVERSIONED, StatusType.STATUS_UNVERSIONED,
true),
- new FileData("root/source1/unv.txt", "unversioned", SVNStatusType.STATUS_UNVERSIONED,
- SVNStatusType.STATUS_UNVERSIONED, SVNStatusType.STATUS_UNVERSIONED,
+ new FileData("root/source1/unv.txt", "unversioned", StatusType.STATUS_UNVERSIONED,
+ StatusType.STATUS_UNVERSIONED, StatusType.STATUS_UNVERSIONED,
false)});
Data MINE_MOVE_THEIRS_EDIT = new Data("Index: root/source/s1.txt\n" +
@@ -211,10 +211,10 @@ public interface TreeConflictData {
"+1*2*3\n" +
"\\ No newline at end of file\n", "root/source",
new FileData[] {
- new FileData("root/sourceNew", null, SVNStatusType.STATUS_ADDED,
- SVNStatusType.STATUS_ADDED, SVNStatusType.STATUS_ADDED, true, "root/source"),
- new FileData("root/source", null, SVNStatusType.STATUS_DELETED,
- SVNStatusType.STATUS_DELETED, SVNStatusType.STATUS_DELETED, true)});
+ new FileData("root/sourceNew", null, StatusType.STATUS_ADDED,
+ StatusType.STATUS_ADDED, StatusType.STATUS_ADDED, true, "root/source"),
+ new FileData("root/source", null, StatusType.STATUS_DELETED,
+ StatusType.STATUS_DELETED, StatusType.STATUS_DELETED, true)});
Data MINE_MOVE_THEIRS_ADD = new Data("Index: root/sourceNew/added.txt\n" +
"===================================================================\n" +
"--- root/sourceNew/added.txt\t(revision )\n" +
@@ -223,10 +223,10 @@ public interface TreeConflictData {
"+added text\n" +
"\\ No newline at end of file\n", "root/sourceNew",
new FileData[] {
- new FileData("root/sourceNew", null, SVNStatusType.STATUS_ADDED,
- SVNStatusType.STATUS_ADDED, SVNStatusType.STATUS_ADDED, true, "root/source"),
- new FileData("root/source", null, SVNStatusType.STATUS_DELETED,
- SVNStatusType.STATUS_DELETED, SVNStatusType.STATUS_DELETED, true)}) {
+ new FileData("root/sourceNew", null, StatusType.STATUS_ADDED,
+ StatusType.STATUS_ADDED, StatusType.STATUS_ADDED, true, "root/source"),
+ new FileData("root/source", null, StatusType.STATUS_DELETED,
+ StatusType.STATUS_DELETED, StatusType.STATUS_DELETED, true)}) {
@Override
protected void afterInit() {
setExcludeFromToTheirsCheck("root\\source", "root\\source\\s1.txt", "root\\source\\s2.txt");
@@ -243,8 +243,8 @@ public interface TreeConflictData {
"@@ -0,0 +1,1 @@\n" +
"+added text\n" +
"\\ No newline at end of file\n",
- "addedDir", new FileData[]{new FileData("addedDir", "unversioned", SVNStatusType.STATUS_UNVERSIONED,
- SVNStatusType.STATUS_UNVERSIONED, SVNStatusType.STATUS_UNVERSIONED,
+ "addedDir", new FileData[]{new FileData("addedDir", "unversioned", StatusType.STATUS_UNVERSIONED,
+ StatusType.STATUS_UNVERSIONED, StatusType.STATUS_UNVERSIONED,
false)});
Data MINE_ADD_THEIRS_ADD = new Data("Index: addedDir/added.txt\n" +
@@ -254,8 +254,8 @@ public interface TreeConflictData {
"@@ -0,0 +1,1 @@\n" +
"+added text\n" +
"\\ No newline at end of file\n",
- "addedDir", new FileData[]{new FileData("addedDir", "unversioned", SVNStatusType.STATUS_ADDED,
- SVNStatusType.STATUS_UNVERSIONED, SVNStatusType.STATUS_UNVERSIONED,
+ "addedDir", new FileData[]{new FileData("addedDir", "unversioned", StatusType.STATUS_ADDED,
+ StatusType.STATUS_UNVERSIONED, StatusType.STATUS_UNVERSIONED,
false)});
Data MINE_UNV_THEIRS_MOVE = new Data( "Index: root/source/s1.txt\n" +
@@ -268,8 +268,8 @@ public interface TreeConflictData {
"--- root/source/s2.txt\t(revision 358)\n" +
"+++ root/source1/s2.txt\t(revision )\n" +
"@@ -1,0 +1,0 @@\n",
- "root/source1", new FileData[]{new FileData("root/source1", "unversioned", SVNStatusType.STATUS_UNVERSIONED,
- SVNStatusType.STATUS_UNVERSIONED, SVNStatusType.STATUS_UNVERSIONED,
+ "root/source1", new FileData[]{new FileData("root/source1", "unversioned", StatusType.STATUS_UNVERSIONED,
+ StatusType.STATUS_UNVERSIONED, StatusType.STATUS_UNVERSIONED,
false)});
Data MINE_ADD_THEIRS_MOVE = new Data( "Index: root/source/s1.txt\n" +
@@ -282,8 +282,8 @@ public interface TreeConflictData {
"--- root/source/s2.txt\t(revision 358)\n" +
"+++ root/source1/s2.txt\t(revision )\n" +
"@@ -1,0 +1,0 @@\n",
- "root/source1", new FileData[]{new FileData("root/source1", "unversioned", SVNStatusType.STATUS_ADDED,
- SVNStatusType.STATUS_UNVERSIONED, SVNStatusType.STATUS_UNVERSIONED,
+ "root/source1", new FileData[]{new FileData("root/source1", "unversioned", StatusType.STATUS_ADDED,
+ StatusType.STATUS_UNVERSIONED, StatusType.STATUS_UNVERSIONED,
false)});
Data MINE_MOVE_THEIRS_ADD = new Data("Index: addedDir/added.txt\n" +
"===================================================================\n" +
@@ -292,11 +292,11 @@ public interface TreeConflictData {
"@@ -0,0 +1,1 @@\n" +
"+added text\n" +
"\\ No newline at end of file\n",
- "addedDir", new FileData[]{new FileData("addedDir", null, SVNStatusType.STATUS_ADDED,
- SVNStatusType.STATUS_ADDED, SVNStatusType.STATUS_ADDED,
+ "addedDir", new FileData[]{new FileData("addedDir", null, StatusType.STATUS_ADDED,
+ StatusType.STATUS_ADDED, StatusType.STATUS_ADDED,
false, "root/source/s1.txt"),
- new FileData("root/source/s1.txt", null, SVNStatusType.STATUS_DELETED,
- SVNStatusType.STATUS_DELETED, SVNStatusType.STATUS_DELETED,
+ new FileData("root/source/s1.txt", null, StatusType.STATUS_DELETED,
+ StatusType.STATUS_DELETED, StatusType.STATUS_DELETED,
false, null)}) {
@Override
protected void afterInit() {
@@ -314,11 +314,11 @@ public interface TreeConflictData {
"@@ -0,0 +1,1 @@\n" +
"+added text\n" +
"\\ No newline at end of file\n",
- "addedDir.txt", new FileData[]{new FileData("addedDir.txt", null, SVNStatusType.STATUS_UNVERSIONED,
- SVNStatusType.STATUS_UNVERSIONED, SVNStatusType.STATUS_UNVERSIONED,
+ "addedDir.txt", new FileData[]{new FileData("addedDir.txt", null, StatusType.STATUS_UNVERSIONED,
+ StatusType.STATUS_UNVERSIONED, StatusType.STATUS_UNVERSIONED,
true),
- new FileData("addedDir.txt/unv.txt", "unversioned", SVNStatusType.STATUS_UNVERSIONED,
- SVNStatusType.STATUS_UNVERSIONED, SVNStatusType.STATUS_UNVERSIONED,
+ new FileData("addedDir.txt/unv.txt", "unversioned", StatusType.STATUS_UNVERSIONED,
+ StatusType.STATUS_UNVERSIONED, StatusType.STATUS_UNVERSIONED,
false)});
Data MINE_ADD_THEIRS_ADD = new Data("Index: addedDir.txt\n" +
@@ -328,11 +328,11 @@ public interface TreeConflictData {
"@@ -0,0 +1,1 @@\n" +
"+added text\n" +
"\\ No newline at end of file\n",
- "addedDir.txt", new FileData[]{new FileData("addedDir.txt", null, SVNStatusType.STATUS_ADDED,
- SVNStatusType.STATUS_UNVERSIONED, SVNStatusType.STATUS_UNVERSIONED,
+ "addedDir.txt", new FileData[]{new FileData("addedDir.txt", null, StatusType.STATUS_ADDED,
+ StatusType.STATUS_UNVERSIONED, StatusType.STATUS_UNVERSIONED,
true),
- new FileData("addedDir.txt/unv.txt", "unversioned", SVNStatusType.STATUS_ADDED,
- SVNStatusType.STATUS_UNVERSIONED, SVNStatusType.STATUS_UNVERSIONED,
+ new FileData("addedDir.txt/unv.txt", "unversioned", StatusType.STATUS_ADDED,
+ StatusType.STATUS_UNVERSIONED, StatusType.STATUS_UNVERSIONED,
false)});
Data MINE_UNV_THEIRS_MOVE = new Data( "Index: root/source/s1.txt\n" +
@@ -342,12 +342,12 @@ public interface TreeConflictData {
"@@ -1,0 +1,0 @@\n" +
"\\ No newline at end of file\n",
"root/source/s1renamed.txt", new FileData[]{new FileData("root/source/s1renamed.txt", null,
- SVNStatusType.STATUS_UNVERSIONED,
- SVNStatusType.STATUS_UNVERSIONED, SVNStatusType.STATUS_UNVERSIONED,
+ StatusType.STATUS_UNVERSIONED,
+ StatusType.STATUS_UNVERSIONED, StatusType.STATUS_UNVERSIONED,
true),
new FileData("root/source/s1renamed.txt/file.txt", "unversioned",
- SVNStatusType.STATUS_UNVERSIONED,
- SVNStatusType.STATUS_UNVERSIONED, SVNStatusType.STATUS_UNVERSIONED,
+ StatusType.STATUS_UNVERSIONED,
+ StatusType.STATUS_UNVERSIONED, StatusType.STATUS_UNVERSIONED,
false)});
Data MINE_ADD_THEIRS_MOVE = new Data( "Index: root/source/s1.txt\n" +
@@ -357,12 +357,12 @@ public interface TreeConflictData {
"@@ -1,0 +1,0 @@\n" +
"\\ No newline at end of file\n",
"root/source/s1renamed.txt", new FileData[]{new FileData("root/source/s1renamed.txt", null,
- SVNStatusType.STATUS_ADDED,
- SVNStatusType.STATUS_UNVERSIONED, SVNStatusType.STATUS_UNVERSIONED,
+ StatusType.STATUS_ADDED,
+ StatusType.STATUS_UNVERSIONED, StatusType.STATUS_UNVERSIONED,
true),
new FileData("root/source/s1renamed.txt/file.txt", "unversioned",
- SVNStatusType.STATUS_ADDED,
- SVNStatusType.STATUS_UNVERSIONED, SVNStatusType.STATUS_UNVERSIONED,
+ StatusType.STATUS_ADDED,
+ StatusType.STATUS_UNVERSIONED, StatusType.STATUS_UNVERSIONED,
false)});
Data MINE_MOVE_THEIRS_ADD = new Data("Index: addedDir.txt\n" +
@@ -372,10 +372,10 @@ public interface TreeConflictData {
"@@ -0,0 +1,1 @@\n" +
"+added text\n" +
"\\ No newline at end of file\n",
- "addedDir.txt", new FileData[]{new FileData("addedDir.txt", null, SVNStatusType.STATUS_ADDED,
- SVNStatusType.STATUS_ADDED, SVNStatusType.STATUS_ADDED, true, "root/source"),
- new FileData("root/source", null, SVNStatusType.STATUS_DELETED,
- SVNStatusType.STATUS_DELETED, SVNStatusType.STATUS_DELETED, true)}) {
+ "addedDir.txt", new FileData[]{new FileData("addedDir.txt", null, StatusType.STATUS_ADDED,
+ StatusType.STATUS_ADDED, StatusType.STATUS_ADDED, true, "root/source"),
+ new FileData("root/source", null, StatusType.STATUS_DELETED,
+ StatusType.STATUS_DELETED, StatusType.STATUS_DELETED, true)}) {
@Override
protected void afterInit() {
setExcludeFromToTheirsCheck("root\\source", "root\\source\\s1.txt", "root\\source\\s2.txt");
@@ -424,26 +424,26 @@ public interface TreeConflictData {
public final String myRelativePath;
public final String myContents;
public final String myCopyFrom;
- public final SVNStatusType myNodeStatus;
- public final SVNStatusType myContentsStatus;
+ public final StatusType myNodeStatus;
+ public final StatusType myContentsStatus;
// not used for now
- public final SVNStatusType myPropertiesStatus;
+ public final StatusType myPropertiesStatus;
public boolean myIsDir;
public FileData(String relativePath,
String contents,
- SVNStatusType nodeStatus,
- SVNStatusType contentsStatus,
- SVNStatusType propertiesStatus,
+ StatusType nodeStatus,
+ StatusType contentsStatus,
+ StatusType propertiesStatus,
boolean isDir) {
this(relativePath, contents, nodeStatus, contentsStatus, propertiesStatus, isDir, null);
}
public FileData(String relativePath,
String contents,
- SVNStatusType nodeStatus,
- SVNStatusType contentsStatus,
- SVNStatusType propertiesStatus,
+ StatusType nodeStatus,
+ StatusType contentsStatus,
+ StatusType propertiesStatus,
boolean isDir, final String copyFrom) {
myRelativePath = relativePath;
myContents = contents;
diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnCachingRevisionsTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnCachingRevisionsTest.java
index 749ee38c9336..c5f7b9d4757e 100644
--- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnCachingRevisionsTest.java
+++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnCachingRevisionsTest.java
@@ -10,7 +10,6 @@ import com.intellij.testFramework.fixtures.CodeInsightFixtureTestCase;
import org.jetbrains.idea.svn.SvnApplicationSettings;
import org.jetbrains.idea.svn.SvnUtil;
import org.jetbrains.idea.svn.history.*;
-import org.tmatesoft.svn.core.SVNLogEntry;
import org.tmatesoft.svn.core.SVNURL;
import org.tmatesoft.svn.core.wc.SVNRevision;
@@ -38,8 +37,9 @@ public class SvnCachingRevisionsTest extends CodeInsightFixtureTestCase {
}
private SvnChangeList createList(final long revision) {
- return new SvnChangeList(null, myLocation,
- new SVNLogEntry(Collections.emptyMap(), revision, AUTHOR, new Date(System.currentTimeMillis()), ""), ROOT.toDecodedString());
+ LogEntry entry =
+ new LogEntry.Builder().setRevision(revision).setAuthor(AUTHOR).setDate(new Date(System.currentTimeMillis())).setMessage("").build();
+ return new SvnChangeList(null, myLocation, entry, ROOT.toDecodedString());
}
private class MockSvnLogLoader implements SvnLogLoader {
diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnMergeInfoTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnMergeInfoTest.java
index cab82d7fc929..028b8c5c631a 100644
--- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnMergeInfoTest.java
+++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnMergeInfoTest.java
@@ -25,6 +25,7 @@ import com.intellij.openapi.vcs.versionBrowser.ChangeBrowserSettings;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.idea.svn.*;
+import org.jetbrains.idea.svn.api.Depth;
import org.jetbrains.idea.svn.dialogs.MergeContext;
import org.jetbrains.idea.svn.dialogs.WCInfo;
import org.jetbrains.idea.svn.history.SvnChangeList;
@@ -34,7 +35,6 @@ import org.jetbrains.idea.svn.mergeinfo.OneShotMergeInfoHelper;
import org.jetbrains.idea.svn.mergeinfo.SvnMergeInfoCache;
import org.junit.Assert;
import org.junit.Test;
-import org.tmatesoft.svn.core.SVNDepth;
import org.tmatesoft.svn.core.SVNURL;
import org.tmatesoft.svn.core.wc.SVNInfo;
import org.tmatesoft.svn.core.wc.SVNPropertyData;
@@ -65,7 +65,7 @@ public class SvnMergeInfoTest extends Svn16TestCase {
VirtualFile vcsRoot = LocalFileSystem.getInstance().findFileByIoFile(myBranchVcsRoot);
Node node = new Node(vcsRoot, SVNURL.parseURIEncoded(myRepoUrl + "/branch"), SVNURL.parseURIEncoded(myRepoUrl));
RootUrlInfo root = new RootUrlInfo(node, WorkingCopyFormat.ONE_DOT_SIX, vcsRoot, null);
- myWCInfo = new WCInfo(root, true, SVNDepth.INFINITY);
+ myWCInfo = new WCInfo(root, true, Depth.INFINITY);
myMergeContext = new MergeContext(SvnVcs.getInstance(myProject), myRepoUrl + "/trunk", myWCInfo, "trunk", vcsRoot);
myOneShotMergeInfoHelper = new OneShotMergeInfoHelper(myMergeContext);
diff --git a/plugins/tasks/tasks-api/src/com/intellij/tasks/impl/BaseRepositoryImpl.java b/plugins/tasks/tasks-api/src/com/intellij/tasks/impl/BaseRepositoryImpl.java
index 5a0aa95bdec7..30ecaf19f2da 100644
--- a/plugins/tasks/tasks-api/src/com/intellij/tasks/impl/BaseRepositoryImpl.java
+++ b/plugins/tasks/tasks-api/src/com/intellij/tasks/impl/BaseRepositoryImpl.java
@@ -1,9 +1,11 @@
package com.intellij.tasks.impl;
+import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.tasks.TaskRepositoryType;
import com.intellij.tasks.config.TaskSettings;
import com.intellij.util.net.HttpConfigurable;
+import com.intellij.util.net.ssl.CertificateManager;
import org.apache.commons.httpclient.*;
import org.apache.commons.httpclient.auth.AuthScope;
import org.jetbrains.annotations.NotNull;
@@ -51,6 +53,11 @@ public abstract class BaseRepositoryImpl extends BaseRepository {
private HttpClient createClient() {
HttpClient client = new HttpClient(new MultiThreadedHttpConnectionManager());
configureHttpClient(client);
+ // After CertificateManager became application service it no longer "automagically" preliminarily
+ // initializes default SSL context as required for trackers written in httpclient 3.x.
+ // Clients that use httpclient 4.x (see NewBaseRepositoryImpl.getHttpClient) install SSL context explicitly though.
+ // This workaround allows to install context properly as soon as HTTP client is needed.
+ ServiceManager.getService(CertificateManager.class);
return client;
}
@@ -76,7 +83,8 @@ public abstract class BaseRepositoryImpl extends BaseRepository {
client.getParams().setCredentialCharset("UTF-8");
client.getParams().setAuthenticationPreemptive(true);
client.getState().setCredentials(AuthScope.ANY, new UsernamePasswordCredentials(getUsername(), getPassword()));
- } else {
+ }
+ else {
client.getState().clearCredentials();
client.getParams().setAuthenticationPreemptive(false);
}
diff --git a/plugins/tasks/tasks-core/jira/src/com/intellij/tasks/jira/JiraRemoteApi.java b/plugins/tasks/tasks-core/jira/src/com/intellij/tasks/jira/JiraRemoteApi.java
index 22e93a9d26ee..8ee9c97512a1 100644
--- a/plugins/tasks/tasks-core/jira/src/com/intellij/tasks/jira/JiraRemoteApi.java
+++ b/plugins/tasks/tasks-core/jira/src/com/intellij/tasks/jira/JiraRemoteApi.java
@@ -5,7 +5,7 @@ import com.intellij.tasks.Task;
import com.intellij.tasks.TaskState;
import com.intellij.tasks.jira.rest.api2.JiraRestApi2;
import com.intellij.tasks.jira.rest.api20alpha1.JiraRestApi20Alpha1;
-import com.intellij.tasks.jira.soap.JiraSoapApi;
+import com.intellij.tasks.jira.soap.JiraLegacyApi;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -47,11 +47,11 @@ public abstract class JiraRemoteApi {
public abstract ApiType getType();
public enum ApiType {
- SOAP("SOAP") {
+ LEGACY("XML-RPC + RSS") {
@NotNull
@Override
- public JiraSoapApi createApi(@NotNull JiraRepository repository) {
- return new JiraSoapApi(repository);
+ public JiraLegacyApi createApi(@NotNull JiraRepository repository) {
+ return new JiraLegacyApi(repository);
}
},
REST_2_0("REST 2.0") {
diff --git a/plugins/tasks/tasks-core/jira/src/com/intellij/tasks/jira/JiraRepository.java b/plugins/tasks/tasks-core/jira/src/com/intellij/tasks/jira/JiraRepository.java
index c5a469a40c33..b8004ca70023 100644
--- a/plugins/tasks/tasks-core/jira/src/com/intellij/tasks/jira/JiraRepository.java
+++ b/plugins/tasks/tasks-core/jira/src/com/intellij/tasks/jira/JiraRepository.java
@@ -15,23 +15,31 @@ import com.intellij.tasks.impl.BaseRepositoryImpl;
import com.intellij.tasks.impl.TaskUtil;
import com.intellij.tasks.impl.gson.GsonUtil;
import com.intellij.tasks.jira.rest.JiraRestApi;
-import com.intellij.tasks.jira.soap.JiraSoapApi;
+import com.intellij.tasks.jira.soap.JiraLegacyApi;
import com.intellij.util.ArrayUtil;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.xmlb.annotations.Tag;
import org.apache.commons.httpclient.*;
import org.apache.commons.httpclient.cookie.CookiePolicy;
import org.apache.commons.httpclient.methods.GetMethod;
+import org.apache.xmlrpc.CommonsXmlRpcTransport;
+import org.apache.xmlrpc.XmlRpcClient;
+import org.apache.xmlrpc.XmlRpcRequest;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.io.InputStream;
+import java.net.URL;
+import java.util.Collections;
+import java.util.Hashtable;
import java.util.List;
+import java.util.Vector;
import java.util.regex.Pattern;
/**
* @author Dmitry Avdeev
*/
+@SuppressWarnings("UseOfObsoleteCollectionType")
@Tag("JIRA")
public class JiraRepository extends BaseRepositoryImpl {
@@ -51,6 +59,7 @@ public class JiraRepository extends BaseRepositoryImpl {
private String mySearchQuery = TaskBundle.message("jira.default.query");
private JiraRemoteApi myApiVersion;
+ private String myJiraVersion;
/**
* Serialization constructor
@@ -69,6 +78,7 @@ public class JiraRepository extends BaseRepositoryImpl {
private JiraRepository(JiraRepository other) {
super(other);
mySearchQuery = other.mySearchQuery;
+ myJiraVersion = other.myJiraVersion;
if (other.myApiVersion != null) {
myApiVersion = other.myApiVersion.getType().createApi(this);
}
@@ -77,8 +87,13 @@ public class JiraRepository extends BaseRepositoryImpl {
@Override
public boolean equals(Object o) {
if (!super.equals(o)) return false;
- if (o.getClass() != getClass()) return false;
- return Comparing.equal(mySearchQuery, ((JiraRepository)o).mySearchQuery);
+ if (!(o instanceof JiraRepository)) return false;
+
+ JiraRepository repository = (JiraRepository)o;
+
+ if (!Comparing.equal(mySearchQuery, repository.getSearchQuery())) return false;
+ if (!Comparing.equal(myJiraVersion, repository.getJiraVersion())) return false;
+ return true;
}
@@ -149,7 +164,7 @@ public class JiraRepository extends BaseRepositoryImpl {
public JiraRemoteApi discoverApiVersion() throws Exception {
if (LEGACY_API_ONLY) {
LOG.info("Intentionally using only legacy JIRA API");
- return new JiraSoapApi(this);
+ return createLegacyApi();
}
String responseBody;
@@ -164,7 +179,7 @@ public class JiraRepository extends BaseRepositoryImpl {
// not the way to check it safely.
StatusLine status = method.getStatusLine();
if (status != null && status.getStatusCode() == HttpStatus.SC_NOT_FOUND) {
- return new JiraSoapApi(this);
+ return createLegacyApi();
}
else {
throw e;
@@ -173,13 +188,31 @@ public class JiraRepository extends BaseRepositoryImpl {
JsonObject object = GSON.fromJson(responseBody, JsonObject.class);
// when JIRA 4.x support will be dropped 'versionNumber' array in response
// may be used instead version string parsing
- JiraRestApi restApi = JiraRestApi.fromJiraVersion(object.get("version").getAsString(), this);
+ myJiraVersion = object.get("version").getAsString();
+ JiraRestApi restApi = JiraRestApi.fromJiraVersion(myJiraVersion, this);
if (restApi == null) {
throw new Exception(TaskBundle.message("jira.failure.no.REST"));
}
return restApi;
}
+ private JiraLegacyApi createLegacyApi() {
+ try {
+ XmlRpcClient client = new XmlRpcClient(getUrl());
+ Vector<String> parameters = new Vector<String>(Collections.singletonList(""));
+ XmlRpcRequest request = new XmlRpcRequest("jira1.getServerInfo", parameters);
+ @SuppressWarnings("unchecked") Hashtable<String, Object> response =
+ (Hashtable<String, Object>)client.execute(request, new CommonsXmlRpcTransport(new URL(getUrl()), getHttpClient()));
+ if (response != null) {
+ myJiraVersion = (String)response.get("version");
+ }
+ }
+ catch (Exception e) {
+ LOG.error("Cannot find out JIRA version via XML-RPC", e);
+ }
+ return new JiraLegacyApi(this);
+ }
+
private void ensureApiVersionDiscovered() throws Exception {
if (myApiVersion == null || LEGACY_API_ONLY || REDISCOVER_API) {
myApiVersion = discoverApiVersion();
@@ -275,7 +308,7 @@ public class JiraRepository extends BaseRepositoryImpl {
}
private boolean isRestApiSupported() {
- return myApiVersion != null && myApiVersion.getType() != JiraRemoteApi.ApiType.SOAP;
+ return myApiVersion != null && myApiVersion.getType() != JiraRemoteApi.ApiType.LEGACY;
}
public boolean isJqlSupported() {
@@ -322,6 +355,16 @@ public class JiraRepository extends BaseRepositoryImpl {
}
}
+ @Nullable
+ public String getJiraVersion() {
+ return myJiraVersion;
+ }
+
+ @SuppressWarnings("UnusedDeclaration")
+ public void setJiraVersion(@Nullable String jiraVersion) {
+ myJiraVersion = jiraVersion;
+ }
+
public String getRestUrl(String... parts) {
return getUrl() + REST_API_PATH + "/" + StringUtil.join(parts, "/");
}
diff --git a/plugins/tasks/tasks-core/jira/src/com/intellij/tasks/jira/JiraRepositoryEditor.java b/plugins/tasks/tasks-core/jira/src/com/intellij/tasks/jira/JiraRepositoryEditor.java
index 3299ac427432..a8ed1f880bf7 100644
--- a/plugins/tasks/tasks-core/jira/src/com/intellij/tasks/jira/JiraRepositoryEditor.java
+++ b/plugins/tasks/tasks-core/jira/src/com/intellij/tasks/jira/JiraRepositoryEditor.java
@@ -16,7 +16,7 @@
package com.intellij.tasks.jira;
import com.intellij.openapi.project.Project;
-import com.intellij.tasks.TaskBundle;
+import com.intellij.openapi.util.text.StringUtil;
import com.intellij.tasks.config.BaseRepositoryEditor;
import com.intellij.tasks.jira.jql.JqlLanguage;
import com.intellij.ui.EditorTextField;
@@ -35,6 +35,7 @@ import javax.swing.*;
public class JiraRepositoryEditor extends BaseRepositoryEditor<JiraRepository> {
private EditorTextField mySearchQueryField;
private JBLabel mySearchLabel;
+ private JBLabel myNoteLabel;
public JiraRepositoryEditor(Project project, JiraRepository repository, Consumer<JiraRepository> changeListener) {
super(project, repository, changeListener);
@@ -53,6 +54,7 @@ public class JiraRepositoryEditor extends BaseRepositoryEditor<JiraRepository> {
if (connectionSuccessful) {
enableJqlSearchIfSupported();
}
+ updateNote();
}
@Nullable
@@ -62,14 +64,20 @@ public class JiraRepositoryEditor extends BaseRepositoryEditor<JiraRepository> {
enableJqlSearchIfSupported();
installListener(mySearchQueryField);
mySearchLabel = new JBLabel("Search:", SwingConstants.RIGHT);
- JBLabel note = new JBLabel(TaskBundle.message("jira.failure.no.JQL"));
- note.setComponentStyle(UIUtil.ComponentStyle.SMALL);
+ myNoteLabel = new JBLabel();
+ myNoteLabel.setComponentStyle(UIUtil.ComponentStyle.SMALL);
+ updateNote();
return FormBuilder.createFormBuilder()
.addLabeledComponent(mySearchLabel, mySearchQueryField)
- .addComponentToRightColumn(note)
+ .addComponentToRightColumn(myNoteLabel)
.getPanel();
}
+ private void updateNote() {
+ myNoteLabel.setText("JQL search cannot be used in JIRA versions prior 4.2. " +
+ String.format("Your version: %s.", StringUtil.notNullize(myRepository.getJiraVersion(), "unknown")));
+ }
+
@Override
public void setAnchor(@Nullable final JComponent anchor) {
super.setAnchor(anchor);
diff --git a/plugins/tasks/tasks-core/jira/src/com/intellij/tasks/jira/soap/JiraLegacyApi.java b/plugins/tasks/tasks-core/jira/src/com/intellij/tasks/jira/soap/JiraLegacyApi.java
new file mode 100644
index 000000000000..e8cbee842cda
--- /dev/null
+++ b/plugins/tasks/tasks-core/jira/src/com/intellij/tasks/jira/soap/JiraLegacyApi.java
@@ -0,0 +1,114 @@
+package com.intellij.tasks.jira.soap;
+
+import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.tasks.LocalTask;
+import com.intellij.tasks.Task;
+import com.intellij.tasks.TaskBundle;
+import com.intellij.tasks.TaskState;
+import com.intellij.tasks.impl.TaskUtil;
+import com.intellij.tasks.jira.JiraRemoteApi;
+import com.intellij.tasks.jira.JiraRepository;
+import com.intellij.util.Function;
+import com.intellij.util.containers.ContainerUtil;
+import org.apache.commons.httpclient.HttpStatus;
+import org.apache.commons.httpclient.NameValuePair;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.jdom.Element;
+import org.jdom.input.SAXBuilder;
+import org.jetbrains.annotations.NonNls;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.List;
+
+/**
+ * Legacy integration restored due to IDEA-120595.
+ *
+ * @author Mikhail Golubev
+ */
+public class JiraLegacyApi extends JiraRemoteApi {
+
+ private static final Logger LOG = Logger.getInstance(JiraLegacyApi.class);
+
+ @NonNls private static final String RSS_SEARCH_PATH = "/sr/jira.issueviews:searchrequest-xml/temp/SearchRequest.xml";
+ public static final String RSS_ISSUE_PATH = "/si/jira.issueviews:issue-xml/";
+
+ public JiraLegacyApi(@NotNull JiraRepository repository) {
+ super(repository);
+ }
+
+ @NotNull
+ @Override
+ public List<Task> findTasks(@NotNull String query, int max) throws Exception {
+
+ // Unfortunately, both SOAP and XML-RPC interfaces of JIRA don't allow fetching *all* tasks from server, but
+ // only filtered by some search term (see http://stackoverflow.com/questions/764282/how-can-jira-soap-api-not-have-this-method).
+ // JQL was added in SOAP only since JIRA 4.0 (see method JiraSoapService#getIssuesFromJqlSearch() at
+ // https://docs.atlassian.com/software/jira/docs/api/rpc-jira-plugin/latest/index.html?com/atlassian/jira/rpc/soap/JiraSoapService.html)
+ // So due to this limitation and the need to support these old versions of bug tracker (3.0, 4.2) we need the following ugly and hacky
+ // solution with extracting issues from RSS feed.
+
+ GetMethod method = new GetMethod(myRepository.getUrl() + RSS_SEARCH_PATH);
+ method.setQueryString(new NameValuePair[] {
+ new NameValuePair("tempMax", String.valueOf(max)),
+ new NameValuePair("assignee", TaskUtil.encodeUrl(myRepository.getUsername())),
+ new NameValuePair("reset", "true"),
+ new NameValuePair("sorter/field", "updated"),
+ new NameValuePair("sorter/order", "DESC"),
+ new NameValuePair("pager/start", "0")
+ });
+ return processRSS(method);
+ }
+
+ private List<Task> processRSS(@NotNull GetMethod method) throws Exception {
+ // Basic authorization should be enough
+ int code = myRepository.getHttpClient().executeMethod(method);
+ if (code != HttpStatus.SC_OK) {
+ throw new Exception(TaskBundle.message("failure.http.error", code, method.getStatusText()));
+ }
+ Element root = new SAXBuilder(false).build(method.getResponseBodyAsStream()).getRootElement();
+ Element channel = root.getChild("channel");
+ if (channel != null) {
+ List<Element> children = channel.getChildren("item");
+ LOG.debug("Total issues in JIRA RSS feed: " + children.size());
+ return ContainerUtil.map(children, new Function<Element, Task>() {
+ public Task fun(Element element) {
+ return new JiraSoapTask(element, myRepository);
+ }
+ });
+ }
+ else {
+ LOG.warn("JIRA channel not found");
+ }
+ return ContainerUtil.emptyList();
+ }
+
+ @Nullable
+ @Override
+ public Task findTask(@NotNull String key) throws Exception {
+ try {
+ List<Task> tasks = processRSS(new GetMethod(myRepository.getUrl() + RSS_ISSUE_PATH + key + '/' + key + ".xml"));
+ return tasks.isEmpty() ? null : tasks.get(0);
+ }
+ catch (Exception e) {
+ LOG.warn("Cannot get issue " + key + ": " + e.getMessage());
+ return null;
+ }
+ }
+
+ @NotNull
+ @Override
+ public final ApiType getType() {
+ return ApiType.LEGACY;
+ }
+
+ @Override
+ public void setTaskState(@NotNull Task task, @NotNull TaskState state) throws Exception {
+ throw new Exception(TaskBundle.message("jira.failure.no.state.update"));
+ }
+
+ @Override
+ public void updateTimeSpend(@NotNull LocalTask task, @NotNull String timeSpent, String comment) throws Exception {
+ throw new Exception(TaskBundle.message("jira.failure.no.time.spent"));
+ }
+}
diff --git a/plugins/tasks/tasks-core/jira/src/com/intellij/tasks/jira/soap/JiraSoapApi.java b/plugins/tasks/tasks-core/jira/src/com/intellij/tasks/jira/soap/JiraSoapApi.java
deleted file mode 100644
index 148432902a86..000000000000
--- a/plugins/tasks/tasks-core/jira/src/com/intellij/tasks/jira/soap/JiraSoapApi.java
+++ /dev/null
@@ -1,114 +0,0 @@
-package com.intellij.tasks.jira.soap;
-
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.tasks.LocalTask;
-import com.intellij.tasks.Task;
-import com.intellij.tasks.TaskBundle;
-import com.intellij.tasks.TaskState;
-import com.intellij.tasks.impl.TaskUtil;
-import com.intellij.tasks.jira.JiraRemoteApi;
-import com.intellij.tasks.jira.JiraRepository;
-import com.intellij.util.Function;
-import com.intellij.util.containers.ContainerUtil;
-import org.apache.commons.httpclient.HttpStatus;
-import org.apache.commons.httpclient.NameValuePair;
-import org.apache.commons.httpclient.methods.GetMethod;
-import org.jdom.Element;
-import org.jdom.input.SAXBuilder;
-import org.jetbrains.annotations.NonNls;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.util.List;
-
-/**
- * Legacy SOAP connector restored due to IDEA-120595.
- *
- * @author Mikhail Golubev
- */
-public class JiraSoapApi extends JiraRemoteApi {
-
- private static final Logger LOG = Logger.getInstance(JiraSoapApi.class);
-
- @NonNls private static final String RSS_SEARCH_PATH = "/sr/jira.issueviews:searchrequest-xml/temp/SearchRequest.xml";
- public static final String RSS_ISSUE_PATH = "/si/jira.issueviews:issue-xml/";
-
- public JiraSoapApi(@NotNull JiraRepository repository) {
- super(repository);
- }
-
- @NotNull
- @Override
- public List<Task> findTasks(@NotNull String query, int max) throws Exception {
-
- // Unfortunately, both SOAP and XML-RPC interfaces of JIRA don't allow fetching *all* tasks from server, but
- // only filtered by some search term (see http://stackoverflow.com/questions/764282/how-can-jira-soap-api-not-have-this-method).
- // JQL was added in SOAP only since JIRA 4.0 (see method JiraSoapService#getIssuesFromJqlSearch() at
- // https://docs.atlassian.com/software/jira/docs/api/rpc-jira-plugin/latest/index.html?com/atlassian/jira/rpc/soap/JiraSoapService.html)
- // So due to this limitation and the need to support these old versions of bug tracker (3.0, 4.2) we need the following ugly and hacky
- // solution with extracting issues from RSS feed.
-
- GetMethod method = new GetMethod(myRepository.getUrl() + RSS_SEARCH_PATH);
- method.setQueryString(new NameValuePair[] {
- new NameValuePair("tempMax", String.valueOf(max)),
- new NameValuePair("assignee", TaskUtil.encodeUrl(myRepository.getUsername())),
- new NameValuePair("reset", "true"),
- new NameValuePair("sorter/field", "updated"),
- new NameValuePair("sorter/order", "DESC"),
- new NameValuePair("pager/start", "0")
- });
- return processRSS(method);
- }
-
- private List<Task> processRSS(@NotNull GetMethod method) throws Exception {
- // Basic authorization should be enough
- int code = myRepository.getHttpClient().executeMethod(method);
- if (code != HttpStatus.SC_OK) {
- throw new Exception(TaskBundle.message("failure.http.error", code, method.getStatusText()));
- }
- Element root = new SAXBuilder(false).build(method.getResponseBodyAsStream()).getRootElement();
- Element channel = root.getChild("channel");
- if (channel != null) {
- List<Element> children = channel.getChildren("item");
- LOG.debug("Total issues in JIRA RSS feed: " + children.size());
- return ContainerUtil.map(children, new Function<Element, Task>() {
- public Task fun(Element element) {
- return new JiraSoapTask(element, myRepository);
- }
- });
- }
- else {
- LOG.warn("JIRA channel not found");
- }
- return ContainerUtil.emptyList();
- }
-
- @Nullable
- @Override
- public Task findTask(@NotNull String key) throws Exception {
- try {
- List<Task> tasks = processRSS(new GetMethod(myRepository.getUrl() + RSS_ISSUE_PATH + key + '/' + key + ".xml"));
- return tasks.isEmpty() ? null : tasks.get(0);
- }
- catch (Exception e) {
- LOG.warn("Cannot get issue " + key + ": " + e.getMessage());
- return null;
- }
- }
-
- @NotNull
- @Override
- public final ApiType getType() {
- return ApiType.SOAP;
- }
-
- @Override
- public void setTaskState(@NotNull Task task, @NotNull TaskState state) throws Exception {
- throw new Exception(TaskBundle.message("jira.failure.no.state.update"));
- }
-
- @Override
- public void updateTimeSpend(@NotNull LocalTask task, @NotNull String timeSpent, String comment) throws Exception {
- throw new Exception(TaskBundle.message("jira.failure.no.time.spent"));
- }
-}
diff --git a/plugins/tasks/tasks-core/src/META-INF/plugin.xml b/plugins/tasks/tasks-core/src/META-INF/plugin.xml
index 36268b408073..6f3ac82f463a 100644
--- a/plugins/tasks/tasks-core/src/META-INF/plugin.xml
+++ b/plugins/tasks/tasks-core/src/META-INF/plugin.xml
@@ -103,7 +103,7 @@
<extensions defaultExtensionNs="com.intellij">
<errorHandler implementation="com.intellij.diagnostic.ITNReporter"/>
- <projectConfigurable instance="com.intellij.tasks.config.TaskConfigurable" id="tasks" displayName="Tasks" nonDefaultProject="true">
+ <projectConfigurable groupId="tools" instance="com.intellij.tasks.config.TaskConfigurable" id="tasks" displayName="Tasks" nonDefaultProject="true">
<configurable instance="com.intellij.tasks.config.TaskRepositoriesConfigurable" displayName="Servers" id="tasks.servers"/>
</projectConfigurable>
diff --git a/plugins/tasks/tasks-core/src/com/intellij/tasks/trello/TrelloRepository.java b/plugins/tasks/tasks-core/src/com/intellij/tasks/trello/TrelloRepository.java
index f7723a9f96fa..eafe341d3989 100644
--- a/plugins/tasks/tasks-core/src/com/intellij/tasks/trello/TrelloRepository.java
+++ b/plugins/tasks/tasks-core/src/com/intellij/tasks/trello/TrelloRepository.java
@@ -107,8 +107,8 @@ public final class TrelloRepository extends BaseRepositoryImpl {
}
@Override
- public Task[] getIssues(@Nullable String query, int max, long since) throws Exception {
- List<TrelloCard> cards = fetchCards();
+ public Task[] getIssues(@Nullable String query, int offset, int limit, boolean withClosed) throws Exception {
+ List<TrelloCard> cards = fetchCards(offset + limit, withClosed);
return ContainerUtil.map2Array(cards, Task.class, new Function<TrelloCard, Task>() {
@Override
public Task fun(TrelloCard card) {
@@ -120,17 +120,24 @@ public final class TrelloRepository extends BaseRepositoryImpl {
@Nullable
@Override
public Task findTask(@NotNull String id) throws Exception {
- String url = TRELLO_API_BASE_URL + "/cards/" + id + "?actions=commentCard&fields=" + encodeUrl(TrelloCard.REQUIRED_FIELDS) ;
+ TrelloCard card = fetchCardById(id);
+ return card != null ? new TrelloTask(card, this) : null;
+ }
+
+ @Nullable
+ public TrelloCard fetchCardById(@NotNull String id) throws Exception {
+ String url = TRELLO_API_BASE_URL + "/cards/" + id + "?actions=commentCard&fields=" + encodeUrl(TrelloCard.REQUIRED_FIELDS);
try {
- return new TrelloTask(makeRequestAndDeserializeJsonResponse(url, TrelloCard.class), this);
+ return makeRequestAndDeserializeJsonResponse(url, TrelloCard.class);
}
// Trello returns string "The requested resource was not found." or "invalid id"
- // if card can't be found
+ // if card can't be found, which not only cannot be deserialized, but also not valid JSON at all.
catch (JsonParseException e) {
return null;
}
}
+
@Nullable
public TrelloUser getCurrentUser() {
return myCurrentUser;
@@ -241,7 +248,7 @@ public final class TrelloRepository extends BaseRepositoryImpl {
}
@NotNull
- private List<TrelloCard> fetchCards() throws Exception {
+ public List<TrelloCard> fetchCards(int limit, boolean withClosed) throws Exception {
boolean fromList = false;
// choose most appropriate card provider
String baseUrl;
@@ -258,8 +265,10 @@ public final class TrelloRepository extends BaseRepositoryImpl {
else {
throw new IllegalStateException("Not configured");
}
- String allCardsUrl = baseUrl + "?filter=all&fields=" + encodeUrl(TrelloCard.REQUIRED_FIELDS);
- List<TrelloCard> cards = makeRequestAndDeserializeJsonResponse(allCardsUrl, TrelloUtil.LIST_OF_CARDS_TYPE);
+ String fetchCardsUrl = baseUrl + "?fields=" + encodeUrl(TrelloCard.REQUIRED_FIELDS) + "&limit" + limit;
+ // 'visible' filter for some reason is not supported for lists
+ fetchCardsUrl += withClosed || fromList ? "&filter=all" : "&filter=visible";
+ List<TrelloCard> cards = makeRequestAndDeserializeJsonResponse(fetchCardsUrl, TrelloUtil.LIST_OF_CARDS_TYPE);
LOG.debug("Total " + cards.size() + " cards downloaded");
if (!myIncludeAllCards) {
cards = ContainerUtil.filter(cards, new Condition<TrelloCard>() {
@@ -270,7 +279,10 @@ public final class TrelloRepository extends BaseRepositoryImpl {
});
LOG.debug("Total " + cards.size() + " cards after filtering");
}
- if (!fromList) {
+ if (!cards.isEmpty()) {
+ if (fromList) {
+ baseUrl = TRELLO_API_BASE_URL + "/boards/" + cards.get(0).getIdBoard() + "/cards";
+ }
// fix for IDEA-111470 and IDEA-111475
// Select IDs of visible cards, e.d. cards that either archived explicitly, belong to archived list or closed board.
// This information can't be extracted from single card description, because its 'closed' field
diff --git a/plugins/tasks/tasks-core/src/com/intellij/tasks/trello/model/TrelloCard.java b/plugins/tasks/tasks-core/src/com/intellij/tasks/trello/model/TrelloCard.java
index f4fc18d42500..4aebd6a67385 100644
--- a/plugins/tasks/tasks-core/src/com/intellij/tasks/trello/model/TrelloCard.java
+++ b/plugins/tasks/tasks-core/src/com/intellij/tasks/trello/model/TrelloCard.java
@@ -44,7 +44,6 @@ public class TrelloCard extends TrelloModel {
@SerializedName("desc")
private String description;
private String url;
- @SerializedName("due")
private boolean closed;
private Date dateLastActivity;
private List<TrelloLabel> labels;
@@ -91,7 +90,7 @@ public class TrelloCard extends TrelloModel {
}
@Override
- public void setName(String name) {
+ public void setName(@NotNull String name) {
this.name = name;
}
diff --git a/plugins/tasks/tasks-tests/test/com/intellij/tasks/integration/live/LiveIntegrationTestCase.java b/plugins/tasks/tasks-tests/test/com/intellij/tasks/integration/live/LiveIntegrationTestCase.java
new file mode 100644
index 000000000000..c5793503cfcd
--- /dev/null
+++ b/plugins/tasks/tasks-tests/test/com/intellij/tasks/integration/live/LiveIntegrationTestCase.java
@@ -0,0 +1,22 @@
+package com.intellij.tasks.integration.live;
+
+import com.intellij.tasks.TaskManagerTestCase;
+import com.intellij.tasks.TaskRepository;
+
+/**
+ * @author Mikhail Golubev
+ */
+public abstract class LiveIntegrationTestCase<T extends TaskRepository> extends TaskManagerTestCase {
+ protected T myRepository;
+
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+ myRepository = createRepository();
+ }
+
+ /**
+ * @return new instance of task repository <b>with authenticated user<b/>
+ */
+ protected abstract T createRepository() throws Exception;
+}
diff --git a/plugins/tasks/tasks-tests/test/com/intellij/tasks/integration/live/TrelloIntegrationTest.java b/plugins/tasks/tasks-tests/test/com/intellij/tasks/integration/live/TrelloIntegrationTest.java
new file mode 100644
index 000000000000..3da6ad3d82d7
--- /dev/null
+++ b/plugins/tasks/tasks-tests/test/com/intellij/tasks/integration/live/TrelloIntegrationTest.java
@@ -0,0 +1,142 @@
+package com.intellij.tasks.integration.live;
+
+import com.intellij.openapi.util.Condition;
+import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.tasks.trello.TrelloRepository;
+import com.intellij.tasks.trello.TrelloRepositoryType;
+import com.intellij.tasks.trello.model.*;
+import com.intellij.util.Function;
+import com.intellij.util.containers.ContainerUtil;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * @author Mikhail Golubev
+ */
+public class TrelloIntegrationTest extends LiveIntegrationTestCase<TrelloRepository> {
+
+ private static final String BOARD_1_NAME = "Board 1";
+ private static final String BOARD_1_ID = "53c416a8a6e5a78753562043";
+
+ private static final String LIST_1_1_NAME = "List 1-1";
+ private static final String LIST_1_1_ID = "53c416a8a6e5a78753562044";
+
+ private static final String CARD_1_1_1_NAME = "Card 1-1-1";
+ private static final String CARD_1_1_1_ID = "53c416d8b4bd36fb078446e5";
+
+ @Override
+ protected TrelloRepository createRepository() throws Exception {
+ TrelloRepository repository = new TrelloRepository(new TrelloRepositoryType());
+ String token = System.getProperty("tasks.tests.trello.token");
+ if (StringUtil.isEmpty(token)) {
+ throw new AssertionError("Authorization token is not set");
+ }
+ repository.setPassword(token);
+ TrelloUser user = repository.fetchUserByToken();
+ assertNotNull(user);
+ repository.setCurrentUser(user);
+ return repository;
+ }
+
+ // TODO Check closed tasks exclusion
+ // TODO Check various cards visibility corner cases
+
+ public void testFetchBoard() throws Exception {
+ TrelloBoard board = myRepository.fetchBoardById(BOARD_1_ID);
+ assertNotNull(board);
+ assertEquals(BOARD_1_NAME, board.getName());
+ }
+
+ public void testFetchList() throws Exception {
+ TrelloList list = myRepository.fetchListById(LIST_1_1_ID);
+ assertNotNull(list);
+ assertEquals(LIST_1_1_NAME, list.getName());
+ }
+
+ public void testFetchCard() throws Exception {
+ TrelloCard card = myRepository.fetchCardById(CARD_1_1_1_ID);
+ assertNotNull(card);
+ assertEquals(CARD_1_1_1_NAME, card.getName());
+ }
+
+ public void testFetchBoardsOfUser() throws Exception {
+ List<TrelloBoard> boards = myRepository.fetchUserBoards();
+ assertEquals(2, boards.size());
+ assertObjectsNamed("All boards of the user should be included", boards, "Board 1", "Board 2");
+ }
+
+ public void testFetchListsOfBoard() throws Exception {
+ TrelloBoard selectedBoard = myRepository.fetchBoardById(BOARD_1_ID);
+ assertNotNull(selectedBoard);
+ myRepository.setCurrentBoard(selectedBoard);
+ List<TrelloList> lists = myRepository.fetchBoardLists();
+ assertEquals(3, lists.size());
+ assertObjectsNamed("All lists of the board should be included", lists, "List 1-1", "List 1-2", "List 1-3");
+ }
+
+ @NotNull
+ private List<TrelloCard> fetchCards(@Nullable String boardId, @Nullable String listId, boolean withClosed) throws Exception {
+ if (boardId != null) {
+ TrelloBoard selectedBoard = myRepository.fetchBoardById(BOARD_1_ID);
+ assertNotNull(selectedBoard);
+ myRepository.setCurrentBoard(selectedBoard);
+ }
+ if (listId != null) {
+ TrelloList selectedList = myRepository.fetchListById(LIST_1_1_ID);
+ assertNotNull(selectedList);
+ myRepository.setCurrentList(selectedList);
+ }
+ return myRepository.fetchCards(100, withClosed);
+ }
+
+ public void testFetchingCardsOfUser() throws Exception {
+ myRepository.setIncludeAllCards(true);
+ List<TrelloCard> cards = fetchCards(null, null, true);
+ assertObjectsNamed("All cards assigned to user should be included", cards, "Card 1-1-1");
+ }
+
+ public void testFetchingCardsOfBoard() throws Exception {
+ myRepository.setIncludeAllCards(true);
+ List<TrelloCard> cards = fetchCards(BOARD_1_ID, null, true);
+ assertObjectsNamed("All cards of the board should be included",
+ cards, "Card 1-1-1", "Card 1-1-2", "Card 1-2-1", "Card 1-3-1", "Archived Card");
+ }
+
+ public void testCardsFilteringByMembership() throws Exception {
+ myRepository.setIncludeAllCards(true);
+ List<TrelloCard> allCards = fetchCards(BOARD_1_ID, LIST_1_1_ID, true);
+ assertObjectsNamed("All cards of the list should be included", allCards, "Card 1-1-1", "Card 1-1-2", "Archived Card");
+
+ myRepository.setIncludeAllCards(false);
+ List<TrelloCard> assignedCards = fetchCards(BOARD_1_ID, LIST_1_1_ID, true);
+ assertObjectsNamed("Only cards of the list assigned to user should be included", assignedCards, "Card 1-1-1");
+ }
+
+ public void testCardsFilteringByStatus() throws Exception {
+ myRepository.setIncludeAllCards(true);
+ List<TrelloCard> allCards = fetchCards(BOARD_1_ID, LIST_1_1_NAME, true);
+ assertObjectsNamed("All cards of the list should be included", allCards, "Card 1-1-1", "Card 1-1-2", "Archived Card");
+
+ TrelloCard card = ContainerUtil.find(allCards, new Condition<TrelloCard>() {
+ @Override
+ public boolean value(TrelloCard card) {
+ return card.getName().equals("Archived Card");
+ }
+ });
+ assertNotNull(card);
+ assertTrue(card.isClosed());
+ assertFalse(card.isVisible());
+ }
+
+ static void assertObjectsNamed(@NotNull String message, @NotNull Collection<? extends TrelloModel> objects, @NotNull String... names) {
+ assertEquals(message, ContainerUtil.newHashSet(names), ContainerUtil.map2Set(objects, new Function<TrelloModel, String>() {
+ @Override
+ public String fun(TrelloModel model) {
+ return model.getName();
+ }
+ }));
+ }
+}
diff --git a/plugins/terminal/resources/META-INF/terminal.xml b/plugins/terminal/resources/META-INF/terminal.xml
index ed2a2b56ec64..11a18e18d81f 100644
--- a/plugins/terminal/resources/META-INF/terminal.xml
+++ b/plugins/terminal/resources/META-INF/terminal.xml
@@ -11,7 +11,7 @@
<toolWindow id="Terminal" anchor="bottom" icon="TerminalIcons.OpenTerminal_13x13"
factoryClass="org.jetbrains.plugins.terminal.TerminalToolWindowFactory" secondary="false"/>
- <projectConfigurable instance="org.jetbrains.plugins.terminal.TerminalOptionsConfigurable"/>
+ <projectConfigurable groupId="tools" displayName="Terminal" instance="org.jetbrains.plugins.terminal.TerminalOptionsConfigurable"/>
<fileEditorProvider implementation="org.jetbrains.plugins.terminal.vfs.TerminalSessionEditorProvider"/>
</extensions>
diff --git a/plugins/typeMigration/src/META-INF/plugin.xml b/plugins/typeMigration/src/META-INF/plugin.xml
deleted file mode 100644
index 93ad2032892c..000000000000
--- a/plugins/typeMigration/src/META-INF/plugin.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-<idea-plugin>
- <name>Type Migration</name>
- <description>
- <![CDATA[
- This plugin adds the type migration refactoring.
- The following features are available:
- <ul>
- <li>Dedicated Refactoring Dialog. (Refactor | Type Migration)</li>
- <li>Ability to review type migration results. (Refactor | Migration | Preview)</li>
- <li>Ability to automatically change a member type or data flow dependent type entries.</li>
- <li>Ability to convert variable or method return type between arrays and collections.</li>
- </ul>
- ]]>
- </description>
- <vendor>JetBrains</vendor>
- <extensions defaultExtensionNs="com.intellij">
- <errorHandler implementation="com.intellij.diagnostic.ITNReporter"/>
- <codeInsight.changeVariableTypeQuickFixProvider
- implementation="com.intellij.refactoring.typeMigration.TypeMigrationVariableTypeFixProvider"/>
- <conversion.rule implementation="com.intellij.refactoring.typeMigration.rules.ListArrayConversionRule"/>
- <conversion.rule implementation="com.intellij.refactoring.typeMigration.rules.AtomicConversionRule"/>
- <conversion.rule implementation="com.intellij.refactoring.typeMigration.rules.BoxingTypeConversionRule"/>
- <conversion.rule implementation="com.intellij.refactoring.typeMigration.rules.ElementToArrayConversionRule"/>
- <conversion.rule implementation="com.intellij.refactoring.typeMigration.rules.ThreadLocalConversionRule"/>
- <intentionAction>
- <className>com.intellij.refactoring.typeMigration.intentions.ConvertFieldToAtomicIntention</className>
- <category>Concurrency</category>
- </intentionAction>
- <intentionAction>
- <className>com.intellij.refactoring.typeMigration.intentions.ConvertFieldToThreadLocalIntention</className>
- <category>Concurrency</category>
- </intentionAction>
- <intentionAction>
- <className>com.intellij.refactoring.typeMigration.intentions.ChangeClassParametersIntention</className>
- <category>Declaration</category>
- </intentionAction>
- </extensions>
- <depends>Structural Search</depends>
-</idea-plugin>
diff --git a/plugins/typeMigration/test/com/intellij/codeInsight/ConvertToAtomicIntentionTest.java b/plugins/typeMigration/test/com/intellij/codeInsight/ConvertToAtomicIntentionTest.java
deleted file mode 100644
index 4a0b73dde767..000000000000
--- a/plugins/typeMigration/test/com/intellij/codeInsight/ConvertToAtomicIntentionTest.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package com.intellij.codeInsight;
-
-import com.intellij.codeInsight.daemon.quickFix.LightQuickFixParameterizedTestCase;
-import com.intellij.openapi.application.PluginPathManager;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * @author anna
- */
-public class ConvertToAtomicIntentionTest extends LightQuickFixParameterizedTestCase {
- @Override
- protected boolean shouldBeAvailableAfterExecution() {
- return true;
- }
-
- @Override
- protected String getBasePath() {
- return "/intentions/atomic";
- }
-
- @NotNull
- @Override
- protected String getTestDataPath() {
- return PluginPathManager.getPluginHomePath("typeMigration") + "/testData";
- }
-
- public void test() throws Exception {
- doAllTests();
- }
-} \ No newline at end of file
diff --git a/plugins/typeMigration/test/com/intellij/codeInsight/ConvertToThreadLocalIntentionTest.java b/plugins/typeMigration/test/com/intellij/codeInsight/ConvertToThreadLocalIntentionTest.java
deleted file mode 100644
index 389ced7354af..000000000000
--- a/plugins/typeMigration/test/com/intellij/codeInsight/ConvertToThreadLocalIntentionTest.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package com.intellij.codeInsight;
-
-import com.intellij.codeInsight.daemon.quickFix.LightQuickFixParameterizedTestCase;
-import com.intellij.openapi.application.PluginPathManager;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * @author anna
- */
-public class ConvertToThreadLocalIntentionTest extends LightQuickFixParameterizedTestCase {
- @Override
- protected boolean shouldBeAvailableAfterExecution() {
- return true;
- }
-
- @Override
- protected String getBasePath() {
- return "/intentions/threadLocal";
- }
-
- @NotNull
- @Override
- protected String getTestDataPath() {
- return PluginPathManager.getPluginHomePath("typeMigration") + "/testData";
- }
-
- public void test() throws Exception {
- doAllTests();
- }
-} \ No newline at end of file
diff --git a/plugins/typeMigration/test/com/intellij/refactoring/ChangeTypeSignatureTest.java b/plugins/typeMigration/test/com/intellij/refactoring/ChangeTypeSignatureTest.java
deleted file mode 100644
index e85b2f79fd30..000000000000
--- a/plugins/typeMigration/test/com/intellij/refactoring/ChangeTypeSignatureTest.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * User: anna
- * Date: 18-Mar-2008
- */
-package com.intellij.refactoring;
-
-import com.intellij.openapi.application.PluginPathManager;
-import com.intellij.psi.*;
-import com.intellij.psi.impl.source.PsiImmediateClassType;
-import com.intellij.psi.search.GlobalSearchScope;
-import com.intellij.psi.util.PsiTreeUtil;
-import com.intellij.refactoring.typeMigration.TypeMigrationLabeler;
-import com.intellij.refactoring.typeMigration.TypeMigrationProcessor;
-import com.intellij.refactoring.typeMigration.TypeMigrationRules;
-import com.intellij.testFramework.LightCodeInsightTestCase;
-import org.jetbrains.annotations.NotNull;
-
-public class ChangeTypeSignatureTest extends LightCodeInsightTestCase {
- @NotNull
- @Override
- protected String getTestDataPath() {
- return PluginPathManager.getPluginHomePath("typeMigration") + "/testData";
- }
-
- private void doTest(boolean success, String migrationTypeText) throws Exception {
- String dataPath = "/refactoring/changeTypeSignature/";
- configureByFile(dataPath + getTestName(false) + ".java");
- final PsiFile file = getFile();
- final PsiElement element = file.findElementAt(getEditor().getCaretModel().getOffset());
- final PsiReferenceParameterList parameterList = PsiTreeUtil.getParentOfType(element, PsiReferenceParameterList.class);
- assert parameterList != null;
- final PsiClass superClass = (PsiClass)((PsiJavaCodeReferenceElement)parameterList.getParent()).resolve();
- assert superClass != null;
-
- PsiType migrationType = getJavaFacade().getElementFactory().createTypeFromText(migrationTypeText, null);
-
- try {
- final TypeMigrationRules rules = new TypeMigrationRules(TypeMigrationLabeler.getElementType(parameterList));
- rules.setMigrationRootType(PsiSubstitutor.EMPTY.put(superClass.getTypeParameters()[0], migrationType).substitute(new PsiImmediateClassType(superClass, PsiSubstitutor.EMPTY)));
- rules.setBoundScope(GlobalSearchScope.projectScope(getProject()));
- new TypeMigrationProcessor(getProject(), parameterList, rules).run();
- if (success) {
- checkResultByFile(dataPath + getTestName(false) + ".java.after");
- } else {
- fail("Conflicts should be detected");
- }
- }
- catch (RuntimeException e) {
- if (success) {
- e.printStackTrace();
- fail("Conflicts should not appear");
- }
- }
- }
-
- private void doTest(boolean success) throws Exception {
- doTest(success, CommonClassNames.JAVA_LANG_OBJECT);
- }
-
- public void testListTypeArguments() throws Exception {
- doTest(true);
- }
-
- public void testFieldUsage() throws Exception {
- doTest(true);
- }
-
- public void testFieldUsage1() throws Exception {
- doTest(true);
- }
-
- public void testReturnType() throws Exception {
- doTest(true);
- }
-
- public void testReturnType1() throws Exception {
- doTest(true);
- }
-
- public void testReturnType2() throws Exception {
- doTest(true);
- }
-
- public void testPassedParameter() throws Exception {
- doTest(true);
- }
-
- public void testPassedParameter1() throws Exception {
- doTest(true, "java.lang.Integer");
- }
-
- public void testPassedParameter2() throws Exception {
- doTest(true);
- }
-
- public void testUsedInSuper() throws Exception {
- doTest(true);
- }
-
- public void testCompositeReturnType() throws Exception {
- doTest(true);
- }
-
- public void testTypeHierarchy() throws Exception {
- doTest(true);
- }
-
- public void testTypeHierarchy1() throws Exception {
- doTest(true);
- }
-
- public void testTypeHierarchy2() throws Exception {
- doTest(true);
- }
-
- public void testTypeHierarchyFieldUsage() throws Exception {
- doTest(true);
- }
-
- public void testTypeHierarchyFieldUsageConflict() throws Exception {
- doTest(true);
- }
-
- public void testParameterMigration() throws Exception {
- doTest(true);
- }
-
- public void testParameterMigration1() throws Exception {
- doTest(true, "java.lang.Integer");
- }
-
- public void testParameterMigration2() throws Exception {
- doTest(true, "java.lang.Integer");
- }
-
- public void testFieldTypeMigration() throws Exception {
- doTest(true, "java.lang.String");
- }
-
- public void testMethodReturnTypeMigration() throws Exception {
- doTest(true, "java.lang.Integer");
- }
-
- @Override
- protected boolean isRunInWriteAction() {
- return false;
- }
-} \ No newline at end of file
diff --git a/plugins/typeMigration/test/com/intellij/refactoring/TypeMigrationTestBase.java b/plugins/typeMigration/test/com/intellij/refactoring/TypeMigrationTestBase.java
deleted file mode 100644
index 8f75c4921a1c..000000000000
--- a/plugins/typeMigration/test/com/intellij/refactoring/TypeMigrationTestBase.java
+++ /dev/null
@@ -1,193 +0,0 @@
-package com.intellij.refactoring;
-
-import com.intellij.openapi.application.PluginPathManager;
-import com.intellij.openapi.command.WriteCommandAction;
-import com.intellij.openapi.fileEditor.FileDocumentManager;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.util.io.FileUtil;
-import com.intellij.openapi.vfs.LocalFileSystem;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.psi.PsiClass;
-import com.intellij.psi.PsiElement;
-import com.intellij.psi.PsiField;
-import com.intellij.psi.PsiType;
-import com.intellij.psi.search.GlobalSearchScope;
-import com.intellij.psi.search.LocalSearchScope;
-import com.intellij.refactoring.typeMigration.TypeMigrationProcessor;
-import com.intellij.refactoring.typeMigration.TypeMigrationRules;
-import com.intellij.usageView.UsageInfo;
-import org.jetbrains.annotations.NonNls;
-import org.jetbrains.annotations.NotNull;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.PrintWriter;
-
-/**
- * @author anna
- * Date: 30-Apr-2008
- */
-public abstract class TypeMigrationTestBase extends MultiFileTestCase {
- @Override
- protected String getTestDataPath() {
- return PluginPathManager.getPluginHomePath("typeMigration") + "/testData";
- }
-
- protected void doTestFieldType(@NonNls String fieldName, PsiType fromType, PsiType toType) {
- doTestFieldType(fieldName, "Test", fromType, toType);
- }
-
- protected void doTestFieldType(@NonNls final String fieldName, String className, final PsiType rootType, final PsiType migrationType) {
- final RulesProvider provider = new RulesProvider() {
- @Override
- public TypeMigrationRules provide() throws Exception {
- final TypeMigrationRules rules = new TypeMigrationRules(rootType);
- rules.setMigrationRootType(migrationType);
- return rules;
- }
-
- @Override
- public PsiElement victims(PsiClass aClass) {
- final PsiField field = aClass.findFieldByName(fieldName, false);
- assert field != null : fieldName + " not found in " + aClass;
- return field;
- }
- };
-
- start(provider, className);
- }
-
- protected void doTestMethodType(@NonNls final String methodName, final PsiType rootType, final PsiType migrationType) {
- doTestMethodType(methodName, "Test", rootType, migrationType);
- }
-
- protected void doTestMethodType(@NonNls final String methodName, @NonNls String className, final PsiType rootType, final PsiType migrationType) {
- final RulesProvider provider = new RulesProvider() {
- @Override
- public TypeMigrationRules provide() throws Exception {
- final TypeMigrationRules rules = new TypeMigrationRules(rootType);
- rules.setMigrationRootType(migrationType);
- return rules;
- }
-
- @Override
- public PsiElement victims(PsiClass aClass) {
- return aClass.findMethodsByName(methodName, false)[0];
- }
- };
-
- start(provider, className);
- }
-
- protected void doTestFirstParamType(@NonNls final String methodName, final PsiType rootType, final PsiType migrationType) {
- doTestFirstParamType(methodName, "Test", rootType, migrationType);
- }
-
- protected void doTestFirstParamType(@NonNls final String methodName, String className, final PsiType rootType, final PsiType migrationType) {
- final RulesProvider provider = new RulesProvider() {
- @Override
- public TypeMigrationRules provide() throws Exception {
- final TypeMigrationRules rules = new TypeMigrationRules(rootType);
- rules.setMigrationRootType(migrationType);
- return rules;
- }
-
- @Override
- public PsiElement victims(PsiClass aClass) {
- return aClass.findMethodsByName(methodName, false)[0].getParameterList().getParameters()[0];
- }
- };
-
- start(provider, className);
- }
-
- public void start(final RulesProvider provider) {
- start(provider, "Test");
- }
-
- public void start(final RulesProvider provider, final String className) {
- doTest(new PerformAction() {
- @Override
- public void performAction(VirtualFile rootDir, VirtualFile rootAfter) throws Exception {
- TypeMigrationTestBase.this.performAction(className, rootDir.getName(), provider);
- }
- });
- }
-
- private void performAction(String className, String rootDir, RulesProvider provider) throws Exception {
- PsiClass aClass = myJavaFacade.findClass(className, GlobalSearchScope.allScope(getProject()));
-
- assertNotNull("Class " + className + " not found", aClass);
-
- final TypeMigrationRules rules = provider.provide();
- rules.setBoundScope(new LocalSearchScope(aClass.getContainingFile()));
- final TestTypeMigrationProcessor pr = new TestTypeMigrationProcessor(getProject(), provider.victims(aClass), rules);
-
- final UsageInfo[] usages = pr.findUsages();
- final String report = pr.getLabeler().getMigrationReport();
-
- WriteCommandAction.runWriteCommandAction(null, new Runnable() {
- public void run() {
- pr.performRefactoring(usages);
- }
- });
-
-
- String itemName = className + ".items";
- String patternName = getTestDataPath() + getTestRoot() + getTestName(true) + "/after/" + itemName;
-
- File patternFile = new File(patternName);
-
- if (!patternFile.exists()) {
- PrintWriter writer = new PrintWriter(new FileOutputStream(patternFile));
- try {
- writer.print(report);
- writer.close();
- }
- finally {
- writer.close();
- }
-
- System.out.println("Pattern not found, file " + patternName + " created.");
-
- LocalFileSystem.getInstance().refreshAndFindFileByIoFile(patternFile);
- }
-
- File graFile = new File(FileUtil.getTempDirectory() + File.separator + rootDir + File.separator + itemName);
-
- PrintWriter writer = new PrintWriter(new FileOutputStream(graFile));
- try {
- writer.print(report);
- writer.close();
- }
- finally {
- writer.close();
- }
-
- LocalFileSystem.getInstance().refreshAndFindFileByIoFile(graFile);
- FileDocumentManager.getInstance().saveAllDocuments();
- }
-
- interface RulesProvider {
- TypeMigrationRules provide() throws Exception;
-
- PsiElement victims(PsiClass aClass);
- }
-
- private static class TestTypeMigrationProcessor extends TypeMigrationProcessor {
- public TestTypeMigrationProcessor(final Project project, final PsiElement root, final TypeMigrationRules rules) {
- super(project, root, rules);
- }
-
- @NotNull
- @Override
- public UsageInfo[] findUsages() {
- return super.findUsages();
- }
-
- @Override
- public void performRefactoring(final UsageInfo[] usages) {
- super.performRefactoring(usages);
- }
- }
-} \ No newline at end of file
diff --git a/plugins/ui-designer/src/META-INF/plugin.xml b/plugins/ui-designer/src/META-INF/plugin.xml
index 6724c40198dd..bca8934330a4 100644
--- a/plugins/ui-designer/src/META-INF/plugin.xml
+++ b/plugins/ui-designer/src/META-INF/plugin.xml
@@ -33,7 +33,7 @@
<i18nInspectionTool implementation="com.intellij.uiDesigner.i18n.I18nFormInspection"/>
<java15InspectionTool implementation="com.intellij.uiDesigner.inspections.Java15FormInspection"/>
- <projectConfigurable instance="com.intellij.uiDesigner.GuiDesignerConfigurable" id="project.propGUI" key="title.gui.designer"
+ <projectConfigurable groupId="editor" instance="com.intellij.uiDesigner.GuiDesignerConfigurable" id="project.propGUI" key="title.gui.designer"
bundle="messages.UIDesignerBundle"/>
<favoriteNodeProvider implementation="com.intellij.uiDesigner.projectView.UIDesignerFavoriteNodeProvider"/>
diff --git a/plugins/xpath/xpath-view/src/META-INF/plugin.xml b/plugins/xpath/xpath-view/src/META-INF/plugin.xml
index 65a942a56ba3..2030b75c8d0a 100644
--- a/plugins/xpath/xpath-view/src/META-INF/plugin.xml
+++ b/plugins/xpath/xpath-view/src/META-INF/plugin.xml
@@ -59,7 +59,7 @@
serviceInterface="org.intellij.lang.xpath.xslt.psi.XsltElementFactory"
serviceImplementation="org.intellij.lang.xpath.xslt.psi.impl.XsltElementFactoryImpl" />
- <projectConfigurable instance="org.intellij.lang.xpath.xslt.associations.impl.FileAssociationsConfigurable" id="xslt.associations" displayName="XSLT File Associations" nonDefaultProject="true" />
+ <projectConfigurable groupId="language" instance="org.intellij.lang.xpath.xslt.associations.impl.FileAssociationsConfigurable" id="xslt.associations" displayName="XSLT File Associations" nonDefaultProject="true" />
<projectService
serviceInterface="org.intellij.lang.xpath.xslt.associations.impl.FileAssociationsConfigurable$UIState"
@@ -137,8 +137,8 @@
<category>XSLT</category>
</intentionAction>
- <applicationConfigurable instance="org.intellij.plugins.xpathView.XPathConfigurable" id="xpath.settings" displayName="XPath Viewer" />
- <applicationConfigurable instance="org.intellij.lang.xpath.xslt.impl.XsltConfigImpl$UIImpl" id="settings.xslt"
+ <applicationConfigurable groupId="tools" instance="org.intellij.plugins.xpathView.XPathConfigurable" id="xpath.settings" displayName="XPath Viewer" />
+ <applicationConfigurable groupId="language" instance="org.intellij.lang.xpath.xslt.impl.XsltConfigImpl$UIImpl" id="settings.xslt"
displayName="XSLT"/>
<fileIconPatcher implementation="org.intellij.lang.xpath.xslt.impl.XsltIconProvider"/>
diff --git a/python/helpers/coverage/__init__.py b/python/helpers/coverage/__init__.py
index d8dbc0f6dc88..193b7a107ebd 100644
--- a/python/helpers/coverage/__init__.py
+++ b/python/helpers/coverage/__init__.py
@@ -5,19 +5,13 @@ http://nedbatchelder.com/code/coverage
"""
-__version__ = "3.5" # see detailed history in CHANGES.txt
-
-__url__ = "http://nedbatchelder.com/code/coverage"
-if max(__version__).isalpha():
- # For pre-releases, use a version-specific URL.
- __url__ += "/" + __version__
+from coverage.version import __version__, __url__
from coverage.control import coverage, process_startup
from coverage.data import CoverageData
from coverage.cmdline import main, CoverageScript
from coverage.misc import CoverageException
-
# Module-level functions. The original API to this module was based on
# functions defined directly in the module, with a singleton of the coverage()
# class. That design hampered programmability, so the current api uses
@@ -36,12 +30,34 @@ def _singleton_method(name):
called.
"""
+ # Disable pylint msg W0612, because a bunch of variables look unused, but
+ # they're accessed via locals().
+ # pylint: disable=W0612
+
def wrapper(*args, **kwargs):
"""Singleton wrapper around a coverage method."""
global _the_coverage
if not _the_coverage:
_the_coverage = coverage(auto_data=True)
return getattr(_the_coverage, name)(*args, **kwargs)
+
+ import inspect
+ meth = getattr(coverage, name)
+ args, varargs, kw, defaults = inspect.getargspec(meth)
+ argspec = inspect.formatargspec(args[1:], varargs, kw, defaults)
+ docstring = meth.__doc__
+ wrapper.__doc__ = ("""\
+ A first-use-singleton wrapper around coverage.%(name)s.
+
+ This wrapper is provided for backward compatibility with legacy code.
+ New code should use coverage.%(name)s directly.
+
+ %(name)s%(argspec)s:
+
+ %(docstring)s
+ """ % locals()
+ )
+
return wrapper
@@ -57,10 +73,26 @@ report = _singleton_method('report')
annotate = _singleton_method('annotate')
+# On Windows, we encode and decode deep enough that something goes wrong and
+# the encodings.utf_8 module is loaded and then unloaded, I don't know why.
+# Adding a reference here prevents it from being unloaded. Yuk.
+import encodings.utf_8
+
+# Because of the "from coverage.control import fooey" lines at the top of the
+# file, there's an entry for coverage.coverage in sys.modules, mapped to None.
+# This makes some inspection tools (like pydoc) unable to find the class
+# coverage.coverage. So remove that entry.
+import sys
+try:
+ del sys.modules['coverage.coverage']
+except KeyError:
+ pass
+
+
# COPYRIGHT AND LICENSE
#
# Copyright 2001 Gareth Rees. All rights reserved.
-# Copyright 2004-2010 Ned Batchelder. All rights reserved.
+# Copyright 2004-2013 Ned Batchelder. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
diff --git a/python/helpers/coverage/__main__.py b/python/helpers/coverage/__main__.py
index af5fa9f6819f..55e0d259e04a 100644
--- a/python/helpers/coverage/__main__.py
+++ b/python/helpers/coverage/__main__.py
@@ -1,3 +1,4 @@
-"""Coverage.py's main entrypoint."""
+"""Coverage.py's main entry point."""
+import sys
from coverage.cmdline import main
-main()
+sys.exit(main())
diff --git a/python/helpers/coverage/annotate.py b/python/helpers/coverage/annotate.py
index a556d853cdbd..5c396784445c 100644
--- a/python/helpers/coverage/annotate.py
+++ b/python/helpers/coverage/annotate.py
@@ -2,6 +2,7 @@
import os, re
+from coverage.backward import sorted # pylint: disable=W0622
from coverage.report import Reporter
class AnnotateReporter(Reporter):
@@ -26,20 +27,20 @@ class AnnotateReporter(Reporter):
"""
- def __init__(self, coverage, ignore_errors=False):
- super(AnnotateReporter, self).__init__(coverage, ignore_errors)
+ def __init__(self, coverage, config):
+ super(AnnotateReporter, self).__init__(coverage, config)
self.directory = None
blank_re = re.compile(r"\s*(#|$)")
else_re = re.compile(r"\s*else\s*:\s*(#|$)")
- def report(self, morfs, config, directory=None):
+ def report(self, morfs, directory=None):
"""Run the report.
See `coverage.report()` for arguments.
"""
- self.report_files(self.annotate_file, morfs, config, directory)
+ self.report_files(self.annotate_file, morfs, directory)
def annotate_file(self, cu, analysis):
"""Annotate a single file.
@@ -59,9 +60,9 @@ class AnnotateReporter(Reporter):
dest_file = filename + ",cover"
dest = open(dest_file, 'w')
- statements = analysis.statements
- missing = analysis.missing
- excluded = analysis.excluded
+ statements = sorted(analysis.statements)
+ missing = sorted(analysis.missing)
+ excluded = sorted(analysis.excluded)
lineno = 0
i = 0
diff --git a/python/helpers/coverage/backward.py b/python/helpers/coverage/backward.py
index f0a34ac4ceb1..7d2685459782 100644
--- a/python/helpers/coverage/backward.py
+++ b/python/helpers/coverage/backward.py
@@ -6,7 +6,7 @@
# W0611: Unused import blah
# W0622: Redefining built-in blah
-import os, sys
+import os, re, sys
# Python 2.3 doesn't have `set`
try:
@@ -24,6 +24,31 @@ except NameError:
lst.sort()
return lst
+# Python 2.3 doesn't have `reversed`.
+try:
+ reversed = reversed
+except NameError:
+ def reversed(iterable):
+ """A 2.3-compatible implementation of `reversed`."""
+ lst = list(iterable)
+ return lst[::-1]
+
+# rpartition is new in 2.5
+try:
+ "".rpartition
+except AttributeError:
+ def rpartition(s, sep):
+ """Implement s.rpartition(sep) for old Pythons."""
+ i = s.rfind(sep)
+ if i == -1:
+ return ('', '', s)
+ else:
+ return (s[:i], sep, s[i+len(sep):])
+else:
+ def rpartition(s, sep):
+ """A common interface for new Pythons."""
+ return s.rpartition(sep)
+
# Pythons 2 and 3 differ on where to get StringIO
try:
from cStringIO import StringIO
@@ -49,6 +74,18 @@ try:
except NameError:
range = range
+# A function to iterate listlessly over a dict's items.
+try:
+ {}.iteritems
+except AttributeError:
+ def iitems(d):
+ """Produce the items from dict `d`."""
+ return d.items()
+else:
+ def iitems(d):
+ """Produce the items from dict `d`."""
+ return d.iteritems()
+
# Exec is a statement in Py2, a function in Py3
if sys.version_info >= (3, 0):
def exec_code_object(code, global_map):
@@ -66,21 +103,32 @@ else:
)
)
-# ConfigParser was renamed to the more-standard configparser
-try:
- import configparser
-except ImportError:
- import ConfigParser as configparser
-
-# Python 3.2 provides `tokenize.open`, the best way to open source files.
-try:
+# Reading Python source and interpreting the coding comment is a big deal.
+if sys.version_info >= (3, 0):
+ # Python 3.2 provides `tokenize.open`, the best way to open source files.
import tokenize
- open_source = tokenize.open # pylint: disable=E1101
-except AttributeError:
+ try:
+ open_source = tokenize.open # pylint: disable=E1101
+ except AttributeError:
+ from io import TextIOWrapper
+ detect_encoding = tokenize.detect_encoding # pylint: disable=E1101
+ # Copied from the 3.2 stdlib:
+ def open_source(fname):
+ """Open a file in read only mode using the encoding detected by
+ detect_encoding().
+ """
+ buffer = open(fname, 'rb')
+ encoding, _ = detect_encoding(buffer.readline)
+ buffer.seek(0)
+ text = TextIOWrapper(buffer, encoding, line_buffering=True)
+ text.mode = 'r'
+ return text
+else:
def open_source(fname):
"""Open a source file the best way."""
return open(fname, "rU")
+
# Python 3.x is picky about bytes and strings, so provide methods to
# get them right, and make them no-ops in 2.x
if sys.version_info >= (3, 0):
@@ -92,6 +140,19 @@ if sys.version_info >= (3, 0):
"""Convert bytes `b` to a string."""
return b.decode('utf8')
+ def binary_bytes(byte_values):
+ """Produce a byte string with the ints from `byte_values`."""
+ return bytes(byte_values)
+
+ def byte_to_int(byte_value):
+ """Turn an element of a bytes object into an int."""
+ return byte_value
+
+ def bytes_to_ints(bytes_value):
+ """Turn a bytes object into a sequence of ints."""
+ # In Py3, iterating bytes gives ints.
+ return bytes_value
+
else:
def to_bytes(s):
"""Convert string `s` to bytes (no-op in 2.x)."""
@@ -101,6 +162,19 @@ else:
"""Convert bytes `b` to a string (no-op in 2.x)."""
return b
+ def binary_bytes(byte_values):
+ """Produce a byte string with the ints from `byte_values`."""
+ return "".join([chr(b) for b in byte_values])
+
+ def byte_to_int(byte_value):
+ """Turn an element of a bytes object into an int."""
+ return ord(byte_value)
+
+ def bytes_to_ints(bytes_value):
+ """Turn a bytes object into a sequence of ints."""
+ for byte in bytes_value:
+ yield ord(byte)
+
# Md5 is available in different places.
try:
import hashlib
diff --git a/python/helpers/coverage/bytecode.py b/python/helpers/coverage/bytecode.py
index ab522d6c1c6c..85360638528e 100644
--- a/python/helpers/coverage/bytecode.py
+++ b/python/helpers/coverage/bytecode.py
@@ -1,14 +1,25 @@
"""Bytecode manipulation for coverage.py"""
-import opcode, sys, types
+import opcode, types
+
+from coverage.backward import byte_to_int
class ByteCode(object):
"""A single bytecode."""
def __init__(self):
+ # The offset of this bytecode in the code object.
self.offset = -1
+
+ # The opcode, defined in the `opcode` module.
self.op = -1
+
+ # The argument, a small integer, whose meaning depends on the opcode.
self.arg = -1
+
+ # The offset in the code object of the next bytecode.
self.next_offset = -1
+
+ # The offset to jump to.
self.jump_to = -1
@@ -18,44 +29,34 @@ class ByteCodes(object):
Returns `ByteCode` objects.
"""
+ # pylint: disable=R0924
def __init__(self, code):
self.code = code
- self.offset = 0
- if sys.version_info >= (3, 0):
- def __getitem__(self, i):
- return self.code[i]
- else:
- def __getitem__(self, i):
- return ord(self.code[i])
+ def __getitem__(self, i):
+ return byte_to_int(self.code[i])
def __iter__(self):
- return self
-
- def __next__(self):
- if self.offset >= len(self.code):
- raise StopIteration
+ offset = 0
+ while offset < len(self.code):
+ bc = ByteCode()
+ bc.op = self[offset]
+ bc.offset = offset
- bc = ByteCode()
- bc.op = self[self.offset]
- bc.offset = self.offset
+ next_offset = offset+1
+ if bc.op >= opcode.HAVE_ARGUMENT:
+ bc.arg = self[offset+1] + 256*self[offset+2]
+ next_offset += 2
- next_offset = self.offset+1
- if bc.op >= opcode.HAVE_ARGUMENT:
- bc.arg = self[self.offset+1] + 256*self[self.offset+2]
- next_offset += 2
+ label = -1
+ if bc.op in opcode.hasjrel:
+ label = next_offset + bc.arg
+ elif bc.op in opcode.hasjabs:
+ label = bc.arg
+ bc.jump_to = label
- label = -1
- if bc.op in opcode.hasjrel:
- label = next_offset + bc.arg
- elif bc.op in opcode.hasjabs:
- label = bc.arg
- bc.jump_to = label
-
- bc.next_offset = self.offset = next_offset
- return bc
-
- next = __next__ # Py2k uses an old-style non-dunder name.
+ bc.next_offset = offset = next_offset
+ yield bc
class CodeObjects(object):
@@ -64,18 +65,11 @@ class CodeObjects(object):
self.stack = [code]
def __iter__(self):
- return self
-
- def __next__(self):
- if self.stack:
+ while self.stack:
# We're going to return the code object on the stack, but first
# push its children for later returning.
code = self.stack.pop()
for c in code.co_consts:
if isinstance(c, types.CodeType):
self.stack.append(c)
- return code
-
- raise StopIteration
-
- next = __next__
+ yield code
diff --git a/python/helpers/coverage/cmdline.py b/python/helpers/coverage/cmdline.py
index 1ce5e0f54ad6..ea112a8b8f2d 100644
--- a/python/helpers/coverage/cmdline.py
+++ b/python/helpers/coverage/cmdline.py
@@ -1,10 +1,11 @@
"""Command-line support for Coverage."""
-import optparse, re, sys, traceback
+import optparse, os, sys, time, traceback
from coverage.backward import sorted # pylint: disable=W0622
from coverage.execfile import run_python_file, run_python_module
from coverage.misc import CoverageException, ExceptionDuringRun, NoSource
+from coverage.debug import info_formatter
class Opts(object):
@@ -19,11 +20,18 @@ class Opts(object):
'', '--branch', action='store_true',
help="Measure branch coverage in addition to statement coverage."
)
+ debug = optparse.make_option(
+ '', '--debug', action='store', metavar="OPTS",
+ help="Debug options, separated by commas"
+ )
directory = optparse.make_option(
- '-d', '--directory', action='store',
- metavar="DIR",
+ '-d', '--directory', action='store', metavar="DIR",
help="Write the output files to DIR."
)
+ fail_under = optparse.make_option(
+ '', '--fail-under', action='store', metavar="MIN", type="int",
+ help="Exit with a status of 2 if the total coverage is less than MIN."
+ )
help = optparse.make_option(
'-h', '--help', action='store_true',
help="Get help on this command."
@@ -89,6 +97,10 @@ class Opts(object):
help="Use a simpler but slower trace method. Try this if you get "
"seemingly impossible results!"
)
+ title = optparse.make_option(
+ '', '--title', action='store', metavar="TITLE",
+ help="A text string to use as the title on the HTML."
+ )
version = optparse.make_option(
'', '--version', action='store_true',
help="Display version information and exit."
@@ -110,7 +122,9 @@ class CoverageOptionParser(optparse.OptionParser, object):
self.set_defaults(
actions=[],
branch=None,
+ debug=None,
directory=None,
+ fail_under=None,
help=None,
ignore_errors=None,
include=None,
@@ -122,6 +136,7 @@ class CoverageOptionParser(optparse.OptionParser, object):
show_missing=None,
source=None,
timid=None,
+ title=None,
erase_first=None,
version=None,
)
@@ -273,9 +288,11 @@ CMDS = {
'html': CmdOptionParser("html",
[
Opts.directory,
+ Opts.fail_under,
Opts.ignore_errors,
Opts.omit,
Opts.include,
+ Opts.title,
] + GLOBAL_ARGS,
usage = "[options] [modules]",
description = "Create an HTML report of the coverage of the files. "
@@ -285,6 +302,7 @@ CMDS = {
'report': CmdOptionParser("report",
[
+ Opts.fail_under,
Opts.ignore_errors,
Opts.omit,
Opts.include,
@@ -298,6 +316,7 @@ CMDS = {
[
Opts.append,
Opts.branch,
+ Opts.debug,
Opts.pylib,
Opts.parallel_mode,
Opts.module,
@@ -314,20 +333,20 @@ CMDS = {
'xml': CmdOptionParser("xml",
[
+ Opts.fail_under,
Opts.ignore_errors,
Opts.omit,
Opts.include,
Opts.output_xml,
] + GLOBAL_ARGS,
cmd = "xml",
- defaults = {'outfile': 'coverage.xml'},
usage = "[options] [modules]",
description = "Generate an XML report of coverage results."
),
}
-OK, ERR = 0, 1
+OK, ERR, FAIL_UNDER = 0, 1, 2
class CoverageScript(object):
@@ -346,27 +365,10 @@ class CoverageScript(object):
self.run_python_file = _run_python_file or run_python_file
self.run_python_module = _run_python_module or run_python_module
self.help_fn = _help_fn or self.help
+ self.classic = False
self.coverage = None
- def help(self, error=None, topic=None, parser=None):
- """Display an error message, or the named topic."""
- assert error or topic or parser
- if error:
- print(error)
- print("Use 'coverage help' for help.")
- elif parser:
- print(parser.format_help().strip())
- else:
- # Parse out the topic we want from HELP_TOPICS
- topic_list = re.split("(?m)^=+ (\w+) =+$", HELP_TOPICS)
- topics = dict(zip(topic_list[1::2], topic_list[2::2]))
- help_msg = topics.get(topic, '').strip()
- if help_msg:
- print(help_msg % self.covpkg.__dict__)
- else:
- print("Don't know topic %r" % topic)
-
def command_line(self, argv):
"""The bulk of the command line interface to Coverage.
@@ -376,15 +378,14 @@ class CoverageScript(object):
"""
# Collect the command-line options.
-
if not argv:
self.help_fn(topic='minimum_help')
return OK
# The command syntax we parse depends on the first argument. Classic
# syntax always starts with an option.
- classic = argv[0].startswith('-')
- if classic:
+ self.classic = argv[0].startswith('-')
+ if self.classic:
parser = ClassicOptionParser()
else:
parser = CMDS.get(argv[0])
@@ -398,64 +399,19 @@ class CoverageScript(object):
if not ok:
return ERR
- # Handle help.
- if options.help:
- if classic:
- self.help_fn(topic='help')
- else:
- self.help_fn(parser=parser)
- return OK
-
- if "help" in options.actions:
- if args:
- for a in args:
- parser = CMDS.get(a)
- if parser:
- self.help_fn(parser=parser)
- else:
- self.help_fn(topic=a)
- else:
- self.help_fn(topic='help')
- return OK
-
- # Handle version.
- if options.version:
- self.help_fn(topic='version')
+ # Handle help and version.
+ if self.do_help(options, args, parser):
return OK
# Check for conflicts and problems in the options.
- for i in ['erase', 'execute']:
- for j in ['annotate', 'html', 'report', 'combine']:
- if (i in options.actions) and (j in options.actions):
- self.help_fn("You can't specify the '%s' and '%s' "
- "options at the same time." % (i, j))
- return ERR
-
- if not options.actions:
- self.help_fn(
- "You must specify at least one of -e, -x, -c, -r, -a, or -b."
- )
- return ERR
- args_allowed = (
- 'execute' in options.actions or
- 'annotate' in options.actions or
- 'html' in options.actions or
- 'debug' in options.actions or
- 'report' in options.actions or
- 'xml' in options.actions
- )
- if not args_allowed and args:
- self.help_fn("Unexpected arguments: %s" % " ".join(args))
- return ERR
-
- if 'execute' in options.actions and not args:
- self.help_fn("Nothing to do.")
+ if not self.args_ok(options, args):
return ERR
# Listify the list options.
source = unshell_list(options.source)
omit = unshell_list(options.omit)
include = unshell_list(options.include)
+ debug = unshell_list(options.debug)
# Do something.
self.coverage = self.covpkg.coverage(
@@ -467,41 +423,11 @@ class CoverageScript(object):
source = source,
omit = omit,
include = include,
+ debug = debug,
)
if 'debug' in options.actions:
- if not args:
- self.help_fn("What information would you like: data, sys?")
- return ERR
- for info in args:
- if info == 'sys':
- print("-- sys ----------------------------------------")
- for label, info in self.coverage.sysinfo():
- if info == []:
- info = "-none-"
- if isinstance(info, list):
- print("%15s:" % label)
- for e in info:
- print("%15s %s" % ("", e))
- else:
- print("%15s: %s" % (label, info))
- elif info == 'data':
- print("-- data ---------------------------------------")
- self.coverage.load()
- print("path: %s" % self.coverage.data.filename)
- print("has_arcs: %r" % self.coverage.data.has_arcs())
- summary = self.coverage.data.summary(fullpath=True)
- if summary:
- filenames = sorted(summary.keys())
- print("\n%d files:" % len(filenames))
- for f in filenames:
- print("%s: %d lines" % (f, summary[f]))
- else:
- print("No data collected")
- else:
- self.help_fn("Don't know what you mean by %r" % info)
- return ERR
- return OK
+ return self.do_debug(args)
if 'erase' in options.actions or options.erase_first:
self.coverage.erase()
@@ -509,22 +435,7 @@ class CoverageScript(object):
self.coverage.load()
if 'execute' in options.actions:
- # Run the script.
- self.coverage.start()
- code_ran = True
- try:
- try:
- if options.module:
- self.run_python_module(args[0], args)
- else:
- self.run_python_file(args[0], args)
- except NoSource:
- code_ran = False
- raise
- finally:
- if code_ran:
- self.coverage.stop()
- self.coverage.save()
+ self.do_execute(options, args)
if 'combine' in options.actions:
self.coverage.combine()
@@ -539,18 +450,167 @@ class CoverageScript(object):
)
if 'report' in options.actions:
- self.coverage.report(
+ total = self.coverage.report(
show_missing=options.show_missing, **report_args)
if 'annotate' in options.actions:
self.coverage.annotate(
directory=options.directory, **report_args)
if 'html' in options.actions:
- self.coverage.html_report(
- directory=options.directory, **report_args)
+ total = self.coverage.html_report(
+ directory=options.directory, title=options.title,
+ **report_args)
if 'xml' in options.actions:
outfile = options.outfile
- self.coverage.xml_report(outfile=outfile, **report_args)
+ total = self.coverage.xml_report(outfile=outfile, **report_args)
+ if options.fail_under is not None:
+ if total >= options.fail_under:
+ return OK
+ else:
+ return FAIL_UNDER
+ else:
+ return OK
+
+ def help(self, error=None, topic=None, parser=None):
+ """Display an error message, or the named topic."""
+ assert error or topic or parser
+ if error:
+ print(error)
+ print("Use 'coverage help' for help.")
+ elif parser:
+ print(parser.format_help().strip())
+ else:
+ help_msg = HELP_TOPICS.get(topic, '').strip()
+ if help_msg:
+ print(help_msg % self.covpkg.__dict__)
+ else:
+ print("Don't know topic %r" % topic)
+
+ def do_help(self, options, args, parser):
+ """Deal with help requests.
+
+ Return True if it handled the request, False if not.
+
+ """
+ # Handle help.
+ if options.help:
+ if self.classic:
+ self.help_fn(topic='help')
+ else:
+ self.help_fn(parser=parser)
+ return True
+
+ if "help" in options.actions:
+ if args:
+ for a in args:
+ parser = CMDS.get(a)
+ if parser:
+ self.help_fn(parser=parser)
+ else:
+ self.help_fn(topic=a)
+ else:
+ self.help_fn(topic='help')
+ return True
+
+ # Handle version.
+ if options.version:
+ self.help_fn(topic='version')
+ return True
+
+ return False
+
+ def args_ok(self, options, args):
+ """Check for conflicts and problems in the options.
+
+ Returns True if everything is ok, or False if not.
+
+ """
+ for i in ['erase', 'execute']:
+ for j in ['annotate', 'html', 'report', 'combine']:
+ if (i in options.actions) and (j in options.actions):
+ self.help_fn("You can't specify the '%s' and '%s' "
+ "options at the same time." % (i, j))
+ return False
+
+ if not options.actions:
+ self.help_fn(
+ "You must specify at least one of -e, -x, -c, -r, -a, or -b."
+ )
+ return False
+ args_allowed = (
+ 'execute' in options.actions or
+ 'annotate' in options.actions or
+ 'html' in options.actions or
+ 'debug' in options.actions or
+ 'report' in options.actions or
+ 'xml' in options.actions
+ )
+ if not args_allowed and args:
+ self.help_fn("Unexpected arguments: %s" % " ".join(args))
+ return False
+
+ if 'execute' in options.actions and not args:
+ self.help_fn("Nothing to do.")
+ return False
+
+ return True
+
+ def do_execute(self, options, args):
+ """Implementation of 'coverage run'."""
+
+ # Set the first path element properly.
+ old_path0 = sys.path[0]
+
+ # Run the script.
+ self.coverage.start()
+ code_ran = True
+ try:
+ try:
+ if options.module:
+ sys.path[0] = ''
+ self.run_python_module(args[0], args)
+ else:
+ filename = args[0]
+ sys.path[0] = os.path.abspath(os.path.dirname(filename))
+ self.run_python_file(filename, args)
+ except NoSource:
+ code_ran = False
+ raise
+ finally:
+ self.coverage.stop()
+ if code_ran:
+ self.coverage.save()
+
+ # Restore the old path
+ sys.path[0] = old_path0
+
+ def do_debug(self, args):
+ """Implementation of 'coverage debug'."""
+
+ if not args:
+ self.help_fn("What information would you like: data, sys?")
+ return ERR
+ for info in args:
+ if info == 'sys':
+ print("-- sys ----------------------------------------")
+ for line in info_formatter(self.coverage.sysinfo()):
+ print(" %s" % line)
+ elif info == 'data':
+ print("-- data ---------------------------------------")
+ self.coverage.load()
+ print("path: %s" % self.coverage.data.filename)
+ print("has_arcs: %r" % self.coverage.data.has_arcs())
+ summary = self.coverage.data.summary(fullpath=True)
+ if summary:
+ filenames = sorted(summary.keys())
+ print("\n%d files:" % len(filenames))
+ for f in filenames:
+ print("%s: %d lines" % (f, summary[f]))
+ else:
+ print("No data collected")
+ else:
+ self.help_fn("Don't know what you mean by %r" % info)
+ return ERR
return OK
@@ -568,10 +628,10 @@ def unshell_list(s):
return s.split(',')
-HELP_TOPICS = r"""
-
-== classic ====================================================================
-Coverage.py version %(__version__)s
+HELP_TOPICS = {
+# -------------------------
+'classic':
+r"""Coverage.py version %(__version__)s
Measure, collect, and report on code coverage in Python programs.
Usage:
@@ -615,8 +675,9 @@ coverage -a [-d DIR] [-i] [-o DIR,...] [FILE1 FILE2 ...]
Coverage data is saved in the file .coverage by default. Set the
COVERAGE_FILE environment variable to save it somewhere else.
-
-== help =======================================================================
+""",
+# -------------------------
+'help': """\
Coverage.py, version %(__version__)s
Measure, collect, and report on code coverage in Python programs.
@@ -635,26 +696,32 @@ Commands:
Use "coverage help <command>" for detailed help on any command.
Use "coverage help classic" for help on older command syntax.
For more information, see %(__url__)s
-
-== minimum_help ===============================================================
+""",
+# -------------------------
+'minimum_help': """\
Code coverage for Python. Use 'coverage help' for help.
-
-== version ====================================================================
+""",
+# -------------------------
+'version': """\
Coverage.py, version %(__version__)s. %(__url__)s
-
-"""
+""",
+}
def main(argv=None):
- """The main entrypoint to Coverage.
+ """The main entry point to Coverage.
- This is installed as the script entrypoint.
+ This is installed as the script entry point.
"""
if argv is None:
argv = sys.argv[1:]
try:
+ start = time.clock()
status = CoverageScript().command_line(argv)
+ end = time.clock()
+ if 0:
+ print("time: %.3fs" % (end - start))
except ExceptionDuringRun:
# An exception was caught while running the product code. The
# sys.exc_info() return tuple is packed into an ExceptionDuringRun
diff --git a/python/helpers/coverage/codeunit.py b/python/helpers/coverage/codeunit.py
index 55f44a240acf..ca1ae5c56d6b 100644
--- a/python/helpers/coverage/codeunit.py
+++ b/python/helpers/coverage/codeunit.py
@@ -52,8 +52,10 @@ class CodeUnit(object):
else:
f = morf
# .pyc files should always refer to a .py instead.
- if f.endswith('.pyc'):
+ if f.endswith('.pyc') or f.endswith('.pyo'):
f = f[:-1]
+ elif f.endswith('$py.class'): # Jython
+ f = f[:-9] + ".py"
self.filename = self.file_locator.canonical_filename(f)
if hasattr(morf, '__name__'):
@@ -77,12 +79,18 @@ class CodeUnit(object):
# Annoying comparison operators. Py3k wants __lt__ etc, and Py2k needs all
# of them defined.
- def __lt__(self, other): return self.name < other.name
- def __le__(self, other): return self.name <= other.name
- def __eq__(self, other): return self.name == other.name
- def __ne__(self, other): return self.name != other.name
- def __gt__(self, other): return self.name > other.name
- def __ge__(self, other): return self.name >= other.name
+ def __lt__(self, other):
+ return self.name < other.name
+ def __le__(self, other):
+ return self.name <= other.name
+ def __eq__(self, other):
+ return self.name == other.name
+ def __ne__(self, other):
+ return self.name != other.name
+ def __gt__(self, other):
+ return self.name > other.name
+ def __ge__(self, other):
+ return self.name >= other.name
def flat_rootname(self):
"""A base for a flat filename to correspond to this code unit.
@@ -113,5 +121,25 @@ class CodeUnit(object):
# Couldn't find source.
raise CoverageException(
- "No source for code %r." % self.filename
+ "No source for code '%s'." % self.filename
)
+
+ def should_be_python(self):
+ """Does it seem like this file should contain Python?
+
+ This is used to decide if a file reported as part of the exection of
+ a program was really likely to have contained Python in the first
+ place.
+
+ """
+ # Get the file extension.
+ _, ext = os.path.splitext(self.filename)
+
+ # Anything named *.py* should be Python.
+ if ext.startswith('.py'):
+ return True
+ # A file with no extension should be Python.
+ if not ext:
+ return True
+ # Everything else is probably not Python.
+ return False
diff --git a/python/helpers/coverage/collector.py b/python/helpers/coverage/collector.py
index 9c40d16c7b19..8ba7d87cd4e0 100644
--- a/python/helpers/coverage/collector.py
+++ b/python/helpers/coverage/collector.py
@@ -1,13 +1,24 @@
"""Raw data collector for Coverage."""
-import sys, threading
+import os, sys, threading
try:
# Use the C extension code when we can, for speed.
- from coverage.tracer import Tracer
+ from coverage.tracer import CTracer # pylint: disable=F0401,E0611
except ImportError:
# Couldn't import the C extension, maybe it isn't built.
- Tracer = None
+ if os.getenv('COVERAGE_TEST_TRACER') == 'c':
+ # During testing, we use the COVERAGE_TEST_TRACER env var to indicate
+ # that we've fiddled with the environment to test this fallback code.
+ # If we thought we had a C tracer, but couldn't import it, then exit
+ # quickly and clearly instead of dribbling confusing errors. I'm using
+ # sys.exit here instead of an exception because an exception here
+ # causes all sorts of other noise in unittest.
+ sys.stderr.write(
+ "*** COVERAGE_TEST_TRACER is 'c' but can't import CTracer!\n"
+ )
+ sys.exit(1)
+ CTracer = None
class PyTracer(object):
@@ -40,12 +51,19 @@ class PyTracer(object):
self.last_exc_back = None
self.last_exc_firstlineno = 0
self.arcs = False
+ self.thread = None
+ self.stopped = False
def _trace(self, frame, event, arg_unused):
"""The trace function passed to sys.settrace."""
- #print("trace event: %s %r @%d" % (
- # event, frame.f_code.co_filename, frame.f_lineno))
+ if self.stopped:
+ return
+
+ if 0:
+ sys.stderr.write("trace event: %s %r @%d\n" % (
+ event, frame.f_code.co_filename, frame.f_lineno
+ ))
if self.last_exc_back:
if frame == self.last_exc_back:
@@ -61,10 +79,11 @@ class PyTracer(object):
# in this file.
self.data_stack.append((self.cur_file_data, self.last_line))
filename = frame.f_code.co_filename
- tracename = self.should_trace_cache.get(filename)
- if tracename is None:
+ if filename not in self.should_trace_cache:
tracename = self.should_trace(filename, frame)
self.should_trace_cache[filename] = tracename
+ else:
+ tracename = self.should_trace_cache[filename]
#print("called, stack is %d deep, tracename is %r" % (
# len(self.data_stack), tracename))
if tracename:
@@ -105,15 +124,24 @@ class PyTracer(object):
Return a Python function suitable for use with sys.settrace().
"""
+ self.thread = threading.currentThread()
sys.settrace(self._trace)
return self._trace
def stop(self):
"""Stop this Tracer."""
+ self.stopped = True
+ if self.thread != threading.currentThread():
+ # Called on a different thread than started us: we can't unhook
+ # ourseves, but we've set the flag that we should stop, so we won't
+ # do any more tracing.
+ return
+
if hasattr(sys, "gettrace") and self.warn:
if sys.gettrace() != self._trace:
msg = "Trace function changed, measurement is likely wrong: %r"
- self.warn(msg % sys.gettrace())
+ self.warn(msg % (sys.gettrace(),))
+ #print("Stopping tracer on %s" % threading.current_thread().ident)
sys.settrace(None)
def get_stats(self):
@@ -146,7 +174,7 @@ class Collector(object):
"""Create a collector.
`should_trace` is a function, taking a filename, and returning a
- canonicalized filename, or False depending on whether the file should
+ canonicalized filename, or None depending on whether the file should
be traced or not.
If `timid` is true, then a slower simpler trace function will be
@@ -173,7 +201,7 @@ class Collector(object):
else:
# Being fast: use the C Tracer if it is available, else the Python
# trace function.
- self._trace_class = Tracer or PyTracer
+ self._trace_class = CTracer or PyTracer
def __repr__(self):
return "<Collector at 0x%x>" % id(self)
@@ -190,7 +218,7 @@ class Collector(object):
# A cache of the results from should_trace, the decision about whether
# to trace execution in a file. A dict of filename to (filename or
- # False).
+ # None).
self.should_trace_cache = {}
# Our active Tracers.
@@ -232,9 +260,29 @@ class Collector(object):
if self._collectors:
self._collectors[-1].pause()
self._collectors.append(self)
- #print >>sys.stderr, "Started: %r" % self._collectors
+ #print("Started: %r" % self._collectors, file=sys.stderr)
+
+ # Check to see whether we had a fullcoverage tracer installed.
+ traces0 = []
+ if hasattr(sys, "gettrace"):
+ fn0 = sys.gettrace()
+ if fn0:
+ tracer0 = getattr(fn0, '__self__', None)
+ if tracer0:
+ traces0 = getattr(tracer0, 'traces', [])
+
# Install the tracer on this thread.
- self._start_tracer()
+ fn = self._start_tracer()
+
+ for args in traces0:
+ (frame, event, arg), lineno = args
+ try:
+ fn(frame, event, arg, lineno=lineno)
+ except TypeError:
+ raise Exception(
+ "fullcoverage must be run with the C trace function."
+ )
+
# Install our installation tracer in threading, to jump start other
# threads.
threading.settrace(self._installation_trace)
diff --git a/python/helpers/coverage/config.py b/python/helpers/coverage/config.py
index 6b441ddc45fc..87318ff12452 100644
--- a/python/helpers/coverage/config.py
+++ b/python/helpers/coverage/config.py
@@ -1,7 +1,76 @@
"""Config file for coverage.py"""
-import os
-from coverage.backward import configparser # pylint: disable=W0622
+import os, re, sys
+from coverage.backward import string_class, iitems
+
+# In py3, # ConfigParser was renamed to the more-standard configparser
+try:
+ import configparser # pylint: disable=F0401
+except ImportError:
+ import ConfigParser as configparser
+
+
+class HandyConfigParser(configparser.RawConfigParser):
+ """Our specialization of ConfigParser."""
+
+ def read(self, filename):
+ """Read a filename as UTF-8 configuration data."""
+ kwargs = {}
+ if sys.version_info >= (3, 2):
+ kwargs['encoding'] = "utf-8"
+ return configparser.RawConfigParser.read(self, filename, **kwargs)
+
+ def get(self, *args, **kwargs):
+ v = configparser.RawConfigParser.get(self, *args, **kwargs)
+ def dollar_replace(m):
+ """Called for each $replacement."""
+ # Only one of the groups will have matched, just get its text.
+ word = [w for w in m.groups() if w is not None][0]
+ if word == "$":
+ return "$"
+ else:
+ return os.environ.get(word, '')
+
+ dollar_pattern = r"""(?x) # Use extended regex syntax
+ \$(?: # A dollar sign, then
+ (?P<v1>\w+) | # a plain word,
+ {(?P<v2>\w+)} | # or a {-wrapped word,
+ (?P<char>[$]) # or a dollar sign.
+ )
+ """
+ v = re.sub(dollar_pattern, dollar_replace, v)
+ return v
+
+ def getlist(self, section, option):
+ """Read a list of strings.
+
+ The value of `section` and `option` is treated as a comma- and newline-
+ separated list of strings. Each value is stripped of whitespace.
+
+ Returns the list of strings.
+
+ """
+ value_list = self.get(section, option)
+ values = []
+ for value_line in value_list.split('\n'):
+ for value in value_line.split(','):
+ value = value.strip()
+ if value:
+ values.append(value)
+ return values
+
+ def getlinelist(self, section, option):
+ """Read a list of full-line strings.
+
+ The value of `section` and `option` is treated as a newline-separated
+ list of strings. Each value is stripped of whitespace.
+
+ Returns the list of strings.
+
+ """
+ value_list = self.get(section, option)
+ return list(filter(None, value_list.split('\n')))
+
# The default line exclusion regexes
DEFAULT_EXCLUDE = [
@@ -29,9 +98,12 @@ class CoverageConfig(object):
operation of coverage.py.
"""
-
def __init__(self):
"""Initialize the configuration attributes to their defaults."""
+ # Metadata about the config.
+ self.attempted_config_files = []
+ self.config_files = []
+
# Defaults for [run]
self.branch = False
self.cover_pylib = False
@@ -39,6 +111,7 @@ class CoverageConfig(object):
self.parallel = False
self.timid = False
self.source = None
+ self.debug = []
# Defaults for [report]
self.exclude_list = DEFAULT_EXCLUDE[:]
@@ -48,13 +121,19 @@ class CoverageConfig(object):
self.partial_list = DEFAULT_PARTIAL[:]
self.partial_always_list = DEFAULT_PARTIAL_ALWAYS[:]
self.precision = 0
+ self.show_missing = False
# Defaults for [html]
self.html_dir = "htmlcov"
+ self.extra_css = None
+ self.html_title = "Coverage report"
# Defaults for [xml]
self.xml_output = "coverage.xml"
+ # Defaults for [paths]
+ self.paths = {}
+
def from_environment(self, env_var):
"""Read configuration from the `env_var` environment variable."""
# Timidity: for nose users, read an environment variable. This is a
@@ -64,93 +143,71 @@ class CoverageConfig(object):
if env:
self.timid = ('--timid' in env)
+ MUST_BE_LIST = ["omit", "include", "debug"]
+
def from_args(self, **kwargs):
"""Read config values from `kwargs`."""
- for k, v in kwargs.items():
+ for k, v in iitems(kwargs):
if v is not None:
+ if k in self.MUST_BE_LIST and isinstance(v, string_class):
+ v = [v]
setattr(self, k, v)
- def from_file(self, *files):
- """Read configuration from .rc files.
+ def from_file(self, filename):
+ """Read configuration from a .rc file.
- Each argument in `files` is a file name to read.
+ `filename` is a file name to read.
"""
- cp = configparser.RawConfigParser()
- cp.read(files)
+ self.attempted_config_files.append(filename)
+ cp = HandyConfigParser()
+ files_read = cp.read(filename)
+ if files_read is not None: # return value changed in 2.4
+ self.config_files.extend(files_read)
+
+ for option_spec in self.CONFIG_FILE_OPTIONS:
+ self.set_attr_from_config_option(cp, *option_spec)
+
+ # [paths] is special
+ if cp.has_section('paths'):
+ for option in cp.options('paths'):
+ self.paths[option] = cp.getlist('paths', option)
+
+ CONFIG_FILE_OPTIONS = [
# [run]
- if cp.has_option('run', 'branch'):
- self.branch = cp.getboolean('run', 'branch')
- if cp.has_option('run', 'cover_pylib'):
- self.cover_pylib = cp.getboolean('run', 'cover_pylib')
- if cp.has_option('run', 'data_file'):
- self.data_file = cp.get('run', 'data_file')
- if cp.has_option('run', 'include'):
- self.include = self.get_list(cp, 'run', 'include')
- if cp.has_option('run', 'omit'):
- self.omit = self.get_list(cp, 'run', 'omit')
- if cp.has_option('run', 'parallel'):
- self.parallel = cp.getboolean('run', 'parallel')
- if cp.has_option('run', 'source'):
- self.source = self.get_list(cp, 'run', 'source')
- if cp.has_option('run', 'timid'):
- self.timid = cp.getboolean('run', 'timid')
+ ('branch', 'run:branch', 'boolean'),
+ ('cover_pylib', 'run:cover_pylib', 'boolean'),
+ ('data_file', 'run:data_file'),
+ ('debug', 'run:debug', 'list'),
+ ('include', 'run:include', 'list'),
+ ('omit', 'run:omit', 'list'),
+ ('parallel', 'run:parallel', 'boolean'),
+ ('source', 'run:source', 'list'),
+ ('timid', 'run:timid', 'boolean'),
# [report]
- if cp.has_option('report', 'exclude_lines'):
- self.exclude_list = \
- self.get_line_list(cp, 'report', 'exclude_lines')
- if cp.has_option('report', 'ignore_errors'):
- self.ignore_errors = cp.getboolean('report', 'ignore_errors')
- if cp.has_option('report', 'include'):
- self.include = self.get_list(cp, 'report', 'include')
- if cp.has_option('report', 'omit'):
- self.omit = self.get_list(cp, 'report', 'omit')
- if cp.has_option('report', 'partial_branches'):
- self.partial_list = \
- self.get_line_list(cp, 'report', 'partial_branches')
- if cp.has_option('report', 'partial_branches_always'):
- self.partial_always_list = \
- self.get_line_list(cp, 'report', 'partial_branches_always')
- if cp.has_option('report', 'precision'):
- self.precision = cp.getint('report', 'precision')
+ ('exclude_list', 'report:exclude_lines', 'linelist'),
+ ('ignore_errors', 'report:ignore_errors', 'boolean'),
+ ('include', 'report:include', 'list'),
+ ('omit', 'report:omit', 'list'),
+ ('partial_list', 'report:partial_branches', 'linelist'),
+ ('partial_always_list', 'report:partial_branches_always', 'linelist'),
+ ('precision', 'report:precision', 'int'),
+ ('show_missing', 'report:show_missing', 'boolean'),
# [html]
- if cp.has_option('html', 'directory'):
- self.html_dir = cp.get('html', 'directory')
+ ('html_dir', 'html:directory'),
+ ('extra_css', 'html:extra_css'),
+ ('html_title', 'html:title'),
# [xml]
- if cp.has_option('xml', 'output'):
- self.xml_output = cp.get('xml', 'output')
-
- def get_list(self, cp, section, option):
- """Read a list of strings from the ConfigParser `cp`.
-
- The value of `section` and `option` is treated as a comma- and newline-
- separated list of strings. Each value is stripped of whitespace.
-
- Returns the list of strings.
-
- """
- value_list = cp.get(section, option)
- values = []
- for value_line in value_list.split('\n'):
- for value in value_line.split(','):
- value = value.strip()
- if value:
- values.append(value)
- return values
-
- def get_line_list(self, cp, section, option):
- """Read a list of full-line strings from the ConfigParser `cp`.
-
- The value of `section` and `option` is treated as a newline-separated
- list of strings. Each value is stripped of whitespace.
-
- Returns the list of strings.
-
- """
- value_list = cp.get(section, option)
- return list(filter(None, value_list.split('\n')))
-
+ ('xml_output', 'xml:output'),
+ ]
+
+ def set_attr_from_config_option(self, cp, attr, where, type_=''):
+ """Set an attribute on self if it exists in the ConfigParser."""
+ section, option = where.split(":")
+ if cp.has_option(section, option):
+ method = getattr(cp, 'get'+type_)
+ setattr(self, attr, method(section, option))
diff --git a/python/helpers/coverage/control.py b/python/helpers/coverage/control.py
index 5ca1ef9538cc..f75a3dda5b1b 100644
--- a/python/helpers/coverage/control.py
+++ b/python/helpers/coverage/control.py
@@ -3,21 +3,31 @@
import atexit, os, random, socket, sys
from coverage.annotate import AnnotateReporter
-from coverage.backward import string_class
+from coverage.backward import string_class, iitems, sorted # pylint: disable=W0622
from coverage.codeunit import code_unit_factory, CodeUnit
from coverage.collector import Collector
from coverage.config import CoverageConfig
from coverage.data import CoverageData
+from coverage.debug import DebugControl
from coverage.files import FileLocator, TreeMatcher, FnmatchMatcher
-from coverage.files import find_python_files
+from coverage.files import PathAliases, find_python_files, prep_patterns
from coverage.html import HtmlReporter
from coverage.misc import CoverageException, bool_or_none, join_regex
+from coverage.misc import file_be_gone
from coverage.results import Analysis, Numbers
from coverage.summary import SummaryReporter
from coverage.xmlreport import XmlReporter
+# Pypy has some unusual stuff in the "stdlib". Consider those locations
+# when deciding where the stdlib is.
+try:
+ import _structseq # pylint: disable=F0401
+except ImportError:
+ _structseq = None
+
+
class coverage(object):
- """Programmatic access to Coverage.
+ """Programmatic access to coverage.py.
To use::
@@ -25,14 +35,15 @@ class coverage(object):
cov = coverage()
cov.start()
- #.. blah blah (run your code) blah blah ..
+ #.. call your code ..
cov.stop()
cov.html_report(directory='covhtml')
"""
def __init__(self, data_file=None, data_suffix=None, cover_pylib=None,
auto_data=False, timid=None, branch=None, config_file=True,
- source=None, omit=None, include=None):
+ source=None, omit=None, include=None, debug=None,
+ debug_file=None):
"""
`data_file` is the base name of the data file to use, defaulting to
".coverage". `data_suffix` is appended (with a dot) to `data_file` to
@@ -67,6 +78,10 @@ class coverage(object):
`include` will be measured, files that match `omit` will not. Each
will also accept a single string argument.
+ `debug` is a list of strings indicating what debugging information is
+ desired. `debug_file` is the file to write debug messages to,
+ defaulting to stderr.
+
"""
from coverage import __version__
@@ -96,18 +111,16 @@ class coverage(object):
self.config.data_file = env_data_file
# 4: from constructor arguments:
- if isinstance(omit, string_class):
- omit = [omit]
- if isinstance(include, string_class):
- include = [include]
self.config.from_args(
data_file=data_file, cover_pylib=cover_pylib, timid=timid,
branch=branch, parallel=bool_or_none(data_suffix),
- source=source, omit=omit, include=include
+ source=source, omit=omit, include=include, debug=debug,
)
+ # Create and configure the debugging controller.
+ self.debug = DebugControl(self.config.debug, debug_file or sys.stderr)
+
self.auto_data = auto_data
- self.atexit_registered = False
# _exclude_re is a dict mapping exclusion list names to compiled
# regexes.
@@ -125,8 +138,8 @@ class coverage(object):
else:
self.source_pkgs.append(src)
- self.omit = self._prep_patterns(self.config.omit)
- self.include = self._prep_patterns(self.config.include)
+ self.omit = prep_patterns(self.config.omit)
+ self.include = prep_patterns(self.config.include)
self.collector = Collector(
self._should_trace, timid=self.config.timid,
@@ -151,7 +164,8 @@ class coverage(object):
# started rather than wherever the process eventually chdir'd to.
self.data = CoverageData(
basename=self.config.data_file,
- collector="coverage v%s" % __version__
+ collector="coverage v%s" % __version__,
+ debug=self.debug,
)
# The dirs for files considered "installed with the interpreter".
@@ -162,9 +176,9 @@ class coverage(object):
# environments (virtualenv, for example), these modules may be
# spread across a few locations. Look at all the candidate modules
# we've imported, and take all the different ones.
- for m in (atexit, os, random, socket):
- if hasattr(m, "__file__"):
- m_dir = self._canonical_dir(m.__file__)
+ for m in (atexit, os, random, socket, _structseq):
+ if m is not None and hasattr(m, "__file__"):
+ m_dir = self._canonical_dir(m)
if m_dir not in self.pylib_dirs:
self.pylib_dirs.append(m_dir)
@@ -172,63 +186,61 @@ class coverage(object):
# where we are.
self.cover_dir = self._canonical_dir(__file__)
- # The matchers for _should_trace, created when tracing starts.
+ # The matchers for _should_trace.
self.source_match = None
self.pylib_match = self.cover_match = None
self.include_match = self.omit_match = None
- # Only _harvest_data once per measurement cycle.
- self._harvested = False
-
# Set the reporting precision.
Numbers.set_precision(self.config.precision)
- # When tearing down the coverage object, modules can become None.
- # Saving the modules as object attributes avoids problems, but it is
- # quite ad-hoc which modules need to be saved and which references
- # need to use the object attributes.
- self.socket = socket
- self.os = os
- self.random = random
+ # Is it ok for no data to be collected?
+ self._warn_no_data = True
+ self._warn_unimported_source = True
+
+ # State machine variables:
+ # Have we started collecting and not stopped it?
+ self._started = False
+ # Have we measured some data and not harvested it?
+ self._measured = False
- def _canonical_dir(self, f):
- """Return the canonical directory of the file `f`."""
- return os.path.split(self.file_locator.canonical_filename(f))[0]
+ atexit.register(self._atexit)
+
+ def _canonical_dir(self, morf):
+ """Return the canonical directory of the module or file `morf`."""
+ return os.path.split(CodeUnit(morf, self.file_locator).filename)[0]
def _source_for_file(self, filename):
"""Return the source file for `filename`."""
if not filename.endswith(".py"):
if filename[-4:-1] == ".py":
filename = filename[:-1]
+ elif filename.endswith("$py.class"): # jython
+ filename = filename[:-9] + ".py"
return filename
- def _should_trace(self, filename, frame):
- """Decide whether to trace execution in `filename`
+ def _should_trace_with_reason(self, filename, frame):
+ """Decide whether to trace execution in `filename`, with a reason.
This function is called from the trace function. As each new file name
is encountered, this function determines whether it is traced or not.
- Returns a canonicalized filename if it should be traced, False if it
- should not.
+ Returns a pair of values: the first indicates whether the file should
+ be traced: it's a canonicalized filename if it should be traced, None
+ if it should not. The second value is a string, the resason for the
+ decision.
"""
- if os is None:
- return False
+ if not filename:
+ # Empty string is pretty useless
+ return None, "empty string isn't a filename"
if filename.startswith('<'):
# Lots of non-file execution is represented with artificial
# filenames like "<string>", "<doctest readme.txt[0]>", or
# "<exec_function>". Don't ever trace these executions, since we
# can't do anything with the data later anyway.
- return False
-
- if filename.endswith(".html"):
- # Jinja and maybe other templating systems compile templates into
- # Python code, but use the template filename as the filename in
- # the compiled code. Of course, those filenames are useless later
- # so don't bother collecting. TODO: How should we really separate
- # out good file extensions from bad?
- return False
+ return None, "not a real filename"
self._check_for_packages()
@@ -248,64 +260,53 @@ class coverage(object):
canonical = self.file_locator.canonical_filename(filename)
- # If the user specified source, then that's authoritative about what to
- # measure. If they didn't, then we have to exclude the stdlib and
- # coverage.py directories.
+ # If the user specified source or include, then that's authoritative
+ # about the outer bound of what to measure and we don't have to apply
+ # any canned exclusions. If they didn't, then we have to exclude the
+ # stdlib and coverage.py directories.
if self.source_match:
if not self.source_match.match(canonical):
- return False
+ return None, "falls outside the --source trees"
+ elif self.include_match:
+ if not self.include_match.match(canonical):
+ return None, "falls outside the --include trees"
else:
# If we aren't supposed to trace installed code, then check if this
# is near the Python standard library and skip it if so.
if self.pylib_match and self.pylib_match.match(canonical):
- return False
+ return None, "is in the stdlib"
# We exclude the coverage code itself, since a little of it will be
# measured otherwise.
if self.cover_match and self.cover_match.match(canonical):
- return False
+ return None, "is part of coverage.py"
- # Check the file against the include and omit patterns.
- if self.include_match and not self.include_match.match(canonical):
- return False
+ # Check the file against the omit pattern.
if self.omit_match and self.omit_match.match(canonical):
- return False
+ return None, "is inside an --omit pattern"
- return canonical
+ return canonical, "because we love you"
+
+ def _should_trace(self, filename, frame):
+ """Decide whether to trace execution in `filename`.
- # To log what should_trace returns, change this to "if 1:"
- if 0:
- _real_should_trace = _should_trace
- def _should_trace(self, filename, frame): # pylint: disable=E0102
- """A logging decorator around the real _should_trace function."""
- ret = self._real_should_trace(filename, frame)
- print("should_trace: %r -> %r" % (filename, ret))
- return ret
+ Calls `_should_trace_with_reason`, and returns just the decision.
+
+ """
+ canonical, reason = self._should_trace_with_reason(filename, frame)
+ if self.debug.should('trace'):
+ if not canonical:
+ msg = "Not tracing %r: %s" % (filename, reason)
+ else:
+ msg = "Tracing %r" % (filename,)
+ self.debug.write(msg)
+ return canonical
def _warn(self, msg):
"""Use `msg` as a warning."""
self._warnings.append(msg)
sys.stderr.write("Coverage.py warning: %s\n" % msg)
- def _prep_patterns(self, patterns):
- """Prepare the file patterns for use in a `FnmatchMatcher`.
-
- If a pattern starts with a wildcard, it is used as a pattern
- as-is. If it does not start with a wildcard, then it is made
- absolute with the current directory.
-
- If `patterns` is None, an empty list is returned.
-
- """
- patterns = patterns or []
- prepped = []
- for p in patterns or []:
- if p.startswith("*") or p.startswith("?"):
- prepped.append(p)
- else:
- prepped.append(self.file_locator.abs_file(p))
- return prepped
-
def _check_for_packages(self):
"""Update the source_match matcher with latest imported packages."""
# Our self.source_pkgs attribute is a list of package names we want to
@@ -325,17 +326,23 @@ class coverage(object):
try:
pkg_file = mod.__file__
except AttributeError:
- self._warn("Module %s has no Python source." % pkg)
+ pkg_file = None
else:
d, f = os.path.split(pkg_file)
- if f.startswith('__init__.'):
+ if f.startswith('__init__'):
# This is actually a package, return the directory.
pkg_file = d
else:
pkg_file = self._source_for_file(pkg_file)
pkg_file = self.file_locator.canonical_filename(pkg_file)
+ if not os.path.exists(pkg_file):
+ pkg_file = None
+
+ if pkg_file:
self.source.append(pkg_file)
self.source_match.add(pkg_file)
+ else:
+ self._warn("Module %s has no Python source." % pkg)
for pkg in found:
self.source_pkgs.remove(pkg)
@@ -354,17 +361,21 @@ class coverage(object):
self.data.read()
def start(self):
- """Start measuring code coverage."""
+ """Start measuring code coverage.
+
+ Coverage measurement actually occurs in functions called after `start`
+ is invoked. Statements in the same scope as `start` won't be measured.
+
+ Once you invoke `start`, you must also call `stop` eventually, or your
+ process might not shut down cleanly.
+
+ """
if self.run_suffix:
# Calling start() means we're running code, so use the run_suffix
# as the data_suffix when we eventually save the data.
self.data_suffix = self.run_suffix
if self.auto_data:
self.load()
- # Save coverage data when Python exits.
- if not self.atexit_registered:
- atexit.register(self.save)
- self.atexit_registered = True
# Create the matchers we need for _should_trace
if self.source or self.source_pkgs:
@@ -379,13 +390,31 @@ class coverage(object):
if self.omit:
self.omit_match = FnmatchMatcher(self.omit)
- self._harvested = False
+ # The user may want to debug things, show info if desired.
+ if self.debug.should('config'):
+ self.debug.write("Configuration values:")
+ config_info = sorted(self.config.__dict__.items())
+ self.debug.write_formatted_info(config_info)
+
+ if self.debug.should('sys'):
+ self.debug.write("Debugging info:")
+ self.debug.write_formatted_info(self.sysinfo())
+
self.collector.start()
+ self._started = True
+ self._measured = True
def stop(self):
"""Stop measuring code coverage."""
+ self._started = False
self.collector.stop()
- self._harvest_data()
+
+ def _atexit(self):
+ """Clean up on process shutdown."""
+ if self._started:
+ self.stop()
+ if self.auto_data:
+ self.save()
def erase(self):
"""Erase previously-collected coverage data.
@@ -449,9 +478,15 @@ class coverage(object):
# plenty of distinguishing information. We do this here in
# `save()` at the last minute so that the pid will be correct even
# if the process forks.
- data_suffix = "%s.%s.%06d" % (
- self.socket.gethostname(), self.os.getpid(),
- self.random.randint(0, 99999)
+ extra = ""
+ if _TEST_NAME_FILE:
+ f = open(_TEST_NAME_FILE)
+ test_name = f.read()
+ f.close()
+ extra = "." + test_name
+ data_suffix = "%s%s.%s.%06d" % (
+ socket.gethostname(), extra, os.getpid(),
+ random.randint(0, 999999)
)
self._harvest_data()
@@ -465,7 +500,14 @@ class coverage(object):
current measurements.
"""
- self.data.combine_parallel_data()
+ aliases = None
+ if self.config.paths:
+ aliases = PathAliases(self.file_locator)
+ for paths in self.config.paths.values():
+ result = paths[0]
+ for pattern in paths[1:]:
+ aliases.add(pattern, result)
+ self.data.combine_parallel_data(aliases=aliases)
def _harvest_data(self):
"""Get the collected data and reset the collector.
@@ -473,27 +515,37 @@ class coverage(object):
Also warn about various problems collecting data.
"""
- if not self._harvested:
- self.data.add_line_data(self.collector.get_line_data())
- self.data.add_arc_data(self.collector.get_arc_data())
- self.collector.reset()
+ if not self._measured:
+ return
- # If there are still entries in the source_pkgs list, then we never
- # encountered those packages.
+ self.data.add_line_data(self.collector.get_line_data())
+ self.data.add_arc_data(self.collector.get_arc_data())
+ self.collector.reset()
+
+ # If there are still entries in the source_pkgs list, then we never
+ # encountered those packages.
+ if self._warn_unimported_source:
for pkg in self.source_pkgs:
self._warn("Module %s was never imported." % pkg)
- # Find out if we got any data.
- summary = self.data.summary()
- if not summary:
- self._warn("No data was collected.")
+ # Find out if we got any data.
+ summary = self.data.summary()
+ if not summary and self._warn_no_data:
+ self._warn("No data was collected.")
+
+ # Find files that were never executed at all.
+ for src in self.source:
+ for py_file in find_python_files(src):
+ py_file = self.file_locator.canonical_filename(py_file)
+
+ if self.omit_match and self.omit_match.match(py_file):
+ # Turns out this file was omitted, so don't pull it back
+ # in as unexecuted.
+ continue
- # Find files that were never executed at all.
- for src in self.source:
- for py_file in find_python_files(src):
- self.data.touch_file(py_file)
+ self.data.touch_file(py_file)
- self._harvested = True
+ self._measured = False
# Backward compatibility with version 1.
def analysis(self, morf):
@@ -520,8 +572,11 @@ class coverage(object):
"""
analysis = self._analyze(morf)
return (
- analysis.filename, analysis.statements, analysis.excluded,
- analysis.missing, analysis.missing_formatted()
+ analysis.filename,
+ sorted(analysis.statements),
+ sorted(analysis.excluded),
+ sorted(analysis.missing),
+ analysis.missing_formatted(),
)
def _analyze(self, it):
@@ -530,6 +585,7 @@ class coverage(object):
Returns an `Analysis` object.
"""
+ self._harvest_data()
if not isinstance(it, CodeUnit):
it = code_unit_factory(it, self.file_locator)[0]
@@ -548,14 +604,16 @@ class coverage(object):
match those patterns will be included in the report. Modules matching
`omit` will not be included in the report.
+ Returns a float, the total percentage covered.
+
"""
+ self._harvest_data()
self.config.from_args(
- ignore_errors=ignore_errors, omit=omit, include=include
- )
- reporter = SummaryReporter(
- self, show_missing, self.config.ignore_errors
+ ignore_errors=ignore_errors, omit=omit, include=include,
+ show_missing=show_missing,
)
- reporter.report(morfs, outfile=file, config=self.config)
+ reporter = SummaryReporter(self, self.config)
+ return reporter.report(morfs, outfile=file)
def annotate(self, morfs=None, directory=None, ignore_errors=None,
omit=None, include=None):
@@ -569,25 +627,39 @@ class coverage(object):
See `coverage.report()` for other arguments.
"""
+ self._harvest_data()
self.config.from_args(
ignore_errors=ignore_errors, omit=omit, include=include
)
- reporter = AnnotateReporter(self, self.config.ignore_errors)
- reporter.report(morfs, config=self.config, directory=directory)
+ reporter = AnnotateReporter(self, self.config)
+ reporter.report(morfs, directory=directory)
def html_report(self, morfs=None, directory=None, ignore_errors=None,
- omit=None, include=None):
+ omit=None, include=None, extra_css=None, title=None):
"""Generate an HTML report.
+ The HTML is written to `directory`. The file "index.html" is the
+ overview starting point, with links to more detailed pages for
+ individual modules.
+
+ `extra_css` is a path to a file of other CSS to apply on the page.
+ It will be copied into the HTML directory.
+
+ `title` is a text string (not HTML) to use as the title of the HTML
+ report.
+
See `coverage.report()` for other arguments.
+ Returns a float, the total percentage covered.
+
"""
+ self._harvest_data()
self.config.from_args(
ignore_errors=ignore_errors, omit=omit, include=include,
- html_dir=directory,
+ html_dir=directory, extra_css=extra_css, html_title=title,
)
- reporter = HtmlReporter(self, self.config.ignore_errors)
- reporter.report(morfs, config=self.config)
+ reporter = HtmlReporter(self, self.config)
+ return reporter.report(morfs)
def xml_report(self, morfs=None, outfile=None, ignore_errors=None,
omit=None, include=None):
@@ -600,12 +672,16 @@ class coverage(object):
See `coverage.report()` for other arguments.
+ Returns a float, the total percentage covered.
+
"""
+ self._harvest_data()
self.config.from_args(
ignore_errors=ignore_errors, omit=omit, include=include,
xml_output=outfile,
)
file_to_close = None
+ delete_file = False
if self.config.xml_output:
if self.config.xml_output == '-':
outfile = sys.stdout
@@ -613,11 +689,17 @@ class coverage(object):
outfile = open(self.config.xml_output, "w")
file_to_close = outfile
try:
- reporter = XmlReporter(self, self.config.ignore_errors)
- reporter.report(morfs, outfile=outfile, config=self.config)
+ try:
+ reporter = XmlReporter(self, self.config)
+ return reporter.report(morfs, outfile=outfile)
+ except CoverageException:
+ delete_file = True
+ raise
finally:
if file_to_close:
file_to_close.close()
+ if delete_file:
+ file_be_gone(self.config.xml_output)
def sysinfo(self):
"""Return a list of (key, value) pairs showing internal information."""
@@ -625,22 +707,43 @@ class coverage(object):
import coverage as covmod
import platform, re
+ try:
+ implementation = platform.python_implementation()
+ except AttributeError:
+ implementation = "unknown"
+
info = [
('version', covmod.__version__),
('coverage', covmod.__file__),
('cover_dir', self.cover_dir),
('pylib_dirs', self.pylib_dirs),
('tracer', self.collector.tracer_name()),
+ ('config_files', self.config.attempted_config_files),
+ ('configs_read', self.config.config_files),
('data_path', self.data.filename),
('python', sys.version.replace('\n', '')),
('platform', platform.platform()),
+ ('implementation', implementation),
+ ('executable', sys.executable),
('cwd', os.getcwd()),
('path', sys.path),
- ('environment', [
- ("%s = %s" % (k, v)) for k, v in os.environ.items()
- if re.search("^COV|^PY", k)
- ]),
+ ('environment', sorted([
+ ("%s = %s" % (k, v)) for k, v in iitems(os.environ)
+ if re.search(r"^COV|^PY", k)
+ ])),
+ ('command_line', " ".join(getattr(sys, 'argv', ['???']))),
]
+ if self.source_match:
+ info.append(('source_match', self.source_match.info()))
+ if self.include_match:
+ info.append(('include_match', self.include_match.info()))
+ if self.omit_match:
+ info.append(('omit_match', self.omit_match.info()))
+ if self.cover_match:
+ info.append(('cover_match', self.cover_match.info()))
+ if self.pylib_match:
+ info.append(('pylib_match', self.pylib_match.info()))
+
return info
@@ -667,7 +770,10 @@ def process_startup():
cps = os.environ.get("COVERAGE_PROCESS_START")
if cps:
cov = coverage(config_file=cps, auto_data=True)
- if os.environ.get("COVERAGE_COVERAGE"):
- # Measuring coverage within coverage.py takes yet more trickery.
- cov.cover_dir = "Please measure coverage.py!"
cov.start()
+ cov._warn_no_data = False
+ cov._warn_unimported_source = False
+
+
+# A hack for debugging testing in subprocesses.
+_TEST_NAME_FILE = "" #"/tmp/covtest.txt"
diff --git a/python/helpers/coverage/data.py b/python/helpers/coverage/data.py
index 3263cb38883b..fb88c5b1e638 100644
--- a/python/helpers/coverage/data.py
+++ b/python/helpers/coverage/data.py
@@ -2,7 +2,9 @@
import os
-from coverage.backward import pickle, sorted # pylint: disable=W0622
+from coverage.backward import iitems, pickle, sorted # pylint: disable=W0622
+from coverage.files import PathAliases
+from coverage.misc import file_be_gone
class CoverageData(object):
@@ -21,15 +23,18 @@ class CoverageData(object):
"""
- def __init__(self, basename=None, collector=None):
+ def __init__(self, basename=None, collector=None, debug=None):
"""Create a CoverageData.
`basename` is the name of the file to use for storing data.
`collector` is a string describing the coverage measurement software.
+ `debug` is a `DebugControl` object for writing debug messages.
+
"""
self.collector = collector or 'unknown'
+ self.debug = debug
self.use_file = True
@@ -59,10 +64,6 @@ class CoverageData(object):
#
self.arcs = {}
- self.os = os
- self.sorted = sorted
- self.pickle = pickle
-
def usefile(self, use_file=True):
"""Set whether or not to use a disk file for data."""
self.use_file = use_file
@@ -92,21 +93,21 @@ class CoverageData(object):
def erase(self):
"""Erase the data, both in this object, and from its file storage."""
if self.use_file:
- if self.filename and os.path.exists(self.filename):
- os.remove(self.filename)
+ if self.filename:
+ file_be_gone(self.filename)
self.lines = {}
self.arcs = {}
def line_data(self):
"""Return the map from filenames to lists of line numbers executed."""
return dict(
- [(f, self.sorted(lmap.keys())) for f, lmap in self.lines.items()]
+ [(f, sorted(lmap.keys())) for f, lmap in iitems(self.lines)]
)
def arc_data(self):
"""Return the map from filenames to lists of line number pairs."""
return dict(
- [(f, self.sorted(amap.keys())) for f, amap in self.arcs.items()]
+ [(f, sorted(amap.keys())) for f, amap in iitems(self.arcs)]
)
def write_file(self, filename):
@@ -123,10 +124,13 @@ class CoverageData(object):
if self.collector:
data['collector'] = self.collector
+ if self.debug and self.debug.should('dataio'):
+ self.debug.write("Writing data to %r" % (filename,))
+
# Write the pickle to the file.
fdata = open(filename, 'wb')
try:
- self.pickle.dump(data, fdata, 2)
+ pickle.dump(data, fdata, 2)
finally:
fdata.close()
@@ -136,6 +140,8 @@ class CoverageData(object):
def raw_data(self, filename):
"""Return the raw pickled data from `filename`."""
+ if self.debug and self.debug.should('dataio'):
+ self.debug.write("Reading data from %r" % (filename,))
fdata = open(filename, 'rb')
try:
data = pickle.load(fdata)
@@ -158,33 +164,39 @@ class CoverageData(object):
# Unpack the 'lines' item.
lines = dict([
(f, dict.fromkeys(linenos, None))
- for f, linenos in data.get('lines', {}).items()
+ for f, linenos in iitems(data.get('lines', {}))
])
# Unpack the 'arcs' item.
arcs = dict([
(f, dict.fromkeys(arcpairs, None))
- for f, arcpairs in data.get('arcs', {}).items()
+ for f, arcpairs in iitems(data.get('arcs', {}))
])
except Exception:
pass
return lines, arcs
- def combine_parallel_data(self):
+ def combine_parallel_data(self, aliases=None):
"""Combine a number of data files together.
Treat `self.filename` as a file prefix, and combine the data from all
of the data files starting with that prefix plus a dot.
+ If `aliases` is provided, it's a `PathAliases` object that is used to
+ re-map paths to match the local machine's.
+
"""
+ aliases = aliases or PathAliases()
data_dir, local = os.path.split(self.filename)
localdot = local + '.'
for f in os.listdir(data_dir or '.'):
if f.startswith(localdot):
full_path = os.path.join(data_dir, f)
new_lines, new_arcs = self._read_file(full_path)
- for filename, file_data in new_lines.items():
+ for filename, file_data in iitems(new_lines):
+ filename = aliases.map(filename)
self.lines.setdefault(filename, {}).update(file_data)
- for filename, file_data in new_arcs.items():
+ for filename, file_data in iitems(new_arcs):
+ filename = aliases.map(filename)
self.arcs.setdefault(filename, {}).update(file_data)
if f != local:
os.remove(full_path)
@@ -195,7 +207,7 @@ class CoverageData(object):
`line_data` is { filename: { lineno: None, ... }, ...}
"""
- for filename, linenos in line_data.items():
+ for filename, linenos in iitems(line_data):
self.lines.setdefault(filename, {}).update(linenos)
def add_arc_data(self, arc_data):
@@ -204,7 +216,7 @@ class CoverageData(object):
`arc_data` is { filename: { (l1,l2): None, ... }, ...}
"""
- for filename, arcs in arc_data.items():
+ for filename, arcs in iitems(arc_data):
self.arcs.setdefault(filename, {}).update(arcs)
def touch_file(self, filename):
@@ -245,8 +257,8 @@ class CoverageData(object):
if fullpath:
filename_fn = lambda f: f
else:
- filename_fn = self.os.path.basename
- for filename, lines in self.lines.items():
+ filename_fn = os.path.basename
+ for filename, lines in iitems(self.lines):
summ[filename_fn(filename)] = len(lines)
return summ
diff --git a/python/helpers/coverage/debug.py b/python/helpers/coverage/debug.py
new file mode 100644
index 000000000000..104f3b1d0a43
--- /dev/null
+++ b/python/helpers/coverage/debug.py
@@ -0,0 +1,54 @@
+"""Control of and utilities for debugging."""
+
+import os
+
+
+# When debugging, it can be helpful to force some options, especially when
+# debugging the configuration mechanisms you usually use to control debugging!
+# This is a list of forced debugging options.
+FORCED_DEBUG = []
+
+
+class DebugControl(object):
+ """Control and output for debugging."""
+
+ def __init__(self, options, output):
+ """Configure the options and output file for debugging."""
+ self.options = options
+ self.output = output
+
+ def should(self, option):
+ """Decide whether to output debug information in category `option`."""
+ return (option in self.options or option in FORCED_DEBUG)
+
+ def write(self, msg):
+ """Write a line of debug output."""
+ if self.should('pid'):
+ msg = "pid %5d: %s" % (os.getpid(), msg)
+ self.output.write(msg+"\n")
+ self.output.flush()
+
+ def write_formatted_info(self, info):
+ """Write a sequence of (label,data) pairs nicely."""
+ for line in info_formatter(info):
+ self.write(" %s" % line)
+
+
+def info_formatter(info):
+ """Produce a sequence of formatted lines from info.
+
+ `info` is a sequence of pairs (label, data). The produced lines are
+ nicely formatted, ready to print.
+
+ """
+ label_len = max([len(l) for l, _d in info])
+ for label, data in info:
+ if data == []:
+ data = "-none-"
+ if isinstance(data, (list, tuple)):
+ prefix = "%*s:" % (label_len, label)
+ for e in data:
+ yield "%*s %s" % (label_len+1, prefix, e)
+ prefix = ""
+ else:
+ yield "%*s: %s" % (label_len, label, data)
diff --git a/python/helpers/coverage/execfile.py b/python/helpers/coverage/execfile.py
index 71227b715a3e..f6ebdf79bb9e 100644
--- a/python/helpers/coverage/execfile.py
+++ b/python/helpers/coverage/execfile.py
@@ -1,9 +1,9 @@
"""Execute files of Python code."""
-import imp, os, sys
+import imp, marshal, os, sys
from coverage.backward import exec_code_object, open_source
-from coverage.misc import NoSource, ExceptionDuringRun
+from coverage.misc import ExceptionDuringRun, NoCode, NoSource
try:
@@ -65,6 +65,8 @@ def run_python_module(modulename, args):
openfile.close()
# Finally, hand the file off to run_python_file for execution.
+ pathname = os.path.abspath(pathname)
+ args[0] = pathname
run_python_file(pathname, args, package=packagename)
@@ -82,34 +84,22 @@ def run_python_file(filename, args, package=None):
main_mod = imp.new_module('__main__')
sys.modules['__main__'] = main_mod
main_mod.__file__ = filename
- main_mod.__package__ = package
+ if package:
+ main_mod.__package__ = package
main_mod.__builtins__ = BUILTINS
- # Set sys.argv and the first path element properly.
+ # Set sys.argv properly.
old_argv = sys.argv
- old_path0 = sys.path[0]
sys.argv = args
- sys.path[0] = os.path.abspath(os.path.dirname(filename))
try:
- # Open the source file.
- try:
- source_file = open_source(filename)
- except IOError:
- raise NoSource("No file to run: %r" % filename)
+ # Make a code object somehow.
+ if filename.endswith(".pyc") or filename.endswith(".pyo"):
+ code = make_code_from_pyc(filename)
+ else:
+ code = make_code_from_py(filename)
- try:
- source = source_file.read()
- finally:
- source_file.close()
-
- # We have the source. `compile` still needs the last line to be clean,
- # so make sure it is, then compile a code object from it.
- if source[-1] != '\n':
- source += '\n'
- code = compile(source, filename, "exec")
-
- # Execute the source file.
+ # Execute the code object.
try:
exec_code_object(code, main_mod.__dict__)
except SystemExit:
@@ -130,4 +120,52 @@ def run_python_file(filename, args, package=None):
# Restore the old argv and path
sys.argv = old_argv
- sys.path[0] = old_path0
+
+def make_code_from_py(filename):
+ """Get source from `filename` and make a code object of it."""
+ # Open the source file.
+ try:
+ source_file = open_source(filename)
+ except IOError:
+ raise NoSource("No file to run: %r" % filename)
+
+ try:
+ source = source_file.read()
+ finally:
+ source_file.close()
+
+ # We have the source. `compile` still needs the last line to be clean,
+ # so make sure it is, then compile a code object from it.
+ if not source or source[-1] != '\n':
+ source += '\n'
+ code = compile(source, filename, "exec")
+
+ return code
+
+
+def make_code_from_pyc(filename):
+ """Get a code object from a .pyc file."""
+ try:
+ fpyc = open(filename, "rb")
+ except IOError:
+ raise NoCode("No file to run: %r" % filename)
+
+ try:
+ # First four bytes are a version-specific magic number. It has to
+ # match or we won't run the file.
+ magic = fpyc.read(4)
+ if magic != imp.get_magic():
+ raise NoCode("Bad magic number in .pyc file")
+
+ # Skip the junk in the header that we don't need.
+ fpyc.read(4) # Skip the moddate.
+ if sys.version_info >= (3, 3):
+ # 3.3 added another long to the header (size), skip it.
+ fpyc.read(4)
+
+ # The rest of the file is the code object we want.
+ code = marshal.load(fpyc)
+ finally:
+ fpyc.close()
+
+ return code
diff --git a/python/helpers/coverage/files.py b/python/helpers/coverage/files.py
index a68a0a7fef88..464535a81653 100644
--- a/python/helpers/coverage/files.py
+++ b/python/helpers/coverage/files.py
@@ -1,23 +1,21 @@
"""File wrangling."""
from coverage.backward import to_string
-import fnmatch, os, sys
+from coverage.misc import CoverageException
+import fnmatch, os, os.path, re, sys
+import ntpath, posixpath
class FileLocator(object):
"""Understand how filenames work."""
def __init__(self):
# The absolute path to our current directory.
- self.relative_dir = self.abs_file(os.curdir) + os.sep
+ self.relative_dir = os.path.normcase(abs_file(os.curdir) + os.sep)
# Cache of results of calling the canonical_filename() method, to
# avoid duplicating work.
self.canonical_filename_cache = {}
- def abs_file(self, filename):
- """Return the absolute normalized form of `filename`."""
- return os.path.normcase(os.path.abspath(os.path.realpath(filename)))
-
def relative_filename(self, filename):
"""Return the relative form of `filename`.
@@ -25,8 +23,9 @@ class FileLocator(object):
`FileLocator` was constructed.
"""
- if filename.startswith(self.relative_dir):
- filename = filename.replace(self.relative_dir, "")
+ fnorm = os.path.normcase(filename)
+ if fnorm.startswith(self.relative_dir):
+ filename = filename[len(self.relative_dir):]
return filename
def canonical_filename(self, filename):
@@ -36,19 +35,15 @@ class FileLocator(object):
"""
if filename not in self.canonical_filename_cache:
- f = filename
- if os.path.isabs(f) and not os.path.exists(f):
- if self.get_zip_data(f) is None:
- f = os.path.basename(f)
- if not os.path.isabs(f):
+ if not os.path.isabs(filename):
for path in [os.curdir] + sys.path:
if path is None:
continue
- g = os.path.join(path, f)
- if os.path.exists(g):
- f = g
+ f = os.path.join(path, filename)
+ if os.path.exists(f):
+ filename = f
break
- cf = self.abs_file(f)
+ cf = abs_file(filename)
self.canonical_filename_cache[filename] = cf
return self.canonical_filename_cache[filename]
@@ -77,6 +72,78 @@ class FileLocator(object):
return None
+if sys.platform == 'win32':
+
+ def actual_path(path):
+ """Get the actual path of `path`, including the correct case."""
+ if path in actual_path.cache:
+ return actual_path.cache[path]
+
+ head, tail = os.path.split(path)
+ if not tail:
+ actpath = head
+ elif not head:
+ actpath = tail
+ else:
+ head = actual_path(head)
+ if head in actual_path.list_cache:
+ files = actual_path.list_cache[head]
+ else:
+ try:
+ files = os.listdir(head)
+ except OSError:
+ files = []
+ actual_path.list_cache[head] = files
+ normtail = os.path.normcase(tail)
+ for f in files:
+ if os.path.normcase(f) == normtail:
+ tail = f
+ break
+ actpath = os.path.join(head, tail)
+ actual_path.cache[path] = actpath
+ return actpath
+
+ actual_path.cache = {}
+ actual_path.list_cache = {}
+
+else:
+ def actual_path(filename):
+ """The actual path for non-Windows platforms."""
+ return filename
+
+
+def abs_file(filename):
+ """Return the absolute normalized form of `filename`."""
+ path = os.path.expandvars(os.path.expanduser(filename))
+ path = os.path.abspath(os.path.realpath(path))
+ path = actual_path(path)
+ return path
+
+
+def isabs_anywhere(filename):
+ """Is `filename` an absolute path on any OS?"""
+ return ntpath.isabs(filename) or posixpath.isabs(filename)
+
+
+def prep_patterns(patterns):
+ """Prepare the file patterns for use in a `FnmatchMatcher`.
+
+ If a pattern starts with a wildcard, it is used as a pattern
+ as-is. If it does not start with a wildcard, then it is made
+ absolute with the current directory.
+
+ If `patterns` is None, an empty list is returned.
+
+ """
+ prepped = []
+ for p in patterns or []:
+ if p.startswith("*") or p.startswith("?"):
+ prepped.append(p)
+ else:
+ prepped.append(abs_file(p))
+ return prepped
+
+
class TreeMatcher(object):
"""A matcher for files in a tree."""
def __init__(self, directories):
@@ -85,6 +152,10 @@ class TreeMatcher(object):
def __repr__(self):
return "<TreeMatcher %r>" % self.dirs
+ def info(self):
+ """A list of strings for displaying when dumping state."""
+ return self.dirs
+
def add(self, directory):
"""Add another directory to the list we match for."""
self.dirs.append(directory)
@@ -110,6 +181,10 @@ class FnmatchMatcher(object):
def __repr__(self):
return "<FnmatchMatcher %r>" % self.pats
+ def info(self):
+ """A list of strings for displaying when dumping state."""
+ return self.pats
+
def match(self, fpath):
"""Does `fpath` match one of our filename patterns?"""
for pat in self.pats:
@@ -118,14 +193,117 @@ class FnmatchMatcher(object):
return False
+def sep(s):
+ """Find the path separator used in this string, or os.sep if none."""
+ sep_match = re.search(r"[\\/]", s)
+ if sep_match:
+ the_sep = sep_match.group(0)
+ else:
+ the_sep = os.sep
+ return the_sep
+
+
+class PathAliases(object):
+ """A collection of aliases for paths.
+
+ When combining data files from remote machines, often the paths to source
+ code are different, for example, due to OS differences, or because of
+ serialized checkouts on continuous integration machines.
+
+ A `PathAliases` object tracks a list of pattern/result pairs, and can
+ map a path through those aliases to produce a unified path.
+
+ `locator` is a FileLocator that is used to canonicalize the results.
+
+ """
+ def __init__(self, locator=None):
+ self.aliases = []
+ self.locator = locator
+
+ def add(self, pattern, result):
+ """Add the `pattern`/`result` pair to the list of aliases.
+
+ `pattern` is an `fnmatch`-style pattern. `result` is a simple
+ string. When mapping paths, if a path starts with a match against
+ `pattern`, then that match is replaced with `result`. This models
+ isomorphic source trees being rooted at different places on two
+ different machines.
+
+ `pattern` can't end with a wildcard component, since that would
+ match an entire tree, and not just its root.
+
+ """
+ # The pattern can't end with a wildcard component.
+ pattern = pattern.rstrip(r"\/")
+ if pattern.endswith("*"):
+ raise CoverageException("Pattern must not end with wildcards.")
+ pattern_sep = sep(pattern)
+
+ # The pattern is meant to match a filepath. Let's make it absolute
+ # unless it already is, or is meant to match any prefix.
+ if not pattern.startswith('*') and not isabs_anywhere(pattern):
+ pattern = abs_file(pattern)
+ pattern += pattern_sep
+
+ # Make a regex from the pattern. fnmatch always adds a \Z or $ to
+ # match the whole string, which we don't want.
+ regex_pat = fnmatch.translate(pattern).replace(r'\Z(', '(')
+ if regex_pat.endswith("$"):
+ regex_pat = regex_pat[:-1]
+ # We want */a/b.py to match on Windows too, so change slash to match
+ # either separator.
+ regex_pat = regex_pat.replace(r"\/", r"[\\/]")
+ # We want case-insensitive matching, so add that flag.
+ regex = re.compile(r"(?i)" + regex_pat)
+
+ # Normalize the result: it must end with a path separator.
+ result_sep = sep(result)
+ result = result.rstrip(r"\/") + result_sep
+ self.aliases.append((regex, result, pattern_sep, result_sep))
+
+ def map(self, path):
+ """Map `path` through the aliases.
+
+ `path` is checked against all of the patterns. The first pattern to
+ match is used to replace the root of the path with the result root.
+ Only one pattern is ever used. If no patterns match, `path` is
+ returned unchanged.
+
+ The separator style in the result is made to match that of the result
+ in the alias.
+
+ """
+ for regex, result, pattern_sep, result_sep in self.aliases:
+ m = regex.match(path)
+ if m:
+ new = path.replace(m.group(0), result)
+ if pattern_sep != result_sep:
+ new = new.replace(pattern_sep, result_sep)
+ if self.locator:
+ new = self.locator.canonical_filename(new)
+ return new
+ return path
+
+
def find_python_files(dirname):
- """Yield all of the importable Python files in `dirname`, recursively."""
- for dirpath, dirnames, filenames in os.walk(dirname, topdown=True):
- if '__init__.py' not in filenames:
+ """Yield all of the importable Python files in `dirname`, recursively.
+
+ To be importable, the files have to be in a directory with a __init__.py,
+ except for `dirname` itself, which isn't required to have one. The
+ assumption is that `dirname` was specified directly, so the user knows
+ best, but subdirectories are checked for a __init__.py to be sure we only
+ find the importable files.
+
+ """
+ for i, (dirpath, dirnames, filenames) in enumerate(os.walk(dirname)):
+ if i > 0 and '__init__.py' not in filenames:
# If a directory doesn't have __init__.py, then it isn't
# importable and neither are its files
del dirnames[:]
continue
for filename in filenames:
- if fnmatch.fnmatch(filename, "*.py"):
+ # We're only interested in files that look like reasonable Python
+ # files: Must end with .py or .pyw, and must not have certain funny
+ # characters that probably mean they are editor junk.
+ if re.match(r"^[^.#~!$@%^&*()+=,]+\.pyw?$", filename):
yield os.path.join(dirpath, filename)
diff --git a/python/helpers/coverage/fullcoverage/encodings.py b/python/helpers/coverage/fullcoverage/encodings.py
new file mode 100644
index 000000000000..6a258d6710c4
--- /dev/null
+++ b/python/helpers/coverage/fullcoverage/encodings.py
@@ -0,0 +1,57 @@
+"""Imposter encodings module that installs a coverage-style tracer.
+
+This is NOT the encodings module; it is an imposter that sets up tracing
+instrumentation and then replaces itself with the real encodings module.
+
+If the directory that holds this file is placed first in the PYTHONPATH when
+using "coverage" to run Python's tests, then this file will become the very
+first module imported by the internals of Python 3. It installs a
+coverage-compatible trace function that can watch Standard Library modules
+execute from the very earliest stages of Python's own boot process. This fixes
+a problem with coverage - that it starts too late to trace the coverage of many
+of the most fundamental modules in the Standard Library.
+
+"""
+
+import sys
+
+class FullCoverageTracer(object):
+ def __init__(self):
+ # `traces` is a list of trace events. Frames are tricky: the same
+ # frame object is used for a whole scope, with new line numbers
+ # written into it. So in one scope, all the frame objects are the
+ # same object, and will eventually all will point to the last line
+ # executed. So we keep the line numbers alongside the frames.
+ # The list looks like:
+ #
+ # traces = [
+ # ((frame, event, arg), lineno), ...
+ # ]
+ #
+ self.traces = []
+
+ def fullcoverage_trace(self, *args):
+ frame, event, arg = args
+ self.traces.append((args, frame.f_lineno))
+ return self.fullcoverage_trace
+
+sys.settrace(FullCoverageTracer().fullcoverage_trace)
+
+# In coverage/files.py is actual_filename(), which uses glob.glob. I don't
+# understand why, but that use of glob borks everything if fullcoverage is in
+# effect. So here we make an ugly hail-mary pass to switch off glob.glob over
+# there. This means when using fullcoverage, Windows path names will not be
+# their actual case.
+
+#sys.fullcoverage = True
+
+# Finally, remove our own directory from sys.path; remove ourselves from
+# sys.modules; and re-import "encodings", which will be the real package
+# this time. Note that the delete from sys.modules dictionary has to
+# happen last, since all of the symbols in this module will become None
+# at that exact moment, including "sys".
+
+parentdir = max(filter(__file__.startswith, sys.path), key=len)
+sys.path.remove(parentdir)
+del sys.modules['encodings']
+import encodings
diff --git a/python/helpers/coverage/html.py b/python/helpers/coverage/html.py
index fffd9b45b41a..5242236c1ed9 100644
--- a/python/helpers/coverage/html.py
+++ b/python/helpers/coverage/html.py
@@ -1,21 +1,45 @@
"""HTML reporting for Coverage."""
-import os, re, shutil
+import os, re, shutil, sys
import coverage
from coverage.backward import pickle
from coverage.misc import CoverageException, Hasher
-from coverage.phystokens import source_token_lines
+from coverage.phystokens import source_token_lines, source_encoding
from coverage.report import Reporter
+from coverage.results import Numbers
from coverage.templite import Templite
-# Disable pylint msg W0612, because a bunch of variables look unused, but
-# they're accessed in a Templite context via locals().
-# pylint: disable=W0612
-def data_filename(fname):
- """Return the path to a data file of ours."""
- return os.path.join(os.path.split(__file__)[0], fname)
+# Static files are looked for in a list of places.
+STATIC_PATH = [
+ # The place Debian puts system Javascript libraries.
+ "/usr/share/javascript",
+
+ # Our htmlfiles directory.
+ os.path.join(os.path.dirname(__file__), "htmlfiles"),
+]
+
+def data_filename(fname, pkgdir=""):
+ """Return the path to a data file of ours.
+
+ The file is searched for on `STATIC_PATH`, and the first place it's found,
+ is returned.
+
+ Each directory in `STATIC_PATH` is searched as-is, and also, if `pkgdir`
+ is provided, at that subdirectory.
+
+ """
+ for static_dir in STATIC_PATH:
+ static_filename = os.path.join(static_dir, fname)
+ if os.path.exists(static_filename):
+ return static_filename
+ if pkgdir:
+ static_filename = os.path.join(static_dir, pkgdir, fname)
+ if os.path.exists(static_filename):
+ return static_filename
+ raise CoverageException("Couldn't find static file %r" % fname)
+
def data(fname):
"""Return the contents of a data file of ours."""
@@ -31,26 +55,27 @@ class HtmlReporter(Reporter):
# These files will be copied from the htmlfiles dir to the output dir.
STATIC_FILES = [
- "style.css",
- "jquery-1.4.3.min.js",
- "jquery.hotkeys.js",
- "jquery.isonscreen.js",
- "jquery.tablesorter.min.js",
- "coverage_html.js",
- "keybd_closed.png",
- "keybd_open.png",
+ ("style.css", ""),
+ ("jquery.min.js", "jquery"),
+ ("jquery.hotkeys.js", "jquery-hotkeys"),
+ ("jquery.isonscreen.js", "jquery-isonscreen"),
+ ("jquery.tablesorter.min.js", "jquery-tablesorter"),
+ ("coverage_html.js", ""),
+ ("keybd_closed.png", ""),
+ ("keybd_open.png", ""),
]
- def __init__(self, cov, ignore_errors=False):
- super(HtmlReporter, self).__init__(cov, ignore_errors)
+ def __init__(self, cov, config):
+ super(HtmlReporter, self).__init__(cov, config)
self.directory = None
self.template_globals = {
'escape': escape,
+ 'title': self.config.html_title,
'__url__': coverage.__url__,
'__version__': coverage.__version__,
}
self.source_tmpl = Templite(
- data("htmlfiles/pyfile.html"), self.template_globals
+ data("pyfile.html"), self.template_globals
)
self.coverage = cov
@@ -58,29 +83,34 @@ class HtmlReporter(Reporter):
self.files = []
self.arcs = self.coverage.data.has_arcs()
self.status = HtmlStatus()
+ self.extra_css = None
+ self.totals = Numbers()
- def report(self, morfs, config=None):
+ def report(self, morfs):
"""Generate an HTML report for `morfs`.
- `morfs` is a list of modules or filenames. `config` is a
- CoverageConfig instance.
+ `morfs` is a list of modules or filenames.
"""
- assert config.html_dir, "must provide a directory for html reporting"
+ assert self.config.html_dir, "must give a directory for html reporting"
# Read the status data.
- self.status.read(config.html_dir)
+ self.status.read(self.config.html_dir)
# Check that this run used the same settings as the last run.
m = Hasher()
- m.update(config)
+ m.update(self.config)
these_settings = m.digest()
if self.status.settings_hash() != these_settings:
self.status.reset()
self.status.set_settings_hash(these_settings)
+ # The user may have extra CSS they want copied.
+ if self.config.extra_css:
+ self.extra_css = os.path.basename(self.config.extra_css)
+
# Process all the files.
- self.report_files(self.html_file, morfs, config, config.html_dir)
+ self.report_files(self.html_file, morfs, self.config.html_dir)
if not self.files:
raise CoverageException("No data to report.")
@@ -88,13 +118,34 @@ class HtmlReporter(Reporter):
# Write the index file.
self.index_file()
- # Create the once-per-directory files.
- for static in self.STATIC_FILES:
+ self.make_local_static_report_files()
+
+ return self.totals.pc_covered
+
+ def make_local_static_report_files(self):
+ """Make local instances of static files for HTML report."""
+ # The files we provide must always be copied.
+ for static, pkgdir in self.STATIC_FILES:
shutil.copyfile(
- data_filename("htmlfiles/" + static),
+ data_filename(static, pkgdir),
os.path.join(self.directory, static)
)
+ # The user may have extra CSS they want copied.
+ if self.extra_css:
+ shutil.copyfile(
+ self.config.extra_css,
+ os.path.join(self.directory, self.extra_css)
+ )
+
+ def write_html(self, fname, html):
+ """Write `html` to `fname`, properly encoded."""
+ fout = open(fname, "wb")
+ try:
+ fout.write(html.encode('ascii', 'xmlcharrefreplace'))
+ finally:
+ fout.close()
+
def file_hash(self, source, cu):
"""Compute a hash that changes if the file needs to be re-reported."""
m = Hasher()
@@ -121,11 +172,20 @@ class HtmlReporter(Reporter):
self.status.set_file_hash(flat_rootname, this_hash)
+ # If need be, determine the encoding of the source file. We use it
+ # later to properly write the HTML.
+ if sys.version_info < (3, 0):
+ encoding = source_encoding(source)
+ # Some UTF8 files have the dreaded UTF8 BOM. If so, junk it.
+ if encoding.startswith("utf-8") and source[:3] == "\xef\xbb\xbf":
+ source = source[3:]
+ encoding = "utf-8"
+
+ # Get the numbers for this file.
nums = analysis.numbers
- missing_branch_arcs = analysis.missing_branch_arcs()
- n_par = 0 # accumulated below.
- arcs = self.arcs
+ if self.arcs:
+ missing_branch_arcs = analysis.missing_branch_arcs()
# These classes determine which lines are highlighted by default.
c_run = "run hide_run"
@@ -149,7 +209,6 @@ class HtmlReporter(Reporter):
line_class.append(c_mis)
elif self.arcs and lineno in missing_branch_arcs:
line_class.append(c_par)
- n_par += 1
annlines = []
for b in missing_branch_arcs[lineno]:
if b < 0:
@@ -184,19 +243,22 @@ class HtmlReporter(Reporter):
})
# Write the HTML page for this file.
+ html = spaceless(self.source_tmpl.render({
+ 'c_exc': c_exc, 'c_mis': c_mis, 'c_par': c_par, 'c_run': c_run,
+ 'arcs': self.arcs, 'extra_css': self.extra_css,
+ 'cu': cu, 'nums': nums, 'lines': lines,
+ }))
+
+ if sys.version_info < (3, 0):
+ html = html.decode(encoding)
+
html_filename = flat_rootname + ".html"
html_path = os.path.join(self.directory, html_filename)
- html = spaceless(self.source_tmpl.render(locals()))
- fhtml = open(html_path, 'w')
- try:
- fhtml.write(html)
- finally:
- fhtml.close()
+ self.write_html(html_path, html)
# Save this file's information for the index file.
index_info = {
'nums': nums,
- 'par': n_par,
'html_filename': html_filename,
'name': cu.name,
}
@@ -206,19 +268,24 @@ class HtmlReporter(Reporter):
def index_file(self):
"""Write the index.html file for this report."""
index_tmpl = Templite(
- data("htmlfiles/index.html"), self.template_globals
+ data("index.html"), self.template_globals
)
- files = self.files
- arcs = self.arcs
-
- totals = sum([f['nums'] for f in files])
+ self.totals = sum([f['nums'] for f in self.files])
- fhtml = open(os.path.join(self.directory, "index.html"), "w")
- try:
- fhtml.write(index_tmpl.render(locals()))
- finally:
- fhtml.close()
+ html = index_tmpl.render({
+ 'arcs': self.arcs,
+ 'extra_css': self.extra_css,
+ 'files': self.files,
+ 'totals': self.totals,
+ })
+
+ if sys.version_info < (3, 0):
+ html = html.decode("utf-8")
+ self.write_html(
+ os.path.join(self.directory, "index.html"),
+ html
+ )
# Write the latest hashes for next time.
self.status.write(self.directory)
@@ -243,8 +310,12 @@ class HtmlStatus(object):
usable = False
try:
status_file = os.path.join(directory, self.STATUS_FILE)
- status = pickle.load(open(status_file, "rb"))
- except IOError:
+ fstatus = open(status_file, "rb")
+ try:
+ status = pickle.load(fstatus)
+ finally:
+ fstatus.close()
+ except (IOError, ValueError):
usable = False
else:
usable = True
@@ -321,5 +392,5 @@ def spaceless(html):
Get rid of some.
"""
- html = re.sub(">\s+<p ", ">\n<p ", html)
+ html = re.sub(r">\s+<p ", ">\n<p ", html)
return html
diff --git a/python/helpers/coverage/htmlfiles/coverage_html.js b/python/helpers/coverage/htmlfiles/coverage_html.js
index da3e22c812c1..b24006d25e00 100644
--- a/python/helpers/coverage/htmlfiles/coverage_html.js
+++ b/python/helpers/coverage/htmlfiles/coverage_html.js
@@ -122,6 +122,11 @@ coverage.pyfile_ready = function ($) {
.bind('keydown', '1', coverage.to_first_chunk)
;
+ $(".button_toggle_run").click(function (evt) {coverage.toggle_lines(evt.target, "run");});
+ $(".button_toggle_exc").click(function (evt) {coverage.toggle_lines(evt.target, "exc");});
+ $(".button_toggle_mis").click(function (evt) {coverage.toggle_lines(evt.target, "mis");});
+ $(".button_toggle_par").click(function (evt) {coverage.toggle_lines(evt.target, "par");});
+
coverage.assign_shortkeys();
coverage.wire_up_help_panel();
};
@@ -369,4 +374,3 @@ coverage.scroll_window = function (to_pos) {
coverage.finish_scrolling = function () {
$("html,body").stop(true, true);
};
-
diff --git a/python/helpers/coverage/htmlfiles/index.html b/python/helpers/coverage/htmlfiles/index.html
index 04b314a3427c..c831823dd239 100644
--- a/python/helpers/coverage/htmlfiles/index.html
+++ b/python/helpers/coverage/htmlfiles/index.html
@@ -2,9 +2,12 @@
<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
- <title>Coverage report</title>
+ <title>{{ title|escape }}</title>
<link rel='stylesheet' href='style.css' type='text/css'>
- <script type='text/javascript' src='jquery-1.4.3.min.js'></script>
+ {% if extra_css %}
+ <link rel='stylesheet' href='{{ extra_css }}' type='text/css'>
+ {% endif %}
+ <script type='text/javascript' src='jquery.min.js'></script>
<script type='text/javascript' src='jquery.tablesorter.min.js'></script>
<script type='text/javascript' src='jquery.hotkeys.js'></script>
<script type='text/javascript' src='coverage_html.js'></script>
@@ -16,7 +19,7 @@
<div id='header'>
<div class='content'>
- <h1>Coverage report:
+ <h1>{{ title|escape }}:
<span class='pc_cov'>{{totals.pc_covered_str}}%</span>
</h1>
<img id='keyboard_icon' src='keybd_closed.png'>
@@ -66,7 +69,7 @@
<td>{{totals.n_excluded}}</td>
{% if arcs %}
<td>{{totals.n_branches}}</td>
- <td>{{totals.n_missing_branches}}</td>
+ <td>{{totals.n_partial_branches}}</td>
{% endif %}
<td class='right'>{{totals.pc_covered_str}}%</td>
</tr>
@@ -80,7 +83,7 @@
<td>{{file.nums.n_excluded}}</td>
{% if arcs %}
<td>{{file.nums.n_branches}}</td>
- <td>{{file.nums.n_missing_branches}}</td>
+ <td>{{file.nums.n_partial_branches}}</td>
{% endif %}
<td class='right'>{{file.nums.pc_covered_str}}%</td>
</tr>
diff --git a/python/helpers/coverage/htmlfiles/jquery-1.4.3.min.js b/python/helpers/coverage/htmlfiles/jquery.min.js
index c941a5f7a9f3..c941a5f7a9f3 100644
--- a/python/helpers/coverage/htmlfiles/jquery-1.4.3.min.js
+++ b/python/helpers/coverage/htmlfiles/jquery.min.js
diff --git a/python/helpers/coverage/htmlfiles/keybd_closed.png b/python/helpers/coverage/htmlfiles/keybd_closed.png
index 6843abf0998b..f2b0418d2a33 100644..100755
--- a/python/helpers/coverage/htmlfiles/keybd_closed.png
+++ b/python/helpers/coverage/htmlfiles/keybd_closed.png
Binary files differ
diff --git a/python/helpers/coverage/htmlfiles/keybd_open.png b/python/helpers/coverage/htmlfiles/keybd_open.png
index 5a681ea70582..a77961db5424 100644..100755
--- a/python/helpers/coverage/htmlfiles/keybd_open.png
+++ b/python/helpers/coverage/htmlfiles/keybd_open.png
Binary files differ
diff --git a/python/helpers/coverage/htmlfiles/pyfile.html b/python/helpers/coverage/htmlfiles/pyfile.html
index ee0a3b1bbc8b..88c158dd41de 100644
--- a/python/helpers/coverage/htmlfiles/pyfile.html
+++ b/python/helpers/coverage/htmlfiles/pyfile.html
@@ -7,7 +7,10 @@
<meta http-equiv='X-UA-Compatible' content='IE=emulateIE7' />
<title>Coverage for {{cu.name|escape}}: {{nums.pc_covered_str}}%</title>
<link rel='stylesheet' href='style.css' type='text/css'>
- <script type='text/javascript' src='jquery-1.4.3.min.js'></script>
+ {% if extra_css %}
+ <link rel='stylesheet' href='{{ extra_css }}' type='text/css'>
+ {% endif %}
+ <script type='text/javascript' src='jquery.min.js'></script>
<script type='text/javascript' src='jquery.hotkeys.js'></script>
<script type='text/javascript' src='jquery.isonscreen.js'></script>
<script type='text/javascript' src='coverage_html.js'></script>
@@ -24,12 +27,12 @@
</h1>
<img id='keyboard_icon' src='keybd_closed.png'>
<h2 class='stats'>
- {{nums.n_statements}} statements
- <span class='{{c_run}} shortkey_r' onclick='coverage.toggle_lines(this, "run")'>{{nums.n_executed}} run</span>
- <span class='{{c_mis}} shortkey_m' onclick='coverage.toggle_lines(this, "mis")'>{{nums.n_missing}} missing</span>
- <span class='{{c_exc}} shortkey_x' onclick='coverage.toggle_lines(this, "exc")'>{{nums.n_excluded}} excluded</span>
+ {{nums.n_statements}} statements &nbsp;
+ <span class='{{c_run}} shortkey_r button_toggle_run'>{{nums.n_executed}} run</span>
+ <span class='{{c_mis}} shortkey_m button_toggle_mis'>{{nums.n_missing}} missing</span>
+ <span class='{{c_exc}} shortkey_x button_toggle_exc'>{{nums.n_excluded}} excluded</span>
{% if arcs %}
- <span class='{{c_par}} shortkey_p' onclick='coverage.toggle_lines(this, "par")'>{{n_par}} partial</span>
+ <span class='{{c_par}} shortkey_p button_toggle_par'>{{nums.n_partial_branches}} partial</span>
{% endif %}
</h2>
</div>
diff --git a/python/helpers/coverage/htmlfiles/style.css b/python/helpers/coverage/htmlfiles/style.css
index c40357b8b482..811c64019c06 100644
--- a/python/helpers/coverage/htmlfiles/style.css
+++ b/python/helpers/coverage/htmlfiles/style.css
@@ -24,8 +24,8 @@ html>body {
/* Set base font size to 12/16 */
p {
- font-size: .75em; /* 12/16 */
- line-height: 1.3333em; /* 16/12 */
+ font-size: .75em; /* 12/16 */
+ line-height: 1.33333333em; /* 16/12 */
}
table {
@@ -102,6 +102,31 @@ h2.stats {
border-color: #999 #ccc #ccc #999;
}
+.stats span.run {
+ background: #ddffdd;
+}
+.stats span.exc {
+ background: #eeeeee;
+}
+.stats span.mis {
+ background: #ffdddd;
+}
+.stats span.hide_run {
+ background: #eeffee;
+}
+.stats span.hide_exc {
+ background: #f5f5f5;
+}
+.stats span.hide_mis {
+ background: #ffeeee;
+}
+.stats span.par {
+ background: #ffffaa;
+}
+.stats span.hide_par {
+ background: #ffffcc;
+}
+
/* Help panel */
#keyboard_icon {
float: right;
diff --git a/python/helpers/coverage/misc.py b/python/helpers/coverage/misc.py
index fd9be8572a5b..0378173fcc3d 100644
--- a/python/helpers/coverage/misc.py
+++ b/python/helpers/coverage/misc.py
@@ -1,6 +1,10 @@
"""Miscellaneous stuff for Coverage."""
+import errno
import inspect
+import os
+import sys
+
from coverage.backward import md5, sorted # pylint: disable=W0622
from coverage.backward import string_class, to_bytes
@@ -34,6 +38,8 @@ def format_lines(statements, lines):
i = 0
j = 0
start = None
+ statements = sorted(statements)
+ lines = sorted(lines)
while i < len(statements) and j < len(lines):
if statements[i] == lines[j]:
if start == None:
@@ -50,6 +56,12 @@ def format_lines(statements, lines):
return ret
+def short_stack():
+ """Return a string summarizing the call stack."""
+ stack = inspect.stack()[:0:-1]
+ return "\n".join(["%30s : %s @%d" % (t[3],t[1],t[2]) for t in stack])
+
+
def expensive(fn):
"""A decorator to cache the result of an expensive operation.
@@ -76,13 +88,23 @@ def bool_or_none(b):
def join_regex(regexes):
"""Combine a list of regexes into one that matches any of them."""
if len(regexes) > 1:
- return "(" + ")|(".join(regexes) + ")"
+ return "|".join(["(%s)" % r for r in regexes])
elif regexes:
return regexes[0]
else:
return ""
+def file_be_gone(path):
+ """Remove a file, and don't get annoyed if it doesn't exist."""
+ try:
+ os.remove(path)
+ except OSError:
+ _, e, _ = sys.exc_info()
+ if e.errno != errno.ENOENT:
+ raise
+
+
class Hasher(object):
"""Hashes Python data into md5."""
def __init__(self):
@@ -93,8 +115,10 @@ class Hasher(object):
self.md5.update(to_bytes(str(type(v))))
if isinstance(v, string_class):
self.md5.update(to_bytes(v))
+ elif v is None:
+ pass
elif isinstance(v, (int, float)):
- self.update(str(v))
+ self.md5.update(to_bytes(str(v)))
elif isinstance(v, (tuple, list)):
for e in v:
self.update(e)
@@ -126,6 +150,10 @@ class NoSource(CoverageException):
"""We couldn't find the source for a module."""
pass
+class NoCode(NoSource):
+ """We couldn't find any code at all."""
+ pass
+
class NotPython(CoverageException):
"""A source file turned out not to be parsable Python."""
pass
diff --git a/python/helpers/coverage/parser.py b/python/helpers/coverage/parser.py
index cbbb5a6a2ec1..7a145a2a5346 100644
--- a/python/helpers/coverage/parser.py
+++ b/python/helpers/coverage/parser.py
@@ -1,9 +1,11 @@
"""Code parsing for Coverage."""
-import glob, opcode, os, re, sys, token, tokenize
+import dis, re, sys, token, tokenize
from coverage.backward import set, sorted, StringIO # pylint: disable=W0622
-from coverage.backward import open_source
+from coverage.backward import open_source, range # pylint: disable=W0622
+from coverage.backward import reversed # pylint: disable=W0622
+from coverage.backward import bytes_to_ints
from coverage.bytecode import ByteCodes, CodeObjects
from coverage.misc import nice_pair, expensive, join_regex
from coverage.misc import CoverageException, NoSource, NotPython
@@ -32,9 +34,13 @@ class CodeParser(object):
except IOError:
_, err, _ = sys.exc_info()
raise NoSource(
- "No source for code: %r: %s" % (self.filename, err)
+ "No source for code: '%s': %s" % (self.filename, err)
)
+ # Scrap the BOM if it exists.
+ if self.text and ord(self.text[0]) == 0xfeff:
+ self.text = self.text[1:]
+
self.exclude = exclude
self.show_tokens = False
@@ -102,9 +108,9 @@ class CodeParser(object):
first_line = None
empty = True
- tokgen = tokenize.generate_tokens(StringIO(self.text).readline)
+ tokgen = generate_tokens(self.text)
for toktype, ttext, (slineno, _), (elineno, _), ltext in tokgen:
- if self.show_tokens: # pragma: no cover
+ if self.show_tokens: # pragma: not covered
print("%10s %5s %-20r %r" % (
tokenize.tok_name.get(toktype, toktype),
nice_pair((slineno, elineno)), ttext, ltext
@@ -130,8 +136,7 @@ class CodeParser(object):
# (a trick from trace.py in the stdlib.) This works for
# 99.9999% of cases. For the rest (!) see:
# http://stackoverflow.com/questions/1769332/x/1769794#1769794
- for i in range(slineno, elineno+1):
- self.docstrings.add(i)
+ self.docstrings.update(range(slineno, elineno+1))
elif toktype == token.NEWLINE:
if first_line is not None and elineno != first_line:
# We're at the end of a line, and we've ended on a
@@ -170,16 +175,18 @@ class CodeParser(object):
first_line = line
return first_line
- def first_lines(self, lines, ignore=None):
+ def first_lines(self, lines, *ignores):
"""Map the line numbers in `lines` to the correct first line of the
statement.
- Skip any line mentioned in `ignore`.
+ Skip any line mentioned in any of the sequences in `ignores`.
- Returns a sorted list of the first lines.
+ Returns a set of the first lines.
"""
- ignore = ignore or []
+ ignore = set()
+ for ign in ignores:
+ ignore.update(ign)
lset = set()
for l in lines:
if l in ignore:
@@ -187,23 +194,34 @@ class CodeParser(object):
new_l = self.first_line(l)
if new_l not in ignore:
lset.add(new_l)
- return sorted(lset)
+ return lset
def parse_source(self):
"""Parse source text to find executable lines, excluded lines, etc.
- Return values are 1) a sorted list of executable line numbers, and
- 2) a sorted list of excluded line numbers.
+ Return values are 1) a set of executable line numbers, and 2) a set of
+ excluded line numbers.
Reported line numbers are normalized to the first line of multi-line
statements.
"""
- self._raw_parse()
+ try:
+ self._raw_parse()
+ except (tokenize.TokenError, IndentationError):
+ _, tokerr, _ = sys.exc_info()
+ msg, lineno = tokerr.args
+ raise NotPython(
+ "Couldn't parse '%s' as Python source: '%s' at %s" %
+ (self.filename, msg, lineno)
+ )
excluded_lines = self.first_lines(self.excluded)
- ignore = excluded_lines + list(self.docstrings)
- lines = self.first_lines(self.statement_starts, ignore)
+ lines = self.first_lines(
+ self.statement_starts,
+ excluded_lines,
+ self.docstrings
+ )
return lines, excluded_lines
@@ -258,8 +276,8 @@ class CodeParser(object):
## Opcodes that guide the ByteParser.
def _opcode(name):
- """Return the opcode by name from the opcode module."""
- return opcode.opmap[name]
+ """Return the opcode by name from the dis module."""
+ return dis.opmap[name]
def _opcode_set(*names):
"""Return a set of opcodes by the names in `names`."""
@@ -297,7 +315,7 @@ OPS_EXCEPT_BLOCKS = _opcode_set('SETUP_EXCEPT', 'SETUP_FINALLY')
OPS_POP_BLOCK = _opcode_set('POP_BLOCK')
# Opcodes that have a jump destination, but aren't really a jump.
-OPS_NO_JUMP = _opcode_set('SETUP_EXCEPT', 'SETUP_FINALLY')
+OPS_NO_JUMP = OPS_PUSH_BLOCK
# Individual opcodes we need below.
OP_BREAK_LOOP = _opcode('BREAK_LOOP')
@@ -314,6 +332,7 @@ class ByteParser(object):
def __init__(self, code=None, text=None, filename=None):
if code:
self.code = code
+ self.text = text
else:
if not text:
assert filename, "If no code or text, need a filename"
@@ -322,6 +341,7 @@ class ByteParser(object):
text = sourcef.read()
finally:
sourcef.close()
+ self.text = text
try:
# Python 2.3 and 2.4 don't like partial last lines, so be sure
@@ -350,69 +370,54 @@ class ByteParser(object):
The iteration includes `self` as its first value.
"""
- return map(lambda c: ByteParser(code=c), CodeObjects(self.code))
-
- # Getting numbers from the lnotab value changed in Py3.0.
- if sys.version_info >= (3, 0):
- def _lnotab_increments(self, lnotab):
- """Return a list of ints from the lnotab bytes in 3.x"""
- return list(lnotab)
- else:
- def _lnotab_increments(self, lnotab):
- """Return a list of ints from the lnotab string in 2.x"""
- return [ord(c) for c in lnotab]
+ children = CodeObjects(self.code)
+ return [ByteParser(code=c, text=self.text) for c in children]
def _bytes_lines(self):
"""Map byte offsets to line numbers in `code`.
Uses co_lnotab described in Python/compile.c to map byte offsets to
- line numbers. Returns a list: [(b0, l0), (b1, l1), ...]
+ line numbers. Produces a sequence: (b0, l0), (b1, l1), ...
+
+ Only byte offsets that correspond to line numbers are included in the
+ results.
"""
# Adapted from dis.py in the standard library.
- byte_increments = self._lnotab_increments(self.code.co_lnotab[0::2])
- line_increments = self._lnotab_increments(self.code.co_lnotab[1::2])
+ byte_increments = bytes_to_ints(self.code.co_lnotab[0::2])
+ line_increments = bytes_to_ints(self.code.co_lnotab[1::2])
- bytes_lines = []
last_line_num = None
line_num = self.code.co_firstlineno
byte_num = 0
for byte_incr, line_incr in zip(byte_increments, line_increments):
if byte_incr:
if line_num != last_line_num:
- bytes_lines.append((byte_num, line_num))
+ yield (byte_num, line_num)
last_line_num = line_num
byte_num += byte_incr
line_num += line_incr
if line_num != last_line_num:
- bytes_lines.append((byte_num, line_num))
- return bytes_lines
+ yield (byte_num, line_num)
def _find_statements(self):
"""Find the statements in `self.code`.
- Return a set of line numbers that start statements. Recurses into all
- code objects reachable from `self.code`.
+ Produce a sequence of line numbers that start statements. Recurses
+ into all code objects reachable from `self.code`.
"""
- stmts = set()
for bp in self.child_parsers():
# Get all of the lineno information from this code.
for _, l in bp._bytes_lines():
- stmts.add(l)
- return stmts
-
- def _disassemble(self): # pragma: no cover
- """Disassemble code, for ad-hoc experimenting."""
-
- import dis
-
- for bp in self.child_parsers():
- print("\n%s: " % bp.code)
- dis.dis(bp.code)
- print("Bytes lines: %r" % bp._bytes_lines())
+ yield l
- print("")
+ def _block_stack_repr(self, block_stack):
+ """Get a string version of `block_stack`, for debugging."""
+ blocks = ", ".join(
+ ["(%s, %r)" % (dis.opname[b[0]], b[1]) for b in block_stack]
+ )
+ return "[" + blocks + "]"
def _split_into_chunks(self):
"""Split the code object into a list of `Chunk` objects.
@@ -423,10 +428,11 @@ class ByteParser(object):
Returns a list of `Chunk` objects.
"""
-
# The list of chunks so far, and the one we're working on.
chunks = []
chunk = None
+
+ # A dict mapping byte offsets of line starts to the line numbers.
bytes_lines_map = dict(self._bytes_lines())
# The block stack: loops and try blocks get pushed here for the
@@ -441,24 +447,38 @@ class ByteParser(object):
# We have to handle the last two bytecodes specially.
ult = penult = None
- for bc in ByteCodes(self.code.co_code):
+ # Get a set of all of the jump-to points.
+ jump_to = set()
+ bytecodes = list(ByteCodes(self.code.co_code))
+ for bc in bytecodes:
+ if bc.jump_to >= 0:
+ jump_to.add(bc.jump_to)
+
+ chunk_lineno = 0
+
+ # Walk the byte codes building chunks.
+ for bc in bytecodes:
# Maybe have to start a new chunk
+ start_new_chunk = False
+ first_chunk = False
if bc.offset in bytes_lines_map:
# Start a new chunk for each source line number.
- if chunk:
- chunk.exits.add(bc.offset)
- chunk = Chunk(bc.offset, bytes_lines_map[bc.offset])
- chunks.append(chunk)
+ start_new_chunk = True
+ chunk_lineno = bytes_lines_map[bc.offset]
+ first_chunk = True
+ elif bc.offset in jump_to:
+ # To make chunks have a single entrance, we have to make a new
+ # chunk when we get to a place some bytecode jumps to.
+ start_new_chunk = True
elif bc.op in OPS_CHUNK_BEGIN:
# Jumps deserve their own unnumbered chunk. This fixes
# problems with jumps to jumps getting confused.
+ start_new_chunk = True
+
+ if not chunk or start_new_chunk:
if chunk:
chunk.exits.add(bc.offset)
- chunk = Chunk(bc.offset)
- chunks.append(chunk)
-
- if not chunk:
- chunk = Chunk(bc.offset)
+ chunk = Chunk(bc.offset, chunk_lineno, first_chunk)
chunks.append(chunk)
# Look at the opcode
@@ -487,15 +507,11 @@ class ByteParser(object):
chunk.exits.add(block_stack[-1][1])
chunk = None
if bc.op == OP_END_FINALLY:
- if block_stack:
- # A break that goes through a finally will jump to whatever
- # block is on top of the stack.
- chunk.exits.add(block_stack[-1][1])
# For the finally clause we need to find the closest exception
# block, and use its jump target as an exit.
- for iblock in range(len(block_stack)-1, -1, -1):
- if block_stack[iblock][0] in OPS_EXCEPT_BLOCKS:
- chunk.exits.add(block_stack[iblock][1])
+ for block in reversed(block_stack):
+ if block[0] in OPS_EXCEPT_BLOCKS:
+ chunk.exits.add(block[1])
break
if bc.op == OP_COMPARE_OP and bc.arg == COMPARE_EXCEPTION:
# This is an except clause. We want to overlook the next
@@ -521,23 +537,33 @@ class ByteParser(object):
last_chunk = chunks[-1]
last_chunk.exits.remove(ex)
last_chunk.exits.add(penult.offset)
- chunk = Chunk(penult.offset)
+ chunk = Chunk(
+ penult.offset, last_chunk.line, False
+ )
chunk.exits.add(ex)
chunks.append(chunk)
# Give all the chunks a length.
- chunks[-1].length = bc.next_offset - chunks[-1].byte
+ chunks[-1].length = bc.next_offset - chunks[-1].byte # pylint: disable=W0631,C0301
for i in range(len(chunks)-1):
chunks[i].length = chunks[i+1].byte - chunks[i].byte
+ #self.validate_chunks(chunks)
return chunks
+ def validate_chunks(self, chunks):
+ """Validate the rule that chunks have a single entrance."""
+ # starts is the entrances to the chunks
+ starts = set([ch.byte for ch in chunks])
+ for ch in chunks:
+ assert all([(ex in starts or ex < 0) for ex in ch.exits])
+
def _arcs(self):
"""Find the executable arcs in the code.
- Returns a set of pairs, (from,to). From and to are integer line
- numbers. If from is < 0, then the arc is an entrance into the code
- object. If to is < 0, the arc is an exit from the code object.
+ Yields pairs: (from,to). From and to are integer line numbers. If
+ from is < 0, then the arc is an entrance into the code object. If to
+ is < 0, the arc is an exit from the code object.
"""
chunks = self._split_into_chunks()
@@ -545,65 +571,43 @@ class ByteParser(object):
# A map from byte offsets to chunks jumped into.
byte_chunks = dict([(c.byte, c) for c in chunks])
- # Build a map from byte offsets to actual lines reached.
- byte_lines = {}
- bytes_to_add = set([c.byte for c in chunks])
+ # There's always an entrance at the first chunk.
+ yield (-1, byte_chunks[0].line)
- while bytes_to_add:
- byte_to_add = bytes_to_add.pop()
- if byte_to_add in byte_lines or byte_to_add < 0:
+ # Traverse from the first chunk in each line, and yield arcs where
+ # the trace function will be invoked.
+ for chunk in chunks:
+ if not chunk.first:
continue
- # Which lines does this chunk lead to?
- bytes_considered = set()
- bytes_to_consider = [byte_to_add]
- lines = set()
-
- while bytes_to_consider:
- byte = bytes_to_consider.pop()
- bytes_considered.add(byte)
-
- # Find chunk for byte
- try:
- ch = byte_chunks[byte]
- except KeyError:
- for ch in chunks:
- if ch.byte <= byte < ch.byte+ch.length:
- break
- else:
- # No chunk for this byte!
- raise Exception("Couldn't find chunk @ %d" % byte)
- byte_chunks[byte] = ch
-
- if ch.line:
- lines.add(ch.line)
- else:
- for ex in ch.exits:
- if ex < 0:
- lines.add(ex)
- elif ex not in bytes_considered:
- bytes_to_consider.append(ex)
-
- bytes_to_add.update(ch.exits)
-
- byte_lines[byte_to_add] = lines
-
- # Figure out for each chunk where the exits go.
- arcs = set()
- for chunk in chunks:
- if chunk.line:
- for ex in chunk.exits:
+ chunks_considered = set()
+ chunks_to_consider = [chunk]
+ while chunks_to_consider:
+ # Get the chunk we're considering, and make sure we don't
+ # consider it again
+ this_chunk = chunks_to_consider.pop()
+ chunks_considered.add(this_chunk)
+
+ # For each exit, add the line number if the trace function
+ # would be triggered, or add the chunk to those being
+ # considered if not.
+ for ex in this_chunk.exits:
if ex < 0:
- exit_lines = [ex]
+ yield (chunk.line, ex)
else:
- exit_lines = byte_lines[ex]
- for exit_line in exit_lines:
- if chunk.line != exit_line:
- arcs.add((chunk.line, exit_line))
- for line in byte_lines[0]:
- arcs.add((-1, line))
-
- return arcs
+ next_chunk = byte_chunks[ex]
+ if next_chunk in chunks_considered:
+ continue
+
+ # The trace function is invoked if visiting the first
+ # bytecode in a line, or if the transition is a
+ # backward jump.
+ backward_jump = next_chunk.byte < this_chunk.byte
+ if next_chunk.first or backward_jump:
+ if next_chunk.line != chunk.line:
+ yield (chunk.line, next_chunk.line)
+ else:
+ chunks_to_consider.append(next_chunk)
def _all_chunks(self):
"""Returns a list of `Chunk` objects for this code and its children.
@@ -631,11 +635,11 @@ class ByteParser(object):
class Chunk(object):
- """A sequence of bytecodes with a single entrance.
+ """A sequence of byte codes with a single entrance.
To analyze byte code, we have to divide it into chunks, sequences of byte
- codes such that each basic block has only one entrance, the first
- instruction in the block.
+ codes such that each chunk has only one entrance, the first instruction in
+ the block.
This is almost the CS concept of `basic block`_, except that we're willing
to have many exits from a chunk, and "basic block" is a more cumbersome
@@ -643,158 +647,54 @@ class Chunk(object):
.. _basic block: http://en.wikipedia.org/wiki/Basic_block
+ `line` is the source line number containing this chunk.
+
+ `first` is true if this is the first chunk in the source line.
+
An exit < 0 means the chunk can leave the code (return). The exit is
the negative of the starting line number of the code block.
"""
- def __init__(self, byte, line=0):
+ def __init__(self, byte, line, first):
self.byte = byte
self.line = line
+ self.first = first
self.length = 0
self.exits = set()
def __repr__(self):
- return "<%d+%d @%d %r>" % (
- self.byte, self.length, self.line, list(self.exits)
+ if self.first:
+ bang = "!"
+ else:
+ bang = ""
+ return "<%d+%d @%d%s %r>" % (
+ self.byte, self.length, self.line, bang, list(self.exits)
)
-class AdHocMain(object): # pragma: no cover
- """An ad-hoc main for code parsing experiments."""
+class CachedTokenizer(object):
+ """A one-element cache around tokenize.generate_tokens.
- def main(self, args):
- """A main function for trying the code from the command line."""
+ When reporting, coverage.py tokenizes files twice, once to find the
+ structure of the file, and once to syntax-color it. Tokenizing is
+ expensive, and easily cached.
- from optparse import OptionParser
+ This is a one-element cache so that our twice-in-a-row tokenizing doesn't
+ actually tokenize twice.
- parser = OptionParser()
- parser.add_option(
- "-c", action="store_true", dest="chunks",
- help="Show basic block chunks"
- )
- parser.add_option(
- "-d", action="store_true", dest="dis",
- help="Disassemble"
- )
- parser.add_option(
- "-R", action="store_true", dest="recursive",
- help="Recurse to find source files"
- )
- parser.add_option(
- "-s", action="store_true", dest="source",
- help="Show analyzed source"
- )
- parser.add_option(
- "-t", action="store_true", dest="tokens",
- help="Show tokens"
+ """
+ def __init__(self):
+ self.last_text = None
+ self.last_tokens = None
+
+ def generate_tokens(self, text):
+ """A stand-in for `tokenize.generate_tokens`."""
+ if text != self.last_text:
+ self.last_text = text
+ self.last_tokens = list(
+ tokenize.generate_tokens(StringIO(text).readline)
)
+ return self.last_tokens
- options, args = parser.parse_args()
- if options.recursive:
- if args:
- root = args[0]
- else:
- root = "."
- for root, _, _ in os.walk(root):
- for f in glob.glob(root + "/*.py"):
- self.adhoc_one_file(options, f)
- else:
- self.adhoc_one_file(options, args[0])
-
- def adhoc_one_file(self, options, filename):
- """Process just one file."""
-
- if options.dis or options.chunks:
- try:
- bp = ByteParser(filename=filename)
- except CoverageException:
- _, err, _ = sys.exc_info()
- print("%s" % (err,))
- return
-
- if options.dis:
- print("Main code:")
- bp._disassemble()
-
- if options.chunks:
- chunks = bp._all_chunks()
- if options.recursive:
- print("%6d: %s" % (len(chunks), filename))
- else:
- print("Chunks: %r" % chunks)
- arcs = bp._all_arcs()
- print("Arcs: %r" % sorted(arcs))
-
- if options.source or options.tokens:
- cp = CodeParser(filename=filename, exclude=r"no\s*cover")
- cp.show_tokens = options.tokens
- cp._raw_parse()
-
- if options.source:
- if options.chunks:
- arc_width, arc_chars = self.arc_ascii_art(arcs)
- else:
- arc_width, arc_chars = 0, {}
-
- exit_counts = cp.exit_counts()
-
- for i, ltext in enumerate(cp.lines):
- lineno = i+1
- m0 = m1 = m2 = m3 = a = ' '
- if lineno in cp.statement_starts:
- m0 = '-'
- exits = exit_counts.get(lineno, 0)
- if exits > 1:
- m1 = str(exits)
- if lineno in cp.docstrings:
- m2 = '"'
- if lineno in cp.classdefs:
- m2 = 'C'
- if lineno in cp.excluded:
- m3 = 'x'
- a = arc_chars.get(lineno, '').ljust(arc_width)
- print("%4d %s%s%s%s%s %s" %
- (lineno, m0, m1, m2, m3, a, ltext)
- )
-
- def arc_ascii_art(self, arcs):
- """Draw arcs as ascii art.
-
- Returns a width of characters needed to draw all the arcs, and a
- dictionary mapping line numbers to ascii strings to draw for that line.
-
- """
- arc_chars = {}
- for lfrom, lto in sorted(arcs):
- if lfrom < 0:
- arc_chars[lto] = arc_chars.get(lto, '') + 'v'
- elif lto < 0:
- arc_chars[lfrom] = arc_chars.get(lfrom, '') + '^'
- else:
- if lfrom == lto - 1:
- # Don't show obvious arcs.
- continue
- if lfrom < lto:
- l1, l2 = lfrom, lto
- else:
- l1, l2 = lto, lfrom
- w = max([len(arc_chars.get(l, '')) for l in range(l1, l2+1)])
- for l in range(l1, l2+1):
- if l == lfrom:
- ch = '<'
- elif l == lto:
- ch = '>'
- else:
- ch = '|'
- arc_chars[l] = arc_chars.get(l, '').ljust(w) + ch
- arc_width = 0
-
- if arc_chars:
- arc_width = max([len(a) for a in arc_chars.values()])
- else:
- arc_width = 0
-
- return arc_width, arc_chars
-
-if __name__ == '__main__':
- AdHocMain().main(sys.argv[1:])
+# Create our generate_tokens cache as a callable replacement function.
+generate_tokens = CachedTokenizer().generate_tokens
diff --git a/python/helpers/coverage/phystokens.py b/python/helpers/coverage/phystokens.py
index fc4f2c9057b1..99b1d5ba0c79 100644
--- a/python/helpers/coverage/phystokens.py
+++ b/python/helpers/coverage/phystokens.py
@@ -1,7 +1,9 @@
"""Better tokenizing for coverage.py."""
-import keyword, re, token, tokenize
-from coverage.backward import StringIO # pylint: disable=W0622
+import codecs, keyword, re, sys, token, tokenize
+from coverage.backward import set # pylint: disable=W0622
+from coverage.parser import generate_tokens
+
def phys_tokens(toks):
"""Return all physical tokens, even line continuations.
@@ -18,7 +20,7 @@ def phys_tokens(toks):
last_ttype = None
for ttype, ttext, (slineno, scol), (elineno, ecol), ltext in toks:
if last_lineno != elineno:
- if last_line and last_line[-2:] == "\\\n":
+ if last_line and last_line.endswith("\\\n"):
# We are at the beginning of a new line, and the last line
# ended with a backslash. We probably have to inject a
# backslash token into the stream. Unfortunately, there's more
@@ -74,11 +76,11 @@ def source_token_lines(source):
is indistinguishable from a final line with a newline.
"""
- ws_tokens = [token.INDENT, token.DEDENT, token.NEWLINE, tokenize.NL]
+ ws_tokens = set([token.INDENT, token.DEDENT, token.NEWLINE, tokenize.NL])
line = []
col = 0
source = source.expandtabs(8).replace('\r\n', '\n')
- tokgen = tokenize.generate_tokens(StringIO(source).readline)
+ tokgen = generate_tokens(source)
for ttype, ttext, (_, scol), (_, ecol), _ in phys_tokens(tokgen):
mark_start = True
for part in re.split('(\n)', ttext):
@@ -106,3 +108,103 @@ def source_token_lines(source):
if line:
yield line
+
+def source_encoding(source):
+ """Determine the encoding for `source` (a string), according to PEP 263.
+
+ Returns a string, the name of the encoding.
+
+ """
+ # Note: this function should never be called on Python 3, since py3 has
+ # built-in tools to do this.
+ assert sys.version_info < (3, 0)
+
+ # This is mostly code adapted from Py3.2's tokenize module.
+
+ cookie_re = re.compile(r"coding[:=]\s*([-\w.]+)")
+
+ # Do this so the detect_encode code we copied will work.
+ readline = iter(source.splitlines(True)).next
+
+ def _get_normal_name(orig_enc):
+ """Imitates get_normal_name in tokenizer.c."""
+ # Only care about the first 12 characters.
+ enc = orig_enc[:12].lower().replace("_", "-")
+ if re.match(r"^utf-8($|-)", enc):
+ return "utf-8"
+ if re.match(r"^(latin-1|iso-8859-1|iso-latin-1)($|-)", enc):
+ return "iso-8859-1"
+ return orig_enc
+
+ # From detect_encode():
+ # It detects the encoding from the presence of a utf-8 bom or an encoding
+ # cookie as specified in pep-0263. If both a bom and a cookie are present,
+ # but disagree, a SyntaxError will be raised. If the encoding cookie is an
+ # invalid charset, raise a SyntaxError. Note that if a utf-8 bom is found,
+ # 'utf-8-sig' is returned.
+
+ # If no encoding is specified, then the default will be returned. The
+ # default varied with version.
+
+ if sys.version_info <= (2, 4):
+ default = 'iso-8859-1'
+ else:
+ default = 'ascii'
+
+ bom_found = False
+ encoding = None
+
+ def read_or_stop():
+ """Get the next source line, or ''."""
+ try:
+ return readline()
+ except StopIteration:
+ return ''
+
+ def find_cookie(line):
+ """Find an encoding cookie in `line`."""
+ try:
+ line_string = line.decode('ascii')
+ except UnicodeDecodeError:
+ return None
+
+ matches = cookie_re.findall(line_string)
+ if not matches:
+ return None
+ encoding = _get_normal_name(matches[0])
+ try:
+ codec = codecs.lookup(encoding)
+ except LookupError:
+ # This behaviour mimics the Python interpreter
+ raise SyntaxError("unknown encoding: " + encoding)
+
+ if bom_found:
+ # codecs in 2.3 were raw tuples of functions, assume the best.
+ codec_name = getattr(codec, 'name', encoding)
+ if codec_name != 'utf-8':
+ # This behaviour mimics the Python interpreter
+ raise SyntaxError('encoding problem: utf-8')
+ encoding += '-sig'
+ return encoding
+
+ first = read_or_stop()
+ if first.startswith(codecs.BOM_UTF8):
+ bom_found = True
+ first = first[3:]
+ default = 'utf-8-sig'
+ if not first:
+ return default
+
+ encoding = find_cookie(first)
+ if encoding:
+ return encoding
+
+ second = read_or_stop()
+ if not second:
+ return default
+
+ encoding = find_cookie(second)
+ if encoding:
+ return encoding
+
+ return default
diff --git a/python/helpers/coverage/report.py b/python/helpers/coverage/report.py
index 6c5510ad4677..34f44422298e 100644
--- a/python/helpers/coverage/report.py
+++ b/python/helpers/coverage/report.py
@@ -2,20 +2,21 @@
import fnmatch, os
from coverage.codeunit import code_unit_factory
+from coverage.files import prep_patterns
from coverage.misc import CoverageException, NoSource, NotPython
class Reporter(object):
"""A base class for all reporters."""
- def __init__(self, coverage, ignore_errors=False):
+ def __init__(self, coverage, config):
"""Create a reporter.
- `coverage` is the coverage instance. `ignore_errors` controls how
- skittish the reporter will be during file processing.
+ `coverage` is the coverage instance. `config` is an instance of
+ CoverageConfig, for controlling all sorts of behavior.
"""
self.coverage = coverage
- self.ignore_errors = ignore_errors
+ self.config = config
# The code units to report on. Set by find_code_units.
self.code_units = []
@@ -24,19 +25,18 @@ class Reporter(object):
# classes.
self.directory = None
- def find_code_units(self, morfs, config):
+ def find_code_units(self, morfs):
"""Find the code units we'll report on.
- `morfs` is a list of modules or filenames. `config` is a
- CoverageConfig instance.
+ `morfs` is a list of modules or filenames.
"""
morfs = morfs or self.coverage.data.measured_files()
file_locator = self.coverage.file_locator
self.code_units = code_unit_factory(morfs, file_locator)
- if config.include:
- patterns = [file_locator.abs_file(p) for p in config.include]
+ if self.config.include:
+ patterns = prep_patterns(self.config.include)
filtered = []
for cu in self.code_units:
for pattern in patterns:
@@ -45,8 +45,8 @@ class Reporter(object):
break
self.code_units = filtered
- if config.omit:
- patterns = [file_locator.abs_file(p) for p in config.omit]
+ if self.config.omit:
+ patterns = prep_patterns(self.config.omit)
filtered = []
for cu in self.code_units:
for pattern in patterns:
@@ -58,7 +58,7 @@ class Reporter(object):
self.code_units.sort()
- def report_files(self, report_fn, morfs, config, directory=None):
+ def report_files(self, report_fn, morfs, directory=None):
"""Run a reporting function on a number of morfs.
`report_fn` is called for each relative morf in `morfs`. It is called
@@ -69,10 +69,8 @@ class Reporter(object):
where `code_unit` is the `CodeUnit` for the morf, and `analysis` is
the `Analysis` for the morf.
- `config` is a CoverageConfig instance.
-
"""
- self.find_code_units(morfs, config)
+ self.find_code_units(morfs)
if not self.code_units:
raise CoverageException("No data to report.")
@@ -84,6 +82,11 @@ class Reporter(object):
for cu in self.code_units:
try:
report_fn(cu, self.coverage._analyze(cu))
- except (NoSource, NotPython):
- if not self.ignore_errors:
+ except NoSource:
+ if not self.config.ignore_errors:
+ raise
+ except NotPython:
+ # Only report errors for .py files, and only if we didn't
+ # explicitly suppress those errors.
+ if cu.should_be_python() and not self.config.ignore_errors:
raise
diff --git a/python/helpers/coverage/results.py b/python/helpers/coverage/results.py
index adfb8f42de5a..db6df0d30b7e 100644
--- a/python/helpers/coverage/results.py
+++ b/python/helpers/coverage/results.py
@@ -2,7 +2,7 @@
import os
-from coverage.backward import set, sorted # pylint: disable=W0622
+from coverage.backward import iitems, set, sorted # pylint: disable=W0622
from coverage.misc import format_lines, join_regex, NoSource
from coverage.parser import CodeParser
@@ -15,16 +15,10 @@ class Analysis(object):
self.code_unit = code_unit
self.filename = self.code_unit.filename
- ext = os.path.splitext(self.filename)[1]
- source = None
- if ext == '.py':
- if not os.path.exists(self.filename):
- source = self.coverage.file_locator.get_zip_data(self.filename)
- if not source:
- raise NoSource("No source for code: %r" % self.filename)
+ actual_filename, source = self.find_source(self.filename)
self.parser = CodeParser(
- text=source, filename=self.filename,
+ text=source, filename=actual_filename,
exclude=self.coverage._exclude_regex('exclude')
)
self.statements, self.excluded = self.parser.parse_source()
@@ -32,7 +26,7 @@ class Analysis(object):
# Identify missing statements.
executed = self.coverage.data.executed_lines(self.filename)
exec1 = self.parser.first_lines(executed)
- self.missing = sorted(set(self.statements) - set(exec1))
+ self.missing = self.statements - exec1
if self.coverage.data.has_arcs():
self.no_branch = self.parser.lines_matching(
@@ -41,9 +35,12 @@ class Analysis(object):
)
n_branches = self.total_branches()
mba = self.missing_branch_arcs()
- n_missing_branches = sum([len(v) for v in mba.values()])
+ n_partial_branches = sum(
+ [len(v) for k,v in iitems(mba) if k not in self.missing]
+ )
+ n_missing_branches = sum([len(v) for k,v in iitems(mba)])
else:
- n_branches = n_missing_branches = 0
+ n_branches = n_partial_branches = n_missing_branches = 0
self.no_branch = set()
self.numbers = Numbers(
@@ -52,9 +49,48 @@ class Analysis(object):
n_excluded=len(self.excluded),
n_missing=len(self.missing),
n_branches=n_branches,
+ n_partial_branches=n_partial_branches,
n_missing_branches=n_missing_branches,
)
+ def find_source(self, filename):
+ """Find the source for `filename`.
+
+ Returns two values: the actual filename, and the source.
+
+ The source returned depends on which of these cases holds:
+
+ * The filename seems to be a non-source file: returns None
+
+ * The filename is a source file, and actually exists: returns None.
+
+ * The filename is a source file, and is in a zip file or egg:
+ returns the source.
+
+ * The filename is a source file, but couldn't be found: raises
+ `NoSource`.
+
+ """
+ source = None
+
+ base, ext = os.path.splitext(filename)
+ TRY_EXTS = {
+ '.py': ['.py', '.pyw'],
+ '.pyw': ['.pyw'],
+ }
+ try_exts = TRY_EXTS.get(ext)
+ if not try_exts:
+ return filename, None
+
+ for try_ext in try_exts:
+ try_filename = base + try_ext
+ if os.path.exists(try_filename):
+ return try_filename, None
+ source = self.coverage.file_locator.get_zip_data(try_filename)
+ if source:
+ return try_filename, source
+ raise NoSource("No source for code: '%s'" % filename)
+
def missing_formatted(self):
"""The missing line numbers, formatted nicely.
@@ -107,7 +143,7 @@ class Analysis(object):
def branch_lines(self):
"""Returns a list of line numbers that have more than one exit."""
exit_counts = self.parser.exit_counts()
- return [l1 for l1,count in exit_counts.items() if count > 1]
+ return [l1 for l1,count in iitems(exit_counts) if count > 1]
def total_branches(self):
"""How many total branches are there?"""
@@ -164,13 +200,14 @@ class Numbers(object):
_near100 = 99.0
def __init__(self, n_files=0, n_statements=0, n_excluded=0, n_missing=0,
- n_branches=0, n_missing_branches=0
+ n_branches=0, n_partial_branches=0, n_missing_branches=0
):
self.n_files = n_files
self.n_statements = n_statements
self.n_excluded = n_excluded
self.n_missing = n_missing
self.n_branches = n_branches
+ self.n_partial_branches = n_partial_branches
self.n_missing_branches = n_missing_branches
def set_precision(cls, precision):
@@ -234,8 +271,12 @@ class Numbers(object):
nums.n_excluded = self.n_excluded + other.n_excluded
nums.n_missing = self.n_missing + other.n_missing
nums.n_branches = self.n_branches + other.n_branches
- nums.n_missing_branches = (self.n_missing_branches +
- other.n_missing_branches)
+ nums.n_partial_branches = (
+ self.n_partial_branches + other.n_partial_branches
+ )
+ nums.n_missing_branches = (
+ self.n_missing_branches + other.n_missing_branches
+ )
return nums
def __radd__(self, other):
diff --git a/python/helpers/coverage/summary.py b/python/helpers/coverage/summary.py
index 599ae78221ff..c99c53034aac 100644
--- a/python/helpers/coverage/summary.py
+++ b/python/helpers/coverage/summary.py
@@ -4,24 +4,23 @@ import sys
from coverage.report import Reporter
from coverage.results import Numbers
+from coverage.misc import NotPython
class SummaryReporter(Reporter):
"""A reporter for writing the summary report."""
- def __init__(self, coverage, show_missing=True, ignore_errors=False):
- super(SummaryReporter, self).__init__(coverage, ignore_errors)
- self.show_missing = show_missing
+ def __init__(self, coverage, config):
+ super(SummaryReporter, self).__init__(coverage, config)
self.branches = coverage.data.has_arcs()
- def report(self, morfs, outfile=None, config=None):
+ def report(self, morfs, outfile=None):
"""Writes a report summarizing coverage statistics per module.
- `outfile` is a file object to write the summary to. `config` is a
- CoverageConfig instance.
+ `outfile` is a file object to write the summary to.
"""
- self.find_code_units(morfs, config)
+ self.find_code_units(morfs)
# Prepare the formatting strings
max_name = max([len(cu.name) for cu in self.code_units] + [5])
@@ -30,12 +29,12 @@ class SummaryReporter(Reporter):
header = (fmt_name % "Name") + " Stmts Miss"
fmt_coverage = fmt_name + "%6d %6d"
if self.branches:
- header += " Branch BrPart"
+ header += " Branch BrMiss"
fmt_coverage += " %6d %6d"
width100 = Numbers.pc_str_width()
header += "%*s" % (width100+4, "Cover")
fmt_coverage += "%%%ds%%%%" % (width100+3,)
- if self.show_missing:
+ if self.config.show_missing:
header += " Missing"
fmt_coverage += " %s"
rule = "-" * len(header) + "\n"
@@ -59,15 +58,19 @@ class SummaryReporter(Reporter):
if self.branches:
args += (nums.n_branches, nums.n_missing_branches)
args += (nums.pc_covered_str,)
- if self.show_missing:
+ if self.config.show_missing:
args += (analysis.missing_formatted(),)
outfile.write(fmt_coverage % args)
total += nums
- except KeyboardInterrupt: # pragma: no cover
+ except KeyboardInterrupt: # pragma: not covered
raise
except:
- if not self.ignore_errors:
+ report_it = not self.config.ignore_errors
+ if report_it:
typ, msg = sys.exc_info()[:2]
+ if typ is NotPython and not cu.should_be_python():
+ report_it = False
+ if report_it:
outfile.write(fmt_err % (cu.name, typ.__name__, msg))
if total.n_files > 1:
@@ -76,6 +79,8 @@ class SummaryReporter(Reporter):
if self.branches:
args += (total.n_branches, total.n_missing_branches)
args += (total.pc_covered_str,)
- if self.show_missing:
+ if self.config.show_missing:
args += ("",)
outfile.write(fmt_coverage % args)
+
+ return total.pc_covered
diff --git a/python/helpers/coverage/templite.py b/python/helpers/coverage/templite.py
index c39e061efd92..e5c0bafefb77 100644
--- a/python/helpers/coverage/templite.py
+++ b/python/helpers/coverage/templite.py
@@ -2,7 +2,53 @@
# Coincidentally named the same as http://code.activestate.com/recipes/496702/
-import re, sys
+import re
+
+from coverage.backward import set # pylint: disable=W0622
+
+
+class CodeBuilder(object):
+ """Build source code conveniently."""
+
+ def __init__(self, indent=0):
+ self.code = []
+ self.indent_amount = indent
+
+ def add_line(self, line):
+ """Add a line of source to the code.
+
+ Don't include indentations or newlines.
+
+ """
+ self.code.append(" " * self.indent_amount)
+ self.code.append(line)
+ self.code.append("\n")
+
+ def add_section(self):
+ """Add a section, a sub-CodeBuilder."""
+ sect = CodeBuilder(self.indent_amount)
+ self.code.append(sect)
+ return sect
+
+ def indent(self):
+ """Increase the current indent for following lines."""
+ self.indent_amount += 4
+
+ def dedent(self):
+ """Decrease the current indent for following lines."""
+ self.indent_amount -= 4
+
+ def __str__(self):
+ return "".join([str(c) for c in self.code])
+
+ def get_function(self, fn_name):
+ """Compile the code, and return the function `fn_name`."""
+ assert self.indent_amount == 0
+ g = {}
+ code_text = str(self)
+ exec(code_text, g)
+ return g[fn_name]
+
class Templite(object):
"""A simple template renderer, for a nano-subset of Django syntax.
@@ -39,53 +85,104 @@ class Templite(object):
for context in contexts:
self.context.update(context)
+ # We construct a function in source form, then compile it and hold onto
+ # it, and execute it to render the template.
+ code = CodeBuilder()
+
+ code.add_line("def render(ctx, dot):")
+ code.indent()
+ vars_code = code.add_section()
+ self.all_vars = set()
+ self.loop_vars = set()
+ code.add_line("result = []")
+ code.add_line("a = result.append")
+ code.add_line("e = result.extend")
+ code.add_line("s = str")
+
+ buffered = []
+ def flush_output():
+ """Force `buffered` to the code builder."""
+ if len(buffered) == 1:
+ code.add_line("a(%s)" % buffered[0])
+ elif len(buffered) > 1:
+ code.add_line("e([%s])" % ",".join(buffered))
+ del buffered[:]
+
# Split the text to form a list of tokens.
toks = re.split(r"(?s)({{.*?}}|{%.*?%}|{#.*?#})", text)
- # Parse the tokens into a nested list of operations. Each item in the
- # list is a tuple with an opcode, and arguments. They'll be
- # interpreted by TempliteEngine.
- #
- # When parsing an action tag with nested content (if, for), the current
- # ops list is pushed onto ops_stack, and the parsing continues in a new
- # ops list that is part of the arguments to the if or for op.
- ops = []
ops_stack = []
for tok in toks:
if tok.startswith('{{'):
- # Expression: ('exp', expr)
- ops.append(('exp', tok[2:-2].strip()))
+ # An expression to evaluate.
+ buffered.append("s(%s)" % self.expr_code(tok[2:-2].strip()))
elif tok.startswith('{#'):
# Comment: ignore it and move on.
continue
elif tok.startswith('{%'):
# Action tag: split into words and parse further.
+ flush_output()
words = tok[2:-2].strip().split()
if words[0] == 'if':
- # If: ('if', (expr, body_ops))
- if_ops = []
+ # An if statement: evaluate the expression to determine if.
assert len(words) == 2
- ops.append(('if', (words[1], if_ops)))
- ops_stack.append(ops)
- ops = if_ops
+ ops_stack.append('if')
+ code.add_line("if %s:" % self.expr_code(words[1]))
+ code.indent()
elif words[0] == 'for':
- # For: ('for', (varname, listexpr, body_ops))
+ # A loop: iterate over expression result.
assert len(words) == 4 and words[2] == 'in'
- for_ops = []
- ops.append(('for', (words[1], words[3], for_ops)))
- ops_stack.append(ops)
- ops = for_ops
+ ops_stack.append('for')
+ self.loop_vars.add(words[1])
+ code.add_line(
+ "for c_%s in %s:" % (
+ words[1],
+ self.expr_code(words[3])
+ )
+ )
+ code.indent()
elif words[0].startswith('end'):
# Endsomething. Pop the ops stack
- ops = ops_stack.pop()
- assert ops[-1][0] == words[0][3:]
+ end_what = words[0][3:]
+ if ops_stack[-1] != end_what:
+ raise SyntaxError("Mismatched end tag: %r" % end_what)
+ ops_stack.pop()
+ code.dedent()
else:
- raise SyntaxError("Don't understand tag %r" % words)
+ raise SyntaxError("Don't understand tag: %r" % words[0])
else:
- ops.append(('lit', tok))
+ # Literal content. If it isn't empty, output it.
+ if tok:
+ buffered.append("%r" % tok)
+ flush_output()
- assert not ops_stack, "Unmatched action tag: %r" % ops_stack[-1][0]
- self.ops = ops
+ for var_name in self.all_vars - self.loop_vars:
+ vars_code.add_line("c_%s = ctx[%r]" % (var_name, var_name))
+
+ if ops_stack:
+ raise SyntaxError("Unmatched action tag: %r" % ops_stack[-1])
+
+ code.add_line("return ''.join(result)")
+ code.dedent()
+ self.render_function = code.get_function('render')
+
+ def expr_code(self, expr):
+ """Generate a Python expression for `expr`."""
+ if "|" in expr:
+ pipes = expr.split("|")
+ code = self.expr_code(pipes[0])
+ for func in pipes[1:]:
+ self.all_vars.add(func)
+ code = "c_%s(%s)" % (func, code)
+ elif "." in expr:
+ dots = expr.split(".")
+ code = self.expr_code(dots[0])
+ args = [repr(d) for d in dots[1:]]
+ code = "dot(%s, %s)" % (code, ", ".join(args))
+ else:
+ self.all_vars.add(expr)
+ code = "c_%s" % expr
+ return code
def render(self, context=None):
"""Render this template by applying it to `context`.
@@ -97,70 +194,15 @@ class Templite(object):
ctx = dict(self.context)
if context:
ctx.update(context)
-
- # Run it through an engine, and return the result.
- engine = _TempliteEngine(ctx)
- engine.execute(self.ops)
- return "".join(engine.result)
-
-
-class _TempliteEngine(object):
- """Executes Templite objects to produce strings."""
- def __init__(self, context):
- self.context = context
- self.result = []
-
- def execute(self, ops):
- """Execute `ops` in the engine.
-
- Called recursively for the bodies of if's and loops.
-
- """
- for op, args in ops:
- if op == 'lit':
- self.result.append(args)
- elif op == 'exp':
- try:
- self.result.append(str(self.evaluate(args)))
- except:
- exc_class, exc, _ = sys.exc_info()
- new_exc = exc_class("Couldn't evaluate {{ %s }}: %s"
- % (args, exc))
- raise new_exc
- elif op == 'if':
- expr, body = args
- if self.evaluate(expr):
- self.execute(body)
- elif op == 'for':
- var, lis, body = args
- vals = self.evaluate(lis)
- for val in vals:
- self.context[var] = val
- self.execute(body)
- else:
- raise AssertionError("TempliteEngine doesn't grok op %r" % op)
-
- def evaluate(self, expr):
- """Evaluate an expression.
-
- `expr` can have pipes and dots to indicate data access and filtering.
-
- """
- if "|" in expr:
- pipes = expr.split("|")
- value = self.evaluate(pipes[0])
- for func in pipes[1:]:
- value = self.evaluate(func)(value)
- elif "." in expr:
- dots = expr.split('.')
- value = self.evaluate(dots[0])
- for dot in dots[1:]:
- try:
- value = getattr(value, dot)
- except AttributeError:
- value = value[dot]
- if hasattr(value, '__call__'):
- value = value()
- else:
- value = self.context[expr]
+ return self.render_function(ctx, self.do_dots)
+
+ def do_dots(self, value, *dots):
+ """Evaluate dotted expressions at runtime."""
+ for dot in dots:
+ try:
+ value = getattr(value, dot)
+ except AttributeError:
+ value = value[dot]
+ if hasattr(value, '__call__'):
+ value = value()
return value
diff --git a/python/helpers/coverage/tracer.c b/python/helpers/coverage/tracer.c
new file mode 100644
index 000000000000..97dd113b8b3a
--- /dev/null
+++ b/python/helpers/coverage/tracer.c
@@ -0,0 +1,730 @@
+/* C-based Tracer for Coverage. */
+
+#include "Python.h"
+#include "compile.h" /* in 2.3, this wasn't part of Python.h */
+#include "eval.h" /* or this. */
+#include "structmember.h"
+#include "frameobject.h"
+
+/* Compile-time debugging helpers */
+#undef WHAT_LOG /* Define to log the WHAT params in the trace function. */
+#undef TRACE_LOG /* Define to log our bookkeeping. */
+#undef COLLECT_STATS /* Collect counters: stats are printed when tracer is stopped. */
+
+#if COLLECT_STATS
+#define STATS(x) x
+#else
+#define STATS(x)
+#endif
+
+/* Py 2.x and 3.x compatibility */
+
+#ifndef Py_TYPE
+#define Py_TYPE(o) (((PyObject*)(o))->ob_type)
+#endif
+
+#if PY_MAJOR_VERSION >= 3
+
+#define MyText_Type PyUnicode_Type
+#define MyText_Check(o) PyUnicode_Check(o)
+#define MyText_AS_BYTES(o) PyUnicode_AsASCIIString(o)
+#define MyText_AS_STRING(o) PyBytes_AS_STRING(o)
+#define MyInt_FromLong(l) PyLong_FromLong(l)
+
+#define MyType_HEAD_INIT PyVarObject_HEAD_INIT(NULL, 0)
+
+#else
+
+#define MyText_Type PyString_Type
+#define MyText_Check(o) PyString_Check(o)
+#define MyText_AS_BYTES(o) (Py_INCREF(o), o)
+#define MyText_AS_STRING(o) PyString_AS_STRING(o)
+#define MyInt_FromLong(l) PyInt_FromLong(l)
+
+#define MyType_HEAD_INIT PyObject_HEAD_INIT(NULL) 0,
+
+#endif /* Py3k */
+
+/* The values returned to indicate ok or error. */
+#define RET_OK 0
+#define RET_ERROR -1
+
+/* An entry on the data stack. For each call frame, we need to record the
+ dictionary to capture data, and the last line number executed in that
+ frame.
+*/
+typedef struct {
+ PyObject * file_data; /* PyMem_Malloc'ed, a borrowed ref. */
+ int last_line;
+} DataStackEntry;
+
+/* The CTracer type. */
+
+typedef struct {
+ PyObject_HEAD
+
+ /* Python objects manipulated directly by the Collector class. */
+ PyObject * should_trace;
+ PyObject * warn;
+ PyObject * data;
+ PyObject * should_trace_cache;
+ PyObject * arcs;
+
+ /* Has the tracer been started? */
+ int started;
+ /* Are we tracing arcs, or just lines? */
+ int tracing_arcs;
+
+ /*
+ The data stack is a stack of dictionaries. Each dictionary collects
+ data for a single source file. The data stack parallels the call stack:
+ each call pushes the new frame's file data onto the data stack, and each
+ return pops file data off.
+
+ The file data is a dictionary whose form depends on the tracing options.
+ If tracing arcs, the keys are line number pairs. If not tracing arcs,
+ the keys are line numbers. In both cases, the value is irrelevant
+ (None).
+ */
+ /* The index of the last-used entry in data_stack. */
+ int depth;
+ /* The file data at each level, or NULL if not recording. */
+ DataStackEntry * data_stack;
+ int data_stack_alloc; /* number of entries allocated at data_stack. */
+
+ /* The current file_data dictionary. Borrowed. */
+ PyObject * cur_file_data;
+
+ /* The line number of the last line recorded, for tracing arcs.
+ -1 means there was no previous line, as when entering a code object.
+ */
+ int last_line;
+
+ /* The parent frame for the last exception event, to fix missing returns. */
+ PyFrameObject * last_exc_back;
+ int last_exc_firstlineno;
+
+#if COLLECT_STATS
+ struct {
+ unsigned int calls;
+ unsigned int lines;
+ unsigned int returns;
+ unsigned int exceptions;
+ unsigned int others;
+ unsigned int new_files;
+ unsigned int missed_returns;
+ unsigned int stack_reallocs;
+ unsigned int errors;
+ } stats;
+#endif /* COLLECT_STATS */
+} CTracer;
+
+#define STACK_DELTA 100
+
+static int
+CTracer_init(CTracer *self, PyObject *args_unused, PyObject *kwds_unused)
+{
+#if COLLECT_STATS
+ self->stats.calls = 0;
+ self->stats.lines = 0;
+ self->stats.returns = 0;
+ self->stats.exceptions = 0;
+ self->stats.others = 0;
+ self->stats.new_files = 0;
+ self->stats.missed_returns = 0;
+ self->stats.stack_reallocs = 0;
+ self->stats.errors = 0;
+#endif /* COLLECT_STATS */
+
+ self->should_trace = NULL;
+ self->warn = NULL;
+ self->data = NULL;
+ self->should_trace_cache = NULL;
+ self->arcs = NULL;
+
+ self->started = 0;
+ self->tracing_arcs = 0;
+
+ self->depth = -1;
+ self->data_stack = PyMem_Malloc(STACK_DELTA*sizeof(DataStackEntry));
+ if (self->data_stack == NULL) {
+ STATS( self->stats.errors++; )
+ PyErr_NoMemory();
+ return RET_ERROR;
+ }
+ self->data_stack_alloc = STACK_DELTA;
+
+ self->cur_file_data = NULL;
+ self->last_line = -1;
+
+ self->last_exc_back = NULL;
+
+ return RET_OK;
+}
+
+static void
+CTracer_dealloc(CTracer *self)
+{
+ if (self->started) {
+ PyEval_SetTrace(NULL, NULL);
+ }
+
+ Py_XDECREF(self->should_trace);
+ Py_XDECREF(self->warn);
+ Py_XDECREF(self->data);
+ Py_XDECREF(self->should_trace_cache);
+
+ PyMem_Free(self->data_stack);
+
+ Py_TYPE(self)->tp_free((PyObject*)self);
+}
+
+#if TRACE_LOG
+static const char *
+indent(int n)
+{
+ static const char * spaces =
+ " "
+ " "
+ " "
+ " "
+ ;
+ return spaces + strlen(spaces) - n*2;
+}
+
+static int logging = 0;
+/* Set these constants to be a file substring and line number to start logging. */
+static const char * start_file = "tests/views";
+static int start_line = 27;
+
+static void
+showlog(int depth, int lineno, PyObject * filename, const char * msg)
+{
+ if (logging) {
+ printf("%s%3d ", indent(depth), depth);
+ if (lineno) {
+ printf("%4d", lineno);
+ }
+ else {
+ printf(" ");
+ }
+ if (filename) {
+ PyObject *ascii = MyText_AS_BYTES(filename);
+ printf(" %s", MyText_AS_STRING(ascii));
+ Py_DECREF(ascii);
+ }
+ if (msg) {
+ printf(" %s", msg);
+ }
+ printf("\n");
+ }
+}
+
+#define SHOWLOG(a,b,c,d) showlog(a,b,c,d)
+#else
+#define SHOWLOG(a,b,c,d)
+#endif /* TRACE_LOG */
+
+#if WHAT_LOG
+static const char * what_sym[] = {"CALL", "EXC ", "LINE", "RET "};
+#endif
+
+/* Record a pair of integers in self->cur_file_data. */
+static int
+CTracer_record_pair(CTracer *self, int l1, int l2)
+{
+ int ret = RET_OK;
+
+ PyObject * t = Py_BuildValue("(ii)", l1, l2);
+ if (t != NULL) {
+ if (PyDict_SetItem(self->cur_file_data, t, Py_None) < 0) {
+ STATS( self->stats.errors++; )
+ ret = RET_ERROR;
+ }
+ Py_DECREF(t);
+ }
+ else {
+ STATS( self->stats.errors++; )
+ ret = RET_ERROR;
+ }
+ return ret;
+}
+
+/*
+ * The Trace Function
+ */
+static int
+CTracer_trace(CTracer *self, PyFrameObject *frame, int what, PyObject *arg_unused)
+{
+ int ret = RET_OK;
+ PyObject * filename = NULL;
+ PyObject * tracename = NULL;
+ #if WHAT_LOG || TRACE_LOG
+ PyObject * ascii = NULL;
+ #endif
+
+ #if WHAT_LOG
+ if (what <= sizeof(what_sym)/sizeof(const char *)) {
+ ascii = MyText_AS_BYTES(frame->f_code->co_filename);
+ printf("trace: %s @ %s %d\n", what_sym[what], MyText_AS_STRING(ascii), frame->f_lineno);
+ Py_DECREF(ascii);
+ }
+ #endif
+
+ #if TRACE_LOG
+ ascii = MyText_AS_BYTES(frame->f_code->co_filename);
+ if (strstr(MyText_AS_STRING(ascii), start_file) && frame->f_lineno == start_line) {
+ logging = 1;
+ }
+ Py_DECREF(ascii);
+ #endif
+
+ /* See below for details on missing-return detection. */
+ if (self->last_exc_back) {
+ if (frame == self->last_exc_back) {
+ /* Looks like someone forgot to send a return event. We'll clear
+ the exception state and do the RETURN code here. Notice that the
+ frame we have in hand here is not the correct frame for the RETURN,
+ that frame is gone. Our handling for RETURN doesn't need the
+ actual frame, but we do log it, so that will look a little off if
+ you're looking at the detailed log.
+
+ If someday we need to examine the frame when doing RETURN, then
+ we'll need to keep more of the missed frame's state.
+ */
+ STATS( self->stats.missed_returns++; )
+ if (self->depth >= 0) {
+ if (self->tracing_arcs && self->cur_file_data) {
+ if (CTracer_record_pair(self, self->last_line, -self->last_exc_firstlineno) < 0) {
+ return RET_ERROR;
+ }
+ }
+ SHOWLOG(self->depth, frame->f_lineno, frame->f_code->co_filename, "missedreturn");
+ self->cur_file_data = self->data_stack[self->depth].file_data;
+ self->last_line = self->data_stack[self->depth].last_line;
+ self->depth--;
+ }
+ }
+ self->last_exc_back = NULL;
+ }
+
+
+ switch (what) {
+ case PyTrace_CALL: /* 0 */
+ STATS( self->stats.calls++; )
+ /* Grow the stack. */
+ self->depth++;
+ if (self->depth >= self->data_stack_alloc) {
+ STATS( self->stats.stack_reallocs++; )
+ /* We've outgrown our data_stack array: make it bigger. */
+ int bigger = self->data_stack_alloc + STACK_DELTA;
+ DataStackEntry * bigger_data_stack = PyMem_Realloc(self->data_stack, bigger * sizeof(DataStackEntry));
+ if (bigger_data_stack == NULL) {
+ STATS( self->stats.errors++; )
+ PyErr_NoMemory();
+ self->depth--;
+ return RET_ERROR;
+ }
+ self->data_stack = bigger_data_stack;
+ self->data_stack_alloc = bigger;
+ }
+
+ /* Push the current state on the stack. */
+ self->data_stack[self->depth].file_data = self->cur_file_data;
+ self->data_stack[self->depth].last_line = self->last_line;
+
+ /* Check if we should trace this line. */
+ filename = frame->f_code->co_filename;
+ tracename = PyDict_GetItem(self->should_trace_cache, filename);
+ if (tracename == NULL) {
+ STATS( self->stats.new_files++; )
+ /* We've never considered this file before. */
+ /* Ask should_trace about it. */
+ PyObject * args = Py_BuildValue("(OO)", filename, frame);
+ tracename = PyObject_Call(self->should_trace, args, NULL);
+ Py_DECREF(args);
+ if (tracename == NULL) {
+ /* An error occurred inside should_trace. */
+ STATS( self->stats.errors++; )
+ return RET_ERROR;
+ }
+ if (PyDict_SetItem(self->should_trace_cache, filename, tracename) < 0) {
+ STATS( self->stats.errors++; )
+ return RET_ERROR;
+ }
+ }
+ else {
+ Py_INCREF(tracename);
+ }
+
+ /* If tracename is a string, then we're supposed to trace. */
+ if (MyText_Check(tracename)) {
+ PyObject * file_data = PyDict_GetItem(self->data, tracename);
+ if (file_data == NULL) {
+ file_data = PyDict_New();
+ if (file_data == NULL) {
+ STATS( self->stats.errors++; )
+ return RET_ERROR;
+ }
+ ret = PyDict_SetItem(self->data, tracename, file_data);
+ Py_DECREF(file_data);
+ if (ret < 0) {
+ STATS( self->stats.errors++; )
+ return RET_ERROR;
+ }
+ }
+ self->cur_file_data = file_data;
+ /* Make the frame right in case settrace(gettrace()) happens. */
+ Py_INCREF(self);
+ frame->f_trace = (PyObject*)self;
+ SHOWLOG(self->depth, frame->f_lineno, filename, "traced");
+ }
+ else {
+ self->cur_file_data = NULL;
+ SHOWLOG(self->depth, frame->f_lineno, filename, "skipped");
+ }
+
+ Py_DECREF(tracename);
+
+ self->last_line = -1;
+ break;
+
+ case PyTrace_RETURN: /* 3 */
+ STATS( self->stats.returns++; )
+ /* A near-copy of this code is above in the missing-return handler. */
+ if (self->depth >= 0) {
+ if (self->tracing_arcs && self->cur_file_data) {
+ int first = frame->f_code->co_firstlineno;
+ if (CTracer_record_pair(self, self->last_line, -first) < 0) {
+ return RET_ERROR;
+ }
+ }
+
+ SHOWLOG(self->depth, frame->f_lineno, frame->f_code->co_filename, "return");
+ self->cur_file_data = self->data_stack[self->depth].file_data;
+ self->last_line = self->data_stack[self->depth].last_line;
+ self->depth--;
+ }
+ break;
+
+ case PyTrace_LINE: /* 2 */
+ STATS( self->stats.lines++; )
+ if (self->depth >= 0) {
+ SHOWLOG(self->depth, frame->f_lineno, frame->f_code->co_filename, "line");
+ if (self->cur_file_data) {
+ /* We're tracing in this frame: record something. */
+ if (self->tracing_arcs) {
+ /* Tracing arcs: key is (last_line,this_line). */
+ if (CTracer_record_pair(self, self->last_line, frame->f_lineno) < 0) {
+ return RET_ERROR;
+ }
+ }
+ else {
+ /* Tracing lines: key is simply this_line. */
+ PyObject * this_line = MyInt_FromLong(frame->f_lineno);
+ if (this_line == NULL) {
+ STATS( self->stats.errors++; )
+ return RET_ERROR;
+ }
+ ret = PyDict_SetItem(self->cur_file_data, this_line, Py_None);
+ Py_DECREF(this_line);
+ if (ret < 0) {
+ STATS( self->stats.errors++; )
+ return RET_ERROR;
+ }
+ }
+ }
+ self->last_line = frame->f_lineno;
+ }
+ break;
+
+ case PyTrace_EXCEPTION:
+ /* Some code (Python 2.3, and pyexpat anywhere) fires an exception event
+ without a return event. To detect that, we'll keep a copy of the
+ parent frame for an exception event. If the next event is in that
+ frame, then we must have returned without a return event. We can
+ synthesize the missing event then.
+
+ Python itself fixed this problem in 2.4. Pyexpat still has the bug.
+ I've reported the problem with pyexpat as http://bugs.python.org/issue6359 .
+ If it gets fixed, this code should still work properly. Maybe some day
+ the bug will be fixed everywhere coverage.py is supported, and we can
+ remove this missing-return detection.
+
+ More about this fix: http://nedbatchelder.com/blog/200907/a_nasty_little_bug.html
+ */
+ STATS( self->stats.exceptions++; )
+ self->last_exc_back = frame->f_back;
+ self->last_exc_firstlineno = frame->f_code->co_firstlineno;
+ break;
+
+ default:
+ STATS( self->stats.others++; )
+ break;
+ }
+
+ return RET_OK;
+}
+
+/*
+ * Python has two ways to set the trace function: sys.settrace(fn), which
+ * takes a Python callable, and PyEval_SetTrace(func, obj), which takes
+ * a C function and a Python object. The way these work together is that
+ * sys.settrace(pyfn) calls PyEval_SetTrace(builtin_func, pyfn), using the
+ * Python callable as the object in PyEval_SetTrace. So sys.gettrace()
+ * simply returns the Python object used as the second argument to
+ * PyEval_SetTrace. So sys.gettrace() will return our self parameter, which
+ * means it must be callable to be used in sys.settrace().
+ *
+ * So we make our self callable, equivalent to invoking our trace function.
+ *
+ * To help with the process of replaying stored frames, this function has an
+ * optional keyword argument:
+ *
+ * def CTracer_call(frame, event, arg, lineno=0)
+ *
+ * If provided, the lineno argument is used as the line number, and the
+ * frame's f_lineno member is ignored.
+ */
+static PyObject *
+CTracer_call(CTracer *self, PyObject *args, PyObject *kwds)
+{
+ PyFrameObject *frame;
+ PyObject *what_str;
+ PyObject *arg;
+ int lineno = 0;
+ int what;
+ int orig_lineno;
+ PyObject *ret = NULL;
+
+ static char *what_names[] = {
+ "call", "exception", "line", "return",
+ "c_call", "c_exception", "c_return",
+ NULL
+ };
+
+ #if WHAT_LOG
+ printf("pytrace\n");
+ #endif
+
+ static char *kwlist[] = {"frame", "event", "arg", "lineno", NULL};
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!O!O|i:Tracer_call", kwlist,
+ &PyFrame_Type, &frame, &MyText_Type, &what_str, &arg, &lineno)) {
+ goto done;
+ }
+
+ /* In Python, the what argument is a string, we need to find an int
+ for the C function. */
+ for (what = 0; what_names[what]; what++) {
+ PyObject *ascii = MyText_AS_BYTES(what_str);
+ int should_break = !strcmp(MyText_AS_STRING(ascii), what_names[what]);
+ Py_DECREF(ascii);
+ if (should_break) {
+ break;
+ }
+ }
+
+ /* Save off the frame's lineno, and use the forced one, if provided. */
+ orig_lineno = frame->f_lineno;
+ if (lineno > 0) {
+ frame->f_lineno = lineno;
+ }
+
+ /* Invoke the C function, and return ourselves. */
+ if (CTracer_trace(self, frame, what, arg) == RET_OK) {
+ Py_INCREF(self);
+ ret = (PyObject *)self;
+ }
+
+ /* Clean up. */
+ frame->f_lineno = orig_lineno;
+
+done:
+ return ret;
+}
+
+static PyObject *
+CTracer_start(CTracer *self, PyObject *args_unused)
+{
+ PyEval_SetTrace((Py_tracefunc)CTracer_trace, (PyObject*)self);
+ self->started = 1;
+ self->tracing_arcs = self->arcs && PyObject_IsTrue(self->arcs);
+ self->last_line = -1;
+
+ /* start() returns a trace function usable with sys.settrace() */
+ Py_INCREF(self);
+ return (PyObject *)self;
+}
+
+static PyObject *
+CTracer_stop(CTracer *self, PyObject *args_unused)
+{
+ if (self->started) {
+ PyEval_SetTrace(NULL, NULL);
+ self->started = 0;
+ }
+
+ return Py_BuildValue("");
+}
+
+static PyObject *
+CTracer_get_stats(CTracer *self)
+{
+#if COLLECT_STATS
+ return Py_BuildValue(
+ "{sI,sI,sI,sI,sI,sI,sI,sI,si,sI}",
+ "calls", self->stats.calls,
+ "lines", self->stats.lines,
+ "returns", self->stats.returns,
+ "exceptions", self->stats.exceptions,
+ "others", self->stats.others,
+ "new_files", self->stats.new_files,
+ "missed_returns", self->stats.missed_returns,
+ "stack_reallocs", self->stats.stack_reallocs,
+ "stack_alloc", self->data_stack_alloc,
+ "errors", self->stats.errors
+ );
+#else
+ return Py_BuildValue("");
+#endif /* COLLECT_STATS */
+}
+
+static PyMemberDef
+CTracer_members[] = {
+ { "should_trace", T_OBJECT, offsetof(CTracer, should_trace), 0,
+ PyDoc_STR("Function indicating whether to trace a file.") },
+
+ { "warn", T_OBJECT, offsetof(CTracer, warn), 0,
+ PyDoc_STR("Function for issuing warnings.") },
+
+ { "data", T_OBJECT, offsetof(CTracer, data), 0,
+ PyDoc_STR("The raw dictionary of trace data.") },
+
+ { "should_trace_cache", T_OBJECT, offsetof(CTracer, should_trace_cache), 0,
+ PyDoc_STR("Dictionary caching should_trace results.") },
+
+ { "arcs", T_OBJECT, offsetof(CTracer, arcs), 0,
+ PyDoc_STR("Should we trace arcs, or just lines?") },
+
+ { NULL }
+};
+
+static PyMethodDef
+CTracer_methods[] = {
+ { "start", (PyCFunction) CTracer_start, METH_VARARGS,
+ PyDoc_STR("Start the tracer") },
+
+ { "stop", (PyCFunction) CTracer_stop, METH_VARARGS,
+ PyDoc_STR("Stop the tracer") },
+
+ { "get_stats", (PyCFunction) CTracer_get_stats, METH_VARARGS,
+ PyDoc_STR("Get statistics about the tracing") },
+
+ { NULL }
+};
+
+static PyTypeObject
+CTracerType = {
+ MyType_HEAD_INIT
+ "coverage.CTracer", /*tp_name*/
+ sizeof(CTracer), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ (destructor)CTracer_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ 0, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ 0, /*tp_compare*/
+ 0, /*tp_repr*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
+ 0, /*tp_hash */
+ (ternaryfunc)CTracer_call, /*tp_call*/
+ 0, /*tp_str*/
+ 0, /*tp_getattro*/
+ 0, /*tp_setattro*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
+ "CTracer objects", /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ 0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+ 0, /* tp_iter */
+ 0, /* tp_iternext */
+ CTracer_methods, /* tp_methods */
+ CTracer_members, /* tp_members */
+ 0, /* tp_getset */
+ 0, /* tp_base */
+ 0, /* tp_dict */
+ 0, /* tp_descr_get */
+ 0, /* tp_descr_set */
+ 0, /* tp_dictoffset */
+ (initproc)CTracer_init, /* tp_init */
+ 0, /* tp_alloc */
+ 0, /* tp_new */
+};
+
+/* Module definition */
+
+#define MODULE_DOC PyDoc_STR("Fast coverage tracer.")
+
+#if PY_MAJOR_VERSION >= 3
+
+static PyModuleDef
+moduledef = {
+ PyModuleDef_HEAD_INIT,
+ "coverage.tracer",
+ MODULE_DOC,
+ -1,
+ NULL, /* methods */
+ NULL,
+ NULL, /* traverse */
+ NULL, /* clear */
+ NULL
+};
+
+
+PyObject *
+PyInit_tracer(void)
+{
+ PyObject * mod = PyModule_Create(&moduledef);
+ if (mod == NULL) {
+ return NULL;
+ }
+
+ CTracerType.tp_new = PyType_GenericNew;
+ if (PyType_Ready(&CTracerType) < 0) {
+ Py_DECREF(mod);
+ return NULL;
+ }
+
+ Py_INCREF(&CTracerType);
+ PyModule_AddObject(mod, "CTracer", (PyObject *)&CTracerType);
+
+ return mod;
+}
+
+#else
+
+void
+inittracer(void)
+{
+ PyObject * mod;
+
+ mod = Py_InitModule3("coverage.tracer", NULL, MODULE_DOC);
+ if (mod == NULL) {
+ return;
+ }
+
+ CTracerType.tp_new = PyType_GenericNew;
+ if (PyType_Ready(&CTracerType) < 0) {
+ return;
+ }
+
+ Py_INCREF(&CTracerType);
+ PyModule_AddObject(mod, "CTracer", (PyObject *)&CTracerType);
+}
+
+#endif /* Py3k */
diff --git a/python/helpers/coverage/tracer.pyd b/python/helpers/coverage/tracer.pyd
deleted file mode 100644
index a13aa032abe1..000000000000
--- a/python/helpers/coverage/tracer.pyd
+++ /dev/null
Binary files differ
diff --git a/python/helpers/coverage/version.py b/python/helpers/coverage/version.py
new file mode 100644
index 000000000000..a43bde8023e3
--- /dev/null
+++ b/python/helpers/coverage/version.py
@@ -0,0 +1,9 @@
+"""The version and URL for coverage.py"""
+# This file is exec'ed in setup.py, don't import anything!
+
+__version__ = "3.7.1" # see detailed history in CHANGES.txt
+
+__url__ = "http://nedbatchelder.com/code/coverage"
+if max(__version__).isalpha():
+ # For pre-releases, use a version-specific URL.
+ __url__ += "/" + __version__
diff --git a/python/helpers/coverage/xmlreport.py b/python/helpers/coverage/xmlreport.py
index 5f6cc87e2fef..26ac02ad13d0 100644
--- a/python/helpers/coverage/xmlreport.py
+++ b/python/helpers/coverage/xmlreport.py
@@ -4,7 +4,7 @@ import os, sys, time
import xml.dom.minidom
from coverage import __url__, __version__
-from coverage.backward import sorted # pylint: disable=W0622
+from coverage.backward import sorted, rpartition # pylint: disable=W0622
from coverage.report import Reporter
def rate(hit, num):
@@ -15,20 +15,19 @@ def rate(hit, num):
class XmlReporter(Reporter):
"""A reporter for writing Cobertura-style XML coverage results."""
- def __init__(self, coverage, ignore_errors=False):
- super(XmlReporter, self).__init__(coverage, ignore_errors)
+ def __init__(self, coverage, config):
+ super(XmlReporter, self).__init__(coverage, config)
self.packages = None
self.xml_out = None
self.arcs = coverage.data.has_arcs()
- def report(self, morfs, outfile=None, config=None):
+ def report(self, morfs, outfile=None):
"""Generate a Cobertura-compatible XML report for `morfs`.
`morfs` is a list of modules or filenames.
- `outfile` is a file object to write the XML to. `config` is a
- CoverageConfig instance.
+ `outfile` is a file object to write the XML to.
"""
# Initial setup.
@@ -54,7 +53,7 @@ class XmlReporter(Reporter):
# Call xml_file for each file in the data.
self.packages = {}
- self.report_files(self.xml_file, morfs, config)
+ self.report_files(self.xml_file, morfs)
lnum_tot, lhits_tot = 0, 0
bnum_tot, bhits_tot = 0, 0
@@ -85,14 +84,23 @@ class XmlReporter(Reporter):
# Use the DOM to write the output file.
outfile.write(self.xml_out.toprettyxml())
+ # Return the total percentage.
+ denom = lnum_tot + bnum_tot
+ if denom == 0:
+ pct = 0.0
+ else:
+ pct = 100.0 * (lhits_tot + bhits_tot) / denom
+ return pct
+
def xml_file(self, cu, analysis):
"""Add to the XML report for a single file."""
# Create the 'lines' and 'package' XML elements, which
# are populated later. Note that a package == a directory.
- dirname, fname = os.path.split(cu.name)
- dirname = dirname or '.'
- package = self.packages.setdefault(dirname, [ {}, 0, 0, 0, 0 ])
+ package_name = rpartition(cu.name, ".")[0]
+ className = cu.name
+
+ package = self.packages.setdefault(package_name, [{}, 0, 0, 0, 0])
xclass = self.xml_out.createElement("class")
@@ -100,22 +108,22 @@ class XmlReporter(Reporter):
xlines = self.xml_out.createElement("lines")
xclass.appendChild(xlines)
- className = fname.replace('.', '_')
+
xclass.setAttribute("name", className)
- ext = os.path.splitext(cu.filename)[1]
- xclass.setAttribute("filename", cu.name + ext)
+ filename = cu.file_locator.relative_filename(cu.filename)
+ xclass.setAttribute("filename", filename.replace("\\", "/"))
xclass.setAttribute("complexity", "0")
branch_stats = analysis.branch_stats()
# For each statement, create an XML 'line' element.
- for line in analysis.statements:
+ for line in sorted(analysis.statements):
xline = self.xml_out.createElement("line")
xline.setAttribute("number", str(line))
# Q: can we get info about the number of times a statement is
# executed? If so, that should be recorded here.
- xline.setAttribute("hits", str(int(not line in analysis.missing)))
+ xline.setAttribute("hits", str(int(line not in analysis.missing)))
if self.arcs:
if line in branch_stats:
diff --git a/python/helpers/generator3.py b/python/helpers/generator3.py
index 50e911923a43..d09f6d918e18 100644
--- a/python/helpers/generator3.py
+++ b/python/helpers/generator3.py
@@ -161,6 +161,9 @@ def list_sources(paths):
path = os.path.normpath(path)
+ if path.endswith('.egg') and os.path.isfile(path):
+ say("%s\t%s\t%d", path, path, os.path.getsize(path))
+
for root, files in walk_python_path(path):
for name in files:
if name.endswith('.py'):
diff --git a/python/helpers/pep8.py b/python/helpers/pep8.py
index 2ce7554840cc..f605f189fab3 100644
--- a/python/helpers/pep8.py
+++ b/python/helpers/pep8.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python
# pep8.py - Check Python source code formatting, according to PEP 8
# Copyright (C) 2006-2009 Johann C. Rocholl <johann@rocholl.net>
-# Copyright (C) 2009-2013 Florent Xicluna <florent.xicluna@gmail.com>
+# Copyright (C) 2009-2014 Florent Xicluna <florent.xicluna@gmail.com>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
@@ -24,8 +24,7 @@
# SOFTWARE.
r"""
-Check Python source code formatting, according to PEP 8:
-http://www.python.org/dev/peps/pep-0008/
+Check Python source code formatting, according to PEP 8.
For usage and a list of options, try this:
$ python pep8.py -h
@@ -45,7 +44,9 @@ W warnings
700 statements
900 syntax error
"""
-__version__ = '1.4.5a0'
+from __future__ import with_statement
+
+__version__ = '1.5.7'
import os
import sys
@@ -63,13 +64,13 @@ except ImportError:
from ConfigParser import RawConfigParser
DEFAULT_EXCLUDE = '.svn,CVS,.bzr,.hg,.git,__pycache__'
-DEFAULT_IGNORE = 'E226,E24'
+DEFAULT_IGNORE = 'E123,E226,E24'
if sys.platform == 'win32':
DEFAULT_CONFIG = os.path.expanduser(r'~\.pep8')
else:
DEFAULT_CONFIG = os.path.join(os.getenv('XDG_CONFIG_HOME') or
os.path.expanduser('~/.config'), 'pep8')
-PROJECT_CONFIG = ('.pep8', 'tox.ini', 'setup.cfg')
+PROJECT_CONFIG = ('setup.cfg', 'tox.ini', '.pep8')
TESTSUITE_PATH = os.path.join(os.path.dirname(__file__), 'testsuite')
MAX_LINE_LENGTH = 79
REPORT_FORMAT = {
@@ -87,18 +88,21 @@ WS_NEEDED_OPERATORS = frozenset([
'**=', '*=', '/=', '//=', '+=', '-=', '!=', '<>', '<', '>',
'%=', '^=', '&=', '|=', '==', '<=', '>=', '<<=', '>>=', '='])
WHITESPACE = frozenset(' \t')
-SKIP_TOKENS = frozenset([tokenize.COMMENT, tokenize.NL, tokenize.NEWLINE,
- tokenize.INDENT, tokenize.DEDENT])
+NEWLINE = frozenset([tokenize.NL, tokenize.NEWLINE])
+SKIP_TOKENS = NEWLINE.union([tokenize.INDENT, tokenize.DEDENT])
+# ERRORTOKEN is triggered by backticks in Python 3
+SKIP_COMMENTS = SKIP_TOKENS.union([tokenize.COMMENT, tokenize.ERRORTOKEN])
BENCHMARK_KEYS = ['directories', 'files', 'logical lines', 'physical lines']
INDENT_REGEX = re.compile(r'([ \t]*)')
-RAISE_COMMA_REGEX = re.compile(r'raise\s+\w+\s*(,)')
-RERAISE_COMMA_REGEX = re.compile(r'raise\s+\w+\s*,\s*\w+\s*,\s*\w+')
+RAISE_COMMA_REGEX = re.compile(r'raise\s+\w+\s*,')
+RERAISE_COMMA_REGEX = re.compile(r'raise\s+\w+\s*,.*,\s*\w+\s*$')
ERRORCODE_REGEX = re.compile(r'\b[A-Z]\d{3}\b')
DOCSTRING_REGEX = re.compile(r'u?r?["\']')
EXTRANEOUS_WHITESPACE_REGEX = re.compile(r'[[({] | []}),;:]')
WHITESPACE_AFTER_COMMA_REGEX = re.compile(r'[,;:]\s*(?: |\t)')
COMPARE_SINGLETON_REGEX = re.compile(r'([=!]=)\s*(None|False|True)')
+COMPARE_NEGATIVE_REGEX = re.compile(r'\b(not)\s+[^[({ ]+\s+(in|is)\s')
COMPARE_TYPE_REGEX = re.compile(r'(?:[=!]=|is(?:\s+not)?)\s*type(?:s.\w+Type'
r'|\s*\(\s*([^)]*[^ )])\s*\))')
KEYWORD_REGEX = re.compile(r'(\s*)\b(?:%s)\b(\s*)' % r'|'.join(KEYWORDS))
@@ -117,8 +121,7 @@ COMMENT_WITH_NL = tokenize.generate_tokens(['#\n'].pop).send(None)[1] == '#\n'
def tabs_or_spaces(physical_line, indent_char):
- r"""
- Never mix tabs and spaces.
+ r"""Never mix tabs and spaces.
The most popular way of indenting Python is with spaces only. The
second-most popular way is with tabs only. Code indented with a mixture
@@ -137,9 +140,7 @@ def tabs_or_spaces(physical_line, indent_char):
def tabs_obsolete(physical_line):
- r"""
- For new projects, spaces-only are strongly recommended over tabs. Most
- editors have features that make this easy to do.
+ r"""For new projects, spaces-only are strongly recommended over tabs.
Okay: if True:\n return
W191: if True:\n\treturn
@@ -150,16 +151,7 @@ def tabs_obsolete(physical_line):
def trailing_whitespace(physical_line):
- r"""
- JCR: Trailing whitespace is superfluous.
- FBM: Except when it occurs as part of a blank line (i.e. the line is
- nothing but whitespace). According to Python docs[1] a line with only
- whitespace is considered a blank line, and is to be ignored. However,
- matching a blank line to its indentation level avoids mistakenly
- terminating a multi-line statement (e.g. class declaration) when
- pasting code into the standard Python interpreter.
-
- [1] http://docs.python.org/reference/lexical_analysis.html#blank-lines
+ r"""Trailing whitespace is superfluous.
The warning returned varies on whether the line itself is blank, for easier
filtering for those who want to indent their blank lines.
@@ -179,30 +171,24 @@ def trailing_whitespace(physical_line):
return 0, "W293 blank line contains whitespace"
-def trailing_blank_lines(physical_line, lines, line_number):
- r"""
- JCR: Trailing blank lines are superfluous.
+def trailing_blank_lines(physical_line, lines, line_number, total_lines):
+ r"""Trailing blank lines are superfluous.
Okay: spam(1)
W391: spam(1)\n
- """
- if not physical_line.rstrip() and line_number == len(lines):
- return 0, "W391 blank line at end of file"
-
-def missing_newline(physical_line):
+ However the last line should end with a new line (warning W292).
"""
- JCR: The last line should have a newline.
-
- Reports warning W292.
- """
- if physical_line.rstrip() == physical_line:
- return len(physical_line), "W292 no newline at end of file"
+ if line_number == total_lines:
+ stripped_last_line = physical_line.rstrip()
+ if not stripped_last_line:
+ return 0, "W391 blank line at end of file"
+ if stripped_last_line == physical_line:
+ return len(physical_line), "W292 no newline at end of file"
-def maximum_line_length(physical_line, max_line_length):
- """
- Limit all lines to a maximum of 79 characters.
+def maximum_line_length(physical_line, max_line_length, multiline):
+ r"""Limit all lines to a maximum of 79 characters.
There are still many devices around that are limited to 80 character
lines; plus, limiting windows to 80 characters makes it possible to have
@@ -215,8 +201,13 @@ def maximum_line_length(physical_line, max_line_length):
"""
line = physical_line.rstrip()
length = len(line)
- if length > max_line_length:
- if noqa(line):
+ if length > max_line_length and not noqa(line):
+ # Special case for long URLs in multi-line docstrings or comments,
+ # but still report the error when the 72 first chars are whitespaces.
+ chunks = line.split()
+ if ((len(chunks) == 1 and multiline) or
+ (len(chunks) == 2 and chunks[0] == '#')) and \
+ len(line) - len(chunks[-1]) < max_line_length - 7:
return
if hasattr(line, 'decode'): # Python 2
# The line could contain multi-byte characters
@@ -235,9 +226,8 @@ def maximum_line_length(physical_line, max_line_length):
def blank_lines(logical_line, blank_lines, indent_level, line_number,
- previous_logical, previous_indent_level):
- r"""
- Separate top-level function and class definitions with two blank lines.
+ blank_before, previous_logical, previous_indent_level):
+ r"""Separate top-level function and class definitions with two blank lines.
Method definitions inside a class are separated by a single blank line.
@@ -265,19 +255,18 @@ def blank_lines(logical_line, blank_lines, indent_level, line_number,
yield 0, "E303 too many blank lines (%d)" % blank_lines
elif logical_line.startswith(('def ', 'class ', '@')):
if indent_level:
- if not (blank_lines or previous_indent_level < indent_level or
+ if not (blank_before or previous_indent_level < indent_level or
DOCSTRING_REGEX.match(previous_logical)):
yield 0, "E301 expected 1 blank line, found 0"
- elif blank_lines != 2:
- yield 0, "E302 expected 2 blank lines, found %d" % blank_lines
+ elif blank_before != 2:
+ yield 0, "E302 expected 2 blank lines, found %d" % blank_before
def extraneous_whitespace(logical_line):
- """
- Avoid extraneous whitespace in the following situations:
+ r"""Avoid extraneous whitespace.
+ Avoid extraneous whitespace in these situations:
- Immediately inside parentheses, brackets or braces.
-
- Immediately before a comma, semicolon, or colon.
Okay: spam(ham[1], {eggs: 2})
@@ -306,8 +295,7 @@ def extraneous_whitespace(logical_line):
def whitespace_around_keywords(logical_line):
- r"""
- Avoid extraneous whitespace around keywords.
+ r"""Avoid extraneous whitespace around keywords.
Okay: True and False
E271: True and False
@@ -330,8 +318,7 @@ def whitespace_around_keywords(logical_line):
def missing_whitespace(logical_line):
- """
- JCR: Each comma, semicolon or colon should be followed by whitespace.
+ r"""Each comma, semicolon or colon should be followed by whitespace.
Okay: [a, b]
Okay: (3,)
@@ -358,8 +345,7 @@ def missing_whitespace(logical_line):
def indentation(logical_line, previous_logical, indent_char,
indent_level, previous_indent_level):
- r"""
- Use 4 spaces per indentation level.
+ r"""Use 4 spaces per indentation level.
For really old code that you don't want to mess up, you can continue to
use 8-space tabs.
@@ -383,16 +369,16 @@ def indentation(logical_line, previous_logical, indent_char,
yield 0, "E113 unexpected indentation"
-def continuation_line_indentation(logical_line, tokens, indent_level, verbose):
- r"""
- Continuation lines should align wrapped elements either vertically using
- Python's implicit line joining inside parentheses, brackets and braces, or
- using a hanging indent.
+def continued_indentation(logical_line, tokens, indent_level, hang_closing,
+ indent_char, noqa, verbose):
+ r"""Continuation lines indentation.
- When using a hanging indent the following considerations should be applied:
+ Continuation lines should align wrapped elements either vertically
+ using Python's implicit line joining inside parentheses, brackets
+ and braces, or using a hanging indent.
+ When using a hanging indent these considerations should be applied:
- there should be no arguments on the first line, and
-
- further indentation should be used to clearly distinguish itself as a
continuation line.
@@ -404,14 +390,16 @@ def continuation_line_indentation(logical_line, tokens, indent_level, verbose):
E122: a = (\n42)
E123: a = (\n 42\n )
E124: a = (24,\n 42\n)
- E125: if (a or\n b):\n pass
+ E125: if (\n b):\n pass
E126: a = (\n 42)
E127: a = (24,\n 42)
E128: a = (24,\n 42)
+ E129: if (a or\n b):\n pass
+ E131: a = (\n 42\n 24)
"""
first_row = tokens[0][2][0]
nrows = 1 + tokens[-1][2][0] - first_row
- if nrows == 1 or noqa(tokens[0][4]):
+ if noqa or nrows == 1:
return
# indent_next tells us whether the next block is indented; assuming
@@ -421,13 +409,20 @@ def continuation_line_indentation(logical_line, tokens, indent_level, verbose):
indent_next = logical_line.endswith(':')
row = depth = 0
+ valid_hangs = (4,) if indent_char != '\t' else (4, 8)
# remember how many brackets were opened on each line
parens = [0] * nrows
# relative indents of physical lines
rel_indent = [0] * nrows
+ # for each depth, collect a list of opening rows
+ open_rows = [[0]]
+ # for each depth, memorize the hanging indentation
+ hangs = [None]
# visual indents
indent_chances = {}
last_indent = tokens[0][2]
+ visual_indent = None
+ # for each depth, memorize the visual indent column
indent = [last_indent[1]]
if verbose >= 3:
print(">>> " + tokens[0][4].rstrip())
@@ -437,8 +432,7 @@ def continuation_line_indentation(logical_line, tokens, indent_level, verbose):
newline = row < start[0] - first_row
if newline:
row = start[0] - first_row
- newline = (not last_token_multiline and
- token_type not in (tokenize.NL, tokenize.NEWLINE))
+ newline = not last_token_multiline and token_type not in NEWLINE
if newline:
# this is the beginning of a continuation line.
@@ -449,51 +443,61 @@ def continuation_line_indentation(logical_line, tokens, indent_level, verbose):
# record the initial indent.
rel_indent[row] = expand_indent(line) - indent_level
- if depth:
- # a bracket expression in a continuation line.
- # find the line that it was opened on
- for open_row in range(row - 1, -1, -1):
- if parens[open_row]:
- break
- else:
- # an unbracketed continuation line (ie, backslash)
- open_row = 0
- hang = rel_indent[row] - rel_indent[open_row]
- visual_indent = indent_chances.get(start[1])
-
- if token_type == tokenize.OP and text in ']})':
- # this line starts with a closing bracket
- if indent[depth]:
- if start[1] != indent[depth]:
- yield (start, "E124 closing bracket does not match "
- "visual indentation")
- elif hang:
+ # identify closing bracket
+ close_bracket = (token_type == tokenize.OP and text in ']})')
+
+ # is the indent relative to an opening bracket line?
+ for open_row in reversed(open_rows[depth]):
+ hang = rel_indent[row] - rel_indent[open_row]
+ hanging_indent = hang in valid_hangs
+ if hanging_indent:
+ break
+ if hangs[depth]:
+ hanging_indent = (hang == hangs[depth])
+ # is there any chance of visual indent?
+ visual_indent = (not close_bracket and hang > 0 and
+ indent_chances.get(start[1]))
+
+ if close_bracket and indent[depth]:
+ # closing bracket for visual indent
+ if start[1] != indent[depth]:
+ yield (start, "E124 closing bracket does not match "
+ "visual indentation")
+ elif close_bracket and not hang:
+ # closing bracket matches indentation of opening bracket's line
+ if hang_closing:
+ yield start, "E133 closing bracket is missing indentation"
+ elif indent[depth] and start[1] < indent[depth]:
+ if visual_indent is not True:
+ # visual indent is broken
+ yield (start, "E128 continuation line "
+ "under-indented for visual indent")
+ elif hanging_indent or (indent_next and rel_indent[row] == 8):
+ # hanging indent is verified
+ if close_bracket and not hang_closing:
yield (start, "E123 closing bracket does not match "
"indentation of opening bracket's line")
+ hangs[depth] = hang
elif visual_indent is True:
# visual indent is verified
- if not indent[depth]:
- indent[depth] = start[1]
+ indent[depth] = start[1]
elif visual_indent in (text, str):
# ignore token lined up with matching one from a previous line
pass
- elif indent[depth] and start[1] < indent[depth]:
- # visual indent is broken
- yield (start, "E128 continuation line "
- "under-indented for visual indent")
- elif hang == 4 or (indent_next and rel_indent[row] == 8):
- # hanging indent is verified
- pass
else:
# indent is broken
if hang <= 0:
error = "E122", "missing indentation or outdented"
elif indent[depth]:
error = "E127", "over-indented for visual indent"
- elif hang % 4:
- error = "E121", "indentation is not a multiple of four"
+ elif not close_bracket and hangs[depth]:
+ error = "E131", "unaligned for hanging indent"
else:
- error = "E126", "over-indented for hanging indent"
+ hangs[depth] = hang
+ if hang > 4:
+ error = "E126", "over-indented for hanging indent"
+ else:
+ error = "E121", "under-indented for hanging indent"
yield start, "%s continuation line %s" % error
# look for visual indenting
@@ -510,12 +514,18 @@ def continuation_line_indentation(logical_line, tokens, indent_level, verbose):
# special case for the "if" statement because len("if (") == 4
elif not indent_chances and not row and not depth and text == 'if':
indent_chances[end[1] + 1] = True
+ elif text == ':' and line[end[1]:].isspace():
+ open_rows[depth].append(row)
# keep track of bracket depth
if token_type == tokenize.OP:
if text in '([{':
depth += 1
indent.append(0)
+ hangs.append(None)
+ if len(open_rows) == depth:
+ open_rows.append([])
+ open_rows[depth].append(row)
parens[row] += 1
if verbose >= 4:
print("bracket depth %s seen, col %s, visual min = %s" %
@@ -523,12 +533,14 @@ def continuation_line_indentation(logical_line, tokens, indent_level, verbose):
elif text in ')]}' and depth > 0:
# parent indents should not be more than this one
prev_indent = indent.pop() or last_indent[1]
+ hangs.pop()
for d in range(depth):
if indent[d] > prev_indent:
indent[d] = 0
for ind in list(indent_chances):
if ind >= prev_indent:
del indent_chances[ind]
+ del open_rows[depth + 1:]
depth -= 1
if depth:
indent_chances[indent[depth]] = True
@@ -542,21 +554,25 @@ def continuation_line_indentation(logical_line, tokens, indent_level, verbose):
indent_chances[start[1]] = text
last_token_multiline = (start[0] != end[0])
+ if last_token_multiline:
+ rel_indent[end[0] - first_row] = rel_indent[row]
- if indent_next and rel_indent[-1] == 4:
- yield (last_indent, "E125 continuation line does not distinguish "
- "itself from next logical line")
+ if indent_next and expand_indent(line) == indent_level + 4:
+ pos = (start[0], indent[0] + 4)
+ if visual_indent:
+ code = "E129 visually indented line"
+ else:
+ code = "E125 continuation line"
+ yield pos, "%s with same indent as next logical line" % code
def whitespace_before_parameters(logical_line, tokens):
- """
- Avoid extraneous whitespace in the following situations:
-
- - Immediately before the open parenthesis that starts the argument
- list of a function call.
+ r"""Avoid extraneous whitespace.
- - Immediately before the open parenthesis that starts an indexing or
- slicing.
+ Avoid extraneous whitespace in the following situations:
+ - before the open parenthesis that starts the argument list of a
+ function call.
+ - before the open parenthesis that starts an indexing or slicing.
Okay: spam(1)
E211: spam (1)
@@ -565,11 +581,9 @@ def whitespace_before_parameters(logical_line, tokens):
E211: dict ['key'] = list[index]
E211: dict['key'] = list [index]
"""
- prev_type = tokens[0][0]
- prev_text = tokens[0][1]
- prev_end = tokens[0][3]
+ prev_type, prev_text, __, prev_end, __ = tokens[0]
for index in range(1, len(tokens)):
- token_type, text, start, end, line = tokens[index]
+ token_type, text, start, end, __ = tokens[index]
if (token_type == tokenize.OP and
text in '([' and
start != prev_end and
@@ -585,11 +599,7 @@ def whitespace_before_parameters(logical_line, tokens):
def whitespace_around_operator(logical_line):
- r"""
- Avoid extraneous whitespace in the following situations:
-
- - More than one space around an assignment (or other) operator to
- align it with another.
+ r"""Avoid extraneous whitespace around an operator.
Okay: a = 12 + 3
E221: a = 4 + 5
@@ -612,13 +622,15 @@ def whitespace_around_operator(logical_line):
def missing_whitespace_around_operator(logical_line, tokens):
- r"""
+ r"""Surround operators with a single space on either side.
+
- Always surround these binary operators with a single space on
either side: assignment (=), augmented assignment (+=, -= etc.),
- comparisons (==, <, >, !=, <>, <=, >=, in, not in, is, is not),
+ comparisons (==, <, >, !=, <=, >=, in, not in, is, is not),
Booleans (and, or, not).
- - Use spaces around arithmetic operators.
+ - If operators with different priorities are used, consider adding
+ whitespace around the operators with the lowest priorities.
Okay: i = i + 1
Okay: submitted += 1
@@ -642,8 +654,7 @@ def missing_whitespace_around_operator(logical_line, tokens):
prev_type = tokenize.OP
prev_text = prev_end = None
for token_type, text, start, end, line in tokens:
- if token_type in (tokenize.NL, tokenize.NEWLINE, tokenize.ERRORTOKEN):
- # ERRORTOKEN is triggered by backticks in Python 3
+ if token_type in SKIP_COMMENTS:
continue
if text in ('(', 'lambda'):
parens += 1
@@ -683,18 +694,9 @@ def missing_whitespace_around_operator(logical_line, tokens):
# Check if the operator is being used as a binary operator
# Allow unary operators: -123, -x, +1.
# Allow argument unpacking: foo(*args, **kwargs).
- if prev_type == tokenize.OP:
- binary_usage = (prev_text in '}])')
- elif prev_type == tokenize.NAME:
- binary_usage = (prev_text not in KEYWORDS)
- else:
- binary_usage = (prev_type not in SKIP_TOKENS)
-
- if binary_usage:
- if text in WS_OPTIONAL_OPERATORS:
- need_space = None
- else:
- need_space = True
+ if (prev_text in '}])' if prev_type == tokenize.OP
+ else prev_text not in KEYWORDS):
+ need_space = None
elif text in WS_OPTIONAL_OPERATORS:
need_space = None
@@ -712,11 +714,7 @@ def missing_whitespace_around_operator(logical_line, tokens):
def whitespace_around_comma(logical_line):
- r"""
- Avoid extraneous whitespace in the following situations:
-
- - More than one space around an assignment (or other) operator to
- align it with another.
+ r"""Avoid extraneous whitespace after a comma or a colon.
Note: these checks are disabled by default
@@ -734,7 +732,8 @@ def whitespace_around_comma(logical_line):
def whitespace_around_named_parameter_equals(logical_line, tokens):
- """
+ r"""Don't use spaces around the '=' sign in function arguments.
+
Don't use spaces around the '=' sign when used to indicate a
keyword argument or a default parameter value.
@@ -753,6 +752,8 @@ def whitespace_around_named_parameter_equals(logical_line, tokens):
prev_end = None
message = "E251 unexpected spaces around keyword / parameter equals"
for token_type, text, start, end, line in tokens:
+ if token_type == tokenize.NL:
+ continue
if no_space:
no_space = False
if start != prev_end:
@@ -769,38 +770,46 @@ def whitespace_around_named_parameter_equals(logical_line, tokens):
prev_end = end
-def whitespace_before_inline_comment(logical_line, tokens):
- """
- Separate inline comments by at least two spaces.
+def whitespace_before_comment(logical_line, tokens):
+ r"""Separate inline comments by at least two spaces.
An inline comment is a comment on the same line as a statement. Inline
comments should be separated by at least two spaces from the statement.
They should start with a # and a single space.
+ Each line of a block comment starts with a # and a single space
+ (unless it is indented text inside the comment).
+
Okay: x = x + 1 # Increment x
Okay: x = x + 1 # Increment x
+ Okay: # Block comment
E261: x = x + 1 # Increment x
E262: x = x + 1 #Increment x
E262: x = x + 1 # Increment x
+ E265: #Block comment
"""
prev_end = (0, 0)
for token_type, text, start, end, line in tokens:
if token_type == tokenize.COMMENT:
- if not line[:start[1]].strip():
- continue
- if prev_end[0] == start[0] and start[1] < prev_end[1] + 2:
- yield (prev_end,
- "E261 at least two spaces before inline comment")
+ inline_comment = line[:start[1]].strip()
+ if inline_comment:
+ if prev_end[0] == start[0] and start[1] < prev_end[1] + 2:
+ yield (prev_end,
+ "E261 at least two spaces before inline comment")
symbol, sp, comment = text.partition(' ')
- if symbol not in ('#', '#:') or comment[:1].isspace():
- yield start, "E262 inline comment should start with '# '"
+ bad_prefix = symbol not in ('#', '#:')
+ if inline_comment:
+ if bad_prefix or comment[:1].isspace():
+ yield start, "E262 inline comment should start with '# '"
+ elif bad_prefix:
+ if text.rstrip('#') and (start[0] > 1 or symbol[1] != '!'):
+ yield start, "E265 block comment should start with '# '"
elif token_type != tokenize.NL:
prev_end = end
def imports_on_separate_lines(logical_line):
- r"""
- Imports should usually be on separate lines.
+ r"""Imports should usually be on separate lines.
Okay: import os\nimport sys
E401: import sys, os
@@ -819,13 +828,11 @@ def imports_on_separate_lines(logical_line):
def compound_statements(logical_line):
- r"""
- Compound statements (multiple statements on the same line) are
- generally discouraged.
+ r"""Compound statements (on the same line) are generally discouraged.
While sometimes it's okay to put an if/for/while with a small body
- on the same line, never do this for multi-clause statements. Also
- avoid folding such long lines!
+ on the same line, never do this for multi-clause statements.
+ Also avoid folding such long lines!
Okay: if foo == 'blah':\n do_blah_thing()
Okay: do_one()
@@ -847,24 +854,25 @@ def compound_statements(logical_line):
line = logical_line
last_char = len(line) - 1
found = line.find(':')
- if -1 < found < last_char:
+ while -1 < found < last_char:
before = line[:found]
if (before.count('{') <= before.count('}') and # {'a': 1} (dict)
before.count('[') <= before.count(']') and # [1:2] (slice)
before.count('(') <= before.count(')') and # (Python 3 annotation)
not LAMBDA_REGEX.search(before)): # lambda x: x
yield found, "E701 multiple statements on one line (colon)"
+ found = line.find(':', found + 1)
found = line.find(';')
- if -1 < found:
+ while -1 < found:
if found < last_char:
yield found, "E702 multiple statements on one line (semicolon)"
else:
yield found, "E703 statement ends with a semicolon"
+ found = line.find(';', found + 1)
def explicit_line_join(logical_line, tokens):
- r"""
- Avoid explicit line join between brackets.
+ r"""Avoid explicit line join between brackets.
The preferred way of wrapping long lines is by using Python's implied line
continuation inside parentheses, brackets and braces. Long lines can be
@@ -897,8 +905,9 @@ def explicit_line_join(logical_line, tokens):
parens -= 1
-def comparison_to_singleton(logical_line):
- """
+def comparison_to_singleton(logical_line, noqa):
+ r"""Comparison to singletons should use "is" or "is not".
+
Comparisons to singletons like None should always be done
with "is" or "is not", never the equality operators.
@@ -911,7 +920,7 @@ def comparison_to_singleton(logical_line):
set to some other value. The other value might have a type (such as a
container) that could be false in a boolean context!
"""
- match = COMPARE_SINGLETON_REGEX.search(logical_line)
+ match = not noqa and COMPARE_SINGLETON_REGEX.search(logical_line)
if match:
same = (match.group(1) == '==')
singleton = match.group(2)
@@ -927,10 +936,31 @@ def comparison_to_singleton(logical_line):
(code, singleton, msg))
-def comparison_type(logical_line):
+def comparison_negative(logical_line):
+ r"""Negative comparison should be done using "not in" and "is not".
+
+ Okay: if x not in y:\n pass
+ Okay: assert (X in Y or X is Z)
+ Okay: if not (X in Y):\n pass
+ Okay: zz = x is not y
+ E713: Z = not X in Y
+ E713: if not X.B in Y:\n pass
+ E714: if not X is Y:\n pass
+ E714: Z = not X.B is Y
"""
- Object type comparisons should always use isinstance() instead of
- comparing types directly.
+ match = COMPARE_NEGATIVE_REGEX.search(logical_line)
+ if match:
+ pos = match.start(1)
+ if match.group(2) == 'in':
+ yield pos, "E713 test for membership should be 'not in'"
+ else:
+ yield pos, "E714 test for object identity should be 'is not'"
+
+
+def comparison_type(logical_line):
+ r"""Object type comparisons should always use isinstance().
+
+ Do not compare types directly.
Okay: if isinstance(obj, int):
E721: if type(obj) is type(1):
@@ -947,44 +977,36 @@ def comparison_type(logical_line):
inst = match.group(1)
if inst and isidentifier(inst) and inst not in SINGLETONS:
return # Allow comparison for types which are not obvious
- yield match.start(0), "E721 do not compare types, use 'isinstance()'"
+ yield match.start(), "E721 do not compare types, use 'isinstance()'"
-def python_3000_has_key(logical_line):
- r"""
- The {}.has_key() method is removed in the Python 3.
- Use the 'in' operation instead.
+def python_3000_has_key(logical_line, noqa):
+ r"""The {}.has_key() method is removed in Python 3: use the 'in' operator.
Okay: if "alph" in d:\n print d["alph"]
W601: assert d.has_key('alph')
"""
pos = logical_line.find('.has_key(')
- if pos > -1:
+ if pos > -1 and not noqa:
yield pos, "W601 .has_key() is deprecated, use 'in'"
def python_3000_raise_comma(logical_line):
- """
- When raising an exception, use "raise ValueError('message')"
- instead of the older form "raise ValueError, 'message'".
+ r"""When raising an exception, use "raise ValueError('message')".
- The paren-using form is preferred because when the exception arguments
- are long or include string formatting, you don't need to use line
- continuation characters thanks to the containing parentheses. The older
- form is removed in Python 3.
+ The older form is removed in Python 3.
Okay: raise DummyError("Message")
W602: raise DummyError, "Message"
"""
match = RAISE_COMMA_REGEX.match(logical_line)
if match and not RERAISE_COMMA_REGEX.match(logical_line):
- yield match.start(1), "W602 deprecated form of raising exception"
+ yield match.end() - 1, "W602 deprecated form of raising exception"
def python_3000_not_equal(logical_line):
- """
- != can also be written <>, but this is an obsolete usage kept for
- backwards compatibility only. New code should always use !=.
+ r"""New code should always use != instead of <>.
+
The older syntax is removed in Python 3.
Okay: if a != 'no':
@@ -996,9 +1018,7 @@ def python_3000_not_equal(logical_line):
def python_3000_backticks(logical_line):
- """
- Backticks are removed in Python 3.
- Use repr() instead.
+ r"""Backticks are removed in Python 3: use repr() instead.
Okay: val = repr(1 + 2)
W604: val = `1 + 2`
@@ -1016,49 +1036,40 @@ def python_3000_backticks(logical_line):
if '' == ''.encode():
# Python 2: implicit encoding.
def readlines(filename):
- f = open(filename)
- try:
+ """Read the source code."""
+ with open(filename, 'rU') as f:
return f.readlines()
- finally:
- f.close()
-
isidentifier = re.compile(r'[a-zA-Z_]\w*').match
stdin_get_value = sys.stdin.read
else:
# Python 3
def readlines(filename):
- f = open(filename, 'rb')
+ """Read the source code."""
try:
- coding, lines = tokenize.detect_encoding(f.readline)
- f = TextIOWrapper(f, coding, line_buffering=True)
- return [l.decode(coding) for l in lines] + f.readlines()
+ with open(filename, 'rb') as f:
+ (coding, lines) = tokenize.detect_encoding(f.readline)
+ f = TextIOWrapper(f, coding, line_buffering=True)
+ return [l.decode(coding) for l in lines] + f.readlines()
except (LookupError, SyntaxError, UnicodeError):
- f.close()
- # Fall back if files are improperly declared
- f = open(filename, encoding='latin-1')
- return f.readlines()
- finally:
- f.close()
-
+ # Fall back if file encoding is improperly declared
+ with open(filename, encoding='latin-1') as f:
+ return f.readlines()
isidentifier = str.isidentifier
def stdin_get_value():
return TextIOWrapper(sys.stdin.buffer, errors='ignore').read()
-readlines.__doc__ = " Read the source code."
noqa = re.compile(r'# no(?:qa|pep8)\b', re.I).search
def expand_indent(line):
- r"""
- Return the amount of indentation.
+ r"""Return the amount of indentation.
+
Tabs are expanded to the next multiple of 8.
>>> expand_indent(' ')
4
>>> expand_indent('\t')
8
- >>> expand_indent(' \t')
- 8
>>> expand_indent(' \t')
8
>>> expand_indent(' \t')
@@ -1078,8 +1089,7 @@ def expand_indent(line):
def mute_string(text):
- """
- Replace contents with 'xxx' to prevent syntax matching.
+ """Replace contents with 'xxx' to prevent syntax matching.
>>> mute_string('"abc"')
'"xxx"'
@@ -1111,7 +1121,7 @@ def parse_udiff(diff, patterns=None, parent='.'):
continue
if line[:3] == '@@ ':
hunk_match = HUNK_REGEX.match(line)
- row, nrows = [int(g or '1') for g in hunk_match.groups()]
+ (row, nrows) = [int(g or '1') for g in hunk_match.groups()]
rv[path].update(range(row, row + nrows))
elif line[:3] == '+++':
path = line[4:].split('\t', 1)[0]
@@ -1123,9 +1133,24 @@ def parse_udiff(diff, patterns=None, parent='.'):
if rows and filename_match(path, patterns)])
-def filename_match(filename, patterns, default=True):
+def normalize_paths(value, parent=os.curdir):
+ """Parse a comma-separated list of paths.
+
+ Return a list of absolute paths.
"""
- Check if patterns contains a pattern that matches filename.
+ if not value or isinstance(value, list):
+ return value
+ paths = []
+ for path in value.split(','):
+ if '/' in path:
+ path = os.path.abspath(os.path.join(parent, path))
+ paths.append(path.rstrip('/'))
+ return paths
+
+
+def filename_match(filename, patterns, default=True):
+ """Check if patterns contains a pattern that matches filename.
+
If patterns is unspecified, this always returns True.
"""
if not patterns:
@@ -1133,6 +1158,15 @@ def filename_match(filename, patterns, default=True):
return any(fnmatch(filename, pattern) for pattern in patterns)
+if COMMENT_WITH_NL:
+ def _is_eol_token(token):
+ return (token[0] in NEWLINE or
+ (token[0] == tokenize.COMMENT and token[1] == token[4]))
+else:
+ def _is_eol_token(token):
+ return token[0] in NEWLINE
+
+
##############################################################################
# Framework to run all checks
##############################################################################
@@ -1142,9 +1176,7 @@ _checks = {'physical_line': {}, 'logical_line': {}, 'tree': {}}
def register_check(check, codes=None):
- """
- Register a new check object.
- """
+ """Register a new check object."""
def _add_check(check, kind, codes, args):
if check in _checks[kind]:
_checks[kind][check][0].extend(codes or [])
@@ -1162,9 +1194,9 @@ def register_check(check, codes=None):
def init_checks_registry():
- """
- Register all globally visible functions where the first argument name
- is 'physical_line' or 'logical_line'.
+ """Register all globally visible functions.
+
+ The first argument name is either 'physical_line' or 'logical_line'.
"""
mod = inspect.getmodule(register_check)
for (name, function) in inspect.getmembers(mod, inspect.isfunction):
@@ -1173,9 +1205,7 @@ init_checks_registry()
class Checker(object):
- """
- Load a Python source file, tokenize it, check coding style.
- """
+ """Load a Python source file, tokenize it, check coding style."""
def __init__(self, filename=None, lines=None,
options=None, report=None, **kwargs):
@@ -1188,6 +1218,8 @@ class Checker(object):
self._logical_checks = options.logical_checks
self._ast_checks = options.ast_checks
self.max_line_length = options.max_line_length
+ self.multiline = False # in a multiline string?
+ self.hang_closing = options.hang_closing
self.verbose = options.verbose
self.filename = filename
if filename is None:
@@ -1200,161 +1232,190 @@ class Checker(object):
try:
self.lines = readlines(filename)
except IOError:
- exc_type, exc = sys.exc_info()[:2]
+ (exc_type, exc) = sys.exc_info()[:2]
self._io_error = '%s: %s' % (exc_type.__name__, exc)
self.lines = []
else:
self.lines = lines
+ if self.lines:
+ ord0 = ord(self.lines[0][0])
+ if ord0 in (0xef, 0xfeff): # Strip the UTF-8 BOM
+ if ord0 == 0xfeff:
+ self.lines[0] = self.lines[0][1:]
+ elif self.lines[0][:3] == '\xef\xbb\xbf':
+ self.lines[0] = self.lines[0][3:]
self.report = report or options.report
self.report_error = self.report.error
def report_invalid_syntax(self):
- exc_type, exc = sys.exc_info()[:2]
- offset = exc.args[1]
- if len(offset) > 2:
- offset = offset[1:3]
+ """Check if the syntax is valid."""
+ (exc_type, exc) = sys.exc_info()[:2]
+ if len(exc.args) > 1:
+ offset = exc.args[1]
+ if len(offset) > 2:
+ offset = offset[1:3]
+ else:
+ offset = (1, 0)
self.report_error(offset[0], offset[1] or 0,
'E901 %s: %s' % (exc_type.__name__, exc.args[0]),
self.report_invalid_syntax)
- report_invalid_syntax.__doc__ = " Check if the syntax is valid."
def readline(self):
- """
- Get the next line from the input buffer.
- """
- self.line_number += 1
- if self.line_number > len(self.lines):
+ """Get the next line from the input buffer."""
+ if self.line_number >= self.total_lines:
return ''
- return self.lines[self.line_number - 1]
-
- def readline_check_physical(self):
- """
- Check and return the next physical line. This method can be
- used to feed tokenize.generate_tokens.
- """
- line = self.readline()
- if line:
- self.check_physical(line)
+ line = self.lines[self.line_number]
+ self.line_number += 1
+ if self.indent_char is None and line[:1] in WHITESPACE:
+ self.indent_char = line[0]
return line
def run_check(self, check, argument_names):
- """
- Run a check plugin.
- """
+ """Run a check plugin."""
arguments = []
for name in argument_names:
arguments.append(getattr(self, name))
return check(*arguments)
def check_physical(self, line):
- """
- Run all physical checks on a raw input line.
- """
+ """Run all physical checks on a raw input line."""
self.physical_line = line
- if self.indent_char is None and line[:1] in WHITESPACE:
- self.indent_char = line[0]
for name, check, argument_names in self._physical_checks:
result = self.run_check(check, argument_names)
if result is not None:
- offset, text = result
+ (offset, text) = result
self.report_error(self.line_number, offset, text, check)
+ if text[:4] == 'E101':
+ self.indent_char = line[0]
def build_tokens_line(self):
- """
- Build a logical line from tokens.
- """
- self.mapping = []
+ """Build a logical line from tokens."""
logical = []
+ comments = []
length = 0
- previous = None
- for token in self.tokens:
- token_type, text = token[0:2]
+ prev_row = prev_col = mapping = None
+ for token_type, text, start, end, line in self.tokens:
if token_type in SKIP_TOKENS:
continue
+ if not mapping:
+ mapping = [(0, start)]
+ if token_type == tokenize.COMMENT:
+ comments.append(text)
+ continue
if token_type == tokenize.STRING:
text = mute_string(text)
- if previous:
- end_row, end = previous[3]
- start_row, start = token[2]
- if end_row != start_row: # different row
- prev_text = self.lines[end_row - 1][end - 1]
+ if prev_row:
+ (start_row, start_col) = start
+ if prev_row != start_row: # different row
+ prev_text = self.lines[prev_row - 1][prev_col - 1]
if prev_text == ',' or (prev_text not in '{[('
and text not in '}])'):
- logical.append(' ')
- length += 1
- elif end != start: # different column
- fill = self.lines[end_row - 1][end:start]
- logical.append(fill)
- length += len(fill)
- self.mapping.append((length, token))
+ text = ' ' + text
+ elif prev_col != start_col: # different column
+ text = line[prev_col:start_col] + text
logical.append(text)
length += len(text)
- previous = token
+ mapping.append((length, end))
+ (prev_row, prev_col) = end
self.logical_line = ''.join(logical)
- # With Python 2, if the line ends with '\r\r\n' the assertion fails
- # assert self.logical_line.strip() == self.logical_line
+ self.noqa = comments and noqa(''.join(comments))
+ return mapping
def check_logical(self):
- """
- Build a line from tokens and run all logical checks on it.
- """
- self.build_tokens_line()
+ """Build a line from tokens and run all logical checks on it."""
self.report.increment_logical_line()
- first_line = self.lines[self.mapping[0][1][2][0] - 1]
- indent = first_line[:self.mapping[0][1][2][1]]
- self.previous_indent_level = self.indent_level
- self.indent_level = expand_indent(indent)
+ mapping = self.build_tokens_line()
+ (start_row, start_col) = mapping[0][1]
+ start_line = self.lines[start_row - 1]
+ self.indent_level = expand_indent(start_line[:start_col])
+ if self.blank_before < self.blank_lines:
+ self.blank_before = self.blank_lines
if self.verbose >= 2:
print(self.logical_line[:80].rstrip())
for name, check, argument_names in self._logical_checks:
if self.verbose >= 4:
print(' ' + name)
- for result in self.run_check(check, argument_names):
- offset, text = result
- if isinstance(offset, tuple):
- orig_number, orig_offset = offset
- else:
- for token_offset, token in self.mapping:
- if offset >= token_offset:
- orig_number = token[2][0]
- orig_offset = (token[2][1] + offset - token_offset)
- self.report_error(orig_number, orig_offset, text, check)
- self.previous_logical = self.logical_line
+ for offset, text in self.run_check(check, argument_names) or ():
+ if not isinstance(offset, tuple):
+ for token_offset, pos in mapping:
+ if offset <= token_offset:
+ break
+ offset = (pos[0], pos[1] + offset - token_offset)
+ self.report_error(offset[0], offset[1], text, check)
+ if self.logical_line:
+ self.previous_indent_level = self.indent_level
+ self.previous_logical = self.logical_line
+ self.blank_lines = 0
+ self.tokens = []
def check_ast(self):
+ """Build the file's AST and run all AST checks."""
try:
tree = compile(''.join(self.lines), '', 'exec', PyCF_ONLY_AST)
- except SyntaxError:
+ except (SyntaxError, TypeError):
return self.report_invalid_syntax()
- for name, cls, _ in self._ast_checks:
+ for name, cls, __ in self._ast_checks:
checker = cls(tree, self.filename)
for lineno, offset, text, check in checker.run():
- if not noqa(self.lines[lineno - 1]):
+ if not self.lines or not noqa(self.lines[lineno - 1]):
self.report_error(lineno, offset, text, check)
def generate_tokens(self):
+ """Tokenize the file, run physical line checks and yield tokens."""
if self._io_error:
self.report_error(1, 0, 'E902 %s' % self._io_error, readlines)
- tokengen = tokenize.generate_tokens(self.readline_check_physical)
+ tokengen = tokenize.generate_tokens(self.readline)
try:
for token in tokengen:
+ if token[2][0] > self.total_lines:
+ return
+ self.maybe_check_physical(token)
yield token
except (SyntaxError, tokenize.TokenError):
self.report_invalid_syntax()
+ def maybe_check_physical(self, token):
+ """If appropriate (based on token), check current physical line(s)."""
+ # Called after every token, but act only on end of line.
+ if _is_eol_token(token):
+ # Obviously, a newline token ends a single physical line.
+ self.check_physical(token[4])
+ elif token[0] == tokenize.STRING and '\n' in token[1]:
+ # Less obviously, a string that contains newlines is a
+ # multiline string, either triple-quoted or with internal
+ # newlines backslash-escaped. Check every physical line in the
+ # string *except* for the last one: its newline is outside of
+ # the multiline string, so we consider it a regular physical
+ # line, and will check it like any other physical line.
+ #
+ # Subtleties:
+ # - we don't *completely* ignore the last line; if it contains
+ # the magical "# noqa" comment, we disable all physical
+ # checks for the entire multiline string
+ # - have to wind self.line_number back because initially it
+ # points to the last line of the string, and we want
+ # check_physical() to give accurate feedback
+ if noqa(token[4]):
+ return
+ self.multiline = True
+ self.line_number = token[2][0]
+ for line in token[1].split('\n')[:-1]:
+ self.check_physical(line + '\n')
+ self.line_number += 1
+ self.multiline = False
+
def check_all(self, expected=None, line_offset=0):
- """
- Run all checks on the input file.
- """
+ """Run all checks on the input file."""
self.report.init_file(self.filename, self.lines, expected, line_offset)
+ self.total_lines = len(self.lines)
if self._ast_checks:
self.check_ast()
self.line_number = 0
self.indent_char = None
- self.indent_level = 0
+ self.indent_level = self.previous_indent_level = 0
self.previous_logical = ''
self.tokens = []
- self.blank_lines = blank_lines_before_comment = 0
+ self.blank_lines = self.blank_before = 0
parens = 0
for token in self.generate_tokens():
self.tokens.append(token)
@@ -1372,29 +1433,33 @@ class Checker(object):
elif text in '}])':
parens -= 1
elif not parens:
- if token_type == tokenize.NEWLINE:
- if self.blank_lines < blank_lines_before_comment:
- self.blank_lines = blank_lines_before_comment
- self.check_logical()
- self.tokens = []
- self.blank_lines = blank_lines_before_comment = 0
- elif token_type == tokenize.NL:
- if len(self.tokens) == 1:
+ if token_type in NEWLINE:
+ if token_type == tokenize.NEWLINE:
+ self.check_logical()
+ self.blank_before = 0
+ elif len(self.tokens) == 1:
# The physical line contains only this token.
self.blank_lines += 1
- self.tokens = []
- elif token_type == tokenize.COMMENT and len(self.tokens) == 1:
- if blank_lines_before_comment < self.blank_lines:
- blank_lines_before_comment = self.blank_lines
- self.blank_lines = 0
- if COMMENT_WITH_NL:
+ del self.tokens[0]
+ else:
+ self.check_logical()
+ elif COMMENT_WITH_NL and token_type == tokenize.COMMENT:
+ if len(self.tokens) == 1:
# The comment also ends a physical line
- self.tokens = []
+ token = list(token)
+ token[1] = text.rstrip('\r\n')
+ token[3] = (token[2][0], token[2][1] + len(token[1]))
+ self.tokens = [tuple(token)]
+ self.check_logical()
+ if self.tokens:
+ self.check_physical(self.lines[-1])
+ self.check_logical()
return self.report.get_file_results()
class BaseReport(object):
"""Collect the results of the checks."""
+
print_filename = False
def __init__(self, options):
@@ -1457,8 +1522,7 @@ class BaseReport(object):
for key in self.messages if key.startswith(prefix)])
def get_statistics(self, prefix=''):
- """
- Get statistics for message codes that start with the prefix.
+ """Get statistics for message codes that start with the prefix.
prefix='' matches all errors and warnings
prefix='E' matches all errors
@@ -1529,9 +1593,9 @@ class StandardReport(BaseReport):
else:
line = self.lines[line_number - 1]
print(line.rstrip())
- print(' ' * offset + '^')
+ print(re.sub(r'\S', ' ', line[:offset]) + '^')
if self._show_pep8 and doc:
- print(doc.lstrip('\n').rstrip())
+ print(' ' + doc.strip())
return self.file_errors
@@ -1557,11 +1621,12 @@ class StyleGuide(object):
parse_argv = kwargs.pop('parse_argv', False)
config_file = kwargs.pop('config_file', None)
parser = kwargs.pop('parser', None)
+ # build options from dict
+ options_dict = dict(*args, **kwargs)
+ arglist = None if parse_argv else options_dict.get('paths', None)
options, self.paths = process_options(
- parse_argv=parse_argv, config_file=config_file, parser=parser)
- if args or kwargs:
- # build options from dict
- options_dict = dict(*args, **kwargs)
+ arglist, parse_argv, config_file, parser)
+ if options_dict:
options.__dict__.update(options_dict)
if 'paths' in options_dict:
self.paths = options_dict['paths']
@@ -1572,11 +1637,14 @@ class StyleGuide(object):
if not options.reporter:
options.reporter = BaseReport if options.quiet else StandardReport
- for index, value in enumerate(options.exclude):
- options.exclude[index] = value.rstrip('/')
- # Ignore all checks which are not explicitly selected
options.select = tuple(options.select or ())
- options.ignore = tuple(options.ignore or options.select and ('',))
+ if not (options.select or options.ignore or
+ options.testsuite or options.doctest) and DEFAULT_IGNORE:
+ # The default choice: ignore controversial checks
+ options.ignore = tuple(DEFAULT_IGNORE.split(','))
+ else:
+ # Ignore all checks which are not explicitly selected
+ options.ignore = ('',) if options.select else tuple(options.ignore)
options.benchmark_keys = BENCHMARK_KEYS[:]
options.ignore_code = self.ignore_code
options.physical_checks = self.get_checks('physical_line')
@@ -1629,37 +1697,45 @@ class StyleGuide(object):
print('directory ' + root)
counters['directories'] += 1
for subdir in sorted(dirs):
- if self.excluded(os.path.join(root, subdir)):
+ if self.excluded(subdir, root):
dirs.remove(subdir)
for filename in sorted(files):
# contain a pattern that matches?
if ((filename_match(filename, filepatterns) and
- not self.excluded(filename))):
+ not self.excluded(filename, root))):
runner(os.path.join(root, filename))
- def excluded(self, filename):
- """
- Check if options.exclude contains a pattern that matches filename.
+ def excluded(self, filename, parent=None):
+ """Check if the file should be excluded.
+
+ Check if 'options.exclude' contains a pattern that matches filename.
"""
+ if not self.options.exclude:
+ return False
basename = os.path.basename(filename)
- return any((filename_match(filename, self.options.exclude,
- default=False),
- filename_match(basename, self.options.exclude,
- default=False)))
+ if filename_match(basename, self.options.exclude):
+ return True
+ if parent:
+ filename = os.path.join(parent, filename)
+ filename = os.path.abspath(filename)
+ return filename_match(filename, self.options.exclude)
def ignore_code(self, code):
- """
- Check if the error code should be ignored.
+ """Check if the error code should be ignored.
If 'options.select' contains a prefix of the error code,
return False. Else, if 'options.ignore' contains a prefix of
the error code, return True.
"""
+ if len(code) < 4 and any(s.startswith(code)
+ for s in self.options.select):
+ return False
return (code.startswith(self.options.ignore) and
not code.startswith(self.options.select))
def get_checks(self, argument_name):
- """
+ """Get all the checks for this category.
+
Find all globally visible functions where the first argument name
starts with argument_name and which contain selected tests.
"""
@@ -1675,8 +1751,9 @@ def get_parser(prog='pep8', version=__version__):
parser = OptionParser(prog=prog, version=version,
usage="%prog [options] input ...")
parser.config_options = [
- 'exclude', 'filename', 'select', 'ignore', 'max-line-length', 'count',
- 'format', 'quiet', 'show-pep8', 'show-source', 'statistics', 'verbose']
+ 'exclude', 'filename', 'select', 'ignore', 'max-line-length',
+ 'hang-closing', 'count', 'format', 'quiet', 'show-pep8',
+ 'show-source', 'statistics', 'verbose']
parser.add_option('-v', '--verbose', default=0, action='count',
help="print status messages, or debug with -vv")
parser.add_option('-q', '--quiet', default=0, action='count',
@@ -1711,6 +1788,9 @@ def get_parser(prog='pep8', version=__version__):
default=MAX_LINE_LENGTH,
help="set maximum allowed line length "
"(default: %default)")
+ parser.add_option('--hang-closing', action='store_true',
+ help="hang closing bracket instead of matching "
+ "indentation of opening bracket's line")
parser.add_option('--format', metavar='format', default='default',
help="set the error format [default|pylint|<custom>]")
parser.add_option('--diff', action='store_true',
@@ -1737,19 +1817,15 @@ def read_config(options, args, arglist, parser):
print('user configuration: %s' % user_conf)
config.read(user_conf)
+ local_dir = os.curdir
parent = tail = args and os.path.abspath(os.path.commonprefix(args))
while tail:
- for name in PROJECT_CONFIG:
- local_conf = os.path.join(parent, name)
- if os.path.isfile(local_conf):
- break
- else:
- parent, tail = os.path.split(parent)
- continue
- if options.verbose:
- print('local configuration: %s' % local_conf)
- config.read(local_conf)
- break
+ if config.read([os.path.join(parent, fn) for fn in PROJECT_CONFIG]):
+ local_dir = parent
+ if options.verbose:
+ print('local configuration: in %s' % parent)
+ break
+ (parent, tail) = os.path.split(parent)
pep8_section = parser.prog
if config.has_section(pep8_section):
@@ -1757,29 +1833,30 @@ def read_config(options, args, arglist, parser):
for o in parser.option_list])
# First, read the default values
- new_options, _ = parser.parse_args([])
+ (new_options, __) = parser.parse_args([])
# Second, parse the configuration
for opt in config.options(pep8_section):
+ if opt.replace('_', '-') not in parser.config_options:
+ print(" unknown option '%s' ignored" % opt)
+ continue
if options.verbose > 1:
print(" %s = %s" % (opt, config.get(pep8_section, opt)))
- if opt.replace('_', '-') not in parser.config_options:
- print("Unknown option: '%s'\n not in [%s]" %
- (opt, ' '.join(parser.config_options)))
- sys.exit(1)
normalized_opt = opt.replace('-', '_')
opt_type = option_list[normalized_opt]
if opt_type in ('int', 'count'):
value = config.getint(pep8_section, opt)
elif opt_type == 'string':
value = config.get(pep8_section, opt)
+ if normalized_opt == 'exclude':
+ value = normalize_paths(value, local_dir)
else:
assert opt_type in ('store_true', 'store_false')
value = config.getboolean(pep8_section, opt)
setattr(new_options, normalized_opt, value)
# Third, overwrite with the command-line options
- options, _ = parser.parse_args(arglist, values=new_options)
+ (options, __) = parser.parse_args(arglist, values=new_options)
options.doctest = options.testsuite = False
return options
@@ -1787,9 +1864,6 @@ def read_config(options, args, arglist, parser):
def process_options(arglist=None, parse_argv=False, config_file=None,
parser=None):
"""Process options passed either via arglist or via command line args."""
- if not arglist and not parse_argv:
- # Don't read the command line if the module is used as a library.
- arglist = []
if not parser:
parser = get_parser()
if not parser.has_option('--config'):
@@ -1802,7 +1876,12 @@ def process_options(arglist=None, parse_argv=False, config_file=None,
(parser.prog, ', '.join(parser.config_options))))
group.add_option('--config', metavar='path', default=config_file,
help="user config file location (default: %default)")
- options, args = parser.parse_args(arglist)
+ # Don't read the command line if the module is used as a library.
+ if not arglist and not parse_argv:
+ arglist = []
+ # If parse_argv is True and arglist is None, arguments are
+ # parsed from the command line (sys.argv)
+ (options, args) = parser.parse_args(arglist)
options.reporter = None
if options.ensure_value('testsuite', False):
@@ -1817,18 +1896,10 @@ def process_options(arglist=None, parse_argv=False, config_file=None,
options = read_config(options, args, arglist, parser)
options.reporter = parse_argv and options.quiet == 1 and FileReport
- if options.filename:
- options.filename = options.filename.split(',')
- options.exclude = options.exclude.split(',')
- if options.select:
- options.select = options.select.split(',')
- if options.ignore:
- options.ignore = options.ignore.split(',')
- elif not (options.select or
- options.testsuite or options.doctest) and DEFAULT_IGNORE:
- # The default choice: ignore controversial checks
- # (for doctest and testsuite, all checks are required)
- options.ignore = DEFAULT_IGNORE.split(',')
+ options.filename = options.filename and options.filename.split(',')
+ options.exclude = normalize_paths(options.exclude)
+ options.select = options.select and options.select.split(',')
+ options.ignore = options.ignore and options.ignore.split(',')
if options.diff:
options.reporter = DiffReport
@@ -1841,13 +1912,19 @@ def process_options(arglist=None, parse_argv=False, config_file=None,
def _main():
"""Parse options and run checks on Python source."""
+ import signal
+
+ # Handle "Broken pipe" gracefully
+ try:
+ signal.signal(signal.SIGPIPE, lambda signum, frame: sys.exit(1))
+ except AttributeError:
+ pass # not supported on Windows
+
pep8style = StyleGuide(parse_argv=True, config_file=True)
options = pep8style.options
if options.doctest or options.testsuite:
- sys.path[:0] = [TESTSUITE_PATH]
- from test_pep8 import run_tests
- del sys.path[0]
- report = run_tests(pep8style, options.doctest, options.testsuite)
+ from testsuite.support import run_tests
+ report = run_tests(pep8style)
else:
report = pep8style.check_files()
if options.statistics:
diff --git a/python/helpers/pycharm/lettuce_runner.py b/python/helpers/pycharm/lettuce_runner.py
new file mode 100644
index 000000000000..6aaa566df719
--- /dev/null
+++ b/python/helpers/pycharm/lettuce_runner.py
@@ -0,0 +1,132 @@
+# coding=utf-8
+"""
+BDD lettuce framework runner
+"""
+__author__ = 'Ilya.Kazakevich'
+import os
+from lettuce.exceptions import ReasonToFail
+import time
+import sys
+import tcmessages
+import lettuce
+from lettuce import core
+
+
+# Error message about unsupported outlines
+_NO_OUTLINE_ERROR = "Outline scenarios are not supported due to https://github.com/gabrielfalcao/lettuce/issues/451"
+
+
+class LettuceRunner(object):
+ """
+ TODO: Runs lettuce
+ """
+
+ def __init__(self, base_dir):
+ """
+ :param base_dir base directory to run tests in
+ :type base_dir: str
+
+ """
+ self.base_dir = base_dir
+ self.runner = lettuce.Runner(base_dir)
+ self.messages = tcmessages.TeamcityServiceMessages()
+ self.test_start_time = None
+
+ def report_tests(self):
+ """
+ :returns : number of tests
+ :rtype : int
+ """
+ result = 0
+ for feature_file in self.runner.loader.find_feature_files():
+ feature = core.Feature.from_file(feature_file)
+ for scenario in feature.scenarios:
+ assert isinstance(scenario, core.Scenario), scenario
+ if not scenario.outlines:
+ result += len(scenario.steps)
+ self.messages.testCount(result)
+
+ def report_scenario_started(self, scenario):
+ """
+ Reports scenario launched
+ :type scenario core.Scenario
+ :param scenario: scenario
+ """
+ if scenario.outlines:
+ self.messages.testIgnored(scenario.name,
+ _NO_OUTLINE_ERROR)
+ scenario.steps = [] # Clear to prevent running. TODO: Fix when this issue fixed
+ scenario.background = None # TODO: undocumented
+ return
+ self.report_suite(True, scenario.name, scenario.described_at)
+
+ def report_suite(self, is_start, name, described_at):
+ """
+ Reports some suite (scenario, feature, background etc) is started or stopped
+ :param is_start: started or not
+ :param name: suite name
+ :param described_at: where it is described (file, line)
+ :return:
+ """
+ if is_start:
+ self.messages.testSuiteStarted(name, self._gen_location(described_at))
+ else:
+ self.messages.testSuiteFinished(name)
+
+ def report_step(self, is_start, step):
+ """
+ Reports step start / stop
+ :param is_start: true if step started
+ :type step core.Step
+ :param step: step
+ """
+ test_name = step.sentence
+ if is_start:
+ self.test_start_time = time.time()
+ self.messages.testStarted(test_name, self._gen_location(step.described_at))
+ elif step.passed:
+ duration = 0
+ if self.test_start_time:
+ duration = long(time.time() - self.test_start_time)
+ self.messages.testFinished(test_name, duration=duration)
+ self.test_start_time = None
+ elif step.failed:
+ reason = step.why
+ assert isinstance(reason, ReasonToFail), reason
+ self.messages.testFailed(test_name, message=reason.exception, details=reason.traceback)
+
+ def _gen_location(self, description):
+ """
+ :param description: "described_at" (file, line)
+ :return: location in format file:line by "described_at"
+ """
+ return "file:///{}/{}:{}".format(self.base_dir, description.file, description.line)
+
+ def run(self):
+ """
+ Launches runner
+ """
+ self.report_tests()
+ self.messages.testMatrixEntered()
+
+ lettuce.before.each_feature(lambda f: self.report_suite(True, f.name, f.described_at))
+ lettuce.after.each_feature(lambda f: self.report_suite(False, f.name, f.described_at))
+
+ lettuce.before.each_scenario(lambda s: self.report_scenario_started(s))
+ lettuce.after.each_scenario(lambda s: self.report_suite(False, s.name, s.described_at))
+
+ lettuce.before.each_background(
+ lambda b, *args: self.report_suite(True, "Scenario background", b.feature.described_at))
+ lettuce.after.each_background(
+ lambda b, *args: self.report_suite(False, "Scenario background", b.feature.described_at))
+
+ lettuce.before.each_step(lambda s: self.report_step(True, s))
+ lettuce.after.each_step(lambda s: self.report_step(False, s))
+
+ self.runner.run()
+
+
+if __name__ == "__main__":
+ path = sys.argv[1] if len(sys.argv) > 1 else "."
+ assert os.path.exists(path), "{} does not exist".format(path)
+ LettuceRunner(path).run() \ No newline at end of file
diff --git a/python/helpers/pycharm_generator_utils/module_redeclarator.py b/python/helpers/pycharm_generator_utils/module_redeclarator.py
index 3af1961a0e09..0dbdbb58ac6b 100644
--- a/python/helpers/pycharm_generator_utils/module_redeclarator.py
+++ b/python/helpers/pycharm_generator_utils/module_redeclarator.py
@@ -1007,6 +1007,8 @@ class ModuleRedeclarator(object):
if self.doing_builtins and p_name == BUILTIN_MOD_NAME:
txt = create_generator()
self.classes_buf.out(0, txt)
+ txt = create_function()
+ self.classes_buf.out(0, txt)
# Fake <type 'namedtuple'>
if version[0] >= 3 or (version[0] == 2 and version[1] >= 6):
diff --git a/python/helpers/pycharm_generator_utils/util_methods.py b/python/helpers/pycharm_generator_utils/util_methods.py
index d679e3385264..b6805c4a5942 100644
--- a/python/helpers/pycharm_generator_utils/util_methods.py
+++ b/python/helpers/pycharm_generator_utils/util_methods.py
@@ -75,6 +75,47 @@ class __generator(object):
"""
return txt
+def create_function():
+ txt = """
+class __function(object):
+ '''A mock class representing function type.'''
+
+ def __init__(self):
+ self.__name__ = ''
+ self.__doc__ = ''
+ self.__dict__ = ''
+ self.__module__ = ''
+"""
+ if version[0] == 2:
+ txt += """
+ self.func_defaults = {}
+ self.func_globals = {}
+ self.func_closure = None
+ self.func_code = None
+ self.func_name = ''
+ self.func_doc = ''
+ self.func_dict = ''
+"""
+ if version[0] >= 3 or (version[0] == 2 and version[1] >= 6):
+ txt += """
+ self.__defaults__ = {}
+ self.__globals__ = {}
+ self.__closure__ = None
+ self.__code__ = None
+ self.__name__ = ''
+"""
+ if version[0] >= 3:
+ txt += """
+ self.__annotations__ = {}
+ self.__kwdefaults__ = {}
+"""
+ if version[0] >= 3 and version[1] >= 3:
+ txt += """
+ self.__qualname__ = ''
+"""
+ return txt
+
+
def _searchbases(cls, accum):
# logic copied from inspect.py
if cls not in accum:
diff --git a/python/helpers/pydev/pydevd_comm.py b/python/helpers/pydev/pydevd_comm.py
index 9d4f2e78b94d..b4cf585e5cc2 100644
--- a/python/helpers/pydev/pydevd_comm.py
+++ b/python/helpers/pydev/pydevd_comm.py
@@ -427,7 +427,7 @@ def StartClient(host, port):
s = socket(AF_INET, SOCK_STREAM)
- MAX_TRIES = 20
+ MAX_TRIES = 100
i = 0
while i<MAX_TRIES:
try:
diff --git a/python/helpers/pydev/pydevd_signature.py b/python/helpers/pydev/pydevd_signature.py
index 2f9a1820fde4..e11bb5dd446b 100644
--- a/python/helpers/pydev/pydevd_signature.py
+++ b/python/helpers/pydev/pydevd_signature.py
@@ -47,7 +47,7 @@ class SignatureFactory(object):
name = code.co_varnames[i]
tp = type(locals[name])
class_name = tp.__name__
- if class_name == 'instance':
+ if class_name == 'instance': # old-style classes
tp = locals[name].__class__
class_name = tp.__name__
diff --git a/python/psi-api/src/com/jetbrains/python/PyNames.java b/python/psi-api/src/com/jetbrains/python/PyNames.java
index 8e2430eef8ed..94e35f711c29 100644
--- a/python/psi-api/src/com/jetbrains/python/PyNames.java
+++ b/python/psi-api/src/com/jetbrains/python/PyNames.java
@@ -59,6 +59,7 @@ public class PyNames {
public static final String FAKE_OLD_BASE = "___Classobj";
public static final String FAKE_GENERATOR = "__generator";
+ public static final String FAKE_FUNCTION = "__function";
public static final String FAKE_NAMEDTUPLE = "__namedtuple";
public static final String FUTURE_MODULE = "__future__";
@@ -167,17 +168,24 @@ public class PyNames {
*/
public static ImmutableSet<String> UnderscoredAttributes = ImmutableSet.of(
"__all__",
+ "__annotations__",
"__author__",
"__bases__",
+ "__closure__",
+ "__code__",
"__defaults__",
"__dict__",
+ "__dir__",
"__doc__",
"__docformat__",
"__file__",
+ "__func__",
+ "__globals__",
"__kwdefaults__",
"__members__",
"__metaclass__",
"__mod__",
+ "__module__",
"__mro__",
"__name__",
"__path__",
diff --git a/python/pydevSrc/com/jetbrains/python/debugger/pydev/RemoteDebugger.java b/python/pydevSrc/com/jetbrains/python/debugger/pydev/RemoteDebugger.java
index a307c031d380..9e347e0e5d7b 100644
--- a/python/pydevSrc/com/jetbrains/python/debugger/pydev/RemoteDebugger.java
+++ b/python/pydevSrc/com/jetbrains/python/debugger/pydev/RemoteDebugger.java
@@ -10,7 +10,9 @@ import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.util.TimeoutUtil;
import com.intellij.util.containers.ContainerUtil;
+import com.intellij.util.io.BaseOutputReader;
import com.intellij.xdebugger.frame.XValueChildrenList;
import com.jetbrains.python.console.pydev.PydevCompletionVariant;
import com.jetbrains.python.debugger.*;
@@ -25,6 +27,7 @@ import java.nio.charset.Charset;
import java.security.SecureRandom;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.Future;
public class RemoteDebugger implements ProcessDebugger {
@@ -87,8 +90,7 @@ public class RemoteDebugger implements ProcessDebugger {
if (myConnected) {
try {
- myDebuggerReader = new DebuggerReader();
- ApplicationManager.getApplication().executeOnPooledThread(myDebuggerReader);
+ myDebuggerReader = createReader(mySocket);
}
catch (Exception e) {
synchronized (mySocketObject) {
@@ -405,35 +407,42 @@ public class RemoteDebugger implements ProcessDebugger {
execute(command);
}
- private class DebuggerReader implements Runnable {
- private final InputStream myInputStream;
+ public DebuggerReader createReader(@NotNull Socket socket) throws IOException {
+ synchronized (mySocketObject) {
+ final InputStream myInputStream = socket.getInputStream();
+ //noinspection IOResourceOpenedButNotSafelyClosed
+ final Reader reader = new InputStreamReader(myInputStream, Charset.forName("UTF-8")); //TODO: correct econding?
+ return new DebuggerReader(reader);
+ }
+ }
+
+ private class DebuggerReader extends BaseOutputReader {
private boolean myClosing = false;
+ private Reader myReader;
- private DebuggerReader() throws IOException {
- synchronized (mySocketObject) {
- this.myInputStream = mySocket.getInputStream();
- }
+ private DebuggerReader(final Reader reader) throws IOException {
+ super(reader);
+ myReader = reader;
+ start();
}
- public void run() {
- final BufferedReader reader = new BufferedReader(new InputStreamReader(myInputStream, Charset.forName("UTF-8")));
+ protected void doRun() {
try {
- String line;
- while ((line = reader.readLine()) != null) {
- processResponse(line);
+ while (true) {
+ boolean read = readAvailable();
+
if (myClosing) {
break;
}
+
+ TimeoutUtil.sleep(mySleepingPolicy.getTimeToSleep(read));
}
}
- catch (SocketException ignore) {
- fireCommunicationError();
- }
catch (Exception e) {
- LOG.error(e);
+ fireCommunicationError();
}
finally {
- closeReader(reader);
+ closeReader(myReader);
fireExitEvent();
}
}
@@ -518,7 +527,7 @@ public class RemoteDebugger implements ProcessDebugger {
return ProtocolParser.parseThread(frame.getPayload(), myDebugProcess.getPositionConverter());
}
- private void closeReader(BufferedReader reader) {
+ private void closeReader(Reader reader) {
try {
reader.close();
}
@@ -526,9 +535,19 @@ public class RemoteDebugger implements ProcessDebugger {
}
}
+ @Override
+ protected Future<?> executeOnPooledThread(Runnable runnable) {
+ return ApplicationManager.getApplication().executeOnPooledThread(runnable);
+ }
+
public void close() {
myClosing = true;
}
+
+ @Override
+ protected void onTextAvailable(@NotNull String text) {
+ processResponse(text);
+ }
}
private void writeToConsole(PyIo io) {
diff --git a/python/src/META-INF/pycharm-core.xml b/python/src/META-INF/pycharm-core.xml
index 775d912b284a..13ba05db63f0 100644
--- a/python/src/META-INF/pycharm-core.xml
+++ b/python/src/META-INF/pycharm-core.xml
@@ -33,7 +33,7 @@
<projectConfigurable instance="com.jetbrains.python.configuration.PythonContentEntriesConfigurable"/>
<projectConfigurable instance="com.jetbrains.python.buildout.BuildoutModulesConfigurable"/>
- <projectConfigurable instance="com.jetbrains.python.configuration.PyActiveSdkModuleConfigurable"/>
+ <projectConfigurable groupId="project" instance="com.jetbrains.python.configuration.PyActiveSdkModuleConfigurable"/>
<projectConfigurable instance="com.jetbrains.python.configuration.PyDependenciesConfigurable"/>
<directoryProjectConfigurator implementation="com.jetbrains.python.PythonSdkConfigurator" id="sdk"
diff --git a/python/src/META-INF/python-core.xml b/python/src/META-INF/python-core.xml
index 54491eb737d6..88280cc2cf10 100644
--- a/python/src/META-INF/python-core.xml
+++ b/python/src/META-INF/python-core.xml
@@ -387,8 +387,6 @@
<completion.contributor language="Python"
implementationClass="com.jetbrains.python.codeInsight.completion.PyClassNameCompletionContributor"/>
- <completion.contributor language="Python"
- implementationClass="com.jetbrains.python.codeInsight.completion.PyBracketProtectingCompletionContributor"/>
<weigher key="completion" implementationClass="com.jetbrains.python.codeInsight.completion.PythonCompletionWeigher" order="first"/>
<completion.confidence language="Python" implementationClass="com.jetbrains.python.codeInsight.completion.PyCompletionConfidence"/>
<typedHandler implementation="com.jetbrains.python.console.completion.PythonConsoleAutopopupBlockingHandler" id="pydevBlockAutoPopup"
@@ -446,10 +444,10 @@
<applicationService serviceInterface="com.jetbrains.python.documentation.PythonDocumentationMap"
serviceImplementation="com.jetbrains.python.documentation.PythonDocumentationMap"/>
- <applicationConfigurable instance="com.jetbrains.python.documentation.PythonDocumentationConfigurable"
+ <applicationConfigurable groupId="tools" instance="com.jetbrains.python.documentation.PythonDocumentationConfigurable"
id="com.jetbrains.python.documentation.PythonDocumentationConfigurable"
displayName="Python External Documentation"/>
- <projectConfigurable instance="com.jetbrains.python.configuration.PyIntegratedToolsModulesConfigurable"
+ <projectConfigurable groupId="tools" instance="com.jetbrains.python.configuration.PyIntegratedToolsModulesConfigurable"
id="com.jetbrains.python.configuration.PyIntegratedToolsModulesConfigurable" displayName="Python Integrated Tools"
nonDefaultProject="true"/>
<moduleService serviceInterface="com.jetbrains.python.documentation.PyDocumentationSettings"
@@ -465,10 +463,10 @@
<project.converterProvider implementation="com.jetbrains.python.testing.converters.PythonTestConverterProvider"/>
- <projectConfigurable instance="com.jetbrains.python.console.PyConsoleOptionsConfigurable"/>
+ <projectConfigurable groupId="build" dynamic="true" instance="com.jetbrains.python.console.PyConsoleOptionsConfigurable"/>
<projectService serviceImplementation="com.jetbrains.python.console.PyConsoleOptions"/>
- <projectConfigurable instance="com.jetbrains.python.debugger.PyDebuggerConfigurable"/>
+ <projectConfigurable groupId="build" instance="com.jetbrains.python.debugger.PyDebuggerConfigurable"/>
<projectService serviceImplementation="com.jetbrains.python.debugger.PyDebuggerOptionsProvider"/>
<codeBlockProvider language="Python" implementationClass="com.jetbrains.python.codeInsight.PyCodeBlockProvider"/>
diff --git a/python/src/com/jetbrains/python/codeInsight/completion/PyBracketProtectingCompletionContributor.java b/python/src/com/jetbrains/python/codeInsight/completion/PyBracketProtectingCompletionContributor.java
deleted file mode 100644
index 766e5be81f3e..000000000000
--- a/python/src/com/jetbrains/python/codeInsight/completion/PyBracketProtectingCompletionContributor.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright 2000-2013 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.jetbrains.python.codeInsight.completion;
-
-import com.intellij.codeInsight.completion.CompletionContributor;
-import com.intellij.codeInsight.completion.CompletionInitializationContext;
-import com.intellij.psi.PsiReference;
-import com.jetbrains.python.psi.impl.references.PyOperatorReference;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * @author yole
- */
-public class PyBracketProtectingCompletionContributor extends CompletionContributor {
- @Override
- public void beforeCompletion(@NotNull CompletionInitializationContext context) {
- PsiReference ref = context.getFile().findReferenceAt(context.getSelectionEndOffset());
- if (ref instanceof PyOperatorReference) {
- context.setReplacementOffset(context.getIdentifierEndOffset());
- }
- }
-}
diff --git a/python/src/com/jetbrains/python/codeInsight/editorActions/smartEnter/PySmartEnterProcessor.java b/python/src/com/jetbrains/python/codeInsight/editorActions/smartEnter/PySmartEnterProcessor.java
index 725cd2d9bf4d..e27f2a638899 100644
--- a/python/src/com/jetbrains/python/codeInsight/editorActions/smartEnter/PySmartEnterProcessor.java
+++ b/python/src/com/jetbrains/python/codeInsight/editorActions/smartEnter/PySmartEnterProcessor.java
@@ -15,6 +15,7 @@
*/
package com.jetbrains.python.codeInsight.editorActions.smartEnter;
+import com.google.common.collect.ImmutableList;
import com.intellij.codeInsight.editorActions.smartEnter.SmartEnterProcessor;
import com.intellij.codeInsight.lookup.LookupManager;
import com.intellij.openapi.diagnostic.Logger;
@@ -48,25 +49,22 @@ import java.util.List;
*/
public class PySmartEnterProcessor extends SmartEnterProcessor {
private static final Logger LOG = Logger.getInstance("#com.jetbrains.python.codeInsight.editorActions.smartEnter.PySmartEnterProcessor");
- private static final List<PyFixer> ourFixers = new ArrayList<PyFixer>();
- private static final List<EnterProcessor> ourProcessors = new ArrayList<EnterProcessor>();
-
- static {
- ourFixers.add(new PyStringLiteralFixer());
- ourFixers.add(new PyParenthesizedFixer());
- ourFixers.add(new PyMissingBracesFixer());
- ourFixers.add(new PyConditionalStatementPartFixer());
- ourFixers.add(new PyUnconditionalStatementPartFixer());
- ourFixers.add(new PyForPartFixer());
- ourFixers.add(new PyExceptFixer());
- ourFixers.add(new PyArgumentListFixer());
- ourFixers.add(new PyParameterListFixer());
- ourFixers.add(new PyFunctionFixer());
- ourFixers.add(new PyClassFixer());
-
- ourProcessors.add(new PyCommentBreakerEnterProcessor());
- ourProcessors.add(new PyPlainEnterProcessor());
- }
+ private static final List<PyFixer> ourFixers = ImmutableList.<PyFixer>builder()
+ .add(new PyStringLiteralFixer())
+ .add(new PyParenthesizedFixer())
+ .add(new PyMissingBracesFixer())
+ .add(new PyConditionalStatementPartFixer())
+ .add(new PyUnconditionalStatementPartFixer())
+ .add(new PyForPartFixer())
+ .add(new PyExceptFixer())
+ .add(new PyArgumentListFixer())
+ .add(new PyParameterListFixer())
+ .add(new PyFunctionFixer())
+ .add(new PyClassFixer())
+ .add(new PyWithFixer())
+ .build();
+ private static final List<EnterProcessor> ourProcessors = ImmutableList.of(new PyCommentBreakerEnterProcessor(),
+ new PyPlainEnterProcessor());
private static class TooManyAttemptsException extends Exception {
}
diff --git a/python/src/com/jetbrains/python/codeInsight/editorActions/smartEnter/enterProcessors/PyPlainEnterProcessor.java b/python/src/com/jetbrains/python/codeInsight/editorActions/smartEnter/enterProcessors/PyPlainEnterProcessor.java
index d6717905a034..ac2e31252dcf 100644
--- a/python/src/com/jetbrains/python/codeInsight/editorActions/smartEnter/enterProcessors/PyPlainEnterProcessor.java
+++ b/python/src/com/jetbrains/python/codeInsight/editorActions/smartEnter/enterProcessors/PyPlainEnterProcessor.java
@@ -20,10 +20,7 @@ import com.intellij.openapi.editor.Editor;
import com.intellij.psi.PsiElement;
import com.intellij.psi.util.PsiTreeUtil;
import com.jetbrains.python.codeInsight.editorActions.smartEnter.SmartEnterUtil;
-import com.jetbrains.python.psi.PyClass;
-import com.jetbrains.python.psi.PyFunction;
-import com.jetbrains.python.psi.PyStatementList;
-import com.jetbrains.python.psi.PyStatementPart;
+import com.jetbrains.python.psi.*;
import org.jetbrains.annotations.Nullable;
/**
@@ -43,10 +40,14 @@ public class PyPlainEnterProcessor implements EnterProcessor {
}
else if (psiElement instanceof PyClass) {
return ((PyClass)psiElement).getStatementList();
- } else {
- final CaretModel caretModel = editor.getCaretModel();
- final PsiElement atCaret = psiElement.getContainingFile().findElementAt(caretModel.getOffset());
- PyStatementPart statementPart = PsiTreeUtil.getParentOfType(atCaret, PyStatementPart.class);
+ }
+ else if (psiElement instanceof PyWithStatement) {
+ return PsiTreeUtil.getChildOfType(psiElement, PyStatementList.class);
+ }
+ else {
+ final CaretModel caretModel = editor.getCaretModel();
+ final PsiElement atCaret = psiElement.getContainingFile().findElementAt(caretModel.getOffset());
+ final PyStatementPart statementPart = PsiTreeUtil.getParentOfType(atCaret, PyStatementPart.class);
if (statementPart != null) {
return statementPart.getStatementList();
}
@@ -55,7 +56,7 @@ public class PyPlainEnterProcessor implements EnterProcessor {
}
public boolean doEnter(Editor editor, PsiElement psiElement, boolean isModified) {
- PyStatementList statementList = getStatementList(psiElement, editor);
+ final PyStatementList statementList = getStatementList(psiElement, editor);
if (statementList != null && statementList.getStatements().length == 0) {
SmartEnterUtil.plainEnter(editor);
//editor.getCaretModel().moveToOffset(statementList.getTextRange().getEndOffset());
diff --git a/python/src/com/jetbrains/python/codeInsight/editorActions/smartEnter/fixers/PyWithFixer.java b/python/src/com/jetbrains/python/codeInsight/editorActions/smartEnter/fixers/PyWithFixer.java
new file mode 100644
index 000000000000..b6d099ef7cb5
--- /dev/null
+++ b/python/src/com/jetbrains/python/codeInsight/editorActions/smartEnter/fixers/PyWithFixer.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright 2000-2013 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.jetbrains.python.codeInsight.editorActions.smartEnter.fixers;
+
+import com.intellij.lang.ASTNode;
+import com.intellij.openapi.editor.Document;
+import com.intellij.openapi.editor.Editor;
+import com.intellij.psi.PsiElement;
+import com.intellij.util.IncorrectOperationException;
+import com.jetbrains.python.PyTokenTypes;
+import com.jetbrains.python.codeInsight.editorActions.smartEnter.PySmartEnterProcessor;
+import com.jetbrains.python.psi.PyElementType;
+import com.jetbrains.python.psi.PyExpression;
+import com.jetbrains.python.psi.PyWithItem;
+import com.jetbrains.python.psi.PyWithStatement;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import static com.jetbrains.python.psi.PyUtil.sure;
+
+/**
+ * @author Mikhail Golubev
+ */
+public class PyWithFixer implements PyFixer {
+ public void apply(Editor editor, PySmartEnterProcessor processor, PsiElement psiElement) throws IncorrectOperationException {
+ if (psiElement instanceof PyWithStatement) {
+ final PyWithStatement withStatement = (PyWithStatement)psiElement;
+ final PsiElement colonToken = getFirstChildOfType(psiElement, PyTokenTypes.COLON);
+ final PsiElement withToken = getFirstChildOfType(withStatement, PyTokenTypes.WITH_KEYWORD);
+ final Document document = editor.getDocument();
+ if (colonToken == null) {
+ int insertAt = sure(withToken).getTextRange().getEndOffset();
+ String textToInsert = ":";
+ final PyWithItem[] withItems = withStatement.getWithItems();
+ final PyWithItem lastItem = withItems.length != 0 ? withItems[withItems.length - 1] : null;
+ if (lastItem == null || lastItem.getExpression() == null) {
+ textToInsert = " :";
+ processor.registerUnresolvedError(insertAt + 1);
+ }
+ else {
+ final PyExpression expression = lastItem.getExpression();
+ insertAt = expression.getTextRange().getEndOffset();
+ final PsiElement asToken = getFirstChildOfType(lastItem, PyTokenTypes.AS_KEYWORD);
+ if (asToken != null) {
+ insertAt = asToken.getTextRange().getEndOffset();
+ final PyExpression target = lastItem.getTarget();
+ if (target != null) {
+ insertAt = target.getTextRange().getEndOffset();
+ }
+ else {
+ textToInsert = " :";
+ processor.registerUnresolvedError(insertAt + 1);
+ }
+ }
+ }
+ document.insertString(insertAt, textToInsert);
+ }
+ }
+ }
+
+ @Nullable
+ private static PsiElement getFirstChildOfType(@NotNull final PsiElement element, @NotNull PyElementType type) {
+ final ASTNode child = element.getNode().findChildByType(type);
+ return child != null ? child.getPsi() : null;
+ }
+}
diff --git a/python/src/com/jetbrains/python/codeInsight/intentions/ConvertFormatOperatorToMethodIntention.java b/python/src/com/jetbrains/python/codeInsight/intentions/ConvertFormatOperatorToMethodIntention.java
index 3df0a3edf390..0ba35edad8bf 100644
--- a/python/src/com/jetbrains/python/codeInsight/intentions/ConvertFormatOperatorToMethodIntention.java
+++ b/python/src/com/jetbrains/python/codeInsight/intentions/ConvertFormatOperatorToMethodIntention.java
@@ -290,7 +290,10 @@ public class ConvertFormatOperatorToMethodIntention extends BaseIntentionAction
}
}
else target.append("(").append(paramText).append(")"); // tuple is ok as is
- element.replace(elementGenerator.createExpressionFromText(LanguageLevel.forElement(element), target.toString()));
+ // Correctly handle multiline implicitly concatenated string literals (PY-9176)
+ target.insert(0, '(').append(')');
+ final PyExpression parenthesized = elementGenerator.createExpressionFromText(LanguageLevel.forElement(element), target.toString());
+ element.replace(sure(((PyParenthesizedExpression)parenthesized).getContainedExpression()));
}
private static String getSeparator(PyStringLiteralExpression leftExpression) {
diff --git a/python/src/com/jetbrains/python/console/PydevConsoleRunner.java b/python/src/com/jetbrains/python/console/PydevConsoleRunner.java
index ba2f137751a4..3d77ac4f62b1 100644
--- a/python/src/com/jetbrains/python/console/PydevConsoleRunner.java
+++ b/python/src/com/jetbrains/python/console/PydevConsoleRunner.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -52,8 +52,8 @@ import com.intellij.openapi.project.DumbAwareAction;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.ui.Messages;
+import com.intellij.openapi.util.Couple;
import com.intellij.openapi.util.Key;
-import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.StreamUtil;
import com.intellij.openapi.vfs.CharsetToolkit;
@@ -360,7 +360,7 @@ public class PydevConsoleRunner extends AbstractConsoleRunnerWithHistory<PythonC
manager.createRemoteProcess(getProject(), myRemoteCredentials, mappings, commandLine, true);
- Pair<Integer, Integer> remotePorts = getRemotePortsFromProcess(remoteProcess);
+ Couple<Integer> remotePorts = getRemotePortsFromProcess(remoteProcess);
remoteProcess.addLocalTunnel(myPorts[0], myRemoteCredentials.getHost(), remotePorts.first);
remoteProcess.addRemoteTunnel(remotePorts.second, "localhost", myPorts[1]);
@@ -374,10 +374,10 @@ public class PydevConsoleRunner extends AbstractConsoleRunnerWithHistory<PythonC
}
}
- private static Pair<Integer, Integer> getRemotePortsFromProcess(RemoteSshProcess process) throws ExecutionException {
+ private static Couple<Integer> getRemotePortsFromProcess(RemoteSshProcess process) throws ExecutionException {
Scanner s = new Scanner(process.getInputStream());
- return Pair.create(readInt(s, process), readInt(s, process));
+ return Couple.of(readInt(s, process), readInt(s, process));
}
private static int readInt(Scanner s, Process process) throws ExecutionException {
diff --git a/python/src/com/jetbrains/python/inspections/quickfix/GenerateBinaryStubsFix.java b/python/src/com/jetbrains/python/inspections/quickfix/GenerateBinaryStubsFix.java
index 3e13332c2616..7d087bd3eb08 100644
--- a/python/src/com/jetbrains/python/inspections/quickfix/GenerateBinaryStubsFix.java
+++ b/python/src/com/jetbrains/python/inspections/quickfix/GenerateBinaryStubsFix.java
@@ -19,12 +19,15 @@ import com.google.common.collect.Lists;
import com.intellij.codeInspection.LocalQuickFix;
import com.intellij.codeInspection.ProblemDescriptor;
import com.intellij.execution.process.ProcessOutput;
+import com.intellij.openapi.application.ReadAction;
+import com.intellij.openapi.application.Result;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleUtilCore;
import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.progress.ProgressManager;
import com.intellij.openapi.progress.Task;
+import com.intellij.openapi.progress.Task.Backgroundable;
import com.intellij.openapi.progress.impl.BackgroundableProcessIndicator;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.projectRoots.Sdk;
@@ -65,6 +68,7 @@ public class GenerateBinaryStubsFix implements LocalQuickFix {
/**
* Generates pack of fixes available for some unresolved import statement.
* Be sure to call {@link #isApplicable(com.jetbrains.python.psi.PyImportStatementBase)} first to make sure this statement is supported
+ *
* @param importStatementBase statement to fix
* @return pack of fixes
*/
@@ -73,14 +77,14 @@ public class GenerateBinaryStubsFix implements LocalQuickFix {
final List<String> names = importStatementBase.getFullyQualifiedObjectNames();
final List<GenerateBinaryStubsFix> result = new ArrayList<GenerateBinaryStubsFix>(names.size());
for (final String qualifiedName : names) {
- result.add(new GenerateBinaryStubsFix(importStatementBase, qualifiedName));
+ result.add(new GenerateBinaryStubsFix(importStatementBase, qualifiedName));
}
return result;
}
/**
* @param importStatementBase statement to fix
- * @param qualifiedName name should be fixed (one of {@link com.jetbrains.python.psi.PyImportStatementBase#getFullyQualifiedObjectNames()})
+ * @param qualifiedName name should be fixed (one of {@link com.jetbrains.python.psi.PyImportStatementBase#getFullyQualifiedObjectNames()})
*/
private GenerateBinaryStubsFix(@NotNull final PyImportStatementBase importStatementBase, @NotNull final String qualifiedName) {
myQualifiedName = qualifiedName;
@@ -102,15 +106,34 @@ public class GenerateBinaryStubsFix implements LocalQuickFix {
@Override
public void applyFix(@NotNull final Project project, @NotNull final ProblemDescriptor descriptor) {
final PsiFile file = descriptor.getPsiElement().getContainingFile();
- final String folder = file.getContainingDirectory().getVirtualFile().getCanonicalPath();
+ final Backgroundable backgroundable = getFixTask(file);
+ ProgressManager.getInstance().runProcessWithProgressAsynchronously(backgroundable, new BackgroundableProcessIndicator(backgroundable));
+ }
- final Task.Backgroundable backgroundable = new Task.Backgroundable(project, "Generating skeletons for binary module", false) {
+
+ /**
+ * Returns fix task that is used to generate stubs
+ * @param fileToRunTaskIn file where task should run
+ * @return task itself
+ */
+ @NotNull
+ public Backgroundable getFixTask(@NotNull final PsiFile fileToRunTaskIn) {
+ final Project project = fileToRunTaskIn.getProject();
+ final String folder = fileToRunTaskIn.getContainingDirectory().getVirtualFile().getCanonicalPath();
+ return new Task.Backgroundable(project, "Generating skeletons for binary module", false) {
@Override
public void run(@NotNull ProgressIndicator indicator) {
indicator.setIndeterminate(true);
- final List<String> assemblyRefs = collectAssemblyReferences(file);
+
+ final List<String> assemblyRefs = new ReadAction<List<String>>() {
+ @Override
+ protected void run(@NotNull Result<List<String>> result) throws Throwable {
+ result.setResult(collectAssemblyReferences(fileToRunTaskIn));
+ }
+ }.execute().getResultObject();
+
try {
final PySkeletonRefresher refresher = new PySkeletonRefresher(project, null, mySdk, null, null, folder);
@@ -133,7 +156,6 @@ public class GenerateBinaryStubsFix implements LocalQuickFix {
}
}
};
- ProgressManager.getInstance().runProcessWithProgressAsynchronously(backgroundable, new BackgroundableProcessIndicator(backgroundable));
}
private boolean generateSkeletonsForList(@NotNull final PySkeletonRefresher refresher,
@@ -185,8 +207,8 @@ public class GenerateBinaryStubsFix implements LocalQuickFix {
// TODO: What if user loads it not by literal? We need to ask user for list of DLLs
if (node.isCalleeText("AddReference", "AddReferenceByPartialName", "AddReferenceByName")) {
final PyExpression[] args = node.getArguments();
- if (args.length == 1 && args [0] instanceof PyStringLiteralExpression) {
- result.add(((PyStringLiteralExpression) args [0]).getStringValue());
+ if (args.length == 1 && args[0] instanceof PyStringLiteralExpression) {
+ result.add(((PyStringLiteralExpression)args[0]).getStringValue());
}
}
}
diff --git a/python/src/com/jetbrains/python/inspections/unresolvedReference/PyUnresolvedReferencesInspection.java b/python/src/com/jetbrains/python/inspections/unresolvedReference/PyUnresolvedReferencesInspection.java
index fac391abdff7..c0fb3c1d620d 100644
--- a/python/src/com/jetbrains/python/inspections/unresolvedReference/PyUnresolvedReferencesInspection.java
+++ b/python/src/com/jetbrains/python/inspections/unresolvedReference/PyUnresolvedReferencesInspection.java
@@ -464,7 +464,9 @@ public class PyUnresolvedReferencesInspection extends PyInspection {
}
if (expr.isQualified()) {
final PyClassTypeImpl object_type = (PyClassTypeImpl)PyBuiltinCache.getInstance(node).getObjectType();
- if ((object_type != null) && object_type.getPossibleInstanceMembers().contains(refName)) return;
+ if ((object_type != null) && object_type.getPossibleInstanceMembers().contains(refName)){
+ return;
+ }
}
else {
if (PyUnreachableCodeInspection.hasAnyInterruptedControlFlowPaths(expr)) {
@@ -494,7 +496,9 @@ public class PyUnresolvedReferencesInspection extends PyInspection {
}
// unqualified:
// may be module's
- if (PyModuleType.getPossibleInstanceMembers().contains(refName)) return;
+ if (PyModuleType.getPossibleInstanceMembers().contains(refName)) {
+ return;
+ }
// may be a "try: import ..."; not an error not to resolve
if ((
PsiTreeUtil.getParentOfType(
diff --git a/python/src/com/jetbrains/python/packaging/PyPackageManagerImpl.java b/python/src/com/jetbrains/python/packaging/PyPackageManagerImpl.java
index 359e497f21c8..65d95eb62713 100644
--- a/python/src/com/jetbrains/python/packaging/PyPackageManagerImpl.java
+++ b/python/src/com/jetbrains/python/packaging/PyPackageManagerImpl.java
@@ -795,14 +795,22 @@ public class PyPackageManagerImpl extends PyPackageManager {
private String getHelperPath(String helper) {
String helperPath;
final SdkAdditionalData sdkData = mySdk.getSdkAdditionalData();
- if (sdkData instanceof RemoteSdkCredentials) {
- final RemoteSdkCredentials remoteSdkCredentials = (RemoteSdkCredentials)sdkData;
- if (!StringUtil.isEmpty(remoteSdkCredentials.getHelpersPath())) {
- helperPath = new RemoteFile(remoteSdkCredentials.getHelpersPath(),
- helper).getPath();
+ if (sdkData instanceof PyRemoteSdkAdditionalDataBase) {
+ PyRemoteSdkAdditionalDataBase remoteSdkData = (PyRemoteSdkAdditionalDataBase)mySdk.getSdkAdditionalData();
+
+ try {
+ final RemoteSdkCredentials remoteSdkCredentials = remoteSdkData.getRemoteSdkCredentials(false);
+ if (!StringUtil.isEmpty(remoteSdkCredentials.getHelpersPath())) {
+ helperPath = new RemoteFile(remoteSdkCredentials.getHelpersPath(),
+ helper).getPath();
+ }
+ else {
+ helperPath = null;
+ }
}
- else {
+ catch (Exception e) {
helperPath = null;
+ LOG.error(e);
}
}
else {
@@ -833,25 +841,26 @@ public class PyPackageManagerImpl extends PyPackageManager {
catch (final ExecutionException e) {
if (e.getCause() instanceof VagrantNotStartedException) {
throw new PyExternalProcessException(ERROR_VAGRANT_NOT_LAUNCHED, helperPath, args, "Vagrant instance is down. <a href=\"" +
- LAUNCH_VAGRANT +
- "\">Launch vagrant</a>").withHandler(LAUNCH_VAGRANT, new Runnable() {
- @Override
- public void run() {
- final PythonRemoteInterpreterManager manager = PythonRemoteInterpreterManager.getInstance();
- if (manager != null) {
-
- try {
- manager.runVagrant(((VagrantNotStartedException)e.getCause()).getVagrantFolder());
- clearCaches();
-
- }
- catch (ExecutionException e1) {
- throw new RuntimeException(e1);
+ LAUNCH_VAGRANT +
+ "\">Launch vagrant</a>")
+ .withHandler(LAUNCH_VAGRANT, new Runnable() {
+ @Override
+ public void run() {
+ final PythonRemoteInterpreterManager manager = PythonRemoteInterpreterManager.getInstance();
+ if (manager != null) {
+
+ try {
+ manager.runVagrant(((VagrantNotStartedException)e.getCause()).getVagrantFolder());
+ clearCaches();
+ }
+ catch (ExecutionException e1) {
+ throw new RuntimeException(e1);
+ }
}
}
- }
- });
- } else {
+ });
+ }
+ else {
throw new PyExternalProcessException(ERROR_REMOTE_ACCESS, helperPath, args, e.getMessage());
}
}
diff --git a/python/src/com/jetbrains/python/packaging/PyPackageUtil.java b/python/src/com/jetbrains/python/packaging/PyPackageUtil.java
index 3bfcc497cac9..31258fa69ea5 100644
--- a/python/src/com/jetbrains/python/packaging/PyPackageUtil.java
+++ b/python/src/com/jetbrains/python/packaging/PyPackageUtil.java
@@ -181,7 +181,7 @@ public class PyPackageUtil {
VfsUtilCore.visitChildrenRecursively(root, new VirtualFileVisitor() {
@Override
public boolean visitFile(@NotNull VirtualFile file) {
- if (!fileIndex.isIgnored(file) && file.isDirectory() && file.findChild(PyNames.INIT_DOT_PY) != null) {
+ if (!fileIndex.isExcluded(file) && file.isDirectory() && file.findChild(PyNames.INIT_DOT_PY) != null) {
results.add(VfsUtilCore.getRelativePath(file, root, '.'));
}
return true;
diff --git a/python/src/com/jetbrains/python/projectView/PyRemoteLibrariesNode.java b/python/src/com/jetbrains/python/projectView/PyRemoteLibrariesNode.java
index 62de7ea14daf..c5b0af7103f3 100644
--- a/python/src/com/jetbrains/python/projectView/PyRemoteLibrariesNode.java
+++ b/python/src/com/jetbrains/python/projectView/PyRemoteLibrariesNode.java
@@ -19,16 +19,16 @@ import com.google.common.base.Function;
import com.google.common.base.Predicates;
import com.google.common.collect.FluentIterable;
import com.google.common.collect.Lists;
+import com.intellij.ide.highlighter.ArchiveFileType;
import com.intellij.ide.projectView.PresentationData;
import com.intellij.ide.projectView.ViewSettings;
import com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode;
import com.intellij.ide.util.treeView.AbstractTreeNode;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.projectRoots.Sdk;
+import com.intellij.openapi.vfs.JarFileSystem;
import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.psi.PsiDirectory;
-import com.intellij.psi.PsiElement;
-import com.intellij.psi.PsiManager;
+import com.intellij.psi.*;
import com.intellij.util.PlatformIcons;
import com.jetbrains.python.remote.PyRemoteSdkAdditionalDataBase;
import com.jetbrains.python.sdk.PySdkUtil;
@@ -75,11 +75,16 @@ public class PyRemoteLibrariesNode extends PsiDirectoryNode {
return FluentIterable.from(Lists.newArrayList(getValue().getChildren())).transform(new Function<PsiElement, AbstractTreeNode>() {
@Override
public AbstractTreeNode apply(PsiElement input) {
- if (input instanceof PsiDirectory) {
- PsiDirectory directory = (PsiDirectory)input;
- if (myRemoteSdkData.getPathMappings().canReplaceLocal((directory.getVirtualFile().getPath()))) {
- return new PyRemoteRootNode(myRemoteSdkData.getPathMappings().convertToRemote(directory.getVirtualFile().getPath()),
- getProject(), directory, getSettings());
+ if (input instanceof PsiFileSystemItem) {
+ String path = ((PsiFileSystemItem)input).getVirtualFile().getPath();
+
+
+ PsiDirectory dir = input instanceof PsiDirectory ? (PsiDirectory)input : getDirectoryForJar((PsiFile)input);
+
+
+ if (myRemoteSdkData.getPathMappings().canReplaceLocal(path)) {
+ return new PyRemoteRootNode(myRemoteSdkData.getPathMappings().convertToRemote(path),
+ getProject(), dir, getSettings());
}
}
@@ -88,6 +93,26 @@ public class PyRemoteLibrariesNode extends PsiDirectoryNode {
}).filter(Predicates.notNull()).toList();
}
+ @Nullable
+ private PsiDirectory getDirectoryForJar(PsiFile input) {
+ VirtualFile jarRoot = getJarRoot(input);
+ if (myProject != null && jarRoot != null) {
+ return PsiManager.getInstance(myProject).findDirectory(jarRoot);
+ }
+ else {
+ return null;
+ }
+ }
+
+ @Nullable
+ private static VirtualFile getJarRoot(PsiFile input) {
+ final VirtualFile file = input.getVirtualFile();
+ if (file == null || !file.isValid() || !(file.getFileType() instanceof ArchiveFileType)) {
+ return null;
+ }
+ return JarFileSystem.getInstance().getJarRootForLocalFile(file);
+ }
+
public static class PyRemoteRootNode extends PsiDirectoryNode {
private String myRemotePath;
diff --git a/python/src/com/jetbrains/python/projectView/PyTreeStructureProvider.java b/python/src/com/jetbrains/python/projectView/PyTreeStructureProvider.java
index 6153bc64146d..8e4889498bca 100644
--- a/python/src/com/jetbrains/python/projectView/PyTreeStructureProvider.java
+++ b/python/src/com/jetbrains/python/projectView/PyTreeStructureProvider.java
@@ -28,6 +28,8 @@ import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.projectRoots.SdkTypeId;
import com.intellij.openapi.roots.JdkOrderEntry;
import com.intellij.openapi.roots.LibraryOrSdkOrderEntry;
+import com.intellij.openapi.vfs.JarFileSystem;
+import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiDirectory;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
@@ -50,7 +52,9 @@ import java.util.List;
public class PyTreeStructureProvider implements SelectableTreeStructureProvider, DumbAware {
@NotNull
@Override
- public Collection<AbstractTreeNode> modify(@NotNull AbstractTreeNode parent, @NotNull Collection<AbstractTreeNode> children, ViewSettings settings) {
+ public Collection<AbstractTreeNode> modify(@NotNull AbstractTreeNode parent,
+ @NotNull Collection<AbstractTreeNode> children,
+ ViewSettings settings) {
final Project project = parent.getProject();
final Sdk sdk = getPythonSdk(parent);
if (sdk != null && project != null) {
@@ -111,7 +115,15 @@ public class PyTreeStructureProvider implements SelectableTreeStructureProvider,
if (directory.getVirtualFile().equals(PyUserSkeletonsUtil.getUserSkeletonsDirectory())) {
continue;
}
- PsiDirectory dirParent = directory.getParent();
+ VirtualFile dir = directory.getVirtualFile();
+ if (dir.getFileSystem() instanceof JarFileSystem) {
+ dir = ((JarFileSystem)directory.getVirtualFile().getFileSystem()).getLocalVirtualFileFor(directory.getVirtualFile());
+ }
+ if (dir == null) {
+ continue;
+ }
+ VirtualFile dirParent = dir.getParent();
+
if (dirParent != null && dirParent.getName().equals(PythonSdkType.SKELETON_DIR_NAME)) {
continue;
}
@@ -120,7 +132,7 @@ public class PyTreeStructureProvider implements SelectableTreeStructureProvider,
continue;
}
if (dirParent != null) {
- PsiDirectory grandParent = dirParent.getParent();
+ VirtualFile grandParent = dirParent.getParent();
if (grandParent != null && grandParent.getName().equals(PythonSdkType.REMOTE_SOURCES_DIR_NAME)) {
continue;
@@ -158,8 +170,8 @@ public class PyTreeStructureProvider implements SelectableTreeStructureProvider,
}
}
if (parents.size() > 0) {
- return parents.get(parents.size()-1);
+ return parents.get(parents.size() - 1);
}
- return element.getContainingFile();
+ return element.getContainingFile();
}
}
diff --git a/python/src/com/jetbrains/python/psi/impl/PyStarImportElementImpl.java b/python/src/com/jetbrains/python/psi/impl/PyStarImportElementImpl.java
index 307ac8e22841..4011c233e38d 100644
--- a/python/src/com/jetbrains/python/psi/impl/PyStarImportElementImpl.java
+++ b/python/src/com/jetbrains/python/psi/impl/PyStarImportElementImpl.java
@@ -15,6 +15,8 @@
*/
package com.jetbrains.python.psi.impl;
+import com.google.common.base.Predicate;
+import com.google.common.collect.Iterables;
import com.intellij.lang.ASTNode;
import com.intellij.navigation.ItemPresentation;
import com.intellij.psi.PsiElement;
@@ -50,7 +52,11 @@ public class PyStarImportElementImpl extends PyElementImpl implements PyStarImpo
for (PsiElement importedFile : new HashSet<PsiElement>(importedFiles)) { // resolver gives lots of duplicates
final PsiElement source = PyUtil.turnDirIntoInit(importedFile);
if (source instanceof PyFile) {
- chain.add(((PyFile) source).iterateNames());
+ Iterable<PyElement> declaredNames = ((PyFile)source).iterateNames();
+ if (((PyFile)source).getDunderAll() == null) {
+ declaredNames = excludeUnderscoredNames(declaredNames);
+ }
+ chain.add(declaredNames);
}
}
return chain;
@@ -58,6 +64,19 @@ public class PyStarImportElementImpl extends PyElementImpl implements PyStarImpo
return Collections.emptyList();
}
+ private static Iterable<PyElement> excludeUnderscoredNames(Iterable<PyElement> declaredNames) {
+ return Iterables.filter(declaredNames, new Predicate<PyElement>() {
+ @Override
+ public boolean apply(@Nullable PyElement input) {
+ final String name = input != null ? input.getName() : null;
+ if (name != null && name.startsWith("_")) {
+ return false;
+ }
+ return true;
+ }
+ });
+ }
+
@Nullable
public PsiElement getElementNamed(final String name) {
if (PyUtil.isClassPrivateName(name)) {
@@ -76,7 +95,7 @@ public class PyStarImportElementImpl extends PyElementImpl implements PyStarImpo
final PsiElement result = results != null && !results.isEmpty() ? results.get(0).getElement() : null;
if (result != null) {
final List<String> all = sourceFile.getDunderAll();
- if (all != null && !all.contains(name)) {
+ if (all != null ? !all.contains(name) : name.startsWith("_")) {
continue;
}
return result;
diff --git a/python/src/com/jetbrains/python/psi/impl/PythonLanguageLevelPusher.java b/python/src/com/jetbrains/python/psi/impl/PythonLanguageLevelPusher.java
index 136a7073bb8b..7e15cab6ffda 100644
--- a/python/src/com/jetbrains/python/psi/impl/PythonLanguageLevelPusher.java
+++ b/python/src/com/jetbrains/python/psi/impl/PythonLanguageLevelPusher.java
@@ -146,7 +146,7 @@ public class PythonLanguageLevelPusher implements FilePropertyPusher<LanguageLev
private static final FileAttribute PERSISTENCE = new FileAttribute("python_language_level_persistence", 2, true);
- public void persistAttribute(@NotNull VirtualFile fileOrDir, @NotNull LanguageLevel level) throws IOException {
+ public void persistAttribute(@NotNull Project project, @NotNull VirtualFile fileOrDir, @NotNull LanguageLevel level) throws IOException {
final DataInputStream iStream = PERSISTENCE.readAttribute(fileOrDir);
if (iStream != null) {
try {
@@ -164,7 +164,7 @@ public class PythonLanguageLevelPusher implements FilePropertyPusher<LanguageLev
for (VirtualFile child : fileOrDir.getChildren()) {
if (!child.isDirectory() && PythonFileType.INSTANCE.equals(child.getFileType())) {
- PushedFilePropertiesUpdater.filePropertiesChanged(child);
+ PushedFilePropertiesUpdater.getInstance(project).filePropertiesChanged(child);
}
}
}
@@ -247,7 +247,7 @@ public class PythonLanguageLevelPusher implements FilePropertyPusher<LanguageLev
return false;
}
if (file.isDirectory()) {
- PushedFilePropertiesUpdater.findAndUpdateValue(project, file, PythonLanguageLevelPusher.this, languageLevel);
+ PushedFilePropertiesUpdater.getInstance(project).findAndUpdateValue(file, PythonLanguageLevelPusher.this, languageLevel);
}
if (suppressSizeLimit) {
SingleRootFileViewProvider.doNotCheckFileSizeLimit(file);
diff --git a/python/src/com/jetbrains/python/psi/impl/stubs/PyFileStubBuilder.java b/python/src/com/jetbrains/python/psi/impl/stubs/PyFileStubBuilder.java
index 15a342151e6a..0858ff5056bb 100644
--- a/python/src/com/jetbrains/python/psi/impl/stubs/PyFileStubBuilder.java
+++ b/python/src/com/jetbrains/python/psi/impl/stubs/PyFileStubBuilder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -29,6 +29,7 @@ import org.jetbrains.annotations.NotNull;
* @author yole
*/
public class PyFileStubBuilder extends DefaultStubBuilder {
+ @NotNull
@Override
protected StubElement createStubForFile(@NotNull PsiFile file) {
if (file instanceof PyFile) {
diff --git a/python/src/com/jetbrains/python/psi/types/PyFunctionType.java b/python/src/com/jetbrains/python/psi/types/PyFunctionType.java
index bb58b68300e8..4b3adfd112f8 100644
--- a/python/src/com/jetbrains/python/psi/types/PyFunctionType.java
+++ b/python/src/com/jetbrains/python/psi/types/PyFunctionType.java
@@ -16,8 +16,11 @@
package com.jetbrains.python.psi.types;
import com.intellij.psi.PsiElement;
+import com.intellij.util.ArrayUtil;
import com.intellij.util.ProcessingContext;
+import com.jetbrains.python.PyNames;
import com.jetbrains.python.psi.*;
+import com.jetbrains.python.psi.impl.PyBuiltinCache;
import com.jetbrains.python.psi.resolve.PyResolveContext;
import com.jetbrains.python.psi.resolve.RatedResolveResult;
import org.jetbrains.annotations.NotNull;
@@ -71,12 +74,20 @@ public class PyFunctionType implements PyCallableType {
@Nullable PyExpression location,
@NotNull AccessDirection direction,
@NotNull PyResolveContext resolveContext) {
- return Collections.emptyList();
+ final PyClassTypeImpl functionType = PyBuiltinCache.getInstance(getCallable()).getObjectType(PyNames.FAKE_FUNCTION);
+ if (functionType == null) {
+ return Collections.emptyList();
+ }
+ return functionType.resolveMember(name, location, direction, resolveContext);
}
@Override
public Object[] getCompletionVariants(String completionPrefix, PsiElement location, ProcessingContext context) {
- return new Object[0];
+ final PyClassTypeImpl functionType = PyBuiltinCache.getInstance(getCallable()).getObjectType(PyNames.FAKE_FUNCTION);
+ if (functionType == null) {
+ return ArrayUtil.EMPTY_OBJECT_ARRAY;
+ }
+ return functionType.getCompletionVariants(completionPrefix, location, context);
}
@Override
diff --git a/python/src/com/jetbrains/python/psi/types/PyModuleType.java b/python/src/com/jetbrains/python/psi/types/PyModuleType.java
index f2dc67c10c70..db5a9ba3f1ae 100644
--- a/python/src/com/jetbrains/python/psi/types/PyModuleType.java
+++ b/python/src/com/jetbrains/python/psi/types/PyModuleType.java
@@ -308,7 +308,7 @@ public class PyModuleType implements PyType { // Modules don't descend from obje
return !(psiElement instanceof PyImportElement) ||
PsiTreeUtil.getParentOfType(psiElement, PyImportStatementBase.class) instanceof PyFromImportStatement;
}
- }, new PyUtil.UnderscoreFilter(0));
+ }, null);
if (suppressParentheses) {
processor.suppressParentheses();
}
diff --git a/python/src/com/jetbrains/python/sdk/PythonSdkType.java b/python/src/com/jetbrains/python/sdk/PythonSdkType.java
index 5e3506b9e4c5..f194f359e1a9 100644
--- a/python/src/com/jetbrains/python/sdk/PythonSdkType.java
+++ b/python/src/com/jetbrains/python/sdk/PythonSdkType.java
@@ -56,7 +56,9 @@ import com.intellij.openapi.vfs.VfsUtilCore;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiElement;
import com.intellij.reference.SoftReference;
-import com.intellij.remote.*;
+import com.intellij.remote.CredentialsType;
+import com.intellij.remote.RemoteSdkCredentialsHolder;
+import com.intellij.remote.VagrantNotStartedException;
import com.intellij.util.ArrayUtil;
import com.intellij.util.Consumer;
import com.intellij.util.NullableConsumer;
@@ -993,9 +995,9 @@ public class PythonSdkType extends SdkType {
}
public static boolean isIncompleteRemote(Sdk sdk) {
- if (sdk.getSdkAdditionalData() instanceof RemoteSdkCredentials) {
+ if (PySdkUtil.isRemote(sdk)) {
//noinspection ConstantConditions
- if (!((RemoteSdkCredentials)sdk.getSdkAdditionalData()).isInitialized()) {
+ if (!((PyRemoteSdkAdditionalDataBase)sdk.getSdkAdditionalData()).isInitialized()) {
return true;
}
}
diff --git a/python/src/com/jetbrains/python/sdk/flavors/PyRemoteSdkFlavor.java b/python/src/com/jetbrains/python/sdk/flavors/PyRemoteSdkFlavor.java
index 271afc6e8c2f..124003158038 100644
--- a/python/src/com/jetbrains/python/sdk/flavors/PyRemoteSdkFlavor.java
+++ b/python/src/com/jetbrains/python/sdk/flavors/PyRemoteSdkFlavor.java
@@ -57,6 +57,6 @@ public class PyRemoteSdkFlavor extends CPythonSdkFlavor {
@Nullable
private static String getExecutableName(String path) {
- return RemoteFile.detectSystemByPath(path).createRemoteFile(path).getName();
+ return RemoteFile.createRemoteFile(path).getName();
}
}
diff --git a/python/src/com/jetbrains/python/validation/Pep8ExternalAnnotator.java b/python/src/com/jetbrains/python/validation/Pep8ExternalAnnotator.java
index c115ba45c272..a7faa6ebb98f 100644
--- a/python/src/com/jetbrains/python/validation/Pep8ExternalAnnotator.java
+++ b/python/src/com/jetbrains/python/validation/Pep8ExternalAnnotator.java
@@ -145,7 +145,7 @@ public class Pep8ExternalAnnotator extends ExternalAnnotator<Pep8ExternalAnnotat
}
final PyPep8Inspection inspection = (PyPep8Inspection)profile.getUnwrappedTool(PyPep8Inspection.KEY.toString(), file);
final List<String> ignoredErrors = inspection.ignoredErrors;
- final int margin = CodeStyleSettingsManager.getInstance(file.getProject()).getCurrentSettings().RIGHT_MARGIN;
+ final int margin = CodeStyleSettingsManager.getInstance(file.getProject()).getCurrentSettings().getRightMargin(file.getLanguage());
return new State(homePath, file.getText(), profile.getErrorLevel(key, file), ignoredErrors, margin);
}
diff --git a/python/testData/MockSdk2.7/python_stubs/__builtin__.py b/python/testData/MockSdk2.7/python_stubs/__builtin__.py
index 6ae5948e3546..ca174bbf6716 100644
--- a/python/testData/MockSdk2.7/python_stubs/__builtin__.py
+++ b/python/testData/MockSdk2.7/python_stubs/__builtin__.py
@@ -1,7 +1,7 @@
# encoding: utf-8
# module __builtin__
# from (built-in)
-# by generator 1.124
+# by generator 1.135
from __future__ import print_function
"""
Built-in functions, exceptions, and other objects.
@@ -43,25 +43,24 @@ def abs(number): # real signature unknown; restored from __doc__
"""
return 0
-
def all(iterable): # real signature unknown; restored from __doc__
"""
all(iterable) -> bool
Return True if bool(x) is True for all values x in the iterable.
+ If the iterable is empty, return True.
"""
return False
-
def any(iterable): # real signature unknown; restored from __doc__
"""
any(iterable) -> bool
Return True if bool(x) is True for any x in the iterable.
+ If the iterable is empty, return False.
"""
return False
-
def apply(p_object, args=None, kwargs=None): # real signature unknown; restored from __doc__
"""
apply(object[, args[, kwargs]]) -> value
@@ -75,7 +74,6 @@ def apply(p_object, args=None, kwargs=None): # real signature unknown; restored
"""
pass
-
def bin(number): # real signature unknown; restored from __doc__
"""
bin(number) -> string
@@ -84,7 +82,6 @@ def bin(number): # real signature unknown; restored from __doc__
"""
return ""
-
def callable(p_object): # real signature unknown; restored from __doc__
"""
callable(object) -> bool
@@ -94,7 +91,6 @@ def callable(p_object): # real signature unknown; restored from __doc__
"""
return False
-
def chr(i): # real signature unknown; restored from __doc__
"""
chr(i) -> character
@@ -103,7 +99,6 @@ def chr(i): # real signature unknown; restored from __doc__
"""
return ""
-
def cmp(x, y): # real signature unknown; restored from __doc__
"""
cmp(x, y) -> integer
@@ -112,7 +107,6 @@ def cmp(x, y): # real signature unknown; restored from __doc__
"""
return 0
-
def coerce(x, y): # real signature unknown; restored from __doc__
"""
coerce(x, y) -> (x1, y1)
@@ -123,7 +117,6 @@ def coerce(x, y): # real signature unknown; restored from __doc__
"""
pass
-
def compile(source, filename, mode, flags=None, dont_inherit=None): # real signature unknown; restored from __doc__
"""
compile(source, filename, mode[, flags[, dont_inherit]]) -> code object
@@ -142,7 +135,6 @@ def compile(source, filename, mode, flags=None, dont_inherit=None): # real signa
"""
pass
-
def copyright(*args, **kwargs): # real signature unknown
"""
interactive prompt objects for printing the license text, a list of
@@ -150,7 +142,6 @@ def copyright(*args, **kwargs): # real signature unknown
"""
pass
-
def credits(*args, **kwargs): # real signature unknown
"""
interactive prompt objects for printing the license text, a list of
@@ -158,7 +149,6 @@ def credits(*args, **kwargs): # real signature unknown
"""
pass
-
def delattr(p_object, name): # real signature unknown; restored from __doc__
"""
delattr(object, name)
@@ -168,7 +158,6 @@ def delattr(p_object, name): # real signature unknown; restored from __doc__
"""
pass
-
def dir(p_object=None): # real signature unknown; restored from __doc__
"""
dir([object]) -> list of strings
@@ -186,7 +175,6 @@ def dir(p_object=None): # real signature unknown; restored from __doc__
"""
return []
-
def divmod(x, y): # known case of __builtin__.divmod
"""
divmod(x, y) -> (quotient, remainder)
@@ -195,7 +183,6 @@ def divmod(x, y): # known case of __builtin__.divmod
"""
return (0, 0)
-
def eval(source, globals=None, locals=None): # real signature unknown; restored from __doc__
"""
eval(source[, globals[, locals]]) -> value
@@ -209,7 +196,6 @@ def eval(source, globals=None, locals=None): # real signature unknown; restored
"""
pass
-
def execfile(filename, globals=None, locals=None): # real signature unknown; restored from __doc__
"""
execfile(filename[, globals[, locals]])
@@ -220,11 +206,9 @@ def execfile(filename, globals=None, locals=None): # real signature unknown; res
"""
pass
-
def exit(*args, **kwargs): # real signature unknown
pass
-
def filter(function_or_none, sequence): # known special case of filter
"""
filter(function or None, sequence) -> list, tuple, or string
@@ -235,7 +219,6 @@ def filter(function_or_none, sequence): # known special case of filter
"""
pass
-
def format(value, format_spec=None): # real signature unknown; restored from __doc__
"""
format(value[, format_spec]) -> string
@@ -245,7 +228,6 @@ def format(value, format_spec=None): # real signature unknown; restored from __d
"""
return ""
-
def getattr(object, name, default=None): # known special case of getattr
"""
getattr(object, name[, default]) -> value
@@ -256,7 +238,6 @@ def getattr(object, name, default=None): # known special case of getattr
"""
pass
-
def globals(): # real signature unknown; restored from __doc__
"""
globals() -> dictionary
@@ -265,7 +246,6 @@ def globals(): # real signature unknown; restored from __doc__
"""
return {}
-
def hasattr(p_object, name): # real signature unknown; restored from __doc__
"""
hasattr(object, name) -> bool
@@ -275,7 +255,6 @@ def hasattr(p_object, name): # real signature unknown; restored from __doc__
"""
return False
-
def hash(p_object): # real signature unknown; restored from __doc__
"""
hash(object) -> integer
@@ -285,7 +264,6 @@ def hash(p_object): # real signature unknown; restored from __doc__
"""
return 0
-
def help(with_a_twist): # real signature unknown; restored from __doc__
"""
Define the builtin 'help'.
@@ -293,7 +271,6 @@ def help(with_a_twist): # real signature unknown; restored from __doc__
"""
pass
-
def hex(number): # real signature unknown; restored from __doc__
"""
hex(number) -> string
@@ -302,7 +279,6 @@ def hex(number): # real signature unknown; restored from __doc__
"""
return ""
-
def id(p_object): # real signature unknown; restored from __doc__
"""
id(object) -> integer
@@ -312,7 +288,6 @@ def id(p_object): # real signature unknown; restored from __doc__
"""
return 0
-
def input(prompt=None): # real signature unknown; restored from __doc__
"""
input([prompt]) -> value
@@ -321,7 +296,6 @@ def input(prompt=None): # real signature unknown; restored from __doc__
"""
pass
-
def intern(string): # real signature unknown; restored from __doc__
"""
intern(string) -> string
@@ -333,7 +307,6 @@ def intern(string): # real signature unknown; restored from __doc__
"""
return ""
-
def isinstance(p_object, class_or_type_or_tuple): # real signature unknown; restored from __doc__
"""
isinstance(object, class-or-type-or-tuple) -> bool
@@ -345,7 +318,6 @@ def isinstance(p_object, class_or_type_or_tuple): # real signature unknown; rest
"""
return False
-
def issubclass(C, B): # real signature unknown; restored from __doc__
"""
issubclass(C, B) -> bool
@@ -356,7 +328,6 @@ def issubclass(C, B): # real signature unknown; restored from __doc__
"""
return False
-
def iter(source, sentinel=None): # known special case of iter
"""
iter(collection) -> iterator
@@ -368,7 +339,6 @@ def iter(source, sentinel=None): # known special case of iter
"""
pass
-
def len(p_object): # real signature unknown; restored from __doc__
"""
len(object) -> integer
@@ -377,7 +347,6 @@ def len(p_object): # real signature unknown; restored from __doc__
"""
return 0
-
def license(*args, **kwargs): # real signature unknown
"""
interactive prompt objects for printing the license text, a list of
@@ -385,7 +354,6 @@ def license(*args, **kwargs): # real signature unknown
"""
pass
-
def locals(): # real signature unknown; restored from __doc__
"""
locals() -> dictionary
@@ -394,7 +362,6 @@ def locals(): # real signature unknown; restored from __doc__
"""
return {}
-
def map(function, sequence, *sequence_1): # real signature unknown; restored from __doc__
"""
map(function, sequence[, sequence, ...]) -> list
@@ -408,7 +375,6 @@ def map(function, sequence, *sequence_1): # real signature unknown; restored fro
"""
return []
-
def max(*args, **kwargs): # known special case of max
"""
max(iterable[, key=func]) -> value
@@ -419,7 +385,6 @@ def max(*args, **kwargs): # known special case of max
"""
pass
-
def min(*args, **kwargs): # known special case of min
"""
min(iterable[, key=func]) -> value
@@ -430,7 +395,6 @@ def min(*args, **kwargs): # known special case of min
"""
pass
-
def next(iterator, default=None): # real signature unknown; restored from __doc__
"""
next(iterator[, default])
@@ -440,7 +404,6 @@ def next(iterator, default=None): # real signature unknown; restored from __doc_
"""
pass
-
def oct(number): # real signature unknown; restored from __doc__
"""
oct(number) -> string
@@ -449,7 +412,6 @@ def oct(number): # real signature unknown; restored from __doc__
"""
return ""
-
def open(name, mode=None, buffering=None): # real signature unknown; restored from __doc__
"""
open(name[, mode[, buffering]]) -> file object
@@ -459,7 +421,6 @@ def open(name, mode=None, buffering=None): # real signature unknown; restored fr
"""
return file('/dev/null')
-
def ord(c): # real signature unknown; restored from __doc__
"""
ord(c) -> integer
@@ -468,7 +429,6 @@ def ord(c): # real signature unknown; restored from __doc__
"""
return 0
-
def pow(x, y, z=None): # real signature unknown; restored from __doc__
"""
pow(x, y[, z]) -> number
@@ -478,7 +438,6 @@ def pow(x, y, z=None): # real signature unknown; restored from __doc__
"""
return 0
-
def print(*args, **kwargs): # known special case of print
"""
print(value, ..., sep=' ', end='\n', file=sys.stdout)
@@ -491,14 +450,13 @@ def print(*args, **kwargs): # known special case of print
"""
pass
-
def quit(*args, **kwargs): # real signature unknown
pass
-
def range(start=None, stop=None, step=None): # known special case of range
"""
- range([start,] stop[, step]) -> list of integers
+ range(stop) -> list of integers
+ range(start, stop[, step]) -> list of integers
Return a list containing an arithmetic progression of integers.
range(i, j) returns [i, i+1, i+2, ..., j-1]; start (!) defaults to 0.
@@ -508,7 +466,6 @@ def range(start=None, stop=None, step=None): # known special case of range
"""
pass
-
def raw_input(prompt=None): # real signature unknown; restored from __doc__
"""
raw_input([prompt]) -> string
@@ -520,7 +477,6 @@ def raw_input(prompt=None): # real signature unknown; restored from __doc__
"""
return ""
-
def reduce(function, sequence, initial=None): # real signature unknown; restored from __doc__
"""
reduce(function, sequence[, initial]) -> value
@@ -534,7 +490,6 @@ def reduce(function, sequence, initial=None): # real signature unknown; restored
"""
pass
-
def reload(module): # real signature unknown; restored from __doc__
"""
reload(module) -> module
@@ -543,7 +498,6 @@ def reload(module): # real signature unknown; restored from __doc__
"""
pass
-
def repr(p_object): # real signature unknown; restored from __doc__
"""
repr(object) -> string
@@ -553,7 +507,6 @@ def repr(p_object): # real signature unknown; restored from __doc__
"""
return ""
-
def round(number, ndigits=None): # real signature unknown; restored from __doc__
"""
round(number[, ndigits]) -> floating point number
@@ -563,7 +516,6 @@ def round(number, ndigits=None): # real signature unknown; restored from __doc__
"""
return 0.0
-
def setattr(p_object, name, value): # real signature unknown; restored from __doc__
"""
setattr(object, name, value)
@@ -573,23 +525,20 @@ def setattr(p_object, name, value): # real signature unknown; restored from __do
"""
pass
-
def sorted(iterable, cmp=None, key=None, reverse=False): # real signature unknown; restored from __doc__
""" sorted(iterable, cmp=None, key=None, reverse=False) --> new sorted list """
pass
-
def sum(sequence, start=None): # real signature unknown; restored from __doc__
"""
sum(sequence[, start]) -> value
- Returns the sum of a sequence of numbers (NOT strings) plus the value
+ Return the sum of a sequence of numbers (NOT strings) plus the value
of parameter 'start' (which defaults to 0). When the sequence is
- empty, returns start.
+ empty, return start.
"""
pass
-
def unichr(i): # real signature unknown; restored from __doc__
"""
unichr(i) -> Unicode character
@@ -598,7 +547,6 @@ def unichr(i): # real signature unknown; restored from __doc__
"""
return u""
-
def vars(p_object=None): # real signature unknown; restored from __doc__
"""
vars([object]) -> dictionary
@@ -608,7 +556,6 @@ def vars(p_object=None): # real signature unknown; restored from __doc__
"""
return {}
-
def zip(seq1, seq2, *more_seqs): # known special case of zip
"""
zip(seq1 [, seq2 [...]]) -> [(seq1[0], seq2[0] ...), (...)]
@@ -619,13 +566,16 @@ def zip(seq1, seq2, *more_seqs): # known special case of zip
"""
pass
-
def __import__(name, globals={}, locals={}, fromlist=[], level=-1): # real signature unknown; restored from __doc__
"""
__import__(name, globals={}, locals={}, fromlist=[], level=-1) -> module
- Import a module. The globals are only used to determine the context;
- they are not modified. The locals are currently unused. The fromlist
+ Import a module. Because this function is meant for use by the Python
+ interpreter and not for general use it is better to use
+ importlib.import_module() to programmatically import a module.
+
+ The globals argument is only used to determine the context;
+ they are not modified. The locals argument is unused. The fromlist
should be a list of names to emulate ``from name import ...'', or an
empty list to emulate ``import name''.
When importing a module from a package, note that __import__('A.B', ...)
@@ -637,9 +587,100 @@ def __import__(name, globals={}, locals={}, fromlist=[], level=-1): # real signa
"""
pass
-
# classes
+class ___Classobj:
+ '''A mock class representing the old style class base.'''
+ __module__ = ''
+ __class__ = None
+
+ def __init__(self):
+ pass
+ __dict__ = {}
+ __doc__ = ''
+
+
+class __generator(object):
+ '''A mock class representing the generator function type.'''
+ def __init__(self):
+ self.gi_code = None
+ self.gi_frame = None
+ self.gi_running = 0
+
+ def __iter__(self):
+ '''Defined to support iteration over container.'''
+ pass
+
+ def next(self):
+ '''Return the next item from the container.'''
+ pass
+
+ def close(self):
+ '''Raises new GeneratorExit exception inside the generator to terminate the iteration.'''
+ pass
+
+ def send(self, value):
+ '''Resumes the generator and "sends" a value that becomes the result of the current yield-expression.'''
+ pass
+
+ def throw(self, type, value=None, traceback=None):
+ '''Used to raise an exception inside the generator.'''
+ pass
+
+
+class __function(object):
+ '''A mock class representing function type.'''
+
+ def __init__(self):
+ self.__name__ = ''
+ self.__doc__ = ''
+ self.__dict__ = ''
+ self.__module__ = ''
+
+ self.func_defaults = {}
+ self.func_globals = {}
+ self.func_closure = None
+ self.func_code = None
+ self.func_name = ''
+ self.func_doc = ''
+ self.func_dict = ''
+
+ self.__defaults__ = {}
+ self.__globals__ = {}
+ self.__closure__ = None
+ self.__code__ = None
+ self.__name__ = ''
+
+
+class __namedtuple(tuple):
+ '''A mock base class for named tuples.'''
+
+ __slots__ = ()
+ _fields = ()
+
+ def __new__(cls, *args, **kwargs):
+ 'Create a new instance of the named tuple.'
+ return tuple.__new__(cls, *args)
+
+ @classmethod
+ def _make(cls, iterable, new=tuple.__new__, len=len):
+ 'Make a new named tuple object from a sequence or iterable.'
+ return new(cls, iterable)
+
+ def __repr__(self):
+ return ''
+
+ def _asdict(self):
+ 'Return a new dict which maps field types to their values.'
+ return {}
+
+ def _replace(self, **kwargs):
+ 'Return a new named tuple object replacing specified fields with new values.'
+ return self
+
+ def __getnewargs__(self):
+ return tuple(self)
+
class object:
""" The most base type """
def __delattr__(self, name): # real signature unknown; restored from __doc__
@@ -712,6 +753,8 @@ class object:
__module__ = ''
+from object import object
+
class basestring(object):
""" Type basestring cannot be instantiated; it is the base for str and unicode. """
def __init__(self, *args, **kwargs): # real signature unknown
@@ -723,17 +766,24 @@ class basestring(object):
pass
+from object import object
+
class int(object):
"""
- int(x[, base]) -> integer
+ int(x=0) -> int or long
+ int(x, base=10) -> int or long
+
+ Convert a number or string to an integer, or return 0 if no arguments
+ are given. If x is floating point, the conversion truncates towards zero.
+ If x is outside the integer range, the function returns a long instead.
- Convert a string or number to an integer, if possible. A floating point
- argument will be truncated towards zero (this does not include a string
- representation of a floating point number!) When converting a string, use
- the optional base. It is an error to supply a base when converting a
- non-string. If base is zero, the proper base is guessed based on the
- string content. If the argument is outside the integer range a
- long object will be returned instead.
+ If x is not a number or if base is given, then x must be a string or
+ Unicode object representing an integer literal in the given base. The
+ literal can be preceded by '+' or '-' and be surrounded by whitespace.
+ The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to
+ interpret the base from the string as an integer literal.
+ >>> int('0b100', base=0)
+ 4
"""
def bit_length(self): # real signature unknown; restored from __doc__
"""
@@ -811,15 +861,20 @@ class int(object):
def __init__(self, x, base=10): # known special case of int.__init__
"""
- int(x[, base]) -> integer
+ int(x=0) -> int or long
+ int(x, base=10) -> int or long
- Convert a string or number to an integer, if possible. A floating point
- argument will be truncated towards zero (this does not include a string
- representation of a floating point number!) When converting a string, use
- the optional base. It is an error to supply a base when converting a
- non-string. If base is zero, the proper base is guessed based on the
- string content. If the argument is outside the integer range a
- long object will be returned instead.
+ Convert a number or string to an integer, or return 0 if no arguments
+ are given. If x is floating point, the conversion truncates towards zero.
+ If x is outside the integer range, the function returns a long instead.
+
+ If x is not a number or if base is given, then x must be a string or
+ Unicode object representing an integer literal in the given base. The
+ literal can be preceded by '+' or '-' and be surrounded by whitespace.
+ The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to
+ interpret the base from the string as an integer literal.
+ >>> int('0b100', base=0)
+ 4
# (copied from class doc)
"""
pass
@@ -961,11 +1016,21 @@ class int(object):
""" x.__xor__(y) <==> x^y """
pass
- denominator = property(lambda self: object()) # default
- imag = property(lambda self: object()) # default
- numerator = property(lambda self: object()) # default
- real = property(lambda self: object()) # default
+ denominator = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
+ """the denominator of a rational number in lowest terms"""
+
+ imag = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
+ """the imaginary part of a complex number"""
+
+ numerator = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
+ """the numerator of a rational number in lowest terms"""
+
+ real = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
+ """the real part of a complex number"""
+
+
+from int import int
class bool(int):
"""
@@ -1016,6 +1081,8 @@ class bool(int):
pass
+from object import object
+
class buffer(object):
"""
buffer(object [, offset[, size]])
@@ -1106,6 +1173,8 @@ class buffer(object):
pass
+from object import object
+
class bytearray(object):
"""
bytearray(iterable_of_ints) -> bytearray.
@@ -1456,9 +1525,9 @@ class bytearray(object):
"""
return []
- def splitlines(self, keepends=None): # real signature unknown; restored from __doc__
+ def splitlines(self, keepends=False): # real signature unknown; restored from __doc__
"""
- B.splitlines([keepends]) -> list of lines
+ B.splitlines(keepends=False) -> list of lines
Return a list of the lines in B, breaking at line boundaries.
Line breaks are not included in the resulting list unless keepends
@@ -1658,9 +1727,11 @@ class bytearray(object):
pass
+from basestring import basestring
+
class str(basestring):
"""
- str(object) -> string
+ str(object='') -> string
Return a nice string representation of the object.
If the argument is a string, the return value is the same object.
@@ -1962,9 +2033,9 @@ class str(basestring):
"""
return []
- def splitlines(self, keepends=None): # real signature unknown; restored from __doc__
+ def splitlines(self, keepends=False): # real signature unknown; restored from __doc__
"""
- S.splitlines([keepends]) -> list of strings
+ S.splitlines(keepends=False) -> list of strings
Return a list of the lines in S, breaking at line boundaries.
Line breaks are not included in the resulting list unless keepends
@@ -2101,7 +2172,7 @@ class str(basestring):
def __init__(self, string=''): # known special case of str.__init__
"""
- str(object) -> string
+ str(object='') -> string
Return a nice string representation of the object.
If the argument is a string, the return value is the same object.
@@ -2162,6 +2233,8 @@ class str(basestring):
bytes = str
+from object import object
+
class classmethod(object):
"""
classmethod(function) -> method
@@ -2200,9 +2273,12 @@ class classmethod(object):
""" T.__new__(S, ...) -> a new object with type S, a subtype of T """
pass
- __func__ = property(lambda self: object()) # default
+ __func__ = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
+
+from object import object
+
class complex(object):
"""
complex(real[, imag]) -> complex number
@@ -2214,7 +2290,7 @@ class complex(object):
"""
complex.conjugate() -> complex
- Returns the complex conjugate of its argument. (3-4j).conjugate() == 3+4j.
+ Return the complex conjugate of its argument. (3-4j).conjugate() == 3+4j.
"""
return complex
@@ -2254,7 +2330,7 @@ class complex(object):
"""
complex.__format__() -> str
- Converts to a string according to format_spec.
+ Convert to a string according to format_spec.
"""
return ""
@@ -2382,9 +2458,21 @@ class complex(object):
pass
imag = property(lambda self: 0.0)
+ """the imaginary part of a complex number
+
+ :type: float
+ """
+
real = property(lambda self: 0.0)
+ """the real part of a complex number
+
+ :type: float
+ """
+
+from object import object
+
class dict(object):
"""
dict() -> new empty dictionary
@@ -2461,9 +2549,9 @@ class dict(object):
def update(self, E=None, **F): # known special case of dict.update
"""
- D.update(E, **F) -> None. Update D from dict/iterable E and F.
- If E has a .keys() method, does: for k in E: D[k] = E[k]
- If E lacks .keys() method, does: for (k, v) in E: D[k] = v
+ D.update([E, ]**F) -> None. Update D from dict/iterable E and F.
+ If E present and has a .keys() method, does: for k in E: D[k] = E[k]
+ If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v
In either case, this is followed by: for k in F: D[k] = F[k]
"""
pass
@@ -2571,6 +2659,8 @@ class dict(object):
__hash__ = None
+from object import object
+
class enumerate(object):
"""
enumerate(iterable[, start]) -> iterator for index, value of iterable
@@ -2603,6 +2693,8 @@ class enumerate(object):
pass
+from object import object
+
class file(object):
"""
file(name[, mode[, buffering]]) -> file object
@@ -2779,14 +2871,48 @@ class file(object):
pass
closed = property(lambda self: True)
+ """True if the file is closed
+
+ :type: bool
+ """
+
encoding = property(lambda self: '')
- errors = property(lambda self: object()) # default
+ """file encoding
+
+ :type: string
+ """
+
+ errors = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
+ """Unicode error handler"""
+
mode = property(lambda self: '')
+ """file mode ('r', 'U', 'w', 'a', possibly with 'b' or '+' added)
+
+ :type: string
+ """
+
name = property(lambda self: '')
+ """file name
+
+ :type: string
+ """
+
newlines = property(lambda self: '')
+ """end-of-line convention used in this file
+
+ :type: string
+ """
+
softspace = property(lambda self: True)
+ """flag indicating that a space needs to be printed; used by print
+
+ :type: bool
+ """
+
+from object import object
+
class float(object):
"""
float(x) -> floating point number
@@ -2797,9 +2923,9 @@ class float(object):
"""
float.as_integer_ratio() -> (int, int)
- Returns a pair of integers, whose ratio is exactly equal to the original
+ Return a pair of integers, whose ratio is exactly equal to the original
float and with a positive denominator.
- Raises OverflowError on infinities and a ValueError on NaNs.
+ Raise OverflowError on infinities and a ValueError on NaNs.
>>> (10.0).as_integer_ratio()
(10, 1)
@@ -2811,7 +2937,7 @@ class float(object):
pass
def conjugate(self, *args, **kwargs): # real signature unknown
- """ Returns self, the complex conjugate of any float. """
+ """ Return self, the complex conjugate of any float. """
pass
def fromhex(self, string): # real signature unknown; restored from __doc__
@@ -2839,7 +2965,7 @@ class float(object):
return ""
def is_integer(self, *args, **kwargs): # real signature unknown
- """ Returns True if the float is an integer. """
+ """ Return True if the float is an integer. """
pass
def __abs__(self): # real signature unknown; restored from __doc__
@@ -3017,7 +3143,7 @@ class float(object):
'IEEE, big-endian' or 'IEEE, little-endian', and in addition can only be
one of the latter two if it appears to match the underlying C reality.
- Overrides the automatic determination of C-level floating point type.
+ Override the automatic determination of C-level floating point type.
This affects how floats are converted to and from binary strings.
"""
pass
@@ -3035,13 +3161,19 @@ class float(object):
pass
def __trunc__(self, *args, **kwargs): # real signature unknown
- """ Returns the Integral closest to x between 0 and x. """
+ """ Return the Integral closest to x between 0 and x. """
pass
- imag = property(lambda self: object()) # default
- real = property(lambda self: object()) # default
+ imag = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
+ """the imaginary part of a complex number"""
+
+ real = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
+ """the real part of a complex number"""
+
+from object import object
+
class frozenset(object):
"""
frozenset() -> empty frozenset object
@@ -3199,6 +3331,8 @@ class frozenset(object):
pass
+from object import object
+
class list(object):
"""
list() -> new empty list
@@ -3376,15 +3510,23 @@ class list(object):
__hash__ = None
+from object import object
+
class long(object):
"""
- long(x[, base]) -> integer
+ long(x=0) -> long
+ long(x, base=10) -> long
- Convert a string or number to a long integer, if possible. A floating
- point argument will be truncated towards zero (this does not include a
- string representation of a floating point number!) When converting a
- string, use the optional base. It is an error to supply a base when
- converting a non-string.
+ Convert a number or string to a long integer, or return 0L if no arguments
+ are given. If x is floating point, the conversion truncates towards zero.
+
+ If x is not a number or if base is given, then x must be a string or
+ Unicode object representing an integer literal in the given base. The
+ literal can be preceded by '+' or '-' and be surrounded by whitespace.
+ The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to
+ interpret the base from the string as an integer literal.
+ >>> int('0b100', base=0)
+ 4L
"""
def bit_length(self): # real signature unknown; restored from __doc__
"""
@@ -3460,7 +3602,7 @@ class long(object):
""" x[y:z] <==> x[y.__index__():z.__index__()] """
pass
- def __init__(self, x, base=None): # real signature unknown; restored from __doc__
+ def __init__(self, x=0): # real signature unknown; restored from __doc__
pass
def __int__(self): # real signature unknown; restored from __doc__
@@ -3604,11 +3746,21 @@ class long(object):
""" x.__xor__(y) <==> x^y """
pass
- denominator = property(lambda self: object()) # default
- imag = property(lambda self: object()) # default
- numerator = property(lambda self: object()) # default
- real = property(lambda self: object()) # default
+ denominator = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
+ """the denominator of a rational number in lowest terms"""
+
+ imag = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
+ """the imaginary part of a complex number"""
+
+ numerator = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
+ """the numerator of a rational number in lowest terms"""
+
+ real = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
+ """the real part of a complex number"""
+
+
+from object import object
class memoryview(object):
"""
@@ -3678,14 +3830,23 @@ class memoryview(object):
""" x.__setitem__(i, y) <==> x[i]=y """
pass
- format = property(lambda self: object()) # default
- itemsize = property(lambda self: object()) # default
- ndim = property(lambda self: object()) # default
- readonly = property(lambda self: object()) # default
- shape = property(lambda self: object()) # default
- strides = property(lambda self: object()) # default
- suboffsets = property(lambda self: object()) # default
+ format = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
+ itemsize = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
+
+ ndim = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
+
+ readonly = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
+
+ shape = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
+
+ strides = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
+
+ suboffsets = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
+
+
+
+from object import object
class property(object):
"""
@@ -3694,6 +3855,7 @@ class property(object):
fget is a function to be used for getting an attribute value, and likewise
fset is a function for setting, and fdel a function for del'ing, an
attribute. Typical use is to define a managed attribute x:
+
class C(object):
def getx(self): return self._x
def setx(self, value): self._x = value
@@ -3701,13 +3863,18 @@ class property(object):
x = property(getx, setx, delx, "I'm the 'x' property.")
Decorators make defining new properties or modifying existing ones easy:
+
class C(object):
@property
- def x(self): return self._x
+ def x(self):
+ "I am the 'x' property."
+ return self._x
@x.setter
- def x(self, value): self._x = value
+ def x(self, value):
+ self._x = value
@x.deleter
- def x(self): del self._x
+ def x(self):
+ del self._x
"""
def deleter(self, *args, **kwargs): # real signature unknown
""" Descriptor to change the deleter on a property. """
@@ -3740,6 +3907,7 @@ class property(object):
fget is a function to be used for getting an attribute value, and likewise
fset is a function for setting, and fdel a function for del'ing, an
attribute. Typical use is to define a managed attribute x:
+
class C(object):
def getx(self): return self._x
def setx(self, value): self._x = value
@@ -3747,13 +3915,18 @@ class property(object):
x = property(getx, setx, delx, "I'm the 'x' property.")
Decorators make defining new properties or modifying existing ones easy:
+
class C(object):
@property
- def x(self): return self._x
+ def x(self):
+ "I am the 'x' property."
+ return self._x
@x.setter
- def x(self, value): self._x = value
+ def x(self, value):
+ self._x = value
@x.deleter
- def x(self): del self._x
+ def x(self):
+ del self._x
# (copied from class doc)
"""
@@ -3768,11 +3941,16 @@ class property(object):
""" descr.__set__(obj, value) """
pass
- fdel = property(lambda self: object()) # default
- fget = property(lambda self: object()) # default
- fset = property(lambda self: object()) # default
+ fdel = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
+
+ fget = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
+
+ fset = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
+
+from object import object
+
class reversed(object):
"""
reversed(sequence) -> reverse iterator over values of the sequence
@@ -3804,6 +3982,8 @@ class reversed(object):
pass
+from object import object
+
class set(object):
"""
set() -> new empty set object
@@ -3939,7 +4119,7 @@ class set(object):
pass
def __iand__(self, y): # real signature unknown; restored from __doc__
- """ x.__iand__(y) <==> x&y """
+ """ x.__iand__(y) <==> x&=y """
pass
def __init__(self, seq=()): # known special case of set.__init__
@@ -3953,11 +4133,11 @@ class set(object):
pass
def __ior__(self, y): # real signature unknown; restored from __doc__
- """ x.__ior__(y) <==> x|y """
+ """ x.__ior__(y) <==> x|=y """
pass
def __isub__(self, y): # real signature unknown; restored from __doc__
- """ x.__isub__(y) <==> x-y """
+ """ x.__isub__(y) <==> x-=y """
pass
def __iter__(self): # real signature unknown; restored from __doc__
@@ -3965,7 +4145,7 @@ class set(object):
pass
def __ixor__(self, y): # real signature unknown; restored from __doc__
- """ x.__ixor__(y) <==> x^y """
+ """ x.__ixor__(y) <==> x^=y """
pass
def __len__(self): # real signature unknown; restored from __doc__
@@ -4032,9 +4212,12 @@ class set(object):
__hash__ = None
+from object import object
+
class slice(object):
"""
- slice([start,] stop[, step])
+ slice(stop)
+ slice(start, stop[, step])
Create a slice object. This is used for extended slicing (e.g. a[0:10:2]).
"""
@@ -4061,7 +4244,7 @@ class slice(object):
""" x.__hash__() <==> hash(x) """
pass
- def __init__(self, start=None, *args, **kwargs): # real signature unknown; NOTE: unreliably restored from __doc__
+ def __init__(self, stop): # real signature unknown; restored from __doc__
pass
@staticmethod # known case of __new__
@@ -4078,9 +4261,17 @@ class slice(object):
pass
start = property(lambda self: 0)
+ """:type: int"""
+
step = property(lambda self: 0)
+ """:type: int"""
+
stop = property(lambda self: 0)
+ """:type: int"""
+
+
+from object import object
class staticmethod(object):
"""
@@ -4117,13 +4308,16 @@ class staticmethod(object):
""" T.__new__(S, ...) -> a new object with type S, a subtype of T """
pass
- __func__ = property(lambda self: object()) # default
+ __func__ = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
+
+
+from object import object
class super(object):
"""
- super(type) -> unbound super object
super(type, obj) -> bound super object; requires isinstance(obj, type)
+ super(type) -> unbound super object
super(type, type2) -> bound super object; requires issubclass(type2, type)
Typical use to call a cooperative superclass method:
class C(B):
@@ -4140,8 +4334,8 @@ class super(object):
def __init__(self, type1, type2=None): # known special case of super.__init__
"""
- super(type) -> unbound super object
super(type, obj) -> bound super object; requires isinstance(obj, type)
+ super(type) -> unbound super object
super(type, type2) -> bound super object; requires issubclass(type2, type)
Typical use to call a cooperative superclass method:
class C(B):
@@ -4161,10 +4355,27 @@ class super(object):
pass
__self_class__ = property(lambda self: type(object))
+ """the type of the instance invoking super(); may be None
+
+ :type: type
+ """
+
__self__ = property(lambda self: type(object))
+ """the instance invoking super(); may be None
+
+ :type: type
+ """
+
__thisclass__ = property(lambda self: type(object))
+ """the class invoking super()
+
+ :type: type
+ """
+
+from object import object
+
class tuple(object):
"""
tuple() -> empty tuple
@@ -4278,6 +4489,8 @@ class tuple(object):
pass
+from object import object
+
class type(object):
"""
type(object) -> the object's type
@@ -4369,7 +4582,8 @@ class type(object):
""" __subclasses__() -> list of immediate subclasses """
return []
- __abstractmethods__ = property(lambda self: object()) # default
+ __abstractmethods__ = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
+
__bases__ = (
object,
@@ -4388,9 +4602,12 @@ class type(object):
__weakrefoffset__ = 368
+from basestring import basestring
+
class unicode(basestring):
"""
- unicode(string [, encoding[, errors]]) -> object
+ unicode(object='') -> unicode object
+ unicode(string[, encoding[, errors]]) -> unicode object
Create a new Unicode object from the given encoded string.
encoding defaults to the current default string encoding.
@@ -4432,7 +4649,7 @@ class unicode(basestring):
to the default encoding. errors may be given to set a different error
handling scheme. Default is 'strict' meaning that encoding errors raise
a UnicodeDecodeError. Other possible values are 'ignore' and 'replace'
- as well as any other name registerd with codecs.register_error that is
+ as well as any other name registered with codecs.register_error that is
able to handle UnicodeDecodeErrors.
"""
return ""
@@ -4711,9 +4928,9 @@ class unicode(basestring):
"""
return []
- def splitlines(self, keepends=None): # real signature unknown; restored from __doc__
+ def splitlines(self, keepends=False): # real signature unknown; restored from __doc__
"""
- S.splitlines([keepends]) -> list of strings
+ S.splitlines(keepends=False) -> list of strings
Return a list of the lines in S, breaking at line boundaries.
Line breaks are not included in the resulting list unless keepends
@@ -4849,7 +5066,8 @@ class unicode(basestring):
def __init__(self, string=u'', encoding=None, errors='strict'): # known special case of unicode.__init__
"""
- unicode(string [, encoding[, errors]]) -> object
+ unicode(object='') -> unicode object
+ unicode(string[, encoding[, errors]]) -> unicode object
Create a new Unicode object from the given encoded string.
encoding defaults to the current default string encoding.
@@ -4908,9 +5126,12 @@ class unicode(basestring):
pass
+from object import object
+
class xrange(object):
"""
- xrange([start,] stop[, step]) -> xrange object
+ xrange(stop) -> xrange object
+ xrange(start, stop[, step]) -> xrange object
Like range(), but instead of returning a list, returns an object that
generates the numbers in the range on demand. For looping, this is
@@ -4924,7 +5145,7 @@ class xrange(object):
""" x.__getitem__(y) <==> x[y] """
pass
- def __init__(self, start=None, *args, **kwargs): # real signature unknown; NOTE: unreliably restored from __doc__
+ def __init__(self, stop): # real signature unknown; restored from __doc__
pass
def __iter__(self): # real signature unknown; restored from __doc__
@@ -4952,74 +5173,6 @@ class xrange(object):
pass
-class ___Classobj:
- '''A mock class representing the old style class base.'''
- __module__ = ''
- __class__ = None
-
- def __init__(self):
- pass
- __dict__ = {}
- __doc__ = ''
-
-
-class __generator(object):
- '''A mock class representing the generator function type.'''
- def __init__(self):
- self.gi_code = None
- self.gi_frame = None
- self.gi_running = 0
-
- def __iter__(self):
- '''Defined to support iteration over container.'''
- pass
-
- def next(self):
- '''Return the next item from the container.'''
- pass
-
- def close(self):
- '''Raises new GeneratorExit exception inside the generator to terminate the iteration.'''
- pass
-
- def send(self, value):
- '''Resumes the generator and "sends" a value that becomes the result of the current yield-expression.'''
- pass
-
- def throw(self, type, value=None, traceback=None):
- '''Used to raise an exception inside the generator.'''
- pass
-
-
-class __namedtuple(tuple):
- '''A mock base class for named tuples.'''
-
- __slots__ = ()
- _fields = ()
-
- def __new__(cls, *args, **kwargs):
- 'Create a new instance of the named tuple.'
- return tuple.__new__(cls, *args)
-
- @classmethod
- def _make(cls, iterable, new=tuple.__new__, len=len):
- 'Make a new named tuple object from a sequence or iterable.'
- return new(cls, iterable)
-
- def __repr__(self):
- return ''
-
- def _asdict(self):
- 'Return a new dict which maps field types to their values.'
- return {}
-
- def _replace(self, **kwargs):
- 'Return a new named tuple object replacing specified fields with new values.'
- return self
-
- def __getnewargs__(self):
- return tuple(self)
-
# variables with complex values
Ellipsis = None # (!) real value is ''
diff --git a/python/testData/MockSdk3.2/python_stubs/builtins.py b/python/testData/MockSdk3.2/python_stubs/builtins.py
index b3fa88d45b0c..88b74ab951ac 100644
--- a/python/testData/MockSdk3.2/python_stubs/builtins.py
+++ b/python/testData/MockSdk3.2/python_stubs/builtins.py
@@ -1,7 +1,7 @@
# encoding: utf-8
# module builtins
# from (built-in)
-# by generator 1.118
+# by generator 1.135
"""
Built-in functions, exceptions, and other objects.
@@ -25,25 +25,24 @@ def abs(number): # real signature unknown; restored from __doc__
"""
return 0
-
def all(iterable): # real signature unknown; restored from __doc__
"""
all(iterable) -> bool
Return True if bool(x) is True for all values x in the iterable.
+ If the iterable is empty, return True.
"""
return False
-
def any(iterable): # real signature unknown; restored from __doc__
"""
any(iterable) -> bool
Return True if bool(x) is True for any x in the iterable.
+ If the iterable is empty, return False.
"""
return False
-
def ascii(p_object): # real signature unknown; restored from __doc__
"""
ascii(object) -> string
@@ -55,7 +54,6 @@ def ascii(p_object): # real signature unknown; restored from __doc__
"""
return ""
-
def bin(number): # real signature unknown; restored from __doc__
"""
bin(number) -> string
@@ -64,7 +62,6 @@ def bin(number): # real signature unknown; restored from __doc__
"""
return ""
-
def callable(p_object): # real signature unknown; restored from __doc__
"""
callable(object) -> bool
@@ -75,16 +72,15 @@ def callable(p_object): # real signature unknown; restored from __doc__
"""
return False
-
def chr(i): # real signature unknown; restored from __doc__
"""
chr(i) -> Unicode character
Return a Unicode string of one character with ordinal i; 0 <= i <= 0x10ffff.
+ If 0x10000 <= i, a surrogate pair is returned.
"""
return ""
-
def compile(source, filename, mode, flags=None, dont_inherit=None): # real signature unknown; restored from __doc__
"""
compile(source, filename, mode[, flags[, dont_inherit]]) -> code object
@@ -103,7 +99,6 @@ def compile(source, filename, mode, flags=None, dont_inherit=None): # real signa
"""
pass
-
def copyright(*args, **kwargs): # real signature unknown
"""
interactive prompt objects for printing the license text, a list of
@@ -111,7 +106,6 @@ def copyright(*args, **kwargs): # real signature unknown
"""
pass
-
def credits(*args, **kwargs): # real signature unknown
"""
interactive prompt objects for printing the license text, a list of
@@ -119,7 +113,6 @@ def credits(*args, **kwargs): # real signature unknown
"""
pass
-
def delattr(p_object, name): # real signature unknown; restored from __doc__
"""
delattr(object, name)
@@ -129,7 +122,6 @@ def delattr(p_object, name): # real signature unknown; restored from __doc__
"""
pass
-
def dir(p_object=None): # real signature unknown; restored from __doc__
"""
dir([object]) -> list of strings
@@ -147,7 +139,6 @@ def dir(p_object=None): # real signature unknown; restored from __doc__
"""
return []
-
def divmod(x, y): # known case of builtins.divmod
"""
divmod(x, y) -> (div, mod)
@@ -156,7 +147,6 @@ def divmod(x, y): # known case of builtins.divmod
"""
return (0, 0)
-
def eval(source, globals=None, locals=None): # real signature unknown; restored from __doc__
"""
eval(source[, globals[, locals]]) -> value
@@ -170,7 +160,6 @@ def eval(source, globals=None, locals=None): # real signature unknown; restored
"""
pass
-
def exec(p_object, globals=None, locals=None): # real signature unknown; restored from __doc__
"""
exec(object[, globals[, locals]])
@@ -182,11 +171,9 @@ def exec(p_object, globals=None, locals=None): # real signature unknown; restore
"""
pass
-
def exit(*args, **kwargs): # real signature unknown
pass
-
def format(value, format_spec=None): # real signature unknown; restored from __doc__
"""
format(value[, format_spec]) -> string
@@ -196,7 +183,6 @@ def format(value, format_spec=None): # real signature unknown; restored from __d
"""
return ""
-
def getattr(object, name, default=None): # known special case of getattr
"""
getattr(object, name[, default]) -> value
@@ -207,7 +193,6 @@ def getattr(object, name, default=None): # known special case of getattr
"""
pass
-
def globals(): # real signature unknown; restored from __doc__
"""
globals() -> dictionary
@@ -216,7 +201,6 @@ def globals(): # real signature unknown; restored from __doc__
"""
return {}
-
def hasattr(p_object, name): # real signature unknown; restored from __doc__
"""
hasattr(object, name) -> bool
@@ -226,7 +210,6 @@ def hasattr(p_object, name): # real signature unknown; restored from __doc__
"""
return False
-
def hash(p_object): # real signature unknown; restored from __doc__
"""
hash(object) -> integer
@@ -236,7 +219,6 @@ def hash(p_object): # real signature unknown; restored from __doc__
"""
return 0
-
def help(with_a_twist): # real signature unknown; restored from __doc__
"""
Define the builtin 'help'.
@@ -244,7 +226,6 @@ def help(with_a_twist): # real signature unknown; restored from __doc__
"""
pass
-
def hex(number): # real signature unknown; restored from __doc__
"""
hex(number) -> string
@@ -253,7 +234,6 @@ def hex(number): # real signature unknown; restored from __doc__
"""
return ""
-
def id(p_object): # real signature unknown; restored from __doc__
"""
id(object) -> integer
@@ -263,7 +243,6 @@ def id(p_object): # real signature unknown; restored from __doc__
"""
return 0
-
def input(prompt=None): # real signature unknown; restored from __doc__
"""
input([prompt]) -> string
@@ -275,7 +254,6 @@ def input(prompt=None): # real signature unknown; restored from __doc__
"""
return ""
-
def isinstance(p_object, class_or_type_or_tuple): # real signature unknown; restored from __doc__
"""
isinstance(object, class-or-type-or-tuple) -> bool
@@ -287,7 +265,6 @@ def isinstance(p_object, class_or_type_or_tuple): # real signature unknown; rest
"""
return False
-
def issubclass(C, B): # real signature unknown; restored from __doc__
"""
issubclass(C, B) -> bool
@@ -298,7 +275,6 @@ def issubclass(C, B): # real signature unknown; restored from __doc__
"""
return False
-
def iter(source, sentinel=None): # known special case of iter
"""
iter(iterable) -> iterator
@@ -310,7 +286,6 @@ def iter(source, sentinel=None): # known special case of iter
"""
pass
-
def len(p_object): # real signature unknown; restored from __doc__
"""
len(object) -> integer
@@ -319,7 +294,6 @@ def len(p_object): # real signature unknown; restored from __doc__
"""
return 0
-
def license(*args, **kwargs): # real signature unknown
"""
interactive prompt objects for printing the license text, a list of
@@ -327,7 +301,6 @@ def license(*args, **kwargs): # real signature unknown
"""
pass
-
def locals(): # real signature unknown; restored from __doc__
"""
locals() -> dictionary
@@ -336,7 +309,6 @@ def locals(): # real signature unknown; restored from __doc__
"""
return {}
-
def max(*args, key=None): # known special case of max
"""
max(iterable[, key=func]) -> value
@@ -347,7 +319,6 @@ def max(*args, key=None): # known special case of max
"""
pass
-
def min(*args, key=None): # known special case of min
"""
min(iterable[, key=func]) -> value
@@ -358,7 +329,6 @@ def min(*args, key=None): # known special case of min
"""
pass
-
def next(iterator, default=None): # real signature unknown; restored from __doc__
"""
next(iterator[, default])
@@ -368,7 +338,6 @@ def next(iterator, default=None): # real signature unknown; restored from __doc_
"""
pass
-
def oct(number): # real signature unknown; restored from __doc__
"""
oct(number) -> string
@@ -377,7 +346,6 @@ def oct(number): # real signature unknown; restored from __doc__
"""
return ""
-
def open(file, mode='r', buffering=None, encoding=None, errors=None, newline=None, closefd=True): # known special case of open
"""
open(file, mode='r', buffering=-1, encoding=None,
@@ -468,9 +436,9 @@ def open(file, mode='r', buffering=None, encoding=None, errors=None, newline=Non
* On output, if newline is None, any '\n' characters written are
translated to the system default line separator, os.linesep. If
- newline is '', no translation takes place. If newline is any of the
- other legal values, any '\n' characters written are translated to
- the given string.
+ newline is '' or '\n', no translation takes place. If newline is any
+ of the other legal values, any '\n' characters written are translated
+ to the given string.
If closefd is False, the underlying file descriptor will be kept open
when the file is closed. This does not work when a file name is given
@@ -492,16 +460,15 @@ def open(file, mode='r', buffering=None, encoding=None, errors=None, newline=Non
"""
pass
-
def ord(c): # real signature unknown; restored from __doc__
"""
ord(c) -> integer
Return the integer ordinal of a one-character string.
+ A valid surrogate pair is also accepted.
"""
return 0
-
def pow(x, y, z=None): # real signature unknown; restored from __doc__
"""
pow(x, y[, z]) -> number
@@ -511,7 +478,6 @@ def pow(x, y, z=None): # real signature unknown; restored from __doc__
"""
return 0
-
def print(*args, sep=' ', end='\n', file=None): # known special case of print
"""
print(value, ..., sep=' ', end='\n', file=sys.stdout)
@@ -524,11 +490,9 @@ def print(*args, sep=' ', end='\n', file=None): # known special case of print
"""
pass
-
def quit(*args, **kwargs): # real signature unknown
pass
-
def repr(p_object): # real signature unknown; restored from __doc__
"""
repr(object) -> string
@@ -538,7 +502,6 @@ def repr(p_object): # real signature unknown; restored from __doc__
"""
return ""
-
def round(number, ndigits=None): # real signature unknown; restored from __doc__
"""
round(number[, ndigits]) -> number
@@ -549,7 +512,6 @@ def round(number, ndigits=None): # real signature unknown; restored from __doc__
"""
return 0
-
def setattr(p_object, name, value): # real signature unknown; restored from __doc__
"""
setattr(object, name, value)
@@ -559,12 +521,10 @@ def setattr(p_object, name, value): # real signature unknown; restored from __do
"""
pass
-
def sorted(iterable, key=None, reverse=False): # real signature unknown; restored from __doc__
""" sorted(iterable, key=None, reverse=False) --> new sorted list """
pass
-
def sum(iterable, start=None): # real signature unknown; restored from __doc__
"""
sum(iterable[, start]) -> value
@@ -575,7 +535,6 @@ def sum(iterable, start=None): # real signature unknown; restored from __doc__
"""
pass
-
def vars(p_object=None): # real signature unknown; restored from __doc__
"""
vars([object]) -> dictionary
@@ -585,7 +544,6 @@ def vars(p_object=None): # real signature unknown; restored from __doc__
"""
return {}
-
def __build_class__(func, name, *bases, metaclass=None, **kwds): # real signature unknown; restored from __doc__
"""
__build_class__(func, name, *bases, metaclass=None, **kwds) -> class
@@ -594,7 +552,6 @@ def __build_class__(func, name, *bases, metaclass=None, **kwds): # real signatur
"""
pass
-
def __import__(name, globals={}, locals={}, fromlist=[], level=-1): # real signature unknown; restored from __doc__
"""
__import__(name, globals={}, locals={}, fromlist=[], level=-1) -> module
@@ -616,9 +573,84 @@ def __import__(name, globals={}, locals={}, fromlist=[], level=-1): # real signa
"""
pass
-
# classes
+
+class __generator(object):
+ '''A mock class representing the generator function type.'''
+ def __init__(self):
+ self.gi_code = None
+ self.gi_frame = None
+ self.gi_running = 0
+
+ def __iter__(self):
+ '''Defined to support iteration over container.'''
+ pass
+
+ def __next__(self):
+ '''Return the next item from the container.'''
+ pass
+
+ def close(self):
+ '''Raises new GeneratorExit exception inside the generator to terminate the iteration.'''
+ pass
+
+ def send(self, value):
+ '''Resumes the generator and "sends" a value that becomes the result of the current yield-expression.'''
+ pass
+
+ def throw(self, type, value=None, traceback=None):
+ '''Used to raise an exception inside the generator.'''
+ pass
+
+
+class __function(object):
+ '''A mock class representing function type.'''
+
+ def __init__(self):
+ self.__name__ = ''
+ self.__doc__ = ''
+ self.__dict__ = ''
+ self.__module__ = ''
+
+ self.__annotations__ = {}
+ self.__defaults__ = {}
+ self.__globals__ = {}
+ self.__kwdefaults__ = {}
+ self.__closure__ = None
+ self.__code__ = None
+ self.__name__ = ''
+
+
+class __namedtuple(tuple):
+ '''A mock base class for named tuples.'''
+
+ __slots__ = ()
+ _fields = ()
+
+ def __new__(cls, *args, **kwargs):
+ 'Create a new instance of the named tuple.'
+ return tuple.__new__(cls, *args)
+
+ @classmethod
+ def _make(cls, iterable, new=tuple.__new__, len=len):
+ 'Make a new named tuple object from a sequence or iterable.'
+ return new(cls, iterable)
+
+ def __repr__(self):
+ return ''
+
+ def _asdict(self):
+ 'Return a new dict which maps field types to their values.'
+ return {}
+
+ def _replace(self, **kwargs):
+ 'Return a new named tuple object replacing specified fields with new values.'
+ return self
+
+ def __getnewargs__(self):
+ return tuple(self)
+
class object:
""" The most base type """
def __delattr__(self, name): # real signature unknown; restored from __doc__
@@ -715,6 +747,8 @@ class object:
__module__ = ''
+from .object import object
+
class BaseException(object):
""" Common base class for all exceptions """
def with_traceback(self, tb): # real signature unknown; restored from __doc__
@@ -758,14 +792,22 @@ class BaseException(object):
""" x.__str__() <==> str(x) """
pass
- args = property(lambda self: object()) # default
- __cause__ = property(lambda self: object()) # default
- __context__ = property(lambda self: object()) # default
- __traceback__ = property(lambda self: object()) # default
+ args = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
+
+ __cause__ = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
+ """exception cause"""
+
+ __context__ = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
+ """exception context"""
+
+ __traceback__ = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
+
__dict__ = None # (!) real value is ''
+from .BaseException import BaseException
+
class Exception(BaseException):
""" Common base class for all non-exit exceptions. """
def __init__(self, *args, **kwargs): # real signature unknown
@@ -777,6 +819,8 @@ class Exception(BaseException):
pass
+from .Exception import Exception
+
class ArithmeticError(Exception):
""" Base class for arithmetic errors. """
def __init__(self, *args, **kwargs): # real signature unknown
@@ -788,6 +832,8 @@ class ArithmeticError(Exception):
pass
+from .Exception import Exception
+
class AssertionError(Exception):
""" Assertion failed. """
def __init__(self, *args, **kwargs): # real signature unknown
@@ -799,6 +845,8 @@ class AssertionError(Exception):
pass
+from .Exception import Exception
+
class AttributeError(Exception):
""" Attribute not found. """
def __init__(self, *args, **kwargs): # real signature unknown
@@ -810,15 +858,24 @@ class AttributeError(Exception):
pass
+from .object import object
+
class int(object):
"""
- int(x[, base]) -> integer
+ int(x=0) -> integer
+ int(x, base=10) -> integer
- Convert a string or number to an integer, if possible. A floating
- point argument will be truncated towards zero (this does not include a
- string representation of a floating point number!) When converting a
- string, use the optional base. It is an error to supply a base when
- converting a non-string.
+ Convert a number or string to an integer, or return 0 if no arguments
+ are given. If x is a number, return x.__int__(). For floating point
+ numbers, this truncates towards zero.
+
+ If x is not a number or if base is given, then x must be a string,
+ bytes, or bytearray instance representing an integer literal in the
+ given base. The literal can be preceded by '+' or '-' and be surrounded
+ by whitespace. The base defaults to 10. Valid bases are 0 and 2-36.
+ Base 0 means to interpret the base from the string as an integer literal.
+ >>> int('0b100', base=0)
+ 4
"""
def bit_length(self): # real signature unknown; restored from __doc__
"""
@@ -836,7 +893,8 @@ class int(object):
""" Returns self, the complex conjugate of any int. """
pass
- def from_bytes(self, bytes, byteorder, *args, **kwargs): # real signature unknown; NOTE: unreliably restored from __doc__
+ @classmethod # known case
+ def from_bytes(cls, bytes, byteorder, *args, **kwargs): # real signature unknown; NOTE: unreliably restored from __doc__
"""
int.from_bytes(bytes, byteorder, *, signed=False) -> int
@@ -947,13 +1005,20 @@ class int(object):
def __init__(self, x, base=10): # known special case of int.__init__
"""
- int(x[, base]) -> integer
+ int(x=0) -> integer
+ int(x, base=10) -> integer
+
+ Convert a number or string to an integer, or return 0 if no arguments
+ are given. If x is a number, return x.__int__(). For floating point
+ numbers, this truncates towards zero.
- Convert a string or number to an integer, if possible. A floating
- point argument will be truncated towards zero (this does not include a
- string representation of a floating point number!) When converting a
- string, use the optional base. It is an error to supply a base when
- converting a non-string.
+ If x is not a number or if base is given, then x must be a string,
+ bytes, or bytearray instance representing an integer literal in the
+ given base. The literal can be preceded by '+' or '-' and be surrounded
+ by whitespace. The base defaults to 10. Valid bases are 0 and 2-36.
+ Base 0 means to interpret the base from the string as an integer literal.
+ >>> int('0b100', base=0)
+ 4
# (copied from class doc)
"""
pass
@@ -1102,11 +1167,21 @@ class int(object):
""" x.__xor__(y) <==> x^y """
pass
- denominator = property(lambda self: object()) # default
- imag = property(lambda self: object()) # default
- numerator = property(lambda self: object()) # default
- real = property(lambda self: object()) # default
+ denominator = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
+ """the denominator of a rational number in lowest terms"""
+
+ imag = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
+ """the imaginary part of a complex number"""
+
+ numerator = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
+ """the numerator of a rational number in lowest terms"""
+ real = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
+ """the real part of a complex number"""
+
+
+
+from .int import int
class bool(int):
"""
@@ -1157,6 +1232,8 @@ class bool(int):
pass
+from .Exception import Exception
+
class BufferError(Exception):
""" Buffer error. """
def __init__(self, *args, **kwargs): # real signature unknown
@@ -1168,22 +1245,22 @@ class BufferError(Exception):
pass
+from .object import object
+
class bytearray(object):
"""
bytearray(iterable_of_ints) -> bytearray
bytearray(string, encoding[, errors]) -> bytearray
- bytearray(bytes_or_bytearray) -> mutable copy of bytes_or_bytearray
- bytearray(memory_view) -> bytearray
+ bytearray(bytes_or_buffer) -> mutable copy of bytes_or_buffer
+ bytearray(int) -> bytes array of size given by the parameter initialized with null bytes
+ bytearray() -> empty bytes array
Construct an mutable bytearray object from:
- an iterable yielding integers in range(256)
- a text string encoded using the specified encoding
- - a bytes or a bytearray object
+ - a bytes or a buffer object
- any object implementing the buffer API.
-
- bytearray(int) -> bytearray
-
- Construct a zero-initialized bytearray of the given length.
+ - an integer
"""
def append(self, p_int): # real signature unknown; restored from __doc__
"""
@@ -1662,18 +1739,16 @@ class bytearray(object):
"""
bytearray(iterable_of_ints) -> bytearray
bytearray(string, encoding[, errors]) -> bytearray
- bytearray(bytes_or_bytearray) -> mutable copy of bytes_or_bytearray
- bytearray(memory_view) -> bytearray
+ bytearray(bytes_or_buffer) -> mutable copy of bytes_or_buffer
+ bytearray(int) -> bytes array of size given by the parameter initialized with null bytes
+ bytearray() -> empty bytes array
Construct an mutable bytearray object from:
- an iterable yielding integers in range(256)
- a text string encoded using the specified encoding
- - a bytes or a bytearray object
+ - a bytes or a buffer object
- any object implementing the buffer API.
-
- bytearray(int) -> bytearray
-
- Construct a zero-initialized bytearray of the given length.
+ - an integer
# (copied from class doc)
"""
pass
@@ -1738,18 +1813,21 @@ class bytearray(object):
__hash__ = None
+from .object import object
+
class bytes(object):
"""
bytes(iterable_of_ints) -> bytes
bytes(string, encoding[, errors]) -> bytes
bytes(bytes_or_buffer) -> immutable copy of bytes_or_buffer
- bytes(memory_view) -> bytes
+ bytes(int) -> bytes object of size given by the parameter initialized with null bytes
+ bytes() -> empty bytes object
Construct an immutable array of bytes from:
- an iterable yielding integers in range(256)
- a text string encoded using the specified encoding
- - a bytes or a buffer object
- any object implementing the buffer API.
+ - an integer
"""
def capitalize(self): # real signature unknown; restored from __doc__
"""
@@ -2073,7 +2151,7 @@ class bytes(object):
B.strip([bytes]) -> bytes
Strip leading and trailing bytes contained in the argument.
- If the argument is omitted, strip trailing ASCII whitespace.
+ If the argument is omitted, strip leading and trailing ASCII whitespace.
"""
return b""
@@ -2163,13 +2241,14 @@ class bytes(object):
bytes(iterable_of_ints) -> bytes
bytes(string, encoding[, errors]) -> bytes
bytes(bytes_or_buffer) -> immutable copy of bytes_or_buffer
- bytes(memory_view) -> bytes
+ bytes(int) -> bytes object of size given by the parameter initialized with null bytes
+ bytes() -> empty bytes object
Construct an immutable array of bytes from:
- an iterable yielding integers in range(256)
- a text string encoded using the specified encoding
- - a bytes or a buffer object
- any object implementing the buffer API.
+ - an integer
# (copied from class doc)
"""
pass
@@ -2220,6 +2299,8 @@ class bytes(object):
pass
+from .Exception import Exception
+
class Warning(Exception):
""" Base class for warning categories. """
def __init__(self, *args, **kwargs): # real signature unknown
@@ -2231,6 +2312,8 @@ class Warning(Exception):
pass
+from .Warning import Warning
+
class BytesWarning(Warning):
"""
Base class for warnings about bytes and buffer related problems, mostly
@@ -2245,6 +2328,8 @@ class BytesWarning(Warning):
pass
+from .object import object
+
class classmethod(object):
"""
classmethod(function) -> method
@@ -2283,9 +2368,12 @@ class classmethod(object):
""" T.__new__(S, ...) -> a new object with type S, a subtype of T """
pass
- __func__ = property(lambda self: object()) # default
+ __func__ = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
+
+from .object import object
+
class complex(object):
"""
complex(real[, imag]) -> complex number
@@ -2449,8 +2537,20 @@ class complex(object):
pass
imag = property(lambda self: 0.0)
+ """the imaginary part of a complex number
+
+ :type: float
+ """
+
real = property(lambda self: 0.0)
+ """the real part of a complex number
+
+ :type: float
+ """
+
+
+from .Warning import Warning
class DeprecationWarning(Warning):
""" Base class for warnings about deprecated features. """
@@ -2463,6 +2563,8 @@ class DeprecationWarning(Warning):
pass
+from .object import object
+
class dict(object):
"""
dict() -> new empty dictionary
@@ -2523,9 +2625,9 @@ class dict(object):
def update(self, E=None, **F): # known special case of dict.update
"""
- D.update(E, **F) -> None. Update D from dict/iterable E and F.
- If E has a .keys() method, does: for k in E: D[k] = E[k]
- If E lacks .keys() method, does: for (k, v) in E: D[k] = v
+ D.update([E, ]**F) -> None. Update D from dict/iterable E and F.
+ If E present and has a .keys() method, does: for k in E: D[k] = E[k]
+ If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v
In either case, this is followed by: for k in F: D[k] = F[k]
"""
pass
@@ -2617,6 +2719,8 @@ class dict(object):
__hash__ = None
+from .object import object
+
class enumerate(object):
"""
enumerate(iterable[, start]) -> iterator for index, value of iterable
@@ -2649,6 +2753,8 @@ class enumerate(object):
pass
+from .Exception import Exception
+
class EnvironmentError(Exception):
""" Base class for I/O related errors. """
def __init__(self, *args, **kwargs): # real signature unknown
@@ -2666,11 +2772,19 @@ class EnvironmentError(Exception):
""" x.__str__() <==> str(x) """
pass
- errno = property(lambda self: object()) # default
- filename = property(lambda self: object()) # default
- strerror = property(lambda self: object()) # default
+ errno = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
+ """exception errno"""
+
+ filename = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
+ """exception filename"""
+
+ strerror = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
+ """exception strerror"""
+
+from .Exception import Exception
+
class EOFError(Exception):
""" Read beyond end of file. """
def __init__(self, *args, **kwargs): # real signature unknown
@@ -2682,6 +2796,8 @@ class EOFError(Exception):
pass
+from .object import object
+
class filter(object):
"""
filter(function or None, iterable) --> filter object
@@ -2710,6 +2826,8 @@ class filter(object):
pass
+from .object import object
+
class float(object):
"""
float(x) -> floating point number
@@ -2952,10 +3070,16 @@ class float(object):
""" Returns the Integral closest to x between 0 and x. """
pass
- imag = property(lambda self: object()) # default
- real = property(lambda self: object()) # default
+ imag = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
+ """the imaginary part of a complex number"""
+
+ real = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
+ """the real part of a complex number"""
+
+from .ArithmeticError import ArithmeticError
+
class FloatingPointError(ArithmeticError):
""" Floating point operation failed. """
def __init__(self, *args, **kwargs): # real signature unknown
@@ -2967,6 +3091,8 @@ class FloatingPointError(ArithmeticError):
pass
+from .object import object
+
class frozenset(object):
"""
frozenset() -> empty frozenset object
@@ -3120,6 +3246,8 @@ class frozenset(object):
pass
+from .Warning import Warning
+
class FutureWarning(Warning):
"""
Base class for warnings about constructs that will change semantically
@@ -3134,6 +3262,8 @@ class FutureWarning(Warning):
pass
+from .BaseException import BaseException
+
class GeneratorExit(BaseException):
""" Request that a generator exit. """
def __init__(self, *args, **kwargs): # real signature unknown
@@ -3145,6 +3275,8 @@ class GeneratorExit(BaseException):
pass
+from .Exception import Exception
+
class ImportError(Exception):
""" Import can't find module, or can't find name in module. """
def __init__(self, *args, **kwargs): # real signature unknown
@@ -3156,6 +3288,8 @@ class ImportError(Exception):
pass
+from .Warning import Warning
+
class ImportWarning(Warning):
""" Base class for warnings about probable mistakes in module imports """
def __init__(self, *args, **kwargs): # real signature unknown
@@ -3167,6 +3301,8 @@ class ImportWarning(Warning):
pass
+from .Exception import Exception
+
class SyntaxError(Exception):
""" Invalid syntax. """
def __init__(self, *args, **kwargs): # real signature unknown
@@ -3181,13 +3317,27 @@ class SyntaxError(Exception):
""" x.__str__() <==> str(x) """
pass
- filename = property(lambda self: object()) # default
- lineno = property(lambda self: object()) # default
- msg = property(lambda self: object()) # default
- offset = property(lambda self: object()) # default
- print_file_and_line = property(lambda self: object()) # default
- text = property(lambda self: object()) # default
+ filename = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
+ """exception filename"""
+
+ lineno = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
+ """exception lineno"""
+
+ msg = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
+ """exception msg"""
+
+ offset = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
+ """exception offset"""
+ print_file_and_line = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
+ """exception print_file_and_line"""
+
+ text = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
+ """exception text"""
+
+
+
+from .SyntaxError import SyntaxError
class IndentationError(SyntaxError):
""" Improper indentation. """
@@ -3200,6 +3350,8 @@ class IndentationError(SyntaxError):
pass
+from .Exception import Exception
+
class LookupError(Exception):
""" Base class for lookup errors. """
def __init__(self, *args, **kwargs): # real signature unknown
@@ -3211,6 +3363,8 @@ class LookupError(Exception):
pass
+from .LookupError import LookupError
+
class IndexError(LookupError):
""" Sequence index out of range. """
def __init__(self, *args, **kwargs): # real signature unknown
@@ -3222,6 +3376,8 @@ class IndexError(LookupError):
pass
+from .EnvironmentError import EnvironmentError
+
class IOError(EnvironmentError):
""" I/O operation failed. """
def __init__(self, *args, **kwargs): # real signature unknown
@@ -3233,6 +3389,8 @@ class IOError(EnvironmentError):
pass
+from .BaseException import BaseException
+
class KeyboardInterrupt(BaseException):
""" Program interrupted by user. """
def __init__(self, *args, **kwargs): # real signature unknown
@@ -3244,6 +3402,8 @@ class KeyboardInterrupt(BaseException):
pass
+from .LookupError import LookupError
+
class KeyError(LookupError):
""" Mapping key not found. """
def __init__(self, *args, **kwargs): # real signature unknown
@@ -3259,6 +3419,8 @@ class KeyError(LookupError):
pass
+from .object import object
+
class list(object):
"""
list() -> new empty list
@@ -3409,6 +3571,8 @@ class list(object):
__hash__ = None
+from .object import object
+
class map(object):
"""
map(func, *iterables) --> map object
@@ -3437,6 +3601,8 @@ class map(object):
pass
+from .Exception import Exception
+
class MemoryError(Exception):
""" Out of memory. """
def __init__(self, *args, **kwargs): # real signature unknown
@@ -3448,20 +3614,37 @@ class MemoryError(Exception):
pass
+from .object import object
+
class memoryview(object):
"""
memoryview(object)
Create a new memoryview object which references the given object.
"""
- def release(self, *args, **kwargs): # real signature unknown
+ def release(self): # real signature unknown; restored from __doc__
+ """
+ M.release() -> None
+
+ Release the underlying buffer exposed by the memoryview object.
+ """
pass
- def tobytes(self, *args, **kwargs): # real signature unknown
- pass
+ def tobytes(self): # real signature unknown; restored from __doc__
+ """
+ M.tobytes() -> bytes
+
+ Return the data in the buffer as a byte string.
+ """
+ return b""
- def tolist(self, *args, **kwargs): # real signature unknown
- pass
+ def tolist(self): # real signature unknown; restored from __doc__
+ """
+ M.tolist() -> list
+
+ Return the data in the buffer as a list of elements.
+ """
+ return []
def __delitem__(self, y): # real signature unknown; restored from __doc__
""" x.__delitem__(y) <==> del x[y] """
@@ -3525,17 +3708,37 @@ class memoryview(object):
""" x.__setitem__(i, y) <==> x[i]=y """
pass
- format = property(lambda self: object()) # default
- itemsize = property(lambda self: object()) # default
- ndim = property(lambda self: object()) # default
- readonly = property(lambda self: object()) # default
- shape = property(lambda self: object()) # default
- strides = property(lambda self: object()) # default
- suboffsets = property(lambda self: object()) # default
+ format = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
+ """A string containing the format (in struct module style)
+ for each element in the view."""
+
+ itemsize = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
+ """The size in bytes of each element of the memoryview."""
+
+ ndim = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
+ """An integer indicating how many dimensions of a multi-dimensional
+ array the memory represents."""
+
+ readonly = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
+ """A bool indicating whether the memory is read only."""
+
+ shape = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
+ """A tuple of ndim integers giving the shape of the memory
+ as an N-dimensional array."""
+
+ strides = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
+ """A tuple of ndim integers giving the size in bytes to access
+ each element for each dimension of the array."""
+
+ suboffsets = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
+ """A tuple of integers used internally for PIL-style arrays."""
+
__hash__ = None
+from .Exception import Exception
+
class NameError(Exception):
""" Name not found globally. """
def __init__(self, *args, **kwargs): # real signature unknown
@@ -3547,6 +3750,8 @@ class NameError(Exception):
pass
+from .Exception import Exception
+
class RuntimeError(Exception):
""" Unspecified run-time error. """
def __init__(self, *args, **kwargs): # real signature unknown
@@ -3558,6 +3763,8 @@ class RuntimeError(Exception):
pass
+from .RuntimeError import RuntimeError
+
class NotImplementedError(RuntimeError):
""" Method or function hasn't been implemented yet. """
def __init__(self, *args, **kwargs): # real signature unknown
@@ -3569,6 +3776,8 @@ class NotImplementedError(RuntimeError):
pass
+from .EnvironmentError import EnvironmentError
+
class OSError(EnvironmentError):
""" OS system call failed. """
def __init__(self, *args, **kwargs): # real signature unknown
@@ -3580,6 +3789,8 @@ class OSError(EnvironmentError):
pass
+from .ArithmeticError import ArithmeticError
+
class OverflowError(ArithmeticError):
""" Result too large to be represented. """
def __init__(self, *args, **kwargs): # real signature unknown
@@ -3591,6 +3802,8 @@ class OverflowError(ArithmeticError):
pass
+from .Warning import Warning
+
class PendingDeprecationWarning(Warning):
"""
Base class for warnings about features which will be deprecated
@@ -3605,6 +3818,8 @@ class PendingDeprecationWarning(Warning):
pass
+from .object import object
+
class property(object):
"""
property(fget=None, fset=None, fdel=None, doc=None) -> property attribute
@@ -3686,14 +3901,20 @@ class property(object):
""" descr.__set__(obj, value) """
pass
- fdel = property(lambda self: object()) # default
- fget = property(lambda self: object()) # default
- fset = property(lambda self: object()) # default
+ fdel = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
+
+ fget = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
+
+ fset = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
+
+from .object import object
+
class range(object):
"""
- range([start,] stop[, step]) -> range object
+ range(stop) -> range object
+ range(start, stop[, step]) -> range object
Returns a virtual sequence of numbers from start to stop by step.
"""
@@ -3720,7 +3941,7 @@ class range(object):
""" x.__getitem__(y) <==> x[y] """
pass
- def __init__(self, start=None, *args, **kwargs): # real signature unknown; NOTE: unreliably restored from __doc__
+ def __init__(self, stop): # real signature unknown; restored from __doc__
pass
def __iter__(self): # real signature unknown; restored from __doc__
@@ -3748,6 +3969,8 @@ class range(object):
pass
+from .Exception import Exception
+
class ReferenceError(Exception):
""" Weak ref proxy used after referent went away. """
def __init__(self, *args, **kwargs): # real signature unknown
@@ -3759,6 +3982,8 @@ class ReferenceError(Exception):
pass
+from .Warning import Warning
+
class ResourceWarning(Warning):
""" Base class for warnings about resource usage. """
def __init__(self, *args, **kwargs): # real signature unknown
@@ -3770,6 +3995,8 @@ class ResourceWarning(Warning):
pass
+from .object import object
+
class reversed(object):
"""
reversed(sequence) -> reverse iterator over values of the sequence
@@ -3801,6 +4028,8 @@ class reversed(object):
pass
+from .Warning import Warning
+
class RuntimeWarning(Warning):
""" Base class for warnings about dubious runtime behavior. """
def __init__(self, *args, **kwargs): # real signature unknown
@@ -3812,6 +4041,8 @@ class RuntimeWarning(Warning):
pass
+from .object import object
+
class set(object):
"""
set() -> new empty set object
@@ -3943,7 +4174,7 @@ class set(object):
pass
def __iand__(self, y): # real signature unknown; restored from __doc__
- """ x.__iand__(y) <==> x&y """
+ """ x.__iand__(y) <==> x&=y """
pass
def __init__(self, seq=()): # known special case of set.__init__
@@ -3957,11 +4188,11 @@ class set(object):
pass
def __ior__(self, y): # real signature unknown; restored from __doc__
- """ x.__ior__(y) <==> x|y """
+ """ x.__ior__(y) <==> x|=y """
pass
def __isub__(self, y): # real signature unknown; restored from __doc__
- """ x.__isub__(y) <==> x-y """
+ """ x.__isub__(y) <==> x-=y """
pass
def __iter__(self): # real signature unknown; restored from __doc__
@@ -3969,7 +4200,7 @@ class set(object):
pass
def __ixor__(self, y): # real signature unknown; restored from __doc__
- """ x.__ixor__(y) <==> x^y """
+ """ x.__ixor__(y) <==> x^=y """
pass
def __len__(self): # real signature unknown; restored from __doc__
@@ -4036,9 +4267,12 @@ class set(object):
__hash__ = None
+from .object import object
+
class slice(object):
"""
- slice([start,] stop[, step])
+ slice(stop)
+ slice(start, stop[, step])
Create a slice object. This is used for extended slicing (e.g. a[0:10:2]).
"""
@@ -4069,7 +4303,7 @@ class slice(object):
""" x.__gt__(y) <==> x>y """
pass
- def __init__(self, start=None, *args, **kwargs): # real signature unknown; NOTE: unreliably restored from __doc__
+ def __init__(self, stop): # real signature unknown; restored from __doc__
pass
def __le__(self, y): # real signature unknown; restored from __doc__
@@ -4098,12 +4332,20 @@ class slice(object):
pass
start = property(lambda self: 0)
+ """:type: int"""
+
step = property(lambda self: 0)
+ """:type: int"""
+
stop = property(lambda self: 0)
+ """:type: int"""
+
__hash__ = None
+from .object import object
+
class staticmethod(object):
"""
staticmethod(function) -> method
@@ -4139,9 +4381,12 @@ class staticmethod(object):
""" T.__new__(S, ...) -> a new object with type S, a subtype of T """
pass
- __func__ = property(lambda self: object()) # default
+ __func__ = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
+
+from .Exception import Exception
+
class StopIteration(Exception):
""" Signal the end from iterator.__next__(). """
def __init__(self, *args, **kwargs): # real signature unknown
@@ -4153,13 +4398,20 @@ class StopIteration(Exception):
pass
+from .object import object
+
class str(object):
"""
- str(string[, encoding[, errors]]) -> str
+ str(object='') -> str
+ str(bytes_or_buffer[, encoding[, errors]]) -> str
- Create a new string object from the given encoded string.
- encoding defaults to the current default string encoding.
- errors can be 'strict', 'replace' or 'ignore' and defaults to 'strict'.
+ Create a new string object from the given object. If encoding or
+ errors is specified, then the object must expose a data buffer
+ that will be decoded using the given encoding and error handler.
+ Otherwise, returns the result of object.__str__() (if defined)
+ or repr(object).
+ encoding defaults to sys.getdefaultencoding().
+ errors defaults to 'strict'.
"""
def capitalize(self): # real signature unknown; restored from __doc__
"""
@@ -4234,14 +4486,14 @@ class str(object):
"""
return 0
- def format(self, *args, **kwargs): # real signature unknown; restored from __doc__
+ def format(*args, **kwargs): # known special case of str.format
"""
S.format(*args, **kwargs) -> str
Return a formatted version of S, using substitutions from args and kwargs.
The substitutions are identified by braces ('{' and '}').
"""
- return ""
+ pass
def format_map(self, mapping): # real signature unknown; restored from __doc__
"""
@@ -4626,11 +4878,16 @@ class str(object):
def __init__(self, value='', encoding=None, errors='strict'): # known special case of str.__init__
"""
- str(string[, encoding[, errors]]) -> str
+ str(object='') -> str
+ str(bytes_or_buffer[, encoding[, errors]]) -> str
- Create a new string object from the given encoded string.
- encoding defaults to the current default string encoding.
- errors can be 'strict', 'replace' or 'ignore' and defaults to 'strict'.
+ Create a new string object from the given object. If encoding or
+ errors is specified, then the object must expose a data buffer
+ that will be decoded using the given encoding and error handler.
+ Otherwise, returns the result of object.__str__() (if defined)
+ or repr(object).
+ encoding defaults to sys.getdefaultencoding().
+ errors defaults to 'strict'.
# (copied from class doc)
"""
pass
@@ -4689,6 +4946,8 @@ class str(object):
pass
+from .object import object
+
class super(object):
"""
super() -> same as super(__class__, <first argument>)
@@ -4743,10 +5002,27 @@ class super(object):
pass
__self_class__ = property(lambda self: type(object))
+ """the type of the instance invoking super(); may be None
+
+ :type: type
+ """
+
__self__ = property(lambda self: type(object))
+ """the instance invoking super(); may be None
+
+ :type: type
+ """
+
__thisclass__ = property(lambda self: type(object))
+ """the class invoking super()
+
+ :type: type
+ """
+
+from .Warning import Warning
+
class SyntaxWarning(Warning):
""" Base class for warnings about dubious syntax. """
def __init__(self, *args, **kwargs): # real signature unknown
@@ -4758,6 +5034,8 @@ class SyntaxWarning(Warning):
pass
+from .Exception import Exception
+
class SystemError(Exception):
"""
Internal error in the Python interpreter.
@@ -4774,6 +5052,8 @@ class SystemError(Exception):
pass
+from .BaseException import BaseException
+
class SystemExit(BaseException):
""" Request to exit from the interpreter. """
def __init__(self, *args, **kwargs): # real signature unknown
@@ -4784,9 +5064,13 @@ class SystemExit(BaseException):
""" T.__new__(S, ...) -> a new object with type S, a subtype of T """
pass
- code = property(lambda self: object()) # default
+ code = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
+ """exception code"""
+
+from .IndentationError import IndentationError
+
class TabError(IndentationError):
""" Improper mixture of spaces and tabs. """
def __init__(self, *args, **kwargs): # real signature unknown
@@ -4798,6 +5082,8 @@ class TabError(IndentationError):
pass
+from .object import object
+
class tuple(object):
"""
tuple() -> empty tuple
@@ -4903,6 +5189,8 @@ class tuple(object):
pass
+from .object import object
+
class type(object):
"""
type(object) -> the object's type
@@ -4973,7 +5261,8 @@ class type(object):
""" __subclasses__() -> list of immediate subclasses """
return []
- __abstractmethods__ = property(lambda self: object()) # default
+ __abstractmethods__ = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
+
__bases__ = (
object,
@@ -4992,6 +5281,8 @@ class type(object):
__weakrefoffset__ = 368
+from .Exception import Exception
+
class TypeError(Exception):
""" Inappropriate argument type. """
def __init__(self, *args, **kwargs): # real signature unknown
@@ -5003,6 +5294,8 @@ class TypeError(Exception):
pass
+from .NameError import NameError
+
class UnboundLocalError(NameError):
""" Local name referenced but not bound to a value. """
def __init__(self, *args, **kwargs): # real signature unknown
@@ -5014,6 +5307,8 @@ class UnboundLocalError(NameError):
pass
+from .Exception import Exception
+
class ValueError(Exception):
""" Inappropriate argument value (of correct type). """
def __init__(self, *args, **kwargs): # real signature unknown
@@ -5025,6 +5320,8 @@ class ValueError(Exception):
pass
+from .ValueError import ValueError
+
class UnicodeError(ValueError):
""" Unicode related error. """
def __init__(self, *args, **kwargs): # real signature unknown
@@ -5036,6 +5333,8 @@ class UnicodeError(ValueError):
pass
+from .UnicodeError import UnicodeError
+
class UnicodeDecodeError(UnicodeError):
""" Unicode decoding error. """
def __init__(self, *args, **kwargs): # real signature unknown
@@ -5050,12 +5349,24 @@ class UnicodeDecodeError(UnicodeError):
""" x.__str__() <==> str(x) """
pass
- encoding = property(lambda self: object()) # default
- end = property(lambda self: object()) # default
- object = property(lambda self: object()) # default
- reason = property(lambda self: object()) # default
- start = property(lambda self: object()) # default
+ encoding = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
+ """exception encoding"""
+
+ end = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
+ """exception end"""
+
+ object = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
+ """exception object"""
+ reason = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
+ """exception reason"""
+
+ start = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
+ """exception start"""
+
+
+
+from .UnicodeError import UnicodeError
class UnicodeEncodeError(UnicodeError):
""" Unicode encoding error. """
@@ -5071,12 +5382,24 @@ class UnicodeEncodeError(UnicodeError):
""" x.__str__() <==> str(x) """
pass
- encoding = property(lambda self: object()) # default
- end = property(lambda self: object()) # default
- object = property(lambda self: object()) # default
- reason = property(lambda self: object()) # default
- start = property(lambda self: object()) # default
+ encoding = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
+ """exception encoding"""
+
+ end = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
+ """exception end"""
+ object = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
+ """exception object"""
+
+ reason = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
+ """exception reason"""
+
+ start = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
+ """exception start"""
+
+
+
+from .UnicodeError import UnicodeError
class UnicodeTranslateError(UnicodeError):
""" Unicode translation error. """
@@ -5092,13 +5415,25 @@ class UnicodeTranslateError(UnicodeError):
""" x.__str__() <==> str(x) """
pass
- encoding = property(lambda self: object()) # default
- end = property(lambda self: object()) # default
- object = property(lambda self: object()) # default
- reason = property(lambda self: object()) # default
- start = property(lambda self: object()) # default
+ encoding = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
+ """exception encoding"""
+
+ end = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
+ """exception end"""
+
+ object = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
+ """exception object"""
+
+ reason = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
+ """exception reason"""
+
+ start = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
+ """exception start"""
+
+from .Warning import Warning
+
class UnicodeWarning(Warning):
"""
Base class for warnings about Unicode related problems, mostly
@@ -5113,6 +5448,8 @@ class UnicodeWarning(Warning):
pass
+from .Warning import Warning
+
class UserWarning(Warning):
""" Base class for warnings generated by user code. """
def __init__(self, *args, **kwargs): # real signature unknown
@@ -5124,6 +5461,8 @@ class UserWarning(Warning):
pass
+from .ArithmeticError import ArithmeticError
+
class ZeroDivisionError(ArithmeticError):
""" Second argument to a division or modulo operation was zero. """
def __init__(self, *args, **kwargs): # real signature unknown
@@ -5135,6 +5474,8 @@ class ZeroDivisionError(ArithmeticError):
pass
+from .object import object
+
class zip(object):
"""
zip(iter1 [,iter2 [...]]) --> zip object
@@ -5165,64 +5506,6 @@ class zip(object):
pass
-
-class __generator(object):
- '''A mock class representing the generator function type.'''
- def __init__(self):
- self.gi_code = None
- self.gi_frame = None
- self.gi_running = 0
-
- def __iter__(self):
- '''Defined to support iteration over container.'''
- pass
-
- def __next__(self):
- '''Return the next item from the container.'''
- pass
-
- def close(self):
- '''Raises new GeneratorExit exception inside the generator to terminate the iteration.'''
- pass
-
- def send(self, value):
- '''Resumes the generator and "sends" a value that becomes the result of the current yield-expression.'''
- pass
-
- def throw(self, type, value=None, traceback=None):
- '''Used to raise an exception inside the generator.'''
- pass
-
-
-class __namedtuple(tuple):
- '''A mock base class for named tuples.'''
-
- __slots__ = ()
- _fields = ()
-
- def __new__(cls, *args, **kwargs):
- 'Create a new instance of the named tuple.'
- return tuple.__new__(cls, *args)
-
- @classmethod
- def _make(cls, iterable, new=tuple.__new__, len=len):
- 'Make a new named tuple object from a sequence or iterable.'
- return new(cls, iterable)
-
- def __repr__(self):
- return ''
-
- def _asdict(self):
- 'Return a new dict which maps field types to their values.'
- return {}
-
- def _replace(self, **kwargs):
- 'Return a new named tuple object replacing specified fields with new values.'
- return self
-
- def __getnewargs__(self):
- return tuple(self)
-
# variables with complex values
Ellipsis = None # (!) real value is ''
diff --git a/python/testData/codeInsight/smartEnter/withTargetIncomplete.py b/python/testData/codeInsight/smartEnter/withTargetIncomplete.py
new file mode 100644
index 000000000000..a3214a35ffe1
--- /dev/null
+++ b/python/testData/codeInsight/smartEnter/withTargetIncomplete.py
@@ -0,0 +1 @@
+with open('file.txt') <caret>as \ No newline at end of file
diff --git a/python/testData/codeInsight/smartEnter/withTargetIncomplete_after.py b/python/testData/codeInsight/smartEnter/withTargetIncomplete_after.py
new file mode 100644
index 000000000000..72892c552212
--- /dev/null
+++ b/python/testData/codeInsight/smartEnter/withTargetIncomplete_after.py
@@ -0,0 +1 @@
+with open('file.txt') as <caret>: \ No newline at end of file
diff --git a/python/testData/codeInsight/smartEnter/withTargetOmitted.py b/python/testData/codeInsight/smartEnter/withTargetOmitted.py
new file mode 100644
index 000000000000..c1ba50b34f80
--- /dev/null
+++ b/python/testData/codeInsight/smartEnter/withTargetOmitted.py
@@ -0,0 +1 @@
+with o<caret>pen('file.txt') \ No newline at end of file
diff --git a/python/testData/codeInsight/smartEnter/withTargetOmitted_after.py b/python/testData/codeInsight/smartEnter/withTargetOmitted_after.py
new file mode 100644
index 000000000000..a9e851f0023d
--- /dev/null
+++ b/python/testData/codeInsight/smartEnter/withTargetOmitted_after.py
@@ -0,0 +1,2 @@
+with open('file.txt'):
+ <caret> \ No newline at end of file
diff --git a/python/testData/completion/modulePrivateNamesCompletedInsideImport/a.py b/python/testData/completion/modulePrivateNamesCompletedInsideImport/a.py
new file mode 100644
index 000000000000..4aa7c1830b82
--- /dev/null
+++ b/python/testData/completion/modulePrivateNamesCompletedInsideImport/a.py
@@ -0,0 +1 @@
+from module import <caret> \ No newline at end of file
diff --git a/python/testData/completion/modulePrivateNamesCompletedInsideImport/module.py b/python/testData/completion/modulePrivateNamesCompletedInsideImport/module.py
new file mode 100644
index 000000000000..0febd2f26c01
--- /dev/null
+++ b/python/testData/completion/modulePrivateNamesCompletedInsideImport/module.py
@@ -0,0 +1,3 @@
+normal_name = 'foo'
+_private_name = 'bar'
+__magic_name__ = 'baz' \ No newline at end of file
diff --git a/python/testData/inspections/PyUnresolvedReferencesInspection/PrivateModuleNames/a.py b/python/testData/inspections/PyUnresolvedReferencesInspection/PrivateModuleNames/a.py
new file mode 100644
index 000000000000..71615d7a4c6a
--- /dev/null
+++ b/python/testData/inspections/PyUnresolvedReferencesInspection/PrivateModuleNames/a.py
@@ -0,0 +1,5 @@
+from lib import *
+
+normal_name
+<error descr="Unresolved reference '_private_name'">_private_name</error>
+<error descr="Unresolved reference '__magic_name__'">__magic_name__</error> \ No newline at end of file
diff --git a/python/testData/inspections/PyUnresolvedReferencesInspection/PrivateModuleNames/lib.py b/python/testData/inspections/PyUnresolvedReferencesInspection/PrivateModuleNames/lib.py
new file mode 100644
index 000000000000..b92c948f871f
--- /dev/null
+++ b/python/testData/inspections/PyUnresolvedReferencesInspection/PrivateModuleNames/lib.py
@@ -0,0 +1,3 @@
+normal_name = 'spam'
+private_name = 'ham'
+__magic_name__ = 'green eggs'
diff --git a/python/testData/intentions/PyConvertFormatOperatorToMethodIntentionTest/concatenated.py b/python/testData/intentions/PyConvertFormatOperatorToMethodIntentionTest/concatenated.py
new file mode 100644
index 000000000000..9ba6589ffc37
--- /dev/null
+++ b/python/testData/intentions/PyConvertFormatOperatorToMethodIntentionTest/concatenated.py
@@ -0,0 +1,2 @@
+print('<caret>%(quantity)s pounds of '
+ '%(type)s' % dict(quantity=42, type='spam')) \ No newline at end of file
diff --git a/python/testData/intentions/PyConvertFormatOperatorToMethodIntentionTest/concatenated_after.py b/python/testData/intentions/PyConvertFormatOperatorToMethodIntentionTest/concatenated_after.py
new file mode 100644
index 000000000000..804f15ca373d
--- /dev/null
+++ b/python/testData/intentions/PyConvertFormatOperatorToMethodIntentionTest/concatenated_after.py
@@ -0,0 +1,2 @@
+print('{quantity:s} pounds of '
+ '{type:s}'.format(quantity=42, type='spam')) \ No newline at end of file
diff --git a/python/testData/resolve/multiFile/modulePrivateName/ImportedFile.py b/python/testData/resolve/multiFile/modulePrivateName/ImportedFile.py
new file mode 100644
index 000000000000..8fb15497b2ab
--- /dev/null
+++ b/python/testData/resolve/multiFile/modulePrivateName/ImportedFile.py
@@ -0,0 +1 @@
+_private_name = "spam" \ No newline at end of file
diff --git a/python/testData/resolve/multiFile/modulePrivateName/ModulePrivateName.py b/python/testData/resolve/multiFile/modulePrivateName/ModulePrivateName.py
new file mode 100644
index 000000000000..ac8143c386f7
--- /dev/null
+++ b/python/testData/resolve/multiFile/modulePrivateName/ModulePrivateName.py
@@ -0,0 +1,5 @@
+from ImportedFile import *
+
+_private_name
+# <ref>
+
diff --git a/python/testData/resolve/multiFile/modulePrivateNameInDunderAll/ImportedFile.py b/python/testData/resolve/multiFile/modulePrivateNameInDunderAll/ImportedFile.py
new file mode 100644
index 000000000000..9fb658fce3a0
--- /dev/null
+++ b/python/testData/resolve/multiFile/modulePrivateNameInDunderAll/ImportedFile.py
@@ -0,0 +1,4 @@
+__all__ = [
+ "_private_name",
+]
+_private_name = "spam" \ No newline at end of file
diff --git a/python/testData/resolve/multiFile/modulePrivateNameInDunderAll/ModulePrivateNameInDunderAll.py b/python/testData/resolve/multiFile/modulePrivateNameInDunderAll/ModulePrivateNameInDunderAll.py
new file mode 100644
index 000000000000..ac8143c386f7
--- /dev/null
+++ b/python/testData/resolve/multiFile/modulePrivateNameInDunderAll/ModulePrivateNameInDunderAll.py
@@ -0,0 +1,5 @@
+from ImportedFile import *
+
+_private_name
+# <ref>
+
diff --git a/python/testSrc/com/jetbrains/python/Py3CompletionTest.java b/python/testSrc/com/jetbrains/python/Py3CompletionTest.java
index 1409ff490005..ca7c3c2649f3 100644
--- a/python/testSrc/com/jetbrains/python/Py3CompletionTest.java
+++ b/python/testSrc/com/jetbrains/python/Py3CompletionTest.java
@@ -18,6 +18,7 @@ package com.jetbrains.python;
import com.intellij.codeInsight.completion.impl.CamelHumpMatcher;
import com.intellij.testFramework.LightProjectDescriptor;
import com.jetbrains.python.fixtures.PyTestCase;
+import com.jetbrains.python.psi.LanguageLevel;
import java.util.List;
@@ -73,4 +74,23 @@ public class Py3CompletionTest extends PyTestCase {
myFixture.completeBasic();
return myFixture.getLookupElementStrings();
}
+
+ // PY-4073
+ public void testSpecialFunctionAttributesPy3() throws Exception {
+ setLanguageLevel(LanguageLevel.PYTHON32);
+ try {
+ List<String> suggested = doTestByText("def func(): pass; func.func_<caret>");
+ assertNotNull(suggested);
+ assertEmpty(suggested);
+
+ suggested = doTestByText("def func(): pass; func.__<caret>");
+ assertNotNull(suggested);
+ assertContainsElements(suggested, "__defaults__", "__globals__", "__closure__",
+ "__code__", "__name__", "__doc__", "__dict__", "__module__");
+ assertContainsElements(suggested, "__annotations__", "__kwdefaults__");
+ }
+ finally {
+ setLanguageLevel(null);
+ }
+ }
}
diff --git a/python/testSrc/com/jetbrains/python/PyCommenterTest.java b/python/testSrc/com/jetbrains/python/PyCommenterTest.java
index 651311e4fde9..1ce9202101ac 100644
--- a/python/testSrc/com/jetbrains/python/PyCommenterTest.java
+++ b/python/testSrc/com/jetbrains/python/PyCommenterTest.java
@@ -15,8 +15,6 @@
*/
package com.jetbrains.python;
-import com.intellij.codeInsight.actions.CodeInsightAction;
-import com.intellij.openapi.actionSystem.ActionManager;
import com.intellij.openapi.actionSystem.IdeActions;
import com.jetbrains.python.fixtures.PyTestCase;
@@ -34,9 +32,7 @@ public class PyCommenterTest extends PyTestCase {
private void doTest() {
myFixture.configureByFile("commenter/" + getTestName(true) + ".py");
- CodeInsightAction action = (CodeInsightAction) ActionManager.getInstance().getAction(IdeActions.ACTION_COMMENT_LINE);
- action.actionPerformedImpl(myFixture.getFile().getProject(), myFixture.getEditor());
+ myFixture.performEditorAction(IdeActions.ACTION_COMMENT_LINE);
myFixture.checkResultByFile("commenter/" + getTestName(true) + "_after.py", true);
-
}
}
diff --git a/python/testSrc/com/jetbrains/python/PyMultiFileResolveTest.java b/python/testSrc/com/jetbrains/python/PyMultiFileResolveTest.java
index e942388659ba..4585832844eb 100644
--- a/python/testSrc/com/jetbrains/python/PyMultiFileResolveTest.java
+++ b/python/testSrc/com/jetbrains/python/PyMultiFileResolveTest.java
@@ -363,4 +363,14 @@ public class PyMultiFileResolveTest extends PyMultiFileResolveTestCase {
public void testFromPackageModuleImportStarElementNamedAsModule() {
assertResolvesTo(PyFunction.class, "foo");
}
+
+ // PY-13140
+ public void testModulePrivateName() {
+ assertNull(doResolve());
+ }
+
+ // PY-13140
+ public void testModulePrivateNameInDunderAll() {
+ assertResolvesTo(PyTargetExpression.class, "_private_name");
+ }
}
diff --git a/python/testSrc/com/jetbrains/python/PySmartEnterTest.java b/python/testSrc/com/jetbrains/python/PySmartEnterTest.java
index 959b1f752ee8..b8421c9d7e18 100644
--- a/python/testSrc/com/jetbrains/python/PySmartEnterTest.java
+++ b/python/testSrc/com/jetbrains/python/PySmartEnterTest.java
@@ -169,4 +169,14 @@ public class PySmartEnterTest extends PyTestCase {
pyCodeInsightSettings.INSERT_TYPE_DOCSTUB = oldInsertType;
}
}
+
+ // PY-12877
+ public void testWithTargetOmitted() {
+ doTest();
+ }
+
+ // PY-12877
+ public void testWithTargetIncomplete() {
+ doTest();
+ }
}
diff --git a/python/testSrc/com/jetbrains/python/PyTypeTest.java b/python/testSrc/com/jetbrains/python/PyTypeTest.java
index 81b4aa46629e..88243f065a3b 100644
--- a/python/testSrc/com/jetbrains/python/PyTypeTest.java
+++ b/python/testSrc/com/jetbrains/python/PyTypeTest.java
@@ -399,6 +399,16 @@ public class PyTypeTest extends PyTestCase {
"expr = x.start\n");
TypeEvalContext context = getTypeEvalContext(expr);
PyType actual = context.getType(expr);
+ assertNotNull(actual);
+ assertInstanceOf(actual, PyClassType.class);
+ assertEquals("int", actual.getName());
+ }
+
+ public void testUndefinedPropertyOfUnionType() {
+ PyExpression expr = parseExpr("x = 42 if True else 'spam'\n" +
+ "expr = x.foo\n");
+ TypeEvalContext context = getTypeEvalContext(expr);
+ PyType actual = context.getType(expr);
assertNull(actual);
}
diff --git a/python/testSrc/com/jetbrains/python/PythonCompletionTest.java b/python/testSrc/com/jetbrains/python/PythonCompletionTest.java
index b57ae35baa17..f365eea4da34 100644
--- a/python/testSrc/com/jetbrains/python/PythonCompletionTest.java
+++ b/python/testSrc/com/jetbrains/python/PythonCompletionTest.java
@@ -161,7 +161,7 @@ public class PythonCompletionTest extends PyTestCase {
final LookupElement[] elements = myFixture.completeBasic();
assertNotNull(elements);
assertEquals(1, elements.length);
- assertEquals("children", elements [0].getLookupString());
+ assertEquals("children", elements[0].getLookupString());
}
public void testImportModule() {
@@ -613,6 +613,36 @@ public class PythonCompletionTest extends PyTestCase {
" __meta<caret>\n");
myFixture.checkResult("class C(object):\n" +
" __metaclass__ = \n");
+ }
+
+ // PY-13140
+ public void testModulePrivateNamesCompletedInsideImport() {
+ myFixture.copyDirectoryToProject("completion/" + getTestName(true), "");
+ myFixture.configureByFile("a.py");
+ myFixture.completeBasic();
+ List<String> suggested = myFixture.getLookupElementStrings();
+ assertNotNull(suggested);
+ assertContainsElements(suggested, "normal_name", "_private_name", "__magic_name__");
+ }
+ // PY-4073
+ public void testSpecialFunctionAttributes() throws Exception {
+ setLanguageLevel(LanguageLevel.PYTHON27);
+ try {
+ List<String> suggested = doTestByText("def func(): pass; func.func_<caret>");
+ assertNotNull(suggested);
+ assertContainsElements(suggested,
+ "func_defaults", "func_globals", "func_closure",
+ "func_code", "func_name", "func_doc", "func_dict");
+
+ suggested = doTestByText("def func(): pass; func.__<caret>");
+ assertNotNull(suggested);
+ assertContainsElements(suggested, "__defaults__", "__globals__", "__closure__",
+ "__code__", "__name__", "__doc__", "__dict__", "__module__");
+ assertDoesntContain(suggested, "__annotations__", "__kwdefaults__");
+ }
+ finally {
+ setLanguageLevel(null);
+ }
}
}
diff --git a/python/testSrc/com/jetbrains/python/inspections/PyUnresolvedReferencesInspectionTest.java b/python/testSrc/com/jetbrains/python/inspections/PyUnresolvedReferencesInspectionTest.java
index e614edd8e627..0c5e87ab1001 100644
--- a/python/testSrc/com/jetbrains/python/inspections/PyUnresolvedReferencesInspectionTest.java
+++ b/python/testSrc/com/jetbrains/python/inspections/PyUnresolvedReferencesInspectionTest.java
@@ -366,6 +366,11 @@ public class PyUnresolvedReferencesInspectionTest extends PyInspectionTestCase {
doMultiFileTest();
}
+ // PY-13140
+ public void testPrivateModuleNames() {
+ doMultiFileTest();
+ }
+
@NotNull
@Override
protected Class<? extends PyInspection> getInspectionClass() {
diff --git a/python/testSrc/com/jetbrains/python/intentions/PyConvertFormatOperatorToMethodIntentionTest.java b/python/testSrc/com/jetbrains/python/intentions/PyConvertFormatOperatorToMethodIntentionTest.java
index 3dfa4a39bc85..833f71e8452a 100644
--- a/python/testSrc/com/jetbrains/python/intentions/PyConvertFormatOperatorToMethodIntentionTest.java
+++ b/python/testSrc/com/jetbrains/python/intentions/PyConvertFormatOperatorToMethodIntentionTest.java
@@ -38,4 +38,9 @@ public class PyConvertFormatOperatorToMethodIntentionTest extends PyIntentionTes
public void testUnicode() {
doTest(PyBundle.message("INTN.replace.with.method"), LanguageLevel.PYTHON26);
}
+
+ // PY-9176
+ public void testConcatenated() {
+ doTest(PyBundle.message("INTN.replace.with.method"), LanguageLevel.PYTHON26);
+ }
} \ No newline at end of file
diff --git a/resources-en/src/messages/DebuggerBundle.properties b/resources-en/src/messages/DebuggerBundle.properties
index ff3238c7dab2..fa51256eb277 100644
--- a/resources-en/src/messages/DebuggerBundle.properties
+++ b/resources-en/src/messages/DebuggerBundle.properties
@@ -173,7 +173,6 @@ label.array.renderer.configurable.start.index=Array sta&rt index:
label.array.renderer.configurable.end.index=en&d index:
label.array.renderer.configurable.max.count1=Show &maximum
label.array.renderer.configurable.max.count2=array elements
-base.renderer.configurable.display.name=Data Views
label.base.renderer.configurable.autoscroll=Autoscroll to new &local variables
label.base.renderer.configurable.show.synthetic.fields=S&ynthetic fields
label.base.renderer.configurable.show.val.fields.as.locals=$val fields as local &variables
@@ -186,10 +185,9 @@ label.base.renderer.configurable.show.static.final.fields=Static &final fields
label.base.renderer.configurable.show.declared.type=Declared &type
label.base.renderer.configurable.show.fq.names=Fully &qualified names
label.base.renderer.configurable.show.object.id=Object &id
-label.base.renderer.configurable.auto.expressions=Enable auto expressions in Variables view
label.base.renderer.configurable.alternate.view=Enable alternative view for Coll&ections classes
-label.base.renderer.configurable.enable.tostring=Enable 't&oString()' object view:
-label.base.renderer.configurable.all.overridding=For all classes that override 'toString()' method
+label.base.renderer.configurable.enable.toString=Enable 't&oString()' object view:
+label.base.renderer.configurable.all.overriding=For all classes that override 'toString()' method
label.base.renderer.configurable.classes.from.list=For classes from the list:
label.compound.renderer.configurable.use.default.renderer=Use default renderer
label.compound.renderer.configurable.use.expression=Use following expression:
@@ -208,13 +206,10 @@ label.compound.renderer.configurable.table.header.name=Name
label.compound.renderer.configurable.table.header.expression=Expression
debugger.launching.configurable.display.name=Launching
debugger.hotswap.configurable.display.name=HotSwap
-debugger.stepping.configurable.display.name=Stepping
label.debugger.launching.configurable.hide.window=Hide debug &window on process termination
-label.debugger.focusAppOnBreakpoint=Focus application on breakpoint
label.debugger.hotswap.configurable.hotswap.background=Reload classes in &background
label.debugger.hotswap.configurable.compile.before.hotswap=Make project before reloading classes
label.debugger.hotswap.configurable.enable.vm.hang.warning=Enable 'JVM will hang' warning
-label.debugger.general.configurable.tooltips.delay=&Value tooltips delay (ms):
label.debugger.hotswap.configurable.reload.classes=Reload classes after compilation:
label.debugger.hotswap.configurable.always=&Always
label.debugger.hotswap.configurable.never=&Never
@@ -227,7 +222,7 @@ label.debugger.launching.configurable.socket=&Socket
label.debugger.launching.configurable.shmem=Shared &memory
label.debugger.general.configurable.skip.synthetic.methods=Ski&p synthetic methods
label.debugger.general.configurable.skip.constructors=Skip &constructors
-label.debugger.general.configurable.skip.classloaders=Skip class l&oaders
+label.debugger.general.configurable.skip.classLoaders=Skip class l&oaders
label.debugger.general.configurable.skip.simple.getters=Skip simple &getters
label.debugger.general.configurable.step.filters.list.header=Do not step &into the classes
label.threads.view.configurable.show.source.file.name=Show source file name
diff --git a/resources/src/META-INF/IdeTipsAndTricks.xml b/resources/src/META-INF/IdeTipsAndTricks.xml
index 35fd6e05e706..c27a05083b67 100644
--- a/resources/src/META-INF/IdeTipsAndTricks.xml
+++ b/resources/src/META-INF/IdeTipsAndTricks.xml
@@ -50,6 +50,7 @@
<tipAndTrick file="HierarchyBrowser.html"/>
<tipAndTrick file="BreakpointSpeedmenu.html"/>
<tipAndTrick file="EvaluateExpressionInEditor.html"/>
+ <tipAndTrick file="QuickEvaluateExpression.html"/>
<tipAndTrick file="WordCompletion.html"/>
<tipAndTrick file="QuickJavaDocInLookups.html" feature-id="codeassists.quickjavadoc.lookup"/>
<tipAndTrick file="DotEtcInLookups.html" feature-id="editing.completion.finishByDotEtc"/>
diff --git a/resources/src/META-INF/IdeaPlugin.xml b/resources/src/META-INF/IdeaPlugin.xml
index 329fc3def69f..9764417638d6 100644
--- a/resources/src/META-INF/IdeaPlugin.xml
+++ b/resources/src/META-INF/IdeaPlugin.xml
@@ -9,16 +9,26 @@
<xi:include href="/idea/JavaActions.xml" xpointer="xpointer(/component/*)"/>
<xi:include href="/META-INF/ExternalSystemExtensions.xml" xpointer="xpointer(/idea-plugin/extensions/*)"/>
<xi:include href="/componentSets/Debugger.xml" xpointer="xpointer(/components/*)"/>
+ <xi:include href="/META-INF/structuralsearch.xml" xpointer="xpointer(/idea-plugin/*)">
+ <xi:fallback/>
+ </xi:include>
+ <xi:include href="/META-INF/structuralsearch-java.xml" xpointer="xpointer(/idea-plugin/*)"/>
<xi:include href="/META-INF/IntentionPowerPack.xml" xpointer="xpointer(/idea-plugin/*)"/>
<xi:include href="/META-INF/InspectionGadgets.xml" xpointer="xpointer(/idea-plugin/*)"/>
<xi:include href="/META-INF/ManifestSupport.xml" xpointer="xpointer(/idea-plugin/*)">
<xi:fallback/>
</xi:include>
+ <xi:include href="/META-INF/TypeMigration.xml" xpointer="xpointer(/idea-plugin/*)">
+ <xi:fallback/>
+ </xi:include>
<application-components>
<component>
<implementation-class>com.intellij.util.xml.impl.JavaDomApplicationComponent</implementation-class>
</component>
+ <component>
+ <implementation-class>com.intellij.codeInspection.bytecodeAnalysis.BytecodeAnalysisConverter</implementation-class>
+ </component>
</application-components>
<project-components>
@@ -1356,6 +1366,8 @@
<stubIndex implementation="com.intellij.psi.impl.java.stubs.index.JavaSuperClassNameOccurenceIndex"/>
<stubIndex implementation="com.intellij.psi.impl.java.stubs.index.JavaMethodParameterTypesIndex"/>
+ <fileBasedIndex implementation="com.intellij.codeInspection.bytecodeAnalysis.BytecodeAnalysisIndex"/>
+
<stubElementTypeHolder class="com.intellij.psi.impl.java.stubs.JavaStubElementTypes"/>
<dom.customAnnotationChecker implementation="com.intellij.util.xml.impl.ExtendsClassChecker"/>
@@ -1416,6 +1428,8 @@
<resolveScopeEnlarger implementation="com.intellij.psi.NonClasspathResolveScopeEnlarger"/>
<xdebugger.debuggerSupport implementation="com.intellij.debugger.ui.JavaDebuggerSupport"/>
+ <xdebugger.settings implementation="com.intellij.debugger.settings.JavaDebuggerSettings"/>
+
<xdebugger.breakpointType implementation="com.intellij.debugger.ui.breakpoints.JavaMethodBreakpointType"/>
<xdebugger.breakpointType implementation="com.intellij.debugger.ui.breakpoints.JavaWildcardMethodBreakpointType"/>
<xdebugger.breakpointType implementation="com.intellij.debugger.ui.breakpoints.JavaFieldBreakpointType"/>
@@ -1471,7 +1485,6 @@
implementationClass="com.intellij.psi.impl.JavaRegExpHost"/>
<psi.referenceContributor language="JAVA" implementation="com.intellij.psi.impl.source.resolve.reference.impl.JavaReflectionReferenceContributor"/>
- <psi.referenceContributor language="JAVA" implementation="com.intellij.psi.impl.source.resolve.reference.impl.JavaCharsetReferenceContributor"/>
<writingAccessProvider implementation="com.intellij.refactoring.util.ClsElementWritingAccessProvider"/>
@@ -1509,6 +1522,8 @@
<projectOpenProcessor implementation="com.intellij.platform.PlatformProjectOpenProcessor" order="last"/>
<projectService serviceInterface="com.intellij.platform.ProjectBaseDirectory"
serviceImplementation="com.intellij.platform.ProjectBaseDirectory"/>
+ <projectService serviceInterface="com.intellij.codeInspection.bytecodeAnalysis.ProjectBytecodeAnalysis"
+ serviceImplementation="com.intellij.codeInspection.bytecodeAnalysis.ProjectBytecodeAnalysis"/>
<spellchecker.support language="JAVA" implementationClass="com.intellij.spellchecker.JavaSpellcheckingStrategy"/>
<codeInsight.template.postfixTemplateProvider language="JAVA"
diff --git a/resources/src/idea/RichPlatformActions.xml b/resources/src/idea/RichPlatformActions.xml
index e54edddfc3fa..12a8d342c956 100644
--- a/resources/src/idea/RichPlatformActions.xml
+++ b/resources/src/idea/RichPlatformActions.xml
@@ -87,7 +87,7 @@
<group id="InspectCodeGroup" text="Inspect Code Actions">
<action id="InspectCode" class="com.intellij.codeInspection.actions.CodeInspectionAction"/>
- <action id="CodeCleanup" class="com.intellij.codeInspection.actions.CodeCleanupAction" internal="true"/>
+ <action id="CodeCleanup" class="com.intellij.codeInspection.actions.CodeCleanupAction"/>
<action id="RunInspection" class="com.intellij.codeInspection.actions.RunInspectionAction"/>
<action id="PopupHector" class="com.intellij.codeInsight.daemon.impl.PopupHectorAction"/>
<action id="ViewOfflineInspection" class="com.intellij.codeInspection.actions.ViewOfflineResultsAction"/>
@@ -141,6 +141,7 @@
<action id="LoadAllContent" internal="true" class="com.intellij.internal.LoadAllContentsAction" text="Load all files content"/>
<action id="LoadAllVFSContent" internal="true" class="com.intellij.internal.LoadAllVfsStoredContentsAction" text="Load all VFS stored files content"/>
<action id="ComputeVFStatistics" internal="true" class="com.intellij.internal.ComputeVirtualFileNameStatAction"/>
+ <action id="DumpVfsInfoForExcludedFiles" internal="true" class="com.intellij.internal.DumpVfsInfoForExcludedFilesAction"/>
<separator/>
<action internal="true" id="PruneEmptyDirectories" class="com.intellij.ide.actions.PruneEmptyDirectoriesAction" text="Prune Empty Directories"/>
<action internal="true" id="FixLineSeparators" class="com.intellij.ide.actions.FixLineSeparatorsAction" text="Fix Line Separators"/>
diff --git a/resources/src/idea/RichPlatformPlugin.xml b/resources/src/idea/RichPlatformPlugin.xml
index b27faab54d4a..92ae7046006e 100644
--- a/resources/src/idea/RichPlatformPlugin.xml
+++ b/resources/src/idea/RichPlatformPlugin.xml
@@ -32,9 +32,6 @@
<extensionPoint name="antCustomCompiler"
interface="com.intellij.compiler.ant.ChunkCustomCompilerExtension"/>
- <extensionPoint name="compiler.buildParticipantProvider"
- interface="com.intellij.openapi.compiler.make.BuildParticipantProvider"/>
-
<extensionPoint name="compiler.buildTargetScopeProvider"
interface="com.intellij.compiler.impl.BuildTargetScopeProvider"/>
@@ -181,6 +178,9 @@
<projectService serviceInterface="com.intellij.codeInsight.ExternalAnnotationsManager"
serviceImplementation="com.intellij.codeInsight.ExternalAnnotationsManagerImpl"/>
+ <projectService serviceInterface="com.intellij.codeInsight.InferredAnnotationsManager"
+ serviceImplementation="com.intellij.codeInsight.InferredAnnotationsManagerImpl"/>
+
<projectService serviceInterface="com.intellij.openapi.compiler.CompilerManager"
serviceImplementation="com.intellij.compiler.CompilerManagerImpl"/>
<projectService serviceInterface="com.intellij.openapi.roots.CompilerProjectExtension"
@@ -239,10 +239,10 @@
<!-- Errors -->
<!-- Show full error options configurable only in full IDEA - platform supports only default IDE profile for now -->
- <projectConfigurable provider="com.intellij.profile.codeInspection.ui.ProjectInspectionToolsConfigurableProvider"/>
+ <projectConfigurable groupId="editor" displayName="Inspections" provider="com.intellij.profile.codeInspection.ui.ProjectInspectionToolsConfigurableProvider"/>
<!-- Compiler -->
- <projectConfigurable instance="com.intellij.compiler.options.CompilerConfigurable" id="project.propCompiler" order="after project"
+ <projectConfigurable groupId="build" instance="com.intellij.compiler.options.CompilerConfigurable" id="project.propCompiler" order="after project"
key="compiler.configurable.display.name" bundle="messages.CompilerBundle" childrenEPName="com.intellij.compilerSettingsFactory">
<configurable instance="com.intellij.openapi.compiler.options.ExcludedEntriesConfigurable" id="reference.projectsettings.compiler.excludes"
displayName="Excludes"/>
@@ -254,20 +254,20 @@
key="rmi.compiler.description" bundle="messages.CompilerBundle"/>
</projectConfigurable>
- <projectConfigurable instance="com.intellij.psi.templateLanguages.TemplateDataLanguageConfigurable" id="Template Data Languages" key="template.data.language.configurable" bundle="messages.LangBundle" />
+ <projectConfigurable groupId="language" instance="com.intellij.psi.templateLanguages.TemplateDataLanguageConfigurable" id="Template Data Languages" key="template.data.language.configurable" bundle="messages.LangBundle" />
<!-- Scopes -->
- <projectConfigurable instance="com.intellij.ide.util.scopeChooser.ScopeChooserConfigurable" id="project.scopes" key="scopes.display.name" bundle="messages.IdeBundle" />
+ <projectConfigurable groupId="project" instance="com.intellij.ide.util.scopeChooser.ScopeChooserConfigurable" id="project.scopes" key="scopes.display.name" bundle="messages.IdeBundle" />
<!-- Application Configurables -->
<!-- Path Variables -->
<!-- the implementation of this configurable is in platform-impl but it's not registered in platform because
it's only required in full IDEA -->
- <applicationConfigurable instance="com.intellij.application.options.pathMacros.PathMacroConfigurable" id="preferences.pathVariables"
+ <applicationConfigurable groupId="project" instance="com.intellij.application.options.pathMacros.PathMacroConfigurable" id="preferences.pathVariables"
key="title.path.variables" bundle="messages.ApplicationBundle"/>
- <applicationConfigurable instance="com.intellij.execution.console.ConsoleFoldingConfigurable" id="Console Folding"
+ <applicationConfigurable parentId="editor" instance="com.intellij.execution.console.ConsoleFoldingConfigurable" id="Console Folding"
displayName="Console Folding"/>
<editorNotificationProvider implementation="com.intellij.codeInsight.daemon.impl.AttachSourcesNotificationProvider"/>
diff --git a/spellchecker/src/META-INF/SpellCheckerPlugin.xml b/spellchecker/src/META-INF/SpellCheckerPlugin.xml
index a6108edac1ff..bd6be663f155 100644
--- a/spellchecker/src/META-INF/SpellCheckerPlugin.xml
+++ b/spellchecker/src/META-INF/SpellCheckerPlugin.xml
@@ -23,7 +23,7 @@
<projectService serviceInterface="com.intellij.spellchecker.SpellCheckerManager"
serviceImplementation="com.intellij.spellchecker.SpellCheckerManager"/>
<editorCustomization implementation="com.intellij.spellchecker.ui.SpellCheckingEditorCustomization"/>
- <projectConfigurable instance="com.intellij.spellchecker.settings.SpellCheckerSettingsManager" id="reference.settings.ide.settings.spelling" key="spelling" bundle="com.intellij.spellchecker.util.SpellCheckerBundle" />
+ <projectConfigurable groupId="editor" instance="com.intellij.spellchecker.settings.SpellCheckerSettingsManager" id="reference.settings.ide.settings.spelling" key="spelling" bundle="com.intellij.spellchecker.util.SpellCheckerBundle" />
<localInspection shortName="SpellCheckingInspection" bundle="com.intellij.spellchecker.util.SpellCheckerBundle"
diff --git a/spellchecker/src/com/intellij/spellchecker/jetbrains.dic b/spellchecker/src/com/intellij/spellchecker/jetbrains.dic
index 71cb555d1838..52b856089b10 100644
--- a/spellchecker/src/com/intellij/spellchecker/jetbrains.dic
+++ b/spellchecker/src/com/intellij/spellchecker/jetbrains.dic
@@ -168,9 +168,11 @@ globals
google
gzip
gruntfile
+hamcrest
hardcoded
hardlink
hardlinks
+hashcode
haxe
helvetica
holdability
@@ -486,6 +488,7 @@ sigwaiting
sigwinch
sigxcpu
sigxfsz
+slru
smallfile
smallint
soname
@@ -560,6 +563,7 @@ undofile
unescaped
unhandled
uninstall
+unmerged
unpivot
unprotect
unwatch
diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/DomInvocationHandler.java b/xml/dom-impl/src/com/intellij/util/xml/impl/DomInvocationHandler.java
index bdad1cf47d75..88bc70044268 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/impl/DomInvocationHandler.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/impl/DomInvocationHandler.java
@@ -17,7 +17,6 @@ package com.intellij.util.xml.impl;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.module.Module;
-import com.intellij.openapi.module.ModuleUtil;
import com.intellij.openapi.module.ModuleUtilCore;
import com.intellij.openapi.progress.ProgressManager;
import com.intellij.openapi.util.NullableFactory;
@@ -29,6 +28,7 @@ import com.intellij.psi.SmartPointerManager;
import com.intellij.psi.SmartPsiElementPointer;
import com.intellij.psi.XmlElementFactory;
import com.intellij.psi.search.GlobalSearchScope;
+import com.intellij.psi.util.PsiUtilCore;
import com.intellij.psi.xml.XmlAttribute;
import com.intellij.psi.xml.XmlElement;
import com.intellij.psi.xml.XmlFile;
@@ -666,8 +666,14 @@ public abstract class DomInvocationHandler<T extends AbstractDomChildDescription
final XmlAttribute attribute = tag.getAttribute(description.getXmlName().getLocalName(), ns.equals(tag.getNamespace())? null:ns);
if (attribute != null) {
- LOG.assertTrue(attribute.isValid());
- return myManager.getSemService().getSemElement(DomManagerImpl.DOM_ATTRIBUTE_HANDLER_KEY, attribute);
+ PsiUtilCore.ensureValid(attribute);
+ AttributeChildInvocationHandler semElement =
+ myManager.getSemService().getSemElement(DomManagerImpl.DOM_ATTRIBUTE_HANDLER_KEY, attribute);
+ if (semElement == null) {
+ final AttributeChildInvocationHandler take2 = myManager.getSemService().getSemElement(DomManagerImpl.DOM_ATTRIBUTE_HANDLER_KEY, attribute);
+ throw new AssertionError("No DOM at XML. Parent=" + tag + "; attribute=" + attribute + "; second attempt=" + take2);
+ }
+ return semElement;
}
}
return new AttributeChildInvocationHandler(evaluatedXmlName, description, myManager, new VirtualDomParentStrategy(this), null);
diff --git a/xml/impl/src/com/intellij/application/options/emmet/EmmetOptions.java b/xml/impl/src/com/intellij/application/options/emmet/EmmetOptions.java
index 6781db72e93a..91fcf3944d89 100644
--- a/xml/impl/src/com/intellij/application/options/emmet/EmmetOptions.java
+++ b/xml/impl/src/com/intellij/application/options/emmet/EmmetOptions.java
@@ -44,7 +44,7 @@ public class EmmetOptions implements PersistentStateComponent<EmmetOptions>, Exp
private boolean myBemFilterEnabledByDefault = false;
private boolean myEmmetEnabled = true;
private int myEmmetExpandShortcut = TemplateSettings.TAB_CHAR;
- private boolean myFuzzySearchEnabled = true;
+ private boolean myFuzzySearchEnabled = false;
private boolean myAutoInsertCssPrefixedEnabled = true;
private boolean myPreviewEnabled = false;
private Set<String> myFiltersEnabledByDefault = ContainerUtil.newHashSet();
diff --git a/xml/impl/src/com/intellij/codeInsight/template/emmet/EmmetException.java b/xml/impl/src/com/intellij/codeInsight/template/emmet/EmmetException.java
new file mode 100644
index 000000000000..0105408ea790
--- /dev/null
+++ b/xml/impl/src/com/intellij/codeInsight/template/emmet/EmmetException.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright 2000-2014 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.template.emmet;
+
+public class EmmetException extends Exception {
+ public EmmetException() {
+ super("Cannot expand emmet abbreviation: output is too big");
+ }
+}
diff --git a/xml/impl/src/com/intellij/codeInsight/template/emmet/EmmetPreviewHint.java b/xml/impl/src/com/intellij/codeInsight/template/emmet/EmmetPreviewHint.java
index edde5a83a6d6..f9777958e689 100644
--- a/xml/impl/src/com/intellij/codeInsight/template/emmet/EmmetPreviewHint.java
+++ b/xml/impl/src/com/intellij/codeInsight/template/emmet/EmmetPreviewHint.java
@@ -147,7 +147,7 @@ public class EmmetPreviewHint extends LightweightHint implements Disposable {
EditorFactory editorFactory = EditorFactory.getInstance();
Document document = editorFactory.createDocument(templateText);
final EditorEx previewEditor = (EditorEx)editorFactory.createEditor(document, parentEditor.getProject(), fileType, true);
- EditorSettings settings = previewEditor.getSettings();
+ final EditorSettings settings = previewEditor.getSettings();
settings.setLineNumbersShown(false);
settings.setAdditionalLinesCount(1);
settings.setAdditionalColumnsCount(1);
@@ -172,7 +172,7 @@ public class EmmetPreviewHint extends LightweightHint implements Disposable {
int maxWidth = (int)parentEditorSize.getWidth() / 3;
int maxHeight = (int)parentEditorSize.getHeight() / 2;
Dimension contentSize = previewEditor.getContentSize();
- return new Dimension(maxWidth > contentSize.getWidth() ? (int)size.getWidth() : maxWidth,
+ return new Dimension(maxWidth > contentSize.getWidth() && !settings.isUseSoftWraps() ? (int)size.getWidth() : maxWidth,
maxHeight > contentSize.getHeight() ? (int)size.getHeight() : maxHeight);
}
diff --git a/xml/impl/src/com/intellij/codeInsight/template/emmet/EmmetPreviewUtil.java b/xml/impl/src/com/intellij/codeInsight/template/emmet/EmmetPreviewUtil.java
index af106929bcea..a82ab071846b 100644
--- a/xml/impl/src/com/intellij/codeInsight/template/emmet/EmmetPreviewUtil.java
+++ b/xml/impl/src/com/intellij/codeInsight/template/emmet/EmmetPreviewUtil.java
@@ -61,12 +61,19 @@ public class EmmetPreviewUtil {
if (generator != null && generator instanceof XmlZenCodingGenerator) {
final String templatePrefix = new ZenCodingTemplate().computeTemplateKeyWithoutContextChecking(callback);
if (templatePrefix != null) {
- ZenCodingTemplate.expand(templatePrefix, callback, generator, Collections.<ZenCodingFilter>emptyList(), expandPrimitiveAbbreviations, 0);
- TemplateImpl template = generatedTemplate.get();
- String templateText = template != null ? template.getTemplateText() : null;
- if (!StringUtil.isEmpty(templateText)) {
- return template.isToReformat() ? reformatTemplateText(file, templateText) : templateText;
+ try {
+ ZenCodingTemplate.expand(templatePrefix, callback, generator, Collections.<ZenCodingFilter>emptyList(),
+ expandPrimitiveAbbreviations, 0);
+ TemplateImpl template = generatedTemplate.get();
+ String templateText = template != null ? template.getTemplateText() : null;
+ if (!StringUtil.isEmpty(templateText)) {
+ return template.isToReformat() ? reformatTemplateText(file, templateText) : templateText;
+ }
}
+ catch (EmmetException e) {
+ return e.getMessage();
+ }
+
}
}
}
diff --git a/xml/impl/src/com/intellij/codeInsight/template/emmet/ZenCodingTemplate.java b/xml/impl/src/com/intellij/codeInsight/template/emmet/ZenCodingTemplate.java
index b0d623683912..f27903a49b5b 100644
--- a/xml/impl/src/com/intellij/codeInsight/template/emmet/ZenCodingTemplate.java
+++ b/xml/impl/src/com/intellij/codeInsight/template/emmet/ZenCodingTemplate.java
@@ -52,6 +52,7 @@ import com.intellij.patterns.StandardPatterns;
import com.intellij.psi.PsiDocumentManager;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
+import com.intellij.refactoring.util.CommonRefactoringUtil;
import com.intellij.ui.*;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.xml.XmlBundle;
@@ -124,7 +125,12 @@ public class ZenCodingTemplate extends CustomLiveTemplateBase {
public void expand(@NotNull String key, @NotNull CustomTemplateCallback callback) {
ZenCodingGenerator defaultGenerator = findApplicableDefaultGenerator(callback.getContext(), false);
assert defaultGenerator != null;
- expand(key, callback, defaultGenerator, Collections.<ZenCodingFilter>emptyList(), true, Registry.intValue("emmet.segments.limit"));
+ try {
+ expand(key, callback, defaultGenerator, Collections.<ZenCodingFilter>emptyList(), true, Registry.intValue("emmet.segments.limit"));
+ }
+ catch (EmmetException e) {
+ CommonRefactoringUtil.showErrorHint(callback.getProject(), callback.getEditor(), e.getMessage(), "Emmet error", "");
+ }
}
@Nullable
@@ -182,7 +188,7 @@ public class ZenCodingTemplate extends CustomLiveTemplateBase {
public static void expand(@NotNull String key, @NotNull CustomTemplateCallback callback,
@NotNull ZenCodingGenerator defaultGenerator,
@NotNull Collection<? extends ZenCodingFilter> extraFilters,
- boolean expandPrimitiveAbbreviations, int segmentsLimit) {
+ boolean expandPrimitiveAbbreviations, int segmentsLimit) throws EmmetException {
final ZenCodingNode node = parse(key, callback, defaultGenerator, null);
if (node == null) {
return;
@@ -204,6 +210,8 @@ public class ZenCodingTemplate extends CustomLiveTemplateBase {
List<ZenCodingFilter> filters = getFilters(node, context);
filters.addAll(extraFilters);
+ checkTemplateOutputLength(node, callback);
+
callback.deleteTemplateKey(key);
expand(node, generator, filters, null, callback, expandPrimitiveAbbreviations, segmentsLimit);
}
@@ -212,7 +220,10 @@ public class ZenCodingTemplate extends CustomLiveTemplateBase {
ZenCodingGenerator generator,
List<ZenCodingFilter> filters,
String surroundedText,
- CustomTemplateCallback callback, boolean expandPrimitiveAbbreviations, int segmentsLimit) {
+ CustomTemplateCallback callback, boolean expandPrimitiveAbbreviations, int segmentsLimit) throws EmmetException {
+
+ checkTemplateOutputLength(node, callback);
+
if (surroundedText != null) {
surroundedText = surroundedText.trim();
}
@@ -282,6 +293,13 @@ public class ZenCodingTemplate extends CustomLiveTemplateBase {
});
}
+ private static void checkTemplateOutputLength(ZenCodingNode node, CustomTemplateCallback callback) throws EmmetException {
+ int predictedOutputLength = node.getApproximateOutputLength(callback);
+ if (predictedOutputLength > 15 * 1024) {
+ throw new EmmetException();
+ }
+ }
+
private static boolean isPrimitiveNode(@NotNull ZenCodingNode node) {
if (node instanceof TemplateNode) {
final TemplateToken token = ((TemplateNode)node).getTemplateToken();
@@ -434,7 +452,12 @@ public class ZenCodingTemplate extends CustomLiveTemplateBase {
EditorModificationUtil.deleteSelectedText(callback.getEditor());
PsiDocumentManager.getInstance(callback.getProject()).commitAllDocuments();
- expand(node, generator, filters, selection, callback, true, Registry.intValue("emmet.segments.limit"));
+ try {
+ expand(node, generator, filters, selection, callback, true, Registry.intValue("emmet.segments.limit"));
+ }
+ catch (EmmetException e) {
+ CommonRefactoringUtil.showErrorHint(callback.getProject(), callback.getEditor(), e.getMessage(), "Emmet error", "");
+ }
}
}
});
@@ -509,7 +532,12 @@ public class ZenCodingTemplate extends CustomLiveTemplateBase {
if (!regularTemplateWithSamePrefixExists) {
// exclude perfect matches with existing templates because LiveTemplateCompletionContributor handles it
final Collection<SingleLineEmmetFilter> extraFilters = ContainerUtil.newLinkedList(new SingleLineEmmetFilter());
- expand(templatePrefix, callback, generator, extraFilters, false, 0);
+ try {
+ expand(templatePrefix, callback, generator, extraFilters, false, 0);
+ }
+ catch (EmmetException e) {
+ generatedTemplate.set(null);
+ }
if (!generatedTemplate.isNull()) {
final TemplateImpl template = generatedTemplate.get();
template.setKey(templatePrefix);
diff --git a/xml/impl/src/com/intellij/codeInsight/template/emmet/generators/LoremGenerator.java b/xml/impl/src/com/intellij/codeInsight/template/emmet/generators/LoremGenerator.java
index a5f4aeef5f0d..37b6d4b15b53 100644
--- a/xml/impl/src/com/intellij/codeInsight/template/emmet/generators/LoremGenerator.java
+++ b/xml/impl/src/com/intellij/codeInsight/template/emmet/generators/LoremGenerator.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -16,6 +16,7 @@
package com.intellij.codeInsight.template.emmet.generators;
import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.util.ArrayUtil;
import java.util.*;
@@ -145,7 +146,7 @@ public class LoremGenerator {
result.add(words[i]);
}
- return result.toArray(new String[result.size()]);
+ return ArrayUtil.toStringArray(result);
}
private char choice(String values) {
diff --git a/xml/impl/src/com/intellij/codeInsight/template/emmet/generators/XmlZenCodingGenerator.java b/xml/impl/src/com/intellij/codeInsight/template/emmet/generators/XmlZenCodingGenerator.java
index ef57f5ed4e49..c1732a306120 100644
--- a/xml/impl/src/com/intellij/codeInsight/template/emmet/generators/XmlZenCodingGenerator.java
+++ b/xml/impl/src/com/intellij/codeInsight/template/emmet/generators/XmlZenCodingGenerator.java
@@ -19,6 +19,8 @@ import com.intellij.codeInsight.template.CustomTemplateCallback;
import com.intellij.codeInsight.template.emmet.ZenCodingTemplate;
import com.intellij.codeInsight.template.emmet.tokens.TemplateToken;
import com.intellij.codeInsight.template.impl.TemplateImpl;
+import com.intellij.diagnostic.AttachmentFactory;
+import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.util.Couple;
import com.intellij.openapi.util.TextRange;
@@ -109,6 +111,11 @@ public abstract class XmlZenCodingGenerator extends ZenCodingGenerator {
prevVisibleLeaf = PsiTreeUtil.prevVisibleLeaf(prevVisibleLeaf);
}
+ if (startOffset < 0 || currentOffset > documentText.length() || currentOffset < startOffset) {
+ Logger.getInstance(getClass()).error("Error while calculating emmet abbreviation. Offset: " + currentOffset + "; Start: " + startOffset,
+ AttachmentFactory.createAttachment(editor.getDocument()));
+ return null;
+ }
String key = computeKey(documentText.subSequence(startOffset, currentOffset));
return !StringUtil.isEmpty(key) && ZenCodingTemplate.checkTemplateKey(key, callback, this) ? key : null;
}
diff --git a/xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/AddOperationNode.java b/xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/AddOperationNode.java
index c63375ef6808..12f2610962c4 100644
--- a/xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/AddOperationNode.java
+++ b/xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/AddOperationNode.java
@@ -65,4 +65,9 @@ public class AddOperationNode extends ZenCodingNode {
public String toString() {
return "+";
}
+
+ @Override
+ public int getApproximateOutputLength(CustomTemplateCallback callback) {
+ return myLeftOperand.getApproximateOutputLength(callback) + myRightOperand.getApproximateOutputLength(callback);
+ }
}
diff --git a/xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/ClimbUpOperationNode.java b/xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/ClimbUpOperationNode.java
index 1648a36f6408..28cc0a8c1533 100644
--- a/xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/ClimbUpOperationNode.java
+++ b/xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/ClimbUpOperationNode.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -71,4 +71,9 @@ public class ClimbUpOperationNode extends ZenCodingNode {
public String toString() {
return "^";
}
+
+ @Override
+ public int getApproximateOutputLength(CustomTemplateCallback callback) {
+ return myLeftOperand.getApproximateOutputLength(callback) + myRightOperand.getApproximateOutputLength(callback);
+ }
}
diff --git a/xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/FilterNode.java b/xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/FilterNode.java
index 2de1c998e140..2ac50c7438aa 100644
--- a/xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/FilterNode.java
+++ b/xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/FilterNode.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2010 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -17,6 +17,7 @@ package com.intellij.codeInsight.template.emmet.nodes;
import com.intellij.codeInsight.template.CustomTemplateCallback;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
import java.util.List;
@@ -50,6 +51,11 @@ public class FilterNode extends ZenCodingNode {
}
@Override
+ public int getApproximateOutputLength(@Nullable CustomTemplateCallback callback) {
+ return myNode.getApproximateOutputLength(callback);
+ }
+
+ @Override
public String toString() {
return "Filter(" + myFilter + ")";
}
diff --git a/xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/LoremNode.java b/xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/LoremNode.java
index 7beab3c721b4..542af14d8ec0 100644
--- a/xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/LoremNode.java
+++ b/xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/LoremNode.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,6 +21,7 @@ import com.intellij.codeInsight.template.emmet.tokens.TemplateToken;
import com.intellij.codeInsight.template.impl.TemplateImpl;
import com.intellij.openapi.util.Couple;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
import java.util.Collections;
import java.util.List;
@@ -54,6 +55,12 @@ public class LoremNode extends ZenCodingNode {
}
@Override
+ public int getApproximateOutputLength(@Nullable CustomTemplateCallback callback) {
+
+ return myWordsCount * 7;
+ }
+
+ @Override
public String toString() {
return "Lorem(" + myWordsCount + ")";
}
diff --git a/xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/MoreOperationNode.java b/xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/MoreOperationNode.java
index fa8021565511..0a1bea140d6b 100644
--- a/xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/MoreOperationNode.java
+++ b/xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/MoreOperationNode.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2010 JetBrains s.r.o.
+ * Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,6 +19,7 @@ import com.intellij.codeInsight.template.CustomTemplateCallback;
import com.intellij.openapi.util.text.LineTokenizer;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
import java.util.List;
@@ -49,6 +50,12 @@ public class MoreOperationNode extends ZenCodingNode {
return ContainerUtil.newLinkedList(myLeftOperand, myRightOperand);
}
+ @Override
+ public int getApproximateOutputLength(@Nullable CustomTemplateCallback callback) {
+ int mul = myLeftOperand instanceof MulOperationNode ? ((MulOperationNode)myLeftOperand).getRightOperand() : 1;
+ return myLeftOperand.getApproximateOutputLength(callback) + (myRightOperand.getApproximateOutputLength(callback) * mul);
+ }
+
@NotNull
@Override
public List<GenerationNode> expand(int numberInIteration,
diff --git a/xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/MulOperationNode.java b/xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/MulOperationNode.java
index ec9eee193c80..1934d9e07099 100644
--- a/xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/MulOperationNode.java
+++ b/xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/MulOperationNode.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2010 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -17,6 +17,7 @@ package com.intellij.codeInsight.template.emmet.nodes;
import com.intellij.codeInsight.template.CustomTemplateCallback;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
import java.util.List;
@@ -55,6 +56,11 @@ public class MulOperationNode extends ZenCodingNode {
}
@Override
+ public int getApproximateOutputLength(@Nullable CustomTemplateCallback callback) {
+ return myLeftOperand.getApproximateOutputLength(callback) * myRightOperand;
+ }
+
+ @Override
public String toString() {
return "*";
}
diff --git a/xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/TemplateNode.java b/xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/TemplateNode.java
index 685f0b396899..28871e1069d6 100644
--- a/xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/TemplateNode.java
+++ b/xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/TemplateNode.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -60,21 +60,19 @@ public class TemplateNode extends ZenCodingNode {
String templateKey = templateToken.getKey();
if (myGenerator != null && StringUtil.containsChar(templateKey, '$') && callback.findApplicableTemplate(templateKey) == null) {
String newTemplateKey = ZenCodingUtil.replaceMarkers(templateKey, numberInIteration, totalIterations, surroundedText);
- TemplateToken newTemplateToken = new TemplateToken(newTemplateKey,
- templateToken.getAttribute2Value());
-
+ TemplateToken newTemplateToken = new TemplateToken(newTemplateKey, templateToken.getAttribute2Value());
TemplateImpl template = myGenerator.createTemplateByKey(newTemplateKey);
if (template != null) {
template.setDeactivated(true);
newTemplateToken.setTemplate(template, callback);
templateToken = newTemplateToken;
}
- }
+ }
- GenerationNode node = new GenerationNode(templateToken, numberInIteration, totalIterations,
- surroundedText, insertSurroundedTextAtTheEnd, parent);
- return Arrays.asList(node);
-}
+ GenerationNode node = new GenerationNode(templateToken, numberInIteration, totalIterations,
+ surroundedText, insertSurroundedTextAtTheEnd, parent);
+ return Arrays.asList(node);
+ }
@Override
public String toString() {
@@ -85,4 +83,17 @@ public class TemplateNode extends ZenCodingNode {
}
return "Template(" + result + ")";
}
+
+ @Override
+ public int getApproximateOutputLength(@Nullable CustomTemplateCallback callback) {
+ TemplateImpl template = myTemplateToken.getTemplate();
+ if (template != null) {
+ int result = template.getTemplateText().length();
+ for (Couple<String> attribute : myTemplateToken.getAttribute2Value()) {
+ result += attribute.first.length() + attribute.second.length() + 4; //plus space, eq, quotes
+ }
+ return result;
+ }
+ return 0;
+ }
}
diff --git a/xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/TextNode.java b/xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/TextNode.java
index e47de7a937cc..d619387ecf31 100644
--- a/xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/TextNode.java
+++ b/xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/TextNode.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2000-2014 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.template.emmet.nodes;
import com.intellij.codeInsight.template.CustomTemplateCallback;
@@ -6,6 +21,7 @@ import com.intellij.codeInsight.template.emmet.tokens.TemplateToken;
import com.intellij.codeInsight.template.emmet.tokens.TextToken;
import com.intellij.codeInsight.template.impl.TemplateImpl;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
import java.util.Collections;
import java.util.List;
@@ -45,6 +61,11 @@ public class TextNode extends ZenCodingNode {
}
@Override
+ public int getApproximateOutputLength(@Nullable CustomTemplateCallback callback) {
+ return myText.length();
+ }
+
+ @Override
public String toString() {
return "Text(" + myText + ")";
}
diff --git a/xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/UnaryMulOperationNode.java b/xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/UnaryMulOperationNode.java
index 78eb446d1f59..96e1e2ec99ba 100644
--- a/xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/UnaryMulOperationNode.java
+++ b/xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/UnaryMulOperationNode.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2010 JetBrains s.r.o.
+ * Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,6 +18,7 @@ package com.intellij.codeInsight.template.emmet.nodes;
import com.intellij.codeInsight.template.CustomTemplateCallback;
import com.intellij.openapi.util.text.LineTokenizer;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
import java.util.List;
@@ -43,7 +44,7 @@ public class UnaryMulOperationNode extends ZenCodingNode {
CustomTemplateCallback callback,
boolean insertSurroundedTextAtTheEnd, GenerationNode parent) {
if (surroundedText == null) {
- return myOperand.expand(numberInIteration, totalIterations, surroundedText, callback, insertSurroundedTextAtTheEnd, parent);
+ return myOperand.expand(numberInIteration, totalIterations, null, callback, insertSurroundedTextAtTheEnd, parent);
}
String[] lines = LineTokenizer.tokenize(surroundedText, false);
List<GenerationNode> result = new ArrayList<GenerationNode>();
@@ -54,6 +55,11 @@ public class UnaryMulOperationNode extends ZenCodingNode {
}
@Override
+ public int getApproximateOutputLength(@Nullable CustomTemplateCallback callback) {
+ return myOperand.getApproximateOutputLength(callback);
+ }
+
+ @Override
public String toString() {
return "*";
}
diff --git a/xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/ZenCodingNode.java b/xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/ZenCodingNode.java
index 550d05d5d186..d246f40007f4 100644
--- a/xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/ZenCodingNode.java
+++ b/xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/ZenCodingNode.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2010 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -17,6 +17,7 @@ package com.intellij.codeInsight.template.emmet.nodes;
import com.intellij.codeInsight.template.CustomTemplateCallback;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
import java.util.Collections;
import java.util.List;
@@ -35,4 +36,6 @@ public abstract class ZenCodingNode {
public List<ZenCodingNode> getChildren() {
return Collections.emptyList();
}
+
+ public abstract int getApproximateOutputLength(@Nullable CustomTemplateCallback callback);
}
diff --git a/xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/ZenEmptyNode.java b/xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/ZenEmptyNode.java
index 9b92681068cd..9282d36f1927 100644
--- a/xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/ZenEmptyNode.java
+++ b/xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/ZenEmptyNode.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -17,6 +17,7 @@ package com.intellij.codeInsight.template.emmet.nodes;
import com.intellij.codeInsight.template.CustomTemplateCallback;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
import java.util.Collections;
import java.util.List;
@@ -39,6 +40,11 @@ public class ZenEmptyNode extends ZenCodingNode {
}
@Override
+ public int getApproximateOutputLength(@Nullable CustomTemplateCallback callback) {
+ return 0;
+ }
+
+ @Override
public String toString() {
return "EMPTY_NODE";
}
diff --git a/xml/impl/src/com/intellij/ide/browsers/WebBrowserManager.java b/xml/impl/src/com/intellij/ide/browsers/WebBrowserManager.java
index a2d78ccb898b..ce51ee07eebc 100644
--- a/xml/impl/src/com/intellij/ide/browsers/WebBrowserManager.java
+++ b/xml/impl/src/com/intellij/ide/browsers/WebBrowserManager.java
@@ -17,7 +17,10 @@ package com.intellij.ide.browsers;
import com.intellij.openapi.components.*;
import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.util.*;
+import com.intellij.openapi.util.Condition;
+import com.intellij.openapi.util.Conditions;
+import com.intellij.openapi.util.JDOMUtil;
+import com.intellij.openapi.util.SimpleModificationTracker;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.util.SmartList;
import com.intellij.util.xmlb.SkipDefaultValuesSerializationFilters;
@@ -325,15 +328,6 @@ public class WebBrowserManager extends SimpleModificationTracker implements Pers
}
@NotNull
- @Deprecated
- /**
- * @deprecated Use {@link #getFirstBrowser(BrowserFamily)}
- */
- public WebBrowser getBrowser(@NotNull BrowserFamily family) {
- return getFirstBrowser(family);
- }
-
- @NotNull
public WebBrowser getFirstBrowser(@NotNull BrowserFamily family) {
for (ConfigurableWebBrowser browser : browsers) {
if (browser.isActive() && family.equals(browser.getFamily())) {
diff --git a/xml/impl/src/com/intellij/ide/browsers/actions/OpenInBrowserBaseGroupAction.java b/xml/impl/src/com/intellij/ide/browsers/actions/OpenInBrowserBaseGroupAction.java
index 5dd70c03ec77..482828c24c5e 100644
--- a/xml/impl/src/com/intellij/ide/browsers/actions/OpenInBrowserBaseGroupAction.java
+++ b/xml/impl/src/com/intellij/ide/browsers/actions/OpenInBrowserBaseGroupAction.java
@@ -30,6 +30,7 @@ public abstract class OpenInBrowserBaseGroupAction extends ComputableActionGroup
protected OpenInBrowserBaseGroupAction(boolean popup) {
super(popup);
+
Presentation p = getTemplatePresentation();
p.setText("Open in _Browser");
p.setDescription("Open selected file in browser");
@@ -76,9 +77,10 @@ public abstract class OpenInBrowserBaseGroupAction extends ComputableActionGroup
public OpenInBrowserEditorContextBarGroupAction() {
super(false);
}
- }
- public void update(@NotNull AnActionEvent e) {
- e.getPresentation().setVisible(!ActionGroupUtil.isGroupEmpty(this, e));
+ @Override
+ public void update(@NotNull AnActionEvent e) {
+ e.getPresentation().setVisible(!WebBrowserManager.getInstance().getBrowsers().isEmpty());
+ }
}
} \ No newline at end of file
diff --git a/xml/impl/src/com/intellij/openapi/options/colors/pages/XMLColorsPage.java b/xml/impl/src/com/intellij/openapi/options/colors/pages/XMLColorsPage.java
index b774c8e9e82f..d5a8f7fa77f4 100644
--- a/xml/impl/src/com/intellij/openapi/options/colors/pages/XMLColorsPage.java
+++ b/xml/impl/src/com/intellij/openapi/options/colors/pages/XMLColorsPage.java
@@ -84,8 +84,14 @@ public class XMLColorsPage implements ColorSettingsPage {
" <indexitem text=\"rename\" target=\"refactoring.rename\"/>\n" +
" <indexitem text=\"move\" target=\"refactoring.move\"/>\n" +
" <indexitem text=\"migrate\" target=\"refactoring.migrate\"/>\n" +
- " <indexitem text=\"usage search\" target=\"find.findUsages\"/>\n&amp; &#x00B7;" +
- " <indexitem text=\"project\" target=\"project.management\"/>" +
+ " <indexitem text=\"usage search\" target=\"find.findUsages\"/>\n" +
+ " <someTextWithEntityRefs>&amp; &#x00B7;</someTextWithEntityRefs>\n" +
+ " <withCData><![CDATA[\n" +
+ " <object class=\"MyClass\" key=\"constant\">\n" +
+ " </object>\n" +
+ " ]]>\n" +
+ " </withCData>\n" +
+ " <indexitem text=\"project\" target=\"project.management\"/>\n" +
" <<bg><np>pf</np></bg>:foo <bg><np>pf</np></bg>:bar=\"bar\"/>\n" +
"</index>";
}
diff --git a/xml/impl/src/com/intellij/xml/util/UserColorLookup.java b/xml/impl/src/com/intellij/xml/util/UserColorLookup.java
index 46c82f243787..ac6f473e5be2 100644
--- a/xml/impl/src/com/intellij/xml/util/UserColorLookup.java
+++ b/xml/impl/src/com/intellij/xml/util/UserColorLookup.java
@@ -36,6 +36,7 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.awt.*;
+import java.util.List;
/**
* @author maxim
@@ -79,7 +80,7 @@ public class UserColorLookup extends LookupElementDecorator<LookupElement> {
context.getDocument().deleteString(context.getStartOffset(), context.getTailOffset());
- ColorPickerListener[] listeners = ColorPickerListenerFactory.createListenersFor(element);
+ List<ColorPickerListener> listeners = ColorPickerListenerFactory.createListenersFor(element);
Color color = ColorChooser.chooseColor(WindowManager.getInstance().suggestParentWindow(context.getProject()),
XmlBundle.message("choose.color.dialog.title"), myColorAtCaret, true, listeners, true);