langtools/test/tools/javac/T6942649.java
author peterz
Fri, 28 May 2010 13:32:40 +0400
changeset 5594 3db39773da2e
parent 5319 63dc7f367a37
child 5520 86e4b9a9da40
permissions -rw-r--r--
6954231: SynthTextPaneUI.installUI() doesn't set component to opaque even if prop was not set by client progr Reviewed-by: alexp
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5319
63dc7f367a37 6942649: add hidden option to identify location and version of javac classes
jjg
parents:
diff changeset
     1
/*
63dc7f367a37 6942649: add hidden option to identify location and version of javac classes
jjg
parents:
diff changeset
     2
 * Copyright 2010 Sun Microsystems, Inc.  All Rights Reserved.
63dc7f367a37 6942649: add hidden option to identify location and version of javac classes
jjg
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
63dc7f367a37 6942649: add hidden option to identify location and version of javac classes
jjg
parents:
diff changeset
     4
 *
63dc7f367a37 6942649: add hidden option to identify location and version of javac classes
jjg
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
63dc7f367a37 6942649: add hidden option to identify location and version of javac classes
jjg
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
63dc7f367a37 6942649: add hidden option to identify location and version of javac classes
jjg
parents:
diff changeset
     7
 * published by the Free Software Foundation.
63dc7f367a37 6942649: add hidden option to identify location and version of javac classes
jjg
parents:
diff changeset
     8
 *
63dc7f367a37 6942649: add hidden option to identify location and version of javac classes
jjg
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
63dc7f367a37 6942649: add hidden option to identify location and version of javac classes
jjg
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
63dc7f367a37 6942649: add hidden option to identify location and version of javac classes
jjg
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
63dc7f367a37 6942649: add hidden option to identify location and version of javac classes
jjg
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
63dc7f367a37 6942649: add hidden option to identify location and version of javac classes
jjg
parents:
diff changeset
    13
 * accompanied this code).
63dc7f367a37 6942649: add hidden option to identify location and version of javac classes
jjg
parents:
diff changeset
    14
 *
63dc7f367a37 6942649: add hidden option to identify location and version of javac classes
jjg
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
63dc7f367a37 6942649: add hidden option to identify location and version of javac classes
jjg
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
63dc7f367a37 6942649: add hidden option to identify location and version of javac classes
jjg
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
63dc7f367a37 6942649: add hidden option to identify location and version of javac classes
jjg
parents:
diff changeset
    18
 *
63dc7f367a37 6942649: add hidden option to identify location and version of javac classes
jjg
parents:
diff changeset
    19
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
63dc7f367a37 6942649: add hidden option to identify location and version of javac classes
jjg
parents:
diff changeset
    20
 * CA 95054 USA or visit www.sun.com if you need additional information or
63dc7f367a37 6942649: add hidden option to identify location and version of javac classes
jjg
parents:
diff changeset
    21
 * have any questions.
63dc7f367a37 6942649: add hidden option to identify location and version of javac classes
jjg
parents:
diff changeset
    22
 */
63dc7f367a37 6942649: add hidden option to identify location and version of javac classes
jjg
parents:
diff changeset
    23
63dc7f367a37 6942649: add hidden option to identify location and version of javac classes
jjg
parents:
diff changeset
    24
63dc7f367a37 6942649: add hidden option to identify location and version of javac classes
jjg
parents:
diff changeset
    25
/*
63dc7f367a37 6942649: add hidden option to identify location and version of javac classes
jjg
parents:
diff changeset
    26
 * @test
63dc7f367a37 6942649: add hidden option to identify location and version of javac classes
jjg
parents:
diff changeset
    27
 * @bug 6942649
63dc7f367a37 6942649: add hidden option to identify location and version of javac classes
jjg
parents:
diff changeset
    28
 * @summary add hidden option to identify location and version of javac classes
63dc7f367a37 6942649: add hidden option to identify location and version of javac classes
jjg
parents:
diff changeset
    29
 */
63dc7f367a37 6942649: add hidden option to identify location and version of javac classes
jjg
parents:
diff changeset
    30
63dc7f367a37 6942649: add hidden option to identify location and version of javac classes
jjg
parents:
diff changeset
    31
import java.io.*;
63dc7f367a37 6942649: add hidden option to identify location and version of javac classes
jjg
parents:
diff changeset
    32
