langtools/test/tools/javac/policy/test3/Test.java
author ohair
Tue, 25 May 2010 15:54:51 -0700
changeset 5520 86e4b9a9da40
parent 2514 f8929e3790b4
child 17799 0ce3b298b678
permissions -rw-r--r--
6943119: Rebrand source copyright notices Reviewed-by: darcy
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2514
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
     1
/*
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 2514
diff changeset
     2
 * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
2514
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
     4
 *
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
     7
 * published by the Free Software Foundation.
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
     8
 *
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    13
 * accompanied this code).
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    14
 *
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    18
 *
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 2514
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 2514
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 2514
diff changeset
    21
 * questions.
2514
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    22
 */
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    23
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    24
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    25
/* @test
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    26
 * @bug 6813059
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    27
 * @summary
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    28
 */
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    29
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    30
import java.io.*;
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    31
import java.util.*;
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    32
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    33
// Simple test of -XDshouldStopPolicy.
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    34
// For each of the permissable values, we compile a file with an error in it,
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    35
// then using -XDverboseCompilePolicy we check that the compilation gets as
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    36
// far as expected, but no further.
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    37
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    38
public class Test {
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    39
    enum ShouldStopPolicy {
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    40
        BLANK(false, null, "attr"),
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    41
        PROCESS(true, null, "attr"),
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    42
        ATTR(true, "attr", "flow"),
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    43
        FLOW(true, "flow", "desugar"),
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    44
        TRANSTYPES(true, "desugar", "generate"),
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    45
        LOWER(true, "desugar", "generate"),
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    46
        GENERATE(true, "generate", null);
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    47
        ShouldStopPolicy(boolean needOption, String expect, String dontExpect) {
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    48
            this.needOption = needOption;
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    49
            this.expect = expect;
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    50
            this.dontExpect = dontExpect;
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    51
        }
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    52
        boolean needOption;
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    53
        String expect;
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    54
        String dontExpect;
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    55
    }
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    56
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    57
    enum CompilePolicy {
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    58
        BYFILE,
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    59
        BYTODO
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    60
    }
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    61
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    62
    public static void main(String... args) throws Exception {
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    63
        new Test().run();
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    64
    }
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    65
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    66
    public void run() throws Exception {
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    67
        for (CompilePolicy cp: CompilePolicy.values()) {
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    68
            for (ShouldStopPolicy ssp: ShouldStopPolicy.values()) {
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    69
                test(cp, ssp);
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    70
            }
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    71
        }
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    72
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    73
        if (errors > 0)
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    74
            throw new Exception(errors + " errors occurred");
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    75
    }
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    76
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    77
    public void test(CompilePolicy cp, ShouldStopPolicy ssp) {
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    78
        System.err.println();
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    79
        System.err.println("test " + cp + " " + ssp);
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    80
        List<String> args = new ArrayList<String>();
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    81
        args.add("-XDverboseCompilePolicy");
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    82
        args.add("-XDcompilePolicy=" + cp.toString().toLowerCase());
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    83
        args.add("-d");
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    84
        args.add(".");
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    85
        if (ssp.needOption)
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    86
            args.add("-XDshouldStopPolicy=" + ssp);
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    87
        args.add(new File(System.getProperty("test.src", "."), "A.java").getPath());
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    88
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    89
        StringWriter sw = new StringWriter();
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    90
        PrintWriter pw = new PrintWriter(sw);
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    91
        System.err.println("compile " + args);
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    92
        int rc = com.sun.tools.javac.Main.compile(args.toArray(new String[args.size()]), pw);
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    93
        if (rc == 0)
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    94
            throw new Error("compilation succeeded unexpectedly");
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    95
        //System.err.println(sw);
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    96
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    97
        // The following is a workaround for the current javac implementation,
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    98
        // that in bytodo mode, it will still attribute files after syntax errors.
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
    99
        // Changing that behavior may surprise existing users, so for now, we
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
   100
        // work around it.
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
   101
        if (cp == CompilePolicy.BYTODO && ssp == ShouldStopPolicy.PROCESS)
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
   102
            ssp = ShouldStopPolicy.ATTR;
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
   103
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
   104
        boolean foundExpected = (ssp.expect == null);
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
   105
        String[] lines = sw.toString().split("\n");
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
   106
        for (String line: lines) {
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
   107
            if (ssp.expect != null && line.startsWith("[" + ssp.expect))
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
   108
                foundExpected = true;
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
   109
            if (ssp.dontExpect != null && line.startsWith("[" + ssp.dontExpect)) {
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
   110
                error("Unexpected output: " + ssp.dontExpect + "\n" + sw);
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
   111
                return;
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
   112
            }
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
   113
        }
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
   114
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
   115
        if (!foundExpected)
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
   116
            error("Expected output not found: " + ssp.expect + "\n" + sw);
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
   117
    }
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
   118
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
   119
    void error(String message) {
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
   120
        System.err.println(message);
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
   121
        errors++;
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
   122
    }
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
   123
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
   124
    int errors;
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
   125
}
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
   126
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
   127
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
   128
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
   129
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
   130
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
   131
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
   132
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
   133
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
   134
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
   135
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
   136
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
   137
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
   138
// These tests test the ability of the compiler to continue in the face of
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
   139
// errors, accordining to the shouldStopPolicy
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
   140
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
   141
/* @ test /nodynamiccopyright/
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
   142
 * @bug 6813059
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
   143
 * @summary
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
   144
 * @compile/fail/ref=flow.out       -XDrawDiagnostics -XDcompilePolicy=byfile -XDverboseCompilePolicy -XDshouldStopPolicy=FLOW       Test.java
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
   145
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
   146
 * @compile/fail/ref=default.out    -XDrawDiagnostics -XDcompilePolicy=byfile -XDverboseCompilePolicy                                Test.java
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
   147
 * @compile/fail/ref=enter.out      -XDrawDiagnostics -XDcompilePolicy=byfile -XDverboseCompilePolicy -XDshouldStopPolicy=ENTER      Test.java
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
   148
 * @compile/fail/ref=attr.out       -XDrawDiagnostics -XDcompilePolicy=byfile -XDverboseCompilePolicy -XDshouldStopPolicy=ATTR       Test.java
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
   149
 * @compile/fail/ref=transtypes.out -XDrawDiagnostics -XDcompilePolicy=byfile -XDverboseCompilePolicy -XDshouldStopPolicy=TRANSTYPES Test.java
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
   150
 * @compile/fail/ref=lower.out      -XDrawDiagnostics -XDcompilePolicy=byfile -XDverboseCompilePolicy -XDshouldStopPolicy=LOWER      Test.java
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
   151
 * @compile/fail/ref=generate.out   -XDrawDiagnostics -XDcompilePolicy=byfile -XDverboseCompilePolicy -XDshouldStopPolicy=GENERATE   Test.java
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
   152
 */
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
   153
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
   154
/*
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
   155
class Test {
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
   156
    void m1() {
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
   157
        System.err.println("hello");
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
   158
        0 // syntax error
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
   159
        System.err.println("world");
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
   160
    }
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
   161
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
   162
    void m2() {
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
   163
    }
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
   164
}
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
   165
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
   166
class Test2 {
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
   167
}
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
   168
*/
f8929e3790b4 6813059: replace use of JavaCompiler.errorCount with shouldContinue
jjg
parents:
diff changeset
   169