Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Two Questions: JSpinner and datatype

Reply
Thread Tools

Two Questions: JSpinner and datatype

 
 
Lew
Guest
Posts: n/a
 
      05-18-2010
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.
The text explains what they mean there, so the rules are clear though the
syntax diagram not be.

--
Lew
 
Reply With Quote
 
 
 
 
John B. Matthews
Guest
Posts: n/a
 
      05-20-2010
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>
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
database datatype bit what is the C# datatype? Jeff ASP .Net 2 04-16-2007 08:26 PM
JSpinner does not display data yingjian.ma1955@gmail.com Java 2 07-13-2006 06:16 PM
Color of JSpinner Timo Geissberger Java 0 05-08-2005 01:11 AM
JSpinner & unlimited max value Mike Mimic Java 4 01-08-2004 11:37 AM
JSpinner with Herbert Eberhart Java 0 10-13-2003 09:50 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57