Commit Graph

839 Commits

Author SHA1 Message Date
Alexander Udalov aea230d677 Introduce black box with Java codegen tests
In contrast to "black box against Java", it supports cyclic dependencies
between Java and Kotlin sources in one test case
2014-06-26 20:57:40 +04:00
Alexander Udalov 09863445bb Rename tests: boxWithJava -> boxAgainstJava 2014-06-26 20:57:40 +04:00
Andrey Breslav 777f3d1341 Codegen tests now fail on JVM-specific errors 2014-06-19 22:11:57 +04:00
Evgeny Gerashchenko aa41ae09ed Merge remote-tracking branch 'origin/master' into incremental 2014-06-19 11:43:59 +04:00
Andrey Breslav 512e4cb75e Support transient, strictfp and synchronized flags
#KT-4377 Fixed
2014-06-18 10:55:57 +04:00
Andrey Breslav 705a081919 KT-5214 Annotation to provide platform name to avoid signature conflict
#KT-5214 Fixed
2014-06-10 18:21:36 +04:00
Laszlo Hornyak 9dec0fb779 Correct the argument types of the StringBuilder.append
Modified AsmUtil to generate calls to more specific append methods
in the StringBuilder class in order to save computation time and make
less temporary objects.

Also adds unit-test to verify that the append(Object) method was
invoked 0 times while the append(String) 3 times

Signed-off-by: Laszlo Hornyak <laszlo.hornyak@gmail.com>
2014-06-02 16:34:44 +04:00
Mikhael Bogdanov 34e8cae89e KT-5112 - test file update 2014-06-02 15:21:28 +04:00
Mikhael Bogdanov c80901bafa KT-5112 Generic signature lost for a field copied from class object to containing class
#KT-5112 Fixed
2014-06-02 13:12:25 +04:00
Alexander Udalov d78d4bc44c Disallow extension properties with backing fields
#KT-1682 Fixed
2014-05-29 21:24:05 +04:00
Alexander Udalov 6210e45fbc Minor, improve test case for KT-1157
Multithreaded version was not working correctly and was throwing NPEs in the
log sometimes
2014-05-29 21:07:34 +04:00
Alexander Udalov 8a84d07645 Fix warnings in JVM codegen tests
Add generics where needed, add nullability annotations, etc.
Also delete some testcases from ArrayGenTest which will never be supported
2014-05-29 21:07:34 +04:00
Alexander Udalov cc94010d07 Fix broken test data file 2014-05-26 16:49:10 +04:00
Mikhael Bogdanov 69ef648005 Write outer class info for closures 2014-05-26 14:48:37 +04:00
Mikhael Bogdanov 449e26ce6d New tests for outer class info 2014-05-26 14:48:34 +04:00
Mikhael Bogdanov 950840b8c7 KT-5076 Error on inlining into object
#KT-5076 Fixed
2014-05-23 11:59:05 +04:00
Alexander Udalov 9760f30c99 Don't allow fake override to inherit implementation with wrong return type
#KT-4763 Fixed
2014-05-22 19:32:10 +04:00
Andrey Breslav 773cb9efbe Signature comparison used to find super functions in SignaturesPropagationData
#KT-4509 Fixed
2014-05-21 15:26:05 +04:00
Mikhael Bogdanov 6ad2814b01 Suppot inlining default methods, inlining function into its default. 2014-05-21 13:56:09 +04:00
Alexander Udalov af3d56b44e Fix JVM type mapping of arrays of type variables
#KT-4262 Fixed
 #KT-5056 Fixed
2014-05-20 19:22:53 +04:00
Alexander Udalov 8f7c0f0b65 Introduce KFunctionImpl, KMemberFunctionImpl, KExtensionFunctionImpl
Old 23*3 classes will be dropped, since they have no value.

Simplify JvmFunctionImplTypes significantly because of that
2014-05-19 19:50:59 +04:00
Alexander Udalov 5488a8402f Move and rename KFunctionImpl classes
Move from package "kotlin.reflect" to "kotlin.reflect.jvm.internal". They are
internal detail of the compiler and should not be used directly (especially now
that "kotlin.reflect" is in default import paths).

Also rename "KFunctionImplN" to "KFunctionNImpl", because this name makes more
sense
2014-05-19 19:50:58 +04:00
Alexander Udalov de8b2b3668 Fix generic signature for SAM adapters and constructors
SAM-related code in codegen was using JavaClassDescriptor directly, which has
an erased signature. Create and use a new abstraction SamType which has a full
generic signature of a type which was used in the SAM construct
2014-05-19 19:50:58 +04:00
Alexander Udalov 41eb0deaa0 Introduce FunctionImpl and ExtensionFunctionImpl classes
Old FunctionImpl0,1,2,... will be dropped since they had no purpose
2014-05-19 19:50:58 +04:00
Alexander Udalov c7a7f31e82 Introduce module 'reflection', move KFunctionN to it
Metadata for KFunction classes is now longer serialized along with built-in
classes. This effectively means that it's no longer possible to find KFunction
classes via dependency on built-ins. There should be a kotlin-runtime library
in the specified classpath for reflection types to be resolvable.

