scala java 转换,自动Java到Scala源代码转换?

(Yes I know I can call Java code from Scala; but that is pointless; I want to DELETE the Java code, not keep it around and have to look at it and maintain it forever!)

Are there any utilities out there to convert Java source to Scala source?

I believe theoretically it should be possible to accomplish with minimal lossage.

I have found this but it seems inactive, probably buggy/incomplete...

http://sourceforge.net/projects/java2scala/

Any alternatives?

解决方案

IntelliJ kinda, sorta, does this. You need to open a project with your Java sources. You can then copy/paste expressions, methods, or entire classes in to a .scala file. This converts to equivalent Scala code.

The fidelity of conversion isn't perfect, and, for this reason, it doesn't support a bulk conversion yet.

I recommend using the latest version of IntelliJ and the Scala Plugin. The Community Edition is free.

Aside from this, Paul Phillips once started the Scalify project to translate code from Java to Scala (or, potentially, your favourite language), and even improve it in the process! He explains the concept in this video. However this effort was stalled, presumably because he turned his attention to directly contributing to the Scala compiler and standard library.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值