Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cce324c2 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "[Catalyst] try-catch for Filer.createSourceFile" into main

parents 3d03e939 e7735636
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -129,7 +129,15 @@ class PreferenceScreenAnnotationProcessor : AbstractProcessor() {
                )
            }
        }
        processingEnv.filer.createSourceFile("$outputPkg.$outputClass").openWriter().use {
        val javaFileObject =
            try {
                processingEnv.filer.createSourceFile("$outputPkg.$outputClass")
            } catch (e: Exception) {
                // quick fix: gradle runs this processor twice unexpectedly
                warn("cannot createSourceFile: $e")
                return
            }
        javaFileObject.openWriter().use {
            it.write("package $outputPkg;\n\n")
            it.write("import $PACKAGE.$PREFERENCE_SCREEN_METADATA;\n\n")
            it.write("// Generated by annotation processor for @$ANNOTATION_NAME\n")