Index: src/grammar/lexer.flex =================================================================== --- src/grammar/lexer.flex (revision 510) +++ src/grammar/lexer.flex (working copy) @@ -139,16 +139,19 @@ "@" {WhiteSpace}* "interface" { classDepth++; + enumMode = false; return Parser.ANNOINTERFACE; } "class" { classDepth++; + enumMode = false; return Parser.CLASS; } "interface" { classDepth++; + enumMode = false; return Parser.INTERFACE; } Index: src/test/com/thoughtworks/qdox/EnumsTest.java =================================================================== --- src/test/com/thoughtworks/qdox/EnumsTest.java (revision 510) +++ src/test/com/thoughtworks/qdox/EnumsTest.java (working copy) @@ -5,6 +5,8 @@ import java.io.StringReader; import com.thoughtworks.qdox.model.JavaClass; +import com.thoughtworks.qdox.parser.Lexer; +import com.thoughtworks.qdox.parser.impl.JFlexLexer; public class EnumsTest extends TestCase { @@ -111,5 +113,31 @@ JavaClass cls = javaDocBuilder.getClassByName("Animal"); assertTrue(cls.isEnum()); } - + + + public void testEnumBeforeClass() throws Exception { + String source = "" + + "package org.carrot2.util.attribute.constraint;" + + "public class Test" + + "{" + + "public enum TestValueSet" + + "{ VALUE_1 }" + + "static class AnnotationContainer" + + "{ @ValueHintEnum(values = TestValueSet.class) String hint; }" + + "}"; + new JavaDocBuilder().addSource(new StringReader(source)); + } + + public void testEnumAfterClass() throws Exception { + String source = "" + + "package org.carrot2.util.attribute.constraint;" + + "public class Test" + + "{" + + "static class AnnotationContainer" + + "{ @ValueHintEnum(values = TestValueSet.class) String hint; }" + + "public enum TestValueSet" + + "{ VALUE_1 }" + + "}"; + new JavaDocBuilder().addSource(new StringReader(source)); + } }