“忽略潜在的比赛"的含义 [英] Meaning of 'Ignore potential matches'

查看:54
本文介绍了“忽略潜在的比赛"的含义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

窗口>首选项>常规>搜索下,有选项忽略潜在的匹配项

它是做什么的?无论是否激活它,我都看不到任何区别.

What does it do? Whether I activate it or not, I never see a difference.

这是仅对Java开发有意义的选项吗(我从没做过,但是我确实使用Eclipse在C,Python和PHP中进行开发)?

Is it an option that only makes sense for Java development (which I never do, but I do develop in C, Python and PHP using Eclipse)?

推荐答案

请参见错误例如127442 :根据您要搜索的内容(类,方法等),搜索引擎可以找到可以匹配的实例(但不能确定)

See bug 127442 for examples: depending on what you are searching (a class, a method, ...), the Search engine can find instances which could match (but it cannot say for certain).

那些实例标记为" POTENTIAL_MATCH ":

Those instances are marked "POTENTIAL_MATCH":

具有不同数量参数的方法不是潜在的匹配.

A method with different number of parameters is not a potential match.

(请参阅错误97322 )

潜在匹配是解析失败的匹配(例如,方法绑定为空).
如果用户搜索" foo(String)"(没有限定的 String ),则搜索" foo(java.lang.String)",然后" foo(p.String)"都是完全匹配的.

A potential match is a match where the resolution failed (e.g. the method binding is null).
If the user searches for "foo(String)" (without qualifying String), then "foo(java.lang.String)" and "foo(p.String)" are both exact matches.

对于 .class 文件大小写,我认为我们只能在缺少类型大小写大小写的情况下进行潜在的匹配(请参阅

For the .class file case, I think we can only have potential matches in the case of the missing type case (see bug 196200), i.e if the .class file was compiled and some types it references were missing.


bug 382778中找到了潜在的匹配不当行为的当前示例.:

我有一个公共的静态void方法 printIt(String name).
当我打开其呼叫层次结构时,一些呼叫者丢失了.

I have a public static void method printIt(String name).
When I open its call hierarchy, some callers are missing.

我猜想这些调用者不见了,因为java搜索将它们标记为可能的字符,而不是 printIt(String)引用的完全匹配项.
以下代码有时有时被标记为可能,而有时确切地被标记为:

I am guessing the callers are missing because java search marks them as potential instead of exact matches for the printIt(String) reference.
The following code is sometimes marked as potential, and sometimes exact:

// Listing 1
PublicInterface2 impl2 = new Impl2("Name Broken");
Static.printIt(impl2.getName());

当搜索结果标记为潜在时, printIt()调用层次结构中缺少呼叫者.

When the search result is marked potential, the caller is missing from the printIt() call hierarchy.

PublicInterface2 is an empty public interface which extends PackageInterface2Getters.
PackageInterface2Getters is an empty default-scoped interface which extends PackageInterface1Getters.
PackageInterface1Getters is a default-scoped interface which declares String getName().

因此,上面的 impl2.getName()返回一个 String .

我报告了一些问题,我猜想这些比赛会被标记为潜在问题:

There are some problems reported which I guess make the matches be marked as potential:

...
Filename : \D:\workspace\eclipse\_runtimes\jdt\call-hierarchy-bug\src\main\PublicInterface2.java
COMPILED type(s)    
2 PROBLEM(s) detected 
     - Pb(2) PackageInterface1Getters cannot be resolved to a type
     - Pb(327) The hierarchy of the type PublicInterface2 is inconsistent

结果是:

编译器要求" NameEnvironment "获取任何从属类型的类型信息.
搜索在 JavaSearchNameEnvironment 中具有自己的 NameEnvironment 实现,并且不查找辅助类型.
这很糟糕,令人惊讶的是,到目前为止我们还没有遇到这个问题.

The compiler asks the "NameEnvironment" to get the type information of any dependent type.
Search has it's own NameEnvironment implementation in JavaSearchNameEnvironment and it is not looking for secondary types.
This is bad and it is surprising that we haven't run into this problem until now.

这篇关于“忽略潜在的比赛"的含义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