Skip to content

Weekly Stable Updates 20211202 - #436

Merged
moljac merged 29 commits into
mainfrom
wsu-20211202
Jan 31, 2022
Merged

Weekly Stable Updates 20211202#436
moljac merged 29 commits into
mainfrom
wsu-20211202

Conversation

@moljac

@moljacmoljac commented Dec 3, 2021

Copy link
Copy Markdown
Contributor

Updated aritfact bindings

  • androidx.annotation:annotation - 1.2.0 -> 1.3.0

  • androidx.collection:collection - 1.1.0 -> 1.2.0

  • androidx.collection:collection-ktx - 1.1.0 -> 1.2.0

  • androidx.compose.animation:animation - 1.0.0 -> 1.0.5

    • no API changes
  • androidx.compose.animation:animation-core - 1.0.0 -> 1.0.5

    • no API changes
  • androidx.compose.foundation:foundation - 1.0.0 -> 1.0.5

    • no API changes
  • androidx.compose.foundation:foundation-layout - 1.0.0 -> 1.0.5

    • no API changes
  • androidx.compose.material:material - 1.0.0 -> 1.0.5

    • no API changes
  • androidx.compose.material:material-icons-core - 1.0.0 -> 1.0.5

    • no API changes
  • androidx.compose.material:material-icons-extended - 1.0.0 -> 1.0.5

    • no API changes
  • androidx.compose.material:material-ripple - 1.0.0 -> 1.0.5

    • no API changes
  • androidx.compose.runtime:runtime - 1.0.0 -> 1.0.5

    • no API changes
  • androidx.compose.runtime:runtime-livedata - 1.0.0 -> 1.0.5

    • no API changes
  • androidx.compose.runtime:runtime-rxjava2 - 1.0.0 -> 1.0.5

    • no API changes
  • androidx.compose.runtime:runtime-saveable - 1.0.0 -> 1.0.5

    • no API changes
  • androidx.compose.ui:ui - 1.0.0 -> 1.0.5

    • no API changes
  • androidx.compose.ui:ui-geometry - 1.0.0 -> 1.0.5

    • no API changes
  • androidx.compose.ui:ui-graphics - 1.0.0 -> 1.0.5

    • no API changes
  • androidx.compose.ui:ui-text - 1.0.0 -> 1.0.5

    • no API changes
  • androidx.compose.ui:ui-unit - 1.0.0 -> 1.0.5

    • no API changes
  • androidx.compose.ui:ui-util - 1.0.0 -> 1.0.5

    • no API changes
  • androidx.compose.ui:ui-viewbinding - 1.0.0 -> 1.0.5

    • no API changes
  • androidx.constraintlayout:constraintlayout - 2.1.1 -> 2.1.2

  • androidx.constraintlayout:constraintlayout-core - 1.0.1 -> 1.0.2

    • no API changes
  • androidx.emoji2:emoji2 - -> 1.0.0

    • no API changes
  • androidx.emoji2.emoji2

  • androidx.emoji2:emoji2-views-helper - -> 1.0.0

  • androidx.resourceinspection:resource-inspection-annotation - -> 1.0.0

    • no API changes
  • androidx.lifecycle:lifecycle-common - 2.3.1 -> 2.4.0

    • Xamarin.AndroidX.Lifecycle.Common

  • androidx.lifecycle:lifecycle-common-java8 - 2.3.1 -> 2.4.0

    • no API changes
  • androidx.lifecycle:lifecycle-livedata - 2.3.1 -> 2.4.0

    • no API changes
  • androidx.lifecycle:lifecycle-livedata-core - 2.3.1 -> 2.4.0

    • no API changes
  • androidx.lifecycle:lifecycle-livedata-core-ktx - 2.3.1 -> 2.4.0

    • no API changes
  • androidx.lifecycle:lifecycle-livedata-ktx - 2.3.1 -> 2.4.0

    • no API changes
  • androidx.lifecycle:lifecycle-process - 2.3.1 -> 2.4.0

  • androidx.lifecycle:lifecycle-reactivestreams - 2.3.1 -> 2.4.0

    • no API changes
  • androidx.lifecycle:lifecycle-reactivestreams-ktx - 2.3.1 -> 2.4.0

    • no API changes
  • androidx.lifecycle:lifecycle-runtime - 2.3.1 -> 2.4.0

    • no API changes
  • androidx.lifecycle:lifecycle-runtime-ktx - 2.3.1 -> 2.4.0

    • no API changes
  • androidx.lifecycle.lifecycle-runtime-ktx

    • Xamarin.AndroidX.Lifecycle.Runtime.Ktx

  • androidx.lifecycle:lifecycle-service - 2.3.1 -> 2.4.0

    • no API changes
  • androidx.lifecycle:lifecycle-viewmodel - 2.3.1 -> 2.4.0

    • no API changes
  • androidx.lifecycle.lifecycle-viewmodel

  • androidx.lifecycle:lifecycle-viewmodel-ktx - 2.3.1 -> 2.4.0

  • androidx.lifecycle:lifecycle-viewmodel-savedstate - 2.3.1 -> 2.4.0

    • no API changes
  • androidx.lifecycle.lifecycle-viewmodel-savedstate

    • Xamarin.AndroidX.Lifecycle.ViewModelSavedState

  • androidx.paging:paging-common - 3.0.1 -> 3.1.0

  • androidx.paging:paging-common-ktx - 3.0.1 -> 3.1.0

    • no API changes
  • androidx.paging:paging-runtime - 3.0.1 -> 3.1.0

    • no API changes
  • androidx.paging.paging-runtime

    • Xamarin.AndroidX.Paging.Runtime

  • androidx.paging:paging-runtime-ktx - 3.0.1 -> 3.1.0

    • no API changes
  • androidx.paging:paging-rxjava2 - 3.0.1 -> 3.1.0

    • no API changes
  • androidx.paging:paging-rxjava2-ktx - 3.0.1 -> 3.1.0

    • no API changes
  • androidx.profileinstaller:profileinstaller - 1.0.0 -> 1.0.4

    • no API changes
  • androidx.profileinstaller.profileinstaller

  • androidx.work:work-runtime - 2.7.0 -> 2.7.1

    • Xamarin.AndroidX.Work.Runtime

  • androidx.work:work-runtime-ktx - 2.7.0 -> 2.7.1

    • no API changes
  • io.reactivex.rxjava3:rxjava - 3.1.2 -> 3.1.3

    • no API changes
  • org.jetbrains:annotations - 22.0.0 -> 23.0.0

    • Xamarin.Jetbrains.Annotations

