On Fri, Oct 8, 2010 at 3:47 PM, Jochen Theodorou <[email protected]> wrote:
> Alessio Stalla wrote:
> [...]
>>
>> I'm not an expert about that. Generally linking is done very lazily by
>> the JVM, so it might not occur if you CHECKCAST a null pointer. When
>> instead you have a live object, a CHECKCAST might count as an access
>> to the referenced class and trigger the illegal access error. I'm
>> guessing, mind you; let's see if someone who knows the JVM better has
>> something different to say.
>
> but why is the access illegal? The class might be package private, but the
> calling class is in the same package and thus allowed to access that class.
> If not the Java version of it would not even compile.

As I said at runtime "same package" means "same package name" AND
"same classloader" or at least this is my interpretation of the jvm
spec, so if you have two different classloaders loading your two
classes like you said, they're not considered to be in the same
package. In the Java version evidently there's only one classloader
involved.

Alessio

-- 
You received this message because you are subscribed to the Google Groups "JVM 
Languages" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/jvm-languages?hl=en.

Reply via email to