This is the mail archive of the java-discuss@sources.redhat.com 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]

Re: Finding the declaring class of a _Jv_Field


>>>>> "Mark" == Mark Wielaard <mark@klomp.org> writes:

Mark>  - Checks that the currently executing method has access to the
Mark>  referenced method or field."

Mark> But does not specify 'has access to'.

I'm sure this means access in terms of private/protected/public.

Mark> I would conclude that the description of putfield and putstatic
Mark> is not strict enough but that almost all JVMs currently
Mark> implement what it says and that the Microsoft VM is (the only)
Mark> correct JVM when it throws the IllegalAccessError.

Mark> It is interesting to know if that is indeed how one should
Mark> interpret the spec because it makes it easier to implement final
Mark> field checking in gij and it indicates that one may do some
Mark> optimalisations on final fields because they really are not
Mark> suppost to change ever.

A long time ago I did some work on java.lang.System.  I found that
some versions of the JDK (the newer ones) did in fact reassign the
final fields `in', `out', and `err'.

That is why I implemented the setIn/setOut/setErr methods the way that
I did.  ISTR that gcj wouldn't accept a direct reassignment from Java
so I did it in C++ (eww).

Before I ran these tests I had more complex machinery in System.java
(I had a private subclass of PrintStream that let you reassign the
underlying stream).  However, experimentation (and an email discussion
with Per) convinced me that this wasn't required.

It sucks that this isn't well specified.  Maybe the only thing to do
is file a bug report with Sun and hope that they respond to it
someday.

Tom

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