Commit Graph

664 Commits

Author SHA1 Message Date
Havoc Pennington
94dda5f9cf If not allowing unresolved, optimize resolve status computation for List 2014-12-27 16:41:47 -05:00
Havoc Pennington
51d94fc357 Merge pull request #180 from tea-dragon/master
Fix 'allow unresolved' for at least two list cases
2014-12-27 13:35:34 -08:00
Havoc Pennington
6c96f2eaa3 Merge pull request #184 from alexwei/master
Added missing duration unit short names that are supported in scala and more
2014-12-27 13:34:11 -08:00
Havoc Pennington
9e719711c3 Merge branch 'master' of https://github.com/Kornel/config into Kornel-master
Conflicts:
	README.md
2014-12-27 16:32:03 -05:00
Havoc Pennington
485f910d55 Change expected result of delayedMergeObjectResolveProblem5
Our "do not look at what we're resolving in order to resolve it"
algorithm is now more robust so we get a different answer.
2014-12-27 16:26:52 -05:00
Havoc Pennington
53d642d93f Fix warning about use of octal escape in string literal 2014-12-27 16:06:40 -05:00
ian
ed19f4c09e isolate test for allowing unresolved list elements 2014-12-24 16:10:20 -05:00
ian
3c6488fbc2 Fix 'allow unresolved' for at least two list cases
lists did not respond well to cases where only some of their
elements were resolved or even when none of them were resolved
but one of their object identities happened to change. Previously
this would throw a nasty 'bug or broken' exception so it seems
unlikely to have unintended side effects.
2014-12-24 15:41:34 -05:00
Havoc Pennington
5c464b3b5a Document ConfigFactory.parseFile 2014-12-18 15:13:03 -05:00
Havoc Pennington
c176bdcf50 Merge pull request #216 from chimpler/master
Updated README.md to add link to python port (pyhocon)
2014-12-07 23:11:31 -05:00
Francois Dang Ngoc
5447501df0 updated README.md to add link to python port (pyhocon) 2014-12-07 22:52:32 -05:00
Havoc Pennington
0a96f9f3b4 Merge pull request #215 from benmccann/minor-upgrades
Upgrade to SBT 0.13.6
2014-12-01 22:39:18 -05:00
Ben McCann
54e780d308 Upgrade to SBT 0.13.7 2014-12-01 17:54:55 -08:00
Havoc Pennington
f3ec3aa910 Missing backtick in HOCON.md
Reported by @takc923
2014-11-11 14:49:47 -05:00
Havoc Pennington
741b14ec6b Merge pull request #210 from chris-martin/pull-quoted-string-do-while
Avoid awkward do-while in Tokenizer.pullQuotedString
2014-11-07 09:23:32 -05:00
Chris Martin
b83089b91d Avoid awkward do-while in Tokenizer.pullQuotedString
Not a big deal, but I think this reads more clearly now.
2014-11-05 14:36:40 -05:00
Havoc Pennington
c3325a8966 Remove "root" from MemoKey
This was just wrong in the new setup; we change the root constantly.
The MemoKey should be per-conceptual-resolve which is per-ResolveContext,
not per-root.

This commit fixes the tests in which we failed to memoize
and thus got different results for the same ConfigReference
at different times in the resolution process.

But it breaks ConfigSubstitutionTest.avoidDelayedMergeObjectResolveProblem5.
2014-10-22 14:28:44 -04:00
Havoc Pennington
1a65f861b2 ConfigDelayedMerge.java: Fix indentation 2014-10-22 13:59:06 -04:00
Havoc Pennington
da494cd8a0 Spec: must memoize when resolving substitutions 2014-10-22 13:59:06 -04:00
Havoc Pennington
0a828f500b Implement equals and hashCode for ResolveSource
Useful for debugging or whatever.
2014-10-22 13:58:44 -04:00
Havoc Pennington
c8f42ef92d Make ResolveContext immutable
This is a mechanical refactoring not intended to change behavior.
Not very efficiently implemented but that's fine for now.
2014-10-13 11:24:52 -04:00
Havoc Pennington
afdcbb3803 Merge remote-tracking branch 'origin/master' into wip/havocp-resolve-fixes 2014-10-13 05:52:18 -04:00
Havoc Pennington
5038949cff README: recommend hasPath rather than catching Missing 2014-10-13 05:49:46 -04:00
Havoc Pennington
0a7db6a126 Avoid PathBuilder for fast-path path parsing
This makes the typical path parse much faster:
 - avoid Character.isLetter in favor of just ASCII alphanumeric
 - allow fast path with hyphens and underscores involved
 - don't use PathBuilder, build a Path directly by
   traversing the string backward; this avoids some
   object allocation
2014-10-13 05:22:38 -04:00
Havoc Pennington
c5b2572858 Change CatchExceptionOnMissing bench to have more stack frames 2014-10-11 10:52:00 -04:00
Havoc Pennington
891a2cde97 Use nanotime for profiling and use more iterations
This doesn't make the benchmarks all accurate or anything
but maybe makes them a little less likely to be way off.
2014-10-10 20:47:28 -04:00
Havoc Pennington
77972fefc3 Add profiling of getting values from a Config
To run these, do
> project config
> test:runMain GetExistingPath
> test:runMain HasPathOnMissing
> test:runMain CatchExceptionOnMissing
2014-10-10 17:32:34 -04:00
Havoc Pennington
5c83183853 README: link to maven central directory
Fixes #203, linking to super-old releases was just confusing.
2014-10-10 12:16:56 -04:00
Havoc Pennington
91663eba6c Merge pull request #200 from tyrcho/patch-1
add badge + link to maven central
2014-10-06 19:33:44 -04:00
Michel Daviot
42efcbce6c add badge + link to maven central 2014-10-06 11:09:16 +02:00
Havoc Pennington
82d6614d2f README: show how to do "inheritance" on one line 2014-10-03 08:55:01 -04:00
Havoc Pennington
1955825951 Merge pull request #198 from chris-martin/typo_now-not
typo: "will (now -> not) throw"
2014-10-03 08:41:00 -04:00
Chris Martin
f450aa9369 typo: "will (now -> not) throw" 2014-10-03 04:55:48 -04:00
Havoc Pennington
d6ffa8fc0f Merge pull request #197 from chris-martin/ConfigRenderOptions-setFormatted-javadoc
Fix javadoc in ConfigRenderOptions.setFormatted
2014-10-02 22:56:07 -04:00
Chris Martin
9f16036979 Fix javadoc in ConfigRenderOptions.setFormatted
It looks like this was copied from setComments and one bit wasn't changed.
2014-10-02 22:34:50 -04:00
Kornel Kielczewski
c1d5c11887 Added sbt library dependencies to README.md
- Lots of people use sbt, why keep a maven sample and forget about sbt?
   :)
2014-09-16 09:55:51 +02:00
Alex Wei
b76b406f2b Patch spec with duration units from Scala that were previously missing. 2014-08-11 18:36:14 +10:00
Alex Wei
c8cab8c79e Revert "Added more duration unit short names for hour, minute and second."
This reverts commit ebb526304e.
2014-08-11 18:31:14 +10:00
Alex Wei
ebb526304e Added more duration unit short names for hour, minute and second. 2014-08-08 09:57:42 +10:00
Alex Wei
60c661d683 Added missing duration unit short names that are supported in scala.concurrent.duration.DurationConversions. 2014-08-08 09:48:56 +10:00
Havoc Pennington
0a20b9ad73 Rewrite substitution resolver, use explicit immutable ResolveSource
The immediate motivation here was to fix #177, which this does,
but in this commit a couple of existing test cases are broken
in a way which seems to relate to order of resolution and resolve
memoization. So we need to layer on to this commit better solutions
for caching and cycle detection to get rid of yet more mutable state.

The previous setup used a side-effect-based lookup table of "replacement"
values to conceptually modify the tree without actually modifying it.
Unfortunately that setup was hacky and hard to reason about and,
apparently, broken in cases such as #177.

This new setup actually creates a modified tree and passes it
around explicitly instead of inside ResolveContext.

In this commit, ResolveContext still unfortunately has a mutable
cache and a mutable table of "cycle markers." Both of those
in theory could also be replaced by simply modifying the tree.

The main downside to this commit - and to cleaning up the remaining
mutable state - is that we're using Java collections which have to
be copied wholesale for every mutation (they are not persistent
functional data structures). This will have an unknown performance
impact, though in a sane world Config.resolve() is not a bottleneck in
anyone's production app.

Some other details of this commit:

 * resolve concerns removed from peekPath in AbstractConfigObject
   and relocated into ResolveSource
 * recursive resolution removed from lookupSubst and moved to
   ConfigReference
 * new hasDescendant() method used only in debug tracing,
   it is grossly inefficient to ever call this full tree
   traversal
 * new replaceChild() method is inefficient due to Java
   collections but could in theory be made efficient
 * most complexity relates to always knowing the parent of
   a node that we might have to replace, so we can walk
   up replacing it in its ancestor chain

TODO in subsequent commits:

 * fix failing test cases
 * we cannot replaceChild if we are a descendant of ConfigConcatenation,
   but we probably (?) need to be able to; consider / fix this
 * instead of memoizing resolve results in a hash table, just
   continuously modify the ResolveSource to have the most recent
   results
 * instead of using the "cycle markers" table, change the
   ConfigReference to a cycle detector value
2014-07-10 12:58:58 -04:00
Havoc Pennington
fdce50fb76 Add shortcut that identity-equal lists/objects are equals()
The intent here is to make it fast to compare something
to itself. Though maybe Java does this automatically,
not sure.
2014-07-07 21:23:03 -04:00
Havoc Pennington
66d21576b1 Track parent values as we resolve
In this patch, it's just to indent the debug output nicely.
2014-07-04 23:44:54 -04:00
Havoc Pennington
7994e02c71 Add identity hash codes to some substitution trace messages
Otherwise you can't tell how it works since replacements and
memoization are done by identity.
2014-07-04 22:35:29 -04:00
Havoc Pennington
9e8532d3f0 Add useful toString to ResolveReplacer subtypes 2014-07-04 22:16:25 -04:00
Havoc Pennington
91497e4a1e Add config.trace=substitutions mode
Dumps a bunch of verbose output about how substitutions
are being resolved.
2014-07-04 14:43:43 -04:00
Havoc Pennington
99afd721a5 Merge pull request #175 from benjaminjackman/master
Update README.md
2014-06-30 09:55:07 -04:00
Ben Jackman
a444b4481d Update README.md 2014-06-27 11:13:46 -05:00
Havoc Pennington
02867c8aec Improve size-in-bytes parser's use of BigInteger/BigDecimal
- use bitLength to see if we overflow Long
 - use BigInteger and BigDecimal to parse, instead of parseLong/parseDouble
2014-06-25 16:52:14 -04:00
Havoc Pennington
6311ef8d4d Throw an exception if size-in-bytes values are out of Long range
Fixes #170
2014-06-23 12:13:40 -04:00