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

static final Strings in valuetypes: rmic makes idl files that idlj doesn't like

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P5 P5
    • 1.4.0
    • 1.4.0
    • other-libs
    • beta3
    • generic
    • generic
    • Verified



        Name: krC82822 Date: 07/24/2001


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

        A Serializable class with a const final String in it causes problems for either rmic or idlj.
        Here's the code:

        import java.io.Serializable;

        class Jim implements Serializable
        {
        public String theString;
        public static final String aStringValue="SomeValue";
        }

        When I compile this using rmic -idl, I get
        /**
         * Jim.idl
         * Generated by rmic -idl. Do not edit
         * 23 July 2001 14:31:12 IST
         */

        #include "orb.idl"

        #ifndef __Jim__
        #define __Jim__



            valuetype Jim {
            
                const ::CORBA::WStringValue aStringValue = "SomeValue";
                public ::CORBA::WStringValue theString;
                factory create( );
            
            };

        #pragma ID Jim "RMI:Jim:E71DCA816B6E87B9:E1BD9D52F23CAEFC"


        #endif

        If I then compile this using idlj, I get
        C:\tmp\tmp>idlj -i D:\jdk1.4\lib\ Jim.idl
        Jim.idl (line 16): The type of Jim/Jim is value box, but it should be primitive
         or string.
                const ::CORBA::WStringValue aStringValue = "SomeValue";
                                            ^
        Jim.idl (line 16): The type of the constant expression is string, but it should
         be long.
                const ::CORBA::WStringValue aStringValue = "SomeValue";
                                                                      ^


        So either idlj is incorrectly complaining about perfectly good idl, or rmic -idl is incorrectly producing bad idl.

        -----------

        24 Jul 2001, eval1127@eng -- with build 72 of merlin-beta (refresh), rmic -idl gives different output:

        /**
         * Jim.idl
         * Generated by rmic -idl. Do not edit
         * Tuesday, July 24, 2001 4:59:15 PM PDT
         */

        #include "orb.idl"

        #ifndef __Jim__
        #define __Jim__



            valuetype Jim {
            
                const wstring aStringValue = "SomeValue";
                public ::CORBA::WStringValue theString;
                factory create( );
            
            };

        #pragma ID Jim "RMI:Jim:45A58CC6B180C396:E1BD9D52F23CAEFC"


        #endif

        -----------

        Running idlj on this:

        % idlj -i ${JAVA_HOME}/lib Jim.idl
        Jim.idl (line 16): The type of the constant expression is string, but it should be wstring.
                const wstring aStringValue = "SomeValue";
                                                        ^


        (Review ID: 128622)
        ======================================================================

        ********************************************************************************
        ###@###.### 2001-11-01

        Fix verified ok
        - With build: j2sdk-1_4_0-beta3-bin-b84-solsparc-20_oct_2001
        - With test: ./tests/product/rmi-iiop/JavaToIdlMapping/ValueTypes/constants01/Test01.java
        ********************************************************************************

              sbauersunw Stefan Bauer (Inactive)
              kryansunw Kevin Ryan (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: