@SuppressWarnings("unchecked")
    public void validateFields(Object object) {
        if (validatedClasses.get(object.getClass()) == Boolean.TRUE) {
            return;
        }

        Map<Object, Field> resolvedFields = Maps.newHashMap();

        for (ScenarioStateField field : getScenarioFields(object)) {
            field.getField().setAccessible(true);
            Resolution resolution = field.getResolution();
            Object key = null;
            if (resolution == Resolution.NAME) {
                key = field.getField().getName();
            } else {
                key = field.getField().getType();
            }
            if (resolvedFields.containsKey(key)) {
                Field existingField = resolvedFields.get(key);
                throw new AmbiguousResolutionException("Ambiguous fields with same " + resolution + " detected. Field 1: "
                        + existingField + ", field 2: " + field.getField());
            }
            resolvedFields.put(key, field.getField());
        }

        validatedClasses.put(object.getClass(), Boolean.TRUE);
    }
@throws AmbiguousResolutionException when multiple fields with the same resolution exist in the given object
jgiven-core/src/main/java/com/tngtech/jgiven/impl/inject/ValueInjector.java