diff options
author | Arne Juul <arnej@verizonmedia.com> | 2019-12-03 13:27:31 +0000 |
---|---|---|
committer | Arne Juul <arnej@verizonmedia.com> | 2019-12-03 13:27:39 +0000 |
commit | 0765979cf838b69e287ad768997084eb14010464 (patch) | |
tree | 35bf510776c9f9bbe85d5fccafe0fc16fce8fc1e /vespa-documentgen-plugin/src | |
parent | fec2553bc3dc96382e4cb4cd9e7da9e567a1023f (diff) |
fix bug in hasAnyPositionField
* clearly returning "true" in all cases is not useful
* but ordering of checks in hasAnyPostionDataType was wrong also:
PositionDataType.INSTANCE is actually instanceof StructuredDataType
so it would always return false.
Diffstat (limited to 'vespa-documentgen-plugin/src')
-rw-r--r-- | vespa-documentgen-plugin/src/main/java/com/yahoo/vespa/DocumentGenMojo.java | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/vespa-documentgen-plugin/src/main/java/com/yahoo/vespa/DocumentGenMojo.java b/vespa-documentgen-plugin/src/main/java/com/yahoo/vespa/DocumentGenMojo.java index eb883662095..d95eddac57f 100644 --- a/vespa-documentgen-plugin/src/main/java/com/yahoo/vespa/DocumentGenMojo.java +++ b/vespa-documentgen-plugin/src/main/java/com/yahoo/vespa/DocumentGenMojo.java @@ -483,23 +483,25 @@ public class DocumentGenMojo extends AbstractMojo { out.write("}\n"); } - private static boolean hasAnyPostionDataType(DataType dt) { - if (dt instanceof CollectionDataType) { - return hasAnyPostionDataType(((CollectionDataType)dt).getNestedType()); + private static boolean hasAnyPositionDataType(DataType dt) { + if (PositionDataType.INSTANCE.equals(dt)) { + return true; + } else if (dt instanceof CollectionDataType) { + return hasAnyPositionDataType(((CollectionDataType)dt).getNestedType()); } else if (dt instanceof StructuredDataType) { return hasAnyPositionField(((StructuredDataType)dt).getFields()); } else { - return PositionDataType.INSTANCE.equals(dt); + return false; } } private static boolean hasAnyPositionField(Collection<Field> fields) { for (Field f : fields) { - if (hasAnyPostionDataType(f.getDataType())) { + if (hasAnyPositionDataType(f.getDataType())) { return true; } } - return true; + return false; } private Collection<Field> getAllUniqueFields(Boolean multipleInheritance, Collection<Field> allFields) { |