Bug 5401 - generator: generic type parameters should be classes not interfaces
Summary: generator: generic type parameters should be classes not interfaces
Status: ASSIGNED
Alias: None
Product: Android
Classification: Xamarin
Component: Tools and Addins ()
Version: 4.2.x
Hardware: PC Mac OS
: Normal normal
Target Milestone: ---
Assignee: Atsushi Eno
URL:
Depends on:
Blocks:
 
Reported: 2012-05-29 16:58 UTC by Jonathan Pryor
Modified: 2016-09-02 20:01 UTC (History)
4 users (show)

Tags: XATriaged
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report for Bug 5401 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
ASSIGNED

Description Jonathan Pryor 2012-05-29 16:58:30 UTC
This is via Bug #5198 Comment #1:

> Is it possible to implement type checking at compilation stage?
> Cause now data could be Dictionaries and Lists and only runtime
> checking showing error.

The problem is SimpleExpandableListAdapter and related types and the IList<IDictionary<string, object>> parameter:

    http://androidapi.xamarin.com/?link=T:Android.Widget.SimpleExpandableListAdapter/*

e.g.

    SimpleExpandableListAdapter(
        Android.Content.Context context,
        IList<IDictionary<string, object>> groupData,
        int expandedGroupLayout,
        int collapsedGroupLayout,
        string[] groupFrom,
        int[] groupTo,
        IList<IList<IDictionary<string, object>>> childData,
        int childLayout,
        string[] childFrom,
        int[] childTo
    );

The problem is that the outermost IList<...> parameter can be a List<T>, but the nested IList<...> and IDictionary<...> types MUST be JavaList and JavaDictionary. See also:

> http://lists.ximian.com/pipermail/monodroid/2012-May/010304.html
> http://docs.xamarin.com/android/Releases/Mono_For_Android_4/Mono_for_Android_4.2#Breaking_Changes
> Bug #5122

That is, the above constructor should instead be:

    SimpleExpandableListAdapter(
        Android.Content.Context context,
        IList<JavaDictionary<string, object>> groupData,
        int expandedGroupLayout,
        int collapsedGroupLayout,
        string[] groupFrom,
        int[] groupTo,
        IList<JavaList<JavaDictionary<string, object>>> childData,
        int childLayout,
        string[] childFrom,
        int[] childTo
    );

The outermost types can remain interfaces; the nested generic type parameters should be JavaList/JavaDictionary/etc. instead of the current interface types. This would ensure that The Right Thing happens, and the compiler would enforce it.