Compare commits

..

37 Commits

Author SHA1 Message Date
Pavel V. Talanov
0c3bdb8f9e ~ bug 2015-05-06 17:39:16 +03:00
Pavel V. Talanov
67fc705dcf ~ containers 2015-05-06 16:29:57 +03:00
Pavel V. Talanov
64249e7150 ~ fix repl 2015-05-06 14:15:58 +03:00
Pavel V. Talanov
e730dc2438 ~ 2015-05-06 14:15:49 +03:00
Pavel V. Talanov
24c20af203 DRAFT: cache and fix 2015-05-05 21:07:37 +03:00
Pavel V. Talanov
d3f0e37320 ~ KotlinPlugin.xml 2015-05-05 21:06:24 +03:00
Pavel V. Talanov
c6dd0ee5c9 ~ 2015-05-05 21:06:08 +03:00
Ilya Ryzhenkov
574cf50821 Cleanup, improve diagnostics, use Linked* versions to make behaviour stable.
(cherry picked from commit 2d78be1)
2015-05-05 18:11:43 +03:00
Ilya Ryzhenkov
ec0984a848 Analyse implicits and setter dependencies before composition.
(cherry picked from commit 6e8b800)
2015-05-05 18:11:29 +03:00
Pavel V. Talanov
585a01f09f ~ Container.kt 2015-05-05 17:25:32 +03:00
Pavel V. Talanov
e8b2870f00 ~ ContainerForTopDownAnalyzerForJs.kt 2015-05-05 17:25:32 +03:00
Pavel V. Talanov
1c53483b9b ~ fix ant build 2015-05-05 17:25:31 +03:00
Pavel V. Talanov
435a0cae5c ~ TopDownAnalysisParameters.java 2015-05-05 17:25:31 +03:00
Pavel V. Talanov
c52e6b3bae ~ 2015-05-05 17:25:30 +03:00
Pavel V. Talanov
57f1372390 ~ new 2015-05-05 17:25:30 +03:00
Pavel V. Talanov
c57665603c ~ new 2015-05-05 17:25:29 +03:00
Pavel V. Talanov
9cbed7fe4a ~old 2015-05-05 17:25:29 +03:00
Pavel V. Talanov
4112a91ef6 ~ old 2015-05-05 17:25:28 +03:00
Pavel V. Talanov
998f812bc4 ~ new 2015-05-05 17:25:28 +03:00
Pavel V. Talanov
3a90539521 ~ old 2015-05-05 17:25:27 +03:00
Pavel V. Talanov
7d45e1ec11 ~ new 2015-05-05 17:25:26 +03:00
Pavel V. Talanov
387ebcea74 ~ convert some of existing injectors 2015-05-05 17:25:26 +03:00
Pavel V. Talanov
71a98fcb33 ~ delete old injectors 2015-05-05 17:25:25 +03:00
Pavel V. Talanov
1669d23bcc ~ delete old injectors 2015-05-05 17:25:25 +03:00
Pavel V. Talanov
fdf103253c ~ injector usages 2015-05-05 17:25:24 +03:00
Pavel V. Talanov
959092f778 ~ remove existing injectors 2015-05-05 17:25:24 +03:00
Pavel V. Talanov
505c67bc84 ~ fix ant build 2015-05-05 17:25:23 +03:00
Pavel V. Talanov
6daf3f6c09 ~ fix ant build 2015-05-05 17:25:23 +03:00
Pavel V. Talanov
8828338d0e ~ 2015-05-05 17:25:22 +03:00
Pavel V. Talanov
8231962896 ~ convert some of existing injectors 2015-05-05 17:25:22 +03:00
Pavel V. Talanov
f55985957d ~ clean up example 2015-05-05 17:25:21 +03:00
Pavel V. Talanov
86846946f9 ~ shorter dsl 2015-05-05 17:25:21 +03:00
Pavel V. Talanov
072f805036 ~ DRAFT: hacky fix of container 2015-05-05 17:25:20 +03:00
Pavel V. Talanov
9166f7ee9c ~ export dependency on container 2015-05-05 17:25:20 +03:00
Ilya Ryzhenkov
3a5b3fc42a Inject into setters and create instances if possible without registration 2015-05-05 17:25:19 +03:00
Ilya Ryzhenkov
04116ab050 Graph composes. 2015-05-05 17:25:19 +03:00
Ilya Ryzhenkov
acf603a9e2 Add container module with initial implementation. 2015-05-05 17:25:18 +03:00
10922 changed files with 63514 additions and 148757 deletions

1
.gitattributes vendored
View File

