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

[FIX] custom fix when xml adapter has names #3052

Merged
merged 3 commits into from
Aug 1, 2024

Conversation

elguardian
Copy link
Member

@elguardian elguardian commented Jul 16, 2024

The performance problem was related to the polymorphic feature of jackson. it computes the subtypes of a given types.
Before the patch we were saying that all classes contained in the kjar/project where subtypes of every class causing a huge impact in performance
That performance problem was causing another problem, it was overwriting the proper names for types
Every class when you are serializing you have the full qualified name and the name used for serialized and deserialized
So before the patch we were overwriting that information making this feature not working properly
Now because the subtypes are being computed properly we are not overwriting the names therefore now the name is being taken from the annotation like it should be

@elguardian
Copy link
Member Author

Jenkins retest this please


XmlElements elements = findAnnotation(XmlElements.class, a, false, false, false);
if (elements != null) {
for (XmlElement elem : elements.value()) {
Copy link
Member

Choose a reason for hiding this comment

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

can't we check jsonHandleXmlAnyElementsNames before the loop, so we can avoid unnecessary processing (I know that over time JIT will do the job... but still)

Copy link
Member Author

Choose a reason for hiding this comment

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

it won't give the same outcome.

@@ -1160,4 +1171,8 @@ public void setClassLoader(ClassLoader classLoader) {
public ClassLoader getClassLoader() {
return classLoader;
}

public void setXmlAnyElementsNames(boolean jsonHandleXmlAnyElementsNames) {
Copy link
Member

Choose a reason for hiding this comment

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

is this method used only for testing purposes? if yes... maybe there's a better way to do so.... I personally like Anonymous classes for hack the tested class... but I also understand that it might not be the most popular design choice.

Copy link
Contributor

@martinweiler martinweiler left a comment

Choose a reason for hiding this comment

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

Excellent work @elguardian

@elguardian elguardian merged commit 7275e37 into kiegroup:main Aug 1, 2024
2 of 3 checks passed
@elguardian elguardian deleted the FIX_CUSTOM_XML_ANY_NAMES branch August 1, 2024 06:25
@elguardian elguardian added backport-7.67.x Generate backport PR for 7.67.x branch backport-7.67.x-blue Generate backport PR for 7.67.x-blue branch labels Aug 1, 2024
elguardian added a commit that referenced this pull request Aug 2, 2024
Co-authored-by: Enrique <enrique.gonzalez.martinez1@ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-7.67.x Generate backport PR for 7.67.x branch backport-7.67.x-blue Generate backport PR for 7.67.x-blue branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants