diff --git a/core/src/main/scala/scala/tools/jardiff/JarDiff.scala b/core/src/main/scala/scala/tools/jardiff/JarDiff.scala index cb403f3..0009952 100644 --- a/core/src/main/scala/scala/tools/jardiff/JarDiff.scala +++ b/core/src/main/scala/scala/tools/jardiff/JarDiff.scala @@ -120,8 +120,8 @@ object JarDiff { } def apply(files: List[List[Path]], config: JarDiff.Config): JarDiff = { val renderers = Map( - "class" -> List(new AsmTextifyRenderer(config.code, config.raw, config.privates), new ScalapRenderer()), - "sig" -> List(new ScalapSigRenderer()) + "class" -> List(new AsmTextifyRenderer(config.code, config.raw, config.privates), new ScalapRenderer(config.privates)), + "sig" -> List(new ScalapSigRenderer(config.privates)) ).withDefault(_ => List(IdentityRenderer)) new JarDiff(files, config, renderers) } diff --git a/core/src/main/scala/scala/tools/jardiff/ScalapRenderer.scala b/core/src/main/scala/scala/tools/jardiff/ScalapRenderer.scala index c0ed1ff..8809984 100644 --- a/core/src/main/scala/scala/tools/jardiff/ScalapRenderer.scala +++ b/core/src/main/scala/scala/tools/jardiff/ScalapRenderer.scala @@ -8,12 +8,14 @@ import java.nio.file.{Files, Path} import scala.tools.scalap.scalax.rules.ScalaSigParserError -class ScalapRenderer() extends FileRenderer { +class ScalapRenderer(privates: Boolean) extends FileRenderer { def outFileExtension: String = ".scalap" override def render(in: Path, out: Path): Unit = { val classBytes = Files.readAllBytes(in) try { - val decompiled = scala.tools.scalap.Main.decompileScala(classBytes, in.getFileName.toString == "package.class") + val main = new scala.tools.scalap.Main + main.printPrivates = privates + val decompiled = main.decompileScala(classBytes, in.getFileName.toString == "package.class") if (decompiled != "") { Files.createDirectories(out.getParent) Files.write(out, decompiled.getBytes("UTF-8")) diff --git a/core/src/main/scala/scala/tools/jardiff/ScalapSigRenderer.scala b/core/src/main/scala/scala/tools/jardiff/ScalapSigRenderer.scala index a716b0a..799e07c 100644 --- a/core/src/main/scala/scala/tools/jardiff/ScalapSigRenderer.scala +++ b/core/src/main/scala/scala/tools/jardiff/ScalapSigRenderer.scala @@ -5,13 +5,15 @@ import java.nio.file.{Files, Path} import scala.tools.scalap.scalax.rules.ScalaSigParserError import scala.tools.scalap.scalax.rules.scalasig.{ByteCode, ScalaSigAttributeParsers} -class ScalapSigRenderer() extends FileRenderer { +class ScalapSigRenderer(privates: Boolean) extends FileRenderer { def outFileExtension: String = ".scalap" override def render(in: Path, out: Path): Unit = { val classBytes = Files.readAllBytes(in) try { val scalaSig = ScalaSigAttributeParsers.parse(ByteCode(classBytes)) - val decompiled = scala.tools.scalap.Main.parseScalaSignature(scalaSig, in.getFileName.toString == "package.sig") + val main = new scala.tools.scalap.Main + main.printPrivates = privates + val decompiled = main.parseScalaSignature(scalaSig, in.getFileName.toString == "package.sig") if (decompiled != "") { Files.createDirectories(out.getParent) Files.write(out, decompiled.getBytes("UTF-8"))