use of com.sun.source.util.JavacTask in project ceylon by eclipse.
the class T6199075 method compileAndCheck.
void compileAndCheck(VarargsMethod m1, VarargsMethod m2, TypeKind actual, ArgumentsArity argsArity) throws Exception {
final JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
JavaSource source = new JavaSource(m1, m2, actual, argsArity);
ErrorChecker ec = new ErrorChecker();
JavacTask ct = (JavacTask) tool.getTask(null, fm, ec, null, null, Arrays.asList(source));
ct.generate();
check(source, ec, m1, m2, actual, argsArity);
}
use of com.sun.source.util.JavacTask in project ceylon by eclipse.
the class T7042566 method compileAndCheck.
void compileAndCheck() throws Exception {
final JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
JavaSource source = new JavaSource();
ErrorChecker ec = new ErrorChecker();
JavacTask ct = (JavacTask) tool.getTask(null, fm, ec, null, null, Arrays.asList(source));
ct.call();
check(source, ec);
}
use of com.sun.source.util.JavacTask in project ceylon by eclipse.
the class T7043922 method compileAndCheck.
void compileAndCheck() throws Exception {
JavaSource source = new JavaSource();
ErrorChecker ec = new ErrorChecker();
JavacTask ct = (JavacTask) tool.getTask(null, fm, ec, null, null, Arrays.asList(source));
ct.analyze();
if (ec.errorFound) {
throw new Error("invalid diagnostics for source:\n" + source.getCharContent(true) + "\nCompiler diagnostics:\n" + ec.printDiags());
}
}
use of com.sun.source.util.JavacTask in project ceylon by eclipse.
the class Warn4 method test.
static void test(SourceLevel sourceLevel, TrustMe trustMe, SuppressLevel suppressLevelClient, SuppressLevel suppressLevelDecl, ModifierKind modKind, Signature vararg_meth, Signature client_meth) throws Exception {
final JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
JavaSource source = new JavaSource(trustMe, suppressLevelClient, suppressLevelDecl, modKind, vararg_meth, client_meth);
DiagnosticChecker dc = new DiagnosticChecker();
JavacTask ct = (JavacTask) tool.getTask(null, fm, dc, Arrays.asList("-Xlint:unchecked", "-source", sourceLevel.sourceKey), null, Arrays.asList(source));
// to get mandatory notes
ct.generate();
check(dc.warnings, sourceLevel, new boolean[] { vararg_meth.giveUnchecked(client_meth), vararg_meth.giveVarargs(client_meth) }, source, trustMe, suppressLevelClient, suppressLevelDecl, modKind);
}
use of com.sun.source.util.JavacTask in project ceylon by eclipse.
the class Warn5 method test.
static void test(SourceLevel sourceLevel, XlintOption xlint, TrustMe trustMe, SuppressLevel suppressLevel, ModifierKind modKind, MethodKind methKind, SignatureKind sig, BodyKind body) throws Exception {
final JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
JavaSource source = new JavaSource(trustMe, suppressLevel, modKind, methKind, sig, body);
DiagnosticChecker dc = new DiagnosticChecker();
JavacTask ct = (JavacTask) tool.getTask(null, fm, dc, Arrays.asList(xlint.getXlintOption(), "-source", sourceLevel.sourceKey), null, Arrays.asList(source));
ct.analyze();
check(sourceLevel, dc, source, xlint, trustMe, suppressLevel, modKind, methKind, sig, body);
}
Aggregations