This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: java/6754: Casting to gnu.gcj.RawData causes SEGV
- From: Bryce McKinlay <bryce at waitaki dot otago dot ac dot nz>
- To: Adam Megacz <gcj at lists dot megacz dot com>
- Cc: java at gcc dot gnu dot org
- Date: Tue, 21 May 2002 14:25:14 +1200
- Subject: Re: java/6754: Casting to gnu.gcj.RawData causes SEGV
- References: <86wutyb951.fsf@megacz.com>
Adam Megacz wrote:
>Here's the test case; it's logged in the PR as well:
>
> - a
>
>
>
>import java.io.*;
>import gnu.gcj.RawData;
>
>public class test {
>
> public static native RawData foo();
>
> public static RawData bar(Object o) {
> return (RawData)o;
> }
>
> public static void main(String[] s) throws Exception {
> bar(foo());
> }
>
>
This isn't a bug. It isn't really safe to do anything with non-Java
objects in Java code, you certainly can't cast one.
RawData is just a hack to let you store non-Java data, which you don't
want scanned by the GC, in a Java object. You probibly shouldn't
actually use "RawData" in Java source for anything other than field
declarations.
regards
Bryce.