A little bit more information I've gathered with a debugger:
At a certain moment, TypeUtils.getParametrization is called with a type that
is a TypeVariable of value T. That method doesn't deal with such types, and
returns null.
The result of the request where this happens is a
List<AValueProxy<AnEntityProxy>> where the entities are declared as such:
@ProxyFor(AnAbstractDomainEntity.class)
public interface AGenericEntityProxy extends EntityProxy {...}
@ProxyFor(AConcreteDomainEntity.class)
public interface AnEntityProxy extends AGenericEntityProxy {...}
@ProxyFor(ADomainClass.class)
public interface AValueProxy<T extends AGenericEntityProxy> extends
ValueProxy {...}
In the server:
public class AnAbstractDomainEntity {...}
public class AConcreteDomainEntity extends AnAbstractDomainEntity {...}
public class ADomainClass<T extends AnAbstractDomainEntity> {...}
When the TypeVariable T is given as type to TypeUtils.getParametrization,
the base parameter is the AGenericEntityProxy.class.
Is this generics construction I'm making illegal? Is there another way I can
implement a similar thing?
Thank you, and sorry for the annoyance.
On Thu, Sep 15, 2011 at 4:51 PM, Tiago Rinck Caveden <[email protected]>wrote:
> Hello all,
>
> I'm having a NPE on MethodPropertyContext. The error message doesn't
> provide any additional information to help me understand what I'm doing
> wrong. By looking at the source code, it seems that the method traverse is
> indeed not protecting itself against a null value that may be the return of
> TypeUtils.parameterization. Take a look:
>
> private void traverse(ParameterizationVisitor visitor, Type type) {
> Class<?> base = TypeUtils.ensureBaseType(type);
> if (visitor.visitType(base)) {
> Type[] params = TypeUtils.getParameterization(base, type);
> for (Type t : params) {
> if (visitor.visitParameter()) {
> traverse(visitor, t);
> }
> visitor.endVisitParameter();
> }
> }
> visitor.endVisitType(base);
> }
>
> The error is raised when the response of a particular request is treated.
> The request is particular because it receives a proxy which uses java
> generics in its declaration. It's the only case so far in my application.
>
> This is the GWT part of the stack trace:
>
> SEVERE: Unexpected error
> java.lang.NullPointerException
> at
> com.google.web.bindery.autobean.vm.impl.MethodPropertyContext.traverse(MethodPropertyContext.java:102)
> at
> com.google.web.bindery.autobean.vm.impl.MethodPropertyContext.accept(MethodPropertyContext.java:75)
> at
> com.google.web.bindery.autobean.shared.impl.AutoBeanCodexImpl$PropertyCoderCreator.maybeCreateCoder(AutoBeanCodexImpl.java:353)
> at
> com.google.web.bindery.autobean.shared.impl.AutoBeanCodexImpl$PropertyCoderCreator.visitReferenceProperty(AutoBeanCodexImpl.java:341)
> at
> com.google.web.bindery.autobean.vm.impl.ProxyAutoBean.traverseProperties(ProxyAutoBean.java:295)
> at
> com.google.web.bindery.autobean.shared.impl.AbstractAutoBean.traverse(AbstractAutoBean.java:166)
> at
> com.google.web.bindery.autobean.shared.impl.AbstractAutoBean.accept(AbstractAutoBean.java:101)
> at
> com.google.web.bindery.autobean.shared.impl.AutoBeanCodexImpl.doCoderFor(AutoBeanCodexImpl.java:521)
> at
> com.google.web.bindery.autobean.shared.impl.AbstractAutoBean.setProperty(AbstractAutoBean.java:276)
> at
> com.google.web.bindery.autobean.vm.impl.ProxyAutoBean.setProperty(ProxyAutoBean.java:224)
> at
> com.google.web.bindery.autobean.vm.impl.BeanPropertyContext.set(BeanPropertyContext.java:44)
> at
> com.google.web.bindery.requestfactory.server.Resolver$1.visitValueProperty(Resolver.java:371)
> at
> com.google.web.bindery.autobean.vm.impl.ProxyAutoBean.traverseProperties(ProxyAutoBean.java:260)
> at
> com.google.web.bindery.autobean.shared.impl.AbstractAutoBean.traverse(AbstractAutoBean.java:166)
> at
> com.google.web.bindery.autobean.shared.impl.AbstractAutoBean.accept(AbstractAutoBean.java:101)
> at
> com.google.web.bindery.requestfactory.server.Resolver.resolveClientProxy(Resolver.java:323)
> at
> com.google.web.bindery.requestfactory.server.Resolver.resolveClientValue(Resolver.java:418)
> at
> com.google.web.bindery.requestfactory.server.Resolver.resolveClientValue(Resolver.java:442)
> at
> com.google.web.bindery.requestfactory.server.Resolver.resolveClientValue(Resolver.java:196)
> at
> com.google.web.bindery.requestfactory.server.SimpleRequestProcessor.processInvocationMessages(SimpleRequestProcessor.java:451)
> at
> com.google.web.bindery.requestfactory.server.SimpleRequestProcessor.process(SimpleRequestProcessor.java:217)
> at
> com.google.web.bindery.requestfactory.server.SimpleRequestProcessor.process(SimpleRequestProcessor.java:125)
> at
> com.google.web.bindery.requestfactory.server.RequestFactoryServlet.doPost(RequestFactoryServlet.java:118)
>
> Is this a GWT bug or am I doing something I shouldn't?
>
> Thank you,
> --
> Tiago Rinck Caveden
>
>
--
Tiago Rinck Caveden
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.