Declare covariant return type in DefaultGenerationContext.withName()
Prior to this commit, if infrastructure code working directly with an instance of DefaultGenerationContext invoked withName() on that instance, the new GenerationContext had to be cast from GenerationContext to DefaultGenerationContext in order for the infrastructure to continue working with the DefaultGenerationContext API -- for example, the writeGeneratedContent() method which is not defined in the GenerationContext API. This commit makes use of a covariant return type by declaring that DefaultGenerationContext.withName() returns a DefaultGenerationContext.
This commit is contained in:
parent
9ab046bdbb
commit
e5f9bb76b1
|
@ -115,7 +115,7 @@ public class DefaultGenerationContext implements GenerationContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public GenerationContext withName(String name) {
|
public DefaultGenerationContext withName(String name) {
|
||||||
return new DefaultGenerationContext(this, name);
|
return new DefaultGenerationContext(this, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue