Skip to content

Java/Scala JAX-RS: relative @Path templates (no leading slash) produce no Route nodes; Scala class-level @Path not composed #2147

Description

@htarnacki

Version

Built from source, main @ 9b24332 (v0.10.8-181)

Platform / Install channel / Binary variant

Linux (x64) / Built from source / standard

What happened, and what did you expect?

JAX-RS allows @Path values without a leading slash, both on the class and on the method (@Path("widgets"), @Path("{id}")). The route extractor only accepts templates that start with /, so such resources produce no Route nodes and no HANDLES edges at all. In Java frameworks this spelling is common (JAX-RS spec, Jersey, RESTEasy, Quarkus samples).

A second, related gap: for Scala JAX-RS resources the class-level @Path prefix is not joined with the method path (it is for Java and Kotlin), so a Scala method route is emitted as the bare method template instead of <class path>/<method path>.

Expected: relative templates are accepted and normalized so the composed path is always rooted (/widgets/{id}), for Java, Kotlin and Scala alike.

Follow-up to #1005 (PR #1007 fixed class/method composition for rooted @Path values; templates without a leading slash are still rejected before composition runs).

Reproduction

  1. Dummy snippet (Java):
@Path("widgets")
public class WidgetResource {
    @GET @Path("{id}")
    public Widget get(@PathParam("id") String id) { return null; }
}

Scala variant:

@Path("/widgets")
class WidgetResource {
  @GET @Path("{id}")
  def get(@PathParam("id") id: String): Widget = null
}
  1. Command: codebase-memory-mcp cli index_repository '{"repo_path":"/tmp/repro"}' then
    codebase-memory-mcp cli search_graph '{"project":"repro","label":"Route"}'

  2. Result: no Route node for the Java resource; for the Scala resource a Route with path {id}.
    Expected: Route /widgets/{id} with a HANDLES edge from WidgetResource.get in both cases.

Proposed fix

I have a two-commit fix with tests (relative-template acceptance + Scala class-level composition), rebased on current main:
https://github.com/htarnacki/codebase-memory-mcp/tree/fix/jaxrs-relative-path — I will open a PR referencing this issue.

Confirmations

  • I searched existing issues and this is not a duplicate.
  • My reproduction uses shareable code (a dummy snippet), not proprietary code.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    parsing/qualityGraph extraction bugs, false positives, missing edges

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions