[ https://issues.apache.org/jira/browse/MRESOLVER-445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17792909#comment-17792909 ]
ASF GitHub Bot commented on MRESOLVER-445: ------------------------------------------ cstamas commented on code in PR #383: URL: https://github.com/apache/maven-resolver/pull/383#discussion_r1414059162 ########## maven-resolver-api/src/main/java/org/eclipse/aether/RepositorySystemSession.java: ########## @@ -391,20 +378,20 @@ interface SessionBuilder { SessionBuilder setData(SessionData data); /** - * Sets the custom session data supplier associated with this session. + * Sets the cache the repository system may use to save data for future reuse during the session. * - * @param dataSupplier The session data supplier, may not be {@code null}. + * @param cache The repository cache, may be {@code null} if none. * @return This session for chaining, never {@code null}. */ - SessionBuilder setSessionDataSupplier(Supplier<SessionData> dataSupplier); + SessionBuilder setCache(RepositoryCache cache); /** - * Sets the cache the repository system may use to save data for future reuse during the session. + * Sets the custom session data supplier associated with this session. * - * @param cache The repository cache, may be {@code null} if none. + * @param dataSupplier The session data supplier, may not be {@code null}. * @return This session for chaining, never {@code null}. */ - SessionBuilder setCache(RepositoryCache cache); + SessionBuilder setSessionDataSupplier(Supplier<SessionData> dataSupplier); Review Comment: Internally supplier is used, and here is why: * create one builder * create session S1 out of builder * create another session S2 out of same builder This "seemingly" trivial operation without supplier would lead that the S1 and S2 would use _same data and cache_, leading to hardly debuggable issues. Hence, I switched internally to supplier that on each call provides new instance (of data and cache), but IF user does use `builder.setCache(cache)` it will become `() -> cache` supplier, so user intentionally can achieve same result. I am may overthinking this, but wanted to avoid this situation (one builder used for several session instances). > Simplify session handling, move out logic from session builder > -------------------------------------------------------------- > > Key: MRESOLVER-445 > URL: https://issues.apache.org/jira/browse/MRESOLVER-445 > Project: Maven Resolver > Issue Type: Task > Reporter: Tamas Cservenak > Assignee: Tamas Cservenak > Priority: Major > Fix For: 2.0.0 > > > Simplify session handling (copy is gone), also move out logic from session > builder to make it reusable. -- This message was sent by Atlassian Jira (v8.20.10#820010)