I'm trying to use Sharpen in Eclipse to convert a java project (full source) into C#
I followed the guidelines from this blog that worked pretty well: http://tumblr.com/ZVuYOwDv6mdu (which suggest using Lluis Sanchez’s compiled version of Sharpen over the source control)
But I'm getting errors in a few classes that extend on ByteArrayInputStream and ByteArrayOutputStream. Any reference to a property and method of the "super" is returned with "Failed to map"
Example:
[exec] ERROR: /sharpened/src/com/netnumber/dns/message/DnsOutputStream.java:176: failed to map: 'this.nameTable.put(name,new Integer(super.count))' [exec] java.lang.IllegalArgumentException: /sharpened/src/com/netnumber/dns/message/DnsOutputStream.java:176: failed to map: 'this.nameTable.put(name,new Integer(super.count))'
I wondered if there were any easy solution for this via Sharpen or if I would have to take the time and re-write the java code (multiple code files) to "mimic" the references and not using extends and then write the C# code using MemoryStream in the final converted code project?
I have made a very simple test, and the following conversion will indeed fail:
The specific error message indicates that access to a field in the super class is not supported:
On the other hand, if I replace
super.count
withsuper.size()
the Java code is successfully converted into this C# code:In summary: Sharpen does not support accessing fields in a super class. However, access to super class methods is supported. When there is an applicable replacement for the super class field, the Java code can thus be modified to use the alternative constructs before conversion.