Author: [EMAIL PROTECTED] Date: Mon Oct 27 13:24:40 2008 New Revision: 3871
Modified: releases/1.6/user/src/com/google/gwt/i18n/rebind/AbstractLocalizableInterfaceCreator.java releases/1.6/user/src/com/google/gwt/user/client/rpc/impl/AbstractSerializationStream.java releases/1.6/user/src/com/google/gwt/user/client/rpc/impl/ClientSerializationStreamWriter.java releases/1.6/user/test/com/google/gwt/i18n/client/TestAnnotatedMessages.java releases/1.6/user/test/com/google/gwt/i18n/client/gen/Colors.java releases/1.6/user/test/com/google/gwt/i18n/client/gen/Shapes.java releases/1.6/user/test/com/google/gwt/i18n/client/gen/SingleConstant.java releases/1.6/user/test/com/google/gwt/i18n/client/gen/SingleMessages.java releases/1.6/user/test/com/google/gwt/i18n/client/gen/TestBadKeys.java releases/1.6/user/test/com/google/gwt/i18n/client/gen/TestConstantsQuoting.java releases/1.6/user/test/com/google/gwt/i18n/client/gen/TestMessages.java releases/1.6/user/test/com/google/gwt/i18n/client/gen/TestMessagesQuoting.java Log: Sort & format fixes. Modified: releases/1.6/user/src/com/google/gwt/i18n/rebind/AbstractLocalizableInterfaceCreator.java ============================================================================== --- releases/1.6/user/src/com/google/gwt/i18n/rebind/AbstractLocalizableInterfaceCreator.java (original) +++ releases/1.6/user/src/com/google/gwt/i18n/rebind/AbstractLocalizableInterfaceCreator.java Mon Oct 27 13:24:40 2008 @@ -86,18 +86,8 @@ * hexadecimal character representation. */ private static final char NIBBLE_TO_HEX_CHAR[] = { - '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', - 'E', 'F' - }; - - private static void unicodeEscape(char ch, StringBuilder buf) { - buf.append('\\'); - buf.append('u'); - buf.append(NIBBLE_TO_HEX_CHAR[(ch >> 12) & 0x0F]); - buf.append(NIBBLE_TO_HEX_CHAR[(ch >> 8) & 0x0F]); - buf.append(NIBBLE_TO_HEX_CHAR[(ch >> 4) & 0x0F]); - buf.append(NIBBLE_TO_HEX_CHAR[ch & 0x0F]); - } + '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', + 'E', 'F'}; private static boolean needsUnicodeEscape(char ch) { if (ch == ' ') { @@ -116,20 +106,28 @@ case Character.PARAGRAPH_SEPARATOR: case Character.SURROGATE: return true; - + default: break; } return false; } + private static void unicodeEscape(char ch, StringBuilder buf) { + buf.append('\\'); + buf.append('u'); + buf.append(NIBBLE_TO_HEX_CHAR[(ch >> 12) & 0x0F]); + buf.append(NIBBLE_TO_HEX_CHAR[(ch >> 8) & 0x0F]); + buf.append(NIBBLE_TO_HEX_CHAR[(ch >> 4) & 0x0F]); + buf.append(NIBBLE_TO_HEX_CHAR[ch & 0x0F]); + } + /** * Composer for the current Constant. */ protected SourceWriter composer; - private List<ResourceKeyFormatter> formatters = - new ArrayList<ResourceKeyFormatter>(); + private List<ResourceKeyFormatter> formatters = new ArrayList<ResourceKeyFormatter>(); private File resourceFile; @@ -197,7 +195,7 @@ * Create an annotation to hold the default value. */ protected abstract void genValueAnnotation(String defaultValue); - + /** * Returns the javaDocComment for the class. * @@ -206,7 +204,36 @@ */ protected abstract String javaDocComment(String path); - @SuppressWarnings("unchecked") // use of raw type from LocalizedProperties + protected String makeJavaString(String value) { + StringBuilder buf = new StringBuilder(); + buf.append('\"'); + for (int i = 0; i < value.length(); ++i) { + char c = value.charAt(i); + switch (c) { + case '\r': + buf.append("\\r"); + break; + case '\n': + buf.append("\\n"); + break; + case '\"': + buf.append("\\\""); + break; + default: + if (needsUnicodeEscape(c)) { + unicodeEscape(c, buf); + } else { + buf.append(c); + } + break; + } + } + buf.append('\"'); + return buf.toString(); + } + + @SuppressWarnings("unchecked") + // use of raw type from LocalizedProperties void generateFromPropertiesFile() throws IOException { InputStream propStream = new FileInputStream(resourceFile); LocalizedProperties p = new LocalizedProperties(); @@ -276,33 +303,5 @@ composer = factory.createSourceWriter(writer); resourceFile = resourceBundle; sourceFile = targetLocation; - } - - protected String makeJavaString(String value) { - StringBuilder buf = new StringBuilder(); - buf.append('\"'); - for (int i = 0; i < value.length(); ++i) { - char c = value.charAt(i); - switch (c) { - case '\r': - buf.append("\\r"); - break; - case '\n': - buf.append("\\n"); - break; - case '\"': - buf.append("\\\""); - break; - default: - if (needsUnicodeEscape(c)) { - unicodeEscape(c, buf); - } else { - buf.append(c); - } - break; - } - } - buf.append('\"'); - return buf.toString(); } } Modified: releases/1.6/user/src/com/google/gwt/user/client/rpc/impl/AbstractSerializationStream.java ============================================================================== --- releases/1.6/user/src/com/google/gwt/user/client/rpc/impl/AbstractSerializationStream.java (original) +++ releases/1.6/user/src/com/google/gwt/user/client/rpc/impl/AbstractSerializationStream.java Mon Oct 27 13:24:40 2008 @@ -15,8 +15,6 @@ */ package com.google.gwt.user.client.rpc.impl; -import com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter; - /** * Base class for the client and server serialization streams. This class * handles the basic serialization and deserialization formatting for primitive @@ -27,8 +25,8 @@ /** * The character used to separate fields in client->server RPC messages. * - * Note that this character is referenced in the following places not - * using this constant, and they must be changed if this is: + * Note that this character is referenced in the following places not using + * this constant, and they must be changed if this is: * <ul> * <li>[EMAIL PROTECTED] ServerSerializationStreamWriter}.deserializeStringTable * <li>[EMAIL PROTECTED] ClientSerializationStreamReader}.getQuotingRegex Modified: releases/1.6/user/src/com/google/gwt/user/client/rpc/impl/ClientSerializationStreamWriter.java ============================================================================== --- releases/1.6/user/src/com/google/gwt/user/client/rpc/impl/ClientSerializationStreamWriter.java (original) +++ releases/1.6/user/src/com/google/gwt/user/client/rpc/impl/ClientSerializationStreamWriter.java Mon Oct 27 13:24:40 2008 @@ -19,7 +19,6 @@ import com.google.gwt.core.client.JavaScriptObject; import com.google.gwt.core.client.UnsafeNativeLong; import com.google.gwt.user.client.rpc.SerializationException; -import com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader; import java.util.List; @@ -34,7 +33,7 @@ */ @SuppressWarnings("unused") private static JavaScriptObject regex = getQuotingRegex(); - + private static void append(StringBuffer sb, String token) { assert (token != null); sb.append(token); @@ -42,15 +41,15 @@ } /** - * Create the RegExp instance used for quoting dangerous characters in - * user payload strings. - * + * Create the RegExp instance used for quoting dangerous characters in user + * payload strings. + * * Note that [EMAIL PROTECTED] AbstractSerializationStream#RPC_SEPARATOR_CHAR} is used in * this expression, which must be updated if the separator character is * changed. * - * For Android WebKit, we quote many more characters to keep them from - * being mangled. + * For Android WebKit, we quote many more characters to keep them from being + * mangled. * * @return RegExp object */ @@ -89,10 +88,10 @@ /** * Quote characters in a user-supplied string to make sure they are safe to * send to the server. - * - * See [EMAIL PROTECTED] ServerSerializationStreamReader#deserializeStringTable} - * for the corresponding dequoting. - * + * + * See [EMAIL PROTECTED] ServerSerializationStreamReader#deserializeStringTable} for the + * corresponding dequoting. + * * @param str string to quote * @return quoted string */ Modified: releases/1.6/user/test/com/google/gwt/i18n/client/TestAnnotatedMessages.java ============================================================================== --- releases/1.6/user/test/com/google/gwt/i18n/client/TestAnnotatedMessages.java (original) +++ releases/1.6/user/test/com/google/gwt/i18n/client/TestAnnotatedMessages.java Mon Oct 27 13:24:40 2008 @@ -1,12 +1,12 @@ /* * Copyright 2006 Google Inc. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the @@ -26,14 +26,15 @@ * Test of Messages generation using annotations. */ @DefaultLocale("en-US") -//@GenerateKeys("com.google.gwt.i18n.rebind.keygen.MD5KeyGenerator") [EMAIL PROTECTED]("com.google.gwt.i18n.rebind.keygen.MethodNameKeyGenerator") // default +// @GenerateKeys("com.google.gwt.i18n.rebind.keygen.MD5KeyGenerator") [EMAIL PROTECTED]("com.google.gwt.i18n.rebind.keygen.MethodNameKeyGenerator") +// default @Generate(format = "com.google.gwt.i18n.rebind.format.PropertiesFormat") public interface TestAnnotatedMessages extends Messages { /** * Test of property file lookup on nested classes. - * + * * nestedDollar() is redefined in a property file with a $ in it. * nestedUnderscore() is redefined in a property file with a _ in it. */ @@ -57,7 +58,8 @@ String oneArgument(String value); @DefaultMessage("One argument, which is optional") - String optionalArgument(@Optional String value); + String optionalArgument(@Optional + String value); @DefaultMessage("Two arguments, {1} and {0}, inverted") String invertedArguments(String one, String two); @@ -78,10 +80,12 @@ String getTimeDate(Date value); @DefaultMessage("{0} widgets") - @PluralText({"one", "A widget"}) - String pluralWidgetsOther(@PluralCount int count); + @PluralText( {"one", "A widget"}) + String pluralWidgetsOther(@PluralCount + int count); @DefaultMessage("{1} {0}") - @PluralText({"one", "A {0}"}) - String twoParamPlural(String name, @PluralCount int count); + @PluralText( {"one", "A {0}"}) + String twoParamPlural(String name, @PluralCount + int count); } Modified: releases/1.6/user/test/com/google/gwt/i18n/client/gen/Colors.java ============================================================================== --- releases/1.6/user/test/com/google/gwt/i18n/client/gen/Colors.java (original) +++ releases/1.6/user/test/com/google/gwt/i18n/client/gen/Colors.java Mon Oct 27 13:24:40 2008 @@ -17,10 +17,10 @@ /** * Interface to represent the constants contained in resource bundle: - * 'com/google/gwt/i18n/client/gen/Colors.properties'. + * 'com/google/gwt/i18n/client/gen/Colors.properties'. */ public interface Colors extends com.google.gwt.i18n.client.Constants { - + /** * Translated "bļåçķ". * Modified: releases/1.6/user/test/com/google/gwt/i18n/client/gen/Shapes.java ============================================================================== --- releases/1.6/user/test/com/google/gwt/i18n/client/gen/Shapes.java (original) +++ releases/1.6/user/test/com/google/gwt/i18n/client/gen/Shapes.java Mon Oct 27 13:24:40 2008 @@ -17,10 +17,10 @@ /** * Interface to represent the constants contained in resource bundle: - * 'com/google/gwt/i18n/client/gen/Shapes.properties'. + * 'com/google/gwt/i18n/client/gen/Shapes.properties'. */ public interface Shapes extends com.google.gwt.i18n.client.Constants { - + /** * Translated "a circle". * Modified: releases/1.6/user/test/com/google/gwt/i18n/client/gen/SingleConstant.java ============================================================================== --- releases/1.6/user/test/com/google/gwt/i18n/client/gen/SingleConstant.java (original) +++ releases/1.6/user/test/com/google/gwt/i18n/client/gen/SingleConstant.java Mon Oct 27 13:24:40 2008 @@ -17,10 +17,10 @@ /** * Interface to represent the constants contained in resource bundle: - * 'com/google/gwt/i18n/client/gen/SingleConstant.properties'. + * 'com/google/gwt/i18n/client/gen/SingleConstant.properties'. */ public interface SingleConstant extends com.google.gwt.i18n.client.Constants { - + /** * Translated "me". * Modified: releases/1.6/user/test/com/google/gwt/i18n/client/gen/SingleMessages.java ============================================================================== --- releases/1.6/user/test/com/google/gwt/i18n/client/gen/SingleMessages.java (original) +++ releases/1.6/user/test/com/google/gwt/i18n/client/gen/SingleMessages.java Mon Oct 27 13:24:40 2008 @@ -17,10 +17,10 @@ /** * Interface to represent the messages contained in resource bundle: - * 'com/google/gwt/i18n/client/gen/SingleMessages.properties'. + * 'com/google/gwt/i18n/client/gen/SingleMessages.properties'. */ public interface SingleMessages extends com.google.gwt.i18n.client.Messages { - + /** * Translated "me". * Modified: releases/1.6/user/test/com/google/gwt/i18n/client/gen/TestBadKeys.java ============================================================================== --- releases/1.6/user/test/com/google/gwt/i18n/client/gen/TestBadKeys.java (original) +++ releases/1.6/user/test/com/google/gwt/i18n/client/gen/TestBadKeys.java Mon Oct 27 13:24:40 2008 @@ -17,10 +17,11 @@ /** * Interface to represent the constants contained in resource bundle: - * 'com/google/gwt/i18n/client/gen/TestBadKeys.properties'. + * 'com/google/gwt/i18n/client/gen/TestBadKeys.properties'. */ -public interface TestBadKeys extends com.google.gwt.i18n.client.ConstantsWithLookup { - +public interface TestBadKeys extends + com.google.gwt.i18n.client.ConstantsWithLookup { + /** * Translated "andStar". * @@ -40,9 +41,11 @@ String _(); /** - * Translated "________________________________________________________________". + * Translated + * "________________________________________________________________". * - * @return translated "________________________________________________________________" + * @return translated + * "________________________________________________________________" */ @DefaultStringValue("________________________________________________________________") @Key("----------------------------------------------------------------") Modified: releases/1.6/user/test/com/google/gwt/i18n/client/gen/TestConstantsQuoting.java ============================================================================== --- releases/1.6/user/test/com/google/gwt/i18n/client/gen/TestConstantsQuoting.java (original) +++ releases/1.6/user/test/com/google/gwt/i18n/client/gen/TestConstantsQuoting.java Mon Oct 27 13:24:40 2008 @@ -17,10 +17,11 @@ /** * Interface to represent the constants contained in resource bundle: - * 'com/google/gwt/i18n/client/gen/TestConstantsQuoting.properties'. + * 'com/google/gwt/i18n/client/gen/TestConstantsQuoting.properties'. */ -public interface TestConstantsQuoting extends com.google.gwt.i18n.client.Constants { - +public interface TestConstantsQuoting extends + com.google.gwt.i18n.client.Constants { + /** * Translated "Doesn''t work this way here". * Modified: releases/1.6/user/test/com/google/gwt/i18n/client/gen/TestMessages.java ============================================================================== --- releases/1.6/user/test/com/google/gwt/i18n/client/gen/TestMessages.java (original) +++ releases/1.6/user/test/com/google/gwt/i18n/client/gen/TestMessages.java Mon Oct 27 13:24:40 2008 @@ -17,10 +17,10 @@ /** * Interface to represent the messages contained in resource bundle: - * 'com/google/gwt/i18n/client/gen/TestMessages.properties'. + * 'com/google/gwt/i18n/client/gen/TestMessages.properties'. */ public interface TestMessages extends com.google.gwt.i18n.client.Messages { - + /** * Translated "no args". * @@ -46,7 +46,9 @@ */ @DefaultMessage("{0},{1},{2},{3},{4},{5},{6},{7},{8},{9}") @Key("args10") - String args10(String arg0, String arg1, String arg2, String arg3, String arg4, String arg5, String arg6, String arg7, String arg8, String arg9); + String args10(String arg0, String arg1, String arg2, String arg3, + String arg4, String arg5, String arg6, String arg7, String arg8, + String arg9); /** * Translated "{1} is the second arg, {0} is the first". @@ -55,7 +57,7 @@ */ @DefaultMessage("{1} is the second arg, {0} is the first") @Key("args2") - String args2(String arg0, String arg1); + String args2(String arg0, String arg1); /** * Translated "arg0arg1 arg0,arg1 {0}arg4". @@ -67,13 +69,15 @@ String argsTest(String arg0); /** - * Translated "{0},{1}, \"a\",\"b\", \"{0}\", \"{1}\", ''a'', 'b', '{0}', ''{1}''". + * Translated "{0},{1}, \"a\",\"b\", \"{0}\", \"{1}\", ''a'', 'b', '{0}', + * ''{1}''". * - * @return translated "{0},{1}, \"a\",\"b\", \"{0}\", \"{1}\", ''a'', 'b', '{0}', ''{1}''" + * @return translated "{0},{1}, \"a\",\"b\", \"{0}\", \"{1}\", ''a'', 'b', + * '{0}', ''{1}''" */ @DefaultMessage("{0},{1}, \"a\",\"b\", \"{0}\", \"{1}\", ''a'', 'b', '{0}', ''{1}''") @Key("argsWithQuotes") - String argsWithQuotes(String arg0, String arg1); + String argsWithQuotes(String arg0, String arg1); /** * Translated "". @@ -109,7 +113,7 @@ */ @DefaultMessage("repeatedArgs: {0}, {1}, {0}, {1}, {0}, {1}, {0}, {1}") @Key("testLotsOfUsageOfArgs") - String testLotsOfUsageOfArgs(String arg0, String arg1); + String testLotsOfUsageOfArgs(String arg0, String arg1); /** * Translated "\"~\" ~~ \"~~~~ \"\"". @@ -127,5 +131,5 @@ */ @DefaultMessage("お{0}你{1}好") @Key("unicode") - String unicode(String arg0, String arg1); + String unicode(String arg0, String arg1); } Modified: releases/1.6/user/test/com/google/gwt/i18n/client/gen/TestMessagesQuoting.java ============================================================================== --- releases/1.6/user/test/com/google/gwt/i18n/client/gen/TestMessagesQuoting.java (original) +++ releases/1.6/user/test/com/google/gwt/i18n/client/gen/TestMessagesQuoting.java Mon Oct 27 13:24:40 2008 @@ -17,10 +17,11 @@ /** * Interface to represent the messages contained in resource bundle: - * 'com/google/gwt/i18n/client/gen/TestMessagesQuoting.properties'. + * 'com/google/gwt/i18n/client/gen/TestMessagesQuoting.properties'. */ -public interface TestMessagesQuoting extends com.google.gwt.i18n.client.Messages { - +public interface TestMessagesQuoting extends + com.google.gwt.i18n.client.Messages { + /** * Translated "Embedded\r\ncr-nl.". * --~--~---------~--~----~------------~-------~--~----~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~----------~----~----~----~------~----~------~--~---