What do user-defined value classes look like from Java?

半腔热情 提交于 2019-12-01 16:03:57

Value classes compile as normal classes, and may well appear as references.

The magic in them is that, when the value class doesn't escape the scope, all traces of it are erased from code, effectively inlining all the code. And, of course, giving additional type safety.

See also SIP-15, which explains the mechanics.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!