test/tools/javap/T6863746.java

Thu, 04 Apr 2013 19:05:42 -0700

author
katleman
date
Thu, 04 Apr 2013 19:05:42 -0700
changeset 1662
4a48f3173534
parent 554
9d9f26857129
child 2525
2eb010b6cb22
permissions
-rw-r--r--

Added tag jdk8-b84 for changeset cfb65ca92082

jjg@330 1 /*
ohair@554 2 * Copyright (c) 2009, Oracle and/or its affiliates. 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 *
ohair@554 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ohair@554 20 * or visit www.oracle.com if you need additional information or have any
ohair@554 21 * 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