define-simple-class + non-default constructor = invalid Java class created
Per Bothner
per@bothner.com
Tue Nov 6 00:53:00 GMT 2012
On 11/05/2012 01:38 PM, Vladimir Tsichevski wrote:
> Hi,
>
> compiling this [define-simple-class with non-default constructor]
> ...
> results in the class with bad non-default constructor (output created
> with jd-decompiler):
>
> public class Test
> {
> private Long id;
> private String firstName;
>
> public Test(Long arg1, String arg2)
> {
> String fn;
> this.id = nid;
> this.firstName = fn;
> }
> }
I'm a bit confused. This output suggests you compiled Test
*not* in Test.scm, hence a separate module-class. When I do that,
the generated bytecode looks fine to me. I haven't tried
jd-decompiler since I couldn't see a simple way to download it
(as a standalone command-line application).
I would guess a limitation/bug in jd-decompiler. Note it is
not a goal of Kawa to produce bytecode than can be easily decompiled.
(It is not a goal to do the opposite either.)
When I compile with the source in file Test.scm, I get a Kawa compiler
crash. Ooops. I checked in a fix for that crash. If after you still have
problems, send me the output from gnu.bytecode.dump on Test.class.
--
--Per Bothner
per@bothner.com http://per.bothner.com/
More information about the Kawa
mailing list