Skip to content

Conversation

@jonpryor
Copy link
Contributor

Context: 0aec86a

Commit 0aec86a mentioned:

Remaining Integration-Tests which don't support JavaInterop1:

  • Missing builtin mapping between collection types:

    warning BG8800: Unknown parameter type 'java.util.List<java.lang.Integer>' for member …
    warning BG8800: Unknown parameter type 'java.util.ArrayList<java.lang.Integer>' for member
    warning BG8400: Unexpected field type `java.util.List<java.lang.String>`
    

    Impacts: Java_Util_List.cs, NormalMethods.cs, ParameterXPath.cs

The problem here is that the provided API XML did not contain a declaration for java.util.List<E>. This didn't matter for XAJavaInterop1 output, as it binds List<E> as
System.Collections.Generic.IList<T>, but it does matter for JavaInterop1 output, as it doesn't special-case List<E>. (Perhaps it should! Or this helps "lower" the need for improved generics! Or…)

Add a declaration for java.util.List<E> to Java_Util_List.cs, and ParameterXPath.cs, so that we can set TryJavaInterop1 => true.

Also add a declaration for java.util.List<E> to NormalMethods.cs. This doesn't allow us to enable TryJavaInterop1 => true, because of the "Handle isn't a public property" issue, but it'll be a necessary prerequisite to enable NormalMethods.cs in the future.

Context: 0aec86a

Commit 0aec86a mentioned:

> Remaining Integration-Tests which don't support JavaInterop1:
>
>  * Missing builtin mapping between collection types:
>
>        warning BG8800: Unknown parameter type 'java.util.List<java.lang.Integer>' for member …
>        warning BG8800: Unknown parameter type 'java.util.ArrayList<java.lang.Integer>' for member
>        warning BG8400: Unexpected field type `java.util.List<java.lang.String>`
>
>    Impacts: Java_Util_List.cs, NormalMethods.cs, ParameterXPath.cs

The problem here is that the provided API XML did not contain a
declaration for `java.util.List<E>`.  This didn't matter for
XAJavaInterop1 output, as it binds `List<E>` as
`System.Collections.Generic.IList<T>`, but it *does* matter for
JavaInterop1 output, as it doesn't special-case `List<E>`.
(Perhaps it should!  Or this helps "lower" the need for improved
generics! Or…)

Add a declaration for `java.util.List<E>` to Java_Util_List.cs,
and ParameterXPath.cs, so that we can set `TryJavaInterop1 => true`.

Also add a declaration for `java.util.List<E>` to NormalMethods.cs.
This doesn't allow us to enable `TryJavaInterop1 => true`, because
of the "`Handle` isn't a public property" issue, but it'll be a
necessary prerequisite to enable NormalMethods.cs in the future.
@jonpryor jonpryor merged commit 87fdb8e into main Oct 24, 2024
4 checks passed
@jonpryor jonpryor deleted the dev/jonp/jonp-bind-List-in-generator-Tests branch October 24, 2024 19:37
jonpryor pushed a commit to dotnet/android that referenced this pull request Oct 25, 2024
Changes: dotnet/java-interop@2a1e180...87fdb8e

  * dotnet/java-interop@87fdb8e6: [generator-Tests] bind java.util.List (dotnet/java-interop#1273)
  * dotnet/java-interop@32506ce5: Bump to dotnet/android-tools@60fae19 (dotnet/java-interop#1270)
  * dotnet/java-interop@53079086: [Java.Base] Update to Microsoft.DotNet.GenAPI 8.0.0-beta.24516.1 (dotnet/java-interop#1272)
  * dotnet/java-interop@0aec86ac: [generator-Tests] Enable JavaInterop1 Integration output tests (dotnet/java-interop#1271)

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
@github-actions github-actions bot locked and limited conversation to collaborators Nov 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants