aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config-model/src/main/java/com/yahoo/documentmodel/NewDocumentType.java41
-rw-r--r--config-model/src/main/java/com/yahoo/schema/DocumentModelBuilder.java14
-rw-r--r--config-model/src/main/java/com/yahoo/schema/derived/IndexSchema.java37
-rw-r--r--config-model/src/main/java/com/yahoo/schema/document/SDField.java7
-rw-r--r--config-model/src/main/java/com/yahoo/schema/parser/ConvertParsedTypes.java12
-rw-r--r--config-model/src/main/java/com/yahoo/schema/processing/TagType.java3
-rw-r--r--document/src/main/java/com/yahoo/document/serialization/XmlDocumentWriter.java3
-rw-r--r--document/src/main/java/com/yahoo/document/serialization/XmlSerializationHelper.java24
8 files changed, 35 insertions, 106 deletions
diff --git a/config-model/src/main/java/com/yahoo/documentmodel/NewDocumentType.java b/config-model/src/main/java/com/yahoo/documentmodel/NewDocumentType.java
index 7f15da3179f..8c644279281 100644
--- a/config-model/src/main/java/com/yahoo/documentmodel/NewDocumentType.java
+++ b/config-model/src/main/java/com/yahoo/documentmodel/NewDocumentType.java
@@ -91,25 +91,6 @@ public final class NewDocumentType extends StructuredDataType implements DataTyp
public DataType getContentStruct() { return contentStruct; }
public Collection<NewDocumentType> getInherited() { return inherits.values(); }
public NewDocumentType getInherited(Name inherited) { return inherits.get(inherited.getId()); }
- public NewDocumentType removeInherited(Name inherited) { return inherits.remove(inherited.getId()); }
-
- /**
- * Data type of the header fields of this and all inherited document types
- * Used by DocumentGenMojo
- * @return merged {@link StructDataType}
- */
- public StructDataType allHeader() {
- StructDataType ret = new StructDataType(contentStruct.getName());
- for (Field f : contentStruct.getFields()) {
- ret.addField(f);
- }
- for (NewDocumentType inherited : getInherited()) {
- for (Field f : ((StructDataType) inherited.getContentStruct()).getFields()) {
- ret.addField(f);
- }
- }
- return ret;
- }
@Override
public Class<Document> getValueClass() {
@@ -132,7 +113,7 @@ public final class NewDocumentType extends StructuredDataType implements DataTyp
return false;
}
- private boolean verifyInheritance(NewDocumentType inherited) {
+ private void verifyInheritance(NewDocumentType inherited) {
for (Field f : getFields()) {
Field inhF = inherited.getField(f.getName());
if (inhF != null && !inhF.equals(f)) {
@@ -151,7 +132,6 @@ public final class NewDocumentType extends StructuredDataType implements DataTyp
}
}
}
- return true;
}
public void inherit(NewDocumentType inherited) {
@@ -213,9 +193,7 @@ public final class NewDocumentType extends StructuredDataType implements DataTyp
}
public Collection<Field> getFields() {
- Collection<Field> collection = new LinkedList<>();
- collection.addAll(contentStruct.getFields());
- return Collections.unmodifiableCollection(collection);
+ return contentStruct.getFields();
}
@Override
@@ -311,20 +289,6 @@ public final class NewDocumentType extends StructuredDataType implements DataTyp
}
return null;
}
- public AnnotationType getAnnotationType(int id) {
- AnnotationType a = annotations.getType(id);
- if (a != null) {
- return a;
- } else {
- for (NewDocumentType dt : getInherited()) {
- a = dt.getAnnotationType(id);
- if (a != null) {
- return a;
- }
- }
- }
- return null;
- }
public NewDocumentType add(AnnotationType type) {
annotations.register(type);
@@ -386,7 +350,6 @@ public final class NewDocumentType extends StructuredDataType implements DataTyp
private NewDocumentReferenceDataType refToThis = null;
- @SuppressWarnings("deprecation")
public NewDocumentReferenceDataType getReferenceDataType() {
if (refToThis == null) {
refToThis = new NewDocumentReferenceDataType(this);
diff --git a/config-model/src/main/java/com/yahoo/schema/DocumentModelBuilder.java b/config-model/src/main/java/com/yahoo/schema/DocumentModelBuilder.java
index 50ae4b72e13..57867bc7807 100644
--- a/config-model/src/main/java/com/yahoo/schema/DocumentModelBuilder.java
+++ b/config-model/src/main/java/com/yahoo/schema/DocumentModelBuilder.java
@@ -189,11 +189,6 @@ public class DocumentModelBuilder {
}
}
- private static String descT(DataType type) {
- if (type == null) { return "<null>"; }
- return "'" + type.getName() + "' [" + type.getId() + "] {"+type.getClass() + "}";
- }
-
private void addDocumentTypes(List<SDDocumentType> docList) {
LinkedList<NewDocumentType> lst = new LinkedList<>();
for (SDDocumentType doc : docList) {
@@ -266,7 +261,7 @@ public class DocumentModelBuilder {
type = other;
} else if (type != DataType.DOCUMENT) {
throw new IllegalArgumentException
- ("Can not handle nested document definitions. Undefined document type: " + type.toString());
+ ("Can not handle nested document definitions. Undefined document type: " + type);
}
} else if (type instanceof NewDocumentType) {
DataType other = getDocumentType(docs, type.getName());
@@ -378,7 +373,7 @@ public class DocumentModelBuilder {
if (type.isStruct()) {
handleStruct(type);
} else {
- throw new IllegalArgumentException("Data type '" + type.getName() + "' is not a struct => tostring='" + type.toString() + "'.");
+ throw new IllegalArgumentException("Data type '" + type.getName() + "' is not a struct => tostring='" + type + "'.");
}
}
for (SDDocumentType type : sdoc.getTypes()) {
@@ -470,7 +465,7 @@ public class DocumentModelBuilder {
private boolean testAddType(DataType type) { return internalAddType(type, true); }
- private boolean addType(DataType type) { return internalAddType(type, false); }
+ private void addType(DataType type) { internalAddType(type, false); }
private boolean internalAddType(DataType type, boolean dryRun) {
DataType oldType = targetDt.getDataTypeRecursive(type.getId());
@@ -573,7 +568,6 @@ public class DocumentModelBuilder {
return null;
}
- @SuppressWarnings("deprecation")
private StructDataType handleStruct(SDDocumentType type) {
if (type.isStruct()) {
var st = type.getStruct();
@@ -610,7 +604,7 @@ public class DocumentModelBuilder {
}
private static Set<NewDocumentType.Name> convertDocumentReferencesToNames(Optional<DocumentReferences> documentReferences) {
- if (!documentReferences.isPresent()) {
+ if (documentReferences.isEmpty()) {
return Set.of();
}
return documentReferences.get().referenceMap().values().stream()
diff --git a/config-model/src/main/java/com/yahoo/schema/derived/IndexSchema.java b/config-model/src/main/java/com/yahoo/schema/derived/IndexSchema.java
index 7f6c824b979..0e58b4cdb3b 100644
--- a/config-model/src/main/java/com/yahoo/schema/derived/IndexSchema.java
+++ b/config-model/src/main/java/com/yahoo/schema/derived/IndexSchema.java
@@ -8,7 +8,6 @@ import com.yahoo.document.StructuredDataType;
import com.yahoo.document.TensorDataType;
import com.yahoo.document.WeightedSetDataType;
import com.yahoo.schema.Schema;
-import com.yahoo.schema.document.BooleanIndexDefinition;
import com.yahoo.schema.document.FieldSet;
import com.yahoo.schema.document.ImmutableSDField;
import com.yahoo.vespa.config.search.IndexschemaConfig;
@@ -112,14 +111,13 @@ public class IndexSchema extends Derived implements IndexschemaConfig.Producer {
@Override
public void getConfig(IndexschemaConfig.Builder icB) {
- for (int i = 0; i < fields.size(); ++i) {
- IndexField f = fields.get(i);
+ for (IndexField f : fields) {
IndexschemaConfig.Indexfield.Builder ifB = new IndexschemaConfig.Indexfield.Builder()
.name(f.getName())
.datatype(IndexschemaConfig.Indexfield.Datatype.Enum.valueOf(f.getType()))
.prefix(f.hasPrefix())
- .phrases(f.hasPhrases())
- .positions(f.hasPositions())
+ .phrases(false)
+ .positions(true)
.interleavedfeatures(f.useInterleavedFeatures());
if (!f.getCollectionType().equals("SINGLE")) {
ifB.collectiontype(IndexschemaConfig.Indexfield.Collectiontype.Enum.valueOf(f.getCollectionType()));
@@ -137,7 +135,6 @@ public class IndexSchema extends Derived implements IndexschemaConfig.Producer {
}
}
- @SuppressWarnings("deprecation")
static List<Field> flattenField(Field field) {
DataType fieldType = field.getDataType();
if (fieldType.getPrimitiveType() != null){
@@ -172,14 +169,11 @@ public class IndexSchema extends Derived implements IndexschemaConfig.Producer {
* Representation of an index field with name and data type.
*/
public static class IndexField {
- private String name;
- private Index.Type type;
- private com.yahoo.schema.Index.Type sdType; // The index type in "user intent land"
- private DataType sdFieldType;
+ private final String name;
+ private final Index.Type type;
+ private final DataType sdFieldType;
private boolean prefix = false;
- private boolean phrases = false; // TODO dead, but keep a while to ensure config compatibility?
- private boolean positions = true;// TODO dead, but keep a while to ensure config compatibility?
- private BooleanIndexDefinition boolIndex = null;
+
// Whether the posting lists of this index field should have interleaved features (num occs, field length) in document id stream.
private boolean interleavedFeatures = false;
@@ -193,11 +187,8 @@ public class IndexSchema extends Derived implements IndexschemaConfig.Producer {
prefix = index.isPrefix();
interleavedFeatures = index.useInterleavedFeatures();
}
- sdType = index.getType();
- boolIndex = index.getBooleanIndexDefiniton();
}
public String getName() { return name; }
- public Index.Type getRawType() { return type; }
public String getType() {
return type.equals(Index.Type.INT64)
? "INT64" : "STRING";
@@ -212,21 +203,7 @@ public class IndexSchema extends Derived implements IndexschemaConfig.Producer {
: "SINGLE";
}
public boolean hasPrefix() { return prefix; }
- public boolean hasPhrases() { return phrases; }
- public boolean hasPositions() { return positions; }
public boolean useInterleavedFeatures() { return interleavedFeatures; }
-
- public BooleanIndexDefinition getBooleanIndexDefinition() {
- return boolIndex;
- }
-
- /**
- * The user set index type
- * @return the type
- */
- public com.yahoo.schema.Index.Type getSdType() {
- return sdType;
- }
}
/**
diff --git a/config-model/src/main/java/com/yahoo/schema/document/SDField.java b/config-model/src/main/java/com/yahoo/schema/document/SDField.java
index fbb2b2dc21f..8f285bdd113 100644
--- a/config-model/src/main/java/com/yahoo/schema/document/SDField.java
+++ b/config-model/src/main/java/com/yahoo/schema/document/SDField.java
@@ -33,9 +33,7 @@ import com.yahoo.vespa.indexinglanguage.parser.ParseException;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
-import java.util.LinkedList;
import java.util.List;
-import java.util.ListIterator;
import java.util.Map;
import java.util.TreeMap;
@@ -111,7 +109,7 @@ public class SDField extends Field implements TypedKey, ImmutableSDField {
private final Map<String,SDField> structFields = new java.util.LinkedHashMap<>(0);
/** The document that this field was declared in, or null */
- private SDDocumentType repoDocType = null;
+ private final SDDocumentType repoDocType;
/** The aliases declared for this field. May pertain to indexes or attributes */
private final Map<String, String> aliasToName = new HashMap<>();
@@ -263,7 +261,6 @@ public class SDField extends Field implements TypedKey, ImmutableSDField {
private boolean doneStructFields = false;
- @SuppressWarnings("deprecation")
private void actuallyMakeStructFields() {
if (doneStructFields) return;
if (getFirstStructOrMapRecursive() == null) {
@@ -344,8 +341,6 @@ public class SDField extends Field implements TypedKey, ImmutableSDField {
doneStructFields = true;
}
- private Matching matchingForStructFields = null;
-
public void setId(int fieldId, DocumentType owner) {
super.setId(fieldId, owner);
idOverride = true;
diff --git a/config-model/src/main/java/com/yahoo/schema/parser/ConvertParsedTypes.java b/config-model/src/main/java/com/yahoo/schema/parser/ConvertParsedTypes.java
index fd493a90249..efe1547f146 100644
--- a/config-model/src/main/java/com/yahoo/schema/parser/ConvertParsedTypes.java
+++ b/config-model/src/main/java/com/yahoo/schema/parser/ConvertParsedTypes.java
@@ -28,11 +28,6 @@ public class ConvertParsedTypes {
private final List<ParsedSchema> orderedInput;
private final DocumentTypeManager docMan;
- ConvertParsedTypes(List<ParsedSchema> input) {
- this.orderedInput = input;
- this.docMan = new DocumentTypeManager();
- }
-
public ConvertParsedTypes(List<ParsedSchema> input, DocumentTypeManager docMan) {
this.orderedInput = input;
this.docMan = docMan;
@@ -46,9 +41,9 @@ public class ConvertParsedTypes {
}
}
- private Map<String, DocumentType> documentsFromSchemas = new HashMap<>();
- private Map<String, StructDataType> structsFromSchemas = new HashMap<>();
- private Map<String, SDAnnotationType> annotationsFromSchemas = new HashMap<>();
+ private final Map<String, DocumentType> documentsFromSchemas = new HashMap<>();
+ private final Map<String, StructDataType> structsFromSchemas = new HashMap<>();
+ private final Map<String, SDAnnotationType> annotationsFromSchemas = new HashMap<>();
private void startDataTypes() {
for (var schema : orderedInput) {
@@ -297,7 +292,6 @@ public class ConvertParsedTypes {
throw new IllegalArgumentException("unknown type named '" + name + "' in context "+context);
}
- @SuppressWarnings("deprecation")
private void registerDataTypes() {
for (DataType t : structsFromSchemas.values()) {
docMan.register(t);
diff --git a/config-model/src/main/java/com/yahoo/schema/processing/TagType.java b/config-model/src/main/java/com/yahoo/schema/processing/TagType.java
index f511d572bc6..112d3c4cad0 100644
--- a/config-model/src/main/java/com/yahoo/schema/processing/TagType.java
+++ b/config-model/src/main/java/com/yahoo/schema/processing/TagType.java
@@ -2,8 +2,9 @@
package com.yahoo.schema.processing;
import com.yahoo.config.application.api.DeployLogger;
+import com.yahoo.document.DataType;
+import com.yahoo.document.WeightedSetDataType;
import com.yahoo.schema.RankProfileRegistry;
-import com.yahoo.document.*;
import com.yahoo.schema.Schema;
import com.yahoo.schema.document.Matching;
import com.yahoo.schema.document.MatchType;
diff --git a/document/src/main/java/com/yahoo/document/serialization/XmlDocumentWriter.java b/document/src/main/java/com/yahoo/document/serialization/XmlDocumentWriter.java
index 082a88bb000..aeb4bbe79b1 100644
--- a/document/src/main/java/com/yahoo/document/serialization/XmlDocumentWriter.java
+++ b/document/src/main/java/com/yahoo/document/serialization/XmlDocumentWriter.java
@@ -41,12 +41,11 @@ import java.util.Map;
*
* @author Steinar Knutsen
*/
-@SuppressWarnings("deprecation")
public final class XmlDocumentWriter implements DocumentWriter {
private final String indent;
private XmlStream buffer;
- private Deque<FieldBase> optionalWrapperMarker = new ArrayDeque<FieldBase>();
+ private final Deque<FieldBase> optionalWrapperMarker = new ArrayDeque<>();
public static XmlDocumentWriter createWriter(String indent) {
return new XmlDocumentWriter(indent);
diff --git a/document/src/main/java/com/yahoo/document/serialization/XmlSerializationHelper.java b/document/src/main/java/com/yahoo/document/serialization/XmlSerializationHelper.java
index 1bb91b91762..899ef1f9195 100644
--- a/document/src/main/java/com/yahoo/document/serialization/XmlSerializationHelper.java
+++ b/document/src/main/java/com/yahoo/document/serialization/XmlSerializationHelper.java
@@ -3,7 +3,21 @@ package com.yahoo.document.serialization;
import com.yahoo.document.Document;
import com.yahoo.document.Field;
-import com.yahoo.document.datatypes.*;
+import com.yahoo.document.datatypes.Array;
+import com.yahoo.document.datatypes.BoolFieldValue;
+import com.yahoo.document.datatypes.ByteFieldValue;
+import com.yahoo.document.datatypes.DoubleFieldValue;
+import com.yahoo.document.datatypes.FieldValue;
+import com.yahoo.document.datatypes.Float16FieldValue;
+import com.yahoo.document.datatypes.FloatFieldValue;
+import com.yahoo.document.datatypes.IntegerFieldValue;
+import com.yahoo.document.datatypes.LongFieldValue;
+import com.yahoo.document.datatypes.MapFieldValue;
+import com.yahoo.document.datatypes.Raw;
+import com.yahoo.document.datatypes.StringFieldValue;
+import com.yahoo.document.datatypes.Struct;
+import com.yahoo.document.datatypes.StructuredFieldValue;
+import com.yahoo.document.datatypes.WeightedSet;
import com.yahoo.text.Utf8;
import java.util.Base64;
@@ -46,7 +60,6 @@ public class XmlSerializationHelper {
xml.addContent(b.toString());
}
- @SuppressWarnings("deprecation")
public static void printDocumentXml(Document doc, XmlStream xml) {
xml.addAttribute("documenttype", doc.getDataType().getName());
xml.addAttribute("documentid", doc.getId());
@@ -121,13 +134,6 @@ public class XmlSerializationHelper {
}
}
- private static boolean containsNonPrintableCharactersByte(final byte[] buffer) {
- for (byte b : buffer) {
- if (b < 32 && (b != 9 && b != 10 && b != 13)) return true;
- }
- return false;
- }
-
private static boolean containsNonPrintableCharactersString(final CharSequence buffer) {
for (int i = 0; i < buffer.length(); i++) {
char b = buffer.charAt(i);