Why do these methods in Component return Object, not a type?
public static Object getInstance(Class<?> clazz) { return getInstance(clazz, true); } public static Object getInstance(Class<?> clazz, boolean create) { return getInstance( getComponentName(clazz), create ); } public static Object getInstance(Class<?> clazz, ScopeType scope) { return getInstance(clazz, scope, true); } public static Object getInstance(Class<?> clazz, ScopeType scope, boolean create) { return getInstance( getComponentName(clazz), scope, create ); }
Ordinarily, you would do:
public static <T> T getInstance(Class<T> clazz) { return (T)getInstance(clazz, true); }
Would help catch bugs I think.
Okay, looks like the code in Component works correctly when you're dealing with an @Unwrap component type. Oops. Please delete my post :-)