Skip to content

Add Java‑8 lambda quick‑fix tests for supported JDT correction scenarios#2895

Merged
noopur2507 merged 1 commit intoeclipse-jdt:masterfrom
RagiGeorge:rg-new-test
Apr 10, 2026
Merged

Add Java‑8 lambda quick‑fix tests for supported JDT correction scenarios#2895
noopur2507 merged 1 commit intoeclipse-jdt:masterfrom
RagiGeorge:rg-new-test

Conversation

@RagiGeorge
Copy link
Copy Markdown
Contributor

This PR introduces a new test class LambdaQuickFixTest1d8 that adds meaningful, Java‑8‑specific lambda quick‑fix coverage to the JDT UI test suite.

What it does

The tests intentionally focus only on lambda scenarios for which Eclipse JDT UI currently provides correction proposals, and avoid cases where quick‑fixes are intentionally not offered.

  • Unhandled checked exception inside a lambda
  • Missing return in a lambda block
  • Unused local variable referencing a lambda
  • Unhandled exception in expression lambdas
  • Missing return in conditional lambda bodies

How to test

image

@RagiGeorge RagiGeorge changed the title new test Add Java‑8 lambda quick‑fix tests for supported JDT correction scenarios Mar 25, 2026
@SougandhS SougandhS requested a review from noopur2507 March 25, 2026 13:38
@RagiGeorge
Copy link
Copy Markdown
Contributor Author

hi @noopur2507
Requesting you to please review Thanks

@jjohnstn
Copy link
Copy Markdown
Contributor

jjohnstn commented Apr 1, 2026

@RagiGeorge You also need to add the test to one of the testsuites.

Copy link
Copy Markdown
Member

@noopur2507 noopur2507 left a comment

Choose a reason for hiding this comment

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

In addition to what Jeff mentioned i.e. apply the proposal and compare the result with expected output:

  • Use existing test classes to add tests and reuse methods like QuickFixTest#assertProposalExists where applicable.

  • The content in testUnhandledExceptionInLambda and testUnhandledExceptionInExpressionLambda is identical.

  • tearDown() method should be present.

@RagiGeorge RagiGeorge force-pushed the rg-new-test branch 6 times, most recently from c8012b4 to 72e0f3d Compare April 7, 2026 09:01
@RagiGeorge RagiGeorge requested a review from noopur2507 April 7, 2026 09:46
- Added 5 lambda quick-fix tests to LocalCorrectionsQuickFixTest1d8
- testUnhandledExceptionInLambda: Tests 'Surround with try/catch' for
unhandled exceptions in lambda
- testMissingReturnInConditionalLambda: Tests 'Add return statement' for
missing return in if statement
- testMissingReturnInMultipleBranches: Tests 'Add return statement' for
missing return in if-else branches
- testMissingReturnAfterLoop: Tests 'Add return statement' for missing
return after loop
- testMissingReturnInTryCatch: Tests 'Add return statement' for missing
return in try-catch block
- All tests use assertProposalPreviewEquals to verify the complete fix
output
- Tests are already included in QuickFixTestSuite via
LocalCorrectionsQuickFixTest1d8.class
@RagiGeorge
Copy link
Copy Markdown
Contributor Author

@noopur2507/ @jjohnstn
Incorporated review comment . Please review. Thanks.

Copy link
Copy Markdown
Contributor

@jjohnstn jjohnstn left a comment

Choose a reason for hiding this comment

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

Looks fine. In the future, don't reformat the whole file, just the area where your changes are.

Copy link
Copy Markdown
Member

@noopur2507 noopur2507 left a comment

Choose a reason for hiding this comment

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

Looks good.

@noopur2507 noopur2507 merged commit 95f893c into eclipse-jdt:master Apr 10, 2026
13 checks passed
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.

3 participants