Skip to content

Commit e5f9bb7

Browse files
committed
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.
1 parent 9ab046b commit e5f9bb7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

spring-core/src/main/java/org/springframework/aot/generate/DefaultGenerationContext.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public RuntimeHints getRuntimeHints() {
115115
}
116116

117117
@Override
118-
public GenerationContext withName(String name) {
118+
public DefaultGenerationContext withName(String name) {
119119
return new DefaultGenerationContext(this, name);
120120
}
121121

0 commit comments

Comments
 (0)