Bug 24193 - [generator] Attempts to generate a JavaCast<byte[]>() invocation.
Summary: [generator] Attempts to generate a JavaCast<byte[]>() invocation.
Status: RESOLVED FIXED
Alias: None
Product: Android
Classification: Xamarin
Component: Bindings ()
Version: 4.20.0
Hardware: PC Mac OS
: Normal normal
Target Milestone: 5.1
Assignee: dean.ellis
URL:
: 24312 ()
Depends on:
Blocks:
 
Reported: 2014-10-31 12:30 UTC by Jonathan Pryor
Modified: 2015-03-12 17:53 UTC (History)
4 users (show)

Tags:
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 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 FIXED

Description Jonathan Pryor 2014-10-31 12:30:41 UTC
This needs a proper test. Sorry. :-(

Sometimes, generator may emit the code:

  // This method is explicitly implemented as a member of an instantiated ISomeInterface
  void ISomeInterface.SomeMethod (global::Java.Lang.Object p0)
  {
    SomeMethod (global::Java.Interop.JavaObjectExtensions.JavaCast<byte[]>(p0));
  }

This fails, as JavaCast<T>() requires that T implement IJavaObject, and byte[] doesn't.

Presumably this is happening due to Java generics? Untested, but:

  // Java
  public interface SomeInterface<T> {
    void someMethod(T value);
  }
  public class Whatever implements SomeInterface<byte[]> {
    public void someMethod(byte[] value) {}
  }
Comment 3 dean.ellis 2014-11-07 03:27:20 UTC
*** Bug 24312 has been marked as a duplicate of this bug. ***
Comment 5 dean.ellis 2015-01-20 05:50:47 UTC
I have managed to replicate this. 
Now need to figure out how to fix it
Comment 6 dean.ellis 2015-01-22 09:14:53 UTC
Fixed in monodroid/master/b544d5e96