Changeset 13394
- Timestamp:
- 07/11/11 13:57:21 (12 years ago)
- Location:
- trunk/abcl/contrib/jss
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abcl/contrib/jss/README.markdown
r13363 r13394 30 30 class. In your call to new, as long as the symbol can refer to only 31 31 one class, we use that class. In this case, it is 32 java.io.StringWriter. You could also have written (new 33 'io.stringwriter), (new '|io.StringWriter|), (new 34 'java.io.StringWriter)... 32 java.io.StringWriter. You could also have written 35 33 36 the call (#"write" sw "Hello "), uses the code in invoke.java to 37 call the method named "write" with the arguments sw and "Hello ". 38 JSS figures out the right java method to call, and calls it. 34 (new 'io.stringwriter) 35 36 or 37 (new '|io.StringWriter|) 38 39 or 40 (new 'java.io.StringWriter) 41 42 The call 43 44 (#"write" sw "Hello ") 45 46 uses the code in invoke.java to call the method named "write" with 47 the arguments sw and "Hello ". JSS figures out the right java method 48 to call, and calls it. 49 50 Static calls are possible as well with the #" macro, but the 51 first argument MUST BE A SYMBOL to distinguish 52 53 (#"getProperties" "java.lang.System") 54 55 from 56 57 (#"getProperties" 'java.lang.System) 58 59 The first attempts to call a method on the java.lang.String object 60 with the contents "java.lang.System", which results in an error, while 61 the second invokes the static java.lang.System.getProperties() method. 39 62 40 63 If you want to do a raw java call, use #0"toString". Raw calls … … 42 65 object to Lisp object conversions that ABCL does. 43 66 44 (with-constant-signature ((name jname raw?)*) &body body) 67 68 (with-constant-signature ((name jname raw?)*) &body body) 69 45 70 binds a macro which expands to a jcall, promising that the same method 46 71 will be called every time. Use this if you are making a lot of calls and 47 72 want to avoid the overhead of a the dynamic dispatch. 48 e.g. (with-constant-signature ((tostring "toString")) 73 e.g. 74 75 (with-constant-signature ((tostring "toString")) 49 76 (time (dotimes (i 10000) (tostring "foo")))) 50 runs about 3x faster than (time (dotimes (i 10000) (#"toString" "foo")))51 77 52 (with-constant-signature ((tostring "toString" t)) ...) will cause the 53 toString to be a raw java call. see get-all-jar-classnames below for 54 an example. 78 runs about three times faster than 79 80 (time (dotimes (i 10000) (#"toString" "foo"))) 81 82 83 (with-constant-signature ((tostring "toString" t)) ...) 84 85 will cause the toString to be a raw java call. See 86 JSS::GET-ALL-JAR-CLASSNAMES for an example. 55 87 56 88 Implementation is that the first time the function is called, the … … 62 94 63 95 (jcmn class-name) lists the names of all methods for the class 96 97 98 Compatibility 99 ------------- 100 101 The function ENSURE-COMPATIBILITY attempts to provide a compatibility 102 mode to existing users of JSS by importing the necessary symbols into 103 CL-USER. 104 105 Some notes on other compatibilty issues: 106 107 *classpath-manager* 108 109 Since we are no longer using Beanshell, this is no longer present. 110 For obtaining the current classloader use JAVA:*CLASSLOADER*. 111 -
trunk/abcl/contrib/jss/asdf-jar.lisp
r13281 r13394 25 25 (defmethod perform ((operation load-op) (c jar-file)) 26 26 (or jss:*inhibit-add-to-classpath* 27 (jss: :add-to-classpath (component-pathname c))))27 (jss:add-to-classpath (component-pathname c)))) 28 28 29 29 (defmethod operation-done-p ((operation load-op) (c jar-file)) 30 t31 #+nil32 30 (or jss:*inhibit-add-to-classpath* 33 31 (member (namestring (truename (component-pathname c))) jss:*added-to-classpath* :test 'equal))) -
trunk/abcl/contrib/jss/jss.asd
r13360 r13394 4 4 (defsystem :jss 5 5 :author "Alan Ruttenberg, Mark Evenson" 6 :version "2. 0.1"6 :version "2.1.0" 7 7 :components 8 8 ((:module base :pathname "" :serial t -
trunk/abcl/contrib/jss/packages.lisp
r13363 r13394 17 17 #:jcmn 18 18 #:japropos 19 #:new 19 20 20 21 ;;; Useful utilities to convert common Java items to Lisp counterparts … … 26 27 27 28 ;;; deprecated 28 #:new ; use JAVA:NEW 29 29 30 #:get-java-field ; use JAVA:JFIELD 30 31
Note: See TracChangeset
for help on using the changeset viewer.