@@ -0,0 +1,2428 @@
+// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.%0Apackage com.yahoo.searchdefinition;%0A%0Aimport com.yahoo.document.DataType;%0Aimport com.yahoo.document.Field;%0Aimport com.yahoo.document.annotation.AnnotationReferenceDataType;%0Aimport com.yahoo.searchdefinition.Schema;%0Aimport com.yahoo.searchdefinition.document.SDDocumentType;%0Aimport com.yahoo.searchdefinition.document.SDField;%0Aimport com.yahoo.config.model.deploy.TestProperties;%0Aimport org.junit.Test;%0A%0Aimport static com.yahoo.config.model.test.TestUtil.joinLines;%0Aimport static org.junit.Assert.assertFalse;%0A%0A/**%0A * @author arnej%0A */%0Apublic class AnnotationReferenceTestCase %7B%0A%0A    static final String sd =%0A        joinLines(%22search test %7B%22,%0A                  %22    document test %7B %22,%0A                  %22        struct mystruct %7B%22,%0A                  %22          field x type int %7B%7D%22,%0A                  %22        %7D%22,%0A                  %22        field a type string %7B%7D%22,%0A                  %22        field b type mystruct %7B%7D%22,%0A                  %22        annotation marker %7B%7D%22,%0A                  %22        annotation person %7B%22,%0A                  %22            field name type string %7B%7D%22,%0A                  %22            field age type int %7B%7D%22,%0A                  %22        %7D%22,%0A                  %22        annotation complex %7B%22,%0A                  %22            field title type string %7B%7D%22,%0A                  %22            field tag type annotationreference%3Cmarker%3E %7B%7D%22,%0A                  %22            field owner type annotationreference%3Cperson%3E %7B%7D%22,%0A                  %22        %7D%22,%0A                  %22    %7D%22,%0A                  %22%7D%22);%0A    %0A    @Test%0A    public void noAnnotationReferenceInDocument() throws Exception %7B%0A        var builder = new ApplicationBuilder(new TestProperties().setExperimentalSdParsing(true));%0A        builder.addSchema(sd);%0A        builder.build(true);%0A        checkForAnnRef(builder.getSchema().getDocument());%0A    %7D%0A%0A    void checkForAnnRef(SDDocumentType doc) %7B%0A        for (var child : doc.getTypes()) %7B%0A            System.err.println(%22Check child %5B%22+child+%22%5D of parent %22+doc);%0A            checkForAnnRef(child);%0A        %7D%0A        for (Field field : doc.fieldSet()) %7B%0A            DataType fieldType = field.getDataType();%0A            System.err.println(%22datatype %22+fieldType+%22 in field  %22+field+%22 in doc %22+doc);%0A            assertFalse(fieldType instanceof AnnotationReferenceDataType);%0A        %7D%0A    %7D%0A        %0A%7D%0A

validate no annotation references in document