Beispiel #1
0
  /** List all class methods, including inherited and private. Inheritance duplicates cleared */
  public List<JaversMethod> getAllMethods() {
    List<JaversMethod> methods = new ArrayList<>();
    Set<Integer> added = new HashSet<>();
    TypeResolvingContext context = new TypeResolvingContext();

    Class clazz = methodSource;
    while (clazz != null) {
      context.addTypeSubstitutions(clazz);
      for (Method m : clazz.getDeclaredMethods()) {
        if (m.isBridge()) {
          continue;
        }
        int methodKey = methodKey(m);
        if (added.contains(methodKey)) {
          // System.out.println("filtered inheritance duplicate" +m);
          continue;
        }
        methods.add(createJMethod(m, context));
        added.add(methodKey);
      }
      clazz = clazz.getSuperclass();
    }

    return methods;
  }
Beispiel #2
0
 private JaversMethod createJMethod(Method rawMethod, TypeResolvingContext context) {
   Type actualReturnType = context.getSubstitution(rawMethod.getGenericReturnType());
   return new JaversMethod(rawMethod, actualReturnType);
 }