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


Java ClassWriter类代码示例

本文整理汇总了Java中com.sun.tools.javac.jvm.ClassWriter的典型用法代码示例。如果您正苦于以下问题:Java ClassWriter类的具体用法?Java ClassWriter怎么用?Java ClassWriter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ClassWriter类属于com.sun.tools.javac.jvm包,在下文中一共展示了ClassWriter类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: preRegister

import com.sun.tools.javac.jvm.ClassWriter; //导入依赖的package包/类
public static void preRegister(Context context) {
    context.put(classWriterKey, new Context.Factory<ClassWriter>() {
        public ClassWriter make(Context c) {
            return new NBClassWriter(c);
        }
    });
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:NBClassWriter.java

示例2: Modules

import com.sun.tools.javac.jvm.ClassWriter; //导入依赖的package包/类
protected Modules(Context context) {
    context.put(Modules.class, this);
    log = Log.instance(context);
    names = Names.instance(context);
    syms = Symtab.instance(context);
    attr = Attr.instance(context);
    chk = Check.instance(context);
    deferredLintHandler = DeferredLintHandler.instance(context);
    typeEnvs = TypeEnvs.instance(context);
    moduleFinder = ModuleFinder.instance(context);
    types = Types.instance(context);
    fileManager = context.get(JavaFileManager.class);
    source = Source.instance(context);
    allowModules = source.allowModules();
    Options options = Options.instance(context);

    allowAccessIntoSystem = options.isUnset(Option.RELEASE);
    lintOptions = options.isUnset(Option.XLINT_CUSTOM, "-" + LintCategory.OPTIONS.option);

    multiModuleMode = fileManager.hasLocation(StandardLocation.MODULE_SOURCE_PATH);
    ClassWriter classWriter = ClassWriter.instance(context);
    classWriter.multiModuleMode = multiModuleMode;
    JNIWriter jniWriter = JNIWriter.instance(context);
    jniWriter.multiModuleMode = multiModuleMode;

    java_se = names.fromString("java.se");
    java_ = names.fromString("java.");

    addExportsOpt = options.get(Option.ADD_EXPORTS);
    addReadsOpt = options.get(Option.ADD_READS);
    addModsOpt = options.get(Option.ADD_MODULES);
    limitModsOpt = options.get(Option.LIMIT_MODULES);
    moduleVersionOpt = options.get(Option.MODULE_VERSION);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:35,代码来源:Modules.java

示例3: injectManFileManager

import com.sun.tools.javac.jvm.ClassWriter; //导入依赖的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

示例4: Modules

import com.sun.tools.javac.jvm.ClassWriter; //导入依赖的package包/类
protected Modules(Context context) {
    context.put(Modules.class, this);
    log = Log.instance(context);
    names = Names.instance(context);
    syms = Symtab.instance(context);
    attr = Attr.instance(context);
    typeEnvs = TypeEnvs.instance(context);
    moduleFinder = ModuleFinder.instance(context);
    fileManager = context.get(JavaFileManager.class);
    allowModules = Source.instance(context).allowModules();
    Options options = Options.instance(context);

    moduleOverride = options.get(Option.XMODULE);

    multiModuleMode = fileManager.hasLocation(StandardLocation.MODULE_SOURCE_PATH);
    ClassWriter classWriter = ClassWriter.instance(context);
    classWriter.multiModuleMode = multiModuleMode;
    JNIWriter jniWriter = JNIWriter.instance(context);
    jniWriter.multiModuleMode = multiModuleMode;

    java_se = names.fromString("java.se");
    java_ = names.fromString("java.");

    addExportsOpt = options.get(Option.XADDEXPORTS);
    addReadsOpt = options.get(Option.XADDREADS);
    addModsOpt = options.get(Option.ADDMODS);
    limitModsOpt = options.get(Option.LIMITMODS);
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:29,代码来源:Modules.java


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