Bug 46949 - Can not change binding type form ArrayList to Object
Summary: Can not change binding type form ArrayList to Object
Status: RESOLVED ANSWERED
Alias: None
Product: Android
Classification: Xamarin
Component: Bindings ()
Version: 7.0 (C8)
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Atsushi Eno
URL:
Depends on:
Blocks:
 
Reported: 2016-11-14 19:40 UTC by Bill Holmes
Modified: 2017-07-07 21:15 UTC (History)
3 users (show)

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


Attachments
Solution for testing (10.00 KB, application/zip)
2016-11-14 19:40 UTC, Bill Holmes
Details


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 on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED ANSWERED

Description Bill Holmes 2016-11-14 19:40:24 UTC
Created attachment 18459 [details]
Solution for testing

Can not change binding type form ArrayList to Object

Build the attached ArrayList.sln.  You will receive errors dealing with converting ArrayList and Object.  

This is a simplified version of a case where we find a base class returns Object yes the derived class returns an ArrayList.  We need to change the return type to an Object to satisfy the abstract base class.
Comment 3 Atsushi Eno 2017-01-05 09:03:21 UTC
This is a blend of limitations, misunderstanding of the binding generator tool, and wrong API design decision.

You can't automatically generate such a code.

Binding generator is not has no human beings behind and cannot automatically guess that the object of what you manually described as "managedReturn" type actually needs casts to the destination target type. You may specify WhateverNamespace.FooBarBaz, instead of Java.Lang.Object, and there is no automatic way to convert to IList<T>, so there are cases that you simply cannot do that.

This could have been avoided if we didn't design the API to generate IList<T> instead of Java.Util collections. But that cannot be changed anymore.
Comment 4 Jon Douglas [MSFT] 2017-07-07 21:15:59 UTC
Marking this bug as RESOLVED ANSWERED due to the comment in https://bugzilla.xamarin.com/show_bug.cgi?id=46949#c3 and the limitations present. If this is still a bug and can be addressed, please feel free to re-open this bug.