Merge branch 'master' of git@git.labs.intellij.net:idea/community

This commit is contained in:
Kirill Kalishev
2011-07-14 13:29:11 +04:00
280 changed files with 4109 additions and 2261 deletions
+496 -3
View File
@@ -2,9 +2,15 @@
<profile version="1.0" is_locked="false">
<option name="myName" value="idea.default.no.spellchecker" />
<option name="myLocal" value="false" />
<inspection_tool class="AbstractBeanReferencesInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="AbstractClassNeverImplemented" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="AbstractMethodCallInConstructor" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="AndroidDomInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="AppEngineForbiddenCode" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="ArchaicSystemPropertyAccess" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="ArgNamesErrorsInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="ArgNamesWarningsInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="AroundAdviceStyleInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="AssignmentToForLoopParameter" enabled="true" level="WARNING" enabled_by_default="true">
<option name="m_checkForeachParameters" value="false" />
</inspection_tool>
@@ -21,46 +27,134 @@
<inspection_tool class="AutoUnboxing" enabled="true" level="WARNING" enabled_by_default="false">
<scope name="runtime.classes" level="WARNING" enabled="true" />
</inspection_tool>
<inspection_tool class="AutowiredDependenciesInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="BadExpressionStatementJS" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="BindingAnnotationWithoutInject" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="BooleanMethodIsAlwaysInverted" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="BuildoutUnresolvedPartInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="BusyWait" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="BvConfigDomInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="BvConstraintMappingsInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="CStyleArrayDeclaration" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="CallerJS" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="CastConflictsWithInstanceof" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="CastToIncompatibleInterface" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="CdiDecoratorInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="CdiDisposerMethodInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="CdiInjectInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="CdiInspectionPointsInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="CdiInterceptorInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="CdiNormalScopeInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="CdiObservesInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="CdiSpecializesInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="CdiStereotypeInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="CdiStereotypeRestrictionsInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="CdiTypedAnnotationInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="ChainedEquality" enabled="false" level="WARNING" enabled_by_default="true" />
<inspection_tool class="CheckEmptyScriptTag" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="CheckImageSize" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="CheckNodeTest" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="CheckValidXmlInScriptTagBody" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="ClassNameSameAsAncestorName" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="CloneCallsSuperClone" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="CloneDeclaresCloneNotSupported" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="CommaExpressionJS" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="ComparisonOfShortAndChar" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="ConditionalExpressionWithIdenticalBranches" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="ConflictingAnnotations" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="ConfusingOctalEscape" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="ConstantConditionalExpression" enabled="true" level="WARNING" enabled_by_default="true">
<scope name="IDEA Test Sources" level="WARNING" enabled="false" />
</inspection_tool>
<inspection_tool class="ConstantConditionalExpressionJS" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="ConstantConditions" enabled="true" level="WARNING" enabled_by_default="true">
<scope name="runtime.classes" level="WARNING" enabled="false">
<option name="SUGGEST_NULLABLE_ANNOTATIONS" value="false" />
<option name="DONT_REPORT_TRUE_ASSERT_STATEMENTS" value="false" />
</scope>
<option name="SUGGEST_NULLABLE_ANNOTATIONS" value="true" />
<option name="SUGGEST_NULLABLE_ANNOTATIONS" value="false" />
<option name="DONT_REPORT_TRUE_ASSERT_STATEMENTS" value="false" />
</inspection_tool>
<inspection_tool class="ConstantIfStatement" enabled="true" level="WARNING" enabled_by_default="true">
<scope name="IDEA Test Sources" level="WARNING" enabled="false" />
</inspection_tool>
<inspection_tool class="ConstantIfStatementJS" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="ConstraintValidatorCreator" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="ContinueOrBreakFromFinallyBlock" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="ContinueOrBreakFromFinallyBlockJS" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="CovariantCompareTo" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="CovariantEquals" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="CssInvalidElementInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="CssInvalidHtmlTagReferenceInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="CssInvalidImportInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="CssInvalidShorthandPropertyValue" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="CssNegativeValueInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="CssNoGenericFontName" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="CssOptimizeSimilarPropertiesInspection" enabled="false" level="INFO" enabled_by_default="false" />
<inspection_tool class="CssOverwrittenProperties" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="CssRgbFunctionInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="CssUnitlessNumber" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="CssUnknownProperty" enabled="false" level="WARNING" enabled_by_default="false">
<option name="myCustomPropertiesEnabled" value="false" />
<option name="myIgnoreVendorSpecificProperties" value="false" />
<option name="myCustomPropertiesList">
<value>
<list size="0" />
</value>
</option>
</inspection_tool>
<inspection_tool class="CssUnusedSymbolInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="DeclareParentsInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="DjangoBrokenLineCommentInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="DjangoCloseTagInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="DjangoUnresolvedFilterInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="DjangoUnresolvedLoadInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="DjangoUnresolvedStaticReferenceInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="DjangoUnresolvedTagInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="DjangoUnresolvedTemplateReferenceInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="DoubleCheckedLocking" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ignoreOnVolatileVariables" value="true" />
</inspection_tool>
<inspection_tool class="DuplicateCaseLabelJS" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="DuplicateCondition" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ignoreMethodCalls" value="false" />
</inspection_tool>
<inspection_tool class="DuplicatedBeanNamesInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="DuplicatedBlockNamesInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="ELMethodSignatureInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="ELSpecValidationInJSP" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="ELValidationInJSP" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="EjbClassBasicInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="EjbClassWarningsInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="EjbDomInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="EjbEntityClassInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="EjbEntityHomeInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="EjbEntityInterfaceInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="EjbEnvironmentInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="EjbInterceptorInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="EjbInterceptorWarningsInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="EjbInterfaceMethodInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="EjbInterfaceSignatureInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="EjbProhibitedPackageUsageInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="EjbQlInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="EjbRemoteRequirementsInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="EjbSessionHomeInterfaceInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="EjbStaticAccessInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="EjbThisExpressionInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="EmptyStatementBodyJS" enabled="false" level="WARNING" enabled_by_default="false">
<option name="m_reportEmptyBlocks" value="false" />
</inspection_tool>
<inspection_tool class="EmptySynchronizedStatement" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="EmptyWebServiceClass" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="EnumSwitchStatementWhichMissesCases" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ignoreSwitchStatementsWithDefault" value="false" />
</inspection_tool>
<inspection_tool class="ExceptionCaughtLocallyJS" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="ExceptionNameDoesntEndWithException" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="ExtendsTagPositionInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="FaceletsDetectingInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="FacesModelInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="FallthroughInSwitchStatementJS" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="FieldAccessedSynchronizedAndUnsynchronized" enabled="true" level="WARNING" enabled_by_default="true">
<option name="countGettersAndSetters" value="false" />
</inspection_tool>
@@ -73,16 +167,123 @@
<option name="m_ignoreLoopsWithoutConditions" value="false" />
</inspection_tool>
<inspection_tool class="ForLoopThatDoesntUseLoopVariable" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="FtlCallsInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="FtlDeprecatedBuiltInsInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="FtlFileReferencesInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="FtlImportCallInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="FtlReferencesInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="FtlTypesInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="FtlWellformednessInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="FunctionWithInconsistentReturnsJS" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="GWTRemoteServiceAsyncCheck" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="GWTStyleCheck" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="Geronimo" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="Glassfish" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="GwtClientClassFromNonInheritedModule" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="GwtCssResourceErrors" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="GwtDeprecatedEventListeners" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="GwtDeprecatedPropertyKeyJavadocTag" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="GwtInconsistentI18nInterface" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="GwtInconsistentSerializableClass" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="GwtJavaScriptReferences" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="GwtMethodWithParametersInConstantsInterface" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="GwtObsoleteTypeArgsJavadocTag" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="GwtServiceNotRegistered" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="GwtSetServiceEntryPointCalls" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="GwtToHtmlReferences" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="GwtUiFieldErrors" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="GwtUiHandlerErrors" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="HardwiredNamespacePrefix" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="HibernateConfigDomFacetInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="HibernateConfigDomInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="HibernateMappingDatasourceDomInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="HibernateMappingDomInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="HtmlDeprecatedTag" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="HtmlExtraClosingTag" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="HtmlFormInputWithoutLabel" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="HtmlPresentationalElement" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="HtmlUnknownAttribute" enabled="false" level="WARNING" enabled_by_default="false">
<option name="myValues">
<value>
<list size="0" />
</value>
</option>
<option name="myCustomValuesEnabled" value="true" />
</inspection_tool>
<inspection_tool class="HtmlUnknownTag" enabled="false" level="WARNING" enabled_by_default="false">
<option name="myValues">
<value>
<list size="4">
<item index="0" class="java.lang.String" itemvalue="nobr" />
<item index="1" class="java.lang.String" itemvalue="noembed" />
<item index="2" class="java.lang.String" itemvalue="comment" />
<item index="3" class="java.lang.String" itemvalue="noscript" />
</list>
</value>
</option>
<option name="myCustomValuesEnabled" value="true" />
</inspection_tool>
<inspection_tool class="IOResource" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ignoredTypesString" value="java.io.ByteArrayOutputStream,java.io.ByteArrayInputStream,java.io.StringBufferInputStream,java.io.CharArrayWriter,java.io.CharArrayReader,java.io.StringWriter,java.io.StringReader" />
<option name="insideTryAllowed" value="false" />
</inspection_tool>
<inspection_tool class="IfStatementWithIdenticalBranches" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="ImplicitTypeConversion" enabled="false" level="WARNING" enabled_by_default="false">
<option name="BITS" value="1720" />
<option name="FLAG_EXPLICIT_CONVERSION" value="true" />
<option name="IGNORE_NODESET_TO_BOOLEAN_VIA_STRING" value="true" />
</inspection_tool>
<inspection_tool class="ImplicitlyExposedWebServiceMethods" enabled="false" level="INFO" enabled_by_default="false" />
<inspection_tool class="IncompatibleMaskJS" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="IndexZeroUsage" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="InfiniteLoopJS" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="InfiniteRecursionJS" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="InjectOfNonPublicMember" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="InjectionValueTypeInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="InnerClassMayBeStatic" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="InstanceofCatchParameter" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="InstanceofIncompatibleInterface" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="InterceptionAnnotationWithoutRuntimeRetention" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="InvalidImplementedBy" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="InvalidProvidedBy" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="InvalidRequestParameters" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JBoss" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="JSDeprecatedSymbols" enabled="false" level="INFO" enabled_by_default="false" />
<inspection_tool class="JSDuplicatedDeclaration" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JSFieldCanBeLocal" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JSImplicitlyInternalDeclaration" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JSLastCommaInArrayLiteral" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JSLastCommaInObjectLiteral" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="JSLowercasedConstructorCall" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JSMethodCanBeStatic" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JSMismatchedCollectionQueryUpdate" enabled="false" level="WARNING" enabled_by_default="false">
<option name="queries" value="trace,write" />
<option name="updates" value="pop,push,shift,splice,unshift" />
</inspection_tool>
<inspection_tool class="JSPotentiallyInvalidConstructorUsage" enabled="false" level="WARNING" enabled_by_default="false">
<option name="myConsiderUppercaseFunctionsToBeConstructors" value="true" />
</inspection_tool>
<inspection_tool class="JSPotentiallyInvalidTargetOfIndexedPropertyAccess" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JSPotentiallyInvalidUsageOfThis" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JSReferencingMutableVariableFromClosure" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JSSuspiciousNameCombination" enabled="false" level="WARNING" enabled_by_default="false">
<group names="x,width,left,right" />
<group names="y,height,top,bottom" />
<exclude classes="Math" />
</inspection_tool>
<inspection_tool class="JSUndeclaredVariable" enabled="false" level="INFO" enabled_by_default="false" />
<inspection_tool class="JSUnfilteredForInLoop" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JSUnnecessarySemicolon" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JSUnresolvedFunction" enabled="false" level="INFO" enabled_by_default="false" />
<inspection_tool class="JSUnresolvedLibraryURL" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JSUnresolvedVariable" enabled="false" level="INFO" enabled_by_default="false" />
<inspection_tool class="JSUntypedDeclaration" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JSUnusedGlobalSymbols" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JSUnusedLocalSymbols" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JSValidateJSON" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="JSValidateTypes" enabled="false" level="INFO" enabled_by_default="false" />
<inspection_tool class="JUnitTestClassNamingConvention" enabled="true" level="WARNING" enabled_by_default="true">
<option name="m_regex" value="[A-Z][A-Za-z]*Test" />
<option name="m_regex" value="[A-Z][A-Za-z\d]*Test" />
<option name="m_minLength" value="8" />
<option name="m_maxLength" value="64" />
</inspection_tool>
@@ -215,6 +416,31 @@
<scope name="idea openapi" level="WARNING" enabled="true" />
<scope name="runtime.classes" level="ERROR" enabled="true" />
</inspection_tool>
<inspection_tool class="JavaeeApplicationDomInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="JdkProxiedBeanTypeInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="JpaAttributeMemberSignatureInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="JpaAttributeTypeInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="JpaConfigDomFacetInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JpaDataSourceORMDomInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="JpaDataSourceORMInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="JpaDomInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="JpaEntityListenerInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="JpaEntityListenerWarningsInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JpaModelReferenceInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="JpaORMDomInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="JpaObjectClassSignatureInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="JpaQlInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="JpaQueryApiInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="JsfJamExtendsClassInconsistencyInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="JsfManagedBeansInconsistencyInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="JspDirectiveInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="JspPropertiesInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="LessUnresolvedVariable" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="LoopStatementThatDoesntLoopJS" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="ManagedBeanClassInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="ManagedBeanInconsistencyInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="MavenDuplicateDependenciesInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="MavenModelInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="MethodMayBeStatic" enabled="true" level="WARNING" enabled_by_default="true">
<option name="m_onlyPrivateOrFinal" value="false" />
<option name="m_ignoreEmptyMethods" value="true" />
@@ -223,19 +449,28 @@
<inspection_tool class="MethodOverloadsParentMethod" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="MethodOverridesPrivateMethod" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="MethodOverridesStaticMethod" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="MimeType" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="MinMaxValuesInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="MissedExecutable" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="MissingAspectjAutoproxyInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="MisspelledCompareTo" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="MisspelledEquals" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="MisspelledHashcode" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="MisspelledSetUp" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="MisspelledTearDown" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="MisspelledToString" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="MultipleBindingAnnotations" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="MultipleDeclaration" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ignoreForLoopDeclarations" value="true" />
</inspection_tool>
<inspection_tool class="MultipleInjectedConstructorsForClass" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="MultipleTypedDeclaration" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="NestedSynchronizedStatement" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="NoExplicitFinalizeCalls" enabled="true" level="WARNING" enabled_by_default="false" />
<inspection_tool class="NonExceptionNameEndsWithException" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="NonJREEmulationClassesInClientCode" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="NonJaxWsWebServices" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="NonSerializableServiceParameters" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="NonStaticFinalLogger" enabled="true" level="WARNING" enabled_by_default="true">
<scope name="IDEA Test Sources" level="WARNING" enabled="false">
<option name="loggerClassName" value="java.util.logging.Logger" />
@@ -243,21 +478,135 @@
<option name="loggerClassName" value="java.util.logging.Logger" />
</inspection_tool>
<inspection_tool class="NonSynchronizedMethodOverridesSynchronizedMethod" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="NullableProblems" enabled="true" level="WARNING" enabled_by_default="true">
<option name="REPORT_NULLABLE_METHOD_OVERRIDES_NOTNULL" value="true" />
<option name="REPORT_NOT_ANNOTATED_METHOD_OVERRIDES_NOTNULL" value="true" />
<option name="REPORT_NOTNULL_PARAMETER_OVERRIDES_NULLABLE" value="true" />
<option name="REPORT_NOT_ANNOTATED_PARAMETER_OVERRIDES_NOTNULL" value="true" />
<option name="REPORT_NOT_ANNOTATED_GETTER" value="true" />
<option name="REPORT_NOT_ANNOTATED_SETTER_PARAMETER" value="true" />
<option name="REPORT_ANNOTATION_NOT_PROPAGATED_TO_OVERRIDERS" value="true" />
<option name="REPORT_NULLS_PASSED_TO_NON_ANNOTATED_METHOD" value="false" />
</inspection_tool>
<inspection_tool class="ObjectEqualsNull" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="ObjectNotify" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="ObsoleteCollection" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ignoreRequiredObsoleteCollectionTypes" value="false" />
</inspection_tool>
<inspection_tool class="OctalIntegerJS" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="OneWayWebMethod" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="PageflowModelInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="PagesFileModelInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="PagesModelInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="PathAnnotation" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PhpDynamicAsStaticMethodCallInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PhpIncludeInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PhpParamsInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PhpUndefinedClassConstantInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PhpUndefinedClassInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PhpUndefinedConstantInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PhpUndefinedFieldInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PhpUndefinedFunctionInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PhpUndefinedMethodInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PhpUndefinedVariableInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PhpUnimplementedMethodsInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="PhpUnusedLocalVariableInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PhpUnusedPrivateFieldInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PointcutMethodStyleInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PointlessArithmeticExpression" enabled="true" level="WARNING" enabled_by_default="true">
<option name="m_ignoreExpressionsContainingConstants" value="true" />
</inspection_tool>
<inspection_tool class="PointlessArithmeticExpressionJS" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PointlessBinding" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PointlessBitwiseExpressionJS" enabled="false" level="WARNING" enabled_by_default="false">
<option name="m_ignoreExpressionsContainingConstants" value="false" />
</inspection_tool>
<inspection_tool class="PointlessBooleanExpressionJS" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="ProtectedMemberInFinalClass" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="PublicFieldAccessedInSynchronizedContext" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="PyArgumentEqualDefaultInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PyArgumentListInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PyAugmentAssignmentInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PyBroadExceptionInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PyByteLiteralInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PyCallByClassInspection" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
<inspection_tool class="PyCallingNonCallableInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PyChainedComparisonsInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PyComparisonWithNoneInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PyDecoratorInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PyDefaultArgumentInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PyDeprecatedModulesInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PyDeprecationInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PyDictCreationInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PyDictDuplicateKeysInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PyExceptClausesOrderInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PyExceptionInheritInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PyFromFutureImportInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PyInconsistentIndentationInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PyInitNewSignatureInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PyListCreationInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PyMethodFirstArgAssignmentInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PyMethodOverridingInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PyMethodParametersInspection" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
<inspection_tool class="PyMissingConstructorInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PyNestedDecoratorsInspection" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
<inspection_tool class="PyOldStyleClassesInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PyPropertyAccessInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PyPropertyDefinitionInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PyRaisingNewStyleClassInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PyRedundantParenthesesInspection" enabled="false" level="WARNING" enabled_by_default="false">
<option name="myIgnorePercOperator" value="false" />
<option name="myIgnoreTupleInReturn" value="false" />
</inspection_tool>
<inspection_tool class="PyReturnFromInitInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PySetFunctionToLiteralInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PySimplifyBooleanCheckInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PySingleQuotedDocstringInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PyStatementEffectInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PyStringExceptionInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PyStringFormatInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PySuperArgumentsInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PyTrailingSemicolonInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PyTupleAssignmentBalanceInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PyTupleItemAssignmentInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PyTypeCheckerInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PyUnboundLocalVariableInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PyUnnecessaryBackslashInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PyUnreachableCodeInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PyUnresolvedReferencesInspection" enabled="false" level="WARNING" enabled_by_default="false">
<option name="ignoredIdentifiers">
<value>
<list size="0" />
</value>
</option>
</inspection_tool>
<inspection_tool class="PyUnusedLocalInspection" enabled="false" level="WARNING" enabled_by_default="false">
<option name="ignoreTupleUnpacking" value="true" />
<option name="ignoreLambdaParameters" value="true" />
<option name="ignoreLoopIterationVariables" value="true" />
</inspection_tool>
<inspection_tool class="Query_bound_parameters" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="Query_index_required" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="Query_restricted" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="RedundantScopeBinding" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="RedundantToBinding" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="RedundantToProviderBinding" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="RedundantTypeConversion" enabled="false" level="WARNING" enabled_by_default="false">
<option name="CHECK_ANY" value="true" />
</inspection_tool>
<inspection_tool class="ReferencesToClassesFromDefaultPackagesInJSPFile" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="ReplaceAssignmentWithOperatorAssignment" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ignoreLazyOperators" value="true" />
<option name="ignoreObscureOperators" value="true" />
</inspection_tool>
<inspection_tool class="SSBasedInspection" enabled="false" level="WARNING" enabled_by_default="false">
<inspection_tool class="RequiredAttributes" enabled="false" level="WARNING" enabled_by_default="false">
<option name="myAdditionalRequiredHtmlAttributes" value="" />
</inspection_tool>
<inspection_tool class="RequiredBeanTypeInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="ReservedWordUsedAsNameJS" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="Restricted_Python_calls" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="ReturnFromFinallyBlockJS" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SSBasedInspection" enabled="true" level="WARNING" enabled_by_default="true">
<searchConfiguration name="SwingUtilities.invokeLater" text="SwingUtilities.invokeLater($runnable$)" recursive="false" caseInsensitive="false" type="JAVA">
<constraint name="Instance" regexp="SwingUtilities" minCount="0" target="true" within="" contains="" />
<constraint name="MethodCall" within="" contains="" />
@@ -271,15 +620,57 @@
<constraint name="Parameter" minCount="0" maxCount="2147483647" within="" contains="" />
<constraint name="__context__" within="" contains="" />
</replaceConfiguration>
<replaceConfiguration name="new Object[0]" text="new Object[0]" recursive="false" caseInsensitive="true" type="JAVA" reformatAccordingToStyle="true" shortenFQN="true" replacement="com.intellij.util.ArrayUtil.EMPTY_OBJECT_ARRAY" />
<replaceConfiguration name="new String[0]" text="new String[0]" recursive="false" caseInsensitive="true" type="JAVA" reformatAccordingToStyle="true" shortenFQN="true" replacement="com.intellij.util.ArrayUtil.EMPTY_STRING_ARRAY" />
<replaceConfiguration name="new Class[0]" text="new Class[0]" recursive="false" caseInsensitive="true" type="JAVA" reformatAccordingToStyle="true" shortenFQN="true" replacement="com.intellij.util.ArrayUtil.EMPTY_CLASS_ARRAY" />
<replaceConfiguration name="Log.error" text="$LOG$.assertTrue(false, $e$)" recursive="false" caseInsensitive="true" type="JAVA" reformatAccordingToStyle="true" shortenFQN="true" replacement="$LOG$.error($e$)">
<constraint name="e" within="" contains="" />
<constraint name="LOG" within="" contains="" />
</replaceConfiguration>
<replaceConfiguration name="toStringArray" text="$collection$.toArray(new String[$collection$.size()])" recursive="false" caseInsensitive="true" type="JAVA" reformatAccordingToStyle="true" shortenFQN="true" replacement="com.intellij.util.ArrayUtil.toStringArray($collection$)">
<constraint name="collection" within="" contains="" />
</replaceConfiguration>
<replaceConfiguration name="toObjectArray" text="$collection$.toArray(new Object[$collection$.size()])" recursive="false" caseInsensitive="true" type="JAVA" reformatAccordingToStyle="true" shortenFQN="true" replacement="com.intellij.util.ArrayUtil.toObjectArray($collection$)">
<constraint name="collection" within="" contains="" />
</replaceConfiguration>
<replaceConfiguration name="toStringArray0" text="$collection$.toArray(new String[0])" recursive="false" caseInsensitive="true" type="JAVA" reformatAccordingToStyle="true" shortenFQN="true" replacement="com.intellij.util.ArrayUtil.toStringArray($collection$)">
<constraint name="collection" within="" contains="" />
</replaceConfiguration>
<replaceConfiguration name="toObjectArray0" text="$collection$.toArray(new Object[0])" recursive="false" caseInsensitive="true" type="JAVA" reformatAccordingToStyle="true" shortenFQN="true" replacement="com.intellij.util.ArrayUtil.toObjectArray($collection$)">
<constraint name="collection" within="" contains="" />
</replaceConfiguration>
<replaceConfiguration name="toStringArray00" text="$collection$.toArray(ArrayUtil.EMPTY_STRING_ARRAY)" recursive="false" caseInsensitive="true" type="JAVA" reformatAccordingToStyle="true" shortenFQN="true" replacement="com.intellij.util.ArrayUtil.toStringArray($collection$)">
<constraint name="collection" within="" contains="" />
</replaceConfiguration>
<replaceConfiguration name="toObjectArray00" text="$collection$.toArray(ArrayUtil.EMPTY_OBJECT_ARRAY)" recursive="false" caseInsensitive="true" type="JAVA" reformatAccordingToStyle="true" shortenFQN="true" replacement="com.intellij.util.ArrayUtil.toObjectArray($collection$)">
<constraint name="collection" within="" contains="" />
</replaceConfiguration>
</inspection_tool>
<inspection_tool class="SassOldSyntax" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SassUnresolvedMixin" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SassUnresolvedVariable" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SeamAnnotationIncorrectSignatureInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="SeamAnnotationsInconsistencyInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="SeamBijectionIllegalScopeParameterInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="SeamBijectionTypeMismatchInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="SeamBijectionUndefinedContextVariableInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SeamDomModelInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="SeamDuplicateComponentsInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="SeamIllegalComponentScopeInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="SeamJamComponentInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="SelfIncludingJspFiles" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="SessionScopedInjectsRequestScoped" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SetReplaceableByEnumSet" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="SetupCallsSuperSetup" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="SetupIsPublicVoidNoArg" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="ShiftOutOfRangeJS" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SillyAssignmentJS" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SimplifiableConditionalExpression" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SimplifiableIfStatement" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="Since15" enabled="true" level="ERROR" enabled_by_default="true">
<scope name="IDEA Test Sources" level="ERROR" enabled="false" />
</inspection_tool>
<inspection_tool class="SingletonInjectsScoped" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SocketResource" enabled="true" level="WARNING" enabled_by_default="true">
<option name="insideTryAllowed" value="false" />
</inspection_tool>
@@ -288,12 +679,51 @@
<option name="processLiterals" value="true" />
<option name="processComments" value="true" />
</inspection_tool>
<inspection_tool class="SpringAopErrorsInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="SpringAopWarningsInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SpringBeanAutowiringInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="SpringBeanConstructorArgInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="SpringBeanDepedencyCheckInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="SpringBeanInstantiationInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="SpringBeanLookupMethodInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="SpringBeanNameConventionInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SpringContextConfigurationInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="SpringFacetInspection" enabled="false" level="WARNING" enabled_by_default="false">
<option name="checkTestFiles" value="false" />
</inspection_tool>
<inspection_tool class="SpringFactoryMethodInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="SpringIncorrectResourceTypeInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="SpringInjectionValueConsistencyInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="SpringInjectionValueStyleInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SpringJavaAutowiringInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="SpringJavaConfigExternalBeansErrorInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SpringJavaConfigInconsistencyInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="SpringMessageDispatcherWebXmlInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="SpringModelInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="SpringOsgiElementsInconsistencyInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="SpringOsgiListenerInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="SpringOsgiServiceCommonInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="SpringPlaceholdersInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SpringPublicFactoryMethodInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SpringReplacedMethodsInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="SpringRequiredAnnotationInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="SpringRequiredPropertyInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="SpringScopesInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="SpringSecurityElementsInconsistencyInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="SpringSecurityFiltersConfiguredInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SpringWebServiceAnnotationsInconsistencyInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SpringWebServicesConfigurationsInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="StaticSuite" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="StringConstructor" enabled="false" level="WARNING" enabled_by_default="false">
<option name="ignoreSubstringArguments" value="false" />
</inspection_tool>
<inspection_tool class="StringEquality" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="StringEqualsEmptyString" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="Struts2ModelInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="StrutsInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="StrutsTilesInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="StrutsValidatorFormInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="StrutsValidatorInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="SwitchStatementWithConfusingDeclaration" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="SynchronizeOnThis" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="SystemOutErr" enabled="true" level="WARNING" enabled_by_default="true">
@@ -301,22 +731,30 @@
</inspection_tool>
<inspection_tool class="TeardownCallsSuperTeardown" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="TeardownIsPublicVoidNoArg" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="TelReferencesInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="TestCaseWithConstructor" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="TestCaseWithNoTestMethods" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ignoreSupers" value="false" />
</inspection_tool>
<inspection_tool class="TestMethodIsPublicVoidNoArg" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="TextLabelInSwitchStatement" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="ThisExpressionReferencesGlobalObjectJS" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="ThreadDumpStack" enabled="true" level="WARNING" enabled_by_default="true">
<scope name="IDEA Test Sources" level="WARNING" enabled="false" />
</inspection_tool>
<inspection_tool class="ThreadRun" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="ThreadStartInConstruction" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="ThrowFromFinallyBlockJS" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="ThrowablePrintStackTrace" enabled="true" level="WARNING" enabled_by_default="true">
<scope name="IDEA Test Sources" level="WARNING" enabled="false" />
</inspection_tool>
<inspection_tool class="TrivialConditionalJS" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="TrivialIf" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="TrivialIfJS" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="TrivialStringConcatenation" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="UninstantiableBinding" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="UninstantiableImplementedByClass" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="UninstantiableProvidedByClass" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="UnnecessarilyQualifiedStaticUsage" enabled="true" level="WARNING" enabled_by_default="true">
<scope name="IDEA Test Sources" level="WARNING" enabled="false">
<option name="m_ignoreStaticFieldAccesses" value="false" />
@@ -328,6 +766,7 @@
<option name="m_ignoreStaticAccessFromStaticContext" value="false" />
</inspection_tool>
<inspection_tool class="UnnecessaryBoxing" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="UnnecessaryContinueJS" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="UnnecessaryFullyQualifiedName" enabled="true" level="WARNING" enabled_by_default="true">
<scope name="IDEA Test Sources" level="WARNING" enabled="false">
<option name="m_ignoreJavadoc" value="false" />
@@ -335,16 +774,46 @@
<option name="m_ignoreJavadoc" value="true" />
</inspection_tool>
<inspection_tool class="UnnecessaryInterfaceModifier" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="UnnecessaryLabelJS" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="UnnecessaryLabelOnBreakStatement" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="UnnecessaryLabelOnBreakStatementJS" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="UnnecessaryLabelOnContinueStatement" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="UnnecessaryLabelOnContinueStatementJS" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="UnnecessaryLocalVariableJS" enabled="false" level="WARNING" enabled_by_default="false">
<option name="m_ignoreImmediatelyReturnedVariables" value="false" />
<option name="m_ignoreAnnotatedVariables" value="false" />
</inspection_tool>
<inspection_tool class="UnnecessaryQualifierForThis" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="UnnecessaryReturnJS" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="UnnecessaryStaticInjection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="UnnecessaryUnboxing" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="UnparsedCustomBeanInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="UnproxyableBeanTypesInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="UnreachableCodeJS" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="UnresolvedReference" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="UnterminatedStatementJS" enabled="false" level="WARNING" enabled_by_default="false">
<option name="ignoreSemicolonAtEndOfBlock" value="true" />
</inspection_tool>
<inspection_tool class="UseOfPropertiesAsHashtable" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="UtilSchemaInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="UtilityClassWithPublicConstructor" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="UtilityClassWithoutPrivateConstructor" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ignoreClassesWithOnlyMain" value="false" />
</inspection_tool>
<inspection_tool class="ValidExternallyBoundObject" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="ValidatorConfigModelInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="ValidatorModelInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="VoidMethodAnnotatedWithGET" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="VolatileLongOrDoubleField" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="VtlDirectiveArgsInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="VtlFileReferencesInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="VtlInterpolationsInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="VtlReferencesInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="VtlTypesInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="W3CssValidation" enabled="false" level="WARNING" enabled_by_default="false">
<option name="myCssVersion" value="css3" />
</inspection_tool>
<inspection_tool class="WSReferenceInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="WaitNotInLoop" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="WaitNotInSynchronizedContext" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="WaitWhileHoldingTwoLocks" enabled="true" level="WARNING" enabled_by_default="true" />
@@ -353,8 +822,32 @@
<option name="SUGGEST_PACKAGE_LOCAL_FOR_TOP_CLASSES" value="false" />
<option name="SUGGEST_PRIVATE_FOR_INNERS" value="false" />
</inspection_tool>
<inspection_tool class="WebProperties" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="WebWarnings" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="WebflowConfigModelInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="WebflowModelInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="Weblogic" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="WhileLoopSpinsOnField" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ignoreNonEmtpyLoops" value="false" />
</inspection_tool>
<inspection_tool class="WithStatementJS" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="XsltDeclarations" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="XsltTemplateInvocation" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="XsltUnusedDeclaration" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="XsltVariableShadowing" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="dependsOnMethodTestNG" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="groupsTestNG" enabled="false" level="WARNING" enabled_by_default="false">
<option name="groups">
<value>
<list size="0" />
</value>
</option>
</inspection_tool>
<inspection_tool class="gwtRawAsyncCallback" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="osmorcClassInDefaultPackage" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="osmorcMissingFinalNewline" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="osmorcMisspelledHeaderName" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="osmorcNonOsgiMavenDependency" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="osmorcUnregisteredActivator" enabled="false" level="ERROR" enabled_by_default="false" />
</profile>
</component>
@@ -318,6 +318,33 @@ public class EvaluatorBuilderImpl implements EvaluatorBuilder {
myResult = createBinaryEvaluator(lResult, lOperand.getType(), rResult, rOperand.getType(), opType, expressionExpectedType);
}
@Override
public void visitPolyadicExpression(PsiPolyadicExpression wideExpression) {
if (LOG.isDebugEnabled()) {
LOG.debug("visitPolyadicExpression " + wideExpression);
}
PsiExpression[] operands = wideExpression.getOperands();
operands[0].accept(this);
Evaluator result = myResult;
PsiType lType = operands[0].getType();
for (int i = 1; i < operands.length; i++) {
PsiExpression expression = operands[i];
if (expression == null) {
throwEvaluateException(DebuggerBundle.message("evaluation.error.invalid.expression", wideExpression.getText()));
return;
}
expression.accept(this);
Evaluator rResult = myResult;
IElementType opType = wideExpression.getOperationTokenType();
PsiType expressionExpectedType = expression.getType();
if (expressionExpectedType == null) {
throwEvaluateException(DebuggerBundle.message("evaluation.error.unknown.expression.type", expression.getText()));
}
myResult = createBinaryEvaluator(result, lType, rResult, expression.getType(), opType, expressionExpectedType);
lType = TypeConversionUtil.calcTypeForBinaryExpression(lType, expressionExpectedType, opType, true);
result = myResult;
}
}
// constructs binary evaluator handling unboxing and numeric promotion issues
private static BinaryExpressionEvaluator createBinaryEvaluator(
@@ -774,7 +801,7 @@ public class EvaluatorBuilderImpl implements EvaluatorBuilder {
final Evaluator operandEvaluator = myResult;
final IElementType operation = expression.getOperationSign().getTokenType();
final IElementType operation = expression.getOperationTokenType();
final PsiType operandType = operandExpression.getType();
@Nullable final PsiType unboxedOperandType = PsiPrimitiveType.getUnboxedType(operandType);
@@ -810,7 +837,7 @@ public class EvaluatorBuilderImpl implements EvaluatorBuilder {
@Nullable
final PsiType unboxedOperandType = PsiPrimitiveType.getUnboxedType(operandType);
final IElementType operation = expression.getOperationSign().getTokenType();
final IElementType operation = expression.getOperationTokenType();
if(operation == JavaTokenType.PLUSPLUS || operation == JavaTokenType.MINUSMINUS) {
try {
@@ -15,10 +15,7 @@
*/
package com.intellij.debugger.impl;
import com.intellij.debugger.DebuggerBundle;
import com.intellij.debugger.DebuggerManagerEx;
import com.intellij.debugger.NameMapper;
import com.intellij.debugger.PositionManager;
import com.intellij.debugger.*;
import com.intellij.debugger.apiAdapters.TransportServiceWrapper;
import com.intellij.debugger.engine.*;
import com.intellij.debugger.settings.DebuggerSettings;
@@ -41,6 +38,7 @@ import com.intellij.openapi.diagnostic.Logger;
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.extensions.Extensions;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.projectRoots.JavaSdk;
import com.intellij.openapi.projectRoots.JavaSdkVersion;
@@ -198,6 +196,12 @@ public class DebuggerManagerImpl extends DebuggerManagerEx {
process.appendPositionManager(positionManager);
}
}
for(PositionManagerFactory factory: Extensions.getExtensions(PositionManagerFactory.EP_NAME, myProject)) {
final PositionManager manager = factory.create(debugProcess);
if (manager != null) {
process.appendPositionManager(manager);
}
}
}
public void processDetached(final DebugProcess process, final boolean closedByUser) {
debugProcess.removeDebugProcessListener(this);
@@ -121,13 +121,16 @@ public class DebuggerTreeBase extends DnDAwareTree implements Disposable {
}
if (tipText.length() > 0) {
final StringTokenizer tokenizer = new StringTokenizer(tipText, "\n", true);
final StringTokenizer tokenizer = new StringTokenizer(tipText, "\n ", true);
while (tokenizer.hasMoreElements()) {
final String each = tokenizer.nextElement();
if ("\n".equals(each)) {
tipBuilder.append("<br>");
}
else if (" ".equals(each)) {
tipBuilder.append("&nbsp ");
}
else {
tipBuilder.append(JDOMUtil.legalizeText(each));
}
@@ -46,6 +46,9 @@ public abstract class DebuggerManager implements ProjectComponent, JDOMExternali
public abstract String getVMClassQualifiedName(PsiClass aClass);
/**
* @deprecated use PositionManagerFactory extension point instead
*/
public abstract void registerPositionManagerFactory(Function<DebugProcess, PositionManager> factory);
public abstract void unregisterPositionManagerFactory(Function<DebugProcess, PositionManager> factory);
@@ -0,0 +1,30 @@
/*
* 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 com.intellij.debugger;
import com.intellij.debugger.engine.DebugProcess;
import com.intellij.openapi.extensions.ExtensionPointName;
import org.jetbrains.annotations.Nullable;
/**
* @author yole
*/
public interface PositionManagerFactory {
ExtensionPointName<PositionManagerFactory> EP_NAME = ExtensionPointName.create("com.intellij.debugger.positionManagerFactory");
@Nullable
PositionManager create(DebugProcess process);
}
@@ -417,7 +417,7 @@ public class ClasspathPanelImpl extends JPanel implements ClasspathPanel {
downButton.setShortcut(KeyboardShortcut.fromString("alt DOWN"));
myEntryTable.setBorder(new LineBorder(UIUtil.getBorderColor()));
final TableToolbarDecorator decorator = TableToolbarDecorator.createDecorator(myEntryTable);
final ToolbarDecorator decorator = ToolbarDecorator.createDecorator(myEntryTable);
decorator
.addExtraAction(addButton)
.addExtraAction(removeButton)
@@ -476,7 +476,7 @@ public class ExpectedTypesProvider {
type = ((PsiAnonymousClass)resolved).getBaseClassType();
}
}
final int kind = assignment.getOperationSign().getTokenType() != JavaTokenType.EQ
final int kind = assignment.getOperationTokenType() != JavaTokenType.EQ
? ExpectedTypeInfo.TYPE_STRICTLY
: ExpectedTypeInfo.TYPE_OR_SUPERTYPE;
ExpectedTypeInfoImpl info = createInfoImpl(type, kind, type, TailType.NONE);
@@ -567,7 +567,6 @@ public class ExpectedTypesProvider {
PsiExpression op1 = expr.getLOperand();
PsiExpression op2 = expr.getROperand();
PsiJavaToken sign = expr.getOperationSign();
if (myForCompletion && op1.equals(myExpr)) {
final MyParentVisitor visitor = new MyParentVisitor(expr, myForCompletion, myClassProvider, myVoidable, myUsedAfter);
myExpr = (PsiExpression)myExpr.getParent();
@@ -583,7 +582,7 @@ public class ExpectedTypesProvider {
PsiExpression anotherExpr = op1.equals(myExpr) ? op2 : op1;
PsiType anotherType = anotherExpr != null ? anotherExpr.getType() : null;
PsiElementFactory factory = JavaPsiFacade.getInstance(expr.getProject()).getElementFactory();
IElementType i = sign.getTokenType();
IElementType i = expr.getOperationTokenType();
if (i == JavaTokenType.MINUS ||
i == JavaTokenType.ASTERISK ||
i == JavaTokenType.DIV ||
@@ -689,8 +688,7 @@ public class ExpectedTypesProvider {
}
@Override public void visitPrefixExpression(PsiPrefixExpression expr) {
PsiJavaToken sign = expr.getOperationSign();
IElementType i = sign.getTokenType();
IElementType i = expr.getOperationTokenType();
final PsiType type = expr.getType();
final TailType tailType = expr.getParent() instanceof PsiAssignmentExpression && ((PsiAssignmentExpression) expr.getParent()).getRExpression() == expr ?
getAssignmentRValueTailType((PsiAssignmentExpression) expr.getParent()) :
@@ -1,3 +1,4 @@
/*
* Copyright 2000-2011 JetBrains s.r.o.
*
@@ -1088,15 +1089,24 @@ public class HighlightUtil {
}
@Nullable
static HighlightInfo checkBinaryOperatorApplicable(PsiBinaryExpression expression) {
PsiExpression lOperand = expression.getLOperand();
PsiExpression rOperand = expression.getROperand();
PsiJavaToken operationSign = expression.getOperationSign();
if (!TypeConversionUtil.isBinaryOperatorApplicable(operationSign.getTokenType(), lOperand, rOperand, false)) {
String message = JavaErrorMessages
.message("binary.operator.not.applicable", operationSign.getText(), formatType(lOperand.getType()), formatType(rOperand.getType()));
return HighlightInfo.createHighlightInfo(HighlightInfoType.ERROR, expression, message);
static HighlightInfo checkPolyadicOperatorApplicable(PsiPolyadicExpression expression) {
PsiExpression[] operands = expression.getOperands();
PsiType lType = operands[0].getType();
IElementType operationSign = expression.getOperationTokenType();
for (int i = 1; i < operands.length; i++) {
PsiExpression operand = operands[i];
PsiType rType = operand.getType();
if (!TypeConversionUtil.isBinaryOperatorApplicable(operationSign, lType, rType, false)) {
PsiJavaToken token = expression.getTokenBeforeOperand(operand);
String message = JavaErrorMessages.message("binary.operator.not.applicable", token.getText(),
formatType(lType),
formatType(rType));
return HighlightInfo.createHighlightInfo(HighlightInfoType.ERROR, expression, message);
}
lType = TypeConversionUtil.calcTypeForBinaryExpression(lType, rType, operationSign, true);
}
return null;
}
@@ -231,9 +231,10 @@ public class HighlightVisitorImpl extends JavaElementVisitor implements Highligh
if (!myHolder.hasErrorResults()) visitExpression(assignment);
}
@Override public void visitBinaryExpression(PsiBinaryExpression expression) {
super.visitBinaryExpression(expression);
if (!myHolder.hasErrorResults()) myHolder.add(HighlightUtil.checkBinaryOperatorApplicable(expression));
@Override
public void visitPolyadicExpression(PsiPolyadicExpression expression) {
super.visitPolyadicExpression(expression);
if (!myHolder.hasErrorResults()) myHolder.add(HighlightUtil.checkPolyadicOperatorApplicable(expression));
}
@Override public void visitBreakStatement(PsiBreakStatement statement) {
@@ -121,14 +121,14 @@ public class SimplifyBooleanExpressionFix implements IntentionAction {
final PsiElement[] children = codeBlock.getChildren();
if(children.length > 2){
final PsiElement added =
parent.addRangeBefore(
children[1],
children[children.length - 2],
orig);
final CodeStyleManager codeStyleManager = CodeStyleManager.getInstance(orig.getManager());
codeStyleManager.reformat(added);
if (children.length > 2) {
final PsiElement added =
parent.addRangeBefore(
children[1],
children[children.length - 2],
orig);
final CodeStyleManager codeStyleManager = CodeStyleManager.getInstance(orig.getManager());
codeStyleManager.reformat(added);
}
orig.delete();
}
@@ -142,7 +142,8 @@ public class SimplifyBooleanExpressionFix implements IntentionAction {
final ExpressionVisitor expressionVisitor = new ExpressionVisitor(expression.getManager(), true);
final IncorrectOperationException[] exception = {null};
result[0].accept(new JavaRecursiveElementVisitor() {
@Override public void visitElement(PsiElement element) {
@Override
public void visitElement(PsiElement element) {
// read in all children in advance since due to Igorek's exercises element replace involves its siblings invalidation
PsiElement[] children = element.getChildren();
for (PsiElement child : children) {
@@ -150,7 +151,8 @@ public class SimplifyBooleanExpressionFix implements IntentionAction {
}
}
@Override public void visitExpression(PsiExpression expression) {
@Override
public void visitExpression(PsiExpression expression) {
super.visitExpression(expression);
expressionVisitor.clear();
expression.accept(expressionVisitor);
@@ -176,19 +178,22 @@ public class SimplifyBooleanExpressionFix implements IntentionAction {
PsiExpression newExpression = (PsiExpression)expression.replace(result[0]);
simplifyIfStatement(newExpression);
}
public static boolean canBeSimplified(@NotNull PsiExpression expression) {
if (!(expression instanceof PsiConditionalExpression) && expression.getType() != PsiType.BOOLEAN) return false;
final ExpressionVisitor expressionVisitor = new ExpressionVisitor(expression.getManager(), false);
final Ref<Boolean> canBeSimplified = new Ref<Boolean>(Boolean.FALSE);
expression.accept(new JavaRecursiveElementWalkingVisitor() {
@Override public void visitElement(PsiElement element) {
@Override
public void visitElement(PsiElement element) {
if (!canBeSimplified.get().booleanValue()) {
super.visitElement(element);
}
}
@Override public void visitExpression(PsiExpression expression) {
@Override
public void visitExpression(PsiExpression expression) {
super.visitExpression(expression);
expressionVisitor.clear();
expression.accept(expressionVisitor);
@@ -228,19 +233,27 @@ public class SimplifyBooleanExpressionFix implements IntentionAction {
return isCreateResult;
}
@Override public void visitBinaryExpression(PsiBinaryExpression expression) {
PsiExpression lOperand = expression.getLOperand();
PsiExpression rOperand = expression.getROperand();
PsiJavaToken operationSign = expression.getOperationSign();
IElementType tokenType = operationSign.getTokenType();
Boolean lConstBoolean = getConstBoolean(lOperand);
Boolean rConstBoolean = getConstBoolean(rOperand);
if (lConstBoolean != null) {
simplifyBinary(tokenType, lConstBoolean, rOperand);
}
else if (rConstBoolean != null) {
simplifyBinary(tokenType, rConstBoolean, lOperand);
@Override
public void visitPolyadicExpression(PsiPolyadicExpression expression) {
PsiExpression[] operands = expression.getOperands();
PsiExpression lExpr = operands[0];
IElementType tokenType = expression.getOperationTokenType();
for (int i = 1; i < operands.length; i++) {
Boolean l = getConstBoolean(lExpr);
PsiExpression operand = operands[i];
Boolean r = getConstBoolean(operand);
if (l != null) {
simplifyBinary(tokenType, l, operand);
}
else if (r != null) {
simplifyBinary(tokenType, r, lExpr);
}
else {
resultExpression = null;
}
if (resultExpression != null) {
lExpr = resultExpression;
}
}
}
@@ -276,7 +289,8 @@ public class SimplifyBooleanExpressionFix implements IntentionAction {
}
}
@Override public void visitConditionalExpression(PsiConditionalExpression expression) {
@Override
public void visitConditionalExpression(PsiConditionalExpression expression) {
Boolean condition = getConstBoolean(expression.getCondition());
if (condition == null) return;
if (!markAndCheckCreateResult()) {
@@ -285,7 +299,7 @@ public class SimplifyBooleanExpressionFix implements IntentionAction {
resultExpression = condition.booleanValue() ? expression.getThenExpression() : expression.getElseExpression();
}
private static PsiPrefixExpression createNegatedExpression(PsiExpression otherOperand) {
private static PsiPrefixExpression createNegatedExpression(PsiExpression otherOperand) {
PsiPrefixExpression expression = (PsiPrefixExpression)createExpression(otherOperand.getManager(), "!(xxx)");
try {
expression.getOperand().replace(otherOperand);
@@ -296,12 +310,12 @@ public class SimplifyBooleanExpressionFix implements IntentionAction {
return expression;
}
@Override public void visitPrefixExpression(PsiPrefixExpression expression) {
@Override
public void visitPrefixExpression(PsiPrefixExpression expression) {
PsiExpression operand = expression.getOperand();
Boolean constBoolean = getConstBoolean(operand);
if (constBoolean == null) return;
PsiJavaToken operationSign = expression.getOperationSign();
IElementType tokenType = operationSign.getTokenType();
IElementType tokenType = expression.getOperationTokenType();
if (JavaTokenType.EXCL == tokenType) {
if (!markAndCheckCreateResult()) {
return;
@@ -311,7 +325,8 @@ public class SimplifyBooleanExpressionFix implements IntentionAction {
}
@Override public void visitParenthesizedExpression(PsiParenthesizedExpression expression) {
@Override
public void visitParenthesizedExpression(PsiParenthesizedExpression expression) {
PsiExpression subexpr = expression.getExpression();
Boolean constBoolean = getConstBoolean(subexpr);
if (constBoolean == null) return;
@@ -321,7 +336,8 @@ public class SimplifyBooleanExpressionFix implements IntentionAction {
resultExpression = constBoolean.booleanValue() ? trueExpression : falseExpression;
}
@Override public void visitReferenceExpression(PsiReferenceExpression expression) {
@Override
public void visitReferenceExpression(PsiReferenceExpression expression) {
visitReferenceElement(expression);
}
@@ -341,4 +357,4 @@ public class SimplifyBooleanExpressionFix implements IntentionAction {
public boolean startInWriteAction() {
return true;
}
}
}
@@ -86,6 +86,7 @@ public class JavaSmartEnterProcessor extends SmartEnterProcessor {
}
private int myFirstErrorOffset = Integer.MAX_VALUE;
private boolean mySkipEnter;
private static final int MAX_ATTEMPTS = 20;
private static final Key<Long> SMART_ENTER_TIMESTAMP = Key.create("smartEnterOriginalTimestamp");
@@ -99,6 +100,7 @@ public class JavaSmartEnterProcessor extends SmartEnterProcessor {
try {
editor.putUserData(SMART_ENTER_TIMESTAMP, editor.getDocument().getModificationStamp());
myFirstErrorOffset = Integer.MAX_VALUE;
mySkipEnter = false;
process(project, editor, psiFile, 0);
}
catch (TooManyAttemptsException e) {
@@ -191,6 +193,10 @@ public class JavaSmartEnterProcessor extends SmartEnterProcessor {
reformat(atCaret);
commit(editor);
if (mySkipEnter) {
return;
}
atCaret = CodeInsightUtil.findElementInRange(psiFile, rangeMarker.getStartOffset(), rangeMarker.getEndOffset(), atCaret.getClass());
for (EnterProcessor processor : ourEnterProcessors) {
if(atCaret == null){
@@ -292,6 +298,10 @@ public class JavaSmartEnterProcessor extends SmartEnterProcessor {
}
}
public void setSkipEnter(boolean skipEnter) {
mySkipEnter = skipEnter;
}
protected static void plainEnter(@NotNull final Editor editor) {
getEnterHandler().execute(editor, ((EditorEx) editor).getDataContext());
}
@@ -19,6 +19,8 @@ import com.intellij.openapi.editor.Editor;
import com.intellij.psi.*;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.util.IncorrectOperationException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
* Created by IntelliJ IDEA.
@@ -29,31 +31,83 @@ import com.intellij.util.IncorrectOperationException;
*/
@SuppressWarnings({"HardCodedStringLiteral"})
public class MissingReturnExpressionFixer implements Fixer {
public void apply(Editor editor, JavaSmartEnterProcessor processor, PsiElement psiElement)
throws IncorrectOperationException {
if (psiElement instanceof PsiReturnStatement) {
PsiReturnStatement retStatement = (PsiReturnStatement) psiElement;
PsiExpression returnValue = retStatement.getReturnValue();
if (returnValue != null &&
lineNumber(editor, editor.getCaretModel().getOffset()) == lineNumber(editor, returnValue.getTextRange().getStartOffset())) {
return;
}
public void apply(Editor editor, JavaSmartEnterProcessor processor, PsiElement psiElement) throws IncorrectOperationException {
if (!(psiElement instanceof PsiReturnStatement)) {
return;
}
if (!PsiTreeUtil.hasErrorElements(psiElement)) {
return;
}
PsiReturnStatement retStatement = (PsiReturnStatement)psiElement;
if (fixMethodCallWithoutTrailingSemicolon(retStatement, editor, processor)) {
return;
}
PsiElement parent = PsiTreeUtil.getParentOfType(psiElement, PsiClassInitializer.class, PsiMethod.class);
if (parent instanceof PsiMethod) {
final PsiType returnType = ((PsiMethod) parent).getReturnType();
if (returnType != null && returnType != PsiType.VOID) {
final int startOffset = retStatement.getTextRange().getStartOffset();
if (returnValue != null) {
editor.getDocument().insertString(startOffset + "return".length(), ";");
}
PsiExpression returnValue = retStatement.getReturnValue();
if (returnValue != null
&& lineNumber(editor, editor.getCaretModel().getOffset()) == lineNumber(editor, returnValue.getTextRange().getStartOffset()))
{
return;
}
processor.registerUnresolvedError(startOffset + "return".length());
PsiElement parent = PsiTreeUtil.getParentOfType(psiElement, PsiClassInitializer.class, PsiMethod.class);
if (parent instanceof PsiMethod) {
final PsiType returnType = ((PsiMethod)parent).getReturnType();
if (returnType != null && returnType != PsiType.VOID) {
final int startOffset = retStatement.getTextRange().getStartOffset();
if (returnValue != null) {
editor.getDocument().insertString(startOffset + "return".length(), ";");
}
processor.registerUnresolvedError(startOffset + "return".length());
}
}
}
private static boolean fixMethodCallWithoutTrailingSemicolon(@Nullable PsiReturnStatement returnStatement, @NotNull Editor editor,
@NotNull JavaSmartEnterProcessor processor)
{
if (returnStatement == null) {
return false;
}
final PsiElement lastChild = returnStatement.getLastChild();
if (!(lastChild instanceof PsiErrorElement)) {
return false;
}
PsiElement prev = lastChild.getPrevSibling();
if (prev instanceof PsiWhiteSpace) {
prev = prev.getPrevSibling();
}
if (!(prev instanceof PsiJavaToken)) {
int offset = returnStatement.getTextRange().getEndOffset();
final PsiMethod method = PsiTreeUtil.getParentOfType(returnStatement, PsiMethod.class);
if (method != null && method.getReturnType() == PsiType.VOID) {
offset = returnStatement.getTextRange().getStartOffset() + "return".length();
}
editor.getDocument().insertString(offset, ";");
//processor.setSkipEnter(true);
return true;
}
PsiJavaToken prevToken = (PsiJavaToken)prev;
if (prevToken.getTokenType() == JavaTokenType.SEMICOLON) {
return false;
}
final int offset = returnStatement.getTextRange().getEndOffset();
editor.getDocument().insertString(offset, ";");
if (prevToken.getTokenType() == JavaTokenType.RETURN_KEYWORD) {
final PsiMethod method = PsiTreeUtil.getParentOfType(returnStatement, PsiMethod.class);
if (method != null && method.getReturnType() != PsiType.VOID) {
editor.getCaretModel().moveToOffset(offset);
processor.setSkipEnter(true);
}
}
return true;
}
private static int lineNumber(Editor editor, int offset) {
return editor.getDocument().getLineNumber(offset);
}
@@ -20,11 +20,11 @@ import com.intellij.codeInsight.CodeInsightUtilBase;
import com.intellij.codeInsight.intention.IntentionAction;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.project.Project;
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.search.GlobalSearchScope;
import com.intellij.psi.util.PsiConcatenationUtil;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.psi.util.PsiUtil;
import com.intellij.util.IncorrectOperationException;
@@ -51,7 +51,7 @@ public class ConcatenationToMessageFormatAction implements IntentionAction {
public void invoke(@NotNull Project project, Editor editor, PsiFile file) throws IncorrectOperationException {
if (!CodeInsightUtilBase.prepareFileForWrite(file)) return;
final PsiElement element = findElementAtCaret(editor, file);
PsiBinaryExpression concatenation = getEnclosingLiteralConcatenation(element);
PsiPolyadicExpression concatenation = getEnclosingLiteralConcatenation(element);
if (concatenation == null) return;
StringBuilder formatString = new StringBuilder();
List<PsiExpression> args = new ArrayList<PsiExpression>();
@@ -86,27 +86,8 @@ public class ConcatenationToMessageFormatAction implements IntentionAction {
StringBuilder formatString,
List<PsiExpression> args)
throws IncorrectOperationException {
if (expression instanceof PsiBinaryExpression) {
final PsiType type = expression.getType();
if (type != null && type.equalsToText("java.lang.String")
&& ((PsiBinaryExpression)expression).getOperationTokenType() == JavaTokenType.PLUS) {
buildMessageFormatString(((PsiBinaryExpression)expression).getLOperand(), formatString, args);
final PsiExpression rhs = ((PsiBinaryExpression)expression).getROperand();
if (rhs != null) {
buildMessageFormatString(rhs, formatString, args);
}
}
else {
appendArgument(args, expression, formatString);
}
}
else if (expression instanceof PsiLiteralExpression) {
final String text = String.valueOf(((PsiLiteralExpression)expression).getValue());
formatString.append(StringUtil.escapeStringCharacters(text).replace("'", "''").replace("{", "'{'"));
}
else {
appendArgument(args, expression, formatString);
}
PsiConcatenationUtil.buildFormatString(expression, formatString, args, false);
}
private static void appendArgument(List<PsiExpression> args, PsiExpression argument, StringBuilder formatString) throws IncorrectOperationException {
@@ -117,52 +98,40 @@ public class ConcatenationToMessageFormatAction implements IntentionAction {
private static PsiExpression getBoxedArgument(PsiExpression arg) throws IncorrectOperationException {
arg = PsiUtil.deparenthesizeExpression(arg);
assert arg != null;
if (!PsiUtil.isLanguageLevel5OrHigher(arg)) {
final PsiType type = arg.getType();
if (type instanceof PsiPrimitiveType && !type.equals(PsiType.NULL)) {
final PsiPrimitiveType primitiveType = (PsiPrimitiveType)type;
final String boxedQName = primitiveType.getBoxedTypeName();
if (boxedQName != null) {
final GlobalSearchScope resolveScope = arg.getResolveScope();
final PsiElementFactory factory = JavaPsiFacade.getElementFactory(arg.getProject());
final PsiJavaCodeReferenceElement ref = factory.createReferenceElementByFQClassName(boxedQName, resolveScope);
final PsiNewExpression newExpr = (PsiNewExpression)factory.createExpressionFromText("new A(b)", null);
final PsiElement classRef = newExpr.getClassReference();
assert classRef != null;
classRef.replace(ref);
final PsiExpressionList argumentList = newExpr.getArgumentList();
assert argumentList != null;
argumentList.getExpressions()[0].replace(arg);
return newExpr;
}
}
if (PsiUtil.isLanguageLevel5OrHigher(arg)) {
return arg;
}
return arg;
final PsiType type = arg.getType();
if (!(type instanceof PsiPrimitiveType) || type.equals(PsiType.NULL)) {
return arg;
}
final PsiPrimitiveType primitiveType = (PsiPrimitiveType)type;
final String boxedQName = primitiveType.getBoxedTypeName();
if (boxedQName == null) {
return arg;
}
final GlobalSearchScope resolveScope = arg.getResolveScope();
final PsiElementFactory factory = JavaPsiFacade.getElementFactory(arg.getProject());
final PsiJavaCodeReferenceElement ref = factory.createReferenceElementByFQClassName(boxedQName, resolveScope);
final PsiNewExpression newExpr = (PsiNewExpression)factory.createExpressionFromText("new A(b)", null);
final PsiElement classRef = newExpr.getClassReference();
assert classRef != null;
classRef.replace(ref);
final PsiExpressionList argumentList = newExpr.getArgumentList();
assert argumentList != null;
argumentList.getExpressions()[0].replace(arg);
return newExpr;
}
public boolean isAvailable(@NotNull Project project, Editor editor, PsiFile file) {
if (PsiUtil.getLanguageLevel(file).compareTo(LanguageLevel.JDK_1_4) < 0) return false;
final PsiElement element = findElementAtCaret(editor, file);
PsiBinaryExpression binaryExpression = PsiTreeUtil.getParentOfType(element, PsiBinaryExpression.class, false, PsiMember.class);
if (binaryExpression == null) return false;
final PsiType type = binaryExpression.getType();
if (type == null) return false;
if (!type.equalsToText("java.lang.String")) {
return false;
}
return !isInsideAnnotation(binaryExpression);
PsiPolyadicExpression binaryExpression = getEnclosingLiteralConcatenation(element);
return binaryExpression != null && !isInsideAnnotation(binaryExpression);
}
private static boolean isInsideAnnotation(PsiElement element) {
for (int i = 0; i < 20 && element instanceof PsiBinaryExpression; i++) {
// optimization: don't check deep string concatenations more than 20 levels up.
element = element.getParent();
if (element instanceof PsiNameValuePair ||
element instanceof PsiArrayInitializerMemberValue) {
return true;
}
}
return false;
return PsiTreeUtil.getParentOfType(element, PsiNameValuePair.class, PsiArrayInitializerMemberValue.class) != null;
}
@Nullable
@@ -171,15 +140,15 @@ public class ConcatenationToMessageFormatAction implements IntentionAction {
}
@Nullable
private static PsiBinaryExpression getEnclosingLiteralConcatenation(final PsiElement element) {
PsiBinaryExpression binaryExpression = PsiTreeUtil.getParentOfType(element, PsiBinaryExpression.class, false, PsiMember.class);
private static PsiPolyadicExpression getEnclosingLiteralConcatenation(final PsiElement element) {
PsiPolyadicExpression binaryExpression = PsiTreeUtil.getParentOfType(element, PsiPolyadicExpression.class, false, PsiMember.class);
if (binaryExpression == null) return null;
final PsiClassType stringType = PsiType.getJavaLangString(element.getManager(), element.getResolveScope());
if (!stringType.equals(binaryExpression.getType())) return null;
while (true) {
final PsiElement parent = binaryExpression.getParent();
if (!(parent instanceof PsiBinaryExpression)) return binaryExpression;
final PsiBinaryExpression parentBinaryExpression = (PsiBinaryExpression)parent;
if (!(parent instanceof PsiPolyadicExpression)) return binaryExpression;
PsiPolyadicExpression parentBinaryExpression = (PsiBinaryExpression)parent;
if (!stringType.equals(parentBinaryExpression.getType())) return binaryExpression;
binaryExpression = parentBinaryExpression;
}
@@ -36,20 +36,19 @@ public class SplitIfAction extends PsiElementBaseIntentionAction {
private static final Logger LOG = Logger.getInstance("#com.intellij.codeInsight.intention.impl.SplitIfAction");
public boolean isAvailable(@NotNull Project project, Editor editor, @NotNull PsiElement element) {
if (!(element instanceof PsiJavaToken)) {
return false;
}
PsiJavaToken token = (PsiJavaToken)element;
if (!(token.getParent() instanceof PsiBinaryExpression)) return false;
if (!(token.getParent() instanceof PsiPolyadicExpression)) return false;
PsiBinaryExpression expression = (PsiBinaryExpression)token.getParent();
PsiPolyadicExpression expression = (PsiPolyadicExpression)token.getParent();
boolean isAndExpression = expression.getOperationTokenType() == JavaTokenType.ANDAND;
boolean isOrExpression = expression.getOperationTokenType() == JavaTokenType.OROR;
if (!isAndExpression && !isOrExpression) return false;
while (expression.getParent() instanceof PsiBinaryExpression) {
expression = (PsiBinaryExpression)expression.getParent();
while (expression.getParent() instanceof PsiPolyadicExpression) {
expression = (PsiPolyadicExpression)expression.getParent();
if (isAndExpression && expression.getOperationTokenType() != JavaTokenType.ANDAND) return false;
if (isOrExpression && expression.getOperationTokenType() != JavaTokenType.OROR) return false;
}
@@ -80,16 +79,16 @@ public class SplitIfAction extends PsiElementBaseIntentionAction {
PsiJavaToken token = (PsiJavaToken)file.findElementAt(offset);
LOG.assertTrue(token.getTokenType() == JavaTokenType.ANDAND || token.getTokenType() == JavaTokenType.OROR);
PsiBinaryExpression expression = (PsiBinaryExpression)token.getParent();
PsiPolyadicExpression expression = (PsiPolyadicExpression)token.getParent();
PsiIfStatement ifStatement = PsiTreeUtil.getParentOfType(expression, PsiIfStatement.class);
LOG.assertTrue(PsiTreeUtil.isAncestor(ifStatement.getCondition(), expression, false));
if (token.getTokenType() == JavaTokenType.ANDAND) {
doAndSplit(ifStatement, expression, editor);
doAndSplit(ifStatement, expression, token, editor);
}
else if (token.getTokenType() == JavaTokenType.OROR) {
doOrSplit(ifStatement, expression, editor);
doOrSplit(ifStatement, expression, token, editor);
}
}
catch (IncorrectOperationException e) {
@@ -97,10 +96,9 @@ public class SplitIfAction extends PsiElementBaseIntentionAction {
}
}
private static void doAndSplit(PsiIfStatement ifStatement, PsiBinaryExpression expression, Editor editor) throws IncorrectOperationException {
PsiExpression lOperand = expression.getLOperand();
PsiExpression rOperand = getROperand(expression);
private static void doAndSplit(PsiIfStatement ifStatement, PsiPolyadicExpression expression, PsiJavaToken token, Editor editor) throws IncorrectOperationException {
PsiExpression lOperand = getLOperands(expression, token);
PsiExpression rOperand = getROperands(expression, token);
PsiManager psiManager = ifStatement.getManager();
PsiIfStatement subIf = (PsiIfStatement)ifStatement.copy();
@@ -109,7 +107,8 @@ public class SplitIfAction extends PsiElementBaseIntentionAction {
ifStatement.getCondition().replace(RefactoringUtil.unparenthesizeExpression(lOperand));
if (ifStatement.getThenBranch() instanceof PsiBlockStatement) {
PsiBlockStatement blockStmt = (PsiBlockStatement)JavaPsiFacade.getInstance(psiManager.getProject()).getElementFactory().createStatementFromText("{}", null);
PsiBlockStatement blockStmt =
(PsiBlockStatement)JavaPsiFacade.getInstance(psiManager.getProject()).getElementFactory().createStatementFromText("{}", null);
blockStmt = (PsiBlockStatement)CodeStyleManager.getInstance(psiManager.getProject()).reformat(blockStmt);
blockStmt = (PsiBlockStatement)ifStatement.getThenBranch().replace(blockStmt);
blockStmt.getCodeBlock().add(subIf);
@@ -125,17 +124,33 @@ public class SplitIfAction extends PsiElementBaseIntentionAction {
editor.getSelectionModel().removeSelection();
}
private static PsiExpression getROperand(PsiBinaryExpression expression) throws IncorrectOperationException {
PsiElement e = expression;
while (!(e.getParent() instanceof PsiIfStatement)) e = e.getParent();
private static PsiExpression getROperands(PsiPolyadicExpression expression, PsiJavaToken separator) throws IncorrectOperationException {
PsiElement next = separator.getNextSibling();
if (next instanceof PsiWhiteSpace) next = next.getNextSibling();
if (next == null) {
throw new IncorrectOperationException("Unable to split '"+expression.getText()+"' at '"+separator+"' (offset "+separator.getStartOffsetInParent()+")");
}
return JavaPsiFacade.getInstance(expression.getProject()).getElementFactory().createExpressionFromText(
e.getText().substring(expression.getROperand().getTextRange().getStartOffset() - e.getTextRange().getStartOffset()), e.getParent());
PsiElementFactory factory = JavaPsiFacade.getInstance(expression.getProject()).getElementFactory();
String rOperands = expression.getText().substring(next.getStartOffsetInParent());
return factory.createExpressionFromText(rOperands, expression.getParent());
}
private static void doOrSplit(PsiIfStatement ifStatement, PsiBinaryExpression expression, Editor editor) throws IncorrectOperationException {
PsiExpression lOperand = expression.getLOperand();
PsiExpression rOperand = getROperand(expression);
private static PsiExpression getLOperands(PsiPolyadicExpression expression, PsiJavaToken separator) throws IncorrectOperationException {
PsiElement next = separator;
if (next.getPrevSibling() instanceof PsiWhiteSpace) next = next.getPrevSibling();
if (next == null) {
throw new IncorrectOperationException("Unable to split '"+expression.getText()+"' left to '"+separator+"' (offset "+separator.getStartOffsetInParent()+")");
}
PsiElementFactory factory = JavaPsiFacade.getInstance(expression.getProject()).getElementFactory();
String rOperands = expression.getText().substring(0, next.getStartOffsetInParent());
return factory.createExpressionFromText(rOperands, expression.getParent());
}
private static void doOrSplit(PsiIfStatement ifStatement, PsiPolyadicExpression expression, PsiJavaToken token, Editor editor) throws IncorrectOperationException {
PsiExpression lOperand = getLOperands(expression, token);
PsiExpression rOperand = getROperands(expression, token);
PsiIfStatement secondIf = (PsiIfStatement)ifStatement.copy();
@@ -33,10 +33,7 @@ import com.intellij.util.IncorrectOperationException;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Set;
import java.util.Stack;
import java.util.*;
class ControlFlowAnalyzer extends JavaElementVisitor {
private static final Logger LOG = Logger.getInstance("#com.intellij.codeInspection.dataFlow.ControlFlowAnalyzer");
@@ -170,7 +167,7 @@ class ControlFlowAnalyzer extends JavaElementVisitor {
}
else if (op == JavaTokenType.XOREQ) {
if (isBoolean) {
generateXorExpression(expression, lExpr, rExpr, type);
generateXorExpression(expression, new PsiExpression[]{lExpr, rExpr}, type);
}
else {
generateDefaultBinop(lExpr, rExpr, type);
@@ -873,69 +870,35 @@ class ControlFlowAnalyzer extends JavaElementVisitor {
finishElement(expression);
}
@Override public void visitBinaryExpression(PsiBinaryExpression expression) {
@Override
public void visitPolyadicExpression(PsiPolyadicExpression expression) {
startElement(expression);
try {
DfaValue dfaValue = myFactory.create(expression);
if (dfaValue != null) {
addInstruction(new PushInstruction(dfaValue, expression));
return;
}
IElementType op = expression.getOperationTokenType();
PsiExpression[] operands = expression.getOperands();
if (operands.length <= 1) {
pushUnknown();
return;
}
PsiType type = expression.getType();
if (op == JavaTokenType.ANDAND) {
generateAndExpression(operands, type);
}
else if (op == JavaTokenType.OROR) {
generateOrExpression(operands, type);
}
else if (op == JavaTokenType.XOR && PsiType.BOOLEAN.equals(type)) {
generateXorExpression(expression, operands, type);
}
else {
IElementType op = expression.getOperationTokenType();
PsiExpression lExpr = expression.getLOperand();
PsiExpression rExpr = expression.getROperand();
if (rExpr == null) {
pushUnknown();
return;
}
PsiType type = expression.getType();
if (op == JavaTokenType.ANDAND) {
generateAndExpression(lExpr, rExpr, type);
}
else if (op == JavaTokenType.OROR) {
generateOrExpression(lExpr, rExpr, type);
}
else if (op == JavaTokenType.XOR && PsiType.BOOLEAN.equals(type)) {
generateXorExpression(expression, lExpr, rExpr, type);
}
else {
lExpr.accept(this);
boolean comparing = op == JavaTokenType.EQEQ || op == JavaTokenType.NE;
PsiType lType = lExpr.getType();
PsiType rType = rExpr.getType();
boolean comparingRef = comparing
&& !TypeConversionUtil.isPrimitiveAndNotNull(lType)
&& !TypeConversionUtil.isPrimitiveAndNotNull(rType);
boolean comparingPrimitiveNumerics = comparing &&
TypeConversionUtil.isPrimitiveAndNotNull(lType) &&
TypeConversionUtil.isPrimitiveAndNotNull(rType) &&
TypeConversionUtil.isNumericType(lType) &&
TypeConversionUtil.isNumericType(rType);
PsiType castType = comparingPrimitiveNumerics ? PsiType.LONG : type;
if (!comparingRef) {
generateBoxingUnboxingInstructionFor(lExpr,castType);
}
rExpr.accept(this);
if (!comparingRef) {
generateBoxingUnboxingInstructionFor(rExpr,castType);
}
String opSign = expression.getOperationSign().getText();
if ("+".equals(opSign)) {
if (type == null || !type.equalsToText("java.lang.String")) {
opSign = null;
}
}
PsiElement psiAnchor = expression.isPhysical() ? expression : null;
addInstruction(new BinopInstruction(opSign, psiAnchor, expression.getProject()));
}
generateOther(expression, op, operands, type);
}
}
finally {
@@ -943,6 +906,55 @@ class ControlFlowAnalyzer extends JavaElementVisitor {
}
}
private void generateOther(PsiPolyadicExpression expression,
IElementType op,
PsiExpression[] operands,
PsiType type) {
boolean comparing = op == JavaTokenType.EQEQ || op == JavaTokenType.NE;
PsiExpression lExpr = operands[0];
lExpr.accept(this);
PsiType lType = lExpr.getType();
PsiExpression rExpr = operands[1];
for (int i = 1; i < operands.length; i++) {
rExpr = operands[i];
PsiType rType = rExpr.getType();
boolean comparingRef = comparing
&& !TypeConversionUtil.isPrimitiveAndNotNull(lType)
&& !TypeConversionUtil.isPrimitiveAndNotNull(rType);
boolean comparingPrimitiveNumerics = comparing &&
TypeConversionUtil.isPrimitiveAndNotNull(lType) &&
TypeConversionUtil.isPrimitiveAndNotNull(rType) &&
TypeConversionUtil.isNumericType(lType) &&
TypeConversionUtil.isNumericType(rType);
PsiType castType = comparingPrimitiveNumerics ? PsiType.LONG : type;
if (!comparingRef) {
generateBoxingUnboxingInstructionFor(lExpr,castType);
}
lExpr = rExpr;
lType = rType;
rExpr.accept(this);
if (!comparingRef) {
generateBoxingUnboxingInstructionFor(rExpr,castType);
}
if (JavaTokenType.PLUS == op) {
if (type == null || !type.equalsToText("java.lang.String")) {
op = null;
}
}
PsiElement psiAnchor = expression.isPhysical() ? expression : null;
addInstruction(new BinopInstruction(op, psiAnchor, expression.getProject()));
}
}
private void generateBoxingUnboxingInstructionFor(PsiExpression expression, PsiType expectedType) {
PsiType exprType = expression.getType();
@@ -966,23 +978,31 @@ class ControlFlowAnalyzer extends JavaElementVisitor {
}
}
private void generateXorExpression(PsiExpression expression, PsiExpression lExpr, PsiExpression rExpr, final PsiType exprType) {
lExpr.accept(this);
generateBoxingUnboxingInstructionFor(lExpr,exprType);
rExpr.accept(this);
generateBoxingUnboxingInstructionFor(rExpr,exprType);
PsiElement psiAnchor = expression.isPhysical() ? expression : null;
addInstruction(new BinopInstruction("!=", psiAnchor, expression.getProject()));
private void generateXorExpression(PsiExpression expression, PsiExpression[] operands, final PsiType exprType) {
PsiExpression operand = operands[0];
operand.accept(this);
generateBoxingUnboxingInstructionFor(operand, exprType);
for (int i = 1; i < operands.length; i++) {
operand = operands[i];
operand.accept(this);
generateBoxingUnboxingInstructionFor(operand, exprType);
PsiElement psiAnchor = expression.isPhysical() ? expression : null;
addInstruction(new BinopInstruction(JavaTokenType.NE, psiAnchor, expression.getProject()));
}
}
private void generateOrExpression(PsiExpression lExpr, PsiExpression rExpr, final PsiType exprType) {
lExpr.accept(this);
generateBoxingUnboxingInstructionFor(lExpr,exprType);
addInstruction(new ConditionalGotoInstruction(getStartOffset(rExpr), true, lExpr));
addInstruction(new PushInstruction(myFactory.getConstFactory().getTrue(), null));
addInstruction(new GotoInstruction(getEndOffset(rExpr)));
rExpr.accept(this);
generateBoxingUnboxingInstructionFor(rExpr,exprType);
private void generateOrExpression(PsiExpression[] operands, final PsiType exprType) {
for (int i = 0; i < operands.length; i++) {
PsiExpression operand = operands[i];
operand.accept(this);
generateBoxingUnboxingInstructionFor(operand, exprType);
PsiExpression nextOperand = i == operands.length - 1 ? null : operands[i + 1];
if (nextOperand != null) {
addInstruction(new ConditionalGotoInstruction(getStartOffset(nextOperand), true, operand));
addInstruction(new PushInstruction(myFactory.getConstFactory().getTrue(), null));
addInstruction(new GotoInstruction(getEndOffset(operands[operands.length - 1])));
}
}
}
private void generateNonMaccartyExpression(boolean and, PsiExpression lExpression, PsiExpression rExpression, final PsiType exprType) {
@@ -1008,21 +1028,30 @@ class ControlFlowAnalyzer extends JavaElementVisitor {
overPushSuccess.setOffset(pushSuccess.getIndex() + 1);
}
private void generateAndExpression(PsiExpression lExpr, PsiExpression rExpr, final PsiType exprType) {
lExpr.accept(this);
generateBoxingUnboxingInstructionFor(lExpr, exprType);
ConditionalGotoInstruction firstTrueGoto = new ConditionalGotoInstruction(-1, true, lExpr);
addInstruction(firstTrueGoto);
rExpr.accept(this);
generateBoxingUnboxingInstructionFor(rExpr, exprType);
private void generateAndExpression(PsiExpression[] operands, final PsiType exprType) {
List<ConditionalGotoInstruction> branchToFail = new ArrayList<ConditionalGotoInstruction>();
for (int i = 0; i < operands.length; i++) {
PsiExpression operand = operands[i];
operand.accept(this);
generateBoxingUnboxingInstructionFor(operand, exprType);
PsiExpression nextOperand = i == operands.length - 1 ? null : operands[i + 1];
GotoInstruction overPushFalse = new GotoInstruction(-1);
addInstruction(overPushFalse);
if (nextOperand != null) {
ConditionalGotoInstruction onFail = new ConditionalGotoInstruction(-1, true, operand);
branchToFail.add(onFail);
addInstruction(onFail);
}
}
GotoInstruction toSuccess = new GotoInstruction(-1);
addInstruction(toSuccess);
PushInstruction pushFalse = new PushInstruction(myFactory.getConstFactory().getFalse(), null);
addInstruction(pushFalse);
for (ConditionalGotoInstruction toFail : branchToFail) {
toFail.setOffset(pushFalse.getIndex());
}
toSuccess.setOffset(pushFalse.getIndex()+1);
firstTrueGoto.setOffset(pushFalse.getIndex());
overPushFalse.setOffset(pushFalse.getIndex() + 1);
}
@Override public void visitClassObjectAccessExpression(PsiClassObjectAccessExpression expression) {
@@ -1196,7 +1225,7 @@ class ControlFlowAnalyzer extends JavaElementVisitor {
pushParameters(params, true, !testng);
addInstruction(new PushInstruction(myFactory.getConstFactory().getNull(), null));
addInstruction(new BinopInstruction("==", null, expression.getProject()));
addInstruction(new BinopInstruction(JavaTokenType.EQEQ, null, expression.getProject()));
conditionalExit(exitPoint, false);
return true;
}
@@ -1204,7 +1233,7 @@ class ControlFlowAnalyzer extends JavaElementVisitor {
pushParameters(params, true, !testng);
addInstruction(new PushInstruction(myFactory.getConstFactory().getNull(), null));
addInstruction(new BinopInstruction("==", null, expression.getProject()));
addInstruction(new BinopInstruction(JavaTokenType.EQEQ, null, expression.getProject()));
conditionalExit(exitPoint, true);
return true;
}
@@ -1370,7 +1399,7 @@ class ControlFlowAnalyzer extends JavaElementVisitor {
PsiType type = expression.getType();
PsiPrimitiveType unboxed = PsiPrimitiveType.getUnboxedType(type);
generateBoxingUnboxingInstructionFor(operand, unboxed == null ? type : unboxed);
if (expression.getOperationSign().getTokenType() == JavaTokenType.EXCL) {
if (expression.getOperationTokenType() == JavaTokenType.EXCL) {
addInstruction(new NotInstruction());
}
else {
@@ -27,6 +27,7 @@ package com.intellij.codeInspection.dataFlow;
import com.intellij.codeInspection.dataFlow.value.*;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.progress.ProgressManager;
import com.intellij.psi.JavaTokenType;
import com.intellij.psi.PsiType;
import com.intellij.psi.PsiVariable;
import com.intellij.psi.util.TypeConversionUtil;
@@ -261,16 +262,16 @@ public class DfaMemoryStateImpl implements DfaMemoryState {
getVariableState(var).setValue(value);
if (value instanceof DfaNotNullValue) {
DfaTypeValue dfaType = myFactory.getTypeFactory().create(((DfaNotNullValue)value).getType());
DfaRelationValue dfaInstanceof = myFactory.getRelationFactory().create(var, dfaType, "instanceof", false);
DfaRelationValue dfaInstanceof = myFactory.getRelationFactory().create(var, dfaType, JavaTokenType.INSTANCEOF_KEYWORD, false);
applyCondition(dfaInstanceof);
applyCondition(compareToNull(var, true));
}
else if (value instanceof DfaTypeValue) {
DfaRelationValue dfaInstanceof = myFactory.getRelationFactory().create(var, value, "instanceof", false);
DfaRelationValue dfaInstanceof = myFactory.getRelationFactory().create(var, value, JavaTokenType.INSTANCEOF_KEYWORD, false);
applyInstanceofOrNull(dfaInstanceof);
}
else {
DfaRelationValue dfaEqual = myFactory.getRelationFactory().create(var, value, "==", false);
DfaRelationValue dfaEqual = myFactory.getRelationFactory().create(var, value, JavaTokenType.EQEQ, false);
if (dfaEqual == null) return;
applyCondition(dfaEqual);
@@ -514,7 +515,7 @@ public class DfaMemoryStateImpl implements DfaMemoryState {
DfaVariableValue dfaNormalVar = isNegated ? (DfaVariableValue)dfaVar.createNegated() : dfaVar;
DfaConstValue dfaTrue = myFactory.getConstFactory().getTrue();
final DfaValue boxedTrue = myFactory.getBoxedFactory().createBoxed(dfaTrue);
DfaRelationValue dfaEqualsTrue = myFactory.getRelationFactory().create(dfaNormalVar, boxedTrue, "==", isNegated);
DfaRelationValue dfaEqualsTrue = myFactory.getRelationFactory().create(dfaNormalVar, boxedTrue, JavaTokenType.EQEQ, isNegated);
return applyCondition(dfaEqualsTrue);
}
@@ -523,7 +524,7 @@ public class DfaMemoryStateImpl implements DfaMemoryState {
boolean isNegated = dfaVar.isNegated();
DfaVariableValue dfaNormalVar = isNegated ? (DfaVariableValue)dfaVar.createNegated() : dfaVar;
DfaConstValue dfaTrue = myFactory.getConstFactory().getTrue();
DfaRelationValue dfaEqualsTrue = myFactory.getRelationFactory().create(dfaNormalVar, dfaTrue, "==", isNegated);
DfaRelationValue dfaEqualsTrue = myFactory.getRelationFactory().create(dfaNormalVar, dfaTrue, JavaTokenType.EQEQ, isNegated);
return applyCondition(dfaEqualsTrue);
}
@@ -643,7 +644,7 @@ public class DfaMemoryStateImpl implements DfaMemoryState {
@Nullable
private DfaRelationValue compareToNull(DfaValue dfaVar, boolean negated) {
DfaConstValue dfaNull = myFactory.getConstFactory().getNull();
return myFactory.getRelationFactory().create(dfaVar, dfaNull, "==", negated);
return myFactory.getRelationFactory().create(dfaVar, dfaNull, JavaTokenType.EQEQ, negated);
}
public DfaVariableState getVariableState(DfaVariableValue dfaVar) {
@@ -15,6 +15,11 @@
*/
package com.intellij.codeInspection.dataFlow;
import com.intellij.codeInspection.dataFlow.instructions.AssignInstruction;
import com.intellij.codeInspection.dataFlow.instructions.Instruction;
import com.intellij.codeInspection.dataFlow.instructions.PushInstruction;
import com.intellij.codeInspection.dataFlow.value.DfaValue;
import com.intellij.codeInspection.dataFlow.value.DfaVariableValue;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.MultiValuesMap;
import com.intellij.openapi.util.Ref;
@@ -28,14 +33,10 @@ import com.intellij.psi.util.CachedValuesManager;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.util.NullableFunction;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.codeInspection.dataFlow.instructions.PushInstruction;
import com.intellij.codeInspection.dataFlow.instructions.AssignInstruction;
import com.intellij.codeInspection.dataFlow.instructions.Instruction;
import com.intellij.codeInspection.dataFlow.value.DfaVariableValue;
import com.intellij.codeInspection.dataFlow.value.DfaValue;
import com.intellij.util.containers.Stack;
import gnu.trove.THashSet;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.*;
@@ -213,16 +214,14 @@ public class DfaUtil {
if (expression == null) return false;
if (expression instanceof PsiLiteralExpression) return true;
if (expression instanceof PsiBinaryExpression) {
final LinkedList<PsiExpression> stack = new LinkedList<PsiExpression>();
Stack<PsiExpression> stack = new Stack<PsiExpression>();
stack.add(expression);
while (!stack.isEmpty()) {
final PsiExpression psiExpression = stack.removeFirst();
if (psiExpression instanceof PsiBinaryExpression) {
final PsiBinaryExpression binaryExpression = (PsiBinaryExpression)psiExpression;
stack.addLast(binaryExpression.getLOperand());
final PsiExpression right = binaryExpression.getROperand();
if (right != null) {
stack.addLast(right);
PsiExpression psiExpression = stack.pop();
if (psiExpression instanceof PsiPolyadicExpression) {
PsiPolyadicExpression binaryExpression = (PsiPolyadicExpression)psiExpression;
for (PsiExpression op : binaryExpression.getOperands()) {
stack.push(op);
}
}
else if (!(psiExpression instanceof PsiLiteralExpression)) {
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* 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.
@@ -13,12 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.codeInspection.dataFlow;
/**
* @author Gregory.Shrago
* User: cdr
*/
public class InstructionFactory {
}
@@ -43,11 +43,11 @@ import java.util.Set;
public class StandardDataFlowRunner extends AnnotationsAwareDataFlowRunner {
private static final Logger LOG = Logger.getInstance("#com.intellij.codeInspection.dataFlow.DataFlowRunner");
private final HashSet<Instruction> myNPEInstructions = new HashSet<Instruction>();
private final HashSet<Instruction> myCCEInstructions = new HashSet<Instruction>();
private final HashSet<PsiExpression> myNullableArguments = new HashSet<PsiExpression>();
private final HashSet<PsiExpression> myNullableAssignments = new HashSet<PsiExpression>();
private final HashSet<PsiReturnStatement> myNullableReturns = new HashSet<PsiReturnStatement>();
private final Set<Instruction> myNPEInstructions = new HashSet<Instruction>();
private final Set<Instruction> myCCEInstructions = new HashSet<Instruction>();
private final Set<PsiExpression> myNullableArguments = new HashSet<PsiExpression>();
private final Set<PsiExpression> myNullableAssignments = new HashSet<PsiExpression>();
private final Set<PsiReturnStatement> myNullableReturns = new HashSet<PsiReturnStatement>();
private final boolean mySuggestNullableAnnotations;
private boolean myInNullableMethod = false;
@@ -20,6 +20,7 @@ import com.intellij.codeInsight.NullableNotNullManager;
import com.intellij.codeInspection.dataFlow.instructions.*;
import com.intellij.codeInspection.dataFlow.value.*;
import com.intellij.psi.*;
import com.intellij.psi.tree.IElementType;
import com.intellij.psi.util.TypeConversionUtil;
import com.intellij.util.ArrayUtil;
import com.intellij.util.containers.FactoryMap;
@@ -136,7 +137,7 @@ public class StandardInstructionVisitor extends InstructionVisitor {
DfaValue dfaExpr = factory.create(instruction.getCasted());
if (dfaExpr != null) {
DfaTypeValue dfaType = factory.getTypeFactory().create(instruction.getCastTo());
DfaRelationValue dfaInstanceof = factory.getRelationFactory().create(dfaExpr, dfaType, "instanceof", false);
DfaRelationValue dfaInstanceof = factory.getRelationFactory().create(dfaExpr, dfaType, JavaTokenType.INSTANCEOF_KEYWORD, false);
if (dfaInstanceof != null && !memState.applyInstanceofOrNull(dfaInstanceof)) {
onInstructionProducesCCE(instruction, runner);
}
@@ -239,12 +240,12 @@ public class StandardInstructionVisitor extends InstructionVisitor {
DfaValue dfaRight = memState.pop();
DfaValue dfaLeft = memState.pop();
final String opSign = instruction.getOperationSign();
final IElementType opSign = instruction.getOperationSign();
if (opSign != null) {
final DfaValueFactory factory = runner.getFactory();
if (("==".equals(opSign) || "!=".equals(opSign)) &&
if ((JavaTokenType.EQEQ == opSign || JavaTokenType.NE == opSign) &&
dfaLeft instanceof DfaConstValue && dfaRight instanceof DfaConstValue) {
boolean negated = "!=".equals(opSign) ^ (memState.canBeNaN(dfaLeft) || memState.canBeNaN(dfaRight));
boolean negated = (JavaTokenType.NE == opSign) ^ (memState.canBeNaN(dfaLeft) || memState.canBeNaN(dfaRight));
if (dfaLeft == dfaRight ^ negated) {
memState.push(factory.getConstFactory().getTrue());
instruction.setTrueReachable();
@@ -282,7 +283,7 @@ public class StandardInstructionVisitor extends InstructionVisitor {
return states.toArray(new DfaInstructionState[states.size()]);
}
else if ("+".equals(opSign)) {
else if (JavaTokenType.PLUS == opSign) {
memState.push(instruction.getNonNullStringValue(factory));
instruction.setTrueReachable(); // Not a branching instruction actually.
instruction.setFalseReachable();
@@ -31,21 +31,18 @@ import com.intellij.codeInspection.dataFlow.InstructionVisitor;
import com.intellij.codeInspection.dataFlow.value.DfaValue;
import com.intellij.codeInspection.dataFlow.value.DfaValueFactory;
import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiClassType;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiManager;
import com.intellij.psi.PsiType;
import com.intellij.psi.*;
import com.intellij.psi.search.GlobalSearchScope;
import org.jetbrains.annotations.NonNls;
import com.intellij.psi.tree.IElementType;
import org.jetbrains.annotations.NotNull;
public class BinopInstruction extends BranchingInstruction {
private final String myOperationSign;
private final IElementType myOperationSign;
private final Project myProject;
public BinopInstruction(@NonNls String opSign, PsiElement psiAnchor, @NotNull Project project) {
public BinopInstruction(IElementType opSign, PsiElement psiAnchor, @NotNull Project project) {
myProject = project;
if (opSign != null && ("==".equals(opSign) || "!=".equals(opSign) || "instanceof".equals(opSign) || "+".equals(opSign))) {
if (JavaTokenType.EQEQ == opSign || JavaTokenType.NE == opSign || JavaTokenType.INSTANCEOF_KEYWORD == opSign || JavaTokenType.PLUS == opSign) {
myOperationSign = opSign;
}
else {
@@ -71,7 +68,7 @@ public class BinopInstruction extends BranchingInstruction {
return "BINOP " + myOperationSign;
}
public String getOperationSign() {
public IElementType getOperationSign() {
return myOperationSign;
}
}
@@ -51,7 +51,7 @@ public class ConditionalGotoInstruction extends BranchingInstruction {
}
public String toString() {
return "cond_goto " + myOffset;
return (isNegated() ? "!":"") + "cond?_goto " + myOffset;
}
public int getOffset() {
@@ -20,10 +20,7 @@ import com.intellij.codeInspection.dataFlow.DfaInstructionState;
import com.intellij.codeInspection.dataFlow.DfaMemoryState;
import com.intellij.codeInspection.dataFlow.InstructionVisitor;
import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiExpression;
import com.intellij.psi.PsiKeyword;
import com.intellij.psi.PsiType;
import com.intellij.psi.*;
import org.jetbrains.annotations.NotNull;
/**
@@ -34,7 +31,7 @@ public class InstanceofInstruction extends BinopInstruction {
@NotNull private final PsiType myCastType;
public InstanceofInstruction(PsiElement psiAnchor, @NotNull Project project, PsiExpression left, PsiType castType) {
super(PsiKeyword.INSTANCEOF, psiAnchor, project);
super(JavaTokenType.INSTANCEOF_KEYWORD, psiAnchor, project);
myLeft = left;
myCastType = castType;
}
@@ -25,6 +25,8 @@
package com.intellij.codeInspection.dataFlow.value;
import com.intellij.openapi.util.Comparing;
import com.intellij.psi.JavaTokenType;
import com.intellij.psi.tree.IElementType;
import com.intellij.util.containers.HashMap;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.Nullable;
@@ -34,7 +36,7 @@ import java.util.ArrayList;
public class DfaRelationValue extends DfaValue {
private DfaValue myLeftOperand;
private DfaValue myRightOperand;
private String myRelation;
private IElementType myRelation;
private boolean myIsNegated;
public static class Factory {
@@ -49,9 +51,9 @@ public class DfaRelationValue extends DfaValue {
}
@Nullable
public DfaRelationValue create(DfaValue dfaLeft, DfaValue dfaRight, @NonNls String relation, boolean negated) {
if (dfaRight instanceof DfaTypeValue && !"instanceof".equals(relation)) return null;
if ("+".equals(relation)) return null;
public DfaRelationValue create(DfaValue dfaLeft, DfaValue dfaRight, IElementType relation, boolean negated) {
if (dfaRight instanceof DfaTypeValue && JavaTokenType.INSTANCEOF_KEYWORD != relation) return null;
if (JavaTokenType.PLUS == relation) return null;
if (dfaLeft instanceof DfaVariableValue || dfaLeft instanceof DfaBoxedValue || dfaLeft instanceof DfaUnboxedValue
|| dfaRight instanceof DfaVariableValue || dfaRight instanceof DfaBoxedValue || dfaRight instanceof DfaUnboxedValue) {
@@ -72,21 +74,21 @@ public class DfaRelationValue extends DfaValue {
}
}
private DfaRelationValue createCanonicalRelation(String relation,
private DfaRelationValue createCanonicalRelation(IElementType relation,
boolean negated,
final DfaValue dfaLeft,
final DfaValue dfaRight) {
// To canonical form.
if ("!=".equals(relation)) {
relation = "==";
if (JavaTokenType.NE == relation) {
relation = JavaTokenType.EQEQ;
negated = !negated;
}
else if ("<".equals(relation)) {
relation = ">=";
else if (JavaTokenType.LT == relation) {
relation = JavaTokenType.GE;
negated = !negated;
}
else if ("<=".equals(relation)) {
relation = ">";
else if (JavaTokenType.LE == relation) {
relation = JavaTokenType.GT;
negated = !negated;
}
@@ -112,18 +114,18 @@ public class DfaRelationValue extends DfaValue {
return result;
}
private static String getSymmetricOperation(String sign) {
if ("<".equals(sign)) {
return ">";
private static IElementType getSymmetricOperation(IElementType sign) {
if (JavaTokenType.LT == sign) {
return JavaTokenType.GT;
}
else if (">=".equals(sign)) {
return "<=";
else if (JavaTokenType.GE == sign) {
return JavaTokenType.LE;
}
else if (">".equals(sign)) {
return "<";
else if (JavaTokenType.GT == sign) {
return JavaTokenType.LT;
}
else if ("<=".equals(sign)) {
return ">=";
else if (JavaTokenType.LE == sign) {
return JavaTokenType.GE;
}
return sign;
@@ -134,7 +136,7 @@ public class DfaRelationValue extends DfaValue {
super(factory);
}
private DfaRelationValue(DfaValue myLeftOperand, DfaValue myRightOperand, String myRelation, boolean myIsNegated,
private DfaRelationValue(DfaValue myLeftOperand, DfaValue myRightOperand, IElementType myRelation, boolean myIsNegated,
DfaValueFactory factory) {
super(factory);
this.myLeftOperand = myLeftOperand;
@@ -161,9 +163,9 @@ public class DfaRelationValue extends DfaValue {
private boolean hardEquals(DfaRelationValue rel) {
return Comparing.equal(rel.myLeftOperand,myLeftOperand)
&& Comparing.equal(rel.myRightOperand,myRightOperand) &&
rel.myRelation.equals(myRelation) &&
rel.myIsNegated == myIsNegated;
&& Comparing.equal(rel.myRightOperand,myRightOperand) &&
rel.myRelation == myRelation &&
rel.myIsNegated == myIsNegated;
}
@NonNls public String toString() {
@@ -171,28 +171,34 @@ public class ExpressionParser {
@Nullable
private static PsiBuilder.Marker parseBinary(final PsiBuilder builder, final ExprType type, final TokenSet ops) {
PsiBuilder.Marker left = parseExpression(builder, type);
if (left == null) return null;
PsiBuilder.Marker result = parseExpression(builder, type);
if (result == null) return null;
int operandCount = 1;
IElementType tokenType = getGtTokenType(builder);
IElementType currentExprTokenType = tokenType;
while (true) {
final IElementType tokenType = getGtTokenType(builder);
if (tokenType == null || !ops.contains(tokenType)) break;
final PsiBuilder.Marker binary = left.precede();
advanceGtToken(builder, tokenType);
final PsiBuilder.Marker right = parseExpression(builder, type);
if (right == null) {
error(builder, JavaErrorMessages.message("expected.expression"));
binary.done(JavaElementType.BINARY_EXPRESSION);
return binary;
operandCount++;
tokenType = getGtTokenType(builder);
if (tokenType == null || !ops.contains(tokenType) || tokenType != currentExprTokenType || right == null) {
// save
result = result.precede();
if (right == null) {
error(builder, JavaErrorMessages.message("expected.expression"));
}
result.done(operandCount > 2 ? JavaElementType.POLYADIC_EXPRESSION : JavaElementType.BINARY_EXPRESSION);
if (right == null) break;
currentExprTokenType = tokenType;
operandCount = 1;
}
binary.done(JavaElementType.BINARY_EXPRESSION);
left = binary;
}
return left;
return result;
}
@Nullable
@@ -41,14 +41,16 @@ public abstract class NonClasspathClassFinder extends PsiElementFinder {
private final AtomicLong myLastStamp = new AtomicLong();
protected final Project myProject;
private volatile List<VirtualFile> myCache;
private final PsiManager myManager;
public NonClasspathClassFinder(Project project) {
myProject = project;
myManager = PsiManager.getInstance(myProject);
}
protected List<VirtualFile> getClassRoots() {
List<VirtualFile> cache = myCache;
long stamp = PsiManager.getInstance(myProject).getModificationTracker().getModificationCount();
long stamp = myManager.getModificationTracker().getModificationCount();
if (myLastStamp.get() != stamp) {
cache = null;
}
@@ -84,7 +86,7 @@ public abstract class NonClasspathClassFinder extends PsiElementFinder {
LOG.error("Invalid child of valid parent: " + classFile.getPath() + "; " + classRoot.isValid() + " path=" + classRoot.getPath());
return null;
}
final PsiFile file = PsiManager.getInstance(myProject).findFile(classFile);
final PsiFile file = myManager.findFile(classFile);
if (file instanceof PsiClassOwner) {
final PsiClass[] classes = ((PsiClassOwner)file).getClasses();
if (classes.length == 1) {
@@ -115,7 +117,7 @@ public abstract class NonClasspathClassFinder extends PsiElementFinder {
if (dir != null && dir.isDirectory()) {
for (final VirtualFile file : dir.getChildren()) {
if (!file.isDirectory()) {
final PsiFile psi = PsiManager.getInstance(myProject).findFile(file);
final PsiFile psi = myManager.findFile(file);
if (psi instanceof PsiClassOwner) {
ContainerUtil.addAll(result, ((PsiClassOwner)psi).getClasses());
}
@@ -169,7 +171,7 @@ public abstract class NonClasspathClassFinder extends PsiElementFinder {
}
private PsiPackageImpl createPackage(String qualifiedName) {
return new PsiPackageImpl((PsiManagerEx)PsiManager.getInstance(myProject), qualifiedName);
return new PsiPackageImpl((PsiManagerEx)myManager, qualifiedName);
}
@Override
@@ -1278,7 +1278,7 @@ class ControlFlowAnalyzer extends JavaJspElementVisitor {
if (myAssignmentTargetsAreElements)
startElement(lExpr);
if (expression.getOperationSign().getTokenType() != JavaTokenType.EQ) {
if (expression.getOperationTokenType() != JavaTokenType.EQ) {
generateReadInstruction(variable);
}
generateWriteInstruction(variable);
@@ -1301,58 +1301,71 @@ class ControlFlowAnalyzer extends JavaJspElementVisitor {
finishElement(expression);
}
@Override public void visitBinaryExpression(PsiBinaryExpression expression) {
startElement(expression);
private static enum Shortcut {
NO_SHORTCUT, // a || b
SKIP_CURRENT_OPERAND, // false || a
STOP_EXPRESSION // true || a
}
final PsiExpression lOperand = expression.getLOperand();
final PsiExpression rOperand = expression.getROperand();
@Override
public void visitPolyadicExpression(PsiPolyadicExpression expression) {
startElement(expression);
IElementType signTokenType = expression.getOperationTokenType();
boolean isAndAnd = signTokenType == JavaTokenType.ANDAND;
boolean isOrOr = signTokenType == JavaTokenType.OROR;
if ((isAndAnd || isOrOr) && myEnabledShortCircuit) {
Object exprValue = myConstantEvaluationHelper.computeConstantExpression(lOperand);
Boolean lvalue = null;
if (exprValue instanceof Boolean) {
myCurrentFlow.setConstantConditionOccurred(true);
lvalue = shouldCalculateConstantExpression(expression) ? (Boolean)exprValue : null;
}
exprValue = myConstantEvaluationHelper.computeConstantExpression(rOperand);
Boolean rvalue = null;
if (exprValue instanceof Boolean) {
myCurrentFlow.setConstantConditionOccurred(true);
rvalue = shouldCalculateConstantExpression(expression) ? (Boolean)exprValue : null;
}
Boolean doShortcut;
if (lvalue != null) {
doShortcut = lvalue.booleanValue() != isAndAnd;
}
else if (rvalue != null && rvalue.booleanValue() != isAndAnd) {
doShortcut = Boolean.TRUE;
}
else {
doShortcut = null;
}
generateLOperand(lOperand, rOperand, signTokenType);
BranchingInstruction.Role role = isAndAnd ? myEndJumpRoles.peek() : myStartJumpRoles.peek();
PsiElement gotoElement = isAndAnd ? myEndStatementStack.peekElement() : myStartStatementStack.peekElement();
boolean gotoIsAtStart = isAndAnd ? myEndStatementStack.peekAtStart() : myStartStatementStack.peekAtStart();
if (doShortcut == null) {
myCurrentFlow.addInstruction(new ConditionalGoToInstruction(0, role, lOperand));
addElementOffsetLater(gotoElement, gotoIsAtStart);
}
else if (doShortcut.booleanValue()) {
myCurrentFlow.addInstruction(new GoToInstruction(0, role));
addElementOffsetLater(gotoElement, gotoIsAtStart);
}
}
else {
generateLOperand(lOperand, rOperand, signTokenType);
}
if (rOperand != null) {
rOperand.accept(this);
PsiExpression[] operands = expression.getOperands();
Boolean lValue = isAndAnd;
PsiExpression lOperand = null;
Boolean rValue = null;
for (int i = 0; i < operands.length; i++) {
PsiExpression rOperand = operands[i];
if ((isAndAnd || isOrOr) && myEnabledShortCircuit) {
Object exprValue = myConstantEvaluationHelper.computeConstantExpression(rOperand);
if (exprValue instanceof Boolean) {
myCurrentFlow.setConstantConditionOccurred(true);
rValue = shouldCalculateConstantExpression(expression) ? (Boolean)exprValue : null;
}
BranchingInstruction.Role role = isAndAnd ? myEndJumpRoles.peek() : myStartJumpRoles.peek();
PsiElement gotoElement = isAndAnd ? myEndStatementStack.peekElement() : myStartStatementStack.peekElement();
boolean gotoIsAtStart = isAndAnd ? myEndStatementStack.peekAtStart() : myStartStatementStack.peekAtStart();
Shortcut shortcut;
if (lValue != null) {
shortcut = lValue.booleanValue() == isOrOr ? Shortcut.STOP_EXPRESSION : Shortcut.SKIP_CURRENT_OPERAND;
}
else if (rValue != null && rValue.booleanValue() == isOrOr) {
shortcut = Shortcut.STOP_EXPRESSION;
}
else {
shortcut = Shortcut.NO_SHORTCUT;
}
switch (shortcut) {
case NO_SHORTCUT:
assert lOperand != null;
myCurrentFlow.addInstruction(new ConditionalGoToInstruction(0, role, lOperand));
addElementOffsetLater(gotoElement, gotoIsAtStart);
break;
case STOP_EXPRESSION:
if (lOperand != null) {
myCurrentFlow.addInstruction(new GoToInstruction(0, role));
addElementOffsetLater(gotoElement, gotoIsAtStart);
}
break;
case SKIP_CURRENT_OPERAND:
break;
}
if (shortcut == Shortcut.STOP_EXPRESSION) break;
}
generateLOperand(rOperand, i == operands.length-1 ? null : operands[i+1],signTokenType);
lOperand = rOperand;
lValue = rValue;
}
finishElement(expression);
@@ -1475,7 +1488,7 @@ class ControlFlowAnalyzer extends JavaJspElementVisitor {
@Override public void visitPostfixExpression(PsiPostfixExpression expression) {
startElement(expression);
IElementType op = expression.getOperationSign().getTokenType();
IElementType op = expression.getOperationTokenType();
PsiExpression operand = expression.getOperand();
operand.accept(this);
if (op == JavaTokenType.PLUSPLUS || op == JavaTokenType.MINUSMINUS) {
@@ -1495,7 +1508,7 @@ class ControlFlowAnalyzer extends JavaJspElementVisitor {
PsiExpression operand = expression.getOperand();
if (operand != null) {
IElementType operationSign = expression.getOperationSign().getTokenType();
IElementType operationSign = expression.getOperationTokenType();
if (operationSign == JavaTokenType.EXCL) {
// negation inverts jump targets
PsiElement topStartStatement = myStartStatementStack.peekElement();
@@ -323,7 +323,8 @@ public abstract class AbstractJavaBlock extends AbstractBlock implements JavaBlo
@Nullable
protected Alignment createChildAlignment() {
final IElementType nodeType = myNode.getElementType();
IElementType nodeType = myNode.getElementType();
if (nodeType == JavaElementType.POLYADIC_EXPRESSION) nodeType = JavaElementType.BINARY_EXPRESSION;
if (nodeType == JavaElementType.ASSIGNMENT_EXPRESSION) {
if (myNode.getTreeParent() != null
&& myNode.getTreeParent().getElementType() == JavaElementType.ASSIGNMENT_EXPRESSION
@@ -368,7 +369,6 @@ public abstract class AbstractJavaBlock extends AbstractBlock implements JavaBlo
else if (nodeType == JavaElementType.MODIFIER_LIST || nodeType == JavaElementType.NEW_EXPRESSION) {
return myAlignment;
}
else {
return null;
}
@@ -407,10 +407,10 @@ public abstract class AbstractJavaBlock extends AbstractBlock implements JavaBlo
}
private boolean shouldInheritAlignment() {
if (myNode.getElementType() == JavaElementType.BINARY_EXPRESSION) {
if (myNode instanceof PsiPolyadicExpression) {
final ASTNode treeParent = myNode.getTreeParent();
if (treeParent != null && treeParent.getElementType() == JavaElementType.BINARY_EXPRESSION) {
return FormattingAstUtil.binaryExpressionHasTheSamePriority(myNode, treeParent);
if (treeParent instanceof PsiPolyadicExpression) {
return FormattingAstUtil.areSamePriorityBinaryExpressions(myNode, treeParent);
}
}
return false;
@@ -452,7 +452,8 @@ public abstract class AbstractJavaBlock extends AbstractBlock implements JavaBlo
arrangeChildAlignment(child, alignmentStrategy)));
}
else {
final IElementType nodeType = myNode.getElementType();
IElementType nodeType = myNode.getElementType();
if (nodeType == JavaElementType.POLYADIC_EXPRESSION) nodeType = JavaElementType.BINARY_EXPRESSION;
if (childType == JavaTokenType.LBRACE && nodeType == JavaElementType.ARRAY_INITIALIZER_EXPRESSION) {
final Wrap wrap = Wrap.createWrap(getWrapType(mySettings.ARRAY_INITIALIZER_WRAP), false);
@@ -524,7 +525,7 @@ public abstract class AbstractJavaBlock extends AbstractBlock implements JavaBlo
child = processField(result, child, alignmentStrategy, defaultWrap, childIndent);
}
else if (childType == JavaElementType.LOCAL_VARIABLE
|| (childType == JavaElementType.DECLARATION_STATEMENT && myNode.getElementType() == JavaElementType.METHOD))
|| childType == JavaElementType.DECLARATION_STATEMENT && myNode.getElementType() == JavaElementType.METHOD)
{
result.add(new SimpleJavaBlock(child, defaultWrap, alignmentStrategy, childIndent, mySettings));
}
@@ -545,8 +546,8 @@ public abstract class AbstractJavaBlock extends AbstractBlock implements JavaBlo
if (block instanceof AbstractJavaBlock) {
final AbstractJavaBlock javaBlock = (AbstractJavaBlock)block;
if ((nodeType == JavaElementType.METHOD_CALL_EXPRESSION && childType == JavaElementType.REFERENCE_EXPRESSION)
|| (nodeType == JavaElementType.REFERENCE_EXPRESSION && childType == JavaElementType.METHOD_CALL_EXPRESSION))
if (nodeType == JavaElementType.METHOD_CALL_EXPRESSION && childType == JavaElementType.REFERENCE_EXPRESSION
|| nodeType == JavaElementType.REFERENCE_EXPRESSION && childType == JavaElementType.METHOD_CALL_EXPRESSION)
{
javaBlock.setReservedWrap(getReservedWrap(nodeType), nodeType);
javaBlock.setReservedWrap(getReservedWrap(childType), childType);
@@ -16,9 +16,8 @@
package com.intellij.psi.formatter.java;
import com.intellij.lang.ASTNode;
import com.intellij.psi.PsiBinaryExpression;
import com.intellij.psi.PsiPolyadicExpression;
import com.intellij.psi.TokenType;
import com.intellij.psi.impl.source.SourceTreeToPsiMap;
import com.intellij.psi.impl.source.tree.JavaElementType;
import com.intellij.psi.tree.IElementType;
import org.jetbrains.annotations.NotNull;
@@ -136,23 +135,23 @@ public class FormattingAstUtil {
}
/**
* Allows to check if given <code>AST</code> nodes refer to binary expressions and have the same priority.
* Allows to check if given <code>AST</code> nodes refer to binary expressions which have the same priority.
*
* @param node1 node to check
* @param node2 node to check
* @return <code>true</code> if given nodes are binary expressions and have the same priority;
* <code>false</code> otherwise
*/
public static boolean binaryExpressionHasTheSamePriority(ASTNode node1, ASTNode node2) {
public static boolean areSamePriorityBinaryExpressions(ASTNode node1, ASTNode node2) {
if (node1 == null || node2 == null) {
return false;
}
if (node1.getElementType() != JavaElementType.BINARY_EXPRESSION || node2.getElementType() != JavaElementType.BINARY_EXPRESSION) {
if (!(node1 instanceof PsiPolyadicExpression) || !(node2 instanceof PsiPolyadicExpression)) {
return false;
}
PsiBinaryExpression expression1 = (PsiBinaryExpression)SourceTreeToPsiMap.treeElementToPsi(node1);
PsiBinaryExpression expression2 = (PsiBinaryExpression)SourceTreeToPsiMap.treeElementToPsi(node2);
PsiPolyadicExpression expression1 = (PsiPolyadicExpression)node1;
PsiPolyadicExpression expression2 = (PsiPolyadicExpression)node2;
return expression1.getOperationTokenType() == expression2.getOperationTokenType();
}
}
@@ -889,10 +889,10 @@ public class JavaSpacePropertyProcessor extends JavaElementVisitor {
}
}
@Override public void visitBinaryExpression(PsiBinaryExpression expression) {
PsiJavaToken sign = expression.getOperationSign();
IElementType i = sign.getTokenType();
@Override
public void visitPolyadicExpression(PsiPolyadicExpression expression) {
if (myRole1 == ChildRole.OPERATION_SIGN || myRole2 == ChildRole.OPERATION_SIGN) {
IElementType i = expression.getOperationTokenType();
if (i == JavaTokenType.OROR || i == JavaTokenType.ANDAND) {
createSpaceInCode(mySettings.SPACE_AROUND_LOGICAL_OPERATORS);
}
@@ -19,6 +19,7 @@ import com.intellij.formatting.ASTBlock;
import com.intellij.formatting.Wrap;
import com.intellij.formatting.WrapType;
import com.intellij.lang.ASTNode;
import com.intellij.psi.PsiPolyadicExpression;
import com.intellij.psi.codeStyle.CodeStyleSettings;
import com.intellij.psi.formatter.java.FormattingAstUtil;
import com.intellij.psi.formatter.java.wrap.ReservedWrapsProvider;
@@ -55,17 +56,17 @@ public class JavaChildBlockWrapFactory {
if (nodeType == JavaElementType.EXTENDS_LIST || nodeType == JavaElementType.IMPLEMENTS_LIST) {
return Wrap.createWrap(settings.EXTENDS_LIST_WRAP, false);
}
else if (nodeType == JavaElementType.BINARY_EXPRESSION) {
else if (node instanceof PsiPolyadicExpression) {
Wrap actualWrap = wrap != null ? wrap : reservedWrapsProvider.getReservedWrap(JavaElementType.BINARY_EXPRESSION);
if (actualWrap == null) {
return Wrap.createWrap(settings.BINARY_OPERATION_WRAP, false);
}
else {
if (!FormattingAstUtil.binaryExpressionHasTheSamePriority(node, node.getTreeParent())) {
return Wrap.createChildWrap(actualWrap, WrapType.byLegacyRepresentation(settings.BINARY_OPERATION_WRAP), false);
if (FormattingAstUtil.areSamePriorityBinaryExpressions(node, node.getTreeParent())) {
return actualWrap;
}
else {
return actualWrap;
return Wrap.createChildWrap(actualWrap, WrapType.byLegacyRepresentation(settings.BINARY_OPERATION_WRAP), false);
}
}
}
@@ -19,6 +19,7 @@ import com.intellij.formatting.Wrap;
import com.intellij.formatting.WrapType;
import com.intellij.lang.ASTNode;
import com.intellij.psi.JavaTokenType;
import com.intellij.psi.PsiPolyadicExpression;
import com.intellij.psi.codeStyle.CodeStyleSettings;
import com.intellij.psi.formatter.java.FormattingAstUtil;
import com.intellij.psi.formatter.java.wrap.JavaWrapManager;
@@ -27,6 +28,7 @@ import com.intellij.psi.impl.source.tree.ChildRole;
import com.intellij.psi.impl.source.tree.CompositeElement;
import com.intellij.psi.impl.source.tree.JavaElementType;
import com.intellij.psi.tree.IElementType;
import com.intellij.util.ArrayUtil;
import org.jetbrains.annotations.Nullable;
/**
@@ -61,15 +63,14 @@ public class JavaChildWrapArranger {
*/
@SuppressWarnings({"MethodMayBeStatic"})
@Nullable
public Wrap arrange(ASTNode child, ASTNode parent, CodeStyleSettings settings, Wrap suggestedWrap,
ReservedWrapsProvider reservedWrapsProvider)
{
final ASTNode directParent = child.getTreeParent();
public Wrap arrange(ASTNode child, ASTNode parent, CodeStyleSettings settings, Wrap suggestedWrap, ReservedWrapsProvider reservedWrapsProvider) {
ASTNode directParent = child.getTreeParent();
int role = ((CompositeElement)directParent).getChildRole(child);
final IElementType nodeType = parent.getElementType();
if (nodeType == JavaElementType.BINARY_EXPRESSION) {
if (parent instanceof PsiPolyadicExpression) {
if (role == ChildRole.OPERATION_SIGN && !settings.BINARY_OPERATION_SIGN_ON_NEXT_LINE) return null;
if (role == ChildRole.ROPERAND && settings.BINARY_OPERATION_SIGN_ON_NEXT_LINE) return null;
boolean rOperand = ArrayUtil.indexOf(((PsiPolyadicExpression)parent).getOperands(), child.getPsi()) > 0;
if (settings.BINARY_OPERATION_SIGN_ON_NEXT_LINE && rOperand) return null;
return suggestedWrap;
}
final IElementType childType = child.getElementType();
@@ -105,26 +105,39 @@ class ConstantExpressionVisitor extends JavaElementVisitor implements PsiConstan
}
@Override
public void visitBinaryExpression(PsiBinaryExpression expression) {
Object lOperandValue = getStoredValue(expression.getLOperand());
if (lOperandValue == null) {
public void visitPolyadicExpression(PsiPolyadicExpression expression) {
PsiExpression[] operands = expression.getOperands();
Object lValue = getStoredValue(operands[0]);
if (lValue == null) {
myResult = null;
return;
}
Object rOperandValue = getStoredValue(expression.getROperand());
if (rOperandValue == null) {
myResult = null;
return;
IElementType tokenType = expression.getOperationTokenType();
for (int i = 1; i < operands.length; i++) {
PsiExpression operand = operands[i];
Object rValue = getStoredValue(operand);
if (rValue == null) {
myResult = null;
break;
}
myResult = compute(lValue, rValue, tokenType, expression);
if (myResult == null) {
break;
}
lValue = myResult;
}
if (myResult instanceof String) {
myResult = myInterner.intern((String)myResult);
}
}
PsiJavaToken operationSign = expression.getOperationSign();
final IElementType tokenType = operationSign.getTokenType();
private Object compute(Object lOperandValue, Object rOperandValue, IElementType tokenType, PsiElement expression) {
Object value = null;
if (tokenType == JavaTokenType.PLUS) {
if (lOperandValue instanceof String || rOperandValue instanceof String) {
value = myInterner.intern(lOperandValue.toString() + rOperandValue.toString());
String l = lOperandValue.toString();
String r = rOperandValue.toString();
value = l + r;
}
else {
if (lOperandValue instanceof Character) lOperandValue = Integer.valueOf(((Character)lOperandValue).charValue());
@@ -182,27 +195,23 @@ class ConstantExpressionVisitor extends JavaElementVisitor implements PsiConstan
}
else if (tokenType == JavaTokenType.ANDAND) {
if (lOperandValue instanceof Boolean && !((Boolean)lOperandValue).booleanValue()) {
myResult = Boolean.FALSE;
return;
value = Boolean.FALSE;
}
if (rOperandValue instanceof Boolean && !((Boolean)rOperandValue).booleanValue()) {
myResult = Boolean.FALSE;
return;
else if (rOperandValue instanceof Boolean && !((Boolean)rOperandValue).booleanValue()) {
value = Boolean.FALSE;
}
if (lOperandValue instanceof Boolean && rOperandValue instanceof Boolean) {
else if (lOperandValue instanceof Boolean && rOperandValue instanceof Boolean) {
value = Boolean.valueOf(((Boolean)lOperandValue).booleanValue() && ((Boolean)rOperandValue).booleanValue());
}
}
else if (tokenType == JavaTokenType.OROR) {
if (lOperandValue instanceof Boolean && ((Boolean)lOperandValue).booleanValue()) {
myResult = Boolean.TRUE;
return;
value = Boolean.TRUE;
}
if (rOperandValue instanceof Boolean && ((Boolean)rOperandValue).booleanValue()) {
myResult = Boolean.TRUE;
return;
else if (rOperandValue instanceof Boolean && ((Boolean)rOperandValue).booleanValue()) {
value = Boolean.TRUE;
}
if (lOperandValue instanceof Boolean && rOperandValue instanceof Boolean) {
else if (lOperandValue instanceof Boolean && rOperandValue instanceof Boolean) {
value = Boolean.valueOf(((Boolean)lOperandValue).booleanValue() || ((Boolean)rOperandValue).booleanValue());
}
}
@@ -421,8 +430,7 @@ class ConstantExpressionVisitor extends JavaElementVisitor implements PsiConstan
value = Boolean.valueOf(((Boolean)lOperandValue).booleanValue() ^ ((Boolean)rOperandValue).booleanValue());
}
}
myResult = value;
return value;
}
@Override public void visitPrefixExpression(PsiPrefixExpression expression) {
@@ -432,7 +440,7 @@ class ConstantExpressionVisitor extends JavaElementVisitor implements PsiConstan
myResult = null;
return;
}
IElementType tokenType = expression.getOperationSign().getTokenType();
IElementType tokenType = expression.getOperationTokenType();
Object value = null;
if (tokenType == JavaTokenType.MINUS) {
if (operandValue instanceof Character) operandValue = Integer.valueOf(((Character)operandValue).charValue());
@@ -543,13 +551,13 @@ class ConstantExpressionVisitor extends JavaElementVisitor implements PsiConstan
return o instanceof Long || o instanceof Integer || o instanceof Short || o instanceof Byte || o instanceof Character;
}
private void checkDivisionOverflow(long l, final long r, long minValue, PsiBinaryExpression expression) {
private void checkDivisionOverflow(long l, final long r, long minValue, PsiElement expression) {
if (!myThrowExceptionOnOverflow) return;
if (r == 0) throw new ConstantEvaluationOverflowException(expression);
if (r == -1 && l == minValue) throw new ConstantEvaluationOverflowException(expression);
}
private void checkMultiplicationOverflow(long result, long l, long r, PsiExpression expression) {
private void checkMultiplicationOverflow(long result, long l, long r, PsiElement expression) {
if (!myThrowExceptionOnOverflow) return;
if (r == 0 || l == 0) return;
if (result / r != l || ((l < 0) ^ (r < 0) != (result < 0))) throw new ConstantEvaluationOverflowException(expression);
@@ -557,7 +565,7 @@ class ConstantExpressionVisitor extends JavaElementVisitor implements PsiConstan
private void checkAdditionOverflow(boolean resultPositive,
boolean lPositive,
boolean rPositive, PsiBinaryExpression expression) {
boolean rPositive, PsiElement expression) {
if (!myThrowExceptionOnOverflow) return;
boolean overflow = lPositive == rPositive && lPositive != resultPositive;
if (overflow) throw new ConstantEvaluationOverflowException(expression);
@@ -565,7 +573,7 @@ class ConstantExpressionVisitor extends JavaElementVisitor implements PsiConstan
private void checkRealNumberOverflow(Object result,
Object lOperandValue,
Object rOperandValue, PsiExpression expression) {
Object rOperandValue, PsiElement expression) {
if (!myThrowExceptionOnOverflow) return;
if (lOperandValue instanceof Float && ((Float) lOperandValue).isInfinite()) return;
if (lOperandValue instanceof Double && ((Double) lOperandValue).isInfinite()) return;
@@ -114,6 +114,11 @@ public class ClsBinaryExpressionImpl extends ClsElementImpl implements PsiBinary
return myOperation.getTokenType();
}
@Override
public PsiJavaToken getTokenBeforeOperand(@NotNull PsiExpression operand) {
return getOperationSign();
}
@Override
public PsiType getType() {
return myLOperand.getType();
@@ -123,4 +128,9 @@ public class ClsBinaryExpressionImpl extends ClsElementImpl implements PsiBinary
public String toString() {
return "PsiBinaryExpression:" + getText();
}
@NotNull
@Override
public PsiExpression[] getOperands() {
return new PsiExpression[]{getLOperand(), getROperand()};
}
}
@@ -25,6 +25,7 @@ import com.intellij.psi.stubs.DefaultStubBuilder;
import com.intellij.psi.stubs.StubElement;
import com.intellij.psi.tree.IElementType;
import com.intellij.util.io.StringRef;
import org.jetbrains.annotations.NotNull;
/**
* @author max
@@ -34,7 +35,7 @@ public class JavaFileStubBuilder extends DefaultStubBuilder {
private static final StubBuilder LIGHT_BUILDER = new JavaLightStubBuilder();
@Override
protected StubElement createStubForFile(final PsiFile file) {
protected StubElement createStubForFile(@NotNull final PsiFile file) {
if (file instanceof PsiJavaFile) {
final PsiJavaFile javaFile = (PsiJavaFile)file;
return new PsiJavaFileStubImpl(javaFile, StringRef.fromString(javaFile.getPackageName()), false);
@@ -44,7 +45,7 @@ public class JavaFileStubBuilder extends DefaultStubBuilder {
}
@Override
protected boolean skipChildProcessingWhenBuildingStubs(final PsiElement element, final PsiElement child) {
protected boolean skipChildProcessingWhenBuildingStubs(@NotNull final PsiElement element, @NotNull final PsiElement child) {
final ASTNode node = element.getNode();
if (node == null) return false;
final ASTNode childNode = child.getNode();
@@ -56,4 +57,4 @@ public class JavaFileStubBuilder extends DefaultStubBuilder {
public boolean skipChildProcessingWhenBuildingStubs(final ASTNode parent, final IElementType childType) {
return LIGHT_BUILDER.skipChildProcessingWhenBuildingStubs(parent, childType);
}
}
}
@@ -24,15 +24,14 @@ import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.NotNullLazyKey;
import com.intellij.psi.PsiEllipsisType;
import com.intellij.psi.PsiExpression;
import com.intellij.psi.PsiType;
import com.intellij.psi.PsiVariable;
import com.intellij.psi.impl.PsiManagerEx;
import com.intellij.psi.util.TypeConversionUtil;
import com.intellij.util.ConcurrencyUtil;
import com.intellij.util.Function;
import com.intellij.util.containers.ConcurrentWeakHashMap;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -56,16 +55,6 @@ public class JavaResolveCache {
private final Map<PsiVariable,Object> myVarToConstValueMap2;
private static final Object NULL = Key.create("NULL");
public static final PsiType NULL_TYPE = new PsiEllipsisType(PsiType.NULL){
public boolean isValid() {
return true;
}
@NonNls
public String getPresentableText() {
return "FAKE TYPE";
}
};
public JavaResolveCache(PsiManagerEx manager) {
ResolveCache cache = manager.getResolveCache();
@@ -93,7 +82,7 @@ public class JavaResolveCache {
if (type == null) {
type = f.fun(expr);
if (type == null) {
type = NULL_TYPE;
type = TypeConversionUtil.NULL_TYPE;
}
type = ConcurrencyUtil.cacheOrGet(myCalculatedTypes, expr, type);
}
@@ -105,7 +94,7 @@ public class JavaResolveCache {
LOG.error("Expression: '"+expr+"' is invalid, must not be used for getType()");
}
}
return type == NULL_TYPE ? null : type;
return type == TypeConversionUtil.NULL_TYPE ? null : type;
}
@Nullable
@@ -53,7 +53,7 @@ public interface ElementType extends JavaTokenType, JavaDocTokenType,
TokenSet EXPRESSION_BIT_SET = TokenSet.create(
REFERENCE_EXPRESSION, LITERAL_EXPRESSION, THIS_EXPRESSION, SUPER_EXPRESSION, PARENTH_EXPRESSION, METHOD_CALL_EXPRESSION,
TYPE_CAST_EXPRESSION, PREFIX_EXPRESSION, POSTFIX_EXPRESSION, BINARY_EXPRESSION, CONDITIONAL_EXPRESSION, ASSIGNMENT_EXPRESSION,
TYPE_CAST_EXPRESSION, PREFIX_EXPRESSION, POSTFIX_EXPRESSION, BINARY_EXPRESSION, POLYADIC_EXPRESSION, CONDITIONAL_EXPRESSION, ASSIGNMENT_EXPRESSION,
NEW_EXPRESSION, ARRAY_ACCESS_EXPRESSION, ARRAY_INITIALIZER_EXPRESSION, INSTANCE_OF_EXPRESSION, CLASS_OBJECT_ACCESS_EXPRESSION,
EMPTY_EXPRESSION);
@@ -62,7 +62,7 @@ public interface ElementType extends JavaTokenType, JavaDocTokenType,
TokenSet ARRAY_DIMENSION_BIT_SET = TokenSet.create(
REFERENCE_EXPRESSION, LITERAL_EXPRESSION, THIS_EXPRESSION, SUPER_EXPRESSION, PARENTH_EXPRESSION, METHOD_CALL_EXPRESSION,
TYPE_CAST_EXPRESSION, PREFIX_EXPRESSION, POSTFIX_EXPRESSION, BINARY_EXPRESSION, CONDITIONAL_EXPRESSION, ASSIGNMENT_EXPRESSION,
TYPE_CAST_EXPRESSION, PREFIX_EXPRESSION, POSTFIX_EXPRESSION, BINARY_EXPRESSION, POLYADIC_EXPRESSION, CONDITIONAL_EXPRESSION, ASSIGNMENT_EXPRESSION,
NEW_EXPRESSION, ARRAY_ACCESS_EXPRESSION, INSTANCE_OF_EXPRESSION, CLASS_OBJECT_ACCESS_EXPRESSION, EMPTY_EXPRESSION);
TokenSet JAVA_STATEMENT_BIT_SET = TokenSet.create(
@@ -98,6 +98,7 @@ public interface JavaElementType {
IElementType PREFIX_EXPRESSION = new JavaCompositeElementType("PREFIX_EXPRESSION", PsiPrefixExpressionImpl.class);
IElementType POSTFIX_EXPRESSION = new JavaCompositeElementType("POSTFIX_EXPRESSION", PsiPostfixExpressionImpl.class);
IElementType BINARY_EXPRESSION = new JavaCompositeElementType("BINARY_EXPRESSION", PsiBinaryExpressionImpl.class);
IElementType POLYADIC_EXPRESSION = new JavaCompositeElementType("POLYADIC_EXPRESSION", PsiPolyadicExpressionImpl.class);
IElementType CONDITIONAL_EXPRESSION = new JavaCompositeElementType("CONDITIONAL_EXPRESSION", PsiConditionalExpressionImpl.class);
IElementType ASSIGNMENT_EXPRESSION = new JavaCompositeElementType("ASSIGNMENT_EXPRESSION", PsiAssignmentExpressionImpl.class);
IElementType NEW_EXPRESSION = new JavaCompositeElementType("NEW_EXPRESSION", PsiNewExpressionImpl.class);
@@ -74,8 +74,8 @@ public class JavaConcatenationInjectorManager implements ModificationTracker {
public CachedValueProvider.Result<MultiHostRegistrarImpl> compute(PsiElement context) {
PsiElement element = context;
PsiElement parent = context.getParent();
while (parent instanceof PsiBinaryExpression && ((PsiBinaryExpression)parent).getOperationSign().getTokenType() == JavaTokenType.PLUS
|| parent instanceof PsiAssignmentExpression && ((PsiAssignmentExpression)parent).getOperationSign().getTokenType() == JavaTokenType.PLUSEQ
while (parent instanceof PsiPolyadicExpression && ((PsiPolyadicExpression)parent).getOperationTokenType() == JavaTokenType.PLUS
|| parent instanceof PsiAssignmentExpression && ((PsiAssignmentExpression)parent).getOperationTokenType() == JavaTokenType.PLUSEQ
|| parent instanceof PsiConditionalExpression && ((PsiConditionalExpression)parent).getCondition() != element
|| parent instanceof PsiTypeCastExpression
|| parent instanceof PsiParenthesizedExpression) {
@@ -85,9 +85,9 @@ public class JavaConcatenationInjectorManager implements ModificationTracker {
PsiElement[] operands;
PsiElement anchor;
if (element instanceof PsiBinaryExpression || element instanceof PsiAssignmentExpression) {
if (element instanceof PsiPolyadicExpression || element instanceof PsiAssignmentExpression) {
List<PsiElement> operandList = new ArrayList<PsiElement>();
collectOperands(element, operandList);
collectOperands((PsiExpression)element, operandList);
operands = PsiUtilBase.toPsiElementArray(operandList);
anchor = element;
}
@@ -105,18 +105,22 @@ public class JavaConcatenationInjectorManager implements ModificationTracker {
CachedValueProvider.Result<MultiHostRegistrarImpl> result = CachedValueProvider.Result.create(registrar, PsiModificationTracker.MODIFICATION_COUNT, concatenationInjectorManager);
ParameterizedCachedValue<MultiHostRegistrarImpl, PsiElement> cachedValue;
if (registrar.result != null) {
// store this everywhere
ParameterizedCachedValue<MultiHostRegistrarImpl, PsiElement> cachedValue =
CachedValuesManager.getManager(context.getProject()).createParameterizedCachedValue(this, false);
cachedValue = CachedValuesManager.getManager(context.getProject()).createParameterizedCachedValue(this, false);
((PsiParameterizedCachedValue<MultiHostRegistrarImpl, PsiElement>)cachedValue).setValue(result);
for (PsiElement operand : operands) {
operand.putUserData(INJECTED_PSI_IN_CONCATENATION, cachedValue);
}
anchor.putUserData(INJECTED_PSI_IN_CONCATENATION, cachedValue);
context.putUserData(INJECTED_PSI_IN_CONCATENATION, cachedValue);
}
else {
cachedValue = InjectedLanguageUtil.NULL_VALUE;
}
for (PsiElement operand : operands) {
operand.putUserData(INJECTED_PSI_IN_CONCATENATION, cachedValue);
}
anchor.putUserData(INJECTED_PSI_IN_CONCATENATION, cachedValue);
context.putUserData(INJECTED_PSI_IN_CONCATENATION, cachedValue);
return result;
}
@@ -156,15 +160,28 @@ public class JavaConcatenationInjectorManager implements ModificationTracker {
}
}
private static void collectOperands(PsiElement expression, List<PsiElement> operands) {
if (expression instanceof PsiBinaryExpression) {
final PsiBinaryExpression binaryExpression = (PsiBinaryExpression)expression;
collectOperands(binaryExpression.getLOperand(), operands);
collectOperands(binaryExpression.getROperand(), operands);
}
else if (expression != null) {
operands.add(expression);
}
private static void collectOperands(PsiExpression expression, final List<PsiElement> operands) {
expression.accept(new JavaRecursiveElementWalkingVisitor() {
@Override
public void visitPolyadicExpression(PsiPolyadicExpression expression) {
super.visitElement(expression);
}
@Override
public void visitExpression(PsiExpression expression) {
operands.add(expression); // add leaf expression to the operand list
}
@Override
public void visitReferenceExpression(PsiReferenceExpression expression) {
visitExpression(expression);
}
@Override
public void visitElement(PsiElement element) {
// do not go deeper
}
});
}
private final List<ConcatenationAwareInjector> myConcatenationInjectors = ContainerUtil.createEmptyCOWList();
@@ -29,13 +29,15 @@ import com.intellij.psi.tree.TokenSet;
import com.intellij.psi.util.TypeConversionUtil;
import com.intellij.util.Function;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class PsiBinaryExpressionImpl extends ExpressionPsiElement implements PsiBinaryExpression {
private static final Logger LOG = Logger.getInstance("#com.intellij.psi.impl.source.tree.java.PsiBinaryExpressionImpl");
public PsiBinaryExpressionImpl() {
super(JavaElementType.BINARY_EXPRESSION);
this(JavaElementType.BINARY_EXPRESSION);
}
protected PsiBinaryExpressionImpl(@NotNull IElementType elementType) {
super(elementType);
}
@NotNull
@@ -57,15 +59,20 @@ public class PsiBinaryExpressionImpl extends ExpressionPsiElement implements Psi
return getOperationSign().getTokenType();
}
@Override
public PsiJavaToken getTokenBeforeOperand(@NotNull PsiExpression operand) {
return getOperationSign();
}
private static PsiType doGetType(PsiBinaryExpressionImpl param) {
PsiExpression lOperand = param.getLOperand();
PsiExpression rOperand = param.getROperand();
if (rOperand == null) return null;
PsiType rType = rOperand.getType();
IElementType sign = param.getOperationSign().getNode().getElementType();
IElementType sign = param.getOperationTokenType();
// optimization: if we can calculate type based on right type only
PsiType type = calcTypeForBinaryExpression(null, rType, sign, false);
if (type != JavaResolveCache.NULL_TYPE) return type;
PsiType type = TypeConversionUtil.calcTypeForBinaryExpression(null, rType, sign, false);
if (type != TypeConversionUtil.NULL_TYPE) return type;
if (lOperand instanceof PsiBinaryExpressionImpl && !JavaResolveCache.getInstance(param.getProject()).isTypeCached(lOperand)) {
// cache all intermediate expression types from bottom up
@@ -86,7 +93,7 @@ public class PsiBinaryExpressionImpl extends ExpressionPsiElement implements Psi
});
}
PsiType lType = lOperand.getType();
return calcTypeForBinaryExpression(lType, rType, sign, true);
return TypeConversionUtil.calcTypeForBinaryExpression(lType, rType, sign, true);
}
private static final Function<PsiBinaryExpressionImpl,PsiType> MY_TYPE_EVALUATOR = new Function<PsiBinaryExpressionImpl, PsiType>() {
@@ -147,60 +154,11 @@ public class PsiBinaryExpressionImpl extends ExpressionPsiElement implements Psi
return "PsiBinaryExpression:" + getText();
}
@Nullable
public static PsiType calcTypeForBinaryExpression(PsiType lType, PsiType rType, IElementType sign, boolean accessLType) {
if (sign == JavaTokenType.PLUS) {
// evaluate right argument first, since '+-/*%' is left associative and left operand tends to be bigger
if (rType == null) return null;
if (rType.equalsToText("java.lang.String")) {
return rType;
}
if (!accessLType) return JavaResolveCache.NULL_TYPE;
if (lType == null) return null;
if (lType.equalsToText("java.lang.String")) {
return lType;
}
return TypeConversionUtil.unboxAndBalanceTypes(lType, rType);
}
if (sign == JavaTokenType.MINUS || sign == JavaTokenType.ASTERISK || sign == JavaTokenType.DIV || sign == JavaTokenType.PERC) {
if (rType == null) return null;
if (!accessLType) return JavaResolveCache.NULL_TYPE;
if (lType == null) return null;
return TypeConversionUtil.unboxAndBalanceTypes(lType, rType);
}
if (sign == JavaTokenType.LTLT || sign == JavaTokenType.GTGT || sign == JavaTokenType.GTGTGT) {
if (!accessLType) return JavaResolveCache.NULL_TYPE;
if (PsiType.BYTE.equals(lType) || PsiType.CHAR.equals(lType) || PsiType.SHORT.equals(lType)) {
return PsiType.INT;
}
if (lType instanceof PsiClassType) lType = PsiPrimitiveType.getUnboxedType(lType);
return lType;
}
if (sign == JavaTokenType.EQEQ ||
sign == JavaTokenType.NE ||
sign == JavaTokenType.LT ||
sign == JavaTokenType.GT ||
sign == JavaTokenType.LE ||
sign == JavaTokenType.GE ||
sign == JavaTokenType.OROR ||
sign == JavaTokenType.ANDAND) {
return PsiType.BOOLEAN;
}
if (sign == JavaTokenType.OR || sign == JavaTokenType.XOR || sign == JavaTokenType.AND) {
if (rType instanceof PsiClassType) rType = PsiPrimitiveType.getUnboxedType(rType);
if (lType instanceof PsiClassType) lType = PsiPrimitiveType.getUnboxedType(lType);
if (rType == null) return null;
if (PsiType.BOOLEAN.equals(rType)) return PsiType.BOOLEAN;
if (!accessLType) return JavaResolveCache.NULL_TYPE;
if (lType == null) return null;
if (PsiType.BOOLEAN.equals(lType)) return PsiType.BOOLEAN;
if (PsiType.LONG.equals(lType) || PsiType.LONG.equals(rType)) return PsiType.LONG;
return PsiType.INT;
}
LOG.error("Unknown token: "+sign);
return null;
@NotNull
@Override
public PsiExpression[] getOperands() {
PsiExpression rOperand = getROperand();
return rOperand == null ? new PsiExpression[]{getLOperand()} : new PsiExpression[]{getLOperand(), rOperand};
}
}
@@ -0,0 +1,127 @@
/*
* 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 com.intellij.psi.impl.source.tree.java;
import com.intellij.lang.ASTNode;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.psi.*;
import com.intellij.psi.impl.source.Constants;
import com.intellij.psi.impl.source.resolve.JavaResolveCache;
import com.intellij.psi.impl.source.tree.ChildRole;
import com.intellij.psi.impl.source.tree.ElementType;
import com.intellij.psi.impl.source.tree.JavaElementType;
import com.intellij.psi.tree.ChildRoleBase;
import com.intellij.psi.tree.IElementType;
import com.intellij.psi.tree.TokenSet;
import com.intellij.psi.util.TypeConversionUtil;
import com.intellij.util.Function;
import org.jetbrains.annotations.NotNull;
public class PsiPolyadicExpressionImpl extends ExpressionPsiElement implements PsiPolyadicExpression {
private static final Logger LOG = Logger.getInstance("#com.intellij.psi.impl.source.tree.java.PsiPolyadicExpressionImpl");
public PsiPolyadicExpressionImpl() {
super(JavaElementType.POLYADIC_EXPRESSION);
}
@NotNull
public IElementType getOperationTokenType() {
return ((PsiJavaToken)findChildByRoleAsPsiElement(ChildRole.OPERATION_SIGN)).getTokenType();
}
@Override
public PsiJavaToken getTokenBeforeOperand(@NotNull PsiExpression operand) {
PsiElement element = operand;
while(element != null) {
if (getChildRole(element.getNode()) == ChildRole.OPERATION_SIGN) return (PsiJavaToken)element;
element = element.getPrevSibling();
}
return null;
}
public PsiType getType() {
return JavaResolveCache.getInstance(getProject()).getType(this, MY_TYPE_EVALUATOR);
}
private static final Function<PsiPolyadicExpressionImpl,PsiType> MY_TYPE_EVALUATOR = new Function<PsiPolyadicExpressionImpl, PsiType>() {
public PsiType fun(PsiPolyadicExpressionImpl expression) {
return doGetType(expression);
}
};
private static PsiType doGetType(PsiPolyadicExpressionImpl param) {
PsiExpression[] operands = param.getOperands();
PsiType lType = null;
IElementType sign = param.getOperationTokenType();
for (int i=1; i<operands.length;i++) {
PsiType rType = operands[i].getType();
// optimization: if we can calculate type based on right type only
PsiType type = TypeConversionUtil.calcTypeForBinaryExpression(null, rType, sign, false);
if (type != TypeConversionUtil.NULL_TYPE) return type;
if (lType == null) lType = operands[0].getType();
lType = TypeConversionUtil.calcTypeForBinaryExpression(lType, rType, sign, true);
}
return lType;
}
public ASTNode findChildByRole(int role) {
LOG.assertTrue(ChildRole.isUnique(role));
switch (role) {
default:
return null;
case ChildRole.OPERATION_SIGN:
return findChildByType(OUR_OPERATIONS_BIT_SET);
}
}
public int getChildRole(ASTNode child) {
LOG.assertTrue(child.getTreeParent() == this);
if (OUR_OPERATIONS_BIT_SET.contains(child.getElementType())) {
return ChildRole.OPERATION_SIGN;
}
return ChildRoleBase.NONE;
}
private static final TokenSet OUR_OPERATIONS_BIT_SET =
TokenSet.create(JavaTokenType.OROR, JavaTokenType.ANDAND, JavaTokenType.OR, JavaTokenType.XOR, JavaTokenType.AND, JavaTokenType.EQEQ,
JavaTokenType.NE, JavaTokenType.LT, JavaTokenType.GT, JavaTokenType.LE, JavaTokenType.GE, JavaTokenType.LTLT,
JavaTokenType.GTGT, JavaTokenType.GTGTGT, JavaTokenType.PLUS, JavaTokenType.MINUS, JavaTokenType.ASTERISK, JavaTokenType.DIV,
JavaTokenType.PERC);
public void accept(@NotNull PsiElementVisitor visitor) {
if (visitor instanceof JavaElementVisitor) {
((JavaElementVisitor)visitor).visitPolyadicExpression(this);
}
else {
visitor.visitElement(this);
}
}
@NotNull
@Override
public PsiExpression[] getOperands() {
return getChildrenAsPsiElements(ElementType.EXPRESSION_BIT_SET, Constants.PSI_EXPRESSION_ARRAY_CONSTRUCTOR);
}
public String toString() {
return "PsiPolyadicExpression: " + getText();
}
}
@@ -18,7 +18,6 @@ package com.intellij.psi.impl.source.tree.java;
import com.intellij.lang.ASTNode;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.psi.*;
import com.intellij.psi.impl.source.SourceTreeToPsiMap;
import com.intellij.psi.impl.source.tree.ChildRole;
import com.intellij.psi.impl.source.tree.ElementType;
import com.intellij.psi.impl.source.tree.JavaElementType;
@@ -52,7 +51,7 @@ public class PsiPrefixExpressionImpl extends ExpressionPsiElement implements Psi
if (operand == null) return null;
PsiType type = operand.getType();
if (type instanceof PsiClassType) type = PsiPrimitiveType.getUnboxedType(type);
IElementType opCode = SourceTreeToPsiMap.psiElementToTree(getOperationSign()).getElementType();
IElementType opCode = getOperationTokenType();
if (opCode == JavaTokenType.PLUS || opCode == JavaTokenType.MINUS || opCode == JavaTokenType.TILDE) {
if (type == null) return null;
return PsiType.BYTE.equals(type) || PsiType.CHAR.equals(type) || PsiType.SHORT.equals(type) ? PsiType.INT : type;
@@ -19,6 +19,8 @@ import com.intellij.lang.ASTNode;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.psi.JavaTokenType;
import com.intellij.psi.PsiBinaryExpression;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiPolyadicExpression;
import com.intellij.psi.impl.source.SourceTreeToPsiMap;
import com.intellij.psi.impl.source.tree.ChildRole;
import com.intellij.psi.impl.source.tree.CompositeElement;
@@ -44,9 +46,10 @@ public class ReplaceExpressionUtil {
if (role == ChildRole.THEN_EXPRESSION) return false;
return priority < parentPriority || role != ChildRole.ELSE_EXPRESSION;
}
else if (i == JavaElementType.BINARY_EXPRESSION) {
else if (i == JavaElementType.BINARY_EXPRESSION || i == JavaElementType.POLYADIC_EXPRESSION) {
if (priority < parentPriority) return true;
final IElementType opType = ((PsiBinaryExpression)SourceTreeToPsiMap.treeElementToPsi(oldParent)).getOperationSign().getTokenType();
PsiElement element = SourceTreeToPsiMap.treeElementToPsi(oldParent);
IElementType opType = i == JavaElementType.BINARY_EXPRESSION ? ((PsiBinaryExpression)element).getOperationTokenType() : ((PsiPolyadicExpression)element).getOperationTokenType();
return ((CompositeElement)oldParent).getChildRole(oldExpr) != ChildRole.LOPERAND &&
opType != JavaTokenType.PLUS &&
opType != JavaTokenType.ASTERISK &&
@@ -100,8 +103,9 @@ public class ReplaceExpressionUtil {
else if (i == JavaElementType.CONDITIONAL_EXPRESSION) {
return 1;
}
else if (i == JavaElementType.BINARY_EXPRESSION) {
IElementType opType = ((PsiBinaryExpression)SourceTreeToPsiMap.treeElementToPsi(expr)).getOperationSign().getTokenType();
else if (i == JavaElementType.BINARY_EXPRESSION || i == JavaElementType.POLYADIC_EXPRESSION) {
PsiElement element = SourceTreeToPsiMap.treeElementToPsi(expr);
IElementType opType = i == JavaElementType.BINARY_EXPRESSION ? ((PsiBinaryExpression)element).getOperationTokenType() : ((PsiPolyadicExpression)element).getOperationTokenType();
if (opType == JavaTokenType.OROR) {
return 2;
}
@@ -315,7 +315,8 @@ public class JavaMethodsConflictResolver implements PsiConflictResolver{
private static Specifics checkSubtyping(PsiType type1, PsiType type2, PsiMethod method1, PsiMethod method2) {
boolean noBoxing = type1 instanceof PsiPrimitiveType == type2 instanceof PsiPrimitiveType;
final boolean allowUncheckedConversion =
!method1.hasModifierProperty(PsiModifier.STATIC) && !method2.hasModifierProperty(PsiModifier.STATIC);
!method1.hasModifierProperty(PsiModifier.STATIC) && !method2.hasModifierProperty(PsiModifier.STATIC) ||
method1.getContainingClass() == method2.getContainingClass();
final boolean assignable2From1 = noBoxing && TypeConversionUtil.isAssignable(type2, type1, allowUncheckedConversion);
final boolean assignable1From2 = noBoxing && TypeConversionUtil.isAssignable(type1, type2, allowUncheckedConversion);
if (assignable1From2 || assignable2From1) {
@@ -135,7 +135,7 @@ public class ChangeClassSignatureDialog extends RefactoringDialog {
final JPanel panel = new JPanel(new BorderLayout());
panel.add(SeparatorFactory.createSeparator(RefactoringBundle.message("changeClassSignature.parameters.panel.border.title"), myTable), BorderLayout.NORTH);
panel.add(TableToolbarDecorator.createDecorator(myTable).createPanel(), BorderLayout.CENTER);
panel.add(ToolbarDecorator.createDecorator(myTable).createPanel(), BorderLayout.CENTER);
return panel;
}
@@ -40,7 +40,7 @@ import com.intellij.refactoring.util.RefactoringUtil;
import com.intellij.ui.AnActionButton;
import com.intellij.ui.IdeBorderFactory;
import com.intellij.ui.TableColumnAnimator;
import com.intellij.ui.TableToolbarDecorator;
import com.intellij.ui.ToolbarDecorator;
import com.intellij.ui.table.JBTable;
import com.intellij.ui.table.TableView;
import com.intellij.ui.treeStructure.Tree;
@@ -160,7 +160,7 @@ public class JavaChangeSignatureDialog extends ChangeSignatureDialogBase<Paramet
};
myPropExceptionsButton.setShortcut(KeyboardShortcut.fromString("alt X"));
final JPanel panel = TableToolbarDecorator.createDecorator(table).addExtraAction(myPropExceptionsButton).createPanel();
final JPanel panel = ToolbarDecorator.createDecorator(table).addExtraAction(myPropExceptionsButton).createPanel();
panel.setBorder(IdeBorderFactory.createEmptyBorder(0));
myExceptionsModel.addTableModelListener(new TableModelListener() {
@@ -429,14 +429,13 @@ public class EncapsulateFieldsProcessor extends BaseRefactoringProcessor {
}
}
else if (RefactoringUtil.isPlusPlusOrMinusMinus(parent)){
PsiJavaToken sign;
IElementType sign;
if (parent instanceof PsiPrefixExpression){
sign = ((PsiPrefixExpression)parent).getOperationSign();
sign = ((PsiPrefixExpression)parent).getOperationTokenType();
}
else{
sign = ((PsiPostfixExpression)parent).getOperationSign();
sign = ((PsiPostfixExpression)parent).getOperationTokenType();
}
IElementType tokenType = sign.getTokenType();
PsiExpression getExpr = expr;
if (processGet){
@@ -448,7 +447,7 @@ public class EncapsulateFieldsProcessor extends BaseRefactoringProcessor {
}
@NonNls String text;
if (tokenType == JavaTokenType.PLUSPLUS){
if (sign == JavaTokenType.PLUSPLUS){
text = "a+1";
}
else{
@@ -959,12 +959,12 @@ public class InlineMethodProcessor extends BaseRefactoringProcessor {
PsiExpression operand = ((PsiTypeCastExpression)initializer).getOperand();
return operand != null && canInlineParmOrThisVariable(operand, shouldBeFinal, strictlyFinal, accessCount, false);
}
else if (initializer instanceof PsiBinaryExpression) {
PsiBinaryExpression binExpr = (PsiBinaryExpression)initializer;
PsiExpression lOperand = binExpr.getLOperand();
PsiExpression rOperand = binExpr.getROperand();
return rOperand != null && canInlineParmOrThisVariable(lOperand, shouldBeFinal, strictlyFinal, accessCount, false) &&
canInlineParmOrThisVariable(rOperand, shouldBeFinal, strictlyFinal, accessCount, false);
else if (initializer instanceof PsiPolyadicExpression) {
PsiPolyadicExpression binExpr = (PsiPolyadicExpression)initializer;
for (PsiExpression op : binExpr.getOperands()) {
if (!canInlineParmOrThisVariable(op, shouldBeFinal, strictlyFinal, accessCount, false)) return false;
}
return true;
}
else if (initializer instanceof PsiClassObjectAccessExpression) {
return true;
@@ -25,6 +25,7 @@ import com.intellij.openapi.util.Pass;
import com.intellij.psi.*;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.psi.util.PsiUtil;
import com.intellij.psi.util.PsiUtilBase;
import com.intellij.refactoring.IntroduceTargetChooser;
import com.intellij.refactoring.RefactoringBundle;
import com.intellij.refactoring.introduceVariable.IntroduceVariableBase;
@@ -91,7 +92,7 @@ public class ElementToWorkOn {
final int offset = editor.getCaretModel().getOffset();
final PsiElement[] statementsInRange = IntroduceVariableBase.findStatementsAtOffset(editor, file, offset);
if (statementsInRange.length == 1 && (PsiUtil.hasErrorElementChild(statementsInRange[0]) || !PsiUtil.isStatement(statementsInRange[0]))) {
if (statementsInRange.length == 1 && (PsiUtilBase.hasErrorElementChild(statementsInRange[0]) || !PsiUtil.isStatement(statementsInRange[0]))) {
editor.getSelectionModel().selectLineAtCaret();
final ElementToWorkOn elementToWorkOn = getElementToWorkOn(editor, file, refactoringName, helpId, project, localVar, expr);
if (elementToWorkOn == null || elementToWorkOn.getLocalVariable() == null && elementToWorkOn.getExpression() == null) {
@@ -1,12 +1,8 @@
package com.intellij.refactoring.introduceParameter;
import com.intellij.ide.ui.ListCellRendererWrapper;
import com.intellij.openapi.application.Result;
import com.intellij.openapi.command.WriteCommandAction;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.LabeledComponent;
import com.intellij.openapi.ui.popup.Balloon;
import com.intellij.psi.*;
import com.intellij.psi.codeStyle.CodeStyleSettingsManager;
import com.intellij.psi.util.PsiUtil;
@@ -14,21 +10,15 @@ import com.intellij.refactoring.IntroduceParameterRefactoring;
import com.intellij.refactoring.JavaRefactoringSettings;
import com.intellij.refactoring.RefactoringBundle;
import com.intellij.refactoring.introduceField.InplaceCombosUtil;
import com.intellij.refactoring.introduceVariable.FinalListener;
import com.intellij.refactoring.ui.TypeSelectorManager;
import com.intellij.ui.IdeBorderFactory;
import com.intellij.ui.NonFocusableCheckBox;
import com.intellij.usageView.UsageInfo;
import com.intellij.util.ui.UIUtil;
import gnu.trove.TIntArrayList;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.List;
/**
* User: anna
@@ -47,7 +37,7 @@ public abstract class InplaceIntroduceParameterUI extends IntroduceParameterSett
TIntArrayList parametersToRemove,
TypeSelectorManager typeSelectorManager,
PsiExpression[] occurrences) {
super(project, onLocalVariable, onExpression, methodToReplaceIn, parametersToRemove);
super(onLocalVariable, onExpression, methodToReplaceIn, parametersToRemove);
myProject = project;
myTypeSelectorManager = typeSelectorManager;
myOccurrences = occurrences;
@@ -81,7 +81,7 @@ public class IntroduceParameterDialog extends RefactoringDialog {
@NotNull TIntArrayList parametersToRemove,
final boolean mustBeFinal) {
super(project, true);
myPanel = new IntroduceParameterSettingsPanel(project, onLocalVariable, onExpression, methodToReplaceIn, parametersToRemove);
myPanel = new IntroduceParameterSettingsPanel(onLocalVariable, onExpression, methodToReplaceIn, parametersToRemove);
myProject = project;
myClassMembersList = classMembersList;
myOccurenceNumber = occurences.length;
@@ -295,11 +295,10 @@ public class IntroduceParameterDialog extends RefactoringDialog {
}
private class IntroduceParameterSettingsPanel extends IntroduceParameterSettingsUI {
public IntroduceParameterSettingsPanel(Project project,
PsiLocalVariable onLocalVariable,
public IntroduceParameterSettingsPanel(PsiLocalVariable onLocalVariable,
PsiExpression onExpression,
PsiMethod methodToReplaceIn, TIntArrayList parametersToRemove) {
super(project, onLocalVariable, onExpression, methodToReplaceIn, parametersToRemove);
super(onLocalVariable, onExpression, methodToReplaceIn, parametersToRemove);
}
@@ -51,7 +51,6 @@ import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.refactoring.*;
import com.intellij.refactoring.introduce.inplace.AbstractInplaceIntroducer;
import com.intellij.refactoring.introduceField.ElementToWorkOn;
import com.intellij.refactoring.introduceField.InplaceIntroduceFieldPopup;
import com.intellij.refactoring.ui.MethodCellRenderer;
import com.intellij.refactoring.ui.NameSuggestionsGenerator;
import com.intellij.refactoring.ui.TypeSelectorManagerImpl;
@@ -82,7 +81,6 @@ import java.util.List;
public class IntroduceParameterHandler extends IntroduceHandlerBase implements RefactoringActionHandler {
private static final Logger LOG = Logger.getInstance("#com.intellij.refactoring.introduceParameter.IntroduceParameterHandler");
static final String REFACTORING_NAME = RefactoringBundle.message("introduce.parameter.title");
private Project myProject;
private JBPopup myEnclosingMethodsPopup;
private InplaceIntroduceParameterPopup myInplaceIntroduceParameterPopup;
@@ -116,8 +114,7 @@ public class IntroduceParameterHandler extends IntroduceHandlerBase implements R
LOG.assertTrue(!PsiDocumentManager.getInstance(project).hasUncommitedDocuments());
PsiMethod method;
if (expr != null) {
final PsiElement physicalElement = expr.getUserData(ElementToWorkOn.PARENT);
method = Util.getContainingMethod(physicalElement != null ? physicalElement : expr);
method = Util.getContainingMethod(expr);
}
else {
method = Util.getContainingMethod(localVar);
@@ -127,10 +124,9 @@ public class IntroduceParameterHandler extends IntroduceHandlerBase implements R
LOG.debug("expression:" + expr);
}
myProject = project;
if (expr == null && localVar == null) {
String message = RefactoringBundle.getCannotRefactorMessage(RefactoringBundle.message("selected.block.should.represent.an.expression"));
showErrorMessage(myProject, message, editor);
showErrorMessage(project, message, editor);
return false;
}
@@ -138,14 +134,14 @@ public class IntroduceParameterHandler extends IntroduceHandlerBase implements R
final PsiElement parent = localVar.getParent();
if (!(parent instanceof PsiDeclarationStatement)) {
String message = RefactoringBundle.getCannotRefactorMessage(RefactoringBundle.message("error.wrong.caret.position.local.or.expression.name"));
showErrorMessage(myProject, message, editor);
showErrorMessage(project, message, editor);
return false;
}
}
if (method == null) {
String message = RefactoringBundle.getCannotRefactorMessage(RefactoringBundle.message("is.not.supported.in.the.current.context", REFACTORING_NAME));
showErrorMessage(myProject, message, editor);
showErrorMessage(project, message, editor);
return false;
}
@@ -154,7 +150,7 @@ public class IntroduceParameterHandler extends IntroduceHandlerBase implements R
final PsiType typeByExpression = invokedOnDeclaration ? null : RefactoringUtil.getTypeByExpressionWithExpectedType(expr);
if (!invokedOnDeclaration && typeByExpression == null) {
String message = RefactoringBundle.getCannotRefactorMessage(RefactoringBundle.message("type.of.the.selected.expression.cannot.be.determined"));
showErrorMessage(myProject, message, editor);
showErrorMessage(project, message, editor);
return false;
}
@@ -15,7 +15,6 @@
*/
package com.intellij.refactoring.introduceParameter;
import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiExpression;
import com.intellij.psi.PsiLocalVariable;
import com.intellij.psi.PsiMethod;
@@ -23,7 +22,6 @@ import com.intellij.psi.PsiParameter;
import com.intellij.refactoring.IntroduceParameterRefactoring;
import com.intellij.refactoring.JavaRefactoringSettings;
import com.intellij.refactoring.RefactoringBundle;
import com.intellij.refactoring.ui.RefactoringDialog;
import com.intellij.refactoring.ui.TypeSelectorManager;
import com.intellij.ui.IdeBorderFactory;
import com.intellij.ui.NonFocusableCheckBox;
@@ -35,8 +33,6 @@ import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
@@ -61,8 +57,7 @@ public abstract class IntroduceParameterSettingsUI {
protected JCheckBox myCbReplaceAllOccurences = null;
protected JCheckBox myCbGenerateDelegate = null;
public IntroduceParameterSettingsUI(Project project,
PsiLocalVariable onLocalVariable,
public IntroduceParameterSettingsUI(PsiLocalVariable onLocalVariable,
PsiExpression onExpression,
PsiMethod methodToReplaceIn,
TIntArrayList parametersToRemove) {
@@ -30,6 +30,7 @@ import com.intellij.psi.search.searches.ReferencesSearch;
import com.intellij.psi.util.PropertyUtil;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.psi.util.PsiUtil;
import com.intellij.refactoring.introduceField.ElementToWorkOn;
import com.intellij.usageView.UsageInfo;
import com.intellij.util.ArrayUtil;
import com.intellij.util.Processor;
@@ -77,8 +78,18 @@ public class Util {
}
}
@NotNull
private static PsiElement getPhysical(@NotNull PsiElement expr) {
PsiElement physicalElement = expr.getUserData(ElementToWorkOn.PARENT);
if (physicalElement != null) expr = physicalElement;
return expr;
}
public static PsiMethod getContainingMethod(PsiElement expr) {
return PsiTreeUtil.getParentOfType(expr, PsiMethod.class);
return PsiTreeUtil.getParentOfType(getPhysical(expr), PsiMethod.class);
}
public static boolean isAncestor(PsiElement ancestor, PsiElement element, boolean strict) {
return PsiTreeUtil.isAncestor(getPhysical(ancestor), getPhysical(element), strict);
}
public static boolean anyFieldsWithGettersPresent(List<UsageInfo> classMemberRefs) {
@@ -138,10 +149,10 @@ public class Util {
PsiElement element = reference.getElement();
boolean stillCanBeRemoved = false;
if (element != null) {
stillCanBeRemoved = PsiTreeUtil.isAncestor(expr, element, false) || PsiUtil.isInsideJavadocComment(element);
stillCanBeRemoved = isAncestor(expr, element, false) || PsiUtil.isInsideJavadocComment(getPhysical(element));
if (!stillCanBeRemoved && occurences != null) {
for (PsiExpression occurence : occurences) {
if (PsiTreeUtil.isAncestor(occurence, element, false)) {
if (isAncestor(occurence, element, false)) {
stillCanBeRemoved = true;
break;
}
@@ -219,10 +219,9 @@ public abstract class IntroduceVariableBase extends IntroduceHandlerBase impleme
}
/**
* @return can return NotNull value thought extraction should fail: reason could be retrieved from {@link #getErrorMessage(PsiExpression)}
* @return can return NotNull value although extraction will fail: reason could be retrieved from {@link #getErrorMessage(PsiExpression)}
*/
public static PsiExpression getSelectedExpression(final Project project, final PsiFile file, int startOffset, int endOffset) {
PsiElement elementAtStart = file.findElementAt(startOffset);
if (elementAtStart == null || elementAtStart instanceof PsiWhiteSpace || elementAtStart instanceof PsiComment) {
elementAtStart = PsiTreeUtil.skipSiblingsForward(elementAtStart, PsiWhiteSpace.class, PsiComment.class);
@@ -148,8 +148,7 @@ public class PropertyUtils {
return null;
}
final PsiAssignmentExpression assignment = (PsiAssignmentExpression)possibleAssignment;
final PsiJavaToken sign = assignment.getOperationSign();
if (!JavaTokenType.EQ.equals(sign.getTokenType())) {
if (!JavaTokenType.EQ.equals(assignment.getOperationTokenType())) {
return null;
}
final PsiExpression lhs = assignment.getLExpression();
@@ -21,7 +21,6 @@ import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.*;
import com.intellij.psi.impl.PsiImplUtil;
import com.intellij.psi.impl.source.tree.java.PsiBinaryExpressionImpl;
import com.intellij.psi.util.InheritanceUtil;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.psi.util.PsiUtil;
@@ -150,9 +149,9 @@ public class TypeEvaluator {
else if (expr instanceof PsiBinaryExpression) {
final PsiExpression lOperand = ((PsiBinaryExpression)expr).getLOperand();
final PsiExpression rOperand = ((PsiBinaryExpression)expr).getROperand();
final PsiJavaToken operationSign = ((PsiBinaryExpression)expr).getOperationSign();
return PsiBinaryExpressionImpl.calcTypeForBinaryExpression(evaluateType(lOperand), evaluateType(rOperand), operationSign.getTokenType(),
true);
return TypeConversionUtil.calcTypeForBinaryExpression(evaluateType(lOperand), evaluateType(rOperand),
((PsiBinaryExpression)expr).getOperationTokenType(),
true);
}
else if (expr instanceof PsiPostfixExpression) {
return evaluateType(((PsiPostfixExpression)expr).getOperand());
@@ -23,8 +23,8 @@ import com.intellij.refactoring.ui.TypeSelectorManager;
import com.intellij.refactoring.ui.TypeSelectorManagerImpl;
import com.intellij.ui.BooleanTableCellRenderer;
import com.intellij.ui.EditableModel;
import com.intellij.ui.TableToolbarDecorator;
import com.intellij.ui.TableUtil;
import com.intellij.ui.ToolbarDecorator;
import com.intellij.ui.components.JBComboBoxLabel;
import com.intellij.ui.components.editors.JBComboBoxTableCellEditorComponent;
import com.intellij.ui.table.JBTable;
@@ -252,7 +252,7 @@ public abstract class ParameterTablePanel extends JPanel {
});
JPanel listPanel = TableToolbarDecorator.createDecorator(myTable).disableAddAction().disableRemoveAction().createPanel();
JPanel listPanel = ToolbarDecorator.createDecorator(myTable).disableAddAction().disableRemoveAction().createPanel();
add(listPanel, BorderLayout.CENTER);
if (getVariableData().length > 1) {
@@ -528,8 +528,8 @@ public class RefactoringUtil {
public static boolean isPlusPlusOrMinusMinus(PsiElement element) {
if (element instanceof PsiPrefixExpression) {
PsiJavaToken operandSign = ((PsiPrefixExpression)element).getOperationSign();
return operandSign.getTokenType() == JavaTokenType.PLUSPLUS || operandSign.getTokenType() == JavaTokenType.MINUSMINUS;
return ((PsiPrefixExpression)element).getOperationTokenType() == JavaTokenType.PLUSPLUS ||
((PsiPrefixExpression)element).getOperationTokenType() == JavaTokenType.MINUSMINUS;
}
else if (element instanceof PsiPostfixExpression) {
IElementType operandTokenType = ((PsiPostfixExpression)element).getOperationTokenType();
@@ -0,0 +1,7 @@
public class Foo {
public String foo() {
return String.valueOf(
1<caret>
)
}
}
@@ -0,0 +1,7 @@
public class Foo {
public String foo() {
return String.valueOf(
1
);<caret>
}
}
@@ -639,18 +639,12 @@
<problem>
<file>Foo.java</file>
<line>73</line>
<line>72</line>
<description>Numeric overflow in expression</description>
</problem>
<problem>
<file>Foo.java</file>
<line>73</line>
<description>Numeric overflow in expression</description>
</problem>
</problems>
@@ -69,8 +69,8 @@ class c {
l1 = LONG_MIN_VALUE / -1;
l1 = 30 * 24 * 60 * 60 * 1000;
l1 = 30000000 * 243232323
* (LONG_MAX_VALUE +3) / 5;
l1 = 30000000 * 243232323 * (LONG_MAX_VALUE +3) / 5;
System.out.println(l1);
@@ -1,6 +1,6 @@
0: EMPTY
1: READ file
2: COND_GOTO [END] 9
2: COND_GOTO [ELSE] 9
3: READ b1
4: COND_GOTO [ELSE] 9
5: READ b2
@@ -9,4 +9,4 @@
8: GOTO [END] 10
9: WRITE highlighter
10: READ highlighter
11: GOTO [END] 12 RETURN
11: GOTO [END] 12 RETURN
@@ -24,19 +24,18 @@ PsiJavaFile:And0.java
PsiReturnStatement
PsiKeyword:return('return')
PsiWhiteSpace(' ')
PsiBinaryExpression:a & b & c
PsiBinaryExpression:a & b
PsiReferenceExpression:a
PsiReferenceParameterList
<empty list>
PsiIdentifier:a('a')
PsiWhiteSpace(' ')
PsiJavaToken:AND('&')
PsiWhiteSpace(' ')
PsiReferenceExpression:b
PsiReferenceParameterList
<empty list>
PsiIdentifier:b('b')
PsiPolyadicExpression: a & b & c
PsiReferenceExpression:a
PsiReferenceParameterList
<empty list>
PsiIdentifier:a('a')
PsiWhiteSpace(' ')
PsiJavaToken:AND('&')
PsiWhiteSpace(' ')
PsiReferenceExpression:b
PsiReferenceParameterList
<empty list>
PsiIdentifier:b('b')
PsiWhiteSpace(' ')
PsiJavaToken:AND('&')
PsiWhiteSpace(' ')
@@ -48,4 +47,4 @@ PsiJavaFile:And0.java
PsiWhiteSpace('\n ')
PsiJavaToken:RBRACE('}')
PsiWhiteSpace('\n')
PsiJavaToken:RBRACE('}')
PsiJavaToken:RBRACE('}')
@@ -24,19 +24,18 @@ PsiJavaFile:CondAnd0.java
PsiReturnStatement
PsiKeyword:return('return')
PsiWhiteSpace(' ')
PsiBinaryExpression:a && b && c
PsiBinaryExpression:a && b
PsiReferenceExpression:a
PsiReferenceParameterList
<empty list>
PsiIdentifier:a('a')
PsiWhiteSpace(' ')
PsiJavaToken:ANDAND('&&')
PsiWhiteSpace(' ')
PsiReferenceExpression:b
PsiReferenceParameterList
<empty list>
PsiIdentifier:b('b')
PsiPolyadicExpression: a && b && c
PsiReferenceExpression:a
PsiReferenceParameterList
<empty list>
PsiIdentifier:a('a')
PsiWhiteSpace(' ')
PsiJavaToken:ANDAND('&&')
PsiWhiteSpace(' ')
PsiReferenceExpression:b
PsiReferenceParameterList
<empty list>
PsiIdentifier:b('b')
PsiWhiteSpace(' ')
PsiJavaToken:ANDAND('&&')
PsiWhiteSpace(' ')
@@ -48,4 +47,4 @@ PsiJavaFile:CondAnd0.java
PsiWhiteSpace('\n ')
PsiJavaToken:RBRACE('}')
PsiWhiteSpace('\n')
PsiJavaToken:RBRACE('}')
PsiJavaToken:RBRACE('}')
@@ -24,19 +24,18 @@ PsiJavaFile:CondOr0.java
PsiReturnStatement
PsiKeyword:return('return')
PsiWhiteSpace(' ')
PsiBinaryExpression:a || b || c
PsiBinaryExpression:a || b
PsiReferenceExpression:a
PsiReferenceParameterList
<empty list>
PsiIdentifier:a('a')
PsiWhiteSpace(' ')
PsiJavaToken:OROR('||')
PsiWhiteSpace(' ')
PsiReferenceExpression:b
PsiReferenceParameterList
<empty list>
PsiIdentifier:b('b')
PsiPolyadicExpression: a || b || c
PsiReferenceExpression:a
PsiReferenceParameterList
<empty list>
PsiIdentifier:a('a')
PsiWhiteSpace(' ')
PsiJavaToken:OROR('||')
PsiWhiteSpace(' ')
PsiReferenceExpression:b
PsiReferenceParameterList
<empty list>
PsiIdentifier:b('b')
PsiWhiteSpace(' ')
PsiJavaToken:OROR('||')
PsiWhiteSpace(' ')
@@ -48,4 +47,4 @@ PsiJavaFile:CondOr0.java
PsiWhiteSpace('\n ')
PsiJavaToken:RBRACE('}')
PsiWhiteSpace('\n')
PsiJavaToken:RBRACE('}')
PsiJavaToken:RBRACE('}')
@@ -24,19 +24,18 @@ PsiJavaFile:Or0.java
PsiReturnStatement
PsiKeyword:return('return')
PsiWhiteSpace(' ')
PsiBinaryExpression:a | b | c
PsiBinaryExpression:a | b
PsiReferenceExpression:a
PsiReferenceParameterList
<empty list>
PsiIdentifier:a('a')
PsiWhiteSpace(' ')
PsiJavaToken:OR('|')
PsiWhiteSpace(' ')
PsiReferenceExpression:b
PsiReferenceParameterList
<empty list>
PsiIdentifier:b('b')
PsiPolyadicExpression: a | b | c
PsiReferenceExpression:a
PsiReferenceParameterList
<empty list>
PsiIdentifier:a('a')
PsiWhiteSpace(' ')
PsiJavaToken:OR('|')
PsiWhiteSpace(' ')
PsiReferenceExpression:b
PsiReferenceParameterList
<empty list>
PsiIdentifier:b('b')
PsiWhiteSpace(' ')
PsiJavaToken:OR('|')
PsiWhiteSpace(' ')
@@ -48,4 +47,4 @@ PsiJavaFile:Or0.java
PsiWhiteSpace('\n ')
PsiJavaToken:RBRACE('}')
PsiWhiteSpace('\n')
PsiJavaToken:RBRACE('}')
PsiJavaToken:RBRACE('}')
@@ -24,19 +24,18 @@ PsiJavaFile:Xor0.java
PsiReturnStatement
PsiKeyword:return('return')
PsiWhiteSpace(' ')
PsiBinaryExpression:a ^ b ^ c
PsiBinaryExpression:a ^ b
PsiReferenceExpression:a
PsiReferenceParameterList
<empty list>
PsiIdentifier:a('a')
PsiWhiteSpace(' ')
PsiJavaToken:XOR('^')
PsiWhiteSpace(' ')
PsiReferenceExpression:b
PsiReferenceParameterList
<empty list>
PsiIdentifier:b('b')
PsiPolyadicExpression: a ^ b ^ c
PsiReferenceExpression:a
PsiReferenceParameterList
<empty list>
PsiIdentifier:a('a')
PsiWhiteSpace(' ')
PsiJavaToken:XOR('^')
PsiWhiteSpace(' ')
PsiReferenceExpression:b
PsiReferenceParameterList
<empty list>
PsiIdentifier:b('b')
PsiWhiteSpace(' ')
PsiJavaToken:XOR('^')
PsiWhiteSpace(' ')
@@ -48,4 +47,4 @@ PsiJavaFile:Xor0.java
PsiWhiteSpace('\n ')
PsiJavaToken:RBRACE('}')
PsiWhiteSpace('\n')
PsiJavaToken:RBRACE('}')
PsiJavaToken:RBRACE('}')
@@ -1,21 +1,20 @@
PsiJavaFile:CondOr0.java
PsiBinaryExpression:a || b || c
PsiBinaryExpression:a || b
PsiReferenceExpression:a
PsiReferenceParameterList
<empty list>
PsiIdentifier:a('a')
PsiWhiteSpace(' ')
PsiJavaToken:OROR('||')
PsiWhiteSpace(' ')
PsiReferenceExpression:b
PsiReferenceParameterList
<empty list>
PsiIdentifier:b('b')
PsiPolyadicExpression: a || b || c
PsiReferenceExpression:a
PsiReferenceParameterList
<empty list>
PsiIdentifier:a('a')
PsiWhiteSpace(' ')
PsiJavaToken:OROR('||')
PsiWhiteSpace(' ')
PsiReferenceExpression:b
PsiReferenceParameterList
<empty list>
PsiIdentifier:b('b')
PsiWhiteSpace(' ')
PsiJavaToken:OROR('||')
PsiWhiteSpace(' ')
PsiReferenceExpression:c
PsiReferenceParameterList
<empty list>
PsiIdentifier:c('c')
PsiIdentifier:c('c')
@@ -1,21 +1,20 @@
PsiJavaFile:Or0.java
PsiBinaryExpression:a | b | c
PsiBinaryExpression:a | b
PsiReferenceExpression:a
PsiReferenceParameterList
<empty list>
PsiIdentifier:a('a')
PsiWhiteSpace(' ')
PsiJavaToken:OR('|')
PsiWhiteSpace(' ')
PsiReferenceExpression:b
PsiReferenceParameterList
<empty list>
PsiIdentifier:b('b')
PsiPolyadicExpression: a | b | c
PsiReferenceExpression:a
PsiReferenceParameterList
<empty list>
PsiIdentifier:a('a')
PsiWhiteSpace(' ')
PsiJavaToken:OR('|')
PsiWhiteSpace(' ')
PsiReferenceExpression:b
PsiReferenceParameterList
<empty list>
PsiIdentifier:b('b')
PsiWhiteSpace(' ')
PsiJavaToken:OR('|')
PsiWhiteSpace(' ')
PsiReferenceExpression:c
PsiReferenceParameterList
<empty list>
PsiIdentifier:c('c')
PsiIdentifier:c('c')
@@ -0,0 +1,10 @@
class XX {
public static String foo(Properties p, String s, boolean b){return null;}
public static String foo(Map p, String s, boolean b){return null;}
}
class UU {
void bar() {
Properties p = new Properties();
XX.fo<ref>o(p, "xxx", false);
}
}
@@ -228,6 +228,8 @@ public class CompleteStatementTest extends EditorActionTestCase {
public void testLastJavadocParameterDescriptionToReturn() throws Exception { doTest(); }
public void testCompleteMethodCallAtReturn() throws Exception { doTest(); }
private void doTestBracesNextLineStyle() throws Exception {
CodeStyleSettings settings = CodeStyleSettingsManager.getSettings(getProject());
settings.BRACE_STYLE = CommonCodeStyleSettings.NEXT_LINE;
@@ -10,8 +10,8 @@ import com.intellij.util.ThrowableRunnable;
*/
public class RecursiveVisitorTest extends LightDaemonAnalyzerTestCase{
public void testHugeConcatenationVisitingPerformance() throws IncorrectOperationException {
StringBuilder text = new StringBuilder("String s = \"xxx\"");
final int N = 2;
StringBuilder text = new StringBuilder("String s = null");
final int N = 20000;
for (int i = 0; i < N; i++) {
text.append("+\"xxx\"");
}
@@ -19,26 +19,26 @@ public class RecursiveVisitorTest extends LightDaemonAnalyzerTestCase{
final PsiElement expression =
JavaPsiFacade.getInstance(getProject()).getElementFactory().createStatementFromText(text.toString(), null);
final int[] n = {0};
PlatformTestUtil.startPerformanceTest(getTestName(false), 20, new ThrowableRunnable() {
PlatformTestUtil.startPerformanceTest(getTestName(false), 100, new ThrowableRunnable() {
@Override
public void run() throws Exception {
n[0] = 0;
expression.accept(new JavaRecursiveElementWalkingVisitor() {
@Override
public void visitBinaryExpression(final PsiBinaryExpression expression) {
PsiExpression s = expression.getLOperand();
super.visitBinaryExpression(expression);
public void visitExpression(PsiExpression expression) {
PsiExpression s = expression;
super.visitExpression(expression);
s.hashCode(); //hold on stack
n[0]++;
}
});
assertEquals(N, n[0]);
assertEquals(N+2, n[0]);
}
}).cpuBound().assertTiming();
}
public void testHugeMethodChainingVisitingPerformance() throws IncorrectOperationException {
StringBuilder text = new StringBuilder("Object s = new StringBuilder()");
final int N = 1500;
final int N = 20000;
for (int i = 0; i < N; i++) {
text.append(".append(\"xxx\")");
}
@@ -46,7 +46,7 @@ public class RecursiveVisitorTest extends LightDaemonAnalyzerTestCase{
final PsiElement expression =
JavaPsiFacade.getInstance(getProject()).getElementFactory().createStatementFromText(text.toString(), null);
final int[] n = {0};
PlatformTestUtil.startPerformanceTest(getTestName(false), 100, new ThrowableRunnable() {
PlatformTestUtil.startPerformanceTest(getTestName(false), 200, new ThrowableRunnable() {
@Override
public void run() throws Exception {
n[0] = 0;
@@ -38,7 +38,7 @@ class Test {
def toPaste =
'''\
foo();
foo();
foo();\
'''
@@ -48,7 +48,7 @@ class Test {
void test() {
if (true) {
foo();
foo();
foo();
}
}
}\
@@ -56,6 +56,48 @@ class Test {
doTest(before, toPaste, expected)
}
void testJavaComplexBlockWithDecreasedIndent() {
def before = '''\
class Test {
void test() {
if (true) {
i = 1;
} else {
i = 2;
}
<caret>
}
}\
'''
def toPaste =
'''\
if (true) {
i = 1;
} else {
i = 2;
}\
'''
def expected = '''\
class Test {
void test() {
if (true) {
i = 1;
} else {
i = 2;
}
if (true) {
i = 1;
} else {
i = 2;
}
}
}\
'''
doTest(before, toPaste, expected)
}
void testJavaBlockIncreasedIndentOnTwoLinesPasting() {
def before = '''\
class Test {
@@ -70,7 +112,7 @@ class Test {
def toPaste =
'''\
foo();
foo();\
foo();\
'''
@@ -79,7 +121,7 @@ class Test {
void test() {
if (true) {
foo();
foo();
foo();
}
}
}\
@@ -100,7 +142,7 @@ class Test {
def toPaste =
'''\
foo();
foo();
foo();\
'''
@@ -110,7 +152,7 @@ class Test {
void test() {
if (true) {
foo();
foo();
foo();
}
}
}\
@@ -131,7 +173,7 @@ class Test {
def toPaste =
'''\
foo();
foo();
foo();
foo();\
'''
@@ -175,8 +217,8 @@ class Test {
void test() {
if (true) {
foo();
foo();
foo();
foo();
foo();
}
}
}\
@@ -229,20 +271,20 @@ class Test {
def toPaste =
'''\
// this is a comment
foo();
foo();
foo();\
// this is a comment
foo();
foo();
foo();\
'''
def expected = '''\
class Test {
void test() {
if (true) { // this is a comment
foo();
if (true) {// this is a comment
foo();
foo();
foo();
foo();
}
}
}\
@@ -250,6 +292,88 @@ class Test {
doTest(before, toPaste, expected)
}
void testPasteAtZeroColumnAfterBlankLineWithWhiteSpaces() {
def before = '''\
class Test {
void test() {
if (true) {
}
}
}
<caret>\
'''
def toPaste =
'''\
class Test {
void test() {
if (true) {
}
}
}\
'''
def expected = '''\
class Test {
void test() {
if (true) {
}
}
}
class Test {
void test() {
if (true) {
}
}
}\
'''
doTest(before, toPaste, expected)
}
void testPasteAtNonZeroColumnAfterBlankLineWithWhiteSpaces() {
def before = '''\
class Test {
void test() {
if (true) {
}
}
}
<caret>\
'''
def toPaste =
'''\
class Test {
void test() {
if (true) {
}
}
}\
'''
def expected = '''\
class Test {
void test() {
if (true) {
}
}
}
class Test {
void test() {
if (true) {
}
}
}\
'''
doTest(before, toPaste, expected)
}
def testPlainTextPaste() {
def before = '''\
line1
@@ -19,6 +19,7 @@ import com.intellij.lang.PsiBuilder;
import com.intellij.lang.java.parser.ExpressionParser;
import com.intellij.lang.java.parser.JavaParsingTestCase;
import com.intellij.pom.java.LanguageLevel;
import org.jetbrains.annotations.NonNls;
public class ExpressionParserTest extends JavaParsingTestCase {
@@ -115,7 +116,7 @@ public class ExpressionParserTest extends JavaParsingTestCase {
public void testChainedClassObjectAccess() { doParserTest("A.class.B.class"); }
public void testChainedThisObjectAccess() { doParserTest("A.this.B.this"); }
private void doParserTest(final String text) {
private void doParserTest(@NonNls final String text) {
doParserTest(text, new TestParser() {
@Override
public void parse(final PsiBuilder builder) {
@@ -15,16 +15,15 @@
*/
package com.intellij.psi;
import com.intellij.codeInsight.daemon.LightDaemonAnalyzerTestCase;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.testFramework.LightCodeInsightTestCase;
public class JavaSOEOnReparseTest extends LightCodeInsightTestCase {
private static final String HUGE_EXPR;
public class JavaSOEOnReparseTest extends LightDaemonAnalyzerTestCase {
private static final StringBuilder HUGE_EXPR;
static {
final StringBuilder sb = new StringBuilder("\"-\"");
for (int i = 0; i < 10000; i++) sb.append("+\"b\"");
HUGE_EXPR = sb.toString();
HUGE_EXPR = new StringBuilder("\"-\"");
for (int i = 0; i < 100000; i++) HUGE_EXPR.append("+\"b\"");
}
public void testOnHugeBinaryExprInFile() throws Exception {
@@ -37,7 +36,7 @@ public class JavaSOEOnReparseTest extends LightCodeInsightTestCase {
doTest();
}
private static void doTest() {
private void doTest() {
final int pos = getEditor().getDocument().getText().indexOf("\"\"");
// replace small expression with huge binary one
@@ -45,23 +44,27 @@ public class JavaSOEOnReparseTest extends LightCodeInsightTestCase {
getEditor().getDocument().replaceString(pos, pos + 2, HUGE_EXPR);
PsiDocumentManager.getInstance(getProject()).commitAllDocuments();
}});
doTestConfiguredFile(false, false);
// modify huge binary expression (1)
ApplicationManager.getApplication().runWriteAction(new Runnable() { public void run() {
getEditor().getDocument().insertString(pos, "\".\"+");
PsiDocumentManager.getInstance(getProject()).commitAllDocuments();
}});
doTestConfiguredFile(false, false);
// modify huge binary expression (2)
ApplicationManager.getApplication().runWriteAction(new Runnable() { public void run() {
getEditor().getDocument().replaceString(pos, pos + 4, "");
PsiDocumentManager.getInstance(getProject()).commitAllDocuments();
}});
doTestConfiguredFile(false, false);
// replace huge binary expression with small one
ApplicationManager.getApplication().runWriteAction(new Runnable() { public void run() {
getEditor().getDocument().replaceString(pos, pos + HUGE_EXPR.length(), "\".\"");
PsiDocumentManager.getInstance(getProject()).commitAllDocuments();
}});
doTestConfiguredFile(false, false);
}
}
@@ -26,6 +26,7 @@ import com.intellij.psi.stubs.StubElement;
import com.intellij.testFramework.LightIdeaTestCase;
import com.intellij.testFramework.PlatformTestUtil;
import com.intellij.util.ThrowableRunnable;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.Nullable;
import java.io.File;
@@ -36,7 +37,6 @@ public class JavaStubBuilderTest extends LightIdeaTestCase {
@SuppressWarnings("deprecation")
private static final StubBuilder OLD_BUILDER = new com.intellij.psi.impl.source.JavaFileStubBuilder();
private static final StubBuilder NEW_BUILDER = new JavaLightStubBuilder();
private static final int SOE_TEST_DEPTH = 20000;
@Override
public void setUp() throws Exception {
@@ -330,7 +330,8 @@ public class JavaStubBuilderTest extends LightIdeaTestCase {
final StringBuilder sb = new StringBuilder();
final SecureRandom random = new SecureRandom();
sb.append("class SOE_test {\n BigInteger BIG = new BigInteger(\n");
for (int i = 0; i < SOE_TEST_DEPTH; i++) {
int i;
for (i = 0; i < 100000; i++) {
sb.append(" \"").append(Math.abs(random.nextInt())).append("\" +\n");
}
sb.append(" \"\");\n}");
@@ -349,7 +350,7 @@ public class JavaStubBuilderTest extends LightIdeaTestCase {
" FIELD:PsiFieldStub[BIG:BigInteger=;INITIALIZER_NOT_STORED;]\n" +
" MODIFIER_LIST:PsiModifierListStub[mask=4096]\n",
DebugUtil.stubTreeToString(tree));
System.out.println("SOE depth=" + SOE_TEST_DEPTH + ", time=" + t + "ms");
System.out.println("SOE depth=" + i + ", time=" + t + "ms");
}
public void testPerformance() throws Exception {
@@ -365,7 +366,7 @@ public class JavaStubBuilderTest extends LightIdeaTestCase {
}).cpuBound().assertTiming();
}
private static void doTest(final String source, @Nullable final String tree) {
private static void doTest(@NonNls final String source, @NonNls @Nullable final String tree) {
final PsiJavaFile file = (PsiJavaFile)createLightFile("test.java", source);
final FileASTNode fileNode = file.getNode();
assertNotNull(fileNode);
@@ -509,6 +509,12 @@ public class ResolveMethod15Test extends Resolve15TestCase {
assertResolvesToMethodInClass(result, "A");
}
public void testRawInheritanceConflict() throws Exception {
PsiJavaReference ref = (PsiJavaReference)configureByFile();
final JavaResolveResult[] result = ref.multiResolve(false);
assertEquals("False ambiguity", 1, result.length);
}
public void testRawVsGenericConflictInCaseOfOverride() throws Exception{
PsiJavaReference ref = (PsiJavaReference) configureByFile();
final JavaResolveResult result = ref.advancedResolve(true);
@@ -11,11 +11,13 @@ package com.intellij.refactoring;
import com.intellij.JavaTestUtil;
import com.intellij.codeInsight.CodeInsightUtil;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.util.Pass;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiExpression;
import com.intellij.psi.PsiLocalVariable;
import com.intellij.psi.PsiMethod;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.refactoring.introduceField.ElementToWorkOn;
import com.intellij.refactoring.introduceParameter.IntroduceParameterHandler;
import com.intellij.refactoring.introduceParameter.IntroduceParameterProcessor;
import com.intellij.refactoring.introduceParameter.Util;
@@ -317,24 +319,25 @@ public class IntroduceParameterTest extends LightCodeInsightTestCase {
final boolean removeUnusedParameters,
final boolean generateDelegate,
int enclosingLevel) {
int startOffset = myEditor.getSelectionModel().getSelectionStart();
int endOffset = myEditor.getSelectionModel().getSelectionEnd();
final ElementToWorkOn[] elementToWorkOn = new ElementToWorkOn[1];
ElementToWorkOn
.processElementToWorkOn(myEditor, myFile, "INtr param", HelpID.INTRODUCE_PARAMETER, getProject(), new Pass<ElementToWorkOn>() {
@Override
public void pass(final ElementToWorkOn e) {
if (e == null) return;
PsiExpression expr = CodeInsightUtil.findExpressionInRange(myFile, startOffset, endOffset);
elementToWorkOn[0] = e;
}
});
PsiLocalVariable localVariable = null;
if (expr == null) {
PsiElement element = CodeInsightUtil.findElementInRange(myFile, startOffset, endOffset, PsiElement.class);
localVariable = PsiTreeUtil.getParentOfType(element, PsiLocalVariable.class);
if (localVariable == null) {
return false;
}
}
PsiElement context = expr == null ? localVariable : expr;
final PsiExpression expr = elementToWorkOn[0].getExpression();
final PsiLocalVariable localVar = elementToWorkOn[0].getLocalVariable();
PsiElement context = expr == null ? localVar : expr;
PsiMethod method = Util.getContainingMethod(context);
if (method == null) return false;
final List<PsiMethod> methods = IntroduceParameterHandler.getEnclosingMethods(method);
final List<PsiMethod> methods = com.intellij.refactoring.introduceParameter.IntroduceParameterHandler.getEnclosingMethods(method);
assertTrue(methods.size() > enclosingLevel);
method = methods.get(enclosingLevel);
@@ -345,11 +348,11 @@ public class IntroduceParameterTest extends LightCodeInsightTestCase {
else {
methodToSearchFor = method;
}
PsiExpression[] occurences = null;
PsiExpression[] occurences;
PsiExpression initializer;
if (expr == null) {
initializer = localVariable.getInitializer();
occurences = CodeInsightUtil.findReferenceExpressions(method, localVariable);
initializer = localVar.getInitializer();
occurences = CodeInsightUtil.findReferenceExpressions(method, localVar);
}
else {
initializer = expr;
@@ -357,7 +360,7 @@ public class IntroduceParameterTest extends LightCodeInsightTestCase {
}
TIntArrayList parametersToRemove = removeUnusedParameters ? Util.findParametersToRemove(method, initializer, occurences) : new TIntArrayList();
new IntroduceParameterProcessor(
getProject(), method, methodToSearchFor, initializer, expr, localVariable, true, parameterName, replaceAllOccurences,
getProject(), method, methodToSearchFor, initializer, expr, localVar, true, parameterName, replaceAllOccurences,
replaceFieldsWithGetters,
declareFinal, generateDelegate, null, parametersToRemove).run();
@@ -26,7 +26,7 @@ import com.intellij.util.IncorrectOperationException;
public class CodeInsightServicesUtil {
private static final Logger LOG = Logger.getInstance("#com.intellij.codeInsight.CodeInsightServicesUtil");
private static final IElementType[] ourTokenMap = new IElementType[]{
private static final IElementType[] ourTokenMap = {
JavaTokenType.EQEQ, JavaTokenType.NE,
JavaTokenType.LT, JavaTokenType.GE,
JavaTokenType.LE, JavaTokenType.GT,
@@ -36,39 +36,45 @@ public class CodeInsightServicesUtil {
public static PsiExpression invertCondition(PsiExpression booleanExpression) throws IncorrectOperationException {
PsiElementFactory factory = JavaPsiFacade.getInstance(booleanExpression.getProject()).getElementFactory();
if (booleanExpression instanceof PsiBinaryExpression) {
PsiBinaryExpression expression = (PsiBinaryExpression) booleanExpression;
PsiJavaToken operationSign = expression.getOperationSign();
if (booleanExpression instanceof PsiPolyadicExpression) {
PsiPolyadicExpression expression = (PsiPolyadicExpression)booleanExpression;
IElementType operationSign = expression.getOperationTokenType();
for (int i = 0; i < ourTokenMap.length; i++) {
IElementType tokenType = ourTokenMap[i];
if (operationSign.getTokenType() == tokenType) {
if (operationSign == tokenType) {
expression = (PsiBinaryExpression)expression.copy();
expression.getOperationSign().replace(createOperationToken(factory, ourTokenMap[i + (i % 2 == 0 ? 1 : -1)]));
if (tokenType == JavaTokenType.OROR || tokenType == JavaTokenType.ANDAND) {
expression.getLOperand().replace(invertCondition(expression.getLOperand()));
expression.getROperand().replace(invertCondition(expression.getROperand()));
PsiExpression[] operands = expression.getOperands();
for (int o = 0; o < operands.length; o++) {
PsiExpression op = operands[o];
if (o != 0) {
expression.getTokenBeforeOperand(op).replace(createOperationToken(factory, ourTokenMap[i + (i % 2 == 0 ? 1 : -1)]));
}
if (tokenType == JavaTokenType.OROR || tokenType == JavaTokenType.ANDAND) {
op.replace(invertCondition(op));
}
}
return expression;
}
}
} else if (booleanExpression instanceof PsiPrefixExpression) {
PsiPrefixExpression expression = (PsiPrefixExpression) booleanExpression;
PsiJavaToken operationSign = expression.getOperationSign();
if (operationSign.getTokenType() == JavaTokenType.EXCL) {
}
else if (booleanExpression instanceof PsiPrefixExpression) {
PsiPrefixExpression expression = (PsiPrefixExpression)booleanExpression;
if (expression.getOperationTokenType() == JavaTokenType.EXCL) {
PsiExpression operand = expression.getOperand();
if (operand instanceof PsiParenthesizedExpression) {
operand = ((PsiParenthesizedExpression) operand).getExpression();
operand = ((PsiParenthesizedExpression)operand).getExpression();
}
return operand;
}
} else if (booleanExpression instanceof PsiLiteralExpression) {
}
else if (booleanExpression instanceof PsiLiteralExpression) {
return booleanExpression.getText().equals("true") ?
factory.createExpressionFromText("false", null) :
factory.createExpressionFromText("true", null);
}
if (booleanExpression instanceof PsiParenthesizedExpression) {
PsiExpression operand = ((PsiParenthesizedExpression) booleanExpression).getExpression();
PsiExpression operand = ((PsiParenthesizedExpression)booleanExpression).getExpression();
operand.replace(invertCondition(operand));
return booleanExpression;
}
@@ -76,8 +82,9 @@ public class CodeInsightServicesUtil {
PsiPrefixExpression result = (PsiPrefixExpression)factory.createExpressionFromText("!(a)", null);
if (!(booleanExpression instanceof PsiBinaryExpression)) {
result.getOperand().replace(booleanExpression);
} else {
PsiParenthesizedExpression e = (PsiParenthesizedExpression) result.getOperand();
}
else {
PsiParenthesizedExpression e = (PsiParenthesizedExpression)result.getOperand();
e.getExpression().replace(booleanExpression);
}
@@ -115,7 +122,7 @@ public class CodeInsightServicesUtil {
s = "==";
}
PsiBinaryExpression expression = (PsiBinaryExpression) factory.createExpressionFromText("a" + s + "b", null);
PsiBinaryExpression expression = (PsiBinaryExpression)factory.createExpressionFromText("a" + s + "b", null);
return expression.getOperationSign();
}
}
@@ -41,7 +41,7 @@ public abstract class JavaElementVisitor extends PsiElementVisitor {
}
public void visitBinaryExpression(PsiBinaryExpression expression) {
visitExpression(expression);
visitPolyadicExpression(expression);
}
public void visitBlockStatement(PsiBlockStatement statement) {
@@ -367,4 +367,8 @@ public abstract class JavaElementVisitor extends PsiElementVisitor {
public void visitCodeFragment(JavaCodeFragment codeFragment) {
visitFile(codeFragment);
}
public void visitPolyadicExpression(PsiPolyadicExpression expression) {
visitExpression(expression);
}
}
@@ -21,8 +21,10 @@ import com.intellij.psi.tree.IElementType;
/**
* Represents a Java binary expression (addition, multiplication and so on).
* @deprecated Use {@link PsiPolyadicExpression} instead.
*/
public interface PsiBinaryExpression extends PsiExpression {
@Deprecated
public interface PsiBinaryExpression extends PsiExpression, PsiPolyadicExpression {
/**
* Returns the left operand of the expression.
*
@@ -0,0 +1,30 @@
/*
* 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 com.intellij.psi;
import com.intellij.psi.tree.IElementType;
import org.jetbrains.annotations.NotNull;
/**
* User: cdr
*/
public interface PsiPolyadicExpression extends PsiExpression {
@NotNull PsiExpression[] getOperands();
@NotNull
IElementType getOperationTokenType();
PsiJavaToken getTokenBeforeOperand(@NotNull PsiExpression operand);
}
@@ -82,20 +82,11 @@ public class IsConstantExpressionVisitor extends JavaElementVisitor {
myIsConstant = false;
}
@Override public void visitBinaryExpression(PsiBinaryExpression expression) {
while (true) {
// check right operand first since it tends to be shorter
PsiExpression rOperand = expression.getROperand();
if (rOperand == null) return;
rOperand.accept(this);
@Override
public void visitPolyadicExpression(PsiPolyadicExpression expression) {
for (PsiExpression operand : expression.getOperands()) {
operand.accept(this);
if (!myIsConstant) return;
PsiExpression lOperand = expression.getLOperand();
if (!(lOperand instanceof PsiBinaryExpression)) {
lOperand.accept(this);
break;
}
expression = (PsiBinaryExpression)lOperand;
}
}
@@ -0,0 +1,138 @@
/*
* 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 com.intellij.psi.util;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.*;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.util.IncorrectOperationException;
import java.util.List;
/**
* User: cdr
*/
public class PsiConcatenationUtil {
public static void buildFormatString(
PsiExpression expression, StringBuilder formatString,
List<PsiExpression> formatParameters, boolean printfFormat) {
if (expression instanceof PsiLiteralExpression) {
final PsiLiteralExpression literalExpression =
(PsiLiteralExpression) expression;
final String text = String.valueOf(literalExpression.getValue());
final String formatText;
if (printfFormat) {
formatText = StringUtil.escapeStringCharacters(text)
.replace("%", "%%").replace("\\'", "'");
}
else {
formatText = StringUtil.escapeStringCharacters(text)
.replace("'", "''").replace("{", "'{").replace("}", "'}");
}
formatString.append(formatText);
} else if (expression instanceof PsiPolyadicExpression) {
final PsiType type = expression.getType();
if (type != null && type.equalsToText("java.lang.String")) {
final PsiPolyadicExpression binaryExpression =
(PsiPolyadicExpression) expression;
PsiExpression[] operands = binaryExpression.getOperands();
PsiType left = operands[0].getType();
boolean stringStarted = left != null && left.equalsToText("java.lang.String");
if (stringStarted) {
buildFormatString(operands[0], formatString, formatParameters, printfFormat);
}
for (int i = 1; i < operands.length; i++) {
PsiExpression op = operands[i];
PsiType optype = op.getType();
PsiType r = TypeConversionUtil.calcTypeForBinaryExpression(left, optype, binaryExpression.getOperationTokenType(), true);
if (r != null && r.equalsToText("java.lang.String") && !stringStarted) {
stringStarted = true;
PsiElement element = binaryExpression.getTokenBeforeOperand(op);
if (element.getPrevSibling() instanceof PsiWhiteSpace) element = element.getPrevSibling();
String text = binaryExpression.getText().substring(0, element.getStartOffsetInParent());
PsiExpression subExpression = JavaPsiFacade.getInstance(binaryExpression.getProject()).getElementFactory()
.createExpressionFromText(text, binaryExpression);
addFormatParameter(subExpression, formatString, formatParameters, printfFormat);
}
if (stringStarted) {
if (optype != null && (optype.equalsToText("java.lang.String") || optype == PsiType.CHAR)) {
buildFormatString(op, formatString, formatParameters, printfFormat);
}
else {
addFormatParameter(op, formatString, formatParameters, printfFormat);
}
}
left = r;
}
}
else {
addFormatParameter(expression, formatString, formatParameters, printfFormat);
}
}
else {
addFormatParameter(expression, formatString, formatParameters, printfFormat);
}
}
private static void addFormatParameter(PsiExpression expression,
StringBuilder formatString,
List<PsiExpression> formatParameters, boolean printfFormat) {
final PsiType type = expression.getType();
if (!printfFormat) {
formatString.append("{" + formatParameters.size() + "}");
}
else if (type != null &&
(type.equalsToText("long") ||
type.equalsToText("int") ||
type.equalsToText("java.lang.Long") ||
type.equalsToText("java.lang.Integer"))) {
formatString.append("%d");
}
else {
formatString.append("%s");
}
formatParameters.add(getBoxedArgument(expression));
}
private static PsiExpression getBoxedArgument(PsiExpression arg) throws IncorrectOperationException {
arg = PsiUtil.deparenthesizeExpression(arg);
assert arg != null;
if (PsiUtil.isLanguageLevel5OrHigher(arg)) {
return arg;
}
final PsiType type = arg.getType();
if (!(type instanceof PsiPrimitiveType) || type.equals(PsiType.NULL)) {
return arg;
}
final PsiPrimitiveType primitiveType = (PsiPrimitiveType)type;
final String boxedQName = primitiveType.getBoxedTypeName();
if (boxedQName == null) {
return arg;
}
final GlobalSearchScope resolveScope = arg.getResolveScope();
final PsiElementFactory factory = JavaPsiFacade.getElementFactory(arg.getProject());
final PsiJavaCodeReferenceElement ref = factory.createReferenceElementByFQClassName(boxedQName, resolveScope);
final PsiNewExpression newExpr = (PsiNewExpression)factory.createExpressionFromText("new A(b)", null);
final PsiElement classRef = newExpr.getClassReference();
assert classRef != null;
classRef.replace(ref);
final PsiExpressionList argumentList = newExpr.getArgumentList();
assert argumentList != null;
argumentList.getExpressions()[0].replace(arg);
return newExpr;
}
}
@@ -94,12 +94,15 @@ public class PsiExpressionTrimRenderer extends JavaRecursiveElementWalkingVisito
}
@Override
public void visitBinaryExpression(final PsiBinaryExpression expression) {
expression.getLOperand().accept(this);
myBuf.append(" ").append(expression.getOperationSign().getText()).append(" ");
final PsiExpression rOperand = expression.getROperand();
if (rOperand != null) {
rOperand.accept(this);
public void visitPolyadicExpression(PsiPolyadicExpression expression) {
PsiExpression[] operands = expression.getOperands();
for (int i = 0; i < operands.length; i++) {
PsiExpression operand = operands[i];
operand.accept(this);
if (i != 0) {
PsiJavaToken token = expression.getTokenBeforeOperand(operand);
myBuf.append(" ").append(token.getText()).append(" ");
}
}
}
@@ -136,25 +136,29 @@ public class RedundantCastUtil {
super.visitReturnStatement(statement);
}
@Override public void visitBinaryExpression(PsiBinaryExpression expression) {
PsiExpression rExpr = deparenthesizeExpression(expression.getLOperand());
PsiExpression lExpr = deparenthesizeExpression(expression.getROperand());
if (rExpr != null && lExpr != null) {
final IElementType binaryToken = expression.getOperationTokenType();
processBinaryExpressionOperand(lExpr, rExpr, binaryToken);
processBinaryExpressionOperand(rExpr, lExpr, binaryToken);
@Override
public void visitPolyadicExpression(PsiPolyadicExpression expression) {
IElementType tokenType = expression.getOperationTokenType();
PsiExpression[] operands = expression.getOperands();
if (operands.length >= 2) {
PsiType lType = operands[0].getType();
processBinaryExpressionOperand(deparenthesizeExpression(operands[0]), operands[1].getType(), tokenType);
for (int i = 1; i < operands.length; i++) {
PsiExpression operand = deparenthesizeExpression(operands[i]);
processBinaryExpressionOperand(operand, lType, tokenType);
lType = TypeConversionUtil.calcTypeForBinaryExpression(lType, operand.getType(), tokenType, true);
}
}
super.visitBinaryExpression(expression);
super.visitPolyadicExpression(expression);
}
private void processBinaryExpressionOperand(final PsiExpression operand,
final PsiExpression otherOperand,
final PsiType otherType,
final IElementType binaryToken) {
if (operand instanceof PsiTypeCastExpression) {
PsiTypeCastExpression typeCast = (PsiTypeCastExpression)operand;
PsiExpression toCast = typeCast.getOperand();
if (toCast != null && TypeConversionUtil.isBinaryOperatorApplicable(binaryToken, toCast, otherOperand, false)) {
if (toCast != null && TypeConversionUtil.isBinaryOperatorApplicable(binaryToken, toCast.getType(), otherType, false)) {
addToResults(typeCast);
}
}
@@ -29,6 +29,7 @@ import com.intellij.util.containers.HashMap;
import gnu.trove.THashMap;
import gnu.trove.THashSet;
import gnu.trove.TObjectIntHashMap;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -62,6 +63,16 @@ public class TypeConversionUtil {
private static final int BOOL_RANK = 10;
private static final int STRING_RANK = 100;
private static final int MAX_NUMERIC_RANK = DOUBLE_RANK;
public static final PsiType NULL_TYPE = new PsiEllipsisType(PsiType.NULL){
public boolean isValid() {
return true;
}
@NonNls
public String getPresentableText() {
return "FAKE TYPE";
}
};
static {
TYPE_TO_RANK_MAP.put(PsiType.BYTE, BYTE_RANK);
@@ -1269,6 +1280,62 @@ public class TypeConversionUtil {
return opSign;
}
@Nullable
public static PsiType calcTypeForBinaryExpression(PsiType lType, PsiType rType, IElementType sign, boolean accessLType) {
if (sign == JavaTokenType.PLUS) {
// evaluate right argument first, since '+-/*%' is left associative and left operand tends to be bigger
if (rType == null) return null;
if (rType.equalsToText("java.lang.String")) {
return rType;
}
if (!accessLType) return NULL_TYPE;
if (lType == null) return null;
if (lType.equalsToText("java.lang.String")) {
return lType;
}
return unboxAndBalanceTypes(lType, rType);
}
if (sign == JavaTokenType.MINUS || sign == JavaTokenType.ASTERISK || sign == JavaTokenType.DIV || sign == JavaTokenType.PERC) {
if (rType == null) return null;
if (!accessLType) return NULL_TYPE;
if (lType == null) return null;
return unboxAndBalanceTypes(lType, rType);
}
if (sign == JavaTokenType.LTLT || sign == JavaTokenType.GTGT || sign == JavaTokenType.GTGTGT) {
if (!accessLType) return NULL_TYPE;
if (PsiType.BYTE.equals(lType) || PsiType.CHAR.equals(lType) || PsiType.SHORT.equals(lType)) {
return PsiType.INT;
}
if (lType instanceof PsiClassType) lType = PsiPrimitiveType.getUnboxedType(lType);
return lType;
}
if (sign == JavaTokenType.EQEQ ||
sign == JavaTokenType.NE ||
sign == JavaTokenType.LT ||
sign == JavaTokenType.GT ||
sign == JavaTokenType.LE ||
sign == JavaTokenType.GE ||
sign == JavaTokenType.OROR ||
sign == JavaTokenType.ANDAND) {
return PsiType.BOOLEAN;
}
if (sign == JavaTokenType.OR || sign == JavaTokenType.XOR || sign == JavaTokenType.AND) {
if (rType instanceof PsiClassType) rType = PsiPrimitiveType.getUnboxedType(rType);
if (lType instanceof PsiClassType) lType = PsiPrimitiveType.getUnboxedType(lType);
if (rType == null) return null;
if (PsiType.BOOLEAN.equals(rType)) return PsiType.BOOLEAN;
if (!accessLType) return NULL_TYPE;
if (lType == null) return null;
if (PsiType.BOOLEAN.equals(lType)) return PsiType.BOOLEAN;
if (PsiType.LONG.equals(lType) || PsiType.LONG.equals(rType)) return PsiType.LONG;
return PsiType.INT;
}
LOG.error("Unknown token: "+sign);
return null;
}
private interface Caster {
Object cast(Object operand);
}
+190 -40
View File
@@ -174,46 +174,6 @@ o+d57fYsNa8xAJ4mLfonZbd64+YY9rfvhIh3Vsl3AACeLPPKtma2K6XCfhTBEDnj
hzSr4vo=
=lBfF
-----END PGP PUBLIC KEY BLOCK-----
pub 1024D/265B4C63 2003-08-18 Antoine Levy-Lambert (Apache Ant Committer) <antoine@apache.org>
sig 3 265B4C63 2003-12-06 Antoine Levy-Lambert (Apache Ant Committer) <antoine@apache.org>
sig 3 5F6B8B72 2003-12-12 Stefan Bodewig <bodewig@apache.org>
uid Antoine Levy-Lambert (Apache Ant Committer) <antoine@antbuild.com>
sig 3 265B4C63 2003-08-18 Antoine Levy-Lambert (Apache Ant Committer) <antoine@apache.org>
sig 3 5F6B8B72 2003-12-12 Stefan Bodewig <bodewig@apache.org>
sub 1024g/A3060393 2003-08-18
sig 265B4C63 2003-08-18 Antoine Levy-Lambert (Apache Ant Committer) <antoine@apache.org>
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.2.2 (MingW32)
mQGiBD9AzmcRBACMqgb7IFvC/nLxw7mUAgHENeZXY3JOQJ8wVBevIbbMEeFvzHE2
diFydqUXocPexduYr0ahkf033WvWdAiNqDLfVW/HFOsc1TpjbHkqPUHtJ62Ya5tg
nH4UGN9BYZfMbfVDOSz41lYwmfK5HYgpZN/sBQBSKf2qgoFB+LxYaae8YwCgrWlu
fYhf7fkKbbdSf3BGS67ggNkD/0VvkXkw1SEnPaqrkKGkPKomCTb2auGxcYYI3/rP
1m+SGRf0gE1NtocmIEitiR6WvfKUjoMAXSCp5KdnUXmO9rwzkM002KCA7K5CY+e/
2bLDuiQ3rNiD4mFfG6M+UnmZ+GMFba1p9Cp4PqLNLsCHz67t7hEsscTZQ8mZ9xKM
+GCsA/9P+XFM7JDn9MLhYab9qo1CkceBkthUP6jWGjuAZ00elmBCkpkzNv5aIzss
xih2GpaU/tmcMjw8FGp0dTwzqdpmbZBLjunRnuBTir4m4l5G9rwl4JbfK1PVqk4a
VKkh9W7/yqBcEfNcsfJO9cqaQ+PzcnCoDiD9UHEBYzUhrCKwhLRCQW50b2luZSBM
ZXZ5LUxhbWJlcnQgKEFwYWNoZSBBbnQgQ29tbWl0dGVyKSA8YW50b2luZUBhbnRi
dWlsZC5jb20+iFsEExECABsFAj9AzmcGCwkIBwMCAxUCAwMWAgECHgECF4AACgkQ
hhTWqyZbTGMnOgCeJV2gI+1CIxMR7dcIhXjPkiusreIAn2SGOsPS0o89l0EIVuc9
J2F03aB+iEYEExECAAYFAj/ZwioACgkQohFa4V9ri3J8CACgiGlh+td0BAnJPq19
ovEQR2DJ02MAoLP203EF+BLPpykeTcGp8UEWmeGQtEBBbnRvaW5lIExldnktTGFt
YmVydCAoQXBhY2hlIEFudCBDb21taXR0ZXIpIDxhbnRvaW5lQGFwYWNoZS5vcmc+
iF4EExECAB4FAj/SSwYCGwMGCwkIBwMCAxUCAwMWAgECHgECF4AACgkQhhTWqyZb
TGOh/QCfbrSoipMlizyGT6c8BOPEd9zzfi0AnRRTqTDzXzsGk4CG/BJME9CCm7Ts
iEYEExECAAYFAj/ZwiMACgkQohFa4V9ri3IOVACgh2QHS1+cVjvM4eLjls1bJwWi
o5IAoLtAszHrwHS5qrhvr2rtnlyyyV2guQENBD9AzmkQBACNpBfqi2PweozCtxoX
PqzKdRDKqCw7TOrDR6lbP3z/ov/1SN5Vc0XqNzBSGqwBcmGWtneABkX7n4uzJrC5
wvX/TZ/DkMvypPyeNVMu+/ZMlzdbx06OUDKr6Fy/NtaI7cN1rw+Igyv22Q8ilhhg
s/5Rdj84EtJkWQjVRml6wXSAZwADBwP/TqyhOC4sA5YrePYGH8i46h0SU9dXjfEF
JijC8vXZ+BNQHQVK3fjEXedZL8Zvvp1bsMu7Muz9SMnqygM1unp2NGxLRd/9315p
Qh0VStYKn0xq13ybOKr0Gsyx5yyl3Nzlu/1qAR0es/zN4jV7/IQi3R2GOvezcpHX
mkbsYiZAhu2IRgQYEQIABgUCP0DOaQAKCRCGFNarJltMYxcsAKCSJJUABlXYnLBj
b+WtmAzu0JjZNACdFJ4KIATJDK/5ajFq5+irOpodoHc=
=UomR
-----END PGP PUBLIC KEY BLOCK-----
pub 1024D/5F6B8B72 2001-05-28
uid Stefan Bodewig <bodewig@apache.org>
@@ -1246,3 +1206,193 @@ iNoi9D8jtudc46l1OASP7n9e+WQDCd/IwwsUXHqT4+EkM/ZIj31W1+mBZtzIPBCU
udvp
=oSat
-----END PGP PUBLIC KEY BLOCK-----
pub 1024D/265B4C63 2003-08-18
uid Antoine Levy-Lambert (Apache Ant Committer) <antoine@apache.org>
sig 3 265B4C63 2003-12-06 Antoine Levy-Lambert (Apache Ant Committer) <antoine@apache.org>
sig 3 5F6B8B72 2003-12-12 Stefan Bodewig <bodewig@apache.org>
uid Antoine Levy-Lambert (Apache Ant Committer) <antoine@antbuild.com>
sig 3 265B4C63 2003-08-18 Antoine Levy-Lambert (Apache Ant Committer) <antoine@apache.org>
sig 3 5F6B8B72 2003-12-12 Stefan Bodewig <bodewig@apache.org>
sub 1024g/A3060393 2003-08-18
sig 265B4C63 2003-08-18 Antoine Levy-Lambert (Apache Ant Committer) <antoine@apache.org>
pub 4096R/710038F5 2010-11-02
uid Antoine Levy-Lambert (CODE SIGNING KEY) <antoine@apache.org>
sig 3 710038F5 2010-11-02 Antoine Levy-Lambert (CODE SIGNING KEY) <antoine@apache.org>
sub 4096R/84F32FDC 2010-11-02
sig 710038F5 2010-11-02 Antoine Levy-Lambert (CODE SIGNING KEY) <antoine@apache.org>
pub 4096R/82A7FBCD 2010-11-02
uid Antoine Levy-Lambert (CODE SIGNING KEY) <antoine@apache.org>
sig 3 82A7FBCD 2010-11-02 Antoine Levy-Lambert (CODE SIGNING KEY) <antoine@apache.org>
sig 62B2963F 2010-11-04 Dan Poirier <dan@poirier.us>
sig 7C408737 2010-11-04 Joseph Edward Bergmark (CODE SIGNING KEY) <bergmark@apache.org>
sig 02E9F65B 2010-11-04 Luc Maisonobe <Luc.Maisonobe@c-s.fr>
sig EFB55DF1 2010-11-05 Luciano Resende (Code Signing Key) <lresende@apache.org>
sub 4096R/70EC4C9A 2010-11-02
sig 82A7FBCD 2010-11-02 Antoine Levy-Lambert (CODE SIGNING KEY) <antoine@apache.org>
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG/MacGPG2 v2.0.16 (Darwin)
mQGiBD9AzmcRBACMqgb7IFvC/nLxw7mUAgHENeZXY3JOQJ8wVBevIbbMEeFvzHE2
diFydqUXocPexduYr0ahkf033WvWdAiNqDLfVW/HFOsc1TpjbHkqPUHtJ62Ya5tg
nH4UGN9BYZfMbfVDOSz41lYwmfK5HYgpZN/sBQBSKf2qgoFB+LxYaae8YwCgrWlu
fYhf7fkKbbdSf3BGS67ggNkD/0VvkXkw1SEnPaqrkKGkPKomCTb2auGxcYYI3/rP
1m+SGRf0gE1NtocmIEitiR6WvfKUjoMAXSCp5KdnUXmO9rwzkM002KCA7K5CY+e/
2bLDuiQ3rNiD4mFfG6M+UnmZ+GMFba1p9Cp4PqLNLsCHz67t7hEsscTZQ8mZ9xKM
+GCsA/9P+XFM7JDn9MLhYab9qo1CkceBkthUP6jWGjuAZ00elmBCkpkzNv5aIzss
xih2GpaU/tmcMjw8FGp0dTwzqdpmbZBLjunRnuBTir4m4l5G9rwl4JbfK1PVqk4a
VKkh9W7/yqBcEfNcsfJO9cqaQ+PzcnCoDiD9UHEBYzUhrCKwhLRCQW50b2luZSBM
ZXZ5LUxhbWJlcnQgKEFwYWNoZSBBbnQgQ29tbWl0dGVyKSA8YW50b2luZUBhbnRi
dWlsZC5jb20+iFsEExECABsFAj9AzmcGCwkIBwMCAxUCAwMWAgECHgECF4AACgkQ
hhTWqyZbTGMnOgCeJV2gI+1CIxMR7dcIhXjPkiusreIAn2SGOsPS0o89l0EIVuc9
J2F03aB+iEYEExECAAYFAj/ZwioACgkQohFa4V9ri3J8CACgiGlh+td0BAnJPq19
ovEQR2DJ02MAoLP203EF+BLPpykeTcGp8UEWmeGQtEBBbnRvaW5lIExldnktTGFt
YmVydCAoQXBhY2hlIEFudCBDb21taXR0ZXIpIDxhbnRvaW5lQGFwYWNoZS5vcmc+
iF4EExECAB4FAj/SSwYCGwMGCwkIBwMCAxUCAwMWAgECHgECF4AACgkQhhTWqyZb
TGOh/QCfbrSoipMlizyGT6c8BOPEd9zzfi0AnRRTqTDzXzsGk4CG/BJME9CCm7Ts
iEYEExECAAYFAj/ZwiMACgkQohFa4V9ri3IOVACgh2QHS1+cVjvM4eLjls1bJwWi
o5IAoLtAszHrwHS5qrhvr2rtnlyyyV2guQENBD9AzmkQBACNpBfqi2PweozCtxoX
PqzKdRDKqCw7TOrDR6lbP3z/ov/1SN5Vc0XqNzBSGqwBcmGWtneABkX7n4uzJrC5
wvX/TZ/DkMvypPyeNVMu+/ZMlzdbx06OUDKr6Fy/NtaI7cN1rw+Igyv22Q8ilhhg
s/5Rdj84EtJkWQjVRml6wXSAZwADBwP/TqyhOC4sA5YrePYGH8i46h0SU9dXjfEF
JijC8vXZ+BNQHQVK3fjEXedZL8Zvvp1bsMu7Muz9SMnqygM1unp2NGxLRd/9315p
Qh0VStYKn0xq13ybOKr0Gsyx5yyl3Nzlu/1qAR0es/zN4jV7/IQi3R2GOvezcpHX
mkbsYiZAhu2IRgQYEQIABgUCP0DOaQAKCRCGFNarJltMYxcsAKCSJJUABlXYnLBj
b+WtmAzu0JjZNACdFJ4KIATJDK/5ajFq5+irOpodoHeZAg0ETM+HJwEQAMkzgJCo
lSOgkvzsTcjy/4ySwS56VgyFdYpZis8QqbEGCe8xKT+d9FYi5sBTw/jGpIy4weig
NKRRW4NLYgriWJANksBaaPOKvczGAOLWzh2aPfifaGF/puIVT8yCubH6ecxr0Wy/
lN54Rpi7cmpp+CEbhUTR+7xNGCMt3f9brtOlC6qYN3tJ7PPcfNBjJr0Ts+fPt8lT
RZlBhVa9iEUVYoqMnZQEBmYkg+FxSrFlLw7/WLMKaKGHAV7QbpIxhaDvQ7bMM6qW
c4plt10+wtZtJV3MB6TIRSYaEF87hXCif7mJY8KkCN8XkAxFlQhqEY/gJTOs73DS
Z5+LJKUOF+0+66B31tN5gQq5yNBGd55OEA9iOM87hhQb4e0IuZGvq2vxxK1OL6Q5
apr141c0ZxHLKaG2YCqM0B42mW84V2mO/Xu25HUjmXGrkpEd61KaodffS5g7SWj3
jb0X1w/+QGQXnWdTPWuWu/SrpnJb9kBpk/awrBbh6/gz9Uug6WVw3jBaYvfm2gEf
eKVYXa8AtBDSDuytXSXCSNRKY6Hd27ohUKMRBLEtz6Z+WgTKS11u9ip6ewG9irtk
cJQmloGjgaQTLmTXJaZ9UkaEh8uH/LinhIDHk+ilht7z2+CN7S3kOX094v1AnvlA
OchoDd7Wn1KqSoiM6WO5pccPdnU/j4LSoeVDABEBAAG0PEFudG9pbmUgTGV2eS1M
YW1iZXJ0IChDT0RFIFNJR05JTkcgS0VZKSA8YW50b2luZUBhcGFjaGUub3JnPokC
OAQTAQIAIgUCTM+HJwIbAwYLCQgHAwIGFQgCCQoLBBYCAwECHgECF4AACgkQDmn4
CXEAOPVsEQ//Vv4CTUrXTvuaPTNR1x08nntcF5RY+2GGNlT5Cs6EzRbiB3GmKFKu
Qxp0Ucgr+Yg1NTa7jOP2TbMwo8/FCD6i/Q5pWTISs7CdahnqKx37a33F1Hz1bNqV
0Jhi5oJS/sVniYG0d4ZcUl5FkD/gDXgNbUDaB1Vi3I9bU+agwrsLoXrFWDpDPxrg
PGDV3grvqfEp7K2HvPl2B6mUQHYHbIZ9FgjRLRIjOzjMr33RkVtg2QrLaUiOlJ3r
i0xpWf2kMKDMej6M3vFP7PTacRHwqZMxZMWZ2WaviuC943pK0gWwUyJgkkYSrfql
LkzIq3DwKPUneuuInNS4bab8YjwuGYSd/Fnj11P8emTEHwkIIKFyH0LxO2JKw8tV
BosgExmS39P99tGjAOp4Qg1E00exl2mxtIiKI359DS3DYhjEhb5EDH1gVAh5GL2s
Y/NiI4VANomiuzkzCybVYaMwjRpaIkCKemXN0BXb8r7e3CLXn4BA3KHIpuZH4Yz7
I6RpVuyTOrayM62czy9mxF64Pnwp0gRUJhWC3a2BTYXV5vAtW89BrFB7ArENUKGd
q81lUXVocAk/1LnMxy5fveS5yuUMxPM0fRBwzgARfyv+0HdsjzVmKZZKfjKPOjB5
YWtOFtdFSdCzYnpIGyoPuUU34v8LuzRwMdBDrODb5LfvX3lMw7YvIkq5Ag0ETM+H
JwEQANOvLBAACFpbL82gr5fP0xfL/fG+oSrAqumUsXmxnCcxHOzDoEvExxebVnL+
102IXIMV3eQqEaZuqcUYGBjkMt216u5btuSoSsVDrwRI8T3/9fXsB/jdvlCzsq7b
pImEFh7VDQc/jC21pP7r1G81Tt7zWB8oWYBbGXJMGsacaNg6449Z/0Ctp+gi+T5L
jIq1b9apD/+ucg9kGdlKFlLJ8zMwc77hG3LWkoli1cbLgYKk4RKahboFmoEVnM9S
ypdFfDZuSCB+7PvitjfqEao+fOCYOG0b3ykdcYXSVitFSnHe9T1DLjvKBy9qMtbA
GkdD61xEl0MtifQxKkya/n2Fg438HUeU7ltcFLlKd4XAzmsh9PXy2Gpj/lbNYpsD
DDMZafyfFfkLYYZasN4/+Ak+f5T1OuUqByIlesAPGReFtnUI+yXM9qEImProy+R5
gNkBPN1AnNWvy2pi+ZUUI+35NW49uee35p5LNzMiP3hd2W+rDHWhE9y3oVFkpzbL
lXwF7AMQGtMNE6i82XfahDyiMRo9BzssTSdYc1+5OO+5buXWuZUibYmGc5yDQ6qv
0Yhlry4uoBMLJQcVCMkFh/os0gB4hgzI/MkhuEIYIBZcjGTzIzeGnB+0hB3ODiqt
LmrR2IiK56EkJ+UGfQ6Niankx+1M+OtSFXc9oWP4RacT8yaZABEBAAGJAh8EGAEC
AAkFAkzPhycCGwwACgkQDmn4CXEAOPW/3w//Wd3DfhQTXa1LoenNuuALnF9zIJQr
scLXc9HRO41x+0oCxi+ePDhCSiTWKWA4t74PsgLurdwXnQlcFU8rdSeWSalnO0gr
f0Rs+OHl4ICK3AWAgzZjFDh4J5Pyr7fVteGlUlKRgCCy/rGMwwSnCGLQYa9W1/ZE
KYZzLvFk0S/AoSv2iw6BxWUYVZVO7EzRzLoauLXQX6HyFyTpaH2soYbs1Xnp8t/u
w47PDnWXpYAaM0P1pD0T6krYp3M8YdNySGiXaZTkHBP2bj0PllGQHB/RjOyUrv95
USYZj60O430OyvjlIBDq+BBL/ZLEbMdUIFJJ6WO1F1nIr8MowpTNqeEBpEaqOY6A
lV0j9fZWX2qJKIxQayq5OjfWL6Y7juJUuDBBZUzPtKSmcwGtg3HsCL0SWoz8JT4p
hPOXy4Zk1NMn4F4oIwRrGrcB2lmBaQmoBWBP63g5rObADL0wsyabfYuVRTE7PoSg
iCEN7wONrFjXrpB+WWG36d8nrETyMKALr96YL+1T4VNs0sllYbrkowRe2ioMKj9r
t61UPOGhPekw0HA7pDS1n+nGMMU+efLKKCvcKFKq/TDdjK2jPg1JQ1Xq8O4fDwRf
ibUXyvYwswAqOqQ0nHH5QSj9pov3tsXhJWWDVIWKMFhk+U1Sans9txHEQKJl8L5k
KiqgPxg3Tk50+6aZAg0ETM+LbwEQAN5ZRgD4sZJ6ClxoWjlmMM1c9632/isnzXJM
unkZeCA3gjx++uhZexCdSD36aQZ7dAFSwvrJLHRrjsszl/uc1H7FaBmkZ7E8sjNI
/oulUtMhcLe0TYy6MRSdl8aBqll4slZNfcl7iYk4PCmk2eR4sdMPMEsQC2kcglDW
HDeJfG0RozFgJ46QVRCktRWTrrACQcvuHLizl0+4nMZ76yexNre7Rrgo6kE5Mapl
0UXog6qM9ngV5cVxh2/wDex5fmXvB9uNTusEQIFo8qaZPBtapAAeoIShyUWispqi
kos5t410OzlGfBHsDb0cq4SU44bAXJmkZv/95JECEy8mZjsbywU4MCDjAf1lC4d9
K7lcwHQS9rE2Xw1suXfD/VjQy9obpLLROk1DGLJC0aige0BbhMOa+mXgKVzSKcKv
PdmcUHcdm0dIy/LYZhC9Ja0uv37Sc9Ri55k3DU6DgdBu2dZgy7q9bBzLpqPIyTPs
XxUlczjhT6KxZYDeyghbwJYQ+miasY2VHeY9aZHYXXhDHIo2eEaut1y/9a7i4auA
aYnaADj/gmryBm6rb+r/MIMbfZ5htB4l6aoI/8BJygzq38LrWwUvzQ3p/N5+jA5N
uJWexAbG9hEc7nbbwINwp1b0P35eqSxhtr5wGdSNor5zScHazaPjPxHKP7WiATj8
a1p0MlEHABEBAAG0PEFudG9pbmUgTGV2eS1MYW1iZXJ0IChDT0RFIFNJR05JTkcg
S0VZKSA8YW50b2luZUBhcGFjaGUub3JnPokCKwQTAQIAFQIbAwIeAQIXgAUCTM+M
LAUVCgkIAgAKCRBe+tn+gqf7zcwkEAC3VkVY4TGXoj3CDnjCL9nwkxAyK+JagXSw
7g8FMjqWW7YAIU8TprZxtOJUcnSXioVtT8dhKBfaasu34EpMrUYEIPNp5BNzhxIf
f9hXVrcuOZ1k0nJRlSc4IKSsrognoCDm340ma8AOMARVkrz7tXdqdlDPWVjMvqn/
5/KReaIHQUNRqjypIIdM5mgaE41F1+uAyqLqcxvf4YQtu0NNGMizGZd37bH+5wMF
BT7S6CesAVPogcfnMdoMN1wO2yOzWKlg49U91DLUY3XHGOQnqVnTnVQ/xzLEj/vf
0PlLoY+3Yn9WEaonkMgco9un71xZ9s4DnR4WE+7QJYU2cgSPFB5DbAZ925qcNK/x
wOpKfRyBPN4zdjWE8Vjd25EcjZLsxgPiSlPpbyIJD6Ot61uoqekinNlAo44sleg8
rNAAYnajlD/1La+Q/grQnHcujOt/w/ya3LG/cTpz7wkUhxhnmMwmxrVlEFaM24Qk
PwbQE/Wuwdvm/hYX5o4F1b7DQ9WepNZ4ahb/ztbsIg2my7JLN4RPDWZ++EMt5K6w
G+34vn8RfuSu4GHT8TAoexDsAEWzFo67F+dAosrvfw+HBBm3hNEz4tRkKP4SPqmo
dE8IXUffF+VFeFH0NLsvIwfpdW90XNxnSlnrc8aVpdvuE3qXqjQICo10LEJuxZRa
hNggNMtUNIkCfQQQAQIAZwUCTNK+FSEcRGFuIFBvaXJpZXIgPHBvaXJpZXJAYXBh
Y2hlLm9yZz4gHERhbiBQb2lyaWVyIDxwb2lyaWVyQHBvYm94LmNvbT4dHERhbiBQ
b2lyaWVyIDxkYW5AcG9pcmllci51cz4ACgkQnPorAWKylj8WUxAAmxx/NESLJp0r
A+fW8dQ08jGZ1Xf1laNCEd1eb6FXr/Z2xsKPFq6okBiiw6cm2wiwp7DBBHxQatyb
AJNLAGVg8wpHUPgUguFOY1LyLRZ9i2SKKmWG0jzQ7svWELxssHFUnMW8dwtk3qAb
o8pKvOKf4ol3qoKfN3Xq8ZBXAGkQaTIOJzGSfau+dH5NbhMcqZEoKGOAcOsLiIHZ
Cnos9KqFMxqBlTMyJWO9YP8dY3mGHUWV0gsYfE32bHM3auaA2Ynzxtor/jMBATeq
hTWjRAD1H92/HZ9vRBKwpHHpjsF+21aL9TZv5D2OmFYeN7/G1tyRcLYLrhDa7tnx
r5S/ePdypMZ2IUaC0umMKrc8ZrAtK/2N4ZmnHKoScCJHjup66cLCVVFGXHb2hEM9
2fPFog2//s78Cw1DAxaNE4jjmR4QWXmQZUqA8AymIfgsi+nI9rWMWnpTCC6DGG9+
j7GbIpPdRscqoyAiPl2lBpZerLirTa1GMuDqqGuNiv6YmEvxNVleOlPYCCQr1vY5
ltJz34zckBNJAH/7woggqoyGiLa456ruDzU77qxUCy5ulFTOWsVtltojnlxgKBML
8f0uThQZN+0HydPb4uP3k5aLNL1ktiSo/XlIP2/AO69Bi4YZzERYsETm2zFLWx1P
MN+R0l/BAjRskTCX+H92fG5OkGjkmR+JAlwEEAECAEcFAkzS16tAHEpvc2VwaCBF
ZHdhcmQgQmVyZ21hcmsgKENPREUgU0lHTklORyBLRVkpIDxiZXJnbWFya0BhcGFj
aGUub3JnPgAKCRCw2ZG0fECHN8OVD/Y8+R4R9aNkuZJ76SCHOIhxjKtMhk44muAZ
FQwB+CG7HY4b/869+JdAOrwsOYr75h3vkz1vkU8FOr2LAu6PdiXDKpEs9wkPDGFx
Rg9yePaX2DbAh0Ch1ucR1FZvr3QqO+L0ri1lfUUl76n/QfZtHXfuoPgsYIjsbv6g
90mxHFJxxmowgX5gWKYaVm6OFN7xYiAC18Ia8LfReNIZO0XyaOq2/NoLuIVyguyi
C3RuVnvAk92/6YCPgZNiH1lN1kLmkoNvGpY6CFkCI9LKZ9xRCbs7Dbkoz7I+EYla
zfRf5mLjsrI+nVmFHvicvuw3ZtCCAImMdZ+Z53CHwd2N2v81lqnxUyCDPJf4Mxcw
Jq7Hf9hYZUBS9Ehj3nfCmJwOVUMrXYXurKinDAcyoYmlA2iqdzUdM3d9xFGjexsl
cUhZusggmOvBc3bK5BLZXUm009B5LYz4BGUAVsmN8vXekRgevszz5GcZBKElgRds
9DQaO4sbgrskq2TXHzBI7e9GiEcUyErZ8fdsbea5zrPoW2/x74Kq93VtQCuWPDOJ
Nq95l0J6bmiaVZuUTO5YIHFts7jphvA4gMf/4Lnzhzkcwftgi9OwyDBbpTyfdno+
hsYBrBFQP4L7DLaGewHt46Iggil7Y9oMO0Yo7JtCsRnDtZYxc4rveg8vRg2xIl4y
NJlDNzNciQIcBBABCgAGBQJM0p5uAAoJEJrilv0C6fZbqooQAOpWpMdzXdmDG2fe
BffHiY2sabhX7B+tBRw+SIvmGw+ZvWvy3Tp2xFy7+PgCJhs/wbjyI3tCyx+DPb5C
ybZpDjferuhbKA/PVgnJozUhYtwLFQ7bRyvlLq3ZSZZawVn2bbIHn1knjohz+0hB
90zVX6vXhjPNZwL8vzPa3jMMNPDbd4E7w0VB63sWTKXq/pTy5SFGfscunxOsDMbj
KcW1VtSszH68aywefZV9DbmjSDEgNRiqwtj+WxD3rp3fARBO+4o5yIsjWu1wGL+n
59atHZJp34dAJFgOTJ2Jtykyuh3G76k4XKLemgUsu4aWFAlNIWt/f41cT5WmQe4z
YG4yWLE/KWpIc5Jn2p3wlQpKqwl/+F3pkOpqPZmZkYjn4ORCMg1Q0eOzfiaheofv
T78N0j8020z1lf5ojmEtGHoOzwz076Z3TGP256a4F37ZzibM7KFBn4iwjVrgqfFa
62Q5WG+q2rdmpQ5B2eXAYNxg66DiMcfR3zHJeMz3UpOZcygIUZ63N6VK7+WgNPtO
swBmXUxa5L35+a616/vvPtCEBlvJtDQz22BIvp/RpYaJ1k5K58uy0hj0oXZlD3q7
BJSgPhgYOOqO79ZOwbgqGB9is5yegDXtXctV4FGuj601C+qtUHbRLmGio3XSMnmy
FCOJpZW41tJYo9uQz7dRHIzGsBpSiIAEEBECAEAFAkzTeLE5HEx1Y2lhbm8gUmVz
ZW5kZSAoQ29kZSBTaWduaW5nIEtleSkgPGxyZXNlbmRlQGFwYWNoZS5vcmc+AAoJ
EPOfGH3vtV3xs08AniczpMS0xOouROjBIHLC+RlBdMwAAJ0ZiOfPrr5+C9Glo317
omxwZ0obvbkCDQRMz4tvARAAoqAcqn4cTgkAEACgeJQJoPKYAAyZwISGNTgqnnSr
BtN91af3XoVybrnXvlzFc6CkyWQ5T44yMaSfM/ZCYMpFCLtzssTlk3R8ASd7aIQR
/ydoB5vaPZ424NjSfsNLiF1NR868R8iFPHphegw3P2UeFT8rw/arcdJ5lXQ/J66p
63t9BlggU4piIMl/JPrtVawVLelYMYy3zw/RdnmrvU1qrZBGno5QkRhRlOXqQBTv
FlWVZT0GtC+lNha/MqEqW5YkACVPYqpmYk2aoNH5+Gj/yBpWap1o8GsVZKZQUMx6
CPAT9GcTrOlFqFbFG1kL0iOQgOlggQ0Kba5LN1VXUl7ESsu7NYEXDqDdbjduVDMR
UsFrhTPUOf/kRNPjMPmGih0RP1s0woe3M4dsLaZEcAu88HHMCcaiOfBPAFU84upM
fEgh0BIcmTVwAaSftD5gzmZKY3YXfaS0cD6RaZBWuzecHNDLLEgzuhNbUtmtylx1
X57tep9Mh2tKDFrqBxlhg3M73+mGdE6zgsWhgOeAMATII8mzM90zLh4bg9RBxdp+
PnoJEbuZVdIX2bNJPt/u4LdAV/czozPjkZtZ60VSkEYyUnZ2dNKUOv5tujkY4dm1
V+R9uR25C4fLopnE/AN26+GYePrbBaghEUh7ugg7HlTEXPz2JsfvpjPIaao0V1+A
bEUAEQEAAYkCHwQYAQIACQUCTM+LbwIbDAAKCRBe+tn+gqf7zYEvEACoszB5B68Z
QrcOBSWvk4l0xWLNfZQIl0M5WoNEoNj6Vt1CzIXadRFxHu1m0gnDLW3brquRuxTe
acho1iqinNw0pP7yODNW5p5ftKdvFlB7NNemVxzNZn1Q4cSkbI7GdYFiU9WQf7lB
TQpzFhjJSbJEMHtQrYOqw1wGNPZThEfNXwFLwe+0RF25gEQwuTkRdnpKarBeZiax
8zkuOmTLWmrI5Dq0dsYi6YotuHaSa3cFjGo+gp2cj+mBljaW8BXAIjzNunjMKqkV
XNA+Eh3w8FIx7NYZfrbDz4II3naYLb3x3IEwb6g7sTnCexFyTcS2RMJOqPBG2Zh6
UI73B3AGkWDMsUyDMPVCVOEWUsT94tPBDZCrvdOpVu99OeMqESuaIuPELEbSIrsU
aDCyJDnIWVExk69szQl/4HOM+u9WBtSmG94WOCT7T+ypPcfFBPpUvxx6VriWKRQX
yKUlVCJVET4UpDHIwVUpIsmFmjxZfTlhe7pny8/a03/EnvGImuLYoxhfzP3VRapr
86fwCseMxAPW3gnl6zvGZrIM6ZS09tdyTIOiHUHMcXvWpyxdw+7EXHuncpEB5m0U
Ci8LBeDYqitVqqakgdKGAl8pfwaIJ9DsE5Sv/IHKFmieLa9PEh/2S/4hCD31atIK
3PimOFurhebU3wOU0wEkNb/3IYLk+MFQOA==
=1STU
-----END PGP PUBLIC KEY BLOCK-----
+282 -2
View File
@@ -1,15 +1,295 @@
Changes from Ant 1.8.1 TO current SVN version
=============================================
Changes from Ant 1.8.1 TO Ant 1.8.2
===================================
Changes that could break older environments:
-------------------------------------------
* Prior to Ant 1.8.0 the <copy> task and several other tasks would
overwrite read-only destination files. Starting with 1.8.0 they
would only do so under special circumstances. Ant 1.8.2 now
consistently won't replace a read-only file by default. The same is
true for a number of other tasks.
The <copy>, <move> and <echo> tasks now have a new force attribute
and <concat> has a new forceReadonly attribute that can be used to
make the task overwrite read-only destinations.
Bugzilla Report 49261.
* Removed ant-nodeps.jar; it is now merged into ant.jar.
* DOMElementWriter#encode used to employ special code before encoding
ampersands so that &#123; remained &#123; rather than being turned
into &amp;#123;. This is no longer the case, ampersands will now
be encoded unconditionally.
Also DOMElementWriter#encodeData will treat CDATA sections containing a
literal "]]>" sequence different now - it will split the CDATA
section between the second "]" and ">" and create two sections.
This affects <echoxml> task as well as the XML logger or JUnit
formatter where ampersands will now always get encoded.
In addition DOMElementWriter will now replace the characters \t, \r
and \n in attribute values by entity references.
Bugzilla Report 49404.
* The list elements returned by ProjectHelper#getExtensionStack are
now String arrays of length 3 rather than 2 in order to support the
onMissingExtensionPoint attribute.
Bugzilla Report 49473.
* When using <property file="..." prefix="..."/> properties defined
inside the same file will only get used in expansions if the ${}
reference uses the same prefix. This is different from Ant 1.8.1
but is the same behavior Ant 1.8.0 and earlier exhibited.
A new attribute prefixValues can be used to re-enable the behavior
of Ant 1.8.1.
Bugzilla Report 49373.
* The files and directories used by Git, Mercurial and Bazaar to
store their information are now excluded by the defaultexcludes.
Bugzilla Report 49624.
* The <junit> task no longer generates TestListener events - which
have been introduced in ant 1.7.0 - by default. The task has a new
attribute enableTestListenerEvents and a new "magic" property
ant.junit.enabletestlistenerevents has been added that can be used
to reinstate the old behavior.
Fixed bugs:
-----------
* hostinfo now prefers addresses with a hostname over addresses without
a hostname, provided the addresses have the same scope.
For local lookup, no IP address will be put in NAME / DOMAIN anymore.
For remote lookup, if a host name was provided and only an IP address is
found, the IP address will no longer overwrite the host name provided to the
task.
Bugzilla Report 49513
* mmap-based file copy problems under JDK 1.4 on Linux.
Bugzilla Report 49430.
* The Sun JVM tries to mmap the entire file during a copy.
For large files this is not feasible.
We now explicitly request to copy at most 16 MiB per request.
Bugzilla Report 49326.
* DemuxInputStream.read() should return unsigned values
Bugzilla Report 49279.
* The MIME mailer ignored the port parameter when using SSL.
Bugzilla Report 49267.
* <xslt> ignored the classpath when using the default TraX processor.
Bugzilla Report 49271.
* <checksum>'s totalproperty only worked reliably if the same file
name didn't occur inside more than one directory.
Bugzilla Report 36748.
* <ftp> could fail to download files from remote subdirectories under
certain circumstances.
Bugzilla Report 49296.
* <junit> will now produce better diagnostics when it fails to delete
a temporary file.
Bugzilla Report 49419.
* Ant would often scan directories even though there were known to
only hold excluded files when evaluating filesets. This never
resulted in wrong results but degraded performance of the scan
itself.
Bugzilla Report 49420.
* <javac> failed for long command lines on OS/2.
Bugzilla Report 49425.
* <junitreport> did not handle encodings well for stdout/stderr.
Bugzilla Report 49418.
* <junit> could issue a warning about multiple versions of Ant on the
CLASSPATH if two CLASSPATH entries differed in case on a
case-insensitive file system.
Bugzilla Report 49041.
* The <restrict> resource collection was checking every resource even if
we actually just want the first one, like in the example of use of
resourcelist in the documentation (getting the first available resource
from a mirror list).
* A race condition could lead to build failures if multiple <mkdir>
tasks were trying to create the same directory.
Bugzilla Report 49572.
* the toString() method of the Resources class - and thus any
${toString:} expansion of a reference to a <resources> element -
didn't iterate over its nested elements if it hadn't done so prior
to the toString invocation already.
Bugzilla Report 49588.
* <apply> in parallel mode didn't work together with a nested
<redirector> if maxparallel was <= 0 (the default) or no source
files matched.
Bugzilla Report 49594.
* <jar filesetmanifest="merge"> didn't work for manifests added via
<zipfileset>s that used the prefix or fullpath attributes.
Bugzilla Report 49605.
* <tempfile createfile="true"> would cause an error unless the prefix
attribute has been specified.
Bugzilla Report 49755.
* If forked, after finished <java> was still reading the input stream
for a bunch of characters, then stealing them from a following <input>.
Bugzilla Report 49119.
* Ant could be leaking threads for each forked process (started by
<exec>, <apply>, <java> or similar tasks) that didn't receive input
from a resource or string explicitly.
Bugzilla Report 49587.
* Project#setDefault threw an exception when null was passed in as
argument, even though the Javadoc says null is a valid value.
Bugzilla Report 49803.
* runant.py would swallow the first argument if CLASSPATH wasn't set.
Bugzilla Report 49963.
* <taskdef> failed to load resources from jar files contained in a
directory that has a "!" in its name.
Bugzilla Report 50007.
* ant.bat exit strategy improvements and issues
make the exit codes work in environments where 4NT or MKS are installed
Bugzilla Report 41039.
* <signjar> would fail if used via its Java API and the File passed
into the setJar method was not "normalized" (i.e. contained ".."
segments).
Bugzilla Report 50081.
* <delete> ignored <fileset>'s errorOnMissingDir attribute
Bugzilla Report 50124.
* <symlink> failed to close files when reading a list of symbolic
links from a properties file.
Bugzilla Report 50136.
* <parallel> could allow tasks to start executing even if a task
scheduled to run before them timed out.
Bugzilla Report 49527.
* If a <junit> batch with multiple tests times out Ant logs a message
about a test named Batch-With-Multiple-Tests since 1.8.0 but the
logic that determined the Java package of this pseudo-test has been
wrong.
Bugzilla Report 45227.
* <propertyfile> didn't preserve the original linefeed style when
updating a file.
Bugzilla Report 50049.
* <zip>'s whenEmpty behavior never consulted the non-fileset
resources so the task could fail even though resources have been
provided using non-fileset resource collections.
Bugzilla Issue 50115.
* ftp chmod could throw a NPE.
Bugzilla report 50217.
* The project help (-p option in the command line) will now print
the dependencies of the targets in debug mode (-d on the command
line)
Other changes:
--------------
* <concat>'s force attribute has been deprecated in favor of a new
overwrite attribute that is consistent with <copy>'s attribute
names.
* You can now specify a list of methods to run in a JUnit test case.
Bugzilla Report 34748.
* properties in files read because of the -propertyfile command line
option will now get resolved against other properties that are
defined before the project starts executing (those from the same or
earlier -propertfiles or defined via the -D option).
Bugzilla Report 18732.
* <pathelement>s can now contain wildcards in order to use wildcard
CLASSPATH entries introduced with Java6.
The wildcards are not expanded or even evaluated by Ant and will be
used literally. The resulting path may be unusable as a CLASSPATH
for Java versions prior to Java6 and likely doesn't mean anything
when used in any other way than a CLASSPATH for a forked Java VM.
Bugzilla Report 46842.
* A new attribute allows targets to deal with nonexistent extension
points, i.e. they can extend an extension-point if it has been
defined or silently work as plain targets if it hasn't. This is
useful for targets that get included/imported in different
scenarios where a given extension-point may or may not exist.
Bugzilla Report 49473.
* Ant now logs a warning message if it fails to change the file
modification time in for example when using <touch> or preserving
timestamps in various tasks.
Bugzilla Report 49485.
* ProjectHelpers can now be installed dynamically via the <projecthelper>
Ant task.
* <import> is now able to switch to the proper ProjectHelper to parse
the imported resource. This means that several kinds of different build
files can import each other.
* <copy tofile=""> now also works for non-filesystem resources.
Bugzilla Report 49756.
* The <linecontainsregexp> filter now supports a casesensitive
attribute.
* The <containsregexp> selector now supports casesensitive, multiline
and singleline attributes.
Bugzilla Report 49764.
* A new <cutdirsmapper> can be used like wget's --cut-dirs option to
strip leading directories from file names.
* <javah> now supports the GNU project's gcjh compiler.
Bugzilla Report 50149.
* <checksum> supports additional views of a file's path as elements
for a custom pattern.
Bugzilla Report 50114.
* JUnit XMLResultAggregator logs the stack trace of caught IO exceptions
in verbose runs.
Bugzilla Report 48836.
* StringUtils.parseHumanSizes() should turn parse failures into
BuildExceptions.
Bugzilla Report 48835.
* New task <bindtargets> to make a list of targets bound to some
specified extension point.
* Initial support for OpenJDK7 has been added.
* Ant now uses java.net.CookieStore rather than
java.util.ServiceLocator to detect whether the environment is a
Java 1.6 system. This means releases of gcj/gij at the time of
this release of Ant are detected as Java 1.5 and not 1.6.
Bugzilla Report 50256.
* It is now possible to write a compiler adapter for <javac> that
compiles sources with extensions other than .java (but that still
compile to .class files).
Bugzilla Report 48829.
* The performance of VectorSet#add(Object) has been improved which
should also benefit any operation that scans directories in Ant.
Bugzilla Report 50200.
Changes from Ant 1.8.0 TO Ant 1.8.1
===================================
BIN
View File
Binary file not shown.
+101 -7
View File
@@ -60,6 +60,10 @@
<!-- load in our properties table -->
<property file="${lib.dir}/libraries.properties"/>
<!-- Temporary cache for working files -->
<property name="temp.dir" location="${user.home}/.ant/tempcache" />
<property name="keep.temp.dir" value="true" />
<import file="get-m2.xml" />
<target name="pick-dest">
@@ -99,9 +103,10 @@ Set -Ddest=LOCATION on the command line
<macrodef name="f2">
<attribute name="project" />
<attribute name="archive" default="@{project}"/>
<attribute name="repository" default="${m2.repo}"/>
<sequential>
<fail>
Unknown archive @{archive} -no property @{archive}.version defined.
Unknown archive @{archive} -no property @{archive}.version defined in ${lib.dir}/libraries.properties.
<condition>
<not>
<isset property="@{archive}.version"/>
@@ -112,6 +117,7 @@ Set -Ddest=LOCATION on the command line
<dependency groupID="@{project}"
artifactID="@{archive}"
version="${@{archive}.version}"/>
<remoteRepository url="@{repository}" />
</artifact:dependencies>
<!-- now we are left with the problem of getting the files
into our directory -->
@@ -123,11 +129,71 @@ Set -Ddest=LOCATION on the command line
</macrodef>
</target>
<target name="nonm2-macros" depends="pick-dest">
<macrodef name="get-ftp-file">
<attribute name="host" />
<attribute name="port" default="21"/>
<attribute name="remotedir" />
<attribute name="filename" />
<attribute name="localdir" default="${dest.dir}" />
<attribute name="user" default="anonymous"/>
<attribute name="pw" default="anonymous"/>
<sequential>
<ftp server="@{host}" port="@{port}" userid="@{user}" password="@{pw}" passive="true"
remotedir="@{remotedir}" action="get" depends="true" preserveLastModified="true"
skipFailedTransfers="true">
<fileset dir="@{localdir}">
<include name="@{filename}" />
</fileset>
</ftp>
</sequential>
</macrodef>
</target>
<!-- any init stuff -->
<target name="init" depends="macros" />
<target name="init-no-m2" depends="nonm2-macros" />
<target name="init-cache">
<available property="temp.cache.already.exists" file="${temp.dir}" type="dir" />
<condition property="user.wants.temp.cache">
<and>
<isset property="keep.temp.dir" />
<not>
<or>
<equals arg1="${keep.temp.dir}" arg2="false" casesensitive="false" />
<equals arg1="${keep.temp.dir}" arg2="no" casesensitive="false" />
<equals arg1="${keep.temp.dir}" arg2="off" casesensitive="false" />
</or>
</not>
</and>
</condition>
<condition property="delete.temp.cache">
<and>
<not>
<isset property="temp.cache.already.exists" />
</not>
<not>
<isset property="user.wants.temp.cache" />
</not>
</and>
</condition>
</target>
<target name="-setup-temp-cache" depends="init-cache" unless="temp.cache.already.exists"
description="Setup temporary cache for downloaded files">
<mkdir dir="${temp.dir}" />
</target>
<target name="-cleanup-temp-cache" depends="init-cache" if="delete.temp.cache"
description="Gets rid of the temporary cache directory">
<delete dir="${temp.dir}" />
</target>
<target name="diag" depends="init">
<echoproperties />
@@ -153,16 +219,12 @@ Set -Ddest=LOCATION on the command line
<f2 project="xml-resolver" />
</target>
<!--
This is not used as
we like to get the more recent artifacts than are in the repo at the time of writing (2006-12-21)
-->
<target name="networking"
description="load networking libraries (commons-net; jsch)"
depends="init">
<f2 project="commons-net" />
<f2 project="com.jcraft" archive="jsch"/>
<available property="have.commons.net" classname="org.apache.commons.net.ftp.FTPClientConfig"/>
</target>
<target name="regexp"
@@ -242,8 +304,40 @@ Set -Ddest=LOCATION on the command line
<f2 project="javax.servlet" archive="servlet-api"/>
</target>
<target name="jai" depends="init"
description="load java advanced imaging">
<f2 project="javax.media" archive="jai-core" repository="http://repository.jboss.org/maven2"/>
<f2 project="com.sun.media" archive="jai-codec" repository="http://repository.jboss.org/maven2"/>
</target>
<target name="netrexx" depends="init-no-m2,-setup-temp-cache,networking,-fetch-netrexx,-fetch-netrexx-no-commons-net,-cleanup-temp-cache"
description="load NetRexx compiler" />
<target name="-fetch-netrexx" depends="-setup-temp-cache"
description="FTPs NetRexx compiler from IBM site" if="have.commons.net">
<get-ftp-file host="ftp.software.ibm.com" remotedir="/software/awdtools/netrexx"
filename="NetRexx.zip" localdir="${temp.dir}" />
<copy todir="${dest.dir}" flatten="true">
<zipfileset src="${temp.dir}/NetRexx.zip">
<include name="NetRexx\lib\NetRexxC.jar" />
<include name="NetRexx\browse\license.txt" />
</zipfileset>
</copy>
</target>
<target name="-fetch-netrexx-no-commons-net" depends="-setup-temp-cache"
description="FTPs NetRexx compiler from IBM site" unless="have.commons.net">
<get src="ftp://ftp.software.ibm.com/software/awdtools/netrexx/NetRexx.zip" dest="${temp.dir}/NetRexx.zip" skipexisting="true"/>
<copy todir="${dest.dir}" flatten="true">
<zipfileset src="${temp.dir}/NetRexx.zip">
<include name="NetRexx\lib\NetRexxC.jar" />
<include name="NetRexx\browse\license.txt" />
</zipfileset>
</copy>
</target>
<target name="all"
description="load all the libraries (except jython)"
depends="logging,junit,xml,networking,regexp,antlr,bcel,jdepend,bsf,debugging,script,javamail,jspc" />
depends="logging,junit,xml,networking,regexp,antlr,bcel,jdepend,bsf,debugging,script,javamail,jspc,jai,netrexx" />
</project>
Binary file not shown.
+4 -3
View File
@@ -27,19 +27,20 @@
<groupId>org.apache.ant</groupId>
<artifactId>ant-parent</artifactId>
<relativePath>../pom.xml</relativePath>
<version>1.8.1</version>
<version>1.8.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.ant</groupId>
<artifactId>ant-antlr</artifactId>
<version>1.8.1</version>
<version>1.8.2</version>
<name>Apache Ant + ANTLR</name>
<description>antlr specific task.
The implementation forks a java process, therefore the antlr jar file is only needed at runtime</description>
<dependencies>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
<version>1.8.1</version>
<version>1.8.2</version>
<optional>true</optional>
<scope>compile</scope>
</dependency>
Binary file not shown.
+6 -5
View File
@@ -27,17 +27,18 @@
<groupId>org.apache.ant</groupId>
<artifactId>ant-parent</artifactId>
<relativePath>../pom.xml</relativePath>
<version>1.8.1</version>
<version>1.8.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.ant</groupId>
<artifactId>ant-apache-bcel</artifactId>
<version>1.8.1</version>
<version>1.8.2</version>
<name>Apache Ant + BCEL</name>
<dependencies>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
<version>1.8.1</version>
<version>1.8.2</version>
<scope>compile</scope>
</dependency>
<dependency>
@@ -56,8 +57,8 @@
<source>1.4</source>
<target>1.4</target>
<includes>
<include>org/apache/tools/ant/tfilters/util/JavaClassHelper*</include>
<include>org/apache/tools/ant/tutil/depend/bcel/*</include>
<include>org/apache/tools/ant/filters/util/JavaClassHelper*</include>
<include>org/apache/tools/ant/util/depend/bcel/*</include>
</includes>
</configuration>
</plugin>
Binary file not shown.
+4 -3
View File
@@ -27,17 +27,18 @@
<groupId>org.apache.ant</groupId>
<artifactId>ant-parent</artifactId>
<relativePath>../pom.xml</relativePath>
<version>1.8.1</version>
<version>1.8.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.ant</groupId>
<artifactId>ant-apache-bsf</artifactId>
<version>1.8.1</version>
<version>1.8.2</version>
<name>Apache Ant + BSF</name>
<dependencies>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
<version>1.8.1</version>
<version>1.8.2</version>
<scope>compile</scope>
</dependency>
<dependency>

Some files were not shown because too many files have changed in this diff Show More