Skip to content

Fix issue 132 and refactor entry point detection logic. #133

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 17, 2025

Conversation

rahlk
Copy link
Collaborator

@rahlk rahlk commented Apr 16, 2025

Motivation and Context

This change addresses Issue #132, which reported that codeanalyzer fails to detect certain JakartaEE methods (e.g., doPost(...)) as valid entrypoints even though the surrounding class is correctly recognized as an entrypoint class.

The root cause was a flawed heuristic in the isEntrypointMethod(...) implementation that required both:

  • the presence of request/response parameters, and
  • an annotation containing the string "Override".

Since methods like doPost(...) override HttpServlet methods but may not explicitly include the @Override annotation (which is optional in Java), the AND condition resulted in false negatives.

This PR removes the faulty annotation check and ensures servlet entrypoints are correctly discovered.

Additionally, this change refactors discovery logic to leverage a new EntrypointFinderFactory, improving modularity and extensibility for multi-framework support.

How Has This Been Tested?

  • Ran the updated codeanalyzer against a JakartaEE sample application with HttpServlet subclasses.
  • Verified that doPost(...), doGet(...), and similar methods are now correctly marked as entrypoints.
  • Confirmed no regressions in Spring or JAX-RS entrypoint detection.

Breaking Changes

No breaking changes. This is a non-breaking behavioral fix that improves the correctness of entrypoint detection in JakartaEE applications.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the Codellm-Devkit Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

  • The use of EntrypointFinderFactory now cleanly supports framework-specific entrypoint logic (e.g., Spring, JAX-RS, Jakarta).
  • This abstraction will make future enhancements (e.g., Struts, Camel) easier to plug in.
  • Minor cleanups also improve maintainability by localizing entrypoint logic to its respective finder class.

Signed-off-by: Rahul Krishna <i.m.ralk@gmail.com>
@rahlk rahlk linked an issue Apr 16, 2025 that may be closed by this pull request
@rahlk rahlk added the bug Something isn't working label Apr 16, 2025
@rahlk rahlk self-assigned this Apr 16, 2025
@rahlk rahlk requested review from pavuluri and sinha108 April 16, 2025 17:43
Copy link
Collaborator

@pavuluri pavuluri left a comment

Choose a reason for hiding this comment

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

Approving this request after going through code changes. However, we need to test this with the large application where we observed the bug; with the new codeanallyzer release jar.

@rahlk rahlk merged commit 20da0eb into main Apr 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to find all entrypoint methods
3 participants