Skip to content

Fix: Issue 4829 Infinite loop in DifferenceElementCalculator when calling setPermittedTypes#4834

Merged
jlerbsc merged 2 commits into
javaparser:masterfrom
jlerbsc:master
Sep 11, 2025
Merged

Fix: Issue 4829 Infinite loop in DifferenceElementCalculator when calling setPermittedTypes#4834
jlerbsc merged 2 commits into
javaparser:masterfrom
jlerbsc:master

Conversation

@jlerbsc

@jlerbsc jlerbsc commented Sep 11, 2025

Copy link
Copy Markdown
Collaborator

The algorithm that calculates the differences in representation of a node following a change has exponential complexity when we remove the permits clause. One solution is to add memoisation to eliminate recalculations. This reduces the complexity to O(n*m).

Fixes #4829 .

@codecov

codecov Bot commented Sep 11, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.71429% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 58.355%. Comparing base (071e827) to head (8faf244).
⚠️ Report is 6 commits behind head on master.

Files with missing lines Patch % Lines
...xicalpreservation/LexicalDifferenceCalculator.java 62.500% 3 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@               Coverage Diff               @@
##              master     #4834       +/-   ##
===============================================
+ Coverage     58.335%   58.355%   +0.019%     
  Complexity      2518      2518               
===============================================
  Files            671       671               
  Lines          38808     38821       +13     
  Branches        7053      7056        +3     
===============================================
+ Hits           22639     22654       +15     
- Misses         13284     13285        +1     
+ Partials        2885      2882        -3     
Flag Coverage Δ
AlsoSlowTests 58.355% <85.714%> (+0.019%) ⬆️
javaparser-core 58.355% <85.714%> (+0.019%) ⬆️
javaparser-symbol-solver 58.355% <85.714%> (+0.019%) ⬆️
jdk-10 57.909% <85.714%> (+0.021%) ⬆️
jdk-11 57.908% <85.714%> (+0.021%) ⬆️
jdk-12 57.908% <85.714%> (+0.021%) ⬆️
jdk-13 57.908% <85.714%> (+0.021%) ⬆️
jdk-14 58.155% <85.714%> (+0.021%) ⬆️
jdk-15 58.155% <85.714%> (+0.021%) ⬆️
jdk-16 58.129% <85.714%> (+0.021%) ⬆️
jdk-17 58.284% <85.714%> (+0.021%) ⬆️
jdk-18 58.284% <85.714%> (+0.021%) ⬆️
jdk-8 57.907% <85.714%> (+0.019%) ⬆️
jdk-9 57.906% <85.714%> (+0.021%) ⬆️
macos-latest 58.347% <85.714%> (+0.019%) ⬆️
ubuntu-latest 58.342% <85.714%> (+0.019%) ⬆️
windows-latest 58.336% <85.714%> (+0.019%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...xicalpreservation/DifferenceElementCalculator.java 86.734% <100.000%> (+1.173%) ⬆️
...xicalpreservation/LexicalDifferenceCalculator.java 73.094% <62.500%> (-0.879%) ⬇️

... and 3 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1652327...8faf244. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jlerbsc jlerbsc merged commit ac72f5b into javaparser:master Sep 11, 2025
32 checks passed
@jlerbsc jlerbsc added this to the next release milestone Sep 11, 2025
@jlerbsc jlerbsc added the PR: Fixed A PR that offers a fix or correction label Sep 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR: Fixed A PR that offers a fix or correction

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Infinite loop in DifferenceElementCalculator when calling setPermittedTypes

1 participant