本文整理汇总了Java中com.sun.tools.javac.jvm.ClassReader类的典型用法代码示例。如果您正苦于以下问题:Java ClassReader类的具体用法?Java ClassReader怎么用?Java ClassReader使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ClassReader类属于com.sun.tools.javac.jvm包,在下文中一共展示了ClassReader类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPackages
import com.sun.tools.javac.jvm.ClassReader; //导入依赖的package包/类
@NonNull
private Map<?,?> getPackages(final Symtab cr) {
Map<?,?> res = Collections.emptyMap();
try {
final Field fld = ClassReader.class.getDeclaredField("packages"); //NOI18N
fld.setAccessible(true);
final Map<?,?> pkgs = (Map<?,?>) fld.get(cr);
if (pkgs != null) {
res = pkgs;
}
} catch (ReflectiveOperationException e) {
if (!pkgROELogged) {
LOG.warning(e.getMessage());
pkgROELogged = true;
}
}
return res;
}
示例2: getClasses
import com.sun.tools.javac.jvm.ClassReader; //导入依赖的package包/类
@NonNull
private Map<?,?> getClasses(final Symtab cr) {
Map<?,?> res = Collections.emptyMap();
try {
final Field fld = ClassReader.class.getDeclaredField("classes"); //NOI18N
fld.setAccessible(true);
Map<?,?> clzs = (Map<?,?>) fld.get(cr);
if (clzs != null) {
res = clzs;
}
} catch (ReflectiveOperationException e) {
if (!clzROELogged) {
LOG.warning(e.getMessage());
clzROELogged = true;
}
}
return res;
}
示例3: 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);
}
示例4: 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);
}
示例5: 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);
}
示例6: 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");
}
示例7: 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;
}
示例8: preRegister
import com.sun.tools.javac.jvm.ClassReader; //导入依赖的package包/类
public static void preRegister(Context context) {
context.put(classReaderKey, new Context.Factory<ClassReader>() {
public ClassReader make(Context c) {
return new NBClassReader(c);
}
});
}
示例9: 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);
}
示例10: preRegister
import com.sun.tools.javac.jvm.ClassReader; //导入依赖的package包/类
public static void preRegister(Context context) {
context.put(classReaderKey, new Context.Factory<ClassReader>() {
public ClassReader make(Context c) {
return new JavadocClassReader(c);
}
});
}
示例11: injectManFileManager
import com.sun.tools.javac.jvm.ClassReader; //导入依赖的package包/类
private void injectManFileManager()
{
// Override javac's JavaFileManager
_manFileManager = new ManifoldJavaFileManager( _fileManager, _ctx, true );
_ctx.put( JavaFileManager.class, (JavaFileManager)null );
_ctx.put( JavaFileManager.class, _manFileManager );
// Assign our file maanger to javac's various components
try
{
if( IS_JAVA_8 )
{
ReflectUtil.field( ClassReader.instance( getContext() ), "fileManager" ).set( _manFileManager );
}
else
{
Object classFinder = ReflectUtil.method( CLASSFINDER_CLASS, "instance", Context.class ).invokeStatic( getContext() );
ReflectUtil.field( classFinder, "fileManager" ).set( _manFileManager );
ReflectUtil.field( classFinder, "preferSource" ).set( true );
Object modules = ReflectUtil.method( MODULES_CLASS, "instance", Context.class ).invokeStatic( getContext() );
ReflectUtil.field( modules, "fileManager" ).set( _manFileManager );
Object moduleFinder = ReflectUtil.method( MODULEFINDER_CLASS, "instance", Context.class ).invokeStatic( getContext() );
ReflectUtil.field( moduleFinder, "fileManager" ).set( _manFileManager );
}
ReflectUtil.field( ClassWriter.instance( getContext() ), "fileManager" ).set( _manFileManager );
ReflectUtil.field( Enter.instance( getContext() ), "fileManager" ).set( _manFileManager );
}
catch( Exception e )
{
throw new RuntimeException( e );
}
}
示例12: 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);
}
示例13: 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>");
}
示例14: preRegister
import com.sun.tools.javac.jvm.ClassReader; //导入依赖的package包/类
public static void preRegister(final Context context) {
context.put(classReaderKey, new Context.Factory<ClassReader>() {
public ClassReader make() {
return new JavadocClassReader(context);
}
});
}
示例15: 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);
}