IDL4-Java 1.1 RTF Avatar
  1. OMG Issue

IDL4JAV11 — Provide strong abstraction for arrays

  • Key: IDL4JAV11-5
  • Status: open  
  • Source: Airbus Group ( Mr. Oliver M. Kellogg)
  • Summary:

    The ptc/19-07-02 section 7.2.4.4 proposes a weak mapping for IDL arrays in that they are mapped directly to Java arrays.
    This means that the fixed size nature of IDL arrays cannot be enforced at the location of usage (e.g. index checking and handling of variable size operations of java.util.List).

    On the other hand, 7.2.4.2.1.1 does define an abstraction for "Sequence of Basic Types", see Table 7.4 where e.g. sequence<boolean> is mapped to the interface BooleanSeq.
    A similar mapping could be defined for IDL arrays.

    Example:

      // IDL
      enum Color { RED, GREEN, BLUE };
    
      typedef Color ColorArray[3];
    

    could be mapped to

      public enum Color {
        // [...]
      }
    
      public class ColorArray implements org.omg.type.Array<Color> {
        public ColorArray() {
          elementData = new Color[3];   // initialize private member
        }
        // [...] most of the operations can be implemented in the superclass
      }
    

    The generic abstract class org.omg.type.Array would provide getter, setter, and other methods. It could also throw an exception on use of java.util.List operations that undermine the fixed size. I can provide a demo implementation of the class if desired.

    If it is desired to maintain the possibility of using plain Java arrays then the mapping could be made switchable via an annotation.

  • Reported: IDL4-Java 1.0a1 — Mon, 23 Mar 2020 05:24 GMT
  • Updated: Tue, 14 Jul 2020 20:04 GMT
  • Attachments: