mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-04-10 00:21:27 +00:00
Compare commits
1 Commits
stdlib/sat
...
ab/bits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6bb03a0b6b |
1
.idea/artifacts/KotlinJpsPlugin.xml
generated
1
.idea/artifacts/KotlinJpsPlugin.xml
generated
@@ -24,7 +24,6 @@
|
||||
<element id="module-output" name="deserialization" />
|
||||
<element id="extracted-dir" path="$PROJECT_DIR$/dependencies/native-platform-uberjar.jar" path-in-jar="/" />
|
||||
<element id="module-output" name="android-jps-plugin" />
|
||||
<element id="module-output" name="build-common" />
|
||||
</root>
|
||||
</artifact>
|
||||
</component>
|
||||
3
.idea/dictionaries/bashor.xml
generated
3
.idea/dictionaries/bashor.xml
generated
@@ -2,9 +2,8 @@
|
||||
<dictionary name="bashor">
|
||||
<words>
|
||||
<w>ctor</w>
|
||||
<w>interner</w>
|
||||
<w>lookups</w>
|
||||
<w>unescape</w>
|
||||
</words>
|
||||
</dictionary>
|
||||
</component>
|
||||
</component>
|
||||
|
||||
6
.idea/kotlinc.xml
generated
6
.idea/kotlinc.xml
generated
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="KotlinCompilerSettings">
|
||||
<option name="additionalArguments" value="-version -Xallow-kotlin-package -Xskip-metadata-version-check" />
|
||||
</component>
|
||||
</project>
|
||||
330
.idea/libraries/idea_full.xml
generated
330
.idea/libraries/idea_full.xml
generated
@@ -2,343 +2,17 @@
|
||||
<library name="idea-full">
|
||||
<ANNOTATIONS>
|
||||
<root url="file://$PROJECT_DIR$/annotations" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/lib" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/java" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/" />
|
||||
</ANNOTATIONS>
|
||||
<CLASSES>
|
||||
<root url="file://$PROJECT_DIR$/ideaSDK/lib" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/jps/antLayout/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/jps/model-api/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/jps/model-impl/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/jps/model-impl/testSrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/jps/jps-builders/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/jps/jps-builders/testSrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/jps/standalone-builder/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/jps/model-serialization/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/jps/model-serialization/testSrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/xml/impl/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/xml/impl/resources" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/xml/tests/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/xml/openapi/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/xml/relaxng/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/xml/relaxng/test" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/xml/dom-impl/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/xml/dom-tests/tests" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/xml/dom-openapi/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/xml/xml-psi-api/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/xml/xml-psi-impl/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/java/idea-ui/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/java/jsp-spi/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/java/openapi/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/java/compiler/impl/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/java/compiler/impl/testSrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/java/compiler/javac2/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/java/compiler/openapi/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/java/compiler/forms-compiler/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/java/compiler/forms-compiler/testSrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/java/compiler/instrumentation-util/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/java/debugger/impl/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/java/debugger/openapi/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/java/manifest/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/java/manifest/test" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/java/execution/impl/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/java/execution/openapi/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/java/java-impl/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/java/java-tests/testSrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/java/jsp-openapi/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/java/java-psi-api/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/java/java-runtime/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/java/java-psi-impl/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/java/testFramework/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/java/remote-servers/api/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/java/remote-servers/impl/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/java/jsp-base-openapi/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/java/java-analysis-api/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/java/java-indexing-api/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/java/java-analysis-impl/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/java/java-indexing-impl/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/build/cucumber-test-runner/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/tools/lexer/jflex-1.4/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/tools/lexer/jflex-1.4/examples/cup" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/tools/lexer/jflex-1.4/examples/java" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/tools/lexer/jflex-1.4/examples/binary" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/tools/lexer/jflex-1.4/examples/simple" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/tools/lexer/jflex-1.4/examples/interpreter" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/tools/launcher-generator/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/images/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/ant/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/ant/tests/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/ant/jps-plugin/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/ant/jps-plugin/testSrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/cvs/cvs-core/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/cvs/cvs-plugin/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/cvs/javacvs-src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/cvs/smartcvs-src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/cvs/trilead-ssh2-build213/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/cvs/trilead-ssh2-build213/examples" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/junit/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/maven/src/main/java" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/maven/src/test/java" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/maven/jps-plugin/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/maven/jps-plugin/testSrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/maven/maven-server-api/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/maven/maven2-server-impl/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/maven/maven2-server-impl/test" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/maven/artifact-resolver-m2/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/maven/artifact-resolver-m3/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/tasks/tasks-api/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/tasks/tasks-core/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/tasks/tasks-java/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/tasks/tasks-tests/test" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/xpath/xslt-rt/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/xpath/xpath-lang/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/xpath/xpath-lang/test" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/xpath/xpath-view/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/devkit/resources" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/devkit/jps-plugin/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/devkit/jps-plugin/testSrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/github/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/github/test" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/gradle/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/gradle/testSources" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/groovy/rt/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/groovy/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/groovy/test" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/groovy/hotswap/agentSrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/groovy/jps-plugin/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/groovy/rt-constants/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/javaFX/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/javaFX/javaFX-CE/testSrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/javaFX/javaFX-jps-plugin/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/javaFX/common-javaFX-plugin/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/testng/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/testng/testSources" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/eclipse/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/eclipse/resources" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/eclipse/jps-plugin/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/eclipse/testSources" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/hg4idea/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/hg4idea/testSrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/git4idea/rt/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/git4idea/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/git4idea/tests" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/git4idea/resources" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/git4idea/test-stepdefs" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/junit_rt/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/svn4idea/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/svn4idea/resources" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/svn4idea/testSource" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/terminal/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/terminal/resources" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/commander/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/copyright/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/java-i18n/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/java-i18n/testSrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/testng_rt/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/properties/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/properties/testSrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/IntelliLang/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/IntelliLang/xml-support" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/IntelliLang/java-support" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/IntelliLang/IntelliLang-tests/test" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/IntelliLang/intellilang-jps-plugin/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/ui-designer/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/ui-designer/testSrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/ui-designer/jps-plugin/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/ui-designer/jps-plugin/testSrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/xslt-debugger/rt/impl/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/xslt-debugger/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/xslt-debugger/engine/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/xslt-debugger/engine/impl/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/ByteCodeViewer/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/ui-designer-core/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/InspectionGadgets/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/InspectionGadgets/test" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/InspectionGadgets/testsrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/IntentionPowerPak/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/IntentionPowerPak/test" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/IntentionPowerPak/testSrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/generate-tostring/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/generate-tostring/testSrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/google-app-engine/source" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/google-app-engine/runtime/source" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/google-app-engine/resources" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/google-app-engine/jps-plugin/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/google-app-engine/jps-plugin/testSource" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/google-app-engine/testSource" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/cucumber-jvm-formatter/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/samples/comparingReferences/source" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/samples/comparingReferences/testSource" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/samples/conditionalOperatorConvertor/source" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/samples/conditionalOperatorConvertor/testSource" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/updater/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/boot/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/util/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/util/testSrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/util-rt/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/vcs-api/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/core-api/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/forms_rt/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/lang-api/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/lang-api/testSources" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/lvcs-api/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/smRunner/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/smRunner/testSrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/vcs-impl/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/vcs-impl/testSrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/bootstrap/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/core-impl/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/funcTests/project1/module1/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/lang-impl/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/lang-impl/testSources" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/lvcs-impl/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/usageView/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/extensions/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/extensions/testSrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/testRunner/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/analysis-api/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/indexing-api/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/platform-api/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/analysis-impl/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/editor-ui-api/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/editor-ui-ex/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/indexing-impl/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/platform-impl/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/platform-main/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/testFramework/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/testFramework/testSrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/testFramework/bootstrap/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/xdebugger-api/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/platform-tests/testSrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/remote-servers/api/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/remote-servers/impl/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/xdebugger-impl/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/xdebugger-impl/testSrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/projectModel-api/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/projectModel-impl/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/external-system-api/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/external-system-impl/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/external-system-impl/testSrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/spellchecker/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/spellchecker/testSrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/RegExpSupport/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/RegExpSupport/test" />
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/guava-17.0-sources.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/asm5-src.zip!/" />
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/cli-parser-1.1.1-sources.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/build/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/java/java-impl/gen" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/java/java-psi-impl/gen" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/java/java-structure-view/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/java/structuralsearch-java/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/java/typeMigration/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/java/typeMigration/test" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/jps/jps-launcher/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/jps/plugin-system/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/json/gen" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/json/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/json/tests/test" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/annotations/common/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/annotations/java5/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/annotations/java8/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/built-in-server-api/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/built-in-server/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/configuration-store-impl/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/diff-api/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/diff-impl/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/duplicates-analysis/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/dvcs-api/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/dvcs-impl/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/lang-impl/gen" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/remote-servers/agent-rt/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/script-debugger/backend/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/script-debugger/debugger-ui/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/script-debugger/debugger-ui/testSrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/script-debugger/protocol/protocol-reader-runtime/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/structuralsearch/source" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/structuralsearch/testSource" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/structure-view-api/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/structure-view-impl/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/vcs-api/vcs-api-core/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/vcs-log/api/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/vcs-log/graph-api/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/vcs-log/graph/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/vcs-log/graph/test" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/vcs-log/impl/gen" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/vcs-log/impl/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/vcs-log/impl/test" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/ShortcutPromoter/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/coverage-common/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/coverage/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/coverage/testSrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/devkit/gen" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/eclipse/gen" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/editorconfig/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/git4idea/remote-servers-git/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/google-app-engine/gen" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/gradle/jps-plugin/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/gradle/tooling-extension-api/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/gradle/tooling-extension-impl/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/gradle/tooling-extension-impl/testSources" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/groovy/groovy-psi/gen" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/groovy/groovy-psi/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/groovy/structuralsearch-groovy/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/groovy/structuralsearch-groovy/testSrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/java-decompiler/engine/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/java-decompiler/engine/test" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/java-decompiler/plugin/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/java-decompiler/plugin/test" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/javaFX/FxBuilderEmbedder/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/junit/test" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/maven/artifact-resolver-m31/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/maven/artifact-resolver/common/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/maven/maven3-server-common/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/maven/maven30-server-impl/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/maven/maven32-server-impl/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/properties/properties-psi-api/gen" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/properties/properties-psi-api/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/properties/properties-psi-impl/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/settings-repository/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/tasks/tasks-core/jira/gen" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/tasks/tasks-core/jira/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/python/IntelliLang-python/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/python/edu/course-creator-intellij-py/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/python/edu/course-creator-python/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/python/edu/course-creator-python/tests" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/python/edu/gen" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/python/edu/interactive-learning-intellij-py/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/python/edu/interactive-learning-python/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/python/edu/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/python/educational/course-creator/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/python/educational/interactive-learning-intellij/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/python/educational/interactive-learning/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/python/educational/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/python/gen" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/python/ide/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/python/ipnb/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/python/ipnb/testSrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/python/openapi/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/python/pluginSrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/python/pluginTestSrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/python/psi-api/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/python/pydevSrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/python/python-rest/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/python/python-rest/test" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/python/rest/gen" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/python/rest/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/python/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/python/testSrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/updater/testSrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/xml/xml-analysis-api/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/xml/xml-analysis-impl/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/xml/xml-psi-impl/gen" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/xml/xml-structure-view-api/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/xml/xml-structure-view-impl/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/" />
|
||||
</SOURCES>
|
||||
<jarDirectory url="file://$PROJECT_DIR$/ideaSDK/lib" recursive="false" />
|
||||
</library>
|
||||
|
||||
324
.idea/libraries/intellij_core.xml
generated
324
.idea/libraries/intellij_core.xml
generated
@@ -2,9 +2,7 @@
|
||||
<library name="intellij-core">
|
||||
<ANNOTATIONS>
|
||||
<root url="file://$PROJECT_DIR$/annotations" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/lib" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/java" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/" />
|
||||
</ANNOTATIONS>
|
||||
<CLASSES>
|
||||
<root url="file://$PROJECT_DIR$/ideaSDK/core" />
|
||||
@@ -13,325 +11,7 @@
|
||||
<SOURCES>
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/guava-17.0-sources.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/asm5-src.zip!/" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/RegExpSupport/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/build/cucumber-test-runner/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/build/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/images/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/java/compiler/forms-compiler/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/java/compiler/forms-compiler/testSrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/java/compiler/impl/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/java/compiler/impl/testSrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/java/compiler/instrumentation-util/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/java/compiler/javac2/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/java/compiler/openapi/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/java/debugger/impl/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/java/debugger/openapi/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/java/execution/impl/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/java/execution/openapi/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/java/idea-ui/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/java/java-analysis-api/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/java/java-analysis-impl/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/java/java-impl/gen" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/java/java-impl/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/java/java-indexing-api/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/java/java-indexing-impl/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/java/java-psi-api/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/java/java-psi-impl/gen" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/java/java-psi-impl/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/java/java-runtime/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/java/java-structure-view/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/java/java-tests/testSrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/java/jsp-base-openapi/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/java/jsp-openapi/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/java/jsp-spi/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/java/manifest/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/java/manifest/test" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/java/openapi/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/java/remote-servers/api/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/java/remote-servers/impl/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/java/structuralsearch-java/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/java/testFramework/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/java/typeMigration/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/java/typeMigration/test" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/jps/antLayout/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/jps/jps-builders/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/jps/jps-builders/testSrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/jps/jps-launcher/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/jps/model-api/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/jps/model-impl/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/jps/model-impl/testSrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/jps/model-serialization/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/jps/model-serialization/testSrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/jps/plugin-system/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/jps/standalone-builder/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/json/gen" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/json/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/json/tests/test" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/analysis-api/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/analysis-impl/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/annotations/common/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/annotations/java5/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/annotations/java8/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/boot/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/bootstrap/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/built-in-server-api/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/built-in-server/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/configuration-store-impl/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/core-api/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/core-impl/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/diff-api/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/diff-impl/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/duplicates-analysis/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/dvcs-api/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/dvcs-impl/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/editor-ui-api/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/editor-ui-ex/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/extensions/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/extensions/testSrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/external-system-api/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/external-system-impl/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/external-system-impl/testSrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/forms_rt/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/funcTests/project1/module1/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/indexing-api/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/indexing-impl/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/lang-api/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/lang-api/testSources" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/lang-impl/gen" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/lang-impl/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/lang-impl/testSources" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/lvcs-api/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/lvcs-impl/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/platform-api/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/platform-impl/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/platform-main/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/platform-tests/testSrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/projectModel-api/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/projectModel-impl/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/remote-servers/agent-rt/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/remote-servers/api/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/remote-servers/impl/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/script-debugger/backend/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/script-debugger/debugger-ui/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/script-debugger/debugger-ui/testSrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/script-debugger/protocol/protocol-reader-runtime/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/smRunner/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/smRunner/testSrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/structuralsearch/source" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/structuralsearch/testSource" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/structure-view-api/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/structure-view-impl/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/testFramework/bootstrap/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/testFramework/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/testFramework/testSrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/testRunner/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/usageView/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/util-rt/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/util/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/util/testSrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/vcs-api/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/vcs-api/vcs-api-core/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/vcs-impl/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/vcs-impl/testSrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/vcs-log/api/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/vcs-log/graph-api/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/vcs-log/graph/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/vcs-log/graph/test" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/vcs-log/impl/gen" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/vcs-log/impl/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/vcs-log/impl/test" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/xdebugger-api/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/xdebugger-impl/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/platform/xdebugger-impl/testSrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/ByteCodeViewer/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/InspectionGadgets/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/InspectionGadgets/test" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/InspectionGadgets/testsrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/IntelliLang/IntelliLang-tests/test" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/IntelliLang/intellilang-jps-plugin/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/IntelliLang/java-support" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/IntelliLang/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/IntelliLang/xml-support" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/IntentionPowerPak/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/IntentionPowerPak/test" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/IntentionPowerPak/testSrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/ShortcutPromoter/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/ant/jps-plugin/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/ant/jps-plugin/testSrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/ant/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/ant/tests/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/commander/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/copyright/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/coverage-common/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/coverage/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/coverage/testSrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/cucumber-jvm-formatter/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/cvs/cvs-core/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/cvs/cvs-plugin/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/cvs/javacvs-src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/cvs/smartcvs-src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/cvs/trilead-ssh2-build213/examples" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/cvs/trilead-ssh2-build213/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/devkit/gen" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/devkit/jps-plugin/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/devkit/jps-plugin/testSrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/eclipse/gen" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/eclipse/jps-plugin/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/eclipse/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/eclipse/testSources" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/editorconfig/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/generate-tostring/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/generate-tostring/testSrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/git4idea/remote-servers-git/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/git4idea/resources" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/git4idea/rt/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/git4idea/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/git4idea/test-stepdefs" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/git4idea/tests" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/github/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/github/test" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/google-app-engine/gen" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/google-app-engine/jps-plugin/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/google-app-engine/jps-plugin/testSource" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/google-app-engine/runtime/source" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/google-app-engine/source" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/google-app-engine/testSource" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/gradle/jps-plugin/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/gradle/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/gradle/testSources" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/gradle/tooling-extension-api/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/gradle/tooling-extension-impl/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/gradle/tooling-extension-impl/testSources" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/groovy/groovy-psi/gen" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/groovy/groovy-psi/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/groovy/hotswap/agentSrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/groovy/jps-plugin/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/groovy/rt-constants/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/groovy/rt/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/groovy/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/groovy/structuralsearch-groovy/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/groovy/structuralsearch-groovy/testSrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/groovy/test" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/hg4idea/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/hg4idea/testSrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/java-decompiler/engine/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/java-decompiler/engine/test" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/java-decompiler/plugin/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/java-decompiler/plugin/test" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/java-i18n/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/java-i18n/testSrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/javaFX/FxBuilderEmbedder/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/javaFX/common-javaFX-plugin/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/javaFX/javaFX-CE/testSrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/javaFX/javaFX-jps-plugin/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/javaFX/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/junit/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/junit/test" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/junit_rt/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/maven/artifact-resolver-m2/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/maven/artifact-resolver-m31/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/maven/artifact-resolver-m3/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/maven/artifact-resolver/common/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/maven/jps-plugin/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/maven/jps-plugin/testSrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/maven/maven-server-api/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/maven/maven2-server-impl/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/maven/maven2-server-impl/test" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/maven/maven3-server-common/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/maven/maven30-server-impl/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/maven/maven32-server-impl/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/maven/src/main/java" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/maven/src/test/java" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/properties/properties-psi-api/gen" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/properties/properties-psi-api/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/properties/properties-psi-impl/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/properties/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/properties/testSrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/settings-repository/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/svn4idea/resources" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/svn4idea/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/svn4idea/testSource" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/tasks/tasks-api/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/tasks/tasks-core/jira/gen" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/tasks/tasks-core/jira/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/tasks/tasks-core/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/tasks/tasks-java/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/tasks/tasks-tests/test" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/terminal/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/testng/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/testng/testSources" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/testng_rt/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/ui-designer-core/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/ui-designer/jps-plugin/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/ui-designer/jps-plugin/testSrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/ui-designer/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/ui-designer/testSrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/xpath/xpath-lang/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/xpath/xpath-lang/test" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/xpath/xpath-view/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/xpath/xslt-rt/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/xslt-debugger/engine/impl/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/xslt-debugger/engine/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/xslt-debugger/rt/impl/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/plugins/xslt-debugger/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/python/IntelliLang-python/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/python/edu/course-creator-intellij-py/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/python/edu/course-creator-python/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/python/edu/course-creator-python/tests" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/python/edu/gen" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/python/edu/interactive-learning-intellij-py/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/python/edu/interactive-learning-python/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/python/edu/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/python/educational/course-creator/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/python/educational/interactive-learning-intellij/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/python/educational/interactive-learning/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/python/educational/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/python/gen" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/python/ide/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/python/ipnb/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/python/ipnb/testSrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/python/openapi/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/python/pluginSrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/python/pluginTestSrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/python/psi-api/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/python/pydevSrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/python/python-rest/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/python/python-rest/test" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/python/rest/gen" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/python/rest/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/python/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/python/testSrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/samples/comparingReferences/source" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/samples/comparingReferences/testSource" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/samples/conditionalOperatorConvertor/source" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/samples/conditionalOperatorConvertor/testSource" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/spellchecker/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/spellchecker/testSrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/tools/launcher-generator/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/tools/lexer/jflex-1.4/examples/binary" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/tools/lexer/jflex-1.4/examples/cup" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/tools/lexer/jflex-1.4/examples/interpreter" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/tools/lexer/jflex-1.4/examples/java" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/tools/lexer/jflex-1.4/examples/simple" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/tools/lexer/jflex-1.4/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/updater/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/updater/testSrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/xml/dom-impl/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/xml/dom-openapi/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/xml/dom-tests/tests" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/xml/impl/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/xml/openapi/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/xml/relaxng/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/xml/relaxng/test" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/xml/tests/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/xml/xml-analysis-api/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/xml/xml-analysis-impl/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/xml/xml-psi-api/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/xml/xml-psi-impl/gen" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/xml/xml-psi-impl/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/xml/xml-structure-view-api/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/xml/xml-structure-view-impl/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/" />
|
||||
</SOURCES>
|
||||
<jarDirectory url="file://$PROJECT_DIR$/ideaSDK/core" recursive="false" />
|
||||
</library>
|
||||
|
||||
3
.idea/modules.xml
generated
3
.idea/modules.xml
generated
@@ -13,7 +13,6 @@
|
||||
<module fileurl="file://$PROJECT_DIR$/compiler/backend/backend.iml" filepath="$PROJECT_DIR$/compiler/backend/backend.iml" group="compiler/java" />
|
||||
<module fileurl="file://$PROJECT_DIR$/compiler/backend-common/backend-common.iml" filepath="$PROJECT_DIR$/compiler/backend-common/backend-common.iml" group="compiler" />
|
||||
<module fileurl="file://$PROJECT_DIR$/jps-plugin/bare-plugin/bare-plugin.iml" filepath="$PROJECT_DIR$/jps-plugin/bare-plugin/bare-plugin.iml" group="ide/jps" />
|
||||
<module fileurl="file://$PROJECT_DIR$/build-common/build-common.iml" filepath="$PROJECT_DIR$/build-common/build-common.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/core/builtins/builtins.iml" filepath="$PROJECT_DIR$/core/builtins/builtins.iml" group="core" />
|
||||
<module fileurl="file://$PROJECT_DIR$/compiler/builtins-serializer/builtins-serializer.iml" filepath="$PROJECT_DIR$/compiler/builtins-serializer/builtins-serializer.iml" group="compiler/cli" />
|
||||
<module fileurl="file://$PROJECT_DIR$/compiler/cli/cli.iml" filepath="$PROJECT_DIR$/compiler/cli/cli.iml" group="compiler/cli" />
|
||||
@@ -68,4 +67,4 @@
|
||||
<module fileurl="file://$PROJECT_DIR$/core/util.runtime/util.runtime.iml" filepath="$PROJECT_DIR$/core/util.runtime/util.runtime.iml" group="core" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
</project>
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
<property name="plugin.zip" value="${artifact.output.path}/kotlin-plugin-${build.number}.zip"/>
|
||||
<property name="bare.plugin.zip" value="${artifact.output.path}/kotlin-bare-plugin-${build.number}.zip"/>
|
||||
<property name="android-extensions.zip" value="${artifact.output.path}/kotlin-android-extensions-plugin-${build.number}.zip"/>
|
||||
|
||||
<property name="kotlin.bare.plugin.xml" value="jps-plugin/bare-plugin/src/META-INF/plugin.xml"/>
|
||||
<property name="kotlin.bare.plugin.xml.bk" value="${version_substitute_dir}/kotlin.bare.plugin.xml.bk"/>
|
||||
@@ -126,6 +127,10 @@
|
||||
|
||||
<zipPlugin filename="${plugin.zip}" dir="Kotlin"/>
|
||||
<zipPlugin filename="${bare.plugin.zip}" dir="BareKotlin"/>
|
||||
|
||||
<zip destfile="${android-extensions.zip}">
|
||||
<zipfileset prefix="META-INF" dir="${basedir}/plugins/android-idea-plugin/old_plugin" includes="plugin.xml" />
|
||||
</zip>
|
||||
</target>
|
||||
|
||||
<macrodef name="print-statistic">
|
||||
|
||||
@@ -19,22 +19,22 @@ package org.jetbrains.kotlin.ant
|
||||
import org.apache.tools.ant.types.Path
|
||||
import java.io.File
|
||||
|
||||
class Kotlin2JsTask : KotlinCompilerBaseTask() {
|
||||
public class Kotlin2JsTask : KotlinCompilerBaseTask() {
|
||||
override val compilerFqName = "org.jetbrains.kotlin.cli.js.K2JSCompiler"
|
||||
|
||||
var library: Path? = null
|
||||
var outputPrefix: File? = null
|
||||
var outputPostfix: File? = null
|
||||
var sourceMap: Boolean = false
|
||||
var metaInfo: Boolean = false
|
||||
public var library: Path? = null
|
||||
public var outputPrefix: File? = null
|
||||
public var outputPostfix: File? = null
|
||||
public var sourceMap: Boolean = false
|
||||
public var metaInfo: Boolean = false
|
||||
|
||||
/**
|
||||
* {@link K2JsArgumentConstants.CALL} (default) if need generate a main function call (main function will be auto detected)
|
||||
* {@link K2JsArgumentConstants.NO_CALL} otherwise.
|
||||
*/
|
||||
var main: String? = null
|
||||
public var main: String? = null
|
||||
|
||||
fun createLibrary(): Path {
|
||||
public fun createLibrary(): Path {
|
||||
val libraryPath = library
|
||||
if (libraryPath == null) {
|
||||
val t = Path(getProject())
|
||||
|
||||
@@ -20,15 +20,15 @@ import org.apache.tools.ant.types.Path
|
||||
import org.apache.tools.ant.types.Reference
|
||||
import java.io.File.pathSeparator
|
||||
|
||||
class Kotlin2JvmTask : KotlinCompilerBaseTask() {
|
||||
public class Kotlin2JvmTask : KotlinCompilerBaseTask() {
|
||||
override val compilerFqName = "org.jetbrains.kotlin.cli.jvm.K2JVMCompiler"
|
||||
|
||||
var includeRuntime: Boolean = true
|
||||
var moduleName: String? = null
|
||||
public var includeRuntime: Boolean = true
|
||||
public var moduleName: String? = null
|
||||
|
||||
private var compileClasspath: Path? = null
|
||||
|
||||
fun setClasspath(classpath: Path) {
|
||||
public fun setClasspath(classpath: Path) {
|
||||
if (compileClasspath == null) {
|
||||
compileClasspath = classpath
|
||||
}
|
||||
@@ -37,14 +37,14 @@ class Kotlin2JvmTask : KotlinCompilerBaseTask() {
|
||||
}
|
||||
}
|
||||
|
||||
fun setClasspathRef(ref: Reference) {
|
||||
public fun setClasspathRef(ref: Reference) {
|
||||
if (compileClasspath == null) {
|
||||
compileClasspath = Path(getProject())
|
||||
}
|
||||
compileClasspath!!.createPath().refid = ref
|
||||
compileClasspath!!.createPath().setRefid(ref)
|
||||
}
|
||||
|
||||
fun addConfiguredClasspath(classpath: Path) {
|
||||
public fun addConfiguredClasspath(classpath: Path) {
|
||||
setClasspath(classpath)
|
||||
}
|
||||
|
||||
|
||||
@@ -29,12 +29,12 @@ object KotlinAntTaskUtil {
|
||||
|
||||
private val libPath: File by lazy {
|
||||
// Find path of kotlin-ant.jar in the filesystem and find kotlin-compiler.jar in the same directory
|
||||
val resourcePath = "/" + javaClass.name.replace('.', '/') + ".class"
|
||||
val resourcePath = "/" + javaClass.getName().replace('.', '/') + ".class"
|
||||
val jarConnection = javaClass.getResource(resourcePath).openConnection() as? JarURLConnection
|
||||
?: throw UnsupportedOperationException("Kotlin compiler Ant task should be loaded from the JAR file")
|
||||
val antTaskJarPath = File(jarConnection.jarFileURL.toURI())
|
||||
val antTaskJarPath = File(jarConnection.getJarFileURL().toURI())
|
||||
|
||||
antTaskJarPath.parentFile
|
||||
antTaskJarPath.getParentFile()
|
||||
}
|
||||
|
||||
val compilerJar: File by lazy {
|
||||
@@ -47,7 +47,7 @@ object KotlinAntTaskUtil {
|
||||
|
||||
private fun File.assertExists(): File {
|
||||
if (!this.exists()) {
|
||||
throw IllegalStateException("${name} is not found in the directory of Kotlin Ant task")
|
||||
throw IllegalStateException("${getName()} is not found in the directory of Kotlin Ant task")
|
||||
}
|
||||
return this
|
||||
}
|
||||
@@ -68,5 +68,5 @@ object KotlinAntTaskUtil {
|
||||
|
||||
}
|
||||
|
||||
val Task.defaultModuleName: String?
|
||||
public val Task.defaultModuleName: String?
|
||||
get() = owningTarget?.name ?: project?.name
|
||||
@@ -24,25 +24,25 @@ import org.apache.tools.ant.types.Reference
|
||||
import java.io.File
|
||||
import java.io.PrintStream
|
||||
|
||||
abstract class KotlinCompilerBaseTask : Task() {
|
||||
public abstract class KotlinCompilerBaseTask : Task() {
|
||||
protected abstract val compilerFqName: String
|
||||
|
||||
val args: MutableList<String> = arrayListOf()
|
||||
public val args: MutableList<String> = arrayListOf()
|
||||
|
||||
var src: Path? = null
|
||||
var output: File? = null
|
||||
var nowarn: Boolean = false
|
||||
var verbose: Boolean = false
|
||||
var printVersion: Boolean = false
|
||||
var failOnError: Boolean = true
|
||||
public var src: Path? = null
|
||||
public var output: File? = null
|
||||
public var nowarn: Boolean = false
|
||||
public var verbose: Boolean = false
|
||||
public var printVersion: Boolean = false
|
||||
public var failOnError: Boolean = true
|
||||
|
||||
var noStdlib: Boolean = false
|
||||
public var noStdlib: Boolean = false
|
||||
|
||||
val additionalArguments: MutableList<Commandline.Argument> = arrayListOf()
|
||||
public val additionalArguments: MutableList<Commandline.Argument> = arrayListOf()
|
||||
|
||||
var exitCode: Int? = null
|
||||
public var exitCode: Int? = null
|
||||
|
||||
fun createSrc(): Path {
|
||||
public fun createSrc(): Path {
|
||||
val srcPath = src
|
||||
if (srcPath == null) {
|
||||
val t = Path(getProject())
|
||||
@@ -53,11 +53,11 @@ abstract class KotlinCompilerBaseTask : Task() {
|
||||
return srcPath.createPath()
|
||||
}
|
||||
|
||||
fun setSrcRef(ref: Reference) {
|
||||
public fun setSrcRef(ref: Reference) {
|
||||
createSrc().refid = ref
|
||||
}
|
||||
|
||||
fun createCompilerArg(): Commandline.Argument {
|
||||
public fun createCompilerArg(): Commandline.Argument {
|
||||
val argument = Commandline.Argument()
|
||||
additionalArguments.add(argument)
|
||||
return argument
|
||||
@@ -65,7 +65,7 @@ abstract class KotlinCompilerBaseTask : Task() {
|
||||
|
||||
abstract fun fillSpecificArguments()
|
||||
|
||||
fun fillArguments() {
|
||||
public fun fillArguments() {
|
||||
val sourcePaths = src ?: throw BuildException("\"src\" should be specified")
|
||||
args.addAll(sourcePaths.list().map { File(it).canonicalPath })
|
||||
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module" module-name="frontend.java" />
|
||||
<orderEntry type="module" module-name="util.runtime" />
|
||||
<orderEntry type="module" module-name="cli-common" />
|
||||
<orderEntry type="module" module-name="util" />
|
||||
<orderEntry type="module" module-name="compiler-tests" scope="TEST" />
|
||||
<orderEntry type="library" scope="TEST" name="idea-full" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -1,40 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.build
|
||||
|
||||
import org.jetbrains.kotlin.incremental.LocalFileKotlinClass
|
||||
import org.jetbrains.kotlin.load.kotlin.ModuleMapping
|
||||
import org.jetbrains.kotlin.utils.sure
|
||||
import java.io.File
|
||||
|
||||
open class GeneratedFile<Target>(
|
||||
val target: Target,
|
||||
val sourceFiles: Collection<File>,
|
||||
val outputFile: File
|
||||
)
|
||||
|
||||
class GeneratedJvmClass<Target> (
|
||||
target: Target,
|
||||
sourceFiles: Collection<File>,
|
||||
outputFile: File
|
||||
) : GeneratedFile<Target>(target, sourceFiles, outputFile) {
|
||||
val outputClass = LocalFileKotlinClass.create(outputFile).sure {
|
||||
"Couldn't load KotlinClass from $outputFile; it may happen because class doesn't have valid Kotlin annotations"
|
||||
}
|
||||
}
|
||||
|
||||
fun File.isModuleMappingFile() = extension == ModuleMapping.MAPPING_FILE_EXT && parentFile.name == "META-INF"
|
||||
@@ -1,131 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.modules
|
||||
|
||||
import com.intellij.openapi.util.io.FileUtil.toSystemIndependentName
|
||||
import com.intellij.openapi.util.text.StringUtil.escapeXml
|
||||
import org.jetbrains.kotlin.build.JvmSourceRoot
|
||||
import org.jetbrains.kotlin.cli.common.modules.ModuleXmlParser.*
|
||||
import org.jetbrains.kotlin.config.IncrementalCompilation
|
||||
import org.jetbrains.kotlin.utils.Printer
|
||||
import java.io.File
|
||||
|
||||
class KotlinModuleXmlBuilder {
|
||||
private val xml = StringBuilder()
|
||||
private val p = Printer(xml)
|
||||
private var done = false
|
||||
|
||||
init {
|
||||
openTag(p, MODULES)
|
||||
}
|
||||
|
||||
fun addModule(
|
||||
moduleName: String,
|
||||
outputDir: String,
|
||||
sourceFiles: Iterable<File>,
|
||||
javaSourceRoots: Iterable<JvmSourceRoot>,
|
||||
classpathRoots: Iterable<File>,
|
||||
targetTypeId: String,
|
||||
isTests: Boolean,
|
||||
directoriesToFilterOut: Set<File>,
|
||||
friendDirs: Iterable<File>): KotlinModuleXmlBuilder {
|
||||
assert(!done) { "Already done" }
|
||||
|
||||
p.println("<!-- Module script for ${if (isTests) "tests" else "production"} -->")
|
||||
|
||||
p.println("<", MODULE, " ",
|
||||
NAME, "=\"", escapeXml(moduleName), "\" ",
|
||||
TYPE, "=\"", escapeXml(targetTypeId), "\" ",
|
||||
OUTPUT_DIR, "=\"", getEscapedPath(File(outputDir)), "\">")
|
||||
p.pushIndent()
|
||||
|
||||
for (friendDir in friendDirs) {
|
||||
p.println("<", FRIEND_DIR, " ", PATH, "=\"", getEscapedPath(friendDir), "\"/>")
|
||||
}
|
||||
|
||||
for (sourceFile in sourceFiles) {
|
||||
p.println("<", SOURCES, " ", PATH, "=\"", getEscapedPath(sourceFile), "\"/>")
|
||||
}
|
||||
|
||||
processJavaSourceRoots(javaSourceRoots)
|
||||
processClasspath(classpathRoots, directoriesToFilterOut)
|
||||
|
||||
closeTag(p, MODULE)
|
||||
return this
|
||||
}
|
||||
|
||||
private fun processClasspath(
|
||||
files: Iterable<File>,
|
||||
directoriesToFilterOut: Set<File>) {
|
||||
p.println("<!-- Classpath -->")
|
||||
for (file in files) {
|
||||
val isOutput = directoriesToFilterOut.contains(file) && !IncrementalCompilation.isEnabled()
|
||||
if (isOutput) {
|
||||
// For IDEA's make (incremental compilation) purposes, output directories of the current module and its dependencies
|
||||
// appear on the class path, so we are at risk of seeing the results of the previous build, i.e. if some class was
|
||||
// removed in the sources, it may still be there in binaries. Thus, we delete these entries from the classpath.
|
||||
p.println("<!-- Output directory, commented out -->")
|
||||
p.println("<!-- ")
|
||||
p.pushIndent()
|
||||
}
|
||||
|
||||
p.println("<", CLASSPATH, " ", PATH, "=\"", getEscapedPath(file), "\"/>")
|
||||
|
||||
if (isOutput) {
|
||||
p.popIndent()
|
||||
p.println("-->")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun processJavaSourceRoots(roots: Iterable<JvmSourceRoot>) {
|
||||
p.println("<!-- Java source roots -->")
|
||||
for (root in roots) {
|
||||
p.print("<")
|
||||
p.printWithNoIndent(JAVA_SOURCE_ROOTS, " ", PATH, "=\"", getEscapedPath(root.file), "\"")
|
||||
|
||||
if (root.packagePrefix != null) {
|
||||
p.printWithNoIndent(" ", JAVA_SOURCE_PACKAGE_PREFIX, "=\"", root.packagePrefix, "\"")
|
||||
}
|
||||
|
||||
p.printWithNoIndent("/>")
|
||||
p.println()
|
||||
}
|
||||
}
|
||||
|
||||
fun asText(): CharSequence {
|
||||
if (!done) {
|
||||
closeTag(p, MODULES)
|
||||
done = true
|
||||
}
|
||||
return xml
|
||||
}
|
||||
|
||||
private fun openTag(p: Printer, tag: String) {
|
||||
p.println("<$tag>")
|
||||
p.pushIndent()
|
||||
}
|
||||
|
||||
private fun closeTag(p: Printer, tag: String) {
|
||||
p.popIndent()
|
||||
p.println("</$tag>")
|
||||
}
|
||||
|
||||
private fun getEscapedPath(sourceFile: File): String {
|
||||
return escapeXml(toSystemIndependentName(sourceFile.path))
|
||||
}
|
||||
}
|
||||
201
build.xml
201
build.xml
@@ -6,9 +6,6 @@
|
||||
<!-- Set to false to disable compiler's javadoc generation. Speeds up the build -->
|
||||
<property name="generate.javadoc" value="true"/>
|
||||
|
||||
<!-- Set to false to prevent jarjar and metadata stripping on kotlin-reflect.jar and reflection sources. Use to debug reflection -->
|
||||
<property name="obfuscate.reflect" value="true"/>
|
||||
|
||||
<property name="max.heap.size.for.forked.jvm" value="1024m"/>
|
||||
|
||||
<property name="bootstrap.home" value="${basedir}/dependencies/bootstrap-compiler"/>
|
||||
@@ -489,6 +486,7 @@
|
||||
<fileset dir="${output}/classes/compiler"/>
|
||||
<fileset dir="${output}/builtins">
|
||||
<include name="kotlin/**"/>
|
||||
<exclude name="kotlin/internal/**"/>
|
||||
</fileset>
|
||||
<fileset dir="${basedir}/core/descriptor.loader.java/src" includes="META-INF/services/**"/>
|
||||
<fileset dir="${basedir}/compiler/frontend.java/src" includes="META-INF/services/**"/>
|
||||
@@ -552,7 +550,6 @@
|
||||
source="${java.target}" target="${java.target}">
|
||||
<withKotlin modulename="kotlin-compiler"/>
|
||||
<skip pattern="kotlin/jvm/internal/.*"/>
|
||||
<skip pattern="kotlin/Metadata"/>
|
||||
<src refid="compilerSources.path"/>
|
||||
<classpath refid="classpath"/>
|
||||
</javac2>
|
||||
@@ -603,51 +600,6 @@
|
||||
</jar>
|
||||
</target>
|
||||
|
||||
<target name="kotlin-build-common">
|
||||
<cleandir dir="${output}/classes/kotlin-build-common"/>
|
||||
|
||||
<javac2 destdir="${output}/classes/kotlin-build-common" debug="true" debuglevel="lines,vars,source" includeAntRuntime="false"
|
||||
source="${java.target}" target="${java.target}">
|
||||
<withKotlin modulename="kotlin-build-common"/>
|
||||
<skip pattern="kotlin/jvm/internal/.*"/>
|
||||
<src>
|
||||
<pathelement path="build-common/src"/>
|
||||
</src>
|
||||
<classpath>
|
||||
<pathelement path="${bootstrap.runtime}"/>
|
||||
<pathelement path="${bootstrap.reflect}"/>
|
||||
<pathelement path="${idea.sdk}/lib/util.jar"/>
|
||||
<pathelement path="${kotlin-home}/lib/kotlin-compiler.jar"/>
|
||||
</classpath>
|
||||
</javac2>
|
||||
|
||||
<jar destfile="${kotlin-home}/lib/kotlin-build-common.jar">
|
||||
<fileset dir="${output}/classes/kotlin-build-common"/>
|
||||
<zipfileset file="${kotlin-home}/build.txt" prefix="META-INF"/>
|
||||
|
||||
<manifest>
|
||||
<attribute name="Built-By" value="${manifest.impl.vendor}"/>
|
||||
|
||||
<attribute name="Implementation-Vendor" value="${manifest.impl.vendor}"/>
|
||||
<attribute name="Implementation-Title" value="${manifest.impl.title.kotlin.build.common}"/>
|
||||
<attribute name="Implementation-Version" value="${build.number}"/>
|
||||
</manifest>
|
||||
</jar>
|
||||
|
||||
<jar jarfile="${output}/kotlin-build-common-sources.jar">
|
||||
<fileset dir="build-common/src"/>
|
||||
<zipfileset file="${kotlin-home}/build.txt" prefix="META-INF"/>
|
||||
|
||||
<manifest>
|
||||
<attribute name="Built-By" value="${manifest.impl.vendor}"/>
|
||||
|
||||
<attribute name="Implementation-Vendor" value="${manifest.impl.vendor}"/>
|
||||
<attribute name="Implementation-Title" value="${manifest.impl.title.kotlin.build.common.sources}"/>
|
||||
<attribute name="Implementation-Version" value="${build.number}"/>
|
||||
</manifest>
|
||||
</jar>
|
||||
</target>
|
||||
|
||||
<target name="daemon-client">
|
||||
<cleandir dir="${output}/classes/daemon-client"/>
|
||||
|
||||
@@ -667,14 +619,6 @@
|
||||
<fileset dir="${output}/classes/daemon-client"/>
|
||||
<zipfileset src="${dependencies.dir}/native-platform-uberjar.jar" includes="**" />
|
||||
<zipfileset file="${kotlin-home}/build.txt" prefix="META-INF"/>
|
||||
|
||||
<manifest>
|
||||
<attribute name="Built-By" value="${manifest.impl.vendor}"/>
|
||||
|
||||
<attribute name="Implementation-Vendor" value="${manifest.impl.vendor}"/>
|
||||
<attribute name="Implementation-Title" value="${manifest.impl.title.kotlin.daemon-client}"/>
|
||||
<attribute name="Implementation-Version" value="${build.number}"/>
|
||||
</manifest>
|
||||
</jar>
|
||||
</target>
|
||||
|
||||
@@ -683,7 +627,6 @@
|
||||
<javac2 destdir="${output}/classes/android-compiler-plugin" debug="true" debuglevel="lines,vars,source" includeAntRuntime="false">
|
||||
<withKotlin modulename="kotlin-android-compiler-plugin"/>
|
||||
<skip pattern="kotlin/jvm/internal/.*"/>
|
||||
<skip pattern="kotlin/Metadata"/>
|
||||
<src>
|
||||
<pathelement path="plugins/android-compiler-plugin/src"/>
|
||||
</src>
|
||||
@@ -708,7 +651,6 @@
|
||||
source="${java.target}" target="${java.target}">
|
||||
<withKotlin modulename="kotlin-ant-tools"/>
|
||||
<skip pattern="kotlin/jvm/internal/.*"/>
|
||||
<skip pattern="kotlin/Metadata"/>
|
||||
<src>
|
||||
<dirset dir="${basedir}/ant">
|
||||
<include name="src"/>
|
||||
@@ -740,6 +682,30 @@
|
||||
</jar>
|
||||
</target>
|
||||
|
||||
<target name="jdk-annotations">
|
||||
<jar destfile="${kotlin-home}/lib/kotlin-jdk-annotations.jar">
|
||||
<manifest>
|
||||
<attribute name="Built-By" value="${manifest.impl.vendor}"/>
|
||||
|
||||
<attribute name="Implementation-Vendor" value="${manifest.impl.vendor}"/>
|
||||
<attribute name="Implementation-Title" value="${manifest.impl.title.kotlin.jdk.annotations}"/>
|
||||
<attribute name="Implementation-Version" value="${build.number}"/>
|
||||
</manifest>
|
||||
</jar>
|
||||
</target>
|
||||
|
||||
<target name="android-sdk-annotations">
|
||||
<jar destfile="${kotlin-home}/lib/kotlin-android-sdk-annotations.jar">
|
||||
<manifest>
|
||||
<attribute name="Built-By" value="${manifest.impl.vendor}"/>
|
||||
|
||||
<attribute name="Implementation-Vendor" value="${manifest.impl.vendor}"/>
|
||||
<attribute name="Implementation-Title" value="${manifest.impl.title.kotlin.android.sdk.annotations}"/>
|
||||
<attribute name="Implementation-Version" value="${build.number}"/>
|
||||
</manifest>
|
||||
</jar>
|
||||
</target>
|
||||
|
||||
<macrodef name="new-kotlinc">
|
||||
<attribute name="output"/>
|
||||
<attribute name="moduleName"/>
|
||||
@@ -781,13 +747,11 @@
|
||||
<arg value="${toString:classpath.path}"/>
|
||||
<arg value="-module-name"/>
|
||||
<arg value="@{moduleName}"/>
|
||||
<arg value="-Xallow-kotlin-package"/>
|
||||
</java>
|
||||
|
||||
<javac2 srcdir="${toString:src.dirset}" destdir="@{output}" debug="true" debuglevel="lines,vars,source"
|
||||
includeAntRuntime="false" source="${java.target}" target="${java.target}">
|
||||
<skip pattern="kotlin/jvm/internal/.*"/>
|
||||
<skip pattern="kotlin/Metadata"/>
|
||||
<classpath>
|
||||
<path refid="classpath.path"/>
|
||||
<!-- Include @{output} here for Java compiler to resolve symbols from Kotlin sources -->
|
||||
@@ -834,7 +798,7 @@
|
||||
</target>
|
||||
|
||||
<target name="stdlib">
|
||||
<new-kotlinc output="${output}/classes/stdlib" moduleName="kotlin-stdlib">
|
||||
<new-kotlinc output="${output}/classes/stdlib" moduleName="kotlin-stdlib" additionalOptions="-Xmultifile-facades-open">
|
||||
<src>
|
||||
<include name="libraries/stdlib/src"/>
|
||||
</src>
|
||||
@@ -844,8 +808,8 @@
|
||||
</new-kotlinc>
|
||||
</target>
|
||||
|
||||
<target name="kotlin-test">
|
||||
<new-kotlinc output="${output}/classes/kotlin-test" moduleName="kotlin-test">
|
||||
<target name="kotlin.test">
|
||||
<new-kotlinc output="${output}/classes/kotlin.test" moduleName="kotlin-test">
|
||||
<src>
|
||||
<include name="libraries/kotlin.test/shared/src/main/kotlin" />
|
||||
<include name="libraries/kotlin.test/shared/src/main/kotlin.jvm" />
|
||||
@@ -856,12 +820,6 @@
|
||||
<pathelement path="libraries/lib/junit-4.11.jar"/>
|
||||
</class-path>
|
||||
</new-kotlinc>
|
||||
|
||||
<pack-runtime-jar jar-name="kotlin-test.jar" implementation-title="${manifest.impl.title.kotlin.test}">
|
||||
<jar-content>
|
||||
<fileset dir="${output}/classes/kotlin-test" includes="**/*" excludes="kotlin/internal/OnlyInputTypes*,kotlin/internal"/>
|
||||
</jar-content>
|
||||
</pack-runtime-jar>
|
||||
</target>
|
||||
|
||||
<target name="core">
|
||||
@@ -926,6 +884,7 @@
|
||||
<fileset dir="${output}/classes/stdlib"/>
|
||||
<zipfileset dir="${output}/builtins">
|
||||
<include name="kotlin/**"/>
|
||||
<exclude name="kotlin/internal/**"/>
|
||||
<!-- TODO: load metadata from @KotlinClass annotation in KotlinBuiltIns on JVM and restore this exclusion -->
|
||||
<!-- exclude name="kotlin/reflect/**"/ -->
|
||||
</zipfileset>
|
||||
@@ -949,46 +908,31 @@
|
||||
</jar>
|
||||
|
||||
<delete file="${output}/kotlin-reflect-jarjar.jar" failonerror="false"/>
|
||||
<taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask" classpath="dependencies/jarjar.jar"/>
|
||||
<jarjar jarfile="${output}/kotlin-reflect-jarjar.jar" filesonly="true" filesetmanifest="merge">
|
||||
<zipfileset src="${output}/kotlin-reflect-before-jarjar.jar"/>
|
||||
<rule pattern="org.jetbrains.kotlin.**" result="kotlin.reflect.jvm.internal.impl.@1"/>
|
||||
<rule pattern="com.google.protobuf.**" result="kotlin.reflect.jvm.internal.impl.com.google.protobuf.@1"/>
|
||||
<rule pattern="javax.inject.**" result="kotlin.reflect.jvm.internal.impl.javax.inject.@1"/>
|
||||
</jarjar>
|
||||
|
||||
<sequential if:true="${obfuscate.reflect}">
|
||||
<taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask" classpath="dependencies/jarjar.jar"/>
|
||||
<jarjar jarfile="${output}/kotlin-reflect-jarjar.jar" filesonly="true" filesetmanifest="merge">
|
||||
<zipfileset src="${output}/kotlin-reflect-before-jarjar.jar"/>
|
||||
<rule pattern="org.jetbrains.kotlin.**" result="kotlin.reflect.jvm.internal.impl.@1"/>
|
||||
<rule pattern="com.google.protobuf.**" result="kotlin.reflect.jvm.internal.impl.com.google.protobuf.@1"/>
|
||||
<rule pattern="javax.inject.**" result="kotlin.reflect.jvm.internal.impl.javax.inject.@1"/>
|
||||
</jarjar>
|
||||
|
||||
<kotlinc src="${basedir}/generators/infrastructure/strip-kotlin-annotations.kts" output="">
|
||||
<compilerarg value="-script"/>
|
||||
<compilerarg value="kotlin/jvm/internal/.*|kotlin/Metadata"/> <!-- Annotations to strip -->
|
||||
<compilerarg value="kotlin/reflect/jvm/internal/impl/.*"/> <!-- Classes to strip from -->
|
||||
<compilerarg value="${output}/kotlin-reflect-jarjar.jar"/>
|
||||
<compilerarg value="${kotlin-home}/lib/kotlin-reflect.jar"/>
|
||||
<classpath>
|
||||
<pathelement location="${idea.sdk}/lib/asm-all.jar"/>
|
||||
</classpath>
|
||||
</kotlinc>
|
||||
</sequential>
|
||||
|
||||
<sequential unless:true="${obfuscate.reflect}">
|
||||
<echo message="Obfuscation of kotlin-reflect is disabled"/>
|
||||
<copy file="${output}/kotlin-reflect-before-jarjar.jar" tofile="${output}/kotlin-reflect-jarjar.jar" overwrite="true"/>
|
||||
<copy file="${output}/kotlin-reflect-before-jarjar.jar" tofile="${kotlin-home}/lib/kotlin-reflect.jar" overwrite="true"/>
|
||||
</sequential>
|
||||
<kotlinc src="${basedir}/generators/infrastructure/strip-kotlin-annotations.kts" output="">
|
||||
<compilerarg value="-script"/>
|
||||
<compilerarg value="kotlin/jvm/internal/.*"/> <!-- Annotations to strip -->
|
||||
<compilerarg value="kotlin/reflect/jvm/internal/impl/.*"/> <!-- Classes to strip from -->
|
||||
<compilerarg value="${output}/kotlin-reflect-jarjar.jar"/>
|
||||
<compilerarg value="${kotlin-home}/lib/kotlin-reflect.jar"/>
|
||||
<classpath>
|
||||
<pathelement location="${idea.sdk}/lib/asm-all.jar"/>
|
||||
</classpath>
|
||||
</kotlinc>
|
||||
</target>
|
||||
|
||||
<target name="pack-runtime-sources">
|
||||
|
||||
<!-- Rename packages in the sources of reflection impl (core) -->
|
||||
<delete dir="${output}/core.src" failonerror="false"/>
|
||||
|
||||
<local name="runtime.sources.base.dir"/>
|
||||
<condition property="runtime.sources.base.dir"
|
||||
value="${output}/core.src/kotlin/reflect/jvm/internal/impl"
|
||||
else="${output}/core.src/org/jetbrains/kotlin">
|
||||
<istrue value="${obfuscate.reflect}"/>
|
||||
</condition>
|
||||
|
||||
<copy todir="${runtime.sources.base.dir}">
|
||||
<copy todir="${output}/core.src/kotlin/reflect/jvm/internal/impl">
|
||||
<fileset dir="core">
|
||||
<include name="descriptor.loader.java/src/**"/>
|
||||
<include name="descriptors/src/**"/>
|
||||
@@ -998,13 +942,9 @@
|
||||
</fileset>
|
||||
<cutdirsmapper dirs="5"/> <!-- module/src/org/jetbrains/kotlin -->
|
||||
</copy>
|
||||
|
||||
<sequential if:true="${obfuscate.reflect}">
|
||||
<!-- Rename packages in the sources of reflection impl (core) -->
|
||||
<replaceregexp match="org\.jetbrains\.kotlin" replace="kotlin.reflect.jvm.internal.impl" flags="g">
|
||||
<fileset dir="${output}/core.src"/>
|
||||
</replaceregexp>
|
||||
</sequential>
|
||||
<replaceregexp match="org\.jetbrains\.kotlin" replace="kotlin.reflect.jvm.internal.impl" flags="g">
|
||||
<fileset dir="${output}/core.src"/>
|
||||
</replaceregexp>
|
||||
|
||||
<pack-runtime-jar jar-name="kotlin-runtime-sources.jar" implementation-title="${manifest.impl.title.kotlin.jvm.runtime.sources}">
|
||||
<jar-content>
|
||||
@@ -1026,15 +966,23 @@
|
||||
</pack-runtime-jar>
|
||||
</target>
|
||||
|
||||
<target name="pack-kotlin-test">
|
||||
<pack-runtime-jar jar-name="kotlin-test.jar" implementation-title="${manifest.impl.title.kotlin.test}">
|
||||
<jar-content>
|
||||
<fileset dir="${output}/classes/kotlin.test" includes="**/*" excludes="kotlin/internal/OnlyInputTypes*,kotlin/internal"/>
|
||||
</jar-content>
|
||||
</pack-runtime-jar>
|
||||
</target>
|
||||
|
||||
<target name="runtime"
|
||||
depends="builtins,stdlib,kotlin-test,core,reflection,pack-runtime,pack-runtime-sources,mock-runtime-for-test"/>
|
||||
depends="builtins,stdlib,core,reflection,pack-runtime,pack-runtime-sources"/>
|
||||
|
||||
<target name="dist"
|
||||
depends="clean,init,prepare-dist,preloader,runner,serialize-builtins,compiler,compiler-sources,kotlin-build-common,ant-tools,runtime,kotlin-js-stdlib,android-compiler-plugin,daemon-client"
|
||||
depends="clean,init,prepare-dist,preloader,runner,serialize-builtins,compiler,compiler-sources,ant-tools,jdk-annotations,android-sdk-annotations,runtime,kotlin.test,pack-kotlin-test,kotlin-js-stdlib,android-compiler-plugin,daemon-client"
|
||||
description="Builds redistributables from sources"/>
|
||||
|
||||
<target name="dist-quick"
|
||||
depends="clean,init,prepare-dist,preloader,serialize-builtins,compiler-quick,ant-tools,runtime,kotlin-js-stdlib,android-compiler-plugin"
|
||||
depends="clean,init,prepare-dist,preloader,serialize-builtins,compiler-quick,ant-tools,jdk-annotations,android-sdk-annotations,runtime,kotlin.test,pack-kotlin-test,kotlin-js-stdlib,android-compiler-plugin"
|
||||
description="Builds everything, but classes are reused from project out dir, doesn't run proguard and javadoc"/>
|
||||
|
||||
<target name="dist-quick-compiler-only"
|
||||
@@ -1056,7 +1004,6 @@
|
||||
source="${java.target}" target="${java.target}">
|
||||
<withKotlin modulename="kotlin-for-upsource"/>
|
||||
<skip pattern="kotlin/jvm/internal/.*"/>
|
||||
<skip pattern="kotlin/Metadata"/>
|
||||
<src>
|
||||
<dirset dir="${basedir}/idea/ide-common" includes="src"/>
|
||||
<dirset dir="${basedir}/idea/idea-analysis" includes="src"/>
|
||||
@@ -1077,6 +1024,7 @@
|
||||
<fileset dir="${output}/classes/compiler"/>
|
||||
<fileset dir="${output}/builtins">
|
||||
<include name="kotlin/**"/>
|
||||
<exclude name="kotlin/internal/**"/>
|
||||
</fileset>
|
||||
<fileset dir="${basedir}/core/descriptor.loader.java/src" includes="META-INF/services/**"/>
|
||||
<fileset dir="${basedir}/compiler/frontend.java/src" includes="META-INF/services/**"/>
|
||||
@@ -1126,27 +1074,6 @@
|
||||
</zip>
|
||||
</target>
|
||||
|
||||
<target name="mock-runtime-for-test">
|
||||
<delete dir="${output}/mock-runtime-src" failonerror="false"/>
|
||||
<mkdir dir="${output}/mock-runtime-src"/>
|
||||
<copy file="${basedir}/libraries/stdlib/src/kotlin/util/Standard.kt" todir="${output}/mock-runtime-src"/>
|
||||
|
||||
<new-kotlinc output="${output}/classes/mock-runtime" moduleName="kotlin-stdlib">
|
||||
<src>
|
||||
<include name="dist/mock-runtime-src"/>
|
||||
</src>
|
||||
<class-path>
|
||||
<pathelement path="${output}/classes/builtins"/>
|
||||
</class-path>
|
||||
</new-kotlinc>
|
||||
|
||||
<pack-runtime-jar jar-dir="${output}" jar-name="kotlin-mock-runtime-for-test.jar" implementation-title="Kotlin Mock Runtime">
|
||||
<jar-content>
|
||||
<fileset dir="${output}/classes/mock-runtime"/>
|
||||
</jar-content>
|
||||
</pack-runtime-jar>
|
||||
</target>
|
||||
|
||||
<target name="build-bootstrap-artifacts" depends="dist,zip-compiler"/>
|
||||
|
||||
<target name="build-artifacts" depends="dist,zip-compiler,kotlin-for-upsource,zip-test-data"/>
|
||||
|
||||
@@ -27,14 +27,15 @@ import org.jetbrains.kotlin.types.isDynamic
|
||||
import org.jetbrains.kotlin.utils.keysToMapExceptNulls
|
||||
import java.util.Comparator
|
||||
|
||||
object CodegenUtilKt {
|
||||
public object CodegenUtilKt {
|
||||
|
||||
// class Foo : Bar by baz
|
||||
// descriptor = Foo
|
||||
// toInterface = Bar
|
||||
// delegateExpressionType = typeof(baz)
|
||||
// return Map<member of Foo, corresponding member of typeOf(baz)>
|
||||
@JvmStatic fun getDelegates(
|
||||
@JvmStatic
|
||||
public fun getDelegates(
|
||||
descriptor: ClassDescriptor,
|
||||
toInterface: ClassDescriptor,
|
||||
delegateExpressionType: KotlinType? = null
|
||||
|
||||
@@ -19,22 +19,22 @@ package org.jetbrains.kotlin.backend.common.bridges
|
||||
import org.jetbrains.kotlin.utils.DFS
|
||||
import java.util.HashSet
|
||||
|
||||
interface FunctionHandle {
|
||||
val isDeclaration: Boolean
|
||||
val isAbstract: Boolean
|
||||
public interface FunctionHandle {
|
||||
public val isDeclaration: Boolean
|
||||
public val isAbstract: Boolean
|
||||
|
||||
fun getOverridden(): Iterable<FunctionHandle>
|
||||
public fun getOverridden(): Iterable<FunctionHandle>
|
||||
}
|
||||
|
||||
data class Bridge<Signature>(
|
||||
val from: Signature,
|
||||
val to: Signature
|
||||
public data class Bridge<Signature>(
|
||||
public val from: Signature,
|
||||
public val to: Signature
|
||||
) {
|
||||
override fun toString() = "$from -> $to"
|
||||
}
|
||||
|
||||
|
||||
fun <Function : FunctionHandle, Signature> generateBridges(
|
||||
public fun <Function : FunctionHandle, Signature> generateBridges(
|
||||
function: Function,
|
||||
signature: (Function) -> Signature
|
||||
): Set<Bridge<Signature>> {
|
||||
@@ -69,7 +69,7 @@ fun <Function : FunctionHandle, Signature> generateBridges(
|
||||
return bridgesToGenerate.map { Bridge(it, method) }.toSet()
|
||||
}
|
||||
|
||||
fun <Function : FunctionHandle> findAllReachableDeclarations(function: Function): MutableSet<Function> {
|
||||
public fun <Function : FunctionHandle> findAllReachableDeclarations(function: Function): MutableSet<Function> {
|
||||
val collector = object : DFS.NodeHandlerWithListResult<Function, Function>() {
|
||||
override fun afterChildren(current: Function) {
|
||||
if (current.isDeclaration) {
|
||||
@@ -86,7 +86,7 @@ fun <Function : FunctionHandle> findAllReachableDeclarations(function: Function)
|
||||
* Given a concrete function, finds an implementation (a concrete declaration) of this function in the supertypes.
|
||||
* The implementation is guaranteed to exist because if it wouldn't, the given function would've been abstract
|
||||
*/
|
||||
fun <Function : FunctionHandle> findConcreteSuperDeclaration(function: Function): Function {
|
||||
public fun <Function : FunctionHandle> findConcreteSuperDeclaration(function: Function): Function {
|
||||
require(!function.isAbstract, { "Only concrete functions have implementations: $function" })
|
||||
|
||||
if (function.isDeclaration) return function
|
||||
|
||||
@@ -23,7 +23,7 @@ import org.jetbrains.kotlin.resolve.DescriptorUtils
|
||||
import org.jetbrains.kotlin.resolve.OverrideResolver
|
||||
import org.jetbrains.kotlin.resolve.calls.callResolverUtil.isOrOverridesSynthesized
|
||||
|
||||
fun <Signature> generateBridgesForFunctionDescriptor(
|
||||
public fun <Signature> generateBridgesForFunctionDescriptor(
|
||||
descriptor: FunctionDescriptor,
|
||||
signature: (FunctionDescriptor) -> Signature
|
||||
): Set<Bridge<Signature>> {
|
||||
@@ -47,16 +47,16 @@ fun <Signature> generateBridgesForFunctionDescriptor(
|
||||
* can generate a bridge near an implementation (of course, in case it has a super-declaration with a different signature). Ultimately this
|
||||
* eases the process of determining what bridges are already generated in our supertypes and need to be inherited, not regenerated.
|
||||
*/
|
||||
data class DescriptorBasedFunctionHandle(val descriptor: FunctionDescriptor) : FunctionHandle {
|
||||
private val overridden = descriptor.overriddenDescriptors.map { DescriptorBasedFunctionHandle(it.original) }
|
||||
public data class DescriptorBasedFunctionHandle(val descriptor: FunctionDescriptor) : FunctionHandle {
|
||||
private val overridden = descriptor.getOverriddenDescriptors().map { DescriptorBasedFunctionHandle(it.getOriginal()) }
|
||||
|
||||
override val isDeclaration: Boolean =
|
||||
descriptor.kind.isReal ||
|
||||
descriptor.getKind().isReal() ||
|
||||
findTraitImplementation(descriptor) != null
|
||||
|
||||
override val isAbstract: Boolean =
|
||||
descriptor.modality == Modality.ABSTRACT ||
|
||||
DescriptorUtils.isInterface(descriptor.containingDeclaration)
|
||||
descriptor.getModality() == Modality.ABSTRACT ||
|
||||
DescriptorUtils.isInterface(descriptor.getContainingDeclaration())
|
||||
|
||||
override fun getOverridden() = overridden
|
||||
}
|
||||
@@ -67,14 +67,14 @@ data class DescriptorBasedFunctionHandle(val descriptor: FunctionDescriptor) : F
|
||||
* trait implementation should be generated into the class containing the fake override; or null if the given function is not a fake
|
||||
* override of any trait implementation or such method was already generated into the superclass or is a method from Any.
|
||||
*/
|
||||
fun findTraitImplementation(descriptor: CallableMemberDescriptor): CallableMemberDescriptor? {
|
||||
if (descriptor.kind.isReal) return null
|
||||
public fun findTraitImplementation(descriptor: CallableMemberDescriptor): CallableMemberDescriptor? {
|
||||
if (descriptor.getKind().isReal()) return null
|
||||
if (isOrOverridesSynthesized(descriptor)) return null
|
||||
|
||||
val implementation = findImplementationFromInterface(descriptor) ?: return null
|
||||
val immediateConcreteSuper = firstSuperMethodFromKotlin(descriptor, implementation) ?: return null
|
||||
|
||||
if (!DescriptorUtils.isInterface(immediateConcreteSuper.containingDeclaration)) {
|
||||
if (!DescriptorUtils.isInterface(immediateConcreteSuper.getContainingDeclaration())) {
|
||||
// If this implementation is already generated into the superclass, we need not generate it again, it'll be inherited
|
||||
return null
|
||||
}
|
||||
@@ -86,7 +86,7 @@ fun findTraitImplementation(descriptor: CallableMemberDescriptor): CallableMembe
|
||||
* Given a fake override, returns an overridden non-abstract function from an interface which is the actual implementation of this function
|
||||
* that should be called when the given fake override is called.
|
||||
*/
|
||||
fun findImplementationFromInterface(descriptor: CallableMemberDescriptor): CallableMemberDescriptor? {
|
||||
public fun findImplementationFromInterface(descriptor: CallableMemberDescriptor): CallableMemberDescriptor? {
|
||||
val overridden = OverrideResolver.getOverriddenDeclarations(descriptor)
|
||||
val filtered = OverrideResolver.filterOutOverridden(overridden)
|
||||
|
||||
@@ -102,12 +102,12 @@ fun findImplementationFromInterface(descriptor: CallableMemberDescriptor): Calla
|
||||
* returns the first immediate super function of the given fake override which overrides that implementation.
|
||||
* The returned function should be called from TImpl-bridges generated for the given fake override.
|
||||
*/
|
||||
fun firstSuperMethodFromKotlin(
|
||||
public fun firstSuperMethodFromKotlin(
|
||||
descriptor: CallableMemberDescriptor,
|
||||
implementation: CallableMemberDescriptor
|
||||
): CallableMemberDescriptor? {
|
||||
return descriptor.overriddenDescriptors.firstOrNull { overridden ->
|
||||
overridden.modality != Modality.ABSTRACT &&
|
||||
return descriptor.getOverriddenDescriptors().firstOrNull { overridden ->
|
||||
overridden.getModality() != Modality.ABSTRACT &&
|
||||
(overridden == implementation || OverrideResolver.overrides(overridden, implementation))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,24 +18,24 @@ package org.jetbrains.kotlin.backend.common.output
|
||||
|
||||
import java.io.File
|
||||
|
||||
interface OutputFileCollection {
|
||||
fun get(relativePath: String): OutputFile?
|
||||
fun asList(): List<OutputFile>
|
||||
public interface OutputFileCollection {
|
||||
public fun get(relativePath: String): OutputFile?
|
||||
public fun asList(): List<OutputFile>
|
||||
}
|
||||
|
||||
class SimpleOutputFileCollection(private val outputFiles: List<OutputFile>) : OutputFileCollection {
|
||||
public class SimpleOutputFileCollection(private val outputFiles: List<OutputFile>) : OutputFileCollection {
|
||||
override fun get(relativePath: String): OutputFile? = outputFiles.firstOrNull { it.relativePath == relativePath }
|
||||
override fun asList(): List<OutputFile> = outputFiles
|
||||
}
|
||||
|
||||
interface OutputFile {
|
||||
val relativePath: String
|
||||
val sourceFiles: List<File>
|
||||
fun asByteArray(): ByteArray
|
||||
fun asText(): String
|
||||
public interface OutputFile {
|
||||
public val relativePath: String
|
||||
public val sourceFiles: List<File>
|
||||
public fun asByteArray(): ByteArray
|
||||
public fun asText(): String
|
||||
}
|
||||
|
||||
class SimpleOutputFile(
|
||||
public class SimpleOutputFile(
|
||||
override val sourceFiles: List<File>,
|
||||
override val relativePath: String,
|
||||
private val content: String
|
||||
@@ -46,7 +46,7 @@ class SimpleOutputFile(
|
||||
override fun toString() = "$relativePath (compiled from $sourceFiles)"
|
||||
}
|
||||
|
||||
class SimpleOutputBinaryFile(
|
||||
public class SimpleOutputBinaryFile(
|
||||
override val sourceFiles: List<File>,
|
||||
override val relativePath: String,
|
||||
private val content: ByteArray
|
||||
|
||||
@@ -24,18 +24,18 @@ import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
||||
import java.util.*
|
||||
|
||||
open class AbstractAccessorForFunctionDescriptor(
|
||||
open public class AbstractAccessorForFunctionDescriptor(
|
||||
containingDeclaration: DeclarationDescriptor,
|
||||
name: Name
|
||||
) : SimpleFunctionDescriptorImpl(containingDeclaration, null, Annotations.EMPTY,
|
||||
name, CallableMemberDescriptor.Kind.DECLARATION, SourceElement.NO_SOURCE) {
|
||||
|
||||
protected fun copyTypeParameters(descriptor: FunctionDescriptor): List<TypeParameterDescriptor> = descriptor.typeParameters.map {
|
||||
protected fun copyTypeParameters(descriptor: FunctionDescriptor): List<TypeParameterDescriptor> = descriptor.getTypeParameters().map {
|
||||
val copy = TypeParameterDescriptorImpl.createForFurtherModification(
|
||||
this, it.annotations, it.isReified,
|
||||
it.variance, it.name,
|
||||
it.index, SourceElement.NO_SOURCE)
|
||||
for (upperBound in it.upperBounds) {
|
||||
this, it.getAnnotations(), it.isReified(),
|
||||
it.getVariance(), it.getName(),
|
||||
it.getIndex(), SourceElement.NO_SOURCE)
|
||||
for (upperBound in it.getUpperBounds()) {
|
||||
copy.addUpperBound(upperBound)
|
||||
}
|
||||
copy.setInitialized()
|
||||
@@ -43,5 +43,5 @@ open class AbstractAccessorForFunctionDescriptor(
|
||||
}
|
||||
|
||||
protected fun copyValueParameters(descriptor: FunctionDescriptor): List<ValueParameterDescriptor> =
|
||||
descriptor.valueParameters.map { it.copy(this, it.name) }
|
||||
descriptor.getValueParameters().map { it.copy(this, it.getName()) }
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ import org.jetbrains.kotlin.resolve.DescriptorUtils
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
import org.jetbrains.kotlin.types.TypeSubstitutor
|
||||
|
||||
class AccessorForConstructorDescriptor(
|
||||
public class AccessorForConstructorDescriptor(
|
||||
private val calleeDescriptor: ConstructorDescriptor,
|
||||
containingDeclaration: DeclarationDescriptor,
|
||||
private val superCallTarget: ClassDescriptor?
|
||||
|
||||
@@ -108,16 +108,6 @@ public abstract class AnnotationCodegen {
|
||||
"Inconsistent target list for lambda annotation: " + applicableTargets + " on " + annotated;
|
||||
continue;
|
||||
}
|
||||
if (annotated instanceof ClassDescriptor
|
||||
&& !applicableTargets.contains(KotlinTarget.CLASS)
|
||||
&& !applicableTargets.contains(KotlinTarget.ANNOTATION_CLASS)) {
|
||||
ClassDescriptor classDescriptor = (ClassDescriptor) annotated;
|
||||
if (classDescriptor.getVisibility() == Visibilities.LOCAL) {
|
||||
assert applicableTargets.contains(KotlinTarget.EXPRESSION) :
|
||||
"Inconsistent target list for object literal annotation: " + applicableTargets + " on " + annotated;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
String descriptor = genAnnotation(annotation);
|
||||
if (descriptor != null) {
|
||||
|
||||
@@ -31,7 +31,7 @@ abstract class ArgumentGenerator {
|
||||
*
|
||||
* @see kotlin.reflect.jvm.internal.KCallableImpl.callBy
|
||||
*/
|
||||
open fun generate(valueArgumentsByIndex: List<ResolvedValueArgument>, actualArgs: List<ResolvedValueArgument>): DefaultCallArgs {
|
||||
open fun generate(valueArgumentsByIndex: List<ResolvedValueArgument>, actualArgs: List<ResolvedValueArgument>): DefaultCallMask {
|
||||
assert(valueArgumentsByIndex.size == actualArgs.size) {
|
||||
"Value arguments collection should have same size, but ${valueArgumentsByIndex.size} != ${actualArgs.size}"
|
||||
}
|
||||
@@ -40,7 +40,7 @@ abstract class ArgumentGenerator {
|
||||
|
||||
val actualArgsWithDeclIndex = actualArgs.filter { it !is DefaultValueArgument }.map {
|
||||
ArgumentAndDeclIndex(it, arg2Index[it]!!)
|
||||
}.toMutableList()
|
||||
}.toArrayList()
|
||||
|
||||
valueArgumentsByIndex.withIndex().forEach {
|
||||
if (it.value is DefaultValueArgument) {
|
||||
@@ -48,7 +48,7 @@ abstract class ArgumentGenerator {
|
||||
}
|
||||
}
|
||||
|
||||
val defaultArgs = DefaultCallArgs(valueArgumentsByIndex.size)
|
||||
val masks = DefaultCallMask(valueArgumentsByIndex.size)
|
||||
|
||||
for (argumentWithDeclIndex in actualArgsWithDeclIndex) {
|
||||
val argument = argumentWithDeclIndex.arg
|
||||
@@ -59,7 +59,7 @@ abstract class ArgumentGenerator {
|
||||
generateExpression(declIndex, argument)
|
||||
}
|
||||
is DefaultValueArgument -> {
|
||||
defaultArgs.mark(declIndex)
|
||||
masks.mark(declIndex)
|
||||
generateDefault(declIndex, argument)
|
||||
}
|
||||
is VarargValueArgument -> {
|
||||
@@ -73,7 +73,7 @@ abstract class ArgumentGenerator {
|
||||
|
||||
reorderArgumentsIfNeeded(actualArgsWithDeclIndex)
|
||||
|
||||
return defaultArgs
|
||||
return masks
|
||||
}
|
||||
|
||||
protected open fun generateExpression(i: Int, argument: ExpressionValueArgument) {
|
||||
|
||||
@@ -39,6 +39,7 @@ import org.jetbrains.kotlin.lexer.KtTokens;
|
||||
import org.jetbrains.kotlin.load.java.JavaVisibilities;
|
||||
import org.jetbrains.kotlin.load.java.JvmAnnotationNames;
|
||||
import org.jetbrains.kotlin.name.FqName;
|
||||
import org.jetbrains.kotlin.platform.JavaToKotlinClassMap;
|
||||
import org.jetbrains.kotlin.resolve.DeprecationUtilKt;
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils;
|
||||
import org.jetbrains.kotlin.resolve.annotations.AnnotationUtilKt;
|
||||
@@ -268,7 +269,7 @@ public class AsmUtil {
|
||||
}
|
||||
|
||||
public static int getVisibilityAccessFlagForAnonymous(@NotNull ClassDescriptor descriptor) {
|
||||
return InlineUtil.isInlineOrContainingInline(descriptor.getContainingDeclaration()) ? ACC_PUBLIC : NO_FLAG_PACKAGE_PRIVATE;
|
||||
return InlineUtil.isInline(descriptor.getContainingDeclaration()) ? ACC_PUBLIC : NO_FLAG_PACKAGE_PRIVATE;
|
||||
}
|
||||
|
||||
public static int calculateInnerClassAccessFlags(@NotNull ClassDescriptor innerClass) {
|
||||
@@ -323,8 +324,6 @@ public class AsmUtil {
|
||||
DeclarationDescriptor containingDeclaration = memberDescriptor.getContainingDeclaration();
|
||||
Visibility memberVisibility = memberDescriptor.getVisibility();
|
||||
|
||||
if (AnnotationUtilKt.isInlineOnly(memberDescriptor)) return ACC_PRIVATE;
|
||||
|
||||
if (memberVisibility == Visibilities.LOCAL && memberDescriptor instanceof CallableMemberDescriptor) {
|
||||
return ACC_PUBLIC;
|
||||
}
|
||||
@@ -785,25 +784,24 @@ public class AsmUtil {
|
||||
public static void writeKotlinSyntheticClassAnnotation(@NotNull ClassBuilder v, @NotNull GenerationState state) {
|
||||
AnnotationVisitor av = v.newAnnotation(asmDescByFqNameWithoutInnerClasses(KOTLIN_SYNTHETIC_CLASS), true);
|
||||
JvmCodegenUtil.writeAbiVersion(av);
|
||||
JvmCodegenUtil.writeModuleName(av, state);
|
||||
av.visitEnd();
|
||||
}
|
||||
|
||||
public static void writeAnnotationData(
|
||||
@NotNull AnnotationVisitor av,
|
||||
@NotNull DescriptorSerializer serializer,
|
||||
@NotNull MessageLite message,
|
||||
boolean old
|
||||
@NotNull MessageLite message
|
||||
) {
|
||||
byte[] bytes = serializer.serialize(message);
|
||||
|
||||
AnnotationVisitor data = av.visitArray(old ? JvmAnnotationNames.DATA_FIELD_NAME : JvmAnnotationNames.METADATA_DATA_FIELD_NAME);
|
||||
JvmCodegenUtil.writeAbiVersion(av);
|
||||
AnnotationVisitor data = av.visitArray(JvmAnnotationNames.DATA_FIELD_NAME);
|
||||
for (String string : BitEncoding.encodeBytes(bytes)) {
|
||||
data.visit(null, string);
|
||||
}
|
||||
data.visitEnd();
|
||||
AnnotationVisitor strings = av.visitArray(
|
||||
old ? JvmAnnotationNames.STRINGS_FIELD_NAME : JvmAnnotationNames.METADATA_STRINGS_FIELD_NAME
|
||||
);
|
||||
AnnotationVisitor strings = av.visitArray(JvmAnnotationNames.STRINGS_FIELD_NAME);
|
||||
for (String string : ((JvmStringTable) serializer.getStringTable()).getStrings()) {
|
||||
strings.visit(null, string);
|
||||
}
|
||||
|
||||
@@ -147,8 +147,8 @@ open class BranchedValue(
|
||||
}, IFEQ)
|
||||
}
|
||||
|
||||
fun cmp(opToken: IElementType, operandType: Type, left: StackValue, right: StackValue): StackValue =
|
||||
if (operandType.sort == Type.OBJECT)
|
||||
public fun cmp(opToken: IElementType, operandType: Type, left: StackValue, right: StackValue): StackValue =
|
||||
if (operandType.getSort() == Type.OBJECT)
|
||||
ObjectCompare(opToken, operandType, left, right)
|
||||
else
|
||||
NumberCompare(opToken, operandType, left, right)
|
||||
|
||||
@@ -51,15 +51,15 @@ public class CallBasedArgumentGenerator extends ArgumentGenerator {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public DefaultCallArgs generate(
|
||||
public DefaultCallMask generate(
|
||||
@NotNull List<? extends ResolvedValueArgument> valueArgumentsByIndex,
|
||||
@NotNull List<? extends ResolvedValueArgument> valueArgs
|
||||
) {
|
||||
boolean shouldMarkLineNumbers = this.codegen.isShouldMarkLineNumbers();
|
||||
this.codegen.setShouldMarkLineNumbers(false);
|
||||
DefaultCallArgs defaultArgs = super.generate(valueArgumentsByIndex, valueArgs);
|
||||
DefaultCallMask masks = super.generate(valueArgumentsByIndex, valueArgs);
|
||||
this.codegen.setShouldMarkLineNumbers(shouldMarkLineNumbers);
|
||||
return defaultArgs;
|
||||
return masks;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -75,9 +75,10 @@ public class CallBasedArgumentGenerator extends ArgumentGenerator {
|
||||
|
||||
@Override
|
||||
protected void generateDefault(int i, @NotNull DefaultValueArgument argument) {
|
||||
ValueParameterDescriptor parameter = valueParameters.get(i);
|
||||
Type type = valueParameterTypes.get(i);
|
||||
pushDefaultValueOnStack(type, codegen.v);
|
||||
callGenerator.afterParameterPut(type, null, i);
|
||||
callGenerator.afterParameterPut(type, null, parameter, i);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -85,7 +86,7 @@ public class CallBasedArgumentGenerator extends ArgumentGenerator {
|
||||
ValueParameterDescriptor parameter = valueParameters.get(i);
|
||||
Type type = valueParameterTypes.get(i);
|
||||
codegen.genVarargs(argument, parameter.getType());
|
||||
callGenerator.afterParameterPut(type, null, i);
|
||||
callGenerator.afterParameterPut(type, null, parameter, i);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -46,6 +46,7 @@ abstract class CallGenerator {
|
||||
override fun afterParameterPut(
|
||||
type: Type,
|
||||
stackValue: StackValue?,
|
||||
valueParameterDescriptor: ValueParameterDescriptor,
|
||||
parameterIndex: Int) {
|
||||
|
||||
}
|
||||
@@ -69,7 +70,7 @@ abstract class CallGenerator {
|
||||
}
|
||||
|
||||
override fun putValueIfNeeded(
|
||||
parameterType: Type, value: StackValue) {
|
||||
valueParameterDescriptor: ValueParameterDescriptor?, parameterType: Type, value: StackValue) {
|
||||
value.put(value.type, codegen.v)
|
||||
}
|
||||
|
||||
@@ -112,6 +113,7 @@ abstract class CallGenerator {
|
||||
abstract fun afterParameterPut(
|
||||
type: Type,
|
||||
stackValue: StackValue?,
|
||||
valueParameterDescriptor: ValueParameterDescriptor,
|
||||
parameterIndex: Int)
|
||||
|
||||
abstract fun genValueAndPut(
|
||||
@@ -121,6 +123,7 @@ abstract class CallGenerator {
|
||||
parameterIndex: Int)
|
||||
|
||||
abstract fun putValueIfNeeded(
|
||||
valueParameterDescriptor: ValueParameterDescriptor?,
|
||||
parameterType: Type,
|
||||
value: StackValue)
|
||||
|
||||
|
||||
@@ -20,32 +20,32 @@ import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall
|
||||
import org.jetbrains.org.objectweb.asm.Type
|
||||
import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter
|
||||
|
||||
interface Callable {
|
||||
val owner: Type
|
||||
public interface Callable {
|
||||
public val owner: Type
|
||||
|
||||
val dispatchReceiverType: Type?
|
||||
public val dispatchReceiverType: Type?
|
||||
|
||||
val extensionReceiverType: Type?
|
||||
public val extensionReceiverType: Type?
|
||||
|
||||
val generateCalleeType: Type?
|
||||
public val generateCalleeType: Type?
|
||||
|
||||
val valueParameterTypes: List<Type>
|
||||
public val valueParameterTypes: List<Type>
|
||||
|
||||
val parameterTypes: Array<Type>
|
||||
public val parameterTypes: Array<Type>
|
||||
|
||||
val returnType: Type
|
||||
public val returnType: Type
|
||||
|
||||
fun genInvokeInstruction(v: InstructionAdapter)
|
||||
public fun genInvokeInstruction(v: InstructionAdapter)
|
||||
|
||||
fun isStaticCall(): Boolean
|
||||
public fun isStaticCall(): Boolean
|
||||
|
||||
fun invokeMethodWithArguments(resolvedCall: ResolvedCall<*>, receiver: StackValue, codegen: ExpressionCodegen): StackValue {
|
||||
public fun invokeMethodWithArguments(resolvedCall: ResolvedCall<*>, receiver: StackValue, codegen: ExpressionCodegen): StackValue {
|
||||
return StackValue.functionCall(returnType) {
|
||||
codegen.invokeMethodWithArguments(this, resolvedCall, receiver)
|
||||
}
|
||||
}
|
||||
|
||||
fun afterReceiverGeneration(v: InstructionAdapter) {
|
||||
public fun afterReceiverGeneration(v: InstructionAdapter) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter
|
||||
import org.jetbrains.org.objectweb.asm.commons.Method
|
||||
import org.jetbrains.org.objectweb.asm.util.Printer
|
||||
|
||||
class CallableMethod(
|
||||
public class CallableMethod(
|
||||
override val owner: Type,
|
||||
private val defaultImplOwner: Type?,
|
||||
private val defaultMethodDesc: String,
|
||||
@@ -37,47 +37,48 @@ class CallableMethod(
|
||||
override val extensionReceiverType: Type?,
|
||||
override val generateCalleeType: Type?
|
||||
) : Callable {
|
||||
fun getValueParameters(): List<JvmMethodParameterSignature> =
|
||||
signature.valueParameters
|
||||
public fun getValueParameters(): List<JvmMethodParameterSignature> =
|
||||
signature.getValueParameters()
|
||||
|
||||
override val valueParameterTypes: List<Type>
|
||||
get() = signature.valueParameters.filter { it.kind == JvmMethodParameterKind.VALUE }.map { it.asmType }
|
||||
get() = signature.getValueParameters().filter { it.getKind() == JvmMethodParameterKind.VALUE }.map { it.getAsmType() }
|
||||
|
||||
fun getAsmMethod(): Method =
|
||||
signature.asmMethod
|
||||
public fun getAsmMethod(): Method =
|
||||
signature.getAsmMethod()
|
||||
|
||||
override val parameterTypes: Array<Type>
|
||||
get() = getAsmMethod().argumentTypes
|
||||
get() = getAsmMethod().getArgumentTypes()
|
||||
|
||||
|
||||
override fun genInvokeInstruction(v: InstructionAdapter) {
|
||||
v.visitMethodInsn(invokeOpcode, owner.internalName, getAsmMethod().name, getAsmMethod().descriptor)
|
||||
public override fun genInvokeInstruction(v: InstructionAdapter) {
|
||||
v.visitMethodInsn(invokeOpcode, owner.getInternalName(), getAsmMethod().getName(), getAsmMethod().getDescriptor())
|
||||
}
|
||||
|
||||
fun genInvokeDefaultInstruction(v: InstructionAdapter) {
|
||||
public fun genInvokeDefaultInstruction(v: InstructionAdapter) {
|
||||
if (defaultImplOwner == null) {
|
||||
throw IllegalStateException()
|
||||
}
|
||||
|
||||
val method = getAsmMethod()
|
||||
|
||||
if ("<init>".equals(method.name)) {
|
||||
v.visitMethodInsn(INVOKESPECIAL, defaultImplOwner.internalName, "<init>", defaultMethodDesc, false)
|
||||
if ("<init>".equals(method.getName())) {
|
||||
v.aconst(null)
|
||||
v.visitMethodInsn(INVOKESPECIAL, defaultImplOwner.getInternalName(), "<init>", defaultMethodDesc, false)
|
||||
}
|
||||
else {
|
||||
v.visitMethodInsn(INVOKESTATIC, defaultImplOwner.internalName,
|
||||
method.name + JvmAbi.DEFAULT_PARAMS_IMPL_SUFFIX, defaultMethodDesc, false)
|
||||
v.visitMethodInsn(INVOKESTATIC, defaultImplOwner.getInternalName(),
|
||||
method.getName() + JvmAbi.DEFAULT_PARAMS_IMPL_SUFFIX, defaultMethodDesc, false)
|
||||
|
||||
StackValue.coerce(Type.getReturnType(defaultMethodDesc), Type.getReturnType(signature.asmMethod.descriptor), v)
|
||||
}
|
||||
}
|
||||
|
||||
override val returnType: Type
|
||||
get() = signature.returnType
|
||||
get() = signature.getReturnType()
|
||||
|
||||
override fun isStaticCall(): Boolean =
|
||||
invokeOpcode == INVOKESTATIC
|
||||
|
||||
override fun toString(): String =
|
||||
"${Printer.OPCODES[invokeOpcode]} ${owner.internalName}.$signature"
|
||||
"${Printer.OPCODES[invokeOpcode]} ${owner.getInternalName()}.$signature"
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ import org.jetbrains.annotations.TestOnly;
|
||||
import org.jetbrains.kotlin.backend.common.output.OutputFile;
|
||||
import org.jetbrains.kotlin.backend.common.output.OutputFileCollection;
|
||||
import org.jetbrains.kotlin.codegen.state.GenerationState;
|
||||
import org.jetbrains.kotlin.load.kotlin.JvmMetadataVersion;
|
||||
import org.jetbrains.kotlin.load.java.JvmAbi;
|
||||
import org.jetbrains.kotlin.load.kotlin.PackagePartClassUtils;
|
||||
import org.jetbrains.kotlin.load.kotlin.PackageParts;
|
||||
import org.jetbrains.kotlin.name.FqName;
|
||||
@@ -123,7 +123,7 @@ public class ClassFileFactory implements OutputFileCollection {
|
||||
try {
|
||||
ByteArrayOutputStream moduleMapping = new ByteArrayOutputStream(4096);
|
||||
DataOutputStream dataOutStream = new DataOutputStream(moduleMapping);
|
||||
int[] version = JvmMetadataVersion.INSTANCE.toArray();
|
||||
int[] version = JvmAbi.VERSION.toArray();
|
||||
dataOutStream.writeInt(version.length);
|
||||
for (int number : version) {
|
||||
dataOutStream.writeInt(number);
|
||||
|
||||
@@ -25,7 +25,7 @@ import org.jetbrains.kotlin.resolve.jvm.diagnostics.RawSignature
|
||||
import org.jetbrains.org.objectweb.asm.FieldVisitor
|
||||
import org.jetbrains.org.objectweb.asm.MethodVisitor
|
||||
|
||||
abstract class ClassNameCollectionClassBuilderFactory(
|
||||
public abstract class ClassNameCollectionClassBuilderFactory(
|
||||
delegate: ClassBuilderFactory
|
||||
) : DelegatingClassBuilderFactory(delegate) {
|
||||
|
||||
|
||||
@@ -18,8 +18,8 @@ package org.jetbrains.kotlin.codegen;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import kotlin.Unit;
|
||||
import kotlin.collections.CollectionsKt;
|
||||
import kotlin.Unit;
|
||||
import kotlin.jvm.functions.Function1;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -35,7 +35,6 @@ import org.jetbrains.kotlin.descriptors.impl.SimpleFunctionDescriptorImpl;
|
||||
import org.jetbrains.kotlin.incremental.components.NoLookupLocation;
|
||||
import org.jetbrains.kotlin.load.java.JvmAbi;
|
||||
import org.jetbrains.kotlin.load.java.JvmAnnotationNames;
|
||||
import org.jetbrains.kotlin.load.kotlin.header.KotlinClassHeader;
|
||||
import org.jetbrains.kotlin.psi.KtElement;
|
||||
import org.jetbrains.kotlin.resolve.BindingContext;
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils;
|
||||
@@ -60,7 +59,7 @@ import java.util.List;
|
||||
import static org.jetbrains.kotlin.codegen.AsmUtil.*;
|
||||
import static org.jetbrains.kotlin.codegen.ExpressionCodegen.generateClassLiteralReference;
|
||||
import static org.jetbrains.kotlin.codegen.JvmCodegenUtil.isConst;
|
||||
import static org.jetbrains.kotlin.codegen.JvmCodegenUtil.writeAbiVersion;
|
||||
import static org.jetbrains.kotlin.codegen.JvmCodegenUtil.writeModuleName;
|
||||
import static org.jetbrains.kotlin.codegen.binding.CodegenBinding.CLOSURE;
|
||||
import static org.jetbrains.kotlin.codegen.binding.CodegenBinding.asmTypeForAnonymousClass;
|
||||
import static org.jetbrains.kotlin.resolve.jvm.AsmTypes.*;
|
||||
@@ -222,22 +221,16 @@ public class ClosureCodegen extends MemberCodegen<KtElement> {
|
||||
protected void generateKotlinAnnotation() {
|
||||
writeKotlinSyntheticClassAnnotation(v, state);
|
||||
|
||||
final DescriptorSerializer serializer =
|
||||
DescriptorSerializer.createForLambda(new JvmSerializerExtension(v.getSerializationBindings(), state));
|
||||
DescriptorSerializer serializer =
|
||||
DescriptorSerializer.createForLambda(
|
||||
new JvmSerializerExtension(v.getSerializationBindings(), typeMapper, state.getUseTypeTableInSerializer())
|
||||
);
|
||||
|
||||
final ProtoBuf.Function functionProto = serializer.functionProto(funDescriptor).build();
|
||||
|
||||
WriteAnnotationUtilKt.writeKotlinMetadata(v, KotlinClassHeader.Kind.SYNTHETIC_CLASS, new Function1<AnnotationVisitor, Unit>() {
|
||||
@Override
|
||||
public Unit invoke(AnnotationVisitor av) {
|
||||
writeAnnotationData(av, serializer, functionProto, false);
|
||||
return Unit.INSTANCE;
|
||||
}
|
||||
});
|
||||
ProtoBuf.Function functionProto = serializer.functionProto(funDescriptor).build();
|
||||
|
||||
AnnotationVisitor av = v.getVisitor().visitAnnotation(asmDescByFqNameWithoutInnerClasses(JvmAnnotationNames.KOTLIN_FUNCTION), true);
|
||||
writeAbiVersion(av);
|
||||
writeAnnotationData(av, serializer, functionProto, true);
|
||||
writeAnnotationData(av, serializer, functionProto);
|
||||
writeModuleName(av, state);
|
||||
av.visitEnd();
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ import org.jetbrains.kotlin.fileClasses.JvmFileClassUtil
|
||||
import org.jetbrains.kotlin.fileClasses.JvmFileClassesProvider
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
|
||||
class CodegenFileClassesProvider : JvmFileClassesProvider {
|
||||
override fun getFileClassInfo(file: KtFile): JvmFileClassInfo =
|
||||
public class CodegenFileClassesProvider : JvmFileClassesProvider {
|
||||
override public fun getFileClassInfo(file: KtFile): JvmFileClassInfo =
|
||||
JvmFileClassUtil.getFileClassInfoNoResolve(file)
|
||||
}
|
||||
@@ -65,14 +65,14 @@ class CollectionStubMethodGenerator(
|
||||
val (child, typeParameters) = createSyntheticSubclass()
|
||||
// If the original class has any type parameters, we copied them and now we need to substitute types of the newly created type
|
||||
// parameters as arguments for the type parameters of the original class
|
||||
val parentType = newType(descriptor, typeParameters.map { TypeProjectionImpl(it.defaultType) })
|
||||
val parentType = newType(descriptor, typeParameters.map { TypeProjectionImpl(it.getDefaultType()) })
|
||||
|
||||
// Now we need to determine the arguments which should be substituted for the MutableCollection super class. To do that,
|
||||
// we look for type arguments which were substituted in the inheritance of the original class from Collection and use them
|
||||
// to construct the needed MutableCollection type. Since getAllSupertypes() may return several types which correspond to the
|
||||
// Collection class descriptor, we find the most specific one (which is guaranteed to exist by front-end)
|
||||
val readOnlyCollectionType = TypeUtils.getAllSupertypes(parentType).findMostSpecificTypeForClass(readOnlyClass)
|
||||
val mutableCollectionType = newType(mutableClass, readOnlyCollectionType.arguments)
|
||||
val mutableCollectionType = newType(mutableClass, readOnlyCollectionType.getArguments())
|
||||
|
||||
child.addSupertype(parentType)
|
||||
child.addSupertype(mutableCollectionType)
|
||||
@@ -81,10 +81,10 @@ class CollectionStubMethodGenerator(
|
||||
// Bind fake overrides and for each fake override originated from the MutableCollection, save its signature to generate a stub
|
||||
// or save its descriptor to generate all the needed bridges
|
||||
for (method in findFakeOverridesForMethodsFromMutableCollection(child, mutableClass)) {
|
||||
if (method.modality == Modality.ABSTRACT) {
|
||||
if (method.getModality() == Modality.ABSTRACT) {
|
||||
// If the fake override is abstract and it's _declared_ as abstract in the class, skip it because the method is already
|
||||
// present in the bytecode (abstract) and we don't want a duplicate signature error
|
||||
if (method.findOverriddenFromDirectSuperClass(descriptor)?.kind == DECLARATION) continue
|
||||
if (method.findOverriddenFromDirectSuperClass(descriptor)?.getKind() == DECLARATION) continue
|
||||
|
||||
// Otherwise we can safely generate the stub with the substituted signature
|
||||
val signature = method.signature()
|
||||
@@ -160,18 +160,18 @@ class CollectionStubMethodGenerator(
|
||||
|
||||
val collectionClasses = with(descriptor.builtIns) {
|
||||
listOf(
|
||||
pair(collection, mutableCollection),
|
||||
pair(set, mutableSet),
|
||||
pair(list, mutableList),
|
||||
pair(map, mutableMap),
|
||||
pair(mapEntry, mutableMapEntry),
|
||||
pair(iterable, mutableIterable),
|
||||
pair(iterator, mutableIterator),
|
||||
pair(listIterator, mutableListIterator)
|
||||
pair(getCollection(), getMutableCollection()),
|
||||
pair(getSet(), getMutableSet()),
|
||||
pair(getList(), getMutableList()),
|
||||
pair(getMap(), getMutableMap()),
|
||||
pair(getMapEntry(), getMutableMapEntry()),
|
||||
pair(getIterable(), getMutableIterable()),
|
||||
pair(getIterator(), getMutableIterator()),
|
||||
pair(getListIterator(), getMutableListIterator())
|
||||
)
|
||||
}
|
||||
|
||||
val allSuperClasses = TypeUtils.getAllSupertypes(descriptor.defaultType).classes().toHashSet()
|
||||
val allSuperClasses = TypeUtils.getAllSupertypes(descriptor.getDefaultType()).classes().toHashSet()
|
||||
|
||||
val ourSuperCollectionClasses = collectionClasses.filter { pair ->
|
||||
pair.readOnlyClass in allSuperClasses && pair.mutableClass !in allSuperClasses
|
||||
@@ -180,13 +180,13 @@ class CollectionStubMethodGenerator(
|
||||
|
||||
// Filter out built-in classes which are overridden by other built-in classes in the list, to avoid duplicating methods.
|
||||
val redundantClasses = ourSuperCollectionClasses.flatMapTo(HashSet<ClassDescriptor>()) { pair ->
|
||||
pair.readOnlyClass.typeConstructor.supertypes.classes()
|
||||
pair.readOnlyClass.getTypeConstructor().getSupertypes().classes()
|
||||
}
|
||||
return ourSuperCollectionClasses.filter { klass -> klass.readOnlyClass !in redundantClasses }
|
||||
}
|
||||
|
||||
private fun Collection<KotlinType>.classes(): Collection<ClassDescriptor> =
|
||||
this.map { it.constructor.declarationDescriptor as ClassDescriptor }
|
||||
this.map { it.getConstructor().getDeclarationDescriptor() as ClassDescriptor }
|
||||
|
||||
private fun findFakeOverridesForMethodsFromMutableCollection(
|
||||
klass: ClassDescriptor,
|
||||
@@ -212,7 +212,7 @@ class CollectionStubMethodGenerator(
|
||||
}
|
||||
|
||||
private fun Collection<KotlinType>.findMostSpecificTypeForClass(klass: ClassDescriptor): KotlinType {
|
||||
val types = this.filter { it.constructor.declarationDescriptor == klass }
|
||||
val types = this.filter { it.getConstructor().getDeclarationDescriptor() == klass }
|
||||
if (types.isEmpty()) error("No supertype of $klass in $this")
|
||||
if (types.size == 1) return types.first()
|
||||
// Find the first type in the list such that it's a subtype of every other type in that list
|
||||
@@ -222,11 +222,11 @@ class CollectionStubMethodGenerator(
|
||||
}
|
||||
|
||||
private fun createSyntheticSubclass(): Pair<MutableClassDescriptor, List<TypeParameterDescriptor>> {
|
||||
val child = MutableClassDescriptor(descriptor.containingDeclaration, ClassKind.CLASS, false,
|
||||
Name.special("<synthetic inheritor of ${descriptor.name}>"), descriptor.source)
|
||||
child.modality = Modality.FINAL
|
||||
child.visibility = Visibilities.PUBLIC
|
||||
val typeParameters = descriptor.typeConstructor.parameters
|
||||
val child = MutableClassDescriptor(descriptor.getContainingDeclaration(), ClassKind.CLASS, false,
|
||||
Name.special("<synthetic inheritor of ${descriptor.getName()}>"), descriptor.getSource())
|
||||
child.setModality(Modality.FINAL)
|
||||
child.setVisibility(Visibilities.PUBLIC)
|
||||
val typeParameters = descriptor.getTypeConstructor().getParameters()
|
||||
val newTypeParameters = ArrayList<TypeParameterDescriptor>(typeParameters.size)
|
||||
DescriptorSubstitutor.substituteTypeParameters(typeParameters, TypeSubstitution.EMPTY, child, newTypeParameters)
|
||||
child.setTypeParameterDescriptors(typeParameters)
|
||||
@@ -234,7 +234,7 @@ class CollectionStubMethodGenerator(
|
||||
}
|
||||
|
||||
private fun FunctionDescriptor.findOverriddenFromDirectSuperClass(classDescriptor: ClassDescriptor): FunctionDescriptor? {
|
||||
return this.overriddenDescriptors.firstOrNull { it.containingDeclaration == classDescriptor }
|
||||
return this.getOverriddenDescriptors().firstOrNull { it.getContainingDeclaration() == classDescriptor }
|
||||
}
|
||||
|
||||
private fun newType(classDescriptor: ClassDescriptor, typeArguments: List<TypeProjection>): KotlinType {
|
||||
@@ -246,13 +246,13 @@ class CollectionStubMethodGenerator(
|
||||
private fun generateMethodStub(signature: JvmMethodSignature, synthetic: Boolean) {
|
||||
// TODO: investigate if it makes sense to generate abstract stubs in traits
|
||||
var access = ACC_PUBLIC
|
||||
if (descriptor.kind == ClassKind.INTERFACE) access = access or ACC_ABSTRACT
|
||||
if (descriptor.getKind() == ClassKind.INTERFACE) access = access or ACC_ABSTRACT
|
||||
if (synthetic) access = access or ACC_SYNTHETIC
|
||||
|
||||
val asmMethod = signature.asmMethod
|
||||
val genericSignature = if (synthetic) null else signature.genericsSignature
|
||||
val mv = v.newMethod(JvmDeclarationOrigin.NO_ORIGIN, access, asmMethod.name, asmMethod.descriptor, genericSignature, null)
|
||||
if (descriptor.kind != ClassKind.INTERFACE) {
|
||||
val asmMethod = signature.getAsmMethod()
|
||||
val genericSignature = if (synthetic) null else signature.getGenericsSignature()
|
||||
val mv = v.newMethod(JvmDeclarationOrigin.NO_ORIGIN, access, asmMethod.getName(), asmMethod.getDescriptor(), genericSignature, null)
|
||||
if (descriptor.getKind() != ClassKind.INTERFACE) {
|
||||
mv.visitCode()
|
||||
AsmUtil.genThrow(InstructionAdapter(mv), "java/lang/UnsupportedOperationException", "Mutating immutable collection")
|
||||
FunctionCodegen.endVisit(mv, "built-in stub for $signature", null)
|
||||
|
||||
@@ -16,11 +16,10 @@
|
||||
|
||||
package org.jetbrains.kotlin.codegen
|
||||
|
||||
import org.jetbrains.kotlin.resolve.jvm.AsmTypes
|
||||
import org.jetbrains.org.objectweb.asm.Type
|
||||
import java.util.*
|
||||
|
||||
class DefaultCallArgs(val size: Int) {
|
||||
class DefaultCallMask(val size: Int) {
|
||||
|
||||
val bits: BitSet = BitSet(size)
|
||||
|
||||
@@ -51,15 +50,10 @@ class DefaultCallArgs(val size: Int) {
|
||||
return masks
|
||||
}
|
||||
|
||||
fun generateOnStackIfNeeded(callGenerator: CallGenerator, isConstructor: Boolean): Boolean {
|
||||
public fun generateOnStackIfNeeded(callGenerator: CallGenerator): Boolean {
|
||||
val toInts = toInts()
|
||||
if (!toInts.isEmpty()) {
|
||||
for (mask in toInts) {
|
||||
callGenerator.putValueIfNeeded(Type.INT_TYPE, StackValue.constant(mask, Type.INT_TYPE))
|
||||
}
|
||||
|
||||
val parameterType = if (isConstructor) AsmTypes.DEFAULT_CONSTRUCTOR_MARKER else AsmTypes.OBJECT_TYPE
|
||||
callGenerator.putValueIfNeeded(parameterType, StackValue.constant(null, parameterType))
|
||||
for (mask in toInts) {
|
||||
callGenerator.putValueIfNeeded(null, Type.INT_TYPE, StackValue.constant(mask, Type.INT_TYPE))
|
||||
}
|
||||
return toInts.isNotEmpty();
|
||||
}
|
||||
@@ -33,7 +33,7 @@ import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter
|
||||
* Generates Java overloads for functions and constructors that have the default
|
||||
* parameter values substituted.
|
||||
*/
|
||||
class DefaultParameterValueSubstitutor(val state: GenerationState) {
|
||||
public class DefaultParameterValueSubstitutor(val state: GenerationState) {
|
||||
/**
|
||||
* If all of the parameters of the specified constructor declare default values,
|
||||
* generates a no-argument constructor that passes default values for all arguments.
|
||||
@@ -118,19 +118,19 @@ class DefaultParameterValueSubstitutor(val state: GenerationState) {
|
||||
val typeMapper = state.typeMapper
|
||||
val isStatic = AsmUtil.isStaticMethod(contextKind, functionDescriptor)
|
||||
val flags = AsmUtil.getVisibilityAccessFlag(functionDescriptor) or (if (isStatic) Opcodes.ACC_STATIC else 0)
|
||||
val remainingParameters = getRemainingParameters(functionDescriptor.original, substituteCount)
|
||||
val remainingParameters = getRemainingParameters(functionDescriptor.getOriginal(), substituteCount)
|
||||
val signature = typeMapper.mapSignature(functionDescriptor, contextKind, remainingParameters)
|
||||
val mv = classBuilder.newMethod(OtherOrigin(methodElement, functionDescriptor), flags,
|
||||
signature.asmMethod.name,
|
||||
signature.asmMethod.descriptor,
|
||||
signature.genericsSignature,
|
||||
signature.getAsmMethod().getName(),
|
||||
signature.getAsmMethod().getDescriptor(),
|
||||
signature.getGenericsSignature(),
|
||||
FunctionCodegen.getThrownExceptions(functionDescriptor, typeMapper))
|
||||
|
||||
AnnotationCodegen.forMethod(mv, typeMapper).genAnnotations(functionDescriptor, signature.returnType)
|
||||
AnnotationCodegen.forMethod(mv, typeMapper).genAnnotations(functionDescriptor, signature.getReturnType())
|
||||
|
||||
remainingParameters.withIndex().forEach {
|
||||
val annotationCodegen = AnnotationCodegen.forParameter(it.index, mv, typeMapper)
|
||||
annotationCodegen.genAnnotations(it.value, signature.valueParameters[it.index].asmType)
|
||||
annotationCodegen.genAnnotations(it.value, signature.getValueParameters()[it.index].getAsmType())
|
||||
}
|
||||
|
||||
if (state.classBuilderMode == ClassBuilderMode.LIGHT_CLASSES) {
|
||||
@@ -148,14 +148,14 @@ class DefaultParameterValueSubstitutor(val state: GenerationState) {
|
||||
v.load(thisIndex, methodOwner) // Load this on stack
|
||||
}
|
||||
else {
|
||||
val delegateOwner = delegateFunctionDescriptor.containingDeclaration
|
||||
if (delegateOwner is ClassDescriptor && delegateOwner.isCompanionObject) {
|
||||
val delegateOwner = delegateFunctionDescriptor.getContainingDeclaration()
|
||||
if (delegateOwner is ClassDescriptor && delegateOwner.isCompanionObject()) {
|
||||
val singletonValue = StackValue.singleton(delegateOwner, typeMapper)
|
||||
singletonValue.put(singletonValue.type, v);
|
||||
}
|
||||
}
|
||||
|
||||
val receiver = functionDescriptor.extensionReceiverParameter
|
||||
val receiver = functionDescriptor.getExtensionReceiverParameter()
|
||||
if (receiver != null) {
|
||||
val receiverType = typeMapper.mapType(receiver)
|
||||
val receiverIndex = frameMap.enter(receiver, receiverType)
|
||||
@@ -167,8 +167,8 @@ class DefaultParameterValueSubstitutor(val state: GenerationState) {
|
||||
|
||||
var mask = 0
|
||||
val masks = arrayListOf<Int>()
|
||||
for (parameterDescriptor in functionDescriptor.valueParameters) {
|
||||
val paramType = typeMapper.mapType(parameterDescriptor.type)
|
||||
for (parameterDescriptor in functionDescriptor.getValueParameters()) {
|
||||
val paramType = typeMapper.mapType(parameterDescriptor.getType())
|
||||
if (parameterDescriptor in remainingParameters) {
|
||||
val index = frameMap.getIndex(parameterDescriptor)
|
||||
StackValue.local(index, paramType).put(paramType, v)
|
||||
@@ -184,50 +184,50 @@ class DefaultParameterValueSubstitutor(val state: GenerationState) {
|
||||
}
|
||||
}
|
||||
masks.add(mask)
|
||||
|
||||
for (m in masks) {
|
||||
v.iconst(m)
|
||||
}
|
||||
|
||||
// for default constructors: just marks default constructor (see DEFAULT_CONSTRUCTOR_MARKER)
|
||||
// for default methods: contains MethodHandle for super calls ('null' cause not super call)
|
||||
v.aconst(null)
|
||||
// constructors with default arguments has last synthetic argument of specific type
|
||||
if (functionDescriptor is ConstructorDescriptor) {
|
||||
v.aconst(null)
|
||||
}
|
||||
|
||||
val defaultMethod = typeMapper.mapDefaultMethod(delegateFunctionDescriptor, contextKind)
|
||||
if (functionDescriptor is ConstructorDescriptor) {
|
||||
v.invokespecial(methodOwner.internalName, defaultMethod.name, defaultMethod.descriptor, false)
|
||||
v.invokespecial(methodOwner.getInternalName(), defaultMethod.getName(), defaultMethod.getDescriptor(), false)
|
||||
}
|
||||
else {
|
||||
v.invokestatic(methodOwner.internalName, defaultMethod.name, defaultMethod.descriptor, false)
|
||||
v.invokestatic(methodOwner.getInternalName(), defaultMethod.getName(), defaultMethod.getDescriptor(), false)
|
||||
}
|
||||
v.areturn(signature.returnType)
|
||||
v.areturn(signature.getReturnType())
|
||||
FunctionCodegen.endVisit(mv, null, methodElement)
|
||||
}
|
||||
|
||||
private fun getRemainingParameters(functionDescriptor: FunctionDescriptor,
|
||||
substituteCount: Int): List<ValueParameterDescriptor> {
|
||||
var remainingCount = functionDescriptor.countDefaultParameters() - substituteCount
|
||||
return functionDescriptor.valueParameters.filter { !it.declaresDefaultValue() || --remainingCount >= 0 }
|
||||
return functionDescriptor.getValueParameters().filter { !it.declaresDefaultValue() || --remainingCount >= 0 }
|
||||
}
|
||||
|
||||
private fun isEmptyConstructorNeeded(constructorDescriptor: ConstructorDescriptor, classOrObject: KtClassOrObject): Boolean {
|
||||
val classDescriptor = constructorDescriptor.containingDeclaration
|
||||
if (classDescriptor.kind != ClassKind.CLASS) return false
|
||||
val classDescriptor = constructorDescriptor.getContainingDeclaration()
|
||||
if (classDescriptor.getKind() != ClassKind.CLASS) return false
|
||||
|
||||
if (classOrObject.isLocal()) return false
|
||||
|
||||
if (CodegenBinding.canHaveOuter(state.bindingContext, classDescriptor)) return false
|
||||
|
||||
if (Visibilities.isPrivate(classDescriptor.visibility) || Visibilities.isPrivate(constructorDescriptor.visibility))
|
||||
if (Visibilities.isPrivate(classDescriptor.getVisibility()) || Visibilities.isPrivate(constructorDescriptor.getVisibility()))
|
||||
return false
|
||||
|
||||
if (constructorDescriptor.valueParameters.isEmpty()) return false
|
||||
if (constructorDescriptor.getValueParameters().isEmpty()) return false
|
||||
if (classOrObject is KtClass && hasSecondaryConstructorsWithNoParameters(classOrObject)) return false
|
||||
|
||||
return constructorDescriptor.valueParameters.all { it.declaresDefaultValue() }
|
||||
return constructorDescriptor.getValueParameters().all { it.declaresDefaultValue() }
|
||||
}
|
||||
|
||||
private fun hasSecondaryConstructorsWithNoParameters(klass: KtClass) =
|
||||
klass.getSecondaryConstructors().any { it.valueParameters.isEmpty() }
|
||||
klass.getSecondaryConstructors().any { it.getValueParameters().isEmpty() }
|
||||
|
||||
}
|
||||
|
||||
@@ -25,18 +25,18 @@ import org.jetbrains.kotlin.resolve.jvm.diagnostics.RawSignature
|
||||
import org.jetbrains.org.objectweb.asm.FieldVisitor
|
||||
import org.jetbrains.org.objectweb.asm.MethodVisitor
|
||||
|
||||
abstract class DelegatingClassBuilderFactory(
|
||||
public abstract class DelegatingClassBuilderFactory(
|
||||
protected val delegate: ClassBuilderFactory
|
||||
|
||||
) : ClassBuilderFactory by delegate {
|
||||
|
||||
abstract override fun newClassBuilder(origin: JvmDeclarationOrigin): DelegatingClassBuilder
|
||||
|
||||
override fun asBytes(builder: ClassBuilder?): ByteArray? {
|
||||
public override fun asBytes(builder: ClassBuilder?): ByteArray? {
|
||||
return delegate.asBytes((builder as DelegatingClassBuilder).getDelegate())
|
||||
}
|
||||
|
||||
override fun asText(builder: ClassBuilder?): String? {
|
||||
public override fun asText(builder: ClassBuilder?): String? {
|
||||
return delegate.asText((builder as DelegatingClassBuilder).getDelegate())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,9 +24,8 @@ import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.Function;
|
||||
import com.intellij.util.containers.Stack;
|
||||
import kotlin.Pair;
|
||||
import kotlin.Unit;
|
||||
import kotlin.collections.CollectionsKt;
|
||||
import kotlin.Unit;
|
||||
import kotlin.jvm.functions.Function1;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -83,7 +82,6 @@ import org.jetbrains.kotlin.types.KotlinType;
|
||||
import org.jetbrains.kotlin.types.TypeProjection;
|
||||
import org.jetbrains.kotlin.types.TypeUtils;
|
||||
import org.jetbrains.kotlin.types.checker.KotlinTypeChecker;
|
||||
import org.jetbrains.kotlin.types.typesApproximation.CapturedTypeApproximationKt;
|
||||
import org.jetbrains.org.objectweb.asm.Label;
|
||||
import org.jetbrains.org.objectweb.asm.MethodVisitor;
|
||||
import org.jetbrains.org.objectweb.asm.Opcodes;
|
||||
@@ -1066,7 +1064,7 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
|
||||
Type asmLoopRangeType = asmType(loopRangeType);
|
||||
|
||||
Collection<PropertyDescriptor> incrementProp =
|
||||
loopRangeType.getMemberScope().getContributedVariables(Name.identifier("step"), NoLookupLocation.FROM_BACKEND);
|
||||
loopRangeType.getMemberScope().getContributedVariables(Name.identifier("increment"), NoLookupLocation.FROM_BACKEND);
|
||||
assert incrementProp.size() == 1 : loopRangeType + " " + incrementProp.size();
|
||||
incrementType = asmType(incrementProp.iterator().next().getType());
|
||||
|
||||
@@ -2214,11 +2212,9 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
|
||||
StackValue receiver
|
||||
) {
|
||||
Type type = typeMapper.mapType(propertyDescriptor.getOriginal().getType());
|
||||
CallableMethod callableGetter =
|
||||
typeMapper.mapToCallableMethod(context.accessibleDescriptor(propertyDescriptor.getGetMethod(), null), false);
|
||||
CallableMethod callableGetter = typeMapper.mapToCallableMethod(propertyDescriptor.getGetMethod(), false);
|
||||
FunctionDescriptor setMethod = propertyDescriptor.getSetMethod();
|
||||
CallableMethod callableSetter =
|
||||
setMethod != null ? typeMapper.mapToCallableMethod(context.accessibleDescriptor(setMethod, null), false) : null;
|
||||
CallableMethod callableSetter = setMethod != null ? typeMapper.mapToCallableMethod(setMethod, false) : null;
|
||||
return StackValue.property(propertyDescriptor, null, type, false, null, callableGetter, callableSetter, state, receiver);
|
||||
}
|
||||
|
||||
@@ -2298,11 +2294,22 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
|
||||
descriptor = originalIfSamAdapter;
|
||||
}
|
||||
// $default method is not private, so you need no accessor to call it
|
||||
return CallUtilKt.usesDefaultArguments(resolvedCall)
|
||||
return usesDefaultArguments(resolvedCall)
|
||||
? descriptor
|
||||
: context.accessibleDescriptor(descriptor, getSuperCallTarget(resolvedCall.getCall()));
|
||||
}
|
||||
|
||||
private static boolean usesDefaultArguments(@NotNull ResolvedCall<?> resolvedCall) {
|
||||
List<ResolvedValueArgument> valueArguments = resolvedCall.getValueArgumentsByIndex();
|
||||
if (valueArguments == null) return false;
|
||||
|
||||
for (ResolvedValueArgument argument : valueArguments) {
|
||||
if (argument instanceof DefaultValueArgument) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public StackValue invokeFunction(@NotNull ResolvedCall<?> resolvedCall, @NotNull StackValue receiver) {
|
||||
return invokeFunction(resolvedCall.getCall(), resolvedCall, receiver);
|
||||
@@ -2381,8 +2388,7 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
|
||||
@NotNull CallGenerator callGenerator,
|
||||
@NotNull ArgumentGenerator argumentGenerator
|
||||
) {
|
||||
boolean isConstructor = resolvedCall.getResultingDescriptor() instanceof ConstructorDescriptor;
|
||||
if (!isConstructor) { // otherwise already
|
||||
if (!(resolvedCall.getResultingDescriptor() instanceof ConstructorDescriptor)) { // otherwise already
|
||||
receiver = StackValue.receiver(resolvedCall, receiver, this, callableMethod);
|
||||
receiver.put(receiver.type, v);
|
||||
callableMethod.afterReceiverGeneration(v);
|
||||
@@ -2393,7 +2399,7 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
|
||||
List<ResolvedValueArgument> valueArguments = resolvedCall.getValueArgumentsByIndex();
|
||||
assert valueArguments != null : "Failed to arrange value arguments by index: " + resolvedCall.getResultingDescriptor();
|
||||
|
||||
DefaultCallArgs defaultArgs =
|
||||
DefaultCallMask masks =
|
||||
argumentGenerator.generate(valueArguments, new ArrayList<ResolvedValueArgument>(resolvedCall.getValueArguments().values()));
|
||||
|
||||
if (tailRecursionCodegen.isTailRecursion(resolvedCall)) {
|
||||
@@ -2401,14 +2407,14 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
|
||||
return;
|
||||
}
|
||||
|
||||
boolean defaultMaskWasGenerated = defaultArgs.generateOnStackIfNeeded(callGenerator, isConstructor);
|
||||
boolean defaultMaskWasGenerated = masks.generateOnStackIfNeeded(callGenerator);
|
||||
|
||||
// Extra constructor marker argument
|
||||
if (callableMethod instanceof CallableMethod) {
|
||||
List<JvmMethodParameterSignature> callableParameters = ((CallableMethod) callableMethod).getValueParameters();
|
||||
for (JvmMethodParameterSignature parameter: callableParameters) {
|
||||
if (parameter.getKind() == JvmMethodParameterKind.CONSTRUCTOR_MARKER) {
|
||||
callGenerator.putValueIfNeeded(parameter.getAsmType(), StackValue.constant(null, parameter.getAsmType()));
|
||||
callGenerator.putValueIfNeeded(null, parameter.getAsmType(), StackValue.constant(null, parameter.getAsmType()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2423,77 +2429,60 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private CallGenerator getOrCreateCallGenerator(
|
||||
protected CallGenerator getOrCreateCallGenerator(
|
||||
@NotNull CallableDescriptor descriptor,
|
||||
@Nullable KtElement callElement,
|
||||
@Nullable TypeParameterMappings typeParameterMappings,
|
||||
boolean isDefaultCompilation
|
||||
@Nullable ReifiedTypeParameterMappings reifiedTypeParameterMappings
|
||||
) {
|
||||
if (callElement == null) return defaultCallGenerator;
|
||||
|
||||
// We should inline callable containing reified type parameters even if inline is disabled
|
||||
// because they may contain something to reify and straight call will probably fail at runtime
|
||||
boolean isInline = (state.isInlineEnabled() || InlineUtil.containsReifiedTypeParameters(descriptor)) &&
|
||||
(InlineUtil.isInline(descriptor) || InlineUtil.isArrayConstructorWithLambda(descriptor));
|
||||
InlineUtil.isInline(descriptor);
|
||||
|
||||
if (!isInline) return defaultCallGenerator;
|
||||
|
||||
FunctionDescriptor original = DescriptorUtils.unwrapFakeOverride((FunctionDescriptor) descriptor.getOriginal());
|
||||
return new InlineCodegen(this, state, original, callElement, typeParameterMappings, isDefaultCompilation);
|
||||
SimpleFunctionDescriptor original = DescriptorUtils.unwrapFakeOverride((SimpleFunctionDescriptor) descriptor.getOriginal());
|
||||
return new InlineCodegen(this, state, original, callElement, reifiedTypeParameterMappings);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected CallGenerator getOrCreateCallGeneratorForDefaultImplBody(@NotNull FunctionDescriptor descriptor, @Nullable KtNamedFunction function) {
|
||||
return getOrCreateCallGenerator(descriptor, function, null, true);
|
||||
public CallGenerator getOrCreateCallGenerator(@NotNull FunctionDescriptor descriptor, @Nullable KtNamedFunction function) {
|
||||
return getOrCreateCallGenerator(descriptor, function, null);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
CallGenerator getOrCreateCallGenerator(@NotNull ResolvedCall<?> resolvedCall) {
|
||||
private CallGenerator getOrCreateCallGenerator(@NotNull ResolvedCall<?> resolvedCall) {
|
||||
Map<TypeParameterDescriptor, KotlinType> typeArguments = resolvedCall.getTypeArguments();
|
||||
TypeParameterMappings mappings = new TypeParameterMappings();
|
||||
ReifiedTypeParameterMappings mappings = new ReifiedTypeParameterMappings();
|
||||
for (Map.Entry<TypeParameterDescriptor, KotlinType> entry : typeArguments.entrySet()) {
|
||||
TypeParameterDescriptor key = entry.getKey();
|
||||
if (!key.isReified()) continue;
|
||||
|
||||
KotlinType type = entry.getValue();
|
||||
|
||||
boolean isReified = key.isReified() || InlineUtil.isArrayConstructorWithLambda(resolvedCall.getResultingDescriptor());
|
||||
|
||||
Pair<TypeParameterDescriptor, ReificationArgument> typeParameterAndReificationArgument = extractReificationArgument(type);
|
||||
if (typeParameterAndReificationArgument == null) {
|
||||
KotlinType approximatedType = CapturedTypeApproximationKt.approximateCapturedTypes(entry.getValue()).getUpper();
|
||||
TypeParameterDescriptor parameterDescriptor = TypeUtils.getTypeParameterDescriptorOrNull(type);
|
||||
if (parameterDescriptor == null) {
|
||||
// type is not generic
|
||||
BothSignatureWriter signatureWriter = new BothSignatureWriter(BothSignatureWriter.Mode.TYPE);
|
||||
Type asmType = typeMapper.mapTypeParameter(approximatedType, signatureWriter);
|
||||
Type asmType = typeMapper.mapTypeParameter(type, signatureWriter);
|
||||
|
||||
mappings.addParameterMappingToType(
|
||||
key.getName().getIdentifier(), approximatedType, asmType, signatureWriter.toString(), isReified
|
||||
key.getName().getIdentifier(),
|
||||
type,
|
||||
asmType,
|
||||
signatureWriter.toString()
|
||||
);
|
||||
}
|
||||
else {
|
||||
mappings.addParameterMappingForFurtherReification(
|
||||
key.getName().getIdentifier(), type, typeParameterAndReificationArgument.getSecond(), isReified
|
||||
);
|
||||
mappings.addParameterMappingToNewParameter(
|
||||
key.getName().getIdentifier(), type,
|
||||
parameterDescriptor.getName().getIdentifier());
|
||||
}
|
||||
}
|
||||
return getOrCreateCallGenerator(
|
||||
resolvedCall.getResultingDescriptor(), resolvedCall.getCall().getCallElement(), mappings, false);
|
||||
}
|
||||
|
||||
|
||||
@Nullable
|
||||
private static Pair<TypeParameterDescriptor, ReificationArgument> extractReificationArgument(@NotNull KotlinType type) {
|
||||
int arrayDepth = 0;
|
||||
boolean isNullable = type.isMarkedNullable();
|
||||
while (KotlinBuiltIns.isArray(type)) {
|
||||
arrayDepth++;
|
||||
type = type.getArguments().get(0).getType();
|
||||
}
|
||||
|
||||
TypeParameterDescriptor parameterDescriptor = TypeUtils.getTypeParameterDescriptorOrNull(type);
|
||||
if (parameterDescriptor == null) return null;
|
||||
|
||||
return new Pair<TypeParameterDescriptor, ReificationArgument>(
|
||||
parameterDescriptor,
|
||||
new ReificationArgument(parameterDescriptor.getName().asString(), isNullable, arrayDepth));
|
||||
resolvedCall.getResultingDescriptor(), resolvedCall.getCall().getCallElement(), mappings
|
||||
);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -3345,7 +3334,7 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
|
||||
Type type = expressionType(expression);
|
||||
if (type.getSort() == Type.ARRAY) {
|
||||
//noinspection ConstantConditions
|
||||
return generateNewArray(expression, bindingContext.getType(expression), resolvedCall);
|
||||
return generateNewArray(expression, bindingContext.getType(expression));
|
||||
}
|
||||
|
||||
return generateConstructorCall(resolvedCall, type);
|
||||
@@ -3391,25 +3380,20 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
|
||||
});
|
||||
}
|
||||
|
||||
public StackValue generateNewArray(
|
||||
@NotNull KtCallExpression expression, @NotNull final KotlinType arrayType, @NotNull ResolvedCall<?> resolvedCall
|
||||
) {
|
||||
List<KtValueArgument> args = expression.getValueArguments();
|
||||
assert args.size() == 1 || args.size() == 2 : "Unknown constructor called: " + args.size() + " arguments";
|
||||
public StackValue generateNewArray(@NotNull KtCallExpression expression, @NotNull final KotlinType arrayType) {
|
||||
assert expression.getValueArguments().size() == 1 : "Size argument expected";
|
||||
|
||||
if (args.size() == 1) {
|
||||
final KtExpression sizeExpression = args.get(0).getArgumentExpression();
|
||||
return StackValue.operation(typeMapper.mapType(arrayType), new Function1<InstructionAdapter, Unit>() {
|
||||
@Override
|
||||
public Unit invoke(InstructionAdapter v) {
|
||||
gen(sizeExpression, Type.INT_TYPE);
|
||||
newArrayInstruction(arrayType);
|
||||
return Unit.INSTANCE;
|
||||
}
|
||||
});
|
||||
}
|
||||
final KtExpression sizeExpression = expression.getValueArguments().get(0).getArgumentExpression();
|
||||
Type type = typeMapper.mapType(arrayType);
|
||||
|
||||
return invokeFunction(resolvedCall, StackValue.none());
|
||||
return StackValue.operation(type, new Function1<InstructionAdapter, Unit>() {
|
||||
@Override
|
||||
public Unit invoke(InstructionAdapter v) {
|
||||
gen(sizeExpression, Type.INT_TYPE);
|
||||
newArrayInstruction(arrayType);
|
||||
return Unit.INSTANCE;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void newArrayInstruction(@NotNull KotlinType arrayType) {
|
||||
@@ -3484,6 +3468,10 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
|
||||
ResolvedCall<FunctionDescriptor> resolvedCall = isGetter ? resolvedGetCall : resolvedSetCall;
|
||||
assert resolvedCall != null : "couldn't find resolved call: " + expression.getText();
|
||||
|
||||
ArgumentGenerator argumentGenerator = new CallBasedArgumentGenerator(
|
||||
this, defaultCallGenerator, resolvedCall.getResultingDescriptor().getValueParameters(), callable.getValueParameterTypes()
|
||||
);
|
||||
|
||||
List<ResolvedValueArgument> valueArguments = resolvedCall.getValueArgumentsByIndex();
|
||||
assert valueArguments != null : "Failed to arrange value arguments by index: " + operationDescriptor;
|
||||
|
||||
@@ -3494,7 +3482,7 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
|
||||
}
|
||||
|
||||
return new StackValue.CollectionElementReceiver(
|
||||
callable, receiver, resolvedGetCall, resolvedSetCall, isGetter, this, valueArguments
|
||||
callable, receiver, resolvedGetCall, resolvedSetCall, isGetter, this, argumentGenerator, valueArguments
|
||||
);
|
||||
}
|
||||
|
||||
@@ -3769,15 +3757,15 @@ The "returned" value of try expression with no finally is either the last expres
|
||||
public void putReifiedOperationMarkerIfTypeIsReifiedParameter(
|
||||
@NotNull KotlinType type, @NotNull ReifiedTypeInliner.OperationKind operationKind
|
||||
) {
|
||||
Pair<TypeParameterDescriptor, ReificationArgument> typeParameterAndReificationArgument = extractReificationArgument(type);
|
||||
if (typeParameterAndReificationArgument != null && typeParameterAndReificationArgument.getFirst().isReified()) {
|
||||
TypeParameterDescriptor typeParameterDescriptor = typeParameterAndReificationArgument.getFirst();
|
||||
TypeParameterDescriptor typeParameterDescriptor = TypeUtils.getTypeParameterDescriptorOrNull(type);
|
||||
if (typeParameterDescriptor != null && typeParameterDescriptor.isReified()) {
|
||||
if (typeParameterDescriptor.getContainingDeclaration() != context.getContextDescriptor()) {
|
||||
parentCodegen.getReifiedTypeParametersUsages().
|
||||
addUsedReifiedParameter(typeParameterDescriptor.getName().asString());
|
||||
}
|
||||
v.iconst(operationKind.getId());
|
||||
v.visitLdcInsn(typeParameterAndReificationArgument.getSecond().asString());
|
||||
boolean putNullableFlag = operationKind.isTypeNullabilityAware() && type.isMarkedNullable();
|
||||
v.visitLdcInsn(typeParameterDescriptor.getName().asString() + (putNullableFlag ? "?" : ""));
|
||||
v.invokestatic(
|
||||
IntrinsicMethods.INTRINSICS_CLASS_NAME, ReifiedTypeInliner.REIFIED_OPERATION_MARKER_METHOD_NAME,
|
||||
Type.getMethodDescriptor(Type.VOID_TYPE, Type.INT_TYPE, Type.getType(String.class)), false
|
||||
|
||||
@@ -47,7 +47,7 @@ public class FrameMap {
|
||||
myVarSizes.remove(descriptor);
|
||||
int oldIndex = myVarIndex.remove(descriptor);
|
||||
if (oldIndex != myMaxIndex) {
|
||||
throw new IllegalStateException("Descriptor can be left only if it is last: " + descriptor);
|
||||
throw new IllegalStateException("descriptor can be left only if it is last");
|
||||
}
|
||||
return oldIndex;
|
||||
}
|
||||
|
||||
@@ -21,14 +21,15 @@ import com.intellij.psi.PsiElement;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.Function;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import kotlin.Unit;
|
||||
import kotlin.jvm.functions.Function1;
|
||||
import kotlin.text.StringsKt;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.backend.common.bridges.Bridge;
|
||||
import org.jetbrains.kotlin.backend.common.bridges.ImplKt;
|
||||
import org.jetbrains.kotlin.codegen.annotation.AnnotatedWithOnlyTargetedAnnotations;
|
||||
import org.jetbrains.kotlin.codegen.context.*;
|
||||
import org.jetbrains.kotlin.codegen.intrinsics.TypeIntrinsics;
|
||||
import org.jetbrains.kotlin.codegen.optimization.OptimizationMethodVisitor;
|
||||
import org.jetbrains.kotlin.codegen.state.GenerationState;
|
||||
import org.jetbrains.kotlin.codegen.state.JetTypeMapper;
|
||||
@@ -58,7 +59,10 @@ import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodParameterSignature
|
||||
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodSignature;
|
||||
import org.jetbrains.kotlin.types.KotlinType;
|
||||
import org.jetbrains.kotlin.types.TypeUtils;
|
||||
import org.jetbrains.org.objectweb.asm.*;
|
||||
import org.jetbrains.org.objectweb.asm.AnnotationVisitor;
|
||||
import org.jetbrains.org.objectweb.asm.Label;
|
||||
import org.jetbrains.org.objectweb.asm.MethodVisitor;
|
||||
import org.jetbrains.org.objectweb.asm.Type;
|
||||
import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter;
|
||||
import org.jetbrains.org.objectweb.asm.commons.Method;
|
||||
import org.jetbrains.org.objectweb.asm.util.TraceMethodVisitor;
|
||||
@@ -673,18 +677,9 @@ public class FunctionCodegen {
|
||||
}
|
||||
else {
|
||||
mv.visitCode();
|
||||
generateDefaultImplBody(owner, functionDescriptor, mv, loadStrategy, function, memberCodegen, defaultMethod);
|
||||
generateDefaultImplBody(owner, functionDescriptor, mv, loadStrategy, function, memberCodegen);
|
||||
endVisit(mv, "default method", getSourceFromDescriptor(functionDescriptor));
|
||||
}
|
||||
|
||||
generateOldDefaultForFun(defaultMethod,
|
||||
JvmDeclarationOriginKt.Synthetic(function, functionDescriptor),
|
||||
flags,
|
||||
getThrownExceptions(functionDescriptor, typeMapper),
|
||||
(owner.getContextKind() == OwnerKind.DEFAULT_IMPLS ?
|
||||
typeMapper.mapDefaultImpls((ClassDescriptor) functionDescriptor.getContainingDeclaration()) :
|
||||
typeMapper.mapImplementationOwner(functionDescriptor)).getInternalName()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -694,8 +689,7 @@ public class FunctionCodegen {
|
||||
@NotNull MethodVisitor mv,
|
||||
@NotNull DefaultParameterValueLoader loadStrategy,
|
||||
@Nullable KtNamedFunction function,
|
||||
@NotNull MemberCodegen<?> parentCodegen,
|
||||
@NotNull Method defaultMethod
|
||||
@NotNull MemberCodegen<?> parentCodegen
|
||||
) {
|
||||
GenerationState state = parentCodegen.state;
|
||||
JvmMethodSignature signature = state.getTypeMapper().mapSignature(functionDescriptor, methodContext.getContextKind());
|
||||
@@ -705,10 +699,7 @@ public class FunctionCodegen {
|
||||
|
||||
ExpressionCodegen codegen = new ExpressionCodegen(mv, frameMap, signature.getReturnType(), methodContext, state, parentCodegen);
|
||||
|
||||
CallGenerator generator = codegen.getOrCreateCallGeneratorForDefaultImplBody(functionDescriptor, function);
|
||||
|
||||
InstructionAdapter iv = new InstructionAdapter(mv);
|
||||
genDefaultSuperCallCheckIfNeeded(iv, defaultMethod);
|
||||
CallGenerator generator = codegen.getOrCreateCallGenerator(functionDescriptor, function);
|
||||
|
||||
loadExplicitArgumentsOnStack(OBJECT_TYPE, isStatic, signature, generator);
|
||||
|
||||
@@ -719,6 +710,8 @@ public class FunctionCodegen {
|
||||
capturedArgumentsCount++;
|
||||
}
|
||||
|
||||
InstructionAdapter iv = new InstructionAdapter(mv);
|
||||
|
||||
int maskIndex = 0;
|
||||
List<ValueParameterDescriptor> valueParameters = functionDescriptor.getValueParameters();
|
||||
for (int index = 0; index < valueParameters.size(); index++) {
|
||||
@@ -741,7 +734,7 @@ public class FunctionCodegen {
|
||||
iv.mark(loadArg);
|
||||
}
|
||||
|
||||
generator.putValueIfNeeded(type, StackValue.local(parameterIndex, type));
|
||||
generator.putValueIfNeeded(parameterDescriptor, type, StackValue.local(parameterIndex, type));
|
||||
}
|
||||
|
||||
CallableMethod method = state.getTypeMapper().mapToCallableMethod(functionDescriptor, false);
|
||||
@@ -751,54 +744,6 @@ public class FunctionCodegen {
|
||||
iv.areturn(signature.getReturnType());
|
||||
}
|
||||
|
||||
private static void genDefaultSuperCallCheckIfNeeded(@NotNull InstructionAdapter iv, @NotNull Method defaultMethod) {
|
||||
String defaultMethodName = defaultMethod.getName();
|
||||
if ("<init>".equals(defaultMethodName)) {
|
||||
return;
|
||||
}
|
||||
Label end = new Label();
|
||||
int handleIndex = (Type.getArgumentsAndReturnSizes(defaultMethod.getDescriptor()) >> 2) - 2; /*-1 for this, and -1 for handle*/
|
||||
iv.load(handleIndex, OBJECT_TYPE);
|
||||
iv.ifnull(end);
|
||||
AsmUtil.genThrow(iv,
|
||||
"java/lang/UnsupportedOperationException",
|
||||
"Super calls with default arguments not supported in this target, function: " +
|
||||
StringsKt.substringBeforeLast(defaultMethodName, JvmAbi.DEFAULT_PARAMS_IMPL_SUFFIX, defaultMethodName));
|
||||
iv.visitLabel(end);
|
||||
}
|
||||
|
||||
private void generateOldDefaultForFun(
|
||||
Method newDefaultMethod,
|
||||
JvmDeclarationOrigin origin,
|
||||
int flags,
|
||||
String[] exceptions,
|
||||
String owner
|
||||
) {
|
||||
if ("<init>".equals(newDefaultMethod.getName())) {
|
||||
return;
|
||||
}
|
||||
String oldSignature = newDefaultMethod.getDescriptor().replaceFirst("Ljava/lang/Object;\\)", ")");
|
||||
MethodVisitor mv = v.newMethod(
|
||||
origin,
|
||||
flags,
|
||||
newDefaultMethod.getName(),
|
||||
oldSignature,
|
||||
null,
|
||||
exceptions
|
||||
);
|
||||
mv.visitCode();
|
||||
int index = 0;
|
||||
InstructionAdapter iv = new InstructionAdapter(mv);
|
||||
for (Type type: Type.getArgumentTypes(oldSignature)) {
|
||||
iv.load(index, type);
|
||||
index += type.getSize();
|
||||
}
|
||||
iv.aconst(null);
|
||||
iv.visitMethodInsn(Opcodes.INVOKESTATIC, owner, newDefaultMethod.getName(), newDefaultMethod.getDescriptor(), false);
|
||||
iv.areturn(newDefaultMethod.getReturnType());
|
||||
mv.visitEnd();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static FrameMap createFrameMap(
|
||||
@NotNull GenerationState state,
|
||||
@@ -838,14 +783,14 @@ public class FunctionCodegen {
|
||||
) {
|
||||
int var = 0;
|
||||
if (!isStatic) {
|
||||
callGenerator.putValueIfNeeded(ownerType, StackValue.local(var, ownerType));
|
||||
callGenerator.putValueIfNeeded(null, ownerType, StackValue.local(var, ownerType));
|
||||
var += ownerType.getSize();
|
||||
}
|
||||
|
||||
for (JvmMethodParameterSignature parameterSignature : signature.getValueParameters()) {
|
||||
if (parameterSignature.getKind() != JvmMethodParameterKind.VALUE) {
|
||||
Type type = parameterSignature.getAsmType();
|
||||
callGenerator.putValueIfNeeded(type, StackValue.local(var, type));
|
||||
callGenerator.putValueIfNeeded(null, type, StackValue.local(var, type));
|
||||
var += type.getSize();
|
||||
}
|
||||
}
|
||||
@@ -973,7 +918,7 @@ public class FunctionCodegen {
|
||||
@NotNull MethodContext context,
|
||||
@NotNull MemberCodegen<?> parentCodegen
|
||||
) {
|
||||
Method delegateToMethod = typeMapper.mapToCallableMethod(delegatedTo, /* superCall = */ false).getAsmMethod();
|
||||
Method delegateToMethod = typeMapper.mapSignature(delegatedTo).getAsmMethod();
|
||||
Method delegateMethod = typeMapper.mapSignature(delegateFunction).getAsmMethod();
|
||||
|
||||
Type[] argTypes = delegateMethod.getArgumentTypes();
|
||||
|
||||
@@ -110,7 +110,7 @@ public class FunctionReferenceGenerationStrategy extends FunctionGenerationStrat
|
||||
if (referencedFunction instanceof ConstructorDescriptor) {
|
||||
if (returnType.getSort() == Type.ARRAY) {
|
||||
//noinspection ConstantConditions
|
||||
result = codegen.generateNewArray(fakeExpression, referencedFunction.getReturnType(), fakeResolvedCall);
|
||||
result = codegen.generateNewArray(fakeExpression, referencedFunction.getReturnType());
|
||||
}
|
||||
else {
|
||||
result = codegen.generateConstructorCall(fakeResolvedCall, returnType);
|
||||
|
||||
@@ -19,8 +19,8 @@ package org.jetbrains.kotlin.codegen;
|
||||
import com.intellij.openapi.progress.ProcessCanceledException;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import kotlin.Unit;
|
||||
import kotlin.collections.CollectionsKt;
|
||||
import kotlin.Unit;
|
||||
import kotlin.jvm.functions.Function0;
|
||||
import kotlin.jvm.functions.Function1;
|
||||
import kotlin.jvm.functions.Function2;
|
||||
@@ -43,8 +43,6 @@ import org.jetbrains.kotlin.lexer.KtTokens;
|
||||
import org.jetbrains.kotlin.load.java.JvmAbi;
|
||||
import org.jetbrains.kotlin.load.java.JvmAnnotationNames;
|
||||
import org.jetbrains.kotlin.load.java.descriptors.JavaCallableMemberDescriptor;
|
||||
import org.jetbrains.kotlin.load.kotlin.header.KotlinClassHeader;
|
||||
import org.jetbrains.kotlin.name.FqName;
|
||||
import org.jetbrains.kotlin.name.Name;
|
||||
import org.jetbrains.kotlin.psi.*;
|
||||
import org.jetbrains.kotlin.resolve.BindingContext;
|
||||
@@ -76,7 +74,6 @@ import org.jetbrains.org.objectweb.asm.commons.Method;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import static org.jetbrains.kotlin.builtins.KotlinBuiltIns.FQ_NAMES;
|
||||
import static org.jetbrains.kotlin.codegen.AsmUtil.*;
|
||||
import static org.jetbrains.kotlin.codegen.JvmCodegenUtil.*;
|
||||
import static org.jetbrains.kotlin.codegen.binding.CodegenBinding.enumEntryNeedSubclass;
|
||||
@@ -249,22 +246,20 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
|
||||
@Override
|
||||
protected void generateKotlinAnnotation() {
|
||||
final DescriptorSerializer serializer =
|
||||
DescriptorSerializer.create(descriptor, new JvmSerializerExtension(v.getSerializationBindings(), state));
|
||||
if (!isTopLevelOrInnerClass(descriptor)) {
|
||||
v.getVisitor().visitAnnotation(asmDescByFqNameWithoutInnerClasses(JvmAnnotationNames.KOTLIN_LOCAL_CLASS), true).visitEnd();
|
||||
}
|
||||
|
||||
final ProtoBuf.Class classProto = serializer.classProto(descriptor).build();
|
||||
DescriptorSerializer serializer =
|
||||
DescriptorSerializer.create(descriptor, new JvmSerializerExtension(
|
||||
v.getSerializationBindings(), typeMapper, state.getUseTypeTableInSerializer()
|
||||
));
|
||||
|
||||
WriteAnnotationUtilKt.writeKotlinMetadata(v, KotlinClassHeader.Kind.CLASS, new Function1<AnnotationVisitor, Unit>() {
|
||||
@Override
|
||||
public Unit invoke(AnnotationVisitor av) {
|
||||
writeAnnotationData(av, serializer, classProto, false);
|
||||
return Unit.INSTANCE;
|
||||
}
|
||||
});
|
||||
ProtoBuf.Class classProto = serializer.classProto(descriptor).build();
|
||||
|
||||
AnnotationVisitor av = v.getVisitor().visitAnnotation(asmDescByFqNameWithoutInnerClasses(JvmAnnotationNames.KOTLIN_CLASS), true);
|
||||
writeAbiVersion(av);
|
||||
writeAnnotationData(av, serializer, classProto, true);
|
||||
writeAnnotationData(av, serializer, classProto);
|
||||
writeModuleName(av, state);
|
||||
av.visitEnd();
|
||||
}
|
||||
|
||||
@@ -280,25 +275,25 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
}
|
||||
}
|
||||
|
||||
private static final Map<FqName, String> KOTLIN_MARKER_INTERFACES = new HashMap<FqName, String>();
|
||||
private static final Map<String, String> KOTLIN_MARKER_INTERFACES = new HashMap<String, String>();
|
||||
static {
|
||||
KOTLIN_MARKER_INTERFACES.put(FQ_NAMES.iterator, "kotlin/jvm/internal/markers/KMappedMarker");
|
||||
KOTLIN_MARKER_INTERFACES.put(FQ_NAMES.iterable, "kotlin/jvm/internal/markers/KMappedMarker");
|
||||
KOTLIN_MARKER_INTERFACES.put(FQ_NAMES.collection, "kotlin/jvm/internal/markers/KMappedMarker");
|
||||
KOTLIN_MARKER_INTERFACES.put(FQ_NAMES.list, "kotlin/jvm/internal/markers/KMappedMarker");
|
||||
KOTLIN_MARKER_INTERFACES.put(FQ_NAMES.listIterator, "kotlin/jvm/internal/markers/KMappedMarker");
|
||||
KOTLIN_MARKER_INTERFACES.put(FQ_NAMES.set, "kotlin/jvm/internal/markers/KMappedMarker");
|
||||
KOTLIN_MARKER_INTERFACES.put(FQ_NAMES.map, "kotlin/jvm/internal/markers/KMappedMarker");
|
||||
KOTLIN_MARKER_INTERFACES.put(FQ_NAMES.mapEntry, "kotlin/jvm/internal/markers/KMappedMarker");
|
||||
KOTLIN_MARKER_INTERFACES.put("kotlin.Iterator", "kotlin/jvm/internal/markers/KMappedMarker");
|
||||
KOTLIN_MARKER_INTERFACES.put("kotlin.Iterable", "kotlin/jvm/internal/markers/KMappedMarker");
|
||||
KOTLIN_MARKER_INTERFACES.put("kotlin.Collection", "kotlin/jvm/internal/markers/KMappedMarker");
|
||||
KOTLIN_MARKER_INTERFACES.put("kotlin.List", "kotlin/jvm/internal/markers/KMappedMarker");
|
||||
KOTLIN_MARKER_INTERFACES.put("kotlin.ListIterator", "kotlin/jvm/internal/markers/KMappedMarker");
|
||||
KOTLIN_MARKER_INTERFACES.put("kotlin.Set", "kotlin/jvm/internal/markers/KMappedMarker");
|
||||
KOTLIN_MARKER_INTERFACES.put("kotlin.Map", "kotlin/jvm/internal/markers/KMappedMarker");
|
||||
KOTLIN_MARKER_INTERFACES.put("kotlin.Map.Entry", "kotlin/jvm/internal/markers/KMappedMarker");
|
||||
|
||||
KOTLIN_MARKER_INTERFACES.put(FQ_NAMES.mutableIterator, "kotlin/jvm/internal/markers/KMutableIterator");
|
||||
KOTLIN_MARKER_INTERFACES.put(FQ_NAMES.mutableIterable, "kotlin/jvm/internal/markers/KMutableIterable");
|
||||
KOTLIN_MARKER_INTERFACES.put(FQ_NAMES.mutableCollection, "kotlin/jvm/internal/markers/KMutableCollection");
|
||||
KOTLIN_MARKER_INTERFACES.put(FQ_NAMES.mutableList, "kotlin/jvm/internal/markers/KMutableList");
|
||||
KOTLIN_MARKER_INTERFACES.put(FQ_NAMES.mutableListIterator, "kotlin/jvm/internal/markers/KMutableListIterator");
|
||||
KOTLIN_MARKER_INTERFACES.put(FQ_NAMES.mutableSet, "kotlin/jvm/internal/markers/KMutableSet");
|
||||
KOTLIN_MARKER_INTERFACES.put(FQ_NAMES.mutableMap, "kotlin/jvm/internal/markers/KMutableMap");
|
||||
KOTLIN_MARKER_INTERFACES.put(FQ_NAMES.mutableMapEntry, "kotlin/jvm/internal/markers/KMutableMap$Entry");
|
||||
KOTLIN_MARKER_INTERFACES.put("kotlin.MutableIterator", "kotlin/jvm/internal/markers/KMutableIterator");
|
||||
KOTLIN_MARKER_INTERFACES.put("kotlin.MutableIterable", "kotlin/jvm/internal/markers/KMutableIterable");
|
||||
KOTLIN_MARKER_INTERFACES.put("kotlin.MutableCollection", "kotlin/jvm/internal/markers/KMutableCollection");
|
||||
KOTLIN_MARKER_INTERFACES.put("kotlin.MutableList", "kotlin/jvm/internal/markers/KMutableList");
|
||||
KOTLIN_MARKER_INTERFACES.put("kotlin.MutableListIterator", "kotlin/jvm/internal/markers/KMutableListIterator");
|
||||
KOTLIN_MARKER_INTERFACES.put("kotlin.MutableSet", "kotlin/jvm/internal/markers/KMutableSet");
|
||||
KOTLIN_MARKER_INTERFACES.put("kotlin.MutableMap", "kotlin/jvm/internal/markers/KMutableMap");
|
||||
KOTLIN_MARKER_INTERFACES.put("kotlin.MutableMap.MutableEntry", "kotlin/jvm/internal/markers/KMutableMap$Entry");
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -328,7 +323,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
String jvmInterfaceInternalName = jvmInterfaceType.getInternalName();
|
||||
superInterfaces.add(jvmInterfaceInternalName);
|
||||
|
||||
FqName kotlinInterfaceName = DescriptorUtils.getFqName(supertype.getConstructor().getDeclarationDescriptor()).toSafe();
|
||||
String kotlinInterfaceName = DescriptorUtils.getFqName(supertype.getConstructor().getDeclarationDescriptor()).asString();
|
||||
String kotlinMarkerInterfaceInternalName = KOTLIN_MARKER_INTERFACES.get(kotlinInterfaceName);
|
||||
if (kotlinMarkerInterfaceInternalName != null) {
|
||||
kotlinMarkerInterfaces.add(kotlinMarkerInterfaceInternalName);
|
||||
|
||||
@@ -23,14 +23,14 @@ import org.jetbrains.kotlin.diagnostics.DiagnosticSink
|
||||
import org.jetbrains.kotlin.diagnostics.Errors
|
||||
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall
|
||||
|
||||
class InlineCycleReporter(val diagnostics: DiagnosticSink) {
|
||||
public class InlineCycleReporter(val diagnostics: DiagnosticSink) {
|
||||
|
||||
val processingFunctions = linkedMapOf<PsiElement, CallableDescriptor>()
|
||||
|
||||
fun enterIntoInlining(call: ResolvedCall<*>?): Boolean {
|
||||
public fun enterIntoInlining(call: ResolvedCall<*>?): Boolean {
|
||||
//null call for default method inlining
|
||||
if (call != null) {
|
||||
val callElement = call.call.callElement
|
||||
val callElement = call.getCall().getCallElement()
|
||||
if (processingFunctions.contains(callElement)) {
|
||||
val cycle = processingFunctions.asSequence().dropWhile { it.key != callElement }
|
||||
cycle.forEach {
|
||||
@@ -38,14 +38,14 @@ class InlineCycleReporter(val diagnostics: DiagnosticSink) {
|
||||
}
|
||||
return false
|
||||
}
|
||||
processingFunctions.put(callElement, call.resultingDescriptor.original)
|
||||
processingFunctions.put(callElement, call.getResultingDescriptor().getOriginal())
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
fun exitFromInliningOf(call: ResolvedCall<*>?) {
|
||||
public fun exitFromInliningOf(call: ResolvedCall<*>?) {
|
||||
if (call != null) {
|
||||
val callElement = call.call.callElement
|
||||
val callElement = call.getCall().getCallElement()
|
||||
processingFunctions.remove(callElement)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ import org.jetbrains.kotlin.codegen.state.GenerationState
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.descriptors.impl.ClassDescriptorImpl
|
||||
import org.jetbrains.kotlin.load.java.JvmAbi
|
||||
import org.jetbrains.kotlin.load.java.JvmAnnotationNames.KOTLIN_INTERFACE_DEFAULT_IMPLS
|
||||
import org.jetbrains.kotlin.load.java.descriptors.JavaMethodDescriptor
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.psi.KtClassOrObject
|
||||
@@ -37,7 +38,7 @@ import org.jetbrains.org.objectweb.asm.MethodVisitor
|
||||
import org.jetbrains.org.objectweb.asm.Opcodes.*
|
||||
import java.util.*
|
||||
|
||||
class InterfaceImplBodyCodegen(
|
||||
public class InterfaceImplBodyCodegen(
|
||||
aClass: KtClassOrObject,
|
||||
context: ClassContext,
|
||||
v: ClassBuilder,
|
||||
@@ -49,11 +50,11 @@ class InterfaceImplBodyCodegen(
|
||||
|
||||
override fun generateDeclaration() {
|
||||
v.defineClass(
|
||||
myClass, V1_6, ACC_PUBLIC or ACC_FINAL or ACC_SUPER,
|
||||
myClass, V1_6, ACC_PUBLIC or ACC_FINAL,
|
||||
typeMapper.mapDefaultImpls(descriptor).internalName,
|
||||
null, "java/lang/Object", ArrayUtil.EMPTY_STRING_ARRAY
|
||||
)
|
||||
v.visitSource(myClass.containingFile.name, null)
|
||||
v.visitSource(myClass.getContainingFile().getName(), null)
|
||||
}
|
||||
|
||||
override fun classForInnerClassRecord(): ClassDescriptor? {
|
||||
@@ -68,12 +69,12 @@ class InterfaceImplBodyCodegen(
|
||||
}
|
||||
|
||||
override fun generateSyntheticParts() {
|
||||
for (memberDescriptor in descriptor.defaultType.memberScope.getContributedDescriptors()) {
|
||||
for (memberDescriptor in descriptor.getDefaultType().getMemberScope().getContributedDescriptors()) {
|
||||
if (memberDescriptor !is CallableMemberDescriptor) continue
|
||||
|
||||
if (memberDescriptor.kind.isReal) continue
|
||||
if (memberDescriptor.visibility == Visibilities.INVISIBLE_FAKE) continue
|
||||
if (memberDescriptor.modality == Modality.ABSTRACT) continue
|
||||
if (memberDescriptor.getKind().isReal()) continue
|
||||
if (memberDescriptor.getVisibility() == Visibilities.INVISIBLE_FAKE) continue
|
||||
if (memberDescriptor.getModality() == Modality.ABSTRACT) continue
|
||||
|
||||
val implementation = findImplementationFromInterface(memberDescriptor) ?: continue
|
||||
|
||||
@@ -81,7 +82,7 @@ class InterfaceImplBodyCodegen(
|
||||
if (implementation is JavaMethodDescriptor) continue
|
||||
|
||||
// We create a copy of the function with kind = DECLARATION so that FunctionCodegen will generate its body
|
||||
val copy = memberDescriptor.copy(memberDescriptor.containingDeclaration, Modality.OPEN, memberDescriptor.visibility,
|
||||
val copy = memberDescriptor.copy(memberDescriptor.getContainingDeclaration(), Modality.OPEN, memberDescriptor.getVisibility(),
|
||||
CallableMemberDescriptor.Kind.DECLARATION, true)
|
||||
|
||||
if (memberDescriptor is FunctionDescriptor) {
|
||||
@@ -89,13 +90,13 @@ class InterfaceImplBodyCodegen(
|
||||
}
|
||||
else if (memberDescriptor is PropertyDescriptor) {
|
||||
implementation as PropertyDescriptor
|
||||
val getter = (copy as PropertyDescriptor).getter
|
||||
val implGetter = implementation.getter
|
||||
val getter = (copy as PropertyDescriptor).getGetter()
|
||||
val implGetter = implementation.getGetter()
|
||||
if (getter != null && implGetter != null) {
|
||||
generateDelegationToSuperTraitImpl(getter, implGetter)
|
||||
}
|
||||
val setter = copy.setter
|
||||
val implSetter = implementation.setter
|
||||
val setter = copy.getSetter()
|
||||
val implSetter = implementation.getSetter()
|
||||
if (setter != null && implSetter != null) {
|
||||
generateDelegationToSuperTraitImpl(setter, implSetter)
|
||||
}
|
||||
@@ -119,7 +120,7 @@ class InterfaceImplBodyCodegen(
|
||||
val iv = codegen.v
|
||||
|
||||
val method = typeMapper.mapToCallableMethod(delegateTo, true)
|
||||
val myParameters = signature.valueParameters
|
||||
val myParameters = signature.getValueParameters()
|
||||
val calleeParameters = method.getValueParameters()
|
||||
|
||||
if (myParameters.size != calleeParameters.size) {
|
||||
@@ -134,14 +135,14 @@ class InterfaceImplBodyCodegen(
|
||||
var k = 0
|
||||
val it = calleeParameters.iterator()
|
||||
for (parameter in myParameters) {
|
||||
val type = parameter.asmType
|
||||
StackValue.local(k, type).put(it.next().asmType, iv)
|
||||
k += type.size
|
||||
val type = parameter.getAsmType()
|
||||
StackValue.local(k, type).put(it.next().getAsmType(), iv)
|
||||
k += type.getSize()
|
||||
}
|
||||
|
||||
method.genInvokeInstruction(iv)
|
||||
StackValue.coerce(method.returnType, signature.returnType, iv)
|
||||
iv.areturn(signature.returnType)
|
||||
StackValue.coerce(method.returnType, signature.getReturnType(), iv)
|
||||
iv.areturn(signature.getReturnType())
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -149,9 +150,8 @@ class InterfaceImplBodyCodegen(
|
||||
override fun generateKotlinAnnotation() {
|
||||
(v as InterfaceImplClassBuilder).stopCounting()
|
||||
|
||||
v.newAnnotation(AsmUtil.asmDescByFqNameWithoutInnerClasses(KOTLIN_INTERFACE_DEFAULT_IMPLS), true).visitEnd()
|
||||
AsmUtil.writeKotlinSyntheticClassAnnotation(v, state)
|
||||
|
||||
writeSyntheticClassMetadata(v);
|
||||
}
|
||||
|
||||
override fun done() {
|
||||
|
||||
@@ -19,8 +19,8 @@ package org.jetbrains.kotlin.codegen;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import kotlin.collections.CollectionsKt;
|
||||
import kotlin.jvm.functions.Function1;
|
||||
import kotlin.text.StringsKt;
|
||||
import kotlin.jvm.functions.Function1;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.codegen.binding.CalculatedClosure;
|
||||
@@ -28,10 +28,11 @@ import org.jetbrains.kotlin.codegen.context.CodegenContext;
|
||||
import org.jetbrains.kotlin.codegen.context.FacadePartWithSourceFile;
|
||||
import org.jetbrains.kotlin.codegen.context.MethodContext;
|
||||
import org.jetbrains.kotlin.codegen.context.RootContext;
|
||||
import org.jetbrains.kotlin.codegen.state.GenerationState;
|
||||
import org.jetbrains.kotlin.codegen.state.JetTypeMapper;
|
||||
import org.jetbrains.kotlin.descriptors.*;
|
||||
import org.jetbrains.kotlin.load.java.JvmAbi;
|
||||
import org.jetbrains.kotlin.load.java.JvmAnnotationNames;
|
||||
import org.jetbrains.kotlin.load.kotlin.JvmMetadataVersion;
|
||||
import org.jetbrains.kotlin.load.kotlin.ModuleMapping;
|
||||
import org.jetbrains.kotlin.load.kotlin.ModuleVisibilityUtilsKt;
|
||||
import org.jetbrains.kotlin.psi.KtFile;
|
||||
@@ -222,6 +223,13 @@ public class JvmCodegenUtil {
|
||||
}
|
||||
|
||||
public static void writeAbiVersion(@NotNull AnnotationVisitor av) {
|
||||
av.visit(JvmAnnotationNames.VERSION_FIELD_NAME, JvmMetadataVersion.INSTANCE.toArray());
|
||||
av.visit(JvmAnnotationNames.VERSION_FIELD_NAME, JvmAbi.VERSION.toArray());
|
||||
}
|
||||
|
||||
public static void writeModuleName(@NotNull AnnotationVisitor av, @NotNull GenerationState state) {
|
||||
String name = state.getModuleName();
|
||||
if (!name.equals(JvmAbi.DEFAULT_MODULE_NAME)) {
|
||||
av.visit(JvmAnnotationNames.MODULE_NAME_FIELD_NAME, name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,14 +79,15 @@ class JvmStaticGenerator(
|
||||
}
|
||||
|
||||
companion object {
|
||||
@JvmStatic fun createStaticFunctionDescriptor(descriptor: FunctionDescriptor): FunctionDescriptor {
|
||||
val memberDescriptor = if (descriptor is PropertyAccessorDescriptor) descriptor.correspondingProperty else descriptor
|
||||
@JvmStatic
|
||||
public fun createStaticFunctionDescriptor(descriptor: FunctionDescriptor): FunctionDescriptor {
|
||||
val memberDescriptor = if (descriptor is PropertyAccessorDescriptor) descriptor.getCorrespondingProperty() else descriptor
|
||||
val copies = CodegenUtil.copyFunctions(
|
||||
memberDescriptor,
|
||||
memberDescriptor,
|
||||
descriptor.containingDeclaration.containingDeclaration,
|
||||
descriptor.modality,
|
||||
descriptor.visibility,
|
||||
descriptor.getContainingDeclaration().getContainingDeclaration(),
|
||||
descriptor.getModality(),
|
||||
descriptor.getVisibility(),
|
||||
CallableMemberDescriptor.Kind.SYNTHESIZED,
|
||||
false
|
||||
)
|
||||
|
||||
@@ -31,7 +31,6 @@ import org.jetbrains.kotlin.diagnostics.DiagnosticUtils
|
||||
import org.jetbrains.kotlin.fileClasses.JvmFileClassUtil
|
||||
import org.jetbrains.kotlin.load.java.JvmAnnotationNames
|
||||
import org.jetbrains.kotlin.load.kotlin.PackageParts
|
||||
import org.jetbrains.kotlin.load.kotlin.header.KotlinClassHeader
|
||||
import org.jetbrains.kotlin.load.kotlin.incremental.IncrementalPackageFragmentProvider
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.progress.ProgressIndicatorAndCompilationCanceledStatus
|
||||
@@ -49,16 +48,15 @@ import org.jetbrains.kotlin.resolve.scopes.MemberScope
|
||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedCallableMemberDescriptor
|
||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedPropertyDescriptor
|
||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedSimpleFunctionDescriptor
|
||||
import org.jetbrains.org.objectweb.asm.AnnotationVisitor
|
||||
import org.jetbrains.org.objectweb.asm.MethodVisitor
|
||||
import org.jetbrains.org.objectweb.asm.Opcodes
|
||||
import org.jetbrains.org.objectweb.asm.Type
|
||||
import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter
|
||||
import java.util.*
|
||||
|
||||
class MultifileClassCodegen(
|
||||
public class MultifileClassCodegen(
|
||||
private val state: GenerationState,
|
||||
val files: Collection<KtFile>,
|
||||
public val files: Collection<KtFile>,
|
||||
private val facadeFqName: FqName
|
||||
) {
|
||||
private val facadeClassType = AsmUtil.asmTypeByFqNameWithoutInnerClasses(facadeFqName)
|
||||
@@ -76,7 +74,7 @@ class MultifileClassCodegen(
|
||||
private fun getDeserializedCallables(compiledPackageFragment: PackageFragmentDescriptor) =
|
||||
compiledPackageFragment.getMemberScope().getContributedDescriptors(DescriptorKindFilter.CALLABLES, MemberScope.ALL_NAME_FILTER).filterIsInstance<DeserializedCallableMemberDescriptor>()
|
||||
|
||||
val packageParts = PackageParts(facadeFqName.parent().asString())
|
||||
public val packageParts = PackageParts(facadeFqName.parent().asString())
|
||||
|
||||
private val classBuilder = ClassBuilderOnDemand {
|
||||
val originFile = files.firstOrNull()
|
||||
@@ -105,7 +103,7 @@ class MultifileClassCodegen(
|
||||
classBuilder
|
||||
}
|
||||
|
||||
fun generate(errorHandler: CompilationErrorHandler) {
|
||||
public fun generate(errorHandler: CompilationErrorHandler) {
|
||||
val generateCallableMemberTasks = HashMap<CallableMemberDescriptor, () -> Unit>()
|
||||
val partFqNames = arrayListOf<FqName>()
|
||||
|
||||
@@ -154,7 +152,7 @@ class MultifileClassCodegen(
|
||||
writeKotlinMultifileFacadeAnnotationIfNeeded(partFqNames)
|
||||
}
|
||||
|
||||
fun generateClassOrObject(classOrObject: KtClassOrObject, packagePartContext: FieldOwnerContext<PackageFragmentDescriptor>) {
|
||||
public fun generateClassOrObject(classOrObject: KtClassOrObject, packagePartContext: FieldOwnerContext<PackageFragmentDescriptor>) {
|
||||
MemberCodegen.genClassOrObject(packagePartContext, classOrObject, state, null)
|
||||
}
|
||||
|
||||
@@ -273,23 +271,17 @@ class MultifileClassCodegen(
|
||||
if (state.classBuilderMode != ClassBuilderMode.FULL) return
|
||||
if (files.any { it.isScript }) return
|
||||
|
||||
val partInternalNames = partFqNames.map(AsmUtil::internalNameByFqNameWithoutInnerClasses).sorted()
|
||||
|
||||
fun writePartNames(av: AnnotationVisitor, fieldName: String) {
|
||||
val arv = av.visitArray(fieldName)
|
||||
for (internalName in partInternalNames) {
|
||||
arv.visit(null, internalName)
|
||||
}
|
||||
arv.visitEnd()
|
||||
}
|
||||
|
||||
writeKotlinMetadata(classBuilder, KotlinClassHeader.Kind.MULTIFILE_CLASS) { av ->
|
||||
writePartNames(av, JvmAnnotationNames.METADATA_DATA_FIELD_NAME)
|
||||
}
|
||||
|
||||
val av = classBuilder.newAnnotation(AsmUtil.asmDescByFqNameWithoutInnerClasses(JvmAnnotationNames.KOTLIN_MULTIFILE_CLASS), true)
|
||||
JvmCodegenUtil.writeAbiVersion(av)
|
||||
writePartNames(av, JvmAnnotationNames.FILE_PART_CLASS_NAMES_FIELD_NAME)
|
||||
JvmCodegenUtil.writeModuleName(av, state)
|
||||
|
||||
val partInternalNames = partFqNames.map { JvmClassName.byFqNameWithoutInnerClasses(it).internalName }.sorted()
|
||||
val arv = av.visitArray(JvmAnnotationNames.FILE_PART_CLASS_NAMES_FIELD_NAME)
|
||||
for (internalName in partInternalNames) {
|
||||
arv.visit(null, internalName)
|
||||
}
|
||||
arv.visitEnd()
|
||||
|
||||
av.visitEnd()
|
||||
}
|
||||
|
||||
@@ -300,13 +292,13 @@ class MultifileClassCodegen(
|
||||
override fun generateKotlinAnnotation() = throw UnsupportedOperationException()
|
||||
}
|
||||
|
||||
fun done() {
|
||||
public fun done() {
|
||||
classBuilder.done()
|
||||
}
|
||||
|
||||
companion object {
|
||||
private val FACADE_CLASS_ATTRIBUTES = Opcodes.ACC_PUBLIC or Opcodes.ACC_FINAL or Opcodes.ACC_SUPER
|
||||
private val OPEN_FACADE_CLASS_ATTRIBUTES = Opcodes.ACC_PUBLIC or Opcodes.ACC_SUPER
|
||||
private val FACADE_CLASS_ATTRIBUTES = Opcodes.ACC_PUBLIC or Opcodes.ACC_FINAL
|
||||
private val OPEN_FACADE_CLASS_ATTRIBUTES = Opcodes.ACC_PUBLIC
|
||||
|
||||
private fun getOnlyPackageFragment(packageFqName: FqName, files: Collection<KtFile>, bindingContext: BindingContext): PackageFragmentDescriptor? {
|
||||
val fragments = SmartList<PackageFragmentDescriptor>()
|
||||
|
||||
@@ -22,7 +22,6 @@ import org.jetbrains.kotlin.codegen.serialization.JvmSerializerExtension
|
||||
import org.jetbrains.kotlin.codegen.state.GenerationState
|
||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
||||
import org.jetbrains.kotlin.load.java.JvmAnnotationNames
|
||||
import org.jetbrains.kotlin.load.kotlin.header.KotlinClassHeader
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.psi.KtNamedFunction
|
||||
import org.jetbrains.kotlin.psi.KtProperty
|
||||
@@ -32,7 +31,7 @@ import org.jetbrains.org.objectweb.asm.Opcodes
|
||||
import org.jetbrains.org.objectweb.asm.Type
|
||||
import java.util.*
|
||||
|
||||
class MultifileClassPartCodegen(
|
||||
public class MultifileClassPartCodegen(
|
||||
v: ClassBuilder,
|
||||
file: KtFile,
|
||||
private val filePartType: Type,
|
||||
@@ -47,7 +46,7 @@ class MultifileClassPartCodegen(
|
||||
|
||||
override fun generateDeclaration() {
|
||||
v.defineClass(element, Opcodes.V1_6,
|
||||
Opcodes.ACC_FINAL or Opcodes.ACC_SYNTHETIC or Opcodes.ACC_SUPER,
|
||||
Opcodes.ACC_FINAL or Opcodes.ACC_SYNTHETIC,
|
||||
filePartType.internalName,
|
||||
null,
|
||||
"java/lang/Object",
|
||||
@@ -84,17 +83,15 @@ class MultifileClassPartCodegen(
|
||||
}
|
||||
}
|
||||
|
||||
val serializer = DescriptorSerializer.createTopLevel(JvmSerializerExtension(v.serializationBindings, state))
|
||||
val bindings = v.serializationBindings
|
||||
|
||||
val serializer = DescriptorSerializer.createTopLevel(
|
||||
JvmSerializerExtension(bindings, state.typeMapper, state.useTypeTableInSerializer)
|
||||
)
|
||||
val packageProto = serializer.packagePartProto(members).build()
|
||||
|
||||
writeKotlinMetadata(v, KotlinClassHeader.Kind.MULTIFILE_CLASS_PART) { av ->
|
||||
AsmUtil.writeAnnotationData(av, serializer, packageProto, false)
|
||||
av.visit(JvmAnnotationNames.METADATA_MULTIFILE_CLASS_NAME_FIELD_NAME, multifileClassType.internalName)
|
||||
}
|
||||
|
||||
val av = v.newAnnotation(AsmUtil.asmDescByFqNameWithoutInnerClasses(JvmAnnotationNames.KOTLIN_MULTIFILE_CLASS_PART), true)
|
||||
JvmCodegenUtil.writeAbiVersion(av)
|
||||
AsmUtil.writeAnnotationData(av, serializer, packageProto, true)
|
||||
AsmUtil.writeAnnotationData(av, serializer, packageProto)
|
||||
av.visit(JvmAnnotationNames.MULTIFILE_CLASS_NAME_FIELD_NAME, multifileClassType.internalName)
|
||||
av.visitEnd()
|
||||
}
|
||||
|
||||
@@ -17,12 +17,11 @@
|
||||
package org.jetbrains.kotlin.codegen;
|
||||
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import kotlin.Unit;
|
||||
import kotlin.jvm.functions.Function0;
|
||||
import kotlin.jvm.functions.Function1;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.kotlin.codegen.annotation.AnnotatedSimple;
|
||||
import org.jetbrains.kotlin.codegen.context.FieldOwnerContext;
|
||||
import org.jetbrains.kotlin.codegen.serialization.JvmSerializationBindings;
|
||||
import org.jetbrains.kotlin.codegen.serialization.JvmSerializerExtension;
|
||||
import org.jetbrains.kotlin.codegen.state.GenerationState;
|
||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor;
|
||||
@@ -32,7 +31,6 @@ import org.jetbrains.kotlin.descriptors.annotations.Annotated;
|
||||
import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor;
|
||||
import org.jetbrains.kotlin.descriptors.annotations.AnnotationsImpl;
|
||||
import org.jetbrains.kotlin.load.java.JvmAnnotationNames;
|
||||
import org.jetbrains.kotlin.load.kotlin.header.KotlinClassHeader;
|
||||
import org.jetbrains.kotlin.psi.*;
|
||||
import org.jetbrains.kotlin.resolve.BindingContext;
|
||||
import org.jetbrains.kotlin.serialization.DescriptorSerializer;
|
||||
@@ -45,7 +43,7 @@ import java.util.List;
|
||||
|
||||
import static org.jetbrains.kotlin.codegen.AsmUtil.asmDescByFqNameWithoutInnerClasses;
|
||||
import static org.jetbrains.kotlin.codegen.AsmUtil.writeAnnotationData;
|
||||
import static org.jetbrains.kotlin.codegen.JvmCodegenUtil.writeAbiVersion;
|
||||
import static org.jetbrains.kotlin.codegen.JvmCodegenUtil.writeModuleName;
|
||||
import static org.jetbrains.org.objectweb.asm.Opcodes.*;
|
||||
|
||||
public class PackagePartCodegen extends MemberCodegen<KtFile> {
|
||||
@@ -65,7 +63,7 @@ public class PackagePartCodegen extends MemberCodegen<KtFile> {
|
||||
@Override
|
||||
protected void generateDeclaration() {
|
||||
v.defineClass(element, V1_6,
|
||||
ACC_PUBLIC | ACC_FINAL | ACC_SUPER,
|
||||
ACC_PUBLIC | ACC_FINAL,
|
||||
packagePartType.getInternalName(),
|
||||
null,
|
||||
"java/lang/Object",
|
||||
@@ -121,21 +119,16 @@ public class PackagePartCodegen extends MemberCodegen<KtFile> {
|
||||
}
|
||||
}
|
||||
|
||||
final DescriptorSerializer serializer =
|
||||
DescriptorSerializer.createTopLevel(new JvmSerializerExtension(v.getSerializationBindings(), state));
|
||||
final ProtoBuf.Package packageProto = serializer.packagePartProto(members).build();
|
||||
JvmSerializationBindings bindings = v.getSerializationBindings();
|
||||
|
||||
WriteAnnotationUtilKt.writeKotlinMetadata(v, KotlinClassHeader.Kind.FILE_FACADE, new Function1<AnnotationVisitor, Unit>() {
|
||||
@Override
|
||||
public Unit invoke(AnnotationVisitor av) {
|
||||
writeAnnotationData(av, serializer, packageProto, false);
|
||||
return Unit.INSTANCE;
|
||||
}
|
||||
});
|
||||
DescriptorSerializer serializer = DescriptorSerializer.createTopLevel(new JvmSerializerExtension(
|
||||
bindings, state.getTypeMapper(), state.getUseTypeTableInSerializer()
|
||||
));
|
||||
ProtoBuf.Package packageProto = serializer.packagePartProto(members).build();
|
||||
|
||||
AnnotationVisitor av = v.newAnnotation(asmDescByFqNameWithoutInnerClasses(JvmAnnotationNames.KOTLIN_FILE_FACADE), true);
|
||||
writeAbiVersion(av);
|
||||
writeAnnotationData(av, serializer, packageProto, true);
|
||||
writeAnnotationData(av, serializer, packageProto);
|
||||
writeModuleName(av, state);
|
||||
av.visitEnd();
|
||||
}
|
||||
|
||||
|
||||
@@ -130,18 +130,16 @@ public class PropertyCodegen {
|
||||
|
||||
private void genBackingFieldAndAnnotations(@NotNull KtNamedDeclaration declaration, @NotNull PropertyDescriptor descriptor, boolean isParameter) {
|
||||
boolean hasBackingField = hasBackingField(declaration, descriptor);
|
||||
boolean hasDelegate = declaration instanceof KtProperty && ((KtProperty) declaration).hasDelegate();
|
||||
|
||||
AnnotationSplitter annotationSplitter =
|
||||
AnnotationSplitter.create(LockBasedStorageManager.NO_LOCKS,
|
||||
descriptor.getAnnotations(),
|
||||
AnnotationSplitter.getTargetSet(isParameter, descriptor.isVar(), hasBackingField, hasDelegate));
|
||||
AnnotationSplitter.getTargetSet(isParameter, descriptor.isVar(), hasBackingField));
|
||||
|
||||
Annotations fieldAnnotations = annotationSplitter.getAnnotationsForTarget(AnnotationUseSiteTarget.FIELD);
|
||||
Annotations delegateAnnotations = annotationSplitter.getAnnotationsForTarget(AnnotationUseSiteTarget.PROPERTY_DELEGATE_FIELD);
|
||||
Annotations propertyAnnotations = annotationSplitter.getAnnotationsForTarget(AnnotationUseSiteTarget.PROPERTY);
|
||||
|
||||
generateBackingField(declaration, descriptor, fieldAnnotations, delegateAnnotations);
|
||||
generateBackingField(declaration, descriptor, fieldAnnotations);
|
||||
generateSyntheticMethodIfNeeded(descriptor, propertyAnnotations);
|
||||
}
|
||||
|
||||
@@ -230,18 +228,17 @@ public class PropertyCodegen {
|
||||
private boolean generateBackingField(
|
||||
@NotNull KtNamedDeclaration p,
|
||||
@NotNull PropertyDescriptor descriptor,
|
||||
@NotNull Annotations backingFieldAnnotations,
|
||||
@NotNull Annotations delegateAnnotations
|
||||
@NotNull Annotations annotations
|
||||
) {
|
||||
if (isJvmInterface(descriptor.getContainingDeclaration()) || kind == OwnerKind.DEFAULT_IMPLS) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (p instanceof KtProperty && ((KtProperty) p).hasDelegate()) {
|
||||
generatePropertyDelegateAccess((KtProperty) p, descriptor, delegateAnnotations);
|
||||
generatePropertyDelegateAccess((KtProperty) p, descriptor, annotations);
|
||||
}
|
||||
else if (Boolean.TRUE.equals(bindingContext.get(BindingContext.BACKING_FIELD_REQUIRED, descriptor))) {
|
||||
generateBackingFieldAccess(p, descriptor, backingFieldAnnotations);
|
||||
generateBackingFieldAccess(p, descriptor, annotations);
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
@@ -330,8 +327,7 @@ public class PropertyCodegen {
|
||||
typeMapper.mapFieldSignature(jetType, propertyDescriptor), defaultValue);
|
||||
|
||||
Annotated fieldAnnotated = new AnnotatedWithFakeAnnotations(propertyDescriptor, annotations);
|
||||
AnnotationCodegen.forField(fv, typeMapper).genAnnotations(
|
||||
fieldAnnotated, type, isDelegate ? AnnotationUseSiteTarget.PROPERTY_DELEGATE_FIELD : AnnotationUseSiteTarget.FIELD);
|
||||
AnnotationCodegen.forField(fv, typeMapper).genAnnotations(fieldAnnotated, type, AnnotationUseSiteTarget.FIELD);
|
||||
}
|
||||
|
||||
private void generatePropertyDelegateAccess(KtProperty p, PropertyDescriptor propertyDescriptor, Annotations annotations) {
|
||||
|
||||
@@ -39,7 +39,7 @@ import org.jetbrains.org.objectweb.asm.Type
|
||||
import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter
|
||||
import org.jetbrains.org.objectweb.asm.commons.Method
|
||||
|
||||
class PropertyReferenceCodegen(
|
||||
public class PropertyReferenceCodegen(
|
||||
state: GenerationState,
|
||||
parentCodegen: MemberCodegen<*>,
|
||||
context: ClassContext,
|
||||
@@ -68,22 +68,22 @@ class PropertyReferenceCodegen(
|
||||
element,
|
||||
V1_6,
|
||||
ACC_FINAL or ACC_SUPER or AsmUtil.getVisibilityAccessFlagForAnonymous(classDescriptor),
|
||||
asmType.internalName,
|
||||
asmType.getInternalName(),
|
||||
null,
|
||||
superAsmType.internalName,
|
||||
superAsmType.getInternalName(),
|
||||
emptyArray()
|
||||
)
|
||||
|
||||
v.visitSource(element.containingFile.name, null)
|
||||
v.visitSource(element.getContainingFile().getName(), null)
|
||||
}
|
||||
|
||||
// TODO: ImplementationBodyCodegen.markLineNumberForSyntheticFunction?
|
||||
override fun generateBody() {
|
||||
generateConstInstance(asmType, wrapperMethod.returnType)
|
||||
generateConstInstance(asmType, wrapperMethod.getReturnType())
|
||||
|
||||
generateMethod("property reference init", 0, method("<init>", Type.VOID_TYPE)) {
|
||||
load(0, OBJECT_TYPE)
|
||||
invokespecial(superAsmType.internalName, "<init>", "()V", false)
|
||||
invokespecial(superAsmType.getInternalName(), "<init>", "()V", false)
|
||||
}
|
||||
|
||||
generateMethod("property reference getOwner", ACC_PUBLIC, method("getOwner", K_DECLARATION_CONTAINER_TYPE)) {
|
||||
@@ -91,7 +91,7 @@ class PropertyReferenceCodegen(
|
||||
}
|
||||
|
||||
generateMethod("property reference getName", ACC_PUBLIC, method("getName", JAVA_STRING_TYPE)) {
|
||||
aconst(target.name.asString())
|
||||
aconst(target.getName().asString())
|
||||
}
|
||||
|
||||
generateMethod("property reference getSignature", ACC_PUBLIC, method("getSignature", JAVA_STRING_TYPE)) {
|
||||
@@ -108,11 +108,11 @@ class PropertyReferenceCodegen(
|
||||
// return type and value parameter types. However, it's created only to be able to use
|
||||
// ExpressionCodegen#intermediateValueForProperty, which is poorly coupled with everything else.
|
||||
val fakeDescriptor = SimpleFunctionDescriptorImpl.create(
|
||||
classDescriptor, Annotations.EMPTY, Name.identifier(method.name), CallableMemberDescriptor.Kind.DECLARATION,
|
||||
classDescriptor, Annotations.EMPTY, Name.identifier(method.getName()), CallableMemberDescriptor.Kind.DECLARATION,
|
||||
SourceElement.NO_SOURCE
|
||||
)
|
||||
fakeDescriptor.initialize(null, classDescriptor.thisAsReceiverParameter, emptyList(), emptyList(),
|
||||
classDescriptor.builtIns.anyType, Modality.OPEN, Visibilities.PUBLIC)
|
||||
fakeDescriptor.initialize(null, classDescriptor.getThisAsReceiverParameter(), emptyList(), emptyList(),
|
||||
classDescriptor.builtIns.getAnyType(), Modality.OPEN, Visibilities.PUBLIC)
|
||||
|
||||
val fakeCodegen = ExpressionCodegen(
|
||||
this, FrameMap(), OBJECT_TYPE, context.intoFunction(fakeDescriptor), state, this@PropertyReferenceCodegen
|
||||
@@ -147,26 +147,24 @@ class PropertyReferenceCodegen(
|
||||
}
|
||||
|
||||
private fun generateMethod(debugString: String, access: Int, method: Method, generate: InstructionAdapter.() -> Unit) {
|
||||
val mv = v.newMethod(JvmDeclarationOrigin.NO_ORIGIN, access, method.name, method.descriptor, null, null)
|
||||
val mv = v.newMethod(JvmDeclarationOrigin.NO_ORIGIN, access, method.getName(), method.getDescriptor(), null, null)
|
||||
|
||||
if (state.classBuilderMode == ClassBuilderMode.FULL) {
|
||||
val iv = InstructionAdapter(mv)
|
||||
iv.visitCode()
|
||||
iv.generate()
|
||||
iv.areturn(method.returnType)
|
||||
iv.areturn(method.getReturnType())
|
||||
FunctionCodegen.endVisit(mv, debugString, element)
|
||||
}
|
||||
}
|
||||
|
||||
override fun generateKotlinAnnotation() {
|
||||
writeKotlinSyntheticClassAnnotation(v, state)
|
||||
|
||||
writeSyntheticClassMetadata(v)
|
||||
}
|
||||
|
||||
fun putInstanceOnStack(): StackValue =
|
||||
StackValue.operation(wrapperMethod.returnType) { iv ->
|
||||
iv.getstatic(asmType.internalName, JvmAbi.INSTANCE_FIELD, wrapperMethod.returnType.descriptor)
|
||||
public fun putInstanceOnStack(): StackValue =
|
||||
StackValue.operation(wrapperMethod.getReturnType()) { iv ->
|
||||
iv.getstatic(asmType.getInternalName(), JvmAbi.INSTANCE_FIELD, wrapperMethod.getReturnType().getDescriptor())
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
@@ -31,7 +31,7 @@ import org.jetbrains.kotlin.types.KotlinType;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.jetbrains.kotlin.builtins.KotlinBuiltIns.RANGES_PACKAGE_FQ_NAME;
|
||||
import static org.jetbrains.kotlin.builtins.KotlinBuiltIns.BUILT_INS_PACKAGE_FQ_NAME;
|
||||
import static org.jetbrains.kotlin.codegen.AsmUtil.isPrimitiveNumberClassDescriptor;
|
||||
|
||||
public class RangeCodegenUtil {
|
||||
@@ -53,8 +53,8 @@ public class RangeCodegenUtil {
|
||||
ImmutableMap.Builder<FqName, PrimitiveType> rangeBuilder = ImmutableMap.builder();
|
||||
ImmutableMap.Builder<FqName, PrimitiveType> progressionBuilder = ImmutableMap.builder();
|
||||
for (PrimitiveType primitiveType : supportedRangeTypes()) {
|
||||
FqName rangeClassFqName = RANGES_PACKAGE_FQ_NAME.child(Name.identifier(primitiveType.getTypeName() + "Range"));
|
||||
FqName progressionClassFqName = RANGES_PACKAGE_FQ_NAME.child(Name.identifier(primitiveType.getTypeName() + "Progression"));
|
||||
FqName rangeClassFqName = BUILT_INS_PACKAGE_FQ_NAME.child(Name.identifier(primitiveType.getTypeName() + "Range"));
|
||||
FqName progressionClassFqName = BUILT_INS_PACKAGE_FQ_NAME.child(Name.identifier(primitiveType.getTypeName() + "Progression"));
|
||||
rangeBuilder.put(rangeClassFqName, primitiveType);
|
||||
progressionBuilder.put(progressionClassFqName, primitiveType);
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ public class SamWrapperCodegen {
|
||||
ClassBuilder cv = state.getFactory().newVisitor(JvmDeclarationOriginKt.OtherOrigin(erasedInterfaceFunction), asmType, file);
|
||||
cv.defineClass(file,
|
||||
V1_6,
|
||||
ACC_FINAL | ACC_SUPER,
|
||||
ACC_FINAL,
|
||||
asmType.getInternalName(),
|
||||
null,
|
||||
OBJECT_TYPE.getInternalName(),
|
||||
@@ -96,8 +96,6 @@ public class SamWrapperCodegen {
|
||||
|
||||
writeKotlinSyntheticClassAnnotation(cv, state);
|
||||
|
||||
WriteAnnotationUtilKt.writeSyntheticClassMetadata(cv);
|
||||
|
||||
// e.g. ASM type for Function2
|
||||
Type functionAsmType = typeMapper.mapType(functionType);
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ public class ScriptCodegen extends MemberCodegen<KtScript> {
|
||||
|
||||
v.defineClass(scriptDeclaration,
|
||||
V1_6,
|
||||
ACC_PUBLIC | ACC_SUPER,
|
||||
ACC_PUBLIC,
|
||||
classType.getInternalName(),
|
||||
null,
|
||||
"java/lang/Object",
|
||||
|
||||
@@ -26,7 +26,7 @@ import org.jetbrains.kotlin.resolve.jvm.diagnostics.RawSignature
|
||||
import org.jetbrains.org.objectweb.asm.FieldVisitor
|
||||
import org.jetbrains.org.objectweb.asm.MethodVisitor
|
||||
|
||||
abstract class SignatureCollectingClassBuilderFactory(
|
||||
public abstract class SignatureCollectingClassBuilderFactory(
|
||||
delegate: ClassBuilderFactory
|
||||
) : DelegatingClassBuilderFactory(delegate) {
|
||||
|
||||
|
||||
@@ -22,19 +22,19 @@ import org.jetbrains.kotlin.backend.common.CodegenUtil
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.psi.KtNamedFunction
|
||||
|
||||
data class SourceInfo(val source: String, val pathOrCleanFQN: String, val linesInFile: Int) {
|
||||
data public class SourceInfo(val source: String, val pathOrCleanFQN: String, val linesInFile: Int) {
|
||||
|
||||
companion object {
|
||||
fun createInfo(element: KtElement?, internalClassName: String): SourceInfo {
|
||||
assert(element != null) { "Couldn't create source mapper for null element " + internalClassName }
|
||||
val lineNumbers = CodegenUtil.getLineNumberForElement(element!!.containingFile, true)
|
||||
assert(lineNumbers != null) { "Couldn't extract line count in " + element.containingFile }
|
||||
val lineNumbers = CodegenUtil.getLineNumberForElement(element!!.getContainingFile(), true)
|
||||
assert(lineNumbers != null) { "Couldn't extract line count in " + element.getContainingFile() }
|
||||
|
||||
//TODO hack condition for package parts cleaning
|
||||
val isTopLevel = element is KtFile || (element is KtNamedFunction && element.getParent() is KtFile)
|
||||
val cleanedClassFqName = if (!isTopLevel) internalClassName else internalClassName.substringBefore('$')
|
||||
|
||||
return SourceInfo(element.getContainingKtFile().name, cleanedClassFqName, lineNumbers!!)
|
||||
return SourceInfo(element.getContainingKtFile().getName(), cleanedClassFqName, lineNumbers!!)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,9 +17,8 @@
|
||||
package org.jetbrains.kotlin.codegen;
|
||||
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import kotlin.Unit;
|
||||
import kotlin.collections.ArraysKt;
|
||||
import kotlin.collections.CollectionsKt;
|
||||
import kotlin.Unit;
|
||||
import kotlin.jvm.functions.Function1;
|
||||
import org.jetbrains.annotations.Contract;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -516,9 +515,6 @@ public abstract class StackValue {
|
||||
dispatchReceiverParameter = extensionReceiverParameter;
|
||||
extensionReceiverParameter = null;
|
||||
}
|
||||
else if (descriptor instanceof SyntheticFieldDescriptor) {
|
||||
dispatchReceiverParameter = ((SyntheticFieldDescriptor) descriptor).getDispatchReceiverParameterForBackend();
|
||||
}
|
||||
|
||||
boolean hasExtensionReceiver = callExtensionReceiver != null;
|
||||
StackValue dispatchReceiver = platformStaticCallIfPresent(
|
||||
@@ -772,14 +768,13 @@ public abstract class StackValue {
|
||||
private final Callable callable;
|
||||
private final boolean isGetter;
|
||||
private final ExpressionCodegen codegen;
|
||||
private final ArgumentGenerator argumentGenerator;
|
||||
private final List<ResolvedValueArgument> valueArguments;
|
||||
private final FrameMap frame;
|
||||
private final StackValue receiver;
|
||||
private final ResolvedCall<FunctionDescriptor> resolvedGetCall;
|
||||
private final ResolvedCall<FunctionDescriptor> resolvedSetCall;
|
||||
private DefaultCallArgs defaultArgs;
|
||||
private CallGenerator callGenerator;
|
||||
boolean isComplexOperationWithDup;
|
||||
private DefaultCallMask mask;
|
||||
|
||||
public CollectionElementReceiver(
|
||||
@NotNull Callable callable,
|
||||
@@ -788,6 +783,7 @@ public abstract class StackValue {
|
||||
ResolvedCall<FunctionDescriptor> resolvedSetCall,
|
||||
boolean isGetter,
|
||||
@NotNull ExpressionCodegen codegen,
|
||||
ArgumentGenerator argumentGenerator,
|
||||
List<ResolvedValueArgument> valueArguments
|
||||
) {
|
||||
super(OBJECT_TYPE);
|
||||
@@ -797,6 +793,7 @@ public abstract class StackValue {
|
||||
this.receiver = receiver;
|
||||
this.resolvedGetCall = resolvedGetCall;
|
||||
this.resolvedSetCall = resolvedSetCall;
|
||||
this.argumentGenerator = argumentGenerator;
|
||||
this.valueArguments = valueArguments;
|
||||
this.codegen = codegen;
|
||||
this.frame = codegen.myFrameMap;
|
||||
@@ -806,25 +803,8 @@ public abstract class StackValue {
|
||||
public void putSelector(@NotNull Type type, @NotNull InstructionAdapter v) {
|
||||
ResolvedCall<?> call = isGetter ? resolvedGetCall : resolvedSetCall;
|
||||
StackValue newReceiver = StackValue.receiver(call, receiver, codegen, callable);
|
||||
ArgumentGenerator generator = createArgumentGenerator();
|
||||
newReceiver.put(newReceiver.type, v);
|
||||
callGenerator.putHiddenParams();
|
||||
|
||||
defaultArgs = generator.generate(valueArguments, valueArguments);
|
||||
}
|
||||
|
||||
private ArgumentGenerator createArgumentGenerator() {
|
||||
assert callGenerator == null :
|
||||
"'putSelector' and 'createArgumentGenerator' methods should be called once for CollectionElementReceiver: " + callable;
|
||||
ResolvedCall<FunctionDescriptor> resolvedCall = isGetter ? resolvedGetCall : resolvedSetCall;
|
||||
assert resolvedCall != null : "Resolved call should be non-null: " + callable;
|
||||
callGenerator =
|
||||
!isComplexOperationWithDup ? codegen.getOrCreateCallGenerator(resolvedCall) : codegen.defaultCallGenerator;
|
||||
return new CallBasedArgumentGenerator(
|
||||
codegen,
|
||||
callGenerator,
|
||||
resolvedCall.getResultingDescriptor().getValueParameters(), callable.getValueParameterTypes()
|
||||
);
|
||||
mask = argumentGenerator.generate(valueArguments, valueArguments);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -952,22 +932,14 @@ public abstract class StackValue {
|
||||
if (getter == null) {
|
||||
throw new UnsupportedOperationException("no getter specified");
|
||||
}
|
||||
CallGenerator callGenerator = getCallGenerator();
|
||||
CallGenerator callGenerator = codegen.defaultCallGenerator;
|
||||
callGenerator.genCall(getter, resolvedGetCall, genDefaultMaskIfPresent(callGenerator), codegen);
|
||||
coerceTo(type, v);
|
||||
}
|
||||
|
||||
private boolean genDefaultMaskIfPresent(CallGenerator callGenerator) {
|
||||
DefaultCallArgs defaultArgs = ((CollectionElementReceiver) receiver).defaultArgs;
|
||||
return defaultArgs.generateOnStackIfNeeded(callGenerator, true);
|
||||
}
|
||||
|
||||
private CallGenerator getCallGenerator() {
|
||||
CallGenerator generator = ((CollectionElementReceiver) receiver).callGenerator;
|
||||
assert generator != null :
|
||||
"CollectionElementReceiver should be putted on stack before CollectionElement:" +
|
||||
" getCall = " + resolvedGetCall + ", setCall = " + resolvedSetCall;
|
||||
return generator;
|
||||
DefaultCallMask mask = ((CollectionElementReceiver) receiver).mask;
|
||||
return mask.generateOnStackIfNeeded(callGenerator);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1019,13 +991,8 @@ public abstract class StackValue {
|
||||
|
||||
Type lastParameterType = ArraysKt.last(setter.getParameterTypes());
|
||||
coerce(topOfStackType, lastParameterType, v);
|
||||
|
||||
getCallGenerator().afterParameterPut(lastParameterType, StackValue.onStack(lastParameterType),
|
||||
CollectionsKt.getLastIndex(setter.getValueParameterTypes()));
|
||||
|
||||
//Convention setter couldn't have default parameters, just getter can have it at last positions
|
||||
//*Convention setter couldn't have default parameters, just getter can have it at last positions
|
||||
//We should remove default parameters of getter from stack*/
|
||||
//Note that it works only for non-inline case
|
||||
CollectionElementReceiver collectionElementReceiver = (CollectionElementReceiver) receiver;
|
||||
if (collectionElementReceiver.isGetter) {
|
||||
List<ResolvedValueArgument> arguments = collectionElementReceiver.valueArguments;
|
||||
@@ -1040,7 +1007,7 @@ public abstract class StackValue {
|
||||
}
|
||||
}
|
||||
|
||||
getCallGenerator().genCall(setter, resolvedSetCall, false, codegen);
|
||||
codegen.defaultCallGenerator.genCall(setter, resolvedSetCall, false, codegen);
|
||||
Type returnType = setter.getReturnType();
|
||||
if (returnType != Type.VOID_TYPE) {
|
||||
pop(v, returnType);
|
||||
@@ -1171,11 +1138,6 @@ public abstract class StackValue {
|
||||
else {
|
||||
coerce(topOfStackType, ArraysKt.last(setter.getParameterTypes()), v);
|
||||
setter.genInvokeInstruction(v);
|
||||
|
||||
Type returnType = setter.getReturnType();
|
||||
if (returnType != Type.VOID_TYPE) {
|
||||
pop(v, returnType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1567,11 +1529,6 @@ public abstract class StackValue {
|
||||
super(value.type, value.receiver.canHaveSideEffects());
|
||||
this.originalValueWithReceiver = value;
|
||||
this.isReadOperations = isReadOperations;
|
||||
if (value instanceof CollectionElement) {
|
||||
if (value.receiver instanceof CollectionElementReceiver) {
|
||||
((CollectionElementReceiver) value.receiver).isComplexOperationWithDup = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -44,7 +44,7 @@ class CoercionValue(
|
||||
}
|
||||
|
||||
|
||||
class StackValueWithLeaveTask(
|
||||
public class StackValueWithLeaveTask(
|
||||
val stackValue: StackValue,
|
||||
val leaveTasks: (StackValue) -> Unit
|
||||
) : StackValue(stackValue.type) {
|
||||
|
||||
@@ -22,15 +22,15 @@ import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.annotations.Annotations
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
|
||||
interface WrappedAnnotated : Annotated {
|
||||
val originalAnnotated: Annotated
|
||||
public interface WrappedAnnotated : Annotated {
|
||||
public val originalAnnotated: Annotated
|
||||
}
|
||||
|
||||
class AnnotatedWithFakeAnnotations(override val originalAnnotated: Annotated, private val actual: Annotations) : WrappedAnnotated {
|
||||
public class AnnotatedWithFakeAnnotations(override val originalAnnotated: Annotated, private val actual: Annotations) : WrappedAnnotated {
|
||||
override fun getAnnotations() = actual
|
||||
}
|
||||
|
||||
class AnnotatedWithOnlyTargetedAnnotations(private val original: Annotated) : Annotated {
|
||||
public class AnnotatedWithOnlyTargetedAnnotations(private val original: Annotated) : Annotated {
|
||||
private val annotations: Annotations = UseSiteTargetedAnnotations(original.annotations)
|
||||
|
||||
override fun getAnnotations() = annotations
|
||||
@@ -52,4 +52,4 @@ class AnnotatedWithOnlyTargetedAnnotations(private val original: Annotated) : An
|
||||
}
|
||||
}
|
||||
|
||||
class AnnotatedSimple(annotations: Annotations) : AnnotatedImpl(annotations)
|
||||
public class AnnotatedSimple(annotations: Annotations) : AnnotatedImpl(annotations)
|
||||
@@ -43,7 +43,8 @@ class BridgeForBuiltinSpecial<Signature>(
|
||||
)
|
||||
|
||||
object BuiltinSpecialBridgesUtil {
|
||||
@JvmStatic fun <Signature> generateBridgesForBuiltinSpecial(
|
||||
@JvmStatic
|
||||
public fun <Signature> generateBridgesForBuiltinSpecial(
|
||||
function: FunctionDescriptor,
|
||||
signatureByDescriptor: (FunctionDescriptor) -> Signature
|
||||
): Set<BridgeForBuiltinSpecial<Signature>> {
|
||||
@@ -92,7 +93,8 @@ object BuiltinSpecialBridgesUtil {
|
||||
return bridges
|
||||
}
|
||||
|
||||
@JvmStatic fun <Signature> FunctionDescriptor.shouldHaveTypeSafeBarrier(
|
||||
@JvmStatic
|
||||
public fun <Signature> FunctionDescriptor.shouldHaveTypeSafeBarrier(
|
||||
signatureByDescriptor: (FunctionDescriptor) -> Signature
|
||||
): Boolean {
|
||||
if (BuiltinMethodsWithSpecialGenericSignature.getDefaultValueForOverriddenBuiltinFunction(this) == null) return false
|
||||
@@ -141,7 +143,7 @@ private fun <Signature> needGenerateSpecialBridge(
|
||||
&& signatureByDescriptor(it) == overriddenBuiltinSignature }
|
||||
}
|
||||
|
||||
fun isValueArgumentForCallToMethodWithTypeCheckBarrier(
|
||||
public fun isValueArgumentForCallToMethodWithTypeCheckBarrier(
|
||||
element: KtElement,
|
||||
bindingContext: BindingContext
|
||||
): Boolean {
|
||||
|
||||
@@ -103,7 +103,7 @@ private fun generateNullCheckForNonSafeAs(
|
||||
}
|
||||
}
|
||||
|
||||
fun SpecialSignatureInfo.replaceValueParametersIn(sourceSignature: String?): String?
|
||||
public fun SpecialSignatureInfo.replaceValueParametersIn(sourceSignature: String?): String?
|
||||
= valueParametersSignature?.let { sourceSignature?.replace("^\\(.*\\)".toRegex(), "($it)") }
|
||||
|
||||
fun populateCompanionBackingFieldNamesToOuterContextIfNeeded(companion: KtObjectDeclaration, outerContext: FieldOwnerContext<*>, state: GenerationState) {
|
||||
|
||||
@@ -29,7 +29,6 @@ import org.jetbrains.kotlin.load.java.JavaVisibilities;
|
||||
import org.jetbrains.kotlin.load.java.descriptors.SamConstructorDescriptor;
|
||||
import org.jetbrains.kotlin.psi.KtFile;
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils;
|
||||
import org.jetbrains.kotlin.resolve.annotations.AnnotationUtilKt;
|
||||
import org.jetbrains.kotlin.storage.LockBasedStorageManager;
|
||||
import org.jetbrains.kotlin.storage.NullableLazyValue;
|
||||
import org.jetbrains.kotlin.types.KotlinType;
|
||||
@@ -610,8 +609,6 @@ public abstract class CodegenContext<T extends DeclarationDescriptor> {
|
||||
boolean withinInline,
|
||||
boolean isSuperCall
|
||||
) {
|
||||
if (AnnotationUtilKt.isInlineOnly(unwrappedDescriptor)) return false;
|
||||
|
||||
return isSuperCall && withinInline ||
|
||||
(accessFlag & ACC_PRIVATE) != 0 ||
|
||||
((accessFlag & ACC_PROTECTED) != 0 &&
|
||||
|
||||
@@ -18,14 +18,16 @@ package org.jetbrains.kotlin.codegen.context
|
||||
|
||||
import org.jetbrains.org.objectweb.asm.Type
|
||||
|
||||
object CodegenContextUtil {
|
||||
@JvmStatic fun getImplementationOwnerClassType(owner: CodegenContext<*>): Type? =
|
||||
public object CodegenContextUtil {
|
||||
@JvmStatic
|
||||
public fun getImplementationOwnerClassType(owner: CodegenContext<*>): Type? =
|
||||
when (owner) {
|
||||
is MultifileClassFacadeContext -> owner.filePartType
|
||||
is DelegatingToPartContext -> owner.implementationOwnerClassType
|
||||
else -> null
|
||||
}
|
||||
|
||||
@JvmStatic fun isImplClassOwner(owner: CodegenContext<*>): Boolean =
|
||||
@JvmStatic
|
||||
public fun isImplClassOwner(owner: CodegenContext<*>): Boolean =
|
||||
owner !is MultifileClassFacadeContext
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ class DefaultImplsClassContext(
|
||||
override fun getAccessors(): Collection<AccessorForCallableDescriptor<*>> {
|
||||
val accessors = super.getAccessors()
|
||||
val alreadyExistKeys = accessors.map ({ Pair(it.calleeDescriptor, it.superCallTarget) })
|
||||
val filtered = interfaceContext.accessors.associateByTo(linkedMapOf()) { Pair(it.calleeDescriptor, it.superCallTarget) }.apply { keys -= alreadyExistKeys }
|
||||
val filtered = interfaceContext.accessors.toMapBy({ Pair(it.calleeDescriptor, it.superCallTarget) }, { it }) - alreadyExistKeys
|
||||
return accessors + filtered.values
|
||||
}
|
||||
}
|
||||
@@ -21,11 +21,11 @@ import org.jetbrains.kotlin.diagnostics.DiagnosticSink
|
||||
import org.jetbrains.kotlin.extensions.ProjectExtensionDescriptor
|
||||
import org.jetbrains.kotlin.resolve.BindingContext
|
||||
|
||||
interface ClassBuilderInterceptorExtension {
|
||||
public interface ClassBuilderInterceptorExtension {
|
||||
companion object : ProjectExtensionDescriptor<ClassBuilderInterceptorExtension>(
|
||||
"org.jetbrains.kotlin.classBuilderFactoryInterceptorExtension", ClassBuilderInterceptorExtension::class.java)
|
||||
|
||||
fun interceptClassBuilderFactory(
|
||||
public fun interceptClassBuilderFactory(
|
||||
interceptedFactory: ClassBuilderFactory,
|
||||
bindingContext: BindingContext,
|
||||
diagnostics: DiagnosticSink
|
||||
|
||||
@@ -26,28 +26,28 @@ import org.jetbrains.kotlin.codegen.state.GenerationState
|
||||
import org.jetbrains.kotlin.psi.KtClassOrObject
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
|
||||
interface ExpressionCodegenExtension {
|
||||
public interface ExpressionCodegenExtension {
|
||||
companion object : ProjectExtensionDescriptor<ExpressionCodegenExtension>(
|
||||
"org.jetbrains.kotlin.expressionCodegenExtension", ExpressionCodegenExtension::class.java)
|
||||
|
||||
class Context(
|
||||
val typeMapper: JetTypeMapper,
|
||||
val v: InstructionAdapter
|
||||
public class Context(
|
||||
public val typeMapper: JetTypeMapper,
|
||||
public val v: InstructionAdapter
|
||||
)
|
||||
|
||||
/**
|
||||
* Used for generating custom byte code for the property value obtain. This function has lazy semantics.
|
||||
* Returns new stack value.
|
||||
*/
|
||||
fun applyProperty(receiver: StackValue, resolvedCall: ResolvedCall<*>, c: Context): StackValue? = null
|
||||
public fun applyProperty(receiver: StackValue, resolvedCall: ResolvedCall<*>, c: Context): StackValue? = null
|
||||
|
||||
/**
|
||||
* Used for generating custom byte code for the function call. This function has lazy semantics.
|
||||
* Returns new stack value.
|
||||
*/
|
||||
fun applyFunction(receiver: StackValue, resolvedCall: ResolvedCall<*>, c: Context): StackValue? = null
|
||||
public fun applyFunction(receiver: StackValue, resolvedCall: ResolvedCall<*>, c: Context): StackValue? = null
|
||||
|
||||
fun generateClassSyntheticParts(
|
||||
public fun generateClassSyntheticParts(
|
||||
classBuilder: ClassBuilder,
|
||||
state: GenerationState,
|
||||
classOrObject: KtClassOrObject,
|
||||
|
||||
@@ -88,7 +88,13 @@ public class AnonymousObjectTransformer {
|
||||
reader.accept(new ClassVisitor(InlineCodegenUtil.API, classBuilder.getVisitor()) {
|
||||
@Override
|
||||
public void visit(int version, int access, @NotNull String name, String signature, String superName, String[] interfaces) {
|
||||
InlineCodegenUtil.assertVersionNotGreaterThanJava6(version, name);
|
||||
InlineCodegenUtil.assertVersionNotGreaterThanJava6(version);
|
||||
|
||||
if (signature != null) {
|
||||
ReifiedTypeInliner.SignatureReificationResult signatureResult = inliningContext.reifedTypeInliner.reifySignature(signature);
|
||||
signature = signatureResult.getNewSignature();
|
||||
transformationResult.getReifiedTypeParametersUsages().mergeAll(signatureResult.getTypeParametersUsages());
|
||||
}
|
||||
super.visit(version, access, name, signature, superName, interfaces);
|
||||
}
|
||||
|
||||
@@ -97,6 +103,21 @@ public class AnonymousObjectTransformer {
|
||||
innerClassNodes.add(new InnerClassNode(name, outerName, innerName, access));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitOuterClass(@NotNull String owner, String name, String desc) {
|
||||
InliningContext parent = inliningContext.getParent();
|
||||
assert parent != null : "Context for transformer should have parent one: " + inliningContext;
|
||||
|
||||
//we don't write owner info for lamdbas and SAMs just only for objects
|
||||
if (parent.isRoot() || parent.isInliningLambdaRootContext()) {
|
||||
//TODO: think about writing method info - there is some problem with new constructor desc calculation
|
||||
super.visitOuterClass(inliningContext.getParent().getClassNameToInline(), null, null);
|
||||
return;
|
||||
}
|
||||
|
||||
super.visitOuterClass(owner, name, desc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MethodVisitor visitMethod(
|
||||
int access, @NotNull String name, @NotNull String desc, String signature, String[] exceptions
|
||||
@@ -187,24 +208,16 @@ public class AnonymousObjectTransformer {
|
||||
|
||||
SourceMapper.Companion.flushToClassBuilder(sourceMapper, classBuilder);
|
||||
|
||||
ClassVisitor visitor = classBuilder.getVisitor();
|
||||
for (InnerClassNode node : innerClassNodes) {
|
||||
visitor.visitInnerClass(node.name, node.outerName, node.innerName, node.access);
|
||||
classBuilder.getVisitor().visitInnerClass(node.name, node.outerName, node.innerName, node.access);
|
||||
}
|
||||
|
||||
writeOuterInfo(visitor);
|
||||
|
||||
classBuilder.done();
|
||||
|
||||
anonymousObjectGen.setNewLambdaType(newLambdaType);
|
||||
return transformationResult;
|
||||
}
|
||||
|
||||
private void writeOuterInfo(@NotNull ClassVisitor visitor) {
|
||||
InlineCallSiteInfo info = inliningContext.getCallSiteInfo();
|
||||
visitor.visitOuterClass(info.getOwnerClassName(), info.getFunctionName(), info.getFunctionDesc());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private InlineResult inlineMethodAndUpdateGlobalResult(
|
||||
@NotNull AnonymousObjectGeneration anonymousObjectGen,
|
||||
@@ -237,20 +250,9 @@ public class AnonymousObjectTransformer {
|
||||
parameters, anonymousObjectGen.getCapturedLambdasToInline(),
|
||||
parentRemapper, isConstructor);
|
||||
|
||||
MethodInliner inliner =
|
||||
new MethodInliner(
|
||||
sourceNode,
|
||||
parameters,
|
||||
inliningContext.subInline(inliningContext.nameGenerator.subGenerator("lambda")),
|
||||
remapper,
|
||||
isSameModule,
|
||||
"Transformer for " + anonymousObjectGen.getOwnerInternalName(),
|
||||
sourceMapper,
|
||||
new InlineCallSiteInfo(
|
||||
anonymousObjectGen.getOwnerInternalName(),
|
||||
sourceNode.name,
|
||||
isConstructor ? anonymousObjectGen.getNewConstructorDescriptor() : sourceNode.desc)
|
||||
);
|
||||
MethodInliner inliner = new MethodInliner(sourceNode, parameters, inliningContext.subInline(inliningContext.nameGenerator.subGenerator("lambda")),
|
||||
remapper, isSameModule, "Transformer for " + anonymousObjectGen.getOwnerInternalName(),
|
||||
sourceMapper);
|
||||
|
||||
InlineResult result = inliner.doInline(deferringVisitor, new LocalVarRemapper(parameters, 0), false, LabelOwner.NOT_APPLICABLE);
|
||||
result.getReifiedTypeParametersUsages().mergeAll(typeParametersToReify);
|
||||
@@ -289,8 +291,6 @@ public class AnonymousObjectTransformer {
|
||||
}
|
||||
|
||||
String constructorDescriptor = Type.getMethodDescriptor(Type.VOID_TYPE, descTypes.toArray(new Type[descTypes.size()]));
|
||||
//TODO for inline method make public class
|
||||
anonymousObjectGen.setNewConstructorDescriptor(constructorDescriptor);
|
||||
MethodVisitor constructorVisitor = classBuilder.newMethod(NO_ORIGIN,
|
||||
AsmUtil.NO_FLAG_PACKAGE_PRIVATE,
|
||||
"<init>", constructorDescriptor,
|
||||
@@ -331,6 +331,8 @@ public class AnonymousObjectTransformer {
|
||||
inlineMethodAndUpdateGlobalResult(anonymousObjectGen, parentRemapper, capturedFieldInitializer, constructor, constructorInlineBuilder, true);
|
||||
constructorVisitor.visitEnd();
|
||||
AsmUtil.genClosureFields(TransformationUtilsKt.toNameTypePair(TransformationUtilsKt.filterSkipped(newFieldsWithSkipped)), classBuilder);
|
||||
//TODO for inline method make public class
|
||||
anonymousObjectGen.setNewConstructorDescriptor(constructorDescriptor);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -348,11 +350,7 @@ public class AnonymousObjectTransformer {
|
||||
@NotNull
|
||||
private ClassBuilder createClassBuilder() {
|
||||
ClassBuilder classBuilder = state.getFactory().newVisitor(NO_ORIGIN, newLambdaType, inliningContext.getRoot().callElement.getContainingFile());
|
||||
|
||||
return new RemappingClassBuilder(
|
||||
classBuilder,
|
||||
new AsmTypeRemapper(inliningContext.typeRemapper, inliningContext.getRoot().typeParameterMappings == null, transformationResult)
|
||||
);
|
||||
return new RemappingClassBuilder(classBuilder, inliningContext.typeRemapper);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.codegen.inline
|
||||
|
||||
import org.jetbrains.org.objectweb.asm.commons.Remapper
|
||||
import org.jetbrains.org.objectweb.asm.commons.RemappingSignatureAdapter
|
||||
import org.jetbrains.org.objectweb.asm.signature.SignatureReader
|
||||
import org.jetbrains.org.objectweb.asm.signature.SignatureVisitor
|
||||
|
||||
class AsmTypeRemapper(val typeRemapper: TypeRemapper, val isDefaultGeneration: Boolean, val result: InlineResult) : Remapper() {
|
||||
|
||||
override fun map(type: String): String {
|
||||
return typeRemapper.map(type)
|
||||
}
|
||||
|
||||
override fun createRemappingSignatureAdapter(v: SignatureVisitor?): SignatureVisitor {
|
||||
if (isDefaultGeneration) {
|
||||
return super.createRemappingSignatureAdapter(v);
|
||||
}
|
||||
|
||||
return object : RemappingSignatureAdapter(v, this) {
|
||||
|
||||
override fun visitTypeVariable(name: String) {
|
||||
/*TODO try to erase absent type variable*/
|
||||
val mapping = typeRemapper.mapTypeParameter(name) ?: return super.visitTypeVariable(name)
|
||||
|
||||
if (mapping.newName != null) {
|
||||
if (mapping.isReified) {
|
||||
result.reifiedTypeParametersUsages.addUsedReifiedParameter(mapping.newName)
|
||||
}
|
||||
return super.visitTypeVariable(mapping.newName)
|
||||
}
|
||||
// else TypeVariable is replaced by concrete type
|
||||
SignatureReader(mapping.signature).accept(v)
|
||||
}
|
||||
|
||||
override fun visitFormalTypeParameter(name: String) {
|
||||
typeRemapper.registerTypeParameter(name)
|
||||
super.visitFormalTypeParameter(name)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -25,26 +25,26 @@ import org.jetbrains.org.objectweb.asm.tree.*
|
||||
import java.util.Comparator
|
||||
import java.util.Collections
|
||||
|
||||
abstract class CoveringTryCatchNodeProcessor(parameterSize: Int) {
|
||||
public abstract class CoveringTryCatchNodeProcessor(parameterSize: Int) {
|
||||
|
||||
val tryBlocksMetaInfo: IntervalMetaInfo<TryCatchBlockNodeInfo> = IntervalMetaInfo()
|
||||
public val tryBlocksMetaInfo: IntervalMetaInfo<TryCatchBlockNodeInfo> = IntervalMetaInfo()
|
||||
|
||||
val localVarsMetaInfo: IntervalMetaInfo<LocalVarNodeWrapper> = IntervalMetaInfo()
|
||||
public val localVarsMetaInfo: IntervalMetaInfo<LocalVarNodeWrapper> = IntervalMetaInfo()
|
||||
|
||||
var nextFreeLocalIndex: Int = parameterSize
|
||||
public var nextFreeLocalIndex: Int = parameterSize
|
||||
private set
|
||||
|
||||
fun getStartNodes(label: LabelNode): List<TryCatchBlockNodeInfo> {
|
||||
public fun getStartNodes(label: LabelNode): List<TryCatchBlockNodeInfo> {
|
||||
return tryBlocksMetaInfo.intervalStarts.get(label)
|
||||
}
|
||||
|
||||
fun getEndNodes(label: LabelNode): List<TryCatchBlockNodeInfo> {
|
||||
public fun getEndNodes(label: LabelNode): List<TryCatchBlockNodeInfo> {
|
||||
return tryBlocksMetaInfo.intervalEnds.get(label)
|
||||
}
|
||||
|
||||
open fun processInstruction(curInstr: AbstractInsnNode, directOrder: Boolean) {
|
||||
public open fun processInstruction(curInstr: AbstractInsnNode, directOrder: Boolean) {
|
||||
if (curInstr is VarInsnNode || curInstr is IincInsnNode) {
|
||||
val argSize = InlineCodegenUtil.getLoadStoreArgSize(curInstr.opcode)
|
||||
val argSize = InlineCodegenUtil.getLoadStoreArgSize(curInstr.getOpcode())
|
||||
val varIndex = if (curInstr is VarInsnNode) curInstr.`var` else (curInstr as IincInsnNode).`var`
|
||||
nextFreeLocalIndex = Math.max(nextFreeLocalIndex, varIndex + argSize)
|
||||
}
|
||||
@@ -55,9 +55,9 @@ abstract class CoveringTryCatchNodeProcessor(parameterSize: Int) {
|
||||
}
|
||||
}
|
||||
|
||||
abstract fun instructionIndex(inst: AbstractInsnNode): Int
|
||||
public abstract fun instructionIndex(inst: AbstractInsnNode): Int
|
||||
|
||||
fun sortTryCatchBlocks(intervals: List<TryCatchBlockNodeInfo>): List<TryCatchBlockNodeInfo> {
|
||||
public fun sortTryCatchBlocks(intervals: List<TryCatchBlockNodeInfo>): List<TryCatchBlockNodeInfo> {
|
||||
val comp = Comparator { t1: TryCatchBlockNodeInfo, t2: TryCatchBlockNodeInfo ->
|
||||
var result = instructionIndex(t1.handler) - instructionIndex(t2.handler)
|
||||
if (result == 0) {
|
||||
@@ -83,7 +83,7 @@ abstract class CoveringTryCatchNodeProcessor(parameterSize: Int) {
|
||||
}
|
||||
|
||||
|
||||
fun substituteLocalVarTable(node: MethodNode) {
|
||||
public fun substituteLocalVarTable(node: MethodNode) {
|
||||
node.localVariables.clear()
|
||||
for (info in localVarsMetaInfo.getMeaningfulIntervals()) {
|
||||
node.localVariables.add(info.node)
|
||||
@@ -165,16 +165,16 @@ private fun Interval.isMeaningless(): Boolean {
|
||||
val start = this.startLabel
|
||||
var end: AbstractInsnNode = this.endLabel
|
||||
while (end != start && !end.isMeaningful) {
|
||||
end = end.previous
|
||||
end = end.getPrevious()
|
||||
}
|
||||
return start == end
|
||||
}
|
||||
|
||||
fun <T : SplittableInterval<T>> IntervalMetaInfo<T>.getMeaningfulIntervals(): List<T> {
|
||||
public fun <T : SplittableInterval<T>> IntervalMetaInfo<T>.getMeaningfulIntervals(): List<T> {
|
||||
return allIntervals.filterNot { it.isMeaningless() }
|
||||
}
|
||||
|
||||
class DefaultProcessor(val node: MethodNode, parameterSize: Int) : CoveringTryCatchNodeProcessor(parameterSize) {
|
||||
public class DefaultProcessor(val node: MethodNode, parameterSize: Int) : CoveringTryCatchNodeProcessor(parameterSize) {
|
||||
|
||||
init {
|
||||
node.tryCatchBlocks.forEach { addTryNode(it) }
|
||||
@@ -194,7 +194,7 @@ class DefaultProcessor(val node: MethodNode, parameterSize: Int) : CoveringTryCa
|
||||
}
|
||||
}
|
||||
|
||||
class LocalVarNodeWrapper(val node: LocalVariableNode) : Interval, SplittableInterval<LocalVarNodeWrapper> {
|
||||
public class LocalVarNodeWrapper(val node: LocalVariableNode) : Interval, SplittableInterval<LocalVarNodeWrapper> {
|
||||
override val startLabel: LabelNode
|
||||
get() = node.start
|
||||
override val endLabel: LabelNode
|
||||
|
||||
@@ -19,7 +19,7 @@ package org.jetbrains.kotlin.codegen.inline
|
||||
import org.jetbrains.org.objectweb.asm.MethodVisitor
|
||||
import org.jetbrains.org.objectweb.asm.tree.MethodNode
|
||||
|
||||
class DeferredMethodVisitor(
|
||||
public class DeferredMethodVisitor(
|
||||
val intermediate: MethodNode,
|
||||
val resultNode: () -> MethodVisitor
|
||||
) : MethodVisitor(InlineCodegenUtil.API, intermediate) {
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.codegen.inline
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.descriptors.annotations.Annotations
|
||||
import org.jetbrains.kotlin.descriptors.impl.SimpleFunctionDescriptorImpl
|
||||
|
||||
internal class FictitiousArrayConstructor(arrayClass: ClassDescriptor) : SimpleFunctionDescriptorImpl(
|
||||
arrayClass.containingDeclaration, null, Annotations.EMPTY, arrayClass.name, CallableMemberDescriptor.Kind.SYNTHESIZED,
|
||||
SourceElement.NO_SOURCE
|
||||
) {
|
||||
companion object Factory {
|
||||
@JvmStatic
|
||||
fun create(arrayConstructor: ConstructorDescriptor): FictitiousArrayConstructor {
|
||||
val arrayClass = arrayConstructor.containingDeclaration
|
||||
return FictitiousArrayConstructor(arrayClass).apply {
|
||||
this.initialize(null, null, arrayConstructor.typeParameters, arrayConstructor.valueParameters, arrayClass.defaultType,
|
||||
Modality.FINAL, Visibilities.PUBLIC)
|
||||
this.isInline = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -23,8 +23,10 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.backend.common.CodegenUtil;
|
||||
import org.jetbrains.kotlin.codegen.*;
|
||||
import org.jetbrains.kotlin.codegen.context.*;
|
||||
import org.jetbrains.kotlin.codegen.intrinsics.IntrinsicArrayConstructorsKt;
|
||||
import org.jetbrains.kotlin.codegen.context.CodegenContext;
|
||||
import org.jetbrains.kotlin.codegen.context.FieldOwnerContext;
|
||||
import org.jetbrains.kotlin.codegen.context.MethodContext;
|
||||
import org.jetbrains.kotlin.codegen.context.PackageContext;
|
||||
import org.jetbrains.kotlin.codegen.state.GenerationState;
|
||||
import org.jetbrains.kotlin.codegen.state.JetTypeMapper;
|
||||
import org.jetbrains.kotlin.descriptors.*;
|
||||
@@ -70,7 +72,7 @@ public class InlineCodegen extends CallGenerator {
|
||||
private final GenerationState state;
|
||||
private final JetTypeMapper typeMapper;
|
||||
|
||||
private final FunctionDescriptor functionDescriptor;
|
||||
private final SimpleFunctionDescriptor functionDescriptor;
|
||||
private final JvmMethodSignature jvmSignature;
|
||||
private final KtElement callElement;
|
||||
private final MethodContext context;
|
||||
@@ -84,8 +86,6 @@ public class InlineCodegen extends CallGenerator {
|
||||
private final Map<Integer, LambdaInfo> expressionMap = new HashMap<Integer, LambdaInfo>();
|
||||
|
||||
private final ReifiedTypeInliner reifiedTypeInliner;
|
||||
@Nullable private final TypeParameterMappings typeParameterMappings;
|
||||
private final boolean isDefaultCompilation;
|
||||
|
||||
private LambdaInfo activeLambda;
|
||||
|
||||
@@ -94,23 +94,17 @@ public class InlineCodegen extends CallGenerator {
|
||||
public InlineCodegen(
|
||||
@NotNull ExpressionCodegen codegen,
|
||||
@NotNull GenerationState state,
|
||||
@NotNull FunctionDescriptor function,
|
||||
@NotNull SimpleFunctionDescriptor functionDescriptor,
|
||||
@NotNull KtElement callElement,
|
||||
@Nullable TypeParameterMappings typeParameterMappings,
|
||||
boolean isDefaultCompilation
|
||||
@Nullable ReifiedTypeParameterMappings typeParameterMappings
|
||||
) {
|
||||
assert InlineUtil.isInline(function) || InlineUtil.isArrayConstructorWithLambda(function) :
|
||||
"InlineCodegen can inline only inline functions and array constructors: " + function;
|
||||
this.isDefaultCompilation = isDefaultCompilation;
|
||||
assert InlineUtil.isInline(functionDescriptor) : "InlineCodegen could inline only inline function: " + functionDescriptor;
|
||||
|
||||
this.state = state;
|
||||
this.typeMapper = state.getTypeMapper();
|
||||
this.codegen = codegen;
|
||||
this.callElement = callElement;
|
||||
this.functionDescriptor =
|
||||
InlineUtil.isArrayConstructorWithLambda(function)
|
||||
? FictitiousArrayConstructor.create((ConstructorDescriptor) function)
|
||||
: function.getOriginal();
|
||||
this.typeParameterMappings = typeParameterMappings;
|
||||
this.functionDescriptor = functionDescriptor.getOriginal();
|
||||
|
||||
reifiedTypeInliner = new ReifiedTypeInliner(typeParameterMappings);
|
||||
|
||||
@@ -126,14 +120,13 @@ public class InlineCodegen extends CallGenerator {
|
||||
isSameModule = JvmCodegenUtil.isCallInsideSameModuleAsDeclared(functionDescriptor, codegen.getContext(), state.getOutDirectory());
|
||||
|
||||
sourceMapper = codegen.getParentCodegen().getOrCreateSourceMapper();
|
||||
|
||||
if (!(functionDescriptor instanceof FictitiousArrayConstructor)) {
|
||||
reportIncrementalInfo(functionDescriptor, codegen.getContext().getFunctionDescriptor().getOriginal());
|
||||
}
|
||||
reportIncrementalInfo(functionDescriptor, codegen.getContext().getFunctionDescriptor().getOriginal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void genCallWithoutAssertions(@NotNull CallableMethod callableMethod, @NotNull ExpressionCodegen codegen) {
|
||||
public void genCallWithoutAssertions(
|
||||
@NotNull CallableMethod callableMethod, @NotNull ExpressionCodegen codegen
|
||||
) {
|
||||
genCall(callableMethod, null, false, codegen);
|
||||
}
|
||||
|
||||
@@ -184,25 +177,19 @@ public class InlineCodegen extends CallGenerator {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private SMAPAndMethodNode createMethodNode(boolean callDefault) throws IOException {
|
||||
Method asmMethod = callDefault
|
||||
? typeMapper.mapDefaultMethod(functionDescriptor, context.getContextKind())
|
||||
: jvmSignature.getAsmMethod();
|
||||
private SMAPAndMethodNode createMethodNode(boolean callDefault) throws ClassNotFoundException, IOException {
|
||||
JvmMethodSignature jvmSignature = typeMapper.mapSignature(functionDescriptor, context.getContextKind());
|
||||
|
||||
Method asmMethod;
|
||||
if (callDefault) {
|
||||
asmMethod = typeMapper.mapDefaultMethod(functionDescriptor, context.getContextKind());
|
||||
}
|
||||
else {
|
||||
asmMethod = jvmSignature.getAsmMethod();
|
||||
}
|
||||
|
||||
SMAPAndMethodNode nodeAndSMAP;
|
||||
if (functionDescriptor instanceof FictitiousArrayConstructor) {
|
||||
nodeAndSMAP = InlineCodegenUtil.getMethodNode(
|
||||
IntrinsicArrayConstructorsKt.getBytecode(),
|
||||
asmMethod.getName(),
|
||||
asmMethod.getDescriptor(),
|
||||
IntrinsicArrayConstructorsKt.getClassId()
|
||||
);
|
||||
|
||||
if (nodeAndSMAP == null) {
|
||||
throw new IllegalStateException("Couldn't obtain array constructor body for " + descriptorName(functionDescriptor));
|
||||
}
|
||||
}
|
||||
else if (functionDescriptor instanceof DeserializedSimpleFunctionDescriptor) {
|
||||
if (functionDescriptor instanceof DeserializedSimpleFunctionDescriptor) {
|
||||
JetTypeMapper.ContainingClassesInfo containingClasses = typeMapper.getContainingClassesForDeserializedCallable(
|
||||
(DeserializedSimpleFunctionDescriptor) functionDescriptor);
|
||||
|
||||
@@ -217,14 +204,14 @@ public class InlineCodegen extends CallGenerator {
|
||||
);
|
||||
|
||||
if (nodeAndSMAP == null) {
|
||||
throw new IllegalStateException("Couldn't obtain compiled function body for " + descriptorName(functionDescriptor));
|
||||
throw new RuntimeException("Couldn't obtain compiled function body for " + descriptorName(functionDescriptor));
|
||||
}
|
||||
}
|
||||
else {
|
||||
PsiElement element = DescriptorToSourceUtils.descriptorToDeclaration(functionDescriptor);
|
||||
|
||||
if (!(element instanceof KtNamedFunction)) {
|
||||
throw new IllegalStateException("Couldn't find declaration for function " + descriptorName(functionDescriptor));
|
||||
if (element == null || !(element instanceof KtNamedFunction)) {
|
||||
throw new RuntimeException("Couldn't find declaration for function " + descriptorName(functionDescriptor));
|
||||
}
|
||||
KtNamedFunction inliningFunction = (KtNamedFunction) element;
|
||||
|
||||
@@ -247,7 +234,7 @@ public class InlineCodegen extends CallGenerator {
|
||||
implementationOwner.getInternalName());
|
||||
FunctionCodegen.generateDefaultImplBody(
|
||||
methodContext, functionDescriptor, maxCalcAdapter, DefaultParameterValueLoader.DEFAULT,
|
||||
inliningFunction, parentCodegen, asmMethod
|
||||
inliningFunction, parentCodegen
|
||||
);
|
||||
smap = createSMAPWithDefaultMapping(inliningFunction, parentCodegen.getOrCreateSourceMapper().getResultMappings());
|
||||
}
|
||||
@@ -274,14 +261,17 @@ public class InlineCodegen extends CallGenerator {
|
||||
|
||||
Parameters parameters = invocationParamBuilder.buildParameters();
|
||||
|
||||
InliningContext info = new RootInliningContext(
|
||||
expressionMap, state, codegen.getInlineNameGenerator().subGenerator(jvmSignature.getAsmMethod().getName()),
|
||||
codegen.getContext(), callElement, getInlineCallSiteInfo(), reifiedTypeInliner, typeParameterMappings, isDefaultCompilation
|
||||
);
|
||||
InliningContext info = new RootInliningContext(expressionMap,
|
||||
state,
|
||||
codegen.getInlineNameGenerator()
|
||||
.subGenerator(functionDescriptor.getName().asString()),
|
||||
codegen.getContext(),
|
||||
callElement,
|
||||
codegen.getParentCodegen().getClassName(), reifiedTypeInliner);
|
||||
|
||||
MethodInliner inliner = new MethodInliner(node, parameters, info, new FieldRemapper(null, null, parameters), isSameModule,
|
||||
"Method inlining " + callElement.getText(),
|
||||
createNestedSourceMapper(nodeAndSmap), info.getCallSiteInfo()); //with captured
|
||||
createNestedSourceMapper(nodeAndSmap)); //with captured
|
||||
|
||||
LocalVarRemapper remapper = new LocalVarRemapper(parameters, initialFrameSize);
|
||||
|
||||
@@ -313,22 +303,6 @@ public class InlineCodegen extends CallGenerator {
|
||||
return result;
|
||||
}
|
||||
|
||||
private InlineCallSiteInfo getInlineCallSiteInfo() {
|
||||
MethodContext context = codegen.getContext();
|
||||
MemberCodegen<?> parentCodegen = codegen.getParentCodegen();
|
||||
while (context instanceof InlineLambdaContext) {
|
||||
CodegenContext closureContext = context.getParentContext();
|
||||
assert closureContext instanceof ClosureContext : "Parent context of inline lambda should be closure context";
|
||||
assert closureContext.getParentContext() instanceof MethodContext : "Closure context should appear in method context";
|
||||
context = (MethodContext) closureContext.getParentContext();
|
||||
assert parentCodegen instanceof FakeMemberCodegen : "Parent codegen of inlined lambda should be FakeMemberCodegen";
|
||||
parentCodegen = ((FakeMemberCodegen) parentCodegen).delegate;
|
||||
}
|
||||
|
||||
JvmMethodSignature signature = typeMapper.mapSignature(context.getFunctionDescriptor(), context.getContextKind());
|
||||
return new InlineCallSiteInfo(parentCodegen.getClassName(), signature.getAsmMethod().getName(), signature.getAsmMethod().getDescriptor());
|
||||
}
|
||||
|
||||
private void generateClosuresBodies() {
|
||||
for (LambdaInfo info : expressionMap.values()) {
|
||||
info.setNode(generateLambdaBody(info));
|
||||
@@ -405,7 +379,7 @@ public class InlineCodegen extends CallGenerator {
|
||||
|
||||
private static class FakeMemberCodegen extends MemberCodegen {
|
||||
|
||||
@NotNull final MemberCodegen delegate;
|
||||
private final MemberCodegen delegate;
|
||||
@NotNull private final String className;
|
||||
|
||||
public FakeMemberCodegen(@NotNull MemberCodegen wrapped, @NotNull KtElement declaration, @NotNull FieldOwnerContext codegenContext, @NotNull String className) {
|
||||
@@ -447,6 +421,7 @@ public class InlineCodegen extends CallGenerator {
|
||||
public void afterParameterPut(
|
||||
@NotNull Type type,
|
||||
@Nullable StackValue stackValue,
|
||||
@Nullable ValueParameterDescriptor valueParameterDescriptor,
|
||||
int parameterIndex
|
||||
) {
|
||||
putArgumentOrCapturedToLocalVal(type, stackValue, -1, parameterIndex);
|
||||
@@ -539,11 +514,13 @@ public class InlineCodegen extends CallGenerator {
|
||||
|
||||
@Override
|
||||
public void putHiddenParams() {
|
||||
if ((getMethodAsmFlags(functionDescriptor, context.getContextKind()) & Opcodes.ACC_STATIC) == 0) {
|
||||
List<JvmMethodParameterSignature> valueParameters = jvmSignature.getValueParameters();
|
||||
|
||||
if (!isStaticMethod(functionDescriptor, context)) {
|
||||
invocationParamBuilder.addNextParameter(AsmTypes.OBJECT_TYPE, false, null);
|
||||
}
|
||||
|
||||
for (JvmMethodParameterSignature param : jvmSignature.getValueParameters()) {
|
||||
for (JvmMethodParameterSignature param : valueParameters) {
|
||||
if (param.getKind() == JvmMethodParameterKind.VALUE) {
|
||||
break;
|
||||
}
|
||||
@@ -651,6 +628,10 @@ public class InlineCodegen extends CallGenerator {
|
||||
throw new IllegalStateException("Couldn't build context for " + descriptorName(descriptor));
|
||||
}
|
||||
|
||||
private static boolean isStaticMethod(FunctionDescriptor functionDescriptor, MethodContext context) {
|
||||
return (getMethodAsmFlags(functionDescriptor, context.getContextKind()) & Opcodes.ACC_STATIC) != 0;
|
||||
}
|
||||
|
||||
private static String descriptorName(DeclarationDescriptor descriptor) {
|
||||
return DescriptorRenderer.SHORT_NAMES_IN_TYPES.render(descriptor);
|
||||
}
|
||||
@@ -667,19 +648,21 @@ public class InlineCodegen extends CallGenerator {
|
||||
}
|
||||
else {
|
||||
StackValue value = codegen.gen(argumentExpression);
|
||||
putValueIfNeeded(parameterType, value, valueParameterDescriptor.getIndex());
|
||||
putValueIfNeeded(valueParameterDescriptor, parameterType, value, valueParameterDescriptor.getIndex());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putValueIfNeeded(
|
||||
@Nullable ValueParameterDescriptor valueParameterDescriptor,
|
||||
@NotNull Type parameterType,
|
||||
@NotNull StackValue value
|
||||
) {
|
||||
putValueIfNeeded(parameterType, value, -1);
|
||||
putValueIfNeeded(valueParameterDescriptor, parameterType, value, -1);
|
||||
}
|
||||
|
||||
private void putValueIfNeeded(
|
||||
@Nullable ValueParameterDescriptor valueParameterDescriptor,
|
||||
@NotNull Type parameterType,
|
||||
@NotNull StackValue value,
|
||||
int index
|
||||
@@ -687,7 +670,7 @@ public class InlineCodegen extends CallGenerator {
|
||||
if (shouldPutValue(parameterType, value)) {
|
||||
value.put(parameterType, codegen.v);
|
||||
}
|
||||
afterParameterPut(parameterType, value, index);
|
||||
afterParameterPut(parameterType, value, valueParameterDescriptor, index);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -30,7 +30,6 @@ import org.jetbrains.kotlin.codegen.context.CodegenContext;
|
||||
import org.jetbrains.kotlin.codegen.context.CodegenContextUtil;
|
||||
import org.jetbrains.kotlin.codegen.context.InlineLambdaContext;
|
||||
import org.jetbrains.kotlin.codegen.context.MethodContext;
|
||||
import org.jetbrains.kotlin.codegen.intrinsics.IntrinsicArrayConstructorsKt;
|
||||
import org.jetbrains.kotlin.codegen.optimization.common.UtilKt;
|
||||
import org.jetbrains.kotlin.codegen.state.GenerationState;
|
||||
import org.jetbrains.kotlin.codegen.state.JetTypeMapper;
|
||||
@@ -63,7 +62,6 @@ public class InlineCodegenUtil {
|
||||
public static final int API = Opcodes.ASM5;
|
||||
|
||||
public static final String CAPTURED_FIELD_PREFIX = "$";
|
||||
public static final String NON_CAPTURED_FIELD_PREFIX = "$$";
|
||||
public static final String THIS$0 = "this$0";
|
||||
public static final String THIS = "this";
|
||||
public static final String RECEIVER$0 = "receiver$0";
|
||||
@@ -85,7 +83,7 @@ public class InlineCodegenUtil {
|
||||
final String methodName,
|
||||
final String methodDescriptor,
|
||||
ClassId classId
|
||||
) throws IOException {
|
||||
) throws ClassNotFoundException, IOException {
|
||||
ClassReader cr = new ClassReader(classData);
|
||||
final MethodNode[] node = new MethodNode[1];
|
||||
final String[] debugInfo = new String[2];
|
||||
@@ -95,7 +93,7 @@ public class InlineCodegenUtil {
|
||||
cr.accept(new ClassVisitor(API) {
|
||||
@Override
|
||||
public void visit(int version, int access, @NotNull String name, String signature, String superName, String[] interfaces) {
|
||||
assertVersionNotGreaterThanJava6(version, name);
|
||||
assertVersionNotGreaterThanJava6(version);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -128,24 +126,15 @@ public class InlineCodegenUtil {
|
||||
}
|
||||
}, ClassReader.SKIP_FRAMES | (GENERATE_SMAP ? 0 : ClassReader.SKIP_DEBUG));
|
||||
|
||||
if (node[0] == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (classId.equals(IntrinsicArrayConstructorsKt.getClassId())) {
|
||||
// Don't load source map for intrinsic array constructors
|
||||
debugInfo[0] = null;
|
||||
}
|
||||
|
||||
SMAP smap = SMAPParser.parseOrCreateDefault(debugInfo[1], debugInfo[0], classId.asString(), lines[0], lines[1]);
|
||||
return new SMAPAndMethodNode(node[0], smap);
|
||||
}
|
||||
|
||||
public static void assertVersionNotGreaterThanJava6(int version, String internalName) {
|
||||
public static void assertVersionNotGreaterThanJava6(int version) {
|
||||
// TODO: report a proper diagnostic
|
||||
if (version > Opcodes.V1_6 && !"true".equals(System.getProperty("kotlin.skip.bytecode.version.check"))) {
|
||||
if (version > Opcodes.V1_6) {
|
||||
throw new UnsupportedOperationException(
|
||||
"Cannot inline bytecode of class " + internalName + " which has version " + version + ". " +
|
||||
"Cannot inline bytecode of version " + version + ". " +
|
||||
"This compiler can only inline Java 1.6 bytecode (version " + Opcodes.V1_6 + ")"
|
||||
);
|
||||
}
|
||||
@@ -297,8 +286,7 @@ public class InlineCodegenUtil {
|
||||
|
||||
public static boolean isCapturedFieldName(@NotNull String fieldName) {
|
||||
// TODO: improve this heuristic
|
||||
return fieldName.startsWith(CAPTURED_FIELD_PREFIX) &&
|
||||
!fieldName.startsWith(NON_CAPTURED_FIELD_PREFIX) ||
|
||||
return fieldName.startsWith(CAPTURED_FIELD_PREFIX) ||
|
||||
THIS$0.equals(fieldName) ||
|
||||
RECEIVER$0.equals(fieldName);
|
||||
}
|
||||
|
||||
@@ -73,18 +73,17 @@ public class InliningContext {
|
||||
return subInline(nameGenerator.subGenerator("lambda"), map, true);
|
||||
}
|
||||
|
||||
private InliningContext subInline(NameGenerator generator, Map<String, String> additionalTypeMappings) {
|
||||
public InliningContext subInline(NameGenerator generator, Map<String, String> additionalTypeMappings) {
|
||||
return subInline(generator, additionalTypeMappings, isInliningLambda);
|
||||
}
|
||||
|
||||
public InliningContext subInlineWithClassRegeneration(@NotNull NameGenerator generator,
|
||||
@NotNull Map<String, String> newTypeMappings,
|
||||
@NotNull AnonymousObjectGeneration anonymousObjectGeneration,
|
||||
@NotNull InlineCallSiteInfo callSiteInfo
|
||||
@NotNull AnonymousObjectGeneration anonymousObjectGeneration
|
||||
) {
|
||||
return new RegeneratedClassContext(this, expressionMap, state, generator,
|
||||
TypeRemapper.createFrom(typeRemapper, newTypeMappings),
|
||||
reifedTypeInliner, isInliningLambda, anonymousObjectGeneration, callSiteInfo);
|
||||
new TypeRemapper(typeRemapper, newTypeMappings),
|
||||
reifedTypeInliner, isInliningLambda, anonymousObjectGeneration);
|
||||
}
|
||||
|
||||
public InliningContext subInline(NameGenerator generator, Map<String, String> additionalTypeMappings, boolean isInliningLambda) {
|
||||
@@ -97,15 +96,8 @@ public class InliningContext {
|
||||
boolean isInliningLambda,
|
||||
boolean isRegeneration
|
||||
) {
|
||||
//isInliningLambda && !this.isInliningLambda for root inline lambda
|
||||
return new InliningContext(this, expressionMap, state, generator,
|
||||
TypeRemapper.createFrom(
|
||||
typeRemapper,
|
||||
additionalTypeMappings,
|
||||
//root inline lambda
|
||||
isInliningLambda && !this.isInliningLambda
|
||||
),
|
||||
reifedTypeInliner, isInliningLambda, isRegeneration);
|
||||
new TypeRemapper(typeRemapper, additionalTypeMappings), reifedTypeInliner, isInliningLambda, isRegeneration);
|
||||
}
|
||||
|
||||
public boolean isRoot() {
|
||||
@@ -132,8 +124,8 @@ public class InliningContext {
|
||||
return isInliningLambda && !getParent().isInliningLambda;
|
||||
}
|
||||
|
||||
public InlineCallSiteInfo getCallSiteInfo() {
|
||||
public String getClassNameToInline() {
|
||||
assert parent != null : "At least root context should return proper value";
|
||||
return parent.getCallSiteInfo();
|
||||
return parent.getClassNameToInline();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,8 +94,8 @@ public class LocalVarRemapper {
|
||||
|
||||
public void visitLocalVariable(String name, String desc, String signature, Label start, Label end, int index, MethodVisitor mv) {
|
||||
RemapInfo info = doRemap(index);
|
||||
//add entries only for shifted vars or remapped to locals
|
||||
if (SHIFT == info.status || REMAPPED == info.status && info.value instanceof StackValue.Local) {
|
||||
//add entries only for shifted vars
|
||||
if (SHIFT == info.status) {
|
||||
int newIndex = ((StackValue.Local) info.value).index;
|
||||
mv.visitLocalVariable(name, desc, signature, start, end, newIndex);
|
||||
}
|
||||
|
||||
@@ -55,8 +55,6 @@ public class MethodInliner {
|
||||
|
||||
private final SourceMapper sourceMapper;
|
||||
|
||||
private final InlineCallSiteInfo inlineCallSiteInfo;
|
||||
|
||||
private final JetTypeMapper typeMapper;
|
||||
|
||||
private final List<InvokeCall> invokeCalls = new ArrayList<InvokeCall>();
|
||||
@@ -84,8 +82,7 @@ public class MethodInliner {
|
||||
@NotNull FieldRemapper nodeRemapper,
|
||||
boolean isSameModule,
|
||||
@NotNull String errorPrefix,
|
||||
@NotNull SourceMapper sourceMapper,
|
||||
@NotNull InlineCallSiteInfo inlineCallSiteInfo
|
||||
@NotNull SourceMapper sourceMapper
|
||||
) {
|
||||
this.node = node;
|
||||
this.parameters = parameters;
|
||||
@@ -94,7 +91,6 @@ public class MethodInliner {
|
||||
this.isSameModule = isSameModule;
|
||||
this.errorPrefix = errorPrefix;
|
||||
this.sourceMapper = sourceMapper;
|
||||
this.inlineCallSiteInfo = inlineCallSiteInfo;
|
||||
this.typeMapper = inliningContext.state.getTypeMapper();
|
||||
this.result = InlineResult.create();
|
||||
}
|
||||
@@ -149,7 +145,7 @@ public class MethodInliner {
|
||||
return result;
|
||||
}
|
||||
|
||||
private MethodNode doInline(final MethodNode node) {
|
||||
private MethodNode doInline(MethodNode node) {
|
||||
|
||||
final Deque<InvokeCall> currentInvokes = new LinkedList<InvokeCall>(invokeCalls);
|
||||
|
||||
@@ -158,12 +154,8 @@ public class MethodInliner {
|
||||
final Iterator<AnonymousObjectGeneration> iterator = anonymousObjectGenerations.iterator();
|
||||
|
||||
final TypeRemapper remapper = TypeRemapper.createFrom(currentTypeMapping);
|
||||
RemappingMethodAdapter remappingMethodAdapter = new RemappingMethodAdapter(
|
||||
resultNode.access,
|
||||
resultNode.desc,
|
||||
resultNode,
|
||||
new AsmTypeRemapper(remapper, inliningContext.getRoot().typeParameterMappings == null, result)
|
||||
);
|
||||
RemappingMethodAdapter remappingMethodAdapter = new RemappingMethodAdapter(resultNode.access, resultNode.desc, resultNode,
|
||||
remapper);
|
||||
|
||||
final int markerShift = InlineCodegenUtil.calcMarkerShift(parameters, node);
|
||||
InlineAdapter lambdaInliner = new InlineAdapter(remappingMethodAdapter, parameters.getArgsSizeOnStack(), sourceMapper) {
|
||||
@@ -183,8 +175,7 @@ public class MethodInliner {
|
||||
.subInlineWithClassRegeneration(
|
||||
inliningContext.nameGenerator,
|
||||
currentTypeMapping,
|
||||
anonymousObjectGen,
|
||||
inlineCallSiteInfo),
|
||||
anonymousObjectGen),
|
||||
isSameModule, Type.getObjectType(newClassName)
|
||||
);
|
||||
|
||||
@@ -248,7 +239,7 @@ public class MethodInliner {
|
||||
inliningContext.subInlineLambda(info),
|
||||
newCapturedRemapper, true /*cause all calls in same module as lambda*/,
|
||||
"Lambda inlining " + info.getLambdaClassType().getInternalName(),
|
||||
mapper, inlineCallSiteInfo);
|
||||
mapper);
|
||||
|
||||
LocalVarRemapper remapper = new LocalVarRemapper(lambdaParameters, valueParamShift);
|
||||
InlineResult lambdaResult = inliner.doInline(this.mv, remapper, true, info, invokeCall.finallyDepthShift);//TODO add skipped this and receiver
|
||||
@@ -370,10 +361,7 @@ public class MethodInliner {
|
||||
@NotNull String name, @NotNull String desc, String signature, @NotNull Label start, @NotNull Label end, int index
|
||||
) {
|
||||
if (isInliningLambda || InlineCodegenUtil.GENERATE_SMAP) {
|
||||
String varSuffix = inliningContext.isRoot() &&
|
||||
!((RootInliningContext) inliningContext).isDefaultCompilation &&
|
||||
!InlineCodegenUtil.isFakeLocalVariableForInline(name) ?
|
||||
INLINE_FUN_VAR_SUFFIX : "";
|
||||
String varSuffix = inliningContext.isRoot() && !InlineCodegenUtil.isFakeLocalVariableForInline(name) ? INLINE_FUN_VAR_SUFFIX : "";
|
||||
String varName = !varSuffix.isEmpty() && name.equals("this") ? name + "_" : name;
|
||||
super.visitLocalVariable(varName + varSuffix, desc, signature, start, end, getNewIndex(index));
|
||||
}
|
||||
@@ -647,7 +635,7 @@ public class MethodInliner {
|
||||
}
|
||||
}
|
||||
|
||||
private static void transformFinallyDeepIndex(@NotNull MethodNode node, int finallyDeepShift) {
|
||||
private void transformFinallyDeepIndex(@NotNull MethodNode node, int finallyDeepShift) {
|
||||
if (finallyDeepShift == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -24,10 +24,10 @@ internal class Parameters(val real: List<ParameterInfo>, val captured: List<Capt
|
||||
private val actualDeclShifts: Array<ParameterInfo?>
|
||||
private val paramToDeclByteCodeIndex: HashMap<ParameterInfo, Int> = hashMapOf()
|
||||
|
||||
val realArgsSizeOnStack = real.sumBy { it.type.size }
|
||||
val capturedArgsSizeOnStack = captured.sumBy { it.type.size }
|
||||
public val realArgsSizeOnStack = real.sumBy { it.type.size }
|
||||
public val capturedArgsSizeOnStack = captured.sumBy { it.type.size }
|
||||
|
||||
val argsSizeOnStack = realArgsSizeOnStack + capturedArgsSizeOnStack
|
||||
public val argsSizeOnStack = realArgsSizeOnStack + capturedArgsSizeOnStack
|
||||
|
||||
init {
|
||||
val declIndexesToActual = arrayOfNulls<Int>(argsSizeOnStack)
|
||||
|
||||
@@ -24,7 +24,6 @@ import java.util.Map;
|
||||
|
||||
public class RegeneratedClassContext extends InliningContext {
|
||||
private final AnonymousObjectGeneration anonymousObjectGeneration;
|
||||
private InlineCallSiteInfo callSiteInfo;
|
||||
|
||||
public RegeneratedClassContext(
|
||||
@Nullable InliningContext parent,
|
||||
@@ -34,15 +33,14 @@ public class RegeneratedClassContext extends InliningContext {
|
||||
@NotNull TypeRemapper typeRemapper,
|
||||
@NotNull ReifiedTypeInliner reifiedTypeInliner,
|
||||
boolean isInliningLambda,
|
||||
@NotNull AnonymousObjectGeneration anonymousObjectGeneration,
|
||||
@NotNull InlineCallSiteInfo callSiteInfo
|
||||
@NotNull AnonymousObjectGeneration anonymousObjectGeneration
|
||||
) {
|
||||
super(parent, map, state, nameGenerator, typeRemapper, reifiedTypeInliner, isInliningLambda, true);
|
||||
this.anonymousObjectGeneration = anonymousObjectGeneration;
|
||||
this.callSiteInfo = callSiteInfo;
|
||||
}
|
||||
|
||||
public InlineCallSiteInfo getCallSiteInfo() {
|
||||
return callSiteInfo;
|
||||
@Override
|
||||
public String getClassNameToInline() {
|
||||
return anonymousObjectGeneration.getOwnerInternalName();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,64 +22,46 @@ import org.jetbrains.kotlin.codegen.generateIsCheck
|
||||
import org.jetbrains.kotlin.codegen.intrinsics.IntrinsicMethods
|
||||
import org.jetbrains.kotlin.codegen.optimization.common.intConstant
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
import org.jetbrains.kotlin.types.Variance
|
||||
import org.jetbrains.kotlin.types.typeUtil.builtIns
|
||||
import org.jetbrains.kotlin.types.typeUtil.makeNullableIfNeeded
|
||||
import org.jetbrains.kotlin.types.TypeUtils
|
||||
import org.jetbrains.org.objectweb.asm.MethodVisitor
|
||||
import org.jetbrains.org.objectweb.asm.Opcodes
|
||||
import org.jetbrains.org.objectweb.asm.Type
|
||||
import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter
|
||||
import org.jetbrains.org.objectweb.asm.signature.SignatureReader
|
||||
import org.jetbrains.org.objectweb.asm.signature.SignatureWriter
|
||||
import org.jetbrains.org.objectweb.asm.tree.*
|
||||
|
||||
class ReificationArgument(
|
||||
val parameterName: String, val nullable: Boolean, val arrayDepth: Int
|
||||
) {
|
||||
fun asString() = "[".repeat(arrayDepth) + parameterName + (if (nullable) "?" else "")
|
||||
fun combine(replacement: ReificationArgument) =
|
||||
ReificationArgument(
|
||||
replacement.parameterName,
|
||||
this.nullable || (replacement.nullable && this.arrayDepth == 0),
|
||||
this.arrayDepth + replacement.arrayDepth)
|
||||
private class ParameterNameAndNullability(val name: String, val nullable: Boolean)
|
||||
|
||||
fun reify(replacementAsmType: Type, kotlinType: KotlinType) =
|
||||
Pair(Type.getType("[".repeat(arrayDepth) + replacementAsmType), kotlinType.arrayOf(arrayDepth).makeNullableIfNeeded(nullable))
|
||||
|
||||
private fun KotlinType.arrayOf(arrayDepth: Int): KotlinType {
|
||||
val builtins = this.builtIns
|
||||
var currentType = this
|
||||
|
||||
repeat(arrayDepth) {
|
||||
currentType = builtins.getArrayType(Variance.INVARIANT, currentType)
|
||||
}
|
||||
|
||||
return currentType
|
||||
}
|
||||
}
|
||||
|
||||
class ReifiedTypeInliner(private val parametersMapping: TypeParameterMappings?) {
|
||||
public class ReifiedTypeInliner(private val parametersMapping: ReifiedTypeParameterMappings?) {
|
||||
|
||||
enum class OperationKind {
|
||||
NEW_ARRAY, AS, SAFE_AS, IS, JAVA_CLASS;
|
||||
|
||||
val id: Int get() = ordinal
|
||||
val isTypeNullabilityAware: Boolean get() = this == AS || this == IS
|
||||
}
|
||||
|
||||
companion object {
|
||||
@JvmField val REIFIED_OPERATION_MARKER_METHOD_NAME = "reifiedOperationMarker"
|
||||
@JvmField val NEED_CLASS_REIFICATION_MARKER_METHOD_NAME = "needClassReification"
|
||||
@JvmField
|
||||
public val REIFIED_OPERATION_MARKER_METHOD_NAME = "reifiedOperationMarker"
|
||||
@JvmField
|
||||
public val NEED_CLASS_REIFICATION_MARKER_METHOD_NAME = "needClassReification"
|
||||
|
||||
private fun isOperationReifiedMarker(insn: AbstractInsnNode) =
|
||||
isReifiedMarker(insn) { it == REIFIED_OPERATION_MARKER_METHOD_NAME }
|
||||
|
||||
private fun isReifiedMarker(insn: AbstractInsnNode, namePredicate: (String) -> Boolean): Boolean {
|
||||
if (insn.opcode != Opcodes.INVOKESTATIC || insn !is MethodInsnNode) return false
|
||||
if (insn.getOpcode() != Opcodes.INVOKESTATIC || insn !is MethodInsnNode) return false
|
||||
return insn.owner == IntrinsicMethods.INTRINSICS_CLASS_NAME && namePredicate(insn.name)
|
||||
}
|
||||
|
||||
@JvmStatic fun isNeedClassReificationMarker(insn: AbstractInsnNode): Boolean =
|
||||
@JvmStatic
|
||||
public fun isNeedClassReificationMarker(insn: AbstractInsnNode): Boolean =
|
||||
isReifiedMarker(insn) { s -> s == NEED_CLASS_REIFICATION_MARKER_METHOD_NAME }
|
||||
|
||||
@JvmStatic fun putNeedClassReificationMarker(v: MethodVisitor) {
|
||||
@JvmStatic
|
||||
public fun putNeedClassReificationMarker(v: MethodVisitor) {
|
||||
v.visitMethodInsn(
|
||||
Opcodes.INVOKESTATIC,
|
||||
IntrinsicMethods.INTRINSICS_CLASS_NAME, NEED_CLASS_REIFICATION_MARKER_METHOD_NAME,
|
||||
@@ -90,16 +72,13 @@ class ReifiedTypeInliner(private val parametersMapping: TypeParameterMappings?)
|
||||
|
||||
private var maxStackSize = 0
|
||||
|
||||
private val hasReifiedParameters = parametersMapping?.hasReifiedParameters() ?: false
|
||||
|
||||
/**
|
||||
* @return set of type parameters' identifiers contained in markers that should be reified further
|
||||
* e.g. when we're generating inline function containing reified T
|
||||
* and another function containing reifiable parts is inlined into that function
|
||||
*/
|
||||
fun reifyInstructions(node: MethodNode): ReifiedTypeParametersUsages {
|
||||
if (!hasReifiedParameters) return ReifiedTypeParametersUsages()
|
||||
|
||||
public fun reifyInstructions(node: MethodNode): ReifiedTypeParametersUsages {
|
||||
if (parametersMapping == null) return ReifiedTypeParametersUsages()
|
||||
val instructions = node.instructions
|
||||
maxStackSize = 0
|
||||
var result = ReifiedTypeParametersUsages()
|
||||
@@ -116,21 +95,62 @@ class ReifiedTypeInliner(private val parametersMapping: TypeParameterMappings?)
|
||||
return result
|
||||
}
|
||||
|
||||
public fun reifySignature(oldSignature: String): SignatureReificationResult {
|
||||
if (parametersMapping == null) return SignatureReificationResult(oldSignature, ReifiedTypeParametersUsages())
|
||||
|
||||
val signatureRemapper = object : SignatureWriter() {
|
||||
var typeParamsToReify = ReifiedTypeParametersUsages()
|
||||
override fun visitTypeVariable(name: String?) {
|
||||
val mapping = getMappingByName(name) ?:
|
||||
return super.visitTypeVariable(name)
|
||||
if (mapping.newName != null) {
|
||||
typeParamsToReify.addUsedReifiedParameter(mapping.newName)
|
||||
return super.visitTypeVariable(mapping.newName)
|
||||
}
|
||||
|
||||
// else TypeVariable is replaced by concrete type
|
||||
SignatureReader(mapping.signature).accept(this)
|
||||
}
|
||||
|
||||
override fun visitFormalTypeParameter(name: String?) {
|
||||
val mapping = getMappingByName(name) ?:
|
||||
return super.visitFormalTypeParameter(name)
|
||||
if (mapping.newName != null) {
|
||||
typeParamsToReify.addUsedReifiedParameter(mapping.newName)
|
||||
super.visitFormalTypeParameter(mapping.newName)
|
||||
}
|
||||
}
|
||||
|
||||
private fun getMappingByName(name: String?) = parametersMapping[name!!]
|
||||
}
|
||||
|
||||
SignatureReader(oldSignature).accept(signatureRemapper)
|
||||
|
||||
return SignatureReificationResult(signatureRemapper.toString(), signatureRemapper.typeParamsToReify)
|
||||
}
|
||||
|
||||
data class SignatureReificationResult(val newSignature: String, val typeParametersUsages: ReifiedTypeParametersUsages)
|
||||
|
||||
/**
|
||||
* @return new type parameter identifier if this marker should be reified further
|
||||
* or null if it shouldn't
|
||||
*/
|
||||
private fun processReifyMarker(insn: MethodInsnNode, instructions: InsnList): String? {
|
||||
val operationKind = insn.operationKind ?: return null
|
||||
val reificationArgument = insn.reificationArgument ?: return null
|
||||
val mapping = parametersMapping?.get(reificationArgument.parameterName) ?: return null
|
||||
val parameter = insn.parameterNameAndNullability ?: return null
|
||||
val mapping = parametersMapping?.get(parameter.name) ?: return null
|
||||
val kotlinType =
|
||||
if (operationKind.isTypeNullabilityAware && parameter.nullable)
|
||||
TypeUtils.makeNullable(mapping.type)
|
||||
else
|
||||
mapping.type
|
||||
|
||||
if (mapping.asmType != null) {
|
||||
|
||||
val asmType = mapping.asmType
|
||||
if (asmType != null) {
|
||||
// process* methods return false if marker should be reified further
|
||||
// or it's invalid (may be emitted explicitly in code)
|
||||
// they return true if instruction is reified and marker can be deleted
|
||||
val (asmType, kotlinType) = reificationArgument.reify(mapping.asmType, mapping.type)
|
||||
|
||||
if (when (operationKind) {
|
||||
OperationKind.NEW_ARRAY -> processNewArray(insn, asmType)
|
||||
OperationKind.AS -> processAs(insn, instructions, kotlinType, asmType, safe = false)
|
||||
@@ -145,9 +165,9 @@ class ReifiedTypeInliner(private val parametersMapping: TypeParameterMappings?)
|
||||
|
||||
return null
|
||||
} else {
|
||||
val newReificationArgument = reificationArgument.combine(mapping.reificationArgument!!)
|
||||
instructions.set(insn.previous!!, LdcInsnNode(newReificationArgument.asString()))
|
||||
return mapping.reificationArgument.parameterName
|
||||
val nullableSuffix = if (operationKind.isTypeNullabilityAware && kotlinType.isMarkedNullable) "?" else ""
|
||||
instructions.set(insn.previous!!, LdcInsnNode(mapping.newName + nullableSuffix))
|
||||
return mapping.newName
|
||||
}
|
||||
}
|
||||
|
||||
@@ -203,13 +223,13 @@ class ReifiedTypeInliner(private val parametersMapping: TypeParameterMappings?)
|
||||
}
|
||||
|
||||
private fun processNextTypeInsn(insn: MethodInsnNode, parameter: Type, expectedNextOpcode: Int): Boolean {
|
||||
if (insn.next?.opcode != expectedNextOpcode) return false
|
||||
(insn.next as TypeInsnNode).desc = parameter.internalName
|
||||
if (insn.getNext()?.getOpcode() != expectedNextOpcode) return false
|
||||
(insn.getNext() as TypeInsnNode).desc = parameter.getInternalName()
|
||||
return true
|
||||
}
|
||||
|
||||
private fun processJavaClass(insn: MethodInsnNode, parameter: Type): Boolean {
|
||||
val next = insn.next
|
||||
val next = insn.getNext()
|
||||
if (next !is LdcInsnNode) return false
|
||||
next.cst = parameter
|
||||
return true
|
||||
@@ -217,20 +237,17 @@ class ReifiedTypeInliner(private val parametersMapping: TypeParameterMappings?)
|
||||
|
||||
}
|
||||
|
||||
private val MethodInsnNode.reificationArgument: ReificationArgument?
|
||||
private val MethodInsnNode.parameterNameAndNullability: ParameterNameAndNullability?
|
||||
get() {
|
||||
val prev = previous!!
|
||||
|
||||
val reificationArgumentRaw = when (prev.opcode) {
|
||||
val parameterNameWithFlag = when (prev.opcode) {
|
||||
Opcodes.LDC -> (prev as LdcInsnNode).cst as String
|
||||
else -> return null
|
||||
}
|
||||
|
||||
val arrayDepth = reificationArgumentRaw.indexOfFirst { it != '[' }
|
||||
val parameterName = reificationArgumentRaw.substring(arrayDepth).removeSuffix("?")
|
||||
val nullable = reificationArgumentRaw.endsWith('?')
|
||||
|
||||
return ReificationArgument(parameterName, nullable, arrayDepth)
|
||||
val parameterName = if (parameterNameWithFlag.endsWith("?")) parameterNameWithFlag.dropLast(1) else parameterNameWithFlag
|
||||
return ParameterNameAndNullability(parameterName, parameterName !== parameterNameWithFlag)
|
||||
}
|
||||
|
||||
private val MethodInsnNode.operationKind: ReifiedTypeInliner.OperationKind? get() =
|
||||
@@ -238,46 +255,36 @@ private val MethodInsnNode.operationKind: ReifiedTypeInliner.OperationKind? get(
|
||||
ReifiedTypeInliner.OperationKind.values().getOrNull(it)
|
||||
}
|
||||
|
||||
class TypeParameterMappings() {
|
||||
private val mappingsByName = hashMapOf<String, TypeParameterMapping>()
|
||||
public class ReifiedTypeParameterMappings() {
|
||||
private val mappingsByName = hashMapOf<String, ReifiedTypeParameterMapping>()
|
||||
|
||||
fun addParameterMappingToType(name: String, type: KotlinType, asmType: Type, signature: String, isReified: Boolean) {
|
||||
mappingsByName[name] = TypeParameterMapping(name, type, asmType, reificationArgument = null, signature = signature, isReified = isReified)
|
||||
public fun addParameterMappingToType(name: String, type: KotlinType, asmType: Type, signature: String) {
|
||||
mappingsByName[name] = ReifiedTypeParameterMapping(name, type, asmType, newName = null, signature = signature)
|
||||
}
|
||||
|
||||
fun addParameterMappingForFurtherReification(name: String, type: KotlinType, reificationArgument: ReificationArgument, isReified: Boolean) {
|
||||
mappingsByName[name] = TypeParameterMapping(name, type, asmType = null, reificationArgument = reificationArgument, signature = null, isReified = isReified)
|
||||
public fun addParameterMappingToNewParameter(name: String, type: KotlinType, newName: String) {
|
||||
mappingsByName[name] = ReifiedTypeParameterMapping(name, type = type, asmType = null, newName = newName, signature = null)
|
||||
}
|
||||
|
||||
operator fun get(name: String): TypeParameterMapping? {
|
||||
operator fun get(name: String): ReifiedTypeParameterMapping? {
|
||||
return mappingsByName[name]
|
||||
}
|
||||
|
||||
fun hasReifiedParameters() = mappingsByName.values.any { it.isReified }
|
||||
|
||||
internal inline fun forEach(l: (TypeParameterMapping) -> Unit) {
|
||||
mappingsByName.values.forEach(l)
|
||||
}
|
||||
}
|
||||
|
||||
class TypeParameterMapping(
|
||||
val name: String, val type: KotlinType,
|
||||
val asmType: Type?,
|
||||
val reificationArgument: ReificationArgument?,
|
||||
val signature: String?,
|
||||
val isReified: Boolean
|
||||
public class ReifiedTypeParameterMapping(
|
||||
val name: String, val type: KotlinType, val asmType: Type?, val newName: String?, val signature: String?
|
||||
)
|
||||
|
||||
class ReifiedTypeParametersUsages {
|
||||
public class ReifiedTypeParametersUsages {
|
||||
val usedTypeParameters: MutableSet<String> = hashSetOf()
|
||||
|
||||
fun wereUsedReifiedParameters(): Boolean = usedTypeParameters.isNotEmpty()
|
||||
public fun wereUsedReifiedParameters(): Boolean = usedTypeParameters.isNotEmpty()
|
||||
|
||||
fun addUsedReifiedParameter(name: String) {
|
||||
public fun addUsedReifiedParameter(name: String) {
|
||||
usedTypeParameters.add(name)
|
||||
}
|
||||
|
||||
fun propagateChildUsagesWithinContext(child: ReifiedTypeParametersUsages, context: MethodContext) {
|
||||
public fun propagateChildUsagesWithinContext(child: ReifiedTypeParametersUsages, context: MethodContext) {
|
||||
if (!child.wereUsedReifiedParameters()) return
|
||||
// used for propagating reified TP usages from children member codegen to parent's
|
||||
// mark enclosing object-literal/lambda as needed reification iff
|
||||
@@ -291,7 +298,7 @@ class ReifiedTypeParametersUsages {
|
||||
}.forEach { usedTypeParameters.add(it) }
|
||||
}
|
||||
|
||||
fun mergeAll(other: ReifiedTypeParametersUsages) {
|
||||
public fun mergeAll(other: ReifiedTypeParametersUsages) {
|
||||
if (!other.wereUsedReifiedParameters()) return
|
||||
usedTypeParameters.addAll(other.usedTypeParameters)
|
||||
}
|
||||
|
||||
@@ -52,10 +52,7 @@ public class RemappingClassBuilder extends DelegatingClassBuilder {
|
||||
@Nullable String signature,
|
||||
@Nullable Object value
|
||||
) {
|
||||
return new RemappingFieldAdapter(
|
||||
builder.newField(origin, access, name, remapper.mapDesc(desc), remapper.mapSignature(signature, true), value),
|
||||
remapper
|
||||
);
|
||||
return new RemappingFieldAdapter(builder.newField(origin, access, name, remapper.mapDesc(desc), signature, value), remapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -68,11 +65,9 @@ public class RemappingClassBuilder extends DelegatingClassBuilder {
|
||||
@Nullable String signature,
|
||||
@Nullable String[] exceptions
|
||||
) {
|
||||
return new RemappingMethodAdapter(
|
||||
access, desc,
|
||||
builder.newMethod(origin, access, name, remapper.mapMethodDesc(desc), remapper.mapSignature(signature, false), exceptions),
|
||||
remapper
|
||||
);
|
||||
return new RemappingMethodAdapter(access, desc,
|
||||
builder.newMethod(origin, access, name, remapper.mapMethodDesc(desc), signature, exceptions),
|
||||
remapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -86,4 +81,5 @@ public class RemappingClassBuilder extends DelegatingClassBuilder {
|
||||
public ClassVisitor getVisitor() {
|
||||
return new RemappingClassAdapter(builder.getVisitor(), remapper);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
package org.jetbrains.kotlin.codegen.inline;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.codegen.context.CodegenContext;
|
||||
import org.jetbrains.kotlin.codegen.state.GenerationState;
|
||||
import org.jetbrains.kotlin.psi.KtElement;
|
||||
@@ -26,9 +25,7 @@ import java.util.Map;
|
||||
|
||||
public class RootInliningContext extends InliningContext {
|
||||
public final CodegenContext startContext;
|
||||
private final InlineCallSiteInfo inlineCallSiteInfo;
|
||||
public final TypeParameterMappings typeParameterMappings;
|
||||
public final boolean isDefaultCompilation;
|
||||
private final String classNameToInline;
|
||||
public final KtElement callElement;
|
||||
|
||||
public RootInliningContext(
|
||||
@@ -37,21 +34,18 @@ public class RootInliningContext extends InliningContext {
|
||||
@NotNull NameGenerator nameGenerator,
|
||||
@NotNull CodegenContext startContext,
|
||||
@NotNull KtElement callElement,
|
||||
@NotNull InlineCallSiteInfo classNameToInline,
|
||||
@NotNull ReifiedTypeInliner inliner,
|
||||
@Nullable TypeParameterMappings typeParameterMappings,
|
||||
boolean isDefaultCompilation
|
||||
@NotNull String classNameToInline,
|
||||
@NotNull ReifiedTypeInliner inliner
|
||||
) {
|
||||
super(null, map, state, nameGenerator, TypeRemapper.createRoot(typeParameterMappings), inliner, false, false);
|
||||
super(null, map, state, nameGenerator, TypeRemapper.createEmpty(), inliner, false, false);
|
||||
this.callElement = callElement;
|
||||
this.startContext = startContext;
|
||||
this.inlineCallSiteInfo = classNameToInline;
|
||||
this.typeParameterMappings = typeParameterMappings;
|
||||
this.isDefaultCompilation = isDefaultCompilation;
|
||||
this.classNameToInline = classNameToInline;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InlineCallSiteInfo getCallSiteInfo() {
|
||||
return inlineCallSiteInfo;
|
||||
@NotNull
|
||||
public String getClassNameToInline() {
|
||||
return classNameToInline;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,12 +24,11 @@ import org.jetbrains.org.objectweb.asm.MethodVisitor
|
||||
import java.util.*
|
||||
|
||||
//TODO join parameter
|
||||
class SMAPBuilder(
|
||||
val source: String,
|
||||
val path: String,
|
||||
val fileMappings: List<FileMapping>
|
||||
) {
|
||||
private val header = "SMAP\n$source\nKotlin\n*S Kotlin"
|
||||
public class SMAPBuilder(val source: String,
|
||||
val path: String,
|
||||
val fileMappings: List<FileMapping>) {
|
||||
|
||||
val header = "SMAP\n$source\nKotlin\n*S Kotlin"
|
||||
|
||||
fun build(): String? {
|
||||
var realMappings = fileMappings.filter {
|
||||
@@ -38,7 +37,7 @@ class SMAPBuilder(
|
||||
}
|
||||
|
||||
if (realMappings.isEmpty()) {
|
||||
return null
|
||||
return null;
|
||||
}
|
||||
|
||||
val fileIds = "*F" + realMappings.mapIndexed { id, file -> "\n${file.toSMAPFile(id + 1)}" }.joinToString("")
|
||||
@@ -47,29 +46,29 @@ class SMAPBuilder(
|
||||
return "$header\n$fileIds\n$lineMappings\n*E\n"
|
||||
}
|
||||
|
||||
private fun RangeMapping.toSMAP(fileId: Int): String {
|
||||
|
||||
fun RangeMapping.toSMAP(fileId: Int): String {
|
||||
return if (range == 1) "$source#$fileId:$dest" else "$source#$fileId,$range:$dest"
|
||||
}
|
||||
|
||||
private fun FileMapping.toSMAPFile(id: Int): String {
|
||||
this.id = id
|
||||
fun FileMapping.toSMAPFile(id: Int): String {
|
||||
this.id = id;
|
||||
return "+ $id $name\n$path"
|
||||
}
|
||||
|
||||
//TODO inline
|
||||
private fun FileMapping.toSMAPMapping(): String {
|
||||
fun FileMapping.toSMAPMapping(): String {
|
||||
return lineMappings.joinToString("") { "\n${it.toSMAP(id)}" }
|
||||
}
|
||||
}
|
||||
|
||||
open class NestedSourceMapper(
|
||||
parent: SourceMapper, val ranges: List<RangeMapping>, sourceInfo: SourceInfo
|
||||
) : DefaultSourceMapper(sourceInfo, parent) {
|
||||
public open class NestedSourceMapper(parent: SourceMapper, val ranges: List<RangeMapping>, sourceInfo: SourceInfo) : DefaultSourceMapper(sourceInfo, parent) {
|
||||
|
||||
override fun visitLineNumber(iv: MethodVisitor, lineNumber: Int, start: Label) {
|
||||
val index = ranges.binarySearch(RangeMapping(lineNumber, lineNumber, 1), Comparator {
|
||||
val index = Collections.binarySearch(ranges, RangeMapping(lineNumber, lineNumber, 1)) {
|
||||
value, key ->
|
||||
if (key.dest in value) 0 else RangeMapping.Comparator.compare(value, key)
|
||||
})
|
||||
if (value.contains(key.dest)) 0 else RangeMapping.Comparator.compare(value, key)
|
||||
}
|
||||
if (index < 0) {
|
||||
parent!!.visitSource(sourceInfo.source, sourceInfo.pathOrCleanFQN)
|
||||
parent!!.visitLineNumber(iv, lineNumber, start)
|
||||
@@ -82,9 +81,8 @@ open class NestedSourceMapper(
|
||||
}
|
||||
}
|
||||
|
||||
open class InlineLambdaSourceMapper(
|
||||
parent: SourceMapper, smap: SMAPAndMethodNode
|
||||
) : NestedSourceMapper(parent, smap.ranges, smap.classSMAP.sourceInfo) {
|
||||
public open class InlineLambdaSourceMapper(parent: SourceMapper, smap: SMAPAndMethodNode) : NestedSourceMapper(parent, smap.ranges, smap.classSMAP.sourceInfo) {
|
||||
|
||||
override fun visitSource(name: String, path: String) {
|
||||
super.visitSource(name, path)
|
||||
if (isOriginalVisited()) {
|
||||
@@ -102,13 +100,13 @@ open class InlineLambdaSourceMapper(
|
||||
}
|
||||
|
||||
override fun visitLineNumber(iv: MethodVisitor, lineNumber: Int, start: Label) {
|
||||
val index = ranges.binarySearch(RangeMapping(lineNumber, lineNumber, 1), Comparator {
|
||||
val index = Collections.binarySearch(ranges, RangeMapping(lineNumber, lineNumber, 1)) {
|
||||
value, key ->
|
||||
if (key.dest in value) 0 else RangeMapping.Comparator.compare(value, key)
|
||||
})
|
||||
if (value.contains(key.dest)) 0 else RangeMapping.Comparator.compare(value, key)
|
||||
}
|
||||
if (index >= 0) {
|
||||
val mapping = ranges[index].parent!!
|
||||
if (mapping.path == origin.path && mapping.name == origin.name) {
|
||||
val fmapping = ranges[index].parent!!
|
||||
if (fmapping.path == origin.path && fmapping.name == origin.name) {
|
||||
parent!!.visitOrigin()
|
||||
parent!!.visitLineNumber(iv, lineNumber, start)
|
||||
return
|
||||
@@ -119,6 +117,7 @@ open class InlineLambdaSourceMapper(
|
||||
}
|
||||
|
||||
interface SourceMapper {
|
||||
|
||||
val resultMappings: List<FileMapping>
|
||||
val parent: SourceMapper?
|
||||
|
||||
@@ -139,6 +138,7 @@ interface SourceMapper {
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
fun flushToClassBuilder(mapper: SourceMapper, v: ClassBuilder) {
|
||||
for (fileMapping in mapper.resultMappings) {
|
||||
v.addSMAP(fileMapping)
|
||||
@@ -162,7 +162,7 @@ interface SourceMapper {
|
||||
}
|
||||
}
|
||||
|
||||
object IdenticalSourceMapper : SourceMapper {
|
||||
public object IdenticalSourceMapper : SourceMapper {
|
||||
override val resultMappings: List<FileMapping>
|
||||
get() = emptyList()
|
||||
|
||||
@@ -178,11 +178,16 @@ object IdenticalSourceMapper : SourceMapper {
|
||||
}
|
||||
}
|
||||
|
||||
open class DefaultSourceMapper(val sourceInfo: SourceInfo, override val parent: SourceMapper?): SourceMapper {
|
||||
public open class DefaultSourceMapper(val sourceInfo: SourceInfo, override val parent: SourceMapper?): SourceMapper {
|
||||
|
||||
protected var maxUsedValue: Int = sourceInfo.linesInFile
|
||||
|
||||
var lastVisited: RawFileMapping? = null
|
||||
|
||||
private var lastMappedWithChanges: RawFileMapping? = null
|
||||
private var fileMappings: LinkedHashMap<String, RawFileMapping> = linkedMapOf()
|
||||
|
||||
var fileMappings: LinkedHashMap<String, RawFileMapping> = linkedMapOf()
|
||||
|
||||
protected val origin: RawFileMapping
|
||||
|
||||
init {
|
||||
@@ -200,7 +205,7 @@ open class DefaultSourceMapper(val sourceInfo: SourceInfo, override val parent:
|
||||
get() = fileMappings.values.map { it.toFileMapping() }
|
||||
|
||||
override fun visitSource(name: String, path: String) {
|
||||
lastVisited = fileMappings.getOrPut(createKey(name, path)) { RawFileMapping(name, path) }
|
||||
lastVisited = fileMappings.getOrPut(createKey(name, path), { RawFileMapping(name, path) })
|
||||
}
|
||||
|
||||
override fun visitOrigin() {
|
||||
@@ -227,6 +232,7 @@ open class DefaultSourceMapper(val sourceInfo: SourceInfo, override val parent:
|
||||
}
|
||||
}
|
||||
|
||||
/*Source Mapping*/
|
||||
class SMAP(val fileMappings: List<FileMapping>) {
|
||||
init {
|
||||
assert(fileMappings.isNotEmpty()) { "File Mappings shouldn't be empty" }
|
||||
@@ -245,7 +251,9 @@ class SMAP(val fileMappings: List<FileMapping>) {
|
||||
|
||||
companion object {
|
||||
val FILE_SECTION = "*F"
|
||||
|
||||
val LINE_SECTION = "*L"
|
||||
|
||||
val END = "*E"
|
||||
}
|
||||
}
|
||||
@@ -254,17 +262,18 @@ class RawFileMapping(val name: String, val path: String) {
|
||||
private val lineMappings = TIntIntHashMap()
|
||||
private val rangeMappings = arrayListOf<RangeMapping>()
|
||||
|
||||
private var lastMappedWithNewIndex = -1000
|
||||
private var lastMappedWithNewIndex = -1000;
|
||||
|
||||
fun toFileMapping() =
|
||||
FileMapping(name, path).apply {
|
||||
for (range in rangeMappings) {
|
||||
addRangeMapping(range)
|
||||
}
|
||||
}
|
||||
fun toFileMapping(): FileMapping {
|
||||
val fileMapping = FileMapping(name, path)
|
||||
for (range in rangeMappings) {
|
||||
fileMapping.addRangeMapping(range)
|
||||
}
|
||||
return fileMapping
|
||||
}
|
||||
|
||||
fun initRange(start: Int, end: Int) {
|
||||
assert(lineMappings.isEmpty) { "initRange should only be called for empty mapping" }
|
||||
assert(lineMappings.isEmpty()) { "initRange should only be called for empty mapping" }
|
||||
for (index in start..end) {
|
||||
lineMappings.put(index, index)
|
||||
}
|
||||
@@ -306,20 +315,21 @@ class RawFileMapping(val name: String, val path: String) {
|
||||
private fun couldFoldInRange(first: Int, second: Int): Boolean {
|
||||
//TODO
|
||||
val delta = second - first
|
||||
return delta > 0 && delta <= 10
|
||||
return delta > 0 && delta <= 10;
|
||||
}
|
||||
}
|
||||
|
||||
open class FileMapping(val name: String, val path: String) {
|
||||
open public class FileMapping(val name: String, val path: String) {
|
||||
val lineMappings = arrayListOf<RangeMapping>()
|
||||
var id = -1
|
||||
|
||||
var id = -1;
|
||||
|
||||
fun addRangeMapping(lineMapping: RangeMapping) {
|
||||
lineMappings.add(lineMapping)
|
||||
lineMapping.parent = this
|
||||
}
|
||||
|
||||
object SKIP : FileMapping("no-source-info", "no-source-info") {
|
||||
public object SKIP : FileMapping("no-source-info", "no-source-info") {
|
||||
init {
|
||||
addRangeMapping(RangeMapping.SKIP)
|
||||
}
|
||||
@@ -327,11 +337,13 @@ open class FileMapping(val name: String, val path: String) {
|
||||
}
|
||||
|
||||
//TODO comparable
|
||||
data class RangeMapping(val source: Int, val dest: Int, var range: Int = 1) {
|
||||
var parent: FileMapping? = null
|
||||
data public class RangeMapping(val source: Int, val dest: Int, var range: Int = 1) {
|
||||
|
||||
var parent: FileMapping? = null;
|
||||
|
||||
private val skip = source == -1 && dest == -1
|
||||
|
||||
operator fun contains(destLine: Int): Boolean {
|
||||
fun contains(destLine: Int): Boolean {
|
||||
return if (skip) true else dest <= destLine && destLine < dest + range
|
||||
}
|
||||
|
||||
@@ -354,6 +366,6 @@ data class RangeMapping(val source: Int, val dest: Int, var range: Int = 1) {
|
||||
}
|
||||
|
||||
companion object {
|
||||
val SKIP = RangeMapping(-1, -1, 1)
|
||||
public val SKIP = RangeMapping(-1, -1, 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,26 +16,30 @@
|
||||
|
||||
package org.jetbrains.kotlin.codegen.inline
|
||||
|
||||
import org.jetbrains.org.objectweb.asm.tree.MethodNode
|
||||
import org.jetbrains.kotlin.codegen.optimization.common.InsnSequence
|
||||
import org.jetbrains.org.objectweb.asm.tree.LineNumberNode
|
||||
import org.jetbrains.org.objectweb.asm.tree.MethodNode
|
||||
import java.util.*
|
||||
import org.jetbrains.org.objectweb.asm.Label
|
||||
import kotlin.properties.Delegates
|
||||
import java.util.Collections
|
||||
import kotlin.properties.ReadOnlyProperty
|
||||
import org.jetbrains.kotlin.codegen.SourceInfo
|
||||
|
||||
//TODO comment
|
||||
class SMAPAndMethodNode(val node: MethodNode, val classSMAP: SMAP) {
|
||||
private val lineNumbers =
|
||||
InsnSequence(node.instructions.first, null).filterIsInstance<LineNumberNode>().map { node ->
|
||||
val index = classSMAP.intervals.binarySearch(RangeMapping(node.line, node.line, 1), Comparator {
|
||||
|
||||
val lineNumbers =
|
||||
InsnSequence(node.instructions.getFirst(), null).filterIsInstance<LineNumberNode>().map {
|
||||
val index = Collections.binarySearch(classSMAP.intervals, RangeMapping(it.line, it.line, 1)) {
|
||||
value, key ->
|
||||
if (key.dest in value) 0 else RangeMapping.Comparator.compare(value, key)
|
||||
})
|
||||
if (index < 0) {
|
||||
error("Unmapped label in inlined function $node ${node.line}")
|
||||
if (value.contains(key.dest)) 0 else RangeMapping.Comparator.compare(value, key)
|
||||
}
|
||||
LabelAndMapping(node, classSMAP.intervals[index])
|
||||
if (index < 0)
|
||||
throw IllegalStateException("Unmapped label in inlined function $it ${it.line}")
|
||||
LabelAndMapping(it, classSMAP.intervals[index])
|
||||
}.toList()
|
||||
|
||||
val ranges = lineNumbers.asSequence().map { it.mapper }.distinct().toList()
|
||||
val ranges = lineNumbers.asSequence().map { it.mapper }.distinct().toList();
|
||||
}
|
||||
|
||||
class LabelAndMapping(val lineNumberNode: LineNumberNode, val mapper: RangeMapping)
|
||||
class LabelAndMapping(val lineNumberNode: LineNumberNode, val mapper: RangeMapping)
|
||||
@@ -16,49 +16,53 @@
|
||||
|
||||
package org.jetbrains.kotlin.codegen.inline
|
||||
|
||||
import com.intellij.util.SmartFMap
|
||||
|
||||
object SMAPParser {
|
||||
/*null smap means that there is no any debug info in file (e.g. sourceName)*/
|
||||
|
||||
@JvmStatic
|
||||
fun parseOrCreateDefault(mappingInfo: String?, source: String?, path: String, methodStartLine: Int, methodEndLine: Int): SMAP {
|
||||
if (mappingInfo != null && mappingInfo.isNotEmpty()) {
|
||||
return parse(mappingInfo)
|
||||
/*null smap means that there is no any debug info in file (e.g. sourceName)*/
|
||||
public fun parseOrCreateDefault(mappingInfo: String?, source: String?, path: String, methodStartLine: Int, methodEndLine: Int): SMAP {
|
||||
if (mappingInfo == null || mappingInfo.isEmpty()) {
|
||||
val fm: FileMapping
|
||||
if (source == null || source.isEmpty()) {
|
||||
fm = FileMapping.SKIP
|
||||
}
|
||||
else {
|
||||
fm = FileMapping(source, path)
|
||||
if (methodStartLine <= methodEndLine) {
|
||||
//one to one
|
||||
fm.addRangeMapping(RangeMapping(methodStartLine, methodStartLine, methodEndLine - methodStartLine + 1))
|
||||
}
|
||||
}
|
||||
return SMAP(listOf(fm))
|
||||
}
|
||||
|
||||
val mapping =
|
||||
if (source == null || source.isEmpty())
|
||||
FileMapping.SKIP
|
||||
else
|
||||
FileMapping(source, path).apply {
|
||||
if (methodStartLine <= methodEndLine) {
|
||||
//one to one
|
||||
addRangeMapping(RangeMapping(methodStartLine, methodStartLine, methodEndLine - methodStartLine + 1))
|
||||
}
|
||||
}
|
||||
|
||||
return SMAP(listOf(mapping))
|
||||
return parse(mappingInfo)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun parse(mappingInfo: String): SMAP {
|
||||
public fun parse(mappingInfo: String): SMAP {
|
||||
val fileMappings = linkedMapOf<Int, FileMapping>()
|
||||
|
||||
val fileSectionStart = mappingInfo.indexOf(SMAP.FILE_SECTION) + SMAP.FILE_SECTION.length
|
||||
val lineSectionAnchor = mappingInfo.indexOf(SMAP.LINE_SECTION)
|
||||
val files = mappingInfo.substring(fileSectionStart, lineSectionAnchor)
|
||||
|
||||
|
||||
val fileEntries = files.trim().split('+')
|
||||
|
||||
for (fileDeclaration in fileEntries) {
|
||||
if (fileDeclaration == "") continue
|
||||
if (fileDeclaration == "") continue;
|
||||
val fileInternalName = fileDeclaration.trim()
|
||||
|
||||
val indexEnd = fileInternalName.indexOf(' ')
|
||||
val fileIndex = fileInternalName.substring(0, indexEnd).toInt()
|
||||
val fileIndex = Integer.valueOf(fileInternalName.substring(0, indexEnd))
|
||||
val newLine = fileInternalName.indexOf('\n')
|
||||
val fileName = fileInternalName.substring(indexEnd + 1, newLine)
|
||||
fileMappings[fileIndex] = FileMapping(fileName, fileInternalName.substring(newLine + 1).trim())
|
||||
fileMappings.put(fileIndex, FileMapping(fileName, fileInternalName.substring(newLine + 1).trim()))
|
||||
}
|
||||
|
||||
|
||||
val lines = mappingInfo.substring(lineSectionAnchor + SMAP.LINE_SECTION.length, mappingInfo.indexOf(SMAP.END)).trim().split('\n')
|
||||
for (lineMapping in lines) {
|
||||
/*only simple mapping now*/
|
||||
@@ -67,14 +71,14 @@ object SMAPParser {
|
||||
var rangeSeparator = originalPart.indexOf(',').let { if (it < 0) targetSplit else it }
|
||||
|
||||
val fileSeparator = lineMapping.indexOf('#')
|
||||
val originalIndex = originalPart.substring(0, fileSeparator).toInt()
|
||||
val range = if (rangeSeparator == targetSplit) 1 else originalPart.substring(rangeSeparator + 1, targetSplit).toInt()
|
||||
val originalIndex = Integer.valueOf(originalPart.substring(0, fileSeparator))
|
||||
val range = if (rangeSeparator == targetSplit) 1 else Integer.valueOf(originalPart.substring(rangeSeparator + 1, targetSplit))
|
||||
|
||||
val fileIndex = lineMapping.substring(fileSeparator + 1, rangeSeparator).toInt()
|
||||
val targetIndex = lineMapping.substring(targetSplit + 1).toInt()
|
||||
val fileIndex = Integer.valueOf(lineMapping.substring(fileSeparator + 1, rangeSeparator))
|
||||
val targetIndex = Integer.valueOf(lineMapping.substring(targetSplit + 1))
|
||||
fileMappings[fileIndex]!!.addRangeMapping(RangeMapping(originalIndex, targetIndex, range))
|
||||
}
|
||||
|
||||
return SMAP(fileMappings.values.toList())
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,7 +26,7 @@ enum class TryCatchPosition {
|
||||
INNER
|
||||
}
|
||||
|
||||
class SplitPair<T: Interval>(val patchedPart: T, val newPart: T)
|
||||
public class SplitPair<T: Interval>(val patchedPart: T, val newPart: T)
|
||||
|
||||
class SimpleInterval(override val startLabel: LabelNode, override val endLabel: LabelNode ) : Interval
|
||||
|
||||
@@ -35,7 +35,7 @@ interface Interval {
|
||||
val endLabel: LabelNode
|
||||
|
||||
/*note that some intervals are mutable */
|
||||
fun isEmpty(): Boolean = startLabel == endLabel
|
||||
public fun isEmpty(): Boolean = startLabel == endLabel
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
* Copyright 2010-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.codegen.inline;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.org.objectweb.asm.commons.Remapper;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class TypeRemapper extends Remapper {
|
||||
//typeMapping field could be changed outside through method processing
|
||||
private final Map<String, String> typeMapping;
|
||||
|
||||
private Map<String, String> additionalMappings;
|
||||
|
||||
//typeMapping field could be changed outside through method processing
|
||||
private TypeRemapper(@NotNull Map<String, String> typeMapping) {
|
||||
this.typeMapping = typeMapping;
|
||||
}
|
||||
|
||||
public TypeRemapper(@NotNull TypeRemapper remapper, @NotNull Map<String, String> newTypeMappings) {
|
||||
this(createNewAndMerge(remapper, newTypeMappings));
|
||||
}
|
||||
|
||||
public static TypeRemapper createEmpty() {
|
||||
return new TypeRemapper(new HashMap<String, String>());
|
||||
}
|
||||
|
||||
public static TypeRemapper createFrom(Map<String, String> mappings) {
|
||||
return new TypeRemapper(mappings);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static Map<String, String> createNewAndMerge(@NotNull TypeRemapper remapper, @NotNull Map<String, String> additionalTypeMappings) {
|
||||
Map<String, String> map = new HashMap<String, String>(remapper.typeMapping);
|
||||
map.putAll(additionalTypeMappings);
|
||||
return map;
|
||||
}
|
||||
|
||||
public void addMapping(String type, String newType) {
|
||||
typeMapping.put(type, newType);
|
||||
}
|
||||
|
||||
public boolean hasNoAdditionalMapping(String type) {
|
||||
return typeMapping.containsKey(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String map(String type) {
|
||||
String newType = typeMapping.get(type);
|
||||
if (newType != null) {
|
||||
return newType;
|
||||
}
|
||||
|
||||
if (additionalMappings != null) {
|
||||
newType = additionalMappings.get(type);
|
||||
if (newType != null) {
|
||||
return newType;
|
||||
}
|
||||
}
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
public void addAdditionalMappings(String oldName, String newName) {
|
||||
if (additionalMappings == null) additionalMappings = new HashMap<String, String>();
|
||||
additionalMappings.put(oldName, newName);
|
||||
}
|
||||
}
|
||||
@@ -1,90 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.codegen.inline
|
||||
|
||||
import java.util.HashMap
|
||||
|
||||
class TypeParameter(val oldName: String, val newName: String?, val isReified: Boolean, val signature: String?)
|
||||
|
||||
//typeMapping data could be changed outside through method processing
|
||||
class TypeRemapper private constructor(private val typeMapping: MutableMap<String, String>, val parent: TypeRemapper?, val isInlineLambda: Boolean = false) {
|
||||
|
||||
private var additionalMappings: MutableMap<String, String> = hashMapOf()
|
||||
|
||||
|
||||
private val typeParametersMapping: MutableMap<String, TypeParameter> = hashMapOf()
|
||||
|
||||
fun addMapping(type: String, newType: String) {
|
||||
typeMapping.put(type, newType)
|
||||
}
|
||||
|
||||
fun hasNoAdditionalMapping(type: String): Boolean {
|
||||
return typeMapping.containsKey(type)
|
||||
}
|
||||
|
||||
fun map(type: String): String {
|
||||
return typeMapping[type] ?: additionalMappings?.get(type) ?: type
|
||||
}
|
||||
|
||||
fun addAdditionalMappings(oldName: String, newName: String) {
|
||||
additionalMappings!!.put(oldName, newName)
|
||||
}
|
||||
|
||||
fun registerTypeParameter(name: String) {
|
||||
assert(typeParametersMapping[name] == null) {
|
||||
"Type parameter already registered $name"
|
||||
}
|
||||
typeParametersMapping[name] = TypeParameter(name, name, false, null)
|
||||
}
|
||||
|
||||
fun registerTypeParameter(mapping: TypeParameterMapping) {
|
||||
typeParametersMapping[mapping.name] = TypeParameter(mapping.name, mapping.reificationArgument?.parameterName, mapping.isReified, mapping.signature)
|
||||
}
|
||||
|
||||
fun mapTypeParameter(name: String): TypeParameter? {
|
||||
return typeParametersMapping[name] ?: if (!isInlineLambda) parent?.mapTypeParameter(name) else null
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
@JvmStatic
|
||||
fun createRoot(formalTypeParameters: TypeParameterMappings?): TypeRemapper {
|
||||
val typeRemapper = TypeRemapper(HashMap<String, String>(), null)
|
||||
formalTypeParameters?.forEach {
|
||||
typeRemapper.registerTypeParameter(it)
|
||||
}
|
||||
return typeRemapper
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun createFrom(mappings: MutableMap<String, String>): TypeRemapper {
|
||||
return TypeRemapper(mappings, null)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
@JvmOverloads
|
||||
fun createFrom(remapper: TypeRemapper, mappings: MutableMap<String, String>, isInlineLambda: Boolean = false): TypeRemapper {
|
||||
return TypeRemapper(createNewAndMerge(remapper, mappings), remapper, isInlineLambda)
|
||||
}
|
||||
|
||||
private fun createNewAndMerge(remapper: TypeRemapper, additionalTypeMappings: Map<String, String>): MutableMap<String, String> {
|
||||
val map = HashMap(remapper.typeMapping)
|
||||
map += additionalTypeMappings
|
||||
return map
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -27,14 +27,14 @@ import org.jetbrains.kotlin.resolve.source.PsiSourceElement
|
||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedCallableMemberDescriptor
|
||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedSimpleFunctionDescriptor
|
||||
|
||||
val FunctionDescriptor.sourceFilePath: String
|
||||
public val FunctionDescriptor.sourceFilePath: String
|
||||
get() {
|
||||
val source = source as PsiSourceElement
|
||||
val containingFile = source.psi?.containingFile
|
||||
return containingFile?.virtualFile?.canonicalPath!!
|
||||
}
|
||||
|
||||
fun FunctionDescriptor.getClassFilePath(typeMapper: JetTypeMapper, cache: IncrementalCache): String {
|
||||
public fun FunctionDescriptor.getClassFilePath(typeMapper: JetTypeMapper, cache: IncrementalCache): String {
|
||||
val container = containingDeclaration as? DeclarationDescriptorWithSource
|
||||
val source = container?.source
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ import org.jetbrains.kotlin.codegen.AsmUtil.correctElementType
|
||||
import org.jetbrains.kotlin.codegen.Callable
|
||||
import org.jetbrains.kotlin.codegen.CallableMethod
|
||||
|
||||
class ArrayGet : IntrinsicMethod() {
|
||||
public class ArrayGet : IntrinsicMethod() {
|
||||
override fun toCallable(method: CallableMethod): Callable =
|
||||
createIntrinsicCallable(method) {
|
||||
val type = correctElementType(calcReceiverType())
|
||||
|
||||
@@ -20,10 +20,10 @@ import org.jetbrains.kotlin.codegen.AsmUtil
|
||||
import org.jetbrains.kotlin.codegen.Callable
|
||||
import org.jetbrains.kotlin.codegen.CallableMethod
|
||||
|
||||
class ArrayIterator : IntrinsicMethod() {
|
||||
public class ArrayIterator : IntrinsicMethod() {
|
||||
override fun toCallable(method: CallableMethod): Callable =
|
||||
createUnaryIntrinsicCallable(method) {
|
||||
val methodSignature = "(${method.owner.descriptor})${returnType.descriptor}"
|
||||
val methodSignature = "(${method.owner.getDescriptor()})${returnType.getDescriptor()}"
|
||||
val intrinsicOwner =
|
||||
if (AsmUtil.isPrimitive(method.owner.elementType))
|
||||
"kotlin/jvm/internal/ArrayIteratorsKt"
|
||||
|
||||
@@ -22,7 +22,7 @@ import org.jetbrains.kotlin.codegen.CallableMethod
|
||||
import org.jetbrains.org.objectweb.asm.Type
|
||||
import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter
|
||||
|
||||
class ArraySet : IntrinsicMethod() {
|
||||
public class ArraySet : IntrinsicMethod() {
|
||||
override fun toCallable(method: CallableMethod): Callable {
|
||||
val type = correctElementType(method.dispatchReceiverType)
|
||||
return object : IntrinsicCallable(
|
||||
|
||||
@@ -21,7 +21,7 @@ import org.jetbrains.kotlin.codegen.StackValue
|
||||
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall
|
||||
import org.jetbrains.org.objectweb.asm.Type
|
||||
|
||||
class ArraySize : IntrinsicPropertyGetter() {
|
||||
public class ArraySize : IntrinsicPropertyGetter() {
|
||||
override fun generate(
|
||||
resolvedCall: ResolvedCall<*>?, codegen: ExpressionCodegen, returnType: Type, receiver: StackValue
|
||||
) = StackValue.operation(returnType) {
|
||||
|
||||
@@ -25,7 +25,7 @@ import org.jetbrains.org.objectweb.asm.Opcodes.ISHR
|
||||
import org.jetbrains.org.objectweb.asm.Opcodes.IUSHR
|
||||
import org.jetbrains.org.objectweb.asm.Type
|
||||
|
||||
class BinaryOp(private val opcode: Int) : IntrinsicMethod() {
|
||||
public class BinaryOp(private val opcode: Int) : IntrinsicMethod() {
|
||||
private fun shift(): Boolean =
|
||||
opcode == ISHL || opcode == ISHR || opcode == IUSHR
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ import org.jetbrains.kotlin.codegen.CallableMethod
|
||||
import org.jetbrains.kotlin.resolve.jvm.AsmTypes.OBJECT_TYPE
|
||||
import org.jetbrains.org.objectweb.asm.Opcodes
|
||||
|
||||
class Clone : IntrinsicMethod() {
|
||||
public class Clone : IntrinsicMethod() {
|
||||
override fun toCallable(method: CallableMethod, isSuperCall: Boolean): Callable =
|
||||
createUnaryIntrinsicCallable(method, OBJECT_TYPE) {
|
||||
val opcode = if (isSuperCall) Opcodes.INVOKESPECIAL else Opcodes.INVOKEVIRTUAL
|
||||
|
||||
@@ -22,7 +22,7 @@ import org.jetbrains.kotlin.codegen.CallableMethod
|
||||
import org.jetbrains.org.objectweb.asm.Type
|
||||
import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter
|
||||
|
||||
class CompareTo : IntrinsicMethod() {
|
||||
public class CompareTo : IntrinsicMethod() {
|
||||
private fun genInvoke(type: Type?, v: InstructionAdapter) {
|
||||
when (type) {
|
||||
Type.INT_TYPE -> v.invokestatic(IntrinsicMethods.INTRINSICS_CLASS_NAME, "compare", "(II)I", false)
|
||||
|
||||
@@ -31,7 +31,7 @@ import org.jetbrains.org.objectweb.asm.Opcodes
|
||||
import org.jetbrains.org.objectweb.asm.Type
|
||||
import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter
|
||||
|
||||
class Concat : IntrinsicMethod() {
|
||||
public class Concat : IntrinsicMethod() {
|
||||
fun generateImpl(
|
||||
codegen: ExpressionCodegen,
|
||||
v: InstructionAdapter,
|
||||
|
||||
@@ -21,7 +21,7 @@ import org.jetbrains.kotlin.codegen.Callable
|
||||
import org.jetbrains.kotlin.codegen.CallableMethod
|
||||
import org.jetbrains.kotlin.resolve.jvm.AsmTypes.OBJECT_TYPE
|
||||
|
||||
class Equals : IntrinsicMethod() {
|
||||
public class Equals : IntrinsicMethod() {
|
||||
override fun toCallable(method: CallableMethod): Callable =
|
||||
createBinaryIntrinsicCallable(
|
||||
method.returnType,
|
||||
|
||||
@@ -22,7 +22,7 @@ import org.jetbrains.org.objectweb.asm.Opcodes
|
||||
import org.jetbrains.org.objectweb.asm.Type
|
||||
import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter
|
||||
|
||||
class HashCode : IntrinsicMethod() {
|
||||
public class HashCode : IntrinsicMethod() {
|
||||
override fun toCallable(method: CallableMethod): Callable =
|
||||
object : IntrinsicCallable(
|
||||
Type.INT_TYPE,
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright 2010-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.codegen.intrinsics
|
||||
|
||||
import org.jetbrains.kotlin.codegen.Callable
|
||||
import org.jetbrains.kotlin.codegen.CallableMethod
|
||||
import org.jetbrains.kotlin.codegen.ExpressionCodegen
|
||||
import org.jetbrains.kotlin.codegen.StackValue
|
||||
import org.jetbrains.kotlin.lexer.KtTokens
|
||||
import org.jetbrains.kotlin.psi.KtBinaryExpression
|
||||
import org.jetbrains.kotlin.psi.KtCallExpression
|
||||
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall
|
||||
import org.jetbrains.kotlin.resolve.jvm.AsmTypes.OBJECT_TYPE
|
||||
|
||||
public class IdentityEquals : IntrinsicMethod() {
|
||||
override fun toCallable(method: CallableMethod): Callable =
|
||||
object : IntrinsicCallable(method) {
|
||||
override fun invokeMethodWithArguments(
|
||||
resolvedCall: ResolvedCall<*>,
|
||||
receiver: StackValue,
|
||||
codegen: ExpressionCodegen
|
||||
): StackValue {
|
||||
val element = resolvedCall.getCall().getCallElement()
|
||||
val left: StackValue
|
||||
val right: StackValue
|
||||
if (element is KtCallExpression) {
|
||||
left = StackValue.receiver(resolvedCall, receiver, codegen, this)
|
||||
right = codegen.gen(resolvedCall.getValueArgumentsByIndex()!!.single().getArguments().single().getArgumentExpression())
|
||||
}
|
||||
else {
|
||||
element as KtBinaryExpression
|
||||
left = codegen.gen(element.getLeft())
|
||||
right = codegen.gen(element.getRight())
|
||||
}
|
||||
return StackValue.cmp(KtTokens.EQEQEQ, OBJECT_TYPE, left, right)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22,11 +22,11 @@ import org.jetbrains.kotlin.codegen.CallableMethod
|
||||
import org.jetbrains.kotlin.psi.KtPrefixExpression
|
||||
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall
|
||||
|
||||
class Increment(private val myDelta: Int) : IntrinsicMethod() {
|
||||
public class Increment(private val myDelta: Int) : IntrinsicMethod() {
|
||||
override fun toCallable(method: CallableMethod, isSuper: Boolean, resolvedCall: ResolvedCall<*>): Callable =
|
||||
createIntrinsicCallable(method) {
|
||||
val jetExpression = resolvedCall.call.calleeExpression
|
||||
assert(jetExpression !is KtPrefixExpression) { "There should be postfix increment ${jetExpression!!.text}" }
|
||||
val jetExpression = resolvedCall.getCall().getCalleeExpression()
|
||||
assert(jetExpression !is KtPrefixExpression) { "There should be postfix increment ${jetExpression!!.getText()}" }
|
||||
genIncrement(returnType, myDelta, it)
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user