| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
…of ERROR reportException() was calling reporter.error() which uses Diagnostic.Kind.ERROR, causing javac to exit non-zero and fail the build. The surrounding catch block explicitly states 'we don't want to stop the compilation' — this change makes the implementation match the intent. Adds SemanticdbReporter.warning() for plugin-internal failures, and updates SemanticdbTaskListener.reportException() to use it. Intentional error paths (e.g. -no-relative-path:error mode) are unchanged. Fixes builds for projects with partial classpaths (e.g. Apache Spark) where CompletionFailure for anonymous inner classes like DataType was breaking compileJava entirely. Fixes scip-code#861 Signed-off-by: Roberto Perez Alcolea <rperezalcolea@netflix.com>
There was a problem hiding this comment.
This fix looks valid. Could you please rebase on top of origin/main?
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
reportException() was calling reporter.error() which uses Diagnostic.Kind.ERROR, causing javac to exit non-zero and fail the build. The surrounding catch block explicitly states 'we don't want to stop the compilation' — this change makes the implementation match the intent.
Adds SemanticdbReporter.warning() for plugin-internal failures, and updates SemanticdbTaskListener.reportException() to use it. Intentional error paths (e.g. -no-relative-path:error mode) are unchanged.
Fixes builds for projects with partial classpaths (e.g. Apache Spark) where CompletionFailure for anonymous inner classes like DataType was breaking compileJava entirely.
Fixes #861
Test plan
What we're testing
SemanticdbTaskListener.reportException() previously emitted Diagnostic.Kind.ERROR,
causing javac to exit non-zero and fail the build when semanticdb-javac hit an internal
exception. After the fix it emits Kind.WARNING, so the build succeeds with partial
semanticdb output.
New unit test
PartialClasspathSuite.scala in tests/unit/src/test/scala/tests/.
How it triggers reportException()
The test pre-creates the semanticdb output path (META-INF/semanticdb/example) as a
regular file instead of a directory. When SemanticdbTaskListener.writeSemanticdb()
calls Files.createDirectories(output.getParent()), it throws FileAlreadyExistsException
(a subtype of IOException). The existing catch (IOException e) block catches it and
calls reportException() → reporter.warning() → trees.printMessage(Kind.WARNING, ...).
This approach is JDK-version-agnostic. An earlier design attempted to trigger
CompletionFailure by deleting an inner class file from the classpath, but Java 21+
handles missing inner class files silently (omitting them rather than throwing), so
that approach was not reliable across JDK versions.
Test 1 — compilation succeeds with a warning
Test 2 — semanticdb still produced for healthy files
Existing tests that continue to pass
Full unit suite was run on the branch — all tests pass:
Key suites that exercise compilation behaviour: