public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: java/8415: reflection bug: exception info for Method
@ 2002-11-01 12:56 Tom Tromey
  0 siblings, 0 replies; 3+ messages in thread
From: Tom Tromey @ 2002-11-01 12:56 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR java/8415; it has been noted by GNATS.

From: Tom Tromey <tromey@redhat.com>
To: Anthony Green <green@build.tokyo.redhat.com>
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: java/8415: reflection bug: exception info for Method
Date: 01 Nov 2002 14:42:16 -0700

 Anthony> I don't have a simple test case prepared.
 
 I wrote one.  I'll check it in.
 
 Anthony> This work-around seems useful for now.  Another fix would be
 Anthony> to change the format of the meta-data emitted by the
 Anthony> compiler.
 
 I prefer the latter.  I have a patch that I'm testing.
 
 Tom


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

* Re: java/8415: reflection bug: exception info for Method
@ 2002-11-02 13:34 tromey
  0 siblings, 0 replies; 3+ messages in thread
From: tromey @ 2002-11-02 13:34 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, green, java-prs, nobody, tromey

Synopsis: reflection bug: exception info for Method

Responsible-Changed-From-To: unassigned->tromey
Responsible-Changed-By: tromey
Responsible-Changed-When: Sat Nov  2 13:34:27 2002
Responsible-Changed-Why:
    I'm handling this
State-Changed-From-To: open->closed
State-Changed-By: tromey
State-Changed-When: Sat Nov  2 13:34:27 2002
State-Changed-Why:
    I've checked in the fix

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8415


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

* java/8415: reflection bug: exception info for Method
@ 2002-10-31  9:26 Anthony Green
  0 siblings, 0 replies; 3+ messages in thread
From: Anthony Green @ 2002-10-31  9:26 UTC (permalink / raw)
  To: gcc-gnats


>Number:         8415
>Category:       java
>Synopsis:       reflection bug: exception info for Method
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Oct 31 09:26:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Anthony Green
>Release:        3.3 20021031 (experimental)
>Organization:
>Environment:
System: Linux build.tokyo.redhat.com 2.4.18-14smp #1 SMP Wed Sep 4 12:34:47 EDT 2002 i686 i686 i386 GNU/Linux
Architecture: i686

	
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../../FSF/GCC/HEAD/gcc/configure --prefix=/home/green/latest/i --enable-threads --enable-languages=c,c++,java : (reconfigured) 
>Description:

	libgcj doesn't build proper reflection data for interpreted
classes.  The problem is that the format of the names of the exception
classes differs between native and interpreted code.  For native code
we get "LMyException;", and for interpreted code we get "MyException".
libgcj is written to expect "LMyException;".  What you end up with in
Method is a Class[] filled with null instead of a proper array of
exception classes.

>How-To-Repeat:
	I don't have a simple test case prepared.  However, all you 
need to do to trigger this is call Method.toString() on a Method
of an interpreted class which throws an exception.
>Fix:

This work-around seems useful for now.   Another fix would be to 
change the format of the meta-data emitted by the compiler.

Index: java/lang/reflect/natMethod.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/lang/reflect/natMethod.cc,v
retrieving revision 1.29
diff -2 -c -p -r1.29 natMethod.cc
*** java/lang/reflect/natMethod.cc	27 Aug 2002 23:57:17 -0000	1.29
--- java/lang/reflect/natMethod.cc	31 Oct 2002 17:16:00 -0000
*************** java::lang::reflect::Method::getType ()
*** 208,213 ****
    jclass *elts = elements (exception_types);
    for (int i = 0; i < count; ++i)
!     elts[i] = _Jv_FindClassFromSignature (method->throws[i]->data,
! 					  declaringClass->getClassLoader ());
  }
  
--- 208,228 ----
    jclass *elts = elements (exception_types);
    for (int i = 0; i < count; ++i)
!     {
!       char *c = (char *) method->throws[i]->data;
!       int len = strlen (c);
!       if (c[0] != 'L' && c[len-1] != ';')
! 	{
! 	  char name[len+3];
! 	  name[0] = 'L';
! 	  strcpy (&name[1], c);
! 	  name[len+1] = ';';
! 	  name[len+2] = 0;
! 	  elts[i] = _Jv_FindClassFromSignature (name,
! 						declaringClass->getClassLoader ());
! 	}
!       else
! 	elts[i] = _Jv_FindClassFromSignature (method->throws[i]->data,
! 					      declaringClass->getClassLoader ());
!     }
  }
  

>Release-Note:
>Audit-Trail:
>Unformatted:


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

end of thread, other threads:[~2002-11-02 21:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-11-01 12:56 java/8415: reflection bug: exception info for Method Tom Tromey
  -- strict thread matches above, loose matches on Subject: below --
2002-11-02 13:34 tromey
2002-10-31  9:26 Anthony Green

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).