1 /* |
1 /* |
2 * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
42 DiagnosticListener<JavaFileObject> dl = new DiagnosticListener<JavaFileObject>() { |
42 DiagnosticListener<JavaFileObject> dl = new DiagnosticListener<JavaFileObject>() { |
43 public void report (Diagnostic<? extends JavaFileObject> message) { |
43 public void report (Diagnostic<? extends JavaFileObject> message) { |
44 throw new NullPointerException(SILLY_BILLY); |
44 throw new NullPointerException(SILLY_BILLY); |
45 } |
45 } |
46 }; |
46 }; |
47 StandardJavaFileManager fm = javac.getStandardFileManager(dl, null, null); |
47 try (StandardJavaFileManager fm = javac.getStandardFileManager(dl, null, null)) { |
48 Iterable<? extends JavaFileObject> files = |
48 Iterable<? extends JavaFileObject> files = |
49 fm.getJavaFileObjectsFromStrings(Arrays.asList("badfile.java")); |
49 fm.getJavaFileObjectsFromStrings(Arrays.asList("badfile.java")); |
50 javac.getTask(null, fm, dl, null, null, files).call(); |
50 javac.getTask(null, fm, dl, null, null, files).call(); |
|
51 } |
51 } |
52 } |
52 catch (RuntimeException e) { |
53 catch (RuntimeException e) { |
53 Throwable cause = e.getCause(); |
54 Throwable cause = e.getCause(); |
54 if (cause instanceof NullPointerException |
55 if (cause instanceof NullPointerException |
55 && cause.getMessage().equals(SILLY_BILLY)) |
56 && cause.getMessage().equals(SILLY_BILLY)) |