test/tools/javap/T4884240.java

Wed, 05 Aug 2009 07:43:50 -0700

author
jjg
date
Wed, 05 Aug 2009 07:43:50 -0700
changeset 349
bc0b1f404c40
parent 242
889ec3ddc91b
child 554
9d9f26857129
permissions
-rw-r--r--

6868553: 6867671 breaks some tests
Reviewed-by: mcimadamore

jjg@88 1 /*
jjg@88 2 * Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
jjg@88 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
jjg@88 4 *
jjg@88 5 * This code is free software; you can redistribute it and/or modify it
jjg@88 6 * under the terms of the GNU General Public License version 2 only, as
jjg@88 7 * published by the Free Software Foundation. Sun designates this
jjg@88 8 * particular file as subject to the "Classpath" exception as provided
jjg@88 9 * by Sun in the LICENSE file that accompanied this code.
jjg@88 10 *
jjg@88 11 * This code is distributed in the hope that it will be useful, but WITHOUT
jjg@88 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
jjg@88 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
jjg@88 14 * version 2 for more details (a copy is included in the LICENSE file that
jjg@88 15 * accompanied this code).
jjg@88 16 *
jjg@88 17 * You should have received a copy of the GNU General Public License version
jjg@88 18 * 2 along with this work; if not, write to the Free Software Foundation,
tbell@242 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
jjg@88 20 *
jjg@88 21 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
jjg@88 22 * CA 95054 USA or visit www.sun.com if you need additional information or
jjg@88 23 * have any questions.
jjg@88 24 */
jjg@88 25
jjg@88 26 /*
jjg@88 27 * @test
jjg@88 28 * @bug 4884240
jjg@88 29 * @summary additional option required for javap
jjg@88 30 */
jjg@88 31
jjg@88 32 import java.io.*;
jjg@88 33
jjg@88 34 public class T4884240 {
jjg@88 35 public static void main(String... args) throws Exception {
jjg@88 36 new T4884240().run();
jjg@88 37 }
jjg@88 38
jjg@88 39 public void run() throws Exception {
jjg@88 40 StringWriter sw = new StringWriter();
jjg@88 41 PrintWriter pw = new PrintWriter(sw);
jjg@88 42 String[] args = { "-sysinfo", "java.lang.Object" };
jjg@88 43 int rc = com.sun.tools.javap.Main.run(args, pw);
jjg@88 44 if (rc != 0)
jjg@88 45 throw new Exception("unexpected return code: " + rc);
jjg@88 46 pw.close();
jjg@88 47 String[] lines = sw.toString().split("\n");
jjg@88 48 if (lines.length < 3
jjg@349 49 || !lines[0].trim().startsWith("Classfile")
jjg@349 50 || !lines[1].trim().startsWith("Last modified")
jjg@349 51 || !lines[2].trim().startsWith("MD5")) {
jjg@88 52 System.out.println(sw);
jjg@88 53 throw new Exception("unexpected output");
jjg@88 54 }
jjg@88 55 }
jjg@88 56 }

mercurial