How can you use structural search to find constructor calls for subclasses of a given type?

旧街凉风 提交于 2019-12-12 15:42:41

问题


I have an abstract class called "com.foo.BaseFoo"

I want to find anyone that calls new() on anything that extends from BaseFoo

I've tried doing a search template of:

new $BaseFoo$()

and then edited the variables to have an expression constraint on the type of the object to be

com.foo.BaseFoo

and clicked on the "Apply constraint within type hierarchy" but this hasn't worked.


回答1:


You were almost there. Use a template like the following:

new $BaseFoo$($argument$)

Where $BaseFoo$
Text/regexp: com\.foo\.BaseFoo
check Apply constraint within type hierarchy

and $argument$
minimum count: 0 maximum count: unlimited



来源:https://stackoverflow.com/questions/17861540/how-can-you-use-structural-search-to-find-constructor-calls-for-subclasses-of-a

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!