Skip to content

Commit 3258ccb

Browse files
author
Jaden Peterson
committed
fixup! Catch ClassFormatErrors in ScalacInvoker
1 parent cc2f0d8 commit 3258ccb

File tree

1 file changed

+2
-15
lines changed

1 file changed

+2
-15
lines changed

src/java/io/bazel/rulesscala/scalac/ScalacWorker.java

+2-15
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ private static String[] getPluginParamsFrom(CompileOptions ops) {
237237
}
238238
if (ops.directTargets.length > 0) {
239239
pluginParams.add(
240-
"-P:dependency-analyzer:direct-targets:" + encodeStringSeqPluginParam(ops.directTargets));
240+
"-P:dependency-analyzer:direct-targets:" + encodeStringSeqPluginParam(ops.directTargets));
241241
}
242242
if (ops.indirectJars.length > 0) {
243243
pluginParams.add(
@@ -269,20 +269,7 @@ private static void compileScalaSources(CompileOptions ops, String[] scalaSource
269269
String[] compilerArgs =
270270
merge(ops.scalaOpts, pluginArgs, constParams, pluginParams, scalaSources);
271271

272-
ScalacInvokerResults compilerResults;
273-
274-
try {
275-
compilerResults = ScalacInvoker.invokeCompiler(ops, compilerArgs);
276-
} catch (CompilationFailed exception) {
277-
if (exception.getCause() instanceof ClassFormatError) {
278-
throw new Exception(
279-
"You may have declared a target containing a macro as a `scala_library` target instead of a `scala_macro_library` target.",
280-
exception
281-
);
282-
}
283-
284-
throw exception;
285-
}
272+
ScalacInvokerResults compilerResults = ScalacInvoker.invokeCompiler(ops, compilerArgs);
286273

287274
if (ops.printCompileTime) {
288275
System.err.println("Compiler runtime: " + (compilerResults.stopTime - compilerResults.startTime) + "ms.");

0 commit comments

Comments
 (0)