ASN.1/Java Compiler Directives

Applies to: ASN.1/Java 7.1

Compiler directives, similar to compiler options, control the compiler output. Unlike compiler options, compiler directives can be added to the ASN.1 schema files or can be included in a separate directive file.

See the following topics for more information and examples:



The following table contains compiler directives listed by category. Note that a directive may belong to more than one category. For your convenience, we have included check boxes that, when selected, display a particular group of directives: basic, advanced, or deprecated.


Compiler directives are case-sensitive and have the following format:

 --<[prefix.]Directive [Operand(s)]>--

Directives appear as comments to compilers that do not support them. The following examples illustrate three equivalent ways to specify directives:

  --<OSS.UNBOUNDED>-- --<OSS.ROOT Module1>--
  --<OSS.ROOT Module1>--

When you specify contradictory directives, the last one takes precedence. The two examples below achieve the same effect:


If a directive accepts one or more operands, they are listed after the name of the directive. Multiple operands are separated by commas:

--<OSS.ROOT Module1, Module2, Module3>--

Directives typically accept directiveOperand(s) consisting of one or more tokens used to configure the named directive as outlined on the following pages. Note that the presence of directiveOperand(s) is mandatory for some directives, but optional for others.


There are three types of compiler directives:

  • Standard directives
  • OSS-specific directives
  • OSS-specific legacy-style directives
Standard OSS Legacy
--<OSS.directive... >--
Usage General usage in the industry. Unique to the OSS ASN.1 Tools. Everywhere, except in-line (next to an item). Inline usage is replaced with the ability to reference a particular item. Historically used as in-line directives. OSS directives at a module or global level are a better alternative.
Use the -genDirectives compiler option to save legacy directives into a .gen file to be used outside of the ASN.1 module.
--<ASN1.WorkingSet Mod>--
--<OSS.FLOAT Mod.TypeX>--
A ::= [1] INTEGER  --<PDU>--  --<HUGE>--
A ::= [1] INTEGER  --<PDU | HUGE >--

OSS-specific directives take precedence over legacy ones. In the following example, the legacy directive <TYPENAME "Acme"> is ignored.

--<OSS.TYPENAME Sample.Name OSS>--

     Name ::= [1] OBJECT IDENTIFIER --<TYPENAME "Acme">--

Likewise, standard directives take precedence over legacy directives.

--<ASN1.Nickname Module.Int ASN1_Nicknamed_Int>--

     Int ::= INTEGER --<TYPENAME "OSS_Specific_New_Name">--

In the example above, the TYPENAME renaming mechanism is ignored and the following is generated in the java file:

public class ASN1_Nicknamed_Int extends INTEGER {

Local OSS-specific new-style directives take precedence over global OSS-specific new-style directives:


     A ::= [1] REAL --<DECIMAL>--
     B ::= [2] REAL
     C ::= [3] REAL

In the notation above, class A will extend the DecimalReal class while B and C will extend the MixedReal class.

Certain standard directives and their operands have no effect on the compiler-generated output files. However, they can be specified in the ASN.1 input file. Each time the OSS ASN.1 compiler parses a directive which has no effect, the compiler prints one of the following two informatory messages:

  • If the -genDirectives command- line option was not specified:
    C0492I:	There are unused standard directives.  Specify the  genDirectives command line option, then look at all lines containing "WARNING:" in the generated .gen file.
  • If -genDirectives was specified:
    C0064I:	There are unused standard or OSS-specific directives. Look at lines containing "WARNING:" in the .gen file.

In the second case, the compiler prints out a commented informatory warning in the .gen file:

--<ASN1.ConstraintFunction Module>-- -- WARNING: could not use the -- directive

This documentation applies to the OSS® ASN.1 Tools for Java release 7.1 and later.

Copyright © 2017 OSS Nokalva, Inc. All rights reserved.
No part of this publication may be reproduced, stored in a retrieval system, or transmitted in any form or by any means electronic, mechanical, photocopying, recording or otherwise, without the prior permission of OSS Nokalva, Inc.
Every distributed copy of the OSS® ASN.1 Tools for Java is associated with a specific license and related unique license number. That license determines, among other things, what functions of the OSS ASN.1 Tools for Java are available to you.