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


Java List.from方法代码示例

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


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

示例1: getAnalyzerModes

import com.sun.tools.javac.util.List; //导入方法依赖的package包/类
/**
 * This method is used to parse the {@code find} option.
 * Possible modes are separated by colon; a mode can be excluded by
 * prepending '-' to its name. Finally, the special mode 'all' can be used to
 * add all modes to the resulting enum.
 */
static EnumSet<AnalyzerMode> getAnalyzerModes(String opt, Source source) {
    if (opt == null) {
        return EnumSet.noneOf(AnalyzerMode.class);
    }
    List<String> modes = List.from(opt.split(","));
    EnumSet<AnalyzerMode> res = EnumSet.noneOf(AnalyzerMode.class);
    if (modes.contains("all")) {
        res = EnumSet.allOf(AnalyzerMode.class);
    }
    for (AnalyzerMode mode : values()) {
        if (modes.contains(mode.opt)) {
            res.add(mode);
        } else if (modes.contains("-" + mode.opt) || !mode.sourceFilter.test(source)) {
            res.remove(mode);
        }
    }
    return res;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:25,代码来源:Analyzer.java

示例2: visitLambda

import com.sun.tools.javac.util.List; //导入方法依赖的package包/类
@Override
public void visitLambda( JCTree.JCLambda tree )
{
  super.visitLambda( tree );

  if( _tp.isGenerate() && !shouldProcessForGeneration() )
  {
    // Don't process tree during GENERATE, unless the tree was generated e.g., a bridge method
    return;
  }

  tree.type = eraseStructureType( tree.type );
  ArrayList<Type> types = new ArrayList<>();
  for( Type target : tree.targets )
  {
    types.add( eraseStructureType( target ) );
  }
  tree.targets = List.from( types );
}
 
开发者ID:manifold-systems,项目名称:manifold,代码行数:20,代码来源:ExtensionTransformer.java

示例3: replaceExtCall

import com.sun.tools.javac.util.List; //导入方法依赖的package包/类
private void replaceExtCall( JCTree.JCMethodInvocation tree, Symbol.MethodSymbol method )
{
  JCExpression methodSelect = tree.getMethodSelect();
  if( methodSelect instanceof JCTree.JCFieldAccess )
  {
    JCTree.JCFieldAccess m = (JCTree.JCFieldAccess)methodSelect;
    boolean isStatic = m.sym.getModifiers().contains( javax.lang.model.element.Modifier.STATIC );
    TreeMaker make = _tp.getTreeMaker();
    JavacElements javacElems = _tp.getElementUtil();
    JCExpression thisArg = m.selected;
    String extensionFqn = method.getEnclosingElement().asType().tsym.toString();
    m.selected = memberAccess( make, javacElems, extensionFqn );
    BasicJavacTask javacTask = ClassSymbols.instance( _sp.getTypeLoader().getModule() ).getJavacTask();
    Symbol.ClassSymbol extensionClassSym = ClassSymbols.instance( _sp.getTypeLoader().getModule() ).getClassSymbol( javacTask, extensionFqn ).getFirst();
    assignTypes( m.selected, extensionClassSym );
    m.sym = method;
    m.type = method.type;

    if( !isStatic )
    {
      ArrayList<JCExpression> newArgs = new ArrayList<>( tree.args );
      newArgs.add( 0, thisArg );
      tree.args = List.from( newArgs );
    }
  }
}
 
开发者ID:manifold-systems,项目名称:manifold,代码行数:27,代码来源:ExtensionTransformer.java

示例4: visitClassType

import com.sun.tools.javac.util.List; //导入方法依赖的package包/类
@Override
public Type visitClassType( Type.ClassType t, Void s )
{
  boolean erased = false;
  Type erasure = _types.erasure( t );
  Type base = visitType( erasure, s );
  if( base != erasure )
  {
    erased = true;
  }
  ArrayList<Type> params = new ArrayList<>();
  for( Type arg : t.allparams() )
  {
    Type param = visit( arg );
    params.add( param );
    if( param != arg )
    {
      erased = true;
    }
  }
  if( erased )
  {
    return new Type.ClassType( t.getEnclosingType(), List.from( params ), base.tsym );
  }
  return t;
}
 
开发者ID:manifold-systems,项目名称:manifold,代码行数:27,代码来源:StructuralTypeEraser.java

示例5: visitClassDef

import com.sun.tools.javac.util.List; //导入方法依赖的package包/类
@Override
public void visitClassDef( JCTree.JCClassDecl tree )
{
  super.visitClassDef( tree );
  if( tree.sym != null && !tree.sym.isInner() )
  {
    if( !hasNoBootstrap( tree.getModifiers().getAnnotations() ) )
    {
      JCTree.JCStatement newNode = buildBootstrapStaticBlock();
      ArrayList<JCTree> newDefs = new ArrayList<>( tree.defs );
      newDefs.add( 0, newNode );
      tree.defs = List.from( newDefs );
    }
  }
  result = tree;
}
 
开发者ID:manifold-systems,项目名称:manifold,代码行数:17,代码来源:BootstrapInserter.java

示例6: solve

import com.sun.tools.javac.util.List; //导入方法依赖的package包/类
/**
 * Solve variables in a given inference context. The amount of variables
 * to be solved, and the way in which the underlying acyclic graph is explored
 * depends on the selected solver strategy.
 */
void solve(GraphStrategy sstrategy) {
    checkWithinBounds(inferenceContext, warn); //initial propagation of bounds
    InferenceGraph inferenceGraph = new InferenceGraph(stuckDeps);
    while (!sstrategy.done()) {
        InferenceGraph.Node nodeToSolve = sstrategy.pickNode(inferenceGraph);
        List<Type> varsToSolve = List.from(nodeToSolve.data);
        List<Type> saved_undet = inferenceContext.save();
        try {
            //repeat until all variables are solved
            outer: while (Type.containsAny(inferenceContext.restvars(), varsToSolve)) {
                //for each inference phase
                for (GraphInferenceSteps step : GraphInferenceSteps.values()) {
                    if (inferenceContext.solveBasic(varsToSolve, step.steps)) {
                        checkWithinBounds(inferenceContext, warn);
                        continue outer;
                    }
                }
                //no progress
                throw inferenceException.setMessage();
            }
        }
        catch (InferenceException ex) {
            //did we fail because of interdependent ivars?
            inferenceContext.rollback(saved_undet);
            instantiateAsUninferredVars(varsToSolve, inferenceContext);
            checkWithinBounds(inferenceContext, warn);
        }
        inferenceGraph.deleteNode(nodeToSolve);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:36,代码来源:Infer.java

示例7: solve

import com.sun.tools.javac.util.List; //导入方法依赖的package包/类
/**
 * Solve variables in a given inference context. The amount of variables
 * to be solved, and the way in which the underlying acyclic graph is explored
 * depends on the selected solver strategy.
 */
void solve(GraphStrategy sstrategy) {
    doIncorporation(inferenceContext, warn); //initial propagation of bounds
    InferenceGraph inferenceGraph = new InferenceGraph();
    while (!sstrategy.done()) {
        if (dependenciesFolder != null) {
            //add this graph to the pending queue
            pendingGraphs = pendingGraphs.prepend(inferenceGraph.toDot());
        }
        InferenceGraph.Node nodeToSolve = sstrategy.pickNode(inferenceGraph);
        List<Type> varsToSolve = List.from(nodeToSolve.data);
        List<Type> saved_undet = inferenceContext.save();
        try {
            //repeat until all variables are solved
            outer: while (Type.containsAny(inferenceContext.restvars(), varsToSolve)) {
                //for each inference phase
                for (GraphInferenceSteps step : GraphInferenceSteps.values()) {
                    if (inferenceContext.solveBasic(varsToSolve, step.steps).nonEmpty()) {
                        doIncorporation(inferenceContext, warn);
                        continue outer;
                    }
                }
                //no progress
                throw inferenceException.setMessage();
            }
        }
        catch (InferenceException ex) {
            //did we fail because of interdependent ivars?
            inferenceContext.rollback(saved_undet);
            instantiateAsUninferredVars(varsToSolve, inferenceContext);
            doIncorporation(inferenceContext, warn);
        }
        inferenceGraph.deleteNode(nodeToSolve);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:40,代码来源:Infer.java

示例8: test

import com.sun.tools.javac.util.List; //导入方法依赖的package包/类
public static void test(String... args) {
    List<String> ss = List.from(args);
    if (args != null) {
        for (String s : args) {
            if (s != ss.head)
                throw new AssertionError("s != ss.head (" + s + ", " + ss.head + ")");
            ss = ss.tail;
        }
    }
    if (!ss.isEmpty())
        throw new AssertionError("!ss.isEmpty (" + ss + ")");
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:13,代码来源:FromArray.java

示例9: getValue

import com.sun.tools.javac.util.List; //导入方法依赖的package包/类
public List<Attribute> getValue() {
    return List.from(values);
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:4,代码来源:Attribute.java

示例10: min

import com.sun.tools.javac.util.List; //导入方法依赖的package包/类
InferenceContext min(List<Type> roots, boolean shouldSolve, Warner warn) {
    if (roots.length() == inferencevars.length()) {
        return this;
    }
    ReachabilityVisitor rv = new ReachabilityVisitor();
    rv.scan(roots);
    if (rv.min.size() == inferencevars.length()) {
        return this;
    }

    List<Type> minVars = List.from(rv.min);
    List<Type> redundantVars = inferencevars.diff(minVars);

    //compute new undet variables (bounds associated to redundant variables are dropped)
    ListBuffer<Type> minUndetVars = new ListBuffer<>();
    for (Type minVar : minVars) {
        UndetVar uv = (UndetVar)asUndetVar(minVar);
        Assert.check(uv.incorporationActions.isEmpty());
        UndetVar uv2 = uv.dup(types);
        for (InferenceBound ib : InferenceBound.values()) {
            List<Type> newBounds = uv.getBounds(ib).stream()
                    .filter(b -> !redundantVars.contains(b))
                    .collect(List.collector());
            uv2.setBounds(ib, newBounds);
        }
        minUndetVars.add(uv2);
    }

    //compute new minimal inference context
    InferenceContext minContext = new InferenceContext(infer, minVars, minUndetVars.toList());
    for (Type t : minContext.inferencevars) {
        //add listener that forwards notifications to original context
        minContext.addFreeTypeListener(List.of(t), (inferenceContext) -> {
            ((UndetVar)asUndetVar(t)).setInst(inferenceContext.asInstType(t));
            infer.doIncorporation(inferenceContext, warn);
            solve(List.from(rv.minMap.get(t)), warn);
            notifyChange();
        });
    }
    if (shouldSolve) {
        //solve definitively unreachable variables
        List<Type> unreachableVars = redundantVars.diff(List.from(rv.equiv));
        minContext.addFreeTypeListener(minVars, (inferenceContext) -> {
            solve(unreachableVars, warn);
            notifyChange();
        });
    }
    return minContext;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:50,代码来源:InferenceContext.java

示例11: ClassKind

import com.sun.tools.javac.util.List; //导入方法依赖的package包/类
ClassKind(String typeStr, InterfaceKind... superInterfaces) {
    this.typeStr = typeStr;
    this.superInterfaces = List.from(superInterfaces);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:5,代码来源:IntersectionTypeCastTest.java

示例12: TypeConfiguration

import com.sun.tools.javac.util.List; //导入方法依赖的package包/类
TypeConfiguration(TypeKind... typeKindList) {
    this.typeKindList = List.from(typeKindList);
    expressionListStr = asExpressionList();
    parameterListStr = asParameterList();
    bytecodeSigStr = asBytecodeString();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:7,代码来源:T7042566.java

示例13: Class

import com.sun.tools.javac.util.List; //导入方法依赖的package包/类
public ClassType Class(long flags, Type... typeArgs) {
    ClassSymbol csym = new ClassSymbol(flags, syntheticName(), predef.noSymbol);
    csym.type = new ClassType(Type.noType, List.from(typeArgs), csym);
    ((ClassType)csym.type).supertype_field = predef.objectType;
    return (ClassType)csym.type;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:7,代码来源:TypeHarness.java

示例14: Intersection

import com.sun.tools.javac.util.List; //导入方法依赖的package包/类
public ClassType Intersection(Type classBound, Type... intfBounds) {
    ClassType ct = Class(Flags.COMPOUND);
    ct.supertype_field = classBound;
    ct.interfaces_field = List.from(intfBounds);
    return ct;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:7,代码来源:TypeHarness.java


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