This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: java/6754: Casting to gnu.gcj.RawData causes SEGV


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.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]