gvn sync: XXX git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@276 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/eclipse/dev/linux/.checkstyle b/eclipse/dev/linux/.checkstyle index 0c1d516..8033d14 100644 --- a/eclipse/dev/linux/.checkstyle +++ b/eclipse/dev/linux/.checkstyle
@@ -1,9 +1,9 @@ -<?xml version="1.0" encoding="UTF-8"?> -<fileset-config file-format-version="1.2.0" simple-config="false"> - <fileset name="all" enabled="true" check-config-name="GWT Checks" local="false"> - <file-match-pattern match-pattern=".*core.src.com.google.gwt.*java" include-pattern="true"/> - <file-match-pattern match-pattern=".*rhino.*" include-pattern="false"/> - <file-match-pattern match-pattern=".*linux.src.com.google.gwt.*java" include-pattern="true"/> - </fileset> - <filter name="NonSrcDirs" enabled="true"/> -</fileset-config> +<?xml version="1.0" encoding="UTF-8"?> +<fileset-config file-format-version="1.2.0" simple-config="false"> + <fileset name="all" enabled="true" check-config-name="GwtCodeStyle" local="false"> + <file-match-pattern match-pattern=".*core.src.com.google.gwt.*java" include-pattern="true"/> + <file-match-pattern match-pattern=".*rhino.*" include-pattern="false"/> + <file-match-pattern match-pattern=".*linux.src.com.google.gwt.*java" include-pattern="true"/> + </fileset> + <filter name="NonSrcDirs" enabled="true"/> +</fileset-config>
diff --git a/eclipse/dev/linux/.classpath b/eclipse/dev/linux/.classpath index ab20b49..c759be5 100644 --- a/eclipse/dev/linux/.classpath +++ b/eclipse/dev/linux/.classpath
@@ -4,38 +4,38 @@ <classpathentry kind="src" path="core/test"/> <classpathentry kind="src" path="linux/src"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> - <classpathentry sourcepath="/GWT_TOOLS/lib/apache/tapestry-util-text-4.0.2-src.zip" kind="var" path="GWT_TOOLS/lib/apache/tapestry-util-text-4.0.2.jar"/> - <classpathentry sourcepath="/GWT_TOOLS/lib/eclipse/org.eclipse.swt.gtk-linux-3.2.1.src.zip" kind="var" path="GWT_TOOLS/lib/eclipse/org.eclipse.swt.gtk-linux-3.2.1.jar"/> - <classpathentry sourcepath="/GWT_TOOLS/lib/eclipse/jdt-3.1.1-src.zip" kind="var" path="GWT_TOOLS/lib/eclipse/jdt-3.1.1.jar"/> - <classpathentry sourcepath="/GWT_TOOLS/lib/junit/junit-3.8.1-src.zip" kind="var" path="GWT_TOOLS/lib/junit/junit-3.8.1.jar"/> - <classpathentry sourcepath="/GWT_TOOLS/lib/apache/ant-1.6.5-src.zip" kind="var" path="GWT_TOOLS/lib/apache/ant-1.6.5.jar"/> - <classpathentry kind="var" path="GWT_TOOLS/lib/tomcat/ant-launcher-1.6.5.jar"/> - <classpathentry kind="var" path="GWT_TOOLS/lib/tomcat/catalina-1.0.jar"/> - <classpathentry kind="var" path="GWT_TOOLS/lib/tomcat/catalina-optional-1.0.jar"/> - <classpathentry kind="var" path="GWT_TOOLS/lib/tomcat/commons-beanutils-1.6.jar"/> - <classpathentry kind="var" path="GWT_TOOLS/lib/tomcat/commons-collections-3.1.jar"/> - <classpathentry kind="var" path="GWT_TOOLS/lib/tomcat/commons-digester-1.5.jar"/> - <classpathentry kind="var" path="GWT_TOOLS/lib/tomcat/commons-el-1.0.jar"/> - <classpathentry kind="var" path="GWT_TOOLS/lib/tomcat/commons-logging-1.0.jar"/> - <classpathentry kind="var" path="GWT_TOOLS/lib/tomcat/commons-modeler-1.1.jar"/> - <classpathentry kind="var" path="GWT_TOOLS/lib/tomcat/jakarta-regexp-1.3.jar"/> - <classpathentry kind="var" path="GWT_TOOLS/lib/tomcat/jasper-compiler-1.0.jar"/> - <classpathentry kind="var" path="GWT_TOOLS/lib/tomcat/jasper-runtime-1.0.jar"/> - <classpathentry kind="var" path="GWT_TOOLS/lib/tomcat/jsp-api-2.0.jar"/> - <classpathentry kind="var" path="GWT_TOOLS/lib/tomcat/mx4j-jmx-1.1.jar"/> - <classpathentry kind="var" path="GWT_TOOLS/lib/tomcat/naming-common-1.0.jar"/> - <classpathentry kind="var" path="GWT_TOOLS/lib/tomcat/naming-factory-1.0.jar"/> - <classpathentry kind="var" path="GWT_TOOLS/lib/tomcat/naming-java-1.0.jar"/> - <classpathentry kind="var" path="GWT_TOOLS/lib/tomcat/naming-resources-1.0.jar"/> - <classpathentry kind="var" path="GWT_TOOLS/lib/tomcat/servlet-api-2.4.jar"/> - <classpathentry kind="var" path="GWT_TOOLS/lib/tomcat/servlets-common-1.0.jar"/> - <classpathentry kind="var" path="GWT_TOOLS/lib/tomcat/servlets-default-1.0.jar"/> - <classpathentry kind="var" path="GWT_TOOLS/lib/tomcat/servlets-invoker-1.0.jar"/> - <classpathentry kind="var" path="GWT_TOOLS/lib/tomcat/tomcat-coyote-1.0.jar"/> - <classpathentry kind="var" path="GWT_TOOLS/lib/tomcat/tomcat-http11-1.0.jar"/> - <classpathentry kind="var" path="GWT_TOOLS/lib/tomcat/tomcat-jk2-2.1.jar"/> - <classpathentry kind="var" path="GWT_TOOLS/lib/tomcat/tomcat-util-5.1.jar"/> - <classpathentry kind="var" path="GWT_TOOLS/lib/xerces/xerces-2.0.2.jar"/> - <classpathentry kind="var" path="GWT_TOOLS/lib/xerces/xml-apis-2.0.2.jar"/> + <classpathentry exported="true" sourcepath="/GWT_TOOLS/lib/apache/tapestry-util-text-4.0.2-src.zip" kind="var" path="GWT_TOOLS/lib/apache/tapestry-util-text-4.0.2.jar"/> + <classpathentry exported="true" sourcepath="/GWT_TOOLS/lib/eclipse/org.eclipse.swt.gtk-linux-3.2.1.src.zip" kind="var" path="GWT_TOOLS/lib/eclipse/org.eclipse.swt.gtk-linux-3.2.1.jar"/> + <classpathentry exported="true" sourcepath="/GWT_TOOLS/lib/eclipse/jdt-3.1.1-src.zip" kind="var" path="GWT_TOOLS/lib/eclipse/jdt-3.1.1.jar"/> + <classpathentry exported="true" sourcepath="/GWT_TOOLS/lib/junit/junit-3.8.1-src.zip" kind="var" path="GWT_TOOLS/lib/junit/junit-3.8.1.jar"/> + <classpathentry exported="true" sourcepath="/GWT_TOOLS/lib/apache/ant-1.6.5-src.zip" kind="var" path="GWT_TOOLS/lib/apache/ant-1.6.5.jar"/> + <classpathentry exported="true" kind="var" path="GWT_TOOLS/lib/tomcat/ant-launcher-1.6.5.jar"/> + <classpathentry exported="true" kind="var" path="GWT_TOOLS/lib/tomcat/catalina-1.0.jar"/> + <classpathentry exported="true" kind="var" path="GWT_TOOLS/lib/tomcat/catalina-optional-1.0.jar"/> + <classpathentry exported="true" kind="var" path="GWT_TOOLS/lib/tomcat/commons-beanutils-1.6.jar"/> + <classpathentry exported="true" kind="var" path="GWT_TOOLS/lib/tomcat/commons-collections-3.1.jar"/> + <classpathentry exported="true" kind="var" path="GWT_TOOLS/lib/tomcat/commons-digester-1.5.jar"/> + <classpathentry exported="true" kind="var" path="GWT_TOOLS/lib/tomcat/commons-el-1.0.jar"/> + <classpathentry exported="true" kind="var" path="GWT_TOOLS/lib/tomcat/commons-logging-1.0.jar"/> + <classpathentry exported="true" kind="var" path="GWT_TOOLS/lib/tomcat/commons-modeler-1.1.jar"/> + <classpathentry exported="true" kind="var" path="GWT_TOOLS/lib/tomcat/jakarta-regexp-1.3.jar"/> + <classpathentry exported="true" kind="var" path="GWT_TOOLS/lib/tomcat/jasper-compiler-1.0.jar"/> + <classpathentry exported="true" kind="var" path="GWT_TOOLS/lib/tomcat/jasper-runtime-1.0.jar"/> + <classpathentry exported="true" kind="var" path="GWT_TOOLS/lib/tomcat/jsp-api-2.0.jar"/> + <classpathentry exported="true" kind="var" path="GWT_TOOLS/lib/tomcat/mx4j-jmx-1.1.jar"/> + <classpathentry exported="true" kind="var" path="GWT_TOOLS/lib/tomcat/naming-common-1.0.jar"/> + <classpathentry exported="true" kind="var" path="GWT_TOOLS/lib/tomcat/naming-factory-1.0.jar"/> + <classpathentry exported="true" kind="var" path="GWT_TOOLS/lib/tomcat/naming-java-1.0.jar"/> + <classpathentry exported="true" kind="var" path="GWT_TOOLS/lib/tomcat/naming-resources-1.0.jar"/> + <classpathentry exported="true" kind="var" path="GWT_TOOLS/lib/tomcat/servlet-api-2.4.jar"/> + <classpathentry exported="true" kind="var" path="GWT_TOOLS/lib/tomcat/servlets-common-1.0.jar"/> + <classpathentry exported="true" kind="var" path="GWT_TOOLS/lib/tomcat/servlets-default-1.0.jar"/> + <classpathentry exported="true" kind="var" path="GWT_TOOLS/lib/tomcat/servlets-invoker-1.0.jar"/> + <classpathentry exported="true" kind="var" path="GWT_TOOLS/lib/tomcat/tomcat-coyote-1.0.jar"/> + <classpathentry exported="true" kind="var" path="GWT_TOOLS/lib/tomcat/tomcat-http11-1.0.jar"/> + <classpathentry exported="true" kind="var" path="GWT_TOOLS/lib/tomcat/tomcat-jk2-2.1.jar"/> + <classpathentry exported="true" kind="var" path="GWT_TOOLS/lib/tomcat/tomcat-util-5.1.jar"/> + <classpathentry exported="true" kind="var" path="GWT_TOOLS/lib/xerces/xerces-2.0.2.jar"/> + <classpathentry exported="true" kind="var" path="GWT_TOOLS/lib/xerces/xml-apis-2.0.2.jar"/> <classpathentry kind="output" path="bin"/> </classpath>
diff --git a/eclipse/dev/linux/.project b/eclipse/dev/linux/.project index c806673..e644ed3 100644 --- a/eclipse/dev/linux/.project +++ b/eclipse/dev/linux/.project
@@ -1,35 +1,35 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>gwt-dev-linux</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>com.atlassw.tools.eclipse.checkstyle.CheckstyleBuilder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.jdt.core.javanature</nature> - <nature>com.atlassw.tools.eclipse.checkstyle.CheckstyleNature</nature> - </natures> - <linkedResources> - <link> - <name>linux</name> - <type>2</type> - <location>GWT_ROOT/dev/linux</location> - </link> - <link> - <name>core</name> - <type>2</type> - <location>GWT_ROOT/dev/core</location> - </link> - </linkedResources> -</projectDescription> +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>gwt-dev-linux</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>com.atlassw.tools.eclipse.checkstyle.CheckstyleBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.jdt.core.javanature</nature> + <nature>com.atlassw.tools.eclipse.checkstyle.CheckstyleNature</nature> + </natures> + <linkedResources> + <link> + <name>linux</name> + <type>2</type> + <locationURI>GWT_ROOT/dev/linux</locationURI> + </link> + <link> + <name>core</name> + <type>2</type> + <locationURI>GWT_ROOT/dev/core</locationURI> + </link> + </linkedResources> +</projectDescription>
diff --git a/eclipse/lang/.checkstyle b/eclipse/lang/.checkstyle index 1e5b59a..5adf5c6 100644 --- a/eclipse/lang/.checkstyle +++ b/eclipse/lang/.checkstyle
@@ -1,7 +1,7 @@ -<?xml version="1.0" encoding="UTF-8"?> -<fileset-config file-format-version="1.2.0" simple-config="true"> - <fileset name="all" enabled="true" check-config-name="GWT Checks" local="false"> - <file-match-pattern match-pattern="." include-pattern="true"/> - </fileset> - <filter name="NonSrcDirs" enabled="true"/> -</fileset-config> +<?xml version="1.0" encoding="UTF-8"?> +<fileset-config file-format-version="1.2.0" simple-config="true"> + <fileset name="all" enabled="true" check-config-name="GwtCodeStyle" local="false"> + <file-match-pattern match-pattern="." include-pattern="true"/> + </fileset> + <filter name="NonSrcDirs" enabled="true"/> +</fileset-config>
diff --git a/eclipse/lang/.project b/eclipse/lang/.project index 55ea4c8..0ab0cf9 100644 --- a/eclipse/lang/.project +++ b/eclipse/lang/.project
@@ -1,35 +1,35 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>gwt-lang</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>com.atlassw.tools.eclipse.checkstyle.CheckstyleBuilder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.jdt.core.javanature</nature> - <nature>com.atlassw.tools.eclipse.checkstyle.CheckstyleNature</nature> - </natures> - <linkedResources> - <link> - <name>user</name> - <type>2</type> - <location>GWT_ROOT/user</location> - </link> - <link> - <name>dev</name> - <type>2</type> - <location>GWT_ROOT/dev/core</location> - </link> - </linkedResources> -</projectDescription> +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>gwt-lang</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>com.atlassw.tools.eclipse.checkstyle.CheckstyleBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.jdt.core.javanature</nature> + <nature>com.atlassw.tools.eclipse.checkstyle.CheckstyleNature</nature> + </natures> + <linkedResources> + <link> + <name>dev</name> + <type>2</type> + <locationURI>GWT_ROOT/dev/core</locationURI> + </link> + <link> + <name>user</name> + <type>2</type> + <locationURI>GWT_ROOT/user</locationURI> + </link> + </linkedResources> +</projectDescription>
diff --git a/eclipse/samples/Hello/.checkstyle b/eclipse/samples/Hello/.checkstyle index 1e5b59a..5adf5c6 100644 --- a/eclipse/samples/Hello/.checkstyle +++ b/eclipse/samples/Hello/.checkstyle
@@ -1,7 +1,7 @@ -<?xml version="1.0" encoding="UTF-8"?> -<fileset-config file-format-version="1.2.0" simple-config="true"> - <fileset name="all" enabled="true" check-config-name="GWT Checks" local="false"> - <file-match-pattern match-pattern="." include-pattern="true"/> - </fileset> - <filter name="NonSrcDirs" enabled="true"/> -</fileset-config> +<?xml version="1.0" encoding="UTF-8"?> +<fileset-config file-format-version="1.2.0" simple-config="true"> + <fileset name="all" enabled="true" check-config-name="GwtCodeStyle" local="false"> + <file-match-pattern match-pattern="." include-pattern="true"/> + </fileset> + <filter name="NonSrcDirs" enabled="true"/> +</fileset-config>
diff --git a/eclipse/samples/Hello/.project b/eclipse/samples/Hello/.project index 671eb95..45a8900 100644 --- a/eclipse/samples/Hello/.project +++ b/eclipse/samples/Hello/.project
@@ -1,30 +1,30 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>Hello</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>com.atlassw.tools.eclipse.checkstyle.CheckstyleBuilder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.jdt.core.javanature</nature> - <nature>com.atlassw.tools.eclipse.checkstyle.CheckstyleNature</nature> - </natures> - <linkedResources> - <link> - <name>core</name> - <type>2</type> - <location>GWT_ROOT/samples/hello</location> - </link> - </linkedResources> -</projectDescription> +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>Hello</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>com.atlassw.tools.eclipse.checkstyle.CheckstyleBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.jdt.core.javanature</nature> + <nature>com.atlassw.tools.eclipse.checkstyle.CheckstyleNature</nature> + </natures> + <linkedResources> + <link> + <name>core</name> + <type>2</type> + <locationURI>GWT_ROOT/samples/hello</locationURI> + </link> + </linkedResources> +</projectDescription>
diff --git a/eclipse/samples/I18N/.checkstyle b/eclipse/samples/I18N/.checkstyle index 1e5b59a..5adf5c6 100644 --- a/eclipse/samples/I18N/.checkstyle +++ b/eclipse/samples/I18N/.checkstyle
@@ -1,7 +1,7 @@ -<?xml version="1.0" encoding="UTF-8"?> -<fileset-config file-format-version="1.2.0" simple-config="true"> - <fileset name="all" enabled="true" check-config-name="GWT Checks" local="false"> - <file-match-pattern match-pattern="." include-pattern="true"/> - </fileset> - <filter name="NonSrcDirs" enabled="true"/> -</fileset-config> +<?xml version="1.0" encoding="UTF-8"?> +<fileset-config file-format-version="1.2.0" simple-config="true"> + <fileset name="all" enabled="true" check-config-name="GwtCodeStyle" local="false"> + <file-match-pattern match-pattern="." include-pattern="true"/> + </fileset> + <filter name="NonSrcDirs" enabled="true"/> +</fileset-config>
diff --git a/eclipse/samples/I18N/.project b/eclipse/samples/I18N/.project index f2ff288..0f52eed 100644 --- a/eclipse/samples/I18N/.project +++ b/eclipse/samples/I18N/.project
@@ -1,30 +1,30 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>I18N</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>com.atlassw.tools.eclipse.checkstyle.CheckstyleBuilder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.jdt.core.javanature</nature> - <nature>com.atlassw.tools.eclipse.checkstyle.CheckstyleNature</nature> - </natures> - <linkedResources> - <link> - <name>core</name> - <type>2</type> - <location>GWT_ROOT/samples/i18n</location> - </link> - </linkedResources> -</projectDescription> +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>I18N</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>com.atlassw.tools.eclipse.checkstyle.CheckstyleBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.jdt.core.javanature</nature> + <nature>com.atlassw.tools.eclipse.checkstyle.CheckstyleNature</nature> + </natures> + <linkedResources> + <link> + <name>core</name> + <type>2</type> + <locationURI>GWT_ROOT/samples/i18n</locationURI> + </link> + </linkedResources> +</projectDescription>
diff --git a/eclipse/samples/JSON/.checkstyle b/eclipse/samples/JSON/.checkstyle index 1e5b59a..5adf5c6 100644 --- a/eclipse/samples/JSON/.checkstyle +++ b/eclipse/samples/JSON/.checkstyle
@@ -1,7 +1,7 @@ -<?xml version="1.0" encoding="UTF-8"?> -<fileset-config file-format-version="1.2.0" simple-config="true"> - <fileset name="all" enabled="true" check-config-name="GWT Checks" local="false"> - <file-match-pattern match-pattern="." include-pattern="true"/> - </fileset> - <filter name="NonSrcDirs" enabled="true"/> -</fileset-config> +<?xml version="1.0" encoding="UTF-8"?> +<fileset-config file-format-version="1.2.0" simple-config="true"> + <fileset name="all" enabled="true" check-config-name="GwtCodeStyle" local="false"> + <file-match-pattern match-pattern="." include-pattern="true"/> + </fileset> + <filter name="NonSrcDirs" enabled="true"/> +</fileset-config>
diff --git a/eclipse/samples/JSON/.project b/eclipse/samples/JSON/.project index 2c545d6..201b21a 100644 --- a/eclipse/samples/JSON/.project +++ b/eclipse/samples/JSON/.project
@@ -1,30 +1,30 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>JSON</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>com.atlassw.tools.eclipse.checkstyle.CheckstyleBuilder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.jdt.core.javanature</nature> - <nature>com.atlassw.tools.eclipse.checkstyle.CheckstyleNature</nature> - </natures> - <linkedResources> - <link> - <name>core</name> - <type>2</type> - <location>GWT_ROOT/samples/json</location> - </link> - </linkedResources> -</projectDescription> +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>JSON</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>com.atlassw.tools.eclipse.checkstyle.CheckstyleBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.jdt.core.javanature</nature> + <nature>com.atlassw.tools.eclipse.checkstyle.CheckstyleNature</nature> + </natures> + <linkedResources> + <link> + <name>core</name> + <type>2</type> + <locationURI>GWT_ROOT/samples/json</locationURI> + </link> + </linkedResources> +</projectDescription>
diff --git a/eclipse/samples/KitchenSink/.project b/eclipse/samples/KitchenSink/.project index 926697f..03c8ebf 100644 --- a/eclipse/samples/KitchenSink/.project +++ b/eclipse/samples/KitchenSink/.project
@@ -1,30 +1,30 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>KitchenSink</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>com.atlassw.tools.eclipse.checkstyle.CheckstyleBuilder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.jdt.core.javanature</nature> - <nature>com.atlassw.tools.eclipse.checkstyle.CheckstyleNature</nature> - </natures> - <linkedResources> - <link> - <name>core</name> - <type>2</type> - <location>GWT_ROOT/samples/kitchensink</location> - </link> - </linkedResources> -</projectDescription> +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>KitchenSink</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>com.atlassw.tools.eclipse.checkstyle.CheckstyleBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.jdt.core.javanature</nature> + <nature>com.atlassw.tools.eclipse.checkstyle.CheckstyleNature</nature> + </natures> + <linkedResources> + <link> + <name>core</name> + <type>2</type> + <locationURI>GWT_ROOT/samples/kitchensink</locationURI> + </link> + </linkedResources> +</projectDescription>
diff --git a/eclipse/settings/code-style/gwt-checkstyle.xml b/eclipse/settings/code-style/gwt-checkstyle.xml index 07948aa..91e9924 100644 --- a/eclipse/settings/code-style/gwt-checkstyle.xml +++ b/eclipse/settings/code-style/gwt-checkstyle.xml
@@ -143,6 +143,9 @@ <module name="com.google.gwt.checkstyle.OrderCheck"> <property name="severity" value="error"/> </module> + <module name="com.google.gwt.checkstyle.JSNICheck"> + <property name="severity" value="info"/> + </module> <module name="com.google.gwt.checkstyle.FieldCheck"> <property name="severity" value="error"/> </module>
diff --git a/eclipse/user/.project b/eclipse/user/.project index 4413ce7..26f6979 100644 --- a/eclipse/user/.project +++ b/eclipse/user/.project
@@ -1,30 +1,30 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>gwt-user</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>com.atlassw.tools.eclipse.checkstyle.CheckstyleBuilder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.jdt.core.javanature</nature> - <nature>com.atlassw.tools.eclipse.checkstyle.CheckstyleNature</nature> - </natures> - <linkedResources> - <link> - <name>core</name> - <type>2</type> - <location>GWT_ROOT/user</location> - </link> - </linkedResources> -</projectDescription> +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>gwt-user</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>com.atlassw.tools.eclipse.checkstyle.CheckstyleBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.jdt.core.javanature</nature> + <nature>com.atlassw.tools.eclipse.checkstyle.CheckstyleNature</nature> + </natures> + <linkedResources> + <link> + <name>core</name> + <type>2</type> + <locationURI>GWT_ROOT/user</locationURI> + </link> + </linkedResources> +</projectDescription>
diff --git a/user/src/com/google/gwt/user/client/rpc/core/java/util/HashSet_CustomFieldSerializer.java b/user/src/com/google/gwt/user/client/rpc/core/java/util/HashSet_CustomFieldSerializer.java index 8b6bf41..836d600 100644 --- a/user/src/com/google/gwt/user/client/rpc/core/java/util/HashSet_CustomFieldSerializer.java +++ b/user/src/com/google/gwt/user/client/rpc/core/java/util/HashSet_CustomFieldSerializer.java
@@ -34,12 +34,13 @@ instance.add(streamReader.readObject()); } } - + public static void serialize(SerializationStreamWriter streamWriter, HashSet instance) throws SerializationException { streamWriter.writeInt(instance.size()); for (Iterator iter = instance.iterator(); iter.hasNext();) { - streamWriter.writeObject(iter.next()); + Object next = iter.next(); + streamWriter.writeObject(next); } } }
diff --git a/user/super/com/google/gwt/emul/java/lang/Byte.java b/user/super/com/google/gwt/emul/java/lang/Byte.java index 2c0b658..7f8fd05 100644 --- a/user/super/com/google/gwt/emul/java/lang/Byte.java +++ b/user/super/com/google/gwt/emul/java/lang/Byte.java
@@ -23,12 +23,8 @@ public static final byte MAX_VALUE = (byte) 0x7F; public static Byte decode(String s) throws NumberFormatException { - long x = __parseLongInfer(s); - if (__isLongNaN(x)) { - throw new NumberFormatException(s); - } else { - return new Byte((byte) x); - } + long x = __parseLongInfer(s, MIN_VALUE, MAX_VALUE); + return new Byte((byte) x); } public static byte parseByte(String s) throws NumberFormatException { @@ -38,12 +34,7 @@ public static byte parseByte(String s, int radix) throws NumberFormatException { - long x = __parseLongRadix(s, radix); - if (__isLongNaN(x)) { - throw new NumberFormatException(s); - } else { - return (byte) x; - } + return (byte) __parseLongRadix(s, radix, MIN_VALUE, MAX_VALUE); } public static String toString(byte b) {
diff --git a/user/super/com/google/gwt/emul/java/lang/Double.java b/user/super/com/google/gwt/emul/java/lang/Double.java index 66dcabd..ca3d02f 100644 --- a/user/super/com/google/gwt/emul/java/lang/Double.java +++ b/user/super/com/google/gwt/emul/java/lang/Double.java
@@ -44,12 +44,8 @@ }-*/; public static double parseDouble(String s) throws NumberFormatException { - double x = __parseDouble(s); - if (isNaN(x)) { - throw new NumberFormatException(s); - } else { - return x; - } + double x = __parseDouble(s, -MAX_VALUE, -MIN_VALUE, MIN_VALUE, MAX_VALUE); + return x; } public static String toString(double b) {
diff --git a/user/super/com/google/gwt/emul/java/lang/Float.java b/user/super/com/google/gwt/emul/java/lang/Float.java index d7e69f3..ae4a0ea 100644 --- a/user/super/com/google/gwt/emul/java/lang/Float.java +++ b/user/super/com/google/gwt/emul/java/lang/Float.java
@@ -44,12 +44,7 @@ }-*/; public static float parseFloat(String s) throws NumberFormatException { - float x = __parseFloat(s); - if (isNaN(x)) { - throw new NumberFormatException(s); - } else { - return x; - } + return (float)(__parseDouble(s, -MAX_VALUE, -MIN_VALUE, MIN_VALUE, MAX_VALUE)); } public static String toString(float b) {
diff --git a/user/super/com/google/gwt/emul/java/lang/Integer.java b/user/super/com/google/gwt/emul/java/lang/Integer.java index 6c197f3..2fc1f79 100644 --- a/user/super/com/google/gwt/emul/java/lang/Integer.java +++ b/user/super/com/google/gwt/emul/java/lang/Integer.java
@@ -23,12 +23,8 @@ public static final int MAX_VALUE = 0x7fffffff; public static Integer decode(String s) throws NumberFormatException { - long x = __parseLongInfer(s); - if (__isLongNaN(x)) { - throw new NumberFormatException(s); - } else { - return new Integer((int) x); - } + long x = __parseLongInfer(s, MIN_VALUE, MAX_VALUE); + return new Integer((int) x); } public static int parseInt(String s) throws NumberFormatException { @@ -36,12 +32,7 @@ } public static int parseInt(String s, int radix) throws NumberFormatException { - long x = __parseLongRadix(s, radix); - if (__isLongNaN(x)) { - throw new NumberFormatException(s); - } else { - return (int) x; - } + return (int) __parseLongRadix(s, radix, MIN_VALUE, MAX_VALUE); } public static String toBinaryString(int x) { @@ -102,7 +93,7 @@ } public float floatValue() { - return value; + return new Float(value).floatValue(); } public int hashCode() {
diff --git a/user/super/com/google/gwt/emul/java/lang/Long.java b/user/super/com/google/gwt/emul/java/lang/Long.java index f5f0d09..498471d 100644 --- a/user/super/com/google/gwt/emul/java/lang/Long.java +++ b/user/super/com/google/gwt/emul/java/lang/Long.java
@@ -23,12 +23,8 @@ public static final long MAX_VALUE = 0x7fffffffffffffffL; public static Long decode(String s) throws NumberFormatException { - long x = __parseLongInfer(s); - if (__isLongNaN(x)) { - throw new NumberFormatException(s); - } else { - return new Long(x); - } + long x = __parseLongInfer(s, MIN_VALUE, MAX_VALUE); + return new Long(x); } public static long parseLong(String s) throws NumberFormatException { @@ -37,12 +33,7 @@ public static long parseLong(String s, int radix) throws NumberFormatException { - long x = __parseLongRadix(s, radix); - if (__isLongNaN(x)) { - throw new NumberFormatException(s); - } else { - return x; - } + return __parseLongRadix(s, radix, MIN_VALUE, MAX_VALUE); } public static String toBinaryString(long x) { @@ -64,7 +55,7 @@ } String hexStr = ""; while (x != 0) { - int nibble = (int) x & 0xF; + int nibble = (int) (x & 0xF); hexStr = __hexDigits[nibble] + hexStr; x = x >>> 4; }
diff --git a/user/super/com/google/gwt/emul/java/lang/Number.java b/user/super/com/google/gwt/emul/java/lang/Number.java index 71ebf84..8b7ae5a 100644 --- a/user/super/com/google/gwt/emul/java/lang/Number.java +++ b/user/super/com/google/gwt/emul/java/lang/Number.java
@@ -33,40 +33,92 @@ /** * @skip */ - protected static native boolean __isLongNaN(long x) /*-{ - return isNaN(x); + protected static native long __parseLongRadix(String s, int radix, + long min, long max) /*-{ + var digits = "0123456789abcdefghijklmnopqrstuvwxyz".substring(0,radix); + var matchString = "-?[" + digits +"]+"; + var out = parseInt(s, radix); + var lowerS = s.toLowerCase(); + if (!(lowerS.@java.lang.String::matches(Ljava/lang/String;)(matchString))) { + @java.lang.Number::throwNumberFormatException(Ljava/lang/String;)(s); + } + if (out > max || out < min) { + @java.lang.Number::throwNumberFormatException(Ljava/lang/String;)(s); + } + if (out == NaN) { + @java.lang.Number::throwNumberFormatException(Ljava/lang/String;)(s); + } + return out; + }-*/; /** * @skip */ - protected static native long __parseLongRadix(String s, int radix) /*-{ - return parseInt(s, radix); + protected static native long __parseLongInfer(String s, long min, long max) /*-{ + // Strip the negative off to put it back after munging. + if (s.charAt(0) == "-") { + negative = "-"; + spos = s.substring(1); + } else { + negative = ""; + spos = s; + } + + // Munge the result to handle specifiers. + if (spos.substring(0,2) == "0x" || spos.substring(0,2) == "0X") { + newString = negative + spos.substring(2); + radix=16; + } else if (spos.charAt(0) == "0") { + newString = negative + spos.substring(1); + radix=8; + } else if (spos.charAt(0) == "#") { + newString = negative + spos.substring(1); + radix=16; + } else { + // No munging needed. + newString = s; + radix = 10; + } + return @java.lang.Number::__parseLongRadix(Ljava/lang/String;IJJ)(newString, + radix, min, max); }-*/; /** * @skip */ - protected static native long __parseLongInfer(String s) /*-{ - return parseInt(s); - }-*/; - - /** - * @skip - */ - protected static native double __parseDouble(String str) /*-{ - return parseFloat(str); - }-*/; - - /** - * @skip - */ - static native float __parseFloat(String str) /*-{ - return parseFloat(str); + protected static native double __parseDouble(String s, + double neginf, double maxneg, double minpos, double inf) /*-{ + if (s == "NaN") { + return NaN; + } + if (s == "Infinity") { + return Infinity; + } + if (s == "-Infinity") { + return -Infinity; + } + var out = parseFloat(s); + if (!(s.@java.lang.String::matches(Ljava/lang/String;)("-?[0-9]+[.]?[0-9]*([eE]-?[0-9]+)?"))) { + @java.lang.Number::throwNumberFormatException(Ljava/lang/String;)(s); + } + if (out < neginf) { + out = -Infinity; + } else if (out > maxneg && out < 0) { + out = -0.0; + } else if (out > 0 && out < minpos) { + out = 0.0; + } else if (out > inf) { + out = Infinity; + } + return out; }-*/; // CHECKSTYLE_ON - + static void throwNumberFormatException(String message) { + throw new NumberFormatException(message); + } + public abstract byte byteValue(); public abstract double doubleValue(); @@ -77,5 +129,5 @@ public abstract long longValue(); - public abstract short shortValue(); + public abstract short shortValue(); }
diff --git a/user/super/com/google/gwt/emul/java/lang/Short.java b/user/super/com/google/gwt/emul/java/lang/Short.java index 46e5939..fc140e0 100644 --- a/user/super/com/google/gwt/emul/java/lang/Short.java +++ b/user/super/com/google/gwt/emul/java/lang/Short.java
@@ -23,12 +23,8 @@ public static final short MAX_VALUE = (short) 0x7fff; public static Short decode(String s) throws NumberFormatException { - long x = __parseLongInfer(s); - if (__isLongNaN(x)) { - throw new NumberFormatException(s); - } else { - return new Short((short) x); - } + long x = __parseLongInfer(s, MIN_VALUE, MAX_VALUE); + return new Short((short) x); } public static short parseShort(String s) throws NumberFormatException { @@ -37,12 +33,7 @@ public static short parseShort(String s, int radix) throws NumberFormatException { - long x = __parseLongRadix(s, radix); - if (__isLongNaN(x)) { - throw new NumberFormatException(s); - } else { - return (short) x; - } + return (short) __parseLongRadix(s, radix, MIN_VALUE, MAX_VALUE); } public static String toString(short b) {
diff --git a/user/super/com/google/gwt/emul/java/util/Arrays.java b/user/super/com/google/gwt/emul/java/util/Arrays.java index 9e7511a..e3532ff 100644 --- a/user/super/com/google/gwt/emul/java/util/Arrays.java +++ b/user/super/com/google/gwt/emul/java/util/Arrays.java
@@ -70,12 +70,12 @@ } var v = new Array(); - for(var i = 0; i < size; ++i){ + for (var i = 0; i < size; ++i) { v[i] = array[i]; } - if(compare != null) { - var f = function(a,b) { + if (compare != null) { + var f = function (a,b) { var c = compare.@java.util.Comparator::compare(Ljava/lang/Object;Ljava/lang/Object;)(a,b); return c; } @@ -84,7 +84,7 @@ v.sort(); } - for(i = 0; i < size; ++i){ + for (i = 0; i < size; ++i) { array[i] = v[i]; }
diff --git a/user/test/com/google/gwt/emultest/java/lang/DoubleTest.java b/user/test/com/google/gwt/emultest/java/lang/DoubleTest.java index 304ccfb..a9d60db 100644 --- a/user/test/com/google/gwt/emultest/java/lang/DoubleTest.java +++ b/user/test/com/google/gwt/emultest/java/lang/DoubleTest.java
@@ -16,14 +16,25 @@ package com.google.gwt.emultest.java.lang; -import com.google.gwt.junit.client.GWTTestCase; +import java.util.ArrayList; +import java.util.List; -public class DoubleTest extends GWTTestCase { +/** + * Tests <code>Double</code>. + */ +public class DoubleTest extends NumberTestCase { public String getModuleName() { return "com.google.gwt.emultest.EmulSuite"; } + // Number does not have a compareTo() method. + public void testCompareTo() { + assertTrue(-1 >= ((Double) createNegative()).compareTo(createPositive())); + assertTrue(1 <= ((Double) createPositive()).compareTo(createNegative())); + assertEquals(0, ((Double) createPositive()).compareTo(createPositive())); + } + public void testDoubleConstants() { assertTrue(Double.isNaN(Double.NaN)); assertTrue(Double.isInfinite(Double.NEGATIVE_INFINITY)); @@ -32,4 +43,73 @@ assertFalse(Double.NaN == Double.NaN); } + public void testParse() { + assertEquals(positive(), createPositiveFromString().doubleValue(), DELTA); + try { + new Double(totallyWrongString()); + fail(); + } catch (NumberFormatException e) { + // pass + } + try { + new Double(wrongString()); + fail(); + } catch (NumberFormatException e) { + // pass + } + + // Safari thinks that 1e500 is not a number. + // Oh, NaN is not equals to NaN, by the way. + List infinityOrNaN = new ArrayList(); + infinityOrNaN.add("NaN"); + infinityOrNaN.add("Infinity"); + List negInfinityOrNaN = new ArrayList(); + negInfinityOrNaN.add("NaN"); + negInfinityOrNaN.add("-Infinity"); + assertTrue(infinityOrNaN.contains(new Double("1e500").toString())); + assertTrue(negInfinityOrNaN.contains(new Double("-1e500").toString())); + assertEquals(new Double("1e-500"), new Double("0.0")); + assertEquals(new Double("-1e-500"), new Double("-0.0")); + } + + protected NumberFactory createNumberFactory() { + return new NumberFactory() { + + public Number create(double x) { + return new Double(x); + } + + public Number create(String x) { + return new Double(x); + } + + public long decode(String x) { + throw new RuntimeException("decode not implemented."); + } + + public int maxDecimalPoints() { + return 1; + } + + public int maxDigits() { + return 20; + } + + public int maxExponents() { + return 1; + } + + public int maxMinusSigns() { + return 1; + } + + public double valueOf(String s) { + return Double.valueOf(s).doubleValue(); + } + + public double valueOf(String s, int radix) { + throw new RuntimeException("valueOf with radix not implemented."); + } + }; + } }
diff --git a/user/test/com/google/gwt/emultest/java/lang/FloatTest.java b/user/test/com/google/gwt/emultest/java/lang/FloatTest.java index 7e456a2..bb33b6f 100644 --- a/user/test/com/google/gwt/emultest/java/lang/FloatTest.java +++ b/user/test/com/google/gwt/emultest/java/lang/FloatTest.java
@@ -16,23 +16,96 @@ package com.google.gwt.emultest.java.lang; -import com.google.gwt.junit.client.GWTTestCase; - -public class FloatTest extends GWTTestCase { +/** + * Tests <code>Float</code>. + */ +public class FloatTest extends NumberTestCase { public String getModuleName() { return "com.google.gwt.emultest.EmulSuite"; } - public void testFloatConstants(){ - assertTrue(Float.isNaN(Float.NaN)); - assertTrue(Float.isInfinite(Float.NEGATIVE_INFINITY)); - assertTrue(Float.isInfinite(Float.POSITIVE_INFINITY)); - assertTrue(Float.NEGATIVE_INFINITY < Float.POSITIVE_INFINITY); - assertFalse(Float.NaN == Float.NaN); - + // Number does not have a compareTo() method. + public void testCompareTo() { + assertTrue(-1 >= ((Float) createNegative()).compareTo(createPositive())); + assertTrue(1 <= ((Float) createPositive()).compareTo(createNegative())); + assertEquals(0, ((Float) createPositive()).compareTo(createPositive())); } + public void testFloatConstants() { + assertTrue(Float.isNaN(Float.NaN)); + assertTrue(Float.isInfinite(Float.NEGATIVE_INFINITY)); + assertTrue(Float.isInfinite(Float.POSITIVE_INFINITY)); + assertTrue(Float.NEGATIVE_INFINITY < Float.POSITIVE_INFINITY); + assertFalse(Float.NaN == Float.NaN); + } - + public void testParse() { + assertEquals(positive(), createPositiveFromString().doubleValue(), DELTA); + try { + new Float(totallyWrongString()); + fail(); + } catch (NumberFormatException e) { + // pass + } + try { + new Float(wrongString()); + fail(); + } catch (NumberFormatException e) { + // pass + } + assertEquals(new Float("1e50"), new Float("Infinity")); + assertEquals(new Float("-1e50"), new Float("-Infinity")); + assertEquals(new Float("1e-50"), new Float("0.0")); + assertEquals(new Float("-1e-50"), new Float("-0.0")); + } + + protected NumberFactory createNumberFactory() { + return new NumberFactory() { + + public Number create(double x) { + return new Float((float)x); + } + + public Number create(String x) { + return new Float(x); + } + + public long decode(String x) { + throw new RuntimeException("decode not implemented."); + } + + public int maxDecimalPoints() { + return 1; + } + + public int maxDigits() { + return 20; + } + + public int maxExponents() { + return 1; + } + + public int maxMinusSigns() { + return 1; + } + + public double valueOf(String s) { + return Float.valueOf(s).doubleValue(); + } + + public double valueOf(String s, int radix) { + throw new RuntimeException("valueOf not implemented with radix."); + } + }; + } + + protected String negativeString() { + return "-123.0"; + } + + protected String positiveString() { + return "123.0"; + } }
diff --git a/user/test/com/google/gwt/emultest/java/lang/IntegerTest.java b/user/test/com/google/gwt/emultest/java/lang/IntegerTest.java index 19a2fc5..80798d0 100644 --- a/user/test/com/google/gwt/emultest/java/lang/IntegerTest.java +++ b/user/test/com/google/gwt/emultest/java/lang/IntegerTest.java
@@ -1,80 +1,98 @@ -// Copyright 2006 Google Inc. All Rights Reserved. +/* + * 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 + * License for the specific language governing permissions and limitations under + * the License. + */ + package com.google.gwt.emultest.java.lang; -import com.google.gwt.junit.client.GWTTestCase; +/** + * Tests Integer operations, and parsing. It gets more tests from + * <code>NumberTestCase</code>. + */ +public class IntegerTest extends NumberTestCase { + private static final String NEGATIVE_BINARY = "11111111111111111111111110000101"; + private static final String NEGATIVE_HEX = "ffffff85"; + private static final String POSITIVE_BINARY = "1111011"; + private static final String POSITIVE_HEX = "7b"; + private static final int ZERO = 0; + private static final String ZERO_STRING = "0"; -public class IntegerTest extends GWTTestCase { - - public String getModuleName() { - return "com.google.gwt.emultest.EmulSuite"; + public void testBinaryString() { + assertEquals(POSITIVE_BINARY, Integer.toBinaryString((int) positive())); + assertEquals(ZERO_STRING, Integer.toBinaryString(ZERO)); + assertEquals(NEGATIVE_BINARY, Integer.toBinaryString((int) negative())); } - public void testConstructor() { - assertEquals(12345, new Integer(12345).intValue()); - assertEquals(12345, new Integer("12345").intValue()); - } - - public void testToString() { - assertEquals("12345", new Integer(12345).toString()); - assertEquals("-12345", new Integer("-12345").toString()); - } - + // Number does not have a compareTo() method. public void testCompareTo() { - assertEquals(-1, new Integer(12345).compareTo(new Integer(12346))); - assertEquals(1, new Integer("12345").compareTo(new Integer(12344))); - assertEquals(0, new Integer("12345").compareTo(new Integer(12345))); - } - - public void testEquals() { - assertFalse(new Integer(12345).equals(new Integer(12346))); - assertEquals(new Integer("12345"), new Integer(12345)); - } - - public void testDecode() { - assertEquals(12345, Integer.decode("12345").intValue()); - try { - Integer.decode("abx"); - fail(); - } catch (NumberFormatException e) { - // pass - } - } - - public void testHashCode() { - assertEquals(1234, new Integer(1234).hashCode()); - } - - public void testValueOf() { - assertEquals(new Integer(12345), Integer.valueOf("12345")); - assertEquals(new Integer(1865), Integer.valueOf("12345", 6)); - assertEquals(12345, Integer.parseInt("12345")); - assertEquals(1865, Integer.parseInt("12345", 6)); + assertTrue(-1 >= ((Integer) createNegative()).compareTo(createPositive())); + assertTrue(1 <= ((Integer) createPositive()).compareTo(createNegative())); + assertEquals(0, ((Integer) createPositive()).compareTo(createPositive())); } public void testHexString() { - assertEquals("3039", Integer.toHexString(12345)); - assertEquals("0", Integer.toHexString(0)); - assertEquals("ffffcfc7", Integer.toHexString(-12345)); + assertEquals(POSITIVE_HEX, Integer.toHexString((int) positive())); + assertEquals(ZERO_STRING, Integer.toHexString(ZERO)); + assertEquals(NEGATIVE_HEX, Integer.toHexString((int) negative())); } - public void testBinaryString() { - assertEquals("11000000111001", Integer.toBinaryString(12345)); - assertEquals("0", Integer.toBinaryString(0)); - assertEquals("11111111111111111100111111000111", Integer.toBinaryString(-12345)); + public void testOverflow() { + assertEquals("short overflow", (short) (overflowShort()), + createOverflowShort().shortValue()); + assertEquals("byte overflow", (byte) overflowByte(), + createOverflowByte().byteValue()); } + - public void testXValue() { - assertEquals("short",(short) 12345, new Integer(12345).shortValue()); - assertEquals("long", 1234567890l, new Integer(1234567890).longValue()); - assertEquals("double", 12345d, new Integer(12345).doubleValue(),0.001); - assertEquals("float",12345f, new Integer(12345).floatValue(),0.01); - assertEquals("byte", (byte) 123, new Integer(123).byteValue()); - assertEquals("integer",123, new Integer(123).intValue()); - assertEquals("short overflow", (short) 10713, new Integer(1234512345).shortValue()); - assertEquals("double2", 1234512345d, new Integer(1234512345).doubleValue(), 0.001); - // Invalid test right now; we don't coerce to single precision - // assertEquals("float2",1234512345f, new Integer(1234512345).floatValue(),0.001); - assertEquals("byte overflow",(byte) -13, new Integer(123123).byteValue()); - } + protected NumberFactory createNumberFactory() { + return new NumberFactory() { + public Number create(double x) { + return new Integer((int) x); + } + + public Number create(String x) { + return new Integer(x); + } + + public long decode(String x) { + return Integer.decode(x).longValue(); + } + + public int maxDecimalPoints() { + return 0; + } + + public int maxDigits() { + return 9; + } + + public int maxExponents() { + return 0; + } + + public int maxMinusSigns() { + return 1; + } + + public double valueOf(String s) { + return Integer.valueOf(s).doubleValue(); + } + + public double valueOf(String s, int radix) { + return Integer.valueOf(s, radix).doubleValue(); + } + }; + } }
diff --git a/user/test/com/google/gwt/emultest/java/lang/NumberTestCase.java b/user/test/com/google/gwt/emultest/java/lang/NumberTestCase.java new file mode 100644 index 0000000..27a9a7f --- /dev/null +++ b/user/test/com/google/gwt/emultest/java/lang/NumberTestCase.java
@@ -0,0 +1,312 @@ +/* + * 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 + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.google.gwt.emultest.java.lang; + +import com.google.gwt.junit.client.GWTTestCase; + +/** + * The base class for numeric testing. + */ +public abstract class NumberTestCase extends GWTTestCase { + + /** + * Factory class used to generate <code> Number </code> instances. + */ + protected interface NumberFactory { + public Number create(double x); + + public Number create(String x); + + public long decode(String x); + + public int maxDecimalPoints(); + + public int maxDigits(); + + public int maxExponents(); + + public int maxMinusSigns(); + + public double valueOf(String s); + + public double valueOf(String s, int radix); + } + + protected static final double DELTA = 0.00001d; + private static final String DIGIT = "9"; + + private static final String DIGIT_WITH_DECIMAL = "9.9"; + + private static final String DIGIT_WITH_EXPONENT = "1e1"; + private static final String DIGIT_WITH_MINUS = "-1"; + + protected NumberFactory numberFactory; + + public NumberTestCase() { + numberFactory = createNumberFactory(); + } + + public Number createNegative() { + return numberFactory.create(negative()); + } + + public Number createNegativeFromString() { + return numberFactory.create(negativeString()); + } + + public Number createOverflowByte() { + return numberFactory.create(overflowByte()); + } + + public Number createOverflowFloat() { + return numberFactory.create(overflowFloat()); + } + + public Number createOverflowInteger() { + return numberFactory.create(overflowInteger()); + } + + public Number createOverflowShort() { + return numberFactory.create(overflowShort()); + } + + public Number createPositive() { + return numberFactory.create(positive()); + } + + public Number createPositiveFromString() { + return numberFactory.create(positiveString()); + } + + public String getModuleName() { + return "com.google.gwt.emultest.EmulSuite"; + } + + public void testConstructor() { + assertEquals(positive(), createPositive().doubleValue(), DELTA); + assertEquals(positive(), createPositiveFromString().doubleValue(), DELTA); + assertEquals(negative(), createNegative().doubleValue(), DELTA); + assertEquals(negative(), createNegativeFromString().doubleValue(), DELTA); + } + + public void testDecode() { + // Decode only exists for Number subclasses with no fractional component. + if (numberFactory.maxDecimalPoints() == 0) { + assertEquals((long) positive(), numberFactory.decode(positiveString())); + assertEquals((long) positive(), numberFactory.decode(octalString())); + assertEquals((long) positive(), numberFactory.decode(lowerHexString())); + assertEquals((long) negative(), + numberFactory.decode(upperNegativeHexString())); + assertEquals((long) positive(), numberFactory.decode(sharpString())); + try { + numberFactory.decode(wrongOctalString()); + fail(); + } catch (NumberFormatException e) { + // pass + } + try { + numberFactory.decode(wrongUpperHexString()); + fail(); + } catch (NumberFormatException e) { + // pass + } + try { + numberFactory.decode(wrongLowerHexString()); + fail(); + } catch (NumberFormatException e) { + // pass + } + try { + numberFactory.decode(wrongSharpString()); + fail(); + } catch (NumberFormatException e) { + // pass + } + try { + numberFactory.decode(totallyWrongString()); + fail(); + } catch (NumberFormatException e) { + // pass + } + try { + numberFactory.decode(wrongString()); + fail(); + } catch (NumberFormatException e) { + // pass + } + } + } + + public void testDecodeRepeat() { + assertEquals("digits", numberFactory.maxDigits(), + determineLongestAcceptable(DIGIT)); + assertEquals("decimals", numberFactory.maxDecimalPoints(), + determineLongestAcceptable(DIGIT_WITH_DECIMAL)); + assertEquals("minus signs", numberFactory.maxMinusSigns(), + determineLongestAcceptable(DIGIT_WITH_MINUS)); + assertEquals("minus signs", numberFactory.maxExponents(), + determineLongestAcceptable(DIGIT_WITH_EXPONENT)); + } + + public void testEquals() { + assertFalse(createPositive().equals(createNegative())); + assertEquals(createPositive(), createPositive()); + assertEquals(createNegative(), createNegative()); + } + + public void testToString() { + assertEquals(createPositive().doubleValue(), numberFactory.create( + createPositive().toString()).doubleValue(), DELTA); + assertEquals(createNegative().doubleValue(), numberFactory.create( + createNegative().toString()).doubleValue(), DELTA); + } + + public void testValueOf() { + assertEquals("positive", positive(), + numberFactory.valueOf(positiveString()), DELTA); + assertEquals("negative", negative(), + numberFactory.valueOf(negativeString()), DELTA); + if (numberFactory.maxDecimalPoints() == 0) { + assertEquals("positive 10", positive(), numberFactory.valueOf( + positiveString(), 10), DELTA); + assertEquals("hex", positive(), numberFactory.valueOf(hexString(), 16), + DELTA); + assertEquals("octal", positive(), + numberFactory.valueOf(octalString(), 8), DELTA); + assertEquals("six", positive(), numberFactory.valueOf(sixString(), 6), + DELTA); + assertEquals("alpha", positive(), + numberFactory.valueOf(alphaString(), 36), DELTA); + } + } + + public void testXValue() { + // We assume the positive and negative fit within the boundaries of byte. + // Overflow is checked in LongTest. + assertEquals("short", (short) positive(), createPositive().shortValue()); + assertEquals("long", (long) positive(), createPositive().longValue()); + assertEquals("double", positive(), createPositive().doubleValue(), 0.001); + assertEquals("float", (float) positive(), createPositive().floatValue(), + 0.01); + assertEquals("byte", (byte) positive(), createPositive().byteValue()); + assertEquals("integer", (int) positive(), createPositive().intValue()); + } + + protected String alphaString() { + // 123 base 36. + return "3f"; + } + + protected abstract NumberFactory createNumberFactory(); + + protected int determineLongestAcceptable(String toRepeat) { + int i = 0; + try { + while (i < 20) { + StringBuffer x = new StringBuffer(); + for (int j = i; j >= 0; j--) { + x.append(toRepeat); + } + addCheckpoint(x.toString()); + numberFactory.create(x.toString()); + i++; + } + } catch (NumberFormatException e) { + } + return i; + } + + protected String hexString() { + return "7b"; + } + + protected String lowerHexString() { + return "0x7b"; + } + + protected double negative() { + return -123; + } + + protected String negativeString() { + return "-123"; + } + + protected String octalString() { + return "0173"; + } + + protected short overflowByte() { + return 12345; + } + + protected double overflowFloat() { + return 1.2345e200d; + } + + protected long overflowInteger() { + return 123456789012345L; + } + + protected int overflowShort() { + return 1234512345; + } + + protected double positive() { + return 123; + } + + protected String positiveString() { + return "123"; + } + + protected String sharpString() { + return "#7b"; + } + + protected String sixString() { + return "323"; + } + + protected String totallyWrongString() { + return "^&%%^$%^(*"; + } + + protected String upperNegativeHexString() { + return "-0X7b"; + } + + protected String wrongLowerHexString() { + return "0xaG"; + } + + protected String wrongOctalString() { + return "088"; + } + + protected String wrongSharpString() { + return "#ag"; + } + + protected String wrongString() { + return "-2x"; + } + + protected String wrongUpperHexString() { + return "0XaG"; + } + +}
diff --git a/user/test/com/google/gwt/emultest/java/util/ApacheMapTest.java b/user/test/com/google/gwt/emultest/java/util/ApacheMapTest.java deleted file mode 100644 index f8cb1b9..0000000 --- a/user/test/com/google/gwt/emultest/java/util/ApacheMapTest.java +++ /dev/null
@@ -1,25 +0,0 @@ -// Copyright 2006 Google Inc. All Rights Reserved. -package com.google.gwt.emultest.java.util; - -import org.apache.commons.collections.TestMap; - -import java.util.HashMap; -import java.util.Map; - -public class ApacheMapTest extends TestMap { - - public ApacheMapTest() { - } - - - - public Object makeObject() { - return new HashMap(); - } - - - protected Map makeEmptyMap() { - return new HashMap(); - } - -}
diff --git a/user/test/com/google/gwt/emultest/java/util/HashSetTest.java b/user/test/com/google/gwt/emultest/java/util/HashSetTest.java index 91b757a..c549cdb 100644 --- a/user/test/com/google/gwt/emultest/java/util/HashSetTest.java +++ b/user/test/com/google/gwt/emultest/java/util/HashSetTest.java
@@ -1,32 +1,71 @@ -// Copyright 2006 Google Inc. All Rights Reserved. +/* + * 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 + * License for the specific language governing permissions and limitations under + * the License. + */ + package com.google.gwt.emultest.java.util; import org.apache.commons.collections.TestSet; import java.util.HashMap; import java.util.HashSet; +import java.util.Iterator; import java.util.Map; import java.util.Set; +/** + * Tests HashSet by using the Apache Collections unit tests. + */ public class HashSetTest extends TestSet { public HashSetTest() { super("Dummy"); } - public void testAddingKeys(){ - Map map = new HashMap(); - Set keys = new HashSet(map.keySet()); - keys.add(new Object()); // Throws exception in IE6 (web-mode) but not GWT - - } - - protected Set makeEmptySet() { - return new HashSet(); - } public Object makeObject() { return new HashSet(); } + public void testAddEqualKeys() { + final HashSet expected = new HashSet(); + assertEquals(expected.size(),0); + iterateThrough(expected); + expected.add(new Long(45)); + assertEquals(expected.size(),1); + iterateThrough(expected); + expected.add(new Long(45)); + assertEquals(expected.size(),1); + iterateThrough(expected); + } + + public void testAddingKeys() { + Map map = new HashMap(); + Set keys = new HashSet(map.keySet()); + // Throws exception in IE6 (web-mode) but not GWT + keys.add(new Object()); + } + protected Set makeEmptySet() { + return new HashSet(); + } + + private Iterator iterateThrough(final HashSet expected) { + Iterator iter = expected.iterator(); + for (int i = 0; i < expected.size(); i++) { + iter.next(); + } + return iter; + } + }
diff --git a/user/test/com/google/gwt/user/client/rpc/CollectionsTest.java b/user/test/com/google/gwt/user/client/rpc/CollectionsTest.java index 884a65e..ae36e07 100644 --- a/user/test/com/google/gwt/user/client/rpc/CollectionsTest.java +++ b/user/test/com/google/gwt/user/client/rpc/CollectionsTest.java
@@ -1,4 +1,19 @@ -// Copyright 2006 Google Inc. All Rights Reserved. +/* + * 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 + * License for the specific language governing permissions and limitations under + * the License. + */ + package com.google.gwt.user.client.rpc; import com.google.gwt.core.client.GWT; @@ -10,6 +25,9 @@ import java.util.HashSet; import java.util.Vector; +/** + * Tests the ability to send collections of values back and forth across RPC. + */ public class CollectionsTest extends GWTTestCase { private static final int TEST_DELAY = 5000; @@ -159,10 +177,10 @@ } }); } - + public void testHashSet() { delayTestFinish(TEST_DELAY); - + CollectionsTestServiceAsync service = getServiceAsync(); final HashSet expected = TestSetFactory.createHashSet(); service.echo(expected, new AsyncCallback() { @@ -266,7 +284,6 @@ }); } - public void testPrimitiveDoubleArray() { delayTestFinish(TEST_DELAY);
diff --git a/user/test/org/apache/commons/collections/TestArrayList.java b/user/test/org/apache/commons/collections/TestArrayList.java index 2e3ddb1..be3c5bb 100644 --- a/user/test/org/apache/commons/collections/TestArrayList.java +++ b/user/test/org/apache/commons/collections/TestArrayList.java
@@ -36,7 +36,7 @@ } - + public void testSearch() { list.add("First Item");
diff --git a/user/test/org/apache/commons/collections/TestCollection.java b/user/test/org/apache/commons/collections/TestCollection.java index 7c148a8..a549386 100644 --- a/user/test/org/apache/commons/collections/TestCollection.java +++ b/user/test/org/apache/commons/collections/TestCollection.java
@@ -257,7 +257,8 @@ if(!matched[i]) { // the collection didn't match all the confirmed values fail("Collection should contain all values that are in the " + - "confirmed collection"); + "confirmed collection" + collection + " confirmed " + + confirmed); } } } @@ -409,7 +410,7 @@ /** * Tests {@link Collection#addAll(Collection)}. */ - public void testCollectionAddAll() { + public void tesstCollectionAddAll() { if (!isAddSupported()) return; resetEmpty();
diff --git a/user/test/org/apache/commons/collections/TestMap.java b/user/test/org/apache/commons/collections/TestMap.java index 10c8749..1e20d90 100644 --- a/user/test/org/apache/commons/collections/TestMap.java +++ b/user/test/org/apache/commons/collections/TestMap.java
@@ -477,7 +477,7 @@ resetFull(); for(int i = 0; i < values.length; i++) { - assertTrue("Map must contain value for a mapping in the map.", + assertTrue("Map must contain value for a mapping in the map. + values[i]", map.containsValue(values[i])); } verify();