question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Consider removing "optimization" of handling Class<?> from TypeFactory.fromParamType

See original GitHub issue

I wanted to create a custom deserializer for Class<? extends Something> that would check the upper bound and throw an exception if it did not match. Easy enough, I thought, just a simple contextual deserializer. But, the type kept coming in as a SimpleType without any generic arguments.

After some digging, I found that it is because of a special-case in TypeFactory.fromParamType that strips the generic arguments from Enum, Comparable and Class. While I agree that for the first two the type arguments aren’t really useful, they sometimes would be for Class.

Please consider whether these “performance reasons” are worth the unintuitive (and possibly undocumented?) behavior.

Currently, the only way is to subclass TypeFactory to skip the special handling (but subclassing TypeFactory from another package is pretty painful thanks to its “mutant factory methods”).

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
kostislavcommented, Apr 4, 2022

Great, thanks for the heads up! I’ll run the change through the test suite and try to create a PR if no problems pop up.

0reactions
cowtowncodercommented, Apr 21, 2022

Fixed, to be included in 2.14.0.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Bug] Fails to compile (Linux Mint 20.1) - WerWolv/ImHex
Consider removing "optimization" of handling Class<?> from TypeFactory.fromParamType, 5, 2022-04-04, 2022-12-02.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found