public inbox for kawa@sourceware.org
 help / color / mirror / Atom feed
* define-alias NOT working
@ 2015-04-04 22:46 Alcides Flores Pineda
  2015-04-05  2:16 ` Per Bothner
  0 siblings, 1 reply; 2+ messages in thread
From: Alcides Flores Pineda @ 2015-04-04 22:46 UTC (permalink / raw)
  To: Kawa Mailing List

Hello Everybody:

I'm finally migrating to Kawa 2.0 and just found that this code:

(define-alias showMsgDlg javax.swing.JOptionPane:showMessageDialog)

(showMsgDlg #!null "Hello everybody from Kawa!")


That used to work pretty well in Kawa 1.14, is now broken..

$ java -cp kawa-2.0.1.jar kawa.repl
#|kawa:1|# (define-alias  showMsgDlg 
javax.swing.JOptionPane:showMessageDialog)
java.lang.NullPointerException
     at kawa.standard.location.rewriteApply(location.java:96)
     at kawa.standard.location.rewrite(location.java:64)
     at kawa.standard.define_alias.rewriteForm(define_alias.java:86)
     at kawa.lang.Translator.apply_rewrite(Translator.java:175)
     at kawa.lang.Translator.rewrite_pair(Translator.java:353)
     at kawa.lang.Translator.rewrite_with_position(Translator.java:1355)
     at kawa.lang.Translator.rewrite(Translator.java:735)
     at kawa.lang.Translator.rewrite(Translator.java:715)
     at kawa.lang.Translator.rewriteInBody(Translator.java:668)
     at kawa.lang.Translator.rewriteBody(Translator.java:1663)
     at kawa.lang.Translator.resolveModule(Translator.java:1844)
     at gnu.kawa.lispexpr.LispLanguage.resolve(LispLanguage.java:141)
     at gnu.expr.Compilation.process(Compilation.java:1973)
     at gnu.expr.ModuleExp.evalModule1(ModuleExp.java:240)
     at gnu.expr.ModuleExp.evalModule(ModuleExp.java:214)
     at kawa.Shell.run(Shell.java:291)
     at kawa.Shell.run(Shell.java:203)
     at kawa.Shell.run(Shell.java:184)
     at kawa.repl.main(repl.java:903)

$ java -version
java version "1.7.0_75"
OpenJDK Runtime Environment (IcedTea 2.5.4) (7u75-2.5.4-1~deb7u1)
OpenJDK Server VM (build 24.75-b04, mixed mode)

I'm getting this error consistently in compile mode and from the REPL, 
and with JDK8(Oracle) and JDK7(OpenJDK), hence my example project 
(https://github.com/alcidesfp/swing-kawa) cannot be compiled with Kawa 2.0

Any workaround or suggestion will be highly appreciated.

Greetings.
--
Alcides Flores Pineda.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: define-alias NOT working
  2015-04-04 22:46 define-alias NOT working Alcides Flores Pineda
@ 2015-04-05  2:16 ` Per Bothner
  0 siblings, 0 replies; 2+ messages in thread
From: Per Bothner @ 2015-04-05  2:16 UTC (permalink / raw)
  To: Alcides Flores Pineda, Kawa Mailing List



On 04/04/2015 03:46 PM, Alcides Flores Pineda wrote:
> (define-alias showMsgDlg javax.swing.JOptionPane:showMessageDialog)
>
> (showMsgDlg #!null "Hello everybody from Kawa!")
>
>
> That used to work pretty well in Kawa 1.14, is now broken..
>
> $ java -cp kawa-2.0.1.jar kawa.repl
> #|kawa:1|# (define-alias  showMsgDlg javax.swing.JOptionPane:showMessageDialog)
> java.lang.NullPointerException
>      at kawa.standard.location.rewriteApply(location.java:96)

I checked in a fix for this.

By the way: Kawa isn't able to resolve the call to showMsgDlg to a specific method,
so it ends up doing runtime reflection.  It would be nice to fix this,
but as an alternative you might consider using a macro:

(define-syntax showMsgDlg
   (syntax-rules ()
     ((_ . args)
      (javax.swing.JOptionPane:showMessageDialog . args))))
-- 
	--Per Bothner
per@bothner.com   http://per.bothner.com/

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-04-05  2:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-04 22:46 define-alias NOT working Alcides Flores Pineda
2015-04-05  2:16 ` Per Bothner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).