从Java使用Scala宏 [英] Using scala macro from java

查看:101
本文介绍了从Java使用Scala宏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当前,我正在编写一个scala宏库,我也想使其在Java中可用.

Currently I'm writing a scala macro library, and I would like to make it usable from java too.

但是我无法想到一种从Java源代码访问scala宏方法的方法.有什么方法可以使用Java中的scala宏方法.

But I cannot think of a way to access scala macro methods form java source code. Is there any way we can use scala macro method from java.

推荐答案

Scala宏是scala编译器的说明,java代码是由javac编译的,它对scala和scala宏都一无所知,所以我想答案是:无法从Java使用它们.

Scala macros are instructions for scala compiler, java code is compiled by javac, which has no idea about both scala and scala macros, so I guess the answer is: there is no way to use them from java.

这篇关于从Java使用Scala宏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