Commit Graph

6615 Commits

Author SHA1 Message Date
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 Petrov 5d9ee7efee Java 8 rules for method overrides:
- base class method wins against a (default) interface method,
so an abstract base class method should always be implemented
in a derived class;

- interface methods clash regardless of abstract/default
with possibly undefined behavior at run-time,
so a class or interface should always define its own method
for methods inherited from multiple interfaces and not from base class;

- meaningful diagnostics for class inheriting conflicting JVM signatures.
Since no override will happen under Java 8 rules,
ACCIDENTAL_OVERRIDE is misleading for this case;

- update testData.
2015-10-12 14:12:31 +03:00
Mikhail Glukhikh 64543e3f52 Implicit Nothing return type is now deprecated 2015-10-12 13:30:16 +03:00
Dmitry Jemerov ead19076d7 stop calling propertyDelegated() method 2015-10-12 11:16:12 +02:00
Dmitry Jemerov 1523d5bcbf removing static type assertions work in progress 2015-10-12 11:11:23 +02:00
Denis Zharkov a76a8fcc3f Adjust various testData to remove/charAt transformation 2015-10-11 19:59:31 +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
Alexander Udalov 9d626ef1d9 Rename KotlinCallable annotation to KotlinFunction 2015-10-11 17:10:40 +03:00
Alexander Udalov 0218e0351b Deprecate KPackage, to be removed later 2015-10-11 17:10:37 +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
Denis Zharkov 97ed8c83a0 Adjust testData to isEmpty/key/value transformations 2015-10-10 12:29:15 +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
Mikhail Glukhikh 2fee9d362c Local interfaces are forbidden now 2015-10-09 21:06:33 +03:00
Mikhail Glukhikh d1ab5168ec Error messages about "var with open / custom setter initialization" changed accordingly with the new backing field syntax 2015-10-09 21:06:29 +03:00
Mikhail Glukhikh 6914d09297 Old backing field with dollar is now forbidden 2015-10-09 21:06:26 +03:00
Michael Bogdanov 8198ac77cb Generate private constructor for object
#KT-9510 Fixed
2015-10-09 16:25:20 +03:00
Michael Bogdanov a4997e8b31 backend tests: INSTANCE$ -> INSTANCE 2015-10-09 16:25:18 +03:00
Michael Bogdanov 7fe71d21f3 Initialize class companion object fields on accessing its java class 2015-10-09 16:25:16 +03:00
Michael Bogdanov 60d1736b97 Instance field generation in objects 2015-10-09 16:25:16 +03:00
Michael Bogdanov 12afbffb09 Copy to interface just companion object public const properties 2015-10-09 16:25:15 +03:00
Denis Zharkov e9cd9db2a7 Adjust testData after contains transformation 2015-10-09 14:40:34 +03:00
Denis Zharkov 35783f129b Generate INSTANCEOF barrier in bridges for Collection.contains 2015-10-09 14:40:33 +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
Alexander Udalov 448b3f6195 Rename testData/codegen/boxWithStdlib/{jdkAnnotations -> jdk} 2015-10-09 11:51:58 +02:00
Alexander Udalov 13c54a2678 Drop external annotations support in build tools
External annotations will only be considered in the IDE for additional
inspections based on more precise types in Java libraries
2015-10-09 11:51:58 +02:00
Zalim Bashorov c8f54b3ccb Fix the accessing to static field from Parent through Child 2015-10-08 19:33:29 +03:00
Zalim Bashorov ae2831338b Load Java static members from parents 2015-10-08 19:33:29 +03:00
Yan Zhulanow fd3c28c950 Forbid Foo<T>.Bar 2015-10-08 18:31:07 +03:00
Yan Zhulanow 2c848b8bb0 Add JvmSynthetic annotation 2015-10-08 18:31:06 +03:00
Yan Zhulanow 9eeb89a6aa Rename sparam to setparam 2015-10-08 18:31:06 +03:00
Ilya Gorbunov 43a74e575e Fix testData/codegen: replace deprecated sort usages. 2015-10-07 22:36:43 +03:00
Michael Bogdanov 882f6113dc Initial internal member mangling 2015-10-07 18:10:54 +03:00
Yan Zhulanow 1b01e7a85a Fix tests ('infix') 2015-10-07 15:50:23 +03:00
Mikhail Glukhikh fff434d377 data + open / inner / abstract / sealed are now forbidden 2015-10-07 15:13:14 +03:00
Mikhail Glukhikh cba6870f52 protected & internal are now forbidden in interfaces 2015-10-07 11:57:14 +03:00
Mikhail Glukhikh 846d7cac69 protected is deprecated inside objects and forbidden inside annotations and enum entries 2015-10-07 10:21:11 +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 252c82abe3 Generate bridges for FAKE_OVERRIDE properties
The same way it's done for function, just call generateBridges for accessors

 #KT-9442 Fixed
2015-10-07 08:46:34 +03:00
Denis Zharkov c21d827326 Adjust various testData to size transformation 2015-10-07 08:46:34 +03:00
Dmitry Jemerov 7c20630272 diagnostics for deprecated syntax of function type parameter list 2015-10-06 16:20:47 +02:00
Pavel V. Talanov 508b401603 Codegen: fix callable reference to member imported from object 2015-10-06 16:31:22 +03:00
Pavel V. Talanov 37d5c4b223 Allow to import members from object by name
Wrap object members so they do not require dispatch receiver
Hack jvm backend to make it work
2015-10-06 16:31:21 +03:00
Dmitry Petrov 4a3f53b322 Revert fbf2424838:
postpone "transparent semantics for spread operator"
until Java-related design issues are resolved (java.utils.Arrays#asList).
2015-10-06 13:48:59 +03:00
Dmitry Petrov fbf2424838 Spread should always copy arrays. 2015-10-06 10:07:12 +03:00
Dmitry Petrov 9e546bda27 Support is/as/as? with Function[K]<...> types. 2015-10-06 10:06:27 +03:00
Michael Nedzelsky 483110332c fix KT-431 Prohibit safe calls on namespaces, super etc
#KT-431 Fixed
2015-10-05 13:14:42 +03:00
Michael Bogdanov cd78514b76 Code clean, small refactorings and tests
#KT-8987 Fixed
2015-10-03 10:53:22 +03:00
Michael Bogdanov 3806ad65fc Fixed error with wrong parameter size calculation 2015-10-03 10:53:21 +03:00