Commit Graph

56 Commits

Author SHA1 Message Date
Mikhail Glukhikh 672b5ba0d7 K2/Java: implement platform-dependent function filtering in JvmMappedScope
We drop Kotlin function 'remove' or 'getOrDefault' from JvmMappedScope,
if it has platform-dependent annotation, and the bound Java class scope
does not contain a function with the same signature.

#KT-57268 Fixed
2024-01-30 19:44:00 +00:00
vladislav.grechko 34bac48541 Add JVM ABI K1/K2 consistency tests 2023-12-26 10:18:19 +00:00
Alexander Udalov 968dfddbc9 Tests: adjust test data for bytecode listing tests
- remove obsolete `IGNORE_BACKEND: JVM` directives
- move contents of .ir.txt files to the corresponding .txt
2023-11-02 10:59:29 +00:00
Alexander Udalov 9ae16fd66e Tests: unmute bytecode listing tests for JVM_IR
Mute them for the old JVM backend instead. JVM IR behavior is fine in
all cases except maybe `destructured.kt`, for which there's now an issue
KT-63075.
2023-11-02 10:59:28 +00:00
Dmitriy Novozhilov 3b6ad36af1 [Test] Update/unmute tests after previous fixes
It's hard to tell which exact commit fixed each test
2023-10-17 12:46:28 +00:00
Alexander Udalov f0fba7be64 K2: add bytecode listing tests
#KT-57171 Fixed
2023-03-14 21:57:26 +01:00
Dmitriy Novozhilov 6b343515e1 [Test] Save IR bytecode dumps from BytecodeListingHandler to .ir.txt file instead of _ir.txt
This is needed to keep consistency with other dumps and to allow
  test helper plugin to recognize those dumps
2022-12-01 07:29:37 +00:00
Pavel Mikhailovskii 18e61315f4 KT-27936 Generate InnerClasses attributes 2022-08-23 22:06:10 +00:00
Dmitry Petrov 55d1fdfbc2 JVM_IR prevent clash of unsubstituted special bridges 2021-11-23 12:05:13 +00:00
Dmitry Petrov 30ceb49442 JVM_IR KT-48945 generate special bridge with unsubstituted signature 2021-11-17 17:44:01 +03:00
Ivan Kylchik c7435ba760 Replace all occurrences of WITH_RUNTIME with WITH_STDLIB
We are going to deprecate `WITH_RUNTIME` directive. The main reason
behind this change is that `WITH_STDLIB` directive better describes
its meaning, specifically it will add kotlin stdlib to test's classpath.
2021-11-17 15:26:38 +03:00
Alexander Udalov 1b98723b3f JVM IR: fix incorrect detection of interface method impls in Java
The problem in the test case was that `JImpl.entrySet` was detected by
ReplaceDefaultImplsOverriddenSymbols as a class fake override, which
overrides non-abstract interface method. Thus, overriddenSymbols of
`MyMap.entrySet` were changed in
`ReplaceDefaultImplsOverriddenSymbols.visitSimpleFunction`.

Later, BridgeLowering tried to determine which special bridges to
generate for `MyMap.<get-entries>`, and for that it inspected existing
methods and their overrides.

Normally we would generate the following special bridge:

    getEntries()Ljava/util/Set;
        invokespecial JImpl.entrySet()Ljava/util/Set;

However, because of incorrect overrides, the generated class method was
selected here instead of the expected `Map.<get-entries>`:
https://github.com/JetBrains/kotlin/blob/06001fc0919c814e757caa494891619882fae15f/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/BridgeLowering.kt#L282
and since the JVM signature of the generated class method is the same as
that of the fake override in MyMap, we never got to generating the
special bridge.

The solution is to skip Java classes when looking for class methods
which override non-abstract interface methods. This logic only makes
sense for Kotlin code, because only Kotlin has DefaultImpls, and the
requirement to generate non-abstract fake overrides of interface methods
as actual methods in the bytecode, delegating to DefaultImpls.

 #KT-48167 Fixed
2021-08-12 13:51:33 +02:00
Dmitry Petrov 4ec369ac5b JVM_IR fix special bridge generation for inline classes 2021-02-01 17:57:58 +03:00
Dmitry Petrov a157b58c61 JVM_IR KT-43610 keep track of "special bridges" for interface funs 2020-11-30 15:49:01 +03:00
Dmitry Petrov 498047e64e KT-43562 don't remap static inline class funs as special builtins 2020-11-25 17:31:46 +03:00
Dmitry Petrov ee5edf4caa JVM_IR fix 'remove' in inline class implementing MutableCollection 2020-10-16 00:02:12 +03:00
Dmitry Petrov 052f345a17 JVM_IR no generic signatures for abstract stubs KT-42609 2020-10-13 19:20:29 +03:00
Dmitry Petrov c8bf74c7d5 Bytecode listing test fails if JVM and JVM_IR have same testData 2020-10-13 19:20:29 +03:00
Dmitry Petrov df64bb3eb7 JVM_IR emulate JVM hack for generic signatures in KT-18189
KT-40307

