antgroup / antgroup/YASA-Engine

[OSS26] 接口查实现类 find_implementations_by_interface_name

Open
#128 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

OSS26-中等难度
Dominant language
TypeScript
Stars
323
Forks
40
PR merge metrics
No merged PRs in 30d

Description

接口介绍

给定 Java 接口的全限定名(如 com.example.RequestValidator),在指定代码仓库内检索并返回该接口的所有实现类位置(类名、文件路径、定义行号),包括直接 implements 与通过抽象类间接实现的情况。

工具名

find_implementations_by_interface_name

背景与目标

接口/抽象类查实现是程序分析的高频路径能力。例如:

  • 安全审计:看到 interface RequestValidator 想知道所有实现是否都做了校验
  • 调用链追踪:Controller 通过接口调用 Service,接口本身不含实现,必须找到实现类才能继续追

本工具面向 Java 项目(后续可扩展其他语言),输出统一结构,便于上层 Agent 把多个 MCP 工具串接成完整的代码理解链路。

输入参数
参数 类型 必填 说明
interface_full_name string 接口全限定名,如 com.example.RequestValidator
repository_path string 仓库本地绝对路径
include_abstract_classes bool 默认 true,是否把抽象类也当作实现源算上
输出结构
{
  "interface_full_name": "com.example.RequestValidator",
  "total_implementations": 3,
  "implementations": [
    {
      "class_full_name": "com.example.impl.JsonRequestValidator",
      "file_path": "src/main/java/com/example/impl/JsonRequestValidator.java",
      "line_number": 12,
      "kind": "class"
    },
    {
      "class_full_name": "com.example.impl.AbstractValidator",
      "file_path": "src/main/java/com/example/impl/AbstractValidator.java",
      "line_number": 8,
      "kind": "abstract_class"
    }
  ]
}
验收标准
  • 在 Java 项目上正确识别 implementsextends(抽象类)关系
  • 支持泛型接口,如 Repository<User> 实现的查询
  • 支持跨多个 Maven module 检索
  • 单元测试覆盖:多层继承、嵌套类、内部类、匿名实现类、找不到时返回空列表
  • 在中等仓库(~5k Java 文件)上响应 < 5s
预估工作量

3-5 人日(关键在 Java 类型解析,需建立类继承关系索引)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Locate the entry point for find_implementations_by_interface_name and inspect the existing Java analysis and repository traversal utilities. Start by tracing how type relationships and tool outputs are represented, then run the existing test suite before adding coverage for inheritance, generics, nested and anonymous classes, missing interfaces, and multi-module repositories. Done means the specified output is returned within the stated performance target.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
devtools
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.