Skip to content

Commit

Permalink
Reproduce problem where error disappeared
Browse files Browse the repository at this point in the history
When the javadoc tool fails with an error that could not be parsed,
the error is silently dropped.
  • Loading branch information
raboof committed Oct 11, 2017
1 parent 8c4b996 commit 6253cee
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package sbt
package internal
package inc
package javac

import xsbti.Reporter
import xsbti.Problem

class CollectingReporter extends Reporter {
var problems: Array[Problem] = Array[Problem]()

def reset() = problems = Array[Problem]()
def hasErrors() = ???
def hasWarnings(): Boolean = ???
def printSummary(): Unit = ???
def log(problem: xsbti.Problem): Unit = problems :+= problem
def comment(pos: xsbti.Position, msg: String): Unit = ???

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package sbt
package internal
package inc
package javac

import java.io.File

class JavaProcessLoggerSpec extends UnitSpec {
"The javac process logger" should "log errors that could not be parsed" in logUnparsableErrors()

def logUnparsableErrors() = {
val reporter = new CollectingReporter()
val logger = new JavacLogger(log = null, reporter, cwd = new File("."))
logger.err("javadoc: error - invalid flag: -target")

logger.flush(-1)

reporter.problems.length should be(1)
}
}

0 comments on commit 6253cee

Please sign in to comment.