Revision: 6603 Author: [email protected] Date: Tue Nov 3 08:32:59 2009 Log: Merge tr...@6446 into this branch Check for @GwtTransient annotation when checking for transient fields in the RPC subsystem. svn merge --ignore-ancestry -c 6446 http://google-web-toolkit.googlecode.com/svn/trunk/ .
http://code.google.com/p/google-web-toolkit/source/detail?r=6603 Modified: /releases/2.0/branch-info.txt /releases/2.0/user/src/com/google/gwt/user/server/rpc/impl/SerializabilityUtil.java /releases/2.0/user/src/com/google/gwt/user/server/rpc/impl/ServerSerializationStreamReader.java ======================================= --- /releases/2.0/branch-info.txt Mon Nov 2 21:56:11 2009 +++ /releases/2.0/branch-info.txt Tue Nov 3 08:32:59 2009 @@ -200,3 +200,7 @@ tr...@6600 was merged into this branch Enable good old VerticalAlignmentConstantParser svn merge --ignore-ancestry -c 6600 https://google-web-toolkit.googlecode.com/svn/trunk . + +tr...@6446 was merged into this branch + Check for @GwtTransient annotation when checking for transient fields in the RPC subsystem. + svn merge --ignore-ancestry -c 6446 http://google-web-toolkit.googlecode.com/svn/trunk/ . ======================================= --- /releases/2.0/user/src/com/google/gwt/user/server/rpc/impl/SerializabilityUtil.java Thu Aug 13 14:05:30 2009 +++ /releases/2.0/user/src/com/google/gwt/user/server/rpc/impl/SerializabilityUtil.java Tue Nov 3 08:32:59 2009 @@ -15,6 +15,7 @@ */ package com.google.gwt.user.server.rpc.impl; +import com.google.gwt.user.client.rpc.GwtTransient; import com.google.gwt.user.server.rpc.SerializationPolicy; import java.io.UnsupportedEncodingException; @@ -219,6 +220,17 @@ } return (result == instanceType) ? null : result; } + + static boolean isNotStaticTransientOrFinal(Field field) { + /* + * Only serialize fields that are not static, transient (including @GwtTransient), or final. + */ + int fieldModifiers = field.getModifiers(); + return !Modifier.isStatic(fieldModifiers) + && !Modifier.isTransient(fieldModifiers) + && !field.isAnnotationPresent(GwtTransient.class) + && !Modifier.isFinal(fieldModifiers); + } /** * This method treats arrays in a special way. @@ -317,14 +329,4 @@ return null; } } - - private static boolean isNotStaticTransientOrFinal(Field field) { - /* - * Only serialize fields that are not static, transient or final. - */ - int fieldModifiers = field.getModifiers(); - return !Modifier.isStatic(fieldModifiers) - && !Modifier.isTransient(fieldModifiers) - && !Modifier.isFinal(fieldModifiers); - } -} +} ======================================= --- /releases/2.0/user/src/com/google/gwt/user/server/rpc/impl/ServerSerializationStreamReader.java Thu Aug 13 14:05:30 2009 +++ /releases/2.0/user/src/com/google/gwt/user/server/rpc/impl/ServerSerializationStreamReader.java Tue Nov 3 08:32:59 2009 @@ -790,22 +790,18 @@ // Iterate over each field and locate a suitable setter method Field[] fields = instanceClass.getDeclaredFields(); for (Field field : fields) { - // Consider non-final, non-static, non-transient fields only - int mod = field.getModifiers(); - if (Modifier.isFinal(mod) || Modifier.isStatic(mod) - || Modifier.isTransient(mod)) { - continue; - } - - String fieldName = field.getName(); - String setterName = "set" + // Consider non-final, non-static, non-transient (or @GwtTransient) fields only + if (SerializabilityUtil.isNotStaticTransientOrFinal(field)) { + String fieldName = field.getName(); + String setterName = "set" + Character.toUpperCase(fieldName.charAt(0)) + fieldName.substring(1); - try { - Method setter = instanceClass.getMethod(setterName, field.getType()); - setters.put(fieldName, setter); - } catch (NoSuchMethodException e) { - // Just leave this field out of the map + try { + Method setter = instanceClass.getMethod(setterName, field.getType()); + setters.put(fieldName, setter); + } catch (NoSuchMethodException e) { + // Just leave this field out of the map + } } } --~--~---------~--~----~------------~-------~--~----~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~----------~----~----~----~------~----~------~--~---
