[armedbear-devel] Longs, Bytes, or casting in general

Theam Yong Chew senatorzergling at gmail.com
Tue Jul 17 02:19:40 UTC 2012


Hi folks,

I was wondering how we can conveniently pass longs, bytes into normal
Java functions/constructors, for example,

(jnew "java.lang.Byte" 23)
==>
Java exception 'java.lang.NoSuchMethodException: Byte(java.lang.Integer)'.
   [Condition of type JAVA-EXCEPTION]

Here only constructor available is for "byte" inputs. It's a pain to
have to use this every time we use a byte, long, or similar:

(jnew (jconstructor "java.lang.Byte" "byte") 23)
#<java.lang.Byte 23 {3A9300BF}>

Relatedly/alternatively, is there a way convenient to coerce values to
a certain type, forcing 23 above (default int/Integer) to be a byte or
long?

Yong




More information about the armedbear-devel mailing list