summaryrefslogtreecommitdiffstats
path: root/document
diff options
context:
space:
mode:
authorArne H Juul <arnej@yahooinc.com>2022-06-02 10:40:41 +0000
committergjoranv <gv@verizonmedia.com>2022-06-08 11:45:24 +0200
commit338d383d81ee6b142b308ef8798b44374b480838 (patch)
tree0af5af65e84a05fb2f8fbdcb1050b9d5db793937 /document
parent9e330c98d573866f162ef76207a8699d76d634c4 (diff)
remove TemporaryStructuredDataType
Diffstat (limited to 'document')
-rw-r--r--document/abi-spec.json16
-rw-r--r--document/src/main/java/com/yahoo/document/DocumentTypeManager.java3
-rw-r--r--document/src/main/java/com/yahoo/document/ReferenceDataType.java36
-rw-r--r--document/src/main/java/com/yahoo/document/TemporaryStructuredDataType.java36
-rw-r--r--document/src/test/java/com/yahoo/document/DocumentTypeManagerTestCase.java2
-rw-r--r--document/src/test/java/com/yahoo/document/ReferenceDataTypeTestCase.java28
-rw-r--r--document/src/test/java/com/yahoo/document/TemporaryStructuredDataTypeTestCase.java24
7 files changed, 0 insertions, 145 deletions
diff --git a/document/abi-spec.json b/document/abi-spec.json
index 7748a927c6d..edc4d8a19c6 100644
--- a/document/abi-spec.json
+++ b/document/abi-spec.json
@@ -954,11 +954,8 @@
],
"methods": [
"public void <init>(com.yahoo.document.DocumentType, int)",
- "public void <init>(com.yahoo.document.TemporaryStructuredDataType, int)",
"public static com.yahoo.document.ReferenceDataType createWithInferredId(com.yahoo.document.DocumentType)",
- "public static com.yahoo.document.ReferenceDataType createWithInferredId(com.yahoo.document.TemporaryStructuredDataType)",
"public com.yahoo.document.StructuredDataType getTargetType()",
- "public void setTargetType(com.yahoo.document.StructuredDataType)",
"public com.yahoo.document.datatypes.ReferenceFieldValue createFieldValue()",
"public java.lang.Class getValueClass()",
"public boolean isValueCompatible(com.yahoo.document.datatypes.FieldValue)",
@@ -1055,19 +1052,6 @@
"public static final int classId"
]
},
- "com.yahoo.document.TemporaryStructuredDataType": {
- "superClass": "com.yahoo.document.StructDataType",
- "interfaces": [],
- "attributes": [
- "public"
- ],
- "methods": [
- "public static com.yahoo.document.TemporaryStructuredDataType create(java.lang.String)",
- "public static com.yahoo.document.TemporaryStructuredDataType createById(int)",
- "protected void setName(java.lang.String)"
- ],
- "fields": []
- },
"com.yahoo.document.TensorDataType": {
"superClass": "com.yahoo.document.DataType",
"interfaces": [],
diff --git a/document/src/main/java/com/yahoo/document/DocumentTypeManager.java b/document/src/main/java/com/yahoo/document/DocumentTypeManager.java
index 42bc27e485b..277f0927be1 100644
--- a/document/src/main/java/com/yahoo/document/DocumentTypeManager.java
+++ b/document/src/main/java/com/yahoo/document/DocumentTypeManager.java
@@ -235,9 +235,6 @@ public class DocumentTypeManager {
@SuppressWarnings("deprecation")
void registerSingleType(DataType type) {
if (type instanceof TensorDataType) return; // built-in dynamic: Created on the fly
- if (type instanceof TemporaryStructuredDataType) {
- throw new IllegalArgumentException("TemporaryStructuredDataType no longer supported: " + type);
- }
if (dataTypes.containsKey(type.getId())) {
DataType existingType = dataTypes.get(type.getId());
if ((existingType == type) || existingType.equals(type)) {
diff --git a/document/src/main/java/com/yahoo/document/ReferenceDataType.java b/document/src/main/java/com/yahoo/document/ReferenceDataType.java
index c3b5f6590b6..8cf6b665acf 100644
--- a/document/src/main/java/com/yahoo/document/ReferenceDataType.java
+++ b/document/src/main/java/com/yahoo/document/ReferenceDataType.java
@@ -22,16 +22,6 @@ public class ReferenceDataType extends DataType {
this((StructuredDataType)targetType, id);
}
- /**
- * Constructor used when building a multi document type model where the concrete instance
- * of the target document type might not yet be known. The temporary data type should be
- * replaced later using setTargetType().
- */
- @SuppressWarnings("deprecation")
- public ReferenceDataType(TemporaryStructuredDataType temporaryTargetType, int id) {
- this((StructuredDataType) temporaryTargetType, id);
- }
-
private ReferenceDataType(StructuredDataType targetType, int id) {
super(buildTypeName(targetType), id);
this.targetType = targetType;
@@ -52,34 +42,8 @@ public class ReferenceDataType extends DataType {
return new ReferenceDataType(targetType);
}
- /**
- * Creates a new type where the numeric ID is based on the hash of targetType
- */
- @SuppressWarnings("deprecation")
- public static ReferenceDataType createWithInferredId(TemporaryStructuredDataType targetType) {
- return new ReferenceDataType(targetType);
- }
-
public StructuredDataType getTargetType() { return targetType; }
- /**
- * Overrides the stored temporary data type with a concrete StructuredDataType instance. Should only
- * be invoked from configuration or model code when resolving temporary types.
- *
- * @throws IllegalStateException if the previously stored target type is already a concrete
- * instance (not TemporaryStructuredDataType).
- */
- @SuppressWarnings("deprecation")
- public void setTargetType(StructuredDataType targetType) {
- if (! (this.targetType instanceof TemporaryStructuredDataType)) {
- throw new IllegalStateException(String.format(
- "Unexpected attempt to replace already concrete target " +
- "type in ReferenceDataType instance (type is '%s')", this.targetType.getName()));
- }
- this.targetType = targetType;
- setName(buildTypeName(targetType));
- }
-
@Override
public ReferenceFieldValue createFieldValue() {
return new ReferenceFieldValue(this);
diff --git a/document/src/main/java/com/yahoo/document/TemporaryStructuredDataType.java b/document/src/main/java/com/yahoo/document/TemporaryStructuredDataType.java
deleted file mode 100644
index 865310e7009..00000000000
--- a/document/src/main/java/com/yahoo/document/TemporaryStructuredDataType.java
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-package com.yahoo.document;
-
-/**
- * Internal class, DO NOT USE!!
- * Only public because it must be used from com.yahoo.searchdefinition.parser.
- *
- * @deprecated will be removed soon
- * @author Einar M R Rosenvinge
- */
-@Deprecated // TODO: Remove on Vespa 8
-public class TemporaryStructuredDataType extends StructDataType {
-
- TemporaryStructuredDataType(String name) {
- super(name);
- }
-
- private TemporaryStructuredDataType(int id) {
- super(id, "temporary_struct_" + id);
- }
-
- public static TemporaryStructuredDataType create(String name) {
- return new TemporaryStructuredDataType(name);
- }
-
- public static TemporaryStructuredDataType createById(int id) {
- return new TemporaryStructuredDataType(id);
- }
-
- @Override
- protected void setName(String name) {
- super.setName(name);
- setId(createId(getName()));
- }
-
-}
diff --git a/document/src/test/java/com/yahoo/document/DocumentTypeManagerTestCase.java b/document/src/test/java/com/yahoo/document/DocumentTypeManagerTestCase.java
index e0efb7e572e..f6cf589cce5 100644
--- a/document/src/test/java/com/yahoo/document/DocumentTypeManagerTestCase.java
+++ b/document/src/test/java/com/yahoo/document/DocumentTypeManagerTestCase.java
@@ -528,14 +528,12 @@ search annotationsimplicitstruct {
assertReferenceTypePresentInManager(manager, 87654321, "referenced_type2");
}
- @SuppressWarnings("deprecation")
@Test
public void no_temporary_targets_in_references_or_names() {
DocumentTypeManager manager = createConfiguredManager("file:src/test/document/documentmanager.replaced_temporary.cfg");
DocumentType docType = manager.getDocumentType("ad");
Field f = docType.getField("campaign_ref");
assertTrue(f.getDataType() instanceof ReferenceDataType);
- assertFalse(((ReferenceDataType)f.getDataType()).getTargetType() instanceof TemporaryStructuredDataType);
assertEquals("Reference<mystiqueCampaign>", f.getDataType().getName());
}
diff --git a/document/src/test/java/com/yahoo/document/ReferenceDataTypeTestCase.java b/document/src/test/java/com/yahoo/document/ReferenceDataTypeTestCase.java
index 53c8a0ecc94..a14b56cc539 100644
--- a/document/src/test/java/com/yahoo/document/ReferenceDataTypeTestCase.java
+++ b/document/src/test/java/com/yahoo/document/ReferenceDataTypeTestCase.java
@@ -72,32 +72,4 @@ public class ReferenceDataTypeTestCase {
assertTrue(fixture.refType.isValueCompatible(fixture.refTypeClone.createFieldValue()));
}
- @SuppressWarnings("deprecation")
- @Test
- public void reference_type_can_be_constructed_with_temporary_structured_data_type() {
- TemporaryStructuredDataType tempType = new TemporaryStructuredDataType("cooldoc");
- ReferenceDataType refType = new ReferenceDataType(tempType, 321);
- assertEquals("Reference<cooldoc>", refType.getName());
- assertEquals(321, refType.getId());
- assertEquals(tempType, refType.getTargetType());
- }
-
- @SuppressWarnings("deprecation")
- @Test
- public void can_replace_temporary_target_data_type() {
- TemporaryStructuredDataType tempType = new TemporaryStructuredDataType("cooldoc");
- ReferenceDataType refType = new ReferenceDataType(tempType, 321);
- DocumentType concreteType = new DocumentType("cooldoc");
- refType.setTargetType(concreteType);
- assertEquals("Reference<cooldoc>", refType.getName());
- assertEquals(321, refType.getId());
- assertEquals(concreteType, refType.getTargetType());
- }
-
- @Test(expected = IllegalStateException.class)
- public void replacing_already_concrete_type_throws_illegal_state_exception() {
- ReferenceDataType refType = new ReferenceDataType(new DocumentType("foo"), 123);
- refType.setTargetType(new DocumentType("foo"));
- }
-
}
diff --git a/document/src/test/java/com/yahoo/document/TemporaryStructuredDataTypeTestCase.java b/document/src/test/java/com/yahoo/document/TemporaryStructuredDataTypeTestCase.java
deleted file mode 100644
index 3b5cd29b90d..00000000000
--- a/document/src/test/java/com/yahoo/document/TemporaryStructuredDataTypeTestCase.java
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-package com.yahoo.document;
-
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-
-/**
- * @author <a href="mailto:einarmr@yahoo-inc.com">Einar M R Rosenvinge</a>
- * @since 5.1.10
- */
-@SuppressWarnings("deprecation")
-public class TemporaryStructuredDataTypeTestCase {
- @Test
- public void basic() {
- TemporaryStructuredDataType type = TemporaryStructuredDataType.create("banana");
- assertEquals("banana", type.getName());
- int originalId = type.getId();
- type.setName("apple");
- assertEquals("apple", type.getName());
- assertNotEquals(originalId, type.getId());
- }
-}