如何在Eclipse中按方法的完全限定名称进行搜索

问题描述 投票:0回答:1

我需要在Eclipse(Luna)中按方法的限定名称进行搜索

我试图使用限定名称(右键单击>复制限定名称复制)找到myMethod,然后在Eclipse的搜索框中找到Ctrl + V myproject.core.services.MyClass.myMethod(P)

这条路:

代码是这样的:

public class MyClass extends AnotherClass {
    @Override
    public void myMethod(P p) {
        // code
    }
}

当我搜索如上图所示,我从父类(AnotherClass)获取搜索结果的方法

我希望MyClass的重写方法作为搜索结果。

java eclipse eclipse-luna
1个回答
1
投票

不要将查询限制为限定引用,而是在“限制为”部分的“声明”中选择以查找方法声明。

匹配位置限定参考用于静态方法。例如,在以下主方法中,有一个对com.example.Foo.foo()方法的非限定和两个限定引用:

package com.example;
public class Foo {

    public static void main(String[] args) {
        foo(); // non-qualified reference
        Foo.foo(); // qualified reference
        com.example.Foo.foo(); // (full) qualified reference
    }

    static void foo() {}

}
© www.soinside.com 2019 - 2024. All rights reserved.