是否有处理器/插件可以在 Java 中强制引用透明性、不可变性等?
看起来非常简单: 例如,类上的 @Immutable 如果存在任何非最终字段访问,处理器将给出错误。它必须确保所有合作者也是不可变的。
可以将 @ReferentiallyTransparent (更好的名称?)放在方法上,然后检查以确保所有调用和协作者也标记为 @RefTrans 和 @Immutable...
It seems pretty straightforward:
For example, an @Immutable on a class that the processor would then give error if there were any non-final field accesses. It would have to ensure that all collaborators were also immutable.
A @ReferentiallyTransparent (better name?) could be put on methods that would then check to ensure that all calls and collaborators were also marked @RefTrans and @Immutable...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可能对以下论文感兴趣:Java 中可验证的函数纯度
抽象的 :
You may be interested by the following paper : Verifiable Functional Purity in Java
Abstract :