Revision: 9779
Author: [email protected]
Date: Mon Feb 28 09:46:39 2011
Log: Fix a codegen bug for use of {0,localtime,predef:FOO}
format in Messages.

Patch by: jat
Review by: pdr

Review at http://gwt-code-reviews.appspot.com/1373801

http://code.google.com/p/google-web-toolkit/source/detail?r=9779

Modified:
 /trunk/user/src/com/google/gwt/i18n/rebind/MessagesMethodCreator.java
 /trunk/user/test/com/google/gwt/i18n/client/I18N2Test.java
 /trunk/user/test/com/google/gwt/i18n/client/TestAnnotatedMessages.java

=======================================
--- /trunk/user/src/com/google/gwt/i18n/rebind/MessagesMethodCreator.java Thu Dec 23 07:49:35 2010 +++ /trunk/user/src/com/google/gwt/i18n/rebind/MessagesMethodCreator.java Mon Feb 28 09:46:39 2011
@@ -433,7 +433,8 @@
           return true;
         }
         out.appendStringValuedExpression(
- dtFormatClassName + ".getFormat(" + PredefinedFormat.class.getName() + "."
+            dtFormatClassName + ".getFormat("
+                + PredefinedFormat.class.getCanonicalName() + "."
+ predef.toString() + ").format(" + argName + tzParam + ")");
         return false;
       }
=======================================
--- /trunk/user/test/com/google/gwt/i18n/client/I18N2Test.java Thu Dec 23 07:49:35 2010 +++ /trunk/user/test/com/google/gwt/i18n/client/I18N2Test.java Mon Feb 28 09:46:39 2011
@@ -453,6 +453,13 @@
     assertEquals("nested dollar b_C", m.nestedDollar());
     assertEquals("nested underscore b", m.nestedUnderscore());
   }
+
+  @SuppressWarnings("deprecation")
+  public void testPredefDateFormat() {
+    TestAnnotatedMessages m = GWT.create(TestAnnotatedMessages.class);
+    Date date = new Date(Date.UTC(2010 - 1900, 1, 2, 3, 4, 5));
+    assertEquals("Short: 2010-02-01", m.predef(date));
+  }

   public void testSpecialPlurals() {
     TestAnnotatedMessages m = GWT.create(TestAnnotatedMessages.class);
=======================================
--- /trunk/user/test/com/google/gwt/i18n/client/TestAnnotatedMessages.java Thu Dec 23 07:49:35 2010 +++ /trunk/user/test/com/google/gwt/i18n/client/TestAnnotatedMessages.java Mon Feb 28 09:46:39 2011
@@ -99,6 +99,9 @@
   @DefaultMessage("in timezone: {0,localdatetime:tz=$tz,yMd hms}")
   SafeHtml inTimezoneAsSafeHtml(Date date, @Optional TimeZone tz);

+  @DefaultMessage("Short: {0,localdatetime,predef:DATE_SHORT}")
+  String predef(Date date);
+
   @DefaultMessage("Once more, with meaning")
   @Meaning("Mangled quote")
   String withMeaning();

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

Reply via email to