In article <hsv7o1$ah4$>, Lew <>
wrote:
> On 05/18/2010 06:41 PM, Roedy Green wrote:
> > Here is the code for SpinnerNumberModel.setValue
> >
> > public void setValue(Object value) {
> > if ((value == null) || !(value instanceof Number)) {
>
> It's interesting that they use a redundant check in that condition.
>
> http://java.sun.com/docs/books/jls/t...s.html#15.20.2
>
> I believe I detect an error in the JLS in that section. They refer
> to the type of the left-hand operand of the 'instanceof' operator as
> a /RelationalExpression/, which it is not. At least not as I read
> the document.
I'm puzzled. It looks like RelationalExpression in
RelationalExpression instanceof ReferenceType
refers back through ShiftExpression, AdditiveExpression,
MultiplicativeExpression, and UnaryExpression to CastExpression
via UnaryExpressionNotPlusMinus. For example,
Object i = 1;
if ((Comparable)i instanceof Number) ...
http://java.sun.com/docs/books/jls/t...ons.html#15.16
> The text explains what they mean there, so the rules are clear though
> the syntax diagram not be.
--
John B. Matthews
trashgod at gmail dot com
<http://sites.google.com/site/drjohnbmatthews>