ReflectUtils.invokeMethodByName 方法添加一处判断,防止参数的子类进入到类型转换的流程#65
Open
morningf wants to merge 1 commit intoyangzongzhuan:masterfrom
Open
ReflectUtils.invokeMethodByName 方法添加一处判断,防止参数的子类进入到类型转换的流程#65morningf wants to merge 1 commit intoyangzongzhuan:masterfrom
morningf wants to merge 1 commit intoyangzongzhuan:masterfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
这个地方原本的判断是类型完全相等,其实如果实际传入的类型是参数类型的子类,是可以直接赋值的,不需要再做转换。
这个问题是在我们公司的项目改造Excel导入数据时发现的,excel中有一列是特殊的时间字符串,之后我们使用了Hutool的DateTime类型做了导入的变量解析和保存,之后调用到这个方法时,由于DateTime为Date的子类,进入到转换流程,造成转换异常。