I have a java project and I want a list of locations in source code where a RuntimeException might be thrown. Is there any tool or Eclipse plugin to do this?
With FindBugs or PMD the NullPointerExceptions might be located, but I need to locate others as well.
NullPointerException, ClassCastException and ArithmeticException are a special cases as they do not need to be explicitly thrown. However, everything else has to be thrown explicitly.
Searching for possible causes of NullPointerException is useful as its a common bug, however like all RuntimeException they are best avoided rather than handled. Searching for all possible causes is likely to give you a very large result which is unlikely to be useful. (I have been through this exercise myself and after lots of work didn’t achieve much IMHO)
You are better off using code coverage and try edge case values to ensure you have good test cases which are likely to trigger all possible exception instead.