OpenJDK / amber / amber
changeset 56953:51f1edd50183 records-and-sealed
improve failure diagnosis
author | jjg |
---|---|
date | Wed, 31 Jul 2019 13:39:22 -0700 |
parents | 29bd151b3e52 |
children | 379c97f704d8 |
files | test/langtools/tools/javac/tree/JavacTreeScannerTest.java |
diffstat | 1 files changed, 14 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/test/langtools/tools/javac/tree/JavacTreeScannerTest.java Wed Jul 31 13:35:42 2019 -0700 +++ b/test/langtools/tools/javac/tree/JavacTreeScannerTest.java Wed Jul 31 13:39:22 2019 -0700 @@ -102,8 +102,21 @@ error(sourcefile, "differences found"); - if (found.size() != expect.size()) + if (found.size() != expect.size()) { error("Size mismatch; found: " + found.size() + ", expected: " + expect.size()); + Set<JCTree> notFound = new HashSet<>(expect); + notFound.removeAll(found); + if (!notFound.isEmpty()) { + System.err.println("found by reflective access to the AST, but not found in the scanner API:"); + notFound.forEach(t -> System.err.println(trim(t, 64))); + } + Set<JCTree> notExpected = new HashSet<>(found); + notExpected.removeAll(expect); + if (!notExpected.isEmpty()) { + System.err.println("found in the scanner API, but not found by reflective access to the AST:"); + notExpected.forEach(t -> System.err.println(trim(t, 64))); + } + } Set<JCTree> missing = new HashSet<JCTree>(); missing.addAll(expect);