aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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();
}