Revision: 6844
Author: [email protected]
Date: Wed Nov 11 12:06:42 2009
Log: Merge tr...@6842 into this branch
Fix external issue 4140: Javascript deserialization error on JPA-annotated  
classes
svn merge --ignore-ancestry -c6842  
https://google-web-toolkit.googlecode.com/svn/trunk/ .


http://code.google.com/p/google-web-toolkit/source/detail?r=6844

Modified:
  /releases/2.0/branch-info.txt
  /releases/2.0/dev/core/src/com/google/gwt/core/ext/typeinfo/JClassType.java
   
/releases/2.0/user/src/com/google/gwt/user/rebind/rpc/FieldSerializerCreator.java
  /releases/2.0/user/src/com/google/gwt/user/rebind/rpc/ProxyCreator.java
   
/releases/2.0/user/src/com/google/gwt/user/rebind/rpc/SerializableTypeOracle.java
   
/releases/2.0/user/src/com/google/gwt/user/rebind/rpc/SerializableTypeOracleBuilder.java
   
/releases/2.0/user/src/com/google/gwt/user/rebind/rpc/SerializableTypeOracleImpl.java
  /releases/2.0/user/src/com/google/gwt/user/rebind/rpc/Shared.java

=======================================
--- /releases/2.0/branch-info.txt       Wed Nov 11 11:04:31 2009
+++ /releases/2.0/branch-info.txt       Wed Nov 11 12:06:42 2009
@@ -559,3 +559,6 @@
      svn merge --ignore-ancestry -r6828:6835 \
        https://google-web-toolkit.googlecode.com/svn/trunk .

+tr...@6842 was merged into this branch
+  Fix external issue 4140: Javascript deserialization error on  
JPA-annotated classes
+  svn merge --ignore-ancestry -c6842  
https://google-web-toolkit.googlecode.com/svn/trunk/ .
=======================================
---  
/releases/2.0/dev/core/src/com/google/gwt/core/ext/typeinfo/JClassType.java     
 
Tue Nov 10 11:37:16 2009
+++  
/releases/2.0/dev/core/src/com/google/gwt/core/ext/typeinfo/JClassType.java     
 
Wed Nov 11 12:06:42 2009
@@ -334,6 +334,14 @@
     * has not been calculated yet.
     */
    private Set<JClassType> flattenedSupertypes;
+
+  /**
+   * True if this type may be enhanced with server-only fields.  This  
property
+   * is 'sticky' and may be set but not unset, since we need to generate  
the
+   * relevant RPC code for handling the server fields if there is any  
chance
+   * the class will be enhanced.
+   */
+  private boolean isEnhanced = false;

    public abstract void addImplementedInterface(JClassType intf);

@@ -558,6 +566,16 @@
     *         <code>false</code> otherwise
     */
    public abstract boolean isDefaultInstantiable();
+
+  /**
+   * Returns true if the type may be enhanced on the server to contain
+   * extra fields that are unknown to client code.
+   *
+   * @return <code>true</code> if the type might be enhanced on the server
+   */
+  public final boolean isEnhanced() {
+    return isEnhanced;
+  }

    public abstract boolean isFinal();

@@ -590,6 +608,14 @@
    public abstract boolean isPublic();

    public abstract boolean isStatic();
+
+  /**
+   * Indicates that the type may be enhanced on the server to contain
+   * extra fields that are unknown to client code.
+   */
+  public void setEnhanced() {
+    this.isEnhanced = true;
+  }

    public abstract void setSuperclass(JClassType type);

=======================================
---  
/releases/2.0/user/src/com/google/gwt/user/rebind/rpc/FieldSerializerCreator.java
        
Wed Nov  4 06:59:39 2009
+++  
/releases/2.0/user/src/com/google/gwt/user/rebind/rpc/FieldSerializerCreator.java
        
Wed Nov 11 12:06:42 2009
@@ -270,8 +270,7 @@
       * If the type is capable of making a round trip between the client and
       * server, store additional server-only field data using {...@link  
WeakMapping}.
       */