See also KT-42609
2020-10-12 21:14:48 +03:00
Dmitry Petrov 91b8e32d43 Add ABI tests for classes extending Number and CharSequence 2020-10-09 16:36:35 +03:00
Dmitry Petrov a412596d8e JVM_IR emulate old back-end behavior in special bridges + inline classes
KT-42491 KT-42539
2020-10-09 16:06:08 +03:00
Dmitry Petrov e018f2bd3e JVM_IR more precise check for special bridges in super class
KT-41123
2020-10-02 12:51:49 +03:00
Dmitry Petrov d9906ae8da Minor: unmute some bytecode listing tests in JVM_IR 2020-09-28 21:48:14 +03:00
Dmitry Petrov 99dbeecc40 Some more bytecode listing tests for JVM_IR 2020-09-23 18:14:20 +03:00
Dmitry Petrov c03573fc18 JVM_IR fix override equivalence check for collection stub generation
KT-42043 KT-42033
2020-09-22 15:26:34 +03:00
Dmitry Petrov ee3ada4e55 JVM_IR KT-40304 KT-41998 special handling for 'removeAt' 2020-09-18 14:27:36 +03:00
Dmitry Petrov 54d5494ecd JVM_IR special handling for 'remove' collection method stub 2020-09-16 15:36:16 +03:00
Dmitry Petrov b395771d01 KT-37050 don't generate redundant special bridges
Loosely based on https://github.com/JetBrains/kotlin/pull/3662
2020-09-14 16:13:34 +03:00
Alexander Udalov b9243aad24 Minor, fix test data in bytecodeListing/specialBridges 2020-07-28 12:12:39 +02:00
Dmitry Petrov 89a0b3e944 Check class source in bytecode listing tests 2020-07-27 19:13:37 +03:00
Steven Schäfer 9d63412b3e JVM IR: Produce correct generic signatures for special bridge methods 2020-07-27 17:02:24 +02:00
Dmitry Petrov 0741781462 Compare inner class access flags in bytecode listing tests 2020-07-23 19:13:28 +03:00
Mikhail Bogdanov b8f0ad2111 Generate nullability annotations on this receiver in DefaultImpls. Don't generate nullability annotations in private methods
#KT-36969 Fixed
2020-06-19 11:57:35 +02:00
Alexander Udalov 5647a935a2 JVM IR: do not generate DefaultImpls delegate for collection fake overrides
In the newly added test, prior to this change, JVM IR was generating
DefaultImpls classes with calls to things like
`kotlin/collections/MutableList$DefaultImpls.spliterator` and other
default methods present in JDK 8+. This obviously didn't make much
sense. Although these weren't explicitly mentioned anywhere in the
bytecode, they caused some validation tools to report errors (e.g.
animalsniffer used in arrow).
2020-06-04 14:27:46 +02:00
Steven Schäfer 34fb636904 JVM: Generate generic signatures for delegate fields 2020-03-06 21:51:30 +01:00
Dmitry Petrov 84baa0b4c2 Check more flags in bytecode listing tests 2020-02-26 12:03:37 +03:00
Mark Punzalan b782e8f0f0 Add IR equivalent of AbstractBytecodeListingTest and muted failures. 2020-02-13 23:44:53 +03:00
Alexander Udalov f3f8db989a Fix test data for annotations on DefaultImpls members
After ea5505f80c, the annotations are now generated correctly
2017-12-27 14:12:14 +01:00
Dmitry Petrov 17d2472511 Do not patch generic signature for methods with special bridges
Somewhat awkward solution for KT-18189.
2017-05-31 10:18:48 +03:00
Dmitry Petrov fd00a6fbe8 Generate generic signatures for special bridges
#KT-12408 Fixed Target versions 1.1.4
2017-05-31 10:18:48 +03:00
Dmitry Petrov 48a60e6f39 Dump generic signatures in bytecode listing tests if required
Add '// WITH_SIGNATURES' to test file if generic signatures should be
dumped.
2017-05-31 10:18:48 +03:00
Denis Zharkov dfb9b323ff Avoid generation of redundant abstract special stubs
#KT-13698 Fixed
2016-10-07 11:59:15 +03:00
Denis Zharkov 6e838f0adc Avoid generation of redundant toArray stubs
#KT-13698 In Progress
2016-10-07 11:59:15 +03:00
Denis Zharkov 8ee568105c Do not generate collection stubs for Kotlin-specific signatures
#KT-14188 Fixed
2016-10-07 11:59:15 +03:00
Denis Zharkov 84eb009c29 Refine stubs generation for special built-ins
Do not generate stub if declaration has the same signature

 #KT-12909 Fixed
2016-06-30 20:12:34 +03:00
Denis Zharkov 5c34b27ea9 Fix stub generation for special built-ins
Do not generate stubs if there is no special bridge in the current class
- there are already Kotlin super class in hierarchy
- special bridge has the same signature as method itself

 #KT-11915 Fixed
2016-06-30 20:12:34 +03:00
Alexander Udalov 2200bfcc85 Simplify ImplementationBodyCodegen#generateToArray
- don't do anything for interfaces because there's no point in generating
  abstract methods which are already abstract in supertypes
- don't use getDeclaredFunctionByRawSignature, check function signature
  manually instead
- don't use isOrOverridesSynthesized because 'toArray' is never synthesized
2016-05-20 00:54:18 +03:00
Alexander Udalov b208995d73 Render different class kinds differently in bytecode listing test 2016-05-20 00:36:56 +03:00
Denis Zharkov 12552d2fc1 Refine special bridges generation
#KT-10958 Fixed
2016-02-10 20:18:46 +03:00
Alexander Udalov 5de1cf3bb4 Do not write old metadata annotations to bytecode 2016-02-06 15:53:55 +05:30