Commit Graph

319 Commits

Author SHA1 Message Date
Tamas Vajk
25098ef2d8 Kotlin: Extract type alias doc comments 2022-08-22 12:31:13 +02:00
Ian Lynagh
7b33aebe1f Kotlin: Refactor TypeResults
We statically know when we expect to have no signature, so now we tell
the type system what we know, rather than having signature always be
nullable.
2022-08-16 17:42:47 +01:00
Ian Lynagh
d06b3a17bb Kotlin: Remove a non-null-expr 2022-08-15 15:01:48 +01:00
Chris Smowton
8c32758ae5 Merge pull request #9829 from smowton/smowton/fix/kotlin-underscore-parameter-names
Kotlin: Don't extract a name for a '_' parameter
2022-08-10 12:28:26 +01:00
Chris Smowton
5086841b46 Kotlin: implement super-method calls
If we only look at the dispatch receiver, these show up like `this` references rather than `super` references, preventing flow through super-calls. The super-interface case requires properly noting that interface methods with a body get a `default` modifier in order to avoid QL discarding the method as a possible callee.
2022-07-26 17:03:46 +01:00
Chris Smowton
1cbe26a54f Kotlin: fix for-loop iterators over primitive or wildcard types
Array<*> can't be queried for an argument type, and IntArray doesn't have an argument at all; both were previously causing the extractor to fail to extract the whole file due to throwing an exception.
2022-07-21 09:13:55 +01:00
Chris Smowton
41ca791966 Implement is-underscore-parameter for old versions of Kotlin 2022-07-15 12:36:37 +01:00
Chris Smowton
d4b0163c4c Kotlin: Don't extract a name for a '_' parameter
I can't reproduce the exact circumstances, but these sometimes get "<anonymous parameter X>" names and sometimes get "$noName_X" names. Whichever way, avoiding extracting a synthetic name seems safest; anyone finding the .class file and not reading the metadata indicating it came from a `_` will extract the binary name selected, or else QL will
invent a name.
2022-07-14 16:36:26 +01:00
Chris Smowton
b499ba5aa8 Kotlin: don't extract private setters of external classes
Previously these would get extracted unlike other private methods even if the class was a standard library or other external class. This could cause inconsistencies because if we also compiled the class from source we could end up deciding different names for the property's setter: setXyz$private when seen from source, and setXyz without a
suffix when seen as an external .class file. Avoiding extracting these functions from the external perspective both restores consistency with other kinds of method and avoids these consistency problems.
2022-07-01 15:44:17 +01:00
Chris Smowton
df78b7e54b Merge pull request #9755 from smowton/smowton/feature/implement-jvmstatic-annotation
Kotlin: support JvmStatic annotation
2022-07-01 10:14:08 +01:00
Ian Lynagh
83fd9c3b3e Merge pull request #9763 from igfoo/igfoo/foreach
Kotlin: Replace a map call with forEach
2022-06-30 15:02:57 +01:00
Ian Lynagh
0e56e50d18 Kotlin: Replace a map call with forEach 2022-06-30 13:50:22 +01:00
Chris Smowton
98761041f1 Prevent labelling proxies of default getters and setters as themselves default getters and setters 2022-06-30 13:11:00 +01:00
Chris Smowton
bf581b971c Rename willExtract properties to shouldExtract 2022-06-30 12:51:09 +01:00
Chris Smowton
5a47e1dd95 Annotate generated static proxy methods as compiler-generated 2022-06-30 12:48:11 +01:00
Chris Smowton
bfdb21d551 Kotlin: support JvmStatic annotation
This makes non-companion object methods into static methods, and for companion objects introduces static proxy methods that call the companion instance method.

