aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/zwobble
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/zwobble')
-rw-r--r--src/main/java/org/zwobble/couscous/frontends/java/JavaReader.java7
1 files changed, 7 insertions, 0 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 ec6b556..b867dc2 100644
--- a/src/main/java/org/zwobble/couscous/frontends/java/JavaReader.java
+++ b/src/main/java/org/zwobble/couscous/frontends/java/JavaReader.java
@@ -68,6 +68,10 @@ public class JavaReader {
private TypeNode readCompilationUnit(CompilationUnit ast) {
TypeDeclaration type = (TypeDeclaration)ast.types().get(0);
+ return readTypeDeclaration(type);
+ }
+
+ private TypeNode readTypeDeclaration(TypeDeclaration type) {
TypeName name = typeOf(type.resolveBinding());
Scope scope = Scope.create().enterClass(name);
TypeDeclarationBody body = readTypeDeclarationBody(scope, name, type.bodyDeclarations());
@@ -254,6 +258,9 @@ public class JavaReader {
Casts.tryCast(FieldDeclaration.class, declaration)
.ifPresent(field -> readField(body, scope, type, field));
+
+ Casts.tryCast(TypeDeclaration.class, declaration)
+ .ifPresent(typeDeclaration -> classes.add(readTypeDeclaration(typeDeclaration)));
}
return body.build();
}