Commit Graph

886 Commits

Author SHA1 Message Date
Michael Bogdanov f4b7913dd3 sanitizeAsJavaIdentifier function moved to JvmAbi 2015-10-13 11:14:32 +03:00
Dmitry Petrov 7e9e427d4c Java 8 rules for method overrides:
- report errors on implementing methods of Any in interfaces
- update testData

~~~

Java 8 override restrictions: interface can't implement a method of 'Any'
- update compiler sources
2015-10-12 14:12:31 +03:00
Dmitry Jemerov 1523d5bcbf removing static type assertions work in progress 2015-10-12 11:11:23 +02:00
Denis Zharkov 6d864e0854 Adjust collection stubs generating to 'remove' transformation
See substitutedList* tests in Backend
2015-10-11 19:59:30 +03:00
Denis Zharkov 89ded4ab1d Implement hack to support both remove() and removeAt() in MutableList<Int>
Also add couple of tests about CharSequence.get
2015-10-11 19:57:22 +03:00
Denis Zharkov 742a538aed Support loading builtin methods from Java with different names 2015-10-11 19:57:22 +03:00
Denis Zharkov a98d1e1e55 Minor. Convert some properties to functions 2015-10-11 19:57:08 +03:00
Alexander Udalov 9d626ef1d9 Rename KotlinCallable annotation to KotlinFunction 2015-10-11 17:10:40 +03:00
Alexander Udalov d4320b43fa Delete useless class, simplify reading class visitor 2015-10-11 17:10:38 +03:00
Alexander Udalov 9e4823ef82 Write module name to metadata, fix reflection for file facades
Module name will be used for proper introspection of internal members
2015-10-11 17:10:37 +03:00
Alexander Udalov 790c59d9e5 Increase ABI & stub version
See previous commits for motivation
2015-10-11 17:10:36 +03:00
Alexander Udalov a4732b442d Don't create KClass and KPackage instances in <clinit>
This proved to be a fragile technique, which probably doesn't even improve
performance in most cases but has lots of unexpected problems: unconditional
initialization of reflection classes, increasing the size of the bytecode, bugs
with <clinit> in annotations on JVM 6, inability to support conversion of a
class from Kotlin to Java without recompiling clients which use it
reflectively, etc.
2015-10-11 17:10:35 +03:00
Alexander Udalov 8c4d7fdf24 Drop deprecated nested classes from Kotlin metadata annotations 2015-10-11 17:10:33 +03:00
Alexander Udalov 1c229d173e Forget old classes from jet.runtime.typeinfo.*, drop JetValueParameter 2015-10-11 17:10:32 +03:00
Alexander Udalov 934ffed944 Don't write field signatures when not necessary 2015-10-11 17:10:30 +03:00
Alexander Udalov 864926ee2e Don't always write JVM method signatures to metadata
When the trivial type mapping (implemented in JvmProtoBufUtil) from
ProtoBuf.Type instances works fine, don't write the signature since it can be
loaded by exactly the same trivial type mapping
2015-10-11 17:10:30 +03:00
Alexander Udalov aa95375029 Fix incorrect copy-paste during proto messages refactoring
Annotations on properties should be loaded not when the message is Property
(this happens for getters/setters as well), but when the kind is explicitly set
to PROPERTY. Also restore construction of JVM signatures for constructors
2015-10-11 17:10:26 +03:00
Alexander Udalov e4efa27b76 Drop Callable and primary/secondary constructor proto messages 2015-10-11 17:10:26 +03:00
Alexander Udalov 9bf0502a31 Load new proto messages for functions and properties 2015-10-11 17:10:24 +03:00
Denis Zharkov ad68378836 Support loading methods from Java as common properties overrides 2015-10-10 12:29:14 +03:00
Yan Zhulanow 1f2b4e20fe Replace get() and set() to getValue() and setValue() (property delegates) 2015-10-09 22:49:16 +03:00
Michael Bogdanov a3e0205aec JvmAbi increased 2015-10-09 16:25:19 +03:00
Michael Bogdanov 60d1736b97 Instance field generation in objects 2015-10-09 16:25:16 +03:00
Zalim Bashorov e9b138557b Report error when try to access to static field which come from many sources 2015-10-09 15:00:59 +03:00
Denis Zharkov 80da320c2c Customize JVM signature for Collection's members
- Do not write signature for `contains`
- Write signature for `containsAll` as it's declared like `containsAll(Collection<?>)`
2015-10-09 14:40:33 +03:00
Denis Zharkov 1f52dfccdb Setup specific loading contains/containsAll from java
If they override Kotlin collection members

