Source:
<code><START> protected boolean validateAnnotatedFieldOrMethod(@NotNull final Element annotatedElement) { <END> boolean valid = true; final Element enclosingElement = annotatedElement.getEnclosingElement(); if (enclosingElement.getKind() != CLASS) { throw new ProcessingException( annotatedElement, "Please apply " + getColumnAnnotationClass().getSimpleName() + " to fields or methods of class: " + annotatedElement.getSimpleName() ); } if (enclosingElement.getAnnotation(getTypeAnnotationClass()) == null) { Element superClass = typeUtils.asElement(((TypeElement) enclosingElement).getSuperclass()); if (superClass.getAnnotation(getTypeAnnotationClass()) != null) { valid = false; } else { throw new ProcessingException( annotatedElement, "Please annotate class " + enclosingElement.getSimpleName() + " with " + getTypeAnnotationClass().getSimpleName() ); } } if (annotatedElement.getKind() == FIELD && annotatedElement.getModifiers().contains(PRIVATE)) { throw new ProcessingException( annotatedElement, getColumnAnnotationClass().getSimpleName() + " can not be applied to private field: " + annotatedElement.getSimpleName() ); } if (annotatedElement.getKind() == FIELD && annotatedElement.getModifiers().contains(FINAL)) { throw new ProcessingException( annotatedElement, getColumnAnnotationClass().getSimpleName() + " can not be applied to final field: " + annotatedElement.getSimpleName() ); } if (annotatedElement.getKind() == METHOD && !((ExecutableElement) annotatedElement).getParameters().isEmpty()) { throw new ProcessingException( annotatedElement, getColumnAnnotationClass().getSimpleName() + " can not be applied to method with parameters: " + annotatedElement.getSimpleName() ); } return valid; }</code><technical_language>I prefer rename this method throw specific exception, moment this code mixes concepts return exceptions define behave for caller, need convert return values (ie enum instead of exceptions) throw exception instead of return</technical_language>

Target:
protected void validateAnnotatedFieldOrMethod(@NotNull final Element annotatedElement) throws SkipNotAnnotatedClassWithAnnotatedParentException { final Element enclosingElement = annotatedElement.getEnclosingElement(); if (enclosingElement.getKind() != CLASS) { throw new ProcessingException( annotatedElement, "Please apply " + getColumnAnnotationClass().getSimpleName() + " to fields or methods of class: " + annotatedElement.getSimpleName() ); } if (enclosingElement.getAnnotation(getTypeAnnotationClass()) == null) { Element superClass = typeUtils.asElement(((TypeElement) enclosingElement).getSuperclass()); if (superClass.getAnnotation(getTypeAnnotationClass()) != null) { throw new SkipNotAnnotatedClassWithAnnotatedParentException("Fields of classes not annotated with" + getTypeAnnotationClass().getSimpleName() + "which have parents annotated with" + getTypeAnnotationClass().getSimpleName() + "will be skipped (e.g. AutoValue case)"); } else { throw new ProcessingException( annotatedElement, "Please annotate class " + enclosingElement.getSimpleName() + " with " + getTypeAnnotationClass().getSimpleName() ); } } if (annotatedElement.getKind() == FIELD && annotatedElement.getModifiers().contains(PRIVATE)) { throw new ProcessingException( annotatedElement, getColumnAnnotationClass().getSimpleName() + " can not be applied to private field: " + annotatedElement.getSimpleName() ); } if (annotatedElement.getKind() == FIELD && annotatedElement.getModifiers().contains(FINAL)) { throw new ProcessingException( annotatedElement, getColumnAnnotationClass().getSimpleName() + " can not be applied to final field: " + annotatedElement.getSimpleName() ); } if (annotatedElement.getKind() == METHOD && !((ExecutableElement) annotatedElement).getParameters().isEmpty()) { throw new ProcessingException( annotatedElement, getColumnAnnotationClass().getSimpleName() + " can not be applied to method with parameters: " + annotatedElement.getSimpleName() ); } }