Revision: 8877
Author: [email protected]
Date: Mon Aug 23 05:12:25 2010
Log: Fixed error on default adapter when using maps with non string keys
and sets with non string values
Review by: [email protected]
http://code.google.com/p/google-web-toolkit/source/detail?r=8877
Added:
/branches/lwc-gwt-migration/bikeshed/test/com/google/gwt/collections/ClientMutableSetIntegerTest.java
/branches/lwc-gwt-migration/bikeshed/test/com/google/gwt/collections/MutableSetIntegerTest.java
Modified:
/branches/lwc-gwt-migration/bikeshed/src/com/google/gwt/collections/CollectionFactory.java
/branches/lwc-gwt-migration/bikeshed/super/com/google/gwt/collections/super/com/google/gwt/collections/Map.java
/branches/lwc-gwt-migration/bikeshed/super/com/google/gwt/collections/super/com/google/gwt/collections/Set.java
/branches/lwc-gwt-migration/bikeshed/test/com/google/gwt/collections/CollectionsServerSideTestSuite.java
/branches/lwc-gwt-migration/bikeshed/test/com/google/gwt/collections/CollectionsTestSuite.java
=======================================
--- /dev/null
+++
/branches/lwc-gwt-migration/bikeshed/test/com/google/gwt/collections/ClientMutableSetIntegerTest.java
Mon Aug 23 05:12:25 2010
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2010 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.collections;
+
+/**
+ * Re-run {...@link MutableSetStringTest} tests under GWT.
+ */
+public class ClientMutableSetIntegerTest extends MutableSetIntegerTest {
+ @Override
+ public String getModuleName() {
+ return "com.google.gwt.collections.Collections";
+ }
+
+}
=======================================
--- /dev/null
+++
/branches/lwc-gwt-migration/bikeshed/test/com/google/gwt/collections/MutableSetIntegerTest.java
Mon Aug 23 05:12:25 2010
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2010 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.collections;
+
+/**
+ * Tests a MutableSet with String elements.
+ */
+public class MutableSetIntegerTest extends MutableSetTest<Integer> {
+
+ @Override
+ public MutableSet<Integer> getSet() {
+ return CollectionFactory.createMutableSet();
+ }
+
+ @Override
+ public void gwtSetUp() {
+ super.gwtSetUp();
+ element1 = 1;
+ element2 = 2;
+ element3 = 3;
+ element4 = 4;
+ element5 = 5;
+ elementUnsupported = null;
+ }
+
+}
=======================================
---
/branches/lwc-gwt-migration/bikeshed/src/com/google/gwt/collections/CollectionFactory.java
Wed Jun 30 09:38:46 2010
+++
/branches/lwc-gwt-migration/bikeshed/src/com/google/gwt/collections/CollectionFactory.java
Mon Aug 23 05:12:25 2010
@@ -27,7 +27,7 @@
if (value == null) {
return null;
}
- return (String) value;
+ return value.toString();
}
};
=======================================
---
/branches/lwc-gwt-migration/bikeshed/super/com/google/gwt/collections/super/com/google/gwt/collections/Map.java
Wed Jun 30 09:38:46 2010
+++
/branches/lwc-gwt-migration/bikeshed/super/com/google/gwt/collections/super/com/google/gwt/collections/Map.java
Mon Aug 23 05:12:25 2010
@@ -89,7 +89,7 @@
*/
protected final String adapt(Object key) {
if (!jsniIsAdapterPresent()) {
- return key == null ? null : (String) key;
+ return key == null ? null : key.toString();
}
return jsniGetAdapter().applyTo(key);
}
=======================================
---
/branches/lwc-gwt-migration/bikeshed/super/com/google/gwt/collections/super/com/google/gwt/collections/Set.java
Wed Jun 30 09:38:46 2010
+++
/branches/lwc-gwt-migration/bikeshed/super/com/google/gwt/collections/super/com/google/gwt/collections/Set.java
Mon Aug 23 05:12:25 2010
@@ -123,7 +123,7 @@
*/
protected final String adapt(Object key) {
if (!jsniIsAdapterPresent()) {
- return key == null ? null : (String) key;
+ return key == null ? null : key.toString();
}
return jsniGetAdapter().applyTo(key);
}
=======================================
---
/branches/lwc-gwt-migration/bikeshed/test/com/google/gwt/collections/CollectionsServerSideTestSuite.java
Tue Jul 20 09:29:15 2010
+++
/branches/lwc-gwt-migration/bikeshed/test/com/google/gwt/collections/CollectionsServerSideTestSuite.java
Mon Aug 23 05:12:25 2010
@@ -32,6 +32,7 @@
suite.addTestSuite(ImmutableArrayTest.class);
suite.addTestSuite(ImmutableArrayInternalTest.class);
suite.addTestSuite(MutableSetStringTest.class);
+ suite.addTestSuite(MutableSetIntegerTest.class);
suite.addTestSuite(MutableSetCustomAdapterTest.class);
suite.addTestSuite(ImmutableSetStringTest.class);
suite.addTestSuite(ImmutableSetAdapterTest.class);
=======================================
---
/branches/lwc-gwt-migration/bikeshed/test/com/google/gwt/collections/CollectionsTestSuite.java
Wed Jun 30 09:38:46 2010
+++
/branches/lwc-gwt-migration/bikeshed/test/com/google/gwt/collections/CollectionsTestSuite.java
Mon Aug 23 05:12:25 2010
@@ -29,6 +29,7 @@
suite.addTestSuite(ClientMutableArrayTest.class);
suite.addTestSuite(GwtImmutableArrayTest.class);
suite.addTestSuite(ClientMutableSetStringTest.class);
+ suite.addTestSuite(ClientMutableSetIntegerTest.class);
suite.addTestSuite(ClientMutableSetCustomAdapterTest.class);
suite.addTestSuite(ClientImmutableSetStringTest.class);
suite.addTestSuite(ClientImmutableSetAdapterTest.class);
--
http://groups.google.com/group/Google-Web-Toolkit-Contributors