PR141

Andrew Haley aph@cygnus.co.uk
Thu Aug 24 04:13:00 GMT 2000


Tom Tromey writes:
 > Andrew> This testuite failure has been bugging me for a long time.
 > Andrew> Anyway, here's a fix that is compatible with JDK: a
 > Andrew> StreamTokenizer shouldn't throw an exception.
 > 
 > This is an interesting one. My reading is that `.' shouldn't be
 > treated as a number and that this is actually a bug in the JDK.
I don't think so. If you look at the spec, it says that "if a numeric
character is encountered, then an attempt is made to recognize a
number. If the first character is a '-' [ ... ] otherwise a number is
parsed, stopping before the next occurence of '.', the first
nonnumeric character encountered or EOF."
In which case, a '.' *is* recognized as a number by the parser, and
the JDK does what the spec says it must.
 > I just tried the stream tokenizer test with `-.'. The JDK gives me
 > `-0.0'. Even with this patch we'll still get `0.0', which is "wrong"
 > by either definition.
I will submit a revised patch. Minus zero, indeed! :-)
Andrew.


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /