Commit Graph

13 Commits

Author SHA1 Message Date
Mikhael Bogdanov
b73be50e5b Move object initialization from <init> to <clinit>
Codegen generates static backing fields for object properties.
  They are initialized in class constructor but some of them are final static
  and such access is prohibited in specification but it's allowed in
  java bytecode <= 1.8. Such access in 1.9 bytecode cause
  "IllegalAccessError: Update to static final field Object.INSTANCE
  attempted from a different method (<init>) than the initializer method <clinit>"

  Added additional hidden field in interface companion to pass out
  companion instance from <clinit>.

 #KT-15894 Fixed
2017-10-11 19:20:24 +03:00
Denis Zharkov
b3f66c7641 Remove $ character from fake continuation parameter
The reason is that when it gets captured into the field
having name $$continuation inliner fails with an exception
as it skips fields starting with '$$'

At the same time it doesn't really matter how to call
that parameter because it's only visible in Java

 #KT-17585 In Progress
 #KT-16603 In Progress
2017-05-05 14:14:37 +03:00
Ilya Gorbunov
99504eb753 Support rendering receiver parameters
Otherwise generated coroutine implementation class could not be rendered since one of its members corresponds to receiver parameter descriptor.
2017-04-27 16:38:25 +03:00
Denis Zharkov
8fa8ba7055 Move coroutine-related runtime parts to kotlin.coroutines.experimental package
#KT-15975 Fixed
2017-01-27 23:24:13 +03:00
Denis Zharkov
75174b4fba Fix issue on dumping override of suspend function
The meaning of `setDropOriginalInContainingParts()` call is that
it makes copyBuilder forget the original parts, in particular
the valueParameter.original.containingDeclaration does not reference
original descriptor no more

Otherwise the following exception is happening:
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
	at java.util.ArrayList.RangeCheck(ArrayList.java:547)
	at java.util.ArrayList.get(ArrayList.java:322)
	at org.jetbrains.kotlin.descriptors.impl.ValueParameterDescriptorImpl.getOverriddenDescriptors(ValueParameterDescriptorImpl.kt:119)
	at java.util.ArrayList.RangeCheck(ArrayList.java:547)
	at java.util.ArrayList.get(ArrayList.java:322)
	at org.jetbrains.kotlin.descriptors.impl.ValueParameterDescriptorImpl.getOverriddenDescriptors(ValueParameterDescriptorImpl.kt:119)
	at org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt$hasDefaultValue$1.getNeighbors(DescriptorUtils.kt:192)
	at org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt$hasDefaultValue$1.getNeighbors(DescriptorUtils.kt)
	at org.jetbrains.kotlin.utils.DFS.doDfs(DFS.java:98)
	at org.jetbrains.kotlin.utils.DFS.doDfs(DFS.java:99)
	at org.jetbrains.kotlin.utils.DFS.dfs(DFS.java:27)
	at org.jetbrains.kotlin.utils.DFS.dfs(DFS.java:37)
	at org.jetbrains.kotlin.utils.DFS.ifAny(DFS.java:47)
	at org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt.hasDefaultValue(DescriptorUtils.kt:189)
	at org.jetbrains.kotlin.renderer.DescriptorRendererImpl.renderValueParameter(DescriptorRendererImpl.kt:803)
	at org.jetbrains.kotlin.renderer.DescriptorRendererImpl.renderValueParameters(DescriptorRendererImpl.kt:767)
	at org.jetbrains.kotlin.renderer.DescriptorRendererImpl.renderFunction(DescriptorRendererImpl.kt:683)
	at org.jetbrains.kotlin.renderer.DescriptorRendererImpl.access$renderFunction(DescriptorRendererImpl.kt:42)
	at org.jetbrains.kotlin.renderer.DescriptorRendererImpl$RenderDeclarationDescriptorVisitor.visitFunctionDescriptor(DescriptorRendererImpl.kt:1039)
	at org.jetbrains.kotlin.renderer.DescriptorRendererImpl$RenderDeclarationDescriptorVisitor.visitFunctionDescriptor(DescriptorRendererImpl.kt:1002)
	at org.jetbrains.kotlin.descriptors.impl.FunctionDescriptorImpl.accept(FunctionDescriptorImpl.java:760)
2016-12-22 11:08:42 +03:00
Mikhail Zarechenskiy
0134b8819b Optimize const vals by inlining them at use sites
#KT-11734 Fixed
 #KT-13570 Fixed
2016-12-05 22:11:33 +03:00
Alexander Udalov
69343549b7 Move TEST_MODULE_NAME to KotlinTestUtils and change value to "test-module"
This name is more generic and thus can be used everywhere, not only in Java
integration tests
2016-05-26 11:47:30 +03:00
Alexander Udalov
1b79770121 Do not produce trailing space when rendering root package header 2016-05-20 14:53:07 +03:00
Dmitry Petrov
583733be8d KT-11645 properly handle private property getter name mangling in reflection 2016-04-14 09:31:29 +03:00
Dmitry Petrov
1d87595dc9 binary compat validator: update testData for changes related to new facade generation 2016-04-01 10:13:22 +03:00
Alexander Udalov
4a533168d9 Rework const val generation in multifile classes
Do not query MultifileClassCodegen#classBuilder early on: this causes the class
file for the facade to be prematurely dumped to the disk in some cases, when
that class file is not yet completely generated. Instead fork the logic in
PropertyCodegen#generateSyntheticMethodIfNeeded: save metadata in parts,
generate method in the facade
2016-03-29 17:53:32 +03:00
Ilya Gorbunov
768da05ba9 Update dump declaration mappings tests to reflect new constant generation in multifile facades. 2016-03-29 14:34:32 +03:00
Ilya Gorbunov
25abdf9fdb Tests for declaration mappings dumping from compiler 2016-03-29 13:49:36 +03:00