@@ -1 +0,0 @@
**/testData/** linguist-vendored

2
.gitignore vendored
View File

@@ -8,6 +8,8 @@
/ideaSDK
/android-studio/sdk
out
/pluginPublisher/idea*
/pluginPublisher/plugin-verifier.jar
tmp
workspace.xml
*.versionsBackup

3
.idea/ant.xml generated
View File

@@ -10,12 +10,13 @@
<buildFile url="file://$PROJECT_DIR$/TeamCityBuild.xml">
<maximumHeapSize value="512" />
</buildFile>
<buildFile url="file://$PROJECT_DIR$/pluginPublisher/TeamCityPluginPublisher.xml" />
<buildFile url="file://$PROJECT_DIR$/idea-runner/runner.xml" />
<buildFile url="file://$PROJECT_DIR$/replicate_versions.xml" />
<buildFile url="file://$PROJECT_DIR$/libraries/build-docs.xml">
<maximumHeapSize value="1024" />
<properties>
<property name="dokka.path" value="../../dokka" />
<property name="dokka.path" value="../../dokka/out/artifacts" />
</properties>
</buildFile>
</component>

9
.idea/artifacts/InjectorGenerator.xml generated Normal file
View File

@@ -0,0 +1,9 @@
<component name="ArtifactManager">
<artifact type="jar" name="InjectorGenerator">
<output-path>$PROJECT_DIR$/out/artifacts/internal/</output-path>
<root id="archive" name="injector-generator.jar">
<element id="module-output" name="injector-generator" />
<element id="dir-copy" path="$PROJECT_DIR$/generators/injector-generator" />
</root>
</artifact>
</component>

View File

@@ -42,7 +42,6 @@
<element id="module-output" name="serialization" />
<element id="module-output" name="idea-completion" />
<element id="module-output" name="idea-core" />
<element id="module-output" name="idea-js" />
<element id="module-output" name="container" />
</element>
<element id="library" level="project" name="javax.inject" />

View File

@@ -287,4 +287,5 @@
</option>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</component>
</project>
</project>

1
.idea/compiler.xml generated
View File

@@ -2,7 +2,6 @@
<project version="4">
<component name="CompilerConfiguration">
<option name="DEFAULT_COMPILER" value="Javac" />
<option name="BUILD_PROCESS_HEAP_SIZE" value="2000" />
<excludeFromCompile>
<directory url="file://$PROJECT_DIR$/core/reflection.jvm" includeSubdirectories="true" />
</excludeFromCompile>

View File

@@ -1,7 +0,0 @@
<component name="ProjectDictionaryState">
<dictionary name="bashor">
<words>
<w>ctor</w>
</words>
</dictionary>
</component>

View File

@@ -2,7 +2,6 @@
<dictionary name="geevee">
<words>
<w>builtins</w>
<w>callables</w>
<w>klass</w>
<w>proto</w>
<w>protoc</w>

View File

@@ -1,8 +1,6 @@
<component name="ProjectDictionaryState">
<dictionary name="valentin">
<words>
<w>decapitalize</w>
<w>delegator</w>
<w>funs</w>
<w>initializers</w>
<w>inserter</w>
@@ -10,10 +8,8 @@
<w>pparent</w>
<w>processings</w>
<w>rbracket</w>
<w>renderers</w>
<w>rparenth</w>
<w>selectioner</w>
<w>unpluralize</w>
</words>
</dictionary>
</component>

View File

@@ -9,7 +9,11 @@
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/android/android/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/android/android/common/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/android/android/rt/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/android/android/jps-plugin/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/android/android/ultimate/src" />
</SOURCES>
<jarDirectory url="file://$PROJECT_DIR$/ideaSDK/plugins/android/lib" recursive="false" />
<jarDirectory url="file://$PROJECT_DIR$/ideaSDK/plugins/android/lib/jps" recursive="false" />

View File

@@ -1,14 +0,0 @@
<component name="libraryTable">
<library name="ant">
<ANNOTATIONS>
<root url="file://$PROJECT_DIR$/annotations" />
</ANNOTATIONS>
<CLASSES>
<root url="jar://$PROJECT_DIR$/dependencies/ant-1.8/lib/ant.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$PROJECT_DIR$/dependencies/apache-ant-1.8.2-src.zip!/apache-ant-1.8.2/src/main" />
</SOURCES>
</library>
</component>

21
.idea/libraries/ant_1_7.xml generated Normal file
View File

@@ -0,0 +1,21 @@
<component name="libraryTable">
<library name="ant-1.7">
<ANNOTATIONS>
<root url="file://$PROJECT_DIR$/annotations" />
</ANNOTATIONS>
<CLASSES>
<root url="jar://$PROJECT_DIR$/dependencies/ant-1.7/lib/ant.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$PROJECT_DIR$/dependencies/apache-ant-1.7.0-src.zip!/apache-ant-1.7.0/src/etc/testcases/core/loaderref/src" />
<root url="jar://$PROJECT_DIR$/dependencies/apache-ant-1.7.0-src.zip!/apache-ant-1.7.0/src/etc/testcases/core/containersrc" />
<root url="jar://$PROJECT_DIR$/dependencies/apache-ant-1.7.0-src.zip!/apache-ant-1.7.0/src/etc/testcases/types/assertions" />
<root url="jar://$PROJECT_DIR$/dependencies/apache-ant-1.7.0-src.zip!/apache-ant-1.7.0/src/etc/testcases/taskdefs/apt" />
<root url="jar://$PROJECT_DIR$/dependencies/apache-ant-1.7.0-src.zip!/apache-ant-1.7.0/src/etc/testcases/taskdefs/rmic/src" />
<root url="jar://$PROJECT_DIR$/dependencies/apache-ant-1.7.0-src.zip!/apache-ant-1.7.0/src/etc/testcases/taskdefs/fixcrlf/input" />
<root url="jar://$PROJECT_DIR$/dependencies/apache-ant-1.7.0-src.zip!/apache-ant-1.7.0/src/etc/testcases/taskdefs/fixcrlf/expected" />
<root url="jar://$PROJECT_DIR$/dependencies/apache-ant-1.7.0-src.zip!/apache-ant-1.7.0/src/main" />
</SOURCES>
</library>
</component>

View File

@@ -8,7 +8,7 @@
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/copyright/src" />
</SOURCES>
</library>
</component>

View File

@@ -7,7 +7,7 @@
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/coverage/src" />
</SOURCES>
</library>
</component>

View File

@@ -10,7 +10,21 @@
<JAVADOC />
<SOURCES>
<root url="file://$PROJECT_DIR$/ideaSDK/plugins/gradle/lib" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/gradle/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/gradle/testSources" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/gradle/tooling-extension-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/gradle/tooling-extension-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/gradle/tooling-extension-impl/testSources" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/groovy/rt/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/groovy/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/groovy/test" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/groovy/hotswap/agentSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/groovy/groovy-psi/gen" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/groovy/groovy-psi/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/groovy/jps-plugin/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/groovy/rt-constants/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/groovy/structuralsearch-groovy/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/groovy/structuralsearch-groovy/testSrc" />
</SOURCES>
<jarDirectory url="file://$PROJECT_DIR$/ideaSDK/plugins/gradle/lib" recursive="false" />
<jarDirectory url="file://$PROJECT_DIR$/ideaSDK/plugins/Groovy/lib" recursive="false" />

View File

@@ -12,7 +12,328 @@
<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.zip!/" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/.jps-build-data/groovyStubs/gradle-tooling-extension-impl/java-production" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/.jps-build-data/groovyStubs/groovy-psi/java-production" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/.jps-build-data/groovyStubs/jetgroovy/java-production" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/.jps-build-data/groovyStubs/jps-standalone-builder/java-production" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/.jps-build-data/groovyStubs/lang-impl/java-test" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/.jps-build-data/groovyStubs/spellchecker/java-test" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/.jps-build-data/groovyStubs/testFramework-java/java-production" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/.jps-build-data/groovyStubs/testFramework/java-production" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/.jps-build-data/groovyStubs/util/java-test" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/RegExpSupport/gen" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/RegExpSupport/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/RegExpSupport/test" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/build/cucumber-test-runner/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/build/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/images/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/compiler/forms-compiler/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/compiler/forms-compiler/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/compiler/impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/compiler/impl/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/compiler/instrumentation-util/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/compiler/javac2/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/compiler/openapi/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/debugger/impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/debugger/openapi/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/execution/impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/execution/openapi/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/idea-ui/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/java-analysis-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/java-analysis-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/java-impl/gen" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/java-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/java-indexing-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/java-indexing-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/java-psi-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/java-psi-impl/gen" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/java-psi-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/java-runtime/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/java-structure-view/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/java-tests/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/jsp-base-openapi/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/jsp-openapi/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/jsp-spi/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/manifest/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/manifest/test" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/openapi/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/remote-servers/api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/remote-servers/impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/structuralsearch-java/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/testFramework/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/typeMigration/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/typeMigration/test" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/jps/antLayout/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/jps/jps-builders/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/jps/jps-builders/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/jps/jps-launcher/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/jps/model-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/jps/model-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/jps/model-impl/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/jps/model-serialization/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/jps/model-serialization/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/jps/plugin-system/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/jps/standalone-builder/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/json/gen" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/json/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/json/tests/test" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/analysis-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/analysis-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/annotations/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/boot/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/bootstrap/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/core-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/core-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/duplicates-analysis/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/dvcs-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/dvcs-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/editor-ui-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/editor-ui-ex/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/extensions/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/extensions/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/external-system-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/external-system-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/external-system-impl/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/forms_rt/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/funcTests/project1/module1/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/indexing-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/indexing-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/lang-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/lang-api/testSources" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/lang-impl/gen" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/lang-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/lang-impl/testSources" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/lvcs-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/lvcs-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/platform-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/platform-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/platform-main/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/platform-tests/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/projectModel-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/projectModel-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/remote-servers/agent-rt/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/remote-servers/api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/remote-servers/impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/script-debugger/backend/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/script-debugger/debugger-ui/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/script-debugger/debugger-ui/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/script-debugger/protocol/protocol-model-generator/generated" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/script-debugger/protocol/protocol-model-generator/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/script-debugger/protocol/protocol-reader-runtime/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/script-debugger/protocol/protocol-reader/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/script-debugger/protocol/schema-reader-generator/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/smRunner/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/smRunner/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/structuralsearch/source" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/structuralsearch/testSource" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/structure-view-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/structure-view-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/testFramework/bootstrap/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/testFramework/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/testFramework/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/testRunner/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/usageView/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/util-rt/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/util/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/util/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/vcs-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/vcs-api/vcs-api-core/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/vcs-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/vcs-impl/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/vcs-log/api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/vcs-log/graph-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/vcs-log/graph/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/vcs-log/graph/test" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/vcs-log/impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/vcs-log/impl/test" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/xdebugger-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/xdebugger-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/xdebugger-impl/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/ByteCodeViewer/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/InspectionGadgets/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/InspectionGadgets/test" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/InspectionGadgets/testsrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/IntelliLang/IntelliLang-tests/test" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/IntelliLang/intellilang-jps-plugin/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/IntelliLang/java-support" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/IntelliLang/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/IntelliLang/xml-support" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/IntentionPowerPak/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/IntentionPowerPak/test" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/IntentionPowerPak/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/ShortcutPromoter/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/ant/jps-plugin/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/ant/jps-plugin/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/ant/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/ant/tests/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/commander/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/copyright/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/coverage-common/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/coverage/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/cucumber-jvm-formatter/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/cvs/cvs-core/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/cvs/cvs-plugin/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/cvs/javacvs-src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/cvs/smartcvs-src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/cvs/trilead-ssh2-build213/examples" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/cvs/trilead-ssh2-build213/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/devkit/gen" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/devkit/jps-plugin/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/devkit/jps-plugin/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/eclipse/jps-plugin/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/eclipse/resources" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/eclipse/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/eclipse/testSources" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/editorconfig/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/generate-tostring/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/generate-tostring/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/git4idea/remote-servers-git/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/git4idea/resources" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/git4idea/rt/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/git4idea/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/git4idea/test-stepdefs" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/git4idea/tests" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/github/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/github/test" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/google-app-engine/gen" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/google-app-engine/jps-plugin/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/google-app-engine/jps-plugin/testSource" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/google-app-engine/runtime/source" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/google-app-engine/source" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/google-app-engine/testSource" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/gradle/jps-plugin/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/gradle/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/gradle/testSources" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/gradle/tooling-extension-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/gradle/tooling-extension-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/gradle/tooling-extension-impl/testSources" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/groovy/groovy-psi/gen" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/groovy/groovy-psi/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/groovy/hotswap/agentSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/groovy/jps-plugin/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/groovy/rt-constants/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/groovy/rt/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/groovy/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/groovy/structuralsearch-groovy/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/groovy/structuralsearch-groovy/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/groovy/test" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/hg4idea/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/hg4idea/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/java-decompiler/engine/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/java-decompiler/engine/test" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/java-decompiler/plugin/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/java-decompiler/plugin/test" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/java-i18n/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/java-i18n/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/javaFX/FxBuilderEmbedder/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/javaFX/common-javaFX-plugin/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/javaFX/javaFX-CE/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/javaFX/javaFX-jps-plugin/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/javaFX/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/junit/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/junit_rt/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/maven/artifact-resolver-m2/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/maven/artifact-resolver-m3/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/maven/artifact-resolver-m31/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/maven/jps-plugin/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/maven/jps-plugin/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/maven/maven-server-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/maven/maven2-server-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/maven/maven2-server-impl/test" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/maven/maven3-server-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/maven/maven3-server-impl/test" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/maven/src/main/java" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/maven/src/test/java" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/properties/properties-psi-api/gen" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/properties/properties-psi-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/properties/properties-psi-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/properties/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/properties/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/svn4idea/resources" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/svn4idea/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/svn4idea/testSource" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/tasks/tasks-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/tasks/tasks-core/jira/gen" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/tasks/tasks-core/jira/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/tasks/tasks-core/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/tasks/tasks-java/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/tasks/tasks-tests/test" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/terminal/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/testng/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/testng/testSources" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/testng_rt/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/ui-designer-core/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/ui-designer/jps-plugin/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/ui-designer/jps-plugin/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/ui-designer/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/ui-designer/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/xpath/xpath-lang/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/xpath/xpath-lang/test" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/xpath/xpath-view/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/xpath/xslt-rt/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/xslt-debugger/engine/impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/xslt-debugger/engine/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/xslt-debugger/rt/impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/xslt-debugger/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/python/IntelliLang-python/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/python/edu/course-creator/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/python/edu/course-creator/tests" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/python/edu/learn-python/gen" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/python/edu/learn-python/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/python/edu/learn-python/tests" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/python/edu/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/python/gen" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/python/ide/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/python/ipnb/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/python/ipnb/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/python/openapi/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/python/pluginSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/python/pluginTestSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/python/psi-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/python/pydevSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/python/python-rest/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/python/python-rest/test" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/python/rest/gen" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/python/rest/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/python/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/python/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/samples/actions/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/samples/applicationConfigurable/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/samples/comparingReferences/source" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/samples/comparingReferences/testSource" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/samples/conditionalOperatorConvertor/source" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/samples/conditionalOperatorConvertor/testSource" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/samples/plugin/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/samples/textEditor/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/samples/toolWindow/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/samples/vfs/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/spellchecker/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/spellchecker/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/tools/launcher-generator/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/tools/lexer/jflex-1.4/examples/binary" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/tools/lexer/jflex-1.4/examples/cup" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/tools/lexer/jflex-1.4/examples/interpreter" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/tools/lexer/jflex-1.4/examples/java" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/tools/lexer/jflex-1.4/examples/simple" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/tools/lexer/jflex-1.4/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/updater/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/updater/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/xml/dom-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/xml/dom-openapi/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/xml/dom-tests/tests" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/xml/impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/xml/openapi/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/xml/relaxng/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/xml/relaxng/test" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/xml/tests/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/xml/xml-analysis-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/xml/xml-analysis-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/xml/xml-psi-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/xml/xml-psi-impl/gen" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/xml/xml-psi-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/xml/xml-structure-view-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/xml/xml-structure-view-impl/src" />
</SOURCES>
<jarDirectory url="file://$PROJECT_DIR$/ideaSDK/lib" recursive="false" />
</library>

View File

@@ -11,7 +11,328 @@
<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.zip!/" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/.jps-build-data/groovyStubs/gradle-tooling-extension-impl/java-production" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/.jps-build-data/groovyStubs/groovy-psi/java-production" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/.jps-build-data/groovyStubs/jetgroovy/java-production" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/.jps-build-data/groovyStubs/jps-standalone-builder/java-production" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/.jps-build-data/groovyStubs/lang-impl/java-test" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/.jps-build-data/groovyStubs/spellchecker/java-test" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/.jps-build-data/groovyStubs/testFramework-java/java-production" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/.jps-build-data/groovyStubs/testFramework/java-production" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/.jps-build-data/groovyStubs/util/java-test" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/RegExpSupport/gen" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/RegExpSupport/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/RegExpSupport/test" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/build/cucumber-test-runner/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/build/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/images/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/compiler/forms-compiler/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/compiler/forms-compiler/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/compiler/impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/compiler/impl/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/compiler/instrumentation-util/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/compiler/javac2/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/compiler/openapi/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/debugger/impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/debugger/openapi/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/execution/impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/execution/openapi/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/idea-ui/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/java-analysis-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/java-analysis-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/java-impl/gen" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/java-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/java-indexing-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/java-indexing-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/java-psi-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/java-psi-impl/gen" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/java-psi-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/java-runtime/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/java-structure-view/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/java-tests/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/jsp-base-openapi/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/jsp-openapi/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/jsp-spi/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/manifest/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/manifest/test" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/openapi/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/remote-servers/api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/remote-servers/impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/structuralsearch-java/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/testFramework/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/typeMigration/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/typeMigration/test" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/jps/antLayout/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/jps/jps-builders/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/jps/jps-builders/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/jps/jps-launcher/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/jps/model-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/jps/model-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/jps/model-impl/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/jps/model-serialization/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/jps/model-serialization/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/jps/plugin-system/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/jps/standalone-builder/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/json/gen" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/json/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/json/tests/test" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/analysis-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/analysis-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/annotations/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/boot/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/bootstrap/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/core-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/core-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/duplicates-analysis/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/dvcs-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/dvcs-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/editor-ui-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/editor-ui-ex/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/extensions/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/extensions/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/external-system-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/external-system-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/external-system-impl/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/forms_rt/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/funcTests/project1/module1/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/indexing-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/indexing-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/lang-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/lang-api/testSources" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/lang-impl/gen" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/lang-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/lang-impl/testSources" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/lvcs-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/lvcs-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/platform-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/platform-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/platform-main/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/platform-tests/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/projectModel-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/projectModel-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/remote-servers/agent-rt/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/remote-servers/api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/remote-servers/impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/script-debugger/backend/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/script-debugger/debugger-ui/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/script-debugger/debugger-ui/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/script-debugger/protocol/protocol-model-generator/generated" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/script-debugger/protocol/protocol-model-generator/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/script-debugger/protocol/protocol-reader-runtime/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/script-debugger/protocol/protocol-reader/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/script-debugger/protocol/schema-reader-generator/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/smRunner/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/smRunner/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/structuralsearch/source" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/structuralsearch/testSource" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/structure-view-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/structure-view-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/testFramework/bootstrap/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/testFramework/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/testFramework/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/testRunner/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/usageView/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/util-rt/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/util/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/util/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/vcs-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/vcs-api/vcs-api-core/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/vcs-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/vcs-impl/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/vcs-log/api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/vcs-log/graph-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/vcs-log/graph/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/vcs-log/graph/test" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/vcs-log/impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/vcs-log/impl/test" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/xdebugger-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/xdebugger-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/xdebugger-impl/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/ByteCodeViewer/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/InspectionGadgets/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/InspectionGadgets/test" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/InspectionGadgets/testsrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/IntelliLang/IntelliLang-tests/test" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/IntelliLang/intellilang-jps-plugin/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/IntelliLang/java-support" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/IntelliLang/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/IntelliLang/xml-support" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/IntentionPowerPak/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/IntentionPowerPak/test" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/IntentionPowerPak/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/ShortcutPromoter/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/ant/jps-plugin/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/ant/jps-plugin/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/ant/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/ant/tests/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/commander/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/copyright/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/coverage-common/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/coverage/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/cucumber-jvm-formatter/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/cvs/cvs-core/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/cvs/cvs-plugin/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/cvs/javacvs-src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/cvs/smartcvs-src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/cvs/trilead-ssh2-build213/examples" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/cvs/trilead-ssh2-build213/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/devkit/gen" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/devkit/jps-plugin/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/devkit/jps-plugin/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/eclipse/jps-plugin/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/eclipse/resources" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/eclipse/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/eclipse/testSources" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/editorconfig/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/generate-tostring/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/generate-tostring/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/git4idea/remote-servers-git/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/git4idea/resources" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/git4idea/rt/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/git4idea/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/git4idea/test-stepdefs" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/git4idea/tests" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/github/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/github/test" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/google-app-engine/gen" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/google-app-engine/jps-plugin/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/google-app-engine/jps-plugin/testSource" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/google-app-engine/runtime/source" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/google-app-engine/source" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/google-app-engine/testSource" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/gradle/jps-plugin/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/gradle/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/gradle/testSources" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/gradle/tooling-extension-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/gradle/tooling-extension-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/gradle/tooling-extension-impl/testSources" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/groovy/groovy-psi/gen" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/groovy/groovy-psi/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/groovy/hotswap/agentSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/groovy/jps-plugin/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/groovy/rt-constants/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/groovy/rt/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/groovy/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/groovy/structuralsearch-groovy/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/groovy/structuralsearch-groovy/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/groovy/test" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/hg4idea/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/hg4idea/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/java-decompiler/engine/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/java-decompiler/engine/test" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/java-decompiler/plugin/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/java-decompiler/plugin/test" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/java-i18n/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/java-i18n/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/javaFX/FxBuilderEmbedder/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/javaFX/common-javaFX-plugin/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/javaFX/javaFX-CE/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/javaFX/javaFX-jps-plugin/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/javaFX/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/junit/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/junit_rt/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/maven/artifact-resolver-m2/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/maven/artifact-resolver-m3/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/maven/artifact-resolver-m31/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/maven/jps-plugin/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/maven/jps-plugin/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/maven/maven-server-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/maven/maven2-server-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/maven/maven2-server-impl/test" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/maven/maven3-server-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/maven/maven3-server-impl/test" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/maven/src/main/java" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/maven/src/test/java" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/properties/properties-psi-api/gen" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/properties/properties-psi-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/properties/properties-psi-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/properties/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/properties/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/svn4idea/resources" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/svn4idea/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/svn4idea/testSource" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/tasks/tasks-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/tasks/tasks-core/jira/gen" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/tasks/tasks-core/jira/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/tasks/tasks-core/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/tasks/tasks-java/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/tasks/tasks-tests/test" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/terminal/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/testng/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/testng/testSources" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/testng_rt/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/ui-designer-core/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/ui-designer/jps-plugin/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/ui-designer/jps-plugin/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/ui-designer/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/ui-designer/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/xpath/xpath-lang/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/xpath/xpath-lang/test" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/xpath/xpath-view/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/xpath/xslt-rt/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/xslt-debugger/engine/impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/xslt-debugger/engine/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/xslt-debugger/rt/impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/xslt-debugger/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/python/IntelliLang-python/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/python/edu/course-creator/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/python/edu/course-creator/tests" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/python/edu/learn-python/gen" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/python/edu/learn-python/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/python/edu/learn-python/tests" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/python/edu/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/python/gen" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/python/ide/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/python/ipnb/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/python/ipnb/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/python/openapi/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/python/pluginSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/python/pluginTestSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/python/psi-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/python/pydevSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/python/python-rest/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/python/python-rest/test" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/python/rest/gen" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/python/rest/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/python/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/python/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/samples/actions/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/samples/applicationConfigurable/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/samples/comparingReferences/source" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/samples/comparingReferences/testSource" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/samples/conditionalOperatorConvertor/source" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/samples/conditionalOperatorConvertor/testSource" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/samples/plugin/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/samples/textEditor/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/samples/toolWindow/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/samples/vfs/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/spellchecker/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/spellchecker/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/tools/launcher-generator/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/tools/lexer/jflex-1.4/examples/binary" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/tools/lexer/jflex-1.4/examples/cup" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/tools/lexer/jflex-1.4/examples/interpreter" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/tools/lexer/jflex-1.4/examples/java" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/tools/lexer/jflex-1.4/examples/simple" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/tools/lexer/jflex-1.4/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/updater/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/updater/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/xml/dom-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/xml/dom-openapi/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/xml/dom-tests/tests" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/xml/impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/xml/openapi/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/xml/relaxng/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/xml/relaxng/test" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/xml/tests/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/xml/xml-analysis-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/xml/xml-analysis-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/xml/xml-psi-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/xml/xml-psi-impl/gen" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/xml/xml-psi-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/xml/xml-structure-view-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/xml/xml-structure-view-impl/src" />
</SOURCES>
<jarDirectory url="file://$PROJECT_DIR$/ideaSDK/core" recursive="false" />
</library>

View File

@@ -11,7 +11,328 @@
<SOURCES>
<root url="jar://$PROJECT_DIR$/dependencies/asm5-src.zip!/" />
<root url="jar://$PROJECT_DIR$/dependencies/guava-17.0-sources.jar!/" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/.jps-build-data/groovyStubs/gradle-tooling-extension-impl/java-production" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/.jps-build-data/groovyStubs/groovy-psi/java-production" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/.jps-build-data/groovyStubs/jetgroovy/java-production" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/.jps-build-data/groovyStubs/jps-standalone-builder/java-production" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/.jps-build-data/groovyStubs/lang-impl/java-test" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/.jps-build-data/groovyStubs/spellchecker/java-test" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/.jps-build-data/groovyStubs/testFramework-java/java-production" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/.jps-build-data/groovyStubs/testFramework/java-production" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/.jps-build-data/groovyStubs/util/java-test" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/RegExpSupport/gen" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/RegExpSupport/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/RegExpSupport/test" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/build/cucumber-test-runner/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/build/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/images/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/compiler/forms-compiler/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/compiler/forms-compiler/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/compiler/impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/compiler/impl/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/compiler/instrumentation-util/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/compiler/javac2/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/compiler/openapi/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/debugger/impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/debugger/openapi/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/execution/impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/execution/openapi/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/idea-ui/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/java-analysis-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/java-analysis-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/java-impl/gen" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/java-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/java-indexing-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/java-indexing-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/java-psi-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/java-psi-impl/gen" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/java-psi-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/java-runtime/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/java-structure-view/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/java-tests/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/jsp-base-openapi/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/jsp-openapi/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/jsp-spi/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/manifest/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/manifest/test" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/openapi/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/remote-servers/api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/remote-servers/impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/structuralsearch-java/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/testFramework/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/typeMigration/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/java/typeMigration/test" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/jps/antLayout/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/jps/jps-builders/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/jps/jps-builders/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/jps/jps-launcher/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/jps/model-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/jps/model-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/jps/model-impl/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/jps/model-serialization/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/jps/model-serialization/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/jps/plugin-system/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/jps/standalone-builder/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/json/gen" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/json/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/json/tests/test" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/analysis-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/analysis-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/annotations/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/boot/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/bootstrap/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/core-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/core-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/duplicates-analysis/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/dvcs-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/dvcs-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/editor-ui-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/editor-ui-ex/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/extensions/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/extensions/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/external-system-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/external-system-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/external-system-impl/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/forms_rt/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/funcTests/project1/module1/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/indexing-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/indexing-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/lang-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/lang-api/testSources" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/lang-impl/gen" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/lang-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/lang-impl/testSources" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/lvcs-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/lvcs-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/platform-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/platform-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/platform-main/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/platform-tests/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/projectModel-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/projectModel-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/remote-servers/agent-rt/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/remote-servers/api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/remote-servers/impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/script-debugger/backend/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/script-debugger/debugger-ui/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/script-debugger/debugger-ui/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/script-debugger/protocol/protocol-model-generator/generated" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/script-debugger/protocol/protocol-model-generator/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/script-debugger/protocol/protocol-reader-runtime/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/script-debugger/protocol/protocol-reader/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/script-debugger/protocol/schema-reader-generator/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/smRunner/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/smRunner/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/structuralsearch/source" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/structuralsearch/testSource" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/structure-view-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/structure-view-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/testFramework/bootstrap/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/testFramework/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/testFramework/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/testRunner/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/usageView/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/util-rt/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/util/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/util/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/vcs-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/vcs-api/vcs-api-core/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/vcs-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/vcs-impl/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/vcs-log/api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/vcs-log/graph-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/vcs-log/graph/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/vcs-log/graph/test" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/vcs-log/impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/vcs-log/impl/test" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/xdebugger-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/xdebugger-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/xdebugger-impl/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/ByteCodeViewer/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/InspectionGadgets/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/InspectionGadgets/test" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/InspectionGadgets/testsrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/IntelliLang/IntelliLang-tests/test" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/IntelliLang/intellilang-jps-plugin/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/IntelliLang/java-support" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/IntelliLang/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/IntelliLang/xml-support" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/IntentionPowerPak/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/IntentionPowerPak/test" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/IntentionPowerPak/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/ShortcutPromoter/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/ant/jps-plugin/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/ant/jps-plugin/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/ant/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/ant/tests/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/commander/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/copyright/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/coverage-common/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/coverage/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/cucumber-jvm-formatter/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/cvs/cvs-core/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/cvs/cvs-plugin/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/cvs/javacvs-src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/cvs/smartcvs-src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/cvs/trilead-ssh2-build213/examples" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/cvs/trilead-ssh2-build213/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/devkit/gen" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/devkit/jps-plugin/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/devkit/jps-plugin/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/eclipse/jps-plugin/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/eclipse/resources" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/eclipse/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/eclipse/testSources" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/editorconfig/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/generate-tostring/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/generate-tostring/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/git4idea/remote-servers-git/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/git4idea/resources" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/git4idea/rt/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/git4idea/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/git4idea/test-stepdefs" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/git4idea/tests" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/github/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/github/test" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/google-app-engine/gen" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/google-app-engine/jps-plugin/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/google-app-engine/jps-plugin/testSource" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/google-app-engine/runtime/source" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/google-app-engine/source" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/google-app-engine/testSource" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/gradle/jps-plugin/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/gradle/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/gradle/testSources" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/gradle/tooling-extension-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/gradle/tooling-extension-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/gradle/tooling-extension-impl/testSources" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/groovy/groovy-psi/gen" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/groovy/groovy-psi/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/groovy/hotswap/agentSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/groovy/jps-plugin/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/groovy/rt-constants/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/groovy/rt/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/groovy/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/groovy/structuralsearch-groovy/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/groovy/structuralsearch-groovy/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/groovy/test" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/hg4idea/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/hg4idea/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/java-decompiler/engine/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/java-decompiler/engine/test" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/java-decompiler/plugin/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/java-decompiler/plugin/test" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/java-i18n/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/java-i18n/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/javaFX/FxBuilderEmbedder/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/javaFX/common-javaFX-plugin/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/javaFX/javaFX-CE/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/javaFX/javaFX-jps-plugin/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/javaFX/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/junit/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/junit_rt/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/maven/artifact-resolver-m2/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/maven/artifact-resolver-m3/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/maven/artifact-resolver-m31/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/maven/jps-plugin/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/maven/jps-plugin/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/maven/maven-server-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/maven/maven2-server-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/maven/maven2-server-impl/test" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/maven/maven3-server-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/maven/maven3-server-impl/test" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/maven/src/main/java" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/maven/src/test/java" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/properties/properties-psi-api/gen" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/properties/properties-psi-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/properties/properties-psi-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/properties/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/properties/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/svn4idea/resources" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/svn4idea/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/svn4idea/testSource" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/tasks/tasks-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/tasks/tasks-core/jira/gen" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/tasks/tasks-core/jira/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/tasks/tasks-core/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/tasks/tasks-java/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/tasks/tasks-tests/test" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/terminal/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/testng/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/testng/testSources" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/testng_rt/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/ui-designer-core/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/ui-designer/jps-plugin/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/ui-designer/jps-plugin/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/ui-designer/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/ui-designer/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/xpath/xpath-lang/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/xpath/xpath-lang/test" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/xpath/xpath-view/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/xpath/xslt-rt/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/xslt-debugger/engine/impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/xslt-debugger/engine/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/xslt-debugger/rt/impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/xslt-debugger/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/python/IntelliLang-python/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/python/edu/course-creator/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/python/edu/course-creator/tests" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/python/edu/learn-python/gen" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/python/edu/learn-python/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/python/edu/learn-python/tests" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/python/edu/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/python/gen" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/python/ide/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/python/ipnb/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/python/ipnb/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/python/openapi/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/python/pluginSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/python/pluginTestSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/python/psi-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/python/pydevSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/python/python-rest/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/python/python-rest/test" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/python/rest/gen" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/python/rest/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/python/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/python/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/samples/actions/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/samples/applicationConfigurable/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/samples/comparingReferences/source" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/samples/comparingReferences/testSource" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/samples/conditionalOperatorConvertor/source" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/samples/conditionalOperatorConvertor/testSource" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/samples/plugin/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/samples/textEditor/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/samples/toolWindow/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/samples/vfs/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/spellchecker/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/spellchecker/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/tools/launcher-generator/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/tools/lexer/jflex-1.4/examples/binary" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/tools/lexer/jflex-1.4/examples/cup" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/tools/lexer/jflex-1.4/examples/interpreter" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/tools/lexer/jflex-1.4/examples/java" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/tools/lexer/jflex-1.4/examples/simple" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/tools/lexer/jflex-1.4/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/updater/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/updater/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/xml/dom-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/xml/dom-openapi/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/xml/dom-tests/tests" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/xml/impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/xml/openapi/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/xml/relaxng/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/xml/relaxng/test" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/xml/tests/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/xml/xml-analysis-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/xml/xml-analysis-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/xml/xml-psi-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/xml/xml-psi-impl/gen" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/xml/xml-psi-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/xml/xml-structure-view-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/xml/xml-structure-view-impl/src" />
</SOURCES>
</library>
</component>

View File

@@ -5,7 +5,8 @@
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/IntelliLang/java-support" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/IntelliLang/src" />
</SOURCES>
</library>
</component>

View File

@@ -1,11 +0,0 @@
<component name="libraryTable">
<library name="jansi">
<CLASSES>
<root url="jar://$PROJECT_DIR$/dependencies/jansi.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$PROJECT_DIR$/dependencies/jansi-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@@ -8,7 +8,8 @@
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/java-i18n/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/java-i18n/testSrc" />
</SOURCES>
</library>
</component>

View File

@@ -8,8 +8,18 @@
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/jps/model-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/jps/model-serialization/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/jps/model-serialization/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/jps/model-impl/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/jps/model-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/jps/antLayout/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/jps/jps-builders/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/jps/jps-builders/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/jps/standalone-builder/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/util/src" />
<root url="jar://$PROJECT_DIR$/dependencies/protobuf-java-2.5.0-sources.jar!/" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/platform/util-rt/src" />
</SOURCES>
<jarDirectory url="file://$PROJECT_DIR$/ideaSDK/jps" recursive="false" />
</library>

View File

@@ -8,7 +8,9 @@
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/jps/model-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/jps/model-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/jps/model-serialization/src" />
</SOURCES>
</library>
</component>

View File

@@ -8,7 +8,9 @@
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/jps/jps-builders/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/jps/model-impl/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/jps/model-serialization/testSrc" />
</SOURCES>
<jarDirectory url="file://$PROJECT_DIR$/ideaSDK/jps/test" recursive="false" />
</library>

16
.idea/libraries/junit_4_11.xml generated Normal file
View File

@@ -0,0 +1,16 @@
<component name="libraryTable">
<library name="junit-4.11">
<ANNOTATIONS>
<root url="file://$PROJECT_DIR$/annotations" />
</ANNOTATIONS>
<CLASSES>
<root url="jar://$PROJECT_DIR$/ideaSDK/lib/hamcrest-core-1.3.jar!/" />
<root url="jar://$PROJECT_DIR$/ideaSDK/lib/junit-4.11.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$PROJECT_DIR$/dependencies/hamcrest-core-1.3-sources.jar!/" />
<root url="jar://$PROJECT_DIR$/dependencies/junit-4.11-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@@ -1,16 +0,0 @@
<component name="libraryTable">
<library name="junit-4.12">
<ANNOTATIONS>
<root url="file://$PROJECT_DIR$/annotations" />
</ANNOTATIONS>
<CLASSES>
<root url="jar://$PROJECT_DIR$/ideaSDK/lib/hamcrest-core-1.3.jar!/" />
<root url="jar://$PROJECT_DIR$/ideaSDK/lib/junit-4.12.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$PROJECT_DIR$/dependencies/hamcrest-core-1.3-sources.jar!/" />
<root url="jar://$PROJECT_DIR$/dependencies/junit-4.12-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@@ -8,7 +8,7 @@
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/junit/src" />
</SOURCES>
</library>
</component>

View File

@@ -2,11 +2,12 @@
<library name="kotlin-runtime">
<CLASSES>
<root url="jar://$KOTLIN_BUNDLED$/lib/kotlin-runtime.jar!/" />
<root url="jar://$KOTLIN_BUNDLED$/lib/kotlin-reflect.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="file://$PROJECT_DIR$/libraries/stdlib/src" />
<root url="file://$PROJECT_DIR$/core/builtins/src" />
<root url="file://$PROJECT_DIR$/core/runtime.jvm/src" />
</SOURCES>
</library>
</component>

View File

@@ -8,7 +8,17 @@
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/maven/src/main/java" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/maven/src/test/java" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/maven/jps-plugin/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/maven/jps-plugin/testSrc" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/maven/maven-server-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/maven/maven2-server-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/maven/maven2-server-impl/test" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/maven/maven3-server-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/maven/maven3-server-impl/test" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/maven/artifact-resolver-m2/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/maven/artifact-resolver-m3/src" />
</SOURCES>
<jarDirectory url="file://$PROJECT_DIR$/ideaSDK/plugins/maven/lib" recursive="false" />
</library>

View File

@@ -8,7 +8,11 @@
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/properties/properties-psi-api/gen" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/properties/properties-psi-api/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/properties/properties-psi-impl/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/properties/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/properties/testSrc" />
</SOURCES>
</library>
</component>

View File

@@ -9,7 +9,7 @@
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/testng/src" />
</SOURCES>
</library>
</component>

5
.idea/modules.xml generated
View File

@@ -8,7 +8,6 @@
<module fileurl="file://$PROJECT_DIR$/plugins/android-jps-plugin/android-jps-plugin.iml" filepath="$PROJECT_DIR$/plugins/android-jps-plugin/android-jps-plugin.iml" group="plugins" />
<module fileurl="file://$PROJECT_DIR$/android-studio/android-studio.iml" filepath="$PROJECT_DIR$/android-studio/android-studio.iml" group="ide" />
<module fileurl="file://$PROJECT_DIR$/compiler/android-tests/android-tests.iml" filepath="$PROJECT_DIR$/compiler/android-tests/android-tests.iml" group="compiler" />
<module fileurl="file://$PROJECT_DIR$/plugins/annotation-collector/annotation-collector.iml" filepath="$PROJECT_DIR$/plugins/annotation-collector/annotation-collector.iml" group="plugins" />
<module fileurl="file://$PROJECT_DIR$/ant/ant.iml" filepath="$PROJECT_DIR$/ant/ant.iml" />
<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" />
@@ -18,7 +17,7 @@
<module fileurl="file://$PROJECT_DIR$/compiler/cli/cli.iml" filepath="$PROJECT_DIR$/compiler/cli/cli.iml" group="compiler/cli" />
<module fileurl="file://$PROJECT_DIR$/compiler/cli/cli-common/cli-common.iml" filepath="$PROJECT_DIR$/compiler/cli/cli-common/cli-common.iml" group="compiler/cli" />
<module fileurl="file://$PROJECT_DIR$/compiler/tests/compiler-tests.iml" filepath="$PROJECT_DIR$/compiler/tests/compiler-tests.iml" group="compiler" />
<module fileurl="file://$PROJECT_DIR$/compiler/container/container.iml" filepath="$PROJECT_DIR$/compiler/container/container.iml" group="compiler" />
<module fileurl="file://$PROJECT_DIR$/core/container/container.iml" filepath="$PROJECT_DIR$/core/container/container.iml" />
<module fileurl="file://$PROJECT_DIR$/core/descriptor.loader.java/descriptor.loader.java.iml" filepath="$PROJECT_DIR$/core/descriptor.loader.java/descriptor.loader.java.iml" group="core" />
<module fileurl="file://$PROJECT_DIR$/core/descriptors/descriptors.iml" filepath="$PROJECT_DIR$/core/descriptors/descriptors.iml" group="core" />
<module fileurl="file://$PROJECT_DIR$/core/descriptors.runtime/descriptors.runtime.iml" filepath="$PROJECT_DIR$/core/descriptors.runtime/descriptors.runtime.iml" group="core" />
@@ -34,9 +33,9 @@
<module fileurl="file://$PROJECT_DIR$/idea/idea-completion/idea-completion.iml" filepath="$PROJECT_DIR$/idea/idea-completion/idea-completion.iml" group="ide" />
<module fileurl="file://$PROJECT_DIR$/idea/idea-core/idea-core.iml" filepath="$PROJECT_DIR$/idea/idea-core/idea-core.iml" group="ide" />
<module fileurl="file://$PROJECT_DIR$/idea/idea-jps-common/idea-jps-common.iml" filepath="$PROJECT_DIR$/idea/idea-jps-common/idea-jps-common.iml" group="ide" />
<module fileurl="file://$PROJECT_DIR$/idea/idea-js/idea-js.iml" filepath="$PROJECT_DIR$/idea/idea-js/idea-js.iml" group="ide" />
<module fileurl="file://$PROJECT_DIR$/idea-runner/idea-runner.iml" filepath="$PROJECT_DIR$/idea-runner/idea-runner.iml" group="ide" />
<module fileurl="file://$PROJECT_DIR$/idea/idea-test-framework/idea-test-framework.iml" filepath="$PROJECT_DIR$/idea/idea-test-framework/idea-test-framework.iml" group="ide" />
<module fileurl="file://$PROJECT_DIR$/generators/injector-generator/injector-generator.iml" filepath="$PROJECT_DIR$/generators/injector-generator/injector-generator.iml" group="infrastructure" />
<module fileurl="file://$PROJECT_DIR$/compiler/preloader/instrumentation/instrumentation.iml" filepath="$PROJECT_DIR$/compiler/preloader/instrumentation/instrumentation.iml" group="compiler/cli" />
<module fileurl="file://$PROJECT_DIR$/j2k/j2k.iml" filepath="$PROJECT_DIR$/j2k/j2k.iml" group="j2k" />
<module fileurl="file://$PROJECT_DIR$/compiler/java8-tests/java8-tests.iml" filepath="$PROJECT_DIR$/compiler/java8-tests/java8-tests.iml" group="compiler" />

View File

@@ -0,0 +1,23 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Generate Injectors" type="JetRunConfigurationType" factoryName="Kotlin">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<option name="MAIN_CLASS_NAME" value="org.jetbrains.kotlin.generators.injectors.InjectorsPackage" />
<option name="VM_PARAMETERS" value="" />
<option name="PROGRAM_PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="PASS_PARENT_ENVS" value="true" />
<module name="generators" />
<envs />
<RunnerSettings RunnerId="Debug">
<option name="DEBUG_PORT" value="" />
<option name="TRANSPORT" value="0" />
<option name="LOCAL" value="true" />
</RunnerSettings>
<RunnerSettings RunnerId="Run" />
<ConfigurationWrapper RunnerId="Debug" />
<ConfigurationWrapper RunnerId="Run" />
<method />
</configuration>
</component>

View File

@@ -0,0 +1,37 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Incremental Compilation Tests" type="JUnit" factoryName="JUnit">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<module name="jps-plugin" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" value="" />
<option name="PACKAGE_NAME" value="org.jetbrains.kotlin.jps.build" />
<option name="MAIN_CLASS_NAME" value="" />
<option name="METHOD_NAME" value="" />
<option name="TEST_OBJECT" value="pattern" />
<option name="VM_PARAMETERS" value="-ea -Xmx512m -XX:MaxPermSize=320m -Dkotlin.incremental.compilation=true" />
<option name="PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<option name="TEST_SEARCH_SCOPE">
<value defaultName="moduleWithDependencies" />
</option>
<envs />
<patterns>
<pattern testClass="org.jetbrains.kotlin.jps.build.IncrementalJpsTestGenerated" />
<pattern testClass="org.jetbrains.kotlin.jps.build.IncrementalCacheVersionChangedTest" />
<pattern testClass="org.jetbrains.kotlin.jps.build.IncrementalConstantSearchTest" />
</patterns>
<RunnerSettings RunnerId="Debug">
<option name="DEBUG_PORT" value="" />
<option name="TRANSPORT" value="0" />
<option name="LOCAL" value="true" />
</RunnerSettings>
<RunnerSettings RunnerId="Run" />
<ConfigurationWrapper RunnerId="Debug" />
<ConfigurationWrapper RunnerId="Run" />
<method>
<option name="AntTarget" enabled="true" antfile="file://$PROJECT_DIR$/build.xml" target="dist-quick-compiler-only" />
</method>
</configuration>
</component>

View File

@@ -1,7 +1,3 @@
[![TeamCity (simple build status)](https://img.shields.io/teamcity/http/teamcity.jetbrains.com/s/bt345.svg)](https://teamcity.jetbrains.com/viewType.html?buildTypeId=bt345&branch_Kotlin=%3Cdefault%3E&tab=buildTypeStatusDiv)
[![Maven Central](https://img.shields.io/maven-central/v/org.jetbrains.kotlin/kotlin-maven-plugin.svg)](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.jetbrains.kotlin%22)
[![GitHub license](https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg?style=flat)](http://www.apache.org/licenses/LICENSE-2.0)
# Kotlin Programming Language
Welcome to [Kotlin](http://kotlinlang.org/)! Some handy links:

View File

@@ -6,24 +6,24 @@
<property name="jdk16.home" value="${java.home}"/>
<property name="fail.on.plugin.verifier.error" value="true"/>
<property name="version_substitute_dir" value="${basedir}/versions_temp/"/>
<property name="version_substitute_dir" value="${basedir}/versions_temp/" />
<property name="artifact.output.path" value="${basedir}/out/artifacts"/>
<property name="plugin.xml" value="idea/src/META-INF/plugin.xml"/>
<property name="plugin.xml.bk" value="${version_substitute_dir}/plugin.xml.bk"/>
<property name="plugin.xml.versioned" value="${plugin.xml}.versioned"/>
<property name="plugin.xml.versioned" value="${plugin.xml}.versioned" />
<property name="android-extensions.plugin.xml" value="plugins/android-idea-plugin/src/META-INF/plugin.xml"/>
<property name="android-extensions.plugin.xml.bk" value="${version_substitute_dir}/kotlin-android-extensions.plugin.xml.bk"/>
<property name="android-extensions.plugin.xml.versioned" value="${android-extensions.plugin.xml}.versioned"/>
<property name="android-extensions.plugin.xml.versioned" value="${android-extensions.plugin.xml}.versioned" />
<property name="compiler.version.java" value="compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/KotlinVersion.java"/>
<property name="compiler.version.java.bk" value="${version_substitute_dir}/KotlinVersion.java.bk"/>
<property name="compiler.version.java.versioned" value="${compiler.version.java}.versioned"/>
<property name="compiler.version.java.versioned" value="${compiler.version.java}.versioned" />
<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="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" />
<macrodef name="echoprop">
<attribute name="prop"/>
@@ -47,68 +47,68 @@
</target>
<macrodef name="substituteVersionInFile">
<attribute name="target.file"/>
<attribute name="test.string"/>
<attribute name="target.file.bk" default="@{target.file}.bk"/>
<attribute name="target.file.versioned" default="@{target.file}.versioned"/>
<attribute name="token.key" default="snapshot"/>
<attribute name="version" default="${build.number}"/>
<sequential>
<!-- Create backup. Backup will be restored after build end. This will allow to rebuild project without renew
plugin.xml from repository. -->
<copy file="@{target.file}" tofile="@{target.file.bk}"/>
<attribute name="target.file"/>
<attribute name="test.string"/>
<attribute name="target.file.bk" default="@{target.file}.bk"/>
<attribute name="target.file.versioned" default="@{target.file}.versioned"/>
<attribute name="token.key" default="snapshot"/>
<attribute name="version" default="${build.number}"/>
<sequential>
<!-- Create backup. Backup will be restored after build end. This will allow to rebuild project without renew
plugin.xml from repository. -->
<copy file="@{target.file}" tofile="@{target.file.bk}"/>
<!-- Check that version has correct pattern for substitution -->
<copy todir="">
<fileset file="@{target.file.bk}">
<contains text="@{test.string}"/>
</fileset>
<filterchain>
<replacetokens>
<token key="@{token.key}" value="@{version}"/>
</replacetokens>
</filterchain>
<mergemapper to="@{target.file.versioned}"/>
</copy>
<!-- Check that version has correct pattern for substitution -->
<copy todir="">
<fileset file="@{target.file.bk}">
<contains text="@{test.string}"/>
</fileset>
<filterchain>
<replacetokens>
<token key="@{token.key}" value="@{version}"/>
</replacetokens>
</filterchain>
<mergemapper to="@{target.file.versioned}"/>
</copy>
<!-- If file doesn't exist - there's a problem with original plugin.xml. Probably there's a bad pattern used for version -->
<copy file="@{target.file.versioned}" tofile="@{target.file}" overwrite="true"/>
<!-- If file doesn't exist - there's a problem with original plugin.xml. Probably there's a bad pattern used for version -->
<copy file="@{target.file.versioned}" tofile="@{target.file}" overwrite="true"/>
<delete file="@{target.file.versioned}" quiet="true"/>
</sequential>
<delete file="@{target.file.versioned}" quiet="true"/>
</sequential>
</macrodef>
<target name="writeVersionToTemplateFiles">
<mkdir dir="${version_substitute_dir}"/>
<mkdir dir="${version_substitute_dir}"/>
<substituteVersionInFile
target.file="${plugin.xml}"
target.file.bk="${plugin.xml.bk}"
target.file.versioned="${plugin.xml.versioned}"
test.string="&lt;version&gt;@snapshot@&lt;/version&gt;"/>
<substituteVersionInFile
target.file="${plugin.xml}"
target.file.bk="${plugin.xml.bk}"
target.file.versioned="${plugin.xml.versioned}"
test.string="&lt;version&gt;@snapshot@&lt;/version&gt;"/>
<substituteVersionInFile
target.file="${android-extensions.plugin.xml}"
target.file.bk="${android-extensions.plugin.xml.bk}"
target.file.versioned="${android-extensions.plugin.xml.versioned}"
test.string="&lt;version&gt;@snapshot@&lt;/version&gt;"/>
<substituteVersionInFile
target.file="${android-extensions.plugin.xml}"
target.file.bk="${android-extensions.plugin.xml.bk}"
target.file.versioned="${android-extensions.plugin.xml.versioned}"
test.string="&lt;version&gt;@snapshot@&lt;/version&gt;"/>
<substituteVersionInFile
target.file="${compiler.version.java}"
target.file.bk="${compiler.version.java.bk}"
target.file.versioned="${compiler.version.java.versioned}"
test.string="public static final String VERSION = &quot;@snapshot@&quot;;"/>
<substituteVersionInFile
target.file="${compiler.version.java}"
target.file.bk="${compiler.version.java.bk}"
target.file.versioned="${compiler.version.java.versioned}"
test.string="public static final String VERSION = &quot;@snapshot@&quot;;"/>
<replicateIdeaVersion target.file="${android-extensions.plugin.xml}"/>
<replicateIdeaVersion target.file="${android-extensions.plugin.xml}" />
</target>
<target name="revertTemplateFiles">
<copy file="${plugin.xml.bk}" tofile="${plugin.xml}" overwrite="true"/>
<copy file="${android-extensions.plugin.xml.bk}" tofile="${android-extensions.plugin.xml}" overwrite="true"/>
<copy file="${compiler.version.java.bk}" tofile="${compiler.version.java}" overwrite="true"/>
<target name="revertTemplateFiles">
<copy file="${plugin.xml.bk}" tofile="${plugin.xml}" overwrite="true"/>
<copy file="${android-extensions.plugin.xml.bk}" tofile="${android-extensions.plugin.xml}" overwrite="true"/>
<copy file="${compiler.version.java.bk}" tofile="${compiler.version.java}" overwrite="true"/>
<delete dir="${version_substitute_dir}" quiet="true"/>
</target>
<delete dir="${version_substitute_dir}" quiet="true"/>
</target>
<target name="pre_build" depends="writeVersionToTemplateFiles, cleanupArtifacts"/>
@@ -120,10 +120,8 @@
<sequential>
<zip destfile="@{filename}">
<zipfileset prefix="@{dir}" dir="${artifact.output.path}/@{dir}" excludes="kotlinc/bin/*"/>
<zipfileset prefix="@{dir}/kotlinc/bin" dir="${artifact.output.path}/@{dir}/kotlinc/bin" includes="*.bat"
filemode="644"/>
<zipfileset prefix="@{dir}/kotlinc/bin" dir="${artifact.output.path}/@{dir}/kotlinc/bin" excludes="*.bat"
filemode="755"/>
<zipfileset prefix="@{dir}/kotlinc/bin" dir="${artifact.output.path}/@{dir}/kotlinc/bin" includes="*.bat" filemode="644"/>
<zipfileset prefix="@{dir}/kotlinc/bin" dir="${artifact.output.path}/@{dir}/kotlinc/bin" excludes="*.bat" filemode="755"/>
</zip>
<delete dir="${artifact.output.path}/@{dir}" quiet="true"/>
</sequential>
@@ -133,7 +131,7 @@
<zipPlugin filename="${bare.plugin.zip}" dir="BareKotlin"/>
<zip destfile="${android-extensions.zip}">
<zipfileset prefix="KotlinAndroidExtensions" dir="${artifact.output.path}/KotlinAndroidExtensions"/>
<zipfileset prefix="KotlinAndroidExtensions" dir="${artifact.output.path}/KotlinAndroidExtensions" />
</zip>
<delete dir="${artifact.output.path}/KotlinAndroidExtensions" quiet="true"/>
</target>
@@ -152,7 +150,7 @@
<attribute name="file-name"/>
<sequential>
<local name="file.size"/>
<local name="file.size" />
<length file="@{path}/@{file-name}" property="file.size"/>
<print-statistic key="@{file-name} size" value="${file.size}"/>
</sequential>
@@ -170,44 +168,9 @@
<print-file-size-statistic path="${output}" file-name="stdlib.meta.js"/>
</target>
<target name="post_build" depends="zipArtifacts, revertTemplateFiles, printStatistics, remove_internal_artifacts"/>
<target name="post_build" depends="zipArtifacts, revertTemplateFiles, printStatistics"/>
<target name="none">
<fail message="Either specify pre_build or post_build"/>
</target>
<property name="teamcity.build.branch" value=""/>
<condition property="need.remove.artifacts" value="true">
<and>
<matches pattern="rr/.*" string="${teamcity.build.branch}"/>
<not>
<matches pattern="rr/internal/.*" string="${teamcity.build.branch}"/>
</not>
</and>
</condition>
<target name="remove_internal_artifacts" description="Remove internal artifacts for rr/* branches, but store them for rr/internal/*">
<if>
<istrue value="${need.remove.artifacts}"/>
<then>
<echo message="Remove internal artifacts" />
<delete failonerror="false" verbose="true">
<fileset dir="dist">
<include name="kotlin-compiler-before-shrink.jar"/>
<include name="kotlin-for-upsource.jar"/>
<include name="kotlin-for-upsource-sources.jar"/>
<include name="kotlin-test-data.zip"/>
</fileset>
<fileset dir="out/artifacts/internal">
<include name="kotlin-ide-common.jar"/>
</fileset>
</delete>
</then>
<else>
<echo message="Internal artifacts left untouched"/>
</else>
</if>
</target>
</project>

View File

@@ -5,7 +5,13 @@
<val name="value" val="&quot;fun isAvailable(project: Project, editor: Editor, file: PsiFile): Boolean&quot;"/>
</annotation>
</item>
<item
<item
name='com.intellij.codeInsight.intention.IntentionAction void invoke(com.intellij.openapi.project.Project, com.intellij.openapi.editor.Editor, com.intellij.psi.PsiFile)'>
<annotation name='jet.runtime.typeinfo.KotlinSignature'>
<val name="value" val="&quot;fun invoke(project: Project, editor: Editor, file: PsiFile): Unit&quot;"/>
</annotation>
</item>
<item
name='com.intellij.codeInsight.intention.PsiElementBaseIntentionAction boolean isAvailable(com.intellij.openapi.project.Project, com.intellij.openapi.editor.Editor, com.intellij.psi.PsiElement) 1'>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>

View File

@@ -7,7 +7,7 @@
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="ant" level="project" />
<orderEntry type="library" name="ant-1.7" level="project" />
<orderEntry type="library" name="kotlin-runtime" level="project" />
<orderEntry type="module" module-name="preloader" />
</component>

View File

@@ -26,7 +26,7 @@ public class Kotlin2JsTask : KotlinCompilerBaseTask() {
public var outputPrefix: File? = null
public var outputPostfix: File? = null
public var sourceMap: Boolean = false
public var metaInfo: Boolean = false
public var metaInfo: File? = null
/**
* {@link K2JsArgumentConstants.CALL} (default) if need generate a main function call (main function will be auto detected)
@@ -72,6 +72,10 @@ public class Kotlin2JsTask : KotlinCompilerBaseTask() {
if (noStdlib) args.add("-no-stdlib")
if (sourceMap) args.add("-source-map")
if (metaInfo) args.add("-meta-info")
metaInfo?.let {
args.add("-meta-info")
args.add(it.canonicalPath)
}
}
}

View File

@@ -1,66 +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.ant
import org.apache.tools.ant.AntClassLoader
import org.jetbrains.kotlin.preloading.ClassPreloadingUtils
import java.io.File
import java.lang.ref.SoftReference
import java.net.JarURLConnection
import kotlin.properties.Delegates
object KotlinAntTaskUtil {
private var classLoaderRef = SoftReference<ClassLoader?>(null)
private val libPath: File by Delegates.lazy {
// Find path of kotlin-ant.jar in the filesystem and find kotlin-compiler.jar in the same directory
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.getJarFileURL().toURI())
antTaskJarPath.getParentFile()
}
val compilerJar: File by Delegates.lazy {
File(libPath, "kotlin-compiler.jar").assertExists()
}
val runtimeJar: File by Delegates.lazy {
File(libPath, "kotlin-runtime.jar").assertExists()
}
private fun File.assertExists(): File {
if (!this.exists()) {
throw IllegalStateException("${getName()} is not found in the directory of Kotlin Ant task")
}
return this
}
synchronized fun getOrCreateClassLoader(): ClassLoader {
val cached = classLoaderRef.get()
if (cached != null) return cached
val myLoader = javaClass.getClassLoader()
if (myLoader !is AntClassLoader) return myLoader
val classLoader = ClassPreloadingUtils.preloadClasses(listOf(compilerJar), 4096, myLoader, null)
classLoaderRef = SoftReference(classLoader)
return classLoader
}
}

View File

@@ -16,29 +16,14 @@
package org.jetbrains.kotlin.ant;
import kotlin.KotlinPackage;
import kotlin.jvm.functions.Function1;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.MagicNames;
import org.apache.tools.ant.taskdefs.Javac;
import org.apache.tools.ant.taskdefs.compilers.DefaultCompilerAdapter;
import org.apache.tools.ant.taskdefs.compilers.Javac13;
import org.apache.tools.ant.taskdefs.condition.AntVersion;
import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.Path;
import org.jetbrains.annotations.NotNull;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import static org.apache.tools.ant.Project.MSG_WARN;
public class KotlinCompilerAdapter extends Javac13 {
private static final List<String> KOTLIN_EXTENSIONS = Arrays.asList("kt", "kts");
public class KotlinCompilerAdapter extends DefaultCompilerAdapter {
private Path externalAnnotations;
public List<Commandline.Argument> additionalArguments = new ArrayList<Commandline.Argument>(0);
public void setExternalAnnotations(Path externalAnnotations) {
this.externalAnnotations = externalAnnotations;
@@ -51,103 +36,22 @@ public class KotlinCompilerAdapter extends Javac13 {
return externalAnnotations.createPath();
}
public Commandline.Argument createCompilerArg() {
Commandline.Argument argument = new Commandline.Argument();
additionalArguments.add(argument);
return argument;
}
@Override
public String[] getSupportedFileExtensions() {
List<String> result = KotlinPackage.plus(Arrays.asList(super.getSupportedFileExtensions()), KOTLIN_EXTENSIONS);
//noinspection SSBasedInspection
return result.toArray(new String[result.size()]);
}
@Override
public boolean execute() throws BuildException {
Javac javac = getJavac();
checkAntVersion();
Kotlin2JvmTask kotlinTask = new Kotlin2JvmTask();
kotlinTask.setOutput(javac.getDestdir());
kotlinTask.setClasspath(javac.getClasspath());
kotlinTask.setSrc(javac.getSrcdir());
kotlinTask.setExternalAnnotations(externalAnnotations);
Kotlin2JvmTask kotlinc = new Kotlin2JvmTask();
kotlinc.setFailOnError(javac.getFailonerror());
kotlinc.setOutput(javac.getDestdir());
Path classpath = javac.getClasspath();
if (classpath != null) {
kotlinc.setClasspath(classpath);
}
// We use the provided src dir instead of compileList, because the latter is insane:
// it is constructed only of sources which are newer than classes with the same name
kotlinc.setSrc(javac.getSrcdir());
kotlinc.setExternalAnnotations(externalAnnotations);
kotlinc.getAdditionalArguments().addAll(additionalArguments);
// Javac13#execute passes everything in compileList to javac, which doesn't recognize .kt files
File[] compileListForJavac = filterOutKotlinSources(compileList);
boolean hasKotlinFilesInSources = compileListForJavac.length < compileList.length;
if (hasKotlinFilesInSources) {
kotlinc.execute();
if (!Integer.valueOf(0).equals(kotlinc.getExitCode())) {
// Don't run javac if failOnError = false and there were errors on Kotlin sources
return false;
}
}
else {
// This is needed for addRuntimeToJavacClasspath, where kotlinc arguments will be used.
kotlinc.fillArguments();
}
kotlinTask.execute();
javac.log("Running javac...");
compileList = compileListForJavac;
addRuntimeToJavacClasspath(kotlinc);
return compileList.length == 0 || super.execute();
}
private void addRuntimeToJavacClasspath(@NotNull Kotlin2JvmTask kotlinc) {
for (String arg : kotlinc.getArgs()) {
// If "-no-stdlib" was specified explicitly, probably the user also wanted the javac classpath to not have it
if ("-no-stdlib".equals(arg)) return;
}
if (compileClasspath == null) {
compileClasspath = new Path(getProject());
}
compileClasspath.add(new Path(getProject(), KotlinAntTaskUtil.INSTANCE$.getRuntimeJar().getAbsolutePath()));
}
private void checkAntVersion() {
AntVersion checkVersion = new AntVersion();
checkVersion.setAtLeast("1.8.2");
if (!checkVersion.eval()) {
getJavac().log("<withKotlin> task requires Ant of version at least 1.8.2 to operate reliably. " +
"Please upgrade or, as a workaround, make sure you have at least one Java source and " +
"the output directory is clean before running this task. " +
"You have: " + getProject().getProperty(MagicNames.ANT_VERSION), MSG_WARN);
}
}
@NotNull
private static File[] filterOutKotlinSources(@NotNull File[] files) {
List<File> nonKotlinSources = KotlinPackage.filterNot(files, new Function1<File, Boolean>() {
@Override
public Boolean invoke(File file) {
for (String extension : KOTLIN_EXTENSIONS) {
if (file.getPath().endsWith("." + extension)) return true;
}
return false;
}
});
return nonKotlinSources.toArray(new File[nonKotlinSources.size()]);
Javac13 javac13 = new Javac13();
javac13.setJavac(javac);
return javac13.execute();
}
}

View File

@@ -16,13 +16,45 @@
package org.jetbrains.kotlin.ant
import org.apache.tools.ant.BuildException
import org.apache.tools.ant.Task
import org.apache.tools.ant.types.Commandline
import org.apache.tools.ant.types.Path
import org.apache.tools.ant.types.Reference
import java.io.File
import org.apache.tools.ant.BuildException
import org.apache.tools.ant.types.Commandline
import java.io.PrintStream
import org.apache.tools.ant.AntClassLoader
import java.lang.ref.SoftReference
import org.jetbrains.kotlin.preloading.ClassPreloadingUtils
import java.net.JarURLConnection
object CompilerClassLoaderHolder {
private var classLoaderRef = SoftReference<ClassLoader?>(null)
synchronized fun getOrCreateClassLoader(): ClassLoader {
val cached = classLoaderRef.get()
if (cached != null) return cached
val myLoader = javaClass.getClassLoader()
if (myLoader !is AntClassLoader) return myLoader
// Find path of kotlin-ant.jar in the filesystem and find kotlin-compiler.jar in the same directory
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.getJarFileURL().toURI())
val compilerJarPath = File(antTaskJarPath.getParent(), "kotlin-compiler.jar")
if (!compilerJarPath.exists()) {
throw IllegalStateException("kotlin-compiler.jar is not found in the directory of Kotlin Ant task")
}
val classLoader = ClassPreloadingUtils.preloadClasses(listOf(compilerJarPath), 4096, myLoader, null)
classLoaderRef = SoftReference(classLoader)
return classLoader
}
}
public abstract class KotlinCompilerBaseTask : Task() {
protected abstract val compilerFqName: String
@@ -34,14 +66,11 @@ public abstract class KotlinCompilerBaseTask : Task() {
public var nowarn: Boolean = false
public var verbose: Boolean = false
public var printVersion: Boolean = false
public var failOnError: Boolean = false
public var noStdlib: Boolean = false
public val additionalArguments: MutableList<Commandline.Argument> = arrayListOf()
internal var exitCode: Int? = null
public fun createSrc(): Path {
val srcPath = src
if (srcPath == null) {
@@ -65,7 +94,7 @@ public abstract class KotlinCompilerBaseTask : Task() {
abstract fun fillSpecificArguments()
public fun fillArguments() {
private fun fillArguments() {
val sourcePaths = src ?: throw BuildException("\"src\" should be specified")
args.addAll(sourcePaths.list().map { File(it).canonicalPath })
@@ -83,16 +112,16 @@ public abstract class KotlinCompilerBaseTask : Task() {
final override fun execute() {
fillArguments()
val compilerClass = KotlinAntTaskUtil.getOrCreateClassLoader().loadClass(compilerFqName)
val compilerClass = CompilerClassLoaderHolder.getOrCreateClassLoader().loadClass(compilerFqName)
val compiler = compilerClass.newInstance()
val exec = compilerClass.getMethod("execFullPathsInMessages", javaClass<PrintStream>(), javaClass<Array<String>>())
log("Compiling ${src!!.list().toList()} => [${output!!.canonicalPath}]");
val result = exec(compiler, System.err, args.toTypedArray())
exitCode = (result as Enum<*>).ordinal()
val exitCode = exec(compiler, System.err, args.copyToArray())
if (failOnError && exitCode != 0) {
// TODO: support failOnError attribute of javac
if ((exitCode as Enum<*>).ordinal() != 0) {
throw BuildException("Compile failed; see the compiler error output for details.")
}
}

230
build.xml
View File

@@ -10,7 +10,7 @@
<property name="max.heap.size.for.forked.jvm" value="1024m"/>
<property name="bootstrap.home" value="${basedir}/dependencies/bootstrap-compiler"/>
<property name="bootstrap.home" value="dependencies/bootstrap-compiler"/>
<property name="bootstrap.compiler.home" value="${bootstrap.home}/Kotlin/kotlinc"/>
<property name="bootstrap.runtime" value="${bootstrap.compiler.home}/lib/kotlin-runtime.jar"/>
<property name="bootstrap.reflect" value="${bootstrap.compiler.home}/lib/kotlin-reflect.jar"/>
@@ -56,13 +56,12 @@
<path id="classpath">
<file file="${bootstrap.runtime}"/>
<file file="${bootstrap.reflect}"/>
<fileset dir="${idea.sdk}" includes="core/*.jar"/>
<pathelement location="${protobuf.jar}"/>
<fileset dir="${basedir}/lib" includes="**/*.jar"/>
<fileset dir="${dependencies.dir}" includes="jansi.jar"/>
<fileset dir="${dependencies.dir}" includes="jline.jar"/>
<fileset dir="${dependencies.dir}" includes="jansi.jar"/>
<fileset dir="${dependencies.dir}" includes="cli-parser-1.1.1.jar"/>
<fileset dir="${basedir}/ideaSDK/jps" includes="jps-model.jar"/>
</path>
@@ -82,17 +81,16 @@
<include name="core/descriptors/src"/>
<include name="core/deserialization/src"/>
<include name="core/util.runtime/src"/>
<include name="core/container/src"/>
<include name="compiler/backend/src"/>
<include name="compiler/backend-common/src"/>
<include name="compiler/builtins-serializer/src"/>
<include name="compiler/cli/src"/>
<include name="compiler/cli/cli-common/src"/>
<include name="compiler/container/src"/>
<include name="compiler/frontend/src"/>
<include name="compiler/frontend.java/src"/>
<include name="compiler/light-classes/src"/>
<include name="compiler/plugin-api/src"/>
<include name="plugins/annotation-collector/src"/>
<include name="compiler/serialization/src"/>
<include name="compiler/util/src"/>
<include name="js/js.dart-ast/src"/>
@@ -106,7 +104,6 @@
<property name="idea.out" value="${basedir}/out/production"/>
<patternset id="compilerClassesFromIDEA.fileset">
<include name="frontend/**"/>
<include name="container/**"/>
<include name="descriptors/**"/>
<include name="deserialization/**"/>
<include name="serialization/**"/>
@@ -120,7 +117,6 @@
<include name="util.runtime/**"/>
<include name="light-classes/**"/>
<include name="plugin-api/**"/>
<include name="annotation-collector/**"/>
<include name="builtins-serializer/**"/>
<include name="js.dart-ast/**"/>
<include name="js.translator/**"/>
@@ -201,12 +197,10 @@
<fileset dir="compiler/builtins-serializer/src"/>
<fileset dir="compiler/cli/src"/>
<fileset dir="compiler/cli/cli-common/src"/>
<fileset dir="compiler/container/src"/>
<fileset dir="compiler/frontend/src"/>
<fileset dir="compiler/frontend.java/src"/>
<fileset dir="compiler/light-classes/src"/>
<fileset dir="compiler/plugin-api/src"/>
<fileset dir="plugins/annotation-collector/src"/>
<fileset dir="compiler/serialization/src"/>
<fileset dir="compiler/util/src"/>
<fileset dir="js/js.dart-ast/src"/>
@@ -266,6 +260,7 @@
<macrodef name="new-kotlin2js">
<attribute name="output"/>
<attribute name="meta-info"/>
<element name="src"/>
<sequential>
@@ -293,6 +288,7 @@
<arg value="@{output}"/>
<arg value="-no-stdlib"/>
<arg value="-meta-info"/>
<arg value="@{meta-info}"/>
<arg line="-main noCall"/>
</java>
</sequential>
@@ -305,13 +301,13 @@
<property name="compiled.stdlib.meta.js" value="stdlib.meta.js"/>
<property name="stdlib.js.dir" value="${basedir}/js/js.translator/testData"/>
<new-kotlin2js output="${output}/${compiled.builtins.js}">
<new-kotlin2js output="${output}/${compiled.builtins.js}" meta-info="${output}/${compiled.builtins.meta.js}">
<src>
<fileset refid="kotlin.builtin.files"/>
</src>
</new-kotlin2js>
<new-kotlin2js output="${output}/${compiled.stdlib.js}">
<new-kotlin2js output="${output}/${compiled.stdlib.js}" meta-info="${output}/${compiled.stdlib.meta.js}">
<src>
<resources refid="js.lib.files"/>
</src>
@@ -358,6 +354,7 @@
</closure-compiler>
<jar jarfile="${kotlin-home}/lib/kotlin-jslib.jar" duplicate="fail">
<resources refid="js.lib.files" />
<zipfileset file="${kotlin-home}/build.txt" prefix="META-INF"/>
<zipfileset file="${output}/kotlin.js" prefix=""/>
<zipfileset file="${output}/${compiled.stdlib.meta.js}" prefix=""/>
@@ -442,6 +439,7 @@
<fileset dir="${output}/builtins">
<include name="kotlin/**"/>
<exclude name="kotlin/internal/**"/>
<exclude name="kotlin/reflect/**"/>
</fileset>
<fileset dir="${basedir}/compiler/frontend.java/src" includes="META-INF/services/**"/>
<fileset dir="${basedir}/compiler/backend/src" includes="META-INF/services/**"/>
@@ -521,7 +519,125 @@
<available property="jssejar" value="${java.home}/lib/jsse.jar" file="${java.home}/lib/jsse.jar"/>
<available property="jssejar" value="${java.home}/../Classes/jsse.jar" file="${java.home}/../Classes/jsse.jar"/>
<proguard configuration="${basedir}/compiler/compiler.pro"/>
<proguard><![CDATA[
-injars '${output}/kotlin-compiler-before-shrink.jar'(
!com/thoughtworks/xstream/converters/extended/ISO8601**,
!com/thoughtworks/xstream/converters/reflection/CGLIBEnhancedConverter**,
!com/thoughtworks/xstream/io/xml/Dom4J**,
!com/thoughtworks/xstream/io/xml/Xom**,
!com/thoughtworks/xstream/io/xml/Wstx**,
!com/thoughtworks/xstream/io/xml/KXml2**,
!com/thoughtworks/xstream/io/xml/BEAStax**,
!com/thoughtworks/xstream/io/json/Jettison**,
!com/thoughtworks/xstream/mapper/CGLIBMapper**,
!org/apache/log4j/jmx/Agent*,
!org/apache/log4j/net/JMS*,
!org/apache/log4j/net/SMTP*,
!org/apache/log4j/or/jms/MessageRenderer*,
!org/jdom/xpath/Jaxen*,
!org/mozilla/javascript/xml/impl/xmlbeans/**,
!META-INF/maven**,
**.class,**.properties,**.kt,**.kotlin_*,
META-INF/services/**,META-INF/native/**,META-INF/extensions/**,META-INF/MANIFEST.MF,
messages/**)
-outjars '${kotlin-home}/lib/kotlin-compiler.jar'
-dontnote **
-dontwarn com.intellij.util.ui.IsRetina*
-dontwarn com.intellij.util.RetinaImage*
-dontwarn apple.awt.*
-dontwarn dk.brics.automaton.*
-dontwarn org.fusesource.**
-dontwarn org.xerial.snappy.SnappyBundleActivator
-dontwarn com.intellij.util.CompressionUtil
-dontwarn com.intellij.util.SnappyInitializer
-dontwarn net.sf.cglib.**
-dontwarn org.objectweb.asm.** # this is ASM3, the old version that we do not use
-libraryjars '${rtjar}'
-libraryjars '${jssejar}'
-libraryjars '${bootstrap.runtime}'
-target 1.6
-dontoptimize
-dontobfuscate
-keep class org.fusesource.** { *; }
-keep class org.jdom.input.JAXPParserFactory { *; }
-keep class org.jetbrains.annotations.** {
public protected *;
}
-keep class javax.inject.** {
public protected *;
}
-keep class org.jetbrains.kotlin.** {
public protected *;
}
-keep class org.jetbrains.kotlin.compiler.plugin.** {
public protected *;
}
-keep class org.jetbrains.kotlin.extensions.** {
public protected *;
}
-keep class org.jetbrains.org.objectweb.asm.Opcodes { *; }
-keep class org.jetbrains.kotlin.codegen.extensions.** {
public protected *;
}
-keepclassmembers class com.intellij.openapi.vfs.VirtualFile {
public InputStream getInputStream();
}
-keep class jet.** {
public protected *;
}
-keep class com.intellij.psi.** {
public protected *;
}
# for kdoc & dokka
-keep class com.intellij.openapi.util.TextRange { *; }
-keep class com.intellij.lang.impl.PsiBuilderImpl* {
public protected *;
}
-keep class com.intellij.openapi.util.text.StringHash { *; }
# for gradle plugin and other server tools
-keep class com.intellij.openapi.util.io.ZipFileCache { public *; }
-keep class com.intellij.openapi.util.LowMemoryWatcher { public *; }
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
-keepclassmembers class * {
** toString();
** hashCode();
void start();
void stop();
void dispose();
}
-keepclassmembers class org.jetbrains.org.objectweb.asm.Opcodes {
*** ASM5;
}
-keepclassmembers class org.jetbrains.org.objectweb.asm.ClassReader {
*** SKIP_CODE;
*** SKIP_DEBUG;
*** SKIP_FRAMES;
}
]]></proguard>
</else>
</if>
@@ -529,7 +645,6 @@
<!-- TODO: don't include both to the jar: it's impossible to test changes to core in the local maven build without bootstrap -->
<zipfileset src="${kotlin-home}/lib/kotlin-compiler.jar" includes="**"/>
<zipfileset src="${bootstrap.runtime}" includes="**" excludes="META-INF/**"/>
<zipfileset src="${bootstrap.reflect}" includes="**" excludes="META-INF/**"/>
<manifest>
<attribute name="Built-By" value="${manifest.impl.vendor}"/>
@@ -554,7 +669,6 @@
<pathelement path="${idea.sdk}/core/intellij-core.jar"/>
<pathelement path="${kotlin-home}/lib/kotlin-compiler.jar"/>
<pathelement path="${bootstrap.runtime}"/>
<pathelement path="${bootstrap.reflect}"/>
</classpath>
</kotlinc>
@@ -579,8 +693,7 @@
<compilerarg value="-Xlint:all"/>
<classpath>
<file file="${bootstrap.runtime}"/>
<file file="${bootstrap.reflect}"/>
<pathelement location="${dependencies.dir}/ant-1.8/lib/ant.jar"/>
<pathelement location="${dependencies.dir}/ant-1.7/lib/ant.jar"/>
<pathelement location="${kotlin-home}/lib/kotlin-preloader.jar"/>
</classpath>
</javac2>
@@ -603,27 +716,11 @@
</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>
<copy file="dependencies/annotations/kotlin-jdk-annotations.jar" todir="${kotlin-home}/lib"/>
</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>
<copy file="dependencies/annotations/kotlin-android-sdk-annotations.jar" todir="${kotlin-home}/lib"/>
</target>
<macrodef name="new-kotlinc">
@@ -708,6 +805,7 @@
<include name="core/descriptors.runtime/src"/>
<include name="core/deserialization/src"/>
<include name="core/util.runtime/src"/>
<include name="core/container/src"/>
</src>
<class-path>
<pathelement path="${output}/classes/builtins"/>
@@ -733,15 +831,14 @@
</target>
<macrodef name="pack-runtime-jar">
<attribute name="jar-dir" default="${kotlin-home}/lib"/>
<attribute name="jar-name"/>
<attribute name="implementation-title"/>
<element name="jar-content"/>
<sequential>
<delete file="@{jar-dir}/@{jar-name}" failonerror="false"/>
<delete file="${kotlin-home}/lib/@{jar-name}" failonerror="false"/>
<jar destfile="@{jar-dir}/@{jar-name}" duplicate="fail">
<jar destfile="${kotlin-home}/lib/@{jar-name}" duplicate="fail">
<jar-content/>
<zipfileset file="${kotlin-home}/build.txt" prefix="META-INF"/>
@@ -763,13 +860,12 @@
<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/**"/ -->
<exclude name="kotlin/reflect/**"/>
</zipfileset>
</jar-content>
</pack-runtime-jar>
<pack-runtime-jar jar-dir="${output}" jar-name="kotlin-reflect-before-jarjar.jar" implementation-title="${manifest.impl.title.kotlin.jvm.reflect}">
<pack-runtime-jar jar-name="kotlin-reflect.jar" implementation-title="${manifest.impl.title.kotlin.jvm.reflect}">
<jar-content>
<fileset dir="${output}/classes/reflection"/>
<fileset dir="${output}/classes/core"/>
@@ -778,67 +874,26 @@
</jar-content>
</pack-runtime-jar>
<jar destfile="${output}/kotlin-reflect-before-jarjar.jar" update="true">
<jar destfile="${kotlin-home}/lib/kotlin-reflect.jar" update="true">
<manifest>
<attribute name="Class-Path" value="kotlin-runtime.jar"/>
</manifest>
</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>
<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"/>
<copy todir="${output}/core.src/kotlin/reflect/jvm/internal/impl">
<fileset dir="core">
<include name="descriptor.loader.java/src/**"/>
<include name="descriptors/src/**"/>
<include name="descriptors.runtime/src/**"/>
<include name="deserialization/src/**"/>
<include name="util.runtime/src/**"/>
</fileset>
<cutdirsmapper dirs="5"/> <!-- module/src/org/jetbrains/kotlin -->
</copy>
<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>
<fileset dir="${basedir}/core/builtins/native" includes="**/*"/>
<fileset dir="${basedir}/core/builtins/src" includes="**/*"/>
<fileset dir="${basedir}/core/descriptor.loader.java/src" includes="**/*"/>
<fileset dir="${basedir}/core/descriptors/src" includes="**/*"/>
<fileset dir="${basedir}/core/descriptors.runtime/src" includes="**/*"/>
<fileset dir="${basedir}/core/deserialization/src" includes="**/*"/>
<fileset dir="${basedir}/core/reflection.jvm/src" includes="**/*"/>
<fileset dir="${basedir}/core/runtime.jvm/src" includes="**/*"/>
<fileset dir="${basedir}/core/util.runtime/src" includes="**/*"/>
<fileset dir="${basedir}/libraries/stdlib/src" includes="**/*"/>
<fileset dir="${output}/core.src" includes="**/*"/>
</jar-content>
</pack-runtime-jar>
<pack-runtime-jar jar-dir="${output}" jar-name="kotlin-reflect-sources-for-maven.jar"
implementation-title="${manifest.impl.title.kotlin.jvm.reflect.sources}">
<jar-content>
<fileset dir="${basedir}/core/reflection.jvm/src" includes="**/*"/>
<fileset dir="${output}/core.src" includes="**/*"/>
</jar-content>
</pack-runtime-jar>
</target>
@@ -894,6 +949,7 @@
<fileset dir="${output}/builtins">
<include name="kotlin/**"/>
<exclude name="kotlin/internal/**"/>
<exclude name="kotlin/reflect/**"/>
</fileset>
<fileset dir="${basedir}/compiler/frontend.java/src" includes="META-INF/services/**"/>
<fileset dir="${basedir}/compiler/backend/src" includes="META-INF/services/**"/>

View File

@@ -75,7 +75,7 @@ public class PathManager {
}
public String getAntBinDirectory() {
return rootFolder + "/dependencies/ant-1.8/bin";
return getDependenciesRoot() + "/apache-ant-1.8.0/bin";
}
public String getAndroidModuleRoot() {

View File

@@ -32,6 +32,7 @@ public class SDKDownloader {
private final String systemImages;
private final String platformToolsZipPath;
private final String toolsZipPath;
private final String antZipPath;
private final PathManager pathManager;
@@ -41,6 +42,7 @@ public class SDKDownloader {
this.systemImages = pathManager.getRootForDownload() + "/system-images.zip";
this.platformToolsZipPath = pathManager.getRootForDownload() + "/platform-tools.zip";
this.toolsZipPath = pathManager.getRootForDownload() + "/tools.zip";
this.antZipPath = pathManager.getRootForDownload() + "/apache-ant-1.8.0.zip";
}
public void downloadPlatform() {
@@ -85,11 +87,16 @@ public class SDKDownloader {
download(downloadURL, toolsZipPath);
}
public void downloadAnt() {
download("http://archive.apache.org/dist/ant/binaries/apache-ant-1.8.0-bin.zip", antZipPath);
}
public void downloadAll() {
downloadTools();
downloadAbi();
downloadPlatform();
downloadPlatformTools();
downloadAnt();
}
@@ -98,12 +105,14 @@ public class SDKDownloader {
unzip(systemImages, pathManager.getAndroidSdkRoot() + "/system-images/android-16/");
unzip(platformToolsZipPath, pathManager.getAndroidSdkRoot());
unzip(toolsZipPath, pathManager.getAndroidSdkRoot());
unzip(antZipPath, pathManager.getDependenciesRoot());
}
public void deleteAll() {
delete(platformZipPath);
delete(platformToolsZipPath);
delete(toolsZipPath);
delete(antZipPath);
}
private static void download(String urlString, String output) {

View File

@@ -224,6 +224,7 @@ public class CodegenUtil {
}
}
Document document = file.getViewProvider().getDocument();
return document != null ? document.getLineNumber(markEndOffset ? statement.getTextRange().getEndOffset() : statement.getTextOffset()) + 1 : null;
TextRange textRange = statement.getTextRange();
return document != null ? document.getLineNumber(markEndOffset ? textRange.getEndOffset() : textRange.getStartOffset()) + 1 : null;
}
}

View File

@@ -34,14 +34,14 @@ public object CodegenUtilKt {
// toTrait = Bar
// delegateExpressionType = typeof(baz)
// return Map<member of Foo, corresponding member of typeOf(baz)>
public platformStatic fun getDelegates(
public [platformStatic] fun getDelegates(
descriptor: ClassDescriptor,
toTrait: ClassDescriptor,
delegateExpressionType: JetType? = null
): Map<CallableMemberDescriptor, CallableDescriptor> {
if (delegateExpressionType?.isDynamic() ?: false) return mapOf();
return descriptor.getDefaultType().getMemberScope().getDescriptors().asSequence()
return descriptor.getDefaultType().getMemberScope().getDescriptors().stream()
.filterIsInstance<CallableMemberDescriptor>()
.filter { it.getKind() == CallableMemberDescriptor.Kind.DELEGATION }
.toList()

View File

@@ -125,7 +125,7 @@ public abstract class DataClassMethodGenerator {
private List<PropertyDescriptor> getDataProperties() {
List<PropertyDescriptor> result = Lists.newArrayList();
for (JetParameter parameter : getPrimaryConstructorParameters()) {
if (parameter.hasValOrVar()) {
if (parameter.hasValOrVarNode()) {
result.add(bindingContext.get(BindingContext.PRIMARY_CONSTRUCTOR_PARAMETER, parameter));
}
}

View File

@@ -56,7 +56,7 @@ public fun <Function : FunctionHandle, Signature> generateBridges(
// If it's a concrete fake override, some of the bridges may be inherited from the super-classes. Specifically, bridges for all
// declarations that are reachable from all concrete immediate super-functions of the given function. Note that all such bridges are
// guaranteed to delegate to the same implementation as bridges for the given function, that's why it's safe to inherit them
@suppress("UNCHECKED_CAST")
[suppress("UNCHECKED_CAST")]
for (overridden in function.getOverridden() as Iterable<Function>) {
if (!overridden.isAbstract) {
bridgesToGenerate.removeAll(findAllReachableDeclarations(overridden).map(signature))
@@ -77,7 +77,7 @@ private fun <Function : FunctionHandle> findAllReachableDeclarations(function: F
}
}
}
@suppress("UNCHECKED_CAST")
[suppress("UNCHECKED_CAST")]
DFS.dfs(listOf(function), { it.getOverridden() as Iterable<Function> }, collector)
return HashSet(collector.result())
}

View File

@@ -16,12 +16,11 @@
package org.jetbrains.kotlin.backend.common.bridges
import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
import org.jetbrains.kotlin.descriptors.Modality
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.resolve.DescriptorUtils
import org.jetbrains.kotlin.resolve.OverrideResolver
import org.jetbrains.kotlin.resolve.calls.CallResolverUtil
import org.jetbrains.kotlin.types.TypeUtils
public fun <Signature> generateBridgesForFunctionDescriptor(
descriptor: FunctionDescriptor,
@@ -65,50 +64,36 @@ private data class DescriptorBasedFunctionHandle(val descriptor: FunctionDescrip
/**
* Given a fake override in a class, returns an overridden declaration with implementation in trait, such that a method delegating to that
* 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.
* override of any trait implementation or such method was already generated into some superclass
*/
public fun findTraitImplementation(descriptor: CallableMemberDescriptor): CallableMemberDescriptor? {
if (descriptor.getKind().isReal()) return null
if (CallResolverUtil.isOrOverridesSynthesized(descriptor)) return null
val implementation = findImplementationFromInterface(descriptor) ?: return null
val immediateConcreteSuper = firstSuperMethodFromKotlin(descriptor, implementation) ?: return null
// TODO: this logic is quite common for bridge generation, find a way to abstract it to a single place
// TODO: don't use filterOutOverridden() here, it's an internal front-end utility (see its implementation)
val overriddenDeclarations = OverrideResolver.getOverriddenDeclarations(descriptor)
val filteredOverriddenDeclarations = OverrideResolver.filterOutOverridden(overriddenDeclarations)
if (!DescriptorUtils.isTrait(immediateConcreteSuper.getContainingDeclaration())) {
// If this implementation is already generated into the superclass, we need not generate it again, it'll be inherited
var implementation: CallableMemberDescriptor? = null
for (overriddenDeclaration in filteredOverriddenDeclarations) {
if (DescriptorUtils.isTrait(overriddenDeclaration.getContainingDeclaration()) && overriddenDeclaration.getModality() != Modality.ABSTRACT) {
implementation = overriddenDeclaration
}
}
if (implementation == null) {
return null
}
return immediateConcreteSuper
}
/**
* 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.
*/
public fun findImplementationFromInterface(descriptor: CallableMemberDescriptor): CallableMemberDescriptor? {
val overridden = OverrideResolver.getOverriddenDeclarations(descriptor)
val filtered = OverrideResolver.filterOutOverridden(overridden)
val result = filtered.firstOrNull { it.getModality() != Modality.ABSTRACT } ?: return null
val container = result.getContainingDeclaration()
if (DescriptorUtils.isClass(container) || DescriptorUtils.isEnumClass(container)) return null
return result
}
/**
* Given a fake override and its implementation (non-abstract declaration) somewhere in supertypes,
* 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.
*/
public fun firstSuperMethodFromKotlin(
descriptor: CallableMemberDescriptor,
implementation: CallableMemberDescriptor
): CallableMemberDescriptor? {
return descriptor.getOverriddenDescriptors().firstOrNull { overridden ->
overridden.getModality() != Modality.ABSTRACT &&
(overridden == implementation || OverrideResolver.overrides(overridden, implementation))
// If this implementation is already generated into one of the superclasses, we need not generate it again, it'll be inherited
val containingClass = descriptor.getContainingDeclaration() as ClassDescriptor
val implClassType = implementation!!.getDispatchReceiverParameter()!!.getType()
for (supertype in containingClass.getDefaultType().getConstructor().getSupertypes()) {
if (!DescriptorUtils.isTrait(supertype.getConstructor().getDeclarationDescriptor()!!) &&
TypeUtils.getAllSupertypes(supertype).contains(implClassType)) {
return null
}
}
return implementation
}

View File

@@ -1,47 +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
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.descriptors.annotations.Annotations
import org.jetbrains.kotlin.descriptors.impl.SimpleFunctionDescriptorImpl
import org.jetbrains.kotlin.descriptors.impl.TypeParameterDescriptorImpl
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.resolve.DescriptorUtils
import java.util.*
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.getTypeParameters().map {
val copy = TypeParameterDescriptorImpl.createForFurtherModification(
this, it.getAnnotations(), it.isReified(),
it.getVariance(), it.getName(),
it.getIndex(), SourceElement.NO_SOURCE)
for (upperBound in it.getUpperBounds()) {
copy.addUpperBound(upperBound)
}
copy.setInitialized()
copy
}
protected fun copyValueParameters(descriptor: FunctionDescriptor): List<ValueParameterDescriptor> =
descriptor.getValueParameters().map { it.copy(this, it.getName()) }
}

View File

@@ -1,52 +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
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.descriptors.annotations.Annotations
import org.jetbrains.kotlin.descriptors.impl.SimpleFunctionDescriptorImpl
import org.jetbrains.kotlin.descriptors.impl.TypeParameterDescriptorImpl
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.resolve.DescriptorUtils
import org.jetbrains.kotlin.resolve.jvm.AsmTypes
import java.util.*
public class AccessorForConstructorDescriptor(
private val calleeDescriptor: ConstructorDescriptor,
containingDeclaration: DeclarationDescriptor
) : AbstractAccessorForFunctionDescriptor(containingDeclaration, Name.special("<init>"))
, ConstructorDescriptor
, AccessorForCallableDescriptor<ConstructorDescriptor> {
override fun getCalleeDescriptor(): ConstructorDescriptor = calleeDescriptor
override fun getContainingDeclaration(): ClassDescriptor = calleeDescriptor.getContainingDeclaration()
override fun isPrimary(): Boolean = false
init {
initialize(
DescriptorUtils.getReceiverParameterType(getExtensionReceiverParameter()),
calleeDescriptor.getDispatchReceiverParameter(),
copyTypeParameters(calleeDescriptor),
copyValueParameters(calleeDescriptor),
calleeDescriptor.getReturnType(),
Modality.FINAL,
Visibilities.INTERNAL
)
}
}

View File

@@ -18,13 +18,20 @@ package org.jetbrains.kotlin.codegen;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.kotlin.descriptors.*;
import org.jetbrains.kotlin.descriptors.annotations.Annotations;
import org.jetbrains.kotlin.descriptors.impl.SimpleFunctionDescriptorImpl;
import org.jetbrains.kotlin.descriptors.impl.TypeParameterDescriptorImpl;
import org.jetbrains.kotlin.name.Name;
import org.jetbrains.kotlin.resolve.DescriptorUtils;
import org.jetbrains.kotlin.resolve.annotations.AnnotationsPackage;
import org.jetbrains.kotlin.types.JetType;
import java.util.ArrayList;
import java.util.List;
import static org.jetbrains.kotlin.descriptors.ReceiverParameterDescriptor.NO_RECEIVER_PARAMETER;
public class AccessorForFunctionDescriptor extends AbstractAccessorForFunctionDescriptor implements AccessorForCallableDescriptor<FunctionDescriptor> {
public class AccessorForFunctionDescriptor extends SimpleFunctionDescriptorImpl implements AccessorForCallableDescriptor<FunctionDescriptor> {
private final FunctionDescriptor calleeDescriptor;
@@ -33,8 +40,9 @@ public class AccessorForFunctionDescriptor extends AbstractAccessorForFunctionDe
@NotNull DeclarationDescriptor containingDeclaration,
int index
) {
super(containingDeclaration,
Name.identifier("access$" + (descriptor instanceof ConstructorDescriptor ? "init" : descriptor.getName()) + "$" + index));
super(containingDeclaration, null, Annotations.EMPTY,
Name.identifier("access$" + (descriptor instanceof ConstructorDescriptor ? "init" : descriptor.getName()) + "$" + index),
Kind.DECLARATION, SourceElement.NO_SOURCE);
this.calleeDescriptor = descriptor;
initialize(DescriptorUtils.getReceiverParameterType(descriptor.getExtensionReceiverParameter()),
@@ -48,6 +56,34 @@ public class AccessorForFunctionDescriptor extends AbstractAccessorForFunctionDe
Visibilities.INTERNAL);
}
@NotNull
private List<TypeParameterDescriptor> copyTypeParameters(@NotNull FunctionDescriptor descriptor) {
List<TypeParameterDescriptor> typeParameters = descriptor.getTypeParameters();
List<TypeParameterDescriptor> result = new ArrayList<TypeParameterDescriptor>(typeParameters.size());
for (TypeParameterDescriptor typeParameter : typeParameters) {
TypeParameterDescriptorImpl copy = TypeParameterDescriptorImpl.createForFurtherModification(
this, typeParameter.getAnnotations(), typeParameter.isReified(),
typeParameter.getVariance(), typeParameter.getName(), typeParameter.getIndex(), SourceElement.NO_SOURCE
);
for (JetType upperBound : typeParameter.getUpperBounds()) {
copy.addUpperBound(upperBound);
}
copy.setInitialized();
result.add(copy);
}
return result;
}
@NotNull
private List<ValueParameterDescriptor> copyValueParameters(@NotNull FunctionDescriptor descriptor) {
List<ValueParameterDescriptor> valueParameters = descriptor.getValueParameters();
List<ValueParameterDescriptor> result = new ArrayList<ValueParameterDescriptor>(valueParameters.size());
for (ValueParameterDescriptor valueParameter : valueParameters) {
result.add(valueParameter.copy(this, valueParameter.getName()));
}
return result;
}
@NotNull
@Override
public FunctionDescriptor getCalleeDescriptor() {

View File

@@ -183,7 +183,7 @@ public abstract class AnnotationCodegen {
ClassifierDescriptor classifierDescriptor = annotationDescriptor.getType().getConstructor().getDeclarationDescriptor();
assert classifierDescriptor != null : "Annotation descriptor has no class: " + annotationDescriptor;
RetentionPolicy rp = getRetentionPolicy(classifierDescriptor);
if (rp == RetentionPolicy.SOURCE && typeMapper.getClassBuilderMode() != ClassBuilderMode.LIGHT_CLASSES) {
if (rp == RetentionPolicy.SOURCE) {
return null;
}
@@ -282,9 +282,18 @@ public abstract class AnnotationCodegen {
return null;
}
@Override
public Void visitJavaClassValue(JavaClassValue value, Void data) {
return visitClassOfType(value.getValue());
}
@Override
public Void visitKClassValue(KClassValue value, Void data) {
annotationVisitor.visit(name, typeMapper.mapType(value.getValue()));
return visitClassOfType(value.getValue());
}
private Void visitClassOfType(@NotNull JetType type) {
annotationVisitor.visit(name, typeMapper.mapType(type));
return null;
}

View File

@@ -20,8 +20,8 @@ import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Sets;
import com.intellij.openapi.util.Pair;
import com.intellij.psi.tree.IElementType;
import kotlin.Function1;
import kotlin.Unit;
import kotlin.jvm.functions.Function1;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.builtins.KotlinBuiltIns;
@@ -170,7 +170,7 @@ public class AsmUtil {
public static boolean isStaticMethod(OwnerKind kind, CallableMemberDescriptor functionDescriptor) {
return isStaticKind(kind) ||
JetTypeMapper.isStaticAccessor(functionDescriptor) ||
JetTypeMapper.isAccessor(functionDescriptor) ||
AnnotationsPackage.isPlatformStaticInObjectOrClass(functionDescriptor);
}

View File

@@ -17,8 +17,6 @@
package org.jetbrains.kotlin.codegen
import com.intellij.psi.tree.IElementType
import org.jetbrains.kotlin.codegen.pseudoInsns.fakeAlwaysFalseIfeq
import org.jetbrains.kotlin.codegen.pseudoInsns.fakeAlwaysTrueIfeq
import org.jetbrains.kotlin.lexer.JetTokens
import org.jetbrains.org.objectweb.asm.Label
import org.jetbrains.org.objectweb.asm.Opcodes.*
@@ -52,10 +50,6 @@ open class BranchedValue(
v.visitJumpInsn(patchOpcode(if (jumpIfFalse) opcode else negatedOperations[opcode], v), jumpLabel);
}
open fun loopJump(jumpLabel: Label, v: InstructionAdapter, jumpIfFalse: Boolean) {
condJump(jumpLabel, v, jumpIfFalse)
}
protected open fun patchOpcode(opcode: Int, v: InstructionAdapter): Int {
return opcode
}
@@ -64,21 +58,13 @@ open class BranchedValue(
val negatedOperations = hashMapOf<Int, Int>()
val TRUE: BranchedValue = object : BranchedValue(StackValue.Constant(true, Type.BOOLEAN_TYPE), null, Type.BOOLEAN_TYPE, IFEQ) {
override fun condJump(jumpLabel: Label, v: InstructionAdapter, jumpIfFalse: Boolean) {
if (!jumpIfFalse) {
v.goTo(jumpLabel)
}
}
override fun loopJump(jumpLabel: Label, v: InstructionAdapter, jumpIfFalse: Boolean) {
if (!jumpIfFalse) {
v.fakeAlwaysTrueIfeq(jumpLabel)
}
else {
v.fakeAlwaysFalseIfeq(jumpLabel)
}
}
override fun putSelector(type: Type, v: InstructionAdapter) {
v.iconst(1)
coerceTo(type, v)
@@ -92,15 +78,6 @@ open class BranchedValue(
}
}
override fun loopJump(jumpLabel: Label, v: InstructionAdapter, jumpIfFalse: Boolean) {
if (jumpIfFalse) {
v.fakeAlwaysTrueIfeq(jumpLabel)
}
else {
v.fakeAlwaysFalseIfeq(jumpLabel)
}
}
override fun putSelector(type: Type, v: InstructionAdapter) {
v.iconst(0)
coerceTo(type, v)
@@ -134,10 +111,6 @@ open class BranchedValue(
condJump(condition).condJump(label, iv, jumpIfFalse)
}
fun loopJump(condition: StackValue, label: Label, jumpIfFalse: Boolean, iv: InstructionAdapter) {
condJump(condition).loopJump(label, iv, jumpIfFalse)
}
fun condJump(condition: StackValue): CondJump {
return CondJump(if (condition is BranchedValue) {
condition
@@ -198,10 +171,6 @@ class CondJump(val condition: BranchedValue, op: Int) : BranchedValue(condition,
override fun condJump(jumpLabel: Label, v: InstructionAdapter, jumpIfFalse: Boolean) {
condition.condJump(jumpLabel, v, jumpIfFalse)
}
override fun loopJump(jumpLabel: Label, v: InstructionAdapter, jumpIfFalse: Boolean) {
condition.loopJump(jumpLabel, v, jumpIfFalse)
}
}
class NumberCompare(

View File

@@ -104,7 +104,7 @@ public abstract class ClassBodyCodegen extends MemberCodegen<JetClassOrObject> {
private void generatePrimaryConstructorProperties(PropertyCodegen propertyCodegen, JetClassOrObject origin) {
boolean isAnnotation = origin instanceof JetClass && ((JetClass) origin).isAnnotation();
for (JetParameter p : getPrimaryConstructorParameters()) {
if (p.hasValOrVar()) {
if (p.hasValOrVarNode()) {
PropertyDescriptor propertyDescriptor = bindingContext.get(BindingContext.PRIMARY_CONSTRUCTOR_PARAMETER, p);
if (propertyDescriptor != null) {
if (!isAnnotation) {

View File

@@ -49,11 +49,6 @@ public class ClassBuilderFactories {
public byte[] asBytes(ClassBuilder builder) {
throw new IllegalStateException();
}
@Override
public void close() {
throw new IllegalStateException();
}
};
@NotNull
@@ -84,11 +79,6 @@ public class ClassBuilderFactories {
public byte[] asBytes(ClassBuilder builder) {
return ((TraceBuilder) builder).binary.toByteArray();
}
@Override
public void close() {
}
};
@NotNull
@@ -115,11 +105,6 @@ public class ClassBuilderFactories {
ClassWriter visitor = (ClassWriter) builder.getVisitor();
return visitor.toByteArray();
}
@Override
public void close() {
}
};
private ClassBuilderFactories() {
@@ -132,13 +117,13 @@ public class ClassBuilderFactories {
@Override
protected String getCommonSuperClass(@NotNull String type1, @NotNull String type2) {
// This method is needed to generate StackFrameMap: bytecode metadata for JVM verification. For bytecode version 50.0 (JDK 6)
// these maps can be invalid: in this case, JVM would generate them itself (potentially slowing class loading),
// for bytecode 51.0+ (JDK 7+) JVM would crash with VerifyError.
// It seems that for bytecode emitted by Kotlin compiler, it is safe to return "Object" here, because there will
// be "checkcast" generated before making a call, anyway.
return "java/lang/Object";
try {
return super.getCommonSuperClass(type1, type2);
}
catch (Throwable t) {
// @todo we might need at some point do more sophisticated handling
return "java/lang/Object";
}
}
}

View File

@@ -29,6 +29,4 @@ public interface ClassBuilderFactory {
String asText(ClassBuilder builder);
byte[] asBytes(ClassBuilder builder);
void close();
}

View File

@@ -16,7 +16,7 @@
package org.jetbrains.kotlin.codegen;
import kotlin.jvm.functions.Function0;
import kotlin.Function0;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.kotlin.storage.LockBasedStorageManager;
import org.jetbrains.kotlin.storage.NotNullLazyValue;

View File

@@ -18,8 +18,8 @@ package org.jetbrains.kotlin.codegen;
import com.google.common.collect.Lists;
import com.intellij.util.ArrayUtil;
import kotlin.Function1;
import kotlin.Unit;
import kotlin.jvm.functions.Function1;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.codegen.binding.CalculatedClosure;
@@ -51,7 +51,6 @@ import static org.jetbrains.kotlin.codegen.binding.CodegenBinding.CLOSURE;
import static org.jetbrains.kotlin.codegen.binding.CodegenBinding.asmTypeForAnonymousClass;
import static org.jetbrains.kotlin.load.java.JvmAnnotationNames.KotlinSyntheticClass;
import static org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilPackage.getBuiltIns;
import static org.jetbrains.kotlin.resolve.jvm.AsmTypes.*;
import static org.jetbrains.kotlin.resolve.jvm.diagnostics.DiagnosticsPackage.OtherOrigin;
import static org.jetbrains.org.objectweb.asm.Opcodes.*;
@@ -214,10 +213,7 @@ public class ClosureCodegen extends MemberCodegen<JetElement> {
}
@NotNull
public StackValue putInstanceOnStack(
@NotNull final ExpressionCodegen codegen,
@Nullable final FunctionDescriptor functionReferenceTarget
) {
public StackValue putInstanceOnStack(@NotNull final ExpressionCodegen codegen) {
return StackValue.operation(asmType, new Function1<InstructionAdapter, Unit>() {
@Override
public Unit invoke(InstructionAdapter v) {
@@ -231,37 +227,11 @@ public class ClosureCodegen extends MemberCodegen<JetElement> {
codegen.pushClosureOnStack(classDescriptor, true, codegen.defaultCallGenerator);
v.invokespecial(asmType.getInternalName(), "<init>", constructor.getDescriptor(), false);
}
if (functionReferenceTarget != null) {
equipFunctionReferenceWithReflection(v, functionReferenceTarget);
}
return Unit.INSTANCE$;
}
});
}
private static void equipFunctionReferenceWithReflection(@NotNull InstructionAdapter v, @NotNull FunctionDescriptor target) {
DeclarationDescriptor container = target.getContainingDeclaration();
Type type;
if (container instanceof PackageFragmentDescriptor) {
type = target.getExtensionReceiverParameter() != null
? K_TOP_LEVEL_EXTENSION_FUNCTION
: K_TOP_LEVEL_FUNCTION;
}
else if (container instanceof ClassDescriptor) {
type = K_MEMBER_FUNCTION;
}
else {
type = K_LOCAL_FUNCTION;
}
Method method = method("function", K_FUNCTION, FUNCTION_REFERENCE);
v.invokestatic(REFLECTION, method.getName(), method.getDescriptor(), false);
StackValue.coerce(K_FUNCTION, type, v);
}
private void generateConstInstance() {
MethodVisitor mv = v.newMethod(OtherOrigin(element, funDescriptor), ACC_STATIC | ACC_SYNTHETIC, "<clinit>", "()V", null, ArrayUtil.EMPTY_STRING_ARRAY);
@@ -335,17 +305,7 @@ public class ClosureCodegen extends MemberCodegen<JetElement> {
}
iv.load(0, superClassAsmType);
if (superClassAsmType.equals(LAMBDA) || superClassAsmType.equals(FUNCTION_REFERENCE)) {
int arity = funDescriptor.getValueParameters().size();
if (funDescriptor.getExtensionReceiverParameter() != null) arity++;
if (funDescriptor.getDispatchReceiverParameter() != null) arity++;
iv.iconst(arity);
iv.invokespecial(superClassAsmType.getInternalName(), "<init>", "(I)V", false);
}
else {
iv.invokespecial(superClassAsmType.getInternalName(), "<init>", "()V", false);
}
iv.invokespecial(superClassAsmType.getInternalName(), "<init>", "()V", false);
iv.visitInsn(RETURN);

View File

@@ -58,7 +58,7 @@ public class DefaultParameterValueSubstitutor(val state: GenerationState) {
}
/**
* If the function is annotated with [kotlin.jvm.jvmOverloads], generates Java methods that
* If the function is annotated with [kotlin.jvm.overloads], generates Java methods that
* have the default parameter values substituted. If a method has N parameters and M of which
* have default values, M overloads are generated: the first one takes N-1 parameters (all but
* the last one that takes a default value), the second takes N-2 parameters, and so on.
@@ -70,12 +70,12 @@ public class DefaultParameterValueSubstitutor(val state: GenerationState) {
* implementation in the companion object class)
* @return true if the overloads annotation was found on the element, false otherwise
*/
fun generateOverloadsIfNeeded(methodElement: JetElement?,
fun generateOverloadsIfNeeded(methodElement: JetElement,
functionDescriptor: FunctionDescriptor,
delegateFunctionDescriptor: FunctionDescriptor,
owner: CodegenContext<*>,
classBuilder: ClassBuilder): Boolean {
if (functionDescriptor.getAnnotations().findAnnotation(FqName("kotlin.jvm.jvmOverloads")) == null) {
if (functionDescriptor.getAnnotations().findAnnotation(FqName("kotlin.jvm.overloads")) == null) {
return false
}

View File

@@ -24,9 +24,10 @@ import com.intellij.psi.tree.IElementType;
import com.intellij.util.ArrayUtil;
import com.intellij.util.Function;
import com.intellij.util.containers.Stack;
import kotlin.ExtensionFunction0;
import kotlin.Function1;
import kotlin.KotlinPackage;
import kotlin.Unit;
import kotlin.jvm.functions.Function1;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.backend.common.CodegenUtil;
@@ -38,7 +39,6 @@ import org.jetbrains.kotlin.codegen.inline.*;
import org.jetbrains.kotlin.codegen.intrinsics.IntrinsicMethod;
import org.jetbrains.kotlin.codegen.intrinsics.IntrinsicMethods;
import org.jetbrains.kotlin.codegen.intrinsics.JavaClassProperty;
import org.jetbrains.kotlin.codegen.pseudoInsns.PseudoInsnsPackage;
import org.jetbrains.kotlin.codegen.signature.BothSignatureWriter;
import org.jetbrains.kotlin.codegen.state.GenerationState;
import org.jetbrains.kotlin.codegen.state.JetTypeMapper;
@@ -46,7 +46,6 @@ import org.jetbrains.kotlin.codegen.when.SwitchCodegen;
import org.jetbrains.kotlin.codegen.when.SwitchCodegenUtil;
import org.jetbrains.kotlin.descriptors.*;
import org.jetbrains.kotlin.diagnostics.DiagnosticUtils;
import org.jetbrains.kotlin.diagnostics.Errors;
import org.jetbrains.kotlin.lexer.JetTokens;
import org.jetbrains.kotlin.load.java.JvmAbi;
import org.jetbrains.kotlin.load.java.descriptors.JavaClassDescriptor;
@@ -66,13 +65,10 @@ import org.jetbrains.kotlin.resolve.calls.util.CallMaker;
import org.jetbrains.kotlin.resolve.calls.util.FakeCallableDescriptorForObject;
import org.jetbrains.kotlin.resolve.constants.CompileTimeConstant;
import org.jetbrains.kotlin.resolve.constants.IntegerValueTypeConstant;
import org.jetbrains.kotlin.resolve.constants.evaluate.ConstantExpressionEvaluator;
import org.jetbrains.kotlin.resolve.constants.evaluate.EvaluatePackage;
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilPackage;
import org.jetbrains.kotlin.resolve.inline.InlineUtil;
import org.jetbrains.kotlin.resolve.jvm.diagnostics.ErrorsJvm;
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodParameterKind;
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodParameterSignature;
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodSignature;
import org.jetbrains.kotlin.resolve.scopes.receivers.*;
import org.jetbrains.kotlin.types.Approximation;
@@ -96,7 +92,8 @@ import static org.jetbrains.kotlin.codegen.binding.CodegenBinding.*;
import static org.jetbrains.kotlin.load.java.JvmAnnotationNames.KotlinSyntheticClass;
import static org.jetbrains.kotlin.psi.PsiPackage.JetPsiFactory;
import static org.jetbrains.kotlin.resolve.BindingContext.*;
import static org.jetbrains.kotlin.resolve.BindingContextUtils.*;
import static org.jetbrains.kotlin.resolve.BindingContextUtils.getNotNull;
import static org.jetbrains.kotlin.resolve.BindingContextUtils.isVarCapturedInClosure;
import static org.jetbrains.kotlin.resolve.DescriptorUtils.*;
import static org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilPackage.getResolvedCall;
import static org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilPackage.getResolvedCallWithAssert;
@@ -104,6 +101,7 @@ import static org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilPackage.
import static org.jetbrains.kotlin.resolve.jvm.AsmTypes.*;
import static org.jetbrains.kotlin.resolve.jvm.diagnostics.DiagnosticsPackage.OtherOrigin;
import static org.jetbrains.kotlin.resolve.jvm.diagnostics.DiagnosticsPackage.TraitImpl;
import static org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue.NO_RECEIVER;
import static org.jetbrains.kotlin.serialization.deserialization.DeserializationPackage.findClassAcrossModuleDependencies;
import static org.jetbrains.org.objectweb.asm.Opcodes.*;
@@ -132,7 +130,6 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
private int myLastLineNumber = -1;
private boolean shouldMarkLineNumbers = true;
private int finallyDepth = 0;
public ExpressionCodegen(
@NotNull MethodVisitor mv,
@@ -405,7 +402,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
}
if (expr instanceof JetBlockExpression) {
JetBlockExpression blockExpression = (JetBlockExpression) expr;
List<JetExpression> statements = blockExpression.getStatements();
List<JetElement> statements = blockExpression.getStatements();
if (statements.size() == 0 || statements.size() == 1 && isEmptyExpression(statements.get(0))) {
return true;
}
@@ -468,7 +465,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
blockStackElements.push(new LoopBlockStackElement(end, condition, targetLabel(expression)));
StackValue conditionValue = gen(expression.getCondition());
BranchedValue.Companion.loopJump(conditionValue, end, true, v);
BranchedValue.Companion.condJump(conditionValue, end, true, v);
generateLoopBody(expression.getBody());
@@ -492,8 +489,6 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
blockStackElements.push(new LoopBlockStackElement(breakLabel, continueLabel, targetLabel(expression)));
PseudoInsnsPackage.fakeAlwaysFalseIfeq(v, continueLabel);
JetExpression body = expression.getBody();
JetExpression condition = expression.getCondition();
StackValue conditionValue;
@@ -501,9 +496,9 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
if (body instanceof JetBlockExpression) {
// If body's a block, it can contain variable declarations which may be used in the condition of a do-while loop.
// We handle this case separately because otherwise such variable will be out of the frame map after the block ends
List<JetExpression> doWhileStatements = ((JetBlockExpression) body).getStatements();
List<JetElement> doWhileStatements = ((JetBlockExpression) body).getStatements();
List<JetExpression> statements = new ArrayList<JetExpression>(doWhileStatements.size() + 1);
List<JetElement> statements = new ArrayList<JetElement>(doWhileStatements.size() + 1);
statements.addAll(doWhileStatements);
statements.add(condition);
@@ -517,7 +512,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
conditionValue = gen(condition);
}
BranchedValue.Companion.loopJump(conditionValue, beginLoopLabel, false, v);
BranchedValue.Companion.condJump(conditionValue, beginLoopLabel, false, v);
v.mark(breakLabel);
blockStackElements.pop();
@@ -577,9 +572,6 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
v.mark(loopEntry);
generator.checkPreCondition(loopExit);
// Some forms of for-loop can be optimized as post-condition loops.
PseudoInsnsPackage.fakeAlwaysFalseIfeq(v, continueLabel);
generator.beforeBody();
blockStackElements.push(new LoopBlockStackElement(loopExit, continueLabel, targetLabel(generator.forExpression)));
generator.body();
@@ -1206,20 +1198,16 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
@Override
public StackValue visitBreakExpression(@NotNull JetBreakExpression expression, StackValue receiver) {
return generateBreakOrContinueExpression(expression, true, new Label());
return generateBreakOrContinueExpression(expression, true);
}
@Override
public StackValue visitContinueExpression(@NotNull JetContinueExpression expression, StackValue receiver) {
return generateBreakOrContinueExpression(expression, false, new Label());
return generateBreakOrContinueExpression(expression, false);
}
@NotNull
private StackValue generateBreakOrContinueExpression(
@NotNull JetExpressionWithLabel expression,
boolean isBreak,
@NotNull Label afterBreakContinueLabel
) {
private StackValue generateBreakOrContinueExpression(@NotNull JetExpressionWithLabel expression, boolean isBreak) {
assert expression instanceof JetContinueExpression || expression instanceof JetBreakExpression;
if (!blockStackElements.isEmpty()) {
@@ -1228,7 +1216,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
if (stackElement instanceof FinallyBlockStackElement) {
FinallyBlockStackElement finallyBlockStackElement = (FinallyBlockStackElement) stackElement;
//noinspection ConstantConditions
genFinallyBlockOrGoto(finallyBlockStackElement, null, afterBreakContinueLabel);
genFinallyBlockOrGoto(finallyBlockStackElement, null);
}
else if (stackElement instanceof LoopBlockStackElement) {
LoopBlockStackElement loopBlockStackElement = (LoopBlockStackElement) stackElement;
@@ -1237,9 +1225,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
if (labelElement == null ||
loopBlockStackElement.targetLabel != null &&
labelElement.getReferencedName().equals(loopBlockStackElement.targetLabel.getReferencedName())) {
Label label = isBreak ? loopBlockStackElement.breakLabel : loopBlockStackElement.continueLabel;
PseudoInsnsPackage.fixStackAndJump(v, label);
v.mark(afterBreakContinueLabel);
v.goTo(isBreak ? loopBlockStackElement.breakLabel : loopBlockStackElement.continueLabel);
return StackValue.none();
}
}
@@ -1248,7 +1234,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
}
blockStackElements.pop();
StackValue result = generateBreakOrContinueExpression(expression, isBreak, afterBreakContinueLabel);
StackValue result = generateBreakOrContinueExpression(expression, isBreak);
blockStackElements.push(stackElement);
return result;
}
@@ -1300,7 +1286,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
@Nullable
public static CompileTimeConstant getCompileTimeConstant(@NotNull JetExpression expression, @NotNull BindingContext bindingContext) {
CompileTimeConstant<?> compileTimeValue = ConstantExpressionEvaluator.getConstant(expression, bindingContext);
CompileTimeConstant<?> compileTimeValue = bindingContext.get(COMPILE_TIME_VALUE, expression);
if (compileTimeValue instanceof IntegerValueTypeConstant) {
JetType expectedType = bindingContext.getType(expression);
assert expectedType != null : "Expression is not type checked: " + expression.getText();
@@ -1409,7 +1395,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
assert descriptor != null : "Function is not resolved to descriptor: " + declaration.getText();
return genClosure(
declaration, descriptor, new FunctionGenerationStrategy.FunctionDefault(state, descriptor, declaration), samType, kind, null
declaration, descriptor, new FunctionGenerationStrategy.FunctionDefault(state, descriptor, declaration), samType, kind
);
}
@@ -1419,8 +1405,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
@NotNull FunctionDescriptor descriptor,
@NotNull FunctionGenerationStrategy strategy,
@Nullable SamType samType,
@NotNull KotlinSyntheticClass.Kind kind,
@Nullable FunctionDescriptor functionReferenceTarget
@NotNull KotlinSyntheticClass.Kind kind
) {
ClassBuilder cv = state.getFactory().newVisitor(
OtherOrigin(declaration, descriptor),
@@ -1439,7 +1424,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
propagateChildReifiedTypeParametersUsages(closureCodegen.getReifiedTypeParametersUsages());
}
return closureCodegen.putInstanceOnStack(this, functionReferenceTarget);
return closureCodegen.putInstanceOnStack(this);
}
@Override
@@ -1528,7 +1513,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
if (sharedVarType == null) {
sharedVarType = typeMapper.mapType((VariableDescriptor) entry.getKey());
}
StackValue capturedVar = lookupOuterValue(entry.getValue());
StackValue capturedVar = entry.getValue().getOuterValue(this);
callGenerator.putCapturedValueOnStack(capturedVar, sharedVarType, paramIndex++);
}
@@ -1551,19 +1536,8 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
return generateBlock(expression.getStatements(), isStatement, null, null);
}
@NotNull
public StackValue lookupOuterValue(EnclosedValueDescriptor d) {
DeclarationDescriptor descriptor = d.getDescriptor();
for (LocalLookup.LocalLookupCase aCase : LocalLookup.LocalLookupCase.values()) {
if (aCase.isCase(descriptor)) {
return aCase.outerValue(d, this);
}
}
throw new IllegalStateException("Can't get outer value in " + this + " for " + d);
}
private StackValue generateBlock(
List<JetExpression> statements,
List<JetElement> statements,
boolean isStatement,
Label labelBeforeLastExpression,
@Nullable final Label labelBlockEnd
@@ -1574,10 +1548,13 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
StackValue answer = StackValue.none();
for (Iterator<JetExpression> iterator = statements.iterator(); iterator.hasNext(); ) {
JetExpression possiblyLabeledStatement = iterator.next();
for (Iterator<JetElement> iterator = statements.iterator(); iterator.hasNext(); ) {
JetElement possiblyLabeledStatement = iterator.next();
JetElement statement = possiblyLabeledStatement instanceof JetExpression
? JetPsiUtil.safeDeparenthesize((JetExpression) possiblyLabeledStatement, true)
: possiblyLabeledStatement;
JetElement statement = JetPsiUtil.safeDeparenthesize(possiblyLabeledStatement, true);
if (statement instanceof JetNamedDeclaration) {
JetNamedDeclaration declaration = (JetNamedDeclaration) statement;
@@ -1602,17 +1579,17 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
result.put(Type.VOID_TYPE, v);
}
addLeaveTaskToRemoveDescriptorFromFrameMap(statement, blockEnd, leaveTasks);
removeDescriptorFromFrameMap(statement, blockEnd, leaveTasks);
}
return new StackValueWithLeaveTask(answer, new Function1<StackValue, Unit>() {
return new StackValueWithLeaveTask(answer, new ExtensionFunction0<StackValueWithLeaveTask, Unit>() {
@Override
public Unit invoke(StackValue value) {
public Unit invoke(StackValueWithLeaveTask wrapper) {
if (labelBlockEnd == null) {
v.mark(blockEnd);
}
for (Function<StackValue, Void> task : Lists.reverse(leaveTasks)) {
task.fun(value);
task.fun(wrapper.getStackValue());
}
return Unit.INSTANCE$;
}
@@ -1644,9 +1621,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
if (statement instanceof JetNamedFunction) {
DeclarationDescriptor descriptor = bindingContext.get(DECLARATION_TO_DESCRIPTOR, statement);
assert descriptor instanceof FunctionDescriptor : "Couldn't find function declaration in binding context " + statement.getText();
Type type = asmTypeForAnonymousClass(bindingContext, (FunctionDescriptor) descriptor);
myFrameMap.enter(descriptor, type);
myFrameMap.enter(descriptor, OBJECT_TYPE);
}
}
@@ -1665,7 +1640,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
}
}
private void addLeaveTaskToRemoveDescriptorFromFrameMap(
private void removeDescriptorFromFrameMap(
@NotNull JetElement statement,
@NotNull Label blockEnd,
@NotNull List<Function<StackValue, Void>> leaveTasks
@@ -1673,20 +1648,27 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
if (statement instanceof JetMultiDeclaration) {
JetMultiDeclaration multiDeclaration = (JetMultiDeclaration) statement;
for (JetMultiDeclarationEntry entry : multiDeclaration.getEntries()) {
addLeaveTaskToRemoveLocalVariableFromFrameMap(entry, blockEnd, leaveTasks);
removeLocalVariableFromFrameMap(entry, blockEnd, leaveTasks);
}
}
if (statement instanceof JetVariableDeclaration) {
addLeaveTaskToRemoveLocalVariableFromFrameMap((JetVariableDeclaration) statement, blockEnd, leaveTasks);
removeLocalVariableFromFrameMap((JetVariableDeclaration) statement, blockEnd, leaveTasks);
}
if (statement instanceof JetNamedFunction) {
addLeaveTaskToRemoveNamedFunctionFromFrameMap((JetNamedFunction) statement, blockEnd, leaveTasks);
final DeclarationDescriptor descriptor = bindingContext.get(DECLARATION_TO_DESCRIPTOR, statement);
leaveTasks.add(new Function<StackValue, Void>() {
@Override
public Void fun(StackValue value) {
myFrameMap.leave(descriptor);
return null;
}
});
}
}
private void addLeaveTaskToRemoveLocalVariableFromFrameMap(
private void removeLocalVariableFromFrameMap(
@NotNull JetVariableDeclaration statement,
final Label blockEnd,
@NotNull List<Function<StackValue, Void>> leaveTasks
@@ -1714,31 +1696,6 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
});
}
private void addLeaveTaskToRemoveNamedFunctionFromFrameMap(
@NotNull final JetNamedFunction statement,
final Label blockEnd,
@NotNull List<Function<StackValue, Void>> leaveTasks
) {
final FunctionDescriptor functionDescriptor = (FunctionDescriptor) bindingContext.get(DECLARATION_TO_DESCRIPTOR, statement);
assert functionDescriptor != null;
final Type type = asmTypeForAnonymousClass(bindingContext, functionDescriptor);
final Label scopeStart = new Label();
v.mark(scopeStart);
leaveTasks.add(new Function<StackValue, Void>() {
@Override
public Void fun(StackValue answer) {
int index = myFrameMap.leave(functionDescriptor);
assert !functionDescriptor.getName().isSpecial() : "Local variable should be generated only for function with name: " + statement.getText();
v.visitLocalVariable(functionDescriptor.getName().asString() + "$", type.getDescriptor(), null, scopeStart, blockEnd, index);
return null;
}
});
}
public boolean isShouldMarkLineNumbers() {
return shouldMarkLineNumbers;
}
@@ -1780,12 +1737,12 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
}
}
private void doFinallyOnReturn(@NotNull Label afterReturnLabel) {
private void doFinallyOnReturn() {
if(!blockStackElements.isEmpty()) {
BlockStackElement stackElement = blockStackElements.peek();
if (stackElement instanceof FinallyBlockStackElement) {
FinallyBlockStackElement finallyBlockStackElement = (FinallyBlockStackElement) stackElement;
genFinallyBlockOrGoto(finallyBlockStackElement, null, afterReturnLabel);
genFinallyBlockOrGoto(finallyBlockStackElement, null);
}
else if (stackElement instanceof LoopBlockStackElement) {
@@ -1794,7 +1751,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
}
blockStackElements.pop();
doFinallyOnReturn(afterReturnLabel);
doFinallyOnReturn();
blockStackElements.push(stackElement);
}
}
@@ -1810,11 +1767,9 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
private void genFinallyBlockOrGoto(
@Nullable FinallyBlockStackElement finallyBlockStackElement,
@Nullable Label tryCatchBlockEnd,
@Nullable Label afterJumpLabel
@Nullable Label tryCatchBlockEnd
) {
if (finallyBlockStackElement != null) {
finallyDepth++;
assert finallyBlockStackElement.gaps.size() % 2 == 0 : "Finally block gaps are inconsistent";
BlockStackElement topOfStack = blockStackElements.pop();
@@ -1824,27 +1779,21 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
Label finallyStart = new Label();
v.mark(finallyStart);
finallyBlockStackElement.addGapLabel(finallyStart);
if (InlineCodegenUtil.isFinallyMarkerRequired(context)) {
InlineCodegenUtil.generateFinallyMarker(v, finallyDepth, true);
}
//noinspection ConstantConditions
gen(jetTryExpression.getFinallyBlock().getFinalExpression(), Type.VOID_TYPE);
if (InlineCodegenUtil.isFinallyMarkerRequired(context)) {
InlineCodegenUtil.generateFinallyMarker(v, finallyDepth, false);
}
}
if (tryCatchBlockEnd != null) {
if (context.isInlineFunction()) {
InlineCodegenUtil.generateGoToTryCatchBlockEndMarker(v);
}
v.goTo(tryCatchBlockEnd);
}
if (finallyBlockStackElement != null) {
finallyDepth--;
Label finallyEnd = afterJumpLabel != null ? afterJumpLabel : new Label();
if (afterJumpLabel == null) {
v.mark(finallyEnd);
}
Label finallyEnd = new Label();
v.mark(finallyEnd);
finallyBlockStackElement.addGapLabel(finallyEnd);
blockStackElements.push(finallyBlockStackElement);
@@ -1858,10 +1807,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
NonLocalReturnInfo nonLocalReturn = getNonLocalReturnInfo(descriptor, expression);
boolean isNonLocalReturn = nonLocalReturn != null;
if (isNonLocalReturn && !state.isInlineEnabled()) {
state.getDiagnostics().report(Errors.NON_LOCAL_RETURN_IN_DISABLED_INLINE.on(expression));
genThrow(v, "java/lang/UnsupportedOperationException",
"Non-local returns are not allowed with inlining disabled");
return StackValue.none();
throw new CompilationException("Non local returns requires enabled inlining", null, expression);
}
Type returnType = isNonLocalReturn ? nonLocalReturn.returnType : this.returnType;
@@ -1869,30 +1815,28 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
gen(returnedExpression, returnType);
}
Label afterReturnLabel = new Label();
generateFinallyBlocksIfNeeded(returnType, afterReturnLabel);
generateFinallyBlocksIfNeeded(returnType);
if (isNonLocalReturn) {
InlineCodegenUtil.generateGlobalReturnFlag(v, nonLocalReturn.labelName);
}
v.visitInsn(returnType.getOpcode(Opcodes.IRETURN));
v.mark(afterReturnLabel);
return StackValue.none();
}
public void generateFinallyBlocksIfNeeded(Type returnType, @NotNull Label afterReturnLabel) {
public void generateFinallyBlocksIfNeeded(Type returnType) {
if (hasFinallyBlocks()) {
if (!Type.VOID_TYPE.equals(returnType)) {
int returnValIndex = myFrameMap.enterTemp(returnType);
StackValue.Local localForReturnValue = StackValue.local(returnValIndex, returnType);
localForReturnValue.store(StackValue.onStack(returnType), v);
doFinallyOnReturn(afterReturnLabel);
doFinallyOnReturn();
localForReturnValue.put(returnType, v);
myFrameMap.leaveTemp(returnType);
}
else {
doFinallyOnReturn(afterReturnLabel);
doFinallyOnReturn();
}
}
}
@@ -1946,7 +1890,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
private static boolean endsWithReturn(JetElement bodyExpression) {
if (bodyExpression instanceof JetBlockExpression) {
List<JetExpression> statements = ((JetBlockExpression) bodyExpression).getStatements();
List<JetElement> statements = ((JetBlockExpression) bodyExpression).getStatements();
return statements.size() > 0 && statements.get(statements.size() - 1) instanceof JetReturnExpression;
}
@@ -2045,8 +1989,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
ClassDescriptor scriptClass = bindingContext.get(CLASS_FOR_SCRIPT, scriptDescriptor);
StackValue script = StackValue.thisOrOuter(this, scriptClass, false, false);
Type fieldType = typeMapper.mapType(valueParameterDescriptor);
return StackValue.field(fieldType, scriptClassType, valueParameterDescriptor.getName().getIdentifier(), false, script,
valueParameterDescriptor);
return StackValue.field(fieldType, scriptClassType, valueParameterDescriptor.getName().getIdentifier(), false, script, valueParameterDescriptor);
}
throw new UnsupportedOperationException("don't know how to generate reference " + descriptor);
@@ -2059,11 +2002,6 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
return stackValueForLocal(descriptor, index);
}
return findCapturedValue(descriptor);
}
@Nullable
public StackValue findCapturedValue(@NotNull DeclarationDescriptor descriptor) {
if (context instanceof ConstructorContext) {
return lookupCapturedValueInConstructorParameters(descriptor);
}
@@ -2250,22 +2188,17 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
@Nullable
private StackValue genSamInterfaceValue(
@NotNull JetExpression probablyParenthesizedExpression,
@NotNull final JetExpression expression,
@NotNull final JetVisitor<StackValue, StackValue> visitor
) {
final JetExpression expression = JetPsiUtil.deparenthesize(probablyParenthesizedExpression);
final SamType samType = bindingContext.get(SAM_VALUE, probablyParenthesizedExpression);
if (samType == null || expression == null) return null;
final SamType samType = bindingContext.get(SAM_VALUE, expression);
if (samType == null) return null;
if (expression instanceof JetFunctionLiteralExpression) {
return genClosure(((JetFunctionLiteralExpression) expression).getFunctionLiteral(), samType,
KotlinSyntheticClass.Kind.SAM_LAMBDA);
}
if (expression instanceof JetNamedFunction) {
return genClosure((JetNamedFunction) expression, samType, KotlinSyntheticClass.Kind.SAM_LAMBDA);
}
final Type asmType =
state.getSamWrapperClasses().getSamWrapperClass(samType, expression.getContainingJetFile(), getParentCodegen());
@@ -2431,16 +2364,6 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
callGenerator.putValueIfNeeded(null, Type.INT_TYPE, StackValue.constant(mask, Type.INT_TYPE));
}
// 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(null, parameter.getAsmType(), StackValue.constant(null, parameter.getAsmType()));
}
}
}
callGenerator.genCall(callableMethod, resolvedCall, !masks.isEmpty(), this);
}
@@ -2749,9 +2672,8 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
ResolvedCall<?> resolvedCall = getResolvedCallWithAssert(expression.getCallableReference(), bindingContext);
FunctionDescriptor functionDescriptor = bindingContext.get(FUNCTION, expression);
if (functionDescriptor != null) {
FunctionReferenceGenerationStrategy strategy = new FunctionReferenceGenerationStrategy(state, functionDescriptor, resolvedCall);
return genClosure(expression, functionDescriptor, strategy, null, KotlinSyntheticClass.Kind.CALLABLE_REFERENCE_WRAPPER,
(FunctionDescriptor) resolvedCall.getResultingDescriptor());
CallableReferenceGenerationStrategy strategy = new CallableReferenceGenerationStrategy(state, functionDescriptor, resolvedCall);
return genClosure(expression, functionDescriptor, strategy, null, KotlinSyntheticClass.Kind.CALLABLE_REFERENCE_WRAPPER);
}
VariableDescriptor variableDescriptor = bindingContext.get(VARIABLE, expression);
@@ -2865,6 +2787,125 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
});
}
public static class CallableReferenceGenerationStrategy extends FunctionGenerationStrategy.CodegenBased<FunctionDescriptor> {
private final ResolvedCall<?> resolvedCall;
private final FunctionDescriptor referencedFunction;
public CallableReferenceGenerationStrategy(
@NotNull GenerationState state,
@NotNull FunctionDescriptor functionDescriptor,
@NotNull ResolvedCall<?> resolvedCall
) {
super(state, functionDescriptor);
this.resolvedCall = resolvedCall;
this.referencedFunction = (FunctionDescriptor) resolvedCall.getResultingDescriptor();
}
@Override
public void doGenerateBody(@NotNull ExpressionCodegen codegen, @NotNull JvmMethodSignature signature) {
/*
Here we need to put the arguments from our locals to the stack and invoke the referenced method. Since invocation
of methods is highly dependent on expressions, we create a fake call expression. Then we create a new instance of
ExpressionCodegen and, in order for it to generate code correctly, we save to its 'tempVariables' field every
argument of our fake expression, pointing it to the corresponding index in our locals. This way generation of
every argument boils down to calling LOAD with the corresponding index
*/
JetCallExpression fakeExpression = constructFakeFunctionCall();
final List<? extends ValueArgument> fakeArguments = fakeExpression.getValueArguments();
final ReceiverValue dispatchReceiver = computeAndSaveReceiver(signature, codegen, referencedFunction.getDispatchReceiverParameter());
final ReceiverValue extensionReceiver = computeAndSaveReceiver(signature, codegen, referencedFunction.getExtensionReceiverParameter());
computeAndSaveArguments(fakeArguments, codegen);
ResolvedCall<CallableDescriptor> fakeResolvedCall = new DelegatingResolvedCall<CallableDescriptor>(resolvedCall) {
@NotNull
@Override
public ReceiverValue getExtensionReceiver() {
return extensionReceiver;
}
@NotNull
@Override
public ReceiverValue getDispatchReceiver() {
return dispatchReceiver;
}
@NotNull
@Override
public List<ResolvedValueArgument> getValueArgumentsByIndex() {
List<ResolvedValueArgument> result = new ArrayList<ResolvedValueArgument>(fakeArguments.size());
for (ValueArgument argument : fakeArguments) {
result.add(new ExpressionValueArgument(argument));
}
return result;
}
};
StackValue result;
Type returnType = codegen.returnType;
if (referencedFunction instanceof ConstructorDescriptor) {
if (returnType.getSort() == Type.ARRAY) {
//noinspection ConstantConditions
result = codegen.generateNewArray(fakeExpression, referencedFunction.getReturnType());
}
else {
result = codegen.generateConstructorCall(fakeResolvedCall, returnType);
}
}
else {
Call call = CallMaker.makeCall(fakeExpression, NO_RECEIVER, null, fakeExpression, fakeArguments);
result = codegen.invokeFunction(call, fakeResolvedCall, StackValue.none());
}
InstructionAdapter v = codegen.v;
result.put(returnType, v);
v.areturn(returnType);
}
@NotNull
private JetCallExpression constructFakeFunctionCall() {
StringBuilder fakeFunctionCall = new StringBuilder("callableReferenceFakeCall(");
for (Iterator<ValueParameterDescriptor> iterator = referencedFunction.getValueParameters().iterator(); iterator.hasNext(); ) {
ValueParameterDescriptor descriptor = iterator.next();
fakeFunctionCall.append("p").append(descriptor.getIndex());
if (iterator.hasNext()) {
fakeFunctionCall.append(", ");
}
}
fakeFunctionCall.append(")");
return (JetCallExpression) JetPsiFactory(state.getProject()).createExpression(fakeFunctionCall.toString());
}
private void computeAndSaveArguments(@NotNull List<? extends ValueArgument> fakeArguments, @NotNull ExpressionCodegen codegen) {
for (ValueParameterDescriptor parameter : callableDescriptor.getValueParameters()) {
ValueArgument fakeArgument = fakeArguments.get(parameter.getIndex());
Type type = state.getTypeMapper().mapType(parameter);
int localIndex = codegen.myFrameMap.getIndex(parameter);
codegen.tempVariables.put(fakeArgument.getArgumentExpression(), StackValue.local(localIndex, type));
}
}
@NotNull
private ReceiverValue computeAndSaveReceiver(
@NotNull JvmMethodSignature signature,
@NotNull ExpressionCodegen codegen,
@Nullable ReceiverParameterDescriptor receiver
) {
if (receiver == null) return NO_RECEIVER;
JetExpression receiverExpression = JetPsiFactory(state.getProject()).createExpression("callableReferenceFakeReceiver");
codegen.tempVariables.put(receiverExpression, receiverParameterStackValue(signature));
return new ExpressionReceiver(receiverExpression, receiver.getType());
}
@NotNull
private static StackValue.Local receiverParameterStackValue(@NotNull JvmMethodSignature signature) {
// 0 is this (the callable reference class), 1 is the invoke() method's first parameter
return StackValue.local(1, signature.getAsmMethod().getArgumentTypes()[0]);
}
}
@Override
public StackValue visitDotQualifiedExpression(@NotNull JetDotQualifiedExpression expression, StackValue receiver) {
StackValue receiverValue = StackValue.none(); //gen(expression.getReceiverExpression())
@@ -3232,7 +3273,8 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
int increment = operationName.equals("inc") ? 1 : -1;
Type type = expressionType(expression.getBaseExpression());
StackValue value = gen(expression.getBaseExpression());
return StackValue.preIncrement(type, value, increment, resolvedCall, this);
Callable callable = resolveToCallable((FunctionDescriptor) op, false, resolvedCall);
return StackValue.preIncrement(type, value, increment, callable, resolvedCall, this);
}
@Override
@@ -3285,9 +3327,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
final boolean isPrimitiveNumberClassDescriptor = isPrimitiveNumberClassDescriptor(cls);
if (isPrimitiveNumberClassDescriptor && AsmUtil.isPrimitive(asmBaseType)) {
JetExpression operand = expression.getBaseExpression();
// Optimization for j = i++, when j and i are Int without any smart cast: we just work with primitive int
if (operand instanceof JetReferenceExpression && asmResultType == Type.INT_TYPE &&
bindingContext.get(BindingContext.SMARTCAST, operand) == null) {
if (operand instanceof JetReferenceExpression && asmResultType == Type.INT_TYPE) {
int index = indexOfLocal((JetReferenceExpression) operand);
if (index >= 0) {
return StackValue.postIncrement(index, increment);
@@ -3295,7 +3335,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
}
}
return StackValue.operation(asmBaseType, new Function1<InstructionAdapter, Unit>() {
return StackValue.operation(asmResultType, new Function1<InstructionAdapter, Unit>() {
@Override
public Unit invoke(InstructionAdapter v) {
StackValue value = gen(expression.getBaseExpression());
@@ -3409,30 +3449,21 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
private StackValue generateNewCall(@NotNull JetCallExpression expression, @NotNull ResolvedCall<?> resolvedCall) {
Type type = expressionType(expression);
if (type.getSort() == Type.ARRAY) {
//noinspection ConstantConditions
return generateNewArray(expression, bindingContext.getType(expression));
return generateNewArray(expression);
}
return generateConstructorCall(resolvedCall, type);
}
@NotNull
public ConstructorDescriptor getConstructorDescriptor(@NotNull ResolvedCall<?> resolvedCall) {
FunctionDescriptor accessibleDescriptor = accessibleFunctionDescriptor(resolvedCall);
assert accessibleDescriptor instanceof ConstructorDescriptor :
"getConstructorDescriptor must be called only for constructors: " + accessibleDescriptor;
return (ConstructorDescriptor) accessibleDescriptor;
}
@NotNull
public StackValue generateConstructorCall(@NotNull final ResolvedCall<?> resolvedCall, @NotNull final Type objectType) {
private StackValue generateConstructorCall(@NotNull final ResolvedCall<?> resolvedCall, @NotNull final Type objectType) {
return StackValue.functionCall(objectType, new Function1<InstructionAdapter, Unit>() {
@Override
public Unit invoke(InstructionAdapter v) {
v.anew(objectType);
v.dup();
ConstructorDescriptor constructor = getConstructorDescriptor(resolvedCall);
ConstructorDescriptor constructor = (ConstructorDescriptor) resolvedCall.getResultingDescriptor();
ReceiverParameterDescriptor dispatchReceiver = constructor.getDispatchReceiverParameter();
if (dispatchReceiver != null) {
@@ -3453,7 +3484,14 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
});
}
public StackValue generateNewArray(@NotNull JetCallExpression expression, @NotNull final JetType arrayType) {
public StackValue generateNewArray(@NotNull JetCallExpression expression) {
JetType arrayType = bindingContext.getType(expression);
assert arrayType != null : "Array instantiation isn't type checked: " + expression.getText();
return generateNewArray(expression, arrayType);
}
private StackValue generateNewArray(@NotNull JetCallExpression expression, @NotNull final JetType arrayType) {
assert expression.getValueArguments().size() == 1 : "Size argument expected";
final JetExpression sizeExpression = expression.getValueArguments().get(0).getArgumentExpression();
@@ -3515,35 +3553,41 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
boolean isGetter = "get".equals(operationDescriptor.getName().asString());
Callable callable = resolveToCallable(operationDescriptor, false, isGetter ? resolvedGetCall : resolvedSetCall);
Callable callableMethod = resolveToCallableMethod(operationDescriptor, false, context);
Type[] argumentTypes = callableMethod.getParameterTypes();
StackValue collectionElementReceiver = createCollectionElementReceiver(
expression, receiver, operationDescriptor, isGetter, resolvedGetCall, resolvedSetCall, callable
);
StackValue collectionElementReceiver =
createCollectionElementReceiver(expression, receiver, array, arrayType, operationDescriptor, isGetter, resolvedGetCall, resolvedSetCall,
callable,
argumentTypes);
Type elementType = isGetter ? callableMethod.getReturnType() : ArrayUtil.getLastElement(argumentTypes);
return StackValue.collectionElement(collectionElementReceiver, elementType, resolvedGetCall, resolvedSetCall, this);
return StackValue.collectionElement(collectionElementReceiver, elementType, resolvedGetCall, resolvedSetCall, this, state);
}
}
@NotNull
private StackValue createCollectionElementReceiver(
@NotNull JetArrayAccessExpression expression,
@NotNull StackValue receiver,
@NotNull JetExpression array,
@NotNull Type arrayType,
@NotNull FunctionDescriptor operationDescriptor,
boolean isGetter,
ResolvedCall<FunctionDescriptor> resolvedGetCall,
ResolvedCall<FunctionDescriptor> resolvedGetCall,
ResolvedCall<FunctionDescriptor> resolvedSetCall,
@NotNull Callable callable
@NotNull Callable callable,
@NotNull Type[] argumentTypes
) {
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()
);
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;
@@ -3554,9 +3598,9 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
valueArguments.remove(valueArguments.size() - 1);
}
return new StackValue.CollectionElementReceiver(
callable, receiver, resolvedGetCall, resolvedSetCall, isGetter, this, argumentGenerator, valueArguments
);
return new StackValue.CollectionElementReceiver(callable, receiver, resolvedGetCall, resolvedSetCall, isGetter, this,
argumentGenerator, valueArguments, array, arrayType, expression, argumentTypes);
}
@Override
@@ -3597,14 +3641,14 @@ The "returned" value of try expression with no finally is either the last expres
return StackValue.operation(expectedAsmType, new Function1<InstructionAdapter, Unit>() {
@Override
public Unit invoke(InstructionAdapter v) {
JetFinallySection finallyBlock = expression.getFinallyBlock();
JetFinallySection finallyBlock = expression.getFinallyBlock();
FinallyBlockStackElement finallyBlockStackElement = null;
if (finallyBlock != null) {
finallyBlockStackElement = new FinallyBlockStackElement(expression);
blockStackElements.push(finallyBlockStackElement);
}
//PseudoInsnsPackage.saveStackBeforeTryExpr(v);
Label tryStart = new Label();
v.mark(tryStart);
@@ -3626,7 +3670,7 @@ The "returned" value of try expression with no finally is either the last expres
Label end = new Label();
genFinallyBlockOrGoto(finallyBlockStackElement, end, null);
genFinallyBlockOrGoto(finallyBlockStackElement, end);
List<JetCatchClause> clauses = expression.getCatchClauses();
for (int i = 0, size = clauses.size(); i < size; i++) {
@@ -3656,7 +3700,7 @@ The "returned" value of try expression with no finally is either the last expres
v.visitLocalVariable(descriptor.getName().asString(), descriptorType.getDescriptor(), null, clauseStart, clauseEnd,
index);
genFinallyBlockOrGoto(finallyBlockStackElement, i != size - 1 || finallyBlock != null ? end : null, null);
genFinallyBlockOrGoto(finallyBlockStackElement, i != size - 1 || finallyBlock != null ? end : null);
generateExceptionTable(clauseStart, tryBlockRegions, descriptorType.getInternalName());
}
@@ -3668,7 +3712,6 @@ The "returned" value of try expression with no finally is either the last expres
v.mark(defaultCatchStart);
int savedException = myFrameMap.enterTemp(JAVA_THROWABLE_TYPE);
v.store(savedException, JAVA_THROWABLE_TYPE);
Label defaultCatchEnd = new Label();
v.mark(defaultCatchEnd);
@@ -3677,7 +3720,7 @@ The "returned" value of try expression with no finally is either the last expres
List<Label> defaultCatchRegions = getCurrentCatchIntervals(finallyBlockStackElement, tryStart, defaultCatchEnd);
genFinallyBlockOrGoto(finallyBlockStackElement, null, null);
genFinallyBlockOrGoto(finallyBlockStackElement, null);
v.load(savedException, JAVA_THROWABLE_TYPE);
myFrameMap.leaveTemp(JAVA_THROWABLE_TYPE);
@@ -3729,50 +3772,63 @@ The "returned" value of try expression with no finally is either the last expres
@Override
public StackValue visitBinaryWithTypeRHSExpression(@NotNull JetBinaryExpressionWithTypeRHS expression, StackValue receiver) {
JetExpression left = expression.getLeft();
final IElementType opToken = expression.getOperationReference().getReferencedNameElementType();
JetSimpleNameExpression operationSign = expression.getOperationReference();
final IElementType opToken = operationSign.getReferencedNameElementType();
if (opToken == JetTokens.COLON) {
return gen(left);
return gen(expression.getLeft());
}
else {
JetTypeReference typeReference = expression.getRight();
final JetType rightType = bindingContext.get(TYPE, typeReference);
assert rightType != null;
final JetType rightType = bindingContext.get(TYPE, expression.getRight());
assert rightType != null;
Type rightTypeAsm = boxType(asmType(rightType));
final JetExpression left = expression.getLeft();
final StackValue value = genQualified(receiver, left);
DeclarationDescriptor descriptor = rightType.getConstructor().getDeclarationDescriptor();
if (descriptor instanceof ClassDescriptor || descriptor instanceof TypeParameterDescriptor) {
final StackValue value = genQualified(receiver, left);
return StackValue.operation(boxType(asmType(rightType)), new Function1<InstructionAdapter, Unit>() {
@Override
public Unit invoke(InstructionAdapter v) {
value.put(boxType(value.type), v);
return StackValue.operation(rightTypeAsm, new Function1<InstructionAdapter, Unit>() {
@Override
public Unit invoke(InstructionAdapter v) {
value.put(boxType(value.type), v);
if (value.type == Type.VOID_TYPE) {
StackValue.putUnitInstance(v);
}
if (value.type == Type.VOID_TYPE) {
v.aconst(null);
}
else if (opToken != JetTokens.AS_SAFE) {
if (!TypeUtils.isNullableType(rightType)) {
v.dup();
Label nonnull = new Label();
v.ifnonnull(nonnull);
JetType leftType = bindingContext.getType(left);
assert leftType != null;
genThrow(v, "kotlin/TypeCastException", DescriptorRenderer.FQ_NAMES_IN_TYPES.renderType(leftType) +
" cannot be cast to " +
DescriptorRenderer.FQ_NAMES_IN_TYPES.renderType(rightType));
v.mark(nonnull);
}
}
else {
v.dup();
generateInstanceOfInstruction(rightType);
Label ok = new Label();
v.ifne(ok);
v.pop();
v.aconst(null);
v.mark(ok);
}
if (opToken != JetTokens.AS_SAFE) {
if (!TypeUtils.isNullableType(rightType)) {
v.dup();
Label nonnull = new Label();
v.ifnonnull(nonnull);
genThrow(v, "kotlin/TypeCastException", "null cannot be cast to non-null type " +
DescriptorRenderer.FQ_NAMES_IN_TYPES.renderType(rightType));
v.mark(nonnull);
generateCheckCastInstruction(rightType);
return Unit.INSTANCE$;
}
}
else {
v.dup();
generateInstanceOfInstruction(rightType);
Label ok = new Label();
v.ifne(ok);
v.pop();
v.aconst(null);
v.mark(ok);
}
generateCheckCastInstruction(rightType);
return Unit.INSTANCE$;
});
}
});
else {
throw new UnsupportedOperationException("Don't know how to handle non-class types in as/as? : " + descriptor);
}
}
}
@Override
@@ -4033,9 +4089,8 @@ The "returned" value of try expression with no finally is either the last expres
return new Stack<BlockStackElement>(blockStackElements);
}
public void addBlockStackElementsForNonLocalReturns(@NotNull Stack<BlockStackElement> elements, int finallyDepth) {
public void addBlockStackElementsForNonLocalReturns(@NotNull Stack<BlockStackElement> elements) {
blockStackElements.addAll(elements);
this.finallyDepth = finallyDepth;
}
private static class NonLocalReturnInfo {

View File

@@ -20,6 +20,7 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.kotlin.builtins.CompanionObjectMapping;
import org.jetbrains.kotlin.codegen.state.JetTypeMapper;
import org.jetbrains.kotlin.descriptors.ClassDescriptor;
import org.jetbrains.kotlin.descriptors.ClassifierDescriptor;
import org.jetbrains.kotlin.load.java.JvmAbi;
import org.jetbrains.kotlin.resolve.DescriptorUtils;
import org.jetbrains.org.objectweb.asm.Type;
@@ -45,6 +46,18 @@ public class FieldInfo {
}
}
@SuppressWarnings("deprecation")
@NotNull
public static FieldInfo deprecatedFieldForCompanionObject(@NotNull ClassDescriptor companionObject, @NotNull JetTypeMapper typeMapper) {
assert DescriptorUtils.isCompanionObject(companionObject) : "Not a companion object: " + companionObject;
return new FieldInfo(
typeMapper.mapType((ClassifierDescriptor) companionObject.getContainingDeclaration()),
typeMapper.mapType(companionObject),
JvmAbi.DEPRECATED_COMPANION_OBJECT_FIELD,
true
);
}
@NotNull
public static FieldInfo createForHiddenField(@NotNull Type owner, @NotNull Type fieldType, @NotNull String fieldName) {
return new FieldInfo(owner, fieldType, fieldName, false);

View File

@@ -21,11 +21,12 @@ import com.intellij.psi.PsiElement;
import com.intellij.util.ArrayUtil;
import com.intellij.util.Function;
import com.intellij.util.containers.ContainerUtil;
import kotlin.jvm.functions.Function1;
import kotlin.Function1;
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.BridgesPackage;
import org.jetbrains.kotlin.builtins.KotlinBuiltIns;
import org.jetbrains.kotlin.codegen.context.CodegenContext;
import org.jetbrains.kotlin.codegen.context.MethodContext;
import org.jetbrains.kotlin.codegen.context.PackageContext;
@@ -117,11 +118,8 @@ public class FunctionCodegen {
generateOverloadsWithDefaultValues(function, functionDescriptor, functionDescriptor);
}
public void generateOverloadsWithDefaultValues(
@Nullable JetNamedFunction function,
@NotNull FunctionDescriptor functionDescriptor,
@NotNull FunctionDescriptor delegateFunctionDescriptor
) {
public void generateOverloadsWithDefaultValues(@NotNull JetNamedFunction function,
FunctionDescriptor functionDescriptor, FunctionDescriptor delegateFunctionDescriptor) {
new DefaultParameterValueSubstitutor(state).generateOverloadsIfNeeded(function,
functionDescriptor,
delegateFunctionDescriptor,
@@ -169,7 +167,8 @@ public class FunctionCodegen {
}
AnnotationCodegen.forMethod(mv, typeMapper).genAnnotations(functionDescriptor, asmMethod.getReturnType());
generateParameterAnnotations(functionDescriptor, mv, typeMapper.mapSignature(functionDescriptor));
generateParameterAnnotations(functionDescriptor, mv, jvmSignature);
if (state.getClassBuilderMode() != ClassBuilderMode.LIGHT_CLASSES) {
generateJetValueParameterAnnotations(mv, functionDescriptor, jvmSignature);
@@ -304,11 +303,7 @@ public class FunctionCodegen {
}
@Nullable
private static Type getThisTypeForFunction(
@NotNull FunctionDescriptor functionDescriptor,
@NotNull MethodContext context,
@NotNull JetTypeMapper typeMapper
) {
private static Type getThisTypeForFunction(@NotNull FunctionDescriptor functionDescriptor, @NotNull MethodContext context, @NotNull JetTypeMapper typeMapper) {
ReceiverParameterDescriptor dispatchReceiver = functionDescriptor.getDispatchReceiverParameter();
if (functionDescriptor instanceof ConstructorDescriptor) {
return typeMapper.mapType(functionDescriptor);
@@ -387,15 +382,14 @@ public class FunctionCodegen {
//add this
if (thisType != null) {
mv.visitLocalVariable("this", thisType.getDescriptor(), null, methodBegin, methodEnd, shift);
}
else {
} else {
//TODO: provide thisType for callable reference
}
shift++;
}
for (int i = 0; i < params.size(); i++) {
JvmMethodParameterSignature param = params.get(i);
JvmMethodParameterSignature param = params.get(i);
JvmMethodParameterKind kind = param.getKind();
String parameterName;
@@ -601,10 +595,6 @@ public class FunctionCodegen {
getThrownExceptions(functionDescriptor, typeMapper)
);
// Only method annotations are copied to the $default method. Parameter annotations are not copied until there are valid use cases;
// enum constructors have two additional synthetic parameters which somewhat complicate this task
AnnotationCodegen.forMethod(mv, typeMapper).genAnnotations(functionDescriptor, defaultMethod.getReturnType());
if (state.getClassBuilderMode() == ClassBuilderMode.FULL) {
if (this.owner instanceof PackageFacadeContext) {
mv.visitCode();
@@ -759,8 +749,7 @@ public class FunctionCodegen {
) {
int flags = ACC_PUBLIC | ACC_BRIDGE | ACC_SYNTHETIC; // TODO.
MethodVisitor mv =
v.newMethod(DiagnosticsPackage.Bridge(descriptor, origin), flags, bridge.getName(), bridge.getDescriptor(), null, null);
MethodVisitor mv = v.newMethod(DiagnosticsPackage.Bridge(descriptor, origin), flags, delegateTo.getName(), bridge.getDescriptor(), null, null);
if (state.getClassBuilderMode() != ClassBuilderMode.FULL) return;
mv.visitCode();
@@ -787,8 +776,7 @@ public class FunctionCodegen {
}
public void genDelegate(@NotNull FunctionDescriptor functionDescriptor, FunctionDescriptor overriddenDescriptor, StackValue field) {
genDelegate(functionDescriptor, overriddenDescriptor.getOriginal(),
(ClassDescriptor) overriddenDescriptor.getContainingDeclaration(), field);
genDelegate(functionDescriptor, overriddenDescriptor.getOriginal(), (ClassDescriptor) overriddenDescriptor.getContainingDeclaration(), field);
}
public void genDelegate(

View File

@@ -1,162 +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;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.codegen.state.GenerationState;
import org.jetbrains.kotlin.descriptors.*;
import org.jetbrains.kotlin.psi.Call;
import org.jetbrains.kotlin.psi.JetCallExpression;
import org.jetbrains.kotlin.psi.JetExpression;
import org.jetbrains.kotlin.psi.ValueArgument;
import org.jetbrains.kotlin.resolve.calls.model.DelegatingResolvedCall;
import org.jetbrains.kotlin.resolve.calls.model.ExpressionValueArgument;
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall;
import org.jetbrains.kotlin.resolve.calls.model.ResolvedValueArgument;
import org.jetbrains.kotlin.resolve.calls.util.CallMaker;
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodSignature;
import org.jetbrains.kotlin.resolve.scopes.receivers.ExpressionReceiver;
import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue;
import org.jetbrains.org.objectweb.asm.Type;
import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import static org.jetbrains.kotlin.psi.PsiPackage.JetPsiFactory;
import static org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue.NO_RECEIVER;
public class FunctionReferenceGenerationStrategy extends FunctionGenerationStrategy.CodegenBased<FunctionDescriptor> {
private final ResolvedCall<?> resolvedCall;
private final FunctionDescriptor referencedFunction;
public FunctionReferenceGenerationStrategy(
@NotNull GenerationState state,
@NotNull FunctionDescriptor functionDescriptor,
@NotNull ResolvedCall<?> resolvedCall
) {
super(state, functionDescriptor);
this.resolvedCall = resolvedCall;
this.referencedFunction = (FunctionDescriptor) resolvedCall.getResultingDescriptor();
}
@Override
public void doGenerateBody(@NotNull ExpressionCodegen codegen, @NotNull JvmMethodSignature signature) {
/*
Here we need to put the arguments from our locals to the stack and invoke the referenced method. Since invocation
of methods is highly dependent on expressions, we create a fake call expression. Then we create a new instance of
ExpressionCodegen and, in order for it to generate code correctly, we save to its 'tempVariables' field every
argument of our fake expression, pointing it to the corresponding index in our locals. This way generation of
every argument boils down to calling LOAD with the corresponding index
*/
JetCallExpression fakeExpression = constructFakeFunctionCall();
final List<? extends ValueArgument> fakeArguments = fakeExpression.getValueArguments();
final ReceiverValue dispatchReceiver = computeAndSaveReceiver(signature, codegen, referencedFunction.getDispatchReceiverParameter());
final ReceiverValue extensionReceiver = computeAndSaveReceiver(signature, codegen, referencedFunction.getExtensionReceiverParameter());
computeAndSaveArguments(fakeArguments, codegen);
ResolvedCall<CallableDescriptor> fakeResolvedCall = new DelegatingResolvedCall<CallableDescriptor>(resolvedCall) {
@NotNull
@Override
public ReceiverValue getExtensionReceiver() {
return extensionReceiver;
}
@NotNull
@Override
public ReceiverValue getDispatchReceiver() {
return dispatchReceiver;
}
@NotNull
@Override
public List<ResolvedValueArgument> getValueArgumentsByIndex() {
List<ResolvedValueArgument> result = new ArrayList<ResolvedValueArgument>(fakeArguments.size());
for (ValueArgument argument : fakeArguments) {
result.add(new ExpressionValueArgument(argument));
}
return result;
}
};
StackValue result;
Type returnType = codegen.getReturnType();
if (referencedFunction instanceof ConstructorDescriptor) {
if (returnType.getSort() == Type.ARRAY) {
//noinspection ConstantConditions
result = codegen.generateNewArray(fakeExpression, referencedFunction.getReturnType());
}
else {
result = codegen.generateConstructorCall(fakeResolvedCall, returnType);
}
}
else {
Call call = CallMaker.makeCall(fakeExpression, NO_RECEIVER, null, fakeExpression, fakeArguments);
result = codegen.invokeFunction(call, fakeResolvedCall, StackValue.none());
}
InstructionAdapter v = codegen.v;
result.put(returnType, v);
v.areturn(returnType);
}
@NotNull
private JetCallExpression constructFakeFunctionCall() {
StringBuilder fakeFunctionCall = new StringBuilder("callableReferenceFakeCall(");
for (Iterator<ValueParameterDescriptor> iterator = referencedFunction.getValueParameters().iterator(); iterator.hasNext(); ) {
ValueParameterDescriptor descriptor = iterator.next();
fakeFunctionCall.append("p").append(descriptor.getIndex());
if (iterator.hasNext()) {
fakeFunctionCall.append(", ");
}
}
fakeFunctionCall.append(")");
return (JetCallExpression) JetPsiFactory(state.getProject()).createExpression(fakeFunctionCall.toString());
}
private void computeAndSaveArguments(@NotNull List<? extends ValueArgument> fakeArguments, @NotNull ExpressionCodegen codegen) {
for (ValueParameterDescriptor parameter : callableDescriptor.getValueParameters()) {
ValueArgument fakeArgument = fakeArguments.get(parameter.getIndex());
Type type = state.getTypeMapper().mapType(parameter);
int localIndex = codegen.myFrameMap.getIndex(parameter);
codegen.tempVariables.put(fakeArgument.getArgumentExpression(), StackValue.local(localIndex, type));
}
}
@NotNull
private ReceiverValue computeAndSaveReceiver(
@NotNull JvmMethodSignature signature,
@NotNull ExpressionCodegen codegen,
@Nullable ReceiverParameterDescriptor receiver
) {
if (receiver == null) return NO_RECEIVER;
JetExpression receiverExpression = JetPsiFactory(state.getProject()).createExpression("callableReferenceFakeReceiver");
codegen.tempVariables.put(receiverExpression, receiverParameterStackValue(signature));
return new ExpressionReceiver(receiverExpression, receiver.getType());
}
@NotNull
private static StackValue.Local receiverParameterStackValue(@NotNull JvmMethodSignature signature) {
// 0 is this (the callable reference class), 1 is the invoke() method's first parameter
return StackValue.local(1, signature.getAsmMethod().getArgumentTypes()[0]);
}
}

View File

@@ -16,14 +16,11 @@
package org.jetbrains.kotlin.codegen;
import com.google.common.collect.Lists;
import com.intellij.openapi.progress.ProcessCanceledException;
import com.intellij.psi.PsiElement;
import com.intellij.util.ArrayUtil;
import kotlin.KotlinPackage;
import kotlin.Unit;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.functions.Function2;
import kotlin.*;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.backend.common.CodegenUtil;
@@ -43,8 +40,10 @@ import org.jetbrains.kotlin.load.java.JvmAbi;
import org.jetbrains.kotlin.load.java.JvmAnnotationNames;
import org.jetbrains.kotlin.load.java.JvmAnnotationNames.KotlinClass;
import org.jetbrains.kotlin.load.java.descriptors.JavaCallableMemberDescriptor;
import org.jetbrains.kotlin.name.FqName;
import org.jetbrains.kotlin.name.Name;
import org.jetbrains.kotlin.psi.*;
import org.jetbrains.kotlin.psi.psiUtil.PsiUtilPackage;
import org.jetbrains.kotlin.resolve.BindingContext;
import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils;
import org.jetbrains.kotlin.resolve.DescriptorUtils;
@@ -56,15 +55,11 @@ import org.jetbrains.kotlin.resolve.calls.model.ExpressionValueArgument;
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall;
import org.jetbrains.kotlin.resolve.calls.model.VarargValueArgument;
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilPackage;
import org.jetbrains.kotlin.resolve.jvm.AsmTypes;
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin;
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmClassSignature;
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodParameterKind;
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodParameterSignature;
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodSignature;
import org.jetbrains.kotlin.resolve.scopes.receivers.ExtensionReceiver;
import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue;
import org.jetbrains.kotlin.resolve.scopes.receivers.ThisReceiver;
import org.jetbrains.kotlin.serialization.*;
import org.jetbrains.kotlin.serialization.deserialization.NameResolver;
import org.jetbrains.kotlin.serialization.jvm.BitEncoding;
@@ -80,11 +75,8 @@ import static kotlin.KotlinPackage.firstOrNull;
import static org.jetbrains.kotlin.codegen.AsmUtil.*;
import static org.jetbrains.kotlin.codegen.JvmCodegenUtil.*;
import static org.jetbrains.kotlin.codegen.binding.CodegenBinding.enumEntryNeedSubclass;
import static org.jetbrains.kotlin.resolve.BindingContextUtils.getDelegationConstructorCall;
import static org.jetbrains.kotlin.resolve.BindingContextUtils.getNotNull;
import static org.jetbrains.kotlin.resolve.DescriptorToSourceUtils.descriptorToDeclaration;
import static org.jetbrains.kotlin.resolve.DescriptorUtils.*;
import static org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilPackage.getResolvedCall;
import static org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilPackage.getBuiltIns;
import static org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilPackage.getSecondaryConstructors;
import static org.jetbrains.kotlin.resolve.jvm.AsmTypes.*;
@@ -131,7 +123,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
if (myClass instanceof JetClass) {
JetClass jetClass = (JetClass) myClass;
if (jetClass.hasModifier(JetTokens.ABSTRACT_KEYWORD) || jetClass.isSealed()) {
if (jetClass.hasModifier(JetTokens.ABSTRACT_KEYWORD)) {
isAbstract = true;
}
if (jetClass.isInterface()) {
@@ -142,6 +134,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
isAbstract = true;
isInterface = true;
isAnnotation = true;
signature.getInterfaces().add("java/lang/annotation/Annotation");
}
else if (jetClass.isEnum()) {
isAbstract = hasAbstractMembers(descriptor);
@@ -159,7 +152,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
isStatic = !jetClass.isInner();
}
else {
isStatic = isCompanionObject(descriptor);
isStatic = myClass instanceof JetObjectDeclaration && ((JetObjectDeclaration) myClass).isCompanion() ;
isFinal = true;
}
@@ -207,16 +200,14 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
}
access |= ACC_ENUM;
}
v.defineClass(
myClass, V1_6,
access,
signature.getName(),
signature.getJavaGenericSignature(),
signature.getSuperclassName(),
ArrayUtil.toStringArray(signature.getInterfaces())
List<String> interfaces = signature.getInterfaces();
v.defineClass(myClass, V1_6,
access,
signature.getName(),
signature.getJavaGenericSignature(),
signature.getSuperclassName(),
ArrayUtil.toStringArray(interfaces)
);
v.visitSource(myClass.getContainingFile().getName(), null);
InlineCodegenUtil.initDefaultSourceMappingIfNeeded(context, this, state);
@@ -226,8 +217,6 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
AnnotationCodegen.forClass(v.getVisitor(), typeMapper).genAnnotations(descriptor, null);
generateReflectionObjectFieldIfNeeded();
generateEnumEntries();
}
@Override
@@ -239,20 +228,13 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
kind = KotlinClass.Kind.ANONYMOUS_OBJECT;
}
else if (isTopLevelOrInnerClass(descriptor)) {
// Default value is Kind.CLASS
kind = null;
kind = KotlinClass.Kind.CLASS;
}
else {
// LOCAL_CLASS is also written to inner classes of local classes
kind = KotlinClass.Kind.LOCAL_CLASS;
}
// Temporarily write class kind anyway because old compiler may not expect its absence
// TODO: remove after M13
if (kind == null) {
kind = KotlinClass.Kind.CLASS;
}
DescriptorSerializer serializer =
DescriptorSerializer.create(descriptor, new JvmSerializerExtension(v.getSerializationBindings(), typeMapper));
@@ -264,14 +246,11 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
AnnotationVisitor av = v.getVisitor().visitAnnotation(asmDescByFqNameWithoutInnerClasses(JvmAnnotationNames.KOTLIN_CLASS), true);
av.visit(JvmAnnotationNames.ABI_VERSION_FIELD_NAME, JvmAbi.VERSION);
//noinspection ConstantConditions
if (kind != null) {
av.visitEnum(
JvmAnnotationNames.KIND_FIELD_NAME,
Type.getObjectType(KotlinClass.KIND_INTERNAL_NAME).getDescriptor(),
kind.toString()
);
}
av.visitEnum(
JvmAnnotationNames.KIND_FIELD_NAME,
Type.getObjectType(KotlinClass.KIND_INTERNAL_NAME).getDescriptor(),
kind.toString()
);
AnnotationVisitor array = av.visitArray(JvmAnnotationNames.DATA_FIELD_NAME);
for (String string : BitEncoding.encodeBytes(SerializationUtil.serializeClassData(data))) {
array.visit(null, string);
@@ -308,17 +287,24 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
}
sw.writeSuperclassEnd();
LinkedHashSet<String> superInterfaces = new LinkedHashSet<String>();
List<JetType> interfaceSupertypes = Lists.newArrayList();
for (JetType supertype : descriptor.getTypeConstructor().getSupertypes()) {
if (isInterface(supertype.getConstructor().getDeclarationDescriptor())) {
sw.writeInterface();
Type jvmName = typeMapper.mapSupertype(supertype, sw);
sw.writeInterfaceEnd();
superInterfaces.add(jvmName.getInternalName());
for (JetDelegationSpecifier specifier : myClass.getDelegationSpecifiers()) {
JetType superType = bindingContext.get(BindingContext.TYPE, specifier.getTypeReference());
assert superType != null : "No supertype for class: " + myClass.getText();
if (isInterface(superType.getConstructor().getDeclarationDescriptor())) {
interfaceSupertypes.add(superType);
}
}
LinkedHashSet<String> superInterfaces = new LinkedHashSet<String>();
for (JetType supertype : interfaceSupertypes) {
sw.writeInterface();
Type jvmName = typeMapper.mapSupertype(supertype, sw);
sw.writeInterfaceEnd();
superInterfaces.add(jvmName.getInternalName());
}
return new JvmClassSignature(classAsmType.getInternalName(), superClassAsmType.getInternalName(),
new ArrayList<String>(superInterfaces), sw.makeJavaGenericSignature());
}
@@ -327,16 +313,37 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
superClassAsmType = OBJECT_TYPE;
superClassType = null;
if (descriptor.getKind() == ClassKind.INTERFACE) {
List<JetDelegationSpecifier> delegationSpecifiers = myClass.getDelegationSpecifiers();
if (myClass instanceof JetClass && ((JetClass) myClass).isInterface()) {
return;
}
for (JetType supertype : descriptor.getTypeConstructor().getSupertypes()) {
ClassifierDescriptor superClass = supertype.getConstructor().getDeclarationDescriptor();
if (superClass != null && !isInterface(superClass)) {
superClassAsmType = typeMapper.mapClass(superClass);
superClassType = supertype;
return;
for (JetDelegationSpecifier specifier : delegationSpecifiers) {
if (specifier instanceof JetDelegatorToSuperClass || specifier instanceof JetDelegatorToSuperCall) {
JetType superType = bindingContext.get(BindingContext.TYPE, specifier.getTypeReference());
assert superType != null :
String.format("No type recorded for \n---\n%s\n---\n", PsiUtilPackage.getElementTextWithContext(specifier));
ClassifierDescriptor classifierDescriptor = superType.getConstructor().getDeclarationDescriptor();
if (!(classifierDescriptor instanceof ClassDescriptor)) continue;
ClassDescriptor superClassDescriptor = (ClassDescriptor) classifierDescriptor;
if (!isInterface(superClassDescriptor)) {
superClassType = superType;
superClassAsmType = typeMapper.mapClass(superClassDescriptor);
}
}
}
if (superClassType == null) {
if (descriptor.getKind() == ClassKind.ENUM_CLASS) {
superClassType = getBuiltIns(descriptor).getEnumType(descriptor.getDefaultType());
superClassAsmType = typeMapper.mapType(superClassType);
}
if (descriptor.getKind() == ClassKind.ENUM_ENTRY) {
superClassType = descriptor.getTypeConstructor().getSupertypes().iterator().next();
superClassAsmType = typeMapper.mapType(superClassType);
}
}
}
@@ -373,7 +380,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
generateSyntheticAccessors();
generateEnumMethods();
generateEnumMethodsAndConstInitializers();
generateFunctionsForDataClasses();
@@ -514,11 +521,8 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
for (PropertyDescriptor propertyDescriptor : properties) {
Type asmType = typeMapper.mapType(propertyDescriptor);
Type thisPropertyType = genPropertyOnStack(iv, context, propertyDescriptor, 0);
StackValue.coerce(thisPropertyType, asmType, iv);
Type otherPropertyType = genPropertyOnStack(iv, context, propertyDescriptor, 2);
StackValue.coerce(otherPropertyType, asmType, iv);
genPropertyOnStack(iv, context, propertyDescriptor, 0);
genPropertyOnStack(iv, context, propertyDescriptor, 2);
if (asmType.getSort() == Type.ARRAY) {
Type elementType = correctElementType(asmType);
@@ -578,11 +582,10 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
iv.mul(Type.INT_TYPE);
}
Type propertyType = genPropertyOnStack(iv, context, propertyDescriptor, 0);
Type asmType = typeMapper.mapType(propertyDescriptor);
StackValue.coerce(propertyType, asmType, iv);
genPropertyOnStack(iv, context, propertyDescriptor, 0);
Label ifNull = null;
Type asmType = typeMapper.mapType(propertyDescriptor);
if (!isPrimitive(asmType)) {
ifNull = new Label();
iv.dup();
@@ -702,8 +705,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
bindingContext.get(BindingContext.PRIMARY_CONSTRUCTOR_PARAMETER, descriptorToDeclaration(parameter));
assert property != null : "Property descriptor is not found for primary constructor parameter: " + parameter;
Type propertyType = genPropertyOnStack(iv, context, property, 0);
StackValue.coerce(propertyType, componentType, iv);
genPropertyOnStack(iv, context, property, 0);
}
iv.areturn(componentType);
}
@@ -736,7 +738,12 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
MutableClosure closure = ImplementationBodyCodegen.this.context.closure;
if (closure != null) {
pushCapturedFieldsOnStack(iv, closure);
ClassDescriptor captureThis = closure.getCaptureThis();
if (captureThis != null) {
iv.load(0, classAsmType);
Type type = typeMapper.mapType(captureThis);
iv.getfield(classAsmType.getInternalName(), CAPTURED_THIS_FIELD, type.getDescriptor());
}
}
int parameterIndex = 1; // localVariable 0 = this
@@ -751,33 +758,6 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
iv.areturn(thisDescriptorType);
}
private void pushCapturedFieldsOnStack(InstructionAdapter iv, MutableClosure closure) {
ClassDescriptor captureThis = closure.getCaptureThis();
if (captureThis != null) {
iv.load(0, classAsmType);
Type type = typeMapper.mapType(captureThis);
iv.getfield(classAsmType.getInternalName(), CAPTURED_THIS_FIELD, type.getDescriptor());
}
JetType captureReceiver = closure.getCaptureReceiverType();
if (captureReceiver != null) {
iv.load(0, classAsmType);
Type type = typeMapper.mapType(captureReceiver);
iv.getfield(classAsmType.getInternalName(), CAPTURED_RECEIVER_FIELD, type.getDescriptor());
}
for (Map.Entry<DeclarationDescriptor, EnclosedValueDescriptor> entry : closure.getCaptureVariables().entrySet()) {
DeclarationDescriptor declarationDescriptor = entry.getKey();
EnclosedValueDescriptor enclosedValueDescriptor = entry.getValue();
StackValue capturedValue = enclosedValueDescriptor.getInstanceValue();
Type sharedVarType = typeMapper.getSharedVarType(declarationDescriptor);
if (sharedVarType == null) {
sharedVarType = typeMapper.mapType((VariableDescriptor) declarationDescriptor);
}
capturedValue.put(sharedVarType, iv);
}
}
});
functionCodegen.generateDefaultIfNeeded(
@@ -804,10 +784,11 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
return constructor;
}
private void generateEnumMethods() {
private void generateEnumMethodsAndConstInitializers() {
if (isEnumClass(descriptor)) {
generateEnumValuesMethod();
generateEnumValueOfMethod();
initializeEnumConstants();
}
}
@@ -863,7 +844,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
private void generateSyntheticAccessor(Map.Entry<DeclarationDescriptor, DeclarationDescriptor> entry) {
if (entry.getValue() instanceof FunctionDescriptor) {
final FunctionDescriptor bridge = (FunctionDescriptor) entry.getValue();
FunctionDescriptor bridge = (FunctionDescriptor) entry.getValue();
final FunctionDescriptor original = (FunctionDescriptor) entry.getKey();
functionCodegen.generateMethod(
Synthetic(null, original), bridge,
@@ -872,7 +853,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
public void doGenerateBody(@NotNull ExpressionCodegen codegen, @NotNull JvmMethodSignature signature) {
markLineNumberForSyntheticFunction(descriptor, codegen.v);
generateMethodCallTo(original, bridge, codegen.v);
generateMethodCallTo(original, codegen.v);
codegen.v.areturn(signature.getReturnType());
}
}
@@ -953,21 +934,15 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
}
}
private void generateMethodCallTo(
@NotNull FunctionDescriptor functionDescriptor,
@Nullable FunctionDescriptor bridgeDescriptor,
@NotNull InstructionAdapter iv
) {
private void generateMethodCallTo(FunctionDescriptor functionDescriptor, InstructionAdapter iv) {
boolean isConstructor = functionDescriptor instanceof ConstructorDescriptor;
boolean bridgeIsAccessorConstructor = bridgeDescriptor instanceof AccessorForConstructorDescriptor;
boolean callFromAccessor = bridgeIsAccessorConstructor
|| (bridgeDescriptor != null && JetTypeMapper.isAccessor(bridgeDescriptor));
boolean callFromAccessor = !JetTypeMapper.isAccessor(functionDescriptor);
CallableMethod callableMethod = isConstructor ?
typeMapper.mapToCallableMethod((ConstructorDescriptor) functionDescriptor) :
typeMapper.mapToCallableMethod(functionDescriptor, callFromAccessor, context);
int reg = 1;
if (isConstructor && !bridgeIsAccessorConstructor) {
if (isConstructor) {
iv.anew(callableMethod.getOwner());
iv.dup();
reg = 0;
@@ -979,13 +954,8 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
}
for (Type argType : callableMethod.getParameterTypes()) {
if (AsmTypes.DEFAULT_CONSTRUCTOR_MARKER.equals(argType)) {
iv.aconst(null);
}
else {
iv.load(reg, argType);
reg += argType.getSize();
}
iv.load(reg, argType);
reg += argType.getSize();
}
callableMethod.genInvokeInstruction(iv);
}
@@ -1017,6 +987,12 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
StackValue.Field field = StackValue.singleton(companionObjectDescriptor, typeMapper);
v.newField(OtherOrigin(companionObject), ACC_PUBLIC | ACC_STATIC | ACC_FINAL, field.name, field.type.getDescriptor(), null, null);
StackValue.Field deprecatedField = StackValue.deprecatedCompanionObjectAccessor(companionObjectDescriptor, typeMapper);
FieldVisitor fv = v.newField(OtherOrigin(companionObject), ACC_PUBLIC | ACC_STATIC | ACC_FINAL | ACC_DEPRECATED,
deprecatedField.name, deprecatedField.type.getDescriptor(), null, null);
fv.visitAnnotation(asmDescByFqNameWithoutInnerClasses(new FqName("java.lang.Deprecated")), true).visitEnd();
if (state.getClassBuilderMode() != ClassBuilderMode.FULL) return;
if (!isCompanionObjectWithBackingFieldsInOuter(companionObjectDescriptor)) {
@@ -1073,23 +1049,22 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
private void generateCompanionObjectInitializer(@NotNull ClassDescriptor companionObject) {
ExpressionCodegen codegen = createOrGetClInitCodegen();
FunctionDescriptor constructor = context.accessibleFunctionDescriptor(KotlinPackage.single(companionObject.getConstructors()));
generateMethodCallTo(constructor, null, codegen.v);
generateMethodCallTo(constructor, codegen.v);
codegen.v.dup();
StackValue instance = StackValue.onStack(typeMapper.mapClass(companionObject));
StackValue.singleton(companionObject, typeMapper).store(instance, codegen.v, true);
StackValue.deprecatedCompanionObjectAccessor(companionObject, typeMapper).store(instance, codegen.v, true);
}
private void generatePrimaryConstructor(final DelegationFieldsInfo delegationFieldsInfo) {
if (isTrait(descriptor) || isAnnotationClass(descriptor)) return;
if (ignoreIfTraitOrAnnotation()) return;
ConstructorDescriptor constructorDescriptor = descriptor.getUnsubstitutedPrimaryConstructor();
if (constructorDescriptor == null) return;
ConstructorContext constructorContext = context.intoConstructor(constructorDescriptor);
JetPrimaryConstructor primaryConstructor = myClass.getPrimaryConstructor();
JvmDeclarationOrigin origin = OtherOrigin(primaryConstructor != null ? primaryConstructor : myClass, constructorDescriptor);
functionCodegen.generateMethod(origin, constructorDescriptor, constructorContext,
functionCodegen.generateMethod(OtherOrigin(myClass, constructorDescriptor), constructorDescriptor, constructorContext,
new FunctionGenerationStrategy.CodegenBased<ConstructorDescriptor>(state, constructorDescriptor) {
@Override
public void doGenerateBody(@NotNull ExpressionCodegen codegen, @NotNull JvmMethodSignature signature) {
@@ -1110,8 +1085,6 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
}
private void generateSecondaryConstructor(@NotNull ConstructorDescriptor constructorDescriptor) {
if (!canHaveDeclaredConstructors(descriptor)) return;
ConstructorContext constructorContext = context.intoConstructor(constructorDescriptor);
functionCodegen.generateMethod(OtherOrigin(descriptorToDeclaration(constructorDescriptor), constructorDescriptor),
@@ -1156,7 +1129,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
int curParam = 0;
List<ValueParameterDescriptor> parameters = constructorDescriptor.getValueParameters();
for (JetParameter parameter : getPrimaryConstructorParameters()) {
if (parameter.hasValOrVar()) {
if (parameter.hasValOrVarNode()) {
VariableDescriptor descriptor = parameters.get(curParam);
Type type = typeMapper.mapType(descriptor);
iv.load(0, classAsmType);
@@ -1337,15 +1310,12 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
public void visitSimpleNameExpression(@NotNull JetSimpleNameExpression expr) {
DeclarationDescriptor descriptor = bindingContext.get(BindingContext.REFERENCE_TARGET, expr);
DeclarationDescriptor toLookup;
if (isLocalFunction(descriptor)) {
lookupInContext(descriptor);
toLookup = descriptor;
}
else if (descriptor instanceof CallableMemberDescriptor) {
ResolvedCall<? extends CallableDescriptor> call = getResolvedCall(expr, bindingContext);
if (call != null) {
lookupReceiver(call.getDispatchReceiver());
lookupReceiver(call.getExtensionReceiver());
}
toLookup = descriptor.getContainingDeclaration();
}
else if (descriptor instanceof VariableDescriptor) {
if (descriptor.getContainingDeclaration() instanceof ConstructorDescriptor) {
@@ -1353,26 +1323,10 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
(ClassDescriptor) descriptor.getContainingDeclaration().getContainingDeclaration();
if (classDescriptor == ImplementationBodyCodegen.this.descriptor) return;
}
lookupInContext(descriptor);
toLookup = descriptor;
}
}
else return;
private void lookupReceiver(@NotNull ReceiverValue value) {
if (value instanceof ThisReceiver) {
if (value instanceof ExtensionReceiver) {
ReceiverParameterDescriptor parameter =
((ExtensionReceiver) value).getDeclarationDescriptor().getExtensionReceiverParameter();
assert parameter != null : "Extension receiver should exist: " + ((ExtensionReceiver) value).getDeclarationDescriptor();
lookupInContext(parameter);
}
else {
lookupInContext(((ThisReceiver) value).getDeclarationDescriptor());
}
}
}
private void lookupInContext(@NotNull DeclarationDescriptor toLookup) {
context.lookupInContext(toLookup, StackValue.LOCAL_0, state, true);
}
@@ -1382,13 +1336,13 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
assert descriptor instanceof CallableDescriptor ||
descriptor instanceof ClassDescriptor : "'This' reference target should be class or callable descriptor but was " + descriptor;
if (descriptor instanceof ClassDescriptor) {
lookupInContext(descriptor);
context.lookupInContext(descriptor, StackValue.LOCAL_0, state, true);
}
if (descriptor instanceof CallableDescriptor) {
ReceiverParameterDescriptor parameter = ((CallableDescriptor) descriptor).getExtensionReceiverParameter();
if (parameter != null) {
lookupInContext(parameter);
context.lookupInContext(parameter, StackValue.LOCAL_0, state, true);
}
}
}
@@ -1437,8 +1391,21 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
}
}
private boolean ignoreIfTraitOrAnnotation() {
if (myClass instanceof JetClass) {
JetClass aClass = (JetClass) myClass;
if (aClass.isInterface()) {
return true;
}
if (aClass.isAnnotation()) {
return true;
}
}
return false;
}
private void generateTraitMethods() {
if (isTrait(descriptor)) return;
if (JetPsiUtil.isTrait(myClass)) return;
for (Map.Entry<FunctionDescriptor, FunctionDescriptor> entry : CodegenUtil.getTraitMethods(descriptor).entrySet()) {
FunctionDescriptor traitFun = entry.getKey();
@@ -1449,7 +1416,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
}
}
private void generateDelegationToTraitImpl(@NotNull final FunctionDescriptor traitFun, @NotNull final FunctionDescriptor inheritedFun) {
private void generateDelegationToTraitImpl(@NotNull final FunctionDescriptor traitFun, @NotNull FunctionDescriptor inheritedFun) {
functionCodegen.generateMethod(
DelegationToTraitImpl(descriptorToDeclaration(traitFun), traitFun),
inheritedFun,
@@ -1458,13 +1425,6 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
public void doGenerateBody(@NotNull ExpressionCodegen codegen, @NotNull JvmMethodSignature signature) {
DeclarationDescriptor containingDeclaration = traitFun.getContainingDeclaration();
if (!DescriptorUtils.isTrait(containingDeclaration)) return;
DeclarationDescriptor declarationInheritedFun = inheritedFun.getContainingDeclaration();
PsiElement classForInheritedFun = descriptorToDeclaration(declarationInheritedFun);
if (classForInheritedFun instanceof JetDeclaration) {
codegen.markLineNumber((JetElement) classForInheritedFun, false);
}
ClassDescriptor containingTrait = (ClassDescriptor) containingDeclaration;
Type traitImplType = typeMapper.mapTraitImpl(containingTrait);
@@ -1511,7 +1471,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
return;
}
iv.load(0, OBJECT_TYPE);
ConstructorDescriptor delegateConstructor = SamCodegenUtil.resolveSamAdapter(codegen.getConstructorDescriptor(delegationConstructorCall));
ConstructorDescriptor delegateConstructor = SamCodegenUtil.resolveSamAdapter(delegationConstructorCall.getResultingDescriptor());
CallableMethod delegateConstructorCallable = typeMapper.mapToCallableMethod(delegateConstructor);
CallableMethod callable = typeMapper.mapToCallableMethod(constructorDescriptor);
@@ -1669,22 +1629,24 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
}
}
private void generateEnumEntries() {
if (descriptor.getKind() != ClassKind.ENUM_CLASS) return;
List<JetEnumEntry> enumEntries = KotlinPackage.filterIsInstance(element.getDeclarations(), JetEnumEntry.class);
for (JetEnumEntry enumEntry : enumEntries) {
ClassDescriptor descriptor = getNotNull(bindingContext, BindingContext.CLASS, enumEntry);
FieldVisitor fv = v.newField(OtherOrigin(enumEntry, descriptor), ACC_PUBLIC | ACC_ENUM | ACC_STATIC | ACC_FINAL,
descriptor.getName().asString(), classAsmType.getDescriptor(), null, null);
AnnotationCodegen.forField(fv, typeMapper).genAnnotations(descriptor, null);
@Override
protected void generateDeclaration(JetDeclaration declaration) {
if (declaration instanceof JetEnumEntry) {
String name = declaration.getName();
assert name != null : "Enum entry has no name: " + declaration.getText();
ClassDescriptor entryDescriptor = bindingContext.get(BindingContext.CLASS, declaration);
FieldVisitor fv = v.newField(OtherOrigin(declaration, entryDescriptor), ACC_PUBLIC | ACC_ENUM | ACC_STATIC | ACC_FINAL,
name, classAsmType.getDescriptor(), null, null);
AnnotationCodegen.forField(fv, typeMapper).genAnnotations(entryDescriptor, null);
myEnumConstants.add((JetEnumEntry) declaration);
}
initializeEnumConstants(enumEntries);
super.generateDeclaration(declaration);
}
private void initializeEnumConstants(@NotNull List<JetEnumEntry> enumEntries) {
private final List<JetEnumEntry> myEnumConstants = new ArrayList<JetEnumEntry>();
private void initializeEnumConstants() {
if (state.getClassBuilderMode() != ClassBuilderMode.FULL) return;
ExpressionCodegen codegen = createOrGetClInitCodegen();
@@ -1694,39 +1656,48 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
v.newField(OtherOrigin(myClass), ACC_PRIVATE | ACC_STATIC | ACC_FINAL | ACC_SYNTHETIC, ENUM_VALUES_FIELD_NAME,
arrayAsmType.getDescriptor(), null, null);
iv.iconst(enumEntries.size());
iv.iconst(myEnumConstants.size());
iv.newarray(classAsmType);
if (!enumEntries.isEmpty()) {
if (!myEnumConstants.isEmpty()) {
iv.dup();
for (int ordinal = 0, size = enumEntries.size(); ordinal < size; ordinal++) {
initializeEnumConstant(enumEntries, ordinal);
for (int ordinal = 0, size = myEnumConstants.size(); ordinal < size; ordinal++) {
initializeEnumConstant(codegen, ordinal);
}
}
iv.putstatic(classAsmType.getInternalName(), ENUM_VALUES_FIELD_NAME, arrayAsmType.getDescriptor());
}
private void initializeEnumConstant(@NotNull List<JetEnumEntry> enumEntries, int ordinal) {
ExpressionCodegen codegen = createOrGetClInitCodegen();
private void initializeEnumConstant(@NotNull ExpressionCodegen codegen, int ordinal) {
InstructionAdapter iv = codegen.v;
JetEnumEntry enumEntry = enumEntries.get(ordinal);
JetEnumEntry enumConstant = myEnumConstants.get(ordinal);
iv.dup();
iv.iconst(ordinal);
ClassDescriptor classDescriptor = getNotNull(bindingContext, BindingContext.CLASS, enumEntry);
ClassDescriptor classDescriptor = bindingContext.get(BindingContext.CLASS, enumConstant);
assert classDescriptor != null;
Type implClass = typeMapper.mapClass(classDescriptor);
List<JetDelegationSpecifier> delegationSpecifiers = enumConstant.getDelegationSpecifiers();
if (delegationSpecifiers.size() > 1) {
throw new UnsupportedOperationException("multiple delegation specifiers for enum constant not supported");
}
iv.anew(implClass);
iv.dup();
iv.aconst(enumEntry.getName());
iv.aconst(enumConstant.getName());
iv.iconst(ordinal);
List<JetDelegationSpecifier> delegationSpecifiers = enumEntry.getDelegationSpecifiers();
if (delegationSpecifiers.size() == 1 && !enumEntryNeedSubclass(bindingContext, enumEntry)) {
ResolvedCall<?> resolvedCall = CallUtilPackage.getResolvedCallWithAssert(delegationSpecifiers.get(0), bindingContext);
if (delegationSpecifiers.size() == 1 && !enumEntryNeedSubclass(bindingContext, enumConstant)) {
JetDelegationSpecifier specifier = delegationSpecifiers.get(0);
if (!(specifier instanceof JetDelegatorToSuperCall)) {
throw new UnsupportedOperationException("unsupported type of enum constant initializer: " + specifier);
}
ResolvedCall<?> resolvedCall = CallUtilPackage.getResolvedCallWithAssert(specifier, bindingContext);
CallableMethod method = typeMapper.mapToCallableMethod((ConstructorDescriptor) resolvedCall.getResultingDescriptor());
@@ -1737,7 +1708,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
}
iv.dup();
iv.putstatic(classAsmType.getInternalName(), enumEntry.getName(), classAsmType.getDescriptor());
iv.putstatic(classAsmType.getInternalName(), enumConstant.getName(), classAsmType.getDescriptor());
iv.astore(OBJECT_TYPE);
}

View File

@@ -1,52 +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
import com.intellij.psi.PsiElement
import org.jetbrains.kotlin.codegen.state.GenerationState
import org.jetbrains.kotlin.descriptors.CallableDescriptor
import org.jetbrains.kotlin.diagnostics.DiagnosticSink
import org.jetbrains.kotlin.diagnostics.Errors
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall
public class InlineCycleReporter(val diagnostics: DiagnosticSink) {
val processingFunctions = linkedMapOf<PsiElement, CallableDescriptor>()
public fun enterIntoInlining(call: ResolvedCall<*>?): Boolean {
//null call for default method inlining
if (call != null) {
val callElement = call.getCall().getCallElement()
if (processingFunctions.contains(callElement)) {
val cycle = processingFunctions.asSequence().dropWhile { it.getKey() != callElement }
cycle.forEach {
diagnostics.report(Errors.INLINE_CALL_CYCLE.on(it.getKey(), it.getValue()))
}
return false
}
processingFunctions.put(callElement, call.getResultingDescriptor().getOriginal())
}
return true
}
public fun exitFromInliningOf(call: ResolvedCall<*>?) {
if (call != null) {
val callElement = call.getCall().getCallElement()
processingFunctions.remove(callElement)
}
}
}

View File

@@ -20,8 +20,8 @@ import com.intellij.openapi.vfs.StandardFileSystems;
import com.intellij.openapi.vfs.VfsUtilCore;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiElement;
import kotlin.Function1;
import kotlin.KotlinPackage;
import kotlin.jvm.functions.Function1;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.codegen.binding.CalculatedClosure;
@@ -40,6 +40,7 @@ import org.jetbrains.kotlin.psi.codeFragmentUtil.CodeFragmentUtilPackage;
import org.jetbrains.kotlin.resolve.BindingContext;
import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils;
import org.jetbrains.kotlin.resolve.DescriptorUtils;
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall;
import org.jetbrains.kotlin.resolve.inline.InlineUtil;
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedCallableMemberDescriptor;
import org.jetbrains.kotlin.types.JetType;
@@ -170,10 +171,7 @@ public class JvmCodegenUtil {
if (JetTypeMapper.isAccessor(property)) return false;
// Inline functions can't use direct access because a field may not be visible at the call site
if (context.isInlineFunction() &&
(!Visibilities.isPrivate(property.getVisibility()) || DescriptorUtils.isTopLevelDeclaration(property))) {
return false;
}
if (context.isInlineFunction() && !Visibilities.isPrivate(property.getVisibility())) return false;
// Only properties of the same class can be directly accessed, except when we are evaluating expressions in the debugger
if (!isCallInsideSameClassAsDeclared(property, context) && !isDebuggerContext(context)) return false;
@@ -237,4 +235,12 @@ public class JvmCodegenUtil {
return InlineUtil.canBeInlineArgument(declaration) &&
InlineUtil.isInlinedArgument((JetFunction) declaration, bindingContext, false);
}
@Nullable
public static ResolvedCall<ConstructorDescriptor> getDelegationConstructorCall(
@NotNull BindingContext bindingContext,
@NotNull ConstructorDescriptor constructorDescriptor
) {
return bindingContext.get(BindingContext.CONSTRUCTOR_RESOLVED_DELEGATION_CALL, constructorDescriptor);
}
}

View File

@@ -17,49 +17,68 @@
package org.jetbrains.kotlin.codegen;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.kotlin.builtins.ReflectionTypes;
import org.jetbrains.kotlin.descriptors.*;
import org.jetbrains.kotlin.descriptors.annotations.Annotations;
import org.jetbrains.kotlin.descriptors.impl.ModuleDescriptorImpl;
import org.jetbrains.kotlin.descriptors.impl.MutableClassDescriptor;
import org.jetbrains.kotlin.descriptors.impl.MutablePackageFragmentDescriptor;
import org.jetbrains.kotlin.descriptors.impl.TypeParameterDescriptorImpl;
import org.jetbrains.kotlin.name.FqName;
import org.jetbrains.kotlin.name.Name;
import org.jetbrains.kotlin.resolve.jvm.TopDownAnalyzerFacadeForJVM;
import org.jetbrains.kotlin.storage.LockBasedStorageManager;
import org.jetbrains.kotlin.types.JetType;
import org.jetbrains.kotlin.types.*;
import org.jetbrains.kotlin.types.expressions.ExpressionTypingUtils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import static org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilPackage.getBuiltIns;
import static org.jetbrains.kotlin.resolve.jvm.TopDownAnalyzerFacadeForJVM.createJavaModule;
public class JvmRuntimeTypes {
private final ClassDescriptor lambda;
private final ClassDescriptor functionReference;
private final ReflectionTypes reflectionTypes;
public JvmRuntimeTypes() {
ModuleDescriptorImpl module = new ModuleDescriptorImpl(
Name.special("<jvm functions impl>"),
LockBasedStorageManager.NO_LOCKS,
TopDownAnalyzerFacadeForJVM.JVM_MODULE_PARAMETERS
private final ClassDescriptor functionImpl;
private final ClassDescriptor memberFunctionImpl;
private final ClassDescriptor extensionFunctionImpl;
public JvmRuntimeTypes(@NotNull ReflectionTypes reflectionTypes) {
this.reflectionTypes = reflectionTypes;
PackageFragmentDescriptor kotlinJvmInternal = new MutablePackageFragmentDescriptor(
createJavaModule("<jvm functions impl>"),
new FqName("kotlin.jvm.internal")
);
PackageFragmentDescriptor kotlinJvmInternal = new MutablePackageFragmentDescriptor(module, new FqName("kotlin.jvm.internal"));
this.lambda = createClass(kotlinJvmInternal, "Lambda");
this.functionReference = createClass(kotlinJvmInternal, "FunctionReference");
this.functionImpl = createClass(kotlinJvmInternal, "FunctionImpl", "out R");
this.memberFunctionImpl = createClass(kotlinJvmInternal, "MemberFunctionImpl", "in T", "out R");
this.extensionFunctionImpl = createClass(kotlinJvmInternal, "ExtensionFunctionImpl", "in T", "out R");
}
@NotNull
private static ClassDescriptor createClass(@NotNull PackageFragmentDescriptor packageFragment, @NotNull String name) {
MutableClassDescriptor descriptor = new MutableClassDescriptor(
packageFragment, packageFragment.getMemberScope(), ClassKind.CLASS, false, Name.identifier(name), SourceElement.NO_SOURCE
);
private static ClassDescriptor createClass(
@NotNull PackageFragmentDescriptor packageFragment,
@NotNull String name,
@NotNull String... typeParameters
) {
MutableClassDescriptor descriptor = new MutableClassDescriptor(packageFragment, packageFragment.getMemberScope(), ClassKind.CLASS,
false, Name.identifier(name), SourceElement.NO_SOURCE);
List<TypeParameterDescriptor> typeParameterDescriptors = new ArrayList<TypeParameterDescriptor>(typeParameters.length);
for (int i = 0; i < typeParameters.length; i++) {
String[] s = typeParameters[i].split(" ");
Variance variance = Variance.valueOf(s[0].toUpperCase() + "_VARIANCE");
String typeParameterName = s[1];
TypeParameterDescriptorImpl typeParameter = TypeParameterDescriptorImpl.createForFurtherModification(
descriptor, Annotations.EMPTY, false, variance, Name.identifier(typeParameterName), i, SourceElement.NO_SOURCE
);
typeParameter.setInitialized();
typeParameterDescriptors.add(typeParameter);
}
descriptor.setModality(Modality.FINAL);
descriptor.setVisibility(Visibilities.PUBLIC);
descriptor.setTypeParameterDescriptors(Collections.<TypeParameterDescriptor>emptyList());
descriptor.setTypeParameterDescriptors(typeParameterDescriptors);
descriptor.createTypeConstructor();
return descriptor;
@@ -69,7 +88,28 @@ public class JvmRuntimeTypes {
public Collection<JetType> getSupertypesForClosure(@NotNull FunctionDescriptor descriptor) {
ReceiverParameterDescriptor receiverParameter = descriptor.getExtensionReceiverParameter();
List<TypeProjection> typeArguments = new ArrayList<TypeProjection>(2);
ClassDescriptor classDescriptor;
if (receiverParameter != null) {
classDescriptor = extensionFunctionImpl;
typeArguments.add(new TypeProjectionImpl(receiverParameter.getType()));
}
else {
classDescriptor = functionImpl;
}
//noinspection ConstantConditions
typeArguments.add(new TypeProjectionImpl(descriptor.getReturnType()));
JetType functionImplType = new JetTypeImpl(
classDescriptor.getDefaultType().getAnnotations(),
classDescriptor.getTypeConstructor(),
false,
typeArguments,
classDescriptor.getMemberScope(typeArguments)
);
JetType functionType = getBuiltIns(descriptor).getFunctionType(
Annotations.EMPTY,
receiverParameter == null ? null : receiverParameter.getType(),
@@ -77,7 +117,7 @@ public class JvmRuntimeTypes {
descriptor.getReturnType()
);
return Arrays.asList(lambda.getDefaultType(), functionType);
return Arrays.asList(functionImplType, functionType);
}
@NotNull
@@ -85,17 +125,44 @@ public class JvmRuntimeTypes {
ReceiverParameterDescriptor extensionReceiver = descriptor.getExtensionReceiverParameter();
ReceiverParameterDescriptor dispatchReceiver = descriptor.getDispatchReceiverParameter();
JetType receiverType =
extensionReceiver != null ? extensionReceiver.getType() : dispatchReceiver != null ? dispatchReceiver.getType() : null;
List<TypeProjection> typeArguments = new ArrayList<TypeProjection>(2);
ClassDescriptor classDescriptor;
JetType receiverType;
if (extensionReceiver != null) {
classDescriptor = extensionFunctionImpl;
receiverType = extensionReceiver.getType();
typeArguments.add(new TypeProjectionImpl(receiverType));
}
else if (dispatchReceiver != null) {
classDescriptor = memberFunctionImpl;
receiverType = dispatchReceiver.getType();
typeArguments.add(new TypeProjectionImpl(receiverType));
}
else {
classDescriptor = functionImpl;
receiverType = null;
}
//noinspection ConstantConditions
JetType functionType = getBuiltIns(descriptor).getFunctionType(
typeArguments.add(new TypeProjectionImpl(descriptor.getReturnType()));
JetType functionImplType = new JetTypeImpl(
classDescriptor.getDefaultType().getAnnotations(),
classDescriptor.getTypeConstructor(),
false,
typeArguments,
classDescriptor.getMemberScope(typeArguments)
);
JetType kFunctionType = reflectionTypes.getKFunctionType(
Annotations.EMPTY,
receiverType,
ExpressionTypingUtils.getValueParametersTypes(descriptor.getValueParameters()),
descriptor.getReturnType()
descriptor.getReturnType(),
extensionReceiver != null
);
return Arrays.asList(functionReference.getDefaultType(), functionType);
return Arrays.asList(functionImplType, kFunctionType);
}
}

View File

@@ -17,7 +17,6 @@
package org.jetbrains.kotlin.codegen;
import com.intellij.openapi.util.Pair;
import kotlin.jvm.functions.Function3;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor;
@@ -29,6 +28,7 @@ import org.jetbrains.org.objectweb.asm.Type;
import org.jetbrains.org.objectweb.asm.commons.Method;
import java.util.Collection;
import java.util.Map;
public final class JvmSerializationBindings {
public static final SerializationMappingSlice<FunctionDescriptor, Method> METHOD_FOR_FUNCTION =
@@ -82,18 +82,13 @@ public final class JvmSerializationBindings {
@NotNull
public static JvmSerializationBindings union(@NotNull Collection<JvmSerializationBindings> bindings) {
final MutableSlicedMap result = SlicedMapImpl.create();
MutableSlicedMap result = SlicedMapImpl.create();
for (JvmSerializationBindings binding : bindings) {
binding.map.forEach(new Function3<WritableSlice, Object, Object, Void>() {
@Override
public Void invoke(WritableSlice slice, Object key, Object value) {
result.put(slice, key, value);
return null;
}
});
for (Map.Entry<SlicedMapKey<?, ?>, ?> entry : binding.map) {
SlicedMapKey<?, ?> key = entry.getKey();
result.put((WritableSlice) key.getSlice(), key.getKey(), entry.getValue());
}
}
return new JvmSerializationBindings(result);
}

View File

@@ -20,7 +20,6 @@ import com.google.common.collect.Sets;
import com.intellij.util.containers.MultiMap;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.kotlin.codegen.state.GenerationState;
import org.jetbrains.kotlin.progress.ProgressIndicatorAndCompilationCanceledStatus;
import org.jetbrains.kotlin.name.FqName;
import org.jetbrains.kotlin.psi.JetFile;
import org.jetbrains.kotlin.psi.JetScript;
@@ -55,12 +54,8 @@ public class KotlinCodegenFacade {
@NotNull GenerationState state,
@NotNull CompilationErrorHandler errorHandler
) {
ProgressIndicatorAndCompilationCanceledStatus.checkCanceled();
prepareForCompilation(state);
ProgressIndicatorAndCompilationCanceledStatus.checkCanceled();
MultiMap<FqName, JetFile> packageFqNameToFiles = new MultiMap<FqName, JetFile>();
for (JetFile file : state.getFiles()) {
if (file == null) throw new IllegalArgumentException("A null file given for compilation");
@@ -69,11 +64,9 @@ public class KotlinCodegenFacade {
Set<FqName> packagesWithObsoleteParts = new HashSet<FqName>(state.getPackagesWithObsoleteParts());
for (FqName fqName : Sets.union(packagesWithObsoleteParts, packageFqNameToFiles.keySet())) {
ProgressIndicatorAndCompilationCanceledStatus.checkCanceled();
generatePackage(state, fqName, packageFqNameToFiles.get(fqName), errorHandler);
}
ProgressIndicatorAndCompilationCanceledStatus.checkCanceled();
state.getFactory().done();
}

View File

@@ -17,7 +17,7 @@
package org.jetbrains.kotlin.codegen;
import com.intellij.openapi.progress.ProcessCanceledException;
import kotlin.jvm.functions.Function0;
import kotlin.Function0;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.codegen.context.*;
@@ -242,13 +242,8 @@ public abstract class MemberCodegen<T extends JetElement/* TODO: & JetDeclaratio
private void writeInnerClass(@NotNull ClassDescriptor innerClass) {
DeclarationDescriptor containing = innerClass.getContainingDeclaration();
String outerClassInternalName = null;
if (containing instanceof ClassDescriptor) {
outerClassInternalName = typeMapper.mapClass((ClassDescriptor) containing).getInternalName();
} /* disabled cause of KT-7775
else if (containing instanceof ScriptDescriptor) {
outerClassInternalName = asmTypeForScriptDescriptor(bindingContext, (ScriptDescriptor) containing).getInternalName();
}*/
String outerClassInternalName =
containing instanceof ClassDescriptor ? typeMapper.mapClass((ClassDescriptor) containing).getInternalName() : null;
String innerName = innerClass.getName().isSpecial() ? null : innerClass.getName().asString();
@@ -285,10 +280,7 @@ public abstract class MemberCodegen<T extends JetElement/* TODO: & JetDeclaratio
}
else if (outermost instanceof PackageContext && !(outermost instanceof PackageFacadeContext)) {
return PackagePartClassUtils.getPackagePartType(element.getContainingJetFile());
}/*disabled cause of KT-7775
else if (outermost instanceof ScriptContext) {
return asmTypeForScriptDescriptor(bindingContext, ((ScriptContext) outermost).getScriptDescriptor());
}*/
}
return null;
}

View File

@@ -24,8 +24,7 @@ import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.ArrayUtil;
import com.intellij.util.SmartList;
import com.intellij.util.containers.ContainerUtil;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
import kotlin.Function0;
import org.jetbrains.annotations.Mutable;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -35,7 +34,6 @@ 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.config.IncrementalCompilation;
import org.jetbrains.kotlin.progress.ProgressIndicatorAndCompilationCanceledStatus;
import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor;
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor;
import org.jetbrains.kotlin.descriptors.PackageFragmentDescriptor;
@@ -137,7 +135,7 @@ public class PackageCodegen {
}
// TODO rewrite it to something more robust when module system is implemented
for (PackageFragmentDescriptor fragment : state.getModule().getPackage(fqName).getFragments()) {
for (PackageFragmentDescriptor fragment : state.getModule().getPackageFragmentProvider().getPackageFragments(fqName)) {
if (fragment instanceof IncrementalPackageFragmentProvider.IncrementalPackageFragment &&
((IncrementalPackageFragmentProvider.IncrementalPackageFragment) fragment).getModuleId().equals(state.getModuleId())) {
return fragment;
@@ -192,8 +190,6 @@ public class PackageCodegen {
memberCodegen.functionCodegen.generateDefaultIfNeeded(
context.intoFunction(function), function, OwnerKind.PACKAGE, DefaultParameterValueLoader.DEFAULT, null
);
memberCodegen.functionCodegen.generateOverloadsWithDefaultValues(null, function, function);
}
else if (member instanceof DeserializedPropertyDescriptor) {
memberCodegen.propertyCodegen.generateInPackageFacade((DeserializedPropertyDescriptor) member);
@@ -212,7 +208,6 @@ public class PackageCodegen {
Map<CallableMemberDescriptor, Runnable> generateCallableMemberTasks = new HashMap<CallableMemberDescriptor, Runnable>();
for (JetFile file : files) {
ProgressIndicatorAndCompilationCanceledStatus.checkCanceled();
try {
ClassBuilder builder = generate(file, generateCallableMemberTasks);
if (builder != null) {
@@ -251,7 +246,7 @@ public class PackageCodegen {
}
bindings.add(v.getSerializationBindings());
writeKotlinPackageAnnotationIfNeeded(JvmSerializationBindings.union(bindings), tasks.keySet());
writeKotlinPackageAnnotationIfNeeded(JvmSerializationBindings.union(bindings));
}
private void generateKotlinPackageReflectionField() {
@@ -263,10 +258,7 @@ public class PackageCodegen {
FunctionCodegen.endVisit(mv, "package facade static initializer", null);
}
private void writeKotlinPackageAnnotationIfNeeded(
@NotNull JvmSerializationBindings bindings,
@NotNull final Collection<CallableMemberDescriptor> relevantCallables
) {
private void writeKotlinPackageAnnotationIfNeeded(@NotNull JvmSerializationBindings bindings) {
if (state.getClassBuilderMode() != ClassBuilderMode.FULL) {
return;
}
@@ -280,12 +272,7 @@ public class PackageCodegen {
Collection<PackageFragmentDescriptor> packageFragments = Lists.newArrayList();
ContainerUtil.addIfNotNull(packageFragments, packageFragment);
ContainerUtil.addIfNotNull(packageFragments, compiledPackageFragment);
ProtoBuf.Package packageProto = serializer.packageProto(packageFragments, new Function1<DeclarationDescriptor, Boolean>() {
@Override
public Boolean invoke(DeclarationDescriptor descriptor) {
return !(descriptor instanceof CallableMemberDescriptor && relevantCallables.contains(descriptor));
}
}).build();
ProtoBuf.Package packageProto = serializer.packageProto(packageFragments).build();
if (packageProto.getMemberCount() == 0) return;

View File

@@ -17,7 +17,7 @@
package org.jetbrains.kotlin.codegen;
import com.intellij.util.ArrayUtil;
import kotlin.jvm.functions.Function0;
import kotlin.Function0;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.kotlin.codegen.context.FieldOwnerContext;
import org.jetbrains.kotlin.codegen.state.GenerationState;

View File

@@ -84,7 +84,7 @@ class PlatformStaticGenerator(
}
companion object {
@platformStatic
[platformStatic]
public fun createStaticFunctionDescriptor(descriptor: FunctionDescriptor): FunctionDescriptor {
val memberDescriptor = if (descriptor is PropertyAccessorDescriptor) descriptor.getCorrespondingProperty() else descriptor
val copies = CodegenUtil.copyFunctions(

View File

@@ -31,8 +31,6 @@ import org.jetbrains.kotlin.psi.*;
import org.jetbrains.kotlin.psi.psiUtil.PsiUtilPackage;
import org.jetbrains.kotlin.resolve.BindingContext;
import org.jetbrains.kotlin.resolve.DescriptorFactory;
import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils;
import org.jetbrains.kotlin.resolve.annotations.AnnotationsPackage;
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall;
import org.jetbrains.kotlin.resolve.constants.CompileTimeConstant;
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodSignature;
@@ -171,7 +169,7 @@ public class PropertyCodegen {
public void generateConstructorPropertyAsMethodForAnnotationClass(JetParameter p, PropertyDescriptor descriptor) {
JvmMethodSignature signature = typeMapper.mapAnnotationParameterSignature(descriptor);
String name = p.getName();
if (name == null) return;
assert name != null : "Annotation parameter has no name: " + p.getText();
MethodVisitor mv = v.newMethod(
OtherOrigin(p, descriptor), ACC_PUBLIC | ACC_ABSTRACT, name,
signature.getAsmMethod().getDescriptor(),
@@ -257,19 +255,9 @@ public class PropertyCodegen {
ClassBuilder builder = v;
boolean hasPublicFieldAnnotation = AnnotationsPackage.findPublicFieldAnnotation(propertyDescriptor) != null;
FieldOwnerContext backingFieldContext = context;
if (AsmUtil.isInstancePropertyWithStaticBackingField(propertyDescriptor) ) {
modifiers |= ACC_STATIC;
if (hasPublicFieldAnnotation && !isDelegate) {
modifiers |= ACC_PUBLIC;
}
else {
modifiers |= getVisibilityForSpecialPropertyBackingField(propertyDescriptor, isDelegate);
}
modifiers |= ACC_STATIC | getVisibilityForSpecialPropertyBackingField(propertyDescriptor, isDelegate);
if (AsmUtil.isPropertyWithBackingFieldInOuterClass(propertyDescriptor)) {
ImplementationBodyCodegen codegen = (ImplementationBodyCodegen) memberCodegen.getParentCodegen();
builder = codegen.v;
@@ -277,9 +265,6 @@ public class PropertyCodegen {
v.getSerializationBindings().put(STATIC_FIELD_IN_OUTER_CLASS, propertyDescriptor);
}
}
else if (!isDelegate && hasPublicFieldAnnotation) {
modifiers |= ACC_PUBLIC;
}
else if (kind != OwnerKind.PACKAGE || isDelegate) {
modifiers |= ACC_PRIVATE;
}
@@ -299,8 +284,8 @@ public class PropertyCodegen {
}
private void generatePropertyDelegateAccess(JetProperty p, PropertyDescriptor propertyDescriptor) {
JetExpression delegateExpression = p.getDelegateExpression();
JetType delegateType = delegateExpression != null ? bindingContext.getType(p.getDelegateExpression()) : null;
assert p.getDelegateExpression() != null: "Property must have a delegate expression here";
JetType delegateType = bindingContext.getType(p.getDelegateExpression());
if (delegateType == null) {
// If delegate expression is unresolved reference
delegateType = ErrorUtils.createErrorType("Delegate type");
@@ -404,11 +389,6 @@ public class PropertyCodegen {
PropertyDescriptor propertyDescriptor = callableDescriptor.getCorrespondingProperty();
StackValue property = codegen.intermediateValueForProperty(propertyDescriptor, true, null, StackValue.LOCAL_0);
PsiElement jetProperty = DescriptorToSourceUtils.descriptorToDeclaration(propertyDescriptor);
if (jetProperty instanceof JetProperty || jetProperty instanceof JetParameter) {
codegen.markLineNumber((JetElement) jetProperty, false);
}
if (callableDescriptor instanceof PropertyGetterDescriptor) {
Type type = signature.getReturnType();
property.put(type, v);

View File

@@ -17,7 +17,7 @@
package org.jetbrains.kotlin.codegen;
import com.intellij.util.ArrayUtil;
import kotlin.jvm.functions.Function0;
import kotlin.Function0;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.kotlin.codegen.context.CodegenContext;
import org.jetbrains.kotlin.codegen.context.MethodContext;

View File

@@ -47,10 +47,6 @@ public abstract class SignatureCollectingClassBuilderFactory(
return delegate.asText((builder as SignatureCollectingClassBuilder)._delegate)
}
public override fun close() {
delegate.close()
}
private inner class SignatureCollectingClassBuilder(
private val classCreatedFor: JvmDeclarationOrigin,
internal val _delegate: ClassBuilder
@@ -78,7 +74,8 @@ public abstract class SignatureCollectingClassBuilderFactory(
}
override fun done() {
for ((signature, elementsAndDescriptors) in signatures.entrySet()) {
var hasDuplicateSignatures = false
for ((signature, elementsAndDescriptors) in signatures.entrySet()!!) {
if (elementsAndDescriptors.size() == 1) continue // no clash
handleClashingSignatures(ConflictingJvmDeclarationsData(
classInternalName,
@@ -86,6 +83,7 @@ public abstract class SignatureCollectingClassBuilderFactory(
signature,
elementsAndDescriptors
))
hasDuplicateSignatures = true
}
onClassDone(classCreatedFor, classInternalName, signatures)
super.done()

View File

@@ -17,8 +17,8 @@
package org.jetbrains.kotlin.codegen;
import com.intellij.psi.tree.IElementType;
import kotlin.Function1;
import kotlin.Unit;
import kotlin.jvm.functions.Function1;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -27,6 +27,7 @@ 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.psi.JetArrayAccessExpression;
import org.jetbrains.kotlin.psi.JetExpression;
import org.jetbrains.kotlin.resolve.annotations.AnnotationsPackage;
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall;
@@ -197,9 +198,10 @@ public abstract class StackValue {
Type type,
ResolvedCall<FunctionDescriptor> getter,
ResolvedCall<FunctionDescriptor> setter,
ExpressionCodegen codegen
ExpressionCodegen codegen,
GenerationState state
) {
return new CollectionElement(collectionElementReceiver, type, getter, setter, codegen);
return new CollectionElement(collectionElementReceiver, type, getter, setter, codegen, state);
}
@NotNull
@@ -412,23 +414,15 @@ public abstract class StackValue {
return None.INSTANCE;
}
public static Field receiverWithRefWrapper(
public static FieldForSharedVar fieldForSharedVar(
@NotNull Type localType,
@NotNull Type classType,
@NotNull String fieldName,
@NotNull StackValue receiver,
@Nullable DeclarationDescriptor descriptor
) {
return field(sharedTypeForType(localType), classType, fieldName, false, receiver, descriptor);
}
public static FieldForSharedVar fieldForSharedVar(
@NotNull Type localType,
@NotNull Type classType,
@NotNull String fieldName,
@NotNull Field refWrapper
) {
return new FieldForSharedVar(localType, classType, fieldName, refWrapper);
Field receiverWithRefWrapper = field(sharedTypeForType(localType), classType, fieldName, false, receiver, descriptor);
return new FieldForSharedVar(localType, classType, fieldName, receiverWithRefWrapper);
}
@NotNull
@@ -445,15 +439,10 @@ public abstract class StackValue {
return new CoercionValue(value, castType);
}
@NotNull
public static StackValue thisOrOuter(
@NotNull ExpressionCodegen codegen,
@NotNull ClassDescriptor descriptor,
boolean isSuper,
boolean isExplicit
) {
public static StackValue thisOrOuter(@NotNull ExpressionCodegen codegen, @NotNull ClassDescriptor descriptor, boolean isSuper, boolean isExplicit) {
// Coerce this/super for traits to support traits with required classes.
// Coerce explicit 'this' for the case when it is smart cast.
// Do not coerce for other cases due to the 'protected' access issues (JVMS 7, 4.9.2 Structural Constraints).
// Do not coerce for other classes due to the 'protected' access issues (JVMS 7, 4.9.2 Structural Constraints).
boolean coerceType = descriptor.getKind() == ClassKind.INTERFACE || (isExplicit && !isSuper);
return new ThisOuter(codegen, descriptor, isSuper, coerceType);
}
@@ -470,13 +459,14 @@ public abstract class StackValue {
@NotNull Type type,
@NotNull StackValue stackValue,
int delta,
@NotNull Callable method,
ResolvedCall resolvedCall,
@NotNull ExpressionCodegen codegen
) {
if (stackValue instanceof StackValue.Local && Type.INT_TYPE == stackValue.type) {
return preIncrementForLocalVar(((StackValue.Local) stackValue).index, delta);
}
return new PrefixIncrement(type, stackValue, resolvedCall, codegen);
return new PrefixIncrement(type, stackValue, delta, method, resolvedCall, codegen);
}
public static StackValue receiver(
@@ -552,6 +542,10 @@ public abstract class StackValue {
return field(FieldInfo.createForSingleton(classDescriptor, typeMapper));
}
public static Field deprecatedCompanionObjectAccessor(ClassDescriptor classDescriptor, JetTypeMapper typeMapper) {
return field(FieldInfo.deprecatedFieldForCompanionObject(classDescriptor, typeMapper));
}
public static StackValue operation(Type type, Function1<InstructionAdapter, Unit> lambda) {
return new OperationStackValue(type, lambda);
}
@@ -718,6 +712,10 @@ public abstract class StackValue {
private final Callable callable;
private final boolean isGetter;
private final ExpressionCodegen codegen;
private final JetExpression array;
private final Type arrayType;
private final JetArrayAccessExpression expression;
private final Type[] argumentTypes;
private final ArgumentGenerator argumentGenerator;
private final List<ResolvedValueArgument> valueArguments;
private final FrameMap frame;
@@ -733,7 +731,11 @@ public abstract class StackValue {
boolean isGetter,
@NotNull ExpressionCodegen codegen,
ArgumentGenerator argumentGenerator,
List<ResolvedValueArgument> valueArguments
List<ResolvedValueArgument> valueArguments,
JetExpression array,
Type arrayType,
JetArrayAccessExpression expression,
Type[] argumentTypes
) {
super(OBJECT_TYPE);
this.callable = callable;
@@ -745,15 +747,33 @@ public abstract class StackValue {
this.argumentGenerator = argumentGenerator;
this.valueArguments = valueArguments;
this.codegen = codegen;
this.array = array;
this.arrayType = arrayType;
this.expression = expression;
this.argumentTypes = argumentTypes;
this.frame = codegen.myFrameMap;
}
@Override
public void putSelector(@NotNull Type type, @NotNull InstructionAdapter v) {
public void putSelector(
@NotNull Type type, @NotNull InstructionAdapter v
) {
ResolvedCall<?> call = isGetter ? resolvedGetCall : resolvedSetCall;
StackValue newReceiver = StackValue.receiver(call, receiver, codegen, callable);
newReceiver.put(newReceiver.type, v);
argumentGenerator.generate(valueArguments);
if (callable instanceof Callable) {
StackValue newReceiver = StackValue.receiver(call, receiver, codegen, (Callable) callable);
newReceiver.put(newReceiver.type, v);
argumentGenerator.generate(valueArguments);
}
else {
codegen.gen(array, arrayType); // intrinsic method
int index = call.getExtensionReceiver().exists() ? 1 : 0;
for (JetExpression jetExpression : expression.getIndexExpressions()) {
codegen.gen(jetExpression, argumentTypes[index]);
index++;
}
}
}
@Override
@@ -762,8 +782,7 @@ public abstract class StackValue {
}
public void dupReceiver(@NotNull InstructionAdapter v) {
if (CollectionElement.isStandardStack(codegen.typeMapper, resolvedGetCall, 1) &&
CollectionElement.isStandardStack(codegen.typeMapper, resolvedSetCall, 2)) {
if (isStandardStack(resolvedGetCall, 1) && isStandardStack(resolvedSetCall, 2)) {
v.dup2(); // collection and index
return;
}
@@ -850,31 +869,67 @@ public abstract class StackValue {
mark.dropTo();
}
private boolean isStandardStack(ResolvedCall<?> call, int valueParamsSize) {
if (call == null) {
return true;
}
List<ValueParameterDescriptor> valueParameters = call.getResultingDescriptor().getValueParameters();
if (valueParameters.size() != valueParamsSize) {
return false;
}
for (ValueParameterDescriptor valueParameter : valueParameters) {
if (codegen.typeMapper.mapType(valueParameter.getType()).getSize() != 1) {
return false;
}
}
if (call.getDispatchReceiver().exists()) {
if (call.getExtensionReceiver().exists()) {
return false;
}
}
else {
if (codegen.typeMapper.mapType(call.getResultingDescriptor().getExtensionReceiverParameter().getType())
.getSize() != 1) {
return false;
}
}
return true;
}
}
public static class CollectionElement extends StackValueWithSimpleReceiver {
private final Callable getter;
private final Callable setter;
private final ExpressionCodegen codegen;
private final GenerationState state;
private final ResolvedCall<FunctionDescriptor> resolvedGetCall;
private final ResolvedCall<FunctionDescriptor> resolvedSetCall;
private final FunctionDescriptor setterDescriptor;
private final FunctionDescriptor getterDescriptor;
public CollectionElement(
@NotNull StackValue collectionElementReceiver,
@NotNull Type type,
@Nullable ResolvedCall<FunctionDescriptor> resolvedGetCall,
@Nullable ResolvedCall<FunctionDescriptor> resolvedSetCall,
@NotNull ExpressionCodegen codegen
StackValue collectionElementReceiver,
Type type,
ResolvedCall<FunctionDescriptor> resolvedGetCall,
ResolvedCall<FunctionDescriptor> resolvedSetCall,
ExpressionCodegen codegen,
GenerationState state
) {
super(type, false, false, collectionElementReceiver, true);
this.resolvedGetCall = resolvedGetCall;
this.resolvedSetCall = resolvedSetCall;
this.state = state;
this.setterDescriptor = resolvedSetCall == null ? null : resolvedSetCall.getResultingDescriptor();
this.getterDescriptor = resolvedGetCall == null ? null : resolvedGetCall.getResultingDescriptor();
this.setter = resolvedSetCall == null ? null : codegen.resolveToCallable(setterDescriptor, false, resolvedSetCall);
this.getter = resolvedGetCall == null ? null : codegen.resolveToCallable(getterDescriptor, false, resolvedGetCall);
this.setter =
resolvedSetCall == null ? null : (Callable) codegen.resolveToCallable(setterDescriptor, false, resolvedSetCall);
this.getter =
resolvedGetCall == null ? null : (Callable) codegen.resolveToCallable(getterDescriptor, false, resolvedGetCall);
this.codegen = codegen;
}
@@ -890,7 +945,7 @@ public abstract class StackValue {
@Override
public int receiverSize() {
if (isStandardStack(codegen.typeMapper, resolvedGetCall, 1) && isStandardStack(codegen.typeMapper, resolvedSetCall, 2)) {
if (isStandardStack(resolvedGetCall, 1) && isStandardStack(resolvedSetCall, 2)) {
return 2;
}
else {
@@ -898,7 +953,7 @@ public abstract class StackValue {
}
}
public static boolean isStandardStack(@NotNull JetTypeMapper typeMapper, @Nullable ResolvedCall<?> call, int valueParamsSize) {
private boolean isStandardStack(ResolvedCall<?> call, int valueParamsSize) {
if (call == null) {
return true;
}
@@ -909,7 +964,7 @@ public abstract class StackValue {
}
for (ValueParameterDescriptor valueParameter : valueParameters) {
if (typeMapper.mapType(valueParameter.getType()).getSize() != 1) {
if (codegen.typeMapper.mapType(valueParameter.getType()).getSize() != 1) {
return false;
}
}
@@ -920,8 +975,8 @@ public abstract class StackValue {
}
}
else {
//noinspection ConstantConditions
if (typeMapper.mapType(call.getResultingDescriptor().getExtensionReceiverParameter().getType()).getSize() != 1) {
if (codegen.typeMapper.mapType(call.getResultingDescriptor().getExtensionReceiverParameter().getType())
.getSize() != 1) {
return false;
}
}
@@ -1209,6 +1264,8 @@ public abstract class StackValue {
}
private static class PrefixIncrement extends StackValue {
private final int delta;
private final Callable callable;
private final ResolvedCall resolvedCall;
private final ExpressionCodegen codegen;
private StackValue value;
@@ -1216,11 +1273,15 @@ public abstract class StackValue {
public PrefixIncrement(
@NotNull Type type,
@NotNull StackValue value,
int delta,
@NotNull Callable callable,
ResolvedCall resolvedCall,
@NotNull ExpressionCodegen codegen
) {
super(type);
this.value = value;
this.delta = delta;
this.callable = callable;
this.resolvedCall = resolvedCall;
this.codegen = codegen;
}
@@ -1230,7 +1291,13 @@ public abstract class StackValue {
value = StackValue.complexReceiver(value, true, false, true);
value.put(this.type, v);
value.store(codegen.invokeFunction(resolvedCall, StackValue.onStack(this.type)), v, true);
if (callable instanceof Callable) {
value.store(codegen.invokeFunction(resolvedCall, StackValue.onStack(this.type)), v, true);
}
else {
genIncrement(this.type, delta, v);
value.store(StackValue.onStack(this.type), v, true);
}
value.put(this.type, v, true);
coerceTo(type, v);
@@ -1258,17 +1325,19 @@ public abstract class StackValue {
) {
CallableDescriptor descriptor = resolvedCall.getResultingDescriptor();
Type dispatchReceiverType = smartDispatchReceiverType(descriptor, typeMapper);
ReceiverParameterDescriptor dispatchReceiver = descriptor.getDispatchReceiverParameter();
ReceiverParameterDescriptor extensionReceiver = descriptor.getExtensionReceiverParameter();
if (extensionReceiver != null) {
return callableMethod != null ? callableMethod.getExtensionReceiverType() : typeMapper.mapType(extensionReceiver.getType());
}
else if (dispatchReceiverType != null) {
else if (dispatchReceiver != null) {
if (AnnotationsPackage.isPlatformStaticInObjectOrClass(descriptor)) {
return Type.VOID_TYPE;
}
return callableMethod != null ? callableMethod.getDispatchReceiverType() : dispatchReceiverType;
else {
return callableMethod != null ? callableMethod.getDispatchReceiverType() : typeMapper.mapType(dispatchReceiver.getType());
}
}
else if (isLocalFunCall(callableMethod)) {
return callableMethod.getGenerateCalleeType();
@@ -1277,22 +1346,6 @@ public abstract class StackValue {
return Type.VOID_TYPE;
}
/**
* Extracts the receiver from the resolved call, workarounding the fact that ResolvedCall#dispatchReceiver doesn't have
* all the needed information, for example there's no way to find out whether or not a smart cast was applied to the receiver.
*/
@Nullable
private static Type smartDispatchReceiverType(@NotNull CallableDescriptor descriptor, @NotNull JetTypeMapper typeMapper) {
ReceiverParameterDescriptor dispatchReceiverParameter = descriptor.getDispatchReceiverParameter();
if (dispatchReceiverParameter == null) return null;
DeclarationDescriptor container = descriptor.getContainingDeclaration();
if (container instanceof ClassDescriptor) {
return typeMapper.mapClass((ClassDescriptor) container);
}
return typeMapper.mapType(dispatchReceiverParameter);
}
@Override
public void putSelector(@NotNull Type type, @NotNull InstructionAdapter v) {

View File

@@ -18,6 +18,7 @@ package org.jetbrains.kotlin.codegen
import org.jetbrains.org.objectweb.asm.Type
import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter
import org.jetbrains.org.objectweb.asm.Label
class CoercionValue(
val value: StackValue,
@@ -46,7 +47,7 @@ class CoercionValue(
public class StackValueWithLeaveTask(
val stackValue: StackValue,
val leaveTasks: (StackValue) -> Unit
val leaveTasks: StackValueWithLeaveTask.() -> Unit
) : StackValue(stackValue.type) {
override fun putReceiver(v: InstructionAdapter, isRead: Boolean) {
@@ -55,7 +56,7 @@ public class StackValueWithLeaveTask(
override fun putSelector(type: Type, v: InstructionAdapter) {
stackValue.putSelector(type, v)
leaveTasks(stackValue)
leaveTasks()
}
}

View File

@@ -0,0 +1,61 @@
/*
* 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;
import com.intellij.util.ArrayUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.codegen.context.ClassContext;
import org.jetbrains.kotlin.codegen.state.GenerationState;
import org.jetbrains.kotlin.psi.JetClassOrObject;
import org.jetbrains.kotlin.resolve.DescriptorUtils;
import static org.jetbrains.kotlin.codegen.AsmUtil.writeKotlinSyntheticClassAnnotation;
import static org.jetbrains.kotlin.load.java.JvmAnnotationNames.KotlinSyntheticClass;
import static org.jetbrains.org.objectweb.asm.Opcodes.*;
public class TraitImplBodyCodegen extends ClassBodyCodegen {
public TraitImplBodyCodegen(
@NotNull JetClassOrObject aClass,
@NotNull ClassContext context,
@NotNull ClassBuilder v,
@NotNull GenerationState state,
@Nullable MemberCodegen<?> parentCodegen
) {
super(aClass, context, v, state, parentCodegen);
}
@Override
protected void generateDeclaration() {
v.defineClass(myClass, V1_6,
ACC_PUBLIC | ACC_FINAL,
typeMapper.mapTraitImpl(descriptor).getInternalName(),
null,
"java/lang/Object",
ArrayUtil.EMPTY_STRING_ARRAY
);
v.visitSource(myClass.getContainingFile().getName(), null);
}
@Override
protected void generateKotlinAnnotation() {
writeKotlinSyntheticClassAnnotation(v, DescriptorUtils.isTopLevelOrInnerClass(descriptor)
? KotlinSyntheticClass.Kind.TRAIT_IMPL
: KotlinSyntheticClass.Kind.LOCAL_TRAIT_IMPL);
}
}

View File

@@ -1,138 +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
import com.intellij.util.ArrayUtil
import org.jetbrains.kotlin.backend.common.bridges.findImplementationFromInterface
import org.jetbrains.kotlin.backend.common.bridges.firstSuperMethodFromKotlin
import org.jetbrains.kotlin.codegen.AsmUtil.writeKotlinSyntheticClassAnnotation
import org.jetbrains.kotlin.codegen.context.ClassContext
import org.jetbrains.kotlin.codegen.state.GenerationState
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.load.java.JvmAnnotationNames.KotlinSyntheticClass.Kind.LOCAL_TRAIT_IMPL
import org.jetbrains.kotlin.load.java.JvmAnnotationNames.KotlinSyntheticClass.Kind.TRAIT_IMPL
import org.jetbrains.kotlin.load.java.descriptors.JavaMethodDescriptor
import org.jetbrains.kotlin.psi.JetClassOrObject
import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils
import org.jetbrains.kotlin.resolve.DescriptorUtils
import org.jetbrains.kotlin.resolve.jvm.diagnostics.DelegationToTraitImpl
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodSignature
import org.jetbrains.org.objectweb.asm.Opcodes.ACC_FINAL
import org.jetbrains.org.objectweb.asm.Opcodes.ACC_PUBLIC
import org.jetbrains.org.objectweb.asm.Opcodes.V1_6
public class TraitImplBodyCodegen(
aClass: JetClassOrObject,
context: ClassContext,
v: ClassBuilder,
state: GenerationState,
parentCodegen: MemberCodegen<*>?
) : ClassBodyCodegen(aClass, context, v, state, parentCodegen) {
override fun generateDeclaration() {
v.defineClass(
myClass, V1_6, ACC_PUBLIC or ACC_FINAL,
typeMapper.mapTraitImpl(descriptor).getInternalName(),
null, "java/lang/Object", ArrayUtil.EMPTY_STRING_ARRAY
)
v.visitSource(myClass.getContainingFile().getName(), null)
}
override fun generateSyntheticParts() {
for (memberDescriptor in descriptor.getDefaultType().getMemberScope().getAllDescriptors()) {
if (memberDescriptor !is CallableMemberDescriptor) continue
if (memberDescriptor.getKind().isReal()) continue
if (memberDescriptor.getVisibility() == Visibilities.INVISIBLE_FAKE) continue
if (memberDescriptor.getModality() == Modality.ABSTRACT) continue
val implementation = findImplementationFromInterface(memberDescriptor) ?: continue
// If implementation is located in a Java interface, it will be inherited via normal Java rules
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.getContainingDeclaration(), Modality.OPEN, memberDescriptor.getVisibility(),
CallableMemberDescriptor.Kind.DECLARATION, true)
if (memberDescriptor is FunctionDescriptor) {
generateDelegationToSuperTraitImpl(copy as FunctionDescriptor, implementation as FunctionDescriptor)
}
else if (memberDescriptor is PropertyDescriptor) {
implementation as PropertyDescriptor
val getter = (copy as PropertyDescriptor).getGetter()
val implGetter = implementation.getGetter()
if (getter != null && implGetter != null) {
generateDelegationToSuperTraitImpl(getter, implGetter)
}
val setter = copy.getSetter()
val implSetter = implementation.getSetter()
if (setter != null && implSetter != null) {
generateDelegationToSuperTraitImpl(setter, implSetter)
}
}
}
}
private fun generateDelegationToSuperTraitImpl(descriptor: FunctionDescriptor, implementation: FunctionDescriptor) {
val delegateTo = firstSuperMethodFromKotlin(descriptor, implementation) as FunctionDescriptor? ?: return
// We can't call super methods from Java 1.8 interfaces because that requires INVOKESPECIAL which is forbidden from TImpl class
if (delegateTo is JavaMethodDescriptor) return
functionCodegen.generateMethod(
DelegationToTraitImpl(DescriptorToSourceUtils.descriptorToDeclaration(descriptor), descriptor),
descriptor,
object : FunctionGenerationStrategy.CodegenBased<FunctionDescriptor>(state, descriptor) {
override fun doGenerateBody(codegen: ExpressionCodegen, signature: JvmMethodSignature) {
val iv = codegen.v
val method = typeMapper.mapToCallableMethod(delegateTo, true, context)
val myParameters = signature.getValueParameters()
val calleeParameters = method.getValueParameters()
if (myParameters.size() != calleeParameters.size()) {
throw AssertionError(
"Method from super interface has a different signature.\n" +
"This method:\n%s\n%s\n%s\nSuper method:\n%s\n%s\n%s".format(
callableDescriptor, signature, myParameters, delegateTo, method, calleeParameters
)
)
}
var k = 0
val it = calleeParameters.iterator()
for (parameter in myParameters) {
val type = parameter.getAsmType()
StackValue.local(k, type).put(it.next().getAsmType(), iv)
k += type.getSize()
}
method.genInvokeInstruction(iv)
StackValue.coerce(method.returnType, signature.getReturnType(), iv)
iv.areturn(signature.getReturnType())
}
})
}
override fun generateKotlinAnnotation() {
writeKotlinSyntheticClassAnnotation(
v,
if (DescriptorUtils.isTopLevelOrInnerClass(descriptor)) TRAIT_IMPL else LOCAL_TRAIT_IMPL
)
}
}

View File

@@ -20,7 +20,7 @@ import com.intellij.psi.PsiElement;
import com.intellij.psi.tree.IElementType;
import com.intellij.psi.tree.TokenSet;
import com.intellij.util.containers.Stack;
import kotlin.jvm.functions.Function1;
import kotlin.Function1;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.cfg.WhenChecker;
@@ -371,7 +371,7 @@ class CodegenAnnotatingVisitor extends JetVisitorVoid {
String peek = peekFromStack(nameStack);
String name = safeIdentifier(descriptor.getName()).asString();
if (containingDeclaration instanceof ClassDescriptor || containingDeclaration instanceof ScriptDescriptor) {
if (containingDeclaration instanceof ClassDescriptor) {
return peek + '$' + name;
}
else if (containingDeclaration instanceof PackageFragmentDescriptor) {

View File

@@ -16,7 +16,7 @@
package org.jetbrains.kotlin.codegen.context;
import kotlin.jvm.functions.Function0;
import kotlin.Function0;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.codegen.*;
@@ -241,12 +241,9 @@ public abstract class CodegenContext<T extends DeclarationDescriptor> {
}
int accessorIndex = accessors.size();
if (descriptor instanceof SimpleFunctionDescriptor) {
if (descriptor instanceof SimpleFunctionDescriptor || descriptor instanceof ConstructorDescriptor) {
accessor = new AccessorForFunctionDescriptor((FunctionDescriptor) descriptor, contextDescriptor, accessorIndex);
}
else if (descriptor instanceof ConstructorDescriptor) {
accessor = new AccessorForConstructorDescriptor((ConstructorDescriptor) descriptor, contextDescriptor);
}
else if (descriptor instanceof PropertyDescriptor) {
if (isForBackingFieldInOuterClass) {
accessor = new AccessorForPropertyBackingFieldInOuterClass((PropertyDescriptor) descriptor, contextDescriptor,

View File

@@ -27,7 +27,6 @@ public final class EnclosedValueDescriptor {
private final String fieldName;
private final DeclarationDescriptor descriptor;
private final StackValue.StackValueWithSimpleReceiver innerValue;
private final StackValue instanceValue;
private final Type type;
public EnclosedValueDescriptor(
@@ -39,21 +38,6 @@ public final class EnclosedValueDescriptor {
this.fieldName = fieldName;
this.descriptor = descriptor;
this.innerValue = innerValue;
this.instanceValue = innerValue;
this.type = type;
}
public EnclosedValueDescriptor(
@NotNull String name,
@Nullable DeclarationDescriptor descriptor,
@NotNull StackValue.StackValueWithSimpleReceiver innerValue,
@NotNull StackValue.Field instanceValue,
@NotNull Type type
) {
this.fieldName = name;
this.descriptor = descriptor;
this.innerValue = innerValue;
this.instanceValue = instanceValue;
this.type = type;
}
@@ -73,13 +57,19 @@ public final class EnclosedValueDescriptor {
}
@NotNull
public StackValue getInstanceValue() {
return instanceValue;
public Type getType() {
return type;
}
@NotNull
public Type getType() {
return type;
public StackValue getOuterValue(@NotNull ExpressionCodegen codegen) {
for (LocalLookup.LocalLookupCase aCase : LocalLookup.LocalLookupCase.values()) {
if (aCase.isCase(descriptor)) {
return aCase.outerValue(this, codegen);
}
}
throw new IllegalStateException("Can't get outer value in " + codegen + " for " + this);
}
@Override

View File

@@ -61,21 +61,12 @@ public interface LocalLookup {
String fieldName = "$" + vd.getName();
StackValue.Local thiz = StackValue.LOCAL_0;
StackValue.StackValueWithSimpleReceiver innerValue;
EnclosedValueDescriptor enclosedValueDescriptor;
if (sharedVarType != null) {
StackValue.Field wrapperValue = StackValue.receiverWithRefWrapper(localType, classType, fieldName, thiz, vd);
innerValue = StackValue.fieldForSharedVar(localType, classType, fieldName, wrapperValue);
enclosedValueDescriptor = new EnclosedValueDescriptor(fieldName, d, innerValue, wrapperValue, type);
}
else {
innerValue = StackValue.field(type, classType, fieldName, false, thiz, vd);
enclosedValueDescriptor = new EnclosedValueDescriptor(fieldName, d, innerValue, type);
}
StackValue.StackValueWithSimpleReceiver innerValue = sharedVarType != null
? StackValue.fieldForSharedVar(localType, classType, fieldName, thiz, vd)
: StackValue.field(type, classType, fieldName, false, thiz, vd);
closure.recordField(fieldName, type);
closure.captureVariable(enclosedValueDescriptor);
closure.captureVariable(new EnclosedValueDescriptor(fieldName, d, innerValue, type));
return innerValue;
}
@@ -168,17 +159,10 @@ public interface LocalLookup {
@NotNull
public StackValue outerValue(@NotNull EnclosedValueDescriptor d, @NotNull ExpressionCodegen codegen) {
DeclarationDescriptor declarationDescriptor = d.getDescriptor();
int idx = codegen.lookupLocalIndex(declarationDescriptor);
if (idx >= 0) {
return StackValue.local(idx, d.getType());
}
else {
assert declarationDescriptor != null : "No declaration descriptor for " + d;
StackValue capturedValue = codegen.findCapturedValue(declarationDescriptor);
assert capturedValue != null : "Unresolved captured value for " + d;
return capturedValue;
}
int idx = codegen.lookupLocalIndex(d.getDescriptor());
assert idx != -1;
return StackValue.local(idx, d.getType());
}
}
}

View File

@@ -61,9 +61,4 @@ public class ScriptContext extends FieldOwnerContext<ClassDescriptor> {
}
return "script$" + (index + 1);
}
@Override
public String toString() {
return "Script: " + getContextDescriptor().getName().asString();
}
}

View File

@@ -1,34 +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.extensions
import org.jetbrains.kotlin.codegen.ClassBuilderFactory
import org.jetbrains.kotlin.diagnostics.DiagnosticSink
import org.jetbrains.kotlin.extensions.ProjectExtensionDescriptor
import org.jetbrains.kotlin.resolve.BindingContext
public trait ClassBuilderInterceptorExtension {
companion object : ProjectExtensionDescriptor<ClassBuilderInterceptorExtension>(
"org.jetbrains.kotlin.classBuilderFactoryInterceptorExtension", javaClass<ClassBuilderInterceptorExtension>())
public fun interceptClassBuilderFactory(
interceptedFactory: ClassBuilderFactory,
bindingContext: BindingContext,
diagnostics: DiagnosticSink
): ClassBuilderFactory
}

View File

@@ -18,7 +18,6 @@ package org.jetbrains.kotlin.codegen.inline;
import com.intellij.openapi.util.Pair;
import com.intellij.util.ArrayUtil;
import kotlin.jvm.functions.Function0;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.kotlin.codegen.AsmUtil;
import org.jetbrains.kotlin.codegen.ClassBuilder;
@@ -63,8 +62,6 @@ public class AnonymousObjectTransformer {
private final Map<String, List<String>> fieldNames = new HashMap<String, List<String>>();
private final TypeRemapper typeRemapper;
public AnonymousObjectTransformer(
@NotNull String objectInternalName,
@NotNull InliningContext inliningContext,
@@ -79,7 +76,6 @@ public class AnonymousObjectTransformer {
this.newLambdaType = newLambdaType;
reader = InlineCodegenUtil.buildClassReaderByInternalName(state, objectInternalName);
typeRemapper = new TypeRemapper(inliningContext.typeMapping);
}
private void buildInvokeParamsFor(@NotNull ParametersBuilder builder, @NotNull MethodNode node) {
@@ -185,29 +181,13 @@ public class AnonymousObjectTransformer {
ParametersBuilder allCapturedParamBuilder = ParametersBuilder.newBuilder();
ParametersBuilder constructorParamBuilder = ParametersBuilder.newBuilder();
List<CapturedParamInfo> additionalFakeParams =
extractParametersMappingAndPatchConstructor(constructor, allCapturedParamBuilder, constructorParamBuilder,
anonymousObjectGen);
List<MethodVisitor> deferringMethods = new ArrayList();
extractParametersMappingAndPatchConstructor(constructor, allCapturedParamBuilder, constructorParamBuilder, anonymousObjectGen);
for (MethodNode next : methodsToTransform) {
MethodVisitor deferringVisitor = newMethod(classBuilder, next);
InlineResult funResult = inlineMethod(anonymousObjectGen, parentRemapper, deferringVisitor, next, allCapturedParamBuilder);
MethodVisitor visitor = newMethod(classBuilder, next);
InlineResult funResult = inlineMethod(anonymousObjectGen, parentRemapper, visitor, next, allCapturedParamBuilder);
result.addAllClassesToRemove(funResult);
result.getReifiedTypeParametersUsages().mergeAll(funResult.getReifiedTypeParametersUsages());
Type returnType = Type.getReturnType(next.desc);
if (!AsmUtil.isPrimitive(returnType)) {
String oldFunReturnType = returnType.getInternalName();
String newFunReturnType = funResult.getChangedTypes().get(oldFunReturnType);
if (newFunReturnType != null) {
typeRemapper.addAdditionalMappings(oldFunReturnType, newFunReturnType);
}
}
deferringMethods.add(deferringVisitor);
}
for (MethodVisitor method : deferringMethods) {
method.visitEnd();
}
InlineResult constructorResult =
@@ -227,7 +207,7 @@ public class AnonymousObjectTransformer {
private InlineResult inlineMethod(
@NotNull AnonymousObjectGeneration anonymousObjectGen,
@NotNull FieldRemapper parentRemapper,
@NotNull MethodVisitor deferringVisitor,
@NotNull MethodVisitor resultVisitor,
@NotNull MethodNode sourceNode,
@NotNull ParametersBuilder capturedBuilder
) {
@@ -243,9 +223,10 @@ public class AnonymousObjectTransformer {
remapper, isSameModule, "Transformer for " + anonymousObjectGen.getOwnerInternalName(),
sourceMapper);
InlineResult result = inliner.doInline(deferringVisitor, new LocalVarRemapper(parameters, 0), false, LabelOwner.NOT_APPLICABLE);
InlineResult result = inliner.doInline(resultVisitor, new LocalVarRemapper(parameters, 0), false, LabelOwner.NOT_APPLICABLE);
result.getReifiedTypeParametersUsages().mergeAll(typeParametersToReify);
deferringVisitor.visitMaxs(-1, -1);
resultVisitor.visitMaxs(-1, -1);
resultVisitor.visitEnd();
return result;
}
@@ -357,30 +338,19 @@ public class AnonymousObjectTransformer {
@NotNull
private ClassBuilder createClassBuilder() {
ClassBuilder classBuilder = state.getFactory().newVisitor(NO_ORIGIN, newLambdaType, inliningContext.getRoot().callElement.getContainingFile());
return new RemappingClassBuilder(classBuilder, typeRemapper);
return new RemappingClassBuilder(classBuilder, new TypeRemapper(inliningContext.typeMapping));
}
@NotNull
private static DeferredMethodVisitor newMethod(@NotNull final ClassBuilder builder, @NotNull final MethodNode original) {
return new DeferredMethodVisitor(
new MethodNode(original.access,
original.name,
original.desc,
original.signature,
ArrayUtil.toStringArray(original.exceptions)),
new Function0<MethodVisitor>() {
@Override
public MethodVisitor invoke() {
return builder.newMethod(
NO_ORIGIN,
original.access,
original.name,
original.desc,
original.signature,
ArrayUtil.toStringArray(original.exceptions));
}
});
private static MethodVisitor newMethod(@NotNull ClassBuilder builder, @NotNull MethodNode original) {
return builder.newMethod(
NO_ORIGIN,
original.access,
original.name,
original.desc,
original.signature,
ArrayUtil.toStringArray(original.exceptions)
);
}
private List<CapturedParamInfo> extractParametersMappingAndPatchConstructor(

View File

@@ -34,6 +34,9 @@ public abstract class CoveringTryCatchNodeProcessor(parameterSize: Int) {
public var nextFreeLocalIndex: Int = parameterSize
private set
public val coveringFromInnermost: List<TryCatchBlockNodeInfo>
get() = tryBlocksMetaInfo.currentIntervals.reverse()
public fun getStartNodes(label: LabelNode): List<TryCatchBlockNodeInfo> {
return tryBlocksMetaInfo.intervalStarts.get(label)
}
@@ -50,33 +53,65 @@ public abstract class CoveringTryCatchNodeProcessor(parameterSize: Int) {
}
if (curInstr is LabelNode) {
tryBlocksMetaInfo.processCurrent(curInstr, directOrder)
localVarsMetaInfo.processCurrent(curInstr, directOrder)
updateCoveringTryBlocks(curInstr, directOrder)
updateCoveringLocalVars(curInstr, directOrder)
}
}
//Keep information about try blocks that cover current instruction -
// pushing and popping it to stack entering and exiting tryCatchBlock start and end labels
protected open fun updateCoveringTryBlocks(curIns: LabelNode, directOrder: Boolean) {
for (startNode in tryBlocksMetaInfo.closeIntervals(curIns, directOrder)) {
assert(!startNode.isEmpty(), {"Try block should be non-empty"})
val pop = tryBlocksMetaInfo.currentIntervals.pop()
//Temporary disabled cause during patched structure of exceptions changed
// if (startNode != pop) {
// throw RuntimeException("Wrong try-catch structure " + startNode + " " + pop + " " + infosToClose.size())
// };
}
//Reversing list order cause we should pop external block before internal one
// (originally internal blocks goes before external one, such invariant preserved via sortTryCatchBlocks method)
for (info in tryBlocksMetaInfo.openIntervals(curIns, directOrder).reverse()) {
assert(!info.isEmpty(), {"Try block should be non-empty"})
tryBlocksMetaInfo.currentIntervals.add(info)
}
}
protected open fun updateCoveringLocalVars(curIns: LabelNode, directOrder: Boolean) {
localVarsMetaInfo.closeIntervals(curIns, directOrder).filterNot {
it.isEmpty()
} forEach {
localVarsMetaInfo.currentIntervals.pop()
}
localVarsMetaInfo.openIntervals(curIns, directOrder).filterNot {
it.isEmpty()
} forEach {
localVarsMetaInfo.currentIntervals.add(it)
}
}
public abstract fun instructionIndex(inst: AbstractInsnNode): Int
public fun sortTryCatchBlocks(intervals: List<TryCatchBlockNodeInfo>): List<TryCatchBlockNodeInfo> {
public fun sortTryCatchBlocks() {
val comp = Comparator { t1: TryCatchBlockNodeInfo, t2: TryCatchBlockNodeInfo ->
var result = instructionIndex(t1.handler) - instructionIndex(t2.handler)
if (result == 0) {
result = instructionIndex(t1.startLabel) - instructionIndex(t2.startLabel)
if (result == 0) {
assert(false, "Error: support multicatch finallies: ${t1.handler}, ${t2.handler}")
assert(false, "Error: support multicatch finallies!")
result = instructionIndex(t1.endLabel) - instructionIndex(t2.endLabel)
}
}
result
}
Collections.sort<TryCatchBlockNodeInfo>(intervals, comp)
return intervals;
Collections.sort<TryCatchBlockNodeInfo>(tryBlocksMetaInfo.allIntervals, comp)
}
protected fun substituteTryBlockNodes(node: MethodNode) {
node.tryCatchBlocks.clear()
sortTryCatchBlocks(tryBlocksMetaInfo.allIntervals)
for (info in tryBlocksMetaInfo.getMeaningfulIntervals()) {
node.tryCatchBlocks.add(info.node)
}
@@ -99,7 +134,7 @@ class IntervalMetaInfo<T : SplittableInterval<T>> {
val allIntervals: ArrayList<T> = arrayListOf()
val currentIntervals: MutableSet<T> = linkedSetOf()
val currentIntervals: Stack<T> = Stack()
fun addNewInterval(newInfo: T) {
intervalStarts.put(newInfo.startLabel, newInfo)
@@ -117,41 +152,24 @@ class IntervalMetaInfo<T : SplittableInterval<T>> {
intervalEnds.put(remapped.endLabel, remapped)
}
fun splitCurrentIntervals(by : Interval, keepStart: Boolean): List<SplitPair<T>> {
fun splitCurrentIntervals(by : Interval, keepStart: Boolean): List<SplittedPair<T>> {
return currentIntervals.map { split(it, by, keepStart) }
}
fun processCurrent(curIns: LabelNode, directOrder: Boolean) {
getInterval(curIns, directOrder).forEach {
val added = currentIntervals.add(it)
assert(added, "Wrong interval structure: $curIns, $it")
}
getInterval(curIns, !directOrder).forEach {
val removed = currentIntervals.remove(it)
assert(removed, "Wrong interval structure: $curIns, $it")
}
}
fun split(interval: T, by : Interval, keepStart: Boolean): SplitPair<T> {
val split = interval.split(by, keepStart)
fun split(interval: T, by : Interval, keepStart: Boolean): SplittedPair<T> {
val splittedPair = interval.split(by, keepStart)
if (!keepStart) {
remapStartLabel(split.newPart.startLabel, split.patchedPart)
remapStartLabel(splittedPair.newPart.startLabel, splittedPair.patchedPart)
} else {
remapEndLabel(split.newPart.endLabel, split.patchedPart)
remapEndLabel(splittedPair.newPart.endLabel, splittedPair.patchedPart)
}
addNewInterval(split.newPart)
return split
addNewInterval(splittedPair.newPart)
return splittedPair
}
fun splitAndRemoveInterval(interval: T, by : Interval, keepStart: Boolean): SplitPair<T> {
val splitPair = split(interval, by, keepStart)
val removed = currentIntervals.remove(splitPair.patchedPart)
assert(removed, {"Wrong interval structure: $splitPair"})
return splitPair
}
fun closeIntervals(curIns: LabelNode, directOrder: Boolean) = if (!directOrder) intervalStarts.get(curIns) else intervalEnds.get(curIns)
fun getInterval(curIns: LabelNode, isOpen: Boolean) = if (isOpen) intervalStarts.get(curIns) else intervalEnds.get(curIns)
fun openIntervals(curIns: LabelNode, directOrder: Boolean) = if (directOrder) intervalStarts.get(curIns) else intervalEnds.get(curIns)
}
private fun Interval.isMeaningless(): Boolean {
@@ -193,7 +211,7 @@ public class LocalVarNodeWrapper(val node: LocalVariableNode) : Interval, Splitt
override val endLabel: LabelNode
get() = node.end
override fun split(split: Interval, keepStart: Boolean): SplitPair<LocalVarNodeWrapper> {
override fun split(split: Interval, keepStart: Boolean): SplittedPair<LocalVarNodeWrapper> {
val newPartInterval = if (keepStart) {
val oldEnd = endLabel
node.end = split.startLabel
@@ -205,7 +223,7 @@ public class LocalVarNodeWrapper(val node: LocalVariableNode) : Interval, Splitt
Pair(oldStart, split.startLabel)
}
return SplitPair(this, LocalVarNodeWrapper(
return SplittedPair(this, LocalVarNodeWrapper(
LocalVariableNode(node.name, node.desc, node.signature, newPartInterval.first, newPartInterval.second, node.index)
))
}

View File

@@ -1,32 +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.MethodVisitor
import org.jetbrains.org.objectweb.asm.tree.MethodNode
public class DeferredMethodVisitor(
val intermediate: MethodNode,
val resultNode: () -> MethodVisitor
) : MethodVisitor(InlineCodegenUtil.API, intermediate) {
override fun visitEnd() {
super.visitEnd()
val resultVisitor = resultNode()
intermediate.accept(resultVisitor)
}
}

View File

@@ -32,7 +32,6 @@ import org.jetbrains.kotlin.codegen.state.JetTypeMapper;
import org.jetbrains.kotlin.descriptors.*;
import org.jetbrains.kotlin.load.kotlin.PackageClassUtils;
import org.jetbrains.kotlin.name.ClassId;
import org.jetbrains.kotlin.name.Name;
import org.jetbrains.kotlin.psi.*;
import org.jetbrains.kotlin.renderer.DescriptorRenderer;
import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils;
@@ -45,14 +44,12 @@ import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodParameterKind;
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodParameterSignature;
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodSignature;
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedSimpleFunctionDescriptor;
import org.jetbrains.kotlin.types.expressions.LabelResolver;
import org.jetbrains.org.objectweb.asm.Label;
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.Method;
import org.jetbrains.org.objectweb.asm.tree.AbstractInsnNode;
import org.jetbrains.org.objectweb.asm.tree.InsnList;
import org.jetbrains.org.objectweb.asm.tree.LabelNode;
import org.jetbrains.org.objectweb.asm.tree.MethodNode;
@@ -61,9 +58,7 @@ import java.util.*;
import static org.jetbrains.kotlin.codegen.AsmUtil.getMethodAsmFlags;
import static org.jetbrains.kotlin.codegen.AsmUtil.isPrimitive;
import static org.jetbrains.kotlin.codegen.binding.CodegenBinding.CLASS_FOR_SCRIPT;
import static org.jetbrains.kotlin.codegen.inline.InlineCodegenUtil.addInlineMarker;
import static org.jetbrains.kotlin.codegen.inline.InlineCodegenUtil.getConstant;
import static org.jetbrains.kotlin.resolve.DescriptorUtils.isFunctionLiteral;
import static org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilPackage.getResolvedCallWithAssert;
@@ -131,10 +126,6 @@ public class InlineCodegen extends CallGenerator {
@Override
public void genCallInner(@NotNull Callable callableMethod, @Nullable ResolvedCall<?> resolvedCall, boolean callDefault, @NotNull ExpressionCodegen codegen) {
SMAPAndMethodNode nodeAndSmap = null;
if (!state.getInlineCycleReporter().enterIntoInlining(resolvedCall)) {
generateStub(resolvedCall, codegen);
return;
}
try {
nodeAndSmap = createMethodNode(callDefault);
@@ -152,16 +143,8 @@ public class InlineCodegen extends CallGenerator {
(generateNodeText ? ("\ncause: " + InlineCodegenUtil.getNodeText(nodeAndSmap != null ? nodeAndSmap.getNode(): null)) : ""),
e, callElement);
}
finally {
state.getInlineCycleReporter().exitFromInliningOf(resolvedCall);
}
}
protected void generateStub(@Nullable ResolvedCall<?> resolvedCall, @NotNull ExpressionCodegen codegen) {
leaveTemps();
assert resolvedCall != null;
String message = "Call is part of inline cycle: " + resolvedCall.getCall().getCallElement().getText();
AsmUtil.genThrow(codegen.v, "java/lang/UnsupportedOperationException", message);
}
private void endCall(@NotNull InlineResult result) {
@@ -292,7 +275,6 @@ public class InlineCodegen extends CallGenerator {
List<MethodInliner.PointForExternalFinallyBlocks> infos = MethodInliner.processReturns(adapter, labelOwner, true, null);
generateAndInsertFinallyBlocks(adapter, infos, ((StackValue.Local)remapper.remap(parameters.totalSize() + 1).value).index);
removeFinallyMarkers(adapter);
adapter.accept(new InliningInstructionAdapter(codegen.v));
@@ -341,7 +323,7 @@ public class InlineCodegen extends CallGenerator {
FunctionGenerationStrategy strategy =
expression instanceof JetCallableReferenceExpression ?
new FunctionReferenceGenerationStrategy(
new ExpressionCodegen.CallableReferenceGenerationStrategy(
state,
descriptor,
getResolvedCallWithAssert(((JetCallableReferenceExpression) expression).getCallableReference(),
@@ -556,14 +538,14 @@ public class InlineCodegen extends CallGenerator {
@NotNull
protected static Set<String> getDeclarationLabels(@Nullable PsiElement lambdaOrFun, @NotNull DeclarationDescriptor descriptor) {
Set<String> result = new HashSet<String>();
if (lambdaOrFun != null) {
Name label = LabelResolver.INSTANCE.getLabelNameIfAny(lambdaOrFun);
if (label != null) {
result.add(label.asString());
PsiElement parent = lambdaOrFun.getParent();
if (parent instanceof JetLabeledExpression) {
String labelName = ((JetLabeledExpression) parent).getLabelName();
assert labelName != null : "Labeled expression should have not nul label " + parent.getText();
result.add(labelName);
}
}
if (!isFunctionLiteral(descriptor)) {
if (!descriptor.getName().isSpecial()) {
result.add(descriptor.getName().asString());
@@ -592,14 +574,6 @@ public class InlineCodegen extends CallGenerator {
OwnerKind kind = DescriptorUtils.isTrait(descriptor) ? OwnerKind.TRAIT_IMPL : OwnerKind.IMPLEMENTATION;
return parent.intoClass((ClassDescriptor) descriptor, kind, state);
}
else if (descriptor instanceof ScriptDescriptor) {
ClassDescriptor classDescriptorForScript = state.getBindingContext().get(CLASS_FOR_SCRIPT, (ScriptDescriptor) descriptor);
assert classDescriptorForScript != null : "Can't find class for script: " + descriptor;
List<ScriptDescriptor> earlierScripts = state.getEarlierScriptsForReplInterpreter();
return parent.intoScript((ScriptDescriptor) descriptor,
earlierScripts == null ? Collections.emptyList() : earlierScripts,
classDescriptorForScript);
}
else if (descriptor instanceof FunctionDescriptor) {
return parent.intoFunction((FunctionDescriptor) descriptor);
}
@@ -650,8 +624,8 @@ public class InlineCodegen extends CallGenerator {
public void generateAndInsertFinallyBlocks(
@NotNull MethodNode intoNode,
@NotNull List<MethodInliner.PointForExternalFinallyBlocks> insertPoints,
MethodNode intoNode,
List<MethodInliner.PointForExternalFinallyBlocks> insertPoints,
int offsetForFinallyLocalVar
) {
if (!codegen.hasFinallyBlocks()) return;
@@ -664,18 +638,14 @@ public class InlineCodegen extends CallGenerator {
DefaultProcessor processor = new DefaultProcessor(intoNode, offsetForFinallyLocalVar);
int curFinallyDepth = 0;
AbstractInsnNode curInstr = intoNode.instructions.getFirst();
while (curInstr != null) {
processor.processInstruction(curInstr, true);
if (InlineCodegenUtil.isFinallyStart(curInstr)) {
//TODO depth index calc could be more precise
curFinallyDepth = getConstant(curInstr.getPrevious());
}
MethodInliner.PointForExternalFinallyBlocks extension = extensionPoints.get(curInstr);
if (extension != null) {
Label start = new Label();
Label end = new Label();
MethodNode finallyNode = InlineCodegenUtil.createEmptyMethodNode();
finallyNode.visitLabel(start);
@@ -683,7 +653,7 @@ public class InlineCodegen extends CallGenerator {
ExpressionCodegen finallyCodegen =
new ExpressionCodegen(finallyNode, codegen.getFrameMap(), codegen.getReturnType(),
codegen.getContext(), codegen.getState(), codegen.getParentCodegen());
finallyCodegen.addBlockStackElementsForNonLocalReturns(codegen.getBlockStackElements(), curFinallyDepth);
finallyCodegen.addBlockStackElementsForNonLocalReturns(codegen.getBlockStackElements());
FrameMap frameMap = finallyCodegen.getFrameMap();
FrameMap.Mark mark = frameMap.mark();
@@ -691,15 +661,15 @@ public class InlineCodegen extends CallGenerator {
frameMap.enterTemp(Type.INT_TYPE);
}
finallyCodegen.generateFinallyBlocksIfNeeded(extension.returnType, extension.finallyIntervalEnd.getLabel());
finallyCodegen.generateFinallyBlocksIfNeeded(extension.returnType);
finallyNode.visitLabel(end);
//Exception table for external try/catch/finally blocks will be generated in original codegen after exiting this method
InlineCodegenUtil.insertNodeBefore(finallyNode, intoNode, curInstr);
SimpleInterval splitBy = new SimpleInterval((LabelNode) start.info, extension.finallyIntervalEnd);
processor.getTryBlocksMetaInfo().splitCurrentIntervals(splitBy, true);
SimpleInterval splitBy = new SimpleInterval((LabelNode) start.info, (LabelNode) end.info);
processor.getTryBlocksMetaInfo().splitCurrentIntervals(splitBy, false);
processor.getLocalVarsMetaInfo().splitCurrentIntervals(splitBy, true);
processor.getLocalVarsMetaInfo().splitCurrentIntervals(splitBy, false);
mark.dropTo();
}
@@ -707,30 +677,12 @@ public class InlineCodegen extends CallGenerator {
curInstr = curInstr.getNext();
}
processor.sortTryCatchBlocks();
processor.substituteTryBlockNodes(intoNode);
//processor.substituteLocalVarTable(intoNode);
}
public void removeFinallyMarkers(@NotNull MethodNode intoNode) {
if (InlineCodegenUtil.isFinallyMarkerRequired(codegen.getContext())) return;
InsnList instructions = intoNode.instructions;
AbstractInsnNode curInstr = instructions.getFirst();
while (curInstr != null) {
if (InlineCodegenUtil.isFinallyMarker(curInstr)) {
AbstractInsnNode marker = curInstr;
//just to assert
getConstant(marker.getPrevious());
curInstr = curInstr.getNext();
instructions.remove(marker.getPrevious());
instructions.remove(marker);
continue;
}
curInstr = curInstr.getNext();
}
}
private SourceMapper createNestedSourceMapper(@NotNull SMAPAndMethodNode nodeAndSmap) {
return new NestedSourceMapper(sourceMapper, nodeAndSmap.getRanges(), nodeAndSmap.getClassSMAP().getSourceInfo());
}

View File

@@ -33,9 +33,9 @@ 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.kotlin.JvmVirtualFileFinder;
import org.jetbrains.kotlin.load.kotlin.PackageClassUtils;
import org.jetbrains.kotlin.load.kotlin.PackagePartClassUtils;
import org.jetbrains.kotlin.load.kotlin.VirtualFileFinder;
import org.jetbrains.kotlin.name.ClassId;
import org.jetbrains.kotlin.name.FqName;
import org.jetbrains.kotlin.name.Name;
@@ -58,6 +58,7 @@ import org.jetbrains.org.objectweb.asm.util.TraceMethodVisitor;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.Arrays;
import java.util.ListIterator;
import static kotlin.KotlinPackage.substringAfterLast;
@@ -69,16 +70,18 @@ public class InlineCodegenUtil {
public static final int API = Opcodes.ASM5;
public static final String CAPTURED_FIELD_PREFIX = "$";
public static final String THIS$0 = "this$0";
public static final String RECEIVER$0 = "receiver$0";
public static final String NON_LOCAL_RETURN = "$$$$$NON_LOCAL_RETURN$$$$$";
public static final String FIRST_FUN_LABEL = "$$$$$ROOT$$$$$";
public static final String NUMBERED_FUNCTION_PREFIX = "kotlin/jvm/functions/Function";
public static final String INLINE_MARKER_CLASS_NAME = "kotlin/jvm/internal/InlineMarker";
public static final String INLINE_MARKER_BEFORE_METHOD_NAME = "beforeInlineCall";
public static final String INLINE_MARKER_AFTER_METHOD_NAME = "afterInlineCall";
public static final String INLINE_MARKER_FINALLY_START = "finallyStart";
public static final String INLINE_MARKER_FINALLY_END = "finallyEnd";
public static final String INLINE_MARKER_GOTO_TRY_CATCH_BLOCK_END = "goToTryCatchBlockEnd";
@Nullable
public static SMAPAndMethodNode getMethodNode(
@@ -147,7 +150,7 @@ public class InlineCodegenUtil {
@NotNull
public static VirtualFile getVirtualFileForCallable(@NotNull ClassId containerClassId, @NotNull GenerationState state) {
JvmVirtualFileFinder fileFinder = JvmVirtualFileFinder.SERVICE.getInstance(state.getProject());
VirtualFileFinder fileFinder = VirtualFileFinder.SERVICE.getInstance(state.getProject());
VirtualFile file = fileFinder.findVirtualFileWithHeader(containerClassId);
if (file == null) {
throw new IllegalStateException("Couldn't find declaration file for " + containerClassId);
@@ -178,7 +181,7 @@ public class InlineCodegenUtil {
public static VirtualFile findVirtualFile(@NotNull Project project, @NotNull String internalClassName) {
FqName packageFqName = JvmClassName.byInternalName(internalClassName).getPackageFqName();
String classNameWithDollars = substringAfterLast(internalClassName, "/", internalClassName);
JvmVirtualFileFinder fileFinder = JvmVirtualFileFinder.SERVICE.getInstance(project);
VirtualFileFinder fileFinder = VirtualFileFinder.SERVICE.getInstance(project);
//TODO: we cannot construct proper classId at this point, we need to read InnerClasses info from class file
// we construct valid.package.name/RelativeClassNameAsSingleName that should work in compiler, but fails for inner classes in IDE
return fileFinder.findVirtualFileWithHeader(new ClassId(packageFqName, Name.identifier(classNameWithDollars)));
@@ -248,10 +251,20 @@ public class InlineCodegenUtil {
return getInlineName(codegenContext, currentDescriptor.getContainingDeclaration(), typeMapper) + "$" + suffix;
}
public static boolean isInvokeOnLambda(@NotNull String owner, @NotNull String name) {
return OperatorConventions.INVOKE.asString().equals(name) &&
owner.startsWith(NUMBERED_FUNCTION_PREFIX) &&
isInteger(owner.substring(NUMBERED_FUNCTION_PREFIX.length()));
public static boolean isInvokeOnLambda(String owner, String name) {
if (!OperatorConventions.INVOKE.asString().equals(name)) {
return false;
}
for (String prefix : Arrays.asList("kotlin/Function", "kotlin/ExtensionFunction")) {
if (owner.startsWith(prefix)) {
String suffix = owner.substring(prefix.length());
if (isInteger(suffix)) {
return true;
}
}
}
return false;
}
public static boolean isAnonymousConstructorCall(@NotNull String internalName, @NotNull String methodName) {
@@ -322,9 +335,7 @@ public class InlineCodegenUtil {
//marked return could be either non-local or local in case of labeled lambda self-returns
public static boolean isMarkedReturn(@NotNull AbstractInsnNode returnIns) {
if (!isReturnOpcode(returnIns.getOpcode())) {
return false;
}
assert isReturnOpcode(returnIns.getOpcode()) : "Should be called on return instruction, but " + returnIns;
AbstractInsnNode globalFlag = returnIns.getPrevious();
return globalFlag instanceof MethodInsnNode && NON_LOCAL_RETURN.equals(((MethodInsnNode)globalFlag).owner);
}
@@ -358,6 +369,10 @@ public class InlineCodegenUtil {
return new MethodNode(API, 0, "fake", "()V", null, null);
}
static boolean isLineNumberOrLabel(@Nullable AbstractInsnNode node) {
return node instanceof LineNumberNode || node instanceof LabelNode;
}
@NotNull
public static LabelNode firstLabelInChain(@NotNull LabelNode node) {
LabelNode curNode = node;
@@ -404,48 +419,16 @@ public class InlineCodegenUtil {
}
}
public static void generateFinallyMarker(@NotNull InstructionAdapter v, int depth, boolean start) {
v.iconst(depth);
v.invokestatic(INLINE_MARKER_CLASS_NAME, start ? INLINE_MARKER_FINALLY_START : INLINE_MARKER_FINALLY_END, "(I)V", false);
public static void generateGoToTryCatchBlockEndMarker(@NotNull InstructionAdapter v) {
v.invokestatic(INLINE_MARKER_CLASS_NAME, INLINE_MARKER_GOTO_TRY_CATCH_BLOCK_END, "()V", false);
}
public static boolean isFinallyEnd(@NotNull AbstractInsnNode node) {
return isFinallyMarker(node, INLINE_MARKER_FINALLY_END);
}
public static boolean isFinallyStart(@NotNull AbstractInsnNode node) {
return isFinallyMarker(node, INLINE_MARKER_FINALLY_START);
}
public static boolean isFinallyMarker(@Nullable AbstractInsnNode node) {
return isFinallyMarker(node, INLINE_MARKER_FINALLY_END) || isFinallyMarker(node, INLINE_MARKER_FINALLY_START);
}
public static boolean isFinallyMarker(@Nullable AbstractInsnNode node, String name) {
if (!(node instanceof MethodInsnNode)) return false;
MethodInsnNode method = (MethodInsnNode) node;
return INLINE_MARKER_CLASS_NAME.equals(method.owner) && name.equals(method.name);
}
public static boolean isFinallyMarkerRequired(@NotNull MethodContext context) {
return context.isInlineFunction() || context.isInliningLambda();
}
public static int getConstant(AbstractInsnNode ins) {
int opcode = ins.getOpcode();
Integer value;
if (opcode >= Opcodes.ICONST_0 && opcode <= Opcodes.ICONST_5) {
value = opcode - Opcodes.ICONST_0;
}
else if (opcode == Opcodes.BIPUSH || opcode == Opcodes.SIPUSH) {
IntInsnNode index = (IntInsnNode) ins;
value = index.operand;
}
else {
LdcInsnNode index = (LdcInsnNode) ins;
value = (Integer) index.cst;
}
return value;
public static boolean isGoToTryCatchBlockEnd(@NotNull AbstractInsnNode node) {
if (!(node.getPrevious() instanceof MethodInsnNode)) return false;
MethodInsnNode previous = (MethodInsnNode) node.getPrevious();
return node.getOpcode() == Opcodes.GOTO &&
INLINE_MARKER_CLASS_NAME.equals(previous.owner) &&
INLINE_MARKER_GOTO_TRY_CATCH_BLOCK_END.equals(previous.name);
}
public static class LabelTextifier extends Textifier {
@@ -471,37 +454,7 @@ public class InlineCodegenUtil {
"()V", false);
}
public static boolean isInlineMarker(AbstractInsnNode insn) {
return isInlineMarker(insn, null);
}
public static boolean isInlineMarker(AbstractInsnNode insn, String name) {
if (insn instanceof MethodInsnNode) {
MethodInsnNode methodInsnNode = (MethodInsnNode) insn;
return insn.getOpcode() == Opcodes.INVOKESTATIC &&
methodInsnNode.owner.equals(INLINE_MARKER_CLASS_NAME) &&
(name != null ? methodInsnNode.name.equals(name)
: methodInsnNode.name.equals(INLINE_MARKER_BEFORE_METHOD_NAME) ||
methodInsnNode.name.equals(INLINE_MARKER_AFTER_METHOD_NAME));
}
else {
return false;
}
}
public static boolean isBeforeInlineMarker(AbstractInsnNode insn) {
return isInlineMarker(insn, INLINE_MARKER_BEFORE_METHOD_NAME);
}
public static boolean isAfterInlineMarker(AbstractInsnNode insn) {
return isInlineMarker(insn, INLINE_MARKER_AFTER_METHOD_NAME);
}
public static int getLoadStoreArgSize(int opcode) {
return opcode == Opcodes.DSTORE || opcode == Opcodes.LSTORE || opcode == Opcodes.DLOAD || opcode == Opcodes.LLOAD ? 2 : 1;
}
public static boolean isStoreInstruction(int opcode) {
return opcode >= Opcodes.ISTORE && opcode <= Opcodes.ASTORE;
}
}

View File

@@ -18,15 +18,12 @@ package org.jetbrains.kotlin.codegen.inline;
import org.jetbrains.annotations.NotNull;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
public class InlineResult {
private final Set<String> classesToRemove = new HashSet<String>();
private final Map<String, String> changedTypes = new HashMap<String, String>();
private final ReifiedTypeParametersUsages reifiedTypeParametersUsages = new ReifiedTypeParametersUsages();
private InlineResult() {
@@ -47,19 +44,11 @@ public class InlineResult {
classesToRemove.add(classInternalName);
}
public void addChangedType(@NotNull String oldClassInternalName, @NotNull String newClassInternalName) {
changedTypes.put(oldClassInternalName, newClassInternalName);
}
@NotNull
public Set<String> getClassesToRemove() {
return classesToRemove;
}
public Map<String, String> getChangedTypes() {
return changedTypes;
}
@NotNull
public ReifiedTypeParametersUsages getReifiedTypeParametersUsages() {
return reifiedTypeParametersUsages;

View File

@@ -22,7 +22,7 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.ReadOnly;
import org.jetbrains.annotations.TestOnly;
import org.jetbrains.kotlin.codegen.optimization.common.CommonPackage;
import org.jetbrains.kotlin.codegen.AsmUtil;
import org.jetbrains.org.objectweb.asm.Label;
import org.jetbrains.org.objectweb.asm.Opcodes;
import org.jetbrains.org.objectweb.asm.Type;
@@ -44,10 +44,7 @@ public class InternalFinallyBlockInliner extends CoveringTryCatchNodeProcessor {
final AbstractInsnNode endInsExclusive;
private FinallyBlockInfo(
@NotNull AbstractInsnNode inclusiveStart,
@NotNull AbstractInsnNode exclusiveEnd
) {
private FinallyBlockInfo(@NotNull AbstractInsnNode inclusiveStart, @NotNull AbstractInsnNode exclusiveEnd) {
startIns = inclusiveStart;
endInsExclusive = exclusiveEnd;
}
@@ -131,21 +128,17 @@ public class InternalFinallyBlockInliner extends CoveringTryCatchNodeProcessor {
continue;
}
List<TryCatchBlockNodeInfo> currentCoveringNodesFromInnermost =
sortTryCatchBlocks(new ArrayList<TryCatchBlockNodeInfo>(getTryBlocksMetaInfo().getCurrentIntervals()));
checkCoveringBlocksInvariant(Lists.reverse(currentCoveringNodesFromInnermost));
if (currentCoveringNodesFromInnermost.isEmpty() ||
currentCoveringNodesFromInnermost.get(currentCoveringNodesFromInnermost.size() - 1).getOnlyCopyNotProcess()) {
List<TryCatchBlockNodeInfo> currentCoveringNodesFromOuterMost = getTryBlocksMetaInfo().getCurrentIntervals();
checkCoveringBlocksInvariant(currentCoveringNodesFromOuterMost);
if (currentCoveringNodesFromOuterMost.isEmpty() ||
currentCoveringNodesFromOuterMost.get(0).getOnlyCopyNotProcess()) {
curIns = curIns.getPrevious();
continue;
}
AbstractInsnNode markedReturn = curIns;
AbstractInsnNode instrInsertFinallyBefore = markedReturn.getPrevious();
AbstractInsnNode nextPrev = instrInsertFinallyBefore.getPrevious().getPrevious();
assert markedReturn.getNext() instanceof LabelNode : "Label should be occurred after non-local return";
LabelNode newFinallyEnd = (LabelNode) markedReturn.getNext();
final AbstractInsnNode instrInsertFinallyBefore = markedReturn.getPrevious();
AbstractInsnNode nextPrev = instrInsertFinallyBefore.getPrevious();
Type nonLocalReturnType = InlineCodegenUtil.getReturnType(markedReturn.getOpcode());
//Generally there could be several tryCatch blocks (group) on one code interval (same start and end labels, but maybe different handlers) -
@@ -153,30 +146,24 @@ public class InternalFinallyBlockInliner extends CoveringTryCatchNodeProcessor {
// Each group that corresponds to try/*catches*/finally contains tryCatch block with default handler.
// For each such group we should insert corresponding finally before non-local return.
// So we split all try blocks on current instructions to groups and process them independently
List<TryBlockCluster<TryCatchBlockNodeInfo>> clustersFromInnermost = InlinePackage.doClustering(
currentCoveringNodesFromInnermost);
List<TryBlockCluster<TryCatchBlockNodeInfo>> clustersFromInnermost = InlinePackage.doClustering(getCoveringFromInnermost());
Iterator<TryBlockCluster<TryCatchBlockNodeInfo>> tryCatchBlockIterator = clustersFromInnermost.iterator();
checkClusterInvariant(clustersFromInnermost);
int originalDepthIndex = 0;
List<TryCatchBlockNodeInfo> additionalNodesToSplit = new ArrayList<TryCatchBlockNodeInfo>();
while (tryCatchBlockIterator.hasNext()) {
TryBlockCluster<TryCatchBlockNodeInfo> clusterToFindFinally = tryCatchBlockIterator.next();
TryBlockCluster clusterToFindFinally = tryCatchBlockIterator.next();
List<TryCatchBlockNodeInfo> clusterBlocks = clusterToFindFinally.getBlocks();
TryCatchBlockNodeInfo nodeWithDefaultHandlerIfExists = clusterBlocks.get(clusterBlocks.size() - 1);
if (nodeWithDefaultHandlerIfExists.getOnlyCopyNotProcess()) {
//lambdas finally generated before non-local return instruction,
//so it's a gap in try/catch handlers
throw new RuntimeException("Lambda try blocks should be skipped");
}
FinallyBlockInfo finallyInfo = findFinallyBlockBody(nodeWithDefaultHandlerIfExists, getTryBlocksMetaInfo().getAllIntervals());
if (finallyInfo == null) continue;
originalDepthIndex++;
if (nodeWithDefaultHandlerIfExists.getOnlyCopyNotProcess()) {
additionalNodesToSplit.addAll(clusterBlocks);
continue;
}
instructions.resetLabels();
@@ -185,6 +172,7 @@ public class InternalFinallyBlockInliner extends CoveringTryCatchNodeProcessor {
//Creating temp node for finally block copy with some additional instruction
MethodNode finallyBlockCopy = createEmptyMethodNode();
Label newFinallyStart = new Label();
Label newFinallyEnd = new Label();
Label insertedBlockEnd = new Label();
boolean generateAloadAstore = nonLocalReturnType != Type.VOID_TYPE && !finallyInfo.isEmpty();
@@ -203,11 +191,13 @@ public class InternalFinallyBlockInliner extends CoveringTryCatchNodeProcessor {
!(currentIns instanceof JumpInsnNode) ||
labelsInsideFinally.contains(((JumpInsnNode) currentIns).label);
copyInstruction(finallyBlockCopy, currentIns, isInsOrJumpInsideFinally, originalDepthIndex);
copyInstruction(nextTempNonLocalVarIndex, markedReturn, instrInsertFinallyBefore, nonLocalReturnType, finallyBlockCopy,
currentIns, isInsOrJumpInsideFinally);
currentIns = currentIns.getNext();
}
finallyBlockCopy.visitLabel(newFinallyEnd);
if (generateAloadAstore) {
finallyBlockCopy.visitVarInsn(nonLocalReturnType.getOpcode(Opcodes.ILOAD), nextTempNonLocalVarIndex);
nextTempNonLocalVarIndex += nonLocalReturnType.getSize(); //TODO: do more wise indexing
@@ -219,7 +209,7 @@ public class InternalFinallyBlockInliner extends CoveringTryCatchNodeProcessor {
InlineCodegenUtil.insertNodeBefore(finallyBlockCopy, inlineFun, instrInsertFinallyBefore);
updateExceptionTable(clusterBlocks, newFinallyStart, newFinallyEnd,
tryCatchBlockInlinedInFinally, labelsInsideFinally, (LabelNode) insertedBlockEnd.info);
tryCatchBlockInlinedInFinally, labelsInsideFinally, (LabelNode) insertedBlockEnd.info, additionalNodesToSplit);
}
//skip just inserted finally
@@ -245,22 +235,38 @@ public class InternalFinallyBlockInliner extends CoveringTryCatchNodeProcessor {
}
private static void copyInstruction(
int nextTempNonLocalVarIndex,
@NotNull AbstractInsnNode curIns,
@NotNull AbstractInsnNode instrInsertFinallyBefore,
@NotNull Type nonLocalReturnType,
@NotNull MethodNode finallyBlockCopy,
@NotNull AbstractInsnNode currentIns,
boolean isInsOrJumpInsideFinally,
int depthShift
boolean isInsOrJumpInsideFinally
) {
if (isInsOrJumpInsideFinally) {
if (InlineCodegenUtil.isFinallyMarker(currentIns.getNext())) {
Integer constant = getConstant(currentIns);
finallyBlockCopy.visitLdcInsn(constant + depthShift);
//This condition allows another model for non-local returns processing
if (false) {
boolean isReturnForSubstitution =
InlineCodegenUtil.isReturnOpcode(currentIns.getOpcode()) && !InlineCodegenUtil.isMarkedReturn(currentIns);
if (!isInsOrJumpInsideFinally || isReturnForSubstitution) {
//substitute all local returns and jumps outside finally with non-local return
Type localReturnType = InlineCodegenUtil.getReturnType(currentIns.getOpcode());
substituteReturnValueInFinally(nextTempNonLocalVarIndex, nonLocalReturnType, finallyBlockCopy,
localReturnType, isReturnForSubstitution);
instrInsertFinallyBefore.accept(finallyBlockCopy);
curIns.accept(finallyBlockCopy);
} else {
currentIns.accept(finallyBlockCopy); //VISIT
}
}
else {
//keep original jump: add currentIns clone
finallyBlockCopy.instructions.add(new JumpInsnNode(currentIns.getOpcode(), ((JumpInsnNode) currentIns).label));
if (isInsOrJumpInsideFinally) {
currentIns.accept(finallyBlockCopy); //VISIT
}
else {
//keep original jump: add currentIns clone
finallyBlockCopy.instructions.add(new JumpInsnNode(currentIns.getOpcode(), ((JumpInsnNode) currentIns).label));
}
}
}
@@ -298,10 +304,11 @@ public class InternalFinallyBlockInliner extends CoveringTryCatchNodeProcessor {
private void updateExceptionTable(
@NotNull List<TryCatchBlockNodeInfo> updatingClusterBlocks,
@NotNull Label newFinallyStart,
@NotNull LabelNode newFinallyEnd,
@NotNull Label newFinallyEnd,
@NotNull List<TryCatchBlockNodePosition> tryCatchBlockPresentInFinally,
@NotNull Set<LabelNode> labelsInsideFinally,
@NotNull LabelNode insertedBlockEnd
@NotNull LabelNode insertedBlockEnd,
@NotNull List<TryCatchBlockNodeInfo> patched
) {
//copy tryCatchFinallies that totally in finally block
@@ -370,6 +377,7 @@ public class InternalFinallyBlockInliner extends CoveringTryCatchNodeProcessor {
getTryBlocksMetaInfo()
.split(endNode, new SimpleInterval((LabelNode) endNode.getNode().end.getLabel().info,
(LabelNode) insertedBlockEnd.getLabel().info), false);
//nextPrev = (AbstractInsnNode) insertedBlockEnd.getLabel().info;
}
handler2Cluster.clear();
@@ -377,20 +385,23 @@ public class InternalFinallyBlockInliner extends CoveringTryCatchNodeProcessor {
}
assert handler2Cluster.isEmpty() : "Unmatched clusters " + handler2Cluster.size();
SimpleInterval splitBy = new SimpleInterval((LabelNode) newFinallyStart.info, newFinallyEnd);
List<TryCatchBlockNodeInfo > toProcess = new ArrayList<TryCatchBlockNodeInfo>();
toProcess.addAll(patched);
toProcess.addAll(updatingClusterBlocks);
patched.clear();
SimpleInterval splitBy = new SimpleInterval((LabelNode) newFinallyStart.info, (LabelNode) newFinallyEnd.info);
// Inserted finally shouldn't be handled by corresponding catches,
// so we should split original interval by inserted finally one
for (TryCatchBlockNodeInfo block : updatingClusterBlocks) {
for (TryCatchBlockNodeInfo block : toProcess) {
//update exception mapping
SplitPair<TryCatchBlockNodeInfo> split = tryBlocksMetaInfo.splitAndRemoveInterval(block, splitBy, false);
checkFinally(split.getNewPart());
checkFinally(split.getPatchedPart());
tryBlocksMetaInfo.split(block, splitBy, false);
//block patched in split method
assert !block.isEmpty() : "Finally block should be non-empty";
patched.add(block);
//TODO add assert
}
sortTryCatchBlocks(tryBlocksMetaInfo.getAllIntervals());
sortTryCatchBlocks();
}
private static LabelNode getNewOrOldLabel(LabelNode oldHandler, @NotNull Set<LabelNode> labelsInsideFinally) {
@@ -401,6 +412,14 @@ public class InternalFinallyBlockInliner extends CoveringTryCatchNodeProcessor {
return oldHandler;
}
//Keep information about try blocks that cover current instruction -
// pushing and popping it to stack entering and exiting tryCatchBlock start and end labels
@Override
protected void updateCoveringTryBlocks(@NotNull LabelNode curIns, boolean directOrder) {
super.updateCoveringTryBlocks(curIns, directOrder);
checkCoveringBlocksInvariant(getTryBlocksMetaInfo().getCurrentIntervals());
}
private static boolean hasFinallyBlocks(List<TryCatchBlockNodeInfo> inlineFunTryBlockInfo) {
for (TryCatchBlockNodeInfo block : inlineFunTryBlockInfo) {
if (!block.getOnlyCopyNotProcess() && block.getNode().type == null) {
@@ -419,6 +438,15 @@ public class InternalFinallyBlockInliner extends CoveringTryCatchNodeProcessor {
@NotNull TryCatchBlockNodeInfo tryCatchBlock,
@ReadOnly @NotNull List<TryCatchBlockNodeInfo> tryCatchBlocks
) {
if (tryCatchBlock.getOnlyCopyNotProcess()) {
AbstractInsnNode start = new LabelNode();
AbstractInsnNode end = new LabelNode();
InsnList insnList = new InsnList();
insnList.add(start);
insnList.add(end);
return new FinallyBlockInfo(start, end);
}
List<TryCatchBlockNodeInfo> sameDefaultHandler = new ArrayList<TryCatchBlockNodeInfo>();
LabelNode defaultHandler = null;
boolean afterStartBlock = false;
@@ -447,42 +475,29 @@ public class InternalFinallyBlockInliner extends CoveringTryCatchNodeProcessor {
TryCatchBlockNodeInfo nextIntervalWithSameDefaultHandler = sameDefaultHandler.get(1);
AbstractInsnNode startFinallyChain = tryCatchBlock.getNode().end;
AbstractInsnNode meaningful = getNextMeaningful(startFinallyChain);
assert meaningful != null : "Can't find meaningful in finally block" + startFinallyChain;
Integer finallyDepth = getConstant(meaningful);
AbstractInsnNode endFinallyChainExclusive = nextIntervalWithSameDefaultHandler.getNode().start;
AbstractInsnNode current = meaningful.getNext();
while (endFinallyChainExclusive != current) {
current = current.getNext();
if (InlineCodegenUtil.isFinallyEnd(current)) {
Integer currentDepth = getConstant(current.getPrevious());
if (currentDepth.equals(finallyDepth)) {
endFinallyChainExclusive = current.getNext();
break;
}
}
}
AbstractInsnNode endFinallyChainExclusive = skipLastGotoIfNeeded(nextIntervalWithSameDefaultHandler.getNode().start);
FinallyBlockInfo finallyInfo = new FinallyBlockInfo(startFinallyChain.getNext(), endFinallyChainExclusive);
checkFinally(finallyInfo);
if (inlineFun.instructions.indexOf(finallyInfo.startIns) > inlineFun.instructions.indexOf(finallyInfo.endInsExclusive)) {
throw new AssertionError("Inconsistent finally: block end occurs before start " + traceInterval(finallyInfo.endInsExclusive, finallyInfo.startIns));
}
return finallyInfo;
}
private void checkFinally(FinallyBlockInfo finallyInfo) {
checkFinally(finallyInfo.startIns, finallyInfo.endInsExclusive);
}
@NotNull
private static AbstractInsnNode skipLastGotoIfNeeded(
@NotNull AbstractInsnNode lastFinallyInsExclusive
) {
private void checkFinally(IntervalWithHandler intervalWithHandler) {
checkFinally(intervalWithHandler.getStartLabel(), intervalWithHandler.getEndLabel());
}
AbstractInsnNode prevLast = getPrevNoLineNumberOrLabel(lastFinallyInsExclusive, true);
assert prevLast != null : "Empty finally block: " + lastFinallyInsExclusive;
private void checkFinally(AbstractInsnNode startIns, AbstractInsnNode endInsExclusive) {
if (inlineFun.instructions.indexOf(startIns) >= inlineFun.instructions.indexOf(endInsExclusive)) {
throw new AssertionError("Inconsistent finally: block end occurs before start " + traceInterval(endInsExclusive, startIns));
if (InlineCodegenUtil.isGoToTryCatchBlockEnd(prevLast)) {
return prevLast.getPrevious();
}
return lastFinallyInsExclusive;
}
@NotNull
@@ -520,11 +535,26 @@ public class InternalFinallyBlockInliner extends CoveringTryCatchNodeProcessor {
return result;
}
private static void substituteReturnValueInFinally(
int nonLocalVarIndex,
@NotNull Type nonLocalReturnType,
@NotNull MethodNode finallyBlockCopy,
@NotNull Type localReturnType,
boolean doPop
) {
if (doPop && localReturnType != Type.VOID_TYPE) {
AsmUtil.pop(finallyBlockCopy, localReturnType);
}
if (nonLocalReturnType != Type.VOID_TYPE) {
finallyBlockCopy.visitVarInsn(nonLocalReturnType.getOpcode(Opcodes.ILOAD), nonLocalVarIndex);
}
}
@Nullable
private static AbstractInsnNode getNextMeaningful(@NotNull AbstractInsnNode node) {
AbstractInsnNode result = node.getNext();
while (result != null && !CommonPackage.getIsMeaningful(result)) {
result = result.getNext();
private static AbstractInsnNode getPrevNoLineNumberOrLabel(@NotNull AbstractInsnNode node, boolean strict) {
AbstractInsnNode result = strict ? node.getPrevious() : node;
while (isLineNumberOrLabel(result)) {
result = result.getPrevious();
}
return result;
}

View File

@@ -21,11 +21,9 @@ import org.jetbrains.annotations.Nullable;
class InvokeCall {
private final int index;
public final LambdaInfo lambdaInfo;
public final int finallyDepthShift;
InvokeCall(int index, @Nullable LambdaInfo lambdaInfo, int finallyDepthShift) {
InvokeCall(int index, @Nullable LambdaInfo lambdaInfo) {
this.index = index;
this.lambdaInfo = lambdaInfo;
this.finallyDepthShift = finallyDepthShift;
}
}

View File

@@ -24,11 +24,11 @@ import org.jetbrains.kotlin.codegen.context.EnclosedValueDescriptor;
import org.jetbrains.kotlin.codegen.state.JetTypeMapper;
import org.jetbrains.kotlin.descriptors.ClassDescriptor;
import org.jetbrains.kotlin.descriptors.FunctionDescriptor;
import org.jetbrains.kotlin.descriptors.ReceiverParameterDescriptor;
import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor;
import org.jetbrains.kotlin.psi.JetExpression;
import org.jetbrains.kotlin.psi.JetFunctionLiteralExpression;
import org.jetbrains.kotlin.resolve.BindingContext;
import org.jetbrains.kotlin.resolve.DescriptorUtils;
import org.jetbrains.kotlin.resolve.jvm.AsmTypes;
import org.jetbrains.org.objectweb.asm.Type;
import org.jetbrains.org.objectweb.asm.tree.FieldInsnNode;
@@ -156,14 +156,7 @@ public class LambdaInfo implements CapturedParamOwner, LabelOwner {
//add skipped this cause inlined lambda doesn't have it
builder.addThis(AsmTypes.OBJECT_TYPE, true).setLambda(this);
FunctionDescriptor lambdaDescriptor = getFunctionDescriptor();
ReceiverParameterDescriptor extensionParameter = lambdaDescriptor.getExtensionReceiverParameter();
if (extensionParameter != null) {
Type type = typeMapper.mapType(extensionParameter.getType());
builder.addNextParameter(type, false, null);
}
List<ValueParameterDescriptor> valueParameters = lambdaDescriptor.getValueParameters();
List<ValueParameterDescriptor> valueParameters = getFunctionDescriptor().getValueParameters();
for (ValueParameterDescriptor parameter : valueParameters) {
Type type = typeMapper.mapType(parameter.getType());
builder.addNextParameter(type, false, null);
@@ -188,4 +181,3 @@ public class LambdaInfo implements CapturedParamOwner, LabelOwner {
}
}

View File

@@ -114,11 +114,7 @@ public class LocalVarRemapper {
StackValue value = remapInfo.value;
if (value instanceof StackValue.Local) {
if (remapInfo.parameterInfo != null) {
//All remapped value parameters can't be rewritten except case of default ones.
//On remapping default parameter to actual value there is only one instruction that writes to it according to mask value
//but if such parameter remapped then it passed and this mask branch code never executed
//TODO add assertion about parameter default value: descriptor is required
opcode = value.type.getOpcode(InlineCodegenUtil.isStoreInstruction(opcode) ? Opcodes.ISTORE : Opcodes.ILOAD);
opcode = value.type.getOpcode(Opcodes.ILOAD);
}
mv.visitVarInsn(opcode, ((StackValue.Local) value).index);
if (remapInfo.parameterInfo != null) {

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