summaryrefslogtreecommitdiffstats
path: root/vespa-documentgen-plugin
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2023-06-13 14:52:05 +0200
committerHenning Baldersheim <balder@yahoo-inc.com>2023-06-13 14:52:05 +0200
commit1e57a0f2c754b981d46d405fa78c8bc16fbf78f6 (patch)
treea77881985ee5b0b44bb30ff00e8b28326f5482c0 /vespa-documentgen-plugin
parent75cdcbc2daae3ec9c538b69d817578eba875c276 (diff)
Add uncheck cast suppression to generated document types.
Diffstat (limited to 'vespa-documentgen-plugin')
-rw-r--r--vespa-documentgen-plugin/src/main/java/com/yahoo/vespa/DocumentGenMojo.java10
1 files changed, 7 insertions, 3 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 d753f3d9e73..7de2627209c 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
@@ -199,7 +199,8 @@ public class DocumentGenMojo extends AbstractMojo {
" * Generated by vespa-documentgen-plugin, do not edit.\n" +
" * Date: "+new Date()+"\n" +
" */\n");
- out.write("@com.yahoo.document.Generated\npublic class ConcreteDocumentFactory extends com.yahoo.docproc.AbstractConcreteDocumentFactory {\n");
+ out.write("@com.yahoo.document.Generated\n");
+ out.write("public class ConcreteDocumentFactory extends com.yahoo.docproc.AbstractConcreteDocumentFactory {\n");
out.write(ind()+"private static java.util.Map<java.lang.String, java.lang.Class<? extends com.yahoo.document.Document>> dTypes = new java.util.HashMap<java.lang.String, java.lang.Class<? extends com.yahoo.document.Document>>();\n");
out.write(ind()+"private static java.util.Map<java.lang.String, com.yahoo.document.DocumentType> docTypes = new java.util.HashMap<>();\n");
out.write(ind()+"private static java.util.Map<java.lang.String, java.lang.Class<? extends com.yahoo.document.datatypes.Struct>> sTypes = new java.util.HashMap<java.lang.String, java.lang.Class<? extends com.yahoo.document.datatypes.Struct>>();\n");
@@ -312,7 +313,8 @@ public class DocumentGenMojo extends AbstractMojo {
" * Input annotation type: "+annType.getName()+"\n" +
" * Date: "+new Date()+"\n" +
" */\n" +
- "@com.yahoo.document.Generated\npublic "+annTypeModifier(annType)+"class "+className+" extends "+getParentAnnotationType(annType)+" {\n\n");
+ "@com.yahoo.document.Generated\n" +
+ "public "+annTypeModifier(annType)+"class "+className+" extends "+getParentAnnotationType(annType)+" {\n\n");
if (annType.getDataType() instanceof StructDataType) {
out.write(ind() + "public "+className+"() {\n" +
ind(2) + "setType(new com.yahoo.document.annotation.AnnotationType(\""+annType.getName()+"\", Fields.type));\n" +
@@ -431,7 +433,9 @@ public class DocumentGenMojo extends AbstractMojo {
" * Input document type: "+docType.getName()+"\n" +
" * Date: "+new Date()+"\n" +
" */\n" +
- "@com.yahoo.document.Generated\npublic class "+className+" extends "+superType+" {\n\n"+
+ "@com.yahoo.document.Generated\n" +
+ "@SuppressWarnings(\"unchecked\")\n" +
+ "public 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");