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

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

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

Types.containsTypeEquivalent介绍

暂无

代码示例

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

@Override
  protected boolean containsTypes(List<Type> ts1, List<Type> ts2) {
    return containsTypeEquivalent(ts1, ts2);
  }
};

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

@Override
protected boolean containsTypes(List<Type> ts1, List<Type> ts2) {
  return containsTypeEquivalent(ts1, ts2);
}

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

@Override
public Boolean visitMethodType(MethodType t, Type s) {
  return s.tag == METHOD
    && containsTypeEquivalent(t.argtypes, s.getParameterTypes());
}

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

@Override
public Boolean visitMethodType(MethodType t, Type s) {
  return s.tag == METHOD
    && containsTypeEquivalent(t.argtypes, s.getParameterTypes());
}

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

@Override
public Boolean visitArrayType(ArrayType t, Type s) {
  if (t == s)
    return true;
  if (s.tag >= firstPartialTag)
    return visit(s, t);
  return s.tag == ARRAY
    && containsTypeEquivalent(t.elemtype, elemtype(s));
}

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

@Override
public Boolean visitMethodType(MethodType t, Type s) {
  return s.hasTag(METHOD)
    && containsTypeEquivalent(t.argtypes, s.getParameterTypes());
}

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

@Override
public Boolean visitArrayType(ArrayType t, Type s) {
  if (t == s)
    return true;
  if (s.tag >= firstPartialTag)
    return visit(s, t);
  return s.tag == ARRAY
    && containsTypeEquivalent(t.elemtype, elemtype(s));
}

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

@Override
public Boolean visitMethodType(MethodType t, Type s) {
  return s.hasTag(METHOD)
    && containsTypeEquivalent(t.argtypes, s.getParameterTypes());
}

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

public boolean containsTypeEquivalent(List<Type> ts, List<Type> ss) {
  while (ts.nonEmpty() && ss.nonEmpty()
      && containsTypeEquivalent(ts.head, ss.head)) {
    ts = ts.tail;
    ss = ss.tail;
  }
  return ts.isEmpty() && ss.isEmpty();
}
// </editor-fold>

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

public boolean containsTypeEquivalent(List<Type> ts, List<Type> ss) {
  while (ts.nonEmpty() && ss.nonEmpty()
      && containsTypeEquivalent(ts.head, ss.head)) {
    ts = ts.tail;
    ss = ss.tail;
  }
  return ts.isEmpty() && ss.isEmpty();
}
// </editor-fold>

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

public boolean containsTypeEquivalent(List<Type> ts, List<Type> ss) {
  while (ts.nonEmpty() && ss.nonEmpty()
      && containsTypeEquivalent(ts.head, ss.head)) {
    ts = ts.tail;
    ss = ss.tail;
  }
  return ts.isEmpty() && ss.isEmpty();
}
// </editor-fold>

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

public boolean containsTypeEquivalent(List<Type> ts, List<Type> ss) {
  while (ts.nonEmpty() && ss.nonEmpty()
      && containsTypeEquivalent(ts.head, ss.head)) {
    ts = ts.tail;
    ss = ss.tail;
  }
  return ts.isEmpty() && ss.isEmpty();
}
// </editor-fold>

代码示例来源:origin: org.netbeans.api/org-netbeans-modules-java-source-base

public boolean alreadyDefinedIn(CharSequence name, TypeMirror returnType, List<TypeMirror> paramTypes, TypeElement enclClass) {
  ClassSymbol clazz = (ClassSymbol)enclClass;
  Scope scope = clazz.members();
  Name n = names.fromString(name.toString());
  ListBuffer<Type> buff = new ListBuffer<>();
  for (TypeMirror tm : paramTypes) {
    buff.append((Type)tm);
  }
  for (Symbol sym : scope.getSymbolsByName(n, Scope.LookupKind.NON_RECURSIVE)) {
    if(sym.type instanceof ExecutableType &&
        jctypes.containsTypeEquivalent(sym.type.asMethodType().getParameterTypes(), buff.toList()) &&
        jctypes.isSameType(sym.type.asMethodType().getReturnType(), (Type)returnType))
      return true;
  }
  return false;
}

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

/** Enter all interfaces of type `type' into the hash table `seensofar'
 *  with their class symbol as key and their type as value. Make
 *  sure no class is entered with two different types.
 */
void checkClassBounds(DiagnosticPosition pos,
       Map<TypeSymbol,Type> seensofar,
       Type type) {
  if (type.isErroneous()) return;
  for (List<Type> l = types.interfaces(type); l.nonEmpty(); l = l.tail) {
  Type it = l.head;
  Type oldit = seensofar.put(it.tsym, it);
  if (oldit != null) {
    List<Type> oldparams = oldit.allparams();
    List<Type> newparams = it.allparams();
    if (!types.containsTypeEquivalent(oldparams, newparams))
    log.error(pos, "cant.inherit.diff.arg",
       it.tsym, Type.toString(oldparams),
       Type.toString(newparams));
  }
  checkClassBounds(pos, seensofar, it);
  }
  Type st = types.supertype(type);
  if (st != null) checkClassBounds(pos, seensofar, st);
}

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

