test/tools/javap/T6863746.java

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

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

6868553: 6867671 breaks some tests
Reviewed-by: mcimadamore

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

mercurial