Illegal Package-Private Accesses in 3.4

Per Bothner per@bothner.com
Tue Aug 12 00:11:00 GMT 2003


Bryce McKinlay wrote:

> In this case it probably is. But there are other places where a "GC-able 
> RawData" is needed - eg java.lang.Thread:
> 
>   // Our native data - points to an instance of struct natThread.
>   private Object data;

In this situation using a JArray<jbyte> seems a reasonable option.
There are some alignment complications, but maybe we can
encapsulate them in some standard macros:

/* Number of bytes past the start of a jbyteArray to
    get maximum alignment. */
#define JBYTE_INIT_PAD ...

data =
   JvNewByteArray(JBYTE_INIT_PAD + sizeof(struct natThread));

#define AS_NAT_THREAD(BYTE_ARR) \
   (struct natThread*) (elements(BYTE_ARR)+JBYTE_INIT_PAD)
-- 
	--Per Bothner
per@bothner.com   http://per.bothner.com/




More information about the Java-patches mailing list