Note this doesn't quite implement what kotlinc does, since it will also eliminate getters and setters by promoting an object field into a static field, but our translation is simpler and only differs in private members' details.
2022-06-30 12:42:38 +01:00
Chris Smowton
8e5bbea9f9 Use map...firstOrNull not firstNotNullOfOrNull
The latter was introduced in Kotlin 1.5, so we can't use it in all supported versions.
2022-06-30 10:15:44 +01:00
Chris Smowton
2d98eb591e Kotlin: note that raw inner classes nest within a raw outer.
Previously the Java extractor did this but the Kotlin extractor nested them within an unbound outer type.
2022-06-30 10:15:44 +01:00
Ian Lynagh
780f5abc67 Merge pull request #9724 from igfoo/igfoo/private
Kotlin: Make more methods private
2022-06-28 10:21:55 +01:00
Ian Lynagh
b6790ef735 Merge pull request #9725 from igfoo/igfoo/inline
Kotlin: Extract inlineability of functions
2022-06-28 10:21:30 +01:00
Ian Lynagh
06060954ec Kotlin: Extract inlineability of functions 2022-06-27 19:25:56 +01:00
Ian Lynagh
4e4b34290b Kotlin: Make more methods private 2022-06-27 18:20:33 +01:00
Ian Lynagh
7430a413ad Kotlin: Mark DELEGATED_PROPERTY_ACCESSORs as compiler-generated 2022-06-27 17:57:40 +01:00
Ian Lynagh
861a368734 Merge pull request #9703 from igfoo/igfoo/generated
Kotlin: Record more kinds of elements as compiler-generated
2022-06-24 19:46:56 +01:00
Ian Lynagh
0ddd5bb162 Merge pull request #9709 from igfoo/igfoo/isLocalFunction
Kotlin: Let useFunction worry about isLocalFunction for us
2022-06-24 19:22:43 +01:00
Ian Lynagh
4791aaae52 Kotlin: Use an enum for compiler-generated-kinds
For now this is in KotlinFileExtractor, but we can move it out later if
we have generated things elsewhere.
2022-06-24 15:19:50 +01:00
Ian Lynagh
c0b6d1d093 Kotlin: Let useFunction worry about isLocalFunction for us 2022-06-24 14:24:02 +01:00
Ian Lynagh
20817a54da Kotlin: Mark enum class special members as cmopiler-generated 2022-06-24 14:00:47 +01:00
Ian Lynagh
50eeb47244 Kotlin: Mark <clinit> as compiler-generated 2022-06-24 14:00:47 +01:00
Ian Lynagh
c06eb09100 Kotlin: Record that DEFAULT_PROPERTY_ACCESSOR are compiler-generated 2022-06-24 14:00:47 +01:00
Ian Lynagh
5fc294d49e Kotlin: Record that generated data class members are compiler-generated 2022-06-24 14:00:47 +01:00
Tamás Vajk
381bcf7dad Merge pull request #9153 from tamasvajk/kotlin-simplify-loop-breaks-1
Kotlin: Unify loop `break`/`continue` statement handling between java and kotlin
2022-06-24 14:45:57 +02:00
Chris Smowton
d0e521ef4a Merge pull request #9681 from smowton/smowton/fix/reintroduce-obinit
Kotlin: reintroduce obinit when we have multiple secondary constructors and no primary
2022-06-24 10:25:24 +01:00
Chris Smowton
fcc8691394 Merge pull request #9625 from smowton/smowton/test/kotlin-1-7-support
Switch to using Kotlin 1.7 by default
2022-06-24 10:24:54 +01:00
Ian Lynagh
eb1b3f801d Merge pull request #9689 from igfoo/igfoo/makeprivate
Kotlin: Make some more methods private
2022-06-23 21:28:07 +01:00
Ian Lynagh
bd8a8d00aa Kotlin: Make some more methods private 2022-06-23 16:44:06 +01:00
Chris Smowton
b5010337a4 Avoid extracting needless obinit methods where we're only extracting a class' outline. 2022-06-23 16:26:54 +01:00
Chris Smowton
3cf7f96298 Ensure <obinit>'s return type is void not Unit 2022-06-23 16:26:54 +01:00
Chris Smowton
af5230349b Kotlin: reintroduce obinit when we have multiple secondary constructors and no primary
This avoids DB inconsistencies because complex initialisers are extracted to more than one function.
2022-06-23 16:26:54 +01:00
Chris Smowton
8c57308661 Prevent extracting hidden functions
I'm not sure how these looked in 1.6 and below yet, but in 1.7 they appear with visibility = public, but a descriptor field set to indicate they have a name clash with a 'real' function.
2022-06-23 15:34:40 +01:00
Tamas Vajk
dabc956dbf Unify loop break/continue statement handling between java and kotlin 2022-06-23 08:45:11 +02:00
Chris Smowton
4b825df60c Kotlin: don't emit synthetic parameter names
The QL library already expects these to be missing in some cases and generates its own names when they are absent. Writing synthetic names to the database can produce inconsistencies if the true name is seen later.
2022-06-20 19:19:35 +01:00
Ian Lynagh
875776d91d Merge pull request #9581 from igfoo/igfoo/redundant_cast
Kotlin: Remove a redundant cast
2022-06-20 17:28:49 +01:00
Ian Lynagh
9a7ff4bcdf Kotlin: Remove a redundant cast 2022-06-16 14:08:12 +01:00
Tamas Vajk
c722921276 Kotlin: substitute fake Parcelize functions with their real equivalent ones 2022-06-15 10:35:48 +02:00
Chris Smowton
a9f43889ea Fix wildcard introduction vs. constructor parameters
Previously we handled the case of *methods* with potentially-wildcarded types that Java nontheless constrains to be invariant, but missed out the constructor case.
2022-06-14 12:07:49 +01:00
Ian Lynagh
ae472f32de Merge pull request #9453 from igfoo/igfoo/sam
Kotlin: Simplify samMember computation
2022-06-13 10:44:18 +01:00
Ian Lynagh
d8edc83ea2 Merge pull request #9451 from igfoo/igfoo/useValueParameter
Kotlin: Remove some redundant code
2022-06-13 10:43:54 +01:00
Ian Lynagh
5c9fea2283 Kotlin: Remove unused idOverride argument to extractFunction 2022-06-07 11:34:43 +01:00
Ian Lynagh
33e11b3014 Kotlin: Simplify samMember computation 2022-06-07 11:11:00 +01:00