18
18
19
19
import org .springframework .aot .generate .ClassNameGenerator ;
20
20
import org .springframework .aot .generate .DefaultGenerationContext ;
21
- import org .springframework .aot .generate .GeneratedClasses ;
22
21
import org .springframework .aot .generate .GeneratedFiles ;
23
22
import org .springframework .aot .hint .RuntimeHints ;
24
23
@@ -49,16 +48,13 @@ class TestContextGenerationContext extends DefaultGenerationContext {
49
48
}
50
49
51
50
/**
52
- * Create a new {@link TestContextGenerationContext} instance backed by the
53
- * specified {@link GeneratedClasses}, {@link GeneratedFiles}, and
54
- * {@link RuntimeHints}.
55
- * @param generatedClasses the generated classes
56
- * @param generatedFiles the generated files
57
- * @param runtimeHints the runtime hints
51
+ * Create a new {@link TestContextGenerationContext} instance based on the
52
+ * supplied {@code existing} context and feature name.
53
+ * @param existing the existing context upon which to base the new one
54
+ * @param featureName the feature name to use
58
55
*/
59
- private TestContextGenerationContext (GeneratedClasses generatedClasses , GeneratedFiles generatedFiles ,
60
- RuntimeHints runtimeHints , String featureName ) {
61
- super (generatedClasses , generatedFiles , runtimeHints );
56
+ private TestContextGenerationContext (TestContextGenerationContext existing , String featureName ) {
57
+ super (existing , featureName );
62
58
this .featureName = featureName ;
63
59
}
64
60
@@ -67,8 +63,8 @@ private TestContextGenerationContext(GeneratedClasses generatedClasses, Generate
67
63
* Create a new {@link TestContextGenerationContext} instance using the specified
68
64
* feature name to qualify generated assets for a dedicated round of code generation.
69
65
* <p>If <em>this</em> {@code TestContextGenerationContext} has a configured feature
70
- * name, the supplied feature name will be appended to the existing feature name
71
- * in order to avoid naming collisions.
66
+ * name, the existing feature name will prepended to the supplied feature name in
67
+ * order to avoid naming collisions.
72
68
* @param featureName the feature name to use
73
69
* @return a specialized {@link TestContextGenerationContext} for the specified
74
70
* feature name
@@ -78,8 +74,7 @@ public TestContextGenerationContext withName(String featureName) {
78
74
if (this .featureName != null ) {
79
75
featureName = this .featureName + featureName ;
80
76
}
81
- GeneratedClasses generatedClasses = getGeneratedClasses ().withFeatureNamePrefix (featureName );
82
- return new TestContextGenerationContext (generatedClasses , getGeneratedFiles (), getRuntimeHints (), featureName );
77
+ return new TestContextGenerationContext (this , featureName );
83
78
}
84
79
85
80
}
0 commit comments