Skip to content

[generator] Unable to inherit reference interface with generic method parameters #699

@jpobst

Description

@jpobst

Context: dotnet/android#5027

Given this snippet:

package com.blah;

import android.database.Cursor;

public interface MyCursor extends Cursor { }

Compiling against API-29 succeeds, while API-30 fails with:

Error CS1026: ) expected
Error CS1056: Unexpected character '`'
Error CS1002: ; expected
Error CS1002: ; expected
Error CS1513: } expected

This is due to the interface invoker method for android.database.Cursor.setNotficationUris, added in API-30, which generates this code:

var uris = (global::System.Collections.Generic.IList`1)global::Java.Lang.Object.GetObject<global::System.Collections.Generic.IList`1> (native_uris, JniHandleOwnership.DoNotTransfer);

Using a type with an arity is not legal C# (IList`1). Instead we need to generate the full closed generic type like this:

global::System.Collections.Generic.IList<global::Android.Net.Uri>

When this is fixed, this PR can be reverted: dotnet/android#5124.

Metadata

Metadata

Assignees

No one assigned

    Labels

    generatorIssues binding a Java library (generator, class-parse, etc.)

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions