Source:
public void validate(Element element, ElementValidation validation) { super.validate(element, validation); TypeElement typeElement = (TypeElement) element; validatorHelper.isInterface(typeElement, validation); List<? extends Element> inheritedMembers = getProcessingEnvironment().getElementUtils().getAllMembers(typeElement); for (Element memberElement : inheritedMembers) { if (!memberElement.getEnclosingElement().asType().toString().equals("java.lang.Object")) { coreValidatorHelper.isPrefMethod(memberElement, validation); DefaultPrefInfo<?> info; IdValidatorHelper defaultAnnotationValidatorHelper = null; if (validation.isValid()) { info = DEFAULT_PREF_INFOS.get(((ExecutableElement) memberElement).getReturnType().toString()); coreValidatorHelper.hasCorrectDefaultAnnotation((ExecutableElement) memberElement, validation); if (validation.isValid() && memberElement.getAnnotation(DefaultRes.class) != null) { defaultAnnotationValidatorHelper = new IdValidatorHelper(new IdAnnotationHelper(getEnvironment(), DefaultRes.class.getName())); defaultAnnotationValidatorHelper.resIdsExist(memberElement, info.resType, FallbackStrategy.USE_ELEMENT_NAME, validation); } else if (validation.isValid() && memberElement.getAnnotation(info.annotationClass) != null) { defaultAnnotationValidatorHelper = new IdValidatorHelper(new IdAnnotationHelper(getEnvironment(), info.annotationClass.getName())); } if (validation.isValid() && defaultAnnotationValidatorHelper != null) { defaultAnnotationValidatorHelper.annotationParameterIsOptionalValidResId(memberElement, IRClass.Res.STRING, "keyRes", validation); } } } } SharedPref sharedPrefAnnotation = element.getAnnotation(SharedPref.class); SharedPref.Scope scope = sharedPrefAnnotation.value(); String name = sharedPrefAnnotation.name(); boolean hasCustomName = !name.trim().isEmpty(); EnumSet<SharedPref.Scope> allowedScopes = EnumSet.of(SharedPref.Scope.ACTIVITY, SharedPref.Scope.UNIQUE); if (hasCustomName && !allowedScopes.contains(scope)) { validation.addWarning("SharedPref#name() is only supported for Scope.ACTIVITY and Scope.UNIQUE."); } }

Target:
public void validate(Element element, ElementValidation validation) { super.validate(element, validation); TypeElement typeElement = (TypeElement) element; validatorHelper.isInterface(typeElement, validation); List<? extends Element> inheritedMembers = getProcessingEnvironment().getElementUtils().getAllMembers(typeElement); for (Element memberElement : inheritedMembers) { if (!memberElement.getEnclosingElement().asType().toString().equals("java.lang.Object")) { coreValidatorHelper.isPrefMethod(memberElement, validation); DefaultPrefInfo<?> info; IdValidatorHelper defaultAnnotationValidatorHelper = null; if (validation.isValid()) { info = DEFAULT_PREF_INFOS.get(((ExecutableElement) memberElement).getReturnType().toString()); coreValidatorHelper.hasCorrectDefaultAnnotation((ExecutableElement) memberElement, validation); if (validation.isValid() && memberElement.getAnnotation(DefaultRes.class) != null) { defaultAnnotationValidatorHelper = new IdValidatorHelper(new IdAnnotationHelper(getEnvironment(), DefaultRes.class.getName())); defaultAnnotationValidatorHelper.resIdsExist(memberElement, info.resType, FallbackStrategy.USE_ELEMENT_NAME, validation); } else if (validation.isValid() && memberElement.getAnnotation(info.annotationClass) != null) { defaultAnnotationValidatorHelper = new IdValidatorHelper(new IdAnnotationHelper(getEnvironment(), info.annotationClass.getName())); } if (validation.isValid() && defaultAnnotationValidatorHelper != null) { defaultAnnotationValidatorHelper.annotationParameterIsOptionalValidResId(memberElement, IRClass.Res.STRING, "keyRes", validation); } } } } SharedPref sharedPrefAnnotation = element.getAnnotation(SharedPref.class); SharedPref.Scope scope = sharedPrefAnnotation.value(); String name = sharedPrefAnnotation.name(); boolean hasCustomName = !name.trim().isEmpty(); EnumSet<SharedPref.Scope> allowedScopes = EnumSet.of(SharedPref.Scope.ACTIVITY, SharedPref.Scope.UNIQUE); if (hasCustomName && !allowedScopes.contains(scope)) { validation.addError("SharedPref#name() is only supported for Scope.ACTIVITY and Scope.UNIQUE."); } }