[英]In IntelliJ, is it possible to find usages of a typed method with a specific type?
假設我有一個類型化的方法:
public interface Foo {
public <T> T bar();
}
在Intellij中,我可以僅使用特定類型搜索方法用法嗎? 比方說,只有String
?
foo.<String>bar(); // will be listed in the search result
foo.<Integer>bar(); // won't
冒着讓你失望的風險,我不相信。 我查看了“查找用法”選項,但沒有任何樂趣。 我想也許標准的文本搜索是前進的方式。
這是可能的,但它需要一些工作。 使用“ Edit > Find > Search Structurally
然后鍵入如下搜索模式:
$a$.<String>bar()
單擊“結構搜索”對話框中的“ Edit Variables
”,將Foo
放入“ Expression type (regexp)
文本字段中,並Apply constraint within type hierarchy
啟用“ Apply constraint within type hierarchy
。 單擊“ OK
,然后單擊“ Find
,將Find
所有使用<String>的調用,即使type參數是隱式的,例如:
String s = foo.bar();
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.