On Fri, Oct 8, 2010 at 2:58 PM, Jochen Theodorou <[email protected]> wrote:
> Alessio Stalla wrote:
> [...]
>>
>> I interpret that to mean that two classes at runtime are considered to
>> be in the same package if and only if they have the same package name
>> and they've been loaded by the very same classloader.
>>
>> So, that might be the problem. Maybe with JUnit you get two classloaders
>> too.
>
> ok, but shouldn't the error then happen whenever I have a CHECKCAST, because
> the class loading for this does not work? But I already produced a variant
> containing he CHECKCAST and not giving the IllegalAccessError.

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.

Cheers,
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