Finding unused methods in IntelliJ (excluding tests)

我怕爱的太早我们不能终老 提交于 2019-12-06 01:48:28

问题


I ran into a method today that is .. not used anywhere .. but is tested. Since it is used by a test, IntelliJ did not flag the method as 'unused'.

Does IntelliJ allow for the following search condition "Find methods that are unused with the exception of tests, where test is defined as anything with @Test annotation"


回答1:


There is a related feature request:

  • IDEA-56519 Inspection for unused code needs options to take into account methods run by test harnesses

While the first point is already covered by the Configure annotations... option in the inspection settings, the second point is still valid:

An option such that a test method (as described above) is not considered an entry point. This is so that we can eliminate ‘production’ methods that are only used by test methods.



来源:https://stackoverflow.com/questions/13827056/finding-unused-methods-in-intellij-excluding-tests

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