@Override protected boolean containsTypes(List<Type> ts1, List<Type> ts2) { return containsTypeEquivalent(ts1, ts2); } };
@Override protected boolean containsTypes(List<Type> ts1, List<Type> ts2) { return containsTypeEquivalent(ts1, ts2); }
@Override public Boolean visitMethodType(MethodType t, Type s) { return s.tag == METHOD && containsTypeEquivalent(t.argtypes, s.getParameterTypes()); }
@Override public Boolean visitMethodType(MethodType t, Type s) { return s.tag == METHOD && containsTypeEquivalent(t.argtypes, s.getParameterTypes()); }
@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)); }
@Override public Boolean visitMethodType(MethodType t, Type s) { return s.hasTag(METHOD) && containsTypeEquivalent(t.argtypes, s.getParameterTypes()); }
@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)); }
@Override public Boolean visitMethodType(MethodType t, Type s) { return s.hasTag(METHOD) && containsTypeEquivalent(t.argtypes, s.getParameterTypes()); }
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>
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>
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>
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>
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; }
/** 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); }
@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()); }
/** 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); }
/** 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); }
@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()); }
/** 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); }