本文整理汇总了Java中com.sun.tools.javac.jvm.ClassReader.instance方法的典型用法代码示例。如果您正苦于以下问题:Java ClassReader.instance方法的具体用法?Java ClassReader.instance怎么用?Java ClassReader.instance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.tools.javac.jvm.ClassReader
的用法示例。
在下文中一共展示了ClassReader.instance方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Enter
import com.sun.tools.javac.jvm.ClassReader; //导入方法依赖的package包/类
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);
names = Names.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);
Options options = Options.instance(context);
pkginfoOpt = PkgInfo.get(options);
}
示例2: Types
import com.sun.tools.javac.jvm.ClassReader; //导入方法依赖的package包/类
protected Types(Context context) {
context.put(typesKey, this);
syms = Symtab.instance(context);
names = Names.instance(context);
Source source = Source.instance(context);
allowBoxing = source.allowBoxing();
allowCovariantReturns = source.allowCovariantReturns();
allowObjectToPrimitiveCast = source.allowObjectToPrimitiveCast();
reader = ClassReader.instance(context);
chk = Check.instance(context);
enter = Enter.instance(context);
capturedName = names.fromString("<captured wildcard>");
messages = JavacMessages.instance(context);
diags = JCDiagnostic.Factory.instance(context);
functionDescriptorLookupError = new FunctionDescriptorLookupError();
noWarnings = new Warner(null);
}
示例3: Types
import com.sun.tools.javac.jvm.ClassReader; //导入方法依赖的package包/类
protected Types(Context context) {
context.put(typesKey, this);
syms = Symtab.instance(context);
names = Names.instance(context);
Source source = Source.instance(context);
allowBoxing = source.allowBoxing();
allowCovariantReturns = source.allowCovariantReturns();
allowObjectToPrimitiveCast = source.allowObjectToPrimitiveCast();
allowDefaultMethods = source.allowDefaultMethods();
reader = ClassReader.instance(context);
chk = Check.instance(context);
enter = Enter.instance(context);
capturedName = names.fromString("<captured wildcard>");
messages = JavacMessages.instance(context);
diags = JCDiagnostic.Factory.instance(context);
functionDescriptorLookupError = new FunctionDescriptorLookupError();
noWarnings = new Warner(null);
}
示例4: MemberEnter
import com.sun.tools.javac.jvm.ClassReader; //导入方法依赖的package包/类
protected MemberEnter(Context context) {
context.put(memberEnterKey, this);
names = Names.instance(context);
enter = Enter.instance(context);
log = Log.instance(context);
chk = Check.instance(context);
attr = Attr.instance(context);
syms = Symtab.instance(context);
make = TreeMaker.instance(context);
reader = ClassReader.instance(context);
todo = Todo.instance(context);
annotate = Annotate.instance(context);
types = Types.instance(context);
diags = JCDiagnostic.Factory.instance(context);
target = Target.instance(context);
deferredLintHandler = DeferredLintHandler.instance(context);
Options options = Options.instance(context);
skipAnnotations = options.isSet("skipAnnotations");
}
示例5: TreeFactory
import com.sun.tools.javac.jvm.ClassReader; //导入方法依赖的package包/类
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;
}
示例6: Types
import com.sun.tools.javac.jvm.ClassReader; //导入方法依赖的package包/类
protected Types(Context context) {
context.put(typesKey, this);
syms = Symtab.instance(context);
names = Names.instance(context);
Source source = Source.instance(context);
allowBoxing = source.allowBoxing();
allowCovariantReturns = source.allowCovariantReturns();
allowObjectToPrimitiveCast = source.allowObjectToPrimitiveCast();
reader = ClassReader.instance(context);
chk = Check.instance(context);
capturedName = names.fromString("<captured wildcard>");
messages = JavacMessages.instance(context);
}
示例7: setContext
import com.sun.tools.javac.jvm.ClassReader; //导入方法依赖的package包/类
/**
* Use a new context. May be called from outside to update
* internal state for a new annotation-processing round.
* This instance is *not* then registered with the new context.
*/
public void setContext(Context context) {
javaCompiler = JavaCompiler.instance(context);
syms = Symtab.instance(context);
names = Name.Table.instance(context);
types = Types.instance(context);
enter = Enter.instance(context);
reader = ClassReader.instance(context);
}
示例8: Types
import com.sun.tools.javac.jvm.ClassReader; //导入方法依赖的package包/类
protected Types(Context context) {
context.put(typesKey, this);
syms = Symtab.instance(context);
names = Name.Table.instance(context);
allowBoxing = Source.instance(context).allowBoxing();
reader = ClassReader.instance(context);
source = Source.instance(context);
chk = Check.instance(context);
capturedName = names.fromString("<captured wildcard>");
}
示例9: TreeBuilder
import com.sun.tools.javac.jvm.ClassReader; //导入方法依赖的package包/类
public TreeBuilder(Context context) {
maker = TreeMaker.instance(context);
elements = JavacElements.instance(context);
jcutils = JavacUtils.get(context);
reader = ClassReader.instance(context);
syms = Symtab.instance(context);
}
示例10: ClassFinder
import com.sun.tools.javac.jvm.ClassReader; //导入方法依赖的package包/类
/** Construct a new class finder. */
protected ClassFinder(Context context) {
context.put(classFinderKey, this);
reader = ClassReader.instance(context);
names = Names.instance(context);
syms = Symtab.instance(context);
fileManager = context.get(JavaFileManager.class);
dependencies = Dependencies.instance(context);
if (fileManager == null)
throw new AssertionError("FileManager initialization error");
diagFactory = JCDiagnostic.Factory.instance(context);
log = Log.instance(context);
annotate = Annotate.instance(context);
Options options = Options.instance(context);
verbose = options.isSet(Option.VERBOSE);
cacheCompletionFailure = options.isUnset("dev");
preferSource = "source".equals(options.get("-Xprefer"));
userPathsFirst = options.isSet(Option.XXUSERPATHSFIRST);
allowSigFiles = context.get(PlatformDescription.class) != null;
completionFailureName =
options.isSet("failcomplete")
? names.fromString(options.get("failcomplete"))
: null;
// Temporary, until more info is available from the module system.
boolean useCtProps;
JavaFileManager fm = context.get(JavaFileManager.class);
if (fm instanceof JavacFileManager) {
JavacFileManager jfm = (JavacFileManager) fm;
useCtProps = jfm.isDefaultBootClassPath() && jfm.isSymbolFileEnabled();
} else if (fm.getClass().getName().equals("com.sun.tools.sjavac.comp.SmartFileManager")) {
useCtProps = !options.isSet("ignore.symbol.file");
} else {
useCtProps = false;
}
jrtIndex = useCtProps && JRTIndex.isAvailable() ? JRTIndex.getSharedInstance() : null;
profile = Profile.instance(context);
}
示例11: test
import com.sun.tools.javac.jvm.ClassReader; //导入方法依赖的package包/类
void test(String testName, boolean expectNames, String... opts) throws Exception {
System.err.println("Test " + testName
+ ": expectNames:" + expectNames
+ " javacOpts:" + Arrays.asList(opts));
File outDir = new File(testName);
outDir.mkdirs();
compile(outDir, opts);
Context ctx = new Context();
JavacFileManager fm = new JavacFileManager(ctx, true, null);
fm.setLocation(StandardLocation.CLASS_PATH, Arrays.asList(outDir));
Symtab syms = Symtab.instance(ctx);
ClassReader cr = ClassReader.instance(ctx);
cr.saveParameterNames = true;
Names names = Names.instance(ctx);
Set<String> classes = getTopLevelClasses(outDir);
Deque<String> work = new LinkedList<String>(classes);
String classname;
while ((classname = work.poll()) != null) {
System.err.println("Checking class " + classname);
ClassSymbol sym = syms.enterClass(syms.noModule, names.table.fromString(classname));
sym.complete();
if ((sym.flags() & Flags.INTERFACE) != 0 && !testInterfaces)
continue;
for (Symbol s : sym.members_field.getSymbols(NON_RECURSIVE)) {
System.err.println("Checking member " + s);
switch (s.kind) {
case TYP: {
String name = s.flatName().toString();
if (!classes.contains(name)) {
classes.add(name);
work.add(name);
}
break;
}
case MTH:
verify((MethodSymbol) s, expectNames);
break;
}
}
}
}
示例12: ClassFinder
import com.sun.tools.javac.jvm.ClassReader; //导入方法依赖的package包/类
/** Construct a new class finder. */
protected ClassFinder(Context context) {
context.put(classFinderKey, this);
reader = ClassReader.instance(context);
names = Names.instance(context);
syms = Symtab.instance(context);
fileManager = context.get(JavaFileManager.class);
dependencies = Dependencies.instance(context);
if (fileManager == null)
throw new AssertionError("FileManager initialization error");
diagFactory = JCDiagnostic.Factory.instance(context);
log = Log.instance(context);
annotate = Annotate.instance(context);
Options options = Options.instance(context);
verbose = options.isSet(VERBOSE);
cacheCompletionFailure = options.isUnset("dev");
preferSource = "source".equals(options.get("-Xprefer"));
userPathsFirst = options.isSet(XXUSERPATHSFIRST);
allowSigFiles = context.get(PlatformDescription.class) != null;
completionFailureName =
options.isSet("failcomplete")
? names.fromString(options.get("failcomplete"))
: null;
moduleOverride = options.isSet(XMODULE) ? names.fromString(options.get(XMODULE))
: null;
// Temporary, until more info is available from the module system.
boolean useCtProps;
JavaFileManager fm = context.get(JavaFileManager.class);
if (fm instanceof JavacFileManager) {
JavacFileManager jfm = (JavacFileManager) fm;
useCtProps = jfm.isDefaultBootClassPath() && jfm.isSymbolFileEnabled();
} else if (fm.getClass().getName().equals("com.sun.tools.sjavac.comp.SmartFileManager")) {
useCtProps = !options.isSet("ignore.symbol.file");
} else {
useCtProps = false;
}
jrtIndex = useCtProps && JRTIndex.isAvailable() ? JRTIndex.getSharedInstance() : null;
profile = Profile.instance(context);
}
示例13: test
import com.sun.tools.javac.jvm.ClassReader; //导入方法依赖的package包/类
void test(String testName, boolean expectNames, String... opts) throws Exception {
System.err.println("Test " + testName
+ ": expectNames:" + expectNames
+ " javacOpts:" + Arrays.asList(opts));
File outDir = new File(testName);
outDir.mkdirs();
compile(outDir, opts);
Context ctx = new Context();
JavacFileManager fm = new JavacFileManager(ctx, true, null);
fm.setLocation(StandardLocation.CLASS_PATH, Arrays.asList(outDir));
ClassReader cr = ClassReader.instance(ctx);
cr.saveParameterNames = true;
Names names = Names.instance(ctx);
Set<String> classes = getTopLevelClasses(outDir);
Deque<String> work = new LinkedList<String>(classes);
String classname;
while ((classname = work.poll()) != null) {
System.err.println("Checking class " + classname);
ClassSymbol sym = cr.enterClass(names.table.fromString(classname));
sym.complete();
if ((sym.flags() & Flags.INTERFACE) != 0 && !testInterfaces)
continue;
for (Scope.Entry e = sym.members_field.elems; e != null; e = e.sibling) {
System.err.println("Checking member " + e.sym);
switch (e.sym.kind) {
case Kinds.TYP: {
String name = e.sym.flatName().toString();
if (!classes.contains(name)) {
classes.add(name);
work.add(name);
}
break;
}
case Kinds.MTH:
verify((MethodSymbol) e.sym, expectNames);
break;
}
}
}
}
示例14: test
import com.sun.tools.javac.jvm.ClassReader; //导入方法依赖的package包/类
void test(String testName, boolean expectNames, String... opts) throws Exception {
System.err.println("Test " + testName
+ ": expectNames:" + expectNames
+ " javacOpts:" + Arrays.asList(opts));
File outDir = new File(testName);
outDir.mkdirs();
compile(outDir, opts);
Context ctx = new Context();
JavacFileManager fm = new JavacFileManager(ctx, true, null);
fm.setLocation(StandardLocation.CLASS_PATH, Arrays.asList(outDir));
ClassReader cr = ClassReader.instance(ctx);
cr.saveParameterNames = true;
Name.Table names = Name.Table.instance(ctx);
Set<String> classes = getTopLevelClasses(outDir);
Deque<String> work = new LinkedList<String>(classes);
String classname;
while ((classname = work.poll()) != null) {
System.err.println("Checking class " + classname);
ClassSymbol sym = cr.enterClass(names.fromString(classname));
sym.complete();
if ((sym.flags() & Flags.INTERFACE) != 0 && !testInterfaces)
continue;
for (Scope.Entry e = sym.members_field.elems; e != null; e = e.sibling) {
System.err.println("Checking member " + e.sym);
switch (e.sym.kind) {
case Kinds.TYP: {
String name = e.sym.flatName().toString();
if (!classes.contains(name)) {
classes.add(name);
work.add(name);
}
break;
}
case Kinds.MTH:
verify((MethodSymbol) e.sym, expectNames);
break;
}
}
}
}