com.sun.tools.javac.code.Types.closureMin()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(3.8k)|赞(0)|评价(0)|浏览(120)

本文整理了Java中com.sun.tools.javac.code.Types.closureMin()方法的一些代码示例,展示了Types.closureMin()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Types.closureMin()方法的具体详情如下:
包路径:com.sun.tools.javac.code.Types
类名称:Types
方法名:closureMin

Types.closureMin介绍

[英]Return the minimum types of a closure, suitable for computing compoundMin or glb.
[中]返回闭包的最小类型,适用于计算compoundMin或glb。

代码示例

代码示例来源:origin: org.kohsuke.sorcerer/sorcerer-javac

/**
 * Return the minimum type of a closure, a compound type if no
 * unique minimum exists.
 */
private Type compoundMin(List<Type> cl) {
  if (cl.isEmpty()) return syms.objectType;
  List<Type> compound = closureMin(cl);
  if (compound.isEmpty())
    return null;
  else if (compound.tail.isEmpty())
    return compound.head;
  else
    return makeCompoundType(compound);
}

代码示例来源:origin: konsoletyper/teavm-javac

/**
 * Return the minimum type of a closure, a compound type if no
 * unique minimum exists.
 */
private Type compoundMin(List<Type> cl) {
  if (cl.isEmpty()) return syms.objectType;
  List<Type> compound = closureMin(cl);
  if (compound.isEmpty())
    return null;
  else if (compound.tail.isEmpty())
    return compound.head;
  else
    return makeIntersectionType(compound);
}

代码示例来源:origin: org.jvnet.sorcerer/sorcerer-javac

/**
 * Return the minimum type of a closure, a compound type if no
 * unique minimum exists.
 */
private Type compoundMin(List<Type> cl) {
  if (cl.isEmpty()) return syms.objectType;
  List<Type> compound = closureMin(cl);
  if (compound.isEmpty())
    return null;
  else if (compound.tail.isEmpty())
    return compound.head;
  else
    return makeCompoundType(compound);
}

代码示例来源:origin: sc.fiji/javac

/**
 * Return the minimum type of a closure, a compound type if no
 * unique minimum exists.
 */
private Type compoundMin(List<Type> cl) {
  if (cl.isEmpty()) return syms.objectType;
  List<Type> compound = closureMin(cl);
  if (compound.isEmpty())
    return null;
  else if (compound.tail.isEmpty())
    return compound.head;
  else
    return makeCompoundType(compound);
}

代码示例来源:origin: sc.fiji/javac

public Type glb(Type t, Type s) {
  if (s == null)
    return t;
  else if (isSubtypeNoCapture(t, s))
    return t;
  else if (isSubtypeNoCapture(s, t))
    return s;
  List<Type> closure = union(closure(t), closure(s));
  List<Type> bounds = closureMin(closure);
  if (bounds.isEmpty()) {             // length == 0
    return syms.objectType;
  } else if (bounds.tail.isEmpty()) { // length == 1
    return bounds.head;
  } else {                            // length > 1
    int classCount = 0;
    for (Type bound : bounds)
      if (!bound.isInterface())
        classCount++;
    if (classCount > 1)
      return syms.errType;
  }
  return makeCompoundType(bounds);
}
// </editor-fold>

代码示例来源:origin: org.jvnet.sorcerer/sorcerer-javac

public Type glb(Type t, Type s) {
  if (s == null)
    return t;
  else if (isSubtypeNoCapture(t, s))
    return t;
  else if (isSubtypeNoCapture(s, t))
    return s;
  List<Type> closure = union(closure(t), closure(s));
  List<Type> bounds = closureMin(closure);
  if (bounds.isEmpty()) {             // length == 0
    return syms.objectType;
  } else if (bounds.tail.isEmpty()) { // length == 1
    return bounds.head;
  } else {                            // length > 1
    int classCount = 0;
    for (Type bound : bounds)
      if (!bound.isInterface())
        classCount++;
    if (classCount > 1)
      return syms.errType;
  }
  return makeCompoundType(bounds);
}
// </editor-fold>

代码示例来源:origin: org.kohsuke.sorcerer/sorcerer-javac

public Type glb(Type t, Type s) {
  if (s == null)
    return t;
  else if (t.isPrimitive() || s.isPrimitive())
    return syms.errType;
  else if (isSubtypeNoCapture(t, s))
    return t;
  else if (isSubtypeNoCapture(s, t))
    return s;
  List<Type> closure = union(closure(t), closure(s));
  List<Type> bounds = closureMin(closure);
  if (bounds.isEmpty()) {             // length == 0
    return syms.objectType;
  } else if (bounds.tail.isEmpty()) { // length == 1
    return bounds.head;
  } else {                            // length > 1
    int classCount = 0;
    for (Type bound : bounds)
      if (!bound.isInterface())
        classCount++;
    if (classCount > 1)
      return createErrorType(t);
  }
  return makeCompoundType(bounds);
}
// </editor-fold>

代码示例来源:origin: konsoletyper/teavm-javac

List<Type> bounds = closureMin(flatBounds);

代码示例来源:origin: org.kohsuke.sorcerer/sorcerer-javac

List<Type> mec = closureMin(cl);

代码示例来源:origin: konsoletyper/teavm-javac

List<Type> mec = closureMin(cl);

相关文章

Types类方法