RFR JDK-8194667: Regex: Serialization doesn't work with match flags (original) (raw)

Xueming Shen xueming.shen at oracle.com
Fri Jan 12 18:36:55 UTC 2018


On 1/12/18, 10:22 AM, Roger Riggs wrote:

Hi Sherman,

flag0 javadoc: /** 957 * The pattern flags used during compiling. The flags might be turned on and 958 * off by*an *embedded flag. 959 */ 2946-3047: Can an exception happen between save and restore? Would the value of flag0 matter if so? if there is any exception thrown (in the middle of pattern compiling) you don't even get a Pattern object. So the status of "flag0" does not matter at all in this circumstance.

+Copyright year update

will be updated accordingly.

thanks, sherman

Regards, Roger On 1/12/2018 11:48 AM, Xueming Shen wrote: Hi,

Please help review the change for JDK-8194667 issue: https://bugs.openjdk.java.net/browse/JDK-8194667 webrev: http://cr.openjdk.java.net/~sherman/8194667/webrev The bits of "flags" are being updated on and off during the pattern compiling by the possible embedded match flag(s) in old implementation. The proposed fix is to add a temporary field "flags0" for this purpose and save/store "flags" for the purpose of deserialization (same as the field "pattern"). For the compatibility concern I'm leaving the behavior of method flags() unchanged to return the muted "flags". Arguably it might be desired to return the original "flags" instead. We can leave this "issue" for future RFE. 1145 public int flags() { 1146 return flags0; 1147 }

Thanks, Sherman



More information about the core-libs-dev mailing list