Conversation
Codecov Report
@@ Coverage Diff @@
## main #2220 +/- ##
============================================
+ Coverage 80.61% 80.64% +0.02%
- Complexity 3355 3357 +2
============================================
Files 240 240
Lines 12327 12331 +4
Branches 1634 1636 +2
============================================
+ Hits 9938 9944 +6
+ Misses 1782 1781 -1
+ Partials 607 606 -1
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
|
Hey @adinauer, really thanks for the quick response. But I am thinking if this solution wouldn't be better in the |
As an optimmization it could be added to both. But it should be in |
| } else if (object instanceof Map) { | ||
| serializeMap(writer, logger, (Map<?, ?>) object); | ||
| } else if (object.getClass().isEnum()) { | ||
| writer.value(object.toString()); |
There was a problem hiding this comment.
WHat's about object..name()? Does it return the same thing?
There was a problem hiding this comment.
We'd have to use reflection to invoke .name(). By default .toString() should be the same as .name(). It also allows overriding the value that is serialized.
📜 Description
Use
toString()for enum entries being serialized.💡 Motivation and Context
JsonReflectionObjectSerializerwould consume lots of memory when serializing an enum entry where the enum has more than just a few entries.Fixes #2219
💚 How did you test it?
Unit Test
📝 Checklist
🔮 Next steps