Skip to content

Redunant code in DefaultEntityCallbacks#callback #3055

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

Closed
mawen12 opened this issue Mar 1, 2024 · 0 comments
Closed

Redunant code in DefaultEntityCallbacks#callback #3055

mawen12 opened this issue Mar 1, 2024 · 0 comments
Assignees
Labels
type: task A general task

Comments

@mawen12
Copy link
Contributor

mawen12 commented Mar 1, 2024

I have found org.springframework.data.mapping.callback.DefaultEntityCallbacks#callback method exists redunant code.

entity is checked not null, then don't need to call callbackDiscoverer.resolveDeclaredEntityType(callbackType).getRawClass()).

current code:

@Override
public <T> T callback(Class<? extends EntityCallback> callbackType, T entity, Object... args) {
    // check entity not null
    Assert.notNull(entity, "Entity must not be null");
    // redundant code
    Class<T> entityType = (Class<T>) (entity != null ? ClassUtils.getUserClass(entity.getClass())
		: callbackDiscoverer.resolveDeclaredEntityType(callbackType).getRawClass());
    ......
}
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Mar 1, 2024
@mp911de mp911de self-assigned this Mar 1, 2024
@mp911de mp911de added type: task A general task and removed status: waiting-for-triage An issue we've not yet triaged labels Mar 1, 2024
@mp911de mp911de added this to the 3.1.10 (2023.0.10) milestone Mar 1, 2024
@mp911de mp911de closed this as completed in 939c614 Mar 1, 2024
mp911de added a commit that referenced this issue Mar 1, 2024
Handle warnings. Remove redundant code in DefaultReactiveEntityCallbacks.

Original pull request: #3053
See #3055
mp911de pushed a commit that referenced this issue Mar 1, 2024
mp911de added a commit that referenced this issue Mar 1, 2024
Handle warnings. Remove redundant code in DefaultReactiveEntityCallbacks.

Original pull request: #3053
See #3055
mp911de pushed a commit that referenced this issue Mar 1, 2024
mp911de added a commit that referenced this issue Mar 1, 2024
Handle warnings. Remove redundant code in DefaultReactiveEntityCallbacks.

Original pull request: #3053
See #3055
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: task A general task
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants