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


Java ClassReader类代码示例

本文整理汇总了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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:AsyncJavaSymbolDescriptor.java

示例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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:AsyncJavaSymbolDescriptor.java

示例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);
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:25,代码来源:Enter.java

示例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);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:18,代码来源:Types.java

示例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);
}
 
开发者ID:ojdkbuild,项目名称:lookaside_java-1.8.0-openjdk,代码行数:19,代码来源:Types.java

示例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");
}
 
开发者ID:sebastianoe,项目名称:s4j,代码行数:20,代码来源:MemberEnter.java

示例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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:TreeFactory.java

示例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);
        }
    });
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:NBClassReader.java

示例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);
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:14,代码来源:Types.java

示例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);
        }
    });
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:8,代码来源:JavadocClassReader.java

示例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 );
  }
}
 
开发者ID:manifold-systems,项目名称:manifold,代码行数:36,代码来源:JavacPlugin.java

示例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);
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:14,代码来源:JavacElements.java

示例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>");
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:11,代码来源:Types.java

示例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);
        }
    });
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:8,代码来源:JavadocClassReader.java

示例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);
}
 
开发者ID:provegard,项目名称:yield4j,代码行数:8,代码来源:TreeBuilder.java


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