-
-
Notifications
You must be signed in to change notification settings - Fork 181
Description
This issue is a discussion of features after merging of foo and after #1025.
wrt: #617 (comment)
Unlike the deprecated MissingKotlinParameterException
, KotlinInvalidNullException
has no information about the creator function.
This is because it was very difficult to keep reflection-related information while keeping the class as Serializable
.
It is not impossible to include creator function information in a new exception, provided that the process is allowed to become very complex.
Personally, I can think of a way to keep the creator function as a string in the form of JvmSignature
and restore it during processing if necessary.
A similar process has been implemented in Kogera
.
This would allow the new exception to act as if it were holding a KFunction
or KParameter
.
However, this has the following problems
- It requires a lot of additional code and tests for the encoding/decoding process to the
JvmSignature
format. - Many edge cases must be considered, especially when
value class
is involved.- When new features such as
multi-field value class
become available, more effort is required to support them(Support for Multi field value class #714).
- When new features such as
- Factory function definition support without
JvmStatic
(Jackson doesn't see companion object @JsonCreators unles they also have @JvmStatic #355) will be difficult.
Personally, I think that there is no need for a function that reads function information directly from exceptions.
This is because the basic information is already included and humans can adequately analyze it from that information.
At least in this case, I feel that the code would be too complicated for the benefit gained.
However, if there is a very strong demand for such a function, I will consider adding it.