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

wrong Stub/Tie code generated when arg type is static nested class

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2 P2
    • 1.4.0
    • 1.2.1
    • other-libs
    • beta3
    • sparc
    • solaris_8
    • Not verified

        If the user chooses an inner static class of an object as an Entity Bean PK class, the bean will not successfully deploy to the RI: server specific generated code will not compile.

        --------------------------------------------
        This deployment problem is caused because of an rmic bug. The generated stub
        and tie code does not compile when one of the argument types of a remote
        method is a static nested class. The import statement at the tope of
        the Stub/Tie class is like:
            import foo.OuterClass.NestedClass;
        and the usage of the class in the generated code is of the form:
            public Hello createBar(OuterClass.NestedClass arg0) throws .....

        This causes an rmic error. I've attached the Stub and Tie classes
        to this bug report. The errors are appended below.
        Note that the errors "Class OuterClass.NestedClass not found" happen
        even though foo.OuterClass.NestedClass was successfully loaded
        (run rmic -verbose), so this indicates that the compiler thinks that
        "OuterClass" is the package name because there is no import statement
        for OuterClass.

        So a possible fix is to generate an "import foo.OuterClass;"
        instead of "import foo.OuterClass.NestedClass;"

        -Sanjeev

        ---------------------------------------------------------

        sixnines> rmic -iiop -poa -alwaysgenerate -keepgenerated -nolocalstubs -classpath /export/users/sanjeevk/j2ee13/build/unix/lib/classes:/export/users/sanjeevk/j2ee13/build/unix/lib/j2ee.jar:/export/users/sanjeevk/j2ee13/build/unix/lib/system/dbschema.jar:/export/users/sanjeevk/j2ee13/build/unix/lib/system/persistence-rt.jar:/export/users/sanjeevk/j2ee13/build/unix/lib/system/xerces.jar:/export/software/jdk1.3.1/lib/tools.jar:/export/users/sanjeevk/j2ee13/build/unix/repository/sixnines/applications/HelloApp995054317534.jar:. -d . hello.HelloEJB_RemoteHomeImpl hello.HelloEJB_EJBObjectImpl
        ./hello/_HelloEJB_RemoteHomeImpl_Tie.java:110: Class OuterClass.NestedClass not found.
                                    OuterClass.NestedClass arg0 = (OuterClass.NestedClass) in.read_value(OuterClass.NestedClass.class);
                                              ^
        ./hello/_HelloEJB_RemoteHomeImpl_Tie.java:110: Class OuterClass.NestedClass not found.
                                    OuterClass.NestedClass arg0 = (OuterClass.NestedClass) in.read_value(OuterClass.NestedClass.class);
                                                                             ^
        ./hello/_HelloEJB_RemoteHomeImpl_Tie.java:110: Class OuterClass.NestedClass not found.
                                    OuterClass.NestedClass arg0 = (OuterClass.NestedClass) in.read_value(OuterClass.NestedClass.class);
                                                                                                                   ^
        ./hello/_HelloEJB_RemoteHomeImpl_Tie.java:113: Variable arg0 may not have been initialized.
                                        result = target.createBar(arg0);
                                                                  ^
        ./hello/_HelloEJB_RemoteHomeImpl_Tie.java:114: Exception javax.ejb.CreateException is never thrown in the body of the corresponding try statement.
                                    } catch (CreateException ex) {
                                      ^
        ./hello/_HelloHome_Stub.java:28: class hello._HelloHome_Stub must be declared abstract. It does not define hello.Hello createBar(foo.OuterClass.NestedClass) from interface hello.HelloHome.
        public class _HelloHome_Stub extends Stub implements HelloHome {
                     ^
        ./hello/_HelloHome_Stub.java:208: Class OuterClass.NestedClass not found.
            public Hello createBar(OuterClass.NestedClass arg0) throws RemoteException, CreateException {
                         ^
        ./hello/_HelloHome_Stub.java:215: Class OuterClass.NestedClass not found in hello.Hello createBar(OuterClass.NestedClass).
                        out.write_value(arg0,OuterClass.NestedClass.class);
                                       ^
        ./hello/_HelloHome_Stub.java:215: Class OuterClass.NestedClass not found.
                        out.write_value(arg0,OuterClass.NestedClass.class);
                                                       ^
        ./hello/_HelloHome_Stub.java:226: Class OuterClass.NestedClass not found in hello.Hello createBar(OuterClass.NestedClass).
                        return createBar(arg0);
                                        ^
        10 errors

              sbauersunw Stefan Bauer (Inactive)
              mvatkina Marina Vatkina (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: