Merge branch 'master' of git.labs.intellij.net:jet
This commit is contained in:
+418
@@ -0,0 +1,418 @@
|
|||||||
|
<component name="InspectionProjectProfileManager">
|
||||||
|
<profile version="1.0" is_locked="false">
|
||||||
|
<option name="myName" value="idea.default" />
|
||||||
|
<option name="myLocal" value="false" />
|
||||||
|
<inspection_tool class="AbstractMethodCallInConstructor" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="ArchaicSystemPropertyAccess" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="AssignmentToForLoopParameter" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<option name="m_checkForeachParameters" value="false" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="AssignmentToStaticFieldFromInstanceMethod" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<scope name="IDEA Test Sources" level="WARNING" enabled="false" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="AssignmentUsedAsCondition" enabled="false" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="AutoBoxing" enabled="true" level="WARNING" enabled_by_default="false">
|
||||||
|
<scope name="runtime.classes" level="WARNING" enabled="true">
|
||||||
|
<option name="ignoreAddedToCollection" value="false" />
|
||||||
|
</scope>
|
||||||
|
<option name="ignoreAddedToCollection" value="false" />
|
||||||
|
</inspection_tool>
|
||||||
|
<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="BooleanMethodIsAlwaysInverted" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||||
|
<inspection_tool class="BusyWait" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="CStyleArrayDeclaration" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<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="ChainedEquality" enabled="false" level="WARNING" enabled_by_default="true" />
|
||||||
|
<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="ComparisonOfShortAndChar" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="ConditionalExpressionWithIdenticalBranches" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<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="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="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="ContinueOrBreakFromFinallyBlock" 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="DoubleCheckedLocking" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<option name="ignoreOnVolatileVariables" value="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="DuplicateCondition" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<option name="ignoreMethodCalls" value="false" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="EmptySynchronizedStatement" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="EnumSwitchStatementWhichMissesCases" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<option name="ignoreSwitchStatementsWithDefault" value="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="ExceptionNameDoesntEndWithException" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="FieldAccessedSynchronizedAndUnsynchronized" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<option name="countGettersAndSetters" value="false" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="FieldMayBeStatic" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="Finalize" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<option name="ignoreTrivialFinalizers" value="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="FinalizeNotProtected" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="ForLoopReplaceableByWhile" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<option name="m_ignoreLoopsWithoutConditions" value="false" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="ForLoopThatDoesntUseLoopVariable" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="HtmlUnknownTag" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<option name="myValues">
|
||||||
|
<value>
|
||||||
|
<list size="5">
|
||||||
|
<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" />
|
||||||
|
<item index="4" class="java.lang.String" itemvalue="javascript" />
|
||||||
|
</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="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="JUnitTestClassNamingConvention" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<option name="m_regex" value="[A-Z][A-Za-z0-9]*Test" />
|
||||||
|
<option name="m_minLength" value="8" />
|
||||||
|
<option name="m_maxLength" value="64" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="JavaDoc" enabled="true" level="WARNING" enabled_by_default="false">
|
||||||
|
<scope name="IDEA Test Sources" level="WARNING" enabled="false">
|
||||||
|
<option name="TOP_LEVEL_CLASS_OPTIONS">
|
||||||
|
<value>
|
||||||
|
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
||||||
|
<option name="REQUIRED_TAGS" value="" />
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
<option name="INNER_CLASS_OPTIONS">
|
||||||
|
<value>
|
||||||
|
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
||||||
|
<option name="REQUIRED_TAGS" value="" />
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
<option name="METHOD_OPTIONS">
|
||||||
|
<value>
|
||||||
|
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
||||||
|
<option name="REQUIRED_TAGS" value="@return@param@throws or @exception" />
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
<option name="FIELD_OPTIONS">
|
||||||
|
<value>
|
||||||
|
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
||||||
|
<option name="REQUIRED_TAGS" value="" />
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
<option name="IGNORE_DEPRECATED" value="false" />
|
||||||
|
<option name="IGNORE_JAVADOC_PERIOD" value="true" />
|
||||||
|
<option name="IGNORE_DUPLICATED_THROWS" value="false" />
|
||||||
|
<option name="IGNORE_POINT_TO_ITSELF" value="false" />
|
||||||
|
<option name="myAdditionalJavadocTags" value="" />
|
||||||
|
</scope>
|
||||||
|
<scope name="idea openapi" level="WARNING" enabled="true">
|
||||||
|
<option name="TOP_LEVEL_CLASS_OPTIONS">
|
||||||
|
<value>
|
||||||
|
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
||||||
|
<option name="REQUIRED_TAGS" value="" />
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
<option name="INNER_CLASS_OPTIONS">
|
||||||
|
<value>
|
||||||
|
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
||||||
|
<option name="REQUIRED_TAGS" value="" />
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
<option name="METHOD_OPTIONS">
|
||||||
|
<value>
|
||||||
|
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
||||||
|
<option name="REQUIRED_TAGS" value="@return@param@throws or @exception" />
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
<option name="FIELD_OPTIONS">
|
||||||
|
<value>
|
||||||
|
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
||||||
|
<option name="REQUIRED_TAGS" value="" />
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
<option name="IGNORE_DEPRECATED" value="true" />
|
||||||
|
<option name="IGNORE_JAVADOC_PERIOD" value="true" />
|
||||||
|
<option name="IGNORE_DUPLICATED_THROWS" value="false" />
|
||||||
|
<option name="IGNORE_POINT_TO_ITSELF" value="false" />
|
||||||
|
<option name="myAdditionalJavadocTags" value="" />
|
||||||
|
</scope>
|
||||||
|
<scope name="runtime.classes" level="WARNING" enabled="true">
|
||||||
|
<option name="TOP_LEVEL_CLASS_OPTIONS">
|
||||||
|
<value>
|
||||||
|
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
||||||
|
<option name="REQUIRED_TAGS" value="" />
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
<option name="INNER_CLASS_OPTIONS">
|
||||||
|
<value>
|
||||||
|
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
||||||
|
<option name="REQUIRED_TAGS" value="" />
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
<option name="METHOD_OPTIONS">
|
||||||
|
<value>
|
||||||
|
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
||||||
|
<option name="REQUIRED_TAGS" value="@return@param@throws or @exception" />
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
<option name="FIELD_OPTIONS">
|
||||||
|
<value>
|
||||||
|
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
||||||
|
<option name="REQUIRED_TAGS" value="" />
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
<option name="IGNORE_DEPRECATED" value="false" />
|
||||||
|
<option name="IGNORE_JAVADOC_PERIOD" value="true" />
|
||||||
|
<option name="IGNORE_DUPLICATED_THROWS" value="false" />
|
||||||
|
<option name="IGNORE_POINT_TO_ITSELF" value="false" />
|
||||||
|
<option name="myAdditionalJavadocTags" value="" />
|
||||||
|
</scope>
|
||||||
|
<option name="TOP_LEVEL_CLASS_OPTIONS">
|
||||||
|
<value>
|
||||||
|
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
||||||
|
<option name="REQUIRED_TAGS" value="" />
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
<option name="INNER_CLASS_OPTIONS">
|
||||||
|
<value>
|
||||||
|
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
||||||
|
<option name="REQUIRED_TAGS" value="" />
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
<option name="METHOD_OPTIONS">
|
||||||
|
<value>
|
||||||
|
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
||||||
|
<option name="REQUIRED_TAGS" value="@return@param@throws or @exception" />
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
<option name="FIELD_OPTIONS">
|
||||||
|
<value>
|
||||||
|
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
||||||
|
<option name="REQUIRED_TAGS" value="" />
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
<option name="IGNORE_DEPRECATED" value="false" />
|
||||||
|
<option name="IGNORE_JAVADOC_PERIOD" value="true" />
|
||||||
|
<option name="IGNORE_DUPLICATED_THROWS" value="false" />
|
||||||
|
<option name="IGNORE_POINT_TO_ITSELF" value="false" />
|
||||||
|
<option name="myAdditionalJavadocTags" value="" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="JavadocReference" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<scope name="IDEA Test Sources" level="ERROR" enabled="false" />
|
||||||
|
<scope name="idea openapi" level="WARNING" enabled="true" />
|
||||||
|
<scope name="runtime.classes" level="ERROR" enabled="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="MethodMayBeStatic" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<option name="m_onlyPrivateOrFinal" value="false" />
|
||||||
|
<option name="m_ignoreEmptyMethods" value="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="MethodNamesDifferOnlyByCase" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<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="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="MultipleDeclaration" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<option name="ignoreForLoopDeclarations" value="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
<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="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" />
|
||||||
|
</scope>
|
||||||
|
<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="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="PointlessArithmeticExpression" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<option name="m_ignoreExpressionsContainingConstants" value="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
<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="PyCompatibilityInspection" enabled="true" level="ERROR" enabled_by_default="true">
|
||||||
|
<option name="fromVersion" value="2.4" />
|
||||||
|
<option name="toVersion" value="3.1" />
|
||||||
|
</inspection_tool>
|
||||||
|
<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="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="" />
|
||||||
|
<constraint name="Parameter" minCount="0" maxCount="2147483647" within="" contains="" />
|
||||||
|
<constraint name="__context__" within="" contains="" />
|
||||||
|
<constraint name="runnable" within="" contains="" />
|
||||||
|
</searchConfiguration>
|
||||||
|
<replaceConfiguration name="DirectCallOfDispose" text="$Instance$.dispose()" recursive="false" caseInsensitive="false" type="JAVA" reformatAccordingToStyle="true" shortenFQN="true" replacement="Disposer.dispose($Instance$)">
|
||||||
|
<constraint name="Instance" regexp="super" nameOfExprType="Disposable" withinHierarchy="true" exprTypeWithinHierarchy="true" minCount="0" negateName="true" within="" contains="" />
|
||||||
|
<constraint name="MethodCall" target="true" within="" contains="" />
|
||||||
|
<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>
|
||||||
|
<replaceConfiguration name="File.createTempFile" text="java.io.File.createTempFile($prefix$, $suffix$)" recursive="false" caseInsensitive="true" type="JAVA" reformatAccordingToStyle="true" shortenFQN="true" replacement="com.intellij.openapi.util.io.FileUtil.createTempFile($prefix$, $suffix$)">
|
||||||
|
<constraint name="prefix" within="" contains="" />
|
||||||
|
<constraint name="suffix" within="" contains="" />
|
||||||
|
</replaceConfiguration>
|
||||||
|
<replaceConfiguration name="File.createTempFile(dir)" text="java.io.File.createTempFile($prefix$, $suffix$, $dir$)" recursive="false" caseInsensitive="true" type="JAVA" reformatAccordingToStyle="true" shortenFQN="true" replacement="com.intellij.openapi.util.io.FileUtil.createTempFile($dir$, $prefix$, $suffix$, true)">
|
||||||
|
<constraint name="prefix" within="" contains="" />
|
||||||
|
<constraint name="suffix" within="" contains="" />
|
||||||
|
<constraint name="dir" within="" contains="" />
|
||||||
|
</replaceConfiguration>
|
||||||
|
<searchConfiguration name="Use RecursionManager?" text="class $Class$ { ThreadLocal<$FieldType$> $FieldName$ = $Init$; }" recursive="false" caseInsensitive="false" type="JAVA">
|
||||||
|
<constraint name="Class" script="""" within="" contains="" />
|
||||||
|
<constraint name="FieldType" script="""" regexp="Collection" withinHierarchy="true" maxCount="2147483647" target="true" wholeWordsOnly="true" within="" contains="" />
|
||||||
|
<constraint name="FieldName" script="""" maxCount="2147483647" within="" contains="" />
|
||||||
|
<constraint name="Init" script="""" minCount="0" maxCount="2147483647" within="" contains="" />
|
||||||
|
<constraint name="__context__" script="""" within="" contains="" />
|
||||||
|
</searchConfiguration>
|
||||||
|
</inspection_tool>
|
||||||
|
<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="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="SocketResource" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<option name="insideTryAllowed" value="false" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="StaticCallOnSubclass" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="StaticFieldReferenceOnSubclass" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<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="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">
|
||||||
|
<scope name="IDEA Test Sources" level="WARNING" enabled="false" />
|
||||||
|
</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="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="TestOnlyProblems" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="TextLabelInSwitchStatement" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<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="ThrowablePrintStackTrace" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<scope name="IDEA Test Sources" level="WARNING" enabled="false" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="TrivialIf" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||||
|
<inspection_tool class="TrivialStringConcatenation" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="UndeclaredTests" enabled="true" level="WARNING" enabled_by_default="false">
|
||||||
|
<scope name="Tests" level="WARNING" enabled="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
<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" />
|
||||||
|
<option name="m_ignoreStaticMethodCalls" value="false" />
|
||||||
|
<option name="m_ignoreStaticAccessFromStaticContext" value="false" />
|
||||||
|
</scope>
|
||||||
|
<option name="m_ignoreStaticFieldAccesses" value="false" />
|
||||||
|
<option name="m_ignoreStaticMethodCalls" value="false" />
|
||||||
|
<option name="m_ignoreStaticAccessFromStaticContext" value="false" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="UnnecessaryBoxing" 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" />
|
||||||
|
</scope>
|
||||||
|
<option name="m_ignoreJavadoc" value="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="UnnecessaryInterfaceModifier" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="UnnecessaryLabelOnBreakStatement" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||||
|
<inspection_tool class="UnnecessaryLabelOnContinueStatement" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||||
|
<inspection_tool class="UnnecessaryQualifierForThis" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="UnnecessaryUnboxing" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||||
|
<inspection_tool class="UseOfPropertiesAsHashtable" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<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="VolatileLongOrDoubleField" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<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" />
|
||||||
|
<inspection_tool class="WeakerAccess" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<option name="SUGGEST_PACKAGE_LOCAL_FOR_MEMBERS" value="false" />
|
||||||
|
<option name="SUGGEST_PACKAGE_LOCAL_FOR_TOP_CLASSES" value="false" />
|
||||||
|
<option name="SUGGEST_PRIVATE_FOR_INNERS" value="false" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="WhileLoopSpinsOnField" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<option name="ignoreNonEmtpyLoops" value="false" />
|
||||||
|
</inspection_tool>
|
||||||
|
</profile>
|
||||||
|
</component>
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
<component name="InspectionProjectProfileManager">
|
||||||
|
<settings>
|
||||||
|
<option name="PROJECT_PROFILE" value="idea.default" />
|
||||||
|
<option name="USE_PROJECT_PROFILE" value="true" />
|
||||||
|
<version value="1.0" />
|
||||||
|
</settings>
|
||||||
|
</component>
|
||||||
Generated
+5
@@ -0,0 +1,5 @@
|
|||||||
|
<component name="DependencyValidationManager">
|
||||||
|
<state>
|
||||||
|
<option name="SKIP_IMPORT_STATEMENTS" value="false" />
|
||||||
|
</state>
|
||||||
|
</component>
|
||||||
@@ -3,11 +3,12 @@
|
|||||||
*/
|
*/
|
||||||
package org.jetbrains.jet.codegen;
|
package org.jetbrains.jet.codegen;
|
||||||
|
|
||||||
import com.intellij.openapi.project.Project;
|
|
||||||
import com.intellij.openapi.util.Pair;
|
import com.intellij.openapi.util.Pair;
|
||||||
import com.intellij.psi.util.PsiTreeUtil;
|
import com.intellij.psi.util.PsiTreeUtil;
|
||||||
|
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
|
||||||
import org.jetbrains.jet.lang.descriptors.FunctionDescriptor;
|
import org.jetbrains.jet.lang.descriptors.FunctionDescriptor;
|
||||||
import org.jetbrains.jet.lang.descriptors.ValueParameterDescriptor;
|
import org.jetbrains.jet.lang.descriptors.ValueParameterDescriptor;
|
||||||
|
import org.jetbrains.jet.lang.descriptors.VariableDescriptor;
|
||||||
import org.jetbrains.jet.lang.psi.*;
|
import org.jetbrains.jet.lang.psi.*;
|
||||||
import org.jetbrains.jet.lang.types.JetType;
|
import org.jetbrains.jet.lang.types.JetType;
|
||||||
import org.objectweb.asm.ClassVisitor;
|
import org.objectweb.asm.ClassVisitor;
|
||||||
@@ -19,13 +20,21 @@ import org.objectweb.asm.commons.Method;
|
|||||||
import org.objectweb.asm.signature.SignatureWriter;
|
import org.objectweb.asm.signature.SignatureWriter;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public class ClosureCodegen {
|
public class ClosureCodegen {
|
||||||
private final GenerationState state;
|
private final GenerationState state;
|
||||||
|
private final ExpressionCodegen context;
|
||||||
|
private ClassVisitor cv = null;
|
||||||
|
private String name = null;
|
||||||
|
|
||||||
public ClosureCodegen(GenerationState state) {
|
private Map<DeclarationDescriptor, EnclosedValueDescriptor> closure = new LinkedHashMap<DeclarationDescriptor, EnclosedValueDescriptor>();
|
||||||
|
|
||||||
|
public ClosureCodegen(GenerationState state, ExpressionCodegen context) {
|
||||||
this.state = state;
|
this.state = state;
|
||||||
|
this.context = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Method erasedInvokeSignature(FunctionDescriptor fd) {
|
public static Method erasedInvokeSignature(FunctionDescriptor fd) {
|
||||||
@@ -44,6 +53,31 @@ public class ClosureCodegen {
|
|||||||
return state.getTypeMapper().mapSignature("invoke", fd);
|
return state.getTypeMapper().mapSignature("invoke", fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public StackValue lookupInContext(DeclarationDescriptor d) {
|
||||||
|
if (d instanceof VariableDescriptor) {
|
||||||
|
VariableDescriptor vd = (VariableDescriptor) d;
|
||||||
|
|
||||||
|
EnclosedValueDescriptor answer = closure.get(vd);
|
||||||
|
if (answer != null) return answer.getInnerValue();
|
||||||
|
|
||||||
|
final int idx = context.lookupLocal(vd);
|
||||||
|
if (idx < 0) return null;
|
||||||
|
|
||||||
|
final Type type = state.getTypeMapper().mapType(vd.getOutType());
|
||||||
|
|
||||||
|
StackValue outerValue = StackValue.local(idx, type);
|
||||||
|
final String fieldName = "$" + (closure.size() + 1);
|
||||||
|
StackValue innerValue = StackValue.field(type, name, fieldName, false);
|
||||||
|
cv.visitField(Opcodes.ACC_PUBLIC, fieldName, type.getDescriptor(), null, null);
|
||||||
|
answer = new EnclosedValueDescriptor(d, innerValue, outerValue);
|
||||||
|
closure.put(d, answer);
|
||||||
|
|
||||||
|
return innerValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public GeneratedClosureDescriptor gen(JetFunctionLiteralExpression fun) {
|
public GeneratedClosureDescriptor gen(JetFunctionLiteralExpression fun) {
|
||||||
JetNamedDeclaration container = PsiTreeUtil.getParentOfType(fun, JetNamespace.class, JetClass.class, JetObjectDeclaration.class);
|
JetNamedDeclaration container = PsiTreeUtil.getParentOfType(fun, JetNamespace.class, JetClass.class, JetObjectDeclaration.class);
|
||||||
|
|
||||||
@@ -58,8 +92,8 @@ public class ClosureCodegen {
|
|||||||
|
|
||||||
final FunctionDescriptor funDescriptor = (FunctionDescriptor) state.getBindingContext().getDeclarationDescriptor(fun);
|
final FunctionDescriptor funDescriptor = (FunctionDescriptor) state.getBindingContext().getDeclarationDescriptor(fun);
|
||||||
|
|
||||||
final ClassVisitor cv = nameAndVisitor.getSecond();
|
cv = nameAndVisitor.getSecond();
|
||||||
final String name = nameAndVisitor.getFirst();
|
name = nameAndVisitor.getFirst();
|
||||||
|
|
||||||
SignatureWriter signatureWriter = new SignatureWriter();
|
SignatureWriter signatureWriter = new SignatureWriter();
|
||||||
|
|
||||||
@@ -79,19 +113,25 @@ public class ClosureCodegen {
|
|||||||
null,
|
null,
|
||||||
funClass,
|
funClass,
|
||||||
new String[0]
|
new String[0]
|
||||||
);
|
);
|
||||||
|
|
||||||
final Method constructor = generateConstructor(cv, funClass);
|
|
||||||
|
|
||||||
generateBridge(name, funDescriptor, cv);
|
generateBridge(name, funDescriptor, cv);
|
||||||
generateBody(name, funDescriptor, cv, container.getProject(), fun.getFunctionLiteral().getBodyExpression().getStatements());
|
generateBody(funDescriptor, cv, fun.getFunctionLiteral().getBodyExpression().getStatements());
|
||||||
|
|
||||||
|
final Method constructor = generateConstructor(funClass);
|
||||||
|
|
||||||
cv.visitEnd();
|
cv.visitEnd();
|
||||||
|
|
||||||
return new GeneratedClosureDescriptor(name, constructor);
|
final GeneratedClosureDescriptor answer = new GeneratedClosureDescriptor(name, constructor);
|
||||||
|
for (DeclarationDescriptor descriptor : closure.keySet()) {
|
||||||
|
final EnclosedValueDescriptor valueDescriptor = closure.get(descriptor);
|
||||||
|
answer.addArg(valueDescriptor.getOuterValue());
|
||||||
|
}
|
||||||
|
return answer;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void generateBody(String className, FunctionDescriptor funDescriptor, ClassVisitor cv, Project project, List<JetElement> body) {
|
private void generateBody(FunctionDescriptor funDescriptor, ClassVisitor cv, List<JetElement> body) {
|
||||||
FunctionCodegen fc = new FunctionCodegen(null, cv, state);
|
FunctionCodegen fc = new FunctionCodegen(null, cv, state);
|
||||||
fc.generatedMethod(body, OwnerKind.IMPLEMENTATION, invokeSignature(funDescriptor), funDescriptor.getReceiverType(), funDescriptor.getUnsubstitutedValueParameters(), null);
|
fc.generatedMethod(body, OwnerKind.IMPLEMENTATION, invokeSignature(funDescriptor), funDescriptor.getReceiverType(), funDescriptor.getUnsubstitutedValueParameters(), null);
|
||||||
}
|
}
|
||||||
@@ -131,8 +171,14 @@ public class ClosureCodegen {
|
|||||||
mv.visitEnd();
|
mv.visitEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
private Method generateConstructor(ClassVisitor cv, String funClass) {
|
private Method generateConstructor(String funClass) {
|
||||||
final Method constructor = new Method("<init>", Type.VOID_TYPE, new Type[0]); // TODO:
|
Type[] argTypes = new Type[closure.size()];
|
||||||
|
int i = 0;
|
||||||
|
for (DeclarationDescriptor descriptor : closure.keySet()) {
|
||||||
|
argTypes[i++] = state.getTypeMapper().mapType(((VariableDescriptor) descriptor).getOutType());
|
||||||
|
}
|
||||||
|
|
||||||
|
final Method constructor = new Method("<init>", Type.VOID_TYPE, argTypes);
|
||||||
final MethodVisitor mv = cv.visitMethod(Opcodes.ACC_PUBLIC, "<init>", constructor.getDescriptor(), null, new String[0]);
|
final MethodVisitor mv = cv.visitMethod(Opcodes.ACC_PUBLIC, "<init>", constructor.getDescriptor(), null, new String[0]);
|
||||||
mv.visitCode();
|
mv.visitCode();
|
||||||
InstructionAdapter iv = new InstructionAdapter(mv);
|
InstructionAdapter iv = new InstructionAdapter(mv);
|
||||||
@@ -140,8 +186,14 @@ public class ClosureCodegen {
|
|||||||
iv.load(0, Type.getObjectType(funClass));
|
iv.load(0, Type.getObjectType(funClass));
|
||||||
iv.invokespecial(funClass, "<init>", "()V");
|
iv.invokespecial(funClass, "<init>", "()V");
|
||||||
|
|
||||||
iv.visitInsn(Opcodes.RETURN);
|
for (int j = 0; j < argTypes.length; j++) {
|
||||||
|
Type type = argTypes[j];
|
||||||
|
StackValue.local(0, JetTypeMapper.TYPE_OBJECT).put(JetTypeMapper.TYPE_OBJECT, iv);
|
||||||
|
StackValue.local(j + 1, type).put(type, iv);
|
||||||
|
StackValue.field(type, name, "$" + (j + 1), false).store(iv);
|
||||||
|
}
|
||||||
|
|
||||||
|
iv.visitInsn(Opcodes.RETURN);
|
||||||
|
|
||||||
mv.visitMaxs(0, 0);
|
mv.visitMaxs(0, 0);
|
||||||
mv.visitEnd();
|
mv.visitEnd();
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
/*
|
||||||
|
* @author max
|
||||||
|
*/
|
||||||
|
package org.jetbrains.jet.codegen;
|
||||||
|
|
||||||
|
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
|
||||||
|
|
||||||
|
public class EnclosedValueDescriptor {
|
||||||
|
private final DeclarationDescriptor descriptor;
|
||||||
|
private final StackValue innerValue;
|
||||||
|
private final StackValue outerValue;
|
||||||
|
|
||||||
|
public EnclosedValueDescriptor(DeclarationDescriptor descriptor, StackValue innerValue, StackValue outerValue) {
|
||||||
|
this.descriptor = descriptor;
|
||||||
|
this.innerValue = innerValue;
|
||||||
|
this.outerValue = outerValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DeclarationDescriptor getDescriptor() {
|
||||||
|
return descriptor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public StackValue getInnerValue() {
|
||||||
|
return innerValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public StackValue getOuterValue() {
|
||||||
|
return outerValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -289,7 +289,7 @@ public class ExpressionCodegen extends JetVisitor {
|
|||||||
if (asmParamType.getSort() == Type.OBJECT && !"java.lang.Object".equals(asmParamType.getClassName())) {
|
if (asmParamType.getSort() == Type.OBJECT && !"java.lang.Object".equals(asmParamType.getClassName())) {
|
||||||
v.checkcast(asmParamType);
|
v.checkcast(asmParamType);
|
||||||
}
|
}
|
||||||
v.store(myMap.getIndex(parameterDescriptor), asmParamType);
|
v.store(lookupLocal(parameterDescriptor), asmParamType);
|
||||||
|
|
||||||
gen(expression.getBody(), Type.VOID_TYPE);
|
gen(expression.getBody(), Type.VOID_TYPE);
|
||||||
|
|
||||||
@@ -384,7 +384,7 @@ public class ExpressionCodegen extends JetVisitor {
|
|||||||
v.load(myIndexVar, Type.INT_TYPE);
|
v.load(myIndexVar, Type.INT_TYPE);
|
||||||
v.aload(loopRangeType.getElementType());
|
v.aload(loopRangeType.getElementType());
|
||||||
StackValue.onStack(loopRangeType.getElementType()).put(asmParamType, v);
|
StackValue.onStack(loopRangeType.getElementType()).put(asmParamType, v);
|
||||||
v.store(myMap.getIndex(parameterDescriptor), asmParamType);
|
v.store(lookupLocal(parameterDescriptor), asmParamType);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void generateIncrement() {
|
protected void generateIncrement() {
|
||||||
@@ -414,21 +414,21 @@ public class ExpressionCodegen extends JetVisitor {
|
|||||||
v.store(myRangeVar, loopRangeType);
|
v.store(myRangeVar, loopRangeType);
|
||||||
|
|
||||||
v.invokevirtual("jet/IntRange", "getStartValue", "()I");
|
v.invokevirtual("jet/IntRange", "getStartValue", "()I");
|
||||||
v.store(myMap.getIndex(parameterDescriptor), Type.INT_TYPE);
|
v.store(lookupLocal(parameterDescriptor), Type.INT_TYPE);
|
||||||
v.invokevirtual("jet/IntRange", "getEndValue", "()I");
|
v.invokevirtual("jet/IntRange", "getEndValue", "()I");
|
||||||
v.store(myEndVar, Type.INT_TYPE);
|
v.store(myEndVar, Type.INT_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void generateCondition(Type asmParamType, Label end) {
|
protected void generateCondition(Type asmParamType, Label end) {
|
||||||
v.load(myMap.getIndex(parameterDescriptor), Type.INT_TYPE);
|
v.load(lookupLocal(parameterDescriptor), Type.INT_TYPE);
|
||||||
v.load(myEndVar, Type.INT_TYPE);
|
v.load(myEndVar, Type.INT_TYPE);
|
||||||
v.ificmpgt(end);
|
v.ificmpgt(end);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void generateIncrement() {
|
protected void generateIncrement() {
|
||||||
v.iinc(myMap.getIndex(parameterDescriptor), 1); // TODO support decreasing order
|
v.iinc(lookupLocal(parameterDescriptor), 1); // TODO support decreasing order
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -482,10 +482,19 @@ public class ExpressionCodegen extends JetVisitor {
|
|||||||
generateBlock(expression.getFunctionLiteral().getBodyExpression().getStatements());
|
generateBlock(expression.getFunctionLiteral().getBodyExpression().getStatements());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
final GeneratedClosureDescriptor closure = new ClosureCodegen(state).gen(expression);
|
final GeneratedClosureDescriptor closure = state.generateClosure(expression, this);
|
||||||
|
|
||||||
v.anew(Type.getObjectType(closure.getClassname()));
|
v.anew(Type.getObjectType(closure.getClassname()));
|
||||||
v.dup();
|
v.dup();
|
||||||
v.invokespecial(closure.getClassname(), "<init>", closure.getConstructor().getDescriptor());
|
|
||||||
|
final Method cons = closure.getConstructor();
|
||||||
|
|
||||||
|
for (int i = 0; i < closure.getArgs().size(); i++) {
|
||||||
|
StackValue arg = closure.getArgs().get(i);
|
||||||
|
arg.put(cons.getArgumentTypes()[i], v);
|
||||||
|
}
|
||||||
|
|
||||||
|
v.invokespecial(closure.getClassname(), "<init>", cons.getDescriptor());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -548,6 +557,7 @@ public class ExpressionCodegen extends JetVisitor {
|
|||||||
@Override
|
@Override
|
||||||
public void visitSimpleNameExpression(JetSimpleNameExpression expression) {
|
public void visitSimpleNameExpression(JetSimpleNameExpression expression) {
|
||||||
DeclarationDescriptor descriptor = bindingContext.resolveReferenceExpression(expression);
|
DeclarationDescriptor descriptor = bindingContext.resolveReferenceExpression(expression);
|
||||||
|
if (descriptor instanceof NamespaceDescriptor) return; // No code to generate
|
||||||
|
|
||||||
if (descriptor instanceof VariableAsFunctionDescriptor) {
|
if (descriptor instanceof VariableAsFunctionDescriptor) {
|
||||||
descriptor = ((VariableAsFunctionDescriptor) descriptor).getVariableDescriptor();
|
descriptor = ((VariableAsFunctionDescriptor) descriptor).getVariableDescriptor();
|
||||||
@@ -577,7 +587,7 @@ public class ExpressionCodegen extends JetVisitor {
|
|||||||
myStack.push(StackValue.field(fieldType, owner, psiField.getName(), isStatic));
|
myStack.push(StackValue.field(fieldType, owner, psiField.getName(), isStatic));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
int index = myMap.getIndex(descriptor);
|
int index = lookupLocal(descriptor);
|
||||||
if (index >= 0) {
|
if (index >= 0) {
|
||||||
final JetType outType = ((VariableDescriptor) descriptor).getOutType();
|
final JetType outType = ((VariableDescriptor) descriptor).getOutType();
|
||||||
myStack.push(StackValue.local(index, typeMapper.mapType(outType)));
|
myStack.push(StackValue.local(index, typeMapper.mapType(outType)));
|
||||||
@@ -594,7 +604,7 @@ public class ExpressionCodegen extends JetVisitor {
|
|||||||
for (ValueParameterDescriptor parameter : parameters) {
|
for (ValueParameterDescriptor parameter : parameters) {
|
||||||
if (parameter.getName().equals(descriptor.getName())) {
|
if (parameter.getName().equals(descriptor.getName())) {
|
||||||
final JetType outType = ((VariableDescriptor) descriptor).getOutType();
|
final JetType outType = ((VariableDescriptor) descriptor).getOutType();
|
||||||
myStack.push(StackValue.local(myMap.getIndex(parameter), typeMapper.mapType(outType)));
|
myStack.push(StackValue.local(lookupLocal(parameter), typeMapper.mapType(outType)));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -626,12 +636,22 @@ public class ExpressionCodegen extends JetVisitor {
|
|||||||
myStack.push(iValue);
|
myStack.push(iValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!(descriptor instanceof NamespaceDescriptor)) {
|
else {
|
||||||
throw new UnsupportedOperationException("don't know how to generate reference " + descriptor);
|
final StackValue value = state.lookupInContext(descriptor);
|
||||||
|
if (value == null) {
|
||||||
|
throw new UnsupportedOperationException("don't know how to generate reference " + descriptor);
|
||||||
|
}
|
||||||
|
// receiver
|
||||||
|
StackValue.local(0, JetTypeMapper.TYPE_OBJECT).put(JetTypeMapper.TYPE_OBJECT, v);
|
||||||
|
myStack.push(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int lookupLocal(DeclarationDescriptor descriptor) {
|
||||||
|
return myMap.getIndex(descriptor);
|
||||||
|
}
|
||||||
|
|
||||||
public StackValue intermediateValueForProperty(PropertyDescriptor propertyDescriptor, final boolean forceField, boolean forceInterface) {
|
public StackValue intermediateValueForProperty(PropertyDescriptor propertyDescriptor, final boolean forceField, boolean forceInterface) {
|
||||||
DeclarationDescriptor containingDeclaration = propertyDescriptor.getContainingDeclaration();
|
DeclarationDescriptor containingDeclaration = propertyDescriptor.getContainingDeclaration();
|
||||||
boolean isStatic = containingDeclaration instanceof NamespaceDescriptorImpl;
|
boolean isStatic = containingDeclaration instanceof NamespaceDescriptorImpl;
|
||||||
@@ -890,7 +910,7 @@ public class ExpressionCodegen extends JetVisitor {
|
|||||||
|
|
||||||
private int indexOfLocal(JetReferenceExpression lhs) {
|
private int indexOfLocal(JetReferenceExpression lhs) {
|
||||||
final DeclarationDescriptor declarationDescriptor = bindingContext.resolveReferenceExpression(lhs);
|
final DeclarationDescriptor declarationDescriptor = bindingContext.resolveReferenceExpression(lhs);
|
||||||
return myMap.getIndex(declarationDescriptor);
|
return lookupLocal(declarationDescriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Type psiTypeToAsm(PsiType type) {
|
private static Type psiTypeToAsm(PsiType type) {
|
||||||
@@ -1369,7 +1389,7 @@ public class ExpressionCodegen extends JetVisitor {
|
|||||||
@Override
|
@Override
|
||||||
public void visitProperty(JetProperty property) {
|
public void visitProperty(JetProperty property) {
|
||||||
VariableDescriptor variableDescriptor = bindingContext.getVariableDescriptor(property);
|
VariableDescriptor variableDescriptor = bindingContext.getVariableDescriptor(property);
|
||||||
int index = myMap.getIndex(variableDescriptor);
|
int index = lookupLocal(variableDescriptor);
|
||||||
|
|
||||||
assert index >= 0;
|
assert index >= 0;
|
||||||
|
|
||||||
@@ -1538,7 +1558,7 @@ public class ExpressionCodegen extends JetVisitor {
|
|||||||
VariableDescriptor descriptor = bindingContext.getVariableDescriptor(clause.getCatchParameter());
|
VariableDescriptor descriptor = bindingContext.getVariableDescriptor(clause.getCatchParameter());
|
||||||
Type descriptorType = typeMapper.mapType(descriptor.getOutType());
|
Type descriptorType = typeMapper.mapType(descriptor.getOutType());
|
||||||
myMap.enter(descriptor, 1);
|
myMap.enter(descriptor, 1);
|
||||||
int index = myMap.getIndex(descriptor);
|
int index = lookupLocal(descriptor);
|
||||||
v.store(index, descriptorType);
|
v.store(index, descriptorType);
|
||||||
|
|
||||||
gen(clause.getCatchBody(), Type.VOID_TYPE);
|
gen(clause.getCatchBody(), Type.VOID_TYPE);
|
||||||
|
|||||||
@@ -5,9 +5,13 @@ package org.jetbrains.jet.codegen;
|
|||||||
|
|
||||||
import org.objectweb.asm.commons.Method;
|
import org.objectweb.asm.commons.Method;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class GeneratedClosureDescriptor {
|
public class GeneratedClosureDescriptor {
|
||||||
private final String classname;
|
private final String classname;
|
||||||
private Method constructor;
|
private Method constructor;
|
||||||
|
private List<StackValue> args = new ArrayList<StackValue>();
|
||||||
|
|
||||||
public GeneratedClosureDescriptor(String classname, Method constructor) {
|
public GeneratedClosureDescriptor(String classname, Method constructor) {
|
||||||
this.classname = classname;
|
this.classname = classname;
|
||||||
@@ -21,4 +25,12 @@ public class GeneratedClosureDescriptor {
|
|||||||
public Method getConstructor() {
|
public Method getConstructor() {
|
||||||
return constructor;
|
return constructor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void addArg(StackValue local) {
|
||||||
|
args.add(local);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<StackValue> getArgs() {
|
||||||
|
return args;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,9 @@ import com.intellij.util.containers.Stack;
|
|||||||
import org.jetbrains.jet.lang.ErrorHandler;
|
import org.jetbrains.jet.lang.ErrorHandler;
|
||||||
import org.jetbrains.jet.lang.cfg.pseudocode.JetControlFlowDataTraceFactory;
|
import org.jetbrains.jet.lang.cfg.pseudocode.JetControlFlowDataTraceFactory;
|
||||||
import org.jetbrains.jet.lang.descriptors.ClassDescriptor;
|
import org.jetbrains.jet.lang.descriptors.ClassDescriptor;
|
||||||
|
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
|
||||||
import org.jetbrains.jet.lang.psi.JetFile;
|
import org.jetbrains.jet.lang.psi.JetFile;
|
||||||
|
import org.jetbrains.jet.lang.psi.JetFunctionLiteralExpression;
|
||||||
import org.jetbrains.jet.lang.psi.JetNamespace;
|
import org.jetbrains.jet.lang.psi.JetNamespace;
|
||||||
import org.jetbrains.jet.lang.resolve.AnalyzingUtils;
|
import org.jetbrains.jet.lang.resolve.AnalyzingUtils;
|
||||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||||
@@ -21,12 +23,12 @@ public class GenerationState {
|
|||||||
private final Project project;
|
private final Project project;
|
||||||
|
|
||||||
private JetTypeMapper typeMapper;
|
private JetTypeMapper typeMapper;
|
||||||
private final Stack<BindingContext> bindingContexts;
|
private final Stack<BindingContext> bindingContexts = new Stack<BindingContext>();
|
||||||
|
private final Stack<ClosureCodegen> closureContexts = new Stack<ClosureCodegen>();
|
||||||
private final JetStandardLibrary standardLibrary;
|
private final JetStandardLibrary standardLibrary;
|
||||||
|
|
||||||
public GenerationState(Project project, boolean text) {
|
public GenerationState(Project project, boolean text) {
|
||||||
this.project = project;
|
this.project = project;
|
||||||
this.bindingContexts = new Stack<BindingContext>();
|
|
||||||
this.standardLibrary = JetStandardLibrary.getJetStandardLibrary(project);
|
this.standardLibrary = JetStandardLibrary.getJetStandardLibrary(project);
|
||||||
this.factory = new ClassFileFactory(project, text, this);
|
this.factory = new ClassFileFactory(project, text, this);
|
||||||
}
|
}
|
||||||
@@ -94,4 +96,21 @@ public class GenerationState {
|
|||||||
typeMapper = null;
|
typeMapper = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public GeneratedClosureDescriptor generateClosure(JetFunctionLiteralExpression literal, ExpressionCodegen context) {
|
||||||
|
final ClosureCodegen codegen = new ClosureCodegen(this, context);
|
||||||
|
closureContexts.push(codegen);
|
||||||
|
try {
|
||||||
|
return codegen.gen(literal);
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
final ClosureCodegen pooped = closureContexts.pop();
|
||||||
|
assert pooped == codegen;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public StackValue lookupInContext(DeclarationDescriptor d) {
|
||||||
|
final ClosureCodegen top = closureContexts.peek();
|
||||||
|
return top != null ? top.lookupInContext(d) : null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
fun box() : String {
|
fun box() : String {
|
||||||
val cl = 39
|
val cl = 39
|
||||||
return if (sum(200, { cl }) == 2) "OK" else "FAIL"
|
return if (sum(200, { cl }) == 239) "OK" else "FAIL"
|
||||||
}
|
}
|
||||||
|
|
||||||
fun sum(arg:Int, f : {() : Int}) : Int {
|
fun sum(arg:Int, f : {() : Int}) : Int {
|
||||||
|
|||||||
Reference in New Issue
Block a user