logo

Notes from porting Java code to .NET

Recently I needed to use a DFA/NFA (finite-state automata) implementation from a Java package in .NET. I could not find a port of this particular package and IKVMC was not an option since I preferred to depend only on the standard library (BCL). So, I decided to port the code myself.

In my case, the Java package didn't have unit tests (at least not publicly available on the website). How could I know that the results of the ported code are the same with the original code?

The solution I came up with was the following:

An example can be found here with integration tests for ported code and Java (through IKVMC).

During the process of porting I came across a few differences between Java and .NET and particularly:

References

Stack Overflow

Java SE 6 Documentation