contains(Object) -> contains(E)
containsAll(Collection<?>) -> containsAll(Collection<E>)
2015-10-09 14:40:33 +03:00
Zalim Bashorov ae2831338b Load Java static members from parents 2015-10-08 19:33:29 +03:00
Yan Zhulanow d90585624f Add 'DeprecationLevel' parameter to 'Deprecated' 2015-10-08 18:31:08 +03:00
Yan Zhulanow 937d1913b8 Automatically put 'operator' modifier on appropriate Java methods 2015-10-08 18:31:07 +03:00
Ilya Gorbunov 90e5ee8a7e Replace KotlinPackage legacy facade with corresponding package parts. 2015-10-07 22:36:29 +03:00
Mikhail Glukhikh 0cc861f00b Exposed visibility checking, a set of exposed visibility tests, some test fixes
Effective visibility mechanism introduced.
Local is considered as public, java protected as Kotlin protected, java package private as Kotlin private.
2015-10-07 20:15:16 +03:00
Michael Bogdanov 264d7da450 PACKAGE_VISIBILITY normalization chaged to PROTECTED 2015-10-07 18:10:55 +03:00
Michael Bogdanov 882f6113dc Initial internal member mangling 2015-10-07 18:10:54 +03:00
Denis Zharkov 6a1566a6dc Make JVM backend work with Collection.size as val
0. Such properties are called special because their accessor JVM name differs from usual one
1. When making call to such property, always choose special name
2. When generating Kotlin class inheriting such property generate `final bridge int size() { return this.getSize(); }`
3. If there is no `size` declaration in current class generate `bridge int getSize() { // super-call }`
2015-10-07 08:46:35 +03:00
Denis Zharkov 547aa2cda6 Load special java methods as properites
Currently only those that override special builtin properties (e.g. `Collection.size`)
Their modality is defined by method's modality
2015-10-06 23:56:17 +03:00
Denis Zharkov a02b64f0e3 Setup overridability rules for properties built on Java fields
- They overrides each other
- They do not overrides Kotlin propeties and vice versa
2015-10-06 23:56:17 +03:00
Denis Zharkov dfe93406d9 Minor. Inline parameter 2015-10-06 23:56:17 +03:00
Denis Zharkov 27b231cd7d Minor. Do not record method within resolveMethodToFunctionDescriptor 2015-10-06 23:56:17 +03:00
Alexander Udalov cb6d16d224 Advance ABI version after changes to binary format 2015-10-03 00:59:52 +03:00
Alexander Udalov bdd69d9e46 Use internal names in multifile class metadata
To reuse the strings already existing in the constant pool of the class file
2015-10-03 00:59:34 +03:00
Alexander Udalov 8c0a86617a Write JVM signatures to new protobuf messages 2015-10-03 00:59:33 +03:00
Alexander Udalov 4f21caecc4 Simplify AnnotationAndConstantLoader, use NameResolver from ProtoContainer 2015-10-03 00:59:32 +03:00
Alexander Udalov 14ec34e37c Refactor annotation and constant loader, simplify, drop some useless checks 2015-10-03 00:59:31 +03:00
Alexander Udalov 041af28166 Deprecate and don't write KotlinClass$Kind, to be removed later 2015-10-03 00:59:30 +03:00
Alexander Udalov 056bb3f833 Deprecate and don't write KotlinSyntheticClass$Kind, to be removed later 2015-10-03 00:59:28 +03:00
Alexander Udalov 5bb47c8365 Write KotlinInterfaceDefaultImpls annotation to DefaultImpls classes
Instead of KotlinSyntheticClass with kind = TRAIT_IMPL
2015-10-03 00:58:52 +03:00
Alexander Udalov e4090d3f30 Cleanup descriptors.proto, regenerate
- move enums and messages nested in Callable to top level, since they're likely
  to be reused in other messages soon
- delete obsolete comments: some did not any value, some became obsolete with
  custom options ("id in StringTable" -> name_id_in_table)
2015-10-02 20:30:55 +03:00
Pavel V. Talanov d5624708fb Add "java.io.Serializable" as supertype to java builtIns mapped to classes that are serializable on jvm
Implementation is hacky, relies on adding fictional supertype to corresponding classes
2015-10-01 17:53:16 +03:00
Pavel V. Talanov 76029ee9b2 Introduce JvmBuiltIns and DefaultBuiltIns, different instances of KotlinBuiltIns
Make KotlinBuiltIns an abstract class
JsPlatform has DefaultBuiltIns
2015-10-01 17:53:14 +03:00
Pavel V. Talanov 0ae842a05d 'descriptors' module exports 'deserialization', not the other way around
Also remove some of redundantly specified dependencies
2015-10-01 17:53:13 +03:00