public boolean isSubtypeOfBound(JavaType type) { switch (boundType) { case SUPER: return bound.isSubtypeOf(type); case EXTENDS: return type.isSubtypeOf(bound); case UNBOUNDED: default: return true; } } }
@Override public boolean isSubtypeOf(String fullyQualifiedName) { return "java.lang.Object".equals(fullyQualifiedName) || (boundType == BoundType.EXTENDS && bound.isSubtypeOf(fullyQualifiedName)); }
public boolean isSubtypeOfBound(JavaType type) { switch (boundType) { case SUPER: return bound.isSubtypeOf(type); case EXTENDS: return !boundIsTypeVarAndNotType(type) && type.isSubtypeOf(bound); case UNBOUNDED: default: return true; } }
public boolean isSubtypeOfBound(JavaType type) { switch (boundType) { case SUPER: return bound.isSubtypeOf(type); case EXTENDS: return !boundIsTypeVarAndNotType(type) && type.isSubtypeOf(bound); case UNBOUNDED: default: return true; } }
private static boolean specializationOfReturnType(JavaType methodResultType, JavaType overrideeResultType) { return !methodResultType.isVoid() && (methodResultType.isSubtypeOf(overrideeResultType) && !overrideeResultType.isSubtypeOf(methodResultType)); }
private static boolean specializationOfReturnType(JavaType methodResultType, JavaType overrideeResultType) { return !methodResultType.isVoid() && (methodResultType.isSubtypeOf(overrideeResultType) && !overrideeResultType.isSubtypeOf(methodResultType)); }
@Override public boolean isSubtypeOf(String fullyQualifiedName) { return "java.lang.Object".equals(fullyQualifiedName) || (fullyQualifiedName.endsWith("[]") && elementType.isSubtypeOf(fullyQualifiedName.substring(0, fullyQualifiedName.length() - 2))); }
@Override public boolean isSubtypeOf(String fullyQualifiedName) { return "java.lang.Object".equals(fullyQualifiedName) || (fullyQualifiedName.endsWith("[]") && elementType.isSubtypeOf(fullyQualifiedName.substring(0, fullyQualifiedName.length() - 2))); }
@Override public boolean isSubtypeOf(String fullyQualifiedName) { return erasure().isSubtypeOf(fullyQualifiedName); }
private static boolean firstParamSubtypeOfRefType(JavaType expressionType, List<JavaType> samMethodArgs) { return samMethodArgs.isEmpty() || samMethodArgs.get(0).isSubtypeOf(expressionType.erasure()); }
@Override public boolean isSubtypeOf(String fullyQualifiedName) { return erasure().isSubtypeOf(fullyQualifiedName); }
private boolean verifySuperTypes(Type superType) { JavaType superclass = getSuperType(); return (superclass != null && superclass.isSubtypeOf(superType)) || symbol.getInterfaces().stream().map(si -> typeSubstitutionSolver.applySubstitution(si, this.typeSubstitution)).anyMatch(si -> si.isSubtypeOf(superType)); }
@Override public boolean isSubtypeOf(String fullyQualifiedName) { if (isTagged(ARRAY)) { return "java.lang.Object".equals(fullyQualifiedName) || (fullyQualifiedName.endsWith("[]") && ((ArrayJavaType) this).elementType.isSubtypeOf(fullyQualifiedName.substring(0, fullyQualifiedName.length() - 2))); } else if (isTagged(TYPEVAR)) { return erasure().isSubtypeOf(fullyQualifiedName); } return false; }
@Override public boolean isSubtypeOf(String fullyQualifiedName) { if (isTagged(ARRAY)) { return "java.lang.Object".equals(fullyQualifiedName) || (fullyQualifiedName.endsWith("[]") && ((ArrayJavaType) this).elementType.isSubtypeOf(fullyQualifiedName.substring(0, fullyQualifiedName.length() - 2))); } else if (isTagged(TYPEVAR)) { return erasure().isSubtypeOf(fullyQualifiedName); } return false; }
private boolean verifySuperTypes(Type superType) { JavaType superclass = getSuperType(); return (superclass != null && superclass.isSubtypeOf(superType)) || symbol.getInterfaces().stream().map(si -> typeSubstitutionSolver.applySubstitution(si, this.typeSubstitution)).anyMatch(si -> si.isSubtypeOf(superType)); }
private boolean isRedundantCast(JavaType cast, JavaType expressionType) { JavaType erasedExpressionType = expressionType; if(erasedExpressionType.isTagged(JavaType.TYPEVAR)) { erasedExpressionType = erasedExpressionType.erasure(); } return erasedExpressionType.equals(cast) || (!(cast instanceof JavaType.ParametrizedTypeJavaType) && !cast.isNumerical() && erasedExpressionType.isSubtypeOf(cast)); }
private static boolean subtypeOfTypeVar(JavaType arg, TypeVariableJavaType formal) { for (JavaType bound : formal.bounds()) { if ((bound.isTagged(JavaType.TYPEVAR) && !subtypeOfTypeVar(arg, (TypeVariableJavaType) bound)) || !arg.isSubtypeOf(bound)) { return false; } } return true; }
private static boolean subtypeOfTypeVar(JavaType arg, TypeVariableJavaType formal) { for (JavaType bound : formal.bounds()) { if ((bound.isTagged(JavaType.TYPEVAR) && !subtypeOfTypeVar(arg, (TypeVariableJavaType) bound)) || !arg.isSubtypeOf(bound)) { return false; } } return true; }
@Override public boolean isSubtypeOf(Type superType) { if (erasure().isSubtypeOf(superType.erasure())) { boolean superTypeIsParametrizedJavaType = superType instanceof ParametrizedTypeJavaType; if (superTypeIsParametrizedJavaType) { return checkSubstitutedTypesCompatibility((ParametrizedTypeJavaType) superType); } return !superTypeIsParametrizedJavaType; } return false; }
@Override public boolean isSubtypeOf(Type superType) { JavaType supType = (JavaType) superType; // Handle covariance of arrays. if (supType.isTagged(ARRAY)) { return elementType.isSubtypeOf(((ArrayType) supType).elementType()); } if (supType.isTagged(WILDCARD)) { return ((WildCardType) superType).isSubtypeOfBound(this); } // Only possibility to be supertype of array without being an array is to be Object. return "java.lang.Object".equals(supType.fullyQualifiedName()); }