Commit Graph

1396 Commits

Author SHA1 Message Date
Ian Lynagh
e7d1782eea Merge pull request #13088 from igfoo/igfoo/getTypeParameterParentLabel
Kotlin: Small simplification
2023-05-11 11:59:06 +01:00
Ian Lynagh
9764a8c348 Kotlin: Remove some redundant return statments 2023-05-09 16:25:59 +01:00
Ian Lynagh
24d7391f5b Kotlin: Remove ODASA_JAVA_LAYOUT support
This is no longer supported, and has never been used with Kotlin.
2023-05-09 16:25:37 +01:00
Ian Lynagh
968a78e3e6 Kotlin: Small simplification
Merge two `IrFunction` cases into one.
2023-05-09 16:25:20 +01:00
Ian Lynagh
fcf1f6a6f9 Kotlin: Don't use distutils in build script
We were getting
    DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
during the build.
2023-03-20 11:49:54 +00:00
Chris Smowton
3514dd1e4d Java: merge the @class and @interface database types and tables
This will allow the extractor to emit class(id, ...) when all it knows about a class is its name, due to not having it available on the classpath. Previously it would have had to guess whether it belonged to @class or @interface, possibly introducing an inconsistency.
2023-02-14 17:21:23 +00:00
Ian Lynagh
6255298876 Kotlin: Use 1.8.10 for CI
I don't think there's any need for the CI version to be one of the
versions we build extractors for, so I've removed that check.
2023-02-08 11:35:23 +00:00
Ian Lynagh
75562e7fb5 Kotlin: Remove legacy trap-locking support 2023-01-26 16:58:51 +00:00
Ian Lynagh
17de5c120a Kotlin: Make a couple of functions private 2023-01-16 15:29:14 +00:00
Ian Lynagh
20b35e5d02 Kotlin: 1.8.0 changes 2023-01-10 14:41:30 +00:00
Ian Lynagh
c4119761cc Kotlin: Another 1.8 build fix 2023-01-10 14:41:30 +00:00
Ian Lynagh
89b3363761 Kotlin: Bump CI version to 1.8.0-Beta 2023-01-10 14:41:30 +00:00
Ian Lynagh
f7d8d16ed3 Kotlin: Fix build for 1.8.0-Beta
The build no longer works for Kotlin < 1.8: We get

    error: class 'org.jetbrains.kotlin.ir.IrElement' was compiled
           with an incompatible version of Kotlin. The binary version
           of its metadata is 1.8.0, expected version is 1.6.0.
2023-01-10 14:41:29 +00:00
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