Bug 17313 - Binding generator: XPath location wrong for types using generics.
Summary: Binding generator: XPath location wrong for types using generics.
Status: VERIFIED FIXED
Alias: None
Product: Android
Classification: Xamarin
Component: Bindings ()
Version: 4.2.x
Hardware: Macintosh Mac OS
: Normal minor
Target Milestone: 5.1
Assignee: dean.ellis
URL:
Depends on:
Blocks:
 
Reported: 2014-01-18 17:12 UTC by Arturo Espinosa
Modified: 2015-05-12 18:04 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:
VERIFIED FIXED

Description Arturo Espinosa 2014-01-18 17:12:10 UTC
Auto-generated bindings put a comment for every method being processed inside the C# code as a guide, stating where the method is found within the api.xml file.

The problem is that the type part of the parameters is badly generated when the type has a generic inside. Example:

// Metadata.xml XPath method reference: path="/api/package[@name='com.samsung.vip.engine.shape']/class[@name='PrimitivePolyline']/method[@name='setPoints' and count(parameter)=1 and parameter[1][@type='java.util.ArrayList']]"

But the XML for that method is:

<method abstract="false" deprecated="not deprecated" final="false" name="setPoints" native="false" return="void" static="false" synchronized="false" visibility="public">
<parameter name="p0" type="java.util.ArrayList&lt;android.graphics.Point&gt;">
</parameter>
</method>

The method reference comment should be:

// Metadata.xml XPath method reference: path="/api/package[@name='com.samsung.vip.engine.shape']/class[@name='PrimitivePolyline']/method[@name='setPoints' and count(parameter)=1 and parameter[1][@type='java.util.ArrayList&lt;android.graphics.Point&gt;']]"

This affects productivity at a minor level. If I want to modify this method, I just copy and paste the illustrated path in Metadata.xml and use it as an attribute for <remove-node, <attr or whatever. But, the XPath will be wrong for these methods and I won't notice until the binding generator complaints that the XPath leads to no nodes at build time.

Just a detail, a minor frustration. Cheers.
Comment 1 Jonathan Pryor 2014-07-28 17:56:52 UTC
This will largely be moot once we migrate to class-parse (which won't have generic types in //parameter/@type, etc.)
Comment 2 dean.ellis 2015-01-19 04:50:13 UTC
Fixed in monodroid/master/0f6c8eed
Comment 5 Peter Collins 2015-05-12 18:04:49 UTC
I was able to verify this by comparing output from the OsmDroidBindingExample monodroid-sample after building against 4.20-series and 5.1-series.

4.20:
> // Metadata.xml XPath method reference:path="/api/package[@name='org.osmdroid.contributor']/class[@name='OSMUploader']/method[@name='uploadAsync' and count(parameter)=1 and parameter[1][@type='java.util.ArrayList']]"

5.1:
> // Metadata.xml XPath method reference: path="/api/package[@name='org.osmdroid.contributor']/class[@name='OSMUploader']/method[@name='uploadAsync' and count(parameter)=1 and parameter[1][@type='java.util.ArrayList&lt;org.osmdroid.contributor.util.RecordedGeoPoint&gt;']]"