From 1e57a0f2c754b981d46d405fa78c8bc16fbf78f6 Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Tue, 13 Jun 2023 14:52:05 +0200 Subject: Add uncheck cast suppression to generated document types. --- .../src/main/java/com/yahoo/vespa/DocumentGenMojo.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'vespa-documentgen-plugin/src') 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> dTypes = new java.util.HashMap>();\n"); out.write(ind()+"private static java.util.Map docTypes = new java.util.HashMap<>();\n"); out.write(ind()+"private static java.util.Map> sTypes = new java.util.HashMap>();\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"); -- cgit v1.2.3