You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Introspection for an abstract class doesn't override the instantiation methods trying to instantiate the abstract class.
Actual Behaviour
For Java and Kotlin, the introspection for abstract classes is overriding the instantiation methods with a call to the abstract class constructor. This results in a j.l.InstantiationError instead of a i.m.c.r.e.InstantiationException.
This is important in my use case because only the latter is caught by micronaut serde and then wrapped in a SerdeException.
Ignore constructors for abstract classes, so the introspection is
written as not buildable and the instantiation methods in the
introspection are not overridden, trying to call a constructor for an
abstract class.
rorueda
added a commit
to rorueda/micronaut-core
that referenced
this issue
Oct 22, 2024
Ignore constructors for abstract classes, so the introspection is
written as not buildable and the instantiation methods in the
introspection are not overridden (trying to call a constructor for an
abstract class).
Expected Behavior
Introspection for an abstract class doesn't override the instantiation methods trying to instantiate the abstract class.
Actual Behaviour
For Java and Kotlin, the introspection for abstract classes is overriding the instantiation methods with a call to the abstract class constructor. This results in a
j.l.InstantiationError
instead of ai.m.c.r.e.InstantiationException
.This is important in my use case because only the latter is caught by micronaut serde and then wrapped in a
SerdeException
.Note that it already works for groovy classes.
Steps To Reproduce
See the changes in the tests at 4.5.x...rorueda:issue-abstract-class-introspection
Note it also has a fix inspired by the groovy implementation (making the
ClassElement
ignore the constructors if the class is abstract).Environment Information
No response
Example Application
No response
Version
core 4.5.x
The text was updated successfully, but these errors were encountered: