public void test_isMoreSpecificThan_typeArguments_upperBound() { ClassElementImpl classS = classElement("A"); TypeParameterElementImpl typeParameterT = new TypeParameterElementImpl(identifier("T")); typeParameterT.setBound(classS.getType()); TypeParameterTypeImpl typeParameterTypeT = new TypeParameterTypeImpl(typeParameterT); // <T extends S> // T << S assertTrue(typeParameterTypeT.isMoreSpecificThan(classS.getType())); }
public void test_isMoreSpecificThan_typeArguments_transitivity_typeParameters() { ClassElementImpl classS = classElement("A"); TypeParameterElementImpl typeParameterU = new TypeParameterElementImpl(identifier("U")); typeParameterU.setBound(classS.getType()); TypeParameterTypeImpl typeParameterTypeU = new TypeParameterTypeImpl(typeParameterU); TypeParameterElementImpl typeParameterT = new TypeParameterElementImpl(identifier("T")); typeParameterT.setBound(typeParameterTypeU); TypeParameterTypeImpl typeParameterTypeT = new TypeParameterTypeImpl(typeParameterT); // <T extends U> and <U extends S> // T << S assertTrue(typeParameterTypeT.isMoreSpecificThan(classS.getType())); }