-    if (typesSentToBrowser.maybeEnhanced(serializableClass)
-        && typesSentFromBrowser.maybeEnhanced(serializableClass)) {
+    if (serializableClass.isEnhanced()) {
        sourceWriter.println(WEAK_MAPPING_CLASS_NAME + ".set(instance, "
            + "\"server-enhanced-data\", streamReader.readString());");
      }
@@ -319,8 +318,7 @@
       * server, retrieve the additional server-only field data from {...@link  
WeakMapping}.
       */

-    if (typesSentToBrowser.maybeEnhanced(serializableClass)
-        && typesSentFromBrowser.maybeEnhanced(serializableClass)) {
+    if (serializableClass.isEnhanced()) {
        sourceWriter.println("streamWriter.writeString((String) "
            + WEAK_MAPPING_CLASS_NAME + ".get(instance,  
\"server-enhanced-data\"));");
      }
=======================================
--- /releases/2.0/user/src/com/google/gwt/user/rebind/rpc/ProxyCreator.java     
 
Thu Aug 13 14:05:30 2009
+++ /releases/2.0/user/src/com/google/gwt/user/rebind/rpc/ProxyCreator.java     
 
Wed Nov 11 12:06:42 2009
@@ -659,13 +659,12 @@

          /*
           * Emit client-side field information for classes that may be  
enhanced
-         * on the server and which are capable of being transmitted in both
-         * directions. Each line consists of a comma-separated list  
containing
-         * the keyword '@ClientFields', the class name, and a list of all
-         * potentially serializable client-visible fields.
+         * on the server. Each line consists of a comma-separated list
+         * containing the keyword '@ClientFields', the class name, and a  
list of
+         * all potentially serializable client-visible fields.
           */
          if ((type instanceof JClassType)
-            && serializationSto.maybeEnhanced(type) &&  
deserializationSto.maybeEnhanced(type)) {
+            && ((JClassType) type).isEnhanced()) {
            JField[] fields = ((JClassType) type).getFields();
            JField[] rpcFields = new JField[fields.length];
            int numRpcFields = 0;
=======================================
---  
/releases/2.0/user/src/com/google/gwt/user/rebind/rpc/SerializableTypeOracle.java
        
Thu Aug 13 14:05:30 2009
+++  
/releases/2.0/user/src/com/google/gwt/user/rebind/rpc/SerializableTypeOracle.java
        
Wed Nov 11 12:06:42 2009
@@ -40,15 +40,6 @@
     * @return true if the type is serializable
     */
    boolean isSerializable(JType type);
-
-  /**
-   * Returns true if the type may be enhanced on the server to contain
-   * extra fields that are unknown to client code.
-   *
-   * @param type the type to test
-   * @return <code>true</code> if the type might be enhanced on the server
-   */
-  boolean maybeEnhanced(JType type);

    /**
     * Returns <code>true</code> if the type might be instantiated as part of
=======================================
---  
/releases/2.0/user/src/com/google/gwt/user/rebind/rpc/SerializableTypeOracleBuilder.java
         
Wed Nov  4 06:59:39 2009
+++  
/releases/2.0/user/src/com/google/gwt/user/rebind/rpc/SerializableTypeOracleBuilder.java
         
Wed Nov 11 12:06:42 2009
@@ -852,9 +852,6 @@

      logReachableTypes(logger);

-    Set<JClassType> possiblyEnhancedTypes = new TreeSet<JClassType>(
-        JTYPE_COMPARATOR);
-
      Set<JClassType> possiblyInstantiatedTypes = new TreeSet<JClassType>(
          JTYPE_COMPARATOR);

@@ -881,16 +878,17 @@
          fieldSerializableTypes.add(type);
        }

-      if ((enhancedClasses != null &&  
enhancedClasses.contains(type.getQualifiedSourceName()))
-          || tic.maybeEnhanced()) {
-        possiblyEnhancedTypes.add(type);
+      if (tic.maybeEnhanced()
+          || (enhancedClasses != null
+          && enhancedClasses.contains(type.getQualifiedSourceName()))) {
+        type.setEnhanced();
        }
      }

      logSerializableTypes(logger, fieldSerializableTypes);

      return new SerializableTypeOracleImpl(fieldSerializableTypes,
-        possiblyInstantiatedTypes, possiblyEnhancedTypes);
+        possiblyInstantiatedTypes);
    }

    /**
=======================================
---  
/releases/2.0/user/src/com/google/gwt/user/rebind/rpc/SerializableTypeOracleImpl.java
    
Thu Aug 13 14:05:30 2009
+++  
/releases/2.0/user/src/com/google/gwt/user/rebind/rpc/SerializableTypeOracleImpl.java
    
Wed Nov 11 12:06:42 2009
@@ -22,17 +22,14 @@

  final class SerializableTypeOracleImpl implements SerializableTypeOracle {

-  private final Set<JClassType> possiblyEnhancedTypes;
    private final Set<JClassType> possiblyInstantiatedTypes;
    private final Set<JClassType> serializableTypesSet;

    public SerializableTypeOracleImpl(Set<JClassType> serializableTypes,
-      Set<JClassType> possiblyInstantiatedTypes,
-      Set<JClassType> possiblyEnhancedTypes) {
+      Set<JClassType> possiblyInstantiatedTypes) {

      serializableTypesSet = serializableTypes;
      this.possiblyInstantiatedTypes = possiblyInstantiatedTypes;
-    this.possiblyEnhancedTypes = possiblyEnhancedTypes;
    }

    public JType[] getSerializableTypes() {
@@ -45,14 +42,6 @@
    public boolean isSerializable(JType type) {
      return serializableTypesSet.contains(type);
    }
-
-  /**
-   * Returns <code>true</code> if the type may be enhanced on the server to
-   * contain additional fields.
-   */
-  public boolean maybeEnhanced(JType type) {
-    return possiblyEnhancedTypes.contains(type);
-  }

    /**
     * Returns <code>true</code> if the type can be serialized and then
=======================================
--- /releases/2.0/user/src/com/google/gwt/user/rebind/rpc/Shared.java   Wed  
Nov  4 06:59:39 2009
+++ /releases/2.0/user/src/com/google/gwt/user/rebind/rpc/Shared.java   Wed  
Nov 11 12:06:42 2009
@@ -40,7 +40,7 @@
    private static final String  
RPC_PROP_SUPPRESS_NON_STATIC_FINAL_FIELD_WARNINGS  
= "gwt.suppressNonStaticFinalFieldWarnings";

    /**
-   * Multi-valued configuration roperty used to list classes that are
+   * Multi-valued configuration property used to list classes that are
     * (potentially) enhanced with server-only fields, to be handled  
specially by
     * RPC.
     */

--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/Google-Web-Toolkit-Contributors
-~----------~----~----~----~------~----~------~--~---

Reply via email to