users@jersey.java.net

Improving error reporting for injection

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Tue, 01 Dec 2009 13:26:29 +0100

Hi,

Currently the error reporting when an instance for a type +
annotations cannot be injected is cryptic or null values are injected
instead. For example,

- a cryptic error message occurs for resource and sub-resource methods
saying the method is invalid.

- null values are injected onto fields and setter methods and
parameters of sub-constructors and resource locator
   methods.

I am working on improving this so that Jersey supports a consistent
approach and clear error reporting.

The approach i would like to support is the following:

- if Jersey cannot find an Injectable for any parameter of a
constructor, sub-resource locator, sub-resource
   method or resource method then deployment will fail, preferably
listing all parameters for which an
   Injectable cannot be found.

- for fields of a class the field will be ignored if an associated
InjectableProvider is not registered. Otherwise,
   if an Injectable cannot be found deployment will fail, preferably
listing all fields for which an Injectable
   cannot be found.

Paul.