diff options
author | 2017-08-23 21:40:49 +0200 | |
---|---|---|
committer | 2017-08-24 13:59:07 +0200 | |
commit | edee4f2b02528f240cb342e9fe8c2ad14be0ada5 (patch) | |
tree | 12a1920eae7916ca0a0edf801d5a6981bd426507 /src/main/java/com/google/devtools/common/options/testing | |
parent | 1e2954d4b4094f5f3c1c5a4b5cf70240d0c82d52 (diff) |
Check at compile time that all options are declared public, and are non-final and non-static.
Remove the now redundant check in the testing framework, as the cases being tested no longer compile. Keep tests that check the contents of the OptionsBase as a whole, however, as this is still not being tested at compile time.
PiperOrigin-RevId: 166239209
Diffstat (limited to 'src/main/java/com/google/devtools/common/options/testing')
-rw-r--r-- | src/main/java/com/google/devtools/common/options/testing/OptionsTester.java | 23 |
1 files changed, 0 insertions, 23 deletions
diff --git a/src/main/java/com/google/devtools/common/options/testing/OptionsTester.java b/src/main/java/com/google/devtools/common/options/testing/OptionsTester.java index 9ecfdc5e0a..53a80dcb15 100644 --- a/src/main/java/com/google/devtools/common/options/testing/OptionsTester.java +++ b/src/main/java/com/google/devtools/common/options/testing/OptionsTester.java @@ -69,29 +69,6 @@ public final class OptionsTester { return this; } - /** Tests that there are no non-public fields which would interfere with option parsing. */ - public OptionsTester testAllOptionFieldsPublic() { - for (Field field : getAllFields(optionsClass)) { - if (field.isAnnotationPresent(Option.class)) { - assertWithMessage( - field - + " is Option-annotated, but is not public; it will not be considered as part" - + " of the options. Change the visibility to public.") - .that(Modifier.isPublic(field.getModifiers())) - .isTrue(); - } - if (Modifier.isStatic(field.getModifiers()) || Modifier.isFinal(field.getModifiers())) { - assertWithMessage( - field - + " is Option-annotated, but is either static or final; it cannot be properly" - + " set by the option parser. Remove either the annotation or the modifier(s).") - .that(field.getAnnotation(Option.class)) - .isNull(); - } - } - return this; - } - /** * Tests that the default values of this class were part of the test data for the appropriate * ConverterTester, ensuring that the defaults at least obey proper equality semantics. |