Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@
*******************************************************************************/
package org.eclipse.e4.core.internal.di;

import java.lang.reflect.Field;
import org.eclipse.e4.core.di.IInjector;
import org.eclipse.e4.core.di.InjectionException;
import org.eclipse.e4.core.di.annotations.Optional;
import org.eclipse.e4.core.di.suppliers.IObjectDescriptor;
import org.eclipse.e4.core.di.suppliers.PrimaryObjectSupplier;

Expand All @@ -26,7 +28,23 @@
*/
public class ClassRequestor extends Requestor<Class<?>> {

private static IObjectDescriptor[] pseudoVariableDescriptor = {};
private interface InjectionLink {
// Marker type for the pseudo dependency. It is intentionally never available
// from any supplier, so the (optional) dependency never resolves to a value.
}

@Optional
private static final InjectionLink PSEUDO_VARIABLE = null;
static {
try {
Field field = ClassRequestor.class.getDeclaredField("PSEUDO_VARIABLE"); //$NON-NLS-1$
pseudoVariableDescriptor = new IObjectDescriptor[] {
new ObjectDescriptor(field.getGenericType(), field.getAnnotations()) };
} catch (NoSuchFieldException e) {
throw new IllegalStateException(e); // the field is declared right above, this cannot happen
}
}
private static final IObjectDescriptor[] pseudoVariableDescriptor;

public ClassRequestor(Class<?> clazz, IInjector injector, PrimaryObjectSupplier primarySupplier, PrimaryObjectSupplier tempSupplier, Object requestingObject, boolean track) {
super(clazz, injector, primarySupplier, tempSupplier, requestingObject, track);
Expand Down
Loading