com.sun.tools.javac.model.JavacElements Java Examples

The following examples show how to use com.sun.tools.javac.model.JavacElements. 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 Project: TencentKona-8   Author: Tencent   File: TestContext.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
    round++;

    JavacProcessingEnvironment jpe = (JavacProcessingEnvironment) processingEnv;
    Context c = jpe.getContext();
    check(c.get(JavacElements.class), eltUtils);
    check(c.get(JavacTypes.class), typeUtils);
    check(c.get(JavacTrees.class), treeUtils);

    final int MAXROUNDS = 3;
    if (round < MAXROUNDS)
        generateSource("Gen" + round);

    return true;
}
 
Example #2
Source Project: jdk8u60   Author: chenghanpeng   File: TestContext.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
    round++;

    JavacProcessingEnvironment jpe = (JavacProcessingEnvironment) processingEnv;
    Context c = jpe.getContext();
    check(c.get(JavacElements.class), eltUtils);
    check(c.get(JavacTypes.class), typeUtils);
    check(c.get(JavacTrees.class), treeUtils);

    final int MAXROUNDS = 3;
    if (round < MAXROUNDS)
        generateSource("Gen" + round);

    return true;
}
 
Example #3
Source Project: openjdk-jdk8u   Author: AdoptOpenJDK   File: TestContext.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
    round++;

    JavacProcessingEnvironment jpe = (JavacProcessingEnvironment) processingEnv;
    Context c = jpe.getContext();
    check(c.get(JavacElements.class), eltUtils);
    check(c.get(JavacTypes.class), typeUtils);
    check(c.get(JavacTrees.class), treeUtils);

    final int MAXROUNDS = 3;
    if (round < MAXROUNDS)
        generateSource("Gen" + round);

    return true;
}
 
Example #4
Source Project: lua-for-android   Author: qtiuto   File: JavacTrees.java    License: BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
private void init(Context context) {
    modules = Modules.instance(context);
    attr = Attr.instance(context);
    enter = Enter.instance(context);
    elements = JavacElements.instance(context);
    log = Log.instance(context);
    resolve = Resolve.instance(context);
    treeMaker = TreeMaker.instance(context);
    memberEnter = MemberEnter.instance(context);
    names = Names.instance(context);
    types = Types.instance(context);
    docTreeMaker = DocTreeMaker.instance(context);
    parser = ParserFactory.instance(context);
    syms = Symtab.instance(context);
    fileManager = context.get(JavaFileManager.class);
    JavacTask t = context.get(JavacTask.class);
    if (t instanceof JavacTaskImpl)
        javacTaskImpl = (JavacTaskImpl) t;
}
 
Example #5
Source Project: netbeans   Author: apache   File: ElementUtilities.java    License: Apache License 2.0 6 votes vote down vote up
/**Return variables declared in the given scope.
 */
public Iterable<? extends Element> getLocalVars(Scope scope, ElementAcceptor acceptor) {
    ArrayList<Element> members = new ArrayList<Element>();
    Elements elements = JavacElements.instance(ctx);
    Types types = JavacTypes.instance(ctx);
    while(scope != null && scope.getEnclosingClass() != null) {
        for (Element local : scope.getLocalElements()) {
            if (acceptor == null || acceptor.accept(local, null)) {
                if (!isHidden(local, members, elements, types)) {
                    members.add(local);
                }
            }
        }
        scope = scope.getEnclosingScope();
    }
    return members;
}
 
Example #6
Source Project: openjdk-jdk8u-backup   Author: AdoptOpenJDK   File: TestContext.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
    round++;

    JavacProcessingEnvironment jpe = (JavacProcessingEnvironment) processingEnv;
    Context c = jpe.getContext();
    check(c.get(JavacElements.class), eltUtils);
    check(c.get(JavacTypes.class), typeUtils);
    check(c.get(JavacTrees.class), treeUtils);

    final int MAXROUNDS = 3;
    if (round < MAXROUNDS)
        generateSource("Gen" + round);

    return true;
}
 
