Details
-
Bug
-
Resolution: Won't Do
-
Neutral
-
4.5.8
Description
The return type is:
Class<Generator<AutoGenerationConfiguration>> getGeneratorClass();
Which means that it has to be this exact class, or interface as it is in this case. That's obviously not what we want. We want it to be a class that implements the Generator interface with a custom configuration class as its type parameter.
It should be:
Class<? extends Generator<? extends AutoGenerationConfiguration>> getGeneratorClass();
Here's an example of the problem:
public static class MyAutoGenerationConfiguration implements AutoGenerationConfiguration {
@Override
public Map<String, Object> getContent() {
return null;
}
@Override
public Class<Generator<AutoGenerationConfiguration>> getGeneratorClass() {
return MyGenerator.class; // DOES NOT COMPILE
}
}
public static class MyGenerator implements Generator<AutoGenerationConfiguration> {
@Override
public void generate(AutoGenerationConfiguration configuration) throws RenderException {
}
}
As a workaround one can cast to Class but it shouldn't be necessary.
@Override
public Class<Generator<AutoGenerationConfiguration>> getGeneratorClass() {
return (Class)MyGenerator.class; // COMPILES WITH WARNING
}
Checklists
Acceptance criteria