code: public static Method[] getAllMethods(Class<?> clazz) {
          Method[] allMethods = allClassMethodsCache.get(clazz);
          if (allMethods == null) {
              // Allows a race between concurrent threads coming for clazz's methods at the same time,
              // but the race seems to be harmless.
              allMethods = doGetAllMethods(clazz);
              allClassMethodsCache.put(clazz, allMethods);
          }
          return allMethods;
      }
docs: Get all methods in a class hierarchy! Both declared an non-declared (no
  duplicates).
  
  @param clazz The class whose methods to get.
  @return All methods declared in this class hierarchy.