Avoid spurious errors on JDK 7.
authorJesse Glick <jglick@netbeans.org>
Thu, 21 Jul 2011 11:09:57 -0400
changeset 17527b877c5fbce8d
parent 17523 3a011dc2eb95
child 17528 0f242d7d2acc
Avoid spurious errors on JDK 7.
other/signatures/test/org/netbeans/signatures/SignatureWriterTest.java
     1.1 --- a/other/signatures/test/org/netbeans/signatures/SignatureWriterTest.java	Fri Jul 15 09:51:22 2011 -0400
     1.2 +++ b/other/signatures/test/org/netbeans/signatures/SignatureWriterTest.java	Thu Jul 21 11:09:57 2011 -0400
     1.3 @@ -188,7 +188,7 @@
     1.4                  null,
     1.5                  compUnits);
     1.6          boolean ok = task.call();
     1.7 -        String errors = err.toString();
     1.8 +        String errors = cleanup(err);
     1.9          assertTrue(errors, ok);
    1.10          assertEquals(errors, 0, errors.length());
    1.11          // Now compile a dummy class so we can run the processor.
    1.12 @@ -203,7 +203,7 @@
    1.13          task.setProcessors(Collections.singleton(new P(result, clazz)));
    1.14          ok = task.call();
    1.15          // XXX could now delete the .class files in dir
    1.16 -        errors = err.toString();
    1.17 +        errors = cleanup(err);
    1.18          assertTrue(errors, ok);
    1.19          assertEquals(errors, 0, errors.length());
    1.20          SortedSet<String> lines = new TreeSet<String>(Arrays.asList(sig.split("  ")));
    1.21 @@ -217,6 +217,10 @@
    1.22          assertEquals(source, b.toString(), result.toString().replaceAll("^\\{", "").replaceAll("\\}\n\n$", "").replaceAll("\\}\n\\{", "  "));
    1.23          // XXX check that sig is compilable, too
    1.24      }
    1.25 +
    1.26 +    private static String cleanup(StringWriter err) {
    1.27 +        return err.toString().replaceAll("warning: .options. bootstrap class path not set in conjunction with -source 1[.]6\r?\n?|\\d+ warnings?\r?\n?", "");
    1.28 +    }
    1.29      
    1.30      /* Just does not work, not obvious why. Never writes out a .class file.
    1.31      private static final class MemoryOutputFileManager extends ForwardingJavaFileManager<JavaFileManager> {