Skip to content

Commit 248a4e8

Browse files
committed
Add subtypes section in Java README.md document
1 parent c30d41e commit 248a4e8

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

compiler/extensions/java/README.md

+13
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,19 @@ Zserio Java generator supports the Java SE 8 (LTS), the Java SE 11 (LTS) and the
1212

1313
Although newer Java versions are not tested, they should work as well as long as they are backward compatible.
1414

15+
## Subtypes
16+
17+
Because Java language does not support aliases for types, Zserio subtypes in Java are resolved during
18+
API generation (resolved means that generated Java API uses always original type directly).
19+
20+
However, there are some use cases where it would be beneficial to have a generated Java class for
21+
subtype types of compounds, e.g. to parse compound type which is given by a subtype class name.
22+
23+
Therefore, for each subtype of compound, a Java class is generated which inherits the base type. These generated
24+
subtype classes are not used by generated code and are just meant to support applications.
25+
26+
> Note: Subtypes of primitive types are not reflected in generated code at all.
27+
1528
## Compatibility check
1629

1730
Java generator honors the `zserio_compatibility_version` specified in the schema. However note that only

0 commit comments

Comments
 (0)