aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2017-03-28 20:06:48 +0100
committerMichael Williamson <mike@zwobble.org>2017-03-28 20:06:48 +0100
commit412d0e3e286acde8a65df3636444e46580254e5b (patch)
tree32bc087427b3e51e237a9725723263c626f37711 /src/main/java
parent013c58676c7bf6777dfb2efb2f4ea4b03ab41a43 (diff)
Read inner enums
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/org/zwobble/couscous/frontends/java/JavaReader.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/main/java/org/zwobble/couscous/frontends/java/JavaReader.java b/src/main/java/org/zwobble/couscous/frontends/java/JavaReader.java
index f7f6217..1d5e710 100644
--- a/src/main/java/org/zwobble/couscous/frontends/java/JavaReader.java
+++ b/src/main/java/org/zwobble/couscous/frontends/java/JavaReader.java
@@ -77,6 +77,10 @@ public class JavaReader {
private TypeNode readCompilationUnit(CompilationUnit ast) {
AbstractTypeDeclaration type = (AbstractTypeDeclaration) ast.types().get(0);
+ return readAbstractTypeDeclaration(type);
+ }
+
+ private TypeNode readAbstractTypeDeclaration(AbstractTypeDeclaration type) {
if (type instanceof TypeDeclaration) {
return readTypeDeclaration((TypeDeclaration) type);
} else if (type instanceof EnumDeclaration) {
@@ -207,8 +211,8 @@ public class JavaReader {
tryCast(FieldDeclaration.class, declaration)
.ifPresent(field -> readField(body, scope, type, field, isInterface));
- tryCast(TypeDeclaration.class, declaration)
- .ifPresent(typeDeclaration -> body.addInnerType(readTypeDeclaration(typeDeclaration)));
+ tryCast(AbstractTypeDeclaration.class, declaration)
+ .ifPresent(typeDeclaration -> body.addInnerType(readAbstractTypeDeclaration(typeDeclaration)));
}
return body.build();
}