final InjectableInstance injectableInstance = getInjectableInstance(ctx);
final QualifyingMetadata qualifyingMetadata = processingContext.getQualifyingMetadataFactory()
.createFrom(injectableInstance.getQualifiers());
final Statement val;
ctx.allowProxyCapture();
switch (taskType) {
case Type:
ctx.getQualifiedInjector(type, qualifyingMetadata);
break;
case PrivateField:
ctx.addExposedField(field, PrivateAccessType.Write);
case Field:
try {
val = InjectUtil.getInjectorOrProxy(ctx, getInjectableInstance(ctx), field.getType(), qualifyingMetadata);
}
catch (InjectionFailure e) {
throw UnsatisfiedDependenciesException.createWithSingleFieldFailure(field, field.getDeclaringClass(),
field.getType(), e.getMessage());
}
catch (UnproxyableClassException e) {
final String err = "your object graph may have cyclical dependencies and the cycle could not be proxied. " +
"use of the @Dependent scope and @New qualifier may not " +
"produce properly initalized objects for: " + getInjector().getInjectedType().getFullyQualifiedName() + "\n" +
"\t Offending node: " + toString() + "\n" +
"\t Note : this issue can be resolved by making "
+ e.getUnproxyableClass().getFullyQualifiedName() + " proxyable. Introduce a default" +
" no-arg constructor and make sure the class is non-final.";
throw UnsatisfiedDependenciesException.createWithSingleFieldFailure(field, field.getDeclaringClass(),
field.getType(), err);
}
final Statement fieldAccessStmt;
if (field.isStatic()) {
throw new InjectionFailure("attempt to inject bean into a static field: "
+ field.getDeclaringClass().getFullyQualifiedName() + "." + field.getName());
}