[英]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.