fix: avoid recursive hashCode in write holder contexts#911
Open
skytin1004 wants to merge 1 commit intoapache:mainfrom
Open
fix: avoid recursive hashCode in write holder contexts#911skytin1004 wants to merge 1 commit intoapache:mainfrom
skytin1004 wants to merge 1 commit intoapache:mainfrom
Conversation
269bfe5 to
a448c15
Compare
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.
Purpose of the pull request
Related: #889
This PR addresses only the recursive
hashCode()failure path discussed in #889 and #899.While rechecking the original failure, I found that the custom converter reproduction appears to involve at least two separate concerns:
hashCode()evaluation in write holder/context objectssupportExcelTypeKey()To keep the review focused, this PR deliberately handles only the first issue.
I reproduced the recursive
hashCode()paths locally and added a focused regression test for them:The regression test creates the recursive holder/context references directly and then calls
hashCode(), so it covers this PR's failure path without depending on converter behavior.WriteWorkbookHolder.hashCode()->WorkbookWriteHandlerContext.hashCode()->WriteWorkbookHolder.hashCode()WriteWorkbookHolder.hashCode()-> initialized sheet holder map ->WriteSheetHolder.hashCode()-> parent workbook holder ->WriteWorkbookHolder.hashCode()The fix excludes only the recursive runtime references from Lombok-generated
equals/hashCode:WriteWorkbookHolder.workbookWriteHandlerContextWriteSheetHolder.parentWriteWorkbookHolderWriteSheetHolder.hasBeenInitializedTableWriteTableHolder.parentWriteSheetHolderThis PR intentionally does not change converter lookup behavior. I plan to handle that separately with a smaller follow-up test/fix, because it can fail independently when a global converter is registered with a non-null
supportExcelTypeKey().I verified the change locally by running:
WriteHolderHashCodeTestCustomConverterTestfesod-sheettest suiteAll tests passed.
Note
If this recursive
hashCode()fix looks good and gets merged, I can follow up with a smaller PR focused only on the global write converter lookup case, so that the remaining part of #889 can be addressed clearly.Checklist