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

"Undeclared type" error using derived enum/typedef definitions

XMLWordPrintable

    • rc
    • x86
    • linux
    • Not verified

      Name: rmT116609 Date: 04/08/2004


      FULL PRODUCT VERSION :
      java version "1.4.2"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-b28)
      Java HotSpot(TM) Client VM (build 1.4.2-b28, mixed mode)

      java version "1.5.0-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b32c)
      Java HotSpot(TM) Client VM (build 1.5.0-beta-b32c, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Linux linws2 2.4.20-4GB #1 Wed Aug 6 18:26:21 UTC 2003 i686 unknown unknown GNU/Linux


      A DESCRIPTION OF THE PROBLEM :
      See example below: interface AA derives interface A. A defines an enum. Using this enum within a struct definition in AA leads to the error "undeclared type". Similar problem when using within exceptions and within a larger IDL within methods, too (I failed to reproduce in this small example).


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      idlj error.idl


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      No error should occur
      ACTUAL -
      error.idl (line 7): A_Enum is an undeclared type.
          struct AA_Struct { A_Enum undeclaredEnum; } ;
                                     ^
      error.idl (line 23): B_long is an undeclared type.
          exception BB_Exception { B_long undeclaredLong; } ;


      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      error.idl (line 7): A_Enum is an undeclared type.
          struct AA_Struct { A_Enum undeclaredEnum; } ;
                                     ^
      error.idl (line 23): B_long is an undeclared type.
          exception BB_Exception { B_long undeclaredLong; } ;


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      IDL error.idl:

      module error {
        interface A {
          enum A_Enum { X1, X2, X3 } ;
        } ;

        interface AA: A {
          struct AA_Struct { A_Enum undeclaredEnum; } ;
        } ;


        interface AA_Fixed: A {
          typedef A_Enum A_Enum; // this solves the problem above :-)

          struct AA_Struct { A_Enum enumOK; } ;
        } ;


        interface B {
          typedef long B_long;
        } ;

        interface BB: B {
          exception BB_Exception { B_long undeclaredLong; } ;
        } ;

        interface BB_Fixed: B {
          typedef B_long B_long; // this solves the problem above :-)

          exception BB_Exception { B_long longOK; } ;
        } ;

      } ;

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      typedef the type complaining about to itself within the deriving interface (see interfaces *_fixed in the example IDL)
      (Incident Review ID: 236139)
      ======================================================================

            rjeyaramsunw Ram Jeyaraman (Inactive)
            rmandalasunw Ranjith Mandala (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: