0
votes

Currently I'm trying to convert a jar file to dll with Xamarin Java Binding project.

Here is the java code public int compareTo(java.lang.object paramPGAbsEffect)

which becomes public virtual unsafe int CompareTo (object p0) in my c# code. I want to just remove the virtual keyword, because it is not there in Java file.

I tried ... /method[@name='compareTo']" name="virtual">false but this is not working.

2

2 Answers

1
votes

All Java functions are virtual by default, unless you use final keyword. Thus, the tool just does its job and you should learn more about both Java and C#.

0
votes

The solution is to set final to true in the Metadata.xml mapping:

<attr 
   path="/api/package[@name='your.package.here']/class[@name='YourClass.InnerClass']/method[@name='methodName']" 
   name="final">true</attr>

This effectively removes the virtual keyword from the method signature, and doesn't add the final keyword either. Strange behavior, but it works.