www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.announce - JavacTo - translate java source to D

reply Patrick <tengai650 gmail.com> writes:
Hello,

I'm pleased to announce a new java prototype application that is 
designed to translate java source into D source. Or any other 
language that support package, class, interface, and enum 
constructs and provides a built in memory garbage collection. 
Supporting D with JavacTo was my first choice!

JavacTo available at:
https://sourceforge.net/projects/javacto/

Please see the "How To use JavacTo.pdf" part of the download 
package for more information.

This tool is designed to explore the challenges faced in 
translating from one language to another. For example what type 
of code is suitable for auto-translation and what code will 
required complete rewrite? What level of automation can be 
expected? What java packages should be translated and what 
packages can be skipped? Are helper classes a good approach in 
bridging java to other language specific features? These are just 
a few questions that I've been working on as I've been writing 
this tool.

I think JavacTo is a good starting point for people who are 
interested in this topic.

IMHO moving java opensource projects to D has the potential to be 
an incredible win for the D language/community.


Patrick
Jul 09 2017
next sibling parent reply Jacob Carlborg <doob me.com> writes:
On 2017-07-10 03:52, Patrick wrote:
 Hello,
 
 I'm pleased to announce a new java prototype application that is 
 designed to translate java source into D source. Or any other language 
 that support package, class, interface, and enum constructs and provides 
 a built in memory garbage collection. Supporting D with JavacTo was my 
 first choice!
 
 JavacTo available at:
 https://sourceforge.net/projects/javacto/
Interesting. I'm working on a similar tool, to translate Java code to D [1]. It's written in Scala and uses the Eclipse JDT library to parse the Java code. [1] https://github.com/d-widget-toolkit/jport/tree/dev -- /Jacob Carlborg
Jul 10 2017
parent reply Phillip <phillip ptav.ch> writes:
On Monday, 10 July 2017 at 08:22:16 UTC, Jacob Carlborg wrote:

 Interesting. I'm working on a similar tool, to translate Java 
 code to D [1]. It's written in Scala and uses the Eclipse JDT 
 library to parse the Java code.

 [1] https://github.com/d-widget-toolkit/jport/tree/dev
Jacob - as with Patrick's posting - this looks useful for anyone working with legacy java code that needs/ or wants to migrate to D. Though less familiar with Scala, will certainly take a look as i get time to test further. Thanks much for posting. p.
Jul 11 2017
parent reply Jacob Carlborg <doob me.com> writes:
On 2017-07-11 21:52, Phillip wrote:

 Jacob - as with Patrick's posting - this looks useful for anyone working 
 with legacy java code that needs/ or wants to migrate to D. Though less 
 familiar with Scala, will certainly take a look as i get time to test 
 further.
 
 Thanks much for posting.
My plan is to automate the porting of SWT to D (DWT [1]). This has currently been done manually. Hopefully the tool can port the JDT library as well. Then I can port the tool itself to D. Then we would have a Java compiler and a tool to translate Java to D, all written in D :) [1] http://github.com/d-widget-toolkit/dwt -- /Jacob Carlborg
Jul 12 2017
parent reply Dejan Lekic <dejan.lekic gmail.com> writes:
On Wednesday, 12 July 2017 at 07:47:48 UTC, Jacob Carlborg wrote:
 My plan is to automate the porting of SWT to D (DWT [1]). This 
 has currently been done manually. Hopefully the tool can port 
 the JDT library as well. Then I can port the tool itself to D. 
 Then we would have a Java compiler and a tool to translate Java 
 to D, all written in D :)
I thought the guy who originally worked on DWT actually wrote a Java-to-D translator??
Jul 12 2017
parent Jacob Carlborg <doob me.com> writes:
On 2017-07-12 18:22, Dejan Lekic wrote:

 I thought the guy who originally worked on DWT actually wrote a 
 Java-to-D translator??
It depends on what you mean with "originally". There's an old port of SWT 3.0.2 that was for Windows only. This port was not entirely API compatible, IIRC. Then a new port of SWT 3.4.x was created by Frank Beniot [1] that supports both Windows and Linux. The ported source code tries to be as close to the original Java code as possible. This has been updated to D2 and it's the port I'm currently maintaining [2]. He also wrote a tool called Tioport to automatically port Java code to D. It's based one some form of XML documents IIRC. This was eventually stalled because he was not satisfied with the result [3]. The tool I'm working on now, JPort [4], is written in Scala and uses the Eclipse JDT compiler library. The aim is not, at least not first, to be able to port arbitrary Java projects to D. The main focus is to have SWT automatically ported. Then hopefully JDT itself, so the tool can be rewritten in D. I might add specific logic for SWT if that's needed. I think I have a much bigger chance to get this working by using a proper compiler. [1] http://dsource.org/projects/dwt [2] https://github.com/d-widget-toolkit [3] http://dsource.org/projects/tioport/wiki/project_stalled [4] https://github.com/d-widget-toolkit/jport/tree/dev -- /Jacob Carlborg
Jul 12 2017
prev sibling parent Phillip <phillip ptav.ch> writes:
On Monday, 10 July 2017 at 01:52:51 UTC, Patrick wrote:
 Hello,

 I'm pleased to announce a new java prototype application that 
 is designed to translate java source into D source. Or any 
 other language that support package, class, interface, and enum 
 constructs and provides a built in memory garbage collection. 
 Supporting D with JavacTo was my first choice!

 [...]
Patrick this looks promising and very useful for anyone working with legacy java code and wanting to get into Dlang codebase - will dig into it as soon as i get some time. thanks for posting this.. - p.
Jul 11 2017