Skip to content

[Scala 2.13.12] Issue with scala.tools.nsc.reporters.Reporter when compiling #1514

@scoquelin

Description

@scoquelin

Seems like this change in the Scala codebase has broken compilation of DepsTrackingReporter.java since it introduces a new parameter (with a default value) to existing error/warning methods that Java cannot interpret seamlessly.

Here is the stacktrace I get when compiling with Scala 2.13.12 (builds fine with 2.13.11 btw)

ERROR: /private/var/tmp/_bazel_sebastien/beeef587c4e635c319809c3cfc50320b/external/io_bazel_rules_scala/src/java/io/bazel/rulesscala/scalac/reporter/BUILD:5:13: Building external/io_bazel_rules_scala/src/java/io/bazel/rulesscala/scalac/reporter/libreporter.jar (2 source files) [for tool] failed: (Exit 1): java failed: error executing command (from target @io_bazel_rules_scala//src/java/io/bazel/rulesscala/scalac/reporter:reporter) external/remotejdk11_macos_aarch64/bin/java -XX:-CompactStrings '--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED' '--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED' ... (remaining 18 arguments skipped)
warning: [path] bad path element "/private/var/tmp/_bazel_sebastien/beeef587c4e635c319809c3cfc50320b/execroot/platform/bazel-out/darwin_arm64-opt-exec-2B5CBBC6/bin/external/io_bazel_rules_scala_scala_compiler/io_bazel_rules_scala_scala_compiler.stamp/scala-reflect.jar": no such file or directory
warning: [path] bad path element "/private/var/tmp/_bazel_sebastien/beeef587c4e635c319809c3cfc50320b/execroot/platform/bazel-out/darwin_arm64-opt-exec-2B5CBBC6/bin/external/io_bazel_rules_scala_scala_compiler/io_bazel_rules_scala_scala_compiler.stamp/scala-library.jar": no such file or directory
external/io_bazel_rules_scala/src/java/io/bazel/rulesscala/scalac/reporter/DepsTrackingReporter.java:220: error: method warning in class Reporter cannot be applied to given types;
            reporter.warning(NoPosition$.MODULE$, strictDepsReport.toString());
                    ^
  required: Position,String,List<CodeAction>
  found: NoPosition$,String
  reason: actual and formal argument lists differ in length
external/io_bazel_rules_scala/src/java/io/bazel/rulesscala/scalac/reporter/DepsTrackingReporter.java:222: error: method error in class Reporter cannot be applied to given types;
            reporter.error(NoPosition$.MODULE$, strictDepsReport.toString());
                    ^
  required: Position,String,List<CodeAction>
  found: NoPosition$,String
  reason: actual and formal argument lists differ in length
external/io_bazel_rules_scala/src/java/io/bazel/rulesscala/scalac/reporter/DepsTrackingReporter.java:228: error: method warning in class Reporter cannot be applied to given types;
            reporter.warning(NoPosition$.MODULE$, compilerDepsReport.toString());
                    ^
  required: Position,String,List<CodeAction>
  found: NoPosition$,String
  reason: actual and formal argument lists differ in length
external/io_bazel_rules_scala/src/java/io/bazel/rulesscala/scalac/reporter/DepsTrackingReporter.java:230: error: method error in class Reporter cannot be applied to given types;
            reporter.error(NoPosition$.MODULE$, compilerDepsReport.toString());
                    ^
  required: Position,String,List<CodeAction>
  found: NoPosition$,String
  reason: actual and formal argument lists differ in length
external/io_bazel_rules_scala/src/java/io/bazel/rulesscala/scalac/reporter/DepsTrackingReporter.java:250: error: method warning in class Reporter cannot be applied to given types;
            reporter.warning(NoPosition$.MODULE$, unusedDepsReport.toString());
                    ^
  required: Position,String,List<CodeAction>
  found: NoPosition$,String
  reason: actual and formal argument lists differ in length
external/io_bazel_rules_scala/src/java/io/bazel/rulesscala/scalac/reporter/DepsTrackingReporter.java:252: error: method error in class Reporter cannot be applied to given types;
            reporter.error(NoPosition$.MODULE$, unusedDepsReport.toString());
                    ^
  required: Position,String,List<CodeAction>
  found: NoPosition$,String
  reason: actual and formal argument lists differ in length

I could try to take a stab at it however since all existing tests are currently based on Scala 2.13.6 and I this change would require to be targeting a specific Scala version I would appreciate some guidance on how to approach this. Thanks !

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions