Created
May 20, 2014 02:33
-
-
Save brendanzagaeski/3868e30b85a1feb1181b to your computer and use it in GitHub Desktop.
Some Metadata.xml fixes for binding "Java WebSockets" (https://github.com/TooTallNate/Java-WebSocket/) in Xamarin.Android
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<metadata> | |
<!-- Some Metadata.xml fixes for binding "Java WebSockets" (https://github.com/TooTallNate/Java-WebSocket/) in Xamarin.Android --> | |
<!-- This is a case of http://docs.xamarin.com/guides/android/advanced_topics/java_integration_overview/binding_a_java_library_(.jar)/#Problem_Duplicate_custom_EventArgs_types | |
Error CS0102: The type `Org.Java_websocket.WebsocketMessageEventArgs' | |
already contains a definition for `p0' --> | |
<attr path="/api/package[@name='org.java_websocket']/interface[@name='WebSocketListener']/method[@name='onWebsocketMessage' and count(parameter)=2 and parameter[1][@type='org.java_websocket.WebSocket'] and parameter[2][@type='java.nio.ByteBuffer']]" name="argsType">WebsocketMessageByteBufferEventArgs</attr> | |
<!-- The automatically generated event handlers cause some trouble | |
here because there are two overloads of `onWebsocketMessage`. | |
Let's just rename one of the methods. That way the event handler | |
will have a different name too, and there won't be a conflict. | |
Error CS0102: The type `Org.Java_websocket.IWebSocketListenerImplementor' | |
already contains a definition for `OnWebsocketMessageHandler' --> | |
<attr path="/api/package[@name='org.java_websocket']/interface[@name='WebSocketListener']/method[@name='onWebsocketMessage' and count(parameter)=2 and parameter[1][@type='org.java_websocket.WebSocket'] and parameter[2][@type='java.nio.ByteBuffer']]" name="managedName">OnWebsocketMessageByteBuffer</attr> | |
<!--- Error CS0115: `Org.Java_websocket.Client.WebSocketClient.OnWebsocketMessage(Org.Java_websocket.IWebSocket, Java.Nio.ByteBuffer)' | |
is marked as an override but no suitable method found to override --> | |
<attr path="/api/package[@name='org.java_websocket.client']/class[@name='WebSocketClient']/method[@name='onWebsocketMessage' and count(parameter)=2 and parameter[1][@type='org.java_websocket.WebSocket'] and parameter[2][@type='java.nio.ByteBuffer']]" name="managedName">OnWebsocketMessageByteBuffer</attr>--> | |
<!-- Error CS0115: `Org.Java_websocket.Server.WebSocketServer.OnWebsocketMessage(Org.Java_websocket.IWebSocket, Java.Nio.ByteBuffer)' | |
is marked as an override but no suitable method found to override --> | |
<attr path="/api/package[@name='org.java_websocket.server']/class[@name='WebSocketServer']/method[@name='onWebsocketMessage' and count(parameter)=2 and parameter[1][@type='org.java_websocket.WebSocket'] and parameter[2][@type='java.nio.ByteBuffer']]" name="managedName">OnWebsocketMessageByteBuffer</attr> | |
<!--- C# does not support covariant return types, but Java does. So | |
we must return the base class type from the interface here instead | |
of a subclass. | |
Error CS0738: `Org.Java_websocket.Client.DefaultSSLWebSocketClientFactory' | |
does not implement interface member `Org.Java_websocket.IWebSocketFactory.CreateWebSocket(Org.Java_websocket.WebSocketAdapter, System.Collections.Generic.IList<Org.Java_websocket.Drafts.Draft>, Java.Net.Socket)' | |
and the best implementing candidate `Org.Java_websocket.Client.DefaultSSLWebSocketClientFactory.CreateWebSocket(Org.Java_websocket.WebSocketAdapter, System.Collections.Generic.IList<Org.Java_websocket.Drafts.Draft>, Java.Net.Socket)' | |
return type `Org.Java_websocket.WebSocketImpl' does not match | |
interface member return type `Org.Java_websocket.IWebSocket' --> | |
<attr path="/api/package[@name='org.java_websocket.client']/class[@name='DefaultSSLWebSocketClientFactory']/method[@name='createWebSocket' and count(parameter)=3 and parameter[1][@type='org.java_websocket.WebSocketAdapter'] and parameter[2][@type='java.util.List<org.java_websocket.drafts.Draft>'] and parameter[3][@type='java.net.Socket']]" name="managedReturn">Org.Java_websocket.IWebSocket</attr> | |
<!---Error CS0738: `Org.Java_websocket.Client.DefaultSSLWebSocketClientFactory' | |
does not implement interface member `Org.Java_websocket.IWebSocketFactory.CreateWebSocket(Org.Java_websocket.WebSocketAdapter, Org.Java_websocket.Drafts.Draft, Java.Net.Socket)' | |
and the best implementing candidate `Org.Java_websocket.Client.DefaultSSLWebSocketClientFactory.CreateWebSocket(Org.Java_websocket.WebSocketAdapter, Org.Java_websocket.Drafts.Draft, Java.Net.Socket)' | |
return type `Org.Java_websocket.WebSocketImpl' does not match | |
interface member return type `Org.Java_websocket.IWebSocket' --> | |
<attr path="/api/package[@name='org.java_websocket.client']/class[@name='DefaultSSLWebSocketClientFactory']/method[@name='createWebSocket' and count(parameter)=3 and parameter[1][@type='org.java_websocket.WebSocketAdapter'] and parameter[2][@type='org.java_websocket.drafts.Draft'] and parameter[3][@type='java.net.Socket']]" name="managedReturn">Org.Java_websocket.IWebSocket</attr> | |
<!-- Same thing for all of these methods too --> | |
<attr path="/api/package[@name='org.java_websocket.server']/class[@name='DefaultSSLWebSocketServerFactory']/method[@name='createWebSocket' and count(parameter)=3 and parameter[1][@type='org.java_websocket.WebSocketAdapter'] and parameter[2][@type='java.util.List<org.java_websocket.drafts.Draft>'] and parameter[3][@type='java.net.Socket']]" name="managedReturn">Org.Java_websocket.IWebSocket</attr> | |
<attr path="/api/package[@name='org.java_websocket.server']/class[@name='DefaultSSLWebSocketServerFactory']/method[@name='createWebSocket' and count(parameter)=3 and parameter[1][@type='org.java_websocket.WebSocketAdapter'] and parameter[2][@type='org.java_websocket.drafts.Draft'] and parameter[3][@type='java.net.Socket']]" name="managedReturn">Org.Java_websocket.IWebSocket</attr> | |
<attr path="/api/package[@name='org.java_websocket.server']/class[@name='DefaultWebSocketServerFactory']/method[@name='createWebSocket' and count(parameter)=3 and parameter[1][@type='org.java_websocket.WebSocketAdapter'] and parameter[2][@type='java.util.List<org.java_websocket.drafts.Draft>'] and parameter[3][@type='java.net.Socket']]" name="managedReturn">Org.Java_websocket.IWebSocket</attr> | |
<attr path="/api/package[@name='org.java_websocket.server']/class[@name='DefaultWebSocketServerFactory']/method[@name='createWebSocket' and count(parameter)=3 and parameter[1][@type='org.java_websocket.WebSocketAdapter'] and parameter[2][@type='org.java_websocket.drafts.Draft'] and parameter[3][@type='java.net.Socket']]" name="managedReturn">Org.Java_websocket.IWebSocket</attr> | |
<attr path="/api/package[@name='org.java_websocket.server']/class[@name='DefaultWebSocketServerFactory']/method[@name='wrapChannel' and count(parameter)=2 and parameter[1][@type='java.nio.channels.SocketChannel'] and parameter[2][@type='java.nio.channels.SelectionKey']]" name="managedReturn">Java.Nio.Channels.IByteChannel</attr> | |
<!-- There's no need to have these methods in this interface at all. | |
They are only present to enforce the covariant return types, and | |
we can't use covariant return types in C#, so the parent | |
interface versions will suffice. | |
Warning CS0108: `Org.Java_websocket.Server.WebSocketServer.IWebSocketServerFactory.CreateWebSocket(Org.Java_websocket.WebSocketAdapter, System.Collections.Generic.IList<Org.Java_websocket.Drafts.Draft>, Java.Net.Socket)' | |
hides inherited member `Org.Java_websocket.IWebSocketFactory.CreateWebSocket(Org.Java_websocket.WebSocketAdapter, System.Collections.Generic.IList<Org.Java_websocket.Drafts.Draft>, Java.Net.Socket)'. | |
Use the new keyword if hiding was intended --> | |
<remove-node path="/api/package[@name='org.java_websocket.server']/interface[@name='WebSocketServer.WebSocketServerFactory']/method[@name='createWebSocket' and count(parameter)=3 and parameter[1][@type='org.java_websocket.WebSocketAdapter'] and parameter[2][@type='java.util.List<org.java_websocket.drafts.Draft>'] and parameter[3][@type='java.net.Socket']]" /> | |
<remove-node path="/api/package[@name='org.java_websocket.server']/interface[@name='WebSocketServer.WebSocketServerFactory']/method[@name='createWebSocket' and count(parameter)=3 and parameter[1][@type='org.java_websocket.WebSocketAdapter'] and parameter[2][@type='org.java_websocket.drafts.Draft'] and parameter[3][@type='java.net.Socket']]" /> | |
<!--- The `IClientHandshakeBuilder` interface only requires a setter. | |
Since setter-only properties are discouraged, we will instead | |
switch the automatically generated properties on | |
`HandshakeImpl1Client` to be plain methods. | |
Error CS0535: `Org.Java_websocket.Handshake.HandshakeImpl1Client' | |
does not implement interface member `Org.Java_websocket.Handshake.IClientHandshakeBuilder.SetResourceDescriptor(string)' --> | |
<attr path="/api/package[@name='org.java_websocket.handshake']/class[@name='HandshakeImpl1Client']/method[@name='setResourceDescriptor' and count(parameter)=1 and parameter[1][@type='java.lang.String']]" name="propertyName"></attr> | |
<attr path="/api/package[@name='org.java_websocket.handshake']/class[@name='HandshakeImpl1Client']/method[@name='getResourceDescriptor' and count(parameter)=0]" name="propertyName"></attr> | |
<!-- The the `IClientHandshake` interface must now also use plain | |
methods to match. | |
Error CS0535: `Org.Java_websocket.Handshake.HandshakeImpl1Client' | |
does not implement interface member `Org.Java_websocket.Handshake.IClientHandshake.ResourceDescriptor.get' --> | |
<attr path="/api/package[@name='org.java_websocket.handshake']/interface[@name='ClientHandshake']/method[@name='getResourceDescriptor' and count(parameter)=0]" name="propertyName"></attr> | |
<!--- Same property vs. method issue here --> | |
<attr path="/api/package[@name='org.java_websocket.handshake']/class[@name='HandshakeImpl1Server']/method[@name='getHttpStatus' and count(parameter)=0]" name="propertyName"></attr> | |
<attr path="/api/package[@name='org.java_websocket.handshake']/class[@name='HandshakeImpl1Server']/method[@name='setHttpStatus' and count(parameter)=1 and parameter[1][@type='short']]" name="propertyName"></attr> | |
<attr path="/api/package[@name='org.java_websocket.handshake']/class[@name='HandshakeImpl1Server']/method[@name='getHttpStatusMessage' and count(parameter)=0]" name="propertyName"></attr> | |
<attr path="/api/package[@name='org.java_websocket.handshake']/class[@name='HandshakeImpl1Server']/method[@name='setHttpStatusMessage' and count(parameter)=1 and parameter[1][@type='java.lang.String']]" name="propertyName"></attr> | |
<attr path="/api/package[@name='org.java_websocket.handshake']/interface[@name='ServerHandshake']/method[@name='getHttpStatus' and count(parameter)=0]" name="propertyName"></attr> | |
<attr path="/api/package[@name='org.java_websocket.handshake']/interface[@name='ServerHandshake']/method[@name='getHttpStatusMessage' and count(parameter)=0]" name="propertyName"></attr> | |
</metadata> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment