langtools/test/tools/javap/T6863746.java
author ohair
Tue, 25 May 2010 15:54:51 -0700
changeset 5520 86e4b9a9da40
parent 3377 22083952ee8f
child 30730 d3ce7619db2c
permissions -rw-r--r--
6943119: Rebrand source copyright notices Reviewed-by: darcy
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3377
22083952ee8f 6863746: javap should not scan ct.sym by default
jjg
parents:
diff changeset
     1
/*
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 3377
diff changeset
     2
 * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
3377
22083952ee8f 6863746: javap should not scan ct.sym by default
jjg
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
22083952ee8f 6863746: javap should not scan ct.sym by default
jjg
parents:
diff changeset
     4
 *
22083952ee8f 6863746: javap should not scan ct.sym by default
jjg
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
22083952ee8f 6863746: javap should not scan ct.sym by default
jjg
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
22083952ee8f 6863746: javap should not scan ct.sym by default
jjg
parents:
diff changeset
     7
 * published by the Free Software Foundation.
22083952ee8f 6863746: javap should not scan ct.sym by default
jjg
parents:
diff changeset
     8
 *
22083952ee8f 6863746: javap should not scan ct.sym by default
jjg
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
22083952ee8f 6863746: javap should not scan ct.sym by default
jjg
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
22083952ee8f 6863746: javap should not scan ct.sym by default
jjg
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
22083952ee8f 6863746: javap should not scan ct.sym by default
jjg
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
22083952ee8f 6863746: javap should not scan ct.sym by default
jjg
parents:
diff changeset
    13
 * accompanied this code).
22083952ee8f 6863746: javap should not scan ct.sym by default
jjg
parents:
diff changeset
    14
 *
22083952ee8f 6863746: javap should not scan ct.sym by default
jjg
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
22083952ee8f 6863746: javap should not scan ct.sym by default
jjg
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
22083952ee8f 6863746: javap should not scan ct.sym by default
jjg
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
22083952ee8f 6863746: javap should not scan ct.sym by default
jjg
parents:
diff changeset
    18
 *
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 3377
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 3377
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 3377
diff changeset
    21
 * questions.
3377
22083952ee8f 6863746: javap should not scan ct.sym by default
jjg
parents:
diff changeset
    22
 */
22083952ee8f 6863746: javap should not scan ct.sym by default
jjg
parents:
diff changeset
    23
22083952ee8f 6863746: javap should not scan ct.sym by default
jjg
parents:
diff changeset
    24
import java.io.*;
22083952ee8f 6863746: javap should not scan ct.sym by default
jjg
parents:
diff changeset
    25
22083952ee8f 6863746: javap should not scan ct.sym by default
jjg
parents:
diff changeset
    26
/*
22083952ee8f 6863746: javap should not scan ct.sym by default
jjg
parents:
diff changeset
    27
 * @test
22083952ee8f 6863746: javap should not scan ct.sym by default
jjg
parents:
diff changeset
    28
 * @bug 6863746
22083952ee8f 6863746: javap should not scan ct.sym by default
jjg
parents:
diff changeset
    29
 * @summary javap should not scan ct.sym by default
22083952ee8f 6863746: javap should not scan ct.sym by default
jjg
parents:
diff changeset
    30
 */
22083952ee8f 6863746: javap should not scan ct.sym by default
jjg
parents:
diff changeset
    31
22083952ee8f 6863746: javap should not scan ct.sym by default
jjg
parents:
diff changeset
    32
public class T6863746 {
22083952ee8f 6863746: javap should not scan ct.sym by default
jjg
parents:
diff changeset
    33
    public static void main(String... args) throws Exception{
22083952ee8f 6863746: javap should not scan ct.sym by default
jjg
parents:
diff changeset
    34
        new T6863746().run();
22083952ee8f 6863746: javap should not scan ct.sym by default
jjg
parents:
diff changeset
    35
    }
22083952ee8f 6863746: javap should not scan ct.sym by default
jjg
parents:
diff changeset
    36
22083952ee8f 6863746: javap should not scan ct.sym by default
jjg
parents:
diff changeset
    37
    public void run() throws Exception {
22083952ee8f 6863746: javap should not scan ct.sym by default
jjg
parents:
diff changeset
    38
        String[] args = { "-c", "java.lang.Object" };
22083952ee8f 6863746: javap should not scan ct.sym by default
jjg
parents:
diff changeset
    39
        StringWriter sw = new StringWriter();
22083952ee8f 6863746: javap should not scan ct.sym by default
jjg
parents:
diff changeset
    40
        PrintWriter pw = new PrintWriter(sw);
22083952ee8f 6863746: javap should not scan ct.sym by default
jjg
parents:
diff changeset
    41
        int rc = com.sun.tools.javap.Main.run(args, pw);
22083952ee8f 6863746: javap should not scan ct.sym by default
jjg
parents:
diff changeset
    42
        pw.close();
22083952ee8f 6863746: javap should not scan ct.sym by default
jjg
parents:
diff changeset
    43
        String out = sw.toString();
22083952ee8f 6863746: javap should not scan ct.sym by default
jjg
parents:
diff changeset
    44
        System.out.println(out);
22083952ee8f 6863746: javap should not scan ct.sym by default
jjg
parents:
diff changeset
    45
        String[] lines = out.split("\n");
22083952ee8f 6863746: javap should not scan ct.sym by default
jjg
parents:
diff changeset
    46
        // If ct.sym is being read, the output does not include
22083952ee8f 6863746: javap should not scan ct.sym by default
jjg
parents:
diff changeset
    47
        // Code attributes, so check for Code attributes as a
22083952ee8f 6863746: javap should not scan ct.sym by default
jjg
parents:
diff changeset
    48
        // way of detecting that ct.sym is not being used.
22083952ee8f 6863746: javap should not scan ct.sym by default
jjg
parents:
diff changeset
    49
        if (lines.length < 50 || out.indexOf("Code:") == -1)
22083952ee8f 6863746: javap should not scan ct.sym by default
jjg
parents:
diff changeset
    50
            throw new Exception("unexpected output from javap");
22083952ee8f 6863746: javap should not scan ct.sym by default
jjg
parents:
diff changeset
    51
    }
22083952ee8f 6863746: javap should not scan ct.sym by default
jjg
parents:
diff changeset
    52
}