[英]remove virtual keyword from xamarin java binding
Currently I'm trying to convert a jar file to dll with Xamarin Java Binding project. 目前,我正在尝试使用Xamarin Java Binding项目将jar文件转换为dll。
Here is the java code public int compareTo(java.lang.object paramPGAbsEffect)
这是Java代码public int compareTo(java.lang.object paramPGAbsEffect)
which becomes public virtual unsafe int CompareTo (object p0)
in my c# code. 在我的C#代码中,它变为public virtual unsafe int CompareTo (object p0)
。 I want to just remove the virtual keyword, because it is not there in Java file. 我只想删除虚拟关键字,因为Java文件中没有该关键字。
I tried ... /method[@name='compareTo']" name="virtual">false
but this is not working. 我尝试过... /method[@name='compareTo']" name="virtual">false
但这不起作用。
All Java functions are virtual by default, unless you use final keyword. 默认情况下,所有Java函数都是虚拟的,除非您使用final关键字。 Thus, the tool just does its job and you should learn more about both Java and C#. 因此,该工具可以正常工作,您应该了解有关Java和C#的更多信息。
The solution is to set final
to true
in the Metadata.xml
mapping: 解决方案是在Metadata.xml
映射中将final
设置为true
:
<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. 这样可以有效地从方法签名中删除virtual
关键字,也不会添加final
关键字。 Strange behavior, but it works. 奇怪的行为,但它可以工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.