Example #7
Source Project: openjdk-8-source   Author: keerath   File: TestContext.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
    round++;

    JavacProcessingEnvironment jpe = (JavacProcessingEnvironment) processingEnv;
    Context c = jpe.getContext();
    check(c.get(JavacElements.class), eltUtils);
    check(c.get(JavacTypes.class), typeUtils);
    check(c.get(JavacTrees.class), treeUtils);

    final int MAXROUNDS = 3;
    if (round < MAXROUNDS)
        generateSource("Gen" + round);

    return true;
}
 
Example #8
Source Project: openjdk-jdk9   Author: AdoptOpenJDK   File: JavacTrees.java    License: GNU General Public License v2.0 6 votes vote down vote up
private void init(Context context) {
    modules = Modules.instance(context);
    attr = Attr.instance(context);
    enter = Enter.instance(context);
    elements = JavacElements.instance(context);
    log = Log.instance(context);
    resolve = Resolve.instance(context);
    treeMaker = TreeMaker.instance(context);
    memberEnter = MemberEnter.instance(context);
    names = Names.instance(context);
    types = Types.instance(context);
    docTreeMaker = DocTreeMaker.instance(context);
    parser = ParserFactory.instance(context);
    syms = Symtab.instance(context);
    fileManager = context.get(JavaFileManager.class);
    JavacTask t = context.get(JavacTask.class);
    if (t instanceof JavacTaskImpl)
        javacTaskImpl = (JavacTaskImpl) t;
}
 
Example #9
Source Project: openjdk-jdk9   Author: AdoptOpenJDK   File: ToolEnvironment.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Constructor
 *
 * @param context      Context for this javadoc instance.
 */
protected ToolEnvironment(Context context) {
    context.put(ToolEnvKey, this);
    this.context = context;

    messager = Messager.instance0(context);
    syms = Symtab.instance(context);
    finder = JavadocClassFinder.instance(context);
    enter = JavadocEnter.instance(context);
    names = Names.instance(context);
    externalizableSym = syms.enterClass(syms.java_base, names.fromString("java.io.Externalizable"));
    chk = Check.instance(context);
    types = com.sun.tools.javac.code.Types.instance(context);
    fileManager = context.get(JavaFileManager.class);
    if (fileManager instanceof JavacFileManager) {
        ((JavacFileManager)fileManager).setSymbolFileEnabled(false);
    }
    docTrees = JavacTrees.instance(context);
    source = Source.instance(context);
    elements =  JavacElements.instance(context);
    typeutils = JavacTypes.instance(context);
    elementToTreePath = new HashMap<>();
}
 
Example #10
Source Project: openjdk-jdk9   Author: AdoptOpenJDK   File: TestContext.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
    round++;

    JavacProcessingEnvironment jpe = (JavacProcessingEnvironment) processingEnv;
    Context c = jpe.getContext();
    check(c.get(JavacElements.class), eltUtils);
    check(c.get(JavacTypes.class), typeUtils);
    check(c.get(JavacTrees.class), treeUtils);

    final int MAXROUNDS = 3;
    if (round < MAXROUNDS)
        generateSource("Gen" + round);

    return true;
}
 
Example #11
Source Project: manifold   Author: manifold-systems   File: ExtensionTransformer.java    License: Apache License 2.0 6 votes vote down vote up
private JCExpression classForNameCall( Type type, JCTree tree )
{
  TreeMaker make = _tp.getTreeMaker();
  JavacElements javacElems = _tp.getElementUtil();

  JCTree.JCMethodInvocation typeCall = make.Apply( List.nil(),
    memberAccess( make, javacElems, ReflectUtil.class.getName() + ".type" ),
    List.of( make.Literal( makeLiteralName( type ) ) ) );
  typeCall.setPos( Position.NOPOS );
  typeCall.type = _tp.getSymtab().classType;
  JCTree.JCFieldAccess newMethodSelect = (JCTree.JCFieldAccess)typeCall.getMethodSelect();

  Symbol.ClassSymbol reflectMethodClassSym =
    IDynamicJdk.instance().getTypeElement( _tp.getContext(), _tp.getCompilationUnit(), ReflectUtil.class.getName() );
  Symbol.MethodSymbol typeMethodSymbol = resolveMethod( tree.pos(),
    Names.instance( _tp.getContext() ).fromString( "type" ),
    reflectMethodClassSym.type, List.of( _tp.getSymtab().stringType ) );
  newMethodSelect.sym = typeMethodSymbol;
  newMethodSelect.type = typeMethodSymbol.type;
  newMethodSelect.pos = tree.pos;
  assignTypes( newMethodSelect.selected, reflectMethodClassSym );

  return typeCall;
}
 
Example #12
Source Project: manifold   Author: manifold-systems   File: ManTypes.java    License: Apache License 2.0 6 votes vote down vote up
private void reassignEarlyHolders8( Context context )
{
  ReflectUtil.field( Annotate.instance( context ), TYPES_FIELD ).set( this );
  ReflectUtil.field( Attr.instance( context ), TYPES_FIELD ).set( this );
  ReflectUtil.field( Check.instance( context ), TYPES_FIELD ).set( this );
  ReflectUtil.field( DeferredAttr.instance( context ), TYPES_FIELD ).set( this );
  ReflectUtil.field( Flow.instance( context ), TYPES_FIELD ).set( this );
  ReflectUtil.field( Gen.instance( context ), TYPES_FIELD ).set( this );
  ReflectUtil.field( Infer.instance( context ), TYPES_FIELD ).set( this );
  ReflectUtil.field( JavaCompiler.instance( context ), TYPES_FIELD ).set( this );
  ReflectUtil.field( JavacTrees.instance( context ), TYPES_FIELD ).set( this );
  ReflectUtil.field( JavacTypes.instance( context ), TYPES_FIELD ).set( this );
  ReflectUtil.field( JavacElements.instance( context ), TYPES_FIELD ).set( this );
  ReflectUtil.field( LambdaToMethod.instance( context ), TYPES_FIELD ).set( this );
  ReflectUtil.field( Lower.instance( context ), TYPES_FIELD ).set( this );
  ReflectUtil.field( ManResolve.instance( context ), TYPES_FIELD ).set( this );
  ReflectUtil.field( MemberEnter.instance( context ), TYPES_FIELD ).set( this );
  ReflectUtil.field( RichDiagnosticFormatter.instance( context ), TYPES_FIELD ).set( this );
  ReflectUtil.field( TransTypes.instance( context ), TYPES_FIELD ).set( this );
}
 
Example #13
Source Project: TencentKona-8   Author: Tencent   File: JNIWriter.java    License: GNU General Public License v2.0 5 votes vote down vote up
private void lazyInit() {
    if (mangler == null) {
        elements = JavacElements.instance(context);
        types = JavacTypes.instance(context);
        mangler = new Mangle(elements, types);
    }
}
 
Example #14
Source Project: TencentKona-8   Author: Tencent   File: JavacProcessingEnvironment.java    License: GNU General Public License v2.0 5 votes vote down vote up
protected JavacProcessingEnvironment(Context context) {
    this.context = context;
    context.put(JavacProcessingEnvironment.class, this);
    log = Log.instance(context);
    source = Source.instance(context);
    diags = JCDiagnostic.Factory.instance(context);
    options = Options.instance(context);
    printProcessorInfo = options.isSet(XPRINTPROCESSORINFO);
    printRounds = options.isSet(XPRINTROUNDS);
    verbose = options.isSet(VERBOSE);
    lint = Lint.instance(context).isEnabled(PROCESSING);
    if (options.isSet(PROC, "only") || options.isSet(XPRINT)) {
        JavaCompiler compiler = JavaCompiler.instance(context);
        compiler.shouldStopPolicyIfNoError = CompileState.PROCESS;
    }
    fatalErrors = options.isSet("fatalEnterError");
    showResolveErrors = options.isSet("showResolveErrors");
    werror = options.isSet(WERROR);
    platformAnnotations = initPlatformAnnotations();

    // Initialize services before any processors are initialized
    // in case processors use them.
    filer = new JavacFiler(context);
    messager = new JavacMessager(context, this);
    elementUtils = JavacElements.instance(context);
    typeUtils = JavacTypes.instance(context);
    processorOptions = initProcessorOptions(context);
    unmatchedProcessorOptions = initUnmatchedProcessorOptions();
    messages = JavacMessages.instance(context);
    taskListener = MultiTaskListener.instance(context);
    initProcessorClassLoader();
}
 
