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


Java ClassReader.instance方法代码示例

本文整理汇总了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);
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:25,代码来源:Enter.java

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

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

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

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

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

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

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

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

示例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);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:43,代码来源:ClassFinder.java

示例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;
            }

        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:48,代码来源:T6889255.java

示例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);
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:46,代码来源:ClassFinder.java

示例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;
            }

        }
    }
}
 
开发者ID:ojdkbuild,项目名称:lookaside_java-1.8.0-openjdk,代码行数:47,代码来源:T6889255.java

示例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;
            }

        }
    }
}
 
开发者ID:lucasicf,项目名称:metricgenerator-jdk-compiler,代码行数:47,代码来源:T6889255.java


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