On 09/29/2014 10:45 PM, Marcus Lagergren wrote:
> OK. New webrev here
> http://cr.openjdk.java.net/~lagergren/8059321.2/webrev/

...

> Let me know if this is semantically sound. From reading the OpenJDK
> code, I think it is.

I would think it should be reversed, in case adapter wants to do
multiple operations on the backing map:

     private static final Set<String> VALID_CACHE_SET =
          Collections.synchronizedSet(
                Collections.newSetFromMap(
                             new WeakHashMap<String, Boolean>()));

Also, the beauty of Set shines here:

  public static void validate(final String pattern, final String flags)
       throws ParserException {
    final Set<String> cache = VALID_CACHE_SET;
    if (VALID_CACHE_SET.add(pattern + flags)) {
      instance.compile(pattern, flags);
    }
  }

-Aleksey.

Reply via email to