Example #15
Source Project: openjdk-8   Author: bpupadhyaya   File: JNIWriter.java    License: GNU General Public License v2.0 5 votes vote down vote up
private void lazyInit() {
    if (mangler == null) {
        elements = JavacElements.instance(context);
        types = JavacTypes.instance(context);
        mangler = new Mangle(elements, types);
    }
}
 
Example #16
Source Project: TencentKona-8   Author: Tencent   File: JavacTrees.java    License: GNU General Public License v2.0 5 votes vote down vote up
private void init(Context context) {
    attr = Attr.instance(context);
    enter = Enter.instance(context);
    elements = JavacElements.instance(context);
    log = Log.instance(context);
    resolve = Resolve.instance(context);
    treeMaker = TreeMaker.instance(context);
    memberEnter = MemberEnter.instance(context);
    names = Names.instance(context);
    types = Types.instance(context);

    JavacTask t = context.get(JavacTask.class);
    if (t instanceof JavacTaskImpl)
        javacTaskImpl = (JavacTaskImpl) t;
}
 
Example #17
Source Project: hottub   Author: dsrg-uoft   File: JavacProcessingEnvironment.java    License: GNU General Public License v2.0 5 votes vote down vote up
protected JavacProcessingEnvironment(Context context) {
    this.context = context;
    context.put(JavacProcessingEnvironment.class, this);
    log = Log.instance(context);
    source = Source.instance(context);
    diags = JCDiagnostic.Factory.instance(context);
    options = Options.instance(context);
    printProcessorInfo = options.isSet(XPRINTPROCESSORINFO);
    printRounds = options.isSet(XPRINTROUNDS);
    verbose = options.isSet(VERBOSE);
    lint = Lint.instance(context).isEnabled(PROCESSING);
    if (options.isSet(PROC, "only") || options.isSet(XPRINT)) {
        JavaCompiler compiler = JavaCompiler.instance(context);
        compiler.shouldStopPolicyIfNoError = CompileState.PROCESS;
    }
    fatalErrors = options.isSet("fatalEnterError");
    showResolveErrors = options.isSet("showResolveErrors");
    werror = options.isSet(WERROR);
    platformAnnotations = initPlatformAnnotations();

    // Initialize services before any processors are initialized
    // in case processors use them.
    filer = new JavacFiler(context);
    messager = new JavacMessager(context, this);
    elementUtils = JavacElements.instance(context);
    typeUtils = JavacTypes.instance(context);
    processorOptions = initProcessorOptions(context);
    unmatchedProcessorOptions = initUnmatchedProcessorOptions();
    messages = JavacMessages.instance(context);
    taskListener = MultiTaskListener.instance(context);
    initProcessorClassLoader();
}
 
Example #18
Source Project: EasyMPermission   Author: mobmead   File: JavacAST.java    License: MIT License 5 votes vote down vote up
/**
 * Creates a new JavacAST of the provided Compilation Unit.
 * 
 * @param messager A Messager for warning and error reporting.
 * @param context A Context object for interfacing with the compiler.
 * @param top The compilation unit, which serves as the top level node in the tree to be built.
 */
