IDL4-Java 1.0 FTF Avatar
  1. OMG Issue

IDL4JAV — Package prefix specified at the IDL to Java translator

  • Key: IDL4JAV-1
  • Status: closed  
  • Source: Airbus Group ( Mr. Oliver M. Kellogg)
  • Summary:


    Many of the IDL to Java translators support an option to specify a Java package prefix for the generated code (e.g. Oracle idlj option -pkgPrefix; JacORB option -i2jpackage; rtiddsgen option -package).
    This is not exactly equivalent to hard coding the prefix as modules in the IDL: When using the translator option, other language mappings do not see the prefix.

    The package prefix provided to the IDL translator may produce a conflict with names in the IDL file.

    // file: test.idl
    module test {
       enum com_t { zero, one };
       struct org_t {
          short foo;
       typedef string<16> net_t;
       struct structure {
          com_t com;   // "com" is in conflict when providing prefix option such as: com.acme
          org_t org;   // "org" is in conflict when providing prefix option such as: org.acme
          net_t net;   // "net" is in conflict when providing prefix option such as: net.acme

    Notice that the Java generated for this IDL does not compile but it does compile for other languages (C++, Ada, etc).

    Section (Name Transformation Rules) contains:

    If the mapped name or identifier collides with a reserved name in 7.1.2, the collision is resolved by prepending an underscore ("_") to the mapped name.

    I suggest adding a further sentence:

    This also applies to name collisions caused by a Java package prefix specified at the IDL to Java translator.
  • Reported: IDL4-Java 1.0a1 — Tue, 13 Aug 2019 15:34 GMT
  • Disposition: Resolved — IDL4-Java 1.0
  • Disposition Summary:

    Document conflict resolution rules for compiler and vendor-extension settings

    Many IDL to Java translators provide extensions to introduce package prefixes for the generated code. Even though these rules are out of the scope of this specification, in this resolution we add a note indicating that name resolution rules may be also applied to collisions caused by these settings.

  • Updated: Fri, 18 Sep 2020 17:05 GMT