@Override
    public int compare(MemberScope<?, ?> first, MemberScope<?, ?> second) {
        int result = PropertySortUtils.SORT_PROPERTIES_FIELDS_BEFORE_METHODS.compare(first, second);
        if (result == 0) {
            result = this.getPropertyIndex(first) - this.getPropertyIndex(second);
        }
        if (result == 0 && Stream.of(first, second)
                .map(property -> property.getDeclaringType().getErasedType())
                .anyMatch(parentType -> this.enabledAlphabeticSorting.computeIfAbsent(parentType, this::shouldSortPropertiesAlphabetically))) {
            result = PropertySortUtils.SORT_PROPERTIES_BY_NAME_ALPHABETICALLY.compare(first, second);
        }
        return result;
    }
Constructor.

@param sortAlphabeticallyIfNotAnnotated whether properties of a type without {@link JsonPropertyOrder} should be sorted alphabetically
jsonschema-module-jackson/src/main/java/com/github/victools/jsonschema/module/jackson/JsonPropertySorter.java