public JavacAST(Messager messager, Context context, JCCompilationUnit top) {
	super(sourceName(top), packageDeclaration(top), new JavacImportList(top));
	setTop(buildCompilationUnit(top));
	this.context = context;
	this.messager = messager;
	this.log = Log.instance(context);
	this.elements = JavacElements.instance(context);
	this.treeMaker = new JavacTreeMaker(TreeMaker.instance(context));
	this.symtab = Symtab.instance(context);
	this.javacTypes = JavacTypes.instance(context);
	clearChanged();
}
 
Example #19
Source Project: jdk8u60   Author: chenghanpeng   File: JavacProcessingEnvironment.java    License: GNU General Public License v2.0 5 votes vote down vote up
protected JavacProcessingEnvironment(Context context) {
    this.context = context;
    context.put(JavacProcessingEnvironment.class, this);
    log = Log.instance(context);
    source = Source.instance(context);
    diags = JCDiagnostic.Factory.instance(context);
    options = Options.instance(context);
    printProcessorInfo = options.isSet(XPRINTPROCESSORINFO);
    printRounds = options.isSet(XPRINTROUNDS);
    verbose = options.isSet(VERBOSE);
    lint = Lint.instance(context).isEnabled(PROCESSING);
    if (options.isSet(PROC, "only") || options.isSet(XPRINT)) {
        JavaCompiler compiler = JavaCompiler.instance(context);
        compiler.shouldStopPolicyIfNoError = CompileState.PROCESS;
    }
    fatalErrors = options.isSet("fatalEnterError");
    showResolveErrors = options.isSet("showResolveErrors");
    werror = options.isSet(WERROR);
    platformAnnotations = initPlatformAnnotations();

    // Initialize services before any processors are initialized
    // in case processors use them.
    filer = new JavacFiler(context);
    messager = new JavacMessager(context, this);
    elementUtils = JavacElements.instance(context);
    typeUtils = JavacTypes.instance(context);
    processorOptions = initProcessorOptions(context);
    unmatchedProcessorOptions = initUnmatchedProcessorOptions();
    messages = JavacMessages.instance(context);
    taskListener = MultiTaskListener.instance(context);
    initProcessorClassLoader();
}
 
Example #20
Source Project: jdk8u60   Author: chenghanpeng   File: JavacTrees.java    License: GNU General Public License v2.0 5 votes vote down vote up
private void init(Context context) {
    attr = Attr.instance(context);
    enter = Enter.instance(context);
    elements = JavacElements.instance(context);
    log = Log.instance(context);
    resolve = Resolve.instance(context);
    treeMaker = TreeMaker.instance(context);
    memberEnter = MemberEnter.instance(context);
    names = Names.instance(context);
    types = Types.instance(context);

    JavacTask t = context.get(JavacTask.class);
    if (t instanceof JavacTaskImpl)
        javacTaskImpl = (JavacTaskImpl) t;
}
 
Example #21
Source Project: java-n-IDE-for-Android   Author: shenghuntianlang   File: JavacProcessingEnvironment.java    License: Apache License 2.0 5 votes vote down vote up
public JavacProcessingEnvironment(Context context, Iterable<? extends Processor> processors) {
    this.context = context;
    log = Log.instance(context);
    source = Source.instance(context);
    diags = JCDiagnostic.Factory.instance(context);
    options = Options.instance(context);
    printProcessorInfo = options.isSet(XPRINTPROCESSORINFO);
    printRounds = options.isSet(XPRINTROUNDS);
    verbose = options.isSet(VERBOSE);
    lint = Lint.instance(context).isEnabled(PROCESSING);
    procOnly = options.isSet(PROC, "only") || options.isSet(XPRINT);
    fatalErrors = options.isSet("fatalEnterError");
    showResolveErrors = options.isSet("showResolveErrors");
    werror = options.isSet(WERROR);
    platformAnnotations = initPlatformAnnotations();
    foundTypeProcessors = false;

    // Initialize services before any processors are initialized
    // in case processors use them.
    filer = new JavacFiler(context);
    messager = new JavacMessager(context, this);
    elementUtils = JavacElements.instance(context);
    typeUtils = JavacTypes.instance(context);
    processorOptions = initProcessorOptions(context);
    unmatchedProcessorOptions = initUnmatchedProcessorOptions();
    messages = JavacMessages.instance(context);
    initProcessorIterator(context, processors);
}
 
