Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
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
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.
I'm trying to bind this class (follow link below):
<a href="http://codeviewer.org/view/code:27cb">Click here for code</a>
The important thing to note is that the class contains a method called setEnabled.
However when I build the JAR binding project this method is not included in the api.xml that is generated and it is causing an error in the generated C# code since this method is missing.
Here is the portion from the api.xml related to this class:
<a href="http://codeviewer.org/view/code:27d7">Click here for XML</a>
As far as I can tell this problem is occuring because the android.view.View class contains a method called setEnabled and the com.actionbarsherlock.internal.view.menu.MenuView.ItemView interface also contains a method called setEnabled. I'm not able to confirm this but I have a gut feeling that this is the problem. Still looking for a way to work-around / resolve this.
Oh the Java project I'm trying to bind is Actionbar Sherlock. You can download the same JAR file that I'm working with here: http://www.sendspace.com/file/xncigz (when you click the link its the download link in the small, blue box towards the bottom, all the other junk is a bunch of ads)
Silly question, but why do you want to bind an internal class? It's in the package: com.actionbarsherlock.internal.view.menu, which implies that it's for internal use. Furthermore, the type has a @hide doc-comment, which prevents it from being exposed in JavaDoc.
> The important thing to note is that the class contains a method called setEnabled
setEnabled() isn't present within the API description because it's an @Override method, and method overrides (normally) aren't bound, as they don't need to be bound.
Is there a build error or runtime error that you're seeing?
Thanks, I guess I hadn't even thought about it that way. You are probably right, I doubt I need to bind the internal classes, which makes my job a lot easier. So that actually eliminates this problem for me. Thanks.
However, I think there still might be a bug, IF I were to try to bind these classes.
The error message I'm seeing is this:
Error 2 'Com.Actionbarsherlock.Internal.View.Menu.ListMenuItemView' does not implement interface member 'Com.Actionbarsherlock.Internal.View.Menu.IMenuViewItemView.SetEnabled(bool)' C:\Users\CSchulte\Documents\Visual Studio 2010\Projects\AndroidApplication4\BindingLibrary1\obj\Debug\generated\src\Com.Actionbarsherlock.Internal.View.Menu.ListMenuItemView.cs 8 23 BindingLibrary1
So I guess I originally thought this error message was caused by the method not being present in the api.xml file, but as you have explained that is not necessarily the case. But, regardless, the method is not present in my generated JAR Binding code either, so it causes the error message since it is not implemented like it should be.
Please see previous comment. I'm not positive it is really a bug but it seems like it might be. Thanks.
You are correct: the issue is that setEnabled() is declared in the MenuViewItemView interface, but it isn't declared in ListMenuItemView because setEnabled() is _also_ a method override.
This is a bug: either jar2xml needs to declare the method in the XML description, or generator needs to check implemented interfaces and generate the methods.
To be consistent with the original AOSP format, jar2xml should NOT generate overriden methods that is covered in the base interfaces.
If things are missing then generator should handle it, unless it should NOT do - for example, return type has changed and it should be left for user which (of base type or derived type) to bind.
Since we made several changes in the binding generator and this sample code is too old (I cannot even see the pastes as they are expired) but we have a working ActionBarSherlock binding in our monodroid-samples repository (which I believe works quite well, as long as I could run the port of its sample), I just close this as fixed. If you still have problem please reopen or create another bug if that is different state than this.