加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

Scala禁止分配值类

发布时间:2020-12-16 18:31:37 所属栏目:安全 来源:网络整理
导读:根据价值类的文件,它们可能在许多情况下分配: Allocation Summary a value class is treated as another type. a value class is assigned to an array. doing runtime type tests,such as pattern matching. 无论如何说,如果出现这些情况,会抛出编译错误吗
根据价值类的文件,它们可能在许多情况下分配:

Allocation Summary

a value class is treated as another type.

a value class is assigned to an array.

doing runtime type tests,such as pattern matching.

无论如何说,如果出现这些情况,会抛出编译错误吗?

解决方法

内置任何东西(AFAIK).

您可以编写一个SBT插件,在编译任务完成后检查.class文件(使用像BCEL,ASM等库),如果找到任何值类构造函数调用,则会失败.

或者,您应该可以使用compiler plugin(不幸的是,我能够找到的文档已经相当陈旧),并且遇到更多困难.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读