< prev index next >

src/jdk.compiler/share/classes/com/sun/tools/javac/comp/MemberEnter.java

Print this page

        

*** 285,297 **** ? env.info.scope.owner.kind == MTH ? Type.noType : syms.errType : tree.vartype.type; VarSymbol v = new VarSymbol(0, tree.name, vartype, enclScope.owner); v.flags_field = chk.checkFlags(tree.pos(), tree.mods.flags, v, tree); tree.sym = v; if (tree.init != null) { v.flags_field |= HASINIT; ! if ((v.flags_field & FINAL) != 0 && needsLazyConstValue(tree.init)) { Env<AttrContext> initEnv = getInitEnv(tree, env); initEnv.info.enclVar = v; v.setLazyConstValue(initEnv(tree, initEnv), attr, tree); } --- 285,300 ---- ? env.info.scope.owner.kind == MTH ? Type.noType : syms.errType : tree.vartype.type; VarSymbol v = new VarSymbol(0, tree.name, vartype, enclScope.owner); v.flags_field = chk.checkFlags(tree.pos(), tree.mods.flags, v, tree); tree.sym = v; + /* Don't want constant propagation/folding for instance fields of value classes, + as these can undergo updates via copy on write. + */ if (tree.init != null) { v.flags_field |= HASINIT; ! if ((v.flags_field & FINAL) != 0 && ((v.flags_field & STATIC) != 0 || !types.isValue(v.owner.type)) && needsLazyConstValue(tree.init)) { Env<AttrContext> initEnv = getInitEnv(tree, env); initEnv.info.enclVar = v; v.setLazyConstValue(initEnv(tree, initEnv), attr, tree); }
< prev index next >