private TypeReference U(final TypeReference t) { TypeReference current = t; while (current.isWildcardType()) { if (current.isUnbounded()) { return BuiltinTypes.Object; } if (current.hasSuperBound()) { return current.getSuperBound(); } current = current.getExtendsBound(); } return current; }
private TypeReference U(final TypeReference t) { TypeReference current = t; while (current.isWildcardType()) { if (current.isUnbounded()) { return BuiltinTypes.Object; } if (current.hasSuperBound()) { return current.getSuperBound(); } current = current.getExtendsBound(); } return current; }
static boolean areParametersEquivalent(final List<ParameterDefinition> a, final List<ParameterDefinition> b) { final int count = a.size(); if (b.size() != count) { return false; } if (count == 0) { return true; } for (int i = 0; i < count; i++) { final ParameterDefinition pb = b.get(i); final ParameterDefinition pa = a.get(i); final TypeReference tb = pb.getParameterType(); TypeReference ta = pa.getParameterType(); if (ta.isGenericParameter() && !tb.isGenericParameter() && ((GenericParameter) ta).getOwner() == pa.getMethod()) { ta = ta.getExtendsBound(); } if (!areEquivalent(ta, tb)) { return false; } } return true; }
static boolean areParametersEquivalent(final List<ParameterDefinition> a, final List<ParameterDefinition> b) { final int count = a.size(); if (b.size() != count) { return false; } if (count == 0) { return true; } for (int i = 0; i < count; i++) { final ParameterDefinition pb = b.get(i); final ParameterDefinition pa = a.get(i); final TypeReference tb = pb.getParameterType(); TypeReference ta = pa.getParameterType(); if (ta.isGenericParameter() && !tb.isGenericParameter() && ((GenericParameter) ta).getOwner() == pa.getMethod()) { ta = ta.getExtendsBound(); } if (!areEquivalent(ta, tb)) { return false; } } return true; }
private TypeReference U(final TypeReference t) { TypeReference current = t; while (current.isWildcardType()) { if (current.isUnbounded()) { return BuiltinTypes.Object; } if (current.hasSuperBound()) { return current.getSuperBound(); } current = current.getExtendsBound(); } return current; }
@Override public TypeReference visitType(final TypeReference t, final Void ignored) { if (t.isWildcardType() || t.isGenericParameter() || t instanceof ICapturedType) { return t.isUnbounded() || t.hasSuperBound() ? BuiltinTypes.Object : visit(t.getExtendsBound()); } return t; }
@Override public TypeReference visitType(final TypeReference t, final Void ignored) { if (t.isWildcardType() || t.isGenericParameter() || t instanceof ICapturedType) { return t.isUnbounded() || t.hasSuperBound() ? BuiltinTypes.Object : visit(t.getExtendsBound()); } return t; }
@Override public TypeReference visitType(final TypeReference t, final Void ignored) { if (t.isWildcardType() || t.isGenericParameter() || t instanceof ICapturedType) { return t.isUnbounded() || t.hasSuperBound() ? BuiltinTypes.Object : visit(t.getExtendsBound()); } return t; }
public boolean hasExtendsBound() { return isGenericParameter() || (isWildcardType() && !BuiltinTypes.Object.equals(getExtendsBound()) && MetadataResolver.areEquivalent(BuiltinTypes.Bottom, getSuperBound())); }
public boolean hasExtendsBound() { return isGenericParameter() || (isWildcardType() && !BuiltinTypes.Object.equals(getExtendsBound()) && MetadataResolver.areEquivalent(BuiltinTypes.Bottom, getSuperBound())); }
public boolean hasExtendsBound() { return isGenericParameter() || (isWildcardType() && !BuiltinTypes.Object.equals(getExtendsBound()) && MetadataResolver.areEquivalent(BuiltinTypes.Bottom, getSuperBound())); }
private static boolean isSameWildcard(final TypeReference t, final TypeReference s) { VerifyArgument.notNull(t, "t"); VerifyArgument.notNull(s, "s"); if (!t.isWildcardType() || !s.isWildcardType()) { return false; } if (t.isUnbounded()) { return s.isUnbounded(); } if (t.hasSuperBound()) { return s.hasSuperBound() && isSameType(t.getSuperBound(), s.getSuperBound()); } return s.hasExtendsBound() && isSameType(t.getExtendsBound(), s.getExtendsBound()); }
private static boolean isSameWildcard(final TypeReference t, final TypeReference s) { VerifyArgument.notNull(t, "t"); VerifyArgument.notNull(s, "s"); if (!t.isWildcardType() || !s.isWildcardType()) { return false; } if (t.isUnbounded()) { return s.isUnbounded(); } if (t.hasSuperBound()) { return s.hasSuperBound() && isSameType(t.getSuperBound(), s.getSuperBound()); } return s.hasExtendsBound() && isSameType(t.getExtendsBound(), s.getExtendsBound()); }
private static boolean isSameWildcard(final TypeReference t, final TypeReference s) { VerifyArgument.notNull(t, "t"); VerifyArgument.notNull(s, "s"); if (!t.isWildcardType() || !s.isWildcardType()) { return false; } if (t.isUnbounded()) { return s.isUnbounded(); } if (t.hasSuperBound()) { return s.hasSuperBound() && isSameType(t.getSuperBound(), s.getSuperBound()); } return s.hasExtendsBound() && isSameType(t.getExtendsBound(), s.getExtendsBound()); }
private TypeReference toRawType(TypeReference type) { if(type.hasExtendsBound()) return toRawType(type.getExtendsBound()); if(type.hasSuperBound()) return BuiltinTypes.Object; if(type instanceof GenericParameter) return toRawType(type.getUnderlyingType()); if(!type.isGenericType()) return type; try { return type.getRawType(); } catch (UnsupportedOperationException e) { return BuiltinTypes.Object; } }
@Override public TypeReference visitWildcard(final WildcardType t, final Map<TypeReference, TypeReference> map) { if (t.isUnbounded()) { return t; } final TypeReference oldBound = t.hasExtendsBound() ? t.getExtendsBound() : t.getSuperBound(); final TypeReference mapping = map.get(oldBound); if (MetadataResolver.areEquivalent(mapping, t)) { return t; } TypeReference newBound = visit(oldBound, map); while (newBound.isWildcardType()) { if (newBound.isUnbounded()) { return newBound; } newBound = newBound.hasExtendsBound() ? newBound.getExtendsBound() : newBound.getSuperBound(); } if (oldBound != newBound) { return t.hasExtendsBound() ? WildcardType.makeExtends(newBound) : WildcardType.makeSuper(newBound); } return t; }
@Override public TypeReference visitWildcard(final WildcardType t, final Map<TypeReference, TypeReference> map) { if (t.isUnbounded()) { return t; } final TypeReference oldBound = t.hasExtendsBound() ? t.getExtendsBound() : t.getSuperBound(); final TypeReference mapping = map.get(oldBound); if (MetadataResolver.areEquivalent(mapping, t)) { return t; } TypeReference newBound = visit(oldBound, map); while (newBound.isWildcardType()) { if (newBound.isUnbounded()) { return newBound; } newBound = newBound.hasExtendsBound() ? newBound.getExtendsBound() : newBound.getSuperBound(); } if (oldBound != newBound) { return t.hasExtendsBound() ? WildcardType.makeExtends(newBound) : WildcardType.makeSuper(newBound); } return t; }
@Override public Boolean visitWildcard(final WildcardType t, final TypeReference s) { if (s.isWildcardType()) { if (t.isUnbounded()) { return s.isUnbounded(); } if (t.hasExtendsBound()) { return s.hasExtendsBound() && isSameType(t.getExtendsBound(), s.getExtendsBound()); } return s.hasSuperBound() && isSameType(t.getSuperBound(), s.getSuperBound()); } return false; } }
@Override public Boolean visitWildcard(final WildcardType t, final TypeReference s) { if (s.isWildcardType()) { if (t.isUnbounded()) { return s.isUnbounded(); } if (t.hasExtendsBound()) { return s.hasExtendsBound() && isSameType(t.getExtendsBound(), s.getExtendsBound()); } return s.hasSuperBound() && isSameType(t.getSuperBound(), s.getSuperBound()); } return false; } }
@Override public Boolean visitWildcard(final WildcardType t, final TypeReference s) { if (s.isWildcardType()) { if (t.isUnbounded()) { return s.isUnbounded(); } if (t.hasExtendsBound()) { return s.hasExtendsBound() && isSameType(t.getExtendsBound(), s.getExtendsBound()); } return s.hasSuperBound() && isSameType(t.getSuperBound(), s.getSuperBound()); } return false; } }