gnodet-bot commented on code in PR #12695:
URL: https://github.com/apache/maven/pull/12695#discussion_r4059641492


##########
impl/maven-testing/src/main/java/org/apache/maven/testing/plugin/stubs/SessionStub.java:
##########
@@ -153,6 +154,76 @@ public SessionData getData() {
         return null;
     }
 
+    @Override
+    public BuildEnvironment buildEnvironment() {

Review Comment:
   **[Low] New per-call allocation — missed opportunity for a static constant.**
   
   `buildEnvironment()` now returns a new anonymous `BuildEnvironment` instance 
on every call. This is a test stub so it won't cause production overhead, but 
the same commit just refactored `ApiRunner.DefaultSession` to extract the 
identical implementation into `EMPTY_BUILD_ENVIRONMENT` for exactly this 
reason. Doing the same here keeps the pattern consistent and avoids a new 
anonymous class per test invocation:
   
   ```suggestion
       private static final BuildEnvironment EMPTY_BUILD_ENVIRONMENT = new 
BuildEnvironment() {
   ```
   
   Then return `EMPTY_BUILD_ENVIRONMENT` from the method instead of the inline 
anonymous class.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to