Skip to content

Allow computeIfAbsent on a different collection in functional conversion - #1478

Merged
carstenartur merged 1 commit into
mainfrom
fix/functional-compute-if-absent
Aug 14, 2026
Merged

Allow computeIfAbsent on a different collection in functional conversion#1478
carstenartur merged 1 commit into
mainfrom
fix/functional-compute-if-absent

Conversation

@carstenartur

Copy link
Copy Markdown
Owner

Scope

Adds an isolated executable reproduction for #1476:

  • list iteration with map.computeIfAbsent(...) must convert to list.forEach(...) because the mutated map is not the traversed collection;
  • map.entrySet() iteration with map.computeIfAbsent(...) must remain unchanged because the backing map is the traversed structural owner.

The first CI run intentionally establishes whether the fault is still in production logic or whether the previously disabled integration test is stale. A production change will be added only if the positive regression fails; the receiver-sensitive safety guard must remain intact.

Fixes #1476.

@github-actions

Copy link
Copy Markdown
Contributor

Static source inventory only: this workflow lexically scans Java code while ignoring comments, strings, character literals and text blocks. It does not compile or execute tests. The authoritative build/test signal is Java CI with Maven.

JUnit Test Overview Report

Generated on: 31839487823

Overall Statistics

  • Total Test Modules: 16
  • Total Test Files: 225
  • Total Tests: 1455
  • Enabled Tests: 1455 (100.0%)
  • Disabled Tests: 0 (0.0%)

Test Summary by Plugin

Plugin Test Files Total Tests Enabled Disabled Disabled %
sandbox_cleanup_application_test 7 64 64 0 0.0%
sandbox_common_test 56 379 379 0 0.0%
sandbox_css_cleanup_test 5 43 43 0 0.0%
sandbox_encoding_quickfix_test 5 18 18 0 0.0%
sandbox_functional_converter_test 36 367 367 0 0.0%
sandbox_int_to_enum_test 11 31 31 0 0.0%
sandbox_jface_cleanup_test 3 12 12 0 0.0%
sandbox_junit_cleanup_test 57 308 308 0 0.0%
sandbox_method_reuse_test 1 1 1 0 0.0%
sandbox_platform_helper_test 3 7 7 0 0.0%
sandbox_test_commons 12 29 29 0 0.0%
sandbox_tools_test 2 3 3 0 0.0%
sandbox_triggerpattern_test 15 101 101 0 0.0%
sandbox_usage_view_test 6 27 27 0 0.0%
sandbox_use_general_type_test 1 15 15 0 0.0%
sandbox_xml_cleanup_test 5 50 50 0 0.0%

Disabled Tests Details

No disabled tests found! 🎉


Generated by the Test Source Inventory workflow

@carstenartur
carstenartur marked this pull request as ready for review August 14, 2026 22:05
Copilot AI lite review requested due to automatic review settings August 14, 2026 22:05

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds focused regression coverage for functional-loop conversion behavior around Map.computeIfAbsent(...), ensuring conversion is allowed when mutating a different collection than the one being traversed, while remaining blocked when mutating the backing map of a traversed map view.

Changes:

  • Introduces a dedicated JUnit test class reproducing issue #1476 with an enhanced-for over a List that calls map.computeIfAbsent(...) and expects conversion to list.forEach(...).
  • Adds a negative test asserting conversion remains blocked when iterating map.entrySet() and mutating the backing map via computeIfAbsent(...).

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@carstenartur
carstenartur merged commit 327d3c1 into main Aug 14, 2026
13 checks passed
@carstenartur
carstenartur deleted the fix/functional-compute-if-absent branch August 14, 2026 22:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Functional converter: allow Map.computeIfAbsent on a different collection

2 participants