Commit Graph

1899 Commits

Author SHA1 Message Date
Pavel V. Talanov 4e29aad1c1 Rework invalid abi version reporting
KotlinClassFileHeader is aware of older annotations
Psi is not used to report invalid Abi version in CLI
2013-08-26 17:58:44 +04:00
Pavel V. Talanov 0f8d50b44f Fix default visibility for class object in eager and lazy resolve 2013-08-26 16:00:13 +04:00
Alexander Udalov 41254a926b Regenerate compileKotlinAgainstCustomJava testData 2013-08-26 16:00:12 +04:00
Alexander Udalov 760ec99315 Regenerate topLevelMemberInvocation testData
Add a source used to generate classes
2013-08-26 16:00:11 +04:00
Alexander Udalov 3bd9d9ee32 Regenerate CliTest.wrongAbiVersion test, add readme 2013-08-26 15:59:56 +04:00
Alexander Udalov 19299daacd Deserialize annotations on class object properties
Class object properties' backing fields are generated into static fields of the
containing class, not into fields of class object. For fields we now store the
flag which, if set, tells that this field should be looked for in the
containing class
2013-08-26 15:59:45 +04:00
Alexander Udalov 9cb19d17b0 Don't test line numbers on *Package classes
Package classes in line number tests only contain "1" as the first line number
of a single function, so there's no point in testing it. The test was failing
due to the latest changes in the order of generation of classfiles (first $src,
then facade)
2013-08-26 15:59:38 +04:00
Pavel V. Talanov 5f108905d1 Remove testing Kotlin signature from WriteSignatureTest 2013-08-26 15:59:34 +04:00
Alexander Udalov cfe9d78015 Deserialize annotations from package$src files if needed
For top-level members, we now write a FQ name of the package$src class which
has the member's annotations, and read the correct file in deserialization
2013-08-23 17:39:23 +04:00
Alexander Udalov 87d4e35388 Deserialize annotations on class properties w/o fields
Annotations on properties without backing fields are stored on a special
synthesized method inside the class
2013-08-23 17:39:21 +04:00
Alexander Udalov c853c9be03 Create empty method for annotated properties w/o fields
There was no place in bytecode where annotations on properties without backing
fields could be stored to. Now they're written on a synthetic empty void method
with a special name ("propertyName$annotations").

(Annotations on properties cannot simply be written on getters in bytecode,
since a getter can have annotations of its own.)
2013-08-23 17:39:21 +04:00
Alexander Udalov 23378f0054 Deserialize annotations on property accessors 2013-08-23 17:39:21 +04:00
Alexander Udalov 6ae81c3ade Store ABI version along with serialized descriptors
KotlinInfo annotation now has a version() field, which should be equal to the
compiler's JvmAbi.VERSION in order for this class to properly load and be used.

Create ErrorReporter class, which has a trace to which it can report errors
(now only related to ABI version). This is done because a dependency of
DeserializedDescriptorResolver from BindingTrace would be confusing.
Implementation of ErrorReporter will probably need to change when we untie
deserialization from java-resolve.