Changed but not updated

  • androidx.appcompat.appcompat

  • androidx.biometric.biometric

  • androidx.core.core

  • androidx.leanback.leanback

  • androidx.recyclerview.recyclerview

    • Xamarin.AndroidX.RecyclerView

  • androidx.resourceinspection.resourceinspection-annotation

  • androidx.security.security-crypto

  • androidx.webkit.webkit

  • androidx.window.window

  • androidx.window.window-java

  • com.google.android.material.material

  • com.google.code.gson.gson

  • com.google.crypto.tink.tink-android

  • io.reactivex.rxjava2.rxjava

  • org.jetbrains.kotlin.kotlin-stdlib

  • org.reactivestreams.reactive-streams

    • Xamarin.Android.ReactiveStreams

@PawKanarek

Copy link
Copy Markdown

Hello @moljac i see that some checks have failed due to

Details
@azure-pipelinesazure-pipelines
/ AndroidX (Build macos)
Build log #L14
Error: Certificate "Apple Development: Matthew Leibowitz (Q3RH4N7S8Y)" (fingerprint: AF4469EF01A461E3994C42E2FBF6C0159AF6FB67) expired on Sun Dec 26 2021 00:22:38 GMT+0000 (Coordinated Universal Time)

Do you have idea when this PR will be merged?
I'm asking because I have to bind newest native exoPlayer 2.16.1 library into Xamarin library and it requires dependency androidx.annotation:annotation 1.3.0 which should created in this PR. Without xamarin.annotation 1.3.0 i cannot move any further.

@moljac

Copy link
Copy Markdown
ContributorAuthor

@PawKanarek

After this one

#453

is approved/merged and packages published I can continue with updates and this PR should be 1st

@moljac
moljac requested a review from jpobstJanuary 27, 2022 12:21
Comment threadconfig.json Outdated
"version": "1.0.0",
"nugetVersion": "1.0.0",
"nugetId": "Xamarin.AndroidX.Emoji2",
"excludedRuntimeDependencies": "androidx.lifecycle.lifecycle-process",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be an actual needed runtime dependency. Removing it will likely cause this package to not work:

 <dependency>
