Could you please explain why this code is not syntactically correct?
private void addEditor(final Class<? extends FieldEditor> fieldEditorClass, final Composite parent, final PropertyKey propertyKey, final String displayName){
final Composite composite = new Composite(parent, SWT.NULL);
composite.setLayout(new GridLayout());
composite.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL));
final FieldEditor fieldEditor = new >>fieldEditorClass<< (propertyKey.toString(), displayName, composite);
initializeFieldEditor(fieldEditor);
}
on line 5, the part between >>
and <<
is underlined in red and it says "can not be resolved to a type".
I hope you can see what I am trying to achieve here. By passing a SomeEditor.class to this method I then want to create an object of this class and initialise it. How can I fix the problem on line 5?
Basically, I want to parametrise the concrete FieldEditor class being instantiated by this code. I have several methods in my code that are essentially identical, except that each instantiates a different class of FieldEditor.