Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make ReflectiveConfig.Section implement ValueTreeNode.Section #49

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

TheGlitch76
Copy link
Contributor

This fixes a holdover from the old WrappedConfig system which tried to hide the "internal" representations entirely.

Fixes #44

Passes tests but has not otherwise been tested.

This fixes a holdover from the old WrappedConfig system which
tried to hide the "internal" representations entirely.

Fixes QuiltMC#44
Copy link
Contributor

@anonymous123-code anonymous123-code left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also think InternalsHelper should be moved to the impl package, but that is nothing new introduced by this pr

@@ -39,6 +41,31 @@ public ReflectiveConfigCreator(Class<C> creatorClass) {
this.creatorClass = creatorClass;
}

public static class SectionMarker {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Im not sure if we should use metadata for pure implementation details. You can get all metadata an elements holds, so it would leak implementation details I think.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I'm not a huge fan of it either, but this was a quick fix and trying to keep track of this information in the creator looked like a pain. I could take a look at doing that in the future, but I'm not sure when I'll have the time...

@TheGlitch76
Copy link
Contributor Author

InternalsHelper cannot be moved to the impl package because its whole purpose is to access package private code

Comment on lines +34 to +42
for (ValueTreeNode node : config.nodes()) {
if (node instanceof ValueTreeNode.Section) {
ValueTreeNode.Section section = (ValueTreeNode.Section) node;
ReflectiveConfigCreator.SectionMarker marker = section.metadata(ReflectiveConfigCreator.SectionMarker.TYPE);
if (marker != null) {
marker.self.setWrappedSection(section);
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO this should either be put into ReflectiveConfig.setWrappedConfig, or into the impl package with another setWrappedSection in here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants