當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。