Example #22
Source Project: openjdk-jdk8u   Author: AdoptOpenJDK   File: JNIWriter.java    License: GNU General Public License v2.0 5 votes vote down vote up
private void lazyInit() {
    if (mangler == null) {
        elements = JavacElements.instance(context);
        types = JavacTypes.instance(context);
        mangler = new Mangle(elements, types);
    }
}
 
Example #23
Source Project: openjdk-jdk8u   Author: AdoptOpenJDK   File: JavacTrees.java    License: GNU General Public License v2.0 5 votes vote down vote up
private void init(Context context) {
    attr = Attr.instance(context);
    enter = Enter.instance(context);
    elements = JavacElements.instance(context);
    log = Log.instance(context);
    resolve = Resolve.instance(context);
    treeMaker = TreeMaker.instance(context);
    memberEnter = MemberEnter.instance(context);
    names = Names.instance(context);
    types = Types.instance(context);

    JavacTask t = context.get(JavacTask.class);
    if (t instanceof JavacTaskImpl)
        javacTaskImpl = (JavacTaskImpl) t;
}
 
Example #24
Source Project: openjdk-8   Author: bpupadhyaya   File: JavacProcessingEnvironment.java    License: GNU General Public License v2.0 5 votes vote down vote up
protected JavacProcessingEnvironment(Context context) {
    this.context = context;
    context.put(JavacProcessingEnvironment.class, this);
    log = Log.instance(context);
    source = Source.instance(context);
    diags = JCDiagnostic.Factory.instance(context);
    options = Options.instance(context);
    printProcessorInfo = options.isSet(XPRINTPROCESSORINFO);
    printRounds = options.isSet(XPRINTROUNDS);
    verbose = options.isSet(VERBOSE);
    lint = Lint.instance(context).isEnabled(PROCESSING);
    if (options.isSet(PROC, "only") || options.isSet(XPRINT)) {
        JavaCompiler compiler = JavaCompiler.instance(context);
        compiler.shouldStopPolicyIfNoError = CompileState.PROCESS;
    }
    fatalErrors = options.isSet("fatalEnterError");
    showResolveErrors = options.isSet("showResolveErrors");
    werror = options.isSet(WERROR);
    platformAnnotations = initPlatformAnnotations();

    // Initialize services before any processors are initialized
    // in case processors use them.
    filer = new JavacFiler(context);
    messager = new JavacMessager(context, this);
    elementUtils = JavacElements.instance(context);
    typeUtils = JavacTypes.instance(context);
    processorOptions = initProcessorOptions(context);
    unmatchedProcessorOptions = initUnmatchedProcessorOptions();
    messages = JavacMessages.instance(context);
    taskListener = MultiTaskListener.instance(context);
    initProcessorClassLoader();
}
 
Example #25
Source Project: hottub   Author: dsrg-uoft   File: JavacTrees.java    License: GNU General Public License v2.0 5 votes vote down vote up
private void init(Context context) {
    attr = Attr.instance(context);
    enter = Enter.instance(context);
    elements = JavacElements.instance(context);
    log = Log.instance(context);
    resolve = Resolve.instance(context);
    treeMaker = TreeMaker.instance(context);
    memberEnter = MemberEnter.instance(context);
    names = Names.instance(context);
    types = Types.instance(context);

    JavacTask t = context.get(JavacTask.class);
    if (t instanceof JavacTaskImpl)
        javacTaskImpl = (JavacTaskImpl) t;
}
 
