Reviewers: jlabanca,
Description:
If asserts are enabled, having @DefaultLocale("foo") is a fatal error if
foo is not in the current list of locales.
Please review this at http://gwt-code-reviews.appspot.com/87801
Affected files:
user/src/com/google/gwt/i18n/rebind/AbstractLocalizableImplCreator.java
user/src/com/google/gwt/i18n/rebind/AbstractResource.java
Index:
user/src/com/google/gwt/i18n/rebind/AbstractLocalizableImplCreator.java
===================================================================
--- user/src/com/google/gwt/i18n/rebind/AbstractLocalizableImplCreator.java
(revision 6446)
+++ user/src/com/google/gwt/i18n/rebind/AbstractLocalizableImplCreator.java
(working copy)
@@ -109,7 +109,8 @@
// generated implementations for interface X will be named X_, X_en,
// X_en_CA, etc.
- GwtLocale generatedLocale =
resourceList.findLeastDerivedLocale(locale);
+ GwtLocale generatedLocale = resourceList.findLeastDerivedLocale(logger,
+ locale);
String localeSuffix = String.valueOf(ResourceFactory.LOCALE_SEPARATOR);
localeSuffix += generatedLocale.getAsString();
// Use _ rather than "." in class name, cannot use $
Index: user/src/com/google/gwt/i18n/rebind/AbstractResource.java
===================================================================
--- user/src/com/google/gwt/i18n/rebind/AbstractResource.java (revision
6446)
+++ user/src/com/google/gwt/i18n/rebind/AbstractResource.java (working copy)
@@ -132,11 +132,12 @@
/**
* From the list of locales matched for any resources in this resource
list,
* choose the one that is least derived from the original search
locale.
- *
+ * @param logger logger to use
* @param locale originally requested locale
* @return least derived matched locale
*/
- public GwtLocale findLeastDerivedLocale(GwtLocale locale) {
+ public GwtLocale findLeastDerivedLocale(TreeLogger logger,
+ GwtLocale locale) {
List<GwtLocale> searchList = locale.getCompleteSearchList();
Map<GwtLocale, Integer> derivedIndex = new HashMap<GwtLocale,
Integer>();
for (int i = 0; i < searchList.size(); ++i) {
@@ -148,8 +149,8 @@
GwtLocale matchLocale = list.get(i).getMatchLocale();
Integer wrappedIdx = derivedIndex.get(matchLocale);
if (wrappedIdx == null) {
- assert false : "Locale " + matchLocale + " not in searchlist "
- + searchList;
+ logger.log(TreeLogger.WARN, "Locale " + matchLocale
+ + " not in searchlist " + searchList);
continue;
}
int idx = wrappedIdx;
--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/Google-Web-Toolkit-Contributors
-~----------~----~----~----~------~----~------~--~---