java2haxe Converter - WIP

207 views
Skip to first unread message

Daniel Kuschny

unread,
Sep 3, 2012, 2:31:52 AM9/3/12
to haxe...@googlegroups.com
Hi again!

I decided to publish my work-in-progress Java to Haxe converter. The aim of this project is to create a utility which can take any Java source and convert it to Haxe. Of course some projects will never can be converted completely automated and will need some manual adjustments. I just created this piece of software last day+night so it is in a very early development stage! This project should allow us to port Java libraries easily to Haxe. 
I hope I can find some other developers which would like to contribute to this project to make it a fully working conversion suite. 


The project makes use of MoDisco which allows importing Java Source code into a Eclipse Modeling Framework (EMF) Model. Using this model it's possible to do some further code generation. 

So far I created a very basic and and untested conversion of:
  • Class and Interface-Declarations 
    • Type Arguments
    • Type Constraints
    • Base Types
    • Base Interfaces
  • Method Declarations
    • Type Arguments
    • Type Constraints
    • Return Types
    • Method Parameters
  • Full Statement and Expression Tree
A lot of parts are still missing:
  • Handling of Method/Constructor Overloading
  • Mapping of Java core classes to Haxe classes
  • Generation of the finally block
  • Refactoring of Nested Type Declarations
  • Conversion of Enumerations
    • Special Enums => Classes with SubTypes
    • Normal Enums => Haxe Enums
  • Refactoring of Anonymous Types
  • Generation of all comments
  • ...
Feel free to fork me and extend the project. 

Cheers 
Daniel


Daniel Kuschny

unread,
Sep 3, 2012, 2:39:10 AM9/3/12
to haxe...@googlegroups.com
Damn, I just saw that Cauê already started a similar project. 5 days ago he said that it will probably be ready in the last week (even if there weren't any commits meanwhile).  I hope we can merge those projects somehow. 

Cauê Waneck

unread,
Sep 3, 2012, 1:56:30 PM9/3/12
to haxe...@googlegroups.com
Hey Daniel, very very exciting project you've got there ! :)

2012/9/3 Daniel Kuschny <danie...@gmail.com>
Damn, I just saw that Cauê already started a similar project. 5 days ago he said that it will probably be ready in the last week (even if there weren't any commits meanwhile).  I hope we can merge those projects somehow. 

I think I wasn't clear when I said what would be supported this week!
The intentions are to support -java-lib to the compiler, which will allow input JAR support. This is mostly done, although since it needs some significant changes to the compiler internals, it's waiting for Nicolas' approval :)

My java2haxe project is right now a little slow on dev, even though I've got a working java parser in haxe there! I intend now to use it so it can generate externs to .java source code as well (but no java source code to haxe yet ! ).
The part that generates code to Haxe is on hold, specially since to properly convert overloads, I'd need a typer, which isn't done yet!

Anyway, I'm happy that you've done it! :)

Cheers!
Cauê

Daniel Kuschny

unread,
Sep 15, 2012, 5:39:33 PM9/15/12
to haxe...@googlegroups.com
UPDATE!

I decided to recreate the project on another base. There is already an awesome Java converter on the market: Sharpen. Sharpen can convert Java to C#. I thought it is a good idea to use this tool as it supports a huge set of features like namespace mappings, type mappings naming conventions etc. My task was quite simple: change the output generated by Sharpen. 

It seems to work quite well even if there are several parts which still need to be changed. So, if somebody is bored feel free to contribute changes to the converter or base library. 
Reply all
Reply to author
Forward
0 new messages