Java中存在两条最终记录规则,如下:
a write to final field in constructor
并且the constructed instance reference is assigned to variable afterwards
不能重新排序read a instance reference
并且read the final field in the instance afterwards
不能重新排序
我们可以将上述规则视为发生之前的规则吗?
a write to final field in constructor
发生之前the constructed instance reference is assigned to variable afterwards
read a instance reference
发生之前read the final field in the instance afterwards
我认为发生在规则之前的语义更强。