Closed WojciechMazur closed 2 months ago
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).
View this failed invocation of the CLA check for more information.
For the most up to date status, view the checks section at the bottom of the pull request.
Description
Motivation
Fixes #1605 When passing invalid scalac options, eg.
-source:not-existing
the Scala compiler would either:None
formDriver.setup
leading to runtime exception inNone.get
(Scala 3)would not create an instance in
Driver.newCompiler
required to createProtoReporter
orDepsTrackingReporter
leading toreporter
being not initialized (Scala 2) This fix handles both of this cases by termination executing earlier with a known exception.In each of cases Scalac compiler would always show error message about which setting was invalid. This is expected behaviour. Because of that, there is no reason to print stack traces on invalid scalac setting from
ScalaInvoker
exposing internal implementaiton to the user. It can be handled by either not filling stack traces or introducing a common subtype handled in the worker. The later option was chosen and additionally extended to handle expected compiler errors. This should reduce amount of boilerplate logs.