Obscure Exception can be improved.
----------------------------------

                 Key: QI-317
                 URL: http://issues.ops4j.org/browse/QI-317
             Project: Qi4j
          Issue Type: Improvement
          Components: Core Runtime
            Reporter: Niclas Hedhman


I accidentally used a @Structure instead of @Service injection scope;

{code}
@Structure
private Iterable<ServiceReference<TopicFactory>> factories;
{code}

which gives a wonderful ClassCastException;

{code}
java.lang.ClassCastException: 
sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl cannot be cast to 
java.lang.Class
        at 
org.qi4j.runtime.injection.provider.StructureInjectionProviderFactory$StructureInjectionProvider.provideInjection(StructureInjectionProviderFactory.java:89)
        at 
org.qi4j.runtime.injection.provider.CachingInjectionProviderDecorator.provideInjection(CachingInjectionProviderDecorator.java:50)
{code}

which isn't that helpful.

Since none of the @Structure injectionTypes can be anything but a class, it 
should convert the "Type type" in StructureInjectionProviderFactory:63 to a 
Class after checking it to be a Class, and if not throw a 
InvalidInjectionTypeException (or something to that extent).

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.ops4j.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev

Reply via email to