/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/* @test
* @bug 6813059
* @summary
*/
// Simple test of -XDshouldStopPolicy.
// For each of the permissable values, we compile a file with an error in it,
// then using -XDverboseCompilePolicy we check that the compilation gets as
// far as expected, but no further.
public class Test {
enum ShouldStopPolicy {
this.needOption = needOption;
this.dontExpect = dontExpect;
}
boolean needOption;
}
enum CompilePolicy {
}
}
}
}
if (errors > 0)
}
if (ssp.needOption)
if (rc == 0)
throw new Error("compilation succeeded unexpectedly");
//System.err.println(sw);
// The following is a workaround for the current javac implementation,
// that in bytodo mode, it will still attribute files after syntax errors.
// Changing that behavior may surprise existing users, so for now, we
// work around it.
foundExpected = true;
return;
}
}
if (!foundExpected)
}
errors++;
}
int errors;
}
// These tests test the ability of the compiler to continue in the face of
// errors, accordining to the shouldStopPolicy
/* @ test /nodynamiccopyright/
* @bug 6813059
* @summary
* @compile/fail/ref=flow.out -XDrawDiagnostics -XDcompilePolicy=byfile -XDverboseCompilePolicy -XDshouldStopPolicy=FLOW Test.java
* @compile/fail/ref=default.out -XDrawDiagnostics -XDcompilePolicy=byfile -XDverboseCompilePolicy Test.java
* @compile/fail/ref=enter.out -XDrawDiagnostics -XDcompilePolicy=byfile -XDverboseCompilePolicy -XDshouldStopPolicy=ENTER Test.java
* @compile/fail/ref=attr.out -XDrawDiagnostics -XDcompilePolicy=byfile -XDverboseCompilePolicy -XDshouldStopPolicy=ATTR Test.java
* @compile/fail/ref=transtypes.out -XDrawDiagnostics -XDcompilePolicy=byfile -XDverboseCompilePolicy -XDshouldStopPolicy=TRANSTYPES Test.java
* @compile/fail/ref=lower.out -XDrawDiagnostics -XDcompilePolicy=byfile -XDverboseCompilePolicy -XDshouldStopPolicy=LOWER Test.java
* @compile/fail/ref=generate.out -XDrawDiagnostics -XDcompilePolicy=byfile -XDverboseCompilePolicy -XDshouldStopPolicy=GENERATE Test.java
*/
/*
class Test {
void m1() {
System.err.println("hello");
0 // syntax error
System.err.println("world");
}
void m2() {
}
}
class Test2 {
}
*/