langtools/test/tools/javadoc/nonConstExprs/Test.java
author jjg
Wed, 28 Aug 2013 15:40:33 -0700
changeset 19666 01a225608c25
child 30730 d3ce7619db2c
permissions -rw-r--r--
8010310: [javadoc] Error processing sources with -private Reviewed-by: vromero, mcimadamore
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
19666
01a225608c25 8010310: [javadoc] Error processing sources with -private
jjg
parents:
diff changeset
     1
/*
01a225608c25 8010310: [javadoc] Error processing sources with -private
jjg
parents:
diff changeset
     2
 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
01a225608c25 8010310: [javadoc] Error processing sources with -private
jjg
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
01a225608c25 8010310: [javadoc] Error processing sources with -private
jjg
parents:
diff changeset
     4
 *
01a225608c25 8010310: [javadoc] Error processing sources with -private
jjg
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
01a225608c25 8010310: [javadoc] Error processing sources with -private
jjg
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
01a225608c25 8010310: [javadoc] Error processing sources with -private
jjg
parents:
diff changeset
     7
 * published by the Free Software Foundation.
01a225608c25 8010310: [javadoc] Error processing sources with -private
jjg
parents:
diff changeset
     8
 *
01a225608c25 8010310: [javadoc] Error processing sources with -private
jjg
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
01a225608c25 8010310: [javadoc] Error processing sources with -private
jjg
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
01a225608c25 8010310: [javadoc] Error processing sources with -private
jjg
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
01a225608c25 8010310: [javadoc] Error processing sources with -private
jjg
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
01a225608c25 8010310: [javadoc] Error processing sources with -private
jjg
parents:
diff changeset
    13
 * accompanied this code).
01a225608c25 8010310: [javadoc] Error processing sources with -private
jjg
parents:
diff changeset
    14
 *
01a225608c25 8010310: [javadoc] Error processing sources with -private
jjg
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
01a225608c25 8010310: [javadoc] Error processing sources with -private
jjg
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
01a225608c25 8010310: [javadoc] Error processing sources with -private
jjg
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
01a225608c25 8010310: [javadoc] Error processing sources with -private
jjg
parents:
diff changeset
    18
 *
01a225608c25 8010310: [javadoc] Error processing sources with -private
jjg
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
01a225608c25 8010310: [javadoc] Error processing sources with -private
jjg
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
01a225608c25 8010310: [javadoc] Error processing sources with -private
jjg
parents:
diff changeset
    21
 * questions.
01a225608c25 8010310: [javadoc] Error processing sources with -private
jjg
parents:
diff changeset
    22
 */
01a225608c25 8010310: [javadoc] Error processing sources with -private
jjg
parents:
diff changeset
    23
01a225608c25 8010310: [javadoc] Error processing sources with -private
jjg
parents:
diff changeset
    24
/**
01a225608c25 8010310: [javadoc] Error processing sources with -private
jjg
parents:
diff changeset
    25
 * @test
01a225608c25 8010310: [javadoc] Error processing sources with -private
jjg
parents:
diff changeset
    26
 * @bug     8010310
01a225608c25 8010310: [javadoc] Error processing sources with -private
jjg
parents:
diff changeset
    27
 * @summary Error processing sources with -private
01a225608c25 8010310: [javadoc] Error processing sources with -private
jjg
parents:
diff changeset
    28
 */
01a225608c25 8010310: [javadoc] Error processing sources with -private
jjg
parents:
diff changeset
    29
01a225608c25 8010310: [javadoc] Error processing sources with -private
jjg
parents:
diff changeset
    30
import java.io.File;
01a225608c25 8010310: [javadoc] Error processing sources with -private
jjg
parents:
diff changeset
    31
01a225608c25 8010310: [javadoc] Error processing sources with -private
jjg
parents:
diff changeset
    32
public class Test {
01a225608c25 8010310: [javadoc] Error processing sources with -private
jjg
parents:
diff changeset
    33
    public static void main(String... args) throws Exception {
01a225608c25 8010310: [javadoc] Error processing sources with -private
jjg
parents:
diff changeset
    34
        File testSrc = new File(System.getProperty("test.src"));
01a225608c25 8010310: [javadoc] Error processing sources with -private
jjg
parents:
diff changeset
    35
        String[] jdoc_args = {
01a225608c25 8010310: [javadoc] Error processing sources with -private
jjg
parents:
diff changeset
    36
            "-d", "out",
01a225608c25 8010310: [javadoc] Error processing sources with -private
jjg
parents:
diff changeset
    37
            new File(testSrc, Test.class.getSimpleName() + ".java").getPath()
01a225608c25 8010310: [javadoc] Error processing sources with -private
jjg
parents:
diff changeset
    38
        };
01a225608c25 8010310: [javadoc] Error processing sources with -private
jjg
parents:
diff changeset
    39
        int rc = com.sun.tools.javadoc.Main.execute(jdoc_args);
01a225608c25 8010310: [javadoc] Error processing sources with -private
jjg
parents:
diff changeset
    40
        if (rc != 0)
01a225608c25 8010310: [javadoc] Error processing sources with -private
jjg
parents:
diff changeset
    41
            throw new Exception("unexpected return code from javadoc: " + rc);
01a225608c25 8010310: [javadoc] Error processing sources with -private
jjg
parents:
diff changeset
    42
    }
01a225608c25 8010310: [javadoc] Error processing sources with -private
jjg
parents:
diff changeset
    43
01a225608c25 8010310: [javadoc] Error processing sources with -private
jjg
parents:
diff changeset
    44
    static int array[] = { 1, 2, 3};
01a225608c25 8010310: [javadoc] Error processing sources with -private
jjg
parents:
diff changeset
    45
    static int method(int p) { return p; }
01a225608c25 8010310: [javadoc] Error processing sources with -private
jjg
parents:
diff changeset
    46
    static int value = 0;
01a225608c25 8010310: [javadoc] Error processing sources with -private
jjg
parents:
diff changeset
    47
01a225608c25 8010310: [javadoc] Error processing sources with -private
jjg
parents:
diff changeset
    48
    public int not_static_not_final = 1;
01a225608c25 8010310: [javadoc] Error processing sources with -private
jjg
parents:
diff changeset
    49
    public static int static_not_final = 2;
01a225608c25 8010310: [javadoc] Error processing sources with -private
jjg
parents:
diff changeset
    50
    public final int not_static_final = 3;
01a225608c25 8010310: [javadoc] Error processing sources with -private
jjg
parents:
diff changeset
    51
    public static final int static_final = 4;
01a225608c25 8010310: [javadoc] Error processing sources with -private
jjg
parents:
diff changeset
    52
01a225608c25 8010310: [javadoc] Error processing sources with -private
jjg
parents:
diff changeset
    53
    public static final int array_index = array[0];
01a225608c25 8010310: [javadoc] Error processing sources with -private
jjg
parents:
diff changeset
    54
    public static final int method_call = method(0);
01a225608c25 8010310: [javadoc] Error processing sources with -private
jjg
parents:
diff changeset
    55
    public static final int inner_class = new Test() { }.method(0);
01a225608c25 8010310: [javadoc] Error processing sources with -private
jjg
parents:
diff changeset
    56
    public static final int new_class = new Test().method(0);
01a225608c25 8010310: [javadoc] Error processing sources with -private
jjg
parents:
diff changeset
    57
    public static final int pre_inc = ++value;
01a225608c25 8010310: [javadoc] Error processing sources with -private
jjg
parents:
diff changeset
    58
    public static final int pre_dec = --value;
01a225608c25 8010310: [javadoc] Error processing sources with -private
jjg
parents:
diff changeset
    59
    public static final int post_inc = value++;
01a225608c25 8010310: [javadoc] Error processing sources with -private
jjg
parents:
diff changeset
    60
    public static final int post_dec = value--;
01a225608c25 8010310: [javadoc] Error processing sources with -private
jjg
parents:
diff changeset
    61
}
01a225608c25 8010310: [javadoc] Error processing sources with -private
jjg
parents:
diff changeset
    62