code: private static boolean isOverridable(Method method, Class<?> targetClass) {
          if (Modifier.isPrivate(method.getModifiers())) {
              return false;
          }
          if (Modifier.isPublic(method.getModifiers()) || Modifier.isProtected(method.getModifiers())) {
              return true;
          }
          return (targetClass == null ||
                  getPackageName(method.getDeclaringClass()).equals(getPackageName(targetClass)));
      }
docs: Determine whether the given method is overridable in the given target class.
  
  @param method      the method to check
  @param targetClass the target class to check against