Skip to content

Fix constructor resolution issue 4703#4727

Merged
jlerbsc merged 2 commits intojavaparser:masterfrom
johannescoetzee:johannes/fix-4703
Apr 11, 2025
Merged

Fix constructor resolution issue 4703#4727
jlerbsc merged 2 commits intojavaparser:masterfrom
johannescoetzee:johannes/fix-4703

Conversation

@johannescoetzee
Copy link
Copy Markdown
Collaborator

Fixes #4703.

The isMoreSpecific methods in ConstructorResolutionLogic and MethodResolutionLogic were two methods that solve the same problem, but MethodResolutionLogic.isMoreSpecific is a lot more comprehensive. This PR fixes the linked issue and probably a number of other constructor resolution bugs by getting rid of the barebones ConstructorResolutionLogic.isMoreSpecific method and using the one in MethodResolutionLogic which now accepts ResolvedMethodLikeDeclarations. This should also simplify maintenance.

I suspect it's possible to "merge" more of the functionality between ConstructorResolutionLogic and MethodResolutionLogic into a MethodLikeResolutionLogic, but there may be subtle differences to look out for and that's beyond the scope of this particular PR.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 11, 2025

Codecov Report

Attention: Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.

Project coverage is 58.303%. Comparing base (b75cdec) to head (a0cab53).
Report is 5 commits behind head on master.

Files with missing lines Patch % Lines
...r/resolution/logic/ConstructorResolutionLogic.java 0.000% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@               Coverage Diff               @@
##              master     #4727       +/-   ##
===============================================
- Coverage     58.310%   58.303%   -0.008%     
  Complexity      2512      2512               
===============================================
  Files            671       671               
  Lines          38756     38761        +5     
  Branches        7029      7031        +2     
===============================================
  Hits           22599     22599               
- Misses         13265     13270        +5     
  Partials        2892      2892               
Flag Coverage Δ
AlsoSlowTests 58.303% <0.000%> (-0.008%) ⬇️
javaparser-core 58.303% <0.000%> (-0.008%) ⬇️
javaparser-symbol-solver 58.303% <0.000%> (-0.008%) ⬇️
jdk-10 57.854% <0.000%> (-0.008%) ⬇️
jdk-11 57.853% <0.000%> (-0.008%) ⬇️
jdk-12 57.850% <0.000%> (-0.011%) ⬇️
jdk-13 57.853% <0.000%> (-0.008%) ⬇️
jdk-14 58.098% <0.000%> (-0.011%) ⬇️
jdk-15 58.101% <0.000%> (-0.008%) ⬇️
jdk-16 58.075% <0.000%> (-0.008%) ⬇️
jdk-17 58.230% <0.000%> (-0.008%) ⬇️
jdk-18 58.230% <0.000%> (-0.008%) ⬇️
jdk-8 57.855% <0.000%> (-0.008%) ⬇️
jdk-9 57.851% <0.000%> (-0.008%) ⬇️
macos-latest 58.295% <0.000%> (-0.008%) ⬇️
ubuntu-latest 58.290% <0.000%> (-0.008%) ⬇️
windows-latest 58.285% <0.000%> (-0.008%) ⬇️

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

Files with missing lines Coverage Δ
...parser/resolution/logic/MethodResolutionLogic.java 0.000% <ø> (ø)
...r/resolution/logic/ConstructorResolutionLogic.java 0.000% <0.000%> (ø)

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 322e7fa...a0cab53. 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 b22db5a into javaparser:master Apr 11, 2025
34 of 35 checks passed
@jlerbsc jlerbsc added this to the next release milestone Apr 11, 2025
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.

Problem resolving the right constructor

2 participants