<groupId>androidx.lifecycle</groupId>
<artifactId>lifecycle-process</artifactId>
<version>2.4.0</version>
<scope>runtime</scope>
<type>aar</type>
</dependency>

Comment threadconfig.json Outdated
"artifactId": "kotlin-stdlib",
"version": "1.5.31",
"nugetVersion": "1.5.31.3",
"version": "1.6.0",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to hold off on updating Kotlin to 1.6.0. Looking at the diffs makes me think they may have changed how they are encoding their "unsigned" types, and we may need a fix there or else all of our Kotlin support around them will be incorrect.

Example: these changed from uint to int for a type called UIntArray:

Type Changed: Kotlin.UIntArray

Removed methods:

publicstaticuintGet(int[]_this,intindex);publicstaticvoidSet(int[]_this,intindex,uintvalue);

Added methods:

publicstaticintGet(int[]arg0,intindex);publicstaticvoidSet(int[]arg0,intindex,intvalue);

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like API was changed:

Type Changed: Kotlin.UByteArray

Removed methods:

publicstaticbyteGet(byte[]_this,intindex);publicstaticvoidSet(byte[]_this,intindex,bytevalue);publicvirtualintSize();

Decompiled:

publicfinalclassUByteArrayimplementsCollection<UByte>, KMappedMarker
{
// removedpublicstaticfinalbyteget-w2LRezQ(finalbyte[] arg0, finalintindex) {
Intrinsics.checkNotNullParameter(arg0, "arg0");
returnUByte.constructor-impl(arg0[index]);
}
publicstaticfinalvoidset-VurrAj0(finalbyte[] arg0, finalintindex, finalbytevalue) {
Intrinsics.checkNotNullParameter(arg0, "arg0");
arg0[index] = value;
}
publicstaticintgetSize-impl(finalbyte[] arg0) {
Intrinsics.checkNotNullParameter(arg0, "arg0");
returnarg0.length;
}
publicintgetSize() {
returngetSize-impl(this.storage);
}
// removed
}

Type Changed: Kotlin.UIntArray

Removed interfaces:

Java.Lang.IIterableJava.Util.ICollection

Removed methods:

publicstaticuintGet(int[]_this,intindex);publicstaticvoidSet(int[]_this,intindex,uintvalue);publicvirtualintSize();

Decompiled:

publicfinalclassUIntArrayimplementsCollection<UInt>, KMappedMarker
{
// removedpublicstaticfinalintget-pVg5ArA(finalint[] arg0, finalintindex) {
Intrinsics.checkNotNullParameter(arg0, "arg0");
returnUInt.constructor-impl(arg0[index]);
}
publicstaticfinalvoidset-VXSXFK8(finalint[] arg0, finalintindex, finalintvalue) {
Intrinsics.checkNotNullParameter(arg0, "arg0");
arg0[index] = value;
}
// removed
}

Type Changed: Kotlin.ULongArray

Removed methods:

publicstaticulongGet(long[]_this,intindex);publicstaticvoidSet(long[]_this,intindex,ulongvalue);publicvirtualintSize();

Decompiled:

publicfinalclassULongArrayimplementsCollection<ULong>, KMappedMarker
{
// removedpublicstaticfinallongget-s-VKNKU(finallong[] arg0, finalintindex) {
Intrinsics.checkNotNullParameter(arg0, "arg0");
returnULong.constructor-impl(arg0[index]);
}
publicstaticfinalvoidset-k8EXiF4(finallong[] arg0, finalintindex, finallongvalue) {
Intrinsics.checkNotNullParameter(arg0, "arg0");
arg0[index] = value;
}
publicstaticintgetSize-impl(finallong[] arg0) {
Intrinsics.checkNotNullParameter(arg0, "arg0");
returnarg0.length;
}
publicintgetSize() {
returngetSize-impl(this.storage);
}
// removed
}

Type Changed: Kotlin.UShortArray

Removed methods:

publicstaticushortGet(short[]_this,intindex);publicstaticvoidSet(short[]_this,intindex,ushortvalue);publicvirtualintSize();

Decompiled:

