You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(java): no phantom JAX-RS routes for HTTP clients + JPA inline-annotation fields (#138)
Round-5 adversarial sweep (added /tmp/retrofit: interface/annotation/generics-
heavy). Two real Java bugs found and fixed; broad audit otherwise clean.
- JAX-RS false positives (HIGH): route detection fired on any file with @path +
an HTTP-method annotation, so Retrofit — an HTTP CLIENT library whose
@GET/@path come from retrofit2.http on interface methods — produced 28 phantom
server routes. Require a javax/jakarta.ws.rs import (the defining signal for a
real JAX-RS resource) before classifying as JAX-RS. Retrofit now yields 0
routes; petclinic Spring routes (17) and genuine JAX-RS resources unaffected.
- JPA inline-annotated fields: `@Id private Long id;` (annotation inline with the
declaration, the common javax.persistence style) was dropped — the parser
treated the whole line as a pure annotation. Peel leading annotations and parse
the remainder, so inline-annotated fields (incl. the @id primary key) are kept.
Regression tests added for both. Full suite green (3722 passing).
Note: the sweep also surfaced a Kotlin (.kt) call-graph receiver-loss self-edge —
out of this Java-scoped work; flagged for separate follow-up.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The system SHALL only classify a Java/Kotlin file as a JAX-RS server endpoint when it imports from the javax.ws.rs or jakarta.ws.rs package, to prevent false positives from HTTP client annotation libraries.
5091
+
5092
+
> Decision recorded: f9de2e30
5093
+
> Date: 2026-06-17
5088
5094
5089
5095
## Technical Notes
5090
5096
@@ -5502,3 +5508,33 @@ The analyzer hardcoded JS/TS/Python extensions in several places, causing Java/K
5502
5508
Java/Kotlin require imports only for cross-package references; same-package classes are used with no import. The dependency graph was built purely from import edges, so a Java project's file-level graph was nearly empty (spring-petclinic: 10 edges) while its call graph held 1261 — same-package relationships were invisible, hurting structural comprehension and leaving cluster views empty. Fix: (1) run injection for Java/Kotlin regardless of import-edge count, (2) seed the dedup set with existing edges so injected call edges never duplicate an import edge, (3) resolve call-graph file paths to absolute so the two id spaces align.
5503
5509
5504
5510
**Consequences:** New exported SAME_PACKAGE_IMPLICIT_LANGS set (Java, Kotlin). injectCallGraphEdges now dedupes against pre-existing edges, making it safe to run alongside import edges. The absolute-path resolution also repairs the previously-silent no-op injection for Swift/C/C++. Java/Kotlin dependency graphs are now populated (petclinic 10→70 edges, gson 318→1517) with structural clusters; injected edges carry isCallEdge:true.
5511
+
5512
+
### Require a ws.rs import for JAX-RS route detection
5513
+
5514
+
**Status:** Approved
5515
+
**Date:** 2026-06-17
5516
+
**ID:** 954eac79
5517
+
5518
+
JAX-RS route detection fired on any Java file containing both @Path and an HTTP-method annotation (@GET/@POST/...). Retrofit — an HTTP CLIENT library — uses identically-named @GET/@POST/@Path from retrofit2.http on interface methods (client request templates), so OpenLore hallucinated 28 phantom server routes for it (adversarial-audit finding). The defining signal for a real JAX-RS server resource is the javax.ws.rs / jakarta.ws.rs import, which Retrofit never has and Spring does not need. Gating JAX-RS detection on that import removes the false positives without affecting Spring (separate detection path) or genuine JAX-RS resources (which always import ws.rs).
5519
+
5520
+
**Consequences:** extractJavaRouteDefinitions now requires an `import javax|jakarta.ws.rs` before classifying a file as JAX-RS. Retrofit/OkHttp client interfaces yield 0 routes; petclinic Spring routes (17) and JAX-RS resources (which import ws.rs) are unaffected.
5521
+
5522
+
### JPA field parser handles inline annotations on the same line as the field declaration
5523
+
5524
+
**Status:** Approved
5525
+
**Date:** 2026-06-17
5526
+
**ID:** 8605684f
5527
+
5528
+
Common JPA patterns place annotations inline with the field (e.g. `@Id private Long id;`). The previous parser only recognized annotations on their own line, causing inline-annotated fields — including primary keys — to be silently dropped from schema extraction.
5529
+
5530
+
**Consequences:** The parser now iteratively strips leading annotations before testing for a field match, correctly capturing inline-annotated fields. Pure-annotation lines still accumulate in pendingAnn for multi-line annotation stacks.
5531
+
5532
+
### JAX-RS route detection requires javax/jakarta.ws.rs import to avoid false positives from HTTP client libraries
5533
+
5534
+
**Status:** Approved
5535
+
**Date:** 2026-06-17
5536
+
**ID:** f9de2e30
5537
+
5538
+
Retrofit interfaces use identically-named @GET/@POST/@Path annotations from retrofit2.http, which are client request templates, not server endpoints. Without checking the import package, the parser would emit phantom server routes for HTTP client definitions.
5539
+
5540
+
**Consequences:** JAX-RS routes are only detected when the file imports from javax.ws.rs or jakarta.ws.rs; projects using non-standard JAX-RS re-exports would not be recognized. Retrofit and similar HTTP client interfaces are correctly excluded.
0 commit comments