fix: Reflector should reflect record#3551
fix: Reflector should reflect record#3551guanchengang wants to merge 2 commits intomybatis:masterfrom
Conversation
|
@guanchengang I believe you are correct here but want to get @harawata to chime in. In meantime, can you add an extra check on your test to make sure it does NOT contain the items you are causing to be avoided. And maybe for utmost clarity, add a test that shows a dummy record using original logic wrongly picked up those other elements to demonstrate why this was important? |
|
@hazendaz I have added extra checks for this. |
|
Question, is this behaviour explicitly for records now? I believe that if we change the reflector it should be consistent with how a normal class is reflected aswell, not _only records get their static methods and toString, etc.. _ avoided. Could you point to a bug that initially made you want to attempt to fix this to gain more context? |
|
I'm sorry about the slow response. In the documentation of JDK(https://docs.oracle.com/javase/specs/jls/se25/html/jls-8.html#jls-8.10.1-120) Perhaps not dealing with it is also a good choice, as they are automatically generated and all read-only methods, and even if used, will not modify any data🤔. |
When using Reflector to obtain the get method of a record, all methods without parameters (e.g.
toString(),hashCode(), and all custom methods without parameters) are obtained simultaneously. I don't think these can be called the get methods of a record.