users@jax-rs-spec.java.net

[jax-rs-spec users] [jsr339-experts] Re: Re: Re: InvocationCallback changing?

From: Bill Burke <bburke_at_redhat.com>
Date: Thu, 28 Jun 2012 19:33:36 -0400

On 6/28/12 4:19 PM, Bill Burke wrote:
>
> I guess I've exhausted my arguments. I hope somebody else chimes in here.
>

Well, I haven't exhausted yet. Are you sure your new abstract class
implementation works? I still think you have type erasure with your
solution. To test my theory I tried this:

public class TestIt
{
    public static abstract class MyInvocationCallback<T> extends
GenericType<T>
    {
       public abstract void complete(T value);
    }

    public static class GenericInvocationCallback<T> extends
MyInvocationCallback<T>
    {
       @Override
       public void complete(T value)
       {
       }
    }

    public static void main(String[] args) throws Exception
    {
       GenericInvocationCallback<List<String>> callback = new
GenericInvocationCallback<List<String>>();

       System.out.println(callback.getRawType().getName());
    }
}


And it failed with an IllegalArgumentException

Exception in thread "main" java.lang.IllegalArgumentException:
org.jboss.resteasy.core.ServerResponse.org.jboss.resteasy.core.ServerResponse$MyInvocationCallback<T>
does not specify the type parameter T of GenericType<T>
        at javax.ws.rs.core.GenericType.getTypeArgument(GenericType.java:245)
        at javax.ws.rs.core.GenericType.<init>(GenericType.java:117)
        at
org.jboss.resteasy.core.ServerResponse$MyInvocationCallback.<init>(ServerResponse.java:496)
        at
org.jboss.resteasy.core.ServerResponse$GenericInvocationCallback.<init>(ServerResponse.java:501)
        at org.jboss.resteasy.core.ServerResponse.main(ServerResponse.java:511)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)



-- 
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com