Skip to content

[OSS26] 接口方法查实现 find_implementations_by_method_name #132

Open

Description

@ponyha

接口介绍

给定接口的某个具体方法(接口全限定名 + 方法名,可选形参类型消歧),返回所有实现该方法的位置 — 包括所在类、方法签名、文件路径、行号。

工具名

find_implementations_by_method_name

背景与目标

find_implementations_by_interface_name 解决"接口的所有实现类",但很多场景里我们关心的是某个具体方法的实现,而不是整类:

  • 审计 validate(Request):不关心整个 RequestValidator 类,只想看每个实现里这个方法怎么写
  • 看 Service.execute(...) 的所有版本

本工具基于接口实现关系索引,进一步细化到方法级。

输入参数

参数 类型 必填 说明
interface_full_name string 是 接口全限定名,如 com.example.RequestValidator
method_name string 是 方法名,如 validate
parameter_types string[] 否 形参类型列表,用于重载消歧,如 ["com.example.Request"]。不填则返回所有同名重载
repository_path string 是 仓库本地绝对路径

输出结构

{
  "interface_full_name": "com.example.RequestValidator",
  "method_name": "validate",
  "total_implementations": 2,
  "implementations": [
    {
      "class_full_name": "com.example.impl.JsonRequestValidator",
      "method_signature": "validate(com.example.Request): boolean",
      "file_path": "src/main/java/com/example/impl/JsonRequestValidator.java",
      "line_number": 24,
      "is_override_annotation_present": true
    }
  ]
}

验收标准

  • 正确处理方法重载(同名不同参)
  • 正确处理泛型方法实现
  • 跳过仅声明、未实现的抽象方法
  • 单元测试覆盖:重载、泛型、空实现、桥接方法
  • 中等仓库响应 < 5s

预估工作量

2-3 人日(在接口实现索引基础上扩展)

Activity

  1. added
    OSS26-中等难度
    on Jun 18, 2026
  2. wryyyds7 commented on Jul 28, 2026

    @wryyyds7

    Pure Python implementation reusing #128's class index plus a regex-based Java method parser for signatures, @OverRide detection, and overload disambiguation. Same limitation: cannot locate methods of classes from transitive dependencies without source in the repo. Branch: feat/oss26-find-implementations-by-method-name-132, 26 tests passing.

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

    OSS26-中等难度

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions