public inbox for java-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug libgcj/32198]  New: rmic fails if remote method throws superclass of RemoteException
@ 2007-06-03 20:30 marcus at better dot se
  2008-06-19  7:55 ` [Bug libgcj/32198] " jerico dot dev at gmail dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: marcus at better dot se @ 2007-06-03 20:30 UTC (permalink / raw)
  To: java-prs

GCJ fails to build MX4J [1], whereas it works with Sun JDK 5. This is because
rmic cannot compile a remote object with a method that only declares that it
throws an exception that is a superclass of RemoteException. This should be
allowed though: 

"Each remote method must declare java.rmi.RemoteException (or a superclass of
RemoteException) in its throws clause, in addition to any application-specific
exceptions." [2]

Build output:

rmic.iiop:
     [rmic] javax/management/remote/rmi/RMIServerImpl.class added as
javax/management/remote/rmi/_RMIServerImpl_Tie.class doesn't exist.
     [rmic] RMI Compiling 1 class to
/home/marcus/src/debian/build-area/libmx4j-java-3.0.2/classes/core
     [rmic] Using SUN rmic compiler
     [rmic] IIOP has been turned on.
     [rmic] Compilation arguments:
     [rmic] '-d'
     [rmic]
'/home/marcus/src/debian/build-area/libmx4j-java-3.0.2/classes/core'
     [rmic] '-classpath'
     [rmic]
'/home/marcus/src/debian/build-area/libmx4j-java-3.0.2/classes/core:/home/marcus/src/debian/build-area/libmx4j-java-3.0.2/lib:/home/marcus/src/debian/build-area/libmx4j-java-3.0.2/dist/lib/mx4j-impl.jar:/home/marcus/src/debian/build-area/libmx4j-java-3.0.2/dist/lib/mx4j-jmx.jar:/home/marcus/src/debian/build-area/libmx4j-java-3.0.2/dist/lib/mx4j.jar:/usr/share/ant/lib/ant.jar:/usr/share/ant/lib/ant-launcher.jar:/usr/share/java/log4j-1.2.jar:/usr/share/java/commons-logging.jar:/usr/share/java/servlet-api-2.4.jar:/usr/share/java/bcel.jar:/usr/share/java/jython.jar:/usr/share/java/gnumail.jar:/usr/share/java/activation.jar:/usr/share/java/axis.jar:/usr/share/java/jaxrpc.jar:/usr/share/java/saaj.jar:/usr/lib/jvm/java-gcj/lib/tools.jar'
     [rmic] '-iiop'
     [rmic] '-g'
     [rmic]
     [rmic] The ' characters around the executable and arguments are
     [rmic] not part of the command.
     [rmic] File to be compiled:    javax.management.remote.rmi.RMIServerImpl
  [antcall] Exiting
/home/marcus/src/debian/build-area/libmx4j-java-3.0.2/build/build.xml.

BUILD FAILED
/home/marcus/src/debian/build-area/libmx4j-java-3.0.2/build/build.xml:287: The
following error occurred while executing this line:
/home/marcus/src/debian/build-area/libmx4j-java-3.0.2/build/build.xml:257:
Error starting SUN rmic:
   at
org.apache.tools.ant.ProjectHelper.addLocationToBuildException(ProjectHelper.java:539)
   at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:385)
   at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:107)
   at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
   at org.apache.tools.ant.Task.perform(Task.java:364)
   at org.apache.tools.ant.Target.execute(Target.java:341)
   at org.apache.tools.ant.Target.performTasks(Target.java:369)
   at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
   at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
   at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
   at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
   at org.apache.tools.ant.Main.runBuild(Main.java:668)
   at org.apache.tools.ant.Main.startAnt(Main.java:187)
   at org.apache.tools.ant.Main.start(Main.java:150)
   at org.apache.tools.ant.Main.main(Main.java:240)
Caused by:
/home/marcus/src/debian/build-area/libmx4j-java-3.0.2/build/build.xml:257:
Error starting SUN rmic:
   at org.apache.tools.ant.taskdefs.rmic.SunRmic.execute(SunRmic.java:67)
   at org.apache.tools.ant.taskdefs.Rmic.execute(Rmic.java:529)
   at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
   at org.apache.tools.ant.Task.perform(Task.java:364)
   at org.apache.tools.ant.Target.execute(Target.java:341)
   at org.apache.tools.ant.Target.performTasks(Target.java:369)
   at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
   at
org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:37)
   at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
   at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:382)
   ...13 more
Caused by: java.lang.reflect.InvocationTargetException
   at java.lang.reflect.Method.invoke(libgcj.so.71)
   at org.apache.tools.ant.taskdefs.rmic.SunRmic.execute(SunRmic.java:54)
   ...22 more
Caused by: gnu.classpath.tools.rmic.CompilationError: newClient, defined in
javax.management.remote.rmi.RMIServer, does not throw java.rmi.RemoteException
   at
gnu.classpath.tools.rmic.SourceGiopRmicCompiler.compile(SourceGiopRmicCompiler.java:302)
   at
gnu.classpath.tools.rmic.SourceGiopRmicCompiler.run(SourceGiopRmicCompiler.java:661)
   at gnu.classpath.tools.rmic.Main.run(Main.java:259)
   at gnu.classpath.tools.rmic.Main.main(Main.java:272)
   at sun.rmi.rmic.Main.compile(Main.java:51)
   at java.lang.reflect.Method.invoke(libgcj.so.71)
   ...23 more
--- Nested Exception ---
/home/marcus/src/debian/build-area/libmx4j-java-3.0.2/build/build.xml:257:
Error starting SUN rmic:
   at org.apache.tools.ant.taskdefs.rmic.SunRmic.execute(SunRmic.java:67)
   at org.apache.tools.ant.taskdefs.Rmic.execute(Rmic.java:529)
   at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
   at org.apache.tools.ant.Task.perform(Task.java:364)
   at org.apache.tools.ant.Target.execute(Target.java:341)
   at org.apache.tools.ant.Target.performTasks(Target.java:369)
   at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
   at
org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:37)
   at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
   at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:382)
   at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:107)
   at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
   at org.apache.tools.ant.Task.perform(Task.java:364)
   at org.apache.tools.ant.Target.execute(Target.java:341)
   at org.apache.tools.ant.Target.performTasks(Target.java:369)
   at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
   at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
   at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
   at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
   at org.apache.tools.ant.Main.runBuild(Main.java:668)
   at org.apache.tools.ant.Main.startAnt(Main.java:187)
   at org.apache.tools.ant.Main.start(Main.java:150)
   at org.apache.tools.ant.Main.main(Main.java:240)
Caused by: java.lang.reflect.InvocationTargetException
   at java.lang.reflect.Method.invoke(libgcj.so.71)
   at org.apache.tools.ant.taskdefs.rmic.SunRmic.execute(SunRmic.java:54)
   ...22 more
Caused by: gnu.classpath.tools.rmic.CompilationError: newClient, defined in
javax.management.remote.rmi.RMIServer, does not throw java.rmi.RemoteException
   at
gnu.classpath.tools.rmic.SourceGiopRmicCompiler.compile(SourceGiopRmicCompiler.java:302)
   at
gnu.classpath.tools.rmic.SourceGiopRmicCompiler.run(SourceGiopRmicCompiler.java:661)
   at gnu.classpath.tools.rmic.Main.run(Main.java:259)
   at gnu.classpath.tools.rmic.Main.main(Main.java:272)
   at sun.rmi.rmic.Main.compile(Main.java:51)
   at java.lang.reflect.Method.invoke(libgcj.so.71)
   ...23 more
--- Nested Exception ---
java.lang.reflect.InvocationTargetException
   at java.lang.reflect.Method.invoke(libgcj.so.71)
   at org.apache.tools.ant.taskdefs.rmic.SunRmic.execute(SunRmic.java:54)
   at org.apache.tools.ant.taskdefs.Rmic.execute(Rmic.java:529)
   at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
   at org.apache.tools.ant.Task.perform(Task.java:364)
   at org.apache.tools.ant.Target.execute(Target.java:341)
   at org.apache.tools.ant.Target.performTasks(Target.java:369)
   at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
   at
org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:37)
   at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
   at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:382)
   at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:107)
   at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
   at org.apache.tools.ant.Task.perform(Task.java:364)
   at org.apache.tools.ant.Target.execute(Target.java:341)
   at org.apache.tools.ant.Target.performTasks(Target.java:369)
   at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
   at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
   at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
   at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
   at org.apache.tools.ant.Main.runBuild(Main.java:668)
   at org.apache.tools.ant.Main.startAnt(Main.java:187)
   at org.apache.tools.ant.Main.start(Main.java:150)
   at org.apache.tools.ant.Main.main(Main.java:240)
Caused by: gnu.classpath.tools.rmic.CompilationError: newClient, defined in
javax.management.remote.rmi.RMIServer, does not throw java.rmi.RemoteException
   at
gnu.classpath.tools.rmic.SourceGiopRmicCompiler.compile(SourceGiopRmicCompiler.java:302)
   at
gnu.classpath.tools.rmic.SourceGiopRmicCompiler.run(SourceGiopRmicCompiler.java:661)
   at gnu.classpath.tools.rmic.Main.run(Main.java:259)
   at gnu.classpath.tools.rmic.Main.main(Main.java:272)
   at sun.rmi.rmic.Main.compile(Main.java:51)
   at java.lang.reflect.Method.invoke(libgcj.so.71)
   ...23 more

The remote interface in question, RMIServer, has the following definition:

public interface RMIServer extends Remote
{
   public String getVersion() throws RemoteException;

   public RMIConnection newClient(Object credentials) throws IOException,
SecurityException;
}

Note that newClient throws IOException, a superclass of RemoteException.

The bug seems to be in gcj's SourceGiopRmicCompiler.compile() method [3]:

        Class c = (Class) iter.next();
        Method[] m = c.getMethods();

        // Check if throws RemoteException.
        for (int i = 0; i < m.length; i++)
          {
            Class[] exc = m[i].getExceptionTypes();
            boolean remEx = false;

            for (int j = 0; j < exc.length; j++)
              {
                if (RemoteException.class.isAssignableFrom(exc[j]))
                  {
                    remEx = true;
                    break;
                  }
              }
            if (! remEx && !force)
              throw new CompilationError(m[i].getName() + ", defined in "
                                         + c.getName()
                                         + ", does not throw "
                                         + RemoteException.class.getName());
            AbstractMethodGenerator mm = createMethodGenerator(m[i]);
            methods.add(mm);
          }

This code checks that the declared exception exc[j] is a _subclass_ of
RemoteException, when it seems that it should do exactly the opposite!

[1] http://mx4j.sourceforge.net/
[2] http://java.sun.com/j2se/1.5.0/docs/guide/rmi/hello/hello-world.html
[3]
http://gcc.gnu.org/viewcvs/trunk/libjava/classpath/tools/gnu/classpath/tools/rmic/SourceGiopRmicCompiler.java?revision=120621&view=markup


-- 
           Summary: rmic fails if remote method throws superclass of
                    RemoteException
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libgcj
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: marcus at better dot se


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32198


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug libgcj/32198] rmic fails if remote method throws superclass of RemoteException
  2007-06-03 20:30 [Bug libgcj/32198] New: rmic fails if remote method throws superclass of RemoteException marcus at better dot se
@ 2008-06-19  7:55 ` jerico dot dev at gmail dot com
  2008-06-19 15:27 ` tromey at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: jerico dot dev at gmail dot com @ 2008-06-19  7:55 UTC (permalink / raw)
  To: java-prs



------- Comment #1 from jerico dot dev at gmail dot com  2008-06-19 07:55 -------
I have got the same problem when trying to produce stubs for JBoss AS. Works
fine with SUN, grmic throws the an exception however (see [2]). To reproduce
download JBoss AS 4.2.2-GA source tarball from [1], compile it from source
(using build/build.sh) and then try to generate stubs from
server/output/classes/org/jboss/invocation/jrmp/server/JRMPInvoker.class

[1]
http://sourceforge.net/project/showfiles.php?group_id=22866&package_id=16942&release_id=548923

[2] rmic -classpath $LOCALCLASSPATH:server/classes/ -d stubs/ -keepgenerated
-v1.2 -verbose -g org.jboss.invocation.jrmp.server.JRMPInvoker
[Processing class org.jboss.invocation.jrmp.server.JRMPInvoker.class]
[analyze class org.jboss.invocation.jrmp.server.JRMPInvoker]
[implements org.jboss.invocation.Invoker]
[implements java.rmi.Remote]
[Generating class org.jboss.invocation.jrmp.server.JRMPInvoker_Stub]
Package org.jboss.invocation.jrmp.server, name JRMPInvoker impl JRMPInvoker
Exception in thread "main" gnu.classpath.tools.rmic.CompilationError: invoke,
defined in org.jboss.invocation.Invoker, does not throw
java.rmi.RemoteException
   at
gnu.classpath.tools.rmic.SourceGiopRmicCompiler.compile(libgcj-tools.so.81)
   at gnu.classpath.tools.rmic.SourceGiopRmicCompiler.run(libgcj-tools.so.81)
   at gnu.classpath.tools.rmic.Main.run(libgcj-tools.so.81)
   at gnu.classpath.tools.rmic.Main.main(libgcj-tools.so.81)


-- 

jerico dot dev at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jerico dot dev at gmail dot
                   |                            |com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32198


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug libgcj/32198] rmic fails if remote method throws superclass of RemoteException
  2007-06-03 20:30 [Bug libgcj/32198] New: rmic fails if remote method throws superclass of RemoteException marcus at better dot se
  2008-06-19  7:55 ` [Bug libgcj/32198] " jerico dot dev at gmail dot com
@ 2008-06-19 15:27 ` tromey at gcc dot gnu dot org
  2008-06-24 17:36 ` cvs-commit at developer dot classpath dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: tromey at gcc dot gnu dot org @ 2008-06-19 15:27 UTC (permalink / raw)
  To: java-prs



------- Comment #2 from tromey at gcc dot gnu dot org  2008-06-19 15:27 -------
Confirmed; I think the analysis is correct here.


-- 

tromey at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2008-06-19 15:27:55
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32198


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug libgcj/32198] rmic fails if remote method throws superclass of RemoteException
  2007-06-03 20:30 [Bug libgcj/32198] New: rmic fails if remote method throws superclass of RemoteException marcus at better dot se
  2008-06-19  7:55 ` [Bug libgcj/32198] " jerico dot dev at gmail dot com
  2008-06-19 15:27 ` tromey at gcc dot gnu dot org
@ 2008-06-24 17:36 ` cvs-commit at developer dot classpath dot org
  2008-06-24 18:32 ` tromey at gcc dot gnu dot org
  2008-06-24 18:32 ` tromey at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at developer dot classpath dot org @ 2008-06-24 17:36 UTC (permalink / raw)
  To: java-prs



------- Comment #3 from cvs-commit at developer dot classpath dot org  2008-06-24 17:36 -------
Subject: Bug 32198

CVSROOT:        /cvsroot/classpath
Module name:    classpath
Changes by:     Tom Tromey <tromey>     08/06/24 17:36:07

Modified files:
        .              : ChangeLog 
        tools/gnu/classpath/tools/rmic: SourceGiopRmicCompiler.java 

Log message:
                PR libgcj/32198:
                * tools/gnu/classpath/tools/rmic/SourceGiopRmicCompiler.java
                (compile): Reverse isAssignableFrom test.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpath&r1=1.9660&r2=1.9661
http://cvs.savannah.gnu.org/viewcvs/classpath/tools/gnu/classpath/tools/rmic/SourceGiopRmicCompiler.java?cvsroot=classpath&r1=1.2&r2=1.3


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32198


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug libgcj/32198] rmic fails if remote method throws superclass of RemoteException
  2007-06-03 20:30 [Bug libgcj/32198] New: rmic fails if remote method throws superclass of RemoteException marcus at better dot se
                   ` (3 preceding siblings ...)
  2008-06-24 18:32 ` tromey at gcc dot gnu dot org
@ 2008-06-24 18:32 ` tromey at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: tromey at gcc dot gnu dot org @ 2008-06-24 18:32 UTC (permalink / raw)
  To: java-prs



------- Comment #4 from tromey at gcc dot gnu dot org  2008-06-24 18:32 -------
Fix checked in.


-- 

tromey at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.4.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32198


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug libgcj/32198] rmic fails if remote method throws superclass of RemoteException
  2007-06-03 20:30 [Bug libgcj/32198] New: rmic fails if remote method throws superclass of RemoteException marcus at better dot se
                   ` (2 preceding siblings ...)
  2008-06-24 17:36 ` cvs-commit at developer dot classpath dot org
@ 2008-06-24 18:32 ` tromey at gcc dot gnu dot org
  2008-06-24 18:32 ` tromey at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: tromey at gcc dot gnu dot org @ 2008-06-24 18:32 UTC (permalink / raw)
  To: java-prs



------- Comment #5 from tromey at gcc dot gnu dot org  2008-06-24 18:32 -------
Subject: Bug 32198

Author: tromey
Date: Tue Jun 24 18:31:49 2008
New Revision: 137084

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=137084
Log:
        PR libgcj/32198:
        * tools/gnu/classpath/tools/rmic/SourceGiopRmicCompiler.java
        (compile): Reverse isAssignableFrom test.
        * tools/gnu/classpath/tools/rmic/SourceGiopRmicCompiler.class:
        Rebuilt.

Modified:
    trunk/libjava/classpath/ChangeLog.gcj
   
trunk/libjava/classpath/tools/classes/gnu/classpath/tools/rmic/SourceGiopRmicCompiler.class
   
trunk/libjava/classpath/tools/gnu/classpath/tools/rmic/SourceGiopRmicCompiler.java


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32198


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-06-24 18:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-06-03 20:30 [Bug libgcj/32198] New: rmic fails if remote method throws superclass of RemoteException marcus at better dot se
2008-06-19  7:55 ` [Bug libgcj/32198] " jerico dot dev at gmail dot com
2008-06-19 15:27 ` tromey at gcc dot gnu dot org
2008-06-24 17:36 ` cvs-commit at developer dot classpath dot org
2008-06-24 18:32 ` tromey at gcc dot gnu dot org
2008-06-24 18:32 ` tromey at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).