tags:

views:

34

answers:

1

Enerjy has a problem with this line of code:

private static List<ParseTree> getTestTrees(Xml test) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException {

This is the warning:

(Baseline) JAVA0126 Method 'getTestTrees' declares unchecked exception 'IllegalArgumentException' in throws

How can I fix this? What is the problem? What does it mean for an exception to be "unchecked"?

+2  A: 

"Unchecked" exceptions (also known as runtime exceptions) are those that the compiler does not force you to catch. For example, imagine if you had to declare and catch NullPointerException everywhere it might occur. These are the types of exceptions that, if they occur, the assumption is your program likely can't recover anyway.

The compiler is telling you to remove IllegalArgumentException from the throws clause of your method.

matt b