This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
Re: Using <java.lang.Class>:forName with define-simple-class
- From: alex mitchell <alexm at nus dot edu dot sg>
- To: "kawa at sourceware dot org" <kawa at sourceware dot org>
- Date: Fri, 07 May 2010 16:35:47 +0800
- Subject: Re: Using <java.lang.Class>:forName with define-simple-class
Sorry, when I said "implement" below, I meant "extend"...
com.apple.eawt.ApplicationAdapter is a class, not an interface.
On 5/7/10 4:31 PM, "alex mitchell" <lexaay@gmail.com> wrote:
> I'm trying to get a kawa-based application to be aware of MacOS application
> events such as Apple-Q, and would like to avoid having to change my source
> code when compiling on other platforms. I've got this working except for one
> problem. When I define a class implementing ApplicationAdapter as follows:
>
> (define-simple-class <my-application-adapter>
> (<com.apple.eawt.ApplicationAdapter>)
> ...)
>
> everything works fine on a Mac, but I'm assuming I won't be able to compile
> this on non-Mac platforms, since com.apple.eawt.ApplicationAdapter won't be
> there. Instead, I've tried this:
>
> (define-simple-class <my-application-adapter> ((<java.lang.Class>:forName
> "com.apple.eawt.ApplicationAdapter"))
> ...)
>
> However, I get an "invalid super type" compile-time error.
>
> I would like to be able to implement com.apple.eawt.ApplicationAdapter at
> runtime. For now I'm commenting out the line where the file containing this
> code is required when I compile, but this is not ideal.
>
> Anyone have any suggestions as to how to do this?
>
> thanks,
> Alex
>
>