diff options
author | Arne H Juul <arnej@yahooinc.com> | 2022-06-02 12:52:12 +0000 |
---|---|---|
committer | gjoranv <gv@verizonmedia.com> | 2022-06-08 11:45:25 +0200 |
commit | f2d548b013350a99c02604020eb1bfc4c2a7bf1f (patch) | |
tree | 4e9d4f25114403a5510b75cb9f4ede3996fd9548 | |
parent | cf964397ea89d06916658df9b3c1c548a8960380 (diff) |
remove more deprecated APIs
15 files changed, 14 insertions, 164 deletions
diff --git a/docproc/src/main/java/com/yahoo/docproc/proxy/ProxyDocument.java b/docproc/src/main/java/com/yahoo/docproc/proxy/ProxyDocument.java index d54ab012b3b..e2432dd71c9 100644 --- a/docproc/src/main/java/com/yahoo/docproc/proxy/ProxyDocument.java +++ b/docproc/src/main/java/com/yahoo/docproc/proxy/ProxyDocument.java @@ -232,18 +232,6 @@ public class ProxyDocument extends Document implements DocumentOperationWrapper } @Override - @SuppressWarnings("deprecation") - public Struct getHeader() { - return doc.getHeader(); - } - - @Override - @SuppressWarnings("deprecation") - public Struct getBody() { - return null; - } - - @Override public void assign(Object o) { doc.assign(o); } diff --git a/docproc/src/test/java/com/yahoo/docproc/proxy/SchemaMappingAndAccessesTest.java b/docproc/src/test/java/com/yahoo/docproc/proxy/SchemaMappingAndAccessesTest.java index cfb051e131e..a986c4deff3 100644 --- a/docproc/src/test/java/com/yahoo/docproc/proxy/SchemaMappingAndAccessesTest.java +++ b/docproc/src/test/java/com/yahoo/docproc/proxy/SchemaMappingAndAccessesTest.java @@ -305,7 +305,6 @@ public class SchemaMappingAndAccessesTest { mapped.setId(new DocumentId("id:map:album::2")); assertEquals(mapped.getId().toString(), "id:map:album::2"); assertEquals(doc.getId().toString(), "id:map:album::2"); - assertEquals(doc.getHeader(), mapped.getHeader()); assertEquals(doc.getSerializedSize(), mapped.getSerializedSize()); ByteArrayOutputStream bos = new ByteArrayOutputStream(); ByteArrayOutputStream bos2 = new ByteArrayOutputStream(); diff --git a/document/abi-spec.json b/document/abi-spec.json index edc4d8a19c6..f8e2cc26b45 100644 --- a/document/abi-spec.json +++ b/document/abi-spec.json @@ -129,7 +129,6 @@ "public com.yahoo.document.CollectionDataType clone()", "public com.yahoo.document.DataType getNestedType()", "protected com.yahoo.document.datatypes.FieldValue createByReflection(java.lang.Object)", - "public void setNestedType(com.yahoo.document.DataType)", "public com.yahoo.document.PrimitiveDataType getPrimitiveType()", "public boolean isValueCompatible(com.yahoo.document.datatypes.FieldValue)", "protected void register(com.yahoo.document.DocumentTypeManager, java.util.List)", @@ -263,8 +262,6 @@ "public void <init>(com.yahoo.document.serialization.DocumentReader)", "public com.yahoo.document.DocumentId getId()", "public void setId(com.yahoo.document.DocumentId)", - "public com.yahoo.document.datatypes.Struct getHeader()", - "public com.yahoo.document.datatypes.Struct getBody()", "public void assign(java.lang.Object)", "public com.yahoo.document.Document clone()", "public void setDataType(com.yahoo.document.DataType)", @@ -425,9 +422,7 @@ "methods": [ "public void <init>(java.lang.String)", "public void <init>(java.lang.String, com.yahoo.document.StructDataType)", - "public void <init>(java.lang.String, com.yahoo.document.StructDataType, com.yahoo.document.StructDataType)", "public void <init>(java.lang.String, com.yahoo.document.StructDataType, java.util.Set)", - "public void <init>(java.lang.String, com.yahoo.document.StructDataType, com.yahoo.document.StructDataType, java.util.Set)", "public void <init>(java.lang.String, java.util.Set)", "public com.yahoo.document.DocumentType clone()", "public com.yahoo.document.Document createFieldValue()", @@ -436,7 +431,6 @@ "public com.yahoo.document.StructDataType contentStruct()", "public com.yahoo.document.StructDataType getStructType(java.lang.String)", "public com.yahoo.document.StructDataType getDeclaredStructType(java.lang.String)", - "public com.yahoo.document.StructDataType getHeaderType()", "protected void register(com.yahoo.document.DocumentTypeManager, java.util.List)", "public boolean isA(java.lang.String)", "public void addField(com.yahoo.document.Field)", @@ -499,13 +493,8 @@ "public void <init>()", "public void <init>(com.yahoo.document.config.DocumentmanagerConfig)", "public void assign(com.yahoo.document.DocumentTypeManager)", - "public com.yahoo.document.DocumentTypeManager configure(java.lang.String)", "public static com.yahoo.document.DocumentTypeManager fromFile(java.lang.String)", "public boolean hasDataType(java.lang.String)", - "public boolean hasDataType(int)", - "public com.yahoo.document.DataType getDataType(java.lang.String)", - "public com.yahoo.document.DataType getDataType(int)", - "public com.yahoo.document.DataType getDataType(int, java.lang.String)", "public void register(com.yahoo.document.DataType)", "public com.yahoo.document.DocumentType registerDocumentType(com.yahoo.document.DocumentType)", "public com.yahoo.document.DocumentType getDocumentType(com.yahoo.document.DataTypeName)", @@ -515,9 +504,7 @@ "public java.util.Collection getDataTypes()", "public java.util.Map getDocumentTypes()", "public java.util.Iterator documentTypeIterator()", - "public void clear()", - "public com.yahoo.document.annotation.AnnotationTypeRegistry getAnnotationTypeRegistry()", - "public void shutdown()" + "public com.yahoo.document.annotation.AnnotationTypeRegistry getAnnotationTypeRegistry()" ], "fields": [] }, @@ -681,8 +668,6 @@ "public final int getId(int)", "public final int getId()", "public final boolean hasForcedId()", - "public boolean isHeader()", - "public void setHeader(boolean)", "public boolean equals(java.lang.Object)", "public int hashCode()", "public java.lang.String toString()", @@ -850,8 +835,6 @@ "public boolean isValueCompatible(com.yahoo.document.datatypes.FieldValue)", "public com.yahoo.document.DataType getKeyType()", "public com.yahoo.document.DataType getValueType()", - "public void setKeyType(com.yahoo.document.DataType)", - "public void setValueType(com.yahoo.document.DataType)", "public com.yahoo.document.datatypes.MapFieldValue createFieldValue()", "public java.lang.Class getValueClass()", "protected void register(com.yahoo.document.DocumentTypeManager, java.util.List)", @@ -1104,7 +1087,6 @@ "methods": [ "public void <init>(com.yahoo.document.DataType, boolean, boolean)", "public void <init>(com.yahoo.document.DataType, boolean, boolean, int)", - "public void <init>(java.lang.String, int, com.yahoo.document.DataType, boolean, boolean)", "public com.yahoo.document.WeightedSetDataType clone()", "public void setTag(boolean)", "public boolean isTag()", diff --git a/document/src/main/java/com/yahoo/document/CollectionDataType.java b/document/src/main/java/com/yahoo/document/CollectionDataType.java index de2aa0cff19..1aeccb7e2fa 100644 --- a/document/src/main/java/com/yahoo/document/CollectionDataType.java +++ b/document/src/main/java/com/yahoo/document/CollectionDataType.java @@ -40,16 +40,6 @@ public abstract class CollectionDataType extends DataType { @Override protected FieldValue createByReflection(Object arg) { return null; } - /** - * WARNING! Do not use! Only to be used by config system! - * Sets the nested type of this CollectionDataType. - * @deprecated // TODO Vespa 8 remove - */ - @Deprecated(forRemoval = true, since = "7") - public void setNestedType(DataType nestedType) { - this.nestedType = nestedType; - } - @Override public PrimitiveDataType getPrimitiveType() { return nestedType.getPrimitiveType(); diff --git a/document/src/main/java/com/yahoo/document/Document.java b/document/src/main/java/com/yahoo/document/Document.java index 1a29bf29191..5937ba00292 100644 --- a/document/src/main/java/com/yahoo/document/Document.java +++ b/document/src/main/java/com/yahoo/document/Document.java @@ -96,14 +96,6 @@ public class Document extends StructuredFieldValue { docId = id; } - /** @deprecated do not use: Use getField(), getFieldValue() or iterator() instead */ - @Deprecated // TODO: Remove on Vespa 8 - public Struct getHeader() { return header; } - - /** @deprecated do not use: Use getField(), getFieldValue() or iterator() instead */ - @Deprecated // TODO: Remove on Vespa 8 - public Struct getBody() { return null; } - @Override public void assign(Object o) { throw new IllegalArgumentException("Assign not implemented for " + getClass() + " objects"); diff --git a/document/src/main/java/com/yahoo/document/DocumentType.java b/document/src/main/java/com/yahoo/document/DocumentType.java index 4fb50f48688..447baacac54 100644 --- a/document/src/main/java/com/yahoo/document/DocumentType.java +++ b/document/src/main/java/com/yahoo/document/DocumentType.java @@ -67,29 +67,12 @@ public class DocumentType extends StructuredDataType { this(name, headerType, Collections.emptySet()); } - /** - * @deprecated //TODO Will be removed on Vespa 8 - */ - @Deprecated - public DocumentType(String name, StructDataType headerType, StructDataType bodyType) { - this(name, headerType, Collections.emptySet()); - } - public DocumentType(String name, StructDataType headerType, Set<String> importedFieldNames) { super(name); this.headerType = headerType; this.importedFieldNames = Collections.unmodifiableSet(importedFieldNames); } - /** - * @deprecated //TODO Will be removed on Vespa 8 - */ - @Deprecated - public DocumentType(String name, StructDataType headerType, - StructDataType bodyType, Set<String> importedFieldNames) { - this(name, headerType, importedFieldNames); - } - public DocumentType(String name, Set<String> importedFieldNames) { this(name, createHeaderStructType(name), importedFieldNames); } @@ -185,12 +168,6 @@ public class DocumentType extends StructuredDataType { } } - /** @deprecated use contentStruct instead */ - @Deprecated // TODO: Remove on Vespa 8 - public StructDataType getHeaderType() { - return contentStruct(); - } - @Override protected void register(DocumentTypeManager manager, List<DataType> seenTypes) { seenTypes.add(this); diff --git a/document/src/main/java/com/yahoo/document/DocumentTypeManager.java b/document/src/main/java/com/yahoo/document/DocumentTypeManager.java index 880d8f3fab0..f1203323cad 100644 --- a/document/src/main/java/com/yahoo/document/DocumentTypeManager.java +++ b/document/src/main/java/com/yahoo/document/DocumentTypeManager.java @@ -40,7 +40,6 @@ public class DocumentTypeManager { private final static Logger log = Logger.getLogger(DocumentTypeManager.class.getName()); - private ConfigSubscriber subscriber; // *Configured data types* (not built-in/primitive) indexed by their id // @@ -72,16 +71,6 @@ public class DocumentTypeManager { annotationTypeRegistry = other.annotationTypeRegistry; } - /** - * For testing, use fromFile factory method instead - * @deprecated //TODO Will be package-private or removed on Vespa 8 - */ - @Deprecated - public DocumentTypeManager configure(String configId) { - subscriber = DocumentTypeManagerConfigurer.configure(this, configId); - return this; - } - /** Only for unit tests */ public static DocumentTypeManager fromFile(String fileName) { var manager = new DocumentTypeManager(); @@ -126,21 +115,12 @@ public class DocumentTypeManager { /** * @deprecated //TODO Will be package-private or removed on Vespa 8 - */ - @Deprecated - public boolean hasDataType(int code) { - if (code == DataType.tensorDataTypeCode) return true; // built-in dynamic: Always present - return dataTypes.containsKey(code); - } - - /** - * @deprecated //TODO Will be package-private or removed on Vespa 8 * Use constants and factories in DataType instead. * For structs, use getStructType() in DocumentType. * For annotation payloads, use getDataType() in AnnotationType. **/ @Deprecated - public DataType getDataType(String name) { + DataType getDataType(String name) { var type = getDataTypeInternal(name); if (type == null) { throw new IllegalArgumentException("No datatype named " + name); @@ -189,7 +169,7 @@ public class DocumentTypeManager { * @deprecated //TODO Will be package-private or removed on Vespa 8 */ @Deprecated - public DataType getDataType(int code) { return getDataType(code, ""); } + DataType getDataType(int code) { return getDataType(code, ""); } /** * Return a data type instance @@ -201,7 +181,7 @@ public class DocumentTypeManager { * @deprecated //TODO Will be package-private or removed on Vespa 8 */ @Deprecated - public DataType getDataType(int code, String detailedType) { + DataType getDataType(int code, String detailedType) { if (code == DataType.tensorDataTypeCode) // built-in dynamic return new TensorDataType(TensorType.fromSpec(detailedType)); @@ -325,7 +305,7 @@ public class DocumentTypeManager { * @deprecated //TODO Will be package-private or removed on Vespa 8 */ @Deprecated - public void clear() { + void clear() { documentTypes.clear(); dataTypes.clear(); registerDefaultDataTypes(); @@ -335,11 +315,4 @@ public class DocumentTypeManager { return annotationTypeRegistry; } - /** - * @deprecated //TODO Will be package-private or removed on Vespa 8 - */ - @Deprecated - public void shutdown() { - if (subscriber!=null) subscriber.close(); - } } diff --git a/document/src/main/java/com/yahoo/document/Field.java b/document/src/main/java/com/yahoo/document/Field.java index a45afea6747..4d508bdc586 100644 --- a/document/src/main/java/com/yahoo/document/Field.java +++ b/document/src/main/java/com/yahoo/document/Field.java @@ -201,16 +201,6 @@ public class Field extends FieldBase implements FieldSet, Comparable, Serializab return forcedId; } - /** @deprecated this has no longer any semantic meaning as this is no longer an aspect with a field */ - @Deprecated // TODO: Remove on Vespa 8 - public boolean isHeader() { - return true; - } - - /** @deprecated this has no longer any semantic meaning as this is no longer an aspect with a field */ - @Deprecated // TODO: Remove on Vespa 8 - public void setHeader(boolean header) { } - /** Two fields are equal if they have the same name and the same data type */ @Override public boolean equals(Object o) { diff --git a/document/src/main/java/com/yahoo/document/MapDataType.java b/document/src/main/java/com/yahoo/document/MapDataType.java index 97a533def8d..457ae084107 100644 --- a/document/src/main/java/com/yahoo/document/MapDataType.java +++ b/document/src/main/java/com/yahoo/document/MapDataType.java @@ -52,26 +52,6 @@ public class MapDataType extends DataType { return valueType; } - /** - * WARNING! Do not use! Only to be used by config system! - * Sets the key type of this MapDataType. - * @deprecated // TODO Vespa 8 remove - */ - @Deprecated(forRemoval = true, since = "7") - public void setKeyType(DataType keyType) { - this.keyType = keyType; - } - - /** - * WARNING! Do not use! Only to be used by config system! - * Sets the value type of this MapDataType. - * @deprecated // TODO Vespa 8 remove - */ - @Deprecated(forRemoval = true, since = "7") - public void setValueType(DataType valueType) { - this.valueType = valueType; - } - @Override public MapFieldValue createFieldValue() { return new MapFieldValue(this); diff --git a/document/src/main/java/com/yahoo/document/PositionDataType.java b/document/src/main/java/com/yahoo/document/PositionDataType.java index f81dffa3837..80c33b4f475 100644 --- a/document/src/main/java/com/yahoo/document/PositionDataType.java +++ b/document/src/main/java/com/yahoo/document/PositionDataType.java @@ -100,12 +100,12 @@ public final class PositionDataType { } public static String getPositionSummaryFieldName(String fieldName) { - // TODO for Vespa 8, consider renaming to _position to use a field name that is actually legal + // Only used in v7 legacy mode, remove in Vespa 9 return fieldName + ".position"; } public static String getDistanceSummaryFieldName(String fieldName) { - // TODO for Vespa 8, consider renaming to _distance to use a field name that is actually legal + // Only used in v7 legacy mode, remove in Vespa 9 return fieldName + ".distance"; } diff --git a/document/src/main/java/com/yahoo/document/WeightedSetDataType.java b/document/src/main/java/com/yahoo/document/WeightedSetDataType.java index b21f059bd7d..04ec779bc16 100644 --- a/document/src/main/java/com/yahoo/document/WeightedSetDataType.java +++ b/document/src/main/java/com/yahoo/document/WeightedSetDataType.java @@ -43,16 +43,6 @@ public class WeightedSetDataType extends CollectionDataType { } } - /* - * @deprecated // TODO remove on Vespa 8 - * Do not use - use one of the constructors above. - * Note: ignores typeName argument. - */ - @Deprecated - public WeightedSetDataType(String typeName, int code, DataType nestedType, boolean createIfNonExistent, boolean removeIfZero) { - this(nestedType, createIfNonExistent, removeIfZero, code); - } - @Override public WeightedSetDataType clone() { return (WeightedSetDataType) super.clone(); diff --git a/document/src/test/java/com/yahoo/document/DocumentTestCase.java b/document/src/test/java/com/yahoo/document/DocumentTestCase.java index 47605264d44..3c1c7ae86e5 100644 --- a/document/src/test/java/com/yahoo/document/DocumentTestCase.java +++ b/document/src/test/java/com/yahoo/document/DocumentTestCase.java @@ -884,9 +884,7 @@ public class DocumentTestCase extends DocumentTestCaseBase { int size_uncompressed; { - DocumentTypeManager docMan = new DocumentTypeManager(); - docMan.configure("file:src/tests/data/cppdocument.cfg"); - + DocumentTypeManager docMan = DocumentTypeManager.fromFile("src/tests/data/cppdocument.cfg"); Document doc = new Document(docMan.getDocumentType("serializetest"), new DocumentId("id:ns:serializetest::test")); doc.setFieldValue("stringfield", @@ -897,9 +895,7 @@ public class DocumentTestCase extends DocumentTestCaseBase { size_uncompressed = data.position(); } - DocumentTypeManager docMan = new DocumentTypeManager(); - docMan.configure("file:src/tests/data/compressed.cfg"); - + DocumentTypeManager docMan = DocumentTypeManager.fromFile("src/tests/data/compressed.cfg"); Document doc = new Document(docMan.getDocumentType("serializetest"), new DocumentId("id:ns:serializetest::test")); doc.setFieldValue("stringfield", 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 1fcb639589f..ed497e8ec1b 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 @@ -444,10 +444,7 @@ public class DocumentGenMojo extends AbstractMojo { " */\n" + "@com.yahoo.document.Generated\npublic class "+className+" extends "+superType+" {\n\n"+ ind(1)+"/** The doc type of this.*/\n" + - ind(1)+"public static final com.yahoo.document.DocumentType type = getDocumentType();\n\n"+ - ind(1)+"/** Struct type view of the type of the body of this.*/\n" + - ind(1)+"/** Struct type view of the type of the header of this.*/\n" + - ind(1)+"private static final com.yahoo.document.StructDataType headerStructType = getHeaderStructType();\n\n"); + ind(1)+"public static final com.yahoo.document.DocumentType type = getDocumentType();\n\n"); // Constructor out.write( @@ -461,11 +458,6 @@ public class DocumentGenMojo extends AbstractMojo { // isGenerated() out.write(ind(1)+"@Override protected boolean isGenerated() { return true; }\n\n"); - // Mimic header and body to make serialization work. - // This can be improved by generating a method to serialize the document _here_, and use that in serialization. - exportOverriddenStructGetter(docType.allHeader().getFields(), out, 1, "getHeader", className+".headerStructType"); - exportStructTypeGetter(docType.getName()+".header", docType.allHeader().getFields(), out, 1, "getHeaderStructType", "com.yahoo.document.StructDataType"); - Collection<Field> allUniqueFields = getAllUniqueFields(multiExtends, docType.getAllFields()); exportExtendedStructTypeGetter(className, docType.getName(), allUniqueFields, docType.getFieldSets(), docType.getImportedFieldNames(), out, 1, "getDocumentType", "com.yahoo.document.DocumentType"); diff --git a/vespa_feed_perf/src/main/java/com/yahoo/vespa/feed/perf/SimpleFeeder.java b/vespa_feed_perf/src/main/java/com/yahoo/vespa/feed/perf/SimpleFeeder.java index 850513fb990..67171de487d 100644 --- a/vespa_feed_perf/src/main/java/com/yahoo/vespa/feed/perf/SimpleFeeder.java +++ b/vespa_feed_perf/src/main/java/com/yahoo/vespa/feed/perf/SimpleFeeder.java @@ -2,10 +2,12 @@ package com.yahoo.vespa.feed.perf; import com.yahoo.concurrent.ThreadFactoryFactory; +import com.yahoo.config.subscription.ConfigSubscriber; import com.yahoo.document.Document; import com.yahoo.document.DocumentId; import com.yahoo.document.DocumentPut; import com.yahoo.document.DocumentTypeManager; +import com.yahoo.document.DocumentTypeManagerConfigurer; import com.yahoo.document.DocumentUpdate; import com.yahoo.document.TestAndSetCondition; import com.yahoo.document.json.JsonFeedReader; @@ -63,8 +65,8 @@ import java.util.stream.Stream; */ public class SimpleFeeder implements ReplyHandler { - private final DocumentTypeManager docTypeMgr = new DocumentTypeManager(); + private final ConfigSubscriber documentTypeConfigSubscriber; private final List<InputStream> inputStreams; private final PrintStream out; private final RPCMessageBus mbus; @@ -359,7 +361,7 @@ public class SimpleFeeder implements ReplyHandler { numMessagesToSend = params.getNumMessagesToSend(); mbus = newMessageBus(docTypeMgr, params); session = newSession(mbus, this, params); - docTypeMgr.configure(params.getConfigId()); + documentTypeConfigSubscriber = DocumentTypeManagerConfigurer.configure(docTypeMgr, params.getConfigId()); benchmarkMode = params.isBenchmarkMode(); destination = (params.getDumpStream() != null) ? createDumper(params) diff --git a/vespa_feed_perf/src/test/java/com/yahoo/vespa/feed/perf/SimpleServer.java b/vespa_feed_perf/src/test/java/com/yahoo/vespa/feed/perf/SimpleServer.java index ea47a58e4b7..a458a59f997 100644 --- a/vespa_feed_perf/src/test/java/com/yahoo/vespa/feed/perf/SimpleServer.java +++ b/vespa_feed_perf/src/test/java/com/yahoo/vespa/feed/perf/SimpleServer.java @@ -57,7 +57,6 @@ public class SimpleServer { public final void close() { session.destroy(); mbus.destroy(); - documentMgr.shutdown(); slobrok.stop(); } |