private List<ValidationError> validate(){
  List<ValidationError> errors=Lists.newArrayList();
  Module module=getModule();
  errors.addAll(BlazeAndroidRunConfigurationValidationUtil.validateModule(module));
  AndroidFacet facet=null;
  if (module != null) {
    facet=AndroidFacet.getInstance(module);
    errors.addAll(BlazeAndroidRunConfigurationValidationUtil.validateFacet(facet,module));
  }
  errors.addAll(configState.validate(facet));
  errors.addAll(BlazeAndroidRunConfigurationValidationUtil.validateLabel(getLabel(),configuration.getProject(),Kind.ANDROID_BINARY));
  return errors;
}

private List < ValidationError > validate ( ) { List < ValidationError > errors = Lists . newArrayList ( ) ; Module module = getModule ( ) ; errors . addAll ( BlazeAndroidRunConfigurationValidationUtil . validateModule ( module ) ) ; AndroidFacet facet = null ; if ( module != null ) { facet = AndroidFacet . getInstance ( module ) ; errors . addAll ( BlazeAndroidRunConfigurationValidationUtil . validateFacet ( facet , module ) ) ; } errors . addAll ( configState . validate ( facet ) ) ; errors . addAll ( BlazeAndroidRunConfigurationValidationUtil . validateLabel ( getLabel ( ) , configuration . getProject ( ) , Kind . ANDROID_BINARY ) ) ; return errors ; }
we collect errors rather than throwing to avoid missing fatal errors by exiting early for a warning . we use a separate method for the collection so the compiler prevents us from accidentally throwing .
