Commit Graph

44 Commits

Author SHA1 Message Date
Alexander Udalov 7f5bc94117 Jvm-abi-gen: do not treat KmProperty.hasConstant as part of ABI
... for non-const properties.

The meaning of this flag for non-const properties is in reality not
well-established, and it can vary from one release to another. In
particular, it's different in K2.

This commit has two parts:
1) The test (added in 5891617674) about clinit is changed. Original
   motivation was to check that presence or absence of `<clinit>` is not
   a part of the ABI. However, in addition to that, the test also
   involuntarily checked that the aforementioned "hasConstant" flag for
   the property y/Object.y is the same in both cases (which I believe
   was not the intention) because these tests check that Kotlin metadata
   is _exactly the same_ after applying jvm-abi-gen. So I've changed it
   to be more straightforward: one version declares an obvious constant,
   while another declares an obvious non-constant. After this change,
   the test started to fail (even on K1) because the value of the
   "hasConstant" flag was different between two versions.
2) Remove "hasConstant" flag for non-const properties when transforming
   metadata via jvm-abi-gen. This fixes the test and assures it won't
   fail when the project is migrated to LV 2.0.

 #KT-60849 Fixed
2023-08-10 20:24:17 +00:00
Alexander Udalov 9f269b83aa Remove "legacy" mode of jvm-abi-gen plugin
#KT-55375 Fixed
2023-03-10 12:24:50 +00:00
Pavel Mikhailovskii 4c7f8ba196 KT-56457 Annotate Enum.entries with @NotNull 2023-02-09 20:13:56 +00:00
Dmitriy Novozhilov 88efa6bfb6 Update tests after switching to LV 1.9 2023-01-30 09:29:57 +00:00
pyos 34a49b3f56 jvm-abi-gen: only keep relevant InnerClasses from current module
If a class is not referenced by the ABI class file, its InnerClasses
entry should only be kept if it's the current class or a descendant
of the current class.
2022-12-28 14:42:33 +01:00
pyos d6fdd6734e jvm-abi-gen: sort inner classes 2022-12-28 14:42:33 +01:00
pyos 26a7ac6d92 jvm-abi-gen: keep InnerClass attributes for all referenced types
^KT-55233 Fixed
2022-12-28 14:42:33 +01:00
Alexander Udalov beb3759f5a Add jvm-abi-gen test on inline class with private ctor
KT-54897
2022-11-11 16:28:37 +00:00
pyos a30d19b655 jvm-abi-gen: consider private type aliases to be public API
They can be referenced from public declarations right now.

^KT-54500 Fixed
2022-10-31 22:13:21 +01:00
Alexander Udalov 97f63d539c Remove tests on jvm-abi-gen with old JVM backend
#KT-48532 Fixed
2022-09-16 00:16:31 +02:00
Alexander Udalov e83819e682 Minor, remove obsolete directives from jvm-abi-gen tests
Language version 1.6 was needed in these tests to enable annotation
instantiation, but that feature is now enabled by default.
2022-09-09 14:32:36 +02:00
Alexander Udalov 6e1cddd039 Disable @SourceDebugExtension generation in jvm-abi-gen tests
In these two tests, contents of the annotation differ by design, and
that does not constitute a difference in ABI.
2022-09-09 14:32:35 +02:00
Pavel Mikhailovskii 18e61315f4 KT-27936 Generate InnerClasses attributes 2022-08-23 22:06:10 +00:00
Steven Schäfer 78d80181e2 inlineClassUtils: Fix handling of inline classes without constructors
Fixes KT-50992

DeclarationDescriptor.isInlineClass misidentifies inline classes without
constructors. This can happen for the ABI of inline classes with private
constructors.
2022-02-04 23:30:24 +01:00
Steven Schäfer 05695761ec jvm-abi-gen: Add test to check the declaration order in interface jars 2021-12-01 19:20:47 +01:00
Steven Schäfer b8625cd233 jvm-abi-gen: Do not sort stripped methods and fields
The order is visible to annotation processors and should be considered
part of the ABI of a class.
2021-12-01 19:20:47 +01:00
Alexander Udalov aa247726b6 Prohibit using old JVM backend with LV >= 1.6
#KT-48928 Fixed
2021-09-30 13:56:34 +02:00
Steven Schäfer 6d518c8e57 JVM IR: Mark annotation implementation classes as anonymous
And add tests to ensure that annotation implementation classes are
handled correctly in jvm-abi-gen.
2021-08-23 18:25:33 +02:00
Steven Schäfer 19660f11a7 jvm-abi-gen: Remove WhenMapping classes from ABI if possible 2021-08-23 18:25:33 +02:00
Steven Schäfer ec4d7b2bb6 jvm-abi-gen: Add tests for uses of private Kotlin classes from Java 2021-08-23 18:25:33 +02:00
Steven Schäfer 6756420725 jvm-abi-gen: Add tests for KT-40133 and KT-40340 2021-08-23 18:25:33 +02:00
Steven Schäfer 5059513106 jvm-abi-gen: Strip inline functions in private classes
Inline functions in private classes can only be accessed from Java and
we do not need to preserve their bodies for the abi.
2021-08-23 18:25:33 +02:00
Steven Schäfer 3ffe495346 jvm-abi-gen: Mark all anonymous objects in inline function scope as public
Anonymous objects inside of a private inline function nested in a public
inline function can still escape.
2021-08-23 18:25:33 +02:00
Steven Schäfer c156613141 jvm-abi-gen: always keep annotation classes 2021-08-23 18:25:33 +02:00
Steven Schäfer 8efb955ab5 JVM: Add more tests to jvm-abi-gen 2021-08-23 18:25:33 +02:00
Steven Schäfer d08990ebb4 JVM: New single-pass implementation for jvm-abi-gen 2021-08-23 18:25:33 +02:00
Dmitry Petrov 89a0b3e944 Check class source in bytecode listing tests 2020-07-27 19:13:37 +03:00
Dmitry Petrov 0741781462 Compare inner class access flags in bytecode listing tests 2020-07-23 19:13:28 +03:00
Dmitry Petrov e9231b5624 JVM: Generate object and companion object INSTANCE fields as @NotNull 2020-06-22 16:28:00 +03:00
Kevin Bierhoff 0285b26e40 make FunctionCodegen skip method bodies we don't need, which avoids problems with inlining methods inside methods we don't need
KT-33604
2019-11-22 12:54:42 +03:00
Kevin Bierhoff bc207ed8db fix for KT-29471
#KT-29471 Fixed
2019-09-18 14:42:09 +03:00
Alexey Tsvetkov 57f8f216d1 Exclude local variables and try catch blocks of non-inline functions from ABI 2018-12-11 22:48:53 +03:00
Alexey Tsvetkov 495cfec9e9 Check descriptor visibility before excluding method from ABI class 2018-12-11 22:48:53 +03:00
Alexey Tsvetkov 09dbf427ee Disable removing private/synthetic/local classes temporarily 2018-12-11 22:48:53 +03:00
Alexey Tsvetkov 05c5196aaa Reuse BytecodeListingTextCollectingVisitor in tests 2018-12-11 22:48:53 +03:00
Alexey Tsvetkov d54ce2da6f Exclude nested classes of private classes from ABI classes 2018-12-11 22:48:53 +03:00
Alexey Tsvetkov 9dd09151f0 Add tests for compilation against abi classes 2018-12-11 22:48:53 +03:00
Alexey Tsvetkov 8992ee6280 Add tests for non-compatible ABI changes 2018-12-11 22:48:53 +03:00
Alexey Tsvetkov 5891617674 Exclude clinit from ABI classes 2018-12-11 22:48:53 +03:00
Alexey Tsvetkov 519211036d Exclude synthetic classes from ABI classes 2018-12-11 22:48:53 +03:00
Alexey Tsvetkov 3a29b337a0 Exclude private typealiases from ABI classes 2018-12-11 22:48:53 +03:00
Alexey Tsvetkov 1f5ca7274d Exclude local and private classes from ABI classes 2018-12-11 22:48:53 +03:00
Alexey Tsvetkov 7c2f7cab9a Exclude non-inline method bodies from ABI classes 2018-12-11 22:48:53 +03:00
Alexey Tsvetkov 903f6bc79b Exclude private members from ABI classes 2018-12-11 22:48:53 +03:00