63dc7f367a37 6942649: add hidden option to identify location and version of javac classes
jjg
parents:
diff changeset
    33
public class T6942649 {
63dc7f367a37 6942649: add hidden option to identify location and version of javac classes
jjg
parents:
diff changeset
    34
    public static void main(String... args) throws Exception {
63dc7f367a37 6942649: add hidden option to identify location and version of javac classes
jjg
parents:
diff changeset
    35
        new T6942649().run();
63dc7f367a37 6942649: add hidden option to identify location and version of javac classes
jjg
parents:
diff changeset
    36
    }
63dc7f367a37 6942649: add hidden option to identify location and version of javac classes
jjg
parents:
diff changeset
    37
63dc7f367a37 6942649: add hidden option to identify location and version of javac classes
jjg
parents:
diff changeset
    38
    void run() throws Exception {
63dc7f367a37 6942649: add hidden option to identify location and version of javac classes
jjg
parents:
diff changeset
    39
        test("-XDshowClass", "com.sun.tools.javac.Main");
63dc7f367a37 6942649: add hidden option to identify location and version of javac classes
jjg
parents:
diff changeset
    40
        test("-XDshowClass=com.sun.tools.javac.util.Log", "com.sun.tools.javac.util.Log");
63dc7f367a37 6942649: add hidden option to identify location and version of javac classes
jjg
parents:
diff changeset
    41
    }
63dc7f367a37 6942649: add hidden option to identify location and version of javac classes
jjg
parents:
diff changeset
    42
63dc7f367a37 6942649: add hidden option to identify location and version of javac classes
jjg
parents:
diff changeset
    43
    void test(String opt, String clazz) throws Exception {
63dc7f367a37 6942649: add hidden option to identify location and version of javac classes
jjg
parents:
diff changeset
    44
        System.err.println("test " + opt);
63dc7f367a37 6942649: add hidden option to identify location and version of javac classes
jjg
parents:
diff changeset
    45
        StringWriter sw = new StringWriter();
63dc7f367a37 6942649: add hidden option to identify location and version of javac classes
jjg
parents:
diff changeset
    46
        PrintWriter pw = new PrintWriter(sw);
63dc7f367a37 6942649: add hidden option to identify location and version of javac classes
jjg
parents:
diff changeset
    47
        int rc = com.sun.tools.javac.Main.compile(new String[] { opt }, pw);
63dc7f367a37 6942649: add hidden option to identify location and version of javac classes
jjg
parents:
diff changeset
    48
        pw.close();
63dc7f367a37 6942649: add hidden option to identify location and version of javac classes
jjg
parents:
diff changeset
    49
        String out = sw.toString();
63dc7f367a37 6942649: add hidden option to identify location and version of javac classes
jjg
parents:
diff changeset
    50
        System.err.println("javac rc=" + rc + "\n" + out);
63dc7f367a37 6942649: add hidden option to identify location and version of javac classes
jjg
parents:
diff changeset
    51
        if (!out.contains(clazz))
63dc7f367a37 6942649: add hidden option to identify location and version of javac classes
jjg
parents:
diff changeset
    52
            throw new Exception("class name not found in output");
63dc7f367a37 6942649: add hidden option to identify location and version of javac classes
jjg
parents:
diff changeset
    53
        int lastDot = clazz.lastIndexOf(".");
63dc7f367a37 6942649: add hidden option to identify location and version of javac classes
jjg
parents:
diff changeset
    54
        if (!out.contains(clazz.substring(lastDot + 1) + ".class"))
63dc7f367a37 6942649: add hidden option to identify location and version of javac classes
jjg
parents:
diff changeset
    55
            throw new Exception("location of class not found in output");
63dc7f367a37 6942649: add hidden option to identify location and version of javac classes
jjg
parents:
diff changeset
    56
        if (!out.contains("MD5 checksum: "))
63dc7f367a37 6942649: add hidden option to identify location and version of javac classes
jjg
parents:
diff changeset
    57
            throw new Exception("checksum not found in output");
63dc7f367a37 6942649: add hidden option to identify location and version of javac classes
jjg
parents:
diff changeset
    58
    }
63dc7f367a37 6942649: add hidden option to identify location and version of javac classes
jjg
parents:
diff changeset
    59
}