Analysis includes three passes and attempted type resolution of your code before generation of equivilent or near-equivilent PHP.
We use a full AST model to accurately parse your Java projects.
Interface and Enumeration declarations are supported and converted to equivilent PHP classes automatically.
Java inheritance is converted to equivilent PHP class inheritence.
PHP does not natively support multiple constructors per class, but with our overload detection and resolution engine, JAVAtoPHP resolves multiple constructors both at point of declaration and when used in code. Static methods are used in place of the traditional __construct() method.
Again, PHP does not natively support method overloading, but with our overload detection and resolution engine your overloaded functions will be converted to unique seperate functions. Calls to overloaded functions are resolved where possible using type analysis, and the appropriate replacements are made in the output code.
Our contextual type-based resolution engine performs a deep type inspection of the arguments passed into overloaded methods and constructors. Using the resultant type information, the engine attempts to match the call to the correct method or constructor.
Static and dynamic imports are accounted for with liberal translation to require_once() statements (with adapted paths) and accurate detection and scope resolution of static fields and methods.
Because PHP does not natively support field initialization with non-primitive data, our engine introduces __init() and __staticinit() functions into each class. The first: __init() is called whenever a new instance of the class is created. The second: __staticinit() is called when the class is first loaded, and populates any static members with their correct values.
Inspects your project directory structure and generates an equivalent project structure for the php project.
JAVAtoPHP is written in Java, but packaged as a windows executable for your convinence. You may also download the jar file (linux, mac compatible) if you do not run windows.
It will make a best effort attempt at converting your project to PHP syntax and, where possible, translate semantics as required. It will not however (or is very unlikely to) convert your project entirely without the need for human intervention.
It does not include a PHP version of the Java runtime environment or libraries. Calls to classes such as System and Arrays are left in (syntactically equivalent) PHP code. It is up to you to change these out or (at own risk) attempt to convert the parts of the JRE you require.
Do not use JAVAtoPHP on financial or critical systems software unless you are going to review every line of code yourself at the end.