Skip to content

refactor: Simplifies VectorStoreChatMemoryAdvisor code#3773

Closed
cueon wants to merge 1 commit into
spring-projects:mainfrom
cueon:refactor-vector-store-chat-memory-advisor
Closed

refactor: Simplifies VectorStoreChatMemoryAdvisor code#3773
cueon wants to merge 1 commit into
spring-projects:mainfrom
cueon:refactor-vector-store-chat-memory-advisor

Conversation

@cueon
Copy link
Copy Markdown
Contributor

@cueon cueon commented Jul 9, 2025

  • The update refactors the VectorStoreChatMemoryAdvisor class by simplifying import statements, streamlining code for readability, and using more concise Java constructs. There are no changes to public APIs or core logic. All modifications focus on internal clarity, direct imports, and more idiomatic Java syntax.

  • Readability: The code is refactored to improve readability by using local variables to hold intermediate results.

  • Maintainability: The refactoring aims to enhance maintainability through clearer type declarations and a more structured approach.

  • Code Style: The changes include using more explicit type declarations instead of var.

image
  • All tests passed.

Refactors VectorStoreChatMemoryAdvisor for improved readability and maintainability.

Uses local variables to hold intermediate results, and ensures type declarations for clarity.

Signed-off-by: Kyuwon Jeong <jkw5033@gmail.com>
@ilayaperumalg
Copy link
Copy Markdown
Member

@digitpic Thanks for the PR cleaning up/polishing the code.

@ilayaperumalg ilayaperumalg self-assigned this Jul 10, 2025
@Amine-Kadi
Copy link
Copy Markdown

* Code Style: The changes include using more explicit type declarations instead of var.

Is there a style guide that forbid the usage of var ? The usage of var with the builder seems pretty fine and easy to read.

@cueon
Copy link
Copy Markdown
Contributor Author

cueon commented Jul 10, 2025

@Amine-Kadi
Thank you for replying.

I agree that using var in builder patterns can improve readability.
However, I decided to make the change because I believe that explicit type declarations are more beneficial for long-term code maintainability.

While using var does not clearly violate any style guide, explicitly declaring the type helps convey the intent of the code more clearly. Additionally, var can sometimes infer unintended types, which could lead to debugging overhead.

For these reasons, I consider explicit type declarations to be a safer and more consistent choice.

@markpollack
Copy link
Copy Markdown
Member

fwiw, i tend to prefer explicit types in framework like code.

@ilayaperumalg
Copy link
Copy Markdown
Member

@digitpic Thanks for the PR cleaning up the code. Rebased and merged as 3fee79a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants