We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 25d9147 commit 62a175cCopy full SHA for 62a175c
src/main/java/io/github/bensku/tsbind/AstGenerator.java
@@ -81,7 +81,11 @@ public Optional<TypeDefinition> parseType(SourceUnit source) {
81
return Optional.empty();
82
}
83
CompilationUnit unit = result.getResult().orElseThrow();
84
- TypeDeclaration<?> type = unit.findFirst(TypeDeclaration.class).orElseThrow();
+ TypeDeclaration<?> type = unit.findFirst(TypeDeclaration.class).orElse(null);
85
+ if (type == null) {
86
+ System.err.println("no type declaration found in source unit: " + source.name);
87
+ return Optional.empty();
88
+ }
89
if (type.getAccessSpecifier() == AccessSpecifier.PUBLIC) {
90
// SourceUnit lacks fully-qualified class name, so ask JavaParser to figure it out
91
String fqn = type.getFullyQualifiedName().orElseThrow();
0 commit comments