JavaMethodDesc functionalInterfaceMethod = null; collectPublicMethods(type, methodMap, staticMethodMap); collectPublicInstanceFields(type, fieldMap, inheritedPublicInaccessibleFields); collectPublicInstanceFields(type, fieldMap, true); for (Constructor<?> c : type.getConstructors()) { SingleMethodDesc overload = SingleMethodDesc.unreflect(c); ctor = ctor == null ? overload : merge(ctor, overload); String functionalInterfaceMethodName = findFunctionalInterfaceMethodName(type); if (functionalInterfaceMethodName != null) { functionalInterfaceMethod = methodMap.get(functionalInterfaceMethodName);
if (visited.add(methodInfo(m))) { putMethod(m, methodMap, staticMethodMap); collectPublicMethods(type.getSuperclass(), methodMap, staticMethodMap, visited, startType); collectPublicMethods(intf, methodMap, staticMethodMap, visited, startType);
private static String findFunctionalInterfaceMethodName(Class<?> clazz) { for (Class<?> iface : clazz.getInterfaces()) { if (Modifier.isPublic(iface.getModifiers()) && iface.isAnnotationPresent(FunctionalInterface.class)) { for (Method m : iface.getMethods()) { if (Modifier.isAbstract(m.getModifiers()) && !isObjectMethodOverride(m)) { return m.getName(); } } } } Class<?> superclass = clazz.getSuperclass(); if (superclass != null && superclass != Object.class) { return findFunctionalInterfaceMethodName(superclass); } return null; } }
private static void collectPublicMethods(Class<?> type, Map<String, JavaMethodDesc> methodMap, Map<String, JavaMethodDesc> staticMethodMap) { collectPublicMethods(type, methodMap, staticMethodMap, new HashSet<>(), type); }
@Override public JavaMethodDesc apply(JavaMethodDesc m1, JavaMethodDesc m2) { return merge(m1, m2); } };
private Members getMembers() { Members m = members; if (m == null) { CompilerDirectives.transferToInterpreterAndInvalidate(); synchronized (this) { m = members; if (m == null) { members = m = new Members(type); } } } return m; }