The i18n stuff looks good except where commented.

http://gwt-code-reviews.appspot.com/826802/diff/3001/4004
File dev/core/src/com/google/gwt/dev/javac/StandardGeneratorContext.java
(right):

http://gwt-code-reviews.appspot.com/826802/diff/3001/4004#newcode402
dev/core/src/com/google/gwt/dev/javac/StandardGeneratorContext.java:402:
}
Suggest instead:
@SuppressWarnings("unchecked")
public <K, V> Cache<K, V> getCache(Class<?> clazz) {
  Cache<K, V> cache = (Cache<K, V>) storage.get(clazz);
  if (cache == null) {
    cache = new MyCache<K, V>();
    storage.put(clazz, cache);
  }
  return cache;
}

and it would create an empty cache if it didn't already exist.  You
could still use clazz.getCanonicalName() if you needed to avoid keeping
the class alive by being a key in the map.

You could also just use Map instead of Cache if you prefer.

http://gwt-code-reviews.appspot.com/826802/diff/3001/4015
File user/src/com/google/gwt/i18n/rebind/LocaleUtils.java (right):

http://gwt-code-reviews.appspot.com/826802/diff/3001/4015#newcode199
user/src/com/google/gwt/i18n/rebind/LocaleUtils.java:199: return
contextCache;
As mentioned in the other thread, I would suggest moving this into a
GeneratorContext.getCache instead of repeating it.

http://gwt-code-reviews.appspot.com/826802/diff/3001/4017
File user/src/com/google/gwt/i18n/rebind/ResourceFactory.java (right):

http://gwt-code-reviews.appspot.com/826802/diff/3001/4017#newcode47
user/src/com/google/gwt/i18n/rebind/ResourceFactory.java:47: private
static final String CONTEXT_STORAGE_KEY = "ResourceFactory";
I think this would be better as a class literal instead of a string,
even if GeneratorContext used the name of the class as the key
internally.  That way you have to worry lessage about collisions and
refactoring happens automatically.

http://gwt-code-reviews.appspot.com/826802/show

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to