Commit Graph

1183 Commits

Author SHA1 Message Date
Chris Smowton
406a12e797 Remove unused function DeclarationStack.findFirst 2022-12-13 09:34:36 +00:00
Chris Smowton
dd86f7a696 Kotlin: Revert type erasure within $default functions
This imprecise implementation turned out to cause linkage errors, e.g. when type variables in the signatures of member methods were inappropriately erased. For the time being we accept that $default methods despite having erased signatures in keeping with their JVM representation can contain expressions whose types make reference to their
surrounding function or class' type variables, even though they should be out of scope since $default methods are static and don't have type parameters, and need to cope with the inconsistency in QL.
2022-12-12 18:33:22 +00:00
Chris Smowton
77004f3e15 Merge pull request #11258 from smowton/smowton/feature/kotlin-annotation-extraction
Kotlin: extract annotations
2022-12-12 09:52:49 +00:00
Chris Smowton
5282c86158 Apply review feedback 2022-12-09 18:07:14 +00:00
Ian Lynagh
1bf82cecfa Merge pull request #11602 from igfoo/igfoo/diaglimits
Kotlin: Improve diagnostic limit message
2022-12-09 14:05:47 +00:00
Chris Smowton
93ea433c49 Add missing imports 2022-12-09 10:33:06 +00:00
Chris Smowton
78234c52fd Ensure constructors don't get nullability annotations 2022-12-09 10:33:06 +00:00
Chris Smowton
f5dc5155f9 Don't introduce @NotNull on Kotlin methods that already have that annotation
This usually can't happen, but delegates pointing at Java appear to be synthesised with this normally-hidden annotation
2022-12-09 10:33:05 +00:00
Chris Smowton
01a5345660 Reimplement Deprecated annotation conversion suitable for older Kotlin versions 2022-12-09 10:33:05 +00:00
Chris Smowton
70ebb41d67 Restore nullability annotations
This is imperfect since arguments to those annotations will be missing, but at least the common case of a plain `@NotNull` or `@Nullable` will be right, and the `@NotNull`s introduced by the Kotlin compiler will be present as expected.
2022-12-09 10:33:05 +00:00
Chris Smowton
8bbb34a498 Convert kotlin.Deprecated back into a no-arg java.lang.Deprecated if applicable
This at least maintains consistency with the Java extractor, although we lose its arguments if any were supplied Java-side.
2022-12-09 10:33:05 +00:00
Chris Smowton
658c7a20cf Don't extract error expressions when a default value is missing
This is a shortcoming of the Kotlin extractor, but at least this way we don't introduce an inconsistency if the annotation is later seen from .kt source or by the Java extractor
2022-12-09 10:33:05 +00:00
Chris Smowton
5b2834c833 Restrict type access extraction to classes extracted from source
Type accesses have anonymous IDs, so we mimic the Java extractor and extract them only when seeing a class in a .kt source file.
2022-12-09 10:33:05 +00:00
Chris Smowton
0a788bcbc1 Don't extract return value type accesses for external annotations
This would cause inconsistencies when both the source and external view of the class are in scope, since the type access has a fresh id.
2022-12-09 10:33:05 +00:00
Chris Smowton
225913c49e Replace needless map call 2022-12-09 10:33:04 +00:00
Chris Smowton
80ef3a5290 Move meta-annotation support code out into its own class 2022-12-09 10:33:04 +00:00
Chris Smowton
c4ded5b4a7 Remove unused function 2022-12-09 10:33:04 +00:00
Chris Smowton
3dc9c2e57b Remove unnecessary unchecked cast 2022-12-09 10:33:04 +00:00
Chris Smowton
f9fc08bd40 Replace uses of the !! operator in borrowed code 2022-12-09 10:33:04 +00:00
Chris Smowton
81353f8654 Make annotation extraction compatible with all supported Kotlin versions 2022-12-09 10:33:04 +00:00
Chris Smowton
757fa60a46 Remove unused import 2022-12-09 10:33:04 +00:00
Chris Smowton
5c019940db Fix missing !! removal 2022-12-09 10:33:04 +00:00
Chris Smowton
ca27f9516a Replace uses of !! operator 2022-12-09 10:33:04 +00:00
Chris Smowton
eaa9595ea2 Restore type-accesses to annotation methods; accept test changes. 2022-12-09 10:33:03 +00:00
Chris Smowton
9e0eb56d77 Extract repeatable annotation container types, including synthetic containers 2022-12-09 10:33:03 +00:00
Chris Smowton
df90fc1a80 Disable type parameter annotation extraction pending a database change 2022-12-09 10:33:03 +00:00
Chris Smowton
9b3c07c32b Add annotation class meta-annotations per classes' expected JVM lowering 2022-12-09 10:33:03 +00:00
Chris Smowton
f7d2644d74 Re-enable extracting most annotations 2022-12-09 10:33:03 +00:00
Chris Smowton
26540111ce Factor out common code for referencing an external type 2022-12-09 10:33:03 +00:00
Chris Smowton
8781366fbe Only extract function annotations for unbound types
Note however this includes extracting annotations for external types, unlike the situation for function bodies.
2022-12-09 10:33:01 +00:00
Chris Smowton
06133e74a5 Handle generic annotations 2022-12-09 10:31:34 +00:00
Chris Smowton
d7213d2d82 Only convert KClass -> Class in annotation context 2022-12-09 10:31:34 +00:00
Chris Smowton
24434ed0ff Make annotation labelling consistent between Java and Kotlin
This gives all annotations and expressions derived from them globally-significant and stable names, enabling the Kotlin and Java extractors to see the same annotation without introducing database conflicts.
2022-12-09 10:31:34 +00:00
Tamas Vajk
df595c05f2 WIP: revert some annotation extraction to get proper tree in printast 2022-12-09 10:31:34 +00:00
Tamas Vajk
fed770fcd1 Move kotlin annotations to negative child index 2022-12-09 10:31:33 +00:00
Tamas Vajk
96a407c9c5 WIP: extract annotations for all declarations 2022-12-09 10:31:33 +00:00
Tamas Vajk
3e1d4a7400 Add more annotation tests, add KClass to Class substitution 2022-12-09 10:31:33 +00:00
Tamas Vajk
b73bfd6133 Compilation fixup 2022-12-09 10:31:33 +00:00
Tamas Vajk
3b09cb2224 WIP: Extract annotation values (tests are missing) 2022-12-09 10:31:33 +00:00
Tamas Vajk
7b075c2190 WIP: extract annotations on classes, with constant values 2022-12-09 10:31:33 +00:00
Tamas Vajk
9fa840106f Extract annotation declarations 2022-12-09 10:31:33 +00:00
Tamas Vajk
d93dce0fa9 Kotlin: Fix extension and dispatch parameter order in $default functions 2022-12-09 10:29:51 +01:00
Tamas Vajk
6457e059f5 Kotlin: Fix extraction of $default extension functions 2022-12-09 10:26:44 +01:00
Chris Smowton
a79126268c Override modality when needed
In particular when generating an implementation based on an abstract prototype, the result is final, and an interface forwarder is open / Java's default modality.
2022-12-08 14:39:57 +00:00
Chris Smowton
045e3a2cf3 Kotlin: extract callable modality 2022-12-08 12:22:50 +00:00
Ian Lynagh
6267da44ae Kotlin: Improve diagnostic limit message
The message saying that the limit was exceeded is now given at the same
severity as the original message.
2022-12-07 18:33:35 +00:00
Chris Smowton
522a549d61 Improve debug logging when the external decl extractor handles an IrFile 2022-12-06 20:39:14 +00:00
Chris Smowton
d2e7797485 Rename to writeStubTrapFile 2022-12-06 20:39:03 +00:00
Chris Smowton
00f323c8bd Fix: extract directly exposed fields with static modifier 2022-12-06 20:32:10 +00:00
Chris Smowton
82f3c2f6d5 Mark the Companion field as static 2022-12-06 18:35:04 +00:00