EmulationMode - mehdimo/janett GitHub Wiki

Note: this feature will be released in future

In Emulation mode, we translate syntax and constructs but not map Java libraries. Instead of Java libraries, we will use thin layer of .Net classes which have the same name with Java ones but delegate call to .Net libraries.

This idea was inspired by db4o project which has been releasing Java and .Net versions of their library simultaneously. They have j4o library as part of their .Net version. An example of this approach taken from j4o library:

....
namespace j4o.io
{
    public class RandomAccessFile
    {
        private FileStream fileStream;
        public RandomAccessFile(string file, string fileMode)
        {
            fileStream = new FileStream(file, FileMode.OpenOrCreate, fileMode.Equals("rw") ?
                                               FileAccess.ReadWrite : FileAccess.Read);
            Compat.LockFileStream(this.fileStream);
        }
        public long Length()
        {
            return fileStream.Length;
        }
        public void Read(byte[] bytes)
        {
            fileStream.Read(bytes, 0, bytes.Length);
        }
            public void Seek(long pos)
        {
            fileStream.Seek(pos, SeekOrigin.Begin);
        }
...

Currently, Janett provides Emulator which emulates JUnit to NUnit and Commons Logging to log4net. Janett success to translate in NativeMode may make EmulationMode less interesting.