kotlin - 如何使 Kotlin 的内联类构造函数对 groovy 可见?
问题描述
Kotlin 1.5 引入了值类,例如:
@JvmInline
value class ShopId(val raw: UUID)
在我的设置中,我有尝试创建这种类型的对象的常规测试:
new ShopId(TestData.SHOP_ID)
但是我收到一个错误:
groovy.lang.GroovyRuntimeException: Could not find matching constructor for: domain.ShopId(UUID)
我猜错误与生成内联类签名的方式有关,根据文档:
fun compute(x: UInt) will be represented as public final void compute-<hashcode>(int x)
因此,我尝试使用编译器 arg 更改修饰方案:
-Xuse-14-inline-classes-mangling-scheme,
可悲的是无济于事。
所以我的问题是:是否可以使用 groovy 中的 kotlin 内联类?如果是这样,我该怎么做?
解决方案
推荐阅读
- google-cloud-platform - Terraform:未创建 google_sql_database_instance
- android - 旋转活动时如何不破坏 ViewModel
- python - 根据列表中列表中的公共元素提取最大列表
- javascript - 防止使用浏览器放大缩小javascript调整图像大小
- c - Windows 编译 v8 上的 pkg-config 错误
- javascript - 数据表不工作且不过滤数据
- python-3.x - PythonL如何输入变量然后使用它在另一个文件中执行然后打印到第一个文件?
- python - python pandas中的制表符和行分隔
- c - 我的应用程序崩溃了,没有任何错误,for循环有问题(?)
- python - 将df的col中的每个元素从字符串转换为列表