本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}
});
}
示例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();
}
示例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);
}
});
}
示例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);
}
示例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);
}
});
}
示例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);
}
});
}
示例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);
}
示例13: preRegister
import com.sun.tools.javac.util.Context; //导入方法依赖的package包/类
public static void preRegister(Context context) {
context.put(classFinderKey, (Factory<ClassFinder>)JavadocClassFinder::new);
}
示例14: preRegister
import com.sun.tools.javac.util.Context; //导入方法依赖的package包/类
public static void preRegister(Context context, CancelService cancelServiceToRegister) {
context.put(cancelServiceKey, cancelServiceToRegister);
}
示例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());
}
}