Skip to content
This repository was archived by the owner on Sep 8, 2022. It is now read-only.

Commit 72a7cf2

Browse files
committed
Add javac tool args to javac invocation
Examines .java file header for "tool args" comments of the form `javac: -deprecation`.
1 parent 96c3c00 commit 72a7cf2

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/main/scala/scala/tools/partest/nest/Runner.scala

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@ class Runner(val testFile: File, val suiteRunner: SuiteRunner) {
111111
joinPaths(outDir :: testClassPath),
112112
"-J-Duser.language=en",
113113
"-J-Duser.country=US"
114-
) ++ files.map(_.getAbsolutePath)
114+
) ++ toolArgsFor(files)("javac")
115+
++ files.map(_.getAbsolutePath)
115116

116117
pushTranscript(args mkString " ")
117118
val captured = StreamCapture(runCommand(args, logFile))
@@ -439,7 +440,12 @@ class Runner(val testFile: File, val suiteRunner: SuiteRunner) {
439440
perTest ++ perGroup
440441
}
441442

442-
def toolArgs(tool: String, split: Boolean = true): List[String] = {
443+
// inspect sources for tool args
444+
def toolArgs(tool: String, split: Boolean = true): List[String] =
445+
toolArgsFor(sources(testFile))(tool, split)
446+
447+
// inspect given files for tool args
448+
def toolArgsFor(files: List[File])(tool: String, split: Boolean = true): List[String] = {
443449
def argsplitter(s: String) = if (split) words(s) filter (_.nonEmpty) else List(s)
444450
def argsFor(f: File): List[String] = {
445451
import scala.util.matching.Regex
@@ -453,7 +459,7 @@ class Runner(val testFile: File, val suiteRunner: SuiteRunner) {
453459
} finally src.close()
454460
args.flatten map argsplitter getOrElse Nil
455461
}
456-
sources(testFile) flatMap argsFor
462+
files flatMap argsFor
457463
}
458464

459465
abstract class CompileRound {

0 commit comments

Comments
 (0)