langtools/test/tools/javap/T6863746.java
author never
Mon, 24 May 2010 13:53:38 -0700
changeset 5691 3b7ff7652596
parent 3377 22083952ee8f
child 5520 86e4b9a9da40
permissions -rw-r--r--
6490487: java support on 64 bit solaris x86 machines is broken. Reviewed-by: kvn, kamg
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
/*
22083952ee8f 6863746: javap should not scan ct.sym by default
jjg
parents:
diff changeset
     2
 * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
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
 *
22083952ee8f 6863746: javap should not scan ct.sym by default
jjg
parents:
diff changeset
    19
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22083952ee8f 6863746: javap should not scan ct.sym by default
jjg
parents:
diff changeset
    20
 * CA 95054 USA or visit www.sun.com if you need additional information or
22083952ee8f 6863746: javap should not scan ct.sym by default
jjg
parents:
diff changeset
    21
 * have any questions.
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
}