title: Issue with ConstraintValidator on a field that contains a lambda expression
body: <p>Im trying to achieve a simple data validation on the output of a class field that contains a lambda expression. The validation is done using <a href="http://docs.jboss.org/hibernate/validator/5.2/reference/en-US/html/ch06.html" rel="nofollow">a custom annotation and ConstraintValidator</a> as follows:</p>
  
  <h2>Custom annotation :</h2>
  
  <pre><code>import javax.validation.Constraint;
  import javax.validation.Payload;
  import java.lang.annotation.*;
  
  @Documented
  @Target(ElementType.FIELD)
  @Retention(RetentionPolicy.RUNTIME)
  @Constraint(validatedBy = MandatoryValidation.class)
  public @interface Mandatory {
  
      boolean value() default true;
  
      String message() default "A value must be supplied";
  
      Class&lt;?&gt;[] groups() default {};
  
      Class&lt;? extends Payload&gt;[] payload() default {};
  
  }
  </code></pre>
  
  <h2>Custom Validator :</h2>
  
  <pre><code>import javax.validation.ConstraintValidator;
  import javax.validation.ConstraintValidatorContext;
  import com.google.common.base.Supplier;
  
  
  public class MandatoryValidation implements ConstraintValidator&lt;Mandatory, Supplier&lt;String&gt;&gt; {
  
      private boolean mandatory;
  
      @Override
      public void initialize(Mandatory mandatory) {
          this.mandatory = mandatory.value();
      }
  
      @Override
      public boolean isValid(Supplier&lt;String&gt; supplier, ConstraintValidatorContext constraintValidatorContext) {
  
          if (mandatory &amp;&amp; supplier.get() == null) {
              return false;
          } else {
              return true;
          }
  
      }
  
  }
  </code></pre>
  
  <h2>Class with field to be validated</h2>
  
  <pre><code>import java.util.function.Supplier;
  
  public class SampleClass {
  
      private SampleGenerator generator;
  
      @Mandatory
      public Supplier&lt;String&gt; lambdaField = () -&gt; generator.next();
  
  }
  </code></pre>
  
  <p>My problem is that the above code generates one compilation error stating that
  <em>"The annotation @Mandatory is disallowed for this data type."</em></p>
  
  <p>The error disappears if I remove the <em>"@Constraint(validatedBy = MandatoryValidation.class)"</em> line from my custom annotation, which leads me to think that I did screw up somewhere in the custom validator but i have no clue how to get it fixed.</p>
  
  <p>Anyone can tell me what is wrong with the above code ?</p>
  
  <h2>EDIT:</h2>
  
  <p>I'm using the following config :<br>
  <strong>Jdk</strong> :  jdk1.8.0_65<br>
  <strong>javax.validation-api</strong> : 1.1.0.Final<br>
  <strong>hibernate-validator-annotation-processor</strong> : 4.1.0.Final</p>
  
  <p>As for the full compiler error message :<br>
  Error:(5, 5) java: The annotation @Mandatory is disallowed for this data type.</p>
  
  <p>I've also noticed the following warning :
  Warning:java: Supported source version 'RELEASE_6' from annotation processor 'org.hibernate.validator.ap.ConstraintValidationProcessor' less than -source '1.8'.<br>
  This warning is removed if i switch to the 5.2.2.Final version of hibernate-validator-annotation-processor but the compilation error remains. </p>