当前位置: 首页>>代码示例>>Java>>正文


Java Context.put方法代码示例

本文整理汇总了Java中com.sun.tools.javac.util.Context.put方法的典型用法代码示例。如果您正苦于以下问题:Java Context.put方法的具体用法?Java Context.put怎么用?Java Context.put使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sun.tools.javac.util.Context的用法示例。


在下文中一共展示了Context.put方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: DocEnv

import com.sun.tools.javac.util.Context; //导入方法依赖的package包/类
/**
 * Constructor
 *
 * @param context      Context for this javadoc instance.
 */
protected DocEnv(Context context) {
    context.put(docEnvKey, 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 = Types.instance(context);
    fileManager = context.get(JavaFileManager.class);
    if (fileManager instanceof JavacFileManager) {
        ((JavacFileManager)fileManager).setSymbolFileEnabled(false);
    }

    // Default.  Should normally be reset with setLocale.
    this.doclocale = new DocLocale(this, "", breakiterator);
    source = Source.instance(context);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:27,代码来源:DocEnv.java

示例2: TypeAnnotations

import com.sun.tools.javac.util.Context; //导入方法依赖的package包/类
protected TypeAnnotations(Context context) {
    context.put(typeAnnosKey, this);
    names = Names.instance(context);
    log = Log.instance(context);
    syms = Symtab.instance(context);
    annotate = Annotate.instance(context);
    attr = Attr.instance(context);
    Options options = Options.instance(context);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:10,代码来源:TypeAnnotations.java

示例3: JavacFileManager

import com.sun.tools.javac.util.Context; //导入方法依赖的package包/类
/**
 * Create a JavacFileManager using a given context, optionally registering
 * it as the JavaFileManager for that context.
 */
public JavacFileManager(Context context, boolean register, Charset charset) {
    super(charset);
    if (register)
        context.put(JavaFileManager.class, this);
    setContext(context);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:11,代码来源:JavacFileManager.java

示例4: instance

import com.sun.tools.javac.util.Context; //导入方法依赖的package包/类
public static PartialReparserService instance(Context ctx) {
    PartialReparserService res = ctx.get(partialReparserKey);
    
    if (res == null) {
        ctx.put(partialReparserKey, res = new PartialReparserService(ctx));
    }
    
    return res;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:PartialReparserService.java

示例5: ScannerFactory

import com.sun.tools.javac.util.Context; //导入方法依赖的package包/类
/** Create a new scanner factory. */
protected ScannerFactory(Context context) {
    context.put(scannerFactoryKey, this);
    this.log = Log.instance(context);
    this.names = Names.instance(context);
    this.source = Source.instance(context);
    this.tokens = Tokens.instance(context);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:9,代码来源:ScannerFactory.java

示例6: enhance

import com.sun.tools.javac.util.Context; //导入方法依赖的package包/类
@Override
public void enhance(Context context, FQN2Files fqn2Files) {
    if (fqn2Files == null)
        return;
    context.put(DuplicateClassChecker.class, new DuplicateClassChecker() {
        @Override
        public boolean check(Name name, JavaFileObject jfo) {
            return fqn2Files.check(name, jfo);
        }
    });
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:TreeLoader.java

示例7: Operators

import com.sun.tools.javac.util.Context; //导入方法依赖的package包/类
protected Operators(Context context) {
    context.put(operatorsKey, this);
    syms = Symtab.instance(context);
    names = Names.instance(context);
    log = Log.instance(context);
    types = Types.instance(context);
    noOpSymbol = new OperatorSymbol(names.empty, Type.noType, -1, syms.noSymbol);
    initOperatorNames();
    initUnaryOperators();
    initBinaryOperators();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:12,代码来源:Operators.java

示例8: preRegister

import com.sun.tools.javac.util.Context; //导入方法依赖的package包/类
public static void preRegister(Context context) {
    context.put(classReaderKey, new Context.Factory<ClassReader>() {
        public ClassReader make(Context c) {
            return new JavadocClassReader(c);
        }
    });
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:8,代码来源:JavadocClassReader.java

示例9: getStandardFileManager

import com.sun.tools.javac.util.Context; //导入方法依赖的package包/类
public JavacFileManager getStandardFileManager(
    DiagnosticListener<? super JavaFileObject> diagnosticListener,
    Locale locale,
    Charset charset) {
    Context context = new Context();
    context.put(Locale.class, locale);
    if (diagnosticListener != null)
        context.put(DiagnosticListener.class, diagnosticListener);
    PrintWriter pw = (charset == null)
            ? new PrintWriter(System.err, true)
            : new PrintWriter(new OutputStreamWriter(System.err, charset), true);
    context.put(Log.outKey, pw);
    return new JavacFileManager(context, true, charset);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:15,代码来源:JavacTool.java

示例10: preRegister

import com.sun.tools.javac.util.Context; //导入方法依赖的package包/类
public static void preRegister(Context ctx) {
    ctx.put(lowerKey, new Factory<Lower>() {
        @Override
        public Lower make(Context c) {
            return new DumpLower(c);
        }
    });
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:9,代码来源:TwrShareCloseCode.java

示例11: preRegister

import com.sun.tools.javac.util.Context; //导入方法依赖的package包/类
public static void preRegister(Context context) {
    context.put(nbNamesKey, new Context.Factory<NBNames>() {
        public NBNames make(Context c) {
            return new NBNames(c);
        }
    });
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:NBNames.java

示例12: ScannerFactory

import com.sun.tools.javac.util.Context; //导入方法依赖的package包/类
/**
 * Create a new scanner factory.
 */
protected ScannerFactory(Context context) {
    context.put(scannerFactoryKey, this);
    this.log = Log.instance(context);
    this.names = Names.instance(context);
    this.source = Source.instance(context);
    this.tokens = Tokens.instance(context);
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:11,代码来源:ScannerFactory.java

示例13: preRegister

import com.sun.tools.javac.util.Context; //导入方法依赖的package包/类
public static void preRegister(Context context) {
    context.put(classFinderKey, (Factory<ClassFinder>)JavadocClassFinder::new);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:4,代码来源:JavadocClassFinder.java

示例14: preRegister

import com.sun.tools.javac.util.Context; //导入方法依赖的package包/类
public static void preRegister(Context context, CancelService cancelServiceToRegister) {
    context.put(cancelServiceKey, cancelServiceToRegister);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:4,代码来源:JavacParser.java

示例15: getTask

import com.sun.tools.javac.util.Context; //导入方法依赖的package包/类
public JavacTask getTask(Writer out,
                         JavaFileManager fileManager,
                         DiagnosticListener<? super JavaFileObject> diagnosticListener,
                         Iterable<String> options,
                         Iterable<String> classes,
                         Iterable<? extends JavaFileObject> compilationUnits)
{
    try {
        Context context = new Context();
        ClientCodeWrapper ccw = ClientCodeWrapper.instance(context);

        final String kindMsg = "All compilation units must be of SOURCE kind";
        if (options != null)
            for (String option : options)
                option.getClass(); // null check
        if (classes != null) {
            for (String cls : classes)
                if (!SourceVersion.isName(cls)) // implicit null check
                    throw new IllegalArgumentException("Not a valid class name: " + cls);
        }
        if (compilationUnits != null) {
            compilationUnits = ccw.wrapJavaFileObjects(compilationUnits); // implicit null check
            for (JavaFileObject cu : compilationUnits) {
                if (cu.getKind() != JavaFileObject.Kind.SOURCE)
                    throw new IllegalArgumentException(kindMsg);
            }
        }

        if (diagnosticListener != null)
            context.put(DiagnosticListener.class, ccw.wrap(diagnosticListener));

        if (out == null)
            context.put(Log.outKey, new PrintWriter(System.err, true));
        else
            context.put(Log.outKey, new PrintWriter(out, true));

        if (fileManager == null)
            fileManager = getStandardFileManager(diagnosticListener, null, null);
        fileManager = ccw.wrap(fileManager);
        context.put(JavaFileManager.class, fileManager);
        processOptions(context, fileManager, options);
        Main compiler = new Main("javacTask", context.get(Log.outKey));
        return new JavacTaskImpl(compiler, options, context, classes, compilationUnits);
    } catch (ClientCodeException ex) {
        throw new RuntimeException(ex.getCause());
    }
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:48,代码来源:JavacTool.java


注:本文中的com.sun.tools.javac.util.Context.put方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。