Skip to content

Introduce ObjectMapperValueToTree Refaster rule#1938

Merged
Stephan202 merged 2 commits intomasterfrom
mohamedsamehsalah/object-mapper-value-to-tree
Nov 15, 2025
Merged

Introduce ObjectMapperValueToTree Refaster rule#1938
Stephan202 merged 2 commits intomasterfrom
mohamedsamehsalah/object-mapper-value-to-tree

Conversation

@mohamedsamehsalah
Copy link
Collaborator

@mohamedsamehsalah mohamedsamehsalah commented Oct 30, 2025

Suggested commit message 🎉

Introduce `ObjectMapperValueToTree` Refaster rule (#1938)

@mohamedsamehsalah mohamedsamehsalah added this to the 0.27.0 milestone Oct 30, 2025
NullNode.getInstance().optional("qux"));
}

JsonNode testObjectMapperValueToTree() throws JsonProcessingException {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure how we usually do this, but I am keeping this throws statement for the diff; ObjectMapper#valueToTree does not throw this exception.

@github-actions
Copy link

Looks good. No mutations were possible for these changes.
Mutation testing report by Pitest. Review any surviving mutants by inspecting the line comments under Files changed.

@rickie rickie changed the title Introduce ObjectMapperValueToTree refaster rule Introduce ObjectMapperValueToTree Refaster rule Oct 30, 2025
Copy link
Member

@Stephan202 Stephan202 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a small commit. Tnx @mohamedsamehsalah!

I'd like to wrap up and merge #1927 #1942 before this one, so that we stop seeing the Error Prone compatibility check failure on master.

</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should omit this one from the runtime classpath:

Suggested change
<artifactId>jackson-core</artifactId>
<artifactId>jackson-core</artifactId>
<scope>provided</scope>

}
}

/** Prefer {@link ObjectMapper#valueToTree(Object)} over more contrived alternatives. */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's also significantly less efficient, IIUC.

@github-actions
Copy link

Looks good. No mutations were possible for these changes.
Mutation testing report by Pitest. Review any surviving mutants by inspecting the line comments under Files changed.

Copy link
Member

@rickie rickie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice addition @mohamedsamehsalah !

@github-actions
Copy link

Looks good. No mutations were possible for these changes.
Mutation testing report by Pitest. Review any surviving mutants by inspecting the line comments under Files changed.

@Stephan202 Stephan202 force-pushed the mohamedsamehsalah/object-mapper-value-to-tree branch from 61ad4b3 to 7ab6dbe Compare November 15, 2025 14:49
@github-actions
Copy link

Looks good. No mutations were possible for these changes.
Mutation testing report by Pitest. Review any surviving mutants by inspecting the line comments under Files changed.

@sonarqubecloud
Copy link

@Stephan202 Stephan202 merged commit c41cc91 into master Nov 15, 2025
18 checks passed
@Stephan202 Stephan202 deleted the mohamedsamehsalah/object-mapper-value-to-tree branch November 15, 2025 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants