test_class.declarator: processingEnv
test_class.modifier: private
test_class.original_string: private ProcessingEnvironment processingEnv;
test_class.type: ProcessingEnvironment
test_class.var_name: processingEnv
test_class.declarator: elementHelper
test_class.modifier: private
test_class.original_string: private ElementHelper elementHelper;
test_class.type: ElementHelper
test_class.var_name: elementHelper
test_class.declarator: buildableValidator
test_class.modifier: private
test_class.original_string: private BuildableValidator buildableValidator;
test_class.type: BuildableValidator
test_class.var_name: buildableValidator
test_class.declarator: element
test_class.modifier: private
test_class.original_string: private TypeElement element;
test_class.type: TypeElement
test_class.var_name: element
test_class.declarator: enclosingElement
test_class.modifier: private
test_class.original_string: private Element enclosingElement;
test_class.type: Element
test_class.var_name: enclosingElement
test_class.declarator: constructor
test_class.modifier: private
test_class.original_string: private ExecutableElement constructor;
test_class.type: ExecutableElement
test_class.var_name: constructor
test_class.declarator: iterator
test_class.modifier: private
test_class.original_string: private Iterator<ExecutableElement> iterator;
test_class.type: Iterator<ExecutableElement>
test_class.var_name: iterator
test_class.declarator: buildableAnnotation
test_class.modifier: private
test_class.original_string: private Buildable buildableAnnotation;
test_class.type: Buildable
test_class.var_name: buildableAnnotation
test_class.declarator: messager
test_class.modifier: private
test_class.original_string: private Messager messager;
test_class.type: Messager
test_class.var_name: messager
test_class.file: buildergen/src/test/java/info/piwai/buildergen/validation/BuildableValidatorTest.java
test_class.identifier: BuildableValidatorTest
test_case.body: @Test
  	public void emptyCustomBuilderNameIsNotValid() {
  		when(buildableAnnotation.value()).thenReturn("");
  		
  		boolean valid = buildableValidator.validate(element);
  		
  		verify(messager).printMessage(any(Kind.class), anyString(), any(Element.class), any(AnnotationMirror.class), any(AnnotationValue.class));
  		
  		assertFalse(valid);
  	}
test_case.class_method_signature: BuildableValidatorTest.emptyCustomBuilderNameIsNotValid()
test_case.full_signature: @Test public void emptyCustomBuilderNameIsNotValid()
test_case.identifier: emptyCustomBuilderNameIsNotValid
test_case.invocations: thenReturn when value validate printMessage verify any anyString any any any assertFalse
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void emptyCustomBuilderNameIsNotValid()
focal_class.declarator: processingEnv
focal_class.modifier: private final
focal_class.original_string: private final ProcessingEnvironment processingEnv;
focal_class.type: ProcessingEnvironment
focal_class.var_name: processingEnv
focal_class.declarator: elementHelper
focal_class.modifier: private final
focal_class.original_string: private final ElementHelper elementHelper;
focal_class.type: ElementHelper
focal_class.var_name: elementHelper
focal_class.file: buildergen/src/main/java/info/piwai/buildergen/validation/BuildableValidator.java
focal_class.identifier: BuildableValidator
focal_class.class_method_signature: BuildableValidator.BuildableValidator(ProcessingEnvironment processingEnv, ElementHelper elementHelper)
focal_class.full_signature: public  BuildableValidator(ProcessingEnvironment processingEnv, ElementHelper elementHelper)
focal_class.identifier: BuildableValidator
focal_class.modifiers: public
focal_class.parameters: (ProcessingEnvironment processingEnv, ElementHelper elementHelper)
focal_class.signature:  BuildableValidator(ProcessingEnvironment processingEnv, ElementHelper elementHelper)
focal_class.class_method_signature: BuildableValidator.validate(TypeElement element)
focal_class.full_signature: public boolean validate(TypeElement element)
focal_class.identifier: validate
focal_class.modifiers: public
focal_class.parameters: (TypeElement element)
focal_class.return: boolean
focal_class.signature: boolean validate(TypeElement element)
focal_class.class_method_signature: BuildableValidator.printBuildError(Element annotatedElement, String message)
focal_class.full_signature: private void printBuildError(Element annotatedElement, String message)
focal_class.identifier: printBuildError
focal_class.modifiers: private
focal_class.parameters: (Element annotatedElement, String message)
focal_class.return: void
focal_class.signature: void printBuildError(Element annotatedElement, String message)
focal_class.class_method_signature: BuildableValidator.printBuildableError(Element annotatedElement, String message)
focal_class.full_signature: private void printBuildableError(Element annotatedElement, String message)
focal_class.identifier: printBuildableError
focal_class.modifiers: private
focal_class.parameters: (Element annotatedElement, String message)
focal_class.return: void
focal_class.signature: void printBuildableError(Element annotatedElement, String message)
focal_class.class_method_signature: BuildableValidator.printMessageOnAnnotation(Diagnostic.Kind diagnosticKind, Element annotatedElement, Class<? extends Annotation> annotationClass, String message)
focal_class.full_signature: private void printMessageOnAnnotation(Diagnostic.Kind diagnosticKind, Element annotatedElement, Class<? extends Annotation> annotationClass, String message)
focal_class.identifier: printMessageOnAnnotation
focal_class.modifiers: private
focal_class.parameters: (Diagnostic.Kind diagnosticKind, Element annotatedElement, Class<? extends Annotation> annotationClass, String message)
focal_class.return: void
focal_class.signature: void printMessageOnAnnotation(Diagnostic.Kind diagnosticKind, Element annotatedElement, Class<? extends Annotation> annotationClass, String message)
focal_class.class_method_signature: BuildableValidator.findAnnotationMirror(Element annotatedElement, Class<? extends Annotation> annotationClass)
focal_class.full_signature: private AnnotationMirror findAnnotationMirror(Element annotatedElement, Class<? extends Annotation> annotationClass)
focal_class.identifier: findAnnotationMirror
focal_class.modifiers: private
focal_class.parameters: (Element annotatedElement, Class<? extends Annotation> annotationClass)
focal_class.return: AnnotationMirror
focal_class.signature: AnnotationMirror findAnnotationMirror(Element annotatedElement, Class<? extends Annotation> annotationClass)
focal_class.class_method_signature: BuildableValidator.hasSameQualifiedName(TypeElement annotation, Class<? extends Annotation> annotationClass)
focal_class.full_signature: private boolean hasSameQualifiedName(TypeElement annotation, Class<? extends Annotation> annotationClass)
focal_class.identifier: hasSameQualifiedName
focal_class.modifiers: private
focal_class.parameters: (TypeElement annotation, Class<? extends Annotation> annotationClass)
focal_class.return: boolean
focal_class.signature: boolean hasSameQualifiedName(TypeElement annotation, Class<? extends Annotation> annotationClass)
focal_method.body: public boolean validate(TypeElement element) {
  
  		IsValid valid = new IsValid();
  
  		if (element.getKind() != ElementKind.CLASS) {
  			valid.invalidate();
  			printBuildableError(element, "%s can only be used on class");
  		}
  
  		if (element.getEnclosingElement().getKind() != ElementKind.PACKAGE) {
  			valid.invalidate();
  			printBuildableError(element, "%s can only be used on a top-level class, no inner class please");
  		}
  
  		if (element.getModifiers().contains(Modifier.ABSTRACT)) {
  			valid.invalidate();
  			printBuildableError(element, "%s cannot be used on an abstract class");
  		}
  		
  		Buildable buildableAnnotation = element.getAnnotation(Buildable.class);
  		String builderNameSuffix = buildableAnnotation.value();
  		if ("".equals(builderNameSuffix)) {
  			valid.invalidate();
  			AnnotationMirror annotationMirror = findAnnotationMirror(element, Buildable.class);
  			AnnotationValue annotationValue = annotationMirror.getElementValues().values().iterator().next();
  			processingEnv.getMessager().printMessage(Kind.ERROR, "The builder name suffix should not be an empty String", element, annotationMirror, annotationValue);
  		}
  		
  		
  
  		Set<ExecutableElement> constructors = elementHelper.findAccessibleConstructors(element);
  
  		if (constructors.size() == 0) {
  			valid.invalidate();
  			printBuildableError(element, "No accessible constructor found. Please provide at least one not private constructor.");
  		} else {
  			ExecutableElement builderConstructor = null;
  			if (constructors.size() == 1) {
  				builderConstructor = constructors.iterator().next();
  			} else {
  				Set<ExecutableElement> builderConstructors = elementHelper.findBuilderConstructors(constructors);
  				if (builderConstructors.size() == 0) {
  					valid.invalidate();
  					String message = "Multiple constructor candidates found. Please use @" + Build.class.getSimpleName() + " annotation on the selected constructor.";
  					printBuildableError(element, message);
  					for (ExecutableElement constructor : constructors) {
  						processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR, message, constructor);
  					}
  				} else if (builderConstructors.size() > 1) {
  					valid.invalidate();
  					for (ExecutableElement constructor : builderConstructors) {
  						printBuildError(constructor, "%s should not be used more than once in a class.");
  					}
  				} else {
  					builderConstructor = builderConstructors.iterator().next();
  				}
  			}
  
  			if (builderConstructor != null) {
  				List<? extends TypeMirror> thrownTypes = builderConstructor.getThrownTypes();
  				if (thrownTypes.size() > 0) {
  					Types typeUtils = processingEnv.getTypeUtils();
  					Elements elementUtils = processingEnv.getElementUtils();
  					TypeElement exceptionElement = elementUtils.getTypeElement(Exception.class.getName());
  					TypeMirror exceptionMirror = exceptionElement.asType();
  					for (TypeMirror thrownType : thrownTypes) {
  						if (!typeUtils.isSubtype(thrownType, exceptionMirror)) {
  							valid.invalidate();
  							processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR, "The constructor used by the builder can only throw subtypes of Exception", builderConstructor);
  						}
  					}
  				}
  			}
  		}
  
  		return valid.isValid();
  	}
focal_method.class_method_signature: BuildableValidator.validate(TypeElement element)
focal_method.full_signature: public boolean validate(TypeElement element)
focal_method.identifier: validate
focal_method.invocations: getKind invalidate printBuildableError getKind getEnclosingElement invalidate printBuildableError contains getModifiers invalidate printBuildableError getAnnotation value equals invalidate findAnnotationMirror next iterator values getElementValues printMessage getMessager findAccessibleConstructors size invalidate printBuildableError size next iterator findBuilderConstructors size invalidate getSimpleName printBuildableError printMessage getMessager size invalidate printBuildError next iterator getThrownTypes size getTypeUtils getElementUtils getTypeElement getName asType isSubtype invalidate printMessage getMessager isValid
focal_method.modifiers: public
focal_method.parameters: (TypeElement element)
focal_method.return: boolean
focal_method.signature: boolean validate(TypeElement element)