Roman Kennke writes:
 > Hi Ken,
 > 
 > > Let's say for example standard Java defines some constant like 
 > > FileFormat.BINARY.  The Javadoc does not specify the value of this 
 > > constant.  I want to write a replacement for FileFormat, so I write a 
 > > program
 > > 
 > > System.out.println(FileFormat.BINARY) and run it against Sun's 
 > > implementation.  I find out that the value is 1, and I put that in my 
 > > implementation.
 > > 
 > > Is this legit for the purposes of contribuing to classpath?
 > 
 > First of all, if a constant is not in the JavaDoc, it is most likely
 > initialized with a value that may differ in different environments

No, that's simply impossible.  If a constant is part of a public
interface it must _not_ change between platforms that support that
public interface.  This is because the compiler inlines the values of
integer constants.  It must do that because otherwise static final
fields couldn't be used in tableswitch instructions.  This is probably
a bug in the design...

Andrew.

Reply via email to