Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4286896

Generated Java code for Discriminated Union doesn't compile

XMLWordPrintable

    • merlin
    • sparc
    • solaris_7
    • Not verified

        If a Discriminated union is defined with an unsigned discriminator, the java code generated by idlj compiler can not be compiled.

        Try compiling the following idl code.

        *******************
        union FixedUnion switch(unsigned short)
        {
        case 0: short s;
        case 1: long l;
        default: boolean b;
        };
        *******************


        javac gives the following error.

        FixedUnion.java:80: Incompatible type for =. Can't convert null to short.
            __discriminator = null;
                            ^
        1 error


        Work around this problem is to remove unsigned from the union declaration.

              kcavanauorcl Ken Cavanaugh (Inactive)
              duke J. Duke
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: