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

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

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

Types.upperBound介绍

[英]The "rvalue conversion".
The upper bound of most types is the type itself. Wildcards, on the other hand have upper and lower bounds.
[中]“右值转换”。
大多数类型的上限是类型本身。另一方面,通配符有上界和下界。

代码示例

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

public boolean isArray(Type t) {
  while (t.tag == WILDCARD)
    t = upperBound(t);
  return t.tag == ARRAY;
}

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

public boolean isArray(Type t) {
  while (t.tag == WILDCARD)
    t = upperBound(t);
  return t.tag == ARRAY;
}

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

@Override
public Boolean visitWildcardType(WildcardType t, Type s) {
  return isCastable(upperBound(t), s, warnStack.head);
}

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

@Override
public Boolean visitWildcardType(WildcardType t, Type s) {
  return isCastable(upperBound(t), s, warnStack.head);
}

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

@Override
public Type visitWildcardType(WildcardType t, Boolean recurse) {
  return erasure(upperBound(t), recurse);
}

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

@Override
public Type visitWildcardType(WildcardType t, Symbol sym) {
  return memberType(upperBound(t), sym);
}

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

@Override
public Type visitWildcardType(WildcardType t, Symbol sym) {
  return memberType(upperBound(t), sym);
}

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

@Override
public Type visitWildcardType(WildcardType t, Symbol sym) {
  return memberType(upperBound(t), sym);
}

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

@Override
public Type visitWildcardType(WildcardType t, Void ignored) {
  return erasure(upperBound(t));
}

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

@Override
public Boolean visitWildcardType(WildcardType t, Type s) {
  return isCastable(upperBound(t), s, warnStack.head);
}

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

public Type visitType(Type t, Void s) {
  return high ? upperBound(t) : lowerBound(t);
}

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

public boolean isArray(Type t) {
  while (t.hasTag(WILDCARD))
    t = upperBound(t);
  return t.hasTag(ARRAY);
}

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

void debugContainsType(WildcardType t, Type s) {
  System.err.println();
  System.err.format(" does %s contain %s?%n", t, s);
  System.err.format(" %s U(%s) <: U(%s) %s = %s%n",
           upperBound(s), s, t, U(t),
           t.isSuperBound()
           || isSubtypeNoCapture(upperBound(s), U(t)));
  System.err.format(" %s L(%s) <: L(%s) %s = %s%n",
           L(t), t, s, lowerBound(s),
           t.isExtendsBound()
           || isSubtypeNoCapture(L(t), lowerBound(s)));
  System.err.println();
}

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

void debugContainsType(WildcardType t, Type s) {
  System.err.println();
  System.err.format(" does %s contain %s?%n", t, s);
  System.err.format(" %s U(%s) <: U(%s) %s = %s%n",
           upperBound(s), s, t, U(t),
           t.isSuperBound()
           || isSubtypeNoCapture(upperBound(s), U(t)));
  System.err.format(" %s L(%s) <: L(%s) %s = %s%n",
           L(t), t, s, lowerBound(s),
           t.isExtendsBound()
           || isSubtypeNoCapture(L(t), lowerBound(s)));
  System.err.println();
}

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

boolean isAccessible(Env<AttrContext> env, Type t, boolean checkInner) {
  return (t.hasTag(ARRAY))
    ? isAccessible(env, types.upperBound(types.elemtype(t)))
    : isAccessible(env, t.tsym, checkInner);
}

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

@Override
public Type visitWildcardType(WildcardType t, Void ignored) {
  Type bound = t.type;
  if (t.kind != BoundKind.UNBOUND)
    bound = subst(bound);
  if (bound == t.type) {
    return t;
  } else {
    if (t.isExtendsBound() && bound.isExtendsBound())
      bound = upperBound(bound);
    return new WildcardType(bound, t.kind, syms.boundClass, t.bound);
  }
}

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

@Override
public Type visitWildcardType(WildcardType t, Void ignored) {
  Type bound = t.type;
  if (t.kind != BoundKind.UNBOUND)
    bound = subst(bound);
  if (bound == t.type) {
    return t;
  } else {
    if (t.isExtendsBound() && bound.isExtendsBound())
      bound = upperBound(bound);
    return new WildcardType(bound, t.kind, syms.boundClass, t.bound);
  }
}

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

/** Attribute the arguments in a method call, returning a list of types.
 */
List<Type> attribArgs(List<JCExpression> trees, Env<AttrContext> env) {
  ListBuffer<Type> argtypes = new ListBuffer<Type>();
  for (List<JCExpression> l = trees; l.nonEmpty(); l = l.tail)
    argtypes.append(chk.checkNonVoid(
      l.head.pos(), types.upperBound(attribTree(l.head, env, VAL, Infer.anyPoly))));
  return argtypes.toList();
}

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

@Override
public Boolean visitWildcardType(WildcardType t, Type s) {
  if (s.tag >= firstPartialTag)
    return containedBy(s, t);
  else {
    // debugContainsType(t, s);
    return isSameWildcard(t, s)
      || isCaptureOf(s, t)
      || ((t.isExtendsBound() || isSubtypeNoCapture(L(t), lowerBound(s))) &&
        (t.isSuperBound() || isSubtypeNoCapture(upperBound(s), U(t))));
  }
}

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

@Override
public Boolean visitWildcardType(WildcardType t, Type s) {
  if (s.tag >= firstPartialTag)
    return containedBy(s, t);
  else {
    // debugContainsType(t, s);
    return isSameWildcard(t, s)
      || isCaptureOf(s, t)
      || ((t.isExtendsBound() || isSubtypeNoCapture(L(t), lowerBound(s))) &&
        (t.isSuperBound() || isSubtypeNoCapture(upperBound(s), U(t))));
  }
}

相关文章

Types类方法