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

remove unnecessary convert from Object to ResultMap #3241

Closed
wants to merge 1 commit into from

Conversation

mawen12
Copy link
Contributor

@mawen12 mawen12 commented Sep 21, 2024

I have found the method checkGloballyForDiscriminatedNestedResultMaps in class Configuration contains unnecessary convert code.

protected final Map<String, ResultMap> resultMaps = new StrictMap<>("Result Maps collection");

...

protected void checkGloballyForDiscriminatedNestedResultMaps(ResultMap rm) {
  if (rm.hasNestedResultMaps()) {
    ...
    for (Object resultMapObject : resultMaps.values()) {
     // here is unnecessary code
      if (resultMapObject instanceof ResultMap) {
        ResultMap entryResultMap = (ResultMap) resultMapObject;
        ...
      }
    }
  }
}

Because variable resultMaps is Map<String, ResultMap>, so it's value type is ResultMap, no need convert from Object.

@mawen12 mawen12 closed this Sep 21, 2024
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.

1 participant