當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。