Skip to content

Fix Hocon to work with Akka.NET #215

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

Merged
merged 5 commits into from
Feb 10, 2020

Conversation

Arkatufus
Copy link
Contributor

Related to akkadotnet/akka.net#4128

  • Refactor Parser class name to HoconParser
  • Fix Akka.NET test unit to work with standalone Hocon

@Arkatufus Arkatufus marked this pull request as ready for review February 7, 2020 00:04
Copy link
Member

@Aaronontheweb Aaronontheweb left a comment

Choose a reason for hiding this comment

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

LGTM - going to need to bump this into a new version since we're changing the name of the Parser class.

@@ -577,6 +577,28 @@ public void ShouldSerializeFallbackValues()

}

[Fact]
public void WithFallback_ShouldNotChangeOriginalConfig()
Copy link
Member

Choose a reason for hiding this comment

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

Good

/// <exception cref="T:System.ArgumentNullException">"The root value cannot be null."</exception>
public Config(HoconRoot root) : base(root?.Value, root?.Substitutions ?? Enumerable.Empty<HoconSubstitution>())
Copy link
Member

Choose a reason for hiding this comment

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

Much simpler - I like it

}
}

return _mergedValueCache;
Copy link
Member

Choose a reason for hiding this comment

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

I think this is a good idea - caching this value for future computations.

/// </summary>
/// <param name="fallback">The configuration to use as a secondary source.</param>
/// <returns>The current configuration configured with the specified fallback.</returns>
/// <exception cref="ArgumentException">Config can not have itself as fallback.</exception>
public virtual Config WithFallback(Config fallback)
{
if (fallback == this)
if (ReferenceEquals(fallback, this))
Copy link
Member

Choose a reason for hiding this comment

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

Yep, that's the right call - since we might overload ==

return Copy(Fallback.SafeWithFallback(fallback));

if (IsEmpty)
return fallback;
Copy link
Member

Choose a reason for hiding this comment

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

Makes sense

@Aaronontheweb Aaronontheweb merged commit 9b29f69 into akkadotnet:dev Feb 10, 2020
@Aaronontheweb Aaronontheweb mentioned this pull request Feb 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants