Commit Graph

681 Commits

Author SHA1 Message Date
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
Havoc Pennington
95b31ccd57 Use a WeakReference to cache class loaders
Fixes #171
2014-06-23 09:11:32 -04:00
Havoc Pennington
08c4fe3950 If all concatenation elements are undefined, undefine the field
This is a spec change but the spec was wrong and the implementation
previously just threw an exception.

The spec claimed that ${?foo}${?bar} would become empty string,
but it's more useful for it to just become undefined.
You can add an explicit empty string with "" if you want it
to be empty string.

Fixes #161.
2014-05-05 11:02:49 -04:00
Havoc Pennington
6218174704 Settings pattern is not a way to get an optional setting 2014-05-03 09:59:42 -04:00
Havoc Pennington
2b4516ab62 Fix markdown syntax in README 2014-05-03 09:56:26 -04:00
Havoc Pennington
798230458e More README improvements 2014-05-03 09:51:57 -04:00
Havoc Pennington
7cae92d3ae Bump README to 1.2.1 2014-05-02 10:54:20 -04:00
Havoc Pennington
47697639f4 add 1.2.1 to NEWS 2014-05-02 10:49:31 -04:00
Havoc Pennington
90d39831a0 Shrink previous patch to skip non-string Properties
There was some extra/leftover logic in there. With this commit
the diff vs. the original codebase is smaller and clearer.
2014-05-02 10:31:57 -04:00
萧岳
1336751ab6 Handle non-String values in a Properties object
The java docs for Properties say avoid this, but
it is possible, so just silently skip any non-strings
we find in the Properties.

Fixes #147
2014-05-02 10:30:29 -04:00
Havoc Pennington
5899bce827 Add paranoia about ClassLoader in ConfigParseOptions
Fixes #155. Really this is kind of a mess; having overloads
with both ClassLoader and ConfigParseOptions parameters, when
the parse options may include a class loader, confuses the
heck out of things.

Trying to make it so that the ConfigParseOptions variants are
the canonical version, and the ones with a loader just immediately
set the loader on the parse options and call the variant with no
loader parameter.

Anyway ... when it fails this patch should at least make it much
clearer what went wrong.
2014-05-02 09:59:31 -04:00
Havoc Pennington
6c2889728e Move table of contents below overview 2014-05-02 09:02:53 -04:00
Havoc Pennington
6eefb61b5e Organize README and add doctoc table of contents 2014-05-02 09:00:25 -04:00
Havoc Pennington
48a9437513 Go on a bit longer about how to handle defaults in the README 2014-05-01 20:23:13 -04:00
Havoc Pennington
bfe83e1b79 Throw exceptions when we need a reference to an array element
This arose in issue https://github.com/typesafehub/config/issues/160

There are two known cases: when we want to relativize references
in included files, and when we use `+=` while inside a list.
Both of those are currently impossible to handle without a way
to generate a reference to a list element.
2014-05-01 11:19:39 -04:00
Havoc Pennington
44e8a925b2 Fix Tokens.Value.toString on unresolved values
It was throwing an exception trying to unwrap unresolved value
2014-05-01 11:13:50 -04:00
Havoc Pennington
e5cc23235f Use fullCurrentPath() when relativizing includes, and make it throw if path is empty
This is just to consolidate our use of pathStack in one place.
2014-05-01 10:15:44 -04:00
Havoc Pennington
36c1392028 Merge pull request #150 from cprice404/add-ruby-port-link-to-README
Add link to ruby port in README
2014-03-16 22:55:27 -04:00
Chris Price
3df982e7af Add link to ruby port in README 2014-03-16 18:33:34 -07:00
Havoc Pennington
e1d59dc48c Wrap ConfigOrigin.comments in unmodifiableList
This prevents people from messing with the returned list.
2014-02-19 11:31:33 -05:00
Havoc Pennington
0f4508cc67 Add more mentions of paths vs. keys to the API docs. 2014-02-13 15:17:09 -05:00
Havoc Pennington
d5924b6d01 Merge pull request #143 from typesafehub/wip/havocp-invalidate-tests
Add tests for cache invalidation with ref config and full config
2014-02-11 19:15:48 -05:00
Havoc Pennington
a0c22c3687 Add tests for cache invalidation with ref config and full config 2014-02-11 17:51:10 -05:00
Havoc Pennington
49770d9290 Merge pull request #141 from typesafehub/fix/havocp-140
Handle a concatenation that doesn't resolve
2014-02-10 16:38:46 -05:00
Havoc Pennington
91e5e81995 Handle a concatenation that doesn't resolve
Fixes #140
2014-02-10 15:59:08 -05:00
Havoc Pennington
f3cb6b1504 Add .travis.yml 2014-02-10 15:58:19 -05:00
Havoc Pennington
f27265b3f5 Merge pull request #138 from fnuecke/master
Added ConfigRenderOptions entry for value sorting in objects.
2014-02-05 15:16:45 -05:00
Florian Nücke
b38e7085d4 Reverted config entry, always sorting keys when rendering in SimpleConfigObject now. 2014-02-05 20:58:06 +01:00
Florian Nücke
e51bb7e118 Added new ConfigRenderOptions entry to control whether to sort value in objects. 2014-02-03 18:53:14 +01:00
Havoc Pennington
9c3907715c Merge pull request #137 from jkinkead/fix_nested_includes
Fix nested includes.
2014-01-30 10:10:08 -08:00
Jesse Kinkead
366ab55582 Use the proper stack ordering when building a nested path in the Parser. 2014-01-29 13:30:37 -08:00
Jesse Kinkead
07c67aed2e Update test10.conf to trigger issue #136. 2014-01-29 13:06:01 -08:00
Havoc Pennington
2ff0e15cd4 1.2.0 in NEWS and README 2014-01-15 09:59:24 -05:00
Havoc Pennington
868c4928b3 Export impl package to OSGI
Fixes #49
2014-01-15 09:57:42 -05:00