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


Java Attr.instance方法代码示例

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


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

示例1: init

import com.sun.tools.javac.comp.Attr; //导入方法依赖的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:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:20,代码来源:JavacTrees.java

示例2: DocEnv

import com.sun.tools.javac.comp.Attr; //导入方法依赖的package包/类
/**
 * Constructor
 *
 * @param context      Context for this javadoc instance.
 */
private DocEnv(Context context) {
    context.put(docEnvKey, this);

    messager = Messager.instance0(context);
    syms = Symtab.instance(context);
    reader = JavadocClassReader.instance0(context);
    enter = JavadocEnter.instance0(context);
    attr = Attr.instance(context);
    names = Name.Table.instance(context);
    externalizableSym = reader.enterClass(names.fromString("java.io.Externalizable"));
    chk = Check.instance(context);
    types = Types.instance(context);

    // Default.  Should normally be reset with setLocale.
    this.doclocale = new DocLocale(this, "", breakiterator);
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:22,代码来源:DocEnv.java

示例3: CodeTranslator

import com.sun.tools.javac.comp.Attr; //导入方法依赖的package包/类
public CodeTranslator(ProcessingEnvironment processingEnv) {
  this.trees = Trees.instance(processingEnv);
  this.SystemType = (DeclaredType) processingEnv.getElementUtils().getTypeElement(System.class.getName()).asType();
  this.ThrowableType = (DeclaredType) processingEnv.getElementUtils().getTypeElement(Throwable.class.getName()).asType();
  Context context = ((JavacProcessingEnvironment)processingEnv).getContext();
  this.attr = Attr.instance(context);
  this.typeUtils = processingEnv.getTypeUtils();
  this.factory = new TypeMirrorFactory(processingEnv.getElementUtils(), processingEnv.getTypeUtils()) {
    @Override
    public TypeInfo create(TypeUse use, TypeMirror type) {
      if (type.getKind() == TypeKind.WILDCARD) {
        WildcardType wildcardType = (WildcardType) type;
        if (wildcardType.getExtendsBound() != null) {
          return super.create(wildcardType.getExtendsBound());
        } else if (wildcardType.getSuperBound() != null) {
          return super.create(use, wildcardType.getSuperBound());
        }
      }
      return super.create(use, type);
    }
  };
}
 
开发者ID:vert-x3,项目名称:vertx-codetrans,代码行数:23,代码来源:CodeTranslator.java

示例4: TreeScannerStateful

import com.sun.tools.javac.comp.Attr; //导入方法依赖的package包/类
public TreeScannerStateful(CompilationTask task, JCCompilationUnit jcc) {
  	this.jcc = jcc ;
      trees = Trees.instance(task);
      treesC = (JavacTrees)trees;
              
      //Rabbit hole to Wonderland
      context = ((BasicJavacTask)task).getContext() ;
this.task = ((BasicJavacTask)task) ;
      
      //Initialize magical classes !
      make = TreeMaker.instance(context) ;
      names = Names.instance(context) ;
      syms = Symtab.instance(context);
      types = Types.instance(context) ;
      typesC = JavacTypes.instance(context) ;
      attr = Attr.instance(context) ;
      enter = Enter.instance(context) ;
      resolve = Resolve.instance(context) ;
      memberEnter = MemberEnter.instance(context) ;
javacElements = JavacElements.instance(context) ;
info = TreeInfo.instance(context) ;

      sourcePositions = trees.getSourcePositions();
      elements = ((JavacTask)task).getElements();
      elementsC = (JavacElements)elements;
}
 
开发者ID:metabrain,项目名称:java8-plugin-persitent-local-vars,代码行数:27,代码来源:TreeScannerStateful.java

示例5: attributeTree

import com.sun.tools.javac.comp.Attr; //导入方法依赖的package包/类
private static TypeMirror attributeTree(JavacTaskImpl jti, Tree tree, Scope scope, final List<Diagnostic<? extends JavaFileObject>> errors) {
        Log log = Log.instance(jti.getContext());
        JavaFileObject prev = log.useSource(new DummyJFO());
        Log.DiagnosticHandler discardHandler = new Log.DiscardDiagnosticHandler(log) {
            @Override
            public void report(JCDiagnostic diag) {
                errors.add(diag);
            }            
        };
        NBResolve resolve = NBResolve.instance(jti.getContext());
        resolve.disableAccessibilityChecks();
//        Enter enter = Enter.instance(jti.getContext());
//        enter.shadowTypeEnvs(true);
//        ArgumentAttr argumentAttr = ArgumentAttr.instance(jti.getContext());
//        ArgumentAttr.LocalCacheContext cacheContext = argumentAttr.withLocalCacheContext();
        try {
            Attr attr = Attr.instance(jti.getContext());
            Env<AttrContext> env = getEnv(scope);
            if (tree instanceof JCExpression)
                return attr.attribExpr((JCTree) tree,env, Type.noType);
            return attr.attribStat((JCTree) tree,env);
        } finally {
//            cacheContext.leave();
            log.useSource(prev);
            log.popDiagnosticHandler(discardHandler);
            resolve.restoreAccessbilityChecks();
//            enter.shadowTypeEnvs(false);
        }
    }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:30,代码来源:TreeUtilities.java

示例6: attributeTreeTo

import com.sun.tools.javac.comp.Attr; //导入方法依赖的package包/类
private static Scope attributeTreeTo(JavacTaskImpl jti, Tree tree, Scope scope, Tree to, final List<Diagnostic<? extends JavaFileObject>> errors) {
        Log log = Log.instance(jti.getContext());
        JavaFileObject prev = log.useSource(new DummyJFO());
        Log.DiagnosticHandler discardHandler = new Log.DiscardDiagnosticHandler(log) {
            @Override
            public void report(JCDiagnostic diag) {
                errors.add(diag);
            }            
        };
        NBResolve resolve = NBResolve.instance(jti.getContext());
        resolve.disableAccessibilityChecks();
//        Enter enter = Enter.instance(jti.getContext());
//        enter.shadowTypeEnvs(true);
//        ArgumentAttr argumentAttr = ArgumentAttr.instance(jti.getContext());
//        ArgumentAttr.LocalCacheContext cacheContext = argumentAttr.withLocalCacheContext();
        try {
            Attr attr = Attr.instance(jti.getContext());
            Env<AttrContext> env = getEnv(scope);
            Env<AttrContext> result = tree instanceof JCExpression ?
                attr.attribExprToTree((JCExpression) tree, env, (JCTree) to) :
                attr.attribStatToTree((JCTree) tree, env, (JCTree) to);
            try {
                Constructor<JavacScope> c = JavacScope.class.getDeclaredConstructor(Env.class);
                c.setAccessible(true);
                return c.newInstance(result);
            } catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) {
                throw new IllegalStateException(ex);
            }
        } finally {
//            cacheContext.leave();
            log.useSource(prev);
            log.popDiagnosticHandler(discardHandler);
            resolve.restoreAccessbilityChecks();
//            enter.shadowTypeEnvs(false);
        }
    }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:37,代码来源:TreeUtilities.java

示例7: attributeTree

import com.sun.tools.javac.comp.Attr; //导入方法依赖的package包/类
private static TypeMirror attributeTree(JavacTaskImpl jti, Tree tree, Scope scope, final List<Diagnostic<? extends JavaFileObject>> errors) {
        Log log = Log.instance(jti.getContext());
        JavaFileObject prev = log.useSource(new DummyJFO());
        Log.DiagnosticHandler discardHandler = new Log.DiscardDiagnosticHandler(log) {
            @Override
            public void report(JCDiagnostic diag) {
                errors.add(diag);
            }            
        };
        NBResolve resolve = NBResolve.instance(jti.getContext());
        resolve.disableAccessibilityChecks();
//        Enter enter = Enter.instance(jti.getContext());
//        enter.shadowTypeEnvs(true);
//        ArgumentAttr argumentAttr = ArgumentAttr.instance(jti.getContext());
//        ArgumentAttr.LocalCacheContext cacheContext = argumentAttr.withLocalCacheContext();
        try {
            Attr attr = Attr.instance(jti.getContext());
            Env<AttrContext> env = ((JavacScope) scope).getEnv();
            if (tree instanceof JCExpression)
                return attr.attribExpr((JCTree) tree,env, Type.noType);
            return attr.attribStat((JCTree) tree,env);
        } finally {
//            cacheContext.leave();
            log.useSource(prev);
            log.popDiagnosticHandler(discardHandler);
            resolve.restoreAccessbilityChecks();
//            enter.shadowTypeEnvs(false);
        }
    }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:30,代码来源:Utilities.java

示例8: attributeTree

import com.sun.tools.javac.comp.Attr; //导入方法依赖的package包/类
private static TypeMirror attributeTree(JavacTaskImpl jti, Tree tree, Scope scope, 
            final List<Diagnostic<? extends JavaFileObject>> errors, @NullAllowed final Diagnostic.Kind filter) {
        Log log = Log.instance(jti.getContext());
        JavaFileObject prev = log.useSource(new DummyJFO());
        Enter enter = Enter.instance(jti.getContext());
        
        Log.DiagnosticHandler discardHandler = new Log.DiscardDiagnosticHandler(log) {
            private Diagnostic.Kind f = filter == null ? Diagnostic.Kind.ERROR : filter;
            @Override
            public void report(JCDiagnostic diag) {
                if (diag.getKind().compareTo(f) >= 0) {
                    errors.add(diag);
                }
            }            
        };
//        ArgumentAttr argumentAttr = ArgumentAttr.instance(jti.getContext());
//        ArgumentAttr.LocalCacheContext cacheContext = argumentAttr.withLocalCacheContext();
        try {
//            enter.shadowTypeEnvs(true);
            Attr attr = Attr.instance(jti.getContext());
            Env<AttrContext> env = ((JavacScope) scope).getEnv();
            if (tree instanceof JCTree.JCExpression) {
                return attr.attribExpr((JCTree) tree,env, Type.noType);
            }
            return attr.attribStat((JCTree) tree,env);
        } finally {
//            cacheContext.leave();
            log.useSource(prev);
            log.popDiagnosticHandler(discardHandler);
//            enter.shadowTypeEnvs(false);
        }
    }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:33,代码来源:Utilities.java

示例9: init

import com.sun.tools.javac.comp.Attr; //导入方法依赖的package包/类
private void init(Context 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);
    javacTaskImpl = context.get(JavacTaskImpl.class);
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:11,代码来源:JavacTrees.java

示例10: init

import com.sun.tools.javac.comp.Attr; //导入方法依赖的package包/类
private void init(Context 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);

    JavacTask t = context.get(JavacTask.class);
    if (t instanceof JavacTaskImpl)
        javacTaskImpl = (JavacTaskImpl) t;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:16,代码来源:JavacTrees.java

示例11: TypeAnnotations

import com.sun.tools.javac.comp.Attr; //导入方法依赖的package包/类
protected TypeAnnotations(Context context) {
    context.put(typeAnnosKey, this);
    names = Names.instance(context);
    log = Log.instance(context);
    syms = Symtab.instance(context);
    annotate = Annotate.instance(context);
    attr = Attr.instance(context);
    Options options = Options.instance(context);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:10,代码来源:TypeAnnotations.java

示例12: TypeAnnotations

import com.sun.tools.javac.comp.Attr; //导入方法依赖的package包/类
protected TypeAnnotations(Context context) {
    context.put(typeAnnosKey, this);
    names = Names.instance(context);
    log = Log.instance(context);
    syms = Symtab.instance(context);
    annotate = Annotate.instance(context);
    attr = Attr.instance(context);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:9,代码来源:TypeAnnotations.java

示例13: JavacTrees

import com.sun.tools.javac.comp.Attr; //导入方法依赖的package包/类
private JavacTrees(Context context) {
    context.put(JavacTrees.class, this);
    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);
    javacTaskImpl = context.get(JavacTaskImpl.class);
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:12,代码来源:JavacTrees.java

示例14: AptEnv

import com.sun.tools.javac.comp.Attr; //导入方法依赖的package包/类
private AptEnv(Context context) {
    context.put(aptEnvKey, this);

    names = Name.Table.instance(context);
    symtab = Symtab.instance(context);
    jctypes = Types.instance(context);
    enter = Enter.instance(context);
    attr = Attr.instance(context);
    typeMaker = TypeMaker.instance(context);
    declMaker = DeclarationMaker.instance(context);
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:12,代码来源:AptEnv.java

示例15: AptEnv

import com.sun.tools.javac.comp.Attr; //导入方法依赖的package包/类
private AptEnv(Context context) {
    context.put(aptEnvKey, this);

    names = Names.instance(context);
    symtab = Symtab.instance(context);
    jctypes = Types.instance(context);
    enter = Enter.instance(context);
    attr = Attr.instance(context);
    typeMaker = TypeMaker.instance(context);
    declMaker = DeclarationMaker.instance(context);
}
 
开发者ID:aducode,项目名称:openjdk-source-code-learn,代码行数:12,代码来源:AptEnv.java


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