diff options
author | ccalvarin <ccalvarin@google.com> | 2017-08-30 00:23:40 +0200 |
---|---|---|
committer | Vladimir Moskva <vladmos@google.com> | 2017-08-30 13:48:32 +0200 |
commit | 00443495e002c9fc68adbcb708f223eb4b6a73c1 (patch) | |
tree | ec4484fc46793ec9b671a902c42e143a3df79c91 /src/test/java/com/google/devtools/common/options/OptionsDataTest.java | |
parent | ef1424cb39a4ff77bc6579821bbc24eea70e32a3 (diff) |
Move default value & converter finding logic to the OptionDefinition class.
Removes some duplicate computation by memoizing the results. Consolidates caching into a single optionDefinition object, instead of having multiple caches that go from the option name to different parts of what defines an option.
Fly-by cleanup of OptionDescription's contents, all contents that are statically defined as part of an option are in OptionDefintion, while expansion data, which depends on the existence of other options, is more clearly stored separately.
Will move the converter-to-option type matching sanity checks to a compile time check in a later change.
RELNOTES: None.
PiperOrigin-RevId: 166912716
Diffstat (limited to 'src/test/java/com/google/devtools/common/options/OptionsDataTest.java')
-rw-r--r-- | src/test/java/com/google/devtools/common/options/OptionsDataTest.java | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/src/test/java/com/google/devtools/common/options/OptionsDataTest.java b/src/test/java/com/google/devtools/common/options/OptionsDataTest.java index 10e5a527e8..1266d2e25d 100644 --- a/src/test/java/com/google/devtools/common/options/OptionsDataTest.java +++ b/src/test/java/com/google/devtools/common/options/OptionsDataTest.java @@ -250,53 +250,6 @@ public class OptionsDataTest { } } - /** Dummy options class. */ - public static class InvalidOptionConverter extends OptionsBase { - @Option( - name = "foo", - converter = StringConverter.class, - documentationCategory = OptionDocumentationCategory.UNCATEGORIZED, - effectTags = {OptionEffectTag.NO_OP}, - defaultValue = "1" - ) - public Integer foo; - } - - @Test - public void errorForInvalidOptionConverter() throws Exception { - try { - construct(InvalidOptionConverter.class); - } catch (ConstructionException e) { - // Expected exception - return; - } - fail(); - } - - /** Dummy options class. */ - public static class InvalidListOptionConverter extends OptionsBase { - @Option( - name = "foo", - converter = StringConverter.class, - documentationCategory = OptionDocumentationCategory.UNCATEGORIZED, - effectTags = {OptionEffectTag.NO_OP}, - defaultValue = "1", - allowMultiple = true - ) - public List<Integer> foo; - } - - @Test - public void errorForInvalidListOptionConverter() throws Exception { - try { - construct(InvalidListOptionConverter.class); - } catch (ConstructionException e) { - // Expected exception - return; - } - fail(); - } - /** Dummy options class using deprecated category. */ public static class InvalidUndocumentedCategory extends OptionsBase { @Option( |