code: public static void verifyAnalyzer(FieldDefinition fieldDef) {
          assert fieldDef != null;
          
          FieldAnalyzer analyzer = findAnalyzer(fieldDef);
          Utils.require(analyzer.compatibleFieldTypes().contains(fieldDef.getType()),
                        "Invalid analyzer for field type '%s': %s", fieldDef.getType(), fieldDef.getAnalyzerName());
      }
docs: Verify that the analyzer defined for the given field is a known analyzer and that it
  is valid for its declared type.  This method can only be called for scalar fields,
  and the field's type and analyzer must be set. This method calls
  {@link #findAnalyzer(FieldDefinition)} and then looks for the field's type in the
  set of {@link FieldType}s returned by {@link #compatibleFieldTypes()}.
  
  @param fieldDef  {@link FieldDefinition} of a scalar field.