Check if PsiClass is actually a compiled class before trying to load serialized
data from it: otherwise it can be a Java source, as was in wrongAbiVersion()
test, and ASM will fail when trying to read that file. Rewrite the test so that
it now has a compiled Kotlin classes to check against (also include sources to
recompile this binary data later, although it won't probably be needed)
2013-08-23 17:39:20 +04:00
Alexander Udalov e63cef0848 Deserialize annotations on package members 2013-08-23 17:39:19 +04:00
Alexander Udalov 67ca7b78c4 Deserialize annotations on class members
Make 'Callable' message of descriptors.proto extensible, extend it in
java_descriptors.proto with a JVM signature of the member. This is needed in
order for annotation deserializer to find out which member in the compiled
bytecode corresponds to which descriptor in the hierarchy.

Create a new module 'serialization.java' containing everything related to
Java-specific serialization of descriptors.

Add an extension point to DescriptorSerializer, allowing to perform
platform-specific serialization on a callable
2013-08-23 17:39:18 +04:00
Alexander Udalov 4aeeafdff0 Deserialize annotations on classes
First version, not all kinds of value arguments of annotations are supported
2013-08-23 17:39:18 +04:00
Pavel V. Talanov a57f74c278 Introduce VariableDescriptorForObject interface
Add implementations
Use this interface instead of CLASS_OBJECT_DECLARATION key in BindingContext
2013-08-23 17:39:16 +04:00
Andrey Breslav 6cee65d74e A test for nesting implicitly labeled calls
The actual error message should be "return not allowed", but due to a bug in label resolution it is "unresolved reference"
2013-08-22 17:13:08 +04:00
Andrey Breslav 55eb994502 KT-3919 Automatic labeling of lambdas by receiving functions
#KT-3919 Fixed
2013-08-22 14:27:01 +04:00
Andrey Breslav a51ea10f55 No need to produce error types when RETURN_NOT_ALLOWED_EXPLICIT_RETURN_TYPE_REQUIRED is reported 2013-08-21 20:12:05 +04:00
Andrey Breslav 3f3ee378f3 Test that local return has type Nothing 2013-08-21 20:12:05 +04:00
Andrey Breslav aa99c29d8d JVM backend test for local returns 2013-08-21 20:12:05 +04:00
Andrey Breslav 08625a6b2f Local returns are only allowed with explicitly specified return types
This is a temporary limitation: otherwise type inference is having trouble to account for all the returned expressions.
 We will fix the inference and remove the limitation
2013-08-21 20:12:04 +04:00
Andrey Breslav 4138ac4e36 Support local returns in lambdas 2013-08-21 20:12:04 +04:00
Andrey Breslav db70087573 Labels on function literal arguments are processed properly 2013-08-21 20:12:04 +04:00
Andrey Breslav 9f90fd0938 No "unreachable code" errors when an illegal return expression is the last in a lambda 2013-08-21 20:12:04 +04:00
Andrey Breslav 3d28c4cdb2 Passing DataFlowInfo to local classes/objects
#KT-2835 In Progress
#KT-2225 In Progress
#KT-338 In Progress
2013-08-19 19:05:21 +04:00
Andrey Breslav 4908766813 Passing DataFlowInfo when analyzing property initializers
#KT-2835 In Progress
#KT-2225 In Progress
#KT-338 In Progress
2013-08-19 19:05:21 +04:00
Andrey Breslav 63c284e200 Passing DataFlowInfo to local classes/objects
#KT-2835 In Progress
#KT-2225 In Progress
#KT-338 In Progress
2013-08-19 19:05:20 +04:00
Mikhael Bogdanov 185b5013fe Properly process nested try and loop blocks
KT-3894: Loops and finally: finally block executed twice when break and return exists in try/finally block
KT-3874: Compilation error on try catch block contains break and continue
KT-3869: Loops and finally: outer finally block not run

 #KT-3869 Fixed
 #KT-3894 Fixed
 #KT-3874 Fixed
2013-08-19 16:06:56 +04:00
Mikhael Bogdanov d0f042ba93 Properly generate exception table for try/catch block
KT-3549 'Finally' block not run when re-throwing exception
KT-3867 When catched exception occurs in finnaly block it invokes additional catch and itself

  #KT-3549 Fixed
  #KT-3867 Fixed
2013-08-19 16:06:56 +04:00
Mikhael Bogdanov c9215ed8a5 KT-2784 VerifyError when passing a value to a class object's super type constructor
#KT-2784 Fixed
2013-08-12 18:58:09 +04:00
Evgeny Gerashchenko 3f7627120b KT-3853 ISE on resolving function implementation from trait from Java
The fix is simple and dirty, because the related code will be removed soon anyways. Fix is necessary for compiling Kara.

 #KT-3853 fixed
2013-08-08 21:39:25 +04:00
Mikhael Bogdanov 8a4b01d9c6 KT-3702: Inner class constructor cannot be invoked in override function with receiver
KT-3532: NoSuchMethodError when constructing Java inner class
KT-3847: Class is not recognized as inner when loaded from binaries

 #KT-3702 Fixed
 #KT-3532 Fixed
 #KT-3847 Fixed
2013-08-06 10:58:27 +04:00
Natalia.Ukhorskaya 8e45bb7657 Fix wrong generated class name invoking inner objects from another module 2013-08-06 10:17:25 +04:00
Natalia.Ukhorskaya acf8c88cfc Java property as annotation parameter 2013-08-02 18:59:29 +04:00
Natalia.Ukhorskaya e792238cbe Boolean as annotation parameter (java) 2013-08-02 18:59:27 +04:00
Natalia.Ukhorskaya 064f114b25 Allow top-level properties or properties from class object as annotation parameters 2013-08-02 18:59:26 +04:00
Natalia.Ukhorskaya 27801d5351 Add test: primitive values as annotation parameter 2013-08-02 18:59:25 +04:00
Evgeny Gerashchenko 7f62b9259c KT-3820 VerifyError when invoking intrinsic for range obtained from collection
#KT-3820 fixed
2013-07-31 15:54:45 -07:00
Natalia.Ukhorskaya b3f0a23c1d Fix android test: cannot change package name 2013-07-29 11:36:47 +04:00
Natalia.Ukhorskaya e11f130278 'annotation' keyword should be allowed only on classes
#KT-2785 Fixed
2013-07-25 17:00:10 +04:00
Natalia.Ukhorskaya 09b163069f Check Retention annotation writing annotations in bytecode 2013-07-25 17:00:04 +04:00
Natalia.Ukhorskaya c11bd7104c Write default values for annotation parameters
#KT-3197 Fixed
2013-07-25 16:44:03 +04:00
Natalia.Ukhorskaya 73000ec407 Change error message for nullable annotation member 2013-07-25 13:25:02 +04:00
Andrey Breslav 8c1da8929b Fix test data (accidentally committed rubbish) 2013-07-23 17:43:33 +04:00
Andrey Breslav d2b1b2e549 Allow newline before : as as? ?: || && 2013-07-23 14:21:36 +04:00
Yakov Zaytsev bb364cd393 KT-3771 Fixed 2013-07-22 18:49:56 +04:00
Svetlana Isakova 539756ff3e KT-3772 Invoke and overload resolution ambiguity
#KT-3772 Fixed
2013-07-16 20:33:08 +04:00
Evgeny Gerashchenko 13849f6b6e Choosing most specific super member when building fake override. Previously, random one was chosen. 2013-07-12 21:09:22 +04:00