private void addClass(Class<?> c) { if (classes.add(c)) { if (c.getSuperclass() != null) { addClass(c.getSuperclass()); } for (Class<?> sc : c.getInterfaces()) { addClass(sc); } for (Class<?> dc : c.getDeclaredClasses()) { addClass(dc); } for (Method m : c.getDeclaredMethods()) { addClass(m.getReturnType()); for (Class<?> p : m.getParameterTypes()) { addClass(p); } } if (c != void.class && dimensions(c) < 2) { Class<?> arrayClass = Array.newInstance(c, 0).getClass(); arrayClasses.put(c, arrayClass); addClass(arrayClass); } } }
public ResolvedJavaMethod lookupJavaMethod(Method reflectionMethod) { try { Class<?> holder = reflectionMethod.getDeclaringClass(); final int slot = reflectionMethodSlot.getInt(reflectionMethod); final long metaspaceMethod = runtime.getCompilerToVM().getMetaspaceMethod(holder, slot); return HotSpotResolvedJavaMethod.fromMetaspace(metaspaceMethod); } catch (IllegalArgumentException | IllegalAccessException e) { throw new GraalInternalError(e); } }