jakarta-bsf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rony G. Flatscher" <Rony.Flatsc...@wu-wien.ac.at>
Subject Re: Planned changes on 'EngineUtils.java'
Date Sat, 11 Jun 2005 12:53:43 GMT
Hi Victor,

... cut ...

>Code doesn't match comment - unless I'm mistaken, checking instanceof Byte won't cover
the other numeric types (or a custom subclass of Number).
Righ, it's the old comment, I left it in there for the review (the 
assumption of the comment didn't work).

>>+	      if      (args[i] instanceof Byte)    argTypes[i] = byte.class;
>>+                    // 2005-06-08, rgf, *must* be given, or signatures not found!
>>+              else if (args[i] instanceof Short  ) argTypes[i] = short.class;
>>+              else if (args[i] instanceof Integer) argTypes[i] = int.class;
>>+              else if (args[i] instanceof Long)    argTypes[i] = long.class;
>>+	      else if (args[i] instanceof Float)   argTypes[i] = float.class;
>>+	      else if (args[i] instanceof Double ) argTypes[i] = double.class;
>>+	    }
>>+            else if (args[i] instanceof Boolean)   argTypes[i] = boolean.class;
>>+            // ---rgf, handle also the case of "Character"
>>+            else if (args[i] instanceof Character) argTypes[i] = char.class;
>OK - I can buy this - except: what about BigDecimal and BigInteger, and what's the default
case (which would handle a custom subclass of Number)?
Well, the strategy here seems to be: if a method with the supplied 
signature is not found, then "unbox" the primitive datatypes and try 
whether a method signature exists for them. For that reason it would not 
be necessary to worry about BigDecimal et.al.: if a programmer uses 
them, he would be able to get the appropriate primitive datatype 
renderings off them, which then allows for seeking a method using the 
primitive datatype signatures in the above section.

>>+      catch (Exception e3)                   // 2003-02-23, --rgf, maybe an IllegalAccessException?
>Just stylistic pedantry: why e3?
Well, probably was a little bit depressed while working on that part of 
the code...

Seriously, no specific reason other than serving as an eye-catcher to 
point to an area where I changed something and wanted others to become 
aware of it (to double-check).

>Otherwise, I'm happy.
Fine. Thank you very much for your efforts!



  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message