Skip to content

Commit

Permalink
New API and fixes for TypeObject generation (#119)
Browse files Browse the repository at this point in the history
* Changes to run typeobject tests  (#103)

* Refs #19115: include method to check if type is boolean

Signed-off-by: JLBuenoLopez-eProsima <joseluisbueno@eprosima.com>

* Refs #19115: accesors to primitive types and enum types

Signed-off-by: JLBuenoLopez-eProsima <joseluisbueno@eprosima.com>

* Refs #19115: add scoped name to annotation declarations

Signed-off-by: JLBuenoLopez-eProsima <joseluisbueno@eprosima.com>

* Refs #19115: add API to check verbatim annotation. Sanity check to ensure that given enumeration value is valid

Signed-off-by: JLBuenoLopez-eProsima <joseluisbueno@eprosima.com>

* Refs #19115: remove quotes from annotation value

Signed-off-by: JLBuenoLopez-eProsima <joseluisbueno@eprosima.com>

* Refs #19115: discriminate builtin annotations

Signed-off-by: JLBuenoLopez-eProsima <joseluisbueno@eprosima.com>

* Refs #19115: API for max and min annotation values (@range)

Signed-off-by: JLBuenoLopez-eProsima <joseluisbueno@eprosima.com>

* Refs #19115: expose scoped name in Annotation API

Signed-off-by: JLBuenoLopez-eProsima <joseluisbueno@eprosima.com>

* Refs #19115: include XTypes v1.3 builtin annotations and fix IDL v4.2 builtin annotations

Signed-off-by: JLBuenoLopez-eProsima <joseluisbueno@eprosima.com>

* Refs #19115: throw exception if annotation is not previously defined

Signed-off-by: JLBuenoLopez-eProsima <joseluisbueno@eprosima.com>

* Refs #19115: remove isIsEnumType defined twice (after rebase)

Signed-off-by: JLBuenoLopez-eProsima <joseluisbueno@eprosima.com>

* Refs #19115: try_construct implementation

Signed-off-by: JLBuenoLopez-eProsima <joseluisbueno@eprosima.com>

* Refs #19115: type system only supports single inheritance

Signed-off-by: JLBuenoLopez-eProsima <joseluisbueno@eprosima.com>

* Refs #19115: check autoid annotation API

Signed-off-by: JLBuenoLopez-eProsima <joseluisbueno@eprosima.com>

* Added TypeObject tests flag.

Signed-off-by: adriancampo <adriancampo@eprosima.com>

* change run() method to work with different types of tests.

Signed-off-by: adriancampo <adriancampo@eprosima.com>

* Refs #19595: apply review suggestions

Signed-off-by: JLBuenoLopez-eProsima <joseluisbueno@eprosima.com>

* Refs #19595: revert changes: -typeobject option will be used to generate legacy TypeObject code

Signed-off-by: JLBuenoLopez-eProsima <joseluisbueno@eprosima.com>

* Refs #19595: check autoid annotation API

Signed-off-by: JLBuenoLopez-eProsima <joseluisbueno@eprosima.com>

* Refs #19595: try_construct annotation implementation

Signed-off-by: JLBuenoLopez-eProsima <joseluisbueno@eprosima.com>

* Refs #19595: add API to check @id and @hashid builtin annotations

Signed-off-by: JLBuenoLopez-eProsima <joseluisbueno@eprosima.com>

* Refs #19595: API to get number of members

Signed-off-by: JLBuenoLopez-eProsima <joseluisbueno@eprosima.com>

* Refs #19595: add getBitBound API to enum types

Signed-off-by: JLBuenoLopez-eProsima <joseluisbueno@eprosima.com>

* Refs #19595: add API to get number of annotation parameters

Signed-off-by: JLBuenoLopez-eProsima <joseluisbueno@eprosima.com>

* Refs #19595: fix merge conflicts

Signed-off-by: JLBuenoLopez-eProsima <joseluisbueno@eprosima.com>

* Refs #19595: add API to check if an annotation is builtin

Signed-off-by: JLBuenoLopez-eProsima <joseluisbueno@eprosima.com>

* Refs #19595: add API to check number of applicable labels

Signed-off-by: JLBuenoLopez-eProsima <joseluisbueno@eprosima.com>

* Refs #19595: fix merge conflicts

Signed-off-by: JLBuenoLopez-eProsima <joseluisbueno@eprosima.com>

* Refs #19595: refactor array_type

Signed-off-by: JLBuenoLopez-eProsima <joseluisbueno@eprosima.com>

* Refs #19595: add array API to check bound sequence size

Signed-off-by: JLBuenoLopez-eProsima <joseluisbueno@eprosima.com>

* Refs #19595: fix after rebase

Signed-off-by: JLBuenoLopez-eProsima <joseluisbueno@eprosima.com>

* Refs #19595: remove non-necessary template attribute

Signed-off-by: JLBuenoLopez-eProsima <joseluisbueno@eprosima.com>

* Refs #19595: include API to get number of annotation parameters

Signed-off-by: JLBuenoLopez-eProsima <joseluisbueno@eprosima.com>

* Refs #19595: apply review suggestion: use new scopedname strategy

Signed-off-by: JLBuenoLopez-eProsima <joseluisbueno@eprosima.com>

* Refs #19595: apply review suggestion

Signed-off-by: JLBuenoLopez-eProsima <joseluisbueno@eprosima.com>

---------

Signed-off-by: JLBuenoLopez-eProsima <joseluisbueno@eprosima.com>
Signed-off-by: adriancampo <adriancampo@eprosima.com>
Co-authored-by: JLBuenoLopez-eProsima <joseluisbueno@eprosima.com>

* Fix API for TypeObject code generation (#110)

* Refs #19595: code style

Signed-off-by: JLBuenoLopez-eProsima <joseluisbueno@eprosima.com>

* Refs #19595: return annotation default value

Signed-off-by: JLBuenoLopez-eProsima <joseluisbueno@eprosima.com>

* Refs #19595: add Alias API for container types aliased

Signed-off-by: JLBuenoLopez-eProsima <joseluisbueno@eprosima.com>

* Refs #19595: fix typos in primitive API

Signed-off-by: JLBuenoLopez-eProsima <joseluisbueno@eprosima.com>

* Refs #19595: explictly override

Signed-off-by: JLBuenoLopez-eProsima <joseluisbueno@eprosima.com>

---------

Signed-off-by: JLBuenoLopez-eProsima <joseluisbueno@eprosima.com>

* Refs #19906: fix TypeCode::isAnnotationAutoidHash function

Signed-off-by: JLBuenoLopez-eProsima <joseluisbueno@eprosima.com>

* Refs #19906: return correct TypeIdentifier kind

Signed-off-by: JLBuenoLopez-eProsima <joseluisbueno@eprosima.com>

* Refs #19906: return correct type identifier

Signed-off-by: JLBuenoLopez-eProsima <joseluisbueno@eprosima.com>

* Refs #19906: unbounded collections use small TypeIdentifier

Signed-off-by: JLBuenoLopez-eProsima <joseluisbueno@eprosima.com>

* Refs #19906: fixes after rebase

Signed-off-by: JLBuenoLopez-eProsima <joseluisbueno@eprosima.com>

* Refs #19906: return correct TypeIdentifier for arrays

Signed-off-by: JLBuenoLopez-eProsima <joseluisbueno@eprosima.com>

* Refs #19906: return correct TypeIdentifier for maps

Signed-off-by: JLBuenoLopez-eProsima <joseluisbueno@eprosima.com>

* Refs #20129: non applied extensibility and try_construct annotations

Signed-off-by: JLBuenoLopez-eProsima <joseluisbueno@eprosima.com>

* Refs #20129: get main project API (generate TypeObject tests only for the main project)

Signed-off-by: JLBuenoLopez-eProsima <joseluisbueno@eprosima.com>

* Refs #20129: fix Annotation Autoid hash return value

Signed-off-by: JLBuenoLopez-eProsima <joseluisbueno@eprosima.com>

* Refs #20129: add getFirstMember API

Signed-off-by: JLBuenoLopez-eProsima <joseluisbueno@eprosima.com>

* Refs #20129: fix bitset holder type

Signed-off-by: JLBuenoLopez-eProsima <joseluisbueno@eprosima.com>

* Refs #20129: fix collection TypeIdentifier

Signed-off-by: JLBuenoLopez-eProsima <joseluisbueno@eprosima.com>

* Refs #20129: recursive types fail generating TypeObject

Signed-off-by: JLBuenoLopez-eProsima <joseluisbueno@eprosima.com>

* Refs #20129: API to check if contained members are forwarded

Signed-off-by: JLBuenoLopez-eProsima <joseluisbueno@eprosima.com>

* Refs #20129: fix bitset bitfields

Signed-off-by: JLBuenoLopez-eProsima <joseluisbueno@eprosima.com>

* Refs #20129: use variables instead of hardcoded strings

Signed-off-by: JLBuenoLopez-eProsima <joseluisbueno@eprosima.com>

* Refs #20129: fixes after rebase

Signed-off-by: JLBuenoLopez-eProsima <joseluisbueno@eprosima.com>

* Refs #20129: apply review suggestions

Signed-off-by: JLBuenoLopez-eProsima <joseluisbueno@eprosima.com>

---------

Signed-off-by: JLBuenoLopez-eProsima <joseluisbueno@eprosima.com>
Signed-off-by: adriancampo <adriancampo@eprosima.com>
Co-authored-by: Adrian del Campo <107918259+adriancampo@users.noreply.github.com>
  • Loading branch information
JLBuenoLopez and adriancampo committed Apr 4, 2024
1 parent 9fe7aa9 commit 16492f8
Show file tree
Hide file tree
Showing 24 changed files with 990 additions and 161 deletions.
10 changes: 10 additions & 0 deletions src/it/java/com/eprosima/integration/Test.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ public boolean generate(

String idlPath = " " + inputPath + "/" + idl + ".idl";

if (idl.equals("external") || idl.equals("declarations"))
{
flags = flags + " -no-typeobjectsupport";
}

String command = program + flags + output + idlPath;

return Command.execute(command, null, errorOutputOnly, true);
Expand All @@ -70,6 +75,11 @@ public boolean generate(

String idlPath = " " + inputPath + "/" + idl + ".idl";

if (idl.equals("external") || idl.equals("declarations"))
{
flags = flags + " -no-typeobjectsupport";
}

String command = program + flags + output + idlPath;
return Command.execute(command, null, errorOutputOnly, true);
}
Expand Down
26 changes: 21 additions & 5 deletions src/main/antlr/com/eprosima/idl/parser/grammar/IDL.g4
Original file line number Diff line number Diff line change
Expand Up @@ -1156,8 +1156,10 @@ annotation_def returns [Pair<AnnotationDeclaration, TemplateGroup> returnPair =
@init
{
TemplateGroup annotationTemplates = null;
String old_scope = ctx.getScope();
String name = null;
}
: annotation_header LEFT_BRACE annotation_body[$annotation_header.annotation] RIGHT_BRACE
: annotation_header
{
if($annotation_header.annotation != null)
{
Expand All @@ -1172,9 +1174,24 @@ annotation_def returns [Pair<AnnotationDeclaration, TemplateGroup> returnPair =
}
}

$returnPair = new Pair<AnnotationDeclaration, TemplateGroup>($annotation_header.annotation, annotationTemplates);
name = $annotation_header.annotation.getName();

// Update to a new namespace.
if(old_scope.isEmpty())
ctx.setScope(name);
else
ctx.setScope(old_scope + "::" + name);
}
}
LEFT_BRACE
annotation_body[$annotation_header.annotation]
RIGHT_BRACE
{
// Set the old namespace.
ctx.setScope(old_scope);
// Create the returned data.
$returnPair = new Pair<AnnotationDeclaration, TemplateGroup>($annotation_header.annotation, annotationTemplates);
}
;

annotation_header returns [AnnotationDeclaration annotation = null]
Expand Down Expand Up @@ -1217,7 +1234,7 @@ annotation_inheritance_spec [AnnotationDeclaration annotation]
}
else
{
System.out.println("WARNING (File " + ctx.getFilename() + ", Line " + (_input.LT(1) != null ? _input.LT(1).getLine() - ctx.getCurrentIncludeLine() : "1") + "): Annotation " + $scoped_name.pair.first() + " not supported. Ignoring...");
throw new ParseException($scoped_name.pair.second(), "was not defined previously");
}
}
}
Expand Down Expand Up @@ -2213,7 +2230,6 @@ array_declarator returns [Pair<Pair<Pair<String, Token>, ContainerTypeCode>, Tem
{
arrayTemplates.setAttribute("array", typecode);
arrayTemplates.setAttribute("ctx", ctx);
arrayTemplates.setAttribute("array_type",tk.getText());
}
Pair<String, Token> p = new Pair<String, Token>(tk.getText(), tk);
Pair<Pair<String, Token>, ContainerTypeCode> pp = new Pair<Pair<String, Token>, ContainerTypeCode>(p, typecode);
Expand Down Expand Up @@ -2786,7 +2802,7 @@ annotation_appl returns [Annotation annotation = null]
anndecl = ctx.getAnnotationDeclaration(name);
if(anndecl == null)
{
System.out.println("WARNING (File " + ctx.getFilename() + ", Line " + (_input.LT(1) != null ? _input.LT(1).getLine() - ctx.getCurrentIncludeLine() : "1") + "): Annotation " + name + " not supported. Ignoring...");
throw new ParseException($scoped_name.pair.second(), "was not defined previously");
}
else
{
Expand Down
129 changes: 80 additions & 49 deletions src/main/java/com/eprosima/idl/context/Context.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import com.eprosima.idl.parser.typecode.BitfieldSpec;
import com.eprosima.idl.parser.typecode.BitsetTypeCode;
import com.eprosima.idl.parser.typecode.BitmaskTypeCode;
import com.eprosima.idl.parser.typecode.Bitmask;
import com.eprosima.idl.parser.typecode.EnumMember;
import com.eprosima.idl.parser.typecode.EnumTypeCode;
import com.eprosima.idl.parser.typecode.Kind;
Expand Down Expand Up @@ -201,9 +202,9 @@ public Context(
TypeCode.ctypesgr = new STGroupFile("com/eprosima/idl/templates/CTypes.stg", '$', '$');
TypeCode.javatypesgr = new STGroupFile("com/eprosima/idl/templates/JavaTypes.stg", '$', '$');

// Add here builtin annotations? (IDL 4.2 - 8.3.1 section)
// Builtin annotations (IDL 4.2 - 8.3 section & XTypes 1.3 - 7.3.1.2.1 section)
AnnotationDeclaration idann = createAnnotationDeclaration(Annotation.id_str, null);
idann.addMember(new AnnotationMember(Annotation.value_str, new PrimitiveTypeCode(Kind.KIND_LONG), "-1"));
idann.addMember(new AnnotationMember(Annotation.value_str, new PrimitiveTypeCode(Kind.KIND_ULONG), Annotation.null_default_value));

AnnotationDeclaration autoidann = createAnnotationDeclaration(Annotation.autoid_str, null);
EnumTypeCode autoidannenum = new EnumTypeCode(autoidann.getScopedname(), Annotation.autoid_enum_str);
Expand All @@ -212,10 +213,10 @@ public Context(
autoidann.addMember(new AnnotationMember(Annotation.value_str, autoidannenum, Annotation.autoid_hash_str));

AnnotationDeclaration optionalann = createAnnotationDeclaration(Annotation.optional_str, null);
optionalann.addMember(new AnnotationMember(Annotation.value_str, new PrimitiveTypeCode(Kind.KIND_BOOLEAN), "true"));
optionalann.addMember(new AnnotationMember(Annotation.value_str, new PrimitiveTypeCode(Kind.KIND_BOOLEAN), Annotation.true_str));

AnnotationDeclaration positionann = createAnnotationDeclaration("position", null);
positionann.addMember(new AnnotationMember(Annotation.value_str, new PrimitiveTypeCode(Kind.KIND_USHORT), "-1"));
AnnotationDeclaration positionann = createAnnotationDeclaration(Annotation.position_str, null);
positionann.addMember(new AnnotationMember(Annotation.value_str, new PrimitiveTypeCode(Kind.KIND_USHORT), Annotation.null_default_value));

AnnotationDeclaration valueann = createAnnotationDeclaration(Annotation.value_str, null);
valueann.addMember(new AnnotationMember(Annotation.value_str, new AnyTypeCode(), null));
Expand All @@ -232,71 +233,101 @@ public Context(
createAnnotationDeclaration(Annotation.appendable_str, null);
createAnnotationDeclaration(Annotation.mutable_str, null);

// Create default @Key annotation.
// Create default @key annotation (@Key annotation also supported and registered in parseIDL)
AnnotationDeclaration keyann = createAnnotationDeclaration(Annotation.key_str, null);
keyann.addMember(new AnnotationMember(Annotation.value_str, new PrimitiveTypeCode(Kind.KIND_BOOLEAN), "true"));
keyann.addMember(new AnnotationMember(Annotation.value_str, new PrimitiveTypeCode(Kind.KIND_BOOLEAN), Annotation.true_str));

AnnotationDeclaration mustundann = createAnnotationDeclaration("must_understand", null);
mustundann.addMember(new AnnotationMember(Annotation.value_str, new PrimitiveTypeCode(Kind.KIND_BOOLEAN), "true"));
AnnotationDeclaration mustundann = createAnnotationDeclaration(Annotation.must_understand_str, null);
mustundann.addMember(new AnnotationMember(Annotation.value_str, new PrimitiveTypeCode(Kind.KIND_BOOLEAN), Annotation.true_str));

createAnnotationDeclaration("default_literal", null);
createAnnotationDeclaration(Annotation.default_literal_str, null);

AnnotationDeclaration rangeann = createAnnotationDeclaration("range", null);
rangeann.addMember(new AnnotationMember("min", new AnyTypeCode(), null));
//String.valueOf(Integer.MIN_VALUE)));
rangeann.addMember(new AnnotationMember("max", new AnyTypeCode(), null));
//String.valueOf(Integer.MAX_VALUE)));

AnnotationDeclaration unitsann = createAnnotationDeclaration("units", null);
unitsann.addMember(new AnnotationMember(Annotation.value_str, new PrimitiveTypeCode(Kind.KIND_STRING), ""));

AnnotationDeclaration defaultann = createAnnotationDeclaration("default", null);
AnnotationDeclaration defaultann = createAnnotationDeclaration(Annotation.default_str, null);
defaultann.addMember(new AnnotationMember(Annotation.value_str, new AnyTypeCode(), null));

AnnotationDeclaration minann = createAnnotationDeclaration("min", null);
AnnotationDeclaration rangeann = createAnnotationDeclaration(Annotation.range_str, null);
rangeann.addMember(new AnnotationMember(Annotation.min_str, new AnyTypeCode(), null));
rangeann.addMember(new AnnotationMember(Annotation.max_str, new AnyTypeCode(), null));

AnnotationDeclaration minann = createAnnotationDeclaration(Annotation.min_str, null);
minann.addMember(new AnnotationMember(Annotation.value_str, new AnyTypeCode(), null));

AnnotationDeclaration maxann = createAnnotationDeclaration("max", null);
AnnotationDeclaration maxann = createAnnotationDeclaration(Annotation.max_str, null);
maxann.addMember(new AnnotationMember(Annotation.value_str, new AnyTypeCode(), null));

AnnotationDeclaration bit_boundann = createAnnotationDeclaration("bit_bound", null);
bit_boundann.addMember(new AnnotationMember(Annotation.value_str, new PrimitiveTypeCode(Kind.KIND_USHORT), "-1"));
AnnotationDeclaration unitsann = createAnnotationDeclaration(Annotation.unit_str, null);
unitsann.addMember(new AnnotationMember(Annotation.value_str, new PrimitiveTypeCode(Kind.KIND_STRING), Annotation.empty_str));

AnnotationDeclaration bit_boundann = createAnnotationDeclaration(Annotation.bit_bound_str, null);
bit_boundann.addMember(new AnnotationMember(Annotation.value_str, new PrimitiveTypeCode(Kind.KIND_USHORT), Annotation.null_default_value));

AnnotationDeclaration externalann = createAnnotationDeclaration(Annotation.external_str, null);
externalann.addMember(new AnnotationMember(Annotation.value_str, new PrimitiveTypeCode(Kind.KIND_BOOLEAN), "true"));

AnnotationDeclaration nestedann = createAnnotationDeclaration("nested", null);
nestedann.addMember(new AnnotationMember(Annotation.value_str, new PrimitiveTypeCode(Kind.KIND_BOOLEAN), "true"));

AnnotationDeclaration verbatimann = createAnnotationDeclaration("verbatim", null);
EnumTypeCode verbatimannenum = new EnumTypeCode(verbatimann.getScopedname(), "verbatimannenum");
verbatimannenum.addMember(new EnumMember("BEGIN_FILE"));
verbatimannenum.addMember(new EnumMember("BEFORE_DECLARATION"));
verbatimannenum.addMember(new EnumMember("BEGIN_DECLARATION"));
verbatimannenum.addMember(new EnumMember("END_DECLARATION"));
verbatimannenum.addMember(new EnumMember("AFTER_DECLARATION"));
verbatimannenum.addMember(new EnumMember("END_FILE"));
verbatimann.addMember(new AnnotationMember("language", new PrimitiveTypeCode(Kind.KIND_STRING), "*"));
externalann.addMember(new AnnotationMember(Annotation.value_str, new PrimitiveTypeCode(Kind.KIND_BOOLEAN), Annotation.true_str));

AnnotationDeclaration nestedann = createAnnotationDeclaration(Annotation.nested_str, null);
nestedann.addMember(new AnnotationMember(Annotation.value_str, new PrimitiveTypeCode(Kind.KIND_BOOLEAN), Annotation.true_str));

AnnotationDeclaration verbatimann = createAnnotationDeclaration(Annotation.verbatim_str, null);
EnumTypeCode verbatimannenum = new EnumTypeCode(verbatimann.getScopedname(), Annotation.placement_enum_str);
verbatimannenum.addMember(new EnumMember(Annotation.begin_file_str));
verbatimannenum.addMember(new EnumMember(Annotation.before_declaration_str));
verbatimannenum.addMember(new EnumMember(Annotation.begin_declaration_str));
verbatimannenum.addMember(new EnumMember(Annotation.end_declaration_str));
verbatimannenum.addMember(new EnumMember(Annotation.after_declaration_str));
verbatimannenum.addMember(new EnumMember(Annotation.end_file_str));
verbatimann.addMember(new AnnotationMember(Annotation.language_str, new PrimitiveTypeCode(Kind.KIND_STRING), Annotation.any_str));
// c, c++, java, idl, * (any), or custom value
verbatimann.addMember(new AnnotationMember("placement", verbatimannenum, "BEFORE_DECLARATION"));
verbatimann.addMember(new AnnotationMember("text", new PrimitiveTypeCode(Kind.KIND_STRING), ""));
verbatimann.addMember(new AnnotationMember(Annotation.placement_str, verbatimannenum, Annotation.before_declaration_str));
verbatimann.addMember(new AnnotationMember(Annotation.text_str, new PrimitiveTypeCode(Kind.KIND_STRING), Annotation.empty_str));

AnnotationDeclaration serviceann = createAnnotationDeclaration("service", null);
serviceann.addMember(new AnnotationMember("platform", new PrimitiveTypeCode(Kind.KIND_STRING), "*"));
AnnotationDeclaration serviceann = createAnnotationDeclaration(Annotation.service_str, null);
serviceann.addMember(new AnnotationMember(Annotation.platform_str, new PrimitiveTypeCode(Kind.KIND_STRING), Annotation.any_str));
// CORBA, DDS, * (any), or custom value

AnnotationDeclaration onewayann = createAnnotationDeclaration("oneway", null);
onewayann.addMember(new AnnotationMember(Annotation.value_str, new PrimitiveTypeCode(Kind.KIND_BOOLEAN), "true"));
AnnotationDeclaration onewayann = createAnnotationDeclaration(Annotation.oneway_str, null);
onewayann.addMember(new AnnotationMember(Annotation.value_str, new PrimitiveTypeCode(Kind.KIND_BOOLEAN), Annotation.true_str));

AnnotationDeclaration amiann = createAnnotationDeclaration("ami", null);
amiann.addMember(new AnnotationMember(Annotation.value_str, new PrimitiveTypeCode(Kind.KIND_BOOLEAN), "true"));
AnnotationDeclaration amiann = createAnnotationDeclaration(Annotation.ami_str, null);
amiann.addMember(new AnnotationMember(Annotation.value_str, new PrimitiveTypeCode(Kind.KIND_BOOLEAN), Annotation.true_str));

AnnotationDeclaration hashid_annotation = createAnnotationDeclaration(Annotation.hashid_str, null);
hashid_annotation.addMember(new AnnotationMember(Annotation.value_str, new StringTypeCode(Kind.KIND_STRING, null, null), ""));
hashid_annotation.addMember(new AnnotationMember(Annotation.value_str, new StringTypeCode(Kind.KIND_STRING, null, null), Annotation.empty_str));

AnnotationDeclaration default_nested_annotation = createAnnotationDeclaration(Annotation.default_nested_str, null);
default_nested_annotation.addMember(new AnnotationMember(Annotation.value_str, new PrimitiveTypeCode(Kind.KIND_BOOLEAN), Annotation.true_str));

AnnotationDeclaration ignore_literal_names_annotation = createAnnotationDeclaration(Annotation.ignore_literal_names_str, null);
ignore_literal_names_annotation.addMember(new AnnotationMember(Annotation.value_str, new PrimitiveTypeCode(Kind.KIND_BOOLEAN), Annotation.true_str));

EnumTypeCode try_construct_fail_action_enum = new EnumTypeCode(null, Annotation.try_construct_enum_str);
try_construct_fail_action_enum.addMember(new EnumMember(Annotation.try_construct_discard_str));
try_construct_fail_action_enum.addMember(new EnumMember(Annotation.try_construct_use_default_str));
try_construct_fail_action_enum.addMember(new EnumMember(Annotation.try_construct_trim_str));

AnnotationDeclaration try_construct_annotation = createAnnotationDeclaration(Annotation.try_construct_str, null);
try_construct_annotation.addMember(new AnnotationMember(Annotation.value_str, try_construct_fail_action_enum, Annotation.try_construct_use_default_str));

// Create default @non_serialized annotation.
AnnotationDeclaration non_serializedann = createAnnotationDeclaration("non_serialized", null);
non_serializedann.addMember(new AnnotationMember(Annotation.value_str, new PrimitiveTypeCode(Kind.KIND_BOOLEAN), "true"));
AnnotationDeclaration non_serializedann = createAnnotationDeclaration(Annotation.non_serialized_str, null);
non_serializedann.addMember(new AnnotationMember(Annotation.value_str, new PrimitiveTypeCode(Kind.KIND_BOOLEAN), Annotation.true_str));

BitmaskTypeCode data_representation_mask_bitmask = new BitmaskTypeCode(null, Annotation.data_representation_mask_str);
Bitmask xcdr1_bitmask = new Bitmask(data_representation_mask_bitmask, Annotation.xcdr1_bitflag_str);
xcdr1_bitmask.setPosition(0);
data_representation_mask_bitmask.addBitmask(xcdr1_bitmask);
Bitmask xml_bitmask = new Bitmask(data_representation_mask_bitmask, Annotation.xml_bitflag_str);
xml_bitmask.setPosition(1);
data_representation_mask_bitmask.addBitmask(xml_bitmask);
Bitmask xcdr2_bitmask = new Bitmask(data_representation_mask_bitmask, Annotation.xcdr2_bitflag_str);
xcdr2_bitmask.setPosition(2);
data_representation_mask_bitmask.addBitmask(xcdr2_bitmask);

AnnotationDeclaration data_representation_annotation = createAnnotationDeclaration(Annotation.data_representation_str, null);
data_representation_annotation.addMember(new AnnotationMember(Annotation.allowed_kinds_str, data_representation_mask_bitmask, Annotation.empty_str));

AnnotationDeclaration topic_annotation = createAnnotationDeclaration(Annotation.topic_str, null);
topic_annotation.addMember(new AnnotationMember(Annotation.name_str, new PrimitiveTypeCode(Kind.KIND_STRING), Annotation.empty_str));
topic_annotation.addMember(new AnnotationMember(Annotation.platform_str, new PrimitiveTypeCode(Kind.KIND_STRING), Annotation.any_str));
}

public String getFilename()
Expand Down
Loading

0 comments on commit 16492f8

Please sign in to comment.