test/langtools/tools/javap/T6863746.java
author vlivanov
Tue, 26 Nov 2019 16:09:21 +0300
changeset 59276 94a84abb873b
parent 47216 71c04702a3d5
permissions -rw-r--r--
8234403: C2: Enable CallSite.target updates in constructors Reviewed-by: psandoz, kvn
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
/*
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30846
diff changeset
     2
 * Copyright (c) 2009, 2016, 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
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30846
diff changeset
    30
 * @modules jdk.jdeps/com.sun.tools.javap
3377
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
22083952ee8f 6863746: javap should not scan ct.sym by default
jjg
parents:
diff changeset
    33
public class T6863746 {
22083952ee8f 6863746: javap should not scan ct.sym by default
jjg
parents:
diff changeset
    34
    public static void main(String... args) throws Exception{
22083952ee8f 6863746: javap should not scan ct.sym by default
jjg
parents:
diff changeset
    35
        new T6863746().run();
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
22083952ee8f 6863746: javap should not scan ct.sym by default
jjg
parents:
diff changeset
    38
    public void run() throws Exception {
22083952ee8f 6863746: javap should not scan ct.sym by default
jjg
parents:
diff changeset
    39
        String[] args = { "-c", "java.lang.Object" };
22083952ee8f 6863746: javap should not scan ct.sym by default
jjg
parents:
diff changeset
    40
        StringWriter sw = new StringWriter();
22083952ee8f 6863746: javap should not scan ct.sym by default
jjg
parents:
diff changeset
    41
        PrintWriter pw = new PrintWriter(sw);
22083952ee8f 6863746: javap should not scan ct.sym by default
jjg
parents:
diff changeset
    42
        int rc = com.sun.tools.javap.Main.run(args, pw);
22083952ee8f 6863746: javap should not scan ct.sym by default
jjg
parents:
diff changeset
    43
        pw.close();
22083952ee8f 6863746: javap should not scan ct.sym by default
jjg
parents:
diff changeset
    44
        String out = sw.toString();
22083952ee8f 6863746: javap should not scan ct.sym by default
jjg
parents:
diff changeset
    45
        System.out.println(out);
22083952ee8f 6863746: javap should not scan ct.sym by default
jjg
parents:
diff changeset
    46
        String[] lines = out.split("\n");
22083952ee8f 6863746: javap should not scan ct.sym by default
jjg
parents:
diff changeset
    47
        // 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
    48
        // Code attributes, so check for Code attributes as a
22083952ee8f 6863746: javap should not scan ct.sym by default
jjg
parents:
diff changeset
    49
        // way of detecting that ct.sym is not being used.
22083952ee8f 6863746: javap should not scan ct.sym by default
jjg
parents:
diff changeset
    50
        if (lines.length < 50 || out.indexOf("Code:") == -1)
22083952ee8f 6863746: javap should not scan ct.sym by default
jjg
parents:
diff changeset
    51
            throw new Exception("unexpected output from javap");
22083952ee8f 6863746: javap should not scan ct.sym by default
jjg
parents:
diff changeset
    52
    }
22083952ee8f 6863746: javap should not scan ct.sym by default
jjg
parents:
diff changeset
    53
}