bodensx / jnaerator

Automatically exported from code.google.com/p/jnaerator
0 stars 0 forks source link

compiler error on generated code from empty struct #86

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

Define an empty struct like this:

typedef struct mystruct {
} mystruct_t;

What is the expected output? What do you see instead?

In the generated Java file implementing this struct you would expect this 
method:
protected void initFieldOrder() {
  setFieldOrder(new java.lang.String[]{});
}

Instead the method looks like this:
protected void initFieldOrder() {
  setFieldOrder(new java.lang.String[]);
}

(note the missing curly brackets after the new String[])
This generates a compiler error of course.

What version of the product are you using? On what operating system?
v0.9.7 on RHEL4.

Is the problem still present in the latest SVN version ? 
Not tested.

Original issue reported on code.google.com by tim.slec...@gmail.com on 23 May 2011 at 1:44

GoogleCodeExporter commented 8 years ago
Hello Tim,

Thanks a lot for your report, I'll look into it ASAP.
Cheers
--
zOlive

Original comment by olivier.chafik@gmail.com on 26 May 2011 at 8:31

GoogleCodeExporter commented 8 years ago
I've just checked in a fix 
(http://code.google.com/p/nativelibs4java/source/detail?r=2005), a new binary 
snapshot should be available in a few days.

Thanks again,
Cheers
--
zOlive

Original comment by olivier.chafik@gmail.com on 26 May 2011 at 10:32

GoogleCodeExporter commented 8 years ago
Thanks for the quick solution!

There's another problem with empty structs during runtime though: when the 
struct size is calculated the result is oviously zero, but zero is handled as 
an error case and an exception is thrown. I suppose this is related to JNA 
itself though so I filed a bug on the JNA project: 
http://java.net/jira/browse/JNA-187

Original comment by tim.slec...@gmail.com on 1 Jun 2011 at 7:26