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);
  }
    protected Enter(Context context) {
		DEBUG.P(this,"Enter(1)");
		context.put(enterKey, this);

		log = Log.instance(context);
		reader = ClassReader.instance(context);
		make = TreeMaker.instance(context);
		syms = Symtab.instance(context);
		chk = Check.instance(context);
		memberEnter = MemberEnter.instance(context);
		annotate = Annotate.instance(context);
		lint = Lint.instance(context);

		predefClassDef = make.ClassDef(
			make.Modifiers(PUBLIC),
			syms.predefClass.name, null, null, null, null);
		//predefClass是一个ClassSymbol(PUBLIC|ACYCLIC, names.empty, rootPackage)
		//且它的Scope members_field已有成员(几个基本类型符号(symbols for basic types)及其他操作符)
		//请参考Systab类的predefClass字段说明
		predefClassDef.sym = syms.predefClass;

		todo = Todo.instance(context);
		fileManager = context.get(JavaFileManager.class);
		
		names = Name.Table.instance(context);    //我加上的
		DEBUG.P(0,this,"Enter(1)");
    }
Beispiel #3
0
  protected Enter(Context context) {
    context.put(enterKey, this);

    log = Log.instance(context);
    reader = ClassReader.instance(context);
    make = TreeMaker.instance(context);
    syms = Symtab.instance(context);
    chk = Check.instance(context);
    memberEnter = MemberEnter.instance(context);
    types = Types.instance(context);
    annotate = Annotate.instance(context);
    lint = Lint.instance(context);

    predefClassDef =
        make.ClassDef(make.Modifiers(PUBLIC), syms.predefClass.name, null, null, null, null);
    predefClassDef.sym = syms.predefClass;
    todo = Todo.instance(context);
    fileManager = context.get(JavaFileManager.class);
  }