Reviewers: pquitslund,

Description:
Use erasure to handle wildcard types in RfValidator.
Restore FindRequest to 2.4 parameterization.
Patch by: bobv
Review by: pquitslund


Please review this at http://gwt-code-reviews.appspot.com/1467814/

Affected files:
M user/src/com/google/web/bindery/requestfactory/apt/ClientToDomainMapper.java M user/src/com/google/web/bindery/requestfactory/apt/TransportableTypeVisitor.java
  M user/src/com/google/web/bindery/requestfactory/apt/TypeSimplifier.java
M user/src/com/google/web/bindery/requestfactory/shared/impl/FindRequest.java


Index: user/src/com/google/web/bindery/requestfactory/apt/ClientToDomainMapper.java
===================================================================
--- user/src/com/google/web/bindery/requestfactory/apt/ClientToDomainMapper.java (revision 10426) +++ user/src/com/google/web/bindery/requestfactory/apt/ClientToDomainMapper.java (working copy)
@@ -62,6 +62,12 @@
     if (state.types.isAssignable(x, state.entityProxyType)
         || state.types.isAssignable(x, state.valueProxyType)) {
       // FooProxy -> FooDomain
+      /*
+ * TODO(bobv): This if statement should be widened to baseProxy to support + * heterogenous collections of any proxy type. The BaseProxy interface + * would also need to be annotated with an @ProxyFor mapping. This can be + * done once RFIV is removed, since it only allows homogenous collections.
+       */
TypeElement domainType = state.getClientToDomainMap().get(state.types.asElement(x));
       if (domainType == null) {
         return defaultAction(x, state);
@@ -120,10 +126,7 @@
   @Override
   public TypeMirror visitWildcard(WildcardType x, State state) {
     // Convert <? extends FooProxy> to FooDomain
-    if (x.getExtendsBound() != null) {
-      return x.getExtendsBound().accept(this, state);
-    }
-    return defaultAction(x, state);
+    return state.types.erasure(x).accept(this, state);
   }

   /**
Index: user/src/com/google/web/bindery/requestfactory/apt/TransportableTypeVisitor.java
===================================================================
--- user/src/com/google/web/bindery/requestfactory/apt/TransportableTypeVisitor.java (revision 10426) +++ user/src/com/google/web/bindery/requestfactory/apt/TransportableTypeVisitor.java (working copy)
@@ -105,7 +105,7 @@
   @Override
   public Boolean visitWildcard(WildcardType t, State state) {
     // Allow List<? extends FooProxy>
- return t.getExtendsBound() != null && t.getExtendsBound().accept(this, state);
+    return state.types.erasure(t).accept(this, state);
   }

   @Override
Index: user/src/com/google/web/bindery/requestfactory/apt/TypeSimplifier.java
===================================================================
--- user/src/com/google/web/bindery/requestfactory/apt/TypeSimplifier.java (revision 10426) +++ user/src/com/google/web/bindery/requestfactory/apt/TypeSimplifier.java (working copy)
@@ -102,10 +102,7 @@

   @Override
   public TypeMirror visitWildcard(WildcardType x, State state) {
-    if (x.getExtendsBound() != null) {
-      return x.getExtendsBound().accept(this, state);
-    }
-    return state.objectType;
+    return state.types.erasure(x).accept(this, state);
   }

   @Override
Index: user/src/com/google/web/bindery/requestfactory/shared/impl/FindRequest.java
===================================================================
--- user/src/com/google/web/bindery/requestfactory/shared/impl/FindRequest.java (revision 10426) +++ user/src/com/google/web/bindery/requestfactory/shared/impl/FindRequest.java (working copy)
@@ -31,5 +31,5 @@
   /**
* Use the implicit lookup in passing EntityProxy types to service methods.
    */
-  Request<EntityProxy> find(EntityProxyId<? extends EntityProxy> proxy);
+  Request<EntityProxy> find(EntityProxyId<?> proxy);
 }
\ No newline at end of file


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

Reply via email to