This is the mail archive of the kawa@sources.redhat.com mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: What is the use of (require <xyz>) and explicit type declarations?


Hoehle, Joerg-Cyril wrote:
What is the use of a require "statement" w.r.t. file-compilation?

I get the exact same warnings whether (require ...KeyStore> is present or not.

;;(require <java.security.KeyStore>)
(define keystore ;;:: <java.security.KeyStore>
  (invoke-static <java.security.KeyStore> 'getInstance "JKS"))
(invoke keystore 'load
	(make <java.io.FileInputStream> "Keys.jks")
	thepasswd)
(define thepubcert ;;:: <java.security.cert.X509Certificate>
  (invoke keystore 'getCertificate "A"))

re-sign.scm:66:2: warning - no method `load' in java.lang.Object
re-sign.scm:74:4: warning - no method `getCertificate' in java.lang.Object

If you don't use the type define with, then the compiler can't know what type (class) the location might contain so it must assume it may be any object and the method is dispatched via reflection when it is executed.


I only get those warnings when the type in the define is commented out (as you show in your post). If I change it to:

(define keystore :: <java.security.KeyStore>

then it compiles without warnings.

This is the same with CVS and the 1.7 release binary.

Jim
--
"I love deadlines. I love the whooshing sound they make as they fly by." -- Douglas Adams



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]