WIN-28: fix POSIX file descriptor numbering assumptions

Adam Megacz patches@lists.megacz.com
Sat Mar 2 17:40:00 GMT 2002


Bryce McKinlay <bryce@waitaki.otago.ac.nz> writes:
> > I tried this -- unfortunately java.lang.System's <clinit> runs first,
> > and it read the not-yet-initialized values out of
> > FileDescriptor.{in|out|err} and crash trying to build a 'new
> > PrintStream(null)'.

> Huh? This can't happen. The language guarantees that a class is 
> initialized before accessing its static fields.

Yes, I'm aware of this.


> > If you initialize to 'new FileDescriptor(getFdFOO())', the compiler
> > figures out that it has to execute that code before it lets
> > System.java access the variable. I don't know why this happens.

> The compiler must execute all static initializer code before accessing a 
> static field from a class. If it doesn't then there is a compiler bug.

Well, I'm hesitant to make wild accusations (since when I do this I'm
almost always wrong), but I think we're facing a compiler bug.

I'll post a patch that uses a static native 'init' method, and confirm
once again that it segfaults. If so, I'll file a PR on it.

  - a


-- 
"If I put copyrighted material into the 'chewy nougat center', I can
 claim the crunchy chocolate coating is an 'Access Control
 Mechanism'."                                     --lynx_user_abroad

Why Windows NT/2k/XP is unreliable: www.zappadoodle.com



More information about the Java-patches mailing list