Fix missing value for first item of enums with trailing comma
The value of the first item of an enum with a trailing comma after its
last item was not correctly initialized to 0 any more after the changes
of 74adaa5738 (see #1515) because "_last"
attribute was not set correctly in this case.
Do set it for the last item when it's followed by a comma too and add
more unit tests checking for this.
Closes #1566.
This commit is contained in:
parent
2db6b42715
commit
c321aca2b4
3 changed files with 31 additions and 0 deletions
|
|
@ -18,6 +18,21 @@ import java.io.*; // For Serializable
|
|||
// Set default Java const code generation
|
||||
%javaconst(1);
|
||||
|
||||
// Test enums with trailing comma after the last item.
|
||||
enum WithTrailingComma
|
||||
{
|
||||
First,
|
||||
Second,
|
||||
};
|
||||
|
||||
%ignore ReallyFirstOneIsIgnored;
|
||||
enum WithTrailingCommaAndIgnoredFirstItem
|
||||
{
|
||||
ReallyFirstOneIsIgnored,
|
||||
FirstNonIgnoredOne,
|
||||
SecondNonIgnoredOne,
|
||||
};
|
||||
|
||||
// Change the default generation so that these enums are generated into an interface instead of a class
|
||||
%typemap(javaclassmodifiers) enum stuff "public interface"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue