11name : " Java 14+ records — definitions, members, call resolution, and pattern matching"
22
3- # Gaps confirmed by this fixture — tracked in #846, do not expand this issue to fix them:
4- # - compact_constructor_declaration has no scope rule → compact constructors not indexed.
5- # Follow-up: add scope("compact_constructor_declaration", "Constructor") to java.rs.
6- # - Implicit accessor methods generated from record components (e.g. x(), y()) are
7- # compiler-synthesised and absent from the source AST → not indexed.
8- # Additional gap tracked in #851:
3+ # Remaining gaps confirmed by this fixture:
4+ # - Implicit equals/hashCode/toString on records are compiler-synthesised and
5+ # not indexed; the java.rs on_scope hook only synthesises component accessors.
6+ # Gap tracked in #851:
97# - Java 21 record patterns (record_pattern nodes) produce no edges at all:
108# neither the type reference (instanceof Point(int x, int y)) nor accessor
11- # calls for destructured components. Accessor-call emission for destructured
12- # components additionally depends on implicit accessors existing (#846).
9+ # calls for destructured components.
1310
1411fixtures :
1512 - path : com/example/records/Measurable.java
@@ -276,6 +273,15 @@ tests:
276273 - { row_count: 1 }
277274 - { row: { name: "Range" } }
278275
276+ - name : " Bounds compact constructor is extracted"
277+ query : |
278+ MATCH (cls:Definition)-[:DefinitionToDefinition]->(m:Definition)
279+ WHERE cls.fqn = 'com.example.records.Bounds' AND m.name = 'Bounds'
280+ AND m.definition_type = 'Constructor'
281+ RETURN m.fqn AS fqn
282+ assert :
283+ - { row_count: 1 }
284+
279285 # ── Methods ───────────────────────────────────────────────────────
280286
281287 - name : " Custom method length() in Range is extracted"
@@ -296,6 +302,20 @@ tests:
296302 - { row_count: 1 }
297303 - { row: { type: "Method" } }
298304
305+ - name : " Implicit accessors x() and y() are synthesised for Point components"
306+ query : |
307+ MATCH (cls:Definition)-[:DefinitionToDefinition]->(m:Definition)
308+ WHERE cls.fqn = 'com.example.records.Point'
309+ AND m.definition_type = 'Method'
310+ RETURN m.name AS name, m.start_line AS line
311+ ORDER BY name
312+ assert :
313+ # Line 4 is the record declaration: synthetic accessors anchor to
314+ # their component's range.
315+ - { row_count: 2 }
316+ - { row: { name: "x", line: 4 } }
317+ - { row: { name: "y", line: 4 } }
318+
299319 # ── Containment edges ─────────────────────────────────────────────
300320
301321 - name : " Range record defines its canonical constructor"
@@ -428,6 +448,33 @@ tests:
428448 assert :
429449 - { row_count: 1 }
430450
451+ - name : " PointUser.describe() calls implicit accessors Point.x and Point.y"
452+ query : |
453+ MATCH (caller:Definition)-[e:DefinitionToDefinition]->(callee:Definition)
454+ WHERE caller.fqn = 'com.example.records.PointUser.describe'
455+ AND e.edge_kind = 'Calls'
456+ AND callee.name IN ['x', 'y']
457+ RETURN callee.fqn AS callee
458+ ORDER BY callee
459+ assert :
460+ - { row_count: 2 }
461+ - { row: { callee: "com.example.records.Point.x" } }
462+ - { row: { callee: "com.example.records.Point.y" } }
463+
464+ - name : " ShapeUser.area() implicit accessor calls on instanceof-bound variables"
465+ query : |
466+ MATCH (caller:Definition)-[e:DefinitionToDefinition]->(callee:Definition)
467+ WHERE caller.fqn = 'com.example.records.ShapeUser.area'
468+ AND e.edge_kind = 'Calls'
469+ AND callee.name IN ['radius', 'width', 'height']
470+ RETURN DISTINCT callee.fqn AS callee
471+ ORDER BY callee
472+ assert :
473+ - { row_count: 3 }
474+ - { row: { callee: "com.example.records.Circle.radius" } }
475+ - { row: { callee: "com.example.records.Rectangle.height" } }
476+ - { row: { callee: "com.example.records.Rectangle.width" } }
477+
431478 # ── Explicit overrides of implicit members ────────────────────────
432479
433480 - name : " Explicit accessor override is a single Method definition"
@@ -491,18 +538,6 @@ tests:
491538
492539 # ── Gaps (severity: warning — see header comment) ─────────────────
493540
494- - name : " GAP: Point accessor methods defined"
495- severity : warning
496- query : |
497- MATCH (cls:Definition)-[:DefinitionToDefinition]->(m:Definition)
498- WHERE cls.fqn = 'com.example.records.Point'
499- AND m.definition_type = 'Method'
500- RETURN m.name AS name
501- ORDER BY name
502- assert :
503- - { row: { name: "x" } }
504- - { row: { name: "y" } }
505-
506541 - name : " GAP: implicit equals/hashCode/toString defined on Point"
507542 severity : warning
508543 query : |
@@ -516,42 +551,6 @@ tests:
516551 - { row: { name: "hashCode" } }
517552 - { row: { name: "toString" } }
518553
519- - name : " GAP: PointUser.describe() calls Point.x and Point.y accessors"
520- severity : warning
521- query : |
522- MATCH (caller:Definition)-[e:DefinitionToDefinition]->(callee:Definition)
523- WHERE caller.fqn = 'com.example.records.PointUser.describe'
524- AND e.edge_kind = 'Calls'
525- RETURN callee.name AS callee
526- ORDER BY callee
527- assert :
528- - { row: { callee: "x" } }
529- - { row: { callee: "y" } }
530-
531- - name : " GAP: ShapeUser.area() accessor calls on instanceof-bound variables"
532- severity : warning
533- query : |
534- MATCH (caller:Definition)-[e:DefinitionToDefinition]->(callee:Definition)
535- WHERE caller.fqn = 'com.example.records.ShapeUser.area'
536- AND e.edge_kind = 'Calls'
537- AND callee.name IN ['radius', 'width', 'height']
538- RETURN callee.name AS callee
539- ORDER BY callee
540- assert :
541- - { row: { callee: "height" } }
542- - { row: { callee: "radius" } }
543- - { row: { callee: "width" } }
544-
545- - name : " GAP: Bounds compact constructor is extracted"
546- severity : warning
547- query : |
548- MATCH (cls:Definition)-[:DefinitionToDefinition]->(m:Definition)
549- WHERE cls.fqn = 'com.example.records.Bounds' AND m.name = 'Bounds'
550- AND m.definition_type IN ['Constructor', 'Method']
551- RETURN m.fqn AS fqn
552- assert :
553- - { row_count: 1 }
554-
555554 - name : " GAP: instanceof record pattern emits Point type reference"
556555 severity : warning
557556 query : |
0 commit comments