publicfinalclassUShortArrayimplementsCollection<UShort>, KMappedMarker
{
// removedpublicstaticfinalshortget-Mh2AYeg(finalshort[] arg0, finalintindex) {
Intrinsics.checkNotNullParameter(arg0, "arg0");
returnUShort.constructor-impl(arg0[index]);
}
publicstaticfinalvoidset-01HTLdE(finalshort[] arg0, finalintindex, finalshortvalue) {
Intrinsics.checkNotNullParameter(arg0, "arg0");
arg0[index] = value;
}
publicstaticintgetSize-impl(finalshort[] arg0) {
Intrinsics.checkNotNullParameter(arg0, "arg0");
returnarg0.length;
}
publicintgetSize() {
returngetSize-impl(this.storage);
}
// removed
}

Comment threadconfig.json Outdated
"artifactId": "activity",
"version": "1.3.1",
"nugetVersion": "1.3.1.2",
"nugetVersion": "1.3.1.3",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's about 20 artifacts that are bumping the nugetVersion but are not bumping the artifact version, What is this for?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't remember. It was begining of December. I might have rebased/merged some change from other PRs

@moljac
moljac requested a review from jpobstJanuary 31, 2022 18:53
@moljac
moljac merged commit 2dc46c6 into mainJan 31, 2022
@moljac
moljac deleted the wsu-20211202 branch January 31, 2022 20:00
jonpryor pushed a commit to dotnet/java-interop that referenced this pull request Feb 7, 2022
Fixes: #945
Context: dotnet/android-libraries#436 (comment)
Consider the following Kotlin function:
fun get (index: Int) : UInt { … }
When `get` is compiled with Kotlin 1.5, `class-parse` would emit:
<method abstract="false" final="true" name="get-pVg5ArA" return="uint" jni-return="I" static="true" visibility="public" jni-signature="([II)I">
<parameter name="$this" type="int[]" jni-type="[I" />
<parameter name="index" type="int" jni-type="I" />
</method>
However, when `get` is compiled with Kotlin 1.6, `class-parse` sees:
<method abstract="false" final="true" name="get-pVg5ArA" return="int" jni-return="I" static="true" visibility="public" jni-signature="([II)I">
<parameter name="arg0" type="int[]" jni-type="[I" />
<parameter name="index" type="int" jni-type="I" />
</method>
Note that the name of the first `int[]` parameter changes from
`$this` to `arg0`, and the return type changed from `uint` to `int`.
The parameter name change is annoying; the return type change is
an ABI break, and makes many package updates impossible.
What happened?
Recall commit 71afce5: Kotlin-compiled `.class` files contain a
`kotlin.Metadata` type-level annotation blob, which contains a
Protobuf stream containing Kotlin metadata for the type.
The `kotlin.Metadata` annotation contains information about Kotlin
functions, and `class-parse` needs to associate the information about
the Kotlin functions to Java methods. This can be tricky because
there is not an explicit way to do this, and one must rely on trying
to match function names and parameter types. Previously, this was
accomplished by looping through the parameters and comparing types.
However, the `kotlin.Metadata` annotation only includes "user created"
method parameters, while the Java method may include "compiler created"
method parameters. We attempted to skip these by ignoring Java
parameters whose names begin with a dollar sign (ex `$this`).
This "worked" most of the time.
This broke in Kotlin 1.6, as the compiler generated method parameters
stopped using `$` for compiler-generated parameter names.
algorithm.
We need something better.
The `kKotlin.Metadata` annotation provides a `JvmSignature` property --
which matches the `JvmName` property which we already use -- which
sounds promising. However, `JvmSignature` is sometimes `null`, and
sometimes it doesn't actually match. But it's closer.
So now we try to match with signatures.
* If `JvmSignature` matches the Java signature we use that.
* If `JvmSignature` is `null`, calculate it from the Kotlin
parameters and try to match with that.
* Note it wants unsigned types as `Lkotlin/UInt;` and not the
primitive encoding (`I`).
* If Kotlin metadata defines a `ReceiverType`, add that as the
first parameter to the signature.
Using `kotlin-stdlib-1.5.31.jar` as a baseline, we get much better
results:
| Version | Matched Functions | Unmatched Functions |
| --------------- | ----------------: | --------------------: |
| main @ 32635fd | 946 | 154 |
| This PR | 1100 | 0 |
Now that we can match Kotlin functions to Java methods, we still have
to match up the parameters so we can apply parameter-level transforms.
Do this by removing Java method parameters from the front and back of
the list to account for cases where the compiler adds "hidden"
parameters:
* Remove Kotlin `ReceiverType` from beginning of list.
* Remove Kotlin `Lkotlin/coroutines/Continuation;` from end of list.
* Note this _could_ be a legitimate user supplied parameter so we
try to restrict it to "unnamed" parameters.
* Remove the `this` parameter added to `static` functions.
Note: the test classes `DeepRecursiveKt.class`,
`DeepRecursiveScope.class`, and `UByteArray.class` are pulled from
[`kotlin-stdlib-1.5.31.jar`][0].
[0]: https://mvnrepository.com/artifact/org.jetbrains.kotlin/kotlin-stdlib/1.5.31
pullBot pushed a commit to MaxMood96/xamarin-android that referenced this pull request Jul 1, 2026
Fixes: dotnet/java-interop#945
Context: dotnet/android-libraries#436 (comment)
Consider the following Kotlin function:
fun get (index: Int) : UInt { … }
When `get` is compiled with Kotlin 1.5, `class-parse` would emit:
<method abstract="false" final="true" name="get-pVg5ArA" return="uint" jni-return="I" static="true" visibility="public" jni-signature="([II)I">
<parameter name="$this" type="int[]" jni-type="[I" />
<parameter name="index" type="int" jni-type="I" />
</method>
However, when `get` is compiled with Kotlin 1.6, `class-parse` sees:
<method abstract="false" final="true" name="get-pVg5ArA" return="int" jni-return="I" static="true" visibility="public" jni-signature="([II)I">
<parameter name="arg0" type="int[]" jni-type="[I" />
<parameter name="index" type="int" jni-type="I" />
</method>
Note that the name of the first `int[]` parameter changes from
`$this` to `arg0`, and the return type changed from `uint` to `int`.
The parameter name change is annoying; the return type change is
an ABI break, and makes many package updates impossible.
What happened?
Recall commit 004aae6: Kotlin-compiled `.class` files contain a
`kotlin.Metadata` type-level annotation blob, which contains a
Protobuf stream containing Kotlin metadata for the type.
The `kotlin.Metadata` annotation contains information about Kotlin
functions, and `class-parse` needs to associate the information about
the Kotlin functions to Java methods. This can be tricky because
there is not an explicit way to do this, and one must rely on trying
to match function names and parameter types. Previously, this was
accomplished by looping through the parameters and comparing types.
However, the `kotlin.Metadata` annotation only includes "user created"
method parameters, while the Java method may include "compiler created"
method parameters. We attempted to skip these by ignoring Java
parameters whose names begin with a dollar sign (ex `$this`).
This "worked" most of the time.
This broke in Kotlin 1.6, as the compiler generated method parameters
stopped using `$` for compiler-generated parameter names.
algorithm.
We need something better.
The `kKotlin.Metadata` annotation provides a `JvmSignature` property --
which matches the `JvmName` property which we already use -- which
sounds promising. However, `JvmSignature` is sometimes `null`, and
sometimes it doesn't actually match. But it's closer.
So now we try to match with signatures.
* If `JvmSignature` matches the Java signature we use that.
* If `JvmSignature` is `null`, calculate it from the Kotlin
parameters and try to match with that.
* Note it wants unsigned types as `Lkotlin/UInt;` and not the
primitive encoding (`I`).
* If Kotlin metadata defines a `ReceiverType`, add that as the
first parameter to the signature.
Using `kotlin-stdlib-1.5.31.jar` as a baseline, we get much better
results:
| Version | Matched Functions | Unmatched Functions |
| --------------- | ----------------: | --------------------: |
| main @ 24dced0 | 946 | 154 |
| This PR | 1100 | 0 |
Now that we can match Kotlin functions to Java methods, we still have
to match up the parameters so we can apply parameter-level transforms.
Do this by removing Java method parameters from the front and back of
the list to account for cases where the compiler adds "hidden"
parameters:
* Remove Kotlin `ReceiverType` from beginning of list.
* Remove Kotlin `Lkotlin/coroutines/Continuation;` from end of list.
* Note this _could_ be a legitimate user supplied parameter so we
try to restrict it to "unnamed" parameters.
* Remove the `this` parameter added to `static` functions.
Note: the test classes `DeepRecursiveKt.class`,
`DeepRecursiveScope.class`, and `UByteArray.class` are pulled from
[`kotlin-stdlib-1.5.31.jar`][0].
[0]: https://mvnrepository.com/artifact/org.jetbrains.kotlin/kotlin-stdlib/1.5.31
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@moljac@PawKanarek@jpobst