Skip to content

Commit

Permalink
fix: Fixed NestConfig field order
Browse files Browse the repository at this point in the history
  • Loading branch information
LeeGodSRC committed Sep 27, 2024
1 parent a0ba84f commit 20fc858
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ private Comments(List<String> classComments,
this.fieldComments = fieldComments;
}

static Comments ofClass(Class<?> cls) {
static Comments ofClass(Class<?> cls, Configuration.Properties properties) {
List<String> classComments = getComments(cls);
Map<String, List<String>> fieldComments = new HashMap<>();
Arrays.stream(cls.getDeclaredFields())
properties.getFilter().filterDeclaredFieldsOf(cls).stream()
.filter(field -> isCommented(field) || isNestedCommented(field))
.forEach(field -> {
if (isCommented(field)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public abstract class Configuration<C extends Configuration<C>> {
*/
protected Configuration(Properties properties) {
this.props = Objects.requireNonNull(properties);
this.comments = Comments.ofClass(getClass());
this.comments = Comments.ofClass(getClass(), properties);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ default List<? extends Field> filterDeclaredFieldsOf(Class<?> cls) {
Class<?> current = cls;
do {
if (current == cls || accepted.contains(current)) {
fields.addAll(Arrays.asList(current.getDeclaredFields()));
fields.addAll(0, Arrays.asList(current.getDeclaredFields()));
}
current = current.getSuperclass();
} while (current != Object.class && current != null);
Expand Down
2 changes: 1 addition & 1 deletion global.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version = 0.7.9b3-SNAPSHOT
version = 0.7.9b4-SNAPSHOT

0 comments on commit 20fc858

Please sign in to comment.