Sort & format fixes.
git-svn-id: https://google-web-toolkit.googlecode.com/svn/releases/1.6@3871 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/src/com/google/gwt/i18n/rebind/AbstractLocalizableInterfaceCreator.java b/user/src/com/google/gwt/i18n/rebind/AbstractLocalizableInterfaceCreator.java
index 25e7da2..8d1d141 100644
--- a/user/src/com/google/gwt/i18n/rebind/AbstractLocalizableInterfaceCreator.java
+++ b/user/src/com/google/gwt/i18n/rebind/AbstractLocalizableInterfaceCreator.java
@@ -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();
@@ -277,32 +304,4 @@
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();
- }
}
diff --git a/user/src/com/google/gwt/user/client/rpc/impl/AbstractSerializationStream.java b/user/src/com/google/gwt/user/client/rpc/impl/AbstractSerializationStream.java
index 800551b..2177020 100644
--- a/user/src/com/google/gwt/user/client/rpc/impl/AbstractSerializationStream.java
+++ b/user/src/com/google/gwt/user/client/rpc/impl/AbstractSerializationStream.java
@@ -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>{@link ServerSerializationStreamWriter}.deserializeStringTable
* <li>{@link ClientSerializationStreamReader}.getQuotingRegex
diff --git a/user/src/com/google/gwt/user/client/rpc/impl/ClientSerializationStreamWriter.java b/user/src/com/google/gwt/user/client/rpc/impl/ClientSerializationStreamWriter.java
index 2b695c4..f760109 100644
--- a/user/src/com/google/gwt/user/client/rpc/impl/ClientSerializationStreamWriter.java
+++ b/user/src/com/google/gwt/user/client/rpc/impl/ClientSerializationStreamWriter.java
@@ -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 {@link 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 {@link ServerSerializationStreamReader#deserializeStringTable}
- * for the corresponding dequoting.
- *
+ *
+ * See {@link ServerSerializationStreamReader#deserializeStringTable} for the
+ * corresponding dequoting.
+ *
* @param str string to quote
* @return quoted string
*/
diff --git a/user/test/com/google/gwt/i18n/client/TestAnnotatedMessages.java b/user/test/com/google/gwt/i18n/client/TestAnnotatedMessages.java
index ac15ff0..7c0d56c 100644
--- a/user/test/com/google/gwt/i18n/client/TestAnnotatedMessages.java
+++ b/user/test/com/google/gwt/i18n/client/TestAnnotatedMessages.java
@@ -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")
-@GenerateKeys("com.google.gwt.i18n.rebind.keygen.MethodNameKeyGenerator") // default
+// @GenerateKeys("com.google.gwt.i18n.rebind.keygen.MD5KeyGenerator")
+@GenerateKeys("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);
}
diff --git a/user/test/com/google/gwt/i18n/client/gen/Colors.java b/user/test/com/google/gwt/i18n/client/gen/Colors.java
index 5c2f661..560836d 100644
--- a/user/test/com/google/gwt/i18n/client/gen/Colors.java
+++ b/user/test/com/google/gwt/i18n/client/gen/Colors.java
@@ -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ļåçķ".
*
diff --git a/user/test/com/google/gwt/i18n/client/gen/Shapes.java b/user/test/com/google/gwt/i18n/client/gen/Shapes.java
index 008fa79..1f2be04 100644
--- a/user/test/com/google/gwt/i18n/client/gen/Shapes.java
+++ b/user/test/com/google/gwt/i18n/client/gen/Shapes.java
@@ -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".
*
diff --git a/user/test/com/google/gwt/i18n/client/gen/SingleConstant.java b/user/test/com/google/gwt/i18n/client/gen/SingleConstant.java
index cfe955c..a3cfec7 100644
--- a/user/test/com/google/gwt/i18n/client/gen/SingleConstant.java
+++ b/user/test/com/google/gwt/i18n/client/gen/SingleConstant.java
@@ -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".
*
diff --git a/user/test/com/google/gwt/i18n/client/gen/SingleMessages.java b/user/test/com/google/gwt/i18n/client/gen/SingleMessages.java
index 765cce2..d14e857 100644
--- a/user/test/com/google/gwt/i18n/client/gen/SingleMessages.java
+++ b/user/test/com/google/gwt/i18n/client/gen/SingleMessages.java
@@ -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".
*
diff --git a/user/test/com/google/gwt/i18n/client/gen/TestBadKeys.java b/user/test/com/google/gwt/i18n/client/gen/TestBadKeys.java
index 4ce5b34..d10bb2e 100644
--- a/user/test/com/google/gwt/i18n/client/gen/TestBadKeys.java
+++ b/user/test/com/google/gwt/i18n/client/gen/TestBadKeys.java
@@ -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("----------------------------------------------------------------")
diff --git a/user/test/com/google/gwt/i18n/client/gen/TestConstantsQuoting.java b/user/test/com/google/gwt/i18n/client/gen/TestConstantsQuoting.java
index 48a9369..a2a50af 100644
--- a/user/test/com/google/gwt/i18n/client/gen/TestConstantsQuoting.java
+++ b/user/test/com/google/gwt/i18n/client/gen/TestConstantsQuoting.java
@@ -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".
*
diff --git a/user/test/com/google/gwt/i18n/client/gen/TestMessages.java b/user/test/com/google/gwt/i18n/client/gen/TestMessages.java
index d873fd7..022ebeb 100644
--- a/user/test/com/google/gwt/i18n/client/gen/TestMessages.java
+++ b/user/test/com/google/gwt/i18n/client/gen/TestMessages.java
@@ -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);
}
diff --git a/user/test/com/google/gwt/i18n/client/gen/TestMessagesQuoting.java b/user/test/com/google/gwt/i18n/client/gen/TestMessagesQuoting.java
index 4e7887c..b20efdc 100644
--- a/user/test/com/google/gwt/i18n/client/gen/TestMessagesQuoting.java
+++ b/user/test/com/google/gwt/i18n/client/gen/TestMessagesQuoting.java
@@ -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.".
*