[JAVA-4886] Nested maps should not shadow variables Created: 16/Feb/23 Updated: 06/Oct/23 |
|
| Status: | Backlog |
| Project: | Java Driver |
| Component/s: | Builders |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Unknown |
| Reporter: | Maxim Katcharov | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Quarter: | FY24Q4 |
| Documentation Changes Summary: | 1. What would you like to communicate to the user about this feature? |
| Description |
|
The following code fails:
The code should set each cell in the row to the sum of the entire row. But because we re-use "$$this" as the variable, "a" in "a.sum" will actually refer to "b". That is, there is inappropriate shadowing of "a". Instead of using "$$this", we should use "var1", 2,3.. etc., such that the N is one higher than the N used by any sub-expression (max of all sub-expressions, + 1). |