Example #26
Source Project: lua-for-android   Author: qtiuto   File: JavacFiler.java    License: BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
JavacFiler(Context context) {
    this.context = context;
    fileManager = context.get(JavaFileManager.class);
    elementUtils = JavacElements.instance(context);

    log = Log.instance(context);
    modules = Modules.instance(context);
    names = Names.instance(context);
    syms = Symtab.instance(context);

    initialInputs = synchronizedSet(new LinkedHashSet<>());
    fileObjectHistory = synchronizedSet(new LinkedHashSet<>());
    generatedSourceNames = synchronizedSet(new LinkedHashSet<>());
    generatedSourceFileObjects = synchronizedSet(new LinkedHashSet<>());

    generatedClasses = synchronizedMap(new LinkedHashMap<>());

    openTypeNames  = synchronizedSet(new LinkedHashSet<>());

    aggregateGeneratedSourceNames = new LinkedHashSet<>();
    aggregateGeneratedClassNames  = new LinkedHashSet<>();
    initialClassNames  = new LinkedHashSet<>();

    lint = (Lint.instance(context)).isEnabled(PROCESSING);

    Options options = Options.instance(context);

    defaultTargetModule = options.get(Option.DEFAULT_MODULE_FOR_CREATED_FILES);
}
 
Example #27
Source Project: lua-for-android   Author: qtiuto   File: JavacTaskPool.java    License: BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
void clear() {
    drop(Arguments.argsKey);
    drop(DiagnosticListener.class);
    drop(Log.outKey);
    drop(Log.errKey);
    drop(JavaFileManager.class);
    drop(JavacTask.class);
    drop(JavacTrees.class);
    drop(JavacElements.class);

    if (ht.get(Log.logKey) instanceof ReusableLog) {
        //log already inited - not first round
        ((ReusableLog)Log.instance(this)).clear();
        Enter.instance(this).newRound();
        ((ReusableJavaCompiler)ReusableJavaCompiler.instance(this)).clear();
        Types.instance(this).newRound();
        Check.instance(this).newRound();
        Modules.instance(this).newRound();
        Annotate.instance(this).newRound();
        CompileStates.instance(this).clear();
        MultiTaskListener.instance(this).clear();

        //find if any of the roots have redefined java.* classes
        Symtab syms = Symtab.instance(this);
        pollutionScanner.scan(roots, syms);
        roots.clear();
    }
}
 
Example #28
Source Project: netbeans   Author: apache   File: ImmutableTreeTranslator.java    License: Apache License 2.0 5 votes vote down vote up
public void attach(Context context, ImportAnalysis2 importAnalysis, Map<Tree, Object> tree2Tag) {
    make = TreeFactory.instance(context);
    elements = JavacElements.instance(context);
    comments = CommentHandlerService.instance(context);
    model = ASTService.instance(context);
    overlay = context.get(ElementOverlay.class);
    this.importAnalysis = importAnalysis;
    this.tree2Tag = tree2Tag;
}
 
Example #29
Source Project: netbeans   Author: apache   File: TreeFactory.java    License: Apache License 2.0 5 votes vote down vote up
protected TreeFactory(Context context) {
    context.put(contextKey, this);
    model = ASTService.instance(context);
    names = Names.instance(context);
    classReader = ClassReader.instance(context);
    make = com.sun.tools.javac.tree.TreeMaker.instance(context);
    docMake = com.sun.tools.javac.tree.DocTreeMaker.instance(context);
    elements = JavacElements.instance(context);
    types = JavacTypes.instance(context);
    chs = CommentHandlerService.instance(context);
    make.toplevel = null;
}
 
Example #30
Source Project: openjdk-jdk8u-backup   Author: AdoptOpenJDK   File: JNIWriter.java    License: GNU General Public License v2.0 5 votes vote down vote up
private void lazyInit() {
    if (mangler == null) {
        elements = JavacElements.instance(context);
        types = JavacTypes.instance(context);
        mangler = new Mangle(elements, types);
    }
}