From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5870 invoked by alias); 31 Oct 2002 17:26:01 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 5839 invoked by uid 71); 31 Oct 2002 17:26:01 -0000 Resent-Date: 31 Oct 2002 17:26:01 -0000 Resent-Message-ID: <20021031172601.5838.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org, java-prs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, Anthony Green Received: (qmail 1907 invoked from network); 31 Oct 2002 17:24:50 -0000 Received: from unknown (HELO build.tokyo.redhat.com) (219.96.218.186) by sources.redhat.com with SMTP; 31 Oct 2002 17:24:50 -0000 Received: from build.tokyo.redhat.com (localhost.localdomain [127.0.0.1]) by build.tokyo.redhat.com (8.12.5/8.12.5) with ESMTP id g9VHSwWD000460 for ; Fri, 1 Nov 2002 02:28:58 +0900 Received: (from green@localhost) by build.tokyo.redhat.com (8.12.5/8.12.5/Submit) id g9VHSw1T000458; Fri, 1 Nov 2002 02:28:58 +0900 Message-Id: <200210311728.g9VHSw1T000458@build.tokyo.redhat.com> Date: Thu, 31 Oct 2002 09:26:00 -0000 From: Anthony Green To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version: 3.113 Subject: java/8415: reflection bug: exception info for Method X-SW-Source: 2002-10/txt/msg01341.txt.bz2 List-Id: >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: