示例

public class ClassA {
public void methodA {

//...
System.exit(0);
}

解决方案
改为抛出 RuntimeException。

public class ClassA {
public void methodA throws RuntimeException {

//...
throw new RuntimeException();
}