All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.ghostwriter.openjdk.v8.Javac8Instrumenter Maven / Gradle / Ivy

There is a newer version: 0.7.2
Show newest version
package io.ghostwriter.openjdk.v8;

import com.sun.source.util.Trees;
import io.ghostwriter.openjdk.v7.Javac7Instrumenter;
import io.ghostwriter.openjdk.v7.ast.compiler.JavaCompilerHelper;
import io.ghostwriter.openjdk.v7.ast.translator.MethodTranslator;
import io.ghostwriter.openjdk.v7.model.Method;
import io.ghostwriter.openjdk.v8.ast.compiler.Javac;
import io.ghostwriter.openjdk.v8.ast.translator.LambdaAwareMethodTranslator;

import javax.annotation.processing.ProcessingEnvironment;
import java.util.List;


public class Javac8Instrumenter extends Javac7Instrumenter {

    @Override
    public void initialize(ProcessingEnvironment processingEnv) {
        setTrees(Trees.instance(processingEnv));
        final Javac javac8 = new Javac(processingEnv);
        setJavac(javac8);
        setJavacHelper(new JavaCompilerHelper(javac8));
        initializeExcludedNames(processingEnv);
    }

    @Override
    protected void instrumentMethods(List methodModels) {
        MethodTranslator mt = new LambdaAwareMethodTranslator(getJavac(), getJavacHelper());

        methodModels.stream().forEach(mt::translate);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy