[jax-rs-spec users] [jsr339-experts] Re: Configurable.register() ignores illegal classes

From: Sergey Beryozkin <>
Date: Thu, 9 May 2013 16:31:38 +0100

On 09/05/13 16:17, Bill Burke wrote:
> On 5/9/2013 11:03 AM, Sergey Beryozkin wrote:
>> On 09/05/13 15:55, Bill Burke wrote:
>>> On 5/9/2013 10:00 AM, Sergey Beryozkin wrote:
>>>> Hi Bill
>>>> On 09/05/13 14:31, Bill Burke wrote:
>>>>> The javadoc for Configurable.register(Class) says that the container
>>>>> should ignore and warn if a user tries to register an illegal class.
>>>>> This is bad behavior, IMO. Instead it should throw an
>>>>> IllegalArgumentException
>>>> This would break the compatibility, example, JAX-RS 3.0 applications
>>>> (custom applications aware of new 3.0 extensions) registering these new
>>>> extensions with 2.0 JAX-RS stacks
>>> Your statement doesn't make sense. Registering unrecognized component
>>> types has nothing to do with compatibility.
>> It does. Consider JAX-RS 3.0 introducing NewCallback.class. 3.0
>> applications know about it and register NewCallback.class and it just
>> works. Now the same application is loaded in the container supporting
>> 2.0 and this application suddenly gets IllegalArgumentException, see
>> what I mean ?
> No I don't. You would hope to get an exception because the application
> is expecting you to support NewCallback.
> d
Kind of makes sense. But 3.0 Application has been coded without a catch
block because it knows NewCallback is supported. And suddenly it gets an
exception which is not good.

Actually, I've been thinking more of AsynResponse here where one can get
back what actually has been registered as far as I recall.

Perhaps Configurable should've been done the same way as far as the
registration is concerned,

Thanks, Sergey

>>> Still, ignoring *illegal* classes like non-static ones, is definitely
>>> not a compatibility issue.
>> Yes, I agree, some tests are coded somewhat unexpectedly, but I'd say it
>> just emulates the above case, does it really matter what sort of class
>> it is ?
> Err...yes... you can't really instantiate non-static inner classes!
> Also, the tests assume that it is *OK* to register non-static inner
> classes, or classes without a public constructor. Which is wrong...