Skip to content

Commit

Permalink
fix: ignore StaticJavaParser#parse exceptions in FieldParser
Browse files Browse the repository at this point in the history
  • Loading branch information
Apehum committed Apr 8, 2024
1 parent e97cdf9 commit 6d7c0e0
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/main/kotlin/su/plo/voice/plugin/parser/FieldParser.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ fun parseStringField(sourceFiles: Collection<File>, className: String, fieldName
val fileName = file.name

if (fileName.endsWith(".java")) {
val parsedFile = StaticJavaParser.parse(file)
val parsedFile = try {
StaticJavaParser.parse(file)
// todo: "Text Block Literals are not supported." Just skip for now, but it can be a problem with modern java code
} catch (e: Exception) {
return@forEach
}

val foundClass = parsedFile.childNodes
.filterIsInstance<ClassOrInterfaceDeclaration>()
Expand Down

0 comments on commit 6d7c0e0

Please sign in to comment.