Пример #1
0
 @Override
 public boolean equals(Object obj) {
   if (obj instanceof WildcardType) {
     WildcardType that = (WildcardType) obj;
     return lowerBounds.equals(Arrays.asList(that.getLowerBounds()))
         && upperBounds.equals(Arrays.asList(that.getUpperBounds()));
   }
   return false;
 }
Пример #2
0
 @Override
 public boolean equals(Object obj) {
   if (NativeTypeVariableEquals.NATIVE_TYPE_VARIABLE_ONLY) {
     // equal only to our TypeVariable implementation with identical bounds
     if (obj != null
         && Proxy.isProxyClass(obj.getClass())
         && Proxy.getInvocationHandler(obj) instanceof TypeVariableInvocationHandler) {
       TypeVariableInvocationHandler typeVariableInvocationHandler =
           (TypeVariableInvocationHandler) Proxy.getInvocationHandler(obj);
       TypeVariableImpl<?> that = typeVariableInvocationHandler.typeVariableImpl;
       return name.equals(that.getName())
           && genericDeclaration.equals(that.getGenericDeclaration())
           && bounds.equals(that.bounds);
     }
     return false;
   } else {
     // equal to any TypeVariable implementation regardless of bounds
     if (obj instanceof TypeVariable) {
       TypeVariable<?> that = (TypeVariable<?>) obj;
       return name.equals(that.getName())
           && genericDeclaration.equals(that.getGenericDeclaration());
     }
     return false;
   }
 }