langtools/test/tools/javap/typeAnnotations/T6855990.java
author jjg
Tue, 28 Jul 2009 10:36:25 -0700
changeset 3536 dee1b5833af7
child 5520 86e4b9a9da40
permissions -rw-r--r--
6855990: javap InstructionDetailWriter should support new 308 annotations attribute Reviewed-by: mcimadamore
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3536
dee1b5833af7 6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
diff changeset
     1
/*
dee1b5833af7 6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
diff changeset
     2
 * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
dee1b5833af7 6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
dee1b5833af7 6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
diff changeset
     4
 *
dee1b5833af7 6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
dee1b5833af7 6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
dee1b5833af7 6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
diff changeset
     7
 * published by the Free Software Foundation.
dee1b5833af7 6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
diff changeset
     8
 *
dee1b5833af7 6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
dee1b5833af7 6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
dee1b5833af7 6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
dee1b5833af7 6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
dee1b5833af7 6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
diff changeset
    13
 * accompanied this code).
dee1b5833af7 6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
diff changeset
    14
 *
dee1b5833af7 6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
dee1b5833af7 6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
dee1b5833af7 6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
dee1b5833af7 6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
diff changeset
    18
 *
dee1b5833af7 6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
diff changeset
    19
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
dee1b5833af7 6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
diff changeset
    20
 * CA 95054 USA or visit www.sun.com if you need additional information or
dee1b5833af7 6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
diff changeset
    21
 * have any questions.
dee1b5833af7 6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
diff changeset
    22
 */
dee1b5833af7 6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
diff changeset
    23
dee1b5833af7 6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
diff changeset
    24
import java.io.*;
dee1b5833af7 6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
diff changeset
    25
dee1b5833af7 6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
diff changeset
    26
/*
dee1b5833af7 6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
diff changeset
    27
 * @test
dee1b5833af7 6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
diff changeset
    28
 * @bug 6855990
dee1b5833af7 6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
diff changeset
    29
 * @summary InstructionDetailWriter should support new 308 annotations attribute
dee1b5833af7 6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
diff changeset
    30
 */
dee1b5833af7 6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
diff changeset
    31
dee1b5833af7 6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
diff changeset
    32
public class T6855990 {
dee1b5833af7 6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
diff changeset
    33
    public static void main(String[] args) throws Exception {
dee1b5833af7 6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
diff changeset
    34
        new T6855990().run();
dee1b5833af7 6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
diff changeset
    35
    }
dee1b5833af7 6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
diff changeset
    36
dee1b5833af7 6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
diff changeset
    37
    public void run() throws Exception {
dee1b5833af7 6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
diff changeset
    38
        @Simple String[] args = { "-c", "-XDdetails:typeAnnotations", "T6855990" };
dee1b5833af7 6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
diff changeset
    39
        StringWriter sw = new StringWriter();
dee1b5833af7 6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
diff changeset
    40
        PrintWriter pw = new PrintWriter(sw);
dee1b5833af7 6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
diff changeset
    41
        int rc = com.sun.tools.javap.Main.run(args, pw);
dee1b5833af7 6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
diff changeset
    42
        pw.close();
dee1b5833af7 6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
diff changeset
    43
        String out = sw.toString();
dee1b5833af7 6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
diff changeset
    44
        System.out.println(out);
dee1b5833af7 6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
diff changeset
    45
        if (out.indexOf("@Simple: LOCAL_VARIABLE") == -1)
dee1b5833af7 6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
diff changeset
    46
            throw new Exception("expected output not found");
dee1b5833af7 6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
diff changeset
    47
    }
dee1b5833af7 6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
diff changeset
    48
}
dee1b5833af7 6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
diff changeset
    49
dee1b5833af7 6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
diff changeset
    50
@interface Simple { }
dee1b5833af7 6855990: javap InstructionDetailWriter should support new 308 annotations attribute
jjg
parents:
diff changeset
    51