[mono-android] java binding library
Wally McClure
theevilprogrammer at hotmail.com
Thu Jun 21 18:19:58 UTC 2012
I decided to go back to the drawing board and create some simple .jar files that I could transform and then be less of a hassle. I have a method called: multiplefloat which takes two floats and multiplies them together and returns a float. I'd like to rename that method to MultipleFloat in the .NET side because I am a bad java programmer. I've tried the following transforms in the Metadata.xml file with no luck. Any suggestions? <metadata>
<attr path="/api/package[@name='com.scalabledevelopment.math.operations.multiplyfloat']" name="managedName">Com.Scalabledevelopment.Math.Operations.MultiplyFloat</attr>
<attr path="/api/package[@name='com.scalabledevelopment.math.operations']/class[@name='multiplyfloat']" name="managedName">Com.Scalabledevelopment.Math.Operations.MultiplyFloat</attr>
</metadata>
> Date: Thu, 21 Jun 2012 18:13:41 +0900
> From: atsushieno at veritas-vos-liberabit.com
> To: monodroid at lists.ximian.com
> Subject: Re: [mono-android] java binding library
>
> Hello,
>
> On 2012/06/21 10:05, Wally McClure wrote:
> > I'm working on an example of using the java binding library. I wanted
> > to use a fairly well known java library, so a friend told me to use
> > the commons-math jar library. Ok, sounds good to me. I plug this
> > into a MfA java binding library, and of course, it generates a bunch
> > of errors. This is actually good. Now, I need to go through and fix
> > these errors as noted here:
> > http://docs.xamarin.com/android/tutorials/Binding_a_Java_Library_%28.jar%29
>
> This kind of Java-vs-C# mismatch always occurs and bites us. There are
> common patterns of troubles. We have some listed (I have to say, that's
> not very up to date though ...) :
> http://docs.xamarin.com/android/tutorials/Binding_a_Java_Library_%28.jar%29#Troublshooting_Bindings
>
> >
> > Some of the errors that I am getting are:
> > Error 1 'Gamma': member names cannot be the same as their
> > enclosing type C:\Projects\MonoAndroidAppDev\New in
> > 4.2\Projects\ExampleJavaBindings\BindingLibrary\obj\Debug\generated\src\Org.Apache.Commons.Math3.Special.Gamma.cs
> > 12 23 BindingLibrary
>
> We convert Java names from camelCase to PascalCase and that results in
> this kind of problem. Either the member or the type name has to be
> renamed via metadata fixup, e.g.
>
> <attr path="/api/package[@name=...]/class[@name=...]"
> name="managedName">GanmaType</attr>
>
> > Error 2 The type or namespace name 'FirstMoment' does not exist
> > in the namespace 'Org.Apache.Commons.Math3.Stat.Descriptive.Moment'
> > (are you missing an assembly reference?)
> > C:\Projects\MonoAndroidAppDev\New in
> > 4.2\Projects\ExampleJavaBindings\BindingLibrary\obj\Debug\generated\src\Org.Apache.Commons.Math3.Stat.Descriptive.Moment.Mean.cs
> > 30 70 BindingLibrary
> >
> The troubleshooting section in our site (mentioned above) contains "The
> binding .dll builds but misses some Java types" row. It contains a
> couple of common patterns, which may give you the answer.
>
> > Error 5 Type
> > 'Org.Apache.Commons.Math3.Stat.Clustering.EuclideanIntegerPoint'
> > already defines a member called
> > 'GetCentroidOf_Ljava_util_Collection_Handler' with the same parameter
> > types C:\Projects\MonoAndroidAppDev\New in
> > 4.2\Projects\ExampleJavaBindings\BindingLibrary\obj\Debug\generated\src\Org.Apache.Commons.Math3.Stat.Clustering.EuclideanIntegerPoint.cs
> > 90 19 BindingLibrary
> >
>
> The only possibility I can think of is some multiple-methods-to-events
> conversion conflict case as Miljenko mentioned. Any other reason is
> possible though.
>
> > Error 29 The name 'Handle' does not exist in the current
> > context C:\Projects\MonoAndroidAppDev\New in
> > 4.2\Projects\ExampleJavaBindings\BindingLibrary\obj\Debug\generated\src\Org.Apache.Commons.Math3.Stat.Descriptive.Moment.SecondMoment.cs
> > 23 22 BindingLibrary
> >
> > Error 33 The name 'SetHandle' does not exist in the current
> > context C:\Projects\MonoAndroidAppDev\New in
> > 4.2\Projects\ExampleJavaBindings\BindingLibrary\obj\Debug\generated\src\Org.Apache.Commons.Math3.Stat.Descriptive.Moment.SecondMoment.cs
> > 51 5 BindingLibrary
> >
>
> I wonder if this type involves "handle" member in the Java library.
> That's what we haven't hit yet, but Handle is (as you would know) a
> special member from Java.Lang.Object and hence should exist in almost
> all types. In that case, this name conflict has to be again resolved by
> metadata xml fixup.
>
> > Error 35 'object' does not contain a constructor that takes 2
> > arguments C:\Projects\MonoAndroidAppDev\New in
> > 4.2\Projects\ExampleJavaBindings\BindingLibrary\obj\Debug\generated\src\Org.Apache.Commons.Math3.Stat.Descriptive.Moment.SecondMoment.cs
> > 62 28 BindingLibrary
> >
>
> Maybe this is due to other compilation error that caused type resolution
> failure and thus C# compiler tries to lookup the member from
> System.Object. This would change after you resolved other issues.
>
> Atsushi Eno
>
> > I'm wondering what the proper step is to go about fixing them. Should
> > I go through the code and manually fix this up? Is there something in
> > the various transform files I should do? As much assistance as I can
> > get in minute detail would be helpful.
> >
> > Wally
> >
> >
> >
> > _______________________________________________
> > Monodroid mailing list
> > Monodroid at lists.ximian.com
> >
> > UNSUBSCRIBE INFORMATION:
> > http://lists.ximian.com/mailman/listinfo/monodroid
>
> _______________________________________________
> Monodroid mailing list
> Monodroid at lists.ximian.com
>
> UNSUBSCRIBE INFORMATION:
> http://lists.ximian.com/mailman/listinfo/monodroid
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/monodroid/attachments/20120621/0058ae58/attachment-0001.html>
More information about the Monodroid
mailing list