[Clirr-devel] Java doesn't appear to do runtime checks for class/method access rights
Status: Alpha
Brought to you by:
lkuehne
From: Simon K. <si...@ec...> - 2004-07-05 07:39:39
|
Hi Lars, Could you please check that I haven't gone completely mad? Attached is an archive which contains some java code that appears to demonstrate that the Java JVM/runtime does not check for class or method access rights. Try: * cd v1; javac Foo.java * cd v2; javac Foo.java * cd .. * cp v1/Foo.class pkg * javac Main.java * java Main --> so far, all as expected. But now: * cp v2/Foo.class pkg * java Main --> the main class successfully invokes a private method on the package-scope Foo class! The java lang spec document seems clear that this *should* throw an IllegalAccessError, but it doesn't. I would like someone to confirm that I am not having hallucinations here before I add a note about this to the message description document. I've tried this with: * sun java 1.3 on AIX * sun java 1.4 on linux * sun java 1.5 on linux * IBM java 1.4 on AIX * IBM java 1.4 on linux and they all give the same result. Regards, Simon |