#91 TKIND_ALIAS handling doesn't pick up enums in all cases

open
nobody
5
2010-04-22
2010-04-22
Kevin Day
No

We have a tlb that has the following format:

CLASS MessagesLanguageEnum;TKIND_ALIAS
GUID;{00000000-0000-0000-0000-000000000000}
EXTENDS;_MessagesLanguageEnum
CLASS _MessagesLanguageEnum;TKIND_ENUM
GUID;{00000000-0000-0000-0000-000000000000}
VAR_CONST;ML_English;VT_I4;0
VAR_CONST;ML_Russian;VT_I4;1

The current code fails b/c it isn't expecting the GUID entry between the alias and the EXTENDS line.

The following patch is a simple fix to scan for the next EXTENDS line:

Index: src/com/jacob/jacobgen/Jacobgen.java

RCS file: /cvsroot/jacob-project/jacobgen/src/com/jacob/jacobgen/Jacobgen.java,v
retrieving revision 1.12
diff -u -r1.12 Jacobgen.java
--- src/com/jacob/jacobgen/Jacobgen.java 22 Nov 2007 18:04:32 -0000 1.12
+++ src/com/jacob/jacobgen/Jacobgen.java 22 Apr 2010 06:51:42 -0000
@@ -224,7 +224,8 @@
if (classType.equals("TKIND_ALIAS")) {

// Pick up the next row and determine the superclass
- i++;
+ while(!lines.elementAt(++i).startsWith("EXTENDS"));
+
String derivedAlias = lines.elementAt(i);
derivedAlias = derivedAlias.substring(
derivedAlias.indexOf(';') + 1).trim();
@@ -338,7 +339,6 @@
+ ";["
+ native_type
+ " parmValue]";
-
MethodItem mi = new MethodItem(getPropLine);
if (!methodsToAvoid.contains(mi.getName())) {
classMethods.addElement(mi);

Discussion