This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
Illegal Access in module class?
- From: tarka at internode dot on dot net (Steve Smith)
- To: kawa at sources dot redhat dot com
- Date: Tue, 29 Aug 2006 10:53:21 +1000
- Subject: Illegal Access in module class?
Hi,
I'm trying to push on with using Kawa as a plugin language for web
apps. However I'm seeing IllegalAccess errors when doing runtime
string casts. My class looks like this:
(module-name 'au.com.isay.confluence.plugins.torrent)
(define-namespace AttachmentManager
<com.atlassian.confluence.pages.AttachmentManager>)
(define-simple-class <au.com.isay.confluence.plugins.torrent.TorrentMacro>
(<com.atlassian.renderer.v2.macro.BaseMacro>)
;; Macro interface implementations
((isInline) :: <boolean> #f)
((hasBody) :: <boolean> #f)
;; Spring autowired
(amgr :: AttachmentManager :access 'private)
((setAttachmentManager (mgr :: AttachmentManager))
(set! amgr mgr))
((execute (params :: <java.util.Map>)
(body :: <java.lang.String>)
(ctx :: <com.atlassian.renderer.RenderContext>))
:: <java.lang.String>
((<org.apache.log4j.Category>:getInstance "MyClass"):warn "Doing Execute")
(<java.lang.String>:new "Test Output"))
)
This loads fine in the application, however when execute is invoked I
get the exception:
java.lang.IllegalAccessError: tried to access field
au.com.isay.confluence.plugins.torrent.Lit0 from class
au.com.isay.confluence.plugins.torrent.TorrentMacro
The javap output for these classes is:
Compiled from "confluence-classes.scm"
public class au.com.isay.confluence.plugins.torrent.TorrentMacro extends com.atlassian.renderer.v2.macro.BaseMacro{
public com.atlassian.renderer.v2.RenderMode bodyRenderMode;
public boolean isInline();
public boolean hasBody();
public void setAttachmentManager(com.atlassian.confluence.pages.AttachmentManager);
public java.lang.String execute(java.util.Map, java.lang.String, com.atlassian.renderer.RenderContext);
public au.com.isay.confluence.plugins.torrent.TorrentMacro();
public com.atlassian.renderer.v2.RenderMode getBodyRenderMode();
}
Compiled from "confluence-classes.scm"
public class au.com.isay.confluence.plugins.torrent extends gnu.expr.ModuleBody implements java.lang.Runnable{
static final gnu.mapping.Location loc$$Lscom$Dtatlassian$Dtconfluence$Dtpages$DtAttachmentManager$Gr;
static final gnu.mapping.Location loc$$Lsjava$Dtlang$DtString$Gr;
public static final java.lang.Object AttachmentManager;
public static final gnu.bytecode.ClassType $Lsau$Dtcom$Dtisay$Dtconfluence$Dtplugins$Dttorrent$DtTorrentMacro$Gr;
static final gnu.lists.FString Lit0;
static final gnu.mapping.Symbol Lit1;
static final gnu.mapping.Symbol Lit2;
static final gnu.bytecode.ClassType Lit3;
public au.com.isay.confluence.plugins.torrent();
public final void run(gnu.mapping.CallContext);
public static {};
public static java.lang.Class class$(java.lang.String);
}
One workaround for this issue is to explicitly initialise all the
strings as java.lang.String, but this is hardly ideal. Any tips on
what I'm doing wrong would be appreciated.
Cheers,
Steve