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


Java Types.instance方法代码示例

本文整理汇总了Java中com.sun.tools.javac.code.Types.instance方法的典型用法代码示例。如果您正苦于以下问题:Java Types.instance方法的具体用法?Java Types.instance怎么用?Java Types.instance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sun.tools.javac.code.Types的用法示例。


在下文中一共展示了Types.instance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: Enter

import com.sun.tools.javac.code.Types; //导入方法依赖的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: CompiledTypeProcessor

import com.sun.tools.javac.code.Types; //导入方法依赖的package包/类
CompiledTypeProcessor( JavacTask javacTask )
  {
    _javacTask = javacTask;
    javacTask.addTaskListener( this );
    Context context = ((BasicJavacTask)javacTask).getContext();
    JavaCompiler compiler = JavaCompiler.instance( context );
    compiler.shouldStopPolicyIfNoError = CompileState.max( compiler.shouldStopPolicyIfNoError, CompileState.FLOW );
    _issueReporter = new IssueReporter<>( Log.instance( context ) );
    _types = Types.instance( context );
//    DiagnosticListener dl = context.get( DiagnosticListener.class );
//    context.put( DiagnosticListener.class, (DiagnosticListener)null );
//    context.put( DiagnosticListener.class, new WrappedDiagnosticListener( dl ) );

    _typesToProcess = new HashMap<>();
    _innerClassForGeneration = new HashMap<>();
  }
 
开发者ID:manifold-systems,项目名称:manifold,代码行数:17,代码来源:CompiledTypeProcessor.java

示例3: LambdaToMethod

import com.sun.tools.javac.code.Types; //导入方法依赖的package包/类
private LambdaToMethod(Context context) {
    context.put(unlambdaKey, this);
    diags = JCDiagnostic.Factory.instance(context);
    log = Log.instance(context);
    lower = Lower.instance(context);
    names = Names.instance(context);
    syms = Symtab.instance(context);
    rs = Resolve.instance(context);
    make = TreeMaker.instance(context);
    types = Types.instance(context);
    transTypes = TransTypes.instance(context);
    analyzer = new LambdaAnalyzerPreprocessor();
    Options options = Options.instance(context);
    dumpLambdaToMethodStats = options.isSet("dumpLambdaToMethodStats");
    attr = Attr.instance(context);
    forceSerializable = options.isSet("forceSerializable");
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:18,代码来源:LambdaToMethod.java

示例4: run

import com.sun.tools.javac.code.Types; //导入方法依赖的package包/类
void run() throws Exception {
    Context context = new Context();
    JavacFileManager.preRegister(context);
    Symtab syms = Symtab.instance(context);
    maker = TreeMaker.instance(context);
    types = Types.instance(context);

    test("abc",                     CLASS,      syms.stringType,    "abc");
    test(Boolean.FALSE,             BOOLEAN,    syms.booleanType,   Integer.valueOf(0));
    test(Boolean.TRUE,              BOOLEAN,    syms.booleanType,   Integer.valueOf(1));
    test(Byte.valueOf((byte) 1),    BYTE,       syms.byteType,      Byte.valueOf((byte) 1));
    test(Character.valueOf('a'),    CHAR,       syms.charType,      Integer.valueOf('a'));
    test(Double.valueOf(1d),        DOUBLE,     syms.doubleType,    Double.valueOf(1d));
    test(Float.valueOf(1f),         FLOAT,      syms.floatType,     Float.valueOf(1f));
    test(Integer.valueOf(1),        INT,        syms.intType,       Integer.valueOf(1));
    test(Long.valueOf(1),           LONG,       syms.longType,      Long.valueOf(1));
    test(Short.valueOf((short) 1),  SHORT,      syms.shortType,     Short.valueOf((short) 1));

    if (errors > 0)
        throw new Exception(errors + " errors found");
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:22,代码来源:MakeLiteralTest.java

示例5: Analyzer

import com.sun.tools.javac.code.Types; //导入方法依赖的package包/类
protected Analyzer(Context context) {
    context.put(analyzerKey, this);
    types = Types.instance(context);
    log = Log.instance(context);
    attr = Attr.instance(context);
    deferredAttr = DeferredAttr.instance(context);
    argumentAttr = ArgumentAttr.instance(context);
    make = TreeMaker.instance(context);
    names = Names.instance(context);
    Options options = Options.instance(context);
    String findOpt = options.get("find");
    //parse modes
    Source source = Source.instance(context);
    allowDiamondWithAnonymousClassCreation = source.allowDiamondWithAnonymousClassCreation();
    analyzerModes = AnalyzerMode.getAnalyzerModes(findOpt, source);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:17,代码来源:Analyzer.java

示例6: LambdaToMethod

import com.sun.tools.javac.code.Types; //导入方法依赖的package包/类
private LambdaToMethod(Context context) {
    context.put(unlambdaKey, this);
    diags = JCDiagnostic.Factory.instance(context);
    log = Log.instance(context);
    lower = Lower.instance(context);
    names = Names.instance(context);
    syms = Symtab.instance(context);
    rs = Resolve.instance(context);
    operators = Operators.instance(context);
    make = TreeMaker.instance(context);
    types = Types.instance(context);
    transTypes = TransTypes.instance(context);
    analyzer = new LambdaAnalyzerPreprocessor();
    Options options = Options.instance(context);
    dumpLambdaToMethodStats = options.isSet("debug.dumpLambdaToMethodStats");
    attr = Attr.instance(context);
    forceSerializable = options.isSet("forceSerializable");
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:19,代码来源:LambdaToMethod.java

示例7: init

import com.sun.tools.javac.code.Types; //导入方法依赖的package包/类
private void init(Context context) {
    modules = Modules.instance(context);
    attr = Attr.instance(context);
    enter = Enter.instance(context);
    elements = JavacElements.instance(context);
    log = Log.instance(context);
    resolve = Resolve.instance(context);
    treeMaker = TreeMaker.instance(context);
    memberEnter = MemberEnter.instance(context);
    names = Names.instance(context);
    types = Types.instance(context);
    docTreeMaker = DocTreeMaker.instance(context);
    parser = ParserFactory.instance(context);
    syms = Symtab.instance(context);
    fileManager = context.get(JavaFileManager.class);
    JavacTask t = context.get(JavacTask.class);
    if (t instanceof JavacTaskImpl)
        javacTaskImpl = (JavacTaskImpl) t;
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:20,代码来源:JavacTrees.java

示例8: LambdaToMethod

import com.sun.tools.javac.code.Types; //导入方法依赖的package包/类
private LambdaToMethod(Context context) {
    context.put(unlambdaKey, this);
    diags = JCDiagnostic.Factory.instance(context);
    log = Log.instance(context);
    lower = Lower.instance(context);
    names = Names.instance(context);
    syms = Symtab.instance(context);
    rs = Resolve.instance(context);
    operators = Operators.instance(context);
    make = TreeMaker.instance(context);
    types = Types.instance(context);
    transTypes = TransTypes.instance(context);
    analyzer = new LambdaAnalyzerPreprocessor();
    Options options = Options.instance(context);
    dumpLambdaToMethodStats = options.isSet("dumpLambdaToMethodStats");
    attr = Attr.instance(context);
    forceSerializable = options.isSet("forceSerializable");
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:19,代码来源:LambdaToMethod.java

示例9: run

import com.sun.tools.javac.code.Types; //导入方法依赖的package包/类
public void run(JavaCompiler comp) {
    JavaSource source = new JavaSource();
    JavacTaskImpl ct = (JavacTaskImpl)comp.getTask(null, null, dc,
            Arrays.asList("-g"), null, Arrays.asList(source));
    Context context = ct.getContext();
    Symtab syms = Symtab.instance(context);
    Names names = Names.instance(context);
    Types types = Types.instance(context);
    ct.addTaskListener(new Indifier(syms, names, types));
    try {
        ct.generate();
    } catch (Throwable t) {
        t.printStackTrace();
        throw new AssertionError(
                String.format("Error thrown when compiling following code\n%s",
                        source.source));
    }
    if (dc.diagFound) {
        throw new AssertionError(
                String.format("Diags found when compiling following code\n%s\n\n%s",
                        source.source, dc.printDiags()));
    }
    verifyBytecode();
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:25,代码来源:TestBootstrapMethodsCount.java

示例10: run

import com.sun.tools.javac.code.Types; //导入方法依赖的package包/类
public void run() {
    int id = checkCount.incrementAndGet();
    JavaSource source = new JavaSource(id);
    JavacTaskImpl ct = (JavacTaskImpl)comp.getTask(null, fm.get(), dc,
            Arrays.asList("-g"), null, Arrays.asList(source));
    Context context = ct.getContext();
    Symtab syms = Symtab.instance(context);
    Names names = Names.instance(context);
    Types types = Types.instance(context);
    ct.addTaskListener(new Indifier(syms, names, types));
    try {
        ct.generate();
    } catch (Throwable t) {
        t.printStackTrace();
        throw new AssertionError(
                String.format("Error thrown when compiling following code\n%s",
                source.source));
    }
    if (dc.diagFound) {
        throw new AssertionError(
                String.format("Diags found when compiling following code\n%s\n\n%s",
                source.source, dc.printDiags()));
    }
    verifyBytecode(id);
}
 
开发者ID:ojdkbuild,项目名称:lookaside_java-1.8.0-openjdk,代码行数:26,代码来源:TestInvokeDynamic.java

示例11: init

import com.sun.tools.javac.code.Types; //导入方法依赖的package包/类
public void init(ProcessingEnvironment procEnv) {
    javacProcessingEnv = (JavacProcessingEnvironment) procEnv;
    maker = TreeMaker.instance(javacProcessingEnv.getContext());
    parserFactory = ParserFactory.instance(javacProcessingEnv.getContext());
    utils = javacProcessingEnv.getElementUtils();
    typeUtils = javacProcessingEnv.getTypeUtils();
    trees = JavacTrees.instance(javacProcessingEnv);
    types = Types.instance(javacProcessingEnv.getContext());

    voidType = maker.Type((Type) typeUtils.getNoType(TypeKind.VOID));
    objectClass = utils.getTypeElement("java.lang.Object");

    debugMode = Boolean.parseBoolean(getOption(DEBUG_MODE_OPTION_NAME));

    // reflection
    try {
        newParserMethod = ParserFactory.class.getMethod("newParser", CharSequence.class, Boolean.TYPE, Boolean.TYPE, Boolean.TYPE);
    } catch (NoSuchMethodException ignored) {
    }
}
 
开发者ID:ixkor,项目名称:genaroid,代码行数:21,代码来源:GenaroidEnvironment.java

示例12: LambdaToMethod

import com.sun.tools.javac.code.Types; //导入方法依赖的package包/类
private LambdaToMethod(Context context) {
    context.put(unlambdaKey, this);
    diags = JCDiagnostic.Factory.instance(context);
    log = Log.instance(context);
    lower = Lower.instance(context);
    names = Names.instance(context);
    syms = Symtab.instance(context);
    rs = Resolve.instance(context);
    make = TreeMaker.instance(context);
    types = Types.instance(context);
    transTypes = TransTypes.instance(context);
    analyzer = new LambdaAnalyzerPreprocessor();
    Options options = Options.instance(context);
    dumpLambdaToMethodStats = options.isSet("dumpLambdaToMethodStats");
    attr = Attr.instance(context);
}
 
开发者ID:RedlineResearch,项目名称:OLD-OpenJDK8,代码行数:17,代码来源:LambdaToMethod.java

示例13: getDescriptorType

import com.sun.tools.javac.code.Types; //导入方法依赖的package包/类
/**
 * Find the type of the method descriptor associated to the functional interface.
 * 
 * @param origin functional interface type
 * @return associated method descriptor type or <code>null</code> if the <code>origin</code> is not a functional interface.
 * @since 0.112
 */
public ExecutableType getDescriptorType(DeclaredType origin) {
    Types types = Types.instance(info.impl.getJavacTask().getContext());
    if (types.isFunctionalInterface(((Type)origin).tsym)) {
        Type dt = types.findDescriptorType((Type)origin);
        if (dt != null && dt.getKind() == TypeKind.EXECUTABLE) {
            return (ExecutableType)dt;
        }
    }
    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:TypeUtilities.java

示例14: checkTypesAssignable

import com.sun.tools.javac.code.Types; //导入方法依赖的package包/类
public static boolean checkTypesAssignable(CompilationInfo info, TypeMirror from, TypeMirror to) {
    Context c = ((JavacTaskImpl) info.impl.getJavacTask()).getContext();
    if (from.getKind() == TypeKind.TYPEVAR) {
        Types types = Types.instance(c);
        TypeVar t = types.substBound((TypeVar)from, com.sun.tools.javac.util.List.of((Type)from), com.sun.tools.javac.util.List.of(types.boxedTypeOrType((Type)to)));
        return info.getTypes().isAssignable(t.getUpperBound(), to)
                || info.getTypes().isAssignable(to, t.getUpperBound());
    }
    if (from.getKind() == TypeKind.WILDCARD) {
        from = Types.instance(c).wildUpperBound((Type)from);
    }
    return Check.instance(c).checkType(null, (Type)from, (Type)to).getKind() != TypeKind.ERROR;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:SourceUtils.java

示例15: RichDiagnosticFormatter

import com.sun.tools.javac.code.Types; //导入方法依赖的package包/类
protected RichDiagnosticFormatter(Context context) {
    super((AbstractDiagnosticFormatter) Log.instance(context).getDiagnosticFormatter());
    setRichPrinter(new RichPrinter());
    this.syms = Symtab.instance(context);
    this.diags = JCDiagnostic.Factory.instance(context);
    this.types = Types.instance(context);
    this.messages = JavacMessages.instance(context);
    whereClauses = new LinkedHashMap<WhereClauseKind, Map<Type, JCDiagnostic>>();
    configuration = new RichConfiguration(Options.instance(context), formatter);
    for (WhereClauseKind kind : WhereClauseKind.values())
        whereClauses.put(kind, new LinkedHashMap<Type, JCDiagnostic>());
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:13,代码来源:RichDiagnosticFormatter.java


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