Java Code Examples for com.sun.tools.javac.api.JavacTaskImpl#addTaskListener()

The following examples show how to use com.sun.tools.javac.api.JavacTaskImpl#addTaskListener() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestInvokeDynamic.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public void run() {
    int id = checkCount.incrementAndGet();
    JavaSource source = new JavaSource(id);
    JavacTaskImpl ct = (JavacTaskImpl)comp.getTask(null, fm.get(), dc,
            Arrays.asList("-g"), null, Arrays.asList(source));
    Context context = ct.getContext();
    Symtab syms = Symtab.instance(context);
    Names names = Names.instance(context);
    Types types = Types.instance(context);
    ct.addTaskListener(new Indifier(syms, names, types));
    try {
        ct.generate();
    } catch (Throwable t) {
        t.printStackTrace();
        throw new AssertionError(
                String.format("Error thrown when compiling following code\n%s",
                source.source));
    }
    if (dc.diagFound) {
        throw new AssertionError(
                String.format("Diags found when compiling following code\n%s\n\n%s",
                source.source, dc.printDiags()));
    }
    verifyBytecode(id);
}
 
Example 2
Source File: TestInvokeDynamic.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public void run() {
    int id = checkCount.incrementAndGet();
    JavaSource source = new JavaSource(id);
    JavacTaskImpl ct = (JavacTaskImpl)comp.getTask(null, fm.get(), dc,
            Arrays.asList("-g"), null, Arrays.asList(source));
    Context context = ct.getContext();
    Symtab syms = Symtab.instance(context);
    Names names = Names.instance(context);
    Types types = Types.instance(context);
    ct.addTaskListener(new Indifier(syms, names, types));
    try {
        ct.generate();
    } catch (Throwable t) {
        t.printStackTrace();
        throw new AssertionError(
                String.format("Error thrown when compiling following code\n%s",
                source.source));
    }
    if (dc.diagFound) {
        throw new AssertionError(
                String.format("Diags found when compiling following code\n%s\n\n%s",
                source.source, dc.printDiags()));
    }
    verifyBytecode(id);
}
 
Example 3
Source File: TestInvokeDynamic.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public void run() {
    int id = checkCount.incrementAndGet();
    JavaSource source = new JavaSource(id);
    JavacTaskImpl ct = (JavacTaskImpl)comp.getTask(null, fm.get(), dc,
            Arrays.asList("-g"), null, Arrays.asList(source));
    Context context = ct.getContext();
    Symtab syms = Symtab.instance(context);
    Names names = Names.instance(context);
    Types types = Types.instance(context);
    ct.addTaskListener(new Indifier(syms, names, types));
    try {
        ct.generate();
    } catch (Throwable t) {
        t.printStackTrace();
        throw new AssertionError(
                String.format("Error thrown when compiling following code\n%s",
                source.source));
    }
    if (dc.diagFound) {
        throw new AssertionError(
                String.format("Diags found when compiling following code\n%s\n\n%s",
                source.source, dc.printDiags()));
    }
    verifyBytecode(id);
}
 
Example 4
Source File: TestInvokeDynamic.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public void run() {
    int id = checkCount.incrementAndGet();
    JavaSource source = new JavaSource(id);
    JavacTaskImpl ct = (JavacTaskImpl)comp.getTask(null, fm.get(), dc,
            Arrays.asList("-g"), null, Arrays.asList(source));
    Context context = ct.getContext();
    Symtab syms = Symtab.instance(context);
    Names names = Names.instance(context);
    Types types = Types.instance(context);
    ct.addTaskListener(new Indifier(syms, names, types));
    try {
        ct.generate();
    } catch (Throwable t) {
        t.printStackTrace();
        throw new AssertionError(
                String.format("Error thrown when compiling following code\n%s",
                source.source));
    }
    if (dc.diagFound) {
        throw new AssertionError(
                String.format("Diags found when compiling following code\n%s\n\n%s",
                source.source, dc.printDiags()));
    }
    verifyBytecode(id);
}
 
Example 5
Source File: TestBootstrapMethodsCount.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public void run(JavaCompiler comp) {
    JavaSource source = new JavaSource();
    JavacTaskImpl ct = (JavacTaskImpl)comp.getTask(null, null, dc,
            Arrays.asList("-g"), null, Arrays.asList(source));
    Context context = ct.getContext();
    Symtab syms = Symtab.instance(context);
    Names names = Names.instance(context);
    Types types = Types.instance(context);
    ct.addTaskListener(new Indifier(syms, names, types));
    try {
        ct.generate();
    } catch (Throwable t) {
        t.printStackTrace();
        throw new AssertionError(
                String.format("Error thrown when compiling following code\n%s",
                        source.source));
    }
    if (dc.diagFound) {
        throw new AssertionError(
                String.format("Diags found when compiling following code\n%s\n\n%s",
                        source.source, dc.printDiags()));
    }
    verifyBytecode();
}
 
Example 6
Source File: TestInvokeDynamic.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public void run() {
    int id = checkCount.incrementAndGet();
    JavaSource source = new JavaSource(id);
    JavacTaskImpl ct = (JavacTaskImpl)comp.getTask(null, fm.get(), dc,
            Arrays.asList("-g"), null, Arrays.asList(source));
    Context context = ct.getContext();
    Symtab syms = Symtab.instance(context);
    Names names = Names.instance(context);
    Types types = Types.instance(context);
    ct.addTaskListener(new Indifier(syms, names, types));
    try {
        ct.generate();
    } catch (Throwable t) {
        t.printStackTrace();
        throw new AssertionError(
                String.format("Error thrown when compiling following code\n%s",
                source.source));
    }
    if (dc.diagFound) {
        throw new AssertionError(
                String.format("Diags found when compiling following code\n%s\n\n%s",
                source.source, dc.printDiags()));
    }
    verifyBytecode(id);
}
 
Example 7
Source File: TestInvokeDynamic.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public void run() {
    int id = checkCount.incrementAndGet();
    JavaSource source = new JavaSource(id);
    JavacTaskImpl ct = (JavacTaskImpl)comp.getTask(null, fm.get(), dc,
            Arrays.asList("-g"), null, Arrays.asList(source));
    Context context = ct.getContext();
    Symtab syms = Symtab.instance(context);
    Names names = Names.instance(context);
    Types types = Types.instance(context);
    ct.addTaskListener(new Indifier(syms, names, types));
    try {
        ct.generate();
    } catch (Throwable t) {
        t.printStackTrace();
        throw new AssertionError(
                String.format("Error thrown when compiling following code\n%s",
                source.source));
    }
    if (dc.diagFound) {
        throw new AssertionError(
                String.format("Diags found when compiling following code\n%s\n\n%s",
                source.source, dc.printDiags()));
    }
    verifyBytecode(id);
}
 
Example 8
Source File: TestInvokeDynamic.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public void run() {
    int id = checkCount.incrementAndGet();
    JavaSource source = new JavaSource(id);
    JavacTaskImpl ct = (JavacTaskImpl)comp.getTask(null, fm.get(), dc,
            Arrays.asList("-g"), null, Arrays.asList(source));
    Context context = ct.getContext();
    Symtab syms = Symtab.instance(context);
    Names names = Names.instance(context);
    Types types = Types.instance(context);
    ct.addTaskListener(new Indifier(syms, names, types));
    try {
        ct.generate();
    } catch (Throwable t) {
        t.printStackTrace();
        throw new AssertionError(
                String.format("Error thrown when compiling following code\n%s",
                source.source));
    }
    if (dc.diagFound) {
        throw new AssertionError(
                String.format("Diags found when compiling following code\n%s\n\n%s",
                source.source, dc.printDiags()));
    }
    verifyBytecode(id);
}
 
Example 9
Source File: TestInvokeDynamic.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void doWork() throws IOException {
    ComboTask comboTask = newCompilationTask()
            .withOption("-g")
            .withSourceFromTemplate(source_template);

    JavacTaskImpl ct = (JavacTaskImpl)comboTask.getTask();
    Context context = ct.getContext();
    Symtab syms = Symtab.instance(context);
    Names names = Names.instance(context);
    Types types = Types.instance(context);
    ct.addTaskListener(new Indifier(syms, names, types));
    verifyBytecode(comboTask.generate());
}