On 11/05/2012 06:22 AM, Vladimir Tsichevski wrote:
Hi all,
I'm trying to generate an annotated Java class:
(define-alias XmlAccessType javax.xml.bind.annotation.XmlAccessType)
(define-alias XmlAccessorType javax.xml.bind.annotation.XmlAccessorType)
(define-simple-class <Test> ()
(@XmlAccessorType value: XmlAccessType:FIELD)
)
;; (compile-file "scratch.scm" "out.zip")
where XmlAccessType is enum:
public enum XmlAccessType {
PROPERTY,
FIELD,
PUBLIC_MEMBER,
NONE
}
This results in a broken Java class "Test".
Broken how?
The class Test is not a stand-alone class - it is not a
"module class" The module class (by default) is a class
that matches the name of the source file scratch.scm
- i.e. scratch.class. Things might work better if you
rename scratch.scm to Test.scm so they match.
You might want to (re-)read:
http://www.gnu.org/software/kawa/Module-classes.html
This is a source of confusion and a semi-frequently asked question.
It might be worthwhile for the Kawa compiler to emit some extra
code in Test.class's static initializer so it forces initialization
of tyhe module class scratch.class first.