Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor to comply with JDK 17 code standards #39

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Gescof
Copy link

@Gescof Gescof commented Jul 26, 2023

This PR intends to refactor key parts of the code to comply with JDK 17+ standards.
Specifically, these are the changes and explanation:

  • Usage of a logger @Sl4j tool instead of System class standard output.
  • Rename field token from Token entity to tokenCode and permission from Permission enum to permissionStr. This is to explicitly describe what is the property meaning since they should not have the same name as their class name.
  • Replace == null and != null with Objects.isNull and Objects.nonNull to follow functional programming approach.
  • Replace @Data annotation with @Getter @Setter @RequiredArgsConstructor @ToString and explicit equals hashCode methods. Using @Data for JPA entities is not recommended. It can cause severe performance and memory consumption issues because of lazy load with mapping entities.
  • Change Token properties visibility to private to be only accessed by their corresponding methods.
  • Make token property transient from User entity. See rule java:S1948.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant