1 /* |
1 /* |
2 * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2008, 2013, 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. |
85 DiagnosticCollector<JavaFileObject> dc = new DiagnosticCollector<JavaFileObject>(); |
85 DiagnosticCollector<JavaFileObject> dc = new DiagnosticCollector<JavaFileObject>(); |
86 StringWriter sw = new StringWriter(); |
86 StringWriter sw = new StringWriter(); |
87 PrintWriter pw = new PrintWriter(sw); |
87 PrintWriter pw = new PrintWriter(sw); |
88 JavaFileManager fm = JavapFileManager.create(dc, pw); |
88 JavaFileManager fm = JavapFileManager.create(dc, pw); |
89 JavapTask t = new JavapTask(pw, fm, dc, args, classes); |
89 JavapTask t = new JavapTask(pw, fm, dc, args, classes); |
90 boolean ok = t.run(); |
90 int ok = t.run(); |
91 |
91 |
92 List<Diagnostic<? extends JavaFileObject>> diags = dc.getDiagnostics(); |
92 List<Diagnostic<? extends JavaFileObject>> diags = dc.getDiagnostics(); |
93 |
93 |
94 if (!ok) |
94 if (ok != 0) |
95 error("javap failed unexpectedly"); |
95 error("javap failed unexpectedly"); |
96 |
96 |
97 System.err.println("args=" + args + " classes=" + classes + "\n" |
97 System.err.println("args=" + args + " classes=" + classes + "\n" |
98 + diags + "\n" |
98 + diags + "\n" |
99 + sw); |
99 + sw); |