A lot of tests were moved and changed, because tests on callable references
require stdlib in classpath from now on
2014-05-19 19:50:57 +04:00
Mikhael Bogdanov 380f1875b8 Don't generate default method implementation in package facade (just delegation) 2014-05-16 18:34:07 +04:00
Mikhael Bogdanov c5e9ea0d29 Support anonymous object constructor transformation and inline 2014-05-16 15:55:08 +04:00
Mikhael Bogdanov 9007ba9c53 Anonymous object transformation 2014-05-16 13:33:57 +04:00
Mikhael Bogdanov 6fb0050575 KT-4982 this$0 is not initialized in the anonymous object
#KT-4982 Fixed
2014-05-16 13:33:39 +04:00
Alexander Udalov 3a0aac4857 Simplify type mapping logic in CodegenBinding
- inline asmType to calling getAsmType, which does something more
- refactor getJvmInternalName to use getAsmType as well
- simplify getAsmType and fix a probable bug in mapping singletons nested in
  enums (which wasn't reproduced, though a test is added)
- delete unnnecessary ASM_TYPE recording for enum entries in
  CodegenAnnotatingVisitor
2014-05-08 16:45:15 +04:00
Alexander Udalov 51b01b5d7d Replace some REFERENCE_TARGET calls with RESOLVED_CALL
Also don't do unnecessary and failing casts in CodegenAnnotatingVisitor for SAM
adapters

 #KT-3173 Fixed
 #KT-3999 Fixed
 #KT-4682 Fixed
2014-05-05 16:49:23 +04:00
Denis Zharkov cb1e762fc4 Optimizations of When expression with int constants:
Added test with dense constants (tableswitch should be used)
2014-04-25 18:17:37 +04:00
Denis Zharkov 3bc1c45fde Refactored tests for switch optimization of When expression 2014-04-25 18:17:36 +04:00
Denis Zharkov 95345a9bd4 Tests for switchOptimization: shuffled and added sparse version 2014-04-25 18:17:36 +04:00
Denis Zharkov 1952781e4b SwitchOptimization: generating `lookupswitch' opcode for 'when' in case of integral types 2014-04-25 18:17:36 +04:00
Denis Zharkov c73533d214 Switch Optimization 2014-04-25 18:16:24 +04:00
Alexander Udalov 61675de305 Optimize PropertyMetadataImpl instance creation
Create all property metadatas in <clinit> and save them to a static array
$propertyMetadata. Getter/setter of each delegated property will then just
obtain the corresponding instance from that array

 #KT-4232 Fixed
2014-04-24 16:10:15 +04:00
Alexander Udalov f7235e9d82 Fix abstract nested class in enums in JVM back-end
It caused InstantiationError because the enum had an incorrect ACC_ABSTRACT
flag
2014-04-24 16:10:13 +04:00
Alexander Udalov d913dfb1aa Correctly map declaration owner in JVM codegen
"context.contextKind()" was incorrect in
ExpressionCodegen.intermediateValueForProperty(), because it represents the
context of the call site, not the context of the property declaration

 #KT-4878 Fixed
2014-04-24 16:10:12 +04:00
Alexander Udalov fbf9f5f7d0 Don't generate bridges for equals(), hashCode(), toString()
Otherwise an assertion is failing in the algorithm which is related to an
inconsistency of java.lang.Object inheritance in JDR (KT-4890)
2014-04-24 16:10:12 +04:00
Alexander Udalov cdceaec79f Fix unjustified descriptorToDeclaration in bridge codegen
Delegated and synthesized members don't usually have a declaration as well as
fake overrides
2014-04-18 17:18:51 +04:00
Alexander Udalov 79e7ee91e4 Generate bridges for trait implementations properly
The intent was to keep the bridge codegen model as simple as possible: we
should be able to figure out all necessary bridges only by a minimal interface
that FunctionHandle provides (isAbstract, isDeclaration, getOverridden)

Add different tests for bridges

 #KT-318 Obsolete
2014-04-11 21:57:47 +04:00
Alexander Udalov b0db6a4526 Rewrite bridge generation to Kotlin, make it abstract 2014-04-11 21:57:46 +04:00
Alexander Udalov fc838dbb53 Refactor ImplementationBodyCodegen.getTraitImplementations()
Make it static, extract a method which finds an implementation in a trait for a
fake override
2014-04-11 21:57:46 +04:00
Alexander Udalov 28940256e3 Minor, add bytecode text test on bridges for fake overrides 2014-04-11 21:57:45 +04:00
Alexander Udalov 478766815d Consider all real functions, not only declarations in bridge codegen
There should be bridges to all of the functions present in bytecode
2014-04-11 21:57:45 +04:00
Alexander Udalov 04c237cc22 Generate bridges for fake overrides when needed
#KT-3985 Fixed
 #KT-4145 Fixed
2014-04-11 21:57:44 +04:00
Andrey Breslav f81bf5ea73 Do not add functions and properties with inferred types as script class memebrs 2014-04-01 12:25:31 +04:00
Mikhael Bogdanov e2f3a589e7 KT-3308 Support local generic functions in codegen
#KT-3308 Can'tReproduce
2014-04-01 11:18:16 +04:00
Mikhael Bogdanov 4269729b0a KT-3214: Verify error when get array convention is used with varargs
#KT-3214 Can'tReproduce
2014-04-01 11:18:16 +04:00