@Override
public Boolean visitClassType(ClassType t, Type s) {
  if (t == s)
    return true;
  if (s.tag >= firstPartialTag)
    return visit(s, t);
  if (s.isSuperBound() && !s.isExtendsBound())
    return visit(t, upperBound(s)) && visit(t, lowerBound(s));
  if (t.isCompound() && s.isCompound()) {
    if (!visit(supertype(t), supertype(s)))
      return false;
    HashSet<SingletonType> set = new HashSet<SingletonType>();
    for (Type x : interfaces(t))
      set.add(new SingletonType(x));
    for (Type x : interfaces(s)) {
      if (!set.remove(new SingletonType(x)))
        return false;
    }
    return (set.size() == 0);
  }
  return t.tsym == s.tsym
    && visit(t.getEnclosingType(), s.getEnclosingType())
    && containsTypeEquivalent(t.getTypeArguments(), s.getTypeArguments());
}

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

/** Enter all interfaces of type `type' into the hash table `seensofar'
 *  with their class symbol as key and their type as value. Make
 *  sure no class is entered with two different types.
 */
void checkClassBounds(DiagnosticPosition pos,
           Map<TypeSymbol,Type> seensofar,
           Type type) {
  if (type.isErroneous()) return;
  for (List<Type> l = types.interfaces(type); l.nonEmpty(); l = l.tail) {
    Type it = l.head;
    Type oldit = seensofar.put(it.tsym, it);
    if (oldit != null) {
      List<Type> oldparams = oldit.allparams();
      List<Type> newparams = it.allparams();
      if (!types.containsTypeEquivalent(oldparams, newparams))
        log.error(pos, "cant.inherit.diff.arg",
             it.tsym, Type.toString(oldparams),
             Type.toString(newparams));
    }
    checkClassBounds(pos, seensofar, it);
  }
  Type st = types.supertype(type);
  if (st != Type.noType) checkClassBounds(pos, seensofar, st);
}

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

/** Enter all interfaces of type `type' into the hash table `seensofar'
 *  with their class symbol as key and their type as value. Make
 *  sure no class is entered with two different types.
 */
void checkClassBounds(DiagnosticPosition pos,
           Map<TypeSymbol,Type> seensofar,
           Type type) {
  if (type.isErroneous()) return;
  for (List<Type> l = types.interfaces(type); l.nonEmpty(); l = l.tail) {
    Type it = l.head;
    Type oldit = seensofar.put(it.tsym, it);
    if (oldit != null) {
      List<Type> oldparams = oldit.allparams();
      List<Type> newparams = it.allparams();
      if (!types.containsTypeEquivalent(oldparams, newparams))
        log.error(pos, "cant.inherit.diff.arg",
             it.tsym, Type.toString(oldparams),
             Type.toString(newparams));
    }
    checkClassBounds(pos, seensofar, it);
  }
  Type st = types.supertype(type);
  if (st != null) checkClassBounds(pos, seensofar, st);
}

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

@Override
public Boolean visitClassType(ClassType t, Type s) {
  if (t == s)
    return true;
  if (s.tag >= firstPartialTag)
    return visit(s, t);
  if (s.isSuperBound() && !s.isExtendsBound())
    return visit(t, upperBound(s)) && visit(t, lowerBound(s));
  if (t.isCompound() && s.isCompound()) {
    if (!visit(supertype(t), supertype(s)))
      return false;
    HashSet<SingletonType> set = new HashSet<SingletonType>();
    for (Type x : interfaces(t))
      set.add(new SingletonType(x));
    for (Type x : interfaces(s)) {
      if (!set.remove(new SingletonType(x)))
        return false;
    }
    return (set.size() == 0);
  }
  return t.tsym == s.tsym
    && visit(t.getEnclosingType(), s.getEnclosingType())
    && containsTypeEquivalent(t.getTypeArguments(), s.getTypeArguments());
}

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

/** Enter all interfaces of type `type' into the hash table `seensofar'
 *  with their class symbol as key and their type as value. Make
 *  sure no class is entered with two different types.
 */
void checkClassBounds(DiagnosticPosition pos,
           Map<TypeSymbol,Type> seensofar,
           Type type) {
  if (type.isErroneous()) return;
  for (List<Type> l = types.interfaces(type); l.nonEmpty(); l = l.tail) {
    Type it = l.head;
    Type oldit = seensofar.put(it.tsym, it);
    if (oldit != null) {
      List<Type> oldparams = oldit.allparams();
      List<Type> newparams = it.allparams();
      if (!types.containsTypeEquivalent(oldparams, newparams))
        log.error(pos, "cant.inherit.diff.arg",
             it.tsym, Type.toString(oldparams),
             Type.toString(newparams));
    }
    checkClassBounds(pos, seensofar, it);
  }
  Type st = types.supertype(type);
  if (st != null) checkClassBounds(pos, seensofar, st);
}

相关文章

Types类方法