Revision: 5940 Author: [email protected] Date: Tue Aug 11 10:21:03 2009 Log: Fix compiler errors when importing only Core.gwt.xml. Fix generic type warnings in WeakMapping.
Patch by: bobv Review by: rjrjr http://code.google.com/p/google-web-toolkit/source/detail?r=5940 Added: /trunk/user/super/com/google/gwt/core /trunk/user/super/com/google/gwt/core/translatable /trunk/user/super/com/google/gwt/core/translatable/com /trunk/user/super/com/google/gwt/core/translatable/com/google /trunk/user/super/com/google/gwt/core/translatable/com/google/gwt /trunk/user/super/com/google/gwt/core/translatable/com/google/gwt/core /trunk/user/super/com/google/gwt/core/translatable/com/google/gwt/core/client /trunk/user/super/com/google/gwt/core/translatable/com/google/gwt/core/client/impl /trunk/user/super/com/google/gwt/core/translatable/com/google/gwt/core/client/impl/WeakMapping.java Deleted: /trunk/user/super/com/google/gwt/user/translatable/com/google/gwt/core/client/impl/WeakMapping.java Modified: /trunk/user/src/com/google/gwt/core/Core.gwt.xml /trunk/user/src/com/google/gwt/core/client/impl/WeakMapping.java ======================================= --- /dev/null +++ /trunk/user/super/com/google/gwt/core/translatable/com/google/gwt/core/client/impl/WeakMapping.java Tue Aug 11 10:21:03 2009 @@ -0,0 +1,65 @@ +/* + * Copyright 2009 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.core.client.impl; + +import com.google.gwt.core.client.GwtScriptOnly; + +/** + * A class associating a (String, Object) map with arbitrary source objects + * (except for Strings). This implementation is used in web mode. + */ +...@gwtscriptonly +public class WeakMapping { + + /* + * This implementation is used in web mode only. It stores the (key, value) + * maps in an expando field on their source objects. + */ + + /** + * Returns the Object associated with the given key in the (key, value) + * mapping associated with the given Object instance. + * + * @param instance the source Object. + * @param key a String key. + * @return an Object associated with that key on the given instance, or null. + */ + public static native Object get(Object instance, String key) /*-{ + return [email protected]::expando[':' + key]; + }-*/; + + /** + * Associates a value with a given key in the (key, value) mapping associated + * with the given Object instance. Note that the key space is module-wide, so + * some care should be taken to choose sufficiently unique identifiers. + * + * @param instance the source Object. + * @param key a String key. + * @param value the Object to associate with the key on the given source + * Object. + */ + public static void set(Object instance, String key, Object value) { + assert !(instance instanceof String) : "Cannot use Strings with WeakMapping"; + setNative(instance, key, value); + } + + private static native void setNative(Object instance, String key, Object value) /*-{ + if ([email protected]::expando) { + [email protected]::expando = {}; + } + [email protected]::expando[':' + key] = value; + }-*/; +} ======================================= --- /trunk/user/super/com/google/gwt/user/translatable/com/google/gwt/core/client/impl/WeakMapping.java Tue Jul 28 11:57:21 2009 +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright 2009 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.core.client.impl; - -import com.google.gwt.core.client.GwtScriptOnly; - -/** - * A class associating a (String, Object) map with arbitrary source objects - * (except for Strings). This implementation is used in web mode. - */ -...@gwtscriptonly -public class WeakMapping { - - /* - * This implementation is used in web mode only. It stores the (key, value) - * maps in an expando field on their source objects. - */ - - /** - * Returns the Object associated with the given key in the (key, value) - * mapping associated with the given Object instance. - * - * @param instance the source Object. - * @param key a String key. - * @return an Object associated with that key on the given instance, or null. - */ - public static native Object get(Object instance, String key) /*-{ - return [email protected]::expando[':' + key]; - }-*/; - - /** - * Associates a value with a given key in the (key, value) mapping associated - * with the given Object instance. Note that the key space is module-wide, so - * some care should be taken to choose sufficiently unique identifiers. - * - * @param instance the source Object. - * @param key a String key. - * @param value the Object to associate with the key on the given source - * Object. - */ - public static void set(Object instance, String key, Object value) { - assert !(instance instanceof String) : "Cannot use Strings with WeakMapping"; - setNative(instance, key, value); - } - - private static native void setNative(Object instance, String key, Object value) /*-{ - if ([email protected]::expando) { - [email protected]::expando = {}; - } - [email protected]::expando[':' + key] = value; - }-*/; -} ======================================= --- /trunk/user/src/com/google/gwt/core/Core.gwt.xml Thu May 21 08:48:10 2009 +++ /trunk/user/src/com/google/gwt/core/Core.gwt.xml Tue Aug 11 10:21:03 2009 @@ -23,6 +23,8 @@ <inherits name="com.google.gwt.xhr.XMLHttpRequest" /> <inherits name="com.google.gwt.core.CompilerParameters" /> + <super-source path="translatable" /> + <define-linker name="sso" class="com.google.gwt.core.linker.SingleScriptLinker" /> <define-linker name="std" class="com.google.gwt.core.linker.IFrameLinker" /> <define-linker name="xs" class="com.google.gwt.core.linker.XSLinker" /> ======================================= --- /trunk/user/src/com/google/gwt/core/client/impl/WeakMapping.java Mon Jul 6 12:56:52 2009 +++ /trunk/user/src/com/google/gwt/core/client/impl/WeakMapping.java Tue Aug 11 10:21:03 2009 @@ -41,14 +41,14 @@ * reference is permanently set to the identity hash code of the referent at * construction time. */ - static class IdentityWeakReference extends WeakReference { + static class IdentityWeakReference extends WeakReference<Object> { /** * The identity hash code of the referent, cached during construction. */ private int hashCode; - public IdentityWeakReference(Object referent, ReferenceQueue queue) { + public IdentityWeakReference(Object referent, ReferenceQueue<Object> queue) { super(referent, queue); hashCode = System.identityHashCode(referent); } @@ -99,7 +99,7 @@ * A ReferenceQueue used to clean up the map as its keys are * garbage-collected. */ - private static ReferenceQueue queue = new ReferenceQueue(); + private static ReferenceQueue<Object> queue = new ReferenceQueue<Object>(); /** * Returns the Object associated with the given key in the (key, value) @@ -157,7 +157,7 @@ * will be eligible for future garbage collection. */ private static void cleanup() { - Reference ref; + Reference<? extends Object> ref; while ((ref = queue.poll()) != null) { /** * Note that we can still remove ref from the map even though its referent --~--~---------~--~----~------------~-------~--~----~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~----------~----~----~----~------~----~------~--~---
