本文整理汇总了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);
}
});
}
示例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);
}
示例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